Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit ab383527 authored by Nick Reuter's avatar Nick Reuter Committed by Michael Bestas
Browse files

sdk: Export receiver for health service

Fixes crash when enabling charging control on two-pane devices
eg. on tablets or foldables.

Change-Id: I5b4a8160cdb9bffc5c7d234cc5e1d7c650b92e18
parent 8ac2a98d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ public class ChargingControlController extends LineageHealthFeature {

    private void updateBatteryInfo() {
        IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
        Intent batteryStatus = mContext.registerReceiver(null, ifilter);
        Intent batteryStatus = mContext.registerReceiver(null, ifilter, Context.RECEIVER_EXPORTED);
        if (batteryStatus == null) {
            Log.e(TAG, "batteryStatus is NULL!");
            return;
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ public class ChargingControlNotification {
        // Register notification monitor
        IntentFilter notificationFilter = new IntentFilter(ACTION_CHARGING_CONTROL_CANCEL_ONCE);
        mContext.registerReceiver(new LineageHealthNotificationBroadcastReceiver(),
                notificationFilter);
                notificationFilter, Context.RECEIVER_EXPORTED);
    }

    public void post(int limit, boolean done) {
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ public class Toggle extends ChargingControlProvider {
        chgCtrlStage stage = mStage;

        IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
        Intent batteryStatus = mContext.registerReceiver(null, ifilter);
        Intent batteryStatus = mContext.registerReceiver(null, ifilter, Context.RECEIVER_EXPORTED);
        boolean plugged = batteryStatus.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1) != 0;

        if (startTime > currentTime && stage != chgCtrlStage.STAGE_CONTINUE) {