Merge change I55edce63 into eclair

* changes:
  Fix issue #2149145: Safe Mode does not work on Sholes device
This commit is contained in:
Android (Google) Code Review
2009-09-28 18:11:28 -04:00
7 changed files with 101 additions and 14 deletions

View File

@ -35,6 +35,18 @@ public class HapticFeedbackConstants {
*/
public static final int VIRTUAL_KEY = 1;
/**
* This is a private constant. Feel free to renumber as desired.
* @hide
*/
public static final int SAFE_MODE_DISABLED = 10000;
/**
* This is a private constant. Feel free to renumber as desired.
* @hide
*/
public static final int SAFE_MODE_ENABLED = 10001;
/**
* Flag for {@link View#performHapticFeedback(int, int)
* View.performHapticFeedback(int, int)}: Ignore the setting in the

View File

@ -813,7 +813,7 @@ public interface WindowManagerPolicy {
boolean displayEnabled);
/**
* Called when the system is mostly done booting to dentermine whether
* Called when the system is mostly done booting to determine whether
* the system should go into safe mode.
*/
public boolean detectSafeMode();

View File

@ -124,6 +124,24 @@
<item>30</item>
</integer-array>
<!-- Vibrator pattern for feedback about booting with safe mode disabled -->
<integer-array name="config_safeModeDisabledVibePattern">
<item>0</item>
<item>1</item>
<item>20</item>
<item>21</item>
</integer-array>
<!-- Vibrator pattern for feedback about booting with safe mode disabled -->
<integer-array name="config_safeModeEnabledVibePattern">
<item>0</item>
<item>1</item>
<item>20</item>
<item>21</item>
<item>500</item>
<item>600</item>
</integer-array>
<bool name="config_use_strict_phone_number_comparation">false</bool>
<!-- Display low battery warning when battery level dips to this value -->

View File

@ -337,6 +337,54 @@ public abstract class KeyInputQueue {
}
}
public int getScancodeState(int code) {
synchronized (mFirst) {
VirtualKey vk = mPressedVirtualKey;
if (vk != null) {
if (vk.scancode == code) {
return 2;
}
}
return nativeGetScancodeState(code);
}
}
public int getScancodeState(int deviceId, int code) {
synchronized (mFirst) {
VirtualKey vk = mPressedVirtualKey;
if (vk != null) {
if (vk.scancode == code) {
return 2;
}
}
return nativeGetScancodeState(deviceId, code);
}
}
public int getKeycodeState(int code) {
synchronized (mFirst) {
VirtualKey vk = mPressedVirtualKey;
if (vk != null) {
if (vk.lastKeycode == code) {
return 2;
}
}
return nativeGetKeycodeState(code);
}
}
public int getKeycodeState(int deviceId, int code) {
synchronized (mFirst) {
VirtualKey vk = mPressedVirtualKey;
if (vk != null) {
if (vk.lastKeycode == code) {
return 2;
}
}
return nativeGetKeycodeState(deviceId, code);
}
}
public static native String getDeviceName(int deviceId);
public static native int getDeviceClasses(int deviceId);
public static native void addExcludedDevice(String deviceName);
@ -344,10 +392,10 @@ public abstract class KeyInputQueue {
InputDevice.AbsoluteInfo outInfo);
public static native int getSwitchState(int sw);
public static native int getSwitchState(int deviceId, int sw);
public static native int getScancodeState(int sw);
public static native int getScancodeState(int deviceId, int sw);
public static native int getKeycodeState(int sw);
public static native int getKeycodeState(int deviceId, int sw);
public static native int nativeGetScancodeState(int code);
public static native int nativeGetScancodeState(int deviceId, int code);
public static native int nativeGetKeycodeState(int code);
public static native int nativeGetKeycodeState(int deviceId, int code);
public static native int scancodeToKeycode(int deviceId, int scancode);
public static native boolean hasKeys(int[] keycodes, boolean[] keyExists);

View File

@ -365,8 +365,17 @@ class ServerThread extends Thread {
mContentResolver.registerContentObserver(Settings.Secure.getUriFor(Settings.Secure.ADB_ENABLED),
false, new AdbSettingsObserver());
// It is now time to start up the app processes...
// Before things start rolling, be sure we have decided whether
// we are in safe mode.
final boolean safeMode = wm.detectSafeMode();
if (safeMode) {
try {
ActivityManagerNative.getDefault().enterSafeMode();
} catch (RemoteException e) {
}
}
// It is now time to start up the app processes...
if (notification != null) {
notification.systemReady();

View File

@ -4108,7 +4108,7 @@ public class WindowManagerService extends IWindowManager.Stub
"getScancodeState()")) {
throw new SecurityException("Requires READ_INPUT_STATE permission");
}
return KeyInputQueue.getScancodeState(sw);
return mQueue.getScancodeState(sw);
}
public int getScancodeStateForDevice(int devid, int sw) {
@ -4116,7 +4116,7 @@ public class WindowManagerService extends IWindowManager.Stub
"getScancodeStateForDevice()")) {
throw new SecurityException("Requires READ_INPUT_STATE permission");
}
return KeyInputQueue.getScancodeState(devid, sw);
return mQueue.getScancodeState(devid, sw);
}
public int getKeycodeState(int sw) {
@ -4124,7 +4124,7 @@ public class WindowManagerService extends IWindowManager.Stub
"getKeycodeState()")) {
throw new SecurityException("Requires READ_INPUT_STATE permission");
}
return KeyInputQueue.getKeycodeState(sw);
return mQueue.getKeycodeState(sw);
}
public int getKeycodeStateForDevice(int devid, int sw) {
@ -4132,7 +4132,7 @@ public class WindowManagerService extends IWindowManager.Stub
"getKeycodeStateForDevice()")) {
throw new SecurityException("Requires READ_INPUT_STATE permission");
}
return KeyInputQueue.getKeycodeState(devid, sw);
return mQueue.getKeycodeState(devid, sw);
}
public boolean hasKeys(int[] keycodes, boolean[] keyExists) {

View File

@ -280,13 +280,13 @@ static JNINativeMethod gInputMethods[] = {
(void*) android_server_KeyInputQueue_getSwitchState },
{ "getSwitchState", "(II)I",
(void*) android_server_KeyInputQueue_getSwitchStateDevice },
{ "getScancodeState", "(I)I",
{ "nativeGetScancodeState", "(I)I",
(void*) android_server_KeyInputQueue_getScancodeState },
{ "getScancodeState", "(II)I",
{ "nativeGetScancodeState", "(II)I",
(void*) android_server_KeyInputQueue_getScancodeStateDevice },
{ "getKeycodeState", "(I)I",
{ "nativeGetKeycodeState", "(I)I",
(void*) android_server_KeyInputQueue_getKeycodeState },
{ "getKeycodeState", "(II)I",
{ "nativeGetKeycodeState", "(II)I",
(void*) android_server_KeyInputQueue_getKeycodeStateDevice },
{ "hasKeys", "([I[Z)Z",
(void*) android_server_KeyInputQueue_hasKeys },