Store gesture counts in Secure Settings
- Add settings to secure.proto
Test: manual
Bug: 127341029
Change-Id: I7843fe55930a3f20100693cfdcf9636e941dfed3
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 7a16742..ea76e79 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -7553,6 +7553,15 @@
private static final Validator SKIP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
/**
+ * Count of successful gestures.
+ * @hide
+ */
+ public static final String SKIP_GESTURE_COUNT = "skip_gesture_count";
+
+ private static final Validator SKIP_GESTURE_COUNT_VALIDATOR =
+ NON_NEGATIVE_INTEGER_VALIDATOR;
+
+ /**
* Gesture that silences sound (alarms, notification, calls).
* @hide
*/
@@ -7561,6 +7570,34 @@
private static final Validator SILENCE_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
/**
+ * Count of successful silence alarms gestures.
+ * @hide
+ */
+ public static final String SILENCE_ALARMS_GESTURE_COUNT = "silence_alarms_gesture_count";
+
+ /**
+ * Count of successful silence timer gestures.
+ * @hide
+ */
+ public static final String SILENCE_TIMER_GESTURE_COUNT = "silence_timer_gesture_count";
+
+ /**
+ * Count of successful silence call gestures.
+ * @hide
+ */
+ public static final String SILENCE_CALL_GESTURE_COUNT = "silence_call_gesture_count";
+
+ /**
+ * Count of successful silence notification gestures.
+ * @hide
+ */
+ public static final String SILENCE_NOTIFICATION_GESTURE_COUNT =
+ "silence_notification_gesture_count";
+
+ private static final Validator SILENCE_GESTURE_COUNT_VALIDATOR =
+ NON_NEGATIVE_INTEGER_VALIDATOR;
+
+ /**
* The current night mode that has been selected by the user. Owned
* and controlled by UiModeManagerService. Constants are as per
* UiModeManager.
@@ -8706,6 +8743,11 @@
SILENCE_GESTURE,
THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
AWARE_ENABLED,
+ SKIP_GESTURE_COUNT,
+ SILENCE_ALARMS_GESTURE_COUNT,
+ SILENCE_NOTIFICATION_GESTURE_COUNT,
+ SILENCE_CALL_GESTURE_COUNT,
+ SILENCE_TIMER_GESTURE_COUNT,
};
/**
@@ -8880,6 +8922,11 @@
VALIDATORS.put(THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
THEME_CUSTOMIZATION_OVERLAY_PACKAGES_VALIDATOR);
VALIDATORS.put(AWARE_ENABLED, AWARE_ENABLED_VALIDATOR);
+ VALIDATORS.put(SKIP_GESTURE_COUNT, SKIP_GESTURE_COUNT_VALIDATOR);
+ VALIDATORS.put(SILENCE_ALARMS_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
+ VALIDATORS.put(SILENCE_TIMER_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
+ VALIDATORS.put(SILENCE_CALL_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
+ VALIDATORS.put(SILENCE_NOTIFICATION_GESTURE_COUNT, SILENCE_GESTURE_COUNT_VALIDATOR);
}
/**
diff --git a/core/proto/android/providers/settings/secure.proto b/core/proto/android/providers/settings/secure.proto
index 6360a5f..b3521d1 100644
--- a/core/proto/android/providers/settings/secure.proto
+++ b/core/proto/android/providers/settings/secure.proto
@@ -191,6 +191,21 @@
optional SettingProto emergency_assistance_application = 22 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto enhanced_voice_privacy_enabled = 23 [ (android.privacy).dest = DEST_AUTOMATIC ];
+
+ message Gesture {
+ optional SettingProto aware_enabled = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
+
+ optional SettingProto silence_alarms_count = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
+ optional SettingProto silence_calls_count = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
+ optional SettingProto silence_enabled = 4 [ (android.privacy).dest = DEST_AUTOMATIC ];
+ optional SettingProto silence_notification_count = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
+ optional SettingProto silence_timer_count = 6 [ (android.privacy).dest = DEST_AUTOMATIC ];
+
+ optional SettingProto skip_count = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];
+ optional SettingProto skip_enabled = 8 [ (android.privacy).dest = DEST_AUTOMATIC ];
+ }
+ optional Gesture gesture = 74;
+
optional SettingProto immersive_mode_confirmations = 24 [ (android.privacy).dest = DEST_AUTOMATIC ];
message Incall {
@@ -439,6 +454,7 @@
// parent profile.
optional SettingProto sync_parent_sounds = 55 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto system_navigation_keys_enabled = 56 [ (android.privacy).dest = DEST_AUTOMATIC ];
+ optional SettingProto theme_customization_overlay_packages = 75 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto trust_agents_initialized = 57 [ (android.privacy).dest = DEST_AUTOMATIC ];
message Tts {
@@ -530,13 +546,7 @@
}
optional Zen zen = 71;
- optional SettingProto skip_gesture_enabled = 74 [ (android.privacy).dest = DEST_AUTOMATIC ];
- optional SettingProto silence_gesture_enabled = 75 [ (android.privacy).dest = DEST_AUTOMATIC ];
- optional SettingProto theme_customization_overlay_packages = 76 [ (android.privacy).dest = DEST_AUTOMATIC ];
-
- optional SettingProto aware_enabled = 77 [ (android.privacy).dest = DEST_AUTOMATIC ];
-
// Please insert fields in alphabetical order and group them into messages
// if possible (to avoid reaching the method limit).
- // Next tag = 78;
+ // Next tag = 76;
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index f7f34f6..68c7a09 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -1919,6 +1919,36 @@
dumpSetting(s, p,
Settings.Secure.ENHANCED_VOICE_PRIVACY_ENABLED,
SecureSettingsProto.ENHANCED_VOICE_PRIVACY_ENABLED);
+
+ final long gestureToken = p.start(SecureSettingsProto.GESTURE);
+ dumpSetting(s, p,
+ Settings.Secure.AWARE_ENABLED,
+ SecureSettingsProto.Gesture.AWARE_ENABLED);
+
+ dumpSetting(s, p,
+ Settings.Secure.SILENCE_ALARMS_GESTURE_COUNT,
+ SecureSettingsProto.Gesture.SILENCE_ALARMS_COUNT);
+ dumpSetting(s, p,
+ Settings.Secure.SILENCE_CALL_GESTURE_COUNT,
+ SecureSettingsProto.Gesture.SILENCE_CALLS_COUNT);
+ dumpSetting(s, p,
+ Settings.Secure.SILENCE_GESTURE,
+ SecureSettingsProto.Gesture.SILENCE_ENABLED);
+ dumpSetting(s, p,
+ Settings.Secure.SILENCE_NOTIFICATION_GESTURE_COUNT,
+ SecureSettingsProto.Gesture.SILENCE_NOTIFICATION_COUNT);
+ dumpSetting(s, p,
+ Settings.Secure.SILENCE_TIMER_GESTURE_COUNT,
+ SecureSettingsProto.Gesture.SILENCE_TIMER_COUNT);
+
+ dumpSetting(s, p,
+ Settings.Secure.SKIP_GESTURE_COUNT,
+ SecureSettingsProto.Gesture.SKIP_COUNT);
+ dumpSetting(s, p,
+ Settings.Secure.SKIP_GESTURE,
+ SecureSettingsProto.Gesture.SKIP_ENABLED);
+ p.end(gestureToken);
+
dumpSetting(s, p,
Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS,
SecureSettingsProto.IMMERSIVE_MODE_CONFIRMATIONS);
@@ -2281,6 +2311,9 @@
Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED,
SecureSettingsProto.SYSTEM_NAVIGATION_KEYS_ENABLED);
dumpSetting(s, p,
+ Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
+ SecureSettingsProto.THEME_CUSTOMIZATION_OVERLAY_PACKAGES);
+ dumpSetting(s, p,
Settings.Secure.TRUST_AGENTS_INITIALIZED,
SecureSettingsProto.TRUST_AGENTS_INITIALIZED);
@@ -2398,22 +2431,6 @@
SecureSettingsProto.Zen.SETTINGS_SUGGESTION_VIEWED);
p.end(zenToken);
- dumpSetting(s, p,
- Settings.Secure.SKIP_GESTURE,
- SecureSettingsProto.SKIP_GESTURE_ENABLED);
-
- dumpSetting(s, p,
- Settings.Secure.SILENCE_GESTURE,
- SecureSettingsProto.SILENCE_GESTURE_ENABLED);
-
- dumpSetting(s, p,
- Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
- SecureSettingsProto.THEME_CUSTOMIZATION_OVERLAY_PACKAGES);
-
- dumpSetting(s, p,
- Settings.Secure.AWARE_ENABLED,
- SecureSettingsProto.AWARE_ENABLED);
-
// Please insert new settings using the same order as in SecureSettingsProto.
p.end(token);