-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[camera] android-rework part 5: Android FPS range, resolution and sensor orientation features #3799
[camera] android-rework part 5: Android FPS range, resolution and sensor orientation features #3799
Conversation
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
Co-authored-by: Andrew Coutts <[email protected]>
Co-authored-by: Andrew Coutts <[email protected]>
a8f0e9f
to
1ba738d
Compare
…s_resolution_sensor_features
...amera/android/src/main/java/io/flutter/plugins/camera/features/fpsrange/FpsRangeFeature.java
Show resolved
Hide resolved
} | ||
} catch (Exception e) { | ||
// TODO: maybe just send a dart error back | ||
// pictureCaptureRequest.error("cameraAccess", e.getMessage(), null); |
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.
Why is this a TODO? It seems like having some kind of error handling is important here, whether that's reporting it back, or setting a default if that would make more sense.
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.
After some refactoring the need for error handling is removed. I have removed the obsolete try...catch
statement.
|
||
verify(mockBuilder).set(eq(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE), any(Range.class)); | ||
} | ||
|
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 error codepath, whatever handling ends up going there, should be tested as well.
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.
Has become obsolete
|
||
public static CamcorderProfile getBestAvailableCamcorderProfileForResolutionPreset( | ||
String cameraName, ResolutionPreset preset) { | ||
int cameraId = Integer.parseInt(cameraName); |
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.
If what's actually needed is an integer ID, why does the method take a string?
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.
Refactored the code to only accept an integer.
angle = 270; | ||
break; | ||
} | ||
if (isFrontFacing) angle *= -1; |
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.
Braces
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.
Done.
} | ||
|
||
private void startUIListener() { | ||
if (broadcastReceiver != null) return; |
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.
Braces
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.
Done.
} | ||
|
||
private void stopSensorListener() { | ||
if (orientationEventListener == null) return; |
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.
Braces
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.
Done.
} | ||
|
||
private void stopUIListener() { | ||
if (broadcastReceiver == null) return; |
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.
Braces
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.
Done.
} | ||
|
||
public void start() { | ||
startSensorListener(); |
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.
Could you add a comment here explaining why we listen to both? It's not clear to me why we need to compute the orientation two different ways. Is it a case of needing a fallback if one isn't available?
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.
Done.
private Display getDisplay() { | ||
return ((WindowManager) activity.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); | ||
} | ||
} |
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.
This class has a lot of non-trivial logic, but no tests.
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.
Done.
@stuartmorgan thank you for reviewing this PR, I have processed all feedback and would appreciate it if you could have another look. |
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.
Looking good, just some small things
...amera/android/src/main/java/io/flutter/plugins/camera/features/fpsrange/FpsRangeFeature.java
Outdated
Show resolved
Hide resolved
...amera/android/src/main/java/io/flutter/plugins/camera/features/fpsrange/FpsRangeFeature.java
Outdated
Show resolved
Hide resolved
...a/android/src/main/java/io/flutter/plugins/camera/features/resolution/ResolutionFeature.java
Outdated
Show resolved
Hide resolved
...a/android/src/main/java/io/flutter/plugins/camera/features/resolution/ResolutionFeature.java
Outdated
Show resolved
Hide resolved
...a/android/src/main/java/io/flutter/plugins/camera/features/resolution/ResolutionFeature.java
Show resolved
Hide resolved
...main/java/io/flutter/plugins/camera/features/sensororientation/DeviceOrientationManager.java
Outdated
Show resolved
Hide resolved
@stuartmorgan I have processed your feedback and would appreciate it if you can have another look. Also I am not sure why the |
You landed another co-authored commit after #3799 (comment), maybe it needs another consent message? I'm not sure exactly how that check is implemented internally. |
...a/android/src/main/java/io/flutter/plugins/camera/features/resolution/ResolutionFeature.java
Show resolved
Hide resolved
...a/android/src/main/java/io/flutter/plugins/camera/features/resolution/ResolutionFeature.java
Show resolved
Hide resolved
...a/android/src/main/java/io/flutter/plugins/camera/features/resolution/ResolutionFeature.java
Outdated
Show resolved
Hide resolved
Strange after pushing the changes you requested (removed the obsolete comment) the CLA is happy again. Anyway would appreciate it if you could have another look. |
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.
LGTM
… and sensor orientation features (flutter/plugins#3799)
… and sensor orientation features (flutter/plugins#3799)
… and sensor orientation features (flutter/plugins#3799)
…sor orientation features (flutter#3799)
…sor orientation features (flutter#3799)
Adds FPS range, resolution and sensor orientation features containing the implementation to handle FPS range, resolution and sensor orientation via the Android Camera2 API.
This is the fifth PR in a series of pull-requests which will gradually introduce changes from PR #3651, making it easier to review the code (as discussed with @stuartmorgan).
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
[shared_preferences]
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.