Merge "Move power button cooldown period flag to Settings.Global" into sc-v2-dev am: e8d0b6bdca
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16762503 Change-Id: Ic19276e9fdc44c567f0e9e488e7e0a1c1fec0ebb
This commit is contained in:
@@ -9193,16 +9193,6 @@ public final class Settings {
|
|||||||
public static final String EMERGENCY_GESTURE_SOUND_ENABLED =
|
public static final String EMERGENCY_GESTURE_SOUND_ENABLED =
|
||||||
"emergency_gesture_sound_enabled";
|
"emergency_gesture_sound_enabled";
|
||||||
|
|
||||||
/**
|
|
||||||
* The power button "cooldown" period in milliseconds after the Emergency gesture is
|
|
||||||
* triggered, during which single-key actions on the power button are suppressed. Cooldown
|
|
||||||
* period is disabled if set to zero.
|
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public static final String EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS =
|
|
||||||
"emergency_gesture_power_button_cooldown_period_ms";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the camera launch gesture to double tap the power button when the screen is off
|
* Whether the camera launch gesture to double tap the power button when the screen is off
|
||||||
* should be disabled.
|
* should be disabled.
|
||||||
@@ -13763,6 +13753,16 @@ public final class Settings {
|
|||||||
@Readable
|
@Readable
|
||||||
public static final String EMERGENCY_AFFORDANCE_NEEDED = "emergency_affordance_needed";
|
public static final String EMERGENCY_AFFORDANCE_NEEDED = "emergency_affordance_needed";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The power button "cooldown" period in milliseconds after the Emergency gesture is
|
||||||
|
* triggered, during which single-key actions on the power button are suppressed. Cooldown
|
||||||
|
* period is disabled if set to zero.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS =
|
||||||
|
"emergency_gesture_power_button_cooldown_period_ms";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to enable automatic system server heap dumps. This only works on userdebug or
|
* Whether to enable automatic system server heap dumps. This only works on userdebug or
|
||||||
* eng builds, not on user builds. This is set by the user and overrides the config value.
|
* eng builds, not on user builds. This is set by the user and overrides the config value.
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import static android.provider.settings.validators.SettingsValidators.ANY_INTEGE
|
|||||||
import static android.provider.settings.validators.SettingsValidators.ANY_STRING_VALIDATOR;
|
import static android.provider.settings.validators.SettingsValidators.ANY_STRING_VALIDATOR;
|
||||||
import static android.provider.settings.validators.SettingsValidators.BOOLEAN_VALIDATOR;
|
import static android.provider.settings.validators.SettingsValidators.BOOLEAN_VALIDATOR;
|
||||||
import static android.provider.settings.validators.SettingsValidators.NONE_NEGATIVE_LONG_VALIDATOR;
|
import static android.provider.settings.validators.SettingsValidators.NONE_NEGATIVE_LONG_VALIDATOR;
|
||||||
|
import static android.provider.settings.validators.SettingsValidators.NON_NEGATIVE_INTEGER_VALIDATOR;
|
||||||
import static android.provider.settings.validators.SettingsValidators.PACKAGE_NAME_VALIDATOR;
|
import static android.provider.settings.validators.SettingsValidators.PACKAGE_NAME_VALIDATOR;
|
||||||
import static android.provider.settings.validators.SettingsValidators.PERCENTAGE_INTEGER_VALIDATOR;
|
import static android.provider.settings.validators.SettingsValidators.PERCENTAGE_INTEGER_VALIDATOR;
|
||||||
import static android.view.Display.HdrCapabilities.HDR_TYPES;
|
import static android.view.Display.HdrCapabilities.HDR_TYPES;
|
||||||
@@ -83,6 +84,8 @@ public class GlobalSettingsValidators {
|
|||||||
VALIDATORS.put(Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, ANY_STRING_VALIDATOR);
|
VALIDATORS.put(Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, ANY_STRING_VALIDATOR);
|
||||||
VALIDATORS.put(
|
VALIDATORS.put(
|
||||||
Global.EMERGENCY_TONE, new DiscreteValueValidator(new String[] {"0", "1", "2"}));
|
Global.EMERGENCY_TONE, new DiscreteValueValidator(new String[] {"0", "1", "2"}));
|
||||||
|
VALIDATORS.put(Global.EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS,
|
||||||
|
NON_NEGATIVE_INTEGER_VALIDATOR);
|
||||||
VALIDATORS.put(Global.CALL_AUTO_RETRY, BOOLEAN_VALIDATOR);
|
VALIDATORS.put(Global.CALL_AUTO_RETRY, BOOLEAN_VALIDATOR);
|
||||||
VALIDATORS.put(Global.DOCK_AUDIO_MEDIA_ENABLED, BOOLEAN_VALIDATOR);
|
VALIDATORS.put(Global.DOCK_AUDIO_MEDIA_ENABLED, BOOLEAN_VALIDATOR);
|
||||||
VALIDATORS.put(
|
VALIDATORS.put(
|
||||||
|
|||||||
@@ -272,8 +272,6 @@ public class SecureSettingsValidators {
|
|||||||
VALIDATORS.put(Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, BOOLEAN_VALIDATOR);
|
VALIDATORS.put(Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, BOOLEAN_VALIDATOR);
|
||||||
VALIDATORS.put(Secure.EMERGENCY_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
|
VALIDATORS.put(Secure.EMERGENCY_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
|
||||||
VALIDATORS.put(Secure.EMERGENCY_GESTURE_SOUND_ENABLED, BOOLEAN_VALIDATOR);
|
VALIDATORS.put(Secure.EMERGENCY_GESTURE_SOUND_ENABLED, BOOLEAN_VALIDATOR);
|
||||||
VALIDATORS.put(Secure.EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS,
|
|
||||||
NON_NEGATIVE_INTEGER_VALIDATOR);
|
|
||||||
VALIDATORS.put(Secure.ADAPTIVE_CONNECTIVITY_ENABLED, BOOLEAN_VALIDATOR);
|
VALIDATORS.put(Secure.ADAPTIVE_CONNECTIVITY_ENABLED, BOOLEAN_VALIDATOR);
|
||||||
VALIDATORS.put(
|
VALIDATORS.put(
|
||||||
Secure.ASSIST_HANDLES_LEARNING_TIME_ELAPSED_MILLIS, NONE_NEGATIVE_LONG_VALIDATOR);
|
Secure.ASSIST_HANDLES_LEARNING_TIME_ELAPSED_MILLIS, NONE_NEGATIVE_LONG_VALIDATOR);
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ public class SettingsBackupTest {
|
|||||||
Settings.Global.DROPBOX_RESERVE_PERCENT,
|
Settings.Global.DROPBOX_RESERVE_PERCENT,
|
||||||
Settings.Global.DROPBOX_TAG_PREFIX,
|
Settings.Global.DROPBOX_TAG_PREFIX,
|
||||||
Settings.Global.EMERGENCY_AFFORDANCE_NEEDED,
|
Settings.Global.EMERGENCY_AFFORDANCE_NEEDED,
|
||||||
|
Settings.Global.EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS,
|
||||||
Settings.Global.EMULATE_DISPLAY_CUTOUT,
|
Settings.Global.EMULATE_DISPLAY_CUTOUT,
|
||||||
Settings.Global.ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED,
|
Settings.Global.ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED,
|
||||||
Settings.Global.ENABLE_CACHE_QUOTA_CALCULATION,
|
Settings.Global.ENABLE_CACHE_QUOTA_CALCULATION,
|
||||||
|
|||||||
@@ -84,13 +84,13 @@ public class GestureLauncherService extends SystemService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Default value of the power button "cooldown" period after the Emergency gesture is triggered.
|
* Default value of the power button "cooldown" period after the Emergency gesture is triggered.
|
||||||
* See {@link Settings.Secure#EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS}
|
* See {@link Settings.Global#EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS}
|
||||||
*/
|
*/
|
||||||
private static final int EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS_DEFAULT = 3000;
|
private static final int EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS_DEFAULT = 3000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum value of the power button "cooldown" period after the Emergency gesture is triggered.
|
* Maximum value of the power button "cooldown" period after the Emergency gesture is triggered.
|
||||||
* The value read from {@link Settings.Secure#EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS}
|
* The value read from {@link Settings.Global#EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS}
|
||||||
* is capped at this maximum.
|
* is capped at this maximum.
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -253,8 +253,8 @@ public class GestureLauncherService extends SystemService {
|
|||||||
Settings.Secure.getUriFor(Settings.Secure.EMERGENCY_GESTURE_ENABLED),
|
Settings.Secure.getUriFor(Settings.Secure.EMERGENCY_GESTURE_ENABLED),
|
||||||
false, mSettingObserver, mUserId);
|
false, mSettingObserver, mUserId);
|
||||||
mContext.getContentResolver().registerContentObserver(
|
mContext.getContentResolver().registerContentObserver(
|
||||||
Settings.Secure.getUriFor(
|
Settings.Global.getUriFor(
|
||||||
Settings.Secure.EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS),
|
Settings.Global.EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS),
|
||||||
false, mSettingObserver, mUserId);
|
false, mSettingObserver, mUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,9 +439,10 @@ public class GestureLauncherService extends SystemService {
|
|||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static int getEmergencyGesturePowerButtonCooldownPeriodMs(Context context, int userId) {
|
static int getEmergencyGesturePowerButtonCooldownPeriodMs(Context context, int userId) {
|
||||||
int cooldown = Settings.Secure.getIntForUser(context.getContentResolver(),
|
int cooldown = Settings.Global.getInt(context.getContentResolver(),
|
||||||
Settings.Secure.EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS,
|
Settings.Global.EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS,
|
||||||
EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS_DEFAULT, userId);
|
EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS_DEFAULT);
|
||||||
|
|
||||||
return Math.min(cooldown, EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS_MAX);
|
return Math.min(cooldown, EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1450,11 +1450,10 @@ public class GestureLauncherServiceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void withEmergencyGesturePowerButtonCooldownPeriodMsValue(int period) {
|
private void withEmergencyGesturePowerButtonCooldownPeriodMsValue(int period) {
|
||||||
Settings.Secure.putIntForUser(
|
Settings.Global.putInt(
|
||||||
mContentResolver,
|
mContentResolver,
|
||||||
Settings.Secure.EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS,
|
Settings.Global.EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS,
|
||||||
period,
|
period);
|
||||||
UserHandle.USER_CURRENT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void withUserSetupCompleteValue(boolean userSetupComplete) {
|
private void withUserSetupCompleteValue(boolean userSetupComplete) {
|
||||||
|
|||||||
Reference in New Issue
Block a user