MuntashirAkon / BatteryChargeLimiter

Limit battery charging on Android
GNU General Public License v3.0
159 stars 15 forks source link

crash when enabling the BCL serivce - Android 12 #15

Closed Smojo closed 1 year ago

Smojo commented 1 year ago

I just tested it, as I still use Battery Charge Limit and was surprised that there is a new one (which forked it - which is good).

I'm using CalyxOS (v3.7.2 -> Android 12) on an Fairphone 4. When I hit the "Enable charge limit" radio button it directly crashes. (and now it is constantly crashing).

Here the details of the crash recorded via Scoop. Maybe it helps to fix it. For now I will go on using the old Battery Charge Limit as it still works basically.


FATAL EXCEPTION: main
Process: io.github.muntashirakon.bcl, PID: 13365
java.lang.IllegalArgumentException: io.github.muntashirakon.bcl: 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.getBroadcastAsUser(PendingIntent.java:645)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
at io.github.muntashirakon.bcl.EnableWidget.buildButtonPendingIntent(EnableWidget.kt:2)
at io.github.muntashirakon.bcl.EnableWidget.updateWidget(EnableWidget.kt:3)
at io.github.muntashirakon.bcl.activities.MainFragment$$ExternalSyntheticLambda3.onCheckedChanged(Unknown Source:21)
at android.widget.CompoundButton.setChecked(CompoundButton.java:222)
at androidx.appcompat.widget.SwitchCompat.setChecked(SwitchCompat.java:1)
at io.github.muntashirakon.bcl.activities.MainFragment.onStart(MainFragment.kt:3)
at androidx.fragment.app.FragmentStateManager.start(FragmentStateManager.java:8)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:11)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:73)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:5)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:22)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:1)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1471)
at android.app.Activity.performStart(Activity.java:8082)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3732)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253)
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:7870)
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)
MuntashirAkon commented 1 year ago

Duplicate of #6

MuntashirAkon commented 1 year ago

A fix has already been made. Wait for the next release.