Merge change Id7c432bf into eclair

* changes:
  Add vertical bar to the alt-space character picker for the hardware keyboard.
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index 70af91f..809e230 100644
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -172,6 +172,10 @@
 
     public boolean isEnabled() {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+        return isEnabledInternal();
+    }
+
+    private boolean isEnabledInternal() {
         return mBluetoothState == BluetoothAdapter.STATE_ON;
     }
 
@@ -328,7 +332,7 @@
         public void handleMessage(Message msg) {
             switch (msg.what) {
             case MESSAGE_REGISTER_SDP_RECORDS:
-                if (!isEnabled()) {
+                if (!isEnabledInternal()) {
                     return;
                 }
                 // SystemService.start() forks sdptool to register service
@@ -375,7 +379,7 @@
                 break;
             case MESSAGE_DISCOVERABLE_TIMEOUT:
                 int mode = msg.arg1;
-                if (isEnabled()) {
+                if (isEnabledInternal()) {
                     // TODO: Switch back to the previous scan mode
                     // This is ok for now, because we only use
                     // CONNECTABLE and CONNECTABLE_DISCOVERABLE
@@ -675,7 +679,9 @@
     }
 
     /*package*/synchronized void getAllProperties() {
+
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+        if (!isEnabledInternal()) return;
         mAdapterProperties.clear();
 
         String properties[] = (String [])getAdapterPropertiesNative();
@@ -734,16 +740,19 @@
     // The following looks dirty.
     private boolean setPropertyString(String key, String value) {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+        if (!isEnabledInternal()) return false;
         return setAdapterPropertyStringNative(key, value);
     }
 
     private boolean setPropertyInteger(String key, int value) {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+        if (!isEnabledInternal()) return false;
         return setAdapterPropertyIntegerNative(key, value);
     }
 
     private boolean setPropertyBoolean(String key, boolean value) {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+        if (!isEnabledInternal()) return false;
         return setAdapterPropertyBooleanNative(key, value ? 1 : 0);
     }
 
@@ -852,7 +861,7 @@
 
     public synchronized int getScanMode() {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
-        if (!isEnabled())
+        if (!isEnabledInternal())
             return BluetoothAdapter.SCAN_MODE_NONE;
 
         boolean pairable = getProperty("Pairable").equals("true");
@@ -863,15 +872,16 @@
     public synchronized boolean startDiscovery() {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                 "Need BLUETOOTH_ADMIN permission");
-        if (!isEnabled()) {
-            return false;
-        }
+        if (!isEnabledInternal()) return false;
+
         return startDiscoveryNative();
     }
 
     public synchronized boolean cancelDiscovery() {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                 "Need BLUETOOTH_ADMIN permission");
+        if (!isEnabledInternal()) return false;
+
         return stopDiscoveryNative();
     }
 
@@ -887,6 +897,8 @@
     public synchronized boolean createBond(String address) {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                 "Need BLUETOOTH_ADMIN permission");
+        if (!isEnabledInternal()) return false;
+
         if (!BluetoothAdapter.checkBluetoothAddress(address)) {
             return false;
         }
@@ -919,6 +931,8 @@
     public synchronized boolean cancelBondProcess(String address) {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                 "Need BLUETOOTH_ADMIN permission");
+        if (!isEnabledInternal()) return false;
+
         if (!BluetoothAdapter.checkBluetoothAddress(address)) {
             return false;
         }
@@ -936,6 +950,8 @@
     public synchronized boolean removeBond(String address) {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                 "Need BLUETOOTH_ADMIN permission");
+        if (!isEnabledInternal()) return false;
+
         if (!BluetoothAdapter.checkBluetoothAddress(address)) {
             return false;
         }
@@ -960,6 +976,8 @@
     }
 
     /*package*/ String[] getRemoteDeviceProperties(String address) {
+        if (!isEnabledInternal()) return null;
+
         String objectPath = getObjectPathFromAddress(address);
         return (String [])getDevicePropertiesNative(objectPath);
     }
@@ -1055,6 +1073,8 @@
             return false;
         }
 
+        if (!isEnabledInternal()) return false;
+
         return setDevicePropertyBooleanNative(getObjectPathFromAddress(address), "Trusted",
                 value ? 1 : 0);
     }
@@ -1144,6 +1164,8 @@
     public synchronized boolean fetchRemoteUuids(String address, ParcelUuid uuid,
             IBluetoothCallback callback) {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+        if (!isEnabledInternal()) return false;
+
         if (!BluetoothAdapter.checkBluetoothAddress(address)) {
             return false;
         }
@@ -1198,6 +1220,8 @@
      */
     public int getRemoteServiceChannel(String address, ParcelUuid uuid) {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+        if (!isEnabledInternal()) return -1;
+
         if (!BluetoothAdapter.checkBluetoothAddress(address)) {
             return BluetoothDevice.ERROR;
         }
@@ -1216,6 +1240,8 @@
     public synchronized boolean setPin(String address, byte[] pin) {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                 "Need BLUETOOTH_ADMIN permission");
+        if (!isEnabledInternal()) return false;
+
         if (pin == null || pin.length <= 0 || pin.length > 16 ||
             !BluetoothAdapter.checkBluetoothAddress(address)) {
             return false;
@@ -1242,6 +1268,8 @@
     public synchronized boolean setPasskey(String address, int passkey) {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                 "Need BLUETOOTH_ADMIN permission");
+        if (!isEnabledInternal()) return false;
+
         if (passkey < 0 || passkey > 999999 || !BluetoothAdapter.checkBluetoothAddress(address)) {
             return false;
         }
@@ -1259,6 +1287,8 @@
     public synchronized boolean setPairingConfirmation(String address, boolean confirm) {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                 "Need BLUETOOTH_ADMIN permission");
+        if (!isEnabledInternal()) return false;
+
         address = address.toUpperCase();
         Integer data = mEventLoop.getPasskeyAgentRequestData().remove(address);
         if (data == null) {
@@ -1273,6 +1303,8 @@
     public synchronized boolean cancelPairingUserInput(String address) {
         mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
                                                 "Need BLUETOOTH_ADMIN permission");
+        if (!isEnabledInternal()) return false;
+
         if (!BluetoothAdapter.checkBluetoothAddress(address)) {
             return false;
         }
@@ -1289,7 +1321,7 @@
         return cancelPairingUserInputNative(address, data.intValue());
     }
 
-    public void updateDeviceServiceChannelCache(String address) {
+    /*package*/ void updateDeviceServiceChannelCache(String address) {
         ParcelUuid[] deviceUuids = getRemoteUuids(address);
         // We are storing the rfcomm channel numbers only for the uuids
         // we are interested in.
@@ -1364,8 +1396,9 @@
      */
     public synchronized int addRfcommServiceRecord(String serviceName, ParcelUuid uuid,
             int channel, IBinder b) {
-        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM,
-                                                "Need BLUETOOTH permission");
+        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+        if (!isEnabledInternal()) return -1;
+
         if (serviceName == null || uuid == null || channel < 1 ||
                 channel > BluetoothSocket.MAX_RFCOMM_CHANNEL) {
             return -1;
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index a5bceb6..c42f647 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -68,6 +68,7 @@
     native void nContextDestroy(int con);
     native void nContextSetSurface(int w, int h, Surface sur);
     native void nContextSetPriority(int p);
+    native void nContextDump(int bits);
 
     native void nContextBindRootScript(int script);
     native void nContextBindSampler(int sampler, int slot);
@@ -304,6 +305,10 @@
         nContextSetSurface(w, h, mSurface);
     }
 
+    public void contextDump(int bits) {
+        nContextDump(bits);
+    }
+
     public void destroy() {
         nContextDeinitToClient();
         mMessageThread.mRun = false;
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index d311c33..af3bc74 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -189,9 +189,16 @@
 nContextDestroy(JNIEnv *_env, jobject _this, jint con)
 {
     LOG_API("nContextDestroy, con(%p)", (RsContext)con);
-    return rsContextDestroy((RsContext)con);
+    rsContextDestroy((RsContext)con);
 }
 
+static void
+nContextDump(JNIEnv *_env, jobject _this, jint bits)
+{
+    RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+    LOG_API("nContextDump, con(%p)  bits(%i)", (RsContext)con, bits);
+    rsContextDump((RsContext)con, bits);
+}
 
 static void
 nContextPause(JNIEnv *_env, jobject _this)
@@ -1346,6 +1353,7 @@
 {"nContextSetPriority",            "(I)V",                                 (void*)nContextSetPriority },
 {"nContextSetSurface",             "(IILandroid/view/Surface;)V",          (void*)nContextSetSurface },
 {"nContextDestroy",                "(I)V",                                 (void*)nContextDestroy },
+{"nContextDump",                   "(I)V",                                 (void*)nContextDump },
 {"nContextPause",                  "()V",                                  (void*)nContextPause },
 {"nContextResume",                 "()V",                                  (void*)nContextResume },
 {"nAssignName",                    "(I[B)V",                               (void*)nAssignName },
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index be988e7..a4e72d9 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -42,6 +42,10 @@
 	param void *sur
 	}
 
+ContextDump {
+	param int32_t bits
+}
+
 ContextSetPriority {
 	param int32_t priority
 	}
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 16029a6..408d83f 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -190,6 +190,24 @@
 {
 }
 
+void Allocation::dumpLOGV(const char *prefix) const
+{
+    ObjectBase::dumpLOGV(prefix);
+
+    String8 s(prefix);
+    s.append(" type ");
+    if (mType.get()) {
+        mType->dumpLOGV(s.string());
+    }
+
+    LOGV("%s allocation ptr=%p mCpuWrite=%i, mCpuRead=%i, mGpuWrite=%i, mGpuRead=%i",
+          prefix, mPtr, mCpuWrite, mCpuRead, mGpuWrite, mGpuRead);
+
+    LOGV("%s allocation mIsTexture=%i mIsTextureID=%i, mIsVertexBuffer=%i, mBufferID=%i",
+          prefix, mIsTexture, mTextureID, mIsVertexBuffer, mBufferID);
+
+
+}
 
 
 /////////////////
diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h
index 1b83267..514b1c2 100644
--- a/libs/rs/rsAllocation.h
+++ b/libs/rs/rsAllocation.h
@@ -65,6 +65,8 @@
     void enableGLVertexBuffers() const;
     void setupGLIndexBuffers() const;
 
+    virtual void dumpLOGV(const char *prefix) const;
+
 
 protected:
     ObjectBaseRef<const Type> mType;
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index deb9592..08ed725 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -819,6 +819,11 @@
     rsc->setPriority(p);
 }
 
+void rsi_ContextDump(Context *rsc, int32_t bits)
+{
+    ObjectBase::dumpAll(rsc);
+}
+
 }
 }
 
diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp
index b7d67cc..05791cb 100644
--- a/libs/rs/rsObjectBase.cpp
+++ b/libs/rs/rsObjectBase.cpp
@@ -190,3 +190,15 @@
     }
 }
 
+void ObjectBase::dumpAll(Context *rsc)
+{
+    if (rsc->props.mLogObjects) {
+        LOGV("Dumping all objects");
+        const ObjectBase * o = rsc->mObjHead;
+        while (o) {
+            o->dumpLOGV("  ");
+            o = o->mNext;
+        }
+    }
+}
+
diff --git a/libs/rs/rsObjectBase.h b/libs/rs/rsObjectBase.h
index dc85ac7..f247022 100644
--- a/libs/rs/rsObjectBase.h
+++ b/libs/rs/rsObjectBase.h
@@ -49,6 +49,7 @@
     void setContext(Context *);
 
     static void zeroAllUserRef(Context *rsc);
+    static void dumpAll(Context *rsc);
 
     virtual void dumpLOGV(const char *prefix) const;