Repository navigation
feat(android): camera layer keeps working in the floating window - #1098
Merged
Merged
Conversation
With only the floating window on screen the app is in the background, and Android hands the camera to a background app only with a camera foreground service: a camera reopened there gave no frames (measured, currentTime stayed 0). CameraService (type camera) now starts with the floating window while the app is still in front, only when the scene has an enabled camera layer and the permission is granted, and stops when the window closes or the app comes back. Notification says the camera is in use. Probe floatcam. For #1054 Co-authored-by: caganturgut <[email protected]>
…-floating # Conflicts: # docs/android/PLAN.tr.md
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Known limit from #1085: the camera layer only worked while the app was in front.
Cause (measured on the emulator): with only the floating window on screen the app is a background app. A camera opened before keeps streaming, but a camera reopened there (retry, scene recall, settings change) gives no frames:
currentTimestayed 0.Fix:
media/CameraService.kt, a foreground service of typecamera(+FOREGROUND_SERVICE_CAMERA). It starts infloatingOpenwhile the app is still in front (Android allows camera FGS only then), only if the scene has an enabled camera layer (SVAndroid.floating.opensendscamera: true) and the camera permission is granted. It stops onfloatingCloseand when the app comes back. Low-importance notification: "The visualizer is using the camera" (TR/EN).Checked with
node android/tools/probe.js floatcam(exit 0): service up while floating, camera reopened in the floating window streams (480 px, time advances), service gone after closing. Control run withcamera: false: the reopened camera stays atcurrentTime0.Also updates the PLAN status lines.
For #1054