Status Update
Comments
rk...@google.com <rk...@google.com> #2
Thank you for reporting this issue. Please upload the AOSP patch following this guidance
dp...@glance.net <dp...@glance.net> #3
Change-Id: I9594ce3d2276127d2a585b9c630b672c857bede7
rk...@google.com <rk...@google.com> #4
We have shared this with our product and engineering team and will update this issue with more information as it becomes available.
dp...@glance.net <dp...@glance.net> #5
am...@google.com <am...@google.com> #6
I'm on the Android SDK team -- we are responsible for tracking and finalizing the API surfaces, not the implementation that backs up those APIs. I suggest you reach out to whoever has been working on the implementation of onActivityResult.
rk...@google.com <rk...@google.com> #7
I work in Android Studio Emulator. We implement hardware. We know nothing about SDK.
mi...@google.com <mi...@google.com>
ma...@google.com <ma...@google.com>
ca...@google.com <ca...@google.com> #8
Can you please share some sample code including the manifest, or even better if you share a sample app reproducing the issue ?
dp...@glance.net <dp...@glance.net> #9
This is permissions declaration:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
This is service Declaration
<service
android:name="net.glance.android.GlanceMediaProjectionService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="mediaProjection" />
The onActivity result is as follows:
// Give Glance permission to capture the screen
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean {
if (requestCode == HostSession.REQUEST_SCREEN_SHARE && Glance.isInSession()) {
if (resultCode == -1) {
Glance.onCaptureScreenPermissionSuccess(data)
return true
} else if (resultCode == 0) {
Glance.onCaptureScreenPermissionFailure()
return true
}
}
return false
}
After requesting the permission, the result of onActivityResult will be 0 instead of -1 as expected. When the code is run on other platforms it returns -1, only with the ext14 does it return 0.
ma...@google.com <ma...@google.com> #10
Can you share a full output of logcat and/or a bugreport after the issue occurs? When are you attempting to start the GlanceMediaProjectionService
?
dp...@glance.net <dp...@glance.net> #11
Process: com...mobile.develop, PID: 2717
java.lang.RuntimeException: Unable to start service net.glance.android.GlanceMediaProjectionService@9c9f987 with Intent { cmp=com.....mobile.develop/net.glance.android.GlanceMediaProjectionService }: java.lang.SecurityException: Starting FGS with type mediaProjection callerApp=ProcessRecord{2e5ad35 2717:com.....mobile.develop/u0a208} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION] any of the permissions allOf=false [android.permission.CAPTURE_VIDEO_OUTPUT, android:project_media]
This is the only error that is showing up in the logs.
dp...@glance.net <dp...@glance.net> #12
{null m=CLOSE f=TRANSLUCENT|FILLS_TASK leash=Surface(name=ActivityRecord{3fc51fb u0 com.android.systemui/.mediaprojection.appselector.MediaProjectionAppSelectorActivity)/@0x3bd6160 sb=Rect(0, 0 - 1080, 2400) eb=Rect(0, 0 - 1080, 2400) epz=Point(1080, 2400) d=0 bc=ff202018 component=com.android.systemui/.mediaprojection.appselector.MediaProjectionAppSelectorActivity opt={t=FROM_STYLE mUserId=0}}
]}
2025-01-19 07:17:31.986 2170-2170 GRIL-S com.google.android.grilservice D [14241]> UPDATE_DEVICE_STATE DeviceState: Usb:1, Wifi: 0, Wifi AP: 0, Earpiece: 0, Bluetooth: 1, Wireless charging: 0, Screen: 1, Camera: 0, 0, -, -, Motion: 1, Bluetooth tethering: 0, Voice: 0, Wifi 2.4G: 0, Radio: 1, Bluetooth connected: 0, Bluetooth media: 0, Wifi Band: 0, Wifi AP Band: 0, Wifi call: 0, mmWave: 0, mCellBackhaul: 0, mHallSensor: 0, mDozeStatus: 1, mAppClassInfo: 0, mWifiCapSensorStatus: 0, mCellCapSensorStatus: 0, mBesideHeadHandStatus: 0, mSpeakerStatus: 0, mProtectiveCaseStatus: 0
2025-01-19 07:17:32.201 1967-1967 VRI[MediaP...rActivity] com.android.systemui D visibilityChanged oldVisibility=true newVisibility=false
2025-01-19 07:17:32.215 1536-2022 CoreBackPreview system_server D Window{993b148 u0 com.android.systemui/com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorActivity}: Setting back callback null
ma...@google.com <ma...@google.com> #13
This error typically occurs when another Exception / crash occurs which can result in issues with the foreground service. As mentioned in adb logcat
or a full bugreport adb bugreport
?
Description
I have set all the permissions properly in the Android manifest file and am starting the service up following documentation. I only have this issue with API 35 ( Extension Level 14), all other images properly return back a 0. I also see this issue on devices running extensions, but not on other devices running different OSes.
I am not clear why this particular image would behave differently when asking for media projection permissions and have found no documentation suggesting that it would. Any help in this matter would be greatly appreciated.