MuntashirAkon / BatteryChargeLimiter

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

Crashing when enabling charge limit #9

Closed assembleDebug closed 2 years ago

assembleDebug commented 2 years ago

App just crashes when toggling "Enable charge limit"

Device- Redmi note 10 Pro , running Android 12L


Process: io.github.muntashirakon.bcl
PID: 13024
UID: 10263
Flags: 0x30c83e44
Package: io.github.muntashirakon.bcl v26 (1.0.0)
Foreground: Yes
Process-Runtime: 25540829
Build: Redmi/sweetin/sweetin:12/SKQ1.210908.001/V13.0.4.0.SKFINXM:user/release-keys
Loading-Progress: 1.0

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 androidx.appcompat.widget.SwitchCompat.toggle(SwitchCompat.java:1)
    at android.widget.CompoundButton.performClick(CompoundButton.java:144)
    at android.view.View.performClickInternal(View.java:7432)
    at android.view.View.access$3700(View.java:835)
    at android.view.View$PerformClick.run(View.java:28811)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7877)
    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
```)
assembleDebug commented 2 years ago

Seems like the issue has been fixed in debug build already.