-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove confidence stream from android settings #8261
Merged
maloel
merged 2 commits into
IntelRealSense:development
from
Nir-Az:android_app_crash_on_multistream
Jan 31, 2021
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,8 @@ protected void onResume() { | |
_device = devices.createDevice(0); | ||
loadInfosList(); | ||
loadSettingsList(_device); | ||
StreamProfileSelector[] profilesList = createSettingList(_device); | ||
List<StreamProfileSelector> profilesList = createSettingList(_device); | ||
RemoveUnsupportedProfiles(profilesList); | ||
loadStreamList(_device, profilesList); | ||
return; | ||
} catch(Exception e){ | ||
|
@@ -299,11 +300,13 @@ public static Map<Integer, List<StreamProfile>> createProfilesMap(Device device) | |
return rv; | ||
} | ||
|
||
private void loadStreamList(Device device, StreamProfileSelector[] lines){ | ||
if(device == null || lines == null) | ||
private void loadStreamList(Device device, List<StreamProfileSelector> streamProfiles){ | ||
if(device == null || streamProfiles.size() == 0) | ||
return; | ||
if(!device.supportsInfo(CameraInfo.PRODUCT_ID)) | ||
throw new RuntimeException("try to config unknown device"); | ||
|
||
StreamProfileSelector[] lines = streamProfiles.toArray(new StreamProfileSelector[streamProfiles.size()]); | ||
final String pid = device.getInfo(CameraInfo.PRODUCT_ID); | ||
final StreamProfileAdapter adapter = new StreamProfileAdapter(this, lines, new StreamProfileAdapter.Listener() { | ||
@Override | ||
|
@@ -322,7 +325,7 @@ public void onCheckedChanged(StreamProfileSelector holder) { | |
adapter.notifyDataSetChanged(); | ||
} | ||
|
||
private StreamProfileSelector[] createSettingList(final Device device){ | ||
private List<StreamProfileSelector> createSettingList(final Device device){ | ||
Map<Integer, List<StreamProfile>> profilesMap = createProfilesMap(device); | ||
|
||
SharedPreferences sharedPref = getSharedPreferences(getString(R.string.app_settings), Context.MODE_PRIVATE); | ||
|
@@ -340,7 +343,24 @@ private StreamProfileSelector[] createSettingList(final Device device){ | |
|
||
Collections.sort(lines); | ||
|
||
return lines.toArray(new StreamProfileSelector[lines.size()]); | ||
return lines; | ||
} | ||
|
||
private void RemoveUnsupportedProfiles(List<StreamProfileSelector> streamProfiles){ | ||
|
||
// Entering Settings when all stream on (including confidence) result in an application crash. | ||
// as a workaround we remove confidence profile as it is not supported on display anyway. | ||
// See [RS5-8989] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove jira ticket reference from comment in code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
StreamProfileSelector confidenceProfile = null; | ||
for (StreamProfileSelector streamProfile : streamProfiles){ | ||
if (streamProfile.getProfile().getType() == StreamType.CONFIDENCE){ | ||
confidenceProfile = streamProfile; | ||
break; | ||
} | ||
} | ||
|
||
if (confidenceProfile != null) | ||
streamProfiles.remove(confidenceProfile); | ||
} | ||
|
||
void toggleFwLogging(){ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is not when entering the Settings Activity, when when we leave it and go back to Preview Activity.
I would have changed the comment as:
// Confidence steam format is RAW8, and it is not supported for display.
// Its removal is necessary until format RAW8 display is enabled.
Feel free to use this or rephrase it by yourself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this comment to right before line 356, too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even 362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it,
but when someone will read this comment 1 year from now and say hey, I can add support for raw8 and remove this patch, he will not know about the problem, he don't have a ticket to read, and no information on the comment.
And he will 99% won't test the flow that caused the issue.
Don't you guys think it's necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the ticket number is harmless -- but you're referring to the other comment, right?