Add navigation mode to Settings.Secure

Bug: 132443163
Test: builds
Change-Id: I90c3fd843dc111ca6fcd7f618f01c321fd055f83
This commit is contained in:
Hyunyoung Song
2019-05-15 22:56:41 -07:00
parent 37f6ad6529
commit 83972396f2
4 changed files with 26 additions and 1 deletions

View File

@@ -8829,6 +8829,18 @@ public final class Settings {
private static final Validator THEME_CUSTOMIZATION_OVERLAY_PACKAGES_VALIDATOR =
SettingsValidators.JSON_OBJECT_VALIDATOR;
/**
* Navigation bar mode.
* 0 = 3 button
* 1 = 2 button
* 2 = fully gestural
* @hide
*/
public static final String NAVIGATION_MODE =
"navigation_mode";
private static final Validator NAVIGATION_MODE_VALIDATOR =
new SettingsValidators.DiscreteValueValidator(new String[] {"0", "1", "2"});
/**
* Controls whether aware is enabled.
* @hide
@@ -8972,6 +8984,7 @@ public final class Settings {
SKIP_GESTURE,
SILENCE_GESTURE,
THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
NAVIGATION_MODE,
AWARE_ENABLED,
SKIP_GESTURE_COUNT,
SILENCE_ALARMS_GESTURE_COUNT,
@@ -9157,6 +9170,7 @@ public final class Settings {
VALIDATORS.put(SILENCE_GESTURE, SILENCE_GESTURE_VALIDATOR);
VALIDATORS.put(THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
THEME_CUSTOMIZATION_OVERLAY_PACKAGES_VALIDATOR);
VALIDATORS.put(NAVIGATION_MODE, NAVIGATION_MODE_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);

View File

@@ -304,6 +304,7 @@ message SecureSettingsProto {
optional SettingProto multi_press_timeout = 38 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto navigation_mode = 76 [ (android.privacy).dest = DEST_AUTOMATIC ];
message NfcPayment {
option (android.msg_privacy).dest = DEST_EXPLICIT;
@@ -552,5 +553,5 @@ message SecureSettingsProto {
// Please insert fields in alphabetical order and group them into messages
// if possible (to avoid reaching the method limit).
// Next tag = 76;
// Next tag = 77;
}

View File

@@ -2086,6 +2086,10 @@ class SettingsProtoDumpUtil {
Settings.Secure.MULTI_PRESS_TIMEOUT,
SecureSettingsProto.MULTI_PRESS_TIMEOUT);
dumpSetting(s, p,
Settings.Secure.NAVIGATION_MODE,
SecureSettingsProto.NAVIGATION_MODE);
final long nfcPaymentToken = p.start(SecureSettingsProto.NFC_PAYMENT);
dumpSetting(s, p,
Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT,

View File

@@ -33,6 +33,8 @@ import android.os.PatternMatcher;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.Secure;
import android.util.Log;
import android.util.SparseBooleanArray;
@@ -150,6 +152,10 @@ public class NavigationModeController implements Dumpable {
mCurrentUserContext = getCurrentUserContext();
int mode = getCurrentInteractionMode(mCurrentUserContext);
mMode = mode;
mUiOffloadThread.submit(() -> {
Settings.Secure.putString(mCurrentUserContext.getContentResolver(),
Secure.NAVIGATION_MODE, String.valueOf(mode));
});
if (DEBUG) {
Log.e(TAG, "updateCurrentInteractionMode: mode=" + mMode
+ " contextUser=" + mCurrentUserContext.getUserId());