Merge "Use bool var judge whether the navi-keys enabled" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-03-08 20:21:27 +00:00
committed by Android (Google) Code Review

View File

@@ -724,6 +724,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Behavior of rotation suggestions. (See Settings.Secure.SHOW_ROTATION_SUGGESTION) // Behavior of rotation suggestions. (See Settings.Secure.SHOW_ROTATION_SUGGESTION)
int mShowRotationSuggestions; int mShowRotationSuggestions;
// Whether system navigation keys are enabled
boolean mSystemNavigationKeysEnabled;
Display mDisplay; Display mDisplay;
int mLandscapeRotation = 0; // default landscape rotation int mLandscapeRotation = 0; // default landscape rotation
@@ -995,6 +998,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
resolver.registerContentObserver(Settings.Global.getUriFor( resolver.registerContentObserver(Settings.Global.getUriFor(
Settings.Global.POLICY_CONTROL), false, this, Settings.Global.POLICY_CONTROL), false, this,
UserHandle.USER_ALL); UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.Global.getUriFor(
Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED), false, this,
UserHandle.USER_ALL);
updateSettings(); updateSettings();
} }
@@ -2370,6 +2376,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
Settings.Secure.INCALL_BACK_BUTTON_BEHAVIOR, Settings.Secure.INCALL_BACK_BUTTON_BEHAVIOR,
Settings.Secure.INCALL_BACK_BUTTON_BEHAVIOR_DEFAULT, Settings.Secure.INCALL_BACK_BUTTON_BEHAVIOR_DEFAULT,
UserHandle.USER_CURRENT); UserHandle.USER_CURRENT);
mSystemNavigationKeysEnabled = Settings.Secure.getIntForUser(resolver,
Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED,
0, UserHandle.USER_CURRENT) == 1;
// Configure rotation suggestions. // Configure rotation suggestions.
int showRotationSuggestions = Settings.Secure.getIntForUser(resolver, int showRotationSuggestions = Settings.Secure.getIntForUser(resolver,
@@ -6235,7 +6244,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (event.getAction() == KeyEvent.ACTION_UP) { if (event.getAction() == KeyEvent.ACTION_UP) {
if (!mAccessibilityManager.isEnabled() if (!mAccessibilityManager.isEnabled()
|| !mAccessibilityManager.sendFingerprintGesture(event.getKeyCode())) { || !mAccessibilityManager.sendFingerprintGesture(event.getKeyCode())) {
if (areSystemNavigationKeysEnabled()) { if (mSystemNavigationKeysEnabled) {
sendSystemKeyToStatusBarAsync(event.getKeyCode()); sendSystemKeyToStatusBarAsync(event.getKeyCode());
} }
} }
@@ -7827,11 +7836,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
Settings.Global.THEATER_MODE_ON, 0) == 1; Settings.Global.THEATER_MODE_ON, 0) == 1;
} }
private boolean areSystemNavigationKeysEnabled() {
return Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED, 0, UserHandle.USER_CURRENT) == 1;
}
@Override @Override
public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always) { public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always) {
if (!mVibrator.hasVibrator()) { if (!mVibrator.hasVibrator()) {