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

Unverified Commit b7b44232 authored by LuK1337's avatar LuK1337
Browse files

fixup! PowerShareTile: Migrate to AIDL PowerShare HAL

We ought to catch ServiceSpecificException too, otherwise SystemUI will
die if AIDL returns `ndk::ScopedAStatus::fromExceptionCode(...)`.

Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/8877
Change-Id: Ib03ac8810f5709a94b6576451b27e73412848748
parent a8f436b6
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceSpecificException;
import android.service.quicksettings.Tile;
import android.util.Log;

@@ -123,7 +124,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState>
        if (mBatteryController.isPowerSave()) {
            try {
                mPowerShare.setEnabled(false);
            } catch (RemoteException ex) {
            } catch (RemoteException | ServiceSpecificException ex) {
                ex.printStackTrace();
            }
        }
@@ -134,7 +135,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState>
            } else {
                mNotificationManager.cancel(NOTIFICATION_ID);
            }
        } catch (RemoteException ex) {
        } catch (RemoteException | ServiceSpecificException ex) {
            ex.printStackTrace();
        }
    }
@@ -156,7 +157,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState>
        try {
            mPowerShare.setEnabled(!mPowerShare.isEnabled());
            refreshState();
        } catch (RemoteException ex) {
        } catch (RemoteException | ServiceSpecificException ex) {
            ex.printStackTrace();
        }
    }
@@ -189,7 +190,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState>
        state.hasLongClickEffect = false;
        try {
            state.value = mPowerShare.isEnabled();
        } catch (RemoteException ex) {
        } catch (RemoteException | ServiceSpecificException ex) {
            state.value = false;
            ex.printStackTrace();
        }
@@ -228,7 +229,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState>
    private int getMinBatteryLevel() {
        try {
            return mPowerShare.getMinBattery();
        } catch (RemoteException ex) {
        } catch (RemoteException | ServiceSpecificException ex) {
            ex.printStackTrace();
        }