judemanutd / AutoStarter

This library helps bring up the autostart permission manager of a phone to the user so they can add an app to autostart.
MIT License
626 stars 115 forks source link

OnePlus Android 11 fails to open ChainLaunchAppListActivity #67

Closed Ynnck123 closed 3 years ago

Ynnck123 commented 3 years ago

Hi, I tried the library on my One Plus 7 Pro with Android 11 (Oxygen OS 11.0.0.2GM21BA) installed.

The isAutoStartPermissionAvailable() succeeds but when I call getAutoStartPermission() I get the following stacktrace.

    android.content.ActivityNotFoundException: Unable to find explicit activity class {com.oneplus.security/com.oneplus.security.chainlaunch.view.ChainLaunchAppListActivity}; have you declared this activity in your AndroidManifest.xml?
        at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2256)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1914)
        at android.app.Activity.startActivityForResult(Activity.java:5326)
        at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:574)
        at android.app.Activity.startActivityForResult(Activity.java:5284)
        at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:560)
        at android.app.Activity.startActivity(Activity.java:5670)
        at android.app.Activity.startActivity(Activity.java:5623)
        at com.judemanutd.autostarter.AutoStartPermissionHelper.startIntent(AutoStartPermissionHelper.kt:325)
        at com.judemanutd.autostarter.AutoStartPermissionHelper.autoStartOnePlus(AutoStartPermissionHelper.kt:308)
        at com.judemanutd.autostarter.AutoStartPermissionHelper.getAutoStartPermission(AutoStartPermissionHelper.kt:118)

I already tried to add the package to the query element in the AndroidManifest

<queries>
        <package android:name="com.oneplus.security.chainlaunch.view.ChainLaunchAppListActivity" />
</queries>

and even tried the prohibited "query all packages permission" <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>

But both results in the same stacktrace. Any ideas on this?

Edit: I think there is just the overall battery optimization settings on this specific phone and no option for auto-start settings; but it's confusing that the isAutoStartPermissionAvailable() returns true

judemanutd commented 3 years ago

This should be resolved by https://github.com/judemanutd/AutoStarter/pull/69 but feel free to open this issue back up in case it does not