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

Commit ee18f9f8 authored by Matthew Fritze's avatar Matthew Fritze Committed by android-build-merger
Browse files

Merge "Add default value to inline payloads" into oc-dr1-dev

am: 5aca5f3a

Change-Id: Iabc71663e942b453e8125bc19401adccc06e85a3
parents 3db8c874 5aca5f3a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ public class AmbientDisplayAlwaysOnPreferenceController extends PreferenceContro
                mContext.getString(R.string.ambient_display_screen_title));

        return new InlineSwitchPayload(Settings.Secure.DOZE_ALWAYS_ON,
                ResultPayload.SettingsSource.SECURE, ON, intent, isAvailable());
                ResultPayload.SettingsSource.SECURE, ON /* onValue */, intent, isAvailable(),
                ON /* defaultValue */);
    }
}
+10 −7
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@ public class AutoBrightnessPreferenceController extends PreferenceController imp

    private final String mAutoBrightnessKey;

    private final String SYSTEM_KEY = SCREEN_BRIGHTNESS_MODE;
    private final int DEFAULT_VALUE = SCREEN_BRIGHTNESS_MODE_MANUAL;

    public AutoBrightnessPreferenceController(Context context, String key) {
        super(context);
        mAutoBrightnessKey = key;
@@ -55,15 +58,15 @@ public class AutoBrightnessPreferenceController extends PreferenceController imp
    @Override
    public void updateState(Preference preference) {
        int brightnessMode = Settings.System.getInt(mContext.getContentResolver(),
                SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_MANUAL);
        ((SwitchPreference) preference).setChecked(brightnessMode != SCREEN_BRIGHTNESS_MODE_MANUAL);
                SYSTEM_KEY, DEFAULT_VALUE);
        ((SwitchPreference) preference).setChecked(brightnessMode != DEFAULT_VALUE);
    }

    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        boolean auto = (Boolean) newValue;
        Settings.System.putInt(mContext.getContentResolver(), SCREEN_BRIGHTNESS_MODE,
                auto ? SCREEN_BRIGHTNESS_MODE_AUTOMATIC : SCREEN_BRIGHTNESS_MODE_MANUAL);
        Settings.System.putInt(mContext.getContentResolver(), SYSTEM_KEY,
                auto ? SCREEN_BRIGHTNESS_MODE_AUTOMATIC : DEFAULT_VALUE);
        return true;
    }

@@ -73,8 +76,8 @@ public class AutoBrightnessPreferenceController extends PreferenceController imp
                DisplaySettings.class.getName(), mAutoBrightnessKey,
                mContext.getString(R.string.display_settings));

        return new InlineSwitchPayload(SCREEN_BRIGHTNESS_MODE,
        return new InlineSwitchPayload(SYSTEM_KEY,
                ResultPayload.SettingsSource.SYSTEM, SCREEN_BRIGHTNESS_MODE_AUTOMATIC, intent,
                isAvailable());
                isAvailable(), DEFAULT_VALUE);
    }
}
 No newline at end of file
+8 −5
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ import com.android.settings.search.ResultPayload;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.events.OnResume;

import static android.provider.Settings.Secure.ASSIST_GESTURE_ENABLED;

public class AssistGesturePreferenceController extends GesturePreferenceController
        implements OnResume {

@@ -41,6 +43,8 @@ public class AssistGesturePreferenceController extends GesturePreferenceControll
    private static final String PREF_KEY_VIDEO = "gesture_assist_video";
    private final String mAssistGesturePrefKey;

    private final String SECURE_KEY = ASSIST_GESTURE_ENABLED;

    private final AssistGestureFeatureProvider mFeatureProvider;
    private boolean mWasAvailable;

@@ -142,8 +146,7 @@ public class AssistGesturePreferenceController extends GesturePreferenceControll
    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        final boolean enabled = (boolean) newValue;
        Settings.Secure.putInt(mContext.getContentResolver(),
                Settings.Secure.ASSIST_GESTURE_ENABLED, enabled ? ON : OFF);
        Settings.Secure.putInt(mContext.getContentResolver(), SECURE_KEY, enabled ? ON : OFF);
        updateState(preference);
        return true;
    }
@@ -161,7 +164,7 @@ public class AssistGesturePreferenceController extends GesturePreferenceControll
    @Override
    protected boolean isSwitchPrefEnabled() {
        final int assistGestureEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
                Settings.Secure.ASSIST_GESTURE_ENABLED, 1);
                SECURE_KEY, ON);
        return assistGestureEnabled != 0;
    }

@@ -171,7 +174,7 @@ public class AssistGesturePreferenceController extends GesturePreferenceControll
                AssistGestureSettings.class.getName(), mAssistGesturePrefKey,
                mContext.getString(R.string.display_settings));

        return new InlineSwitchPayload(Settings.Secure.ASSIST_GESTURE_ENABLED,
                ResultPayload.SettingsSource.SECURE, ON, intent, isAvailable());
        return new InlineSwitchPayload(SECURE_KEY, ResultPayload.SettingsSource.SECURE,
                ON /* onValue */, intent, isAvailable(), ON /* defaultValue */);
    }
}
+8 −7
Original line number Diff line number Diff line
@@ -22,14 +22,14 @@ import android.content.SharedPreferences;
import android.provider.Settings;
import android.support.v7.preference.Preference;

import com.android.settings.DisplaySettings;
import com.android.settings.R;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.DatabaseIndexingUtils;
import com.android.settings.search.InlineSwitchPayload;
import com.android.settings.search.ResultPayload;
import com.android.settingslib.core.lifecycle.Lifecycle;

import static android.provider.Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED;

public class DoubleTapPowerPreferenceController extends GesturePreferenceController {

    private final int ON = 0;
@@ -38,6 +38,8 @@ public class DoubleTapPowerPreferenceController extends GesturePreferenceControl
    private static final String PREF_KEY_VIDEO = "gesture_double_tap_power_video";
    private final String mDoubleTapPowerKey;

    private final String SECURE_KEY = CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED;

    public DoubleTapPowerPreferenceController(Context context, Lifecycle lifecycle, String key) {
        super(context, lifecycle);
        mDoubleTapPowerKey = key;
@@ -71,15 +73,14 @@ public class DoubleTapPowerPreferenceController extends GesturePreferenceControl
    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        boolean enabled = (boolean) newValue;
        Settings.Secure.putInt(mContext.getContentResolver(),
                Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, enabled ? ON : OFF);
        Settings.Secure.putInt(mContext.getContentResolver(), SECURE_KEY, enabled ? ON : OFF);
        return true;
    }

    @Override
    protected boolean isSwitchPrefEnabled() {
        final int cameraDisabled = Settings.Secure.getInt(mContext.getContentResolver(),
                Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, 0);
                SECURE_KEY, ON);
        return cameraDisabled == 0;
    }

@@ -89,7 +90,7 @@ public class DoubleTapPowerPreferenceController extends GesturePreferenceControl
                DoubleTapPowerSettings.class.getName(), mDoubleTapPowerKey,
                mContext.getString(R.string.display_settings));

        return new InlineSwitchPayload(Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED,
                ResultPayload.SettingsSource.SECURE, ON, intent, isAvailable());
        return new InlineSwitchPayload(SECURE_KEY, ResultPayload.SettingsSource.SECURE,
                ON /* onValue */, intent, isAvailable(), ON /* defaultValue */);
    }
}
+8 −6
Original line number Diff line number Diff line
@@ -25,12 +25,13 @@ import android.support.v7.preference.Preference;

import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.settings.R;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.DatabaseIndexingUtils;
import com.android.settings.search.InlineSwitchPayload;
import com.android.settings.search.ResultPayload;
import com.android.settingslib.core.lifecycle.Lifecycle;

import static android.provider.Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP;

public class DoubleTapScreenPreferenceController extends GesturePreferenceController {

    private final int ON = 1;
@@ -39,6 +40,8 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro
    private static final String PREF_KEY_VIDEO = "gesture_double_tap_screen_video";
    private final String mDoubleTapScreenPrefKey;

    private final String SECURE_KEY = DOZE_PULSE_ON_DOUBLE_TAP;

    private final AmbientDisplayConfiguration mAmbientConfig;
    @UserIdInt
    private final int mUserId;
@@ -70,8 +73,7 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro
    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        final boolean enabled = (boolean) newValue;
        Settings.Secure.putInt(mContext.getContentResolver(),
                Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, enabled ? ON : OFF);
        Settings.Secure.putInt(mContext.getContentResolver(), SECURE_KEY, enabled ? ON : OFF);
        return true;
    }

@@ -91,7 +93,7 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro
                DoubleTapScreenSettings.class.getName(), mDoubleTapScreenPrefKey,
                mContext.getString(R.string.display_settings));

        return new InlineSwitchPayload(Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP,
                ResultPayload.SettingsSource.SECURE, ON, intent, isAvailable());
        return new InlineSwitchPayload(SECURE_KEY, ResultPayload.SettingsSource.SECURE,
                ON /* onValue */, intent, isAvailable(), ON /* defaultValue */);
    }
}
 No newline at end of file
Loading