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

Commit 6b26dfc7 authored by Pawit Pornkitprasan's avatar Pawit Pornkitprasan Committed by Ricardo Cerqueira
Browse files

PowerWidget: fix airplane mode toggle

Settings.System -> Settings.Global

Change-Id: Ic1a874ec694e76153d0838fdb81650fe384bae59
parent 2b1c3dc3
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ public class AirplaneButton extends PowerButton {

    private static final List<Uri> OBSERVED_URIS = new ArrayList<Uri>();
    static {
        OBSERVED_URIS.add(Settings.System.getUriFor(Settings.System.AIRPLANE_MODE_ON));
        OBSERVED_URIS.add(Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON));
    }

    public AirplaneButton() { mType = BUTTON_AIRPLANE; }
@@ -34,8 +34,8 @@ public class AirplaneButton extends PowerButton {
    @Override
    protected void toggleState(Context context) {
        boolean state = getState(context);
        Settings.System.putInt(context.getContentResolver(),
            Settings.System.AIRPLANE_MODE_ON, state ? 0 : 1);
        Settings.Global.putInt(context.getContentResolver(),
            Settings.Global.AIRPLANE_MODE_ON, state ? 0 : 1);
        // notify change
        Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
        // Reverse state when sending the intent, since we grabbed it before the toggle.
@@ -58,8 +58,8 @@ public class AirplaneButton extends PowerButton {
    }

    private boolean getState(Context context) {
        return Settings.System.getInt(context.getContentResolver(),
                 Settings.System.AIRPLANE_MODE_ON,0) == 1;
        return Settings.Global.getInt(context.getContentResolver(),
                 Settings.Global.AIRPLANE_MODE_ON,0) == 1;
    }
}