JonasBernard / FakeStandby

An Android app for turning the screen off while keeping apps running.
https://fakestandby.jonasbernard.de
GNU General Public License v3.0
424 stars 27 forks source link

Android 13: Accessibility Service - "This service is malfunctioning" [BUG] #46

Closed AyoungDukie closed 1 year ago

AyoungDukie commented 2 years ago

Describe the bug Using version 1.3.4 on Android 13 (Pixel 4a), attempting to start fake standby fails (as though a permission is missing), however everything was enabled. Under the Android Accessibility Settings page, FakeStandby is noted with a subheading of "Not working. Tap for more info." Which reveals the following screen:

Screenshot_20220920-233022

To Reproduce Occurs both on fresh installs and on upgrades from previous app versions. Does not occur on an install of 1.3.3

Disabling/reenabling the service did not address, nor does clearing app data or reinstalling.

Device information:

pythonmcpi commented 2 years ago

Can confirm. I'm also using a Pixel 4a with Android 13 and 1.3.4 does not work. However, downgrading to 1.3.3 works fine

KrasnayaPloshchad commented 2 years ago

Me too.

SituChengxiang commented 2 years ago

So do I, the old version do not have the problem.

jul13579 commented 2 years ago

Since I think nobody has posted a StackTrace of the error yet, I'm leaving this one here in the hope it helps fixing the problem:

java.lang.IllegalArgumentException: android.jonas.fakestandby: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. stacktrace: java.lang.IllegalArgumentException: android.jonas.fakestandby: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. at android.app.PendingIntent.checkFlags(PendingIntent.java:375) at android.app.PendingIntent.buildServicePendingIntent(PendingIntent.java:724) at android.app.PendingIntent.getService(PendingIntent.java:686) at a.a.(Unknown Source:21) at android.jonas.fakestandby.service.AccessibilityOverlayService.onServiceConnected(SourceFile:2) at android.accessibilityservice.AccessibilityService.dispatchServiceConnected(AccessibilityService.java:768) at android.accessibilityservice.AccessibilityService.access$200(AccessibilityService.java:240) at android.accessibilityservice.AccessibilityService$2.onServiceConnected(AccessibilityService.java:2171) at android.accessibilityservice.AccessibilityService$IAccessibilityServiceClientWrapper.executeMessage(AccessibilityService.java:2417) at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:44) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7876) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

I also think this issue is a duplicate of #45.

Device information:

JonasBernard commented 2 years ago

Thank you so much. This seems helpful.

lothkang commented 1 year ago

Same here.

Device: Xiaomi 12 Lite (model 22031)
OS: MIUI v14.0.3(TLIMIXM)
Android version: Android 13 TKQ1.220807.001
Security patch: 2023-01-01
App version: v1.3.5
JonasBernard commented 1 year ago

Did the issue go away for any of you using the new version 1.3.5? @AyoungDukie @pythonmcpi @KrasnayaPloshchad @SituChengxiang @jul13579 @lothkang

AyoungDukie commented 1 year ago

This issue seems initially fixed after upgrade, however the first invokation crashes FakeStandby, and this message re-appears in the settings. Reverting to 1.3.3 still seems to be the workaround for now.

jul13579 commented 1 year ago

For me the situation is the same as for @AyoungDukie. CrDroid gives me this StackTrace now:

java.lang.SecurityException: Remote stack trace:
    at com.android.server.wm.ActivityTaskManagerService.checkCanCloseSystemDialogs(ActivityTaskManagerService.java:3073)
    at com.android.server.wm.ActivityTaskManagerService.access$1100(ActivityTaskManagerService.java:300)
    at com.android.server.wm.ActivityTaskManagerService$LocalService.checkCanCloseSystemDialogs(ActivityTaskManagerService.java:5569)
    at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:13255)
    at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:12823)

stacktrace: java.lang.RuntimeException: Unable to start service android.jonas.fakestandby.service.AccessibilityOverlayService@fda1aed with Intent { cmp=android.jonas.fakestandby/.service.AccessibilityOverlayService (has extras) }: java.lang.SecurityException: Permission Denial: android.intent.action.CLOSE_SYSTEM_DIALOGS broadcast from android.jonas.fakestandby (pid=7235, uid=10292) requires android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS.
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4724)
    at android.app.ActivityThread.access$2000(ActivityThread.java:256)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2129)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7876)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.SecurityException: Permission Denial: android.intent.action.CLOSE_SYSTEM_DIALOGS broadcast from android.jonas.fakestandby (pid=7235, uid=10292) requires android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS.
    at android.os.Parcel.createExceptionOrNull(Parcel.java:2426)
    at android.os.Parcel.createException(Parcel.java:2410)
    at android.os.Parcel.readException(Parcel.java:2393)
    at android.os.Parcel.readException(Parcel.java:2335)
    at android.app.IActivityManager$Stub$Proxy.broadcastIntentWithFeature(IActivityManager.java:5767)
    at android.app.ContextImpl.sendBroadcast(ContextImpl.java:1185)
    at android.content.ContextWrapper.sendBroadcast(ContextWrapper.java:479)
    at android.jonas.fakestandby.service.AccessibilityOverlayService.g(SourceFile:4)
    at android.jonas.fakestandby.service.AccessibilityOverlayService.onStartCommand(SourceFile:7)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4706)
    ... 9 more
Caused by: android.os.RemoteException: Remote stack trace:
    at com.android.server.wm.ActivityTaskManagerService.checkCanCloseSystemDialogs(ActivityTaskManagerService.java:3073)
    at com.android.server.wm.ActivityTaskManagerService.access$1100(ActivityTaskManagerService.java:300)
    at com.android.server.wm.ActivityTaskManagerService$LocalService.checkCanCloseSystemDialogs(ActivityTaskManagerService.java:5569)
    at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:13255)
    at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:12823)
jul13579 commented 1 year ago

@JonasBernard the latest update (1.4.0) fixed all issues for me, thank you so much!

SituChengxiang commented 1 year ago

v1.4.0 seem to fix the bug, thank you. Sorry for replying so late, I'm too busy with my studies. @JonasBernard

JonasBernard commented 1 year ago

v1.4.0 seem to fix the bug, thank you. Sorry for replying so late, I'm too busy with my studies. @JonasBernard

No problem. I have the same problem with being busy with studies. Thanks for the reply anyway.

AyoungDukie commented 1 year ago

Just want to chime back in here, 1.4.0, things are working now! I also apologize for not checking back on this sooner, I will go ahead and close the issue since others also seem to have this working now!