MuntashirAkon / BatteryChargeLimiter

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

App force closes in Android 12.1 #6

Closed solomonrajan closed 2 years ago

solomonrajan commented 2 years ago

While enabling the charge limit app force closes. I've attached the crash log:

time: 1658151047072 msg: java.lang.IllegalArgumentException: io.github.muntashirakon.bcl.debug: 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: io.github.muntashirakon.bcl.debug: 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$Companion.buildButtonPendingIntent(EnableWidget.kt:64) at io.github.muntashirakon.bcl.EnableWidget$Companion.updateWidget(EnableWidget.kt:50) at io.github.muntashirakon.bcl.activities.MainFragment.switchListener$lambda-6(MainFragment.kt:184) at io.github.muntashirakon.bcl.activities.MainFragment.$r8$lambda$GMmIIXh6R1Kv95aWsImFSbm4LRI(Unknown Source:0) at io.github.muntashirakon.bcl.activities.MainFragment$$ExternalSyntheticLambda3.onCheckedChanged(Unknown Source:2) at android.widget.CompoundButton.setChecked(CompoundButton.java:222) at androidx.appcompat.widget.SwitchCompat.setChecked(SwitchCompat.java:1071) at io.github.muntashirakon.bcl.activities.MainFragment.updateUi(MainFragment.kt:298) at io.github.muntashirakon.bcl.activities.MainFragment.onStart(MainFragment.kt:159) at androidx.fragment.app.Fragment.performStart(Fragment.java:3021) at androidx.fragment.app.FragmentStateManager.start(FragmentStateManager.java:589) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:300) at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647) at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128) at androidx.fragment.app.FragmentManager.dispatchStart(FragmentManager.java:3079) at androidx.fragment.app.FragmentController.dispatchStart(FragmentController.java:262) at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:510) at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:210) 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:550) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

AzzyC commented 2 years ago

BCL-Debug.txt

I am also on 12.1 (ArrowOS, alioth, Poco F3) The log is not based on the app from releases page, but the #debug4 build from GitHub actions

This is in case you wanted a full logcat -b all, when 'Enabling charge limit' and then it Force Closes

Also, selecting a different control file acts a bit funny, where 2 control files are selected, but all in good time things will fix

Thanks for continuing the development of this great app!!

MuntashirAkon commented 2 years ago

Fixed in cee9e2630af90ebea0082f339ba93e519299dda0