This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[camera] android-rework part 5: Android FPS range, resolution and sensor orientation features #3799
Merged
fluttergithubbot
merged 26 commits into
flutter:master
from
Baseflow:camera-android/fps_resolution_sensor_features
Jun 22, 2021
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
2b7aa9b
Base classes to support Android camera features
mvanbeusekom f780742
Fixed formatting
mvanbeusekom 76bc5bd
Applied feedback from PR
mvanbeusekom 0bbed99
Added Android FPS range, resolution and sensor orientation features
mvanbeusekom 1ba738d
Use mockito-inline
mvanbeusekom de4e70f
Merge remote-tracking branch 'upstream/master' into camera-android/fp…
mvanbeusekom 728346a
Fix issue Pixel 4A
mvanbeusekom c014fe3
Merge remote-tracking branch 'upstream/master' into camera-android/fp…
mvanbeusekom 84f5e73
Added API documentation
mvanbeusekom f763f77
Processed feedback on PR
mvanbeusekom 4a7c73a
Fix formatting
mvanbeusekom a890919
Fix formatting
mvanbeusekom 55a6702
Only exclude 60 FPS limit for Pixel 4a
mvanbeusekom cd53321
Removed redundant empty line
mvanbeusekom 35831d3
Fixed comment
mvanbeusekom a9f3142
Test Pixel 4a workaround
mvanbeusekom 551800e
Add tests for orientation updates
mvanbeusekom 68cbc56
Fix formatting
mvanbeusekom 1b137c2
Fix formatting
mvanbeusekom 6514a00
Added missing license header
mvanbeusekom 7f0180e
Accept cameraName as String
mvanbeusekom 24af367
Format
mvanbeusekom 8313dd0
Removed obsolete comment
mvanbeusekom a39c2e1
update method structure in class to a more logical order
mvanbeusekom 3eecfe9
Merge remote-tracking branch 'origin/master' into camera-android/fps_…
mvanbeusekom 7299b1d
Fix formatting
mvanbeusekom 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
Added API documentation
- Loading branch information
commit 84f5e73e635d3a83210a46190321a1bc81c2f0ef
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -20,6 +20,10 @@ | |
| import io.flutter.embedding.engine.systemchannels.PlatformChannel; | ||
| import io.flutter.plugins.camera.DartMessenger; | ||
|
|
||
| /** | ||
| * Support class to help to determine the media orientation based on the orientation of the | ||
| * device. | ||
| */ | ||
| public class DeviceOrientationManager { | ||
|
|
||
| private static final IntentFilter orientationIntentFilter = | ||
|
|
@@ -53,20 +57,61 @@ private DeviceOrientationManager( | |
| this.sensorOrientation = sensorOrientation; | ||
| } | ||
|
|
||
| /** | ||
| * Starts listening to the device's sensors and UI for orientation updates. | ||
| * | ||
| * When either the sensor or UI listeners indicate the orientation has changed the updated | ||
| * orientation is send to the client using the {@link DartMessenger}. | ||
| */ | ||
| public void start() { | ||
| startSensorListener(); | ||
|
Contributor
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. 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?
Contributor
Author
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. Done. |
||
| startUIListener(); | ||
| } | ||
|
|
||
| /** | ||
| * Stops listening for orientation updates. | ||
| */ | ||
| public void stop() { | ||
| stopSensorListener(); | ||
| stopUIListener(); | ||
| } | ||
|
|
||
| /** | ||
| * Returns the last captured orientation in degrees based on sensor or UI information. | ||
| * | ||
| * The orientation is returned in degrees and could be one of the following values: | ||
| * <p> | ||
| * <ul> | ||
| * <li>0: Indicates the device is currently in portrait.</li> | ||
| * <li>90: Indicates the device is currently in landscape left.</li> | ||
| * <li>180: Indicates the device is currently in portrait down.</li> | ||
| * <li>270: Indicates the device is currently in landscape right.</li> | ||
| * </ul> | ||
| * </p> | ||
| * | ||
| * @return The last captured orientation in degrees | ||
| */ | ||
| public int getMediaOrientation() { | ||
| return this.getMediaOrientation(this.lastOrientation); | ||
| } | ||
|
|
||
| /** | ||
| * Returns the device's orientation in degrees based on the supplied {@link | ||
| * PlatformChannel.DeviceOrientation} value. | ||
| * | ||
| * <p> | ||
| * | ||
| * <ul> | ||
| * <li>PORTRAIT_UP: converts to 0 degrees.</li> | ||
| * <li>LANDSCAPE_LEFT: converts to 90 degrees.</li> | ||
| * <li>PORTRAIT_DOWN: converts to 180 degrees.</li> | ||
| * <li>LANDSCAPE_RIGHT: converts to 270 degrees.</li> | ||
| * </ul> | ||
| * | ||
| * @param orientation The {@link PlatformChannel.DeviceOrientation} value that is to be converted | ||
| * into degrees. | ||
| * @return The device's orientation in degrees. | ||
| */ | ||
| public int getMediaOrientation(PlatformChannel.DeviceOrientation orientation) { | ||
| int angle = 0; | ||
|
|
||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.