Open chenxiaolong opened 14 hours ago
Workarounds like https://github.com/zhanghai/MaterialFiles/commit/7a2b228dfef8e5080d4cc887208b1ac5458c160e and https://stackoverflow.com/a/78754376 do not work for WIU foreground services:
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): FATAL EXCEPTION: main
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): Process: com.chiller3.pixellight, PID: 21348
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): java.lang.SecurityException: Starting FGS with type camera callerApp=ProcessRecord{8e02e14 21348:com.chiller3.pixellight/u0a179} targetSDK=35 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_CAMERA] any of the permissions allOf=false [android.permission.CAMERA, android.permission.SYSTEM_CAMERA] and the app must be in the eligible state/exemptions to access the foreground only permission
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at android.os.Parcel.createExceptionOrNull(Parcel.java:3251)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at android.os.Parcel.createException(Parcel.java:3235)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at android.os.Parcel.readException(Parcel.java:3211)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at android.os.Parcel.readException(Parcel.java:3153)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7231)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at android.app.Service.startForeground(Service.java:879)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at com.chiller3.pixellight.ServiceHelper.setTorchBrightness(Unknown Source:348)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at com.chiller3.pixellight.TorchTileService$$ExternalSyntheticLambda1.onShow(Unknown Source:24)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at android.app.Dialog$ListenersHandler.handleMessage(Dialog.java:1500)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at android.os.Handler.dispatchMessage(Handler.java:107)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at android.os.Looper.loopOnce(Looper.java:232)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at android.os.Looper.loop(Looper.java:317)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at android.app.ActivityThread.main(ActivityThread.java:8736)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at java.lang.reflect.Method.invoke(Native Method)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at com.android.internal.os.ExecInit.main(ExecInit.java:50)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:369)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): Caused by: android.os.RemoteException: Remote stack trace:
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at com.android.server.am.ActiveServices.validateForegroundServiceType(ActiveServices.java:2905)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:2589)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1843)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:14178)
2024-10-17 00:44:34.878581 -0400 E/AndroidRuntime(21348): at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3609)
Starting the
TileService
as a foreground service at all is no longer allowed by default in Android 15:If battery optimizations are disabled, it makes it further, but hits the while-in-use foreground service restrictions:
I haven't been able to find a workaround. Looks like the loophole for having a nice quick settings UI for PixelLight will no longer work. There's no longer way to have the tile service access the camera.
Maybe I can implement some janky thing, like spawning an transparent activity that toggles the light and then exits. If that doesn't work, I'll just remove the quick settings tile completely. Either way, it'll no longer be possible to use PixelLight from the lock screen. Thanks, Google.