Merge change I36ad03e1 into eclair

* changes:
  Delegate exclude mimetypes to FasttrackBadgeWidget
diff --git a/api/current.xml b/api/current.xml
index 9ed1b32..5efaed1 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -158411,6 +158411,19 @@
 <parameter name="isScrollContainer" type="boolean">
 </parameter>
 </method>
+<method name="setScrollbarFadingEnabled"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="fadeScrollbars" type="boolean">
+</parameter>
+</method>
 <method name="setSelected"
  return="void"
  abstract="false"
diff --git a/core/java/android/view/HapticFeedbackConstants.java b/core/java/android/view/HapticFeedbackConstants.java
index f936f65..e1f2823 100644
--- a/core/java/android/view/HapticFeedbackConstants.java
+++ b/core/java/android/view/HapticFeedbackConstants.java
@@ -36,6 +36,18 @@
     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 for whether to perform haptic feedback, do it always.
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 1cfe18f..a39faae 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -4723,7 +4723,7 @@
      * caller should not call {@link #invalidate()}.</p>
      *
      * <p>This method should be invoked every time a subclass directly updates
-     * the scroll parameters. (See {@link #mScrollX} and {@link #mScrollY})</p>
+     * the scroll parameters.</p>
      *
      * <p>This method is automatically invoked by {@link #scrollBy(int, int)}
      * and {@link #scrollTo(int, int)}.</p>
@@ -4731,8 +4731,6 @@
      * @return true if the animation is played, false otherwise
      *
      * @see #awakenScrollBars(int)
-     * @see #mScrollX
-     * @see #mScrollY
      * @see #scrollBy(int, int)
      * @see #scrollTo(int, int)
      * @see #isHorizontalScrollBarEnabled()
@@ -4764,7 +4762,7 @@
      * 
      * <p>
      * This method should be invoked everytime a subclass directly updates the
-     * scroll parameters. (See {@link #mScrollX} and {@link #mScrollY})
+     * scroll parameters.
      * </p>
      * 
      * @param startDelay the delay, in milliseconds, after which the animation
@@ -4772,8 +4770,6 @@
      *        immediately
      * @return true if the animation is played, false otherwise
      * 
-     * @see #mScrollX
-     * @see #mScrollY
      * @see #scrollBy(int, int)
      * @see #scrollTo(int, int)
      * @see #isHorizontalScrollBarEnabled()
@@ -5314,7 +5310,22 @@
     private void recomputePadding() {
         setPadding(mPaddingLeft, mPaddingTop, mUserPaddingRight, mUserPaddingBottom);
     }
-
+    
+    /**
+     * Define whether scrollbars will fade when the view is not scrolling.
+     * 
+     * @param fadeScrollbars wheter to enable fading
+     * 
+     */
+    public void setScrollbarFadingEnabled(boolean fadeScrollbars) {
+        initScrollCache();
+        final ScrollabilityCache scrollabilityCache = mScrollCache;
+        scrollabilityCache.fadeScrollBars = fadeScrollbars;
+        if (!fadeScrollbars) {
+            scrollabilityCache.state = ScrollabilityCache.ON;
+        }
+    }
+    
     /**
      * <p>Specify the style of the scrollbars. The scrollbars can be overlaid or
      * inset. When inset, they add to the padding of the view. And the scrollbars
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index b3125b2..78999fa 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -813,7 +813,7 @@
             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();
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 907fd8f..498b5cf 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -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 -->
diff --git a/include/ui/CameraParameters.h b/include/ui/CameraParameters.h
index 9c3d4f0..9e4e140 100644
--- a/include/ui/CameraParameters.h
+++ b/include/ui/CameraParameters.h
@@ -215,15 +215,17 @@
     // Values for flash mode settings.
     // Flash will not be fired.
     static const char FLASH_MODE_OFF[];
-    // Flash will be fired automatically when required. The timing is decided by
-    // camera driver.
+    // Flash will be fired automatically when required. The flash may be fired
+    // during preview, auto-focus, or snapshot depending on the driver.
     static const char FLASH_MODE_AUTO[];
-    // Flash will always be fired. The timing is decided by camera driver.
+    // Flash will always be fired during snapshot. The flash may also be
+    // fired during preview or auto-focus depending on the driver.
     static const char FLASH_MODE_ON[];
     // Flash will be fired in red-eye reduction mode.
     static const char FLASH_MODE_RED_EYE[];
-    // Constant emission of light. This can be used for video recording.
-    static const char FLASH_MODE_VIDEO_LIGHT[];
+    // Constant emission of light during preview, auto-focus and snapshot.
+    // This can also be used for video recording.
+    static const char FLASH_MODE_TORCH[];
 
     // Values for scene mode settings.
     static const char SCENE_MODE_AUTO[];
diff --git a/libs/ui/CameraParameters.cpp b/libs/ui/CameraParameters.cpp
index 9200a97..8f1749d 100644
--- a/libs/ui/CameraParameters.cpp
+++ b/libs/ui/CameraParameters.cpp
@@ -89,7 +89,7 @@
 const char CameraParameters::FLASH_MODE_AUTO[] = "auto";
 const char CameraParameters::FLASH_MODE_ON[] = "on";
 const char CameraParameters::FLASH_MODE_RED_EYE[] = "red-eye";
-const char CameraParameters::FLASH_MODE_VIDEO_LIGHT[] = "video-light";
+const char CameraParameters::FLASH_MODE_TORCH[] = "torch";
 
 // Values for scene mode settings.
 const char CameraParameters::SCENE_MODE_AUTO[] = "auto";
diff --git a/services/java/com/android/server/KeyInputQueue.java b/services/java/com/android/server/KeyInputQueue.java
index d9f4c9c..d7b8f57 100644
--- a/services/java/com/android/server/KeyInputQueue.java
+++ b/services/java/com/android/server/KeyInputQueue.java
@@ -337,6 +337,54 @@
         }
     }
     
+    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 @@
             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);
     
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index b3b50e5..65b3e3f 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -365,8 +365,17 @@
         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();
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 228d25e..30855b1 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -4108,7 +4108,7 @@
                 "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 @@
                 "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 @@
                 "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 @@
                 "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) {
diff --git a/services/jni/com_android_server_KeyInputQueue.cpp b/services/jni/com_android_server_KeyInputQueue.cpp
index f27596c..c92f8df 100644
--- a/services/jni/com_android_server_KeyInputQueue.cpp
+++ b/services/jni/com_android_server_KeyInputQueue.cpp
@@ -280,13 +280,13 @@
         (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 },