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

Skip to content
Commits on Source (2)
...@@ -124,7 +124,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState> ...@@ -124,7 +124,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState>
if (mBatteryController.isPowerSave()) { if (mBatteryController.isPowerSave()) {
try { try {
mPowerShare.setEnabled(false); mPowerShare.setEnabled(false);
} catch (RemoteException | ServiceSpecificException ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
} }
...@@ -135,14 +135,20 @@ public class PowerShareTile extends QSTileImpl<BooleanState> ...@@ -135,14 +135,20 @@ public class PowerShareTile extends QSTileImpl<BooleanState>
} else { } else {
mNotificationManager.cancel(NOTIFICATION_ID); mNotificationManager.cancel(NOTIFICATION_ID);
} }
} catch (RemoteException | ServiceSpecificException ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
} }
@Override @Override
public boolean isAvailable() { public boolean isAvailable() {
return mPowerShare != null; try {
// Will throw NPE or some other exception if HAL is either missing or broken.
mPowerShare.isEnabled();
return true;
} catch (Exception ex) {
return false;
}
} }
@Override @Override
...@@ -157,7 +163,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState> ...@@ -157,7 +163,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState>
try { try {
mPowerShare.setEnabled(!mPowerShare.isEnabled()); mPowerShare.setEnabled(!mPowerShare.isEnabled());
refreshState(); refreshState();
} catch (RemoteException | ServiceSpecificException ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
} }
...@@ -190,7 +196,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState> ...@@ -190,7 +196,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState>
state.hasLongClickEffect = false; state.hasLongClickEffect = false;
try { try {
state.value = mPowerShare.isEnabled(); state.value = mPowerShare.isEnabled();
} catch (RemoteException | ServiceSpecificException ex) { } catch (Exception ex) {
state.value = false; state.value = false;
ex.printStackTrace(); ex.printStackTrace();
} }
...@@ -229,7 +235,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState> ...@@ -229,7 +235,7 @@ public class PowerShareTile extends QSTileImpl<BooleanState>
private int getMinBatteryLevel() { private int getMinBatteryLevel() {
try { try {
return mPowerShare.getMinBattery(); return mPowerShare.getMinBattery();
} catch (RemoteException | ServiceSpecificException ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
......