summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-09-29 15:18:31 -0700
committerDianne Hackborn <hackbod@google.com>2009-09-29 15:18:31 -0700
commit086d88503e589f14560209000724fe5215a10937 (patch)
treeebdcf258bfd7d8d98b63e52bc4e168e689fdb57f
parent3e1ae648d66e3eaa7da6187b6afdbe95d902dbef (diff)
downloadbase-086d88503e589f14560209000724fe5215a10937.tar.gz
Whoops forgot the change to actually check for safe mode!
Change-Id: Iba0ad151ed786be8ae8659bfefe2a29776ce6311
-rwxr-xr-xphone/com/android/internal/policy/impl/PhoneWindowManager.java64
1 files changed, 39 insertions, 25 deletions
diff --git a/phone/com/android/internal/policy/impl/PhoneWindowManager.java b/phone/com/android/internal/policy/impl/PhoneWindowManager.java
index 4234247..b6b6b77 100755
--- a/phone/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/phone/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -168,6 +168,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Vibrator pattern for haptic feedback of virtual key press.
long[] mVirtualKeyVibePattern;
+ // Vibrator pattern for haptic feedback during boot when safe mode is disabled.
+ long[] mSafeModeDisabledVibePattern;
+
+ // Vibrator pattern for haptic feedback during boot when safe mode is enabled.
+ long[] mSafeModeEnabledVibePattern;
+
/** If true, hitting shift & menu will broadcast Intent.ACTION_BUG_REPORT */
boolean mEnableShiftMenuBugReports = false;
@@ -534,6 +540,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
updatePlugged();
// register for dock events
context.registerReceiver(mDockReceiver, new IntentFilter(Intent.ACTION_DOCK_EVENT));
+ mVibrator = new Vibrator();
+ mLongPressVibePattern = getLongIntArray(mContext.getResources(),
+ com.android.internal.R.array.config_longPressVibePattern);
+ mVirtualKeyVibePattern = getLongIntArray(mContext.getResources(),
+ com.android.internal.R.array.config_virtualKeyVibePattern);
+ mSafeModeDisabledVibePattern = getLongIntArray(mContext.getResources(),
+ com.android.internal.R.array.config_safeModeDisabledVibePattern);
+ mSafeModeEnabledVibePattern = getLongIntArray(mContext.getResources(),
+ com.android.internal.R.array.config_safeModeEnabledVibePattern);
}
void updatePlugged() {
@@ -1971,8 +1986,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
public boolean detectSafeMode() {
try {
int menuState = mWindowManager.getKeycodeState(KeyEvent.KEYCODE_MENU);
- mSafeMode = menuState > 0;
- Log.i(TAG, "Menu key state: " + menuState + " safeMode=" + mSafeMode);
+ int sState = mWindowManager.getKeycodeState(KeyEvent.KEYCODE_S);
+ int dpadState = mWindowManager.getKeycodeState(KeyEvent.KEYCODE_DPAD_CENTER);
+ int trackballState = mWindowManager.getScancodeState(RawInputEvent.BTN_MOUSE);
+ mSafeMode = menuState > 0 || sState > 0 || dpadState > 0 || trackballState > 0;
+ performHapticFeedbackLw(null, mSafeMode
+ ? HapticFeedbackConstants.SAFE_MODE_ENABLED
+ : HapticFeedbackConstants.SAFE_MODE_DISABLED, true);
+ Log.i(TAG, "SAFEMODE: " + mSafeMode + "menu=" + menuState + " s=" + sState
+ + " dpad=" + dpadState + " trackball=" + trackballState + ")");
return mSafeMode;
} catch (RemoteException e) {
// Doom! (it's also local)
@@ -1994,25 +2016,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
/** {@inheritDoc} */
public void systemReady() {
- try {
- if (mSafeMode) {
- // If the user is holding the menu key code, then we are
- // going to boot into safe mode.
- ActivityManagerNative.getDefault().enterSafeMode();
- }
- // tell the keyguard
- mKeyguardMediator.onSystemReady();
- android.os.SystemProperties.set("dev.bootcomplete", "1");
- synchronized (mLock) {
- updateOrientationListenerLp();
- mVibrator = new Vibrator();
- mLongPressVibePattern = getLongIntArray(mContext.getResources(),
- com.android.internal.R.array.config_longPressVibePattern);
- mVirtualKeyVibePattern = getLongIntArray(mContext.getResources(),
- com.android.internal.R.array.config_virtualKeyVibePattern);
- }
- } catch (RemoteException e) {
- // Ignore
+ // tell the keyguard
+ mKeyguardMediator.onSystemReady();
+ android.os.SystemProperties.set("dev.bootcomplete", "1");
+ synchronized (mLock) {
+ updateOrientationListenerLp();
}
}
@@ -2177,6 +2185,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
case HapticFeedbackConstants.LONG_PRESS:
mVibrator.vibrate(mLongPressVibePattern, -1);
return true;
+ case HapticFeedbackConstants.VIRTUAL_KEY:
+ mVibrator.vibrate(mVirtualKeyVibePattern, -1);
+ return true;
+ case HapticFeedbackConstants.SAFE_MODE_DISABLED:
+ mVibrator.vibrate(mSafeModeDisabledVibePattern, -1);
+ return true;
+ case HapticFeedbackConstants.SAFE_MODE_ENABLED:
+ mVibrator.vibrate(mSafeModeEnabledVibePattern, -1);
+ return true;
}
return false;
}
@@ -2184,10 +2201,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
public void keyFeedbackFromInput(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN
&& (event.getFlags()&KeyEvent.FLAG_VIRTUAL_HARD_KEY) != 0) {
- if (Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.HAPTIC_FEEDBACK_ENABLED, 0) != 0) {
- mVibrator.vibrate(mVirtualKeyVibePattern, -1);
- }
+ performHapticFeedbackLw(null, HapticFeedbackConstants.VIRTUAL_KEY, false);
}
}