Merge "Double input focus and focus movement in list not working." into jb-dev
diff --git a/api/16.txt b/api/16.txt
index 8a7ac00..ec35e21 100644
--- a/api/16.txt
+++ b/api/16.txt
@@ -140,36 +140,16 @@
   public static final class Manifest.permission_group {
     ctor public Manifest.permission_group();
     field public static final java.lang.String ACCOUNTS = "android.permission-group.ACCOUNTS";
-    field public static final java.lang.String AFFECTS_BATTERY = "android.permission-group.AFFECTS_BATTERY";
-    field public static final java.lang.String APP_INFO = "android.permission-group.APP_INFO";
-    field public static final java.lang.String AUDIO_SETTINGS = "android.permission-group.AUDIO_SETTINGS";
-    field public static final java.lang.String BLUETOOTH_NETWORK = "android.permission-group.BLUETOOTH_NETWORK";
-    field public static final java.lang.String BOOKMARKS = "android.permission-group.BOOKMARKS";
-    field public static final java.lang.String CALENDAR = "android.permission-group.CALENDAR";
-    field public static final java.lang.String CAMERA = "android.permission-group.CAMERA";
     field public static final java.lang.String COST_MONEY = "android.permission-group.COST_MONEY";
     field public static final java.lang.String DEVELOPMENT_TOOLS = "android.permission-group.DEVELOPMENT_TOOLS";
-    field public static final java.lang.String DEVICE_ALARMS = "android.permission-group.DEVICE_ALARMS";
-    field public static final java.lang.String DISPLAY = "android.permission-group.DISPLAY";
     field public static final java.lang.String HARDWARE_CONTROLS = "android.permission-group.HARDWARE_CONTROLS";
     field public static final java.lang.String LOCATION = "android.permission-group.LOCATION";
     field public static final java.lang.String MESSAGES = "android.permission-group.MESSAGES";
-    field public static final java.lang.String MICROPHONE = "android.permission-group.MICROPHONE";
     field public static final java.lang.String NETWORK = "android.permission-group.NETWORK";
     field public static final java.lang.String PERSONAL_INFO = "android.permission-group.PERSONAL_INFO";
     field public static final java.lang.String PHONE_CALLS = "android.permission-group.PHONE_CALLS";
-    field public static final java.lang.String SCREENLOCK = "android.permission-group.SCREENLOCK";
-    field public static final java.lang.String SHORTRANGE_NETWORK = "android.permission-group.SHORTRANGE_NETWORK";
-    field public static final java.lang.String SOCIAL_INFO = "android.permission-group.SOCIAL_INFO";
-    field public static final java.lang.String STATUS_BAR = "android.permission-group.STATUS_BAR";
     field public static final java.lang.String STORAGE = "android.permission-group.STORAGE";
-    field public static final java.lang.String SYNC_SETTINGS = "android.permission-group.SYNC_SETTINGS";
-    field public static final java.lang.String SYSTEM_CLOCK = "android.permission-group.SYSTEM_CLOCK";
     field public static final java.lang.String SYSTEM_TOOLS = "android.permission-group.SYSTEM_TOOLS";
-    field public static final java.lang.String USER_DICTIONARY = "android.permission-group.USER_DICTIONARY";
-    field public static final java.lang.String VOICEMAIL = "android.permission-group.VOICEMAIL";
-    field public static final java.lang.String WALLPAPER = "android.permission-group.WALLPAPER";
-    field public static final java.lang.String WRITE_USER_DICTIONARY = "android.permission-group.WRITE_USER_DICTIONARY";
   }
 
   public final class R {
diff --git a/api/current.txt b/api/current.txt
index 8a7ac00..43128ee 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -97,6 +97,7 @@
     field public static final java.lang.String RECORD_AUDIO = "android.permission.RECORD_AUDIO";
     field public static final java.lang.String REORDER_TASKS = "android.permission.REORDER_TASKS";
     field public static final deprecated java.lang.String RESTART_PACKAGES = "android.permission.RESTART_PACKAGES";
+    field public static final java.lang.String ROUTE_MEDIA_OUTPUT = "android.permission.ROUTE_MEDIA_OUTPUT";
     field public static final java.lang.String SEND_SMS = "android.permission.SEND_SMS";
     field public static final java.lang.String SET_ACTIVITY_WATCHER = "android.permission.SET_ACTIVITY_WATCHER";
     field public static final java.lang.String SET_ALARM = "com.android.alarm.permission.SET_ALARM";
@@ -140,36 +141,16 @@
   public static final class Manifest.permission_group {
     ctor public Manifest.permission_group();
     field public static final java.lang.String ACCOUNTS = "android.permission-group.ACCOUNTS";
-    field public static final java.lang.String AFFECTS_BATTERY = "android.permission-group.AFFECTS_BATTERY";
-    field public static final java.lang.String APP_INFO = "android.permission-group.APP_INFO";
-    field public static final java.lang.String AUDIO_SETTINGS = "android.permission-group.AUDIO_SETTINGS";
-    field public static final java.lang.String BLUETOOTH_NETWORK = "android.permission-group.BLUETOOTH_NETWORK";
-    field public static final java.lang.String BOOKMARKS = "android.permission-group.BOOKMARKS";
-    field public static final java.lang.String CALENDAR = "android.permission-group.CALENDAR";
-    field public static final java.lang.String CAMERA = "android.permission-group.CAMERA";
     field public static final java.lang.String COST_MONEY = "android.permission-group.COST_MONEY";
     field public static final java.lang.String DEVELOPMENT_TOOLS = "android.permission-group.DEVELOPMENT_TOOLS";
-    field public static final java.lang.String DEVICE_ALARMS = "android.permission-group.DEVICE_ALARMS";
-    field public static final java.lang.String DISPLAY = "android.permission-group.DISPLAY";
     field public static final java.lang.String HARDWARE_CONTROLS = "android.permission-group.HARDWARE_CONTROLS";
     field public static final java.lang.String LOCATION = "android.permission-group.LOCATION";
     field public static final java.lang.String MESSAGES = "android.permission-group.MESSAGES";
-    field public static final java.lang.String MICROPHONE = "android.permission-group.MICROPHONE";
     field public static final java.lang.String NETWORK = "android.permission-group.NETWORK";
     field public static final java.lang.String PERSONAL_INFO = "android.permission-group.PERSONAL_INFO";
     field public static final java.lang.String PHONE_CALLS = "android.permission-group.PHONE_CALLS";
-    field public static final java.lang.String SCREENLOCK = "android.permission-group.SCREENLOCK";
-    field public static final java.lang.String SHORTRANGE_NETWORK = "android.permission-group.SHORTRANGE_NETWORK";
-    field public static final java.lang.String SOCIAL_INFO = "android.permission-group.SOCIAL_INFO";
-    field public static final java.lang.String STATUS_BAR = "android.permission-group.STATUS_BAR";
     field public static final java.lang.String STORAGE = "android.permission-group.STORAGE";
-    field public static final java.lang.String SYNC_SETTINGS = "android.permission-group.SYNC_SETTINGS";
-    field public static final java.lang.String SYSTEM_CLOCK = "android.permission-group.SYSTEM_CLOCK";
     field public static final java.lang.String SYSTEM_TOOLS = "android.permission-group.SYSTEM_TOOLS";
-    field public static final java.lang.String USER_DICTIONARY = "android.permission-group.USER_DICTIONARY";
-    field public static final java.lang.String VOICEMAIL = "android.permission-group.VOICEMAIL";
-    field public static final java.lang.String WALLPAPER = "android.permission-group.WALLPAPER";
-    field public static final java.lang.String WRITE_USER_DICTIONARY = "android.permission-group.WRITE_USER_DICTIONARY";
   }
 
   public final class R {
@@ -11506,6 +11487,71 @@
     field public static final int DEFAULT = 0; // 0x0
   }
 
+  public class MediaRouter {
+    method public void addCallback(int, android.media.MediaRouter.Callback);
+    method public void addUserRoute(android.media.MediaRouter.UserRouteInfo);
+    method public android.media.MediaRouter.RouteCategory createRouteCategory(java.lang.CharSequence, boolean);
+    method public android.media.MediaRouter.UserRouteInfo createUserRoute(android.media.MediaRouter.RouteCategory);
+    method public static android.media.MediaRouter forApplication(android.content.Context);
+    method public android.media.MediaRouter.RouteCategory getCategoryAt(int);
+    method public int getCategoryCount();
+    method public android.media.MediaRouter.RouteInfo getRouteAt(int);
+    method public int getRouteCount();
+    method public void removeCallback(android.media.MediaRouter.Callback);
+    method public void removeUserRoute(android.media.MediaRouter.UserRouteInfo);
+    method public void selectRoute(int, android.media.MediaRouter.RouteInfo);
+    method public void setRouteVolume(int, float);
+    field public static final int ROUTE_TYPE_LIVE_AUDIO = 1; // 0x1
+    field public static final int ROUTE_TYPE_USER = 8388608; // 0x800000
+  }
+
+  public static abstract interface MediaRouter.Callback {
+    method public abstract void onRouteAdded(int, android.media.MediaRouter.RouteInfo);
+    method public abstract void onRouteChanged(android.media.MediaRouter.RouteInfo);
+    method public abstract void onRouteRemoved(int, android.media.MediaRouter.RouteInfo);
+    method public abstract void onRouteSelected(int, android.media.MediaRouter.RouteInfo);
+    method public abstract void onRouteUnselected(int, android.media.MediaRouter.RouteInfo);
+    method public abstract void onVolumeChanged(int, float);
+  }
+
+  public class MediaRouter.RouteCategory {
+    method public java.lang.CharSequence getName();
+    method public android.media.MediaRouter.RouteInfo getRouteAt(int);
+    method public int getRouteCount();
+    method public int getSupportedTypes();
+    method public boolean isGroupable();
+  }
+
+  public class MediaRouter.RouteGroup extends android.media.MediaRouter.RouteInfo {
+    method public void addRoute(android.media.MediaRouter.RouteInfo);
+    method public void addRoute(android.media.MediaRouter.RouteInfo, int);
+    method public void removeRoute(android.media.MediaRouter.RouteInfo);
+    method public void removeRoute(int);
+  }
+
+  public class MediaRouter.RouteInfo {
+    method public android.media.MediaRouter.RouteCategory getCategory();
+    method public android.media.MediaRouter.RouteGroup getGroup();
+    method public java.lang.CharSequence getName();
+    method public java.lang.CharSequence getStatus();
+    method public int getSupportedTypes();
+  }
+
+  public static class MediaRouter.SimpleCallback implements android.media.MediaRouter.Callback {
+    ctor public MediaRouter.SimpleCallback();
+    method public void onRouteAdded(int, android.media.MediaRouter.RouteInfo);
+    method public void onRouteChanged(android.media.MediaRouter.RouteInfo);
+    method public void onRouteRemoved(int, android.media.MediaRouter.RouteInfo);
+    method public void onRouteSelected(int, android.media.MediaRouter.RouteInfo);
+    method public void onRouteUnselected(int, android.media.MediaRouter.RouteInfo);
+    method public void onVolumeChanged(int, float);
+  }
+
+  public class MediaRouter.UserRouteInfo extends android.media.MediaRouter.RouteInfo {
+    method public void setName(java.lang.CharSequence);
+    method public void setStatus(java.lang.CharSequence);
+  }
+
   public class MediaScannerConnection implements android.content.ServiceConnection {
     ctor public MediaScannerConnection(android.content.Context, android.media.MediaScannerConnection.MediaScannerConnectionClient);
     method public void connect();
diff --git a/core/java/android/animation/LayoutTransition.java b/core/java/android/animation/LayoutTransition.java
index bdcb2af..4d3a519 100644
--- a/core/java/android/animation/LayoutTransition.java
+++ b/core/java/android/animation/LayoutTransition.java
@@ -831,6 +831,14 @@
             return;
         }
 
+        // Don't animate items up from size(0,0); this is likely because the objects
+        // were offscreen/invisible or otherwise measured to be infinitely small. We don't
+        // want to see them animate into their real size; just ignore animation requests
+        // on these views
+        if (child.getWidth() == 0 && child.getHeight() == 0) {
+            return;
+        }
+
         // Make a copy of the appropriate animation
         final Animator anim = baseAnimator.clone();
 
diff --git a/core/java/android/view/ActionProvider.java b/core/java/android/view/ActionProvider.java
index ed976ab..9150d19 100644
--- a/core/java/android/view/ActionProvider.java
+++ b/core/java/android/view/ActionProvider.java
@@ -19,28 +19,25 @@
 import android.content.Context;
 
 /**
- * This class is a mediator for accomplishing a given task, for example sharing a file.
- * It is responsible for creating a view that performs an action that accomplishes the task.
- * This class also implements other functions such a performing a default action.
- * <p>
- * An ActionProvider can be optionally specified for a {@link MenuItem} and in such a
- * case it will be responsible for creating the action view that appears in the
- * {@link android.app.ActionBar} as a substitute for the menu item when the item is
- * displayed as an action item. Also the provider is responsible for performing a
- * default action if a menu item placed on the overflow menu of the ActionBar is
- * selected and none of the menu item callbacks has handled the selection. For this
- * case the provider can also optionally provide a sub-menu for accomplishing the
- * task at hand.
- * </p>
- * <p>
- * There are two ways for using an action provider for creating and handling of action views:
+ * An ActionProvider defines rich menu interaction in a single component.
+ * ActionProvider can generate action views for use in the action bar,
+ * dynamically populate submenus of a MenuItem, and handle default menu
+ * item invocations.
+ *
+ * <p>An ActionProvider can be optionally specified for a {@link MenuItem} and will be
+ * responsible for creating the action view that appears in the {@link android.app.ActionBar}
+ * in place of a simple button in the bar. When the menu item is presented in a way that
+ * does not allow custom action views, (e.g. in an overflow menu,) the ActionProvider
+ * can perform a default action.</p>
+ *
+ * <p>There are two ways to use an action provider:
  * <ul>
  * <li>
- * Setting the action provider on a {@link MenuItem} directly by calling
+ * Set the action provider on a {@link MenuItem} directly by calling
  * {@link MenuItem#setActionProvider(ActionProvider)}.
  * </li>
  * <li>
- * Declaring the action provider in the menu XML resource. For example:
+ * Declare the action provider in an XML menu resource. For example:
  * <pre>
  * <code>
  *   &lt;item android:id="@+id/my_menu_item"
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index fe812af..5108990 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -74,7 +74,6 @@
     private final CallbackProxy mCallbackProxy;
     private final WebSettingsClassic mSettings;
     private final Context mContext;
-    private final WebViewDatabaseClassic mDatabase;
     private final WebViewCore mWebViewCore;
     /* package */ boolean mLoadInitFromJava;
     private int mLoadType;
@@ -243,7 +242,6 @@
         mSettings = settings;
         mContext = context;
         mCallbackProxy = proxy;
-        mDatabase = WebViewDatabaseClassic.getInstance(appContext);
         mWebViewCore = w;
 
         mSearchBox = new SearchBoxImpl(mWebViewCore, mCallbackProxy);
@@ -426,7 +424,8 @@
             if (h != null) {
                 String url = WebTextView.urlForAutoCompleteData(h.getUrl());
                 if (url != null) {
-                    mDatabase.setFormData(url, data);
+                    WebViewDatabaseClassic.getInstance(mContext).setFormData(
+                            url, data);
                 }
             }
         }
@@ -498,8 +497,9 @@
                     if (item != null) {
                         WebAddress uri = new WebAddress(item.getUrl());
                         String schemePlusHost = uri.getScheme() + uri.getHost();
-                        String[] up = mDatabase.getUsernamePassword(
-                                schemePlusHost);
+                        String[] up =
+                                WebViewDatabaseClassic.getInstance(mContext)
+                                        .getUsernamePassword(schemePlusHost);
                         if (up != null && up[0] != null) {
                             setUsernamePassword(up[0], up[1]);
                         }
@@ -800,10 +800,10 @@
             // the post data (there could be another form on the
             // page and that was posted instead.
             String postString = new String(postData);
+            WebViewDatabaseClassic db = WebViewDatabaseClassic.getInstance(mContext);
             if (postString.contains(URLEncoder.encode(username)) &&
                     postString.contains(URLEncoder.encode(password))) {
-                String[] saved = mDatabase.getUsernamePassword(
-                        schemePlusHost);
+                String[] saved = db.getUsernamePassword(schemePlusHost);
                 if (saved != null) {
                     // null username implies that user has chosen not to
                     // save password
@@ -811,7 +811,8 @@
                         // non-null username implies that user has
                         // chosen to save password, so update the
                         // recorded password
-                        mDatabase.setUsernamePassword(schemePlusHost, username, password);
+                        db.setUsernamePassword(schemePlusHost, username,
+                                password);
                     }
                 } else {
                     // CallbackProxy will handle creating the resume
diff --git a/core/java/android/webkit/WebSyncManager.java b/core/java/android/webkit/WebSyncManager.java
index d3ec603..38b5e5c 100644
--- a/core/java/android/webkit/WebSyncManager.java
+++ b/core/java/android/webkit/WebSyncManager.java
@@ -37,6 +37,9 @@
     // handler of the sync thread
     protected Handler mHandler;
     // database for the persistent storage
+    // Note that this remains uninitialised as it is unused. We cannot remove
+    // the member as it leaked into the public API via CookieSyncManager.
+    // TODO: hide this member, ditto for mHandler.
     protected WebViewDatabase mDataBase;
     // Ref count for calls to start/stop sync
     private int mStartSyncRefCount;
@@ -62,7 +65,6 @@
     protected WebSyncManager(Context context, String name) {
         mThreadName = name;
         if (context != null) {
-            mDataBase = WebViewDatabase.getInstance(context);
             mSyncThread = new Thread(this);
             mSyncThread.setName(mThreadName);
             mSyncThread.start();
diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
index b2c3091..89dbd1b 100644
--- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
@@ -23,12 +23,16 @@
 import android.animation.TimeInterpolator;
 import android.animation.ValueAnimator;
 import android.animation.ValueAnimator.AnimatorUpdateListener;
+import android.content.ComponentName;
 import android.content.Context;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.res.Resources;
 import android.content.res.TypedArray;
 import android.graphics.Canvas;
 import android.graphics.RectF;
 import android.graphics.drawable.Drawable;
+import android.os.Bundle;
 import android.os.Vibrator;
 import android.text.TextUtils;
 import android.util.AttributeSet;
@@ -1233,4 +1237,62 @@
         }
         return -1;
     }
+
+    private boolean replaceTargetDrawables(Resources res, int existingResourceId,
+            int newResourceId) {
+        if (existingResourceId == 0 || newResourceId == 0) {
+            return false;
+        }
+
+        boolean result = false;
+        final ArrayList<TargetDrawable> drawables = mTargetDrawables;
+        final int size = drawables.size();
+        for (int i = 0; i < size; i++) {
+            final TargetDrawable target = drawables.get(i);
+            if (target != null && target.getResourceId() == existingResourceId) {
+                target.setDrawable(res, newResourceId);
+                result = true;
+            }
+        }
+
+        if (result) {
+            requestLayout(); // in case any given drawable's size changes
+        }
+
+        return result;
+    }
+
+    /**
+     * Searches the given package for a resource to use to replace the Drawable on the
+     * target with the given resource id
+     * @param component of the .apk that contains the resource
+     * @param name of the metadata in the .apk
+     * @param existingResId the resource id of the target to search for
+     * @return true if found in the given package and replaced at least one target Drawables
+     */
+    public boolean replaceTargetDrawablesIfPresent(ComponentName component, String name,
+                int existingResId) {
+        if (existingResId == 0) return false;
+
+        try {
+            PackageManager packageManager = mContext.getPackageManager();
+            // Look for the search icon specified in the activity meta-data
+            Bundle metaData = packageManager.getActivityInfo(
+                    component, PackageManager.GET_META_DATA).metaData;
+            if (metaData != null) {
+                int iconResId = metaData.getInt(name);
+                if (iconResId != 0) {
+                    Resources res = packageManager.getResourcesForActivity(component);
+                    return replaceTargetDrawables(res, existingResId, iconResId);
+                }
+            }
+        } catch (NameNotFoundException e) {
+            Log.w(TAG, "Failed to swap drawable; "
+                    + component.flattenToShortString() + " not found", e);
+        } catch (Resources.NotFoundException nfe) {
+            Log.w(TAG, "Failed to swap drawable from "
+                    + component.flattenToShortString(), nfe);
+        }
+        return false;
+    }
 }
diff --git a/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java b/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java
index 6392093..30f5f2f 100644
--- a/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java
+++ b/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java
@@ -44,7 +44,7 @@
     private float mAlpha = 1.0f;
     private Drawable mDrawable;
     private boolean mEnabled = true;
-    private int mResourceId;
+    private final int mResourceId;
 
     /* package */ static class DrawableWithAlpha extends Drawable {
         private float mAlpha = 1.0f;
@@ -78,6 +78,12 @@
 
     public TargetDrawable(Resources res, int resId) {
         mResourceId = resId;
+        setDrawable(res, resId);
+    }
+
+    public void setDrawable(Resources res, int resId) {
+        // Note we explicitly don't set mResourceId to resId since we allow the drawable to be
+        // swapped at runtime and want to re-use the existing resource id for identification.
         Drawable drawable = resId == 0 ? null : res.getDrawable(resId);
         // Mutate the drawable so we can animate shared drawable properties.
         mDrawable = drawable != null ? drawable.mutate() : null;
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 155e59c..d9d87c1 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -139,11 +139,39 @@
     <eat-comment />
 
     <!-- Used for permissions that can be used to make the user spend money
-         without their direct involvement. -->
+         without their direct involvement.  For example, this is the group
+         for permissions that allow you to directly place phone calls,
+         directly send SMS messages, etc. -->
     <permission-group android:name="android.permission-group.COST_MONEY"
         android:label="@string/permgrouplab_costMoney"
         android:description="@string/permgroupdesc_costMoney" />
 
+
+    <!-- Allows an application to send SMS messages. -->
+    <permission android:name="android.permission.SEND_SMS"
+        android:permissionGroup="android.permission-group.COST_MONEY"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_sendSms"
+        android:description="@string/permdesc_sendSms" />
+
+    <!-- Allows an application to send SMS messages via the Messaging app with no user
+         input or confirmation.
+         @hide -->
+    <permission android:name="android.permission.SEND_SMS_NO_CONFIRMATION"
+        android:permissionGroup="android.permission-group.COST_MONEY"
+        android:protectionLevel="signature|system"
+        android:label="@string/permlab_sendSmsNoConfirmation"
+        android:description="@string/permdesc_sendSmsNoConfirmation" />
+
+    <!-- Allows an application to initiate a phone call without going through
+         the Dialer user interface for the user to confirm the call
+         being placed. -->
+    <permission android:name="android.permission.CALL_PHONE"
+        android:permissionGroup="android.permission-group.COST_MONEY"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_callPhone"
+        android:description="@string/permdesc_callPhone" />
+
     <!-- ================================== -->
     <!-- Permissions for accessing messages -->
     <!-- ================================== -->
@@ -155,26 +183,7 @@
          receiving or reading an MMS. -->
     <permission-group android:name="android.permission-group.MESSAGES"
         android:label="@string/permgrouplab_messages"
-        android:icon="@drawable/perm_group_messages"
-        android:description="@string/permgroupdesc_messages"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="360"/>
-
-  <!-- Allows an application to send SMS messages. -->
-    <permission android:name="android.permission.SEND_SMS"
-        android:permissionGroup="android.permission-group.MESSAGES"
-        android:protectionLevel="dangerous"
-        android:label="@string/permlab_sendSms"
-        android:description="@string/permdesc_sendSms" />
-
-    <!-- Allows an application to send SMS messages via the Messaging app with no user
-         input or confirmation.
-         @hide -->
-    <permission android:name="android.permission.SEND_SMS_NO_CONFIRMATION"
-        android:permissionGroup="android.permission-group.MESSAGES"
-        android:protectionLevel="signature|system"
-        android:label="@string/permlab_sendSmsNoConfirmation"
-        android:description="@string/permdesc_sendSmsNoConfirmation" />
+        android:description="@string/permgroupdesc_messages" />
 
     <!-- Allows an application to monitor incoming SMS messages, to record
          or perform processing on them. -->
@@ -240,25 +249,22 @@
         android:description="@string/permdesc_receiveWapPush" />
 
     <!-- =============================================================== -->
-    <!-- Permissions for accessing social info (contacts and social) -->
+    <!-- Permissions for accessing personal info (contacts and calendar) -->
     <!-- =============================================================== -->
     <eat-comment />
 
-    <!-- Used for permissions that provide access to the user's social connections,
-         such as contacts, call logs, social stream, etc.  This includes
+    <!-- Used for permissions that provide access to the user's private data,
+         such as contacts, calendar events, e-mail messages, etc.  This includes
          both reading and writing of this data (which should generally be
          expressed as two distinct permissions). -->
 
-    <permission-group android:name="android.permission-group.SOCIAL_INFO"
-        android:label="@string/permgrouplab_socialInfo"
-        android:icon="@drawable/perm_group_social_info"
-        android:description="@string/permgroupdesc_socialInfo"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="320" />
+    <permission-group android:name="android.permission-group.PERSONAL_INFO"
+        android:label="@string/permgrouplab_personalInfo"
+        android:description="@string/permgroupdesc_personalInfo" />
 
     <!-- Allows an application to read the user's contacts data. -->
     <permission android:name="android.permission.READ_CONTACTS"
-        android:permissionGroup="android.permission-group.SOCIAL_INFO"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:protectionLevel="dangerous"
         android:label="@string/permlab_readContacts"
         android:description="@string/permdesc_readContacts" />
@@ -266,14 +272,14 @@
     <!-- Allows an application to write (but not read) the user's
          contacts data. -->
     <permission android:name="android.permission.WRITE_CONTACTS"
-        android:permissionGroup="android.permission-group.SOCIAL_INFO"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:protectionLevel="dangerous"
         android:label="@string/permlab_writeContacts"
         android:description="@string/permdesc_writeContacts" />
 
     <!-- Allows an application to read the user's call log. -->
     <permission android:name="android.permission.READ_CALL_LOG"
-        android:permissionGroup="android.permission-group.SOCIAL_INFO"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:protectionLevel="dangerous"
         android:label="@string/permlab_readCallLog"
         android:description="@string/permdesc_readCallLog" />
@@ -281,42 +287,11 @@
     <!-- Allows an application to write (but not read) the user's
          contacts data. -->
     <permission android:name="android.permission.WRITE_CALL_LOG"
-        android:permissionGroup="android.permission-group.SOCIAL_INFO"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:protectionLevel="dangerous"
         android:label="@string/permlab_writeCallLog"
         android:description="@string/permdesc_writeCallLog" />
 
-  <!-- Allows an application to read from the user's social stream. -->
-    <permission android:name="android.permission.READ_SOCIAL_STREAM"
-        android:permissionGroup="android.permission-group.SOCIAL_INFO"
-        android:protectionLevel="dangerous"
-        android:label="@string/permlab_readSocialStream"
-        android:description="@string/permdesc_readSocialStream" />
-
-    <!-- Allows an application to write (but not read) the user's
-         social stream data. -->
-    <permission android:name="android.permission.WRITE_SOCIAL_STREAM"
-        android:permissionGroup="android.permission-group.SOCIAL_INFO"
-        android:protectionLevel="dangerous"
-        android:label="@string/permlab_writeSocialStream"
-        android:description="@string/permdesc_writeSocialStream" />
-
-    <!-- =============================================================== -->
-    <!-- Permissions for accessing information about the device owner    -->
-    <!-- =============================================================== -->
-    <eat-comment />
-
-    <!-- Used for permissions that provide access to information about the device
-         user such as profile information.  This includes both reading and
-         writing of this data (which should generally be expressed as two
-         distinct permissions). -->
-    <permission-group android:name="android.permission-group.PERSONAL_INFO"
-        android:label="@string/permgrouplab_personalInfo"
-        android:icon="@drawable/perm_group_personal_info"
-        android:description="@string/permgroupdesc_personalInfo"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="310" />
-
     <!-- Allows an application to read the user's personal profile data. -->
     <permission android:name="android.permission.READ_PROFILE"
         android:permissionGroup="android.permission-group.PERSONAL_INFO"
@@ -332,19 +307,20 @@
         android:label="@string/permlab_writeProfile"
         android:description="@string/permdesc_writeProfile" />
 
-    <!-- =============================================================== -->
-    <!-- Permissions for accessing the device calendar                   -->
-    <!-- =============================================================== -->
-    <eat-comment />
+    <!-- Allows an application to read from the user's social stream. -->
+    <permission android:name="android.permission.READ_SOCIAL_STREAM"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_readSocialStream"
+        android:description="@string/permdesc_readSocialStream" />
 
-    <!-- Used for permissions that provide access to the device
-         calendar to create / view events.-->
-    <permission-group android:name="android.permission-group.CALENDAR"
-        android:label="@string/permgrouplab_calendar"
-        android:icon="@drawable/perm_group_calendar"
-        android:description="@string/permgroupdesc_calendar"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="290" />
+    <!-- Allows an application to write (but not read) the user's
+         social stream data. -->
+    <permission android:name="android.permission.WRITE_SOCIAL_STREAM"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_writeSocialStream"
+        android:description="@string/permdesc_writeSocialStream" />
 
     <!-- Allows an application to read the user's calendar data. -->
     <permission android:name="android.permission.READ_CALENDAR"
@@ -361,63 +337,26 @@
         android:label="@string/permlab_writeCalendar"
         android:description="@string/permdesc_writeCalendar" />
 
-    <!-- =============================================================== -->
-    <!-- Permissions for accessing the user dictionary-->
-    <!-- =============================================================== -->
-    <eat-comment />
-
-    <!-- Used for permissions that provide access to the user
-         calendar to create / view events.-->
-    <permission-group android:name="android.permission-group.USER_DICTIONARY"
-        android:label="@string/permgrouplab_dictionary"
-        android:icon="@drawable/perm_group_user_dictionary"
-        android:description="@string/permgroupdesc_dictionary"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="170" />
-
     <!-- Allows an application to read the user dictionary. This should
          really only be required by an IME, or a dictionary editor like
          the Settings app. -->
     <permission android:name="android.permission.READ_USER_DICTIONARY"
-        android:permissionGroup="android.permission-group.USER_DICTIONARY"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:protectionLevel="dangerous"
         android:label="@string/permlab_readDictionary"
         android:description="@string/permdesc_readDictionary" />
 
-    <!-- Used for permissions that provide access to the user
-         calendar to create / view events.-->
-    <permission-group android:name="android.permission-group.WRITE_USER_DICTIONARY"
-        android:label="@string/permgrouplab_writeDictionary"
-        android:icon="@drawable/perm_group_user_dictionary_write"
-        android:description="@string/permgroupdesc_writeDictionary"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="160" />
-
     <!-- Allows an application to write to the user dictionary. -->
     <permission android:name="android.permission.WRITE_USER_DICTIONARY"
-        android:permissionGroup="android.permission-group.WRITE_USER_DICTIONARY"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:protectionLevel="normal"
         android:label="@string/permlab_writeDictionary"
         android:description="@string/permdesc_writeDictionary" />
 
-    <!-- =============================================================== -->
-    <!-- Permissions for accessing the user bookmarks                    -->
-    <!-- =============================================================== -->
-    <eat-comment />
-
-    <!-- Used for permissions that provide access to the user
-         bookmarks and browser history.-->
-    <permission-group android:name="android.permission-group.BOOKMARKS"
-        android:label="@string/permgrouplab_bookmarks"
-        android:icon="@drawable/perm_group_bookmarks"
-        android:description="@string/permgroupdesc_bookmarks"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="300" />
-
     <!-- Allows an application to read (but not write) the user's
         browsing history and bookmarks. -->
     <permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"
-        android:permissionGroup="android.permission-group.BOOKMARKS"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:label="@string/permlab_readHistoryBookmarks"
         android:description="@string/permdesc_readHistoryBookmarks"
         android:protectionLevel="dangerous" />
@@ -425,48 +364,23 @@
     <!-- Allows an application to write (but not read) the user's
         browsing history and bookmarks. -->
     <permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"
-        android:permissionGroup="android.permission-group.BOOKMARKS"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:label="@string/permlab_writeHistoryBookmarks"
         android:description="@string/permdesc_writeHistoryBookmarks"
         android:protectionLevel="dangerous" />
 
-    <!-- =============================================================== -->
-    <!-- Permissions for setting the device alarm                        -->
-    <!-- =============================================================== -->
-    <eat-comment />
-
-    <!-- Used for permissions that provide access to the user voicemail box. -->
-    <permission-group android:name="android.permission-group.DEVICE_ALARMS"
-        android:label="@string/permgrouplab_deviceAlarms"
-        android:icon="@drawable/perm_group_device_alarms"
-        android:description="@string/permgroupdesc_deviceAlarms"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="210" />
-
     <!-- Allows an application to broadcast an Intent to set an alarm for the
          user. -->
     <permission android:name="com.android.alarm.permission.SET_ALARM"
-        android:permissionGroup="android.permission-group.DEVICE_ALARMS"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:label="@string/permlab_setAlarm"
         android:description="@string/permdesc_setAlarm"
         android:protectionLevel="normal" />
 
-    <!-- =============================================================== -->
-    <!-- Permissions for accessing the user voicemail                    -->
-    <!-- =============================================================== -->
-    <eat-comment />
-
-    <!-- Used for permissions that provide access to the user voicemail box. -->
-    <permission-group android:name="android.permission-group.VOICEMAIL"
-        android:label="@string/permgrouplab_voicemail"
-        android:icon="@drawable/perm_group_voicemail"
-        android:description="@string/permgroupdesc_voicemail"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="280" />
 
    <!-- Allows an application to add voicemails into the system. -->
     <permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL"
-        android:permissionGroup="android.permission-group.VOICEMAIL"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:protectionLevel="dangerous"
         android:label="@string/permlab_addVoicemail"
         android:description="@string/permdesc_addVoicemail" />
@@ -481,9 +395,7 @@
     <permission-group android:name="android.permission-group.LOCATION"
         android:label="@string/permgrouplab_location"
         android:icon="@drawable/perm_group_location"
-        android:description="@string/permgroupdesc_location"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="330" />
+        android:description="@string/permgroupdesc_location" />
 
     <!-- Allows an application to access fine (e.g., GPS) location -->
     <permission android:name="android.permission.ACCESS_FINE_LOCATION"
@@ -530,9 +442,7 @@
          or other related network operations. -->
     <permission-group android:name="android.permission-group.NETWORK"
         android:label="@string/permgrouplab_network"
-        android:icon="@drawable/perm_group_network"
-        android:description="@string/permgroupdesc_network"
-        android:priority="270" />
+        android:description="@string/permgroupdesc_network" />
 
     <!-- Allows applications to open network sockets. -->
     <permission android:name="android.permission.INTERNET"
@@ -554,13 +464,6 @@
         android:protectionLevel="normal"
         android:description="@string/permdesc_accessWifiState"
         android:label="@string/permlab_accessWifiState" />
-        
-    <!-- Allows applications to change Wi-Fi connectivity state -->
-    <permission android:name="android.permission.CHANGE_WIFI_STATE"
-        android:permissionGroup="android.permission-group.NETWORK"
-        android:protectionLevel="normal"
-        android:description="@string/permdesc_changeWifiState"
-        android:label="@string/permlab_changeWifiState" />
 
     <!-- @hide -->
     <permission android:name="android.permission.ACCESS_WIMAX_STATE"
@@ -569,55 +472,35 @@
         android:description="@string/permdesc_accessWimaxState"
         android:label="@string/permlab_accessWimaxState" />
 
-    <!-- @hide -->
-    <permission android:name="android.permission.CHANGE_WIMAX_STATE"
-        android:permissionGroup="android.permission-group.NETWORK"
-        android:protectionLevel="dangerous"
-        android:description="@string/permdesc_changeWimaxState"
-        android:label="@string/permlab_changeWimaxState" />
-
-    <!-- ======================================= -->
-    <!-- Permissions for short range, peripheral networks -->
-    <!-- ======================================= -->
-    <eat-comment />
-
-    <!-- Used for permissions that provide access to other devices through Bluetooth.-->
-    <permission-group android:name="android.permission-group.BLUETOOTH_NETWORK"
-        android:label="@string/permgrouplab_bluetoothNetwork"
-        android:icon="@drawable/perm_group_bluetooth"
-        android:description="@string/permgroupdesc_bluetoothNetwork"
-        android:priority="260" />
-
-    <!-- Allows applications to connect to paired bluetooth devices -->
+     <!-- Allows applications to connect to paired bluetooth devices -->
     <permission android:name="android.permission.BLUETOOTH"
-        android:permissionGroup="android.permission-group.BLUETOOTH_NETWORK"
+        android:permissionGroup="android.permission-group.NETWORK"
         android:protectionLevel="dangerous"
         android:description="@string/permdesc_bluetooth"
         android:label="@string/permlab_bluetooth" />
-        
-    <!-- Allows applications to discover and pair bluetooth devices -->
-    <permission android:name="android.permission.BLUETOOTH_ADMIN"
-        android:permissionGroup="android.permission-group.BLUETOOTH_NETWORK"
-        android:protectionLevel="dangerous"
-        android:description="@string/permdesc_bluetoothAdmin"
-        android:label="@string/permlab_bluetoothAdmin" />
-   
-    <!-- Used for permissions that provide access to network services that
-         are for peripherals and other nearby devices.  These networks
-         generally do not provide IP based networking or internet access.-->
-    <permission-group android:name="android.permission-group.SHORTRANGE_NETWORK"
-        android:label="@string/permgrouplab_shortrangeNetwork"
-        android:icon="@drawable/perm_group_shortrange_network"
-        android:description="@string/permgroupdesc_shortrangeNetwork"
-        android:priority="250" />
 
     <!-- Allows applications to perform I/O operations over NFC -->
     <permission android:name="android.permission.NFC"
-        android:permissionGroup="android.permission-group.SHORTRANGE_NETWORK"
+        android:permissionGroup="android.permission-group.NETWORK"
         android:protectionLevel="dangerous"
         android:description="@string/permdesc_nfc"
         android:label="@string/permlab_nfc" />
 
+    <!-- Allows an application to use SIP service -->
+    <permission android:name="android.permission.USE_SIP"
+        android:permissionGroup="android.permission-group.NETWORK"
+        android:protectionLevel="dangerous"
+        android:description="@string/permdesc_use_sip"
+        android:label="@string/permlab_use_sip" />
+
+    <!-- Allows applications to call into AccountAuthenticators. Only
+    the system can get this permission. -->
+    <permission android:name="android.permission.ACCOUNT_MANAGER"
+        android:permissionGroup="android.permission-group.ACCOUNTS"
+        android:protectionLevel="signature"
+        android:description="@string/permdesc_accountManagerService"
+        android:label="@string/permlab_accountManagerService" />
+
     <!-- Allows an internal user to use privileged ConnectivityManager
     APIs.
         @hide -->
@@ -634,10 +517,7 @@
          by the Account Manager. -->
     <permission-group android:name="android.permission-group.ACCOUNTS"
         android:label="@string/permgrouplab_accounts"
-        android:icon="@drawable/perm_group_accounts"
-        android:description="@string/permgroupdesc_accounts"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="200" />
+        android:description="@string/permgroupdesc_accounts" />
 
     <!-- Allows access to the list of accounts in the Accounts Service -->
     <permission android:name="android.permission.GET_ACCOUNTS"
@@ -668,77 +548,6 @@
         android:label="@string/permlab_manageAccounts"
         android:description="@string/permdesc_manageAccounts" />
 
-    <!-- Allows applications to call into AccountAuthenticators. Only
-         the system can get this permission. -->
-    <permission android:name="android.permission.ACCOUNT_MANAGER"
-        android:permissionGroup="android.permission-group.ACCOUNTS"
-        android:protectionLevel="signature"
-        android:description="@string/permdesc_accountManagerService"
-        android:label="@string/permlab_accountManagerService" />
-
-    <!-- ================================== -->
-    <!-- Permissions for accessing hardware that may effect battery life-->
-    <!-- ================================== -->
-    <eat-comment />
-
-    <!-- Used for permissions that provide direct access to the hardware on
-         the device that has an effect on battery life.  This includes vibrator,
-         flashlight,  etc. -->
-
-    <permission-group android:name="android.permission-group.AFFECTS_BATTERY"
-        android:label="@string/permgrouplab_affectsBattery"
-        android:icon="@drawable/perm_group_affects_battery"
-        android:description="@string/permgroupdesc_affectsBattery"
-        android:priority="180" />
-
-    <!-- Allows applications to enter Wi-Fi Multicast mode -->
-    <permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"
-        android:permissionGroup="android.permission-group.AFFECTS_BATTERY"
-        android:protectionLevel="normal"
-        android:description="@string/permdesc_changeWifiMulticastState"
-        android:label="@string/permlab_changeWifiMulticastState" />
-
-    <!-- Allows access to the vibrator -->
-    <permission android:name="android.permission.VIBRATE"
-        android:permissionGroup="android.permission-group.AFFECTS_BATTERY"
-        android:protectionLevel="normal"
-        android:label="@string/permlab_vibrate"
-        android:description="@string/permdesc_vibrate" />
-
-    <!-- Allows access to the flashlight -->
-    <permission android:name="android.permission.FLASHLIGHT"
-        android:permissionGroup="android.permission-group.AFFECTS_BATTERY"
-        android:protectionLevel="normal"
-        android:label="@string/permlab_flashlight"
-        android:description="@string/permdesc_flashlight" />
-
-    <!-- Allows using PowerManager WakeLocks to keep processor from sleeping or screen
-         from dimming -->
-    <permission android:name="android.permission.WAKE_LOCK"
-        android:permissionGroup="android.permission-group.AFFECTS_BATTERY"
-        android:protectionLevel="normal"
-        android:label="@string/permlab_wakeLock"
-        android:description="@string/permdesc_wakeLock" />
-
-    <!-- ==================================================== -->
-    <!-- Permissions related to changing audio settings   -->
-    <!-- ==================================================== -->
-
-    <!-- Used for permissions that provide direct access to speaker settings
-         the device. -->
-    <permission-group android:name="android.permission-group.AUDIO_SETTINGS"
-        android:label="@string/permgrouplab_audioSettings"
-        android:icon="@drawable/perm_group_audio_settings"
-        android:description="@string/permgroupdesc_audioSettings"
-        android:priority="130" />
-
-    <!-- Allows an application to modify global audio settings -->
-    <permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"
-        android:permissionGroup="android.permission-group.AUDIO_SETTINGS"
-        android:protectionLevel="normal"
-        android:label="@string/permlab_modifyAudioSettings"
-        android:description="@string/permdesc_modifyAudioSettings" />
-
     <!-- ================================== -->
     <!-- Permissions for accessing hardware -->
     <!-- ================================== -->
@@ -748,8 +557,49 @@
          the device.  This includes audio, the camera, vibrator, etc. -->
     <permission-group android:name="android.permission-group.HARDWARE_CONTROLS"
         android:label="@string/permgrouplab_hardwareControls"
-        android:description="@string/permgroupdesc_hardwareControls"
-        android:priority="260"/>
+        android:description="@string/permgroupdesc_hardwareControls" />
+
+
+    <!-- Allows an application to modify global audio settings -->
+    <permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"
+        android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_modifyAudioSettings"
+        android:description="@string/permdesc_modifyAudioSettings" />
+
+    <!-- Allows an application to record audio -->
+    <permission android:name="android.permission.RECORD_AUDIO"
+        android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_recordAudio"
+        android:description="@string/permdesc_recordAudio" />
+
+    <!-- Required to be able to access the camera device.
+         <p>This will automatically enforce the <a
+         href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code
+         &lt;uses-feature&gt;}</a> manifest element for <em>all</em> camera features.
+         If you do not require all camera features or can properly operate if a camera
+         is not available, then you must modify your manifest as appropriate in order to
+         install on devices that don't support all camera features.</p> -->
+    <permission android:name="android.permission.CAMERA"
+        android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_camera"
+        android:description="@string/permdesc_camera" />
+
+    <!-- Allows access to the vibrator -->
+    <permission android:name="android.permission.VIBRATE"
+        android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
+        android:protectionLevel="normal"
+        android:label="@string/permlab_vibrate"
+        android:description="@string/permdesc_vibrate" />
+
+    <!-- Allows access to the flashlight -->
+    <permission android:name="android.permission.FLASHLIGHT"
+        android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
+        android:protectionLevel="normal"
+        android:label="@string/permlab_flashlight"
+        android:description="@string/permdesc_flashlight" />
 
     <!-- Allows an application to manage preferences and permissions for USB devices
          @hide -->
@@ -786,54 +636,11 @@
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="signature" />
 
-    <!-- =========================================== -->
-    <!-- Permissions associated with audio capture -->
-    <!-- =========================================== -->
-    <eat-comment />
-
-    <!-- Used for permissions that are associated with accessing
-         microphone audio from the device. Note that phone calls also capture audio
-         but are in a separate (more visible) permission group. -->
-    <permission-group android:name="android.permission-group.MICROPHONE"
-        android:label="@string/permgrouplab_microphone"
-        android:icon="@drawable/perm_group_microphone"
-        android:description="@string/permgroupdesc_microphone"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="340" />
-
-    <!-- Allows an application to record audio -->
-    <permission android:name="android.permission.RECORD_AUDIO"
-        android:permissionGroup="android.permission-group.MICROPHONE"
-        android:protectionLevel="dangerous"
-        android:label="@string/permlab_recordAudio" />
-
-
-    <!-- =========================================== -->
-    <!-- Permissions associated with camera and image capture -->
-    <!-- =========================================== -->
-    <eat-comment />
-
-    <!-- Used for permissions that are associated with accessing
-         camera or capturing images/video from the device. -->
-    <permission-group android:name="android.permission-group.CAMERA"
-        android:label="@string/permgrouplab_camera"
-        android:icon="@drawable/perm_group_camera"
-        android:description="@string/permgroupdesc_camera"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="350" />
-
-    <!-- Required to be able to access the camera device.
-         <p>This will automatically enforce the <a
-         href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code
-         &lt;uses-feature&gt;}</a> manifest element for <em>all</em> camera features.
-         If you do not require all camera features or can properly operate if a camera
-         is not available, then you must modify your manifest as appropriate in order to
-         install on devices that don't support all camera features.</p> -->
-    <permission android:name="android.permission.CAMERA"
-        android:permissionGroup="android.permission-group.CAMERA"
-        android:protectionLevel="dangerous"
-        android:label="@string/permlab_camera"
-        android:description="@string/permdesc_camera" />
+    <!-- Allows an application to route media output to other devices. -->
+    <permission android:name="android.permission.ROUTE_MEDIA_OUTPUT"
+                android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+                android:label="@string/permlab_route_media_output"
+                android:description="@string/permdesc_route_media_output" />
 
     <!-- =========================================== -->
     <!-- Permissions associated with telephony state -->
@@ -841,14 +648,13 @@
     <eat-comment />
 
     <!-- Used for permissions that are associated with accessing and modifyign
-         telephony state: placing calls, intercepting outgoing calls, reading
-         and modifying the phone state. -->
+         telephony state: intercepting outgoing calls, reading
+         and modifying the phone state.  Note that
+         placing phone calls is not in this group, since that is in the
+         more important "takin' yer moneys" group. -->
     <permission-group android:name="android.permission-group.PHONE_CALLS"
         android:label="@string/permgrouplab_phoneCalls"
-        android:icon="@drawable/perm_group_phone_calls"
-        android:description="@string/permgroupdesc_phoneCalls"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="370" />
+        android:description="@string/permgroupdesc_phoneCalls" />
 
     <!-- Allows an application to monitor, modify, or abort outgoing
          calls. -->
@@ -879,22 +685,6 @@
         android:permissionGroup="android.permission-group.PHONE_CALLS"
         android:protectionLevel="signature|system" />
 
-     <!-- Allows an application to initiate a phone call without going through
-         the Dialer user interface for the user to confirm the call
-         being placed. -->
-    <permission android:name="android.permission.CALL_PHONE"
-        android:permissionGroup="android.permission-group.PHONE_CALLS"
-        android:protectionLevel="dangerous"
-        android:label="@string/permlab_callPhone"
-        android:description="@string/permdesc_callPhone" />
-
-    <!-- Allows an application to use SIP service -->
-    <permission android:name="android.permission.USE_SIP"
-        android:permissionGroup="android.permission-group.PHONE_CALLS"
-        android:protectionLevel="dangerous"
-        android:description="@string/permdesc_use_sip"
-        android:label="@string/permlab_use_sip" />
-
     <!-- ================================== -->
     <!-- Permissions for sdcard interaction -->
     <!-- ================================== -->
@@ -903,17 +693,14 @@
     <!-- Group of permissions that are related to SD card access. -->
     <permission-group android:name="android.permission-group.STORAGE"
         android:label="@string/permgrouplab_storage"
-        android:icon="@drawable/perm_group_storage"
-        android:description="@string/permgroupdesc_storage"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="240" />
+        android:description="@string/permgroupdesc_storage" />
 
     <!-- Allows an application to read from external storage -->
     <permission android:name="android.permission.READ_EXTERNAL_STORAGE"
-        android:permissionGroup="android.permission-group.STORAGE"
+        android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
         android:label="@string/permlab_sdcardRead"
         android:description="@string/permdesc_sdcardRead"
-        android:protectionLevel="dangerous" />
+        android:protectionLevel="normal" />
 
     <!-- Allows an application to write to external storage -->
     <permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
@@ -930,44 +717,45 @@
         android:description="@string/permdesc_mediaStorageWrite"
         android:protectionLevel="signature|system" />
 
-    <!-- ================================== -->
-    <!-- Permissions for screenlock         -->
-    <!-- ================================== -->
+    <!-- ============================================ -->
+    <!-- Permissions for low-level system interaction -->
+    <!-- ============================================ -->
     <eat-comment />
 
-    <!-- Group of permissions that are related to the screenlock. -->
-    <permission-group android:name="android.permission-group.SCREENLOCK"
-        android:label="@string/permgrouplab_storage"
-        android:icon="@drawable/perm_group_screenlock"
-        android:permissionGroupFlags="personalInfo"
-        android:description="@string/permgroupdesc_storage"
-        android:priority="230" />
+    <!-- Group of permissions that are related to system APIs.  Many
+         of these are not permissions the user will be expected to understand,
+         and such permissions should generally be marked as "normal" protection
+         level so they don't get displayed.  This can also, however, be used
+         for miscellaneous features that provide access to the operating system,
+         such as writing the global system settings. -->
+    <permission-group android:name="android.permission-group.SYSTEM_TOOLS"
+        android:label="@string/permgrouplab_systemTools"
+        android:description="@string/permgroupdesc_systemTools" />
 
-    <!-- Allows applications to disable the keyguard -->
-    <permission android:name="android.permission.DISABLE_KEYGUARD"
-        android:permissionGroup="android.permission-group.SCREENLOCK"
+    <!-- Allows an application to read or write the system settings. -->
+    <permission android:name="android.permission.WRITE_SETTINGS"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="dangerous"
-        android:description="@string/permdesc_disableKeyguard"
-        android:label="@string/permlab_disableKeyguard" />
+        android:label="@string/permlab_writeSettings"
+        android:description="@string/permdesc_writeSettings" />
 
-    <!-- ================================== -->
-    <!-- Permissions to access other installed applications  -->
-    <!-- ================================== -->
-    <eat-comment />
+    <!-- Allows an application to modify the Google service map. -->
+    <permission android:name="android.permission.WRITE_GSERVICES"
+        android:protectionLevel="signature|system"
+        android:label="@string/permlab_writeGservices"
+        android:description="@string/permdesc_writeGservices" />
 
-    <!-- Group of permissions that are related to the other applications
-         installed on the system.  Examples include such as listing
-         running apps, or killing background processes. -->
-    <permission-group android:name="android.permission-group.APP_INFO"
-        android:label="@string/permgrouplab_appInfo"
-        android:icon="@drawable/perm_group_app_info"
-        android:description="@string/permgroupdesc_appInfo"
-        android:priority="220" />
+    <!-- Allows an application to expand or collapse the status bar. -->
+    <permission android:name="android.permission.EXPAND_STATUS_BAR"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="normal"
+        android:label="@string/permlab_expandStatusBar"
+        android:description="@string/permdesc_expandStatusBar" />
 
     <!-- Allows an application to get information about the currently
          or recently running tasks. -->
     <permission android:name="android.permission.GET_TASKS"
-        android:permissionGroup="android.permission-group.APP_INFO"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="dangerous"
         android:label="@string/permlab_getTasks"
         android:description="@string/permdesc_getTasks" />
@@ -983,14 +771,14 @@
 
     <!-- Allows an application to change the Z-order of tasks -->
     <permission android:name="android.permission.REORDER_TASKS"
-        android:permissionGroup="android.permission-group.APP_INFO"
-        android:protectionLevel="normal"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="dangerous"
         android:label="@string/permlab_reorderTasks"
         android:description="@string/permdesc_reorderTasks" />
 
     <!-- @hide Allows an application to change to remove/kill tasks -->
     <permission android:name="android.permission.REMOVE_TASKS"
-        android:permissionGroup="android.permission-group.APP_INFO"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="signature"
         android:label="@string/permlab_removeTasks"
         android:description="@string/permdesc_removeTasks" />
@@ -1003,10 +791,25 @@
         android:label="@string/permlab_startAnyActivity"
         android:description="@string/permdesc_startAnyActivity" />
 
+    <!-- @hide Change the screen compatibility mode of applications -->
+    <permission android:name="android.permission.SET_SCREEN_COMPATIBILITY"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="signature"
+        android:label="@string/permlab_setScreenCompatibility"
+        android:description="@string/permdesc_setScreenCompatibility" />
+
+    <!-- Allows an application to modify the current configuration, such
+         as locale. -->
+    <permission android:name="android.permission.CHANGE_CONFIGURATION"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_changeConfiguration"
+        android:description="@string/permdesc_changeConfiguration" />
+
     <!-- @deprecated The {@link android.app.ActivityManager#restartPackage}
         API is no longer supported. -->
     <permission android:name="android.permission.RESTART_PACKAGES"
-        android:permissionGroup="android.permission-group.APP_INFO"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="normal"
         android:label="@string/permlab_killBackgroundProcesses"
         android:description="@string/permdesc_killBackgroundProcesses" />
@@ -1014,199 +817,11 @@
     <!-- Allows an application to call
         {@link android.app.ActivityManager#killBackgroundProcesses}. -->
     <permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"
-        android:permissionGroup="android.permission-group.APP_INFO"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="normal"
         android:label="@string/permlab_killBackgroundProcesses"
         android:description="@string/permdesc_killBackgroundProcesses" />
 
-    <!-- ================================== -->
-    <!-- Permissions affecting the display of other applications  -->
-    <!-- ================================== -->
-    <eat-comment />
-
-    <!-- Group of permissions that allow manipulation of how
-         another application displays UI to the user. -->
-    <permission-group android:name="android.permission-group.DISPLAY"
-        android:label="@string/permgrouplab_display"
-        android:icon="@drawable/perm_group_display"
-        android:description="@string/permgroupdesc_display"
-        android:priority="190"/>
-
-    <!-- Allows an application to open windows using the type
-         {@link android.view.WindowManager.LayoutParams#TYPE_SYSTEM_ALERT},
-         shown on top of all other applications.  Very few applications
-         should use this permission; these windows are intended for
-         system-level interaction with the user. -->
-    <permission android:name="android.permission.SYSTEM_ALERT_WINDOW"
-        android:permissionGroup="android.permission-group.DISPLAY"
-        android:protectionLevel="dangerous"
-        android:label="@string/permlab_systemAlertWindow"
-        android:description="@string/permdesc_systemAlertWindow" />
-
-    <!-- ================================== -->
-    <!-- Permissions affecting the system wallpaper -->
-    <!-- ================================== -->
-    <eat-comment />
-
-    <!-- Group of permissions that allow manipulation of how
-         another application displays UI to the user. -->
-    <permission-group android:name="android.permission-group.WALLPAPER"
-        android:label="@string/permgrouplab_wallpaper"
-        android:icon="@drawable/perm_group_wallpaper"
-        android:description="@string/permgroupdesc_wallpaper"
-        android:priority="150" />
-
-    <!-- Allows applications to set the wallpaper -->
-    <permission android:name="android.permission.SET_WALLPAPER"
-        android:permissionGroup="android.permission-group.WALLPAPER"
-        android:protectionLevel="normal"
-        android:label="@string/permlab_setWallpaper"
-        android:description="@string/permdesc_setWallpaper" />
-
-    <!-- Allows applications to set the wallpaper hints -->
-    <permission android:name="android.permission.SET_WALLPAPER_HINTS"
-        android:permissionGroup="android.permission-group.WALLPAPER"
-        android:protectionLevel="normal"
-        android:label="@string/permlab_setWallpaperHints"
-        android:description="@string/permdesc_setWallpaperHints" />
-
-    <!-- ============================================ -->
-    <!-- Permissions for changing the system clock -->
-    <!-- ============================================ -->
-    <eat-comment />
-
-    <!-- Group of permissions that are related to system clock. -->
-    <permission-group android:name="android.permission-group.SYSTEM_CLOCK"
-        android:label="@string/permgrouplab_systemClock"
-        android:icon="@drawable/perm_group_system_clock"
-        android:description="@string/permgroupdesc_systemClock"
-        android:priority="140" />
-
-    <!-- Allows applications to set the system time -->
-    <permission android:name="android.permission.SET_TIME"
-        android:protectionLevel="signature|system"
-        android:label="@string/permlab_setTime"
-        android:description="@string/permdesc_setTime" />
-
-    <!-- Allows applications to set the system time zone -->
-    <permission android:name="android.permission.SET_TIME_ZONE"
-        android:permissionGroup="android.permission-group.SYSTEM_CLOCK"
-        android:protectionLevel="normal"
-        android:label="@string/permlab_setTimeZone"
-        android:description="@string/permdesc_setTimeZone" />
-
-    <!-- ==================================================== -->
-    <!-- Permissions related to changing status bar   -->
-    <!-- ==================================================== -->
-
-    <!-- Used for permissions that change the status bar -->
-    <permission-group android:name="android.permission-group.STATUS_BAR"
-        android:label="@string/permgrouplab_statusBar"
-        android:icon="@drawable/perm_group_status_bar"
-        android:description="@string/permgroupdesc_statusBar"
-        android:priority="110" />
-
-    <!-- Allows an application to expand or collapse the status bar. -->
-    <permission android:name="android.permission.EXPAND_STATUS_BAR"
-        android:permissionGroup="android.permission-group.STATUS_BAR"
-        android:protectionLevel="normal"
-        android:label="@string/permlab_expandStatusBar"
-        android:description="@string/permdesc_expandStatusBar" />
-
-    <!-- ==================================================== -->
-    <!-- Permissions related to accessing sync settings   -->
-    <!-- ==================================================== -->
-
-    <!-- Used for permissions that access the sync settings or sync
-         related information. -->
-    <permission-group android:name="android.permission-group.SYNC_SETTINGS"
-        android:label="@string/permgrouplab_syncSettings"
-        android:icon="@drawable/perm_group_sync_settings"
-        android:description="@string/permgroupdesc_syncSettings"
-        android:priority="120" />
-
-    <!-- Allows applications to read the sync settings -->
-    <permission android:name="android.permission.READ_SYNC_SETTINGS"
-        android:permissionGroup="android.permission-group.SYNC_SETTINGS"
-        android:protectionLevel="normal"
-        android:description="@string/permdesc_readSyncSettings"
-        android:label="@string/permlab_readSyncSettings" />
-
-    <!-- Allows applications to write the sync settings -->
-    <permission android:name="android.permission.WRITE_SYNC_SETTINGS"
-        android:permissionGroup="android.permission-group.SYNC_SETTINGS"
-        android:protectionLevel="normal"
-        android:description="@string/permdesc_writeSyncSettings"
-        android:label="@string/permlab_writeSyncSettings" />
-
-    <!-- Allows applications to read the sync stats -->
-    <permission android:name="android.permission.READ_SYNC_STATS"
-        android:permissionGroup="android.permission-group.SYNC_SETTINGS"
-        android:protectionLevel="normal"
-        android:description="@string/permdesc_readSyncStats"
-        android:label="@string/permlab_readSyncStats" />
-
-
-    <!-- ============================================ -->
-    <!-- Permissions for low-level system interaction -->
-    <!-- ============================================ -->
-    <eat-comment />
-
-    <!-- Group of permissions that are related to system APIs.  Many
-         of these are not permissions the user will be expected to understand,
-         and such permissions should generally be marked as "normal" protection
-         level so they don't get displayed.  This can also, however, be used
-         for miscellaneous features that provide access to the operating system,
-         such as writing the global system settings. -->
-    <permission-group android:name="android.permission-group.SYSTEM_TOOLS"
-        android:label="@string/permgrouplab_systemTools"
-        android:icon="@drawable/perm_group_system_tools"
-        android:description="@string/permgroupdesc_systemTools"
-        android:priority="100" />
-
-    <!-- @hide Change the screen compatibility mode of applications -->
-    <permission android:name="android.permission.SET_SCREEN_COMPATIBILITY"
-        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
-        android:protectionLevel="signature"
-        android:label="@string/permlab_setScreenCompatibility"
-        android:description="@string/permdesc_setScreenCompatibility" />
-
-    <!-- Allows an application to modify the current configuration, such
-         as locale. -->
-    <permission android:name="android.permission.CHANGE_CONFIGURATION"
-        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
-        android:protectionLevel="signature|system|development"
-        android:label="@string/permlab_changeConfiguration"
-        android:description="@string/permdesc_changeConfiguration" />
-
-    <!-- Allows an application to read or write the system settings. -->
-    <permission android:name="android.permission.WRITE_SETTINGS"
-        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
-        android:protectionLevel="normal"
-        android:label="@string/permlab_writeSettings"
-        android:description="@string/permdesc_writeSettings" />
-
-    <!-- Allows an application to modify the Google service map. -->
-    <permission android:name="android.permission.WRITE_GSERVICES"
-        android:protectionLevel="signature|system"
-        android:label="@string/permlab_writeGservices"
-        android:description="@string/permdesc_writeGservices" />
-
-    <!-- @hide Change the screen compatibility mode of applications -->
-    <permission android:name="android.permission.SET_SCREEN_COMPATIBILITY"
-        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
-        android:protectionLevel="signature"
-        android:label="@string/permlab_setScreenCompatibility"
-        android:description="@string/permdesc_setScreenCompatibility" />
-
-    <!-- Allows an application to modify the current configuration, such
-         as locale. -->
-    <permission android:name="android.permission.CHANGE_CONFIGURATION"
-        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
-        android:protectionLevel="system|signature"
-        android:label="@string/permlab_changeConfiguration"
-        android:description="@string/permdesc_changeConfiguration" />
-
     <!-- Allows an application to call
         {@link android.app.ActivityManager#forceStopPackage}.
         @hide -->
@@ -1224,6 +839,17 @@
         android:label="@string/permlab_retrieve_window_content"
         android:description="@string/permdesc_retrieve_window_content" />
 
+    <!-- Allows an application to open windows using the type
+         {@link android.view.WindowManager.LayoutParams#TYPE_SYSTEM_ALERT},
+         shown on top of all other applications.  Very few applications
+         should use this permission; these windows are intended for
+         system-level interaction with the user. -->
+    <permission android:name="android.permission.SYSTEM_ALERT_WINDOW"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_systemAlertWindow"
+        android:description="@string/permdesc_systemAlertWindow" />
+
     <!-- Modify the global animation scaling factor. -->
     <permission android:name="android.permission.SET_ANIMATION_SCALE"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
@@ -1235,7 +861,7 @@
          not use. Allow an application to make its activities persistent. -->
     <permission android:name="android.permission.PERSISTENT_ACTIVITY"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
-        android:protectionLevel="normal"
+        android:protectionLevel="dangerous"
         android:label="@string/permlab_persistentActivity"
         android:description="@string/permdesc_persistentActivity" />
 
@@ -1282,17 +908,52 @@
         android:label="@string/permlab_broadcastSticky"
         android:description="@string/permdesc_broadcastSticky" />
 
+    <!-- Allows using PowerManager WakeLocks to keep processor from sleeping or screen
+         from dimming -->
+    <permission android:name="android.permission.WAKE_LOCK"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_wakeLock"
+        android:description="@string/permdesc_wakeLock" />
+
+    <!-- Allows applications to set the wallpaper -->
+    <permission android:name="android.permission.SET_WALLPAPER"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="normal"
+        android:label="@string/permlab_setWallpaper"
+        android:description="@string/permdesc_setWallpaper" />
+
+    <!-- Allows applications to set the wallpaper hints -->
+    <permission android:name="android.permission.SET_WALLPAPER_HINTS"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="normal"
+        android:label="@string/permlab_setWallpaperHints"
+        android:description="@string/permdesc_setWallpaperHints" />
+
+    <!-- Allows applications to set the system time -->
+    <permission android:name="android.permission.SET_TIME"
+        android:protectionLevel="signature|system"
+        android:label="@string/permlab_setTime"
+        android:description="@string/permdesc_setTime" />
+
+    <!-- Allows applications to set the system time zone -->
+    <permission android:name="android.permission.SET_TIME_ZONE"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_setTimeZone"
+        android:description="@string/permdesc_setTimeZone" />
+
     <!-- Allows mounting and unmounting file systems for removable storage. -->
     <permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
-        android:protectionLevel="system|signature"
+        android:protectionLevel="dangerous"
         android:label="@string/permlab_mount_unmount_filesystems"
         android:description="@string/permdesc_mount_unmount_filesystems" />
 
     <!-- Allows formatting file systems for removable storage. -->
     <permission android:name="android.permission.MOUNT_FORMAT_FILESYSTEMS"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
-        android:protectionLevel="system|signature"
+        android:protectionLevel="dangerous"
         android:label="@string/permlab_mount_format_filesystems"
         android:description="@string/permdesc_mount_format_filesystems" />
 
@@ -1336,6 +997,34 @@
         android:label="@string/permlab_asec_rename"
         android:description="@string/permdesc_asec_rename" />
 
+    <!-- Allows applications to disable the keyguard -->
+    <permission android:name="android.permission.DISABLE_KEYGUARD"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="dangerous"
+        android:description="@string/permdesc_disableKeyguard"
+        android:label="@string/permlab_disableKeyguard" />
+
+    <!-- Allows applications to read the sync settings -->
+    <permission android:name="android.permission.READ_SYNC_SETTINGS"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="normal"
+        android:description="@string/permdesc_readSyncSettings"
+        android:label="@string/permlab_readSyncSettings" />
+
+    <!-- Allows applications to write the sync settings -->
+    <permission android:name="android.permission.WRITE_SYNC_SETTINGS"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="dangerous"
+        android:description="@string/permdesc_writeSyncSettings"
+        android:label="@string/permlab_writeSyncSettings" />
+
+    <!-- Allows applications to read the sync stats -->
+    <permission android:name="android.permission.READ_SYNC_STATS"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="normal"
+        android:description="@string/permdesc_readSyncStats"
+        android:label="@string/permlab_readSyncStats" />
+
     <!-- Allows applications to write the apn settings -->
     <permission android:name="android.permission.WRITE_APN_SETTINGS"
                 android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
@@ -1359,10 +1048,41 @@
     <!-- Allows applications to change network connectivity state -->
     <permission android:name="android.permission.CHANGE_NETWORK_STATE"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
-        android:protectionLevel="normal"
+        android:protectionLevel="dangerous"
         android:description="@string/permdesc_changeNetworkState"
         android:label="@string/permlab_changeNetworkState" />
 
+    <!-- Allows applications to change Wi-Fi connectivity state -->
+    <permission android:name="android.permission.CHANGE_WIFI_STATE"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="dangerous"
+        android:description="@string/permdesc_changeWifiState"
+        android:label="@string/permlab_changeWifiState" />
+
+
+    <!-- @hide -->
+    <permission android:name="android.permission.CHANGE_WIMAX_STATE"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="dangerous"
+        android:description="@string/permdesc_changeWimaxState"
+        android:label="@string/permlab_changeWimaxState" />
+
+
+
+    <!-- Allows applications to enter Wi-Fi Multicast mode -->
+    <permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="dangerous"
+        android:description="@string/permdesc_changeWifiMulticastState"
+        android:label="@string/permlab_changeWifiMulticastState" />
+
+    <!-- Allows applications to discover and pair bluetooth devices -->
+    <permission android:name="android.permission.BLUETOOTH_ADMIN"
+        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+        android:protectionLevel="dangerous"
+        android:description="@string/permdesc_bluetoothAdmin"
+        android:label="@string/permlab_bluetoothAdmin" />
+
     <!-- Allows an application to clear the caches of all installed
          applications on the device.  -->
     <permission android:name="android.permission.CLEAR_APP_CACHE"
@@ -1389,8 +1109,7 @@
          purposes. -->
     <permission-group android:name="android.permission-group.DEVELOPMENT_TOOLS"
         android:label="@string/permgrouplab_developmentTools"
-        android:description="@string/permgroupdesc_developmentTools"
-        android:priority="310" />
+        android:description="@string/permgroupdesc_developmentTools" />
 
     <!-- Allows an application to read or write the secure system settings. -->
     <permission android:name="android.permission.WRITE_SECURE_SETTINGS"
diff --git a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo1.png b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo1.png
index bf3cabb..7efb94f 100644
--- a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo1.png
+++ b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo1.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo2.png b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo2.png
index c4f00be..00e6879 100644
--- a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo2.png
+++ b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo2.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo3.png b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo3.png
index 935e44f..3ffcd68 100644
--- a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo3.png
+++ b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo3.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo4.png b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo4.png
index 03ae28b..a5e94f7 100644
--- a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo4.png
+++ b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo4.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo5.png b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo5.png
index b68981f..dfdeba3 100644
--- a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo5.png
+++ b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo5.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo6.png b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo6.png
index 678b772..5b02b13 100644
--- a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo6.png
+++ b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo6.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo7.png b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo7.png
index 0aeb0a6..815f31b 100644
--- a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo7.png
+++ b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo7.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo8.png b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo8.png
index 1bd7312..936794c 100644
--- a/core/res/res/drawable-hdpi/progressbar_indeterminate_holo8.png
+++ b/core/res/res/drawable-hdpi/progressbar_indeterminate_holo8.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo1.png b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo1.png
index 1e5d956..5a9dec3 100644
--- a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo1.png
+++ b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo1.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo2.png b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo2.png
index d0c0200..184b280 100644
--- a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo2.png
+++ b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo2.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo3.png b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo3.png
index bfdc5ea..96f0644 100644
--- a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo3.png
+++ b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo3.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo4.png b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo4.png
index 1440bc8..2393a2c 100644
--- a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo4.png
+++ b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo4.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo5.png b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo5.png
index 4f645fa8..4c1d60d 100644
--- a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo5.png
+++ b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo5.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo6.png b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo6.png
index 21966fd..cb89d16 100644
--- a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo6.png
+++ b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo6.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo7.png b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo7.png
index 7ca15ed..a4f843a 100644
--- a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo7.png
+++ b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo7.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo8.png b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo8.png
index 369d0ac..ea1ee05 100644
--- a/core/res/res/drawable-mdpi/progressbar_indeterminate_holo8.png
+++ b/core/res/res/drawable-mdpi/progressbar_indeterminate_holo8.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo1.png b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo1.png
index ca24502..f541e32 100644
--- a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo1.png
+++ b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo1.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo2.png b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo2.png
index 5653118..4c3f686 100644
--- a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo2.png
+++ b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo2.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo3.png b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo3.png
index 438b1b5..42ccc49 100644
--- a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo3.png
+++ b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo3.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo4.png b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo4.png
index efe3fed..e5f0cd3 100644
--- a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo4.png
+++ b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo4.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo5.png b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo5.png
index cb7931c..415494b 100644
--- a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo5.png
+++ b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo5.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo6.png b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo6.png
index 8ff7ee9..297d7b7 100644
--- a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo6.png
+++ b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo6.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo7.png b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo7.png
index ce07298..ba152f2 100644
--- a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo7.png
+++ b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo7.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo8.png b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo8.png
index 87e9d8f..b996b94 100644
--- a/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo8.png
+++ b/core/res/res/drawable-xhdpi/progressbar_indeterminate_holo8.png
Binary files differ
diff --git a/core/res/res/drawable/ic_lockscreen_search.xml b/core/res/res/drawable/ic_lockscreen_search.xml
index 4040153..d7a5b00 100644
--- a/core/res/res/drawable/ic_lockscreen_search.xml
+++ b/core/res/res/drawable/ic_lockscreen_search.xml
@@ -31,6 +31,6 @@
         android:state_enabled="true"
         android:state_active="false"
         android:state_focused="true"
-        android:drawable="@drawable/ic_lockscreen_google_activated" />
+        android:drawable="@drawable/ic_lockscreen_google_focused" />
 
 </selector>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 51be22d..801fdf6 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -881,6 +881,11 @@
   <java-symbol type="string" name="granularity_label_word" />
   <java-symbol type="string" name="granularity_label_link" />
   <java-symbol type="string" name="granularity_label_line" />
+  <java-symbol type="string" name="default_audio_route_name" />
+  <java-symbol type="string" name="default_audio_route_name_headphones" />
+  <java-symbol type="string" name="default_audio_route_name_dock_speakers" />
+  <java-symbol type="string" name="default_audio_route_name_hdmi" />
+  <java-symbol type="string" name="default_audio_route_category_name" />
 
   <java-symbol type="plurals" name="abbrev_in_num_days" />
   <java-symbol type="plurals" name="abbrev_in_num_hours" />
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 4cac3ec..ec8634a9 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -390,12 +390,11 @@
     <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permgrouplab_personalInfo">Your personal information</string>
     <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_personalInfo">Direct access to information about you, stored in on your contact card.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_socialInfo">Your social information</string>
+    <string name="permgroupdesc_personalInfo" product="tablet">Direct access to your contacts
+        and calendar stored on the tablet.</string>
     <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_socialInfo">Direct access to information about your contacts and social connections.</string>
+    <string name="permgroupdesc_personalInfo" product="default">Direct access to your contacts
+        and calendar stored on the phone.</string>
 
     <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permgrouplab_location">Your location</string>
@@ -408,91 +407,6 @@
     <string name="permgroupdesc_network">Access various network features.</string>
 
     <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_bluetoothNetwork">Bluetooth</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_bluetoothNetwork">Access devices and networks through Bluetooth.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_shortrangeNetwork">Short-range Networks</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_shortrangeNetwork">Access devices through short-range networks such as NFC.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_audioSettings">Audio Settings</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_audioSettings">Change audio settings.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_affectsBattery">Affects Battery</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_affectsBattery">Use features that can quickly drain battery.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_calendar">Calendar</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_calendar">Direct access to calendar and events.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_dictionary">Read User Dictionary</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_dictionary">Read words in user dictionary.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_writeDictionary">Write User Dictionary</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_writeDictionary">Add words to the user dictionary.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_bookmarks">Bookmarks and History</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_bookmarks">Direct access to bookmarks and browser history.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_deviceAlarms">Alarm</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_deviceAlarms">Set the alarm clock.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_voicemail">Voicemail</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_voicemail">Direct access to voicemail.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_microphone">Microphone</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_microphone">Direct access to the microphone to record audio.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_camera">Camera</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_camera">Direct access to camera for image or video capture.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_appInfo">Your applications information</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_appInfo">Ability to affect behavior of other applications on your device.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_wallpaper">Wallpaper</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_wallpaper">Change the device wallpaper settings.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_systemClock">Clock</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_systemClock">Change the device time or timezone.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_statusBar">Status Bar</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_statusBar">Change the device status bar settings.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_syncSettings">Sync Settings</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_syncSettings">Access to the sync settings.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permgrouplab_accounts">Your accounts</string>
     <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permgroupdesc_accounts">Access the available accounts.</string>
@@ -518,11 +432,6 @@
     <string name="permgroupdesc_developmentTools">Features only needed for app developers.</string>
 
     <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_display">Other Application UI</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_display">Effect the UI of other applications.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permgrouplab_storage">Storage</string>
     <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this.   [CHAR LIMIT=30] -->
     <string name="permgroupdesc_storage" product="nosdcard">Access the USB storage.</string>
@@ -549,23 +458,23 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_processOutgoingCalls">reroute outgoing calls</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_processOutgoingCalls">Allows the app to
-        process outgoing calls and change the number to be dialed. Malicious
-        apps may monitor, redirect, or prevent outgoing calls.</string>
+    <string name="permdesc_processOutgoingCalls">Allows the app to process
+      outgoing calls and change the number to be dialed. This permission allows
+      the app to monitor, redirect, or prevent outgoing calls.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_receiveSms">receive text messages (SMS)</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_receiveSms">Allows the app to receive
-      and process SMS messages. Malicious apps may monitor
-      your messages or delete them without showing them to you.</string>
+    <string name="permdesc_receiveSms">Allows the app to receive and process SMS
+      messages. This means the app could monitor or delete messages sent to your
+      device without showing them to you.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_receiveMms">receive text messages (MMS)</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_receiveMms">Allows the app to receive
-      and process MMS messages. Malicious apps may monitor
-      your messages or delete them without showing them to you.</string>
+    <string name="permdesc_receiveMms">Allows the app to receive and process MMS
+      messages. This means the app could monitor or delete messages sent to your
+      device without showing them to you.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_receiveEmergencyBroadcast">receive emergency broadcasts</string>
@@ -586,27 +495,27 @@
      <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_sendSms">send SMS messages</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_sendSms">Allows the app to send SMS
-      messages. Malicious apps may cost you money by sending
-      messages without your confirmation.</string>
+    <string name="permdesc_sendSms">Allows the app to send SMS messages.
+     This may result in unexpected charges. Malicious apps may cost you money by
+     sending messages without your confirmation.</string>
 
      <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_sendSmsNoConfirmation">send SMS messages with no confirmation</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permdesc_sendSmsNoConfirmation">Allows the app to send SMS
-      messages. Malicious apps may cost you money by sending
-      messages without your confirmation.</string>
+      messages. This may result in unexpected charges. Malicious apps may cost
+      you money by sending messages without your confirmation.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_readSms">read your text messages (SMS or MMS)</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_readSms" product="tablet">Allows the app to read
-      SMS messages stored on your tablet or SIM card. Malicious apps
-      may read your confidential messages.</string>
+    <string name="permdesc_readSms" product="tablet">Allows the app to read SMS
+      messages stored on your tablet or SIM card. This allows the app to read all
+      SMS messages, regardless of content or confidentiality.</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_readSms" product="default">Allows the app to read
-      SMS messages stored on your phone or SIM card. Malicious apps
-      may read your confidential messages.</string>
+    <string name="permdesc_readSms" product="default">Allows the app to read SMS
+      messages stored on your phone or SIM card. This allows the app to read all
+      SMS messages, regardless of content or confidentiality.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_writeSms">edit your text messages (SMS or MMS)</string>
@@ -622,30 +531,30 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_receiveWapPush">receive text messages (WAP)</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_receiveWapPush">Allows the app to receive
-      and process WAP messages. Malicious apps may monitor
-      your messages or delete them without showing them to you.</string>
+    <string name="permdesc_receiveWapPush">Allows the app to receive and process
+     WAP messages.  This permission includes the ability to monitor or delete
+     messages sent to you without showing them to you.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_getTasks">retrieve running apps</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_getTasks">Allows the app to retrieve
-        information about currently and recently running tasks. Malicious apps may
-        discover private information about other apps.</string>
+
+    <string name="permdesc_getTasks">Allows the app to retrieve information
+       about currently and recently running tasks.  This may allow the app to
+       discover information about which applications are used on the device.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=50] -->
     <string name="permlab_getDetailedTasks">retrieve details of running apps</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=NONE] -->
     <string name="permdesc_getDetailedTasks">Allows the app to retrieve
-        detailed information about currently and recently running tasks. Malicious apps may 
+        detailed information about currently and recently running tasks. Malicious apps may
         discover private information about other apps.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_reorderTasks">reorder running apps</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_reorderTasks">Allows the app to move
-        tasks to the foreground and background. Malicious apps may force
-        themselves to the front without your control.</string>
+    <string name="permdesc_reorderTasks">Allows the app to move tasks to the
+      foreground and background.  The app may do this without your input.</string>
 
     <!-- Title of an application permission, allowing an application to remove/kill tasks -->
     <string name="permlab_removeTasks">stop running apps</string>
@@ -689,9 +598,9 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_killBackgroundProcesses">close other apps</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_killBackgroundProcesses">Allows the app to
-        kill background processes of other apps, even if memory
-        isn\'t low.</string>
+    <string name="permdesc_killBackgroundProcesses">Allows the app to end
+      background processes of other apps.  This may cause other apps to stop
+      running.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_forceStopPackages">force stop other apps</string>
@@ -804,9 +713,9 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_systemAlertWindow">draw over other apps</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_systemAlertWindow">Allows the app to
-        show system alert windows. Malicious apps may take over the
-        entire screen.</string>
+    <string name="permdesc_systemAlertWindow">Allows the app to show system
+      alert windows.  Some alert windows may take over the entire screen.
+      </string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_setAnimationScale">modify global animation speed</string>
@@ -910,9 +819,8 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_persistentActivity">make app always run</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_persistentActivity">Allows the app to make
-        parts of itself persistent, so the system can\'t use it for other
-        apps.</string>
+    <string name="permdesc_persistentActivity" product="tablet">Allows the app to make parts of itself persistent in memory.  This can limit memory available to other apps slowing down the tablet.</string>
+    <string name="permdesc_persistentActivity" product="default">Allows the app to make parts of itself persistent in memory.  This can limit memory available to other apps slowing down the phone.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_deletePackages">delete apps</string>
@@ -1049,56 +957,60 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_broadcastSticky">send sticky broadcast</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_broadcastSticky" product="tablet">Allows the app to send
-        sticky broadcasts, which remain after the broadcast ends.
-        Malicious apps may make the tablet slow or unstable by causing it
-        to use too much memory.</string>
+    <string name="permdesc_broadcastSticky" product="tablet">Allows the app to
+    send sticky broadcasts, which remain after the broadcast ends. Excessive use
+    may make the tablet slow or unstable by causing it to use too much memory.
+    </string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_broadcastSticky" product="default">Allows the app to send
-        sticky broadcasts, which remain after the broadcast ends.
-        Malicious apps may make the phone slow or unstable by causing it
-        to use too much memory.</string>
+    <string name="permdesc_broadcastSticky" product="default">Allows the app to
+    send sticky broadcasts, which remain after the broadcast ends. Excessive
+    use may make the phone slow or unstable by causing it to use too
+    much memory.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_readContacts">read your contacts</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_readContacts" product="tablet">Allows the app to read all
-        the data about your contacts stored on your tablet, including the frequency
-        with which you\'ve called, emailed, or communicated in other ways with specific
-        individuals. This helps with auto-completion of email addresses and other convenient
-        features. Malicious apps can use this permission to send your contact data to
-        other people.</string>
+    <string name="permdesc_readContacts" product="tablet">Allows the app to read
+      data about your contacts stored on your tablet, including the frequency
+      with which you\'ve called, emailed, or communicated in other ways with
+      specific individuals. This permission allows apps to save your contact
+      data, and malicious apps may share contact data without your
+      knowledge.</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_readContacts" product="default">Allows the app to read all
-        the data about your contacts stored on your phone, including the frequency
-        with which you\'ve called, emailed, or communicated in other ways with specific
-        individuals. This helps with auto-completion of email addresses and other convenient
-        features. Malicious apps can use this permission to send your contact data to
-        other people.</string>
+    <string name="permdesc_readContacts" product="default">Allows the app to
+      read data about your contacts stored on your phone, including the
+      frequency with which you\'ve called, emailed, or communicated in other ways
+      with specific individuals. This permission allows apps to save your
+      contact data, and malicious apps may share contact data without your
+      knowledge.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_writeContacts">modify your contacts</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_writeContacts" product="tablet">Allows the app to modify
-        the data about your contacts stored on your tablet, including the frequency
-        with which you\'ve called, emailed, or communicated in other ways with specific
-        individuals. This helps with auto-completion of email addresses and other convenient
-        features. Malicious apps may use this to erase or modify your contact data.</string>
+    <string name="permdesc_writeContacts" product="tablet">Allows the app to
+      modify the data about your contacts stored on your tablet, including the
+      frequency with which you\'ve called, emailed, or communicated in other ways
+      with specific contacts. This permission allows apps to delete contact
+      data.</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_writeContacts" product="default">Allows the app to modify
-        the data about your contacts stored on your phone, including the frequency
-        with which you\'ve called, emailed, or communicated in other ways with specific
-        individuals. This helps with auto-completion of email addresses and other convenient
-        features. Malicious apps may use this to erase or modify your contact data.</string>
+    <string name="permdesc_writeContacts" product="default">Allows the app to
+    modify the data about your contacts stored on your phone, including the
+    frequency with which you\'ve called, emailed, or communicated in other ways
+    with specific contacts. This permission allows apps to delete contact
+    data.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_readCallLog">read call log</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_readCallLog" product="tablet">Allows the app to read your tablet\'s call log, including data about incoming and outgoing calls.
-        Malicious apps may use this to send your data to other people.</string>
+    <string name="permdesc_readCallLog" product="tablet">Allows the app to read
+     your tablet\'s call log, including data about incoming and outgoing calls.
+     This permission allows apps to save your call log data, and malicious apps
+     may share call log data without your knowledge.</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_readCallLog" product="default">Allows the app to read your phone\'s call log, including data about incoming and outgoing calls.
-        Malicious apps may use this to send your data to other people.</string>
+    <string name="permdesc_readCallLog" product="default">Allows the app to read
+      your phone\'s call log, including data about incoming and outgoing calls.
+      This permission allows apps to save your call log data, and malicious apps
+      may share call log data without your knowledge.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_writeCallLog">write call log</string>
@@ -1113,93 +1025,110 @@
     <!-- Title of the read profile permission, listed so the user can decide whether to allow the application to read the user's personal profile data. [CHAR LIMIT=30] -->
     <string name="permlab_readProfile">read your own contact card</string>
     <!-- Description of the read profile permission, listed so the user can decide whether to allow the application to read the user's personal profile data. [CHAR LIMIT=NONE] -->
-    <string name="permdesc_readProfile" product="default">Allows the app to read personal
-        profile information stored on your device, such as your name and contact information. This
-        means the app can identify you and send your profile information to others.</string>
+    <string name="permdesc_readProfile" product="default">Allows the app to read
+     personal profile information stored on your device, such as your name and
+     contact information. This means the app can identify you and may send your
+     profile information to others.</string>
 
     <!-- Title of the write profile permission, listed so the user can decide whether to allow the application to write to the user's personal profile data. [CHAR LIMIT=30] -->
     <string name="permlab_writeProfile">modify your own contact card</string>
     <!-- Description of the write profile permission, listed so the user can decide whether to allow the application to write to the user's personal profile data. [CHAR LIMIT=NONE] -->
-    <string name="permdesc_writeProfile" product="default">Allows the app to change or add
-        to personal profile information stored on your device, such as your name and contact
-        information.  This means other apps can identify you and send your profile
-        information to others.</string>
+    <string name="permdesc_writeProfile" product="default">Allows the app to
+      change or add to personal profile information stored on your device, such
+      as your name and contact information.  This means the app can identify you
+      and may send your profile information to others.</string>
 
     <!-- Title of the read social stream permission, listed so the user can decide whether to allow the application to read information from the user's social stream. [CHAR LIMIT=30] -->
     <string name="permlab_readSocialStream" product="default">read your social stream</string>
-    <string name="permdesc_readSocialStream" product="default">Allows the app to access
-        and sync social updates from you and your friends. Malicious apps may use this to read
-        private communications between you and your friends on social networks.</string>
+    <string name="permdesc_readSocialStream" product="default">Allows the app
+      to access and sync social updates from you and your friends. Be careful
+      when sharing information -- this allows the app to read communications
+      between you and your friends on social networks, regardless of
+      confidentiality. Note: this permission may not be enforced on all social
+      networks.</string>
 
     <!-- Title of the write social stream permission, listed so the user can decide whether to allow the application to write information to the user's social stream. [CHAR LIMIT=30] -->
     <string name="permlab_writeSocialStream" product="default">write to your social stream</string>
-    <string name="permdesc_writeSocialStream" product="default">Allows the app to display
-        social updates from your friends. Malicious apps may use this to pretend to be a friend
-        and trick you into revealing passwords or other confidential information.</string>
-
+    <string name="permdesc_writeSocialStream" product="default">Allows the app to
+     display social updates from your friends.  Be careful when sharing
+     information -- this allows the app to produce messages that may appear to
+     come from a friend. Note: this permission may not be enforced on all social
+     networks.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_readCalendar">read calendar events plus confidential information</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_readCalendar" product="tablet">Allows the app to read all calendar
-        events stored on your tablet, including those of friends or coworkers. Malicious apps
-        may extract personal information from these calendars without the owners\' knowledge.</string>
+
+    <string name="permdesc_readCalendar" product="tablet">Allows the app to read
+       all calendar events stored on your tablet, including those of friends or
+       co-workers. This may allow the app to share or save your calendar data,
+       regardless of confidentiality or sensitivity.</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_readCalendar" product="default">Allows the app to read all calendar
-        events stored on your phone, including those of friends or coworkers. Malicious apps
-        may extract personal information from these calendars without the owners\' knowledge.</string>
+    <string name="permdesc_readCalendar" product="default">Allows the app to
+       read all calendar events stored on your phone, including those of friends
+       or co-workers. This may allow the app to share or save your calendar data,
+       regardless of confidentiality or sensitivity.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_writeCalendar">add or modify calendar events and send email to guests without owners\' knowledge</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_writeCalendar">Allows the app to send event invitations as the calendar owner and add, remove,
-        change events that you can modify on your device, including those of friends or co-workers. Malicious apps
-        may send spam emails that appear to come from calendar owners, modify events without the owners\' knowledge, or add fake events.</string>
+
+<string name="permdesc_writeCalendar" product="tablet">Allows the app to
+     add, remove, change events that you can modify on your tablet, including
+     those of friends or co-workers. This may allow the app to send messages
+     that appear to come from calendar owners, or modify events without the
+     owners\' knowledge.</string>
+<string name="permdesc_writeCalendar" product="default">Allows the app to
+     add, remove, change events that you can modify on your phone, including
+     those of friends or co-workers. This may allow the app to send messages
+     that appear to come from calendar owners, or modify events without the
+     owners\' knowledge.</string>
+
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_accessMockLocation">mock location sources for testing</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_accessMockLocation">Allows the app to create mock location sources for testing.
-        Malicious apps may use this to override the location and/or status returned by real
-        location sources such as GPS or network providers.</string>
+    <string name="permdesc_accessMockLocation">Create mock location sources for
+      testing or install a new location provider.  This allows the app to
+      override the location and/or status returned by other location sources
+      such as GPS or location providers.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_accessLocationExtraCommands">access extra location provider commands</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_accessLocationExtraCommands">Allows the app to access extra location provider commands.
-        Malicious apps may use this to interfere with the operation of the GPS
-        or other location sources.</string>
+    <string name="permdesc_accessLocationExtraCommands">Allows the app to access
+      extra location provider commands.  This may allow the app to to interfere
+      with the operation of the GPS or other location sources.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_installLocationProvider">permission to install a location provider</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_installLocationProvider">Create mock location sources for testing.
-        Malicious apps may use this to override the location and/or status returned by real
-        location sources such as GPS or Network providers or monitor and report your location to an external source.</string>
+    <string name="permdesc_installLocationProvider">Create mock location sources
+      for testing or install a new location provider.  This allows the app to
+      override the location and/or status returned by other location sources
+      such as GPS or location providers.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permlab_accessFineLocation">fine (GPS) location</string>
+    <string name="permlab_accessFineLocation">precise (GPS) location</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_accessFineLocation" product="tablet">Access fine location sources such as the
-        Global Positioning System on the tablet, where available.
-        Malicious apps may use this to determine where you are, and may
-        consume additional battery power.</string>
+    <string name="permdesc_accessFineLocation" product="tablet">Access precise
+      location sources such as the Global Positioning System on the tablet. When
+      location services are available and turned on, this permission allows the
+      app to determine your precise location.</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_accessFineLocation" product="default">Access fine location sources such as the
-        Global Positioning System on the phone, where available.
-        Malicious apps may use this to determine where you are, and may
-        consume additional battery power.</string>
+    <string name="permdesc_accessFineLocation" product="default">Access precise
+      location sources such as the Global Positioning System on the phone. When
+      location services are available and turned on, this permission allows the
+      app to determine your precise location.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permlab_accessCoarseLocation">coarse (network-based) location</string>
+    <string name="permlab_accessCoarseLocation">approximate (network-based) location</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_accessCoarseLocation" product="tablet">Access coarse location sources such as the cellular
-        network database to determine an approximate tablet location, where available. Malicious
-        apps may use this to determine approximately where you are.</string>
-    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_accessCoarseLocation" product="default">Access coarse location sources such as the cellular
-        network database to determine an approximate phone location, where available. Malicious
-        apps may use this to determine approximately where you are.</string>
+    <string name="permdesc_accessCoarseLocation">Access
+      approximate location from location providers using network sources such as
+      cell tower and Wi-Fi. When these location services are available and turned
+      on, this permission allows the app to determine your approximate
+      location.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_accessSurfaceFlinger">access SurfaceFlinger</string>
@@ -1214,19 +1143,21 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_modifyAudioSettings">change your audio settings</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_modifyAudioSettings">Allows the app to modify global audio settings such as volume and routing.</string>
+    <string name="permdesc_modifyAudioSettings">Allows the app to modify global audio settings such as volume and which speaker is used for output.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_recordAudio">record audio</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_recordAudio">Allows the app to access the audio record path.</string>
+    <string name="permdesc_recordAudio">Allows the app to record audio with the
+      microphone.  This permission allows the app to record audio at any time
+      without your confirmation.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_camera">take pictures and videos</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permdesc_camera">Allows the app to take pictures and videos
-        with the camera. This allows the app at any time to collect
-        images the camera is seeing.</string>
+      with the camera.  This permission allows the app to use the camera at any
+      time without your confirmation.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_brick" product="tablet">permanently disable tablet</string>
@@ -1318,10 +1249,11 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_callPhone">directly call phone numbers</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_callPhone">Allows the app to call
-        phone numbers without your intervention. Malicious apps may
-        cause unexpected calls on your phone bill. Note that this doesn\'t
-        allow the app to call emergency numbers.</string>
+    <string name="permdesc_callPhone">Allows the app to call phone numbers
+      without your intervention. This may result in unexpected charges or calls.
+      Note that this doesn\'t allow the app to call emergency numbers.
+      Malicious apps may cost you money by making calls without your
+      confirmation.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_callPrivileged">directly call any phone numbers</string>
@@ -1372,9 +1304,9 @@
     <string name="permlab_readPhoneState">read phone status and identity</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permdesc_readPhoneState">Allows the app to access the phone
-        features of the device.  An app with this permission can determine the phone
-        number and serial number of this phone, whether a call is active, the number that call
-        is connected to and the like.</string>
+      features of the device.  This permission allows the app to determine the
+      phone number and device IDs, whether a call is active, and the remote number
+      connected by a call.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_wakeLock" product="tablet">prevent tablet from sleeping</string>
@@ -1445,9 +1377,13 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_getAccounts">find accounts on the device</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_getAccounts" product="tablet">Allows the app to get the list of accounts known by the tablet.</string>
+    <string name="permdesc_getAccounts" product="tablet">Allows the app to get
+      the list of accounts known by the tablet.  This may include any accounts
+      created by applications you have installed.</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_getAccounts" product="default">Allows the app to get the list of accounts known by the phone.</string>
+    <string name="permdesc_getAccounts" product="default">Allows the app to get
+      the list of accounts known by the phone.  This may include any accounts
+      created by applications you have installed.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_authenticateAccounts">create accounts and set passwords</string>
@@ -1472,12 +1408,17 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_accessNetworkState">view network connections</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_accessNetworkState">Allows the app to view the state of all networks.</string>
+    <string name="permdesc_accessNetworkState">Allows the app to view
+      information about network connections such as which networks exist and are
+      connected.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permlab_createNetworkSockets">full Internet access</string>
+    <string name="permlab_createNetworkSockets">full network access</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_createNetworkSockets">Allows the app to create network sockets.</string>
+    <string name="permdesc_createNetworkSockets">Allows the app to create
+     network sockets and use custom network protocols. The browser and other
+     applications provide means to send data to the internet, so this
+     permission is not required to send data to the internet.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_writeApnSettings">change/intercept network settings and traffic</string>
@@ -1504,21 +1445,26 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_accessWifiState">view Wi-Fi connections</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_accessWifiState">Allows the app to view the information about the state of Wi-Fi.</string>
+    <string name="permdesc_accessWifiState">Allows the app to view information
+      about Wi-Fi networking, such as whether Wi-Fi is enabled and name of
+      connected Wi-Fi devices.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_changeWifiState">connect and disconnect from Wi-Fi</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_changeWifiState">Allows the app to connect to and disconnect from Wi-Fi access points, and to make changes to
-      configured Wi-Fi networks.</string>
+    <string name="permdesc_changeWifiState">Allows the app to connect to and
+      disconnect from Wi-Fi access points and to make changes to device
+      configuration for Wi-Fi networks.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_changeWifiMulticastState">allow Wi-Fi Multicast reception</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_changeWifiMulticastState">Allows the app to
-      receive packets not directly addressed to your device. This can be
-      useful when discovering services offered near by. It uses more power
-      than the non-multicast mode.</string>
+    <string name="permdesc_changeWifiMulticastState" product="tablet">Allows the app to receive
+      packets sent to all devices on a Wi-Fi network using multicast addresses,
+      not just your tablet.  It uses more power than the non-multicast mode.</string>
+    <string name="permdesc_changeWifiMulticastState" product="default">Allows the app to receive
+      packets sent to all devices on a Wi-Fi network using multicast addresses,
+      not just your phone.  It uses more power than the non-multicast mode.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_bluetoothAdmin">access Bluetooth settings</string>
@@ -1531,19 +1477,25 @@
       the local Bluetooth phone, and to discover and pair with remote devices.</string>
 
     <string name="permlab_accessWimaxState">View WiMAX connections</string>
-    <string name="permdesc_accessWimaxState">Allows the app to view the information about the state of WiMAX.</string>
+    <string name="permdesc_accessWimaxState">Allows the app to determine whether
+     WiMAX is enabled and information about any WiMAX networks that are
+     connected. </string>
+
     <string name="permlab_changeWimaxState">Change WiMAX state</string>
-    <string name="permdesc_changeWimaxState">Allows the app to connect to and disconnect from WiMAX network.</string>
+    <string name="permdesc_changeWimaxState" product="tablet">Allows the app to
+      connect the tablet to and disconnect the tablet from WiMAX networks.</string>
+    <string name="permdesc_changeWimaxState" product="default">Allows the app to
+      connect the phone to and disconnect the phone from WiMAX networks.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_bluetooth">pair with Bluetooth devices</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permdesc_bluetooth" product="tablet">Allows the app to view the
-      configuration of the local Bluetooth tablet, and to make and accept
+      configuration of Bluetooth on the tablet, and to make and accept
       connections with paired devices.</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permdesc_bluetooth" product="default">Allows the app to view the
-      configuration of the local Bluetooth phone, and to make and accept
+      configuration of the Bluetooth on the phone, and to make and accept
       connections with paired devices.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
@@ -1555,28 +1507,25 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_disableKeyguard">disable your screen lock</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_disableKeyguard">Allows the app to disable
-      the keylock and any associated password security. A legitimate example of
-      this is the phone disabling the keylock when receiving an incoming phone call,
-      then re-enabling the keylock when the call is finished.</string>
+    <string name="permdesc_disableKeyguard">Allows the app to disable the
+      keylock and any associated password security.  For example, the phone
+      disables the keylock when receiving an incoming phone call, then
+      re-enables the keylock when the call is finished.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_readSyncSettings">read sync settings</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_readSyncSettings">Allows the app to read the sync settings,
-        such as whether sync is enabled for the People app.</string>
+    <string name="permdesc_readSyncSettings">Allows the app to read the sync settings for an account. For example, this can determine whether the People app is synced with an account.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_writeSyncSettings">toggle sync on and off</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_writeSyncSettings">Allows the app to modify the sync
-        settings, such as whether sync is enabled for the People app.</string>
+    <string name="permdesc_writeSyncSettings">Allows an app to modify the sync settings for an account.  For example, this can be used to enable sync of the People app with an account.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_readSyncStats">read sync statistics</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_readSyncStats">Allows the app to read the sync stats; e.g., the
-        history of syncs that have occurred.</string>
+    <string name="permdesc_readSyncStats">Allows an app to read the sync stats for an account, including the history of sync events and how much data is synced. </string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_subscribedFeedsRead">read subscribed feeds</string>
@@ -1592,8 +1541,8 @@
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_readDictionary">read terms you added to the dictionary</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_readDictionary">Allows the app to read any private
-      words, names and phrases that the user may have stored in the user dictionary.</string>
+    <string name="permdesc_readDictionary">Allows the app to read all words,
+       names and phrases that the user may have stored in the user dictionary.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_writeDictionary">write to user-defined dictionary</string>
@@ -1602,13 +1551,13 @@
       user dictionary.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=30] -->
-    <string name="permlab_sdcardRead" product="nosdcard">read the contents of your USB storage</string>
+    <string name="permlab_sdcardRead" product="nosdcard">test access to protected storage</string>
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permlab_sdcardRead" product="default">read the contents of your SD card</string>
+    <string name="permlab_sdcardRead" product="default">test access to protected storage</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=30] -->
-    <string name="permdesc_sdcardRead" product="nosdcard">Allows the app to read contents of USB storage, which may include photos and media.</string>
+    <string name="permdesc_sdcardRead" product="nosdcard">Allows the app to test a permission for USB storage that will be availabe on future devices. </string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_sdcardRead" product="default">Allows the app to read contents of SD card, which may include photos and media.</string>
+    <string name="permdesc_sdcardRead" product="default">Allows the app to test a permission for the SD card that will be available on future devices.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=30] -->
     <string name="permlab_sdcardWrite" product="nosdcard">modify or delete the contents of your USB storage</string>
@@ -2386,21 +2335,28 @@
     <string name="permlab_readHistoryBookmarks">read your Web bookmarks and history</string>
     <!-- Description of an application permission, listed so the user can choose whether
         they want to allow the application to do this. -->
-    <string name="permdesc_readHistoryBookmarks">Allows the app to read all
-        the URLs that the Browser has visited, and all of the Browser\'s bookmarks.</string>
+    <string name="permdesc_readHistoryBookmarks">Allows the app to read the
+     history of all URLs that the Browser has visited, and all of the Browser\'s
+     bookmarks. Note: this permission may not be enforced by third-party
+     browsers or other  applications with web browsing capabilities.</string>
     <!-- Title of an application permission, listed so the user can choose whether
         they want to allow the application to do this. -->
+
     <string name="permlab_writeHistoryBookmarks">write web bookmarks and history</string>
     <!-- Description of an application permission, listed so the user can choose whether
         they want to allow the application to do this. -->
-    <string name="permdesc_writeHistoryBookmarks" product="tablet">Allows the app to modify the
-        Browser\'s history or bookmarks stored on your tablet. Malicious apps
-        may use this to erase or modify your Browser\'s data.</string>
+    <string name="permdesc_writeHistoryBookmarks" product="tablet">Allows the
+        app to modify the Browser\'s history or bookmarks stored on your tablet.
+        This may allow the app to erase or modify Browser data.  Note: this
+        permission may note be enforced by third-party browsers or other
+        applications with web browsing capabilities.</string>
     <!-- Description of an application permission, listed so the user can choose whether
         they want to allow the application to do this. -->
-    <string name="permdesc_writeHistoryBookmarks" product="default">Allows the app to modify the
-        Browser\'s history or bookmarks stored on your phone. Malicious apps
-        may use this to erase or modify your Browser\'s data.</string>
+    <string name="permdesc_writeHistoryBookmarks" product="default">Allows the
+        app to modify the Browser\'s history or bookmarks stored on your phone.
+        This may allow the app to erase or modify Browser data.  Note:
+        this permission may note be enforced by third-party browsers or other
+        applications with web browsing capabilities.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether
         they want to allow the application to do this. -->
@@ -3193,6 +3149,11 @@
     <!-- Description of an application permission,  used to invoke default container service to copy content. -->
     <string name="permdesc_copyProtectedData">Allows the app to invoke default container service to copy content. Not for use by normal apps.</string>
 
+    <!-- Title of an application permission that lets an application route media output. -->
+    <string name="permlab_route_media_output">Route media output</string>
+    <!-- Description of an application permission that lets an application route media output. -->
+    <string name="permdesc_route_media_output">Allows an application to route media output to other external devices.</string>
+
     <!-- Shown in the tutorial for tap twice for zoom control. -->
     <string name="tutorial_double_tap_to_zoom_message_short">Touch twice for zoom control</string>
 
@@ -3607,4 +3568,25 @@
          from the activity resolver to use just this once. [CHAR LIMIT=25] -->
     <string name="activity_resolver_use_once">Just once</string>
 
+    <!-- Name of the default audio route for tablets when nothing
+         is connected to a headphone or other wired audio output jack. [CHAR LIMIT=25] -->
+    <string name="default_audio_route_name" product="tablet">Tablet speakers</string>
+
+    <!-- Name of the default audio route when nothing is connected to
+         a headphone or other wired audio output jack. [CHAR LIMIT=25] -->
+    <string name="default_audio_route_name" product="default">Phone speaker</string>
+
+    <!-- Name of the default audio route when wired headphones are
+         connected. [CHAR LIMIT=25] -->
+    <string name="default_audio_route_name_headphones">Headphones</string>
+
+    <!-- Name of the default audio route when an audio dock is connected. [CHAR LIMIT=25] -->
+    <string name="default_audio_route_name_dock_speakers">Dock speakers</string>
+
+    <!-- Name of the default audio route when HDMI is connected. [CHAR LIMIT=25] -->
+    <string name="default_audio_route_name_hdmi">HDMI audio</string>
+
+    <!-- Name of the default audio route category. [CHAR LIMIT=25] -->
+    <string name="default_audio_route_category_name">System</string>
+
 </resources>
diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java
new file mode 100644
index 0000000..b23443d
--- /dev/null
+++ b/media/java/android/media/MediaRouter.java
@@ -0,0 +1,875 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.media;
+
+import android.bluetooth.BluetoothA2dp;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Handler;
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * MediaRouter allows applications to control the routing of media channels
+ * and streams from the current device to external speakers and destination devices.
+ *
+ * <p>Media routes should only be modified on your application's main thread.</p>
+ */
+public class MediaRouter {
+    private static final String TAG = "MediaRouter";
+
+    private Context mAppContext;
+    private AudioManager mAudioManager;
+    private Handler mHandler;
+    private final ArrayList<CallbackInfo> mCallbacks = new ArrayList<CallbackInfo>();
+
+    private final ArrayList<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
+    private final ArrayList<RouteCategory> mCategories = new ArrayList<RouteCategory>();
+
+    private final RouteCategory mSystemCategory;
+    private RouteInfo mDefaultAudio;
+    private RouteInfo mBluetoothA2dpRoute;
+
+    private RouteInfo mSelectedRoute;
+
+    // These get removed when an activity dies
+    final ArrayList<BroadcastReceiver> mRegisteredReceivers = new ArrayList<BroadcastReceiver>();
+
+    /**
+     * Route type flag for live audio.
+     *
+     * <p>A device that supports live audio routing will allow the media audio stream
+     * to be routed to supported destinations. This can include internal speakers or
+     * audio jacks on the device itself, A2DP devices, and more.</p>
+     *
+     * <p>Once initiated this routing is transparent to the application. All audio
+     * played on the media stream will be routed to the selected destination.</p>
+     */
+    public static final int ROUTE_TYPE_LIVE_AUDIO = 0x1;
+
+    /**
+     * Route type flag for application-specific usage.
+     *
+     * <p>Unlike other media route types, user routes are managed by the application.
+     * The MediaRouter will manage and dispatch events for user routes, but the application
+     * is expected to interpret the meaning of these events and perform the requested
+     * routing tasks.</p>
+     */
+    public static final int ROUTE_TYPE_USER = 0x00800000;
+
+    // Maps application contexts
+    static final HashMap<Context, MediaRouter> sRouters = new HashMap<Context, MediaRouter>();
+
+    /**
+     * Return a MediaRouter for the application that the specified Context belongs to.
+     * The behavior or availability of media routing may depend on
+     * various parameters of the context.
+     *
+     * @param context Context for the desired router
+     * @return Router for the supplied Context
+     */
+    public static MediaRouter forApplication(Context context) {
+        final Context appContext = context.getApplicationContext();
+        if (!sRouters.containsKey(appContext)) {
+            final MediaRouter r = new MediaRouter(appContext);
+            sRouters.put(appContext, r);
+            return r;
+        } else {
+            return sRouters.get(appContext);
+        }
+    }
+
+    static String typesToString(int types) {
+        final StringBuilder result = new StringBuilder();
+        if ((types & ROUTE_TYPE_LIVE_AUDIO) != 0) {
+            result.append("ROUTE_TYPE_LIVE_AUDIO ");
+        }
+        if ((types & ROUTE_TYPE_USER) != 0) {
+            result.append("ROUTE_TYPE_USER ");
+        }
+        return result.toString();
+    }
+
+    private MediaRouter(Context context) {
+        mAppContext = context;
+        mHandler = new Handler(mAppContext.getMainLooper());
+
+        mAudioManager = (AudioManager) mAppContext.getSystemService(Context.AUDIO_SERVICE);
+        mSystemCategory = new RouteCategory(mAppContext.getText(
+                com.android.internal.R.string.default_audio_route_category_name),
+                ROUTE_TYPE_LIVE_AUDIO, false);
+
+        registerReceivers();
+
+        createDefaultRoutes();
+    }
+
+    private void registerReceivers() {
+        final BroadcastReceiver volumeReceiver = new VolumeChangedBroadcastReceiver();
+        mAppContext.registerReceiver(volumeReceiver,
+                new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION));
+        mRegisteredReceivers.add(volumeReceiver);
+
+        final IntentFilter speakerFilter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
+        speakerFilter.addAction(Intent.ACTION_ANALOG_AUDIO_DOCK_PLUG);
+        speakerFilter.addAction(Intent.ACTION_DIGITAL_AUDIO_DOCK_PLUG);
+        speakerFilter.addAction(Intent.ACTION_HDMI_AUDIO_PLUG);
+        final BroadcastReceiver plugReceiver = new HeadphoneChangedBroadcastReceiver();
+        mAppContext.registerReceiver(plugReceiver, speakerFilter);
+        mRegisteredReceivers.add(plugReceiver);
+    }
+
+    void unregisterReceivers() {
+        final int count = mRegisteredReceivers.size();
+        for (int i = 0; i < count; i++) {
+            final BroadcastReceiver r = mRegisteredReceivers.get(i);
+            mAppContext.unregisterReceiver(r);
+        }
+        mRegisteredReceivers.clear();
+    }
+
+    private void createDefaultRoutes() {
+        mDefaultAudio = new RouteInfo(mSystemCategory);
+        mDefaultAudio.mName = mAppContext.getText(
+                com.android.internal.R.string.default_audio_route_name);
+        mDefaultAudio.mSupportedTypes = ROUTE_TYPE_LIVE_AUDIO;
+        addRoute(mDefaultAudio);
+    }
+
+    void onHeadphonesPlugged(boolean headphonesPresent, String headphonesName) {
+        mDefaultAudio.mName = headphonesPresent ? headphonesName : mAppContext.getText(
+                com.android.internal.R.string.default_audio_route_name);
+        dispatchRouteChanged(mDefaultAudio);
+    }
+
+    /**
+     * Set volume for the specified route types.
+     *
+     * @param types Volume will be set for these route types
+     * @param volume Volume to set in the range 0.f (inaudible) to 1.f (full volume).
+     */
+    public void setRouteVolume(int types, float volume) {
+        if ((types & ROUTE_TYPE_LIVE_AUDIO) != 0) {
+            final int index = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
+            mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, index, 0);
+        }
+        if ((types & ROUTE_TYPE_USER) != 0) {
+            dispatchVolumeChanged(ROUTE_TYPE_USER, volume);
+        }
+    }
+
+    /**
+     * Add a callback to listen to events about specific kinds of media routes.
+     * If the specified callback is already registered, its registration will be updated for any
+     * additional route types specified.
+     *
+     * @param types Types of routes this callback is interested in
+     * @param cb Callback to add
+     */
+    public void addCallback(int types, Callback cb) {
+        final int count = mCallbacks.size();
+        for (int i = 0; i < count; i++) {
+            final CallbackInfo info = mCallbacks.get(i);
+            if (info.cb == cb) {
+                info.type &= types;
+                return;
+            }
+        }
+        mCallbacks.add(new CallbackInfo(cb, types));
+    }
+
+    /**
+     * Remove the specified callback. It will no longer receive events about media routing.
+     *
+     * @param cb Callback to remove
+     */
+    public void removeCallback(Callback cb) {
+        final int count = mCallbacks.size();
+        for (int i = 0; i < count; i++) {
+            if (mCallbacks.get(i).cb == cb) {
+                mCallbacks.remove(i);
+                return;
+            }
+        }
+        Log.w(TAG, "removeCallback(" + cb + "): callback not registered");
+    }
+
+    public void selectRoute(int types, RouteInfo route) {
+        if (mSelectedRoute == route) return;
+
+        if (mSelectedRoute != null) {
+            // TODO filter types properly
+            dispatchRouteUnselected(types & mSelectedRoute.getSupportedTypes(), mSelectedRoute);
+        }
+        mSelectedRoute = route;
+        if (route != null) {
+            // TODO filter types properly
+            dispatchRouteSelected(types & route.getSupportedTypes(), route);
+        }
+    }
+
+    /**
+     * Add an app-specified route for media to the MediaRouter.
+     * App-specified route definitions are created using {@link #createUserRoute(RouteCategory)}
+     *
+     * @param info Definition of the route to add
+     * @see #createUserRoute()
+     * @see #removeUserRoute(UserRouteInfo)
+     */
+    public void addUserRoute(UserRouteInfo info) {
+        addRoute(info);
+    }
+
+    void addRoute(RouteInfo info) {
+        final RouteCategory cat = info.getCategory();
+        if (!mCategories.contains(cat)) {
+            mCategories.add(cat);
+        }
+        if (info.getCategory().isGroupable() && !(info instanceof RouteGroup)) {
+            // Enforce that any added route in a groupable category must be in a group.
+            final RouteGroup group = new RouteGroup(info.getCategory());
+            group.addRoute(info);
+            info = group;
+        }
+        final boolean onlyRoute = mRoutes.isEmpty();
+        mRoutes.add(info);
+        dispatchRouteAdded(info);
+        if (onlyRoute) {
+            selectRoute(info.getSupportedTypes(), info);
+        }
+    }
+
+    /**
+     * Remove an app-specified route for media from the MediaRouter.
+     *
+     * @param info Definition of the route to remove
+     * @see #addUserRoute(UserRouteInfo)
+     */
+    public void removeUserRoute(UserRouteInfo info) {
+        removeRoute(info);
+    }
+
+    void removeRoute(RouteInfo info) {
+        if (mRoutes.remove(info)) {
+            final RouteCategory removingCat = info.getCategory();
+            final int count = mRoutes.size();
+            boolean found = false;
+            for (int i = 0; i < count; i++) {
+                final RouteCategory cat = mRoutes.get(i).getCategory();
+                if (removingCat == cat) {
+                    found = true;
+                    break;
+                }
+            }
+            if (!found) {
+                mCategories.remove(removingCat);
+            }
+            dispatchRouteRemoved(info);
+        }
+    }
+
+    /**
+     * Return the number of {@link MediaRouter.RouteCategory categories} currently
+     * represented by routes known to this MediaRouter.
+     *
+     * @return the number of unique categories represented by this MediaRouter's known routes
+     */
+    public int getCategoryCount() {
+        return mCategories.size();
+    }
+
+    /**
+     * Return the {@link MediaRouter.RouteCategory category} at the given index.
+     * Valid indices are in the range [0-getCategoryCount).
+     *
+     * @param index which category to return
+     * @return the category at index
+     */
+    public RouteCategory getCategoryAt(int index) {
+        return mCategories.get(index);
+    }
+
+    /**
+     * Return the number of {@link MediaRouter.RouteInfo routes} currently known
+     * to this MediaRouter.
+     *
+     * @return the number of routes tracked by this router
+     */
+    public int getRouteCount() {
+        return mRoutes.size();
+    }
+
+    /**
+     * Return the route at the specified index.
+     *
+     * @param index index of the route to return
+     * @return the route at index
+     */
+    public RouteInfo getRouteAt(int index) {
+        return mRoutes.get(index);
+    }
+
+    /**
+     * Create a new user route that may be modified and registered for use by the application.
+     *
+     * @param category The category the new route will belong to
+     * @return A new UserRouteInfo for use by the application
+     *
+     * @see #addUserRoute(UserRouteInfo)
+     * @see #removeUserRoute(UserRouteInfo)
+     * @see #createRouteCategory(CharSequence)
+     */
+    public UserRouteInfo createUserRoute(RouteCategory category) {
+        return new UserRouteInfo(category);
+    }
+
+    /**
+     * Create a new route category. Each route must belong to a category.
+     *
+     * @param name Name of the new category
+     * @param isGroupable true if routes in this category may be grouped with one another
+     * @return the new RouteCategory
+     */
+    public RouteCategory createRouteCategory(CharSequence name, boolean isGroupable) {
+        return new RouteCategory(name, ROUTE_TYPE_USER, isGroupable);
+    }
+
+    void updateRoute(final RouteInfo info) {
+        dispatchRouteChanged(info);
+    }
+
+    void dispatchRouteSelected(int type, RouteInfo info) {
+        final int count = mCallbacks.size();
+        for (int i = 0; i < count; i++) {
+            final CallbackInfo cbi = mCallbacks.get(i);
+            if ((cbi.type & type) != 0) {
+                cbi.cb.onRouteSelected(type, info);
+            }
+        }
+    }
+
+    void dispatchRouteUnselected(int type, RouteInfo info) {
+        final int count = mCallbacks.size();
+        for (int i = 0; i < count; i++) {
+            final CallbackInfo cbi = mCallbacks.get(i);
+            if ((cbi.type & type) != 0) {
+                cbi.cb.onRouteUnselected(type, info);
+            }
+        }
+    }
+
+    void dispatchRouteChanged(RouteInfo info) {
+        final int count = mCallbacks.size();
+        for (int i = 0; i < count; i++) {
+            final CallbackInfo cbi = mCallbacks.get(i);
+            if ((cbi.type & info.mSupportedTypes) != 0) {
+                cbi.cb.onRouteChanged(info);
+            }
+        }
+    }
+
+    void dispatchRouteAdded(RouteInfo info) {
+        final int count = mCallbacks.size();
+        for (int i = 0; i < count; i++) {
+            final CallbackInfo cbi = mCallbacks.get(i);
+            if ((cbi.type & info.mSupportedTypes) != 0) {
+                cbi.cb.onRouteAdded(info.mSupportedTypes, info);
+            }
+        }
+    }
+
+    void dispatchRouteRemoved(RouteInfo info) {
+        final int count = mCallbacks.size();
+        for (int i = 0; i < count; i++) {
+            final CallbackInfo cbi = mCallbacks.get(i);
+            if ((cbi.type & info.mSupportedTypes) != 0) {
+                cbi.cb.onRouteRemoved(info.mSupportedTypes, info);
+            }
+        }
+    }
+
+    void dispatchVolumeChanged(int type, float volume) {
+        final int count = mCallbacks.size();
+        for (int i = 0; i < count; i++) {
+            final CallbackInfo cbi = mCallbacks.get(i);
+            if ((cbi.type & type) != 0) {
+                cbi.cb.onVolumeChanged(type, volume);
+            }
+        }
+    }
+
+    void onA2dpDeviceConnected() {
+        final RouteInfo info = new RouteInfo(mSystemCategory);
+        info.mName = "Bluetooth"; // TODO Fetch the real name of the device
+        mBluetoothA2dpRoute = info;
+        addRoute(mBluetoothA2dpRoute);
+    }
+
+    void onA2dpDeviceDisconnected() {
+        removeRoute(mBluetoothA2dpRoute);
+        mBluetoothA2dpRoute = null;
+    }
+
+    /**
+     * Information about a media route.
+     */
+    public class RouteInfo {
+        CharSequence mName;
+        private CharSequence mStatus;
+        int mSupportedTypes;
+        RouteGroup mGroup;
+        final RouteCategory mCategory;
+
+        RouteInfo(RouteCategory category) {
+            mCategory = category;
+            category.mRoutes.add(this);
+        }
+
+        /**
+         * @return The user-friendly name of a media route. This is the string presented
+         * to users who may select this as the active route.
+         */
+        public CharSequence getName() {
+            return mName;
+        }
+
+        /**
+         * @return The user-friendly status for a media route. This may include a description
+         * of the currently playing media, if available.
+         */
+        public CharSequence getStatus() {
+            return mStatus;
+        }
+
+        /**
+         * @return A media type flag set describing which types this route supports.
+         */
+        public int getSupportedTypes() {
+            return mSupportedTypes;
+        }
+
+        /**
+         * @return The group that this route belongs to.
+         */
+        public RouteGroup getGroup() {
+            return mGroup;
+        }
+
+        /**
+         * @return the category this route belongs to.
+         */
+        public RouteCategory getCategory() {
+            return mCategory;
+        }
+
+        void setStatusInt(CharSequence status) {
+            if (!status.equals(mStatus)) {
+                mStatus = status;
+                routeUpdated();
+                if (mGroup != null) {
+                    mGroup.memberStatusChanged(this, status);
+                }
+                routeUpdated();
+            }
+        }
+
+        void routeUpdated() {
+            updateRoute(this);
+        }
+
+        @Override
+        public String toString() {
+            String supportedTypes = typesToString(mSupportedTypes);
+            return "RouteInfo{ name=" + mName + ", status=" + mStatus +
+                    " category=" + mCategory +
+                    " supportedTypes=" + supportedTypes + "}";
+        }
+    }
+
+    /**
+     * Information about a route that the application may define and modify.
+     *
+     * @see MediaRouter.RouteInfo
+     */
+    public class UserRouteInfo extends RouteInfo {
+
+        UserRouteInfo(RouteCategory category) {
+            super(category);
+            mSupportedTypes = ROUTE_TYPE_USER;
+        }
+
+        /**
+         * Set the user-visible name of this route.
+         * @param name Name to display to the user to describe this route
+         */
+        public void setName(CharSequence name) {
+            mName = name;
+            routeUpdated();
+        }
+
+        /**
+         * Set the current user-visible status for this route.
+         * @param status Status to display to the user to describe what the endpoint
+         * of this route is currently doing
+         */
+        public void setStatus(CharSequence status) {
+            setStatusInt(status);
+        }
+    }
+
+    /**
+     * Information about a route that consists of multiple other routes in a group.
+     */
+    public class RouteGroup extends RouteInfo {
+        final ArrayList<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
+        private boolean mUpdateName;
+
+        RouteGroup(RouteCategory category) {
+            super(category);
+            mGroup = this;
+        }
+
+        public CharSequence getName() {
+            if (mUpdateName) updateName();
+            return super.getName();
+        }
+
+        /**
+         * Add a route to this group. The route must not currently belong to another group.
+         *
+         * @param route route to add to this group
+         */
+        public void addRoute(RouteInfo route) {
+            if (route.getGroup() != null) {
+                throw new IllegalStateException("Route " + route + " is already part of a group.");
+            }
+            if (route.getCategory() != mCategory) {
+                throw new IllegalArgumentException(
+                        "Route cannot be added to a group with a different category. " +
+                            "(Route category=" + route.getCategory() +
+                            " group category=" + mCategory + ")");
+            }
+            mRoutes.add(route);
+            mUpdateName = true;
+            routeUpdated();
+        }
+
+        /**
+         * Add a route to this group before the specified index.
+         *
+         * @param route route to add
+         * @param insertAt insert the new route before this index
+         */
+        public void addRoute(RouteInfo route, int insertAt) {
+            if (route.getGroup() != null) {
+                throw new IllegalStateException("Route " + route + " is already part of a group.");
+            }
+            if (route.getCategory() != mCategory) {
+                throw new IllegalArgumentException(
+                        "Route cannot be added to a group with a different category. " +
+                            "(Route category=" + route.getCategory() +
+                            " group category=" + mCategory + ")");
+            }
+            mRoutes.add(insertAt, route);
+            mUpdateName = true;
+            routeUpdated();
+        }
+
+        /**
+         * Remove a route from this group.
+         *
+         * @param route route to remove
+         */
+        public void removeRoute(RouteInfo route) {
+            if (route.getGroup() != this) {
+                throw new IllegalArgumentException("Route " + route +
+                        " is not a member of this group.");
+            }
+            mRoutes.remove(route);
+            mUpdateName = true;
+            routeUpdated();
+        }
+
+        /**
+         * Remove the route at the specified index from this group.
+         *
+         * @param index index of the route to remove
+         */
+        public void removeRoute(int index) {
+            mRoutes.remove(index);
+            mUpdateName = true;
+            routeUpdated();
+        }
+
+        void memberNameChanged(RouteInfo info, CharSequence name) {
+            mUpdateName = true;
+            routeUpdated();
+        }
+
+        void memberStatusChanged(RouteInfo info, CharSequence status) {
+            setStatusInt(status);
+        }
+
+        void updateName() {
+            final StringBuilder sb = new StringBuilder();
+            final int count = mRoutes.size();
+            for (int i = 0; i < count; i++) {
+                final RouteInfo info = mRoutes.get(i);
+                if (i > 0) sb.append(", ");
+                sb.append(info.mName);
+            }
+            mName = sb.toString();
+            mUpdateName = false;
+        }
+    }
+
+    /**
+     * Definition of a category of routes. All routes belong to a category.
+     */
+    public class RouteCategory {
+        final ArrayList<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
+        CharSequence mName;
+        int mTypes;
+        final boolean mGroupable;
+
+        RouteCategory(CharSequence name, int types, boolean groupable) {
+            mName = name;
+            mTypes = types;
+            mGroupable = groupable;
+        }
+
+        /**
+         * @return the name of this route category
+         */
+        public CharSequence getName() {
+            return mName;
+        }
+
+        /**
+         * @return the number of routes in this category
+         */
+        public int getRouteCount() {
+            return mRoutes.size();
+        }
+
+        /**
+         * Return a route from this category
+         *
+         * @param index Index from [0-getRouteCount)
+         * @return the route at the given index
+         */
+        public RouteInfo getRouteAt(int index) {
+            return mRoutes.get(index);
+        }
+
+        /**
+         * @return Flag set describing the route types supported by this category
+         */
+        public int getSupportedTypes() {
+            return mTypes;
+        }
+
+        /**
+         * Return whether or not this category supports grouping.
+         *
+         * <p>If this method returns true, all routes obtained from this category
+         * via calls to {@link #getRouteAt(int)} will be {@link MediaRouter.RouteGroup}s.
+         *
+         * @return true if this category supports
+         */
+        public boolean isGroupable() {
+            return mGroupable;
+        }
+
+        public String toString() {
+            return "RouteCategory{ name=" + mName + " types=" + typesToString(mTypes) +
+                    " groupable=" + mGroupable + " routes=" + mRoutes.size() + " }";
+        }
+    }
+
+    static class CallbackInfo {
+        public int type;
+        public Callback cb;
+
+        public CallbackInfo(Callback cb, int type) {
+            this.cb = cb;
+            this.type = type;
+        }
+    }
+
+    /**
+     * Interface for receiving events about media routing changes.
+     * All methods of this interface will be called from the application's main thread.
+     *
+     * <p>A Callback will only receive events relevant to routes that the callback
+     * was registered for.</p>
+     *
+     * @see MediaRouter#addCallback(int, Callback)
+     * @see MediaRouter#removeCallback(Callback)
+     */
+    public interface Callback {
+        /**
+         * Called when the supplied route becomes selected as the active route
+         * for the given route type.
+         *
+         * @param type Type flag set indicating the routes that have been selected
+         * @param info Route that has been selected for the given route types
+         */
+        public void onRouteSelected(int type, RouteInfo info);
+
+        /**
+         * Called when the supplied route becomes unselected as the active route
+         * for the given route type.
+         *
+         * @param type Type flag set indicating the routes that have been unselected
+         * @param info Route that has been unselected for the given route types
+         */
+        public void onRouteUnselected(int type, RouteInfo info);
+
+        /**
+         * Called when the volume is changed for the specified route types.
+         *
+         * @param type Type flags indicating which volume type was changed
+         * @param volume New volume value in the range 0 (inaudible) to 1 (full)
+         */
+        public void onVolumeChanged(int type, float volume);
+
+        /**
+         * Called when a route for the specified type was added.
+         *
+         * @param type Type flags indicating which types the added route supports
+         * @param info Route that has become available for use
+         */
+        public void onRouteAdded(int type, RouteInfo info);
+
+        /**
+         * Called when a route for the specified type was removed.
+         *
+         * @param type Type flags indicating which types the removed route supported
+         * @param info Route that has been removed from availability
+         */
+        public void onRouteRemoved(int type, RouteInfo info);
+
+        /**
+         * Called when an aspect of the indicated route has changed.
+         *
+         * <p>This will not indicate that the types supported by this route have
+         * changed, only that cosmetic info such as name or status have been updated.</p>
+         *
+         * @param info The route that was changed
+         */
+        public void onRouteChanged(RouteInfo info);
+    }
+
+    /**
+     * Stub implementation of the {@link MediaRouter.Callback} interface.
+     * Each interface method is defined as a no-op. Override just the ones
+     * you need.
+     */
+    public static class SimpleCallback implements Callback {
+
+        @Override
+        public void onRouteSelected(int type, RouteInfo info) {
+
+        }
+
+        @Override
+        public void onRouteUnselected(int type, RouteInfo info) {
+
+        }
+
+        @Override
+        public void onVolumeChanged(int type, float volume) {
+
+        }
+
+        @Override
+        public void onRouteAdded(int type, RouteInfo info) {
+
+        }
+
+        @Override
+        public void onRouteRemoved(int type, RouteInfo info) {
+
+        }
+
+        @Override
+        public void onRouteChanged(RouteInfo info) {
+
+        }
+
+    }
+
+    class VolumeChangedBroadcastReceiver extends BroadcastReceiver {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            final String action = intent.getAction();
+            if (AudioManager.VOLUME_CHANGED_ACTION.equals(action) &&
+                    AudioManager.STREAM_MUSIC == intent.getIntExtra(
+                            AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1)) {
+                final int maxVol = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
+                final int volExtra = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE, 0);
+                final float volume = (float) volExtra / maxVol;
+                dispatchVolumeChanged(ROUTE_TYPE_LIVE_AUDIO, volume);
+            }
+        }
+    }
+
+    class BtChangedBroadcastReceiver extends BroadcastReceiver {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            final String action = intent.getAction();
+            if (BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED.equals(action)) {
+                final int state = intent.getIntExtra(BluetoothA2dp.EXTRA_STATE, -1);
+                if (state == BluetoothA2dp.STATE_CONNECTED) {
+                    onA2dpDeviceConnected();
+                } else if (state == BluetoothA2dp.STATE_DISCONNECTING ||
+                        state == BluetoothA2dp.STATE_DISCONNECTED) {
+                    onA2dpDeviceDisconnected();
+                }
+            }
+        }
+    }
+
+    class HeadphoneChangedBroadcastReceiver extends BroadcastReceiver {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            final String action = intent.getAction();
+            if (Intent.ACTION_HEADSET_PLUG.equals(action)) {
+                final boolean plugged = intent.getIntExtra("state", 0) != 0;
+                final String name = mAppContext.getString(
+                        com.android.internal.R.string.default_audio_route_name_headphones);
+                onHeadphonesPlugged(plugged, name);
+            } else if (Intent.ACTION_ANALOG_AUDIO_DOCK_PLUG.equals(action) ||
+                    Intent.ACTION_DIGITAL_AUDIO_DOCK_PLUG.equals(action)) {
+                final boolean plugged = intent.getIntExtra("state", 0) != 0;
+                final String name = mAppContext.getString(
+                        com.android.internal.R.string.default_audio_route_name_dock_speakers);
+                onHeadphonesPlugged(plugged, name);
+            } else if (Intent.ACTION_HDMI_AUDIO_PLUG.equals(action)) {
+                final boolean plugged = intent.getIntExtra("state", 0) != 0;
+                final String name = mAppContext.getString(
+                        com.android.internal.R.string.default_audio_route_name_hdmi);
+                onHeadphonesPlugged(plugged, name);
+            }
+        }
+    }
+}
diff --git a/media/mca/filterpacks/java/android/filterpacks/imageproc/BlackWhiteFilter.java b/media/mca/filterpacks/java/android/filterpacks/imageproc/BlackWhiteFilter.java
index dd7f5e0..20b02d2 100644
--- a/media/mca/filterpacks/java/android/filterpacks/imageproc/BlackWhiteFilter.java
+++ b/media/mca/filterpacks/java/android/filterpacks/imageproc/BlackWhiteFilter.java
@@ -56,13 +56,25 @@
             "uniform float stepsize;\n" +
             "varying vec2 v_texcoord;\n" +
             "float rand(vec2 loc) {\n" +
-            "  const float divide = 0.00048828125;\n" +
-            "  const float factor = 2048.0;\n" +
-            "  float value = sin(dot(loc, vec2(12.9898, 78.233)));\n" +
-            "  float residual = mod(dot(mod(loc, divide), vec2(0.9898, 0.233)), divide);\n" +
-            "  float part2 = mod(value, divide);\n" +
-            "  float part1 = value - part2;\n" +
-            "  return fract(0.5453 * part1 + factor * (part2 + residual));\n" +
+            // Compute sin(theta), theta = 12.9898 x + 78.233y
+            // because floating point has limited range, make theta = theta1 + theta2
+            // where theta1 = 12x + 78y and theta2 = 0.9898x + 0.233y)
+            // Note that theta1 and theta2 cover diffent range of theta.
+            "  float theta1 = dot(loc, vec2(0.9898, 0.233));\n" +
+            "  float theta2 = dot(loc, vec2(12.0, 78.0));\n" +
+            // Use the property sin(theta) = cos(theta1)*sin(theta2)+sin(theta1)*cos(theta2)
+            // this approach also increases the precisions of sin(theta)
+            "  float value = cos(theta1) * sin(theta2) + sin(theta1) * cos(theta2);\n" +
+            // fract(43758.5453 * x) = fract(43758 * x + 0.5453 * x)
+            // keep value of part1 in range: (2^-14 to 2^14). Since 43758 = 117 * 374
+            // fract(43758 * sin(theta)) = mod(221 * mod(198*sin(theta), 1.0), 1.0)
+            // also to keep as much decimal digits, use the property
+            // mod(mod(198*sin(theta)) = mod(mod(197*sin(theta) + sin(theta))
+            "  float temp = mod(197.0 * value, 1.0) + value;\n" +
+            "  float part1 = mod(220.0 * temp, 1.0) + temp;\n" +
+            "  float part2 = value * 0.5453;\n" +
+            "  float part3 = cos(theta1 + theta2) * 0.43758;\n" +
+            "  return fract(part1 + part2 + part3);\n" +
             "}\n" +
             "void main() {\n" +
             "  vec4 color = texture2D(tex_sampler_0, v_texcoord);\n" +
diff --git a/media/mca/filterpacks/java/android/filterpacks/imageproc/ColorTemperatureFilter.java b/media/mca/filterpacks/java/android/filterpacks/imageproc/ColorTemperatureFilter.java
index 19da006..7488980 100644
--- a/media/mca/filterpacks/java/android/filterpacks/imageproc/ColorTemperatureFilter.java
+++ b/media/mca/filterpacks/java/android/filterpacks/imageproc/ColorTemperatureFilter.java
@@ -51,7 +51,7 @@
             "  new_color.r = color.r + color.r * ( 1.0 - color.r) * scale;\n" +
             "  new_color.b = color.b - color.b * ( 1.0 - color.b) * scale;\n" +
             "  if (scale > 0.0) { \n" +
-            "    color.g = color.g + color.g * ( 1.0 - color.g) * scale * 0.25;\n" +
+            "    new_color.g = color.g + color.g * ( 1.0 - color.g) * scale * 0.25;\n" +
             "  }\n" +
             "  float max_value = max(new_color.r, max(new_color.g, new_color.b));\n" +
             "  if (max_value > 1.0) { \n" +
diff --git a/media/mca/filterpacks/java/android/filterpacks/imageproc/DocumentaryFilter.java b/media/mca/filterpacks/java/android/filterpacks/imageproc/DocumentaryFilter.java
index 377e49d5..f93a82c 100644
--- a/media/mca/filterpacks/java/android/filterpacks/imageproc/DocumentaryFilter.java
+++ b/media/mca/filterpacks/java/android/filterpacks/imageproc/DocumentaryFilter.java
@@ -49,16 +49,18 @@
             "uniform vec2 seed;\n" +
             "uniform float stepsize;\n" +
             "uniform float inv_max_dist;\n" +
-            "uniform vec2 center;\n" +
+            "uniform vec2 scale;\n" +
             "varying vec2 v_texcoord;\n" +
             "float rand(vec2 loc) {\n" +
-            "  const float divide = 0.00048828125;\n" +
-            "  const float factor = 2048.0;\n" +
-            "  float value = sin(dot(loc, vec2(12.9898, 78.233)));\n" +
-            "  float residual = mod(dot(mod(loc, divide), vec2(0.9898, 0.233)), divide);\n" +
-            "  float part2 = mod(value, divide);\n" +
-            "  float part1 = value - part2;\n" +
-            "  return fract(0.5453 * part1 + factor * (part2 + residual));\n" +
+            "  float theta1 = dot(loc, vec2(0.9898, 0.233));\n" +
+            "  float theta2 = dot(loc, vec2(12.0, 78.0));\n" +
+            "  float value = cos(theta1) * sin(theta2) + sin(theta1) * cos(theta2);\n" +
+            // keep value of part1 in range: (2^-14 to 2^14).
+            "  float temp = mod(197.0 * value, 1.0) + value;\n" +
+            "  float part1 = mod(220.0 * temp, 1.0) + temp;\n" +
+            "  float part2 = value * 0.5453;\n" +
+            "  float part3 = cos(theta1 + theta2) * 0.43758;\n" +
+            "  return fract(part1 + part2 + part3);\n" +
             "}\n" +
             "void main() {\n" +
             // black white
@@ -71,7 +73,8 @@
             "  float gray = dot(new_color, vec3(0.299, 0.587, 0.114));\n" +
             "  new_color = vec3(gray, gray, gray);\n" +
             // vignette
-            "  float dist = distance(gl_FragCoord.xy, center);\n" +
+            "  vec2 coord = v_texcoord - vec2(0.5, 0.5);\n" +
+            "  float dist = length(coord * scale);\n" +
             "  float lumen = 0.85 / (1.0 + exp((dist * inv_max_dist - 0.83) * 20.0)) + 0.15;\n" +
             "  gl_FragColor = vec4(new_color * lumen, color.a);\n" +
             "}\n";
@@ -141,12 +144,17 @@
 
     private void initParameters() {
         if (mProgram != null) {
-            float centerX = (float) (0.5 * mWidth);
-            float centerY = (float) (0.5 * mHeight);
-            float center[] = {centerX, centerY};
-            float max_dist = (float) Math.sqrt(centerX * centerX + centerY * centerY);
+            float scale[] = new float[2];
+            if (mWidth > mHeight) {
+                scale[0] = 1f;
+                scale[1] = ((float) mHeight) / mWidth;
+            } else {
+                scale[0] = ((float) mWidth) / mHeight;
+                scale[1] = 1f;
+            }
+            float max_dist = ((float) Math.sqrt(scale[0] * scale[0] + scale[1] * scale[1])) * 0.5f;
 
-            mProgram.setHostValue("center", center);
+            mProgram.setHostValue("scale", scale);
             mProgram.setHostValue("inv_max_dist", 1.0f / max_dist);
             mProgram.setHostValue("stepsize", 1.0f / 255.0f);
 
diff --git a/media/mca/filterpacks/java/android/filterpacks/imageproc/FisheyeFilter.java b/media/mca/filterpacks/java/android/filterpacks/imageproc/FisheyeFilter.java
index 8d38f98..5d7929f 100644
--- a/media/mca/filterpacks/java/android/filterpacks/imageproc/FisheyeFilter.java
+++ b/media/mca/filterpacks/java/android/filterpacks/imageproc/FisheyeFilter.java
@@ -58,24 +58,19 @@
     private static final String mFisheyeShader =
             "precision mediump float;\n" +
             "uniform sampler2D tex_sampler_0;\n" +
-            "uniform vec2 center;\n" +
+            "uniform vec2 scale;\n" +
             "uniform float alpha;\n" +
-            "uniform float bound;\n" +
             "uniform float radius2;\n" +
             "uniform float factor;\n" +
-            "uniform float inv_height;\n" +
-            "uniform float inv_width;\n" +
             "varying vec2 v_texcoord;\n" +
             "void main() {\n" +
             "  const float m_pi_2 = 1.570963;\n" +
-            "  float dist = distance(gl_FragCoord.xy, center);\n" +
+            "  vec2 coord = v_texcoord - vec2(0.5, 0.5);\n" +
+            "  float dist = length(coord * scale);\n" +
             "  float radian = m_pi_2 - atan(alpha * sqrt(radius2 - dist * dist), dist);\n" +
-            "  float scale = radian * factor / dist;\n" +
-            "  vec2 new_coord = gl_FragCoord.xy * scale + (1.0 - scale) * center;\n" +
-            "  new_coord.x *= inv_width;\n" +
-            "  new_coord.y *= inv_height;\n" +
-            "  vec4 color = texture2D(tex_sampler_0, new_coord);\n" +
-            "  gl_FragColor = color;\n" +
+            "  float scalar = radian * factor / dist;\n" +
+            "  vec2 new_coord = coord * scalar + vec2(0.5, 0.5);\n" +
+            "  gl_FragColor = texture2D(tex_sampler_0, new_coord);\n" +
             "}\n";
 
     public FisheyeFilter(String name) {
@@ -145,12 +140,6 @@
     }
 
     private void updateFrameSize(int width, int height) {
-        float center[] = {0.5f * width, 0.5f * height};
-
-        mProgram.setHostValue("center", center);
-        mProgram.setHostValue("inv_width", 1.0f / width);
-        mProgram.setHostValue("inv_height", 1.0f / height);
-
         mWidth = width;
         mHeight = height;
 
@@ -159,9 +148,16 @@
 
     private void updateProgramParams() {
         final float pi = 3.14159265f;
-
+        float scale[] = new float[2];
+        if (mWidth > mHeight) {
+          scale[0] = 1f;
+          scale[1] = ((float) mHeight) / mWidth;
+        } else {
+          scale[0] = ((float) mWidth) / mHeight;
+          scale[1] = 1f;
+        }
         float alpha = mScale * 2.0f + 0.75f;
-        float bound2 = 0.25f * (mWidth * mWidth  + mHeight * mHeight);
+        float bound2 = 0.25f * (scale[0] * scale[0] + scale[1] * scale[1]);
         float bound = (float) Math.sqrt(bound2);
         float radius = 1.15f * bound;
         float radius2 = radius * radius;
@@ -169,10 +165,9 @@
             (float) Math.atan(alpha / bound * (float) Math.sqrt(radius2 - bound2));
         float factor = bound / max_radian;
 
+        mProgram.setHostValue("scale", scale);
         mProgram.setHostValue("radius2",radius2);
         mProgram.setHostValue("factor", factor);
-        mProgram.setHostValue("alpha", (float) (mScale * 2.0 + 0.75));
+        mProgram.setHostValue("alpha", alpha);
     }
-
-
 }
diff --git a/media/mca/filterpacks/java/android/filterpacks/imageproc/GrainFilter.java b/media/mca/filterpacks/java/android/filterpacks/imageproc/GrainFilter.java
index f236856..577243a 100644
--- a/media/mca/filterpacks/java/android/filterpacks/imageproc/GrainFilter.java
+++ b/media/mca/filterpacks/java/android/filterpacks/imageproc/GrainFilter.java
@@ -57,13 +57,15 @@
             "uniform vec2 seed;\n" +
             "varying vec2 v_texcoord;\n" +
             "float rand(vec2 loc) {\n" +
-            "  const float divide = 0.00048828125;\n" +
-            "  const float factor = 2048.0;\n" +
-            "  float value = sin(dot(loc, vec2(12.9898, 78.233)));\n" +
-            "  float residual = mod(dot(mod(loc, divide), vec2(0.9898, 0.233)), divide);\n" +
-            "  float part2 = mod(value, divide);\n" +
-            "  float part1 = value - part2;\n" +
-            "  return fract(0.5453 * part1 + factor * (part2 + residual));\n" +
+            "  float theta1 = dot(loc, vec2(0.9898, 0.233));\n" +
+            "  float theta2 = dot(loc, vec2(12.0, 78.0));\n" +
+            "  float value = cos(theta1) * sin(theta2) + sin(theta1) * cos(theta2);\n" +
+            // keep value of part1 in range: (2^-14 to 2^14).
+            "  float temp = mod(197.0 * value, 1.0) + value;\n" +
+            "  float part1 = mod(220.0 * temp, 1.0) + temp;\n" +
+            "  float part2 = value * 0.5453;\n" +
+            "  float part3 = cos(theta1 + theta2) * 0.43758;\n" +
+            "  return fract(part1 + part2 + part3);\n" +
             "}\n" +
             "void main() {\n" +
             "  gl_FragColor = vec4(rand(v_texcoord + seed), 0.0, 0.0, 1.0);\n" +
diff --git a/media/mca/filterpacks/java/android/filterpacks/imageproc/LomoishFilter.java b/media/mca/filterpacks/java/android/filterpacks/imageproc/LomoishFilter.java
index 22a2ec8..726ffff 100644
--- a/media/mca/filterpacks/java/android/filterpacks/imageproc/LomoishFilter.java
+++ b/media/mca/filterpacks/java/android/filterpacks/imageproc/LomoishFilter.java
@@ -50,17 +50,19 @@
             "uniform float stepsizeX;\n" +
             "uniform float stepsizeY;\n" +
             "uniform float stepsize;\n" +
-            "uniform vec2 center;\n" +
+            "uniform vec2 scale;\n" +
             "uniform float inv_max_dist;\n" +
             "varying vec2 v_texcoord;\n" +
             "float rand(vec2 loc) {\n" +
-            "  const float divide = 0.00048828125;\n" +
-            "  const float factor = 2048.0;\n" +
-            "  float value = sin(dot(loc, vec2(12.9898, 78.233)));\n" +
-            "  float residual = mod(dot(mod(loc, divide), vec2(0.9898, 0.233)), divide);\n" +
-            "  float part2 = mod(value, divide);\n" +
-            "  float part1 = value - part2;\n" +
-            "  return fract(0.5453 * part1 + factor * (part2 + residual));\n" +
+            "  float theta1 = dot(loc, vec2(0.9898, 0.233));\n" +
+            "  float theta2 = dot(loc, vec2(12.0, 78.0));\n" +
+            "  float value = cos(theta1) * sin(theta2) + sin(theta1) * cos(theta2);\n" +
+            // keep value of part1 in range: (2^-14 to 2^14).
+            "  float temp = mod(197.0 * value, 1.0) + value;\n" +
+            "  float part1 = mod(220.0 * temp, 1.0) + temp;\n" +
+            "  float part2 = value * 0.5453;\n" +
+            "  float part3 = cos(theta1 + theta2) * 0.43758;\n" +
+            "  return fract(part1 + part2 + part3);\n" +
             "}\n" +
             "void main() {\n" +
             // sharpen
@@ -112,7 +114,8 @@
             "  vec3 temp = clamp((color.rgb + stepsize - 0.15) * 1.53846, 0.0, 1.0);\n" +
             "  vec3 bw_color = clamp(xform + (temp - xform) * (dither - 0.5), 0.0, 1.0);\n" +
             // vignette
-            "  float dist = distance(gl_FragCoord.xy, center);\n" +
+            "  coord = v_texcoord - vec2(0.5, 0.5);\n" +
+            "  float dist = length(coord * scale);\n" +
             "  float lumen = 0.85 / (1.0 + exp((dist * inv_max_dist - 0.73) * 20.0)) + 0.15;\n" +
             "  gl_FragColor = vec4(bw_color * lumen, color.a);\n" +
             "}\n";
@@ -150,12 +153,17 @@
 
     private void initParameters() {
         if (mProgram !=null) {
-            float centerX = (float) (0.5 * mWidth);
-            float centerY = (float) (0.5 * mHeight);
-            float center[] = {centerX, centerY};
-            float max_dist = (float) Math.sqrt(centerX * centerX + centerY * centerY);
+            float scale[] = new float[2];
+            if (mWidth > mHeight) {
+                scale[0] = 1f;
+                scale[1] = ((float) mHeight) / mWidth;
+            } else {
+                scale[0] = ((float) mWidth) / mHeight;
+                scale[1] = 1f;
+            }
+            float max_dist = ((float) Math.sqrt(scale[0] * scale[0] + scale[1] * scale[1])) * 0.5f;
 
-            mProgram.setHostValue("center", center);
+            mProgram.setHostValue("scale", scale);
             mProgram.setHostValue("inv_max_dist", 1.0f / max_dist);
 
             mProgram.setHostValue("stepsize", 1.0f / 255.0f);
diff --git a/media/mca/filterpacks/java/android/filterpacks/imageproc/VignetteFilter.java b/media/mca/filterpacks/java/android/filterpacks/imageproc/VignetteFilter.java
index 2d78fff..715fec6 100644
--- a/media/mca/filterpacks/java/android/filterpacks/imageproc/VignetteFilter.java
+++ b/media/mca/filterpacks/java/android/filterpacks/imageproc/VignetteFilter.java
@@ -51,11 +51,12 @@
             "uniform float range;\n" +
             "uniform float inv_max_dist;\n" +
             "uniform float shade;\n" +
-            "uniform vec2 center;\n" +
+            "uniform vec2 scale;\n" +
             "varying vec2 v_texcoord;\n" +
             "void main() {\n" +
             "  const float slope = 20.0;\n" +
-            "  float dist = distance(gl_FragCoord.xy, center);\n" +
+            "  vec2 coord = v_texcoord - vec2(0.5, 0.5);\n" +
+            "  float dist = length(coord * scale);\n" +
             "  float lumen = shade / (1.0 + exp((dist * inv_max_dist - range) * slope)) + (1.0 - shade);\n" +
             "  vec4 color = texture2D(tex_sampler_0, v_texcoord);\n" +
             "  gl_FragColor = vec4(color.rgb * lumen, color.a);\n" +
@@ -93,13 +94,17 @@
 
     private void initParameters() {
         if (mProgram != null) {
-            float centerX = (float) (0.5 * mWidth);
-            float centerY = (float) (0.5 * mHeight);
-            float center[] = {centerX, centerY};
-            float max_dist = (float) Math.sqrt(centerX * centerX + centerY * centerY);
-
-            mProgram.setHostValue("center", center);
-            mProgram.setHostValue("inv_max_dist", 1.0f / max_dist);
+            float scale[] = new float[2];
+            if (mWidth > mHeight) {
+                scale[0] = 1f;
+                scale[1] = ((float) mHeight) / mWidth;
+            } else {
+                scale[0] = ((float) mWidth) / mHeight;
+                scale[1] = 1f;
+            }
+            float max_dist = ((float) Math.sqrt(scale[0] * scale[0] + scale[1] * scale[1])) * 0.5f;
+            mProgram.setHostValue("scale", scale);
+            mProgram.setHostValue("inv_max_dist", 1f / max_dist);
             mProgram.setHostValue("shade", mShade);
 
             updateParameters();
diff --git a/packages/FakeOemFeatures/Android.mk b/packages/FakeOemFeatures/Android.mk
index b0b0eeb..d96bb3d 100644
--- a/packages/FakeOemFeatures/Android.mk
+++ b/packages/FakeOemFeatures/Android.mk
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
-LOCAL_MODULE_TAGS := debug
+LOCAL_MODULE_TAGS := optional
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
index af88a06..1cd8d50 100644
--- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
@@ -50,6 +50,8 @@
     private static final int SEARCH_PANEL_HOLD_DURATION = 500;
     static final String TAG = "SearchPanelView";
     static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false;
+    private static final String ASSIST_ICON_METADATA_NAME =
+            "com.android.systemui.action_assist_icon";
     private final Context mContext;
     private BaseStatusBar mBar;
     private StatusBarTouchProxy mStatusBarTouchProxy;
@@ -168,6 +170,21 @@
         // TODO: fetch views
         mMultiWaveView = (MultiWaveView) findViewById(R.id.multi_wave_view);
         mMultiWaveView.setOnTriggerListener(mMultiWaveViewListener);
+        SearchManager searchManager = getSearchManager();
+        if (searchManager != null) {
+            ComponentName component = searchManager.getGlobalSearchActivity();
+            if (component != null) {
+                if (!mMultiWaveView.replaceTargetDrawablesIfPresent(component,
+                        ASSIST_ICON_METADATA_NAME,
+                        com.android.internal.R.drawable.ic_lockscreen_search)) {
+                    Slog.w(TAG, "Couldn't grab icon from component " + component);
+                }
+            } else {
+                Slog.w(TAG, "No search icon specified in component " + component);
+            }
+        } else {
+            Slog.w(TAG, "No SearchManager");
+        }
     }
 
     private boolean pointInside(int x, int y, View v) {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 1302c1f..e1abb23 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -73,10 +73,16 @@
         return mLinearLayout.getWidth() - getWidth();
     }
 
+    private void addToRecycledViews(View v) {
+        if (mRecycledViews.size() < mNumItemsInOneScreenful) {
+            mRecycledViews.add(v);
+        }
+    }
+
     private void update() {
         for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
             View v = mLinearLayout.getChildAt(i);
-            mRecycledViews.add(v);
+            addToRecycledViews(v);
             mAdapter.recycleView(v);
         }
         LayoutTransition transitioner = getLayoutTransition();
@@ -187,7 +193,7 @@
     }
 
     public void onChildDismissed(View v) {
-        mRecycledViews.add(v);
+        addToRecycledViews(v);
         mLinearLayout.removeView(v);
         if (v.getParent() != null) {
             throw new RuntimeException("Recycled child has parent");
@@ -362,13 +368,13 @@
         child.measure(childWidthMeasureSpec, childheightMeasureSpec);
         mNumItemsInOneScreenful =
                 (int) FloatMath.ceil(dm.widthPixels / (float) child.getMeasuredWidth());
-        mRecycledViews.add(child);
+        addToRecycledViews(child);
         if (child.getParent() != null) {
             throw new RuntimeException("First recycled child has parent");
         }
 
         for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) {
-            mRecycledViews.add(mAdapter.createView(mLinearLayout));
+            addToRecycledViews(mAdapter.createView(mLinearLayout));
             if (mRecycledViews.get(mRecycledViews.size() - 1).getParent() != null) {
                 throw new RuntimeException("Recycled child has parent");
             }
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 587bfe8..34cd397 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -174,6 +174,13 @@
         public View getView(int position, View convertView, ViewGroup parent) {
             if (convertView == null) {
                 convertView = createView(parent);
+                if (convertView.getParent() != null) {
+                    throw new RuntimeException("Recycled child has parent");
+                }
+            } else {
+                if (convertView.getParent() != null) {
+                    throw new RuntimeException("Recycled child has parent");
+                }
             }
             ViewHolder holder = (ViewHolder) convertView.getTag();
 
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java
index 6bd1826..9bc54cb 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java
@@ -78,9 +78,10 @@
 
     public void addViewCallback(View newLinearLayoutChild) {
         if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
-            final View view = newLinearLayoutChild;
-            view.setDrawingCacheEnabled(true);
-            view.buildDrawingCache();
+            final RecentsPanelView.ViewHolder holder =
+                    (RecentsPanelView.ViewHolder) newLinearLayoutChild.getTag();
+            holder.labelView.setDrawingCacheEnabled(true);
+            holder.labelView.buildDrawingCache();
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index f682203..33d2a75 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -74,10 +74,16 @@
         return mLinearLayout.getHeight() - getHeight();
     }
 
+    private void addToRecycledViews(View v) {
+        if (mRecycledViews.size() < mNumItemsInOneScreenful) {
+            mRecycledViews.add(v);
+        }
+    }
+
     private void update() {
         for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
             View v = mLinearLayout.getChildAt(i);
-            mRecycledViews.add(v);
+            addToRecycledViews(v);
             mAdapter.recycleView(v);
         }
         LayoutTransition transitioner = getLayoutTransition();
@@ -203,7 +209,7 @@
     }
 
     public void onChildDismissed(View v) {
-        mRecycledViews.add(v);
+        addToRecycledViews(v);
         mLinearLayout.removeView(v);
         if (v.getParent() != null) {
             throw new RuntimeException("Recycled child has parent");
@@ -380,13 +386,13 @@
         child.measure(childWidthMeasureSpec, childheightMeasureSpec);
         mNumItemsInOneScreenful =
                 (int) FloatMath.ceil(dm.heightPixels / (float) child.getMeasuredHeight());
-        mRecycledViews.add(child);
+        addToRecycledViews(child);
         if (child.getParent() != null) {
             throw new RuntimeException("First recycled child has parent");
         }
 
         for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) {
-            mRecycledViews.add(mAdapter.createView(mLinearLayout));
+            addToRecycledViews(mAdapter.createView(mLinearLayout));
             if (mRecycledViews.get(mRecycledViews.size() - 1).getParent() != null) {
                 throw new RuntimeException("Recycled child has parent");
             }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index f088e0e..cf2690b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -26,6 +26,7 @@
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
+import android.database.ContentObserver;
 import android.graphics.Rect;
 import android.net.Uri;
 import android.os.Build;
@@ -123,7 +124,7 @@
 
     protected Display mDisplay;
     private IWindowManager mWindowManager;
-
+    private boolean mDeviceProvisioned = false;
 
     public IWindowManager getWindowManager() {
         return mWindowManager;
@@ -137,10 +138,31 @@
         return mBarService;
     }
 
+    protected boolean isDeviceProvisioned() {
+        return mDeviceProvisioned;
+    }
+
+    private ContentObserver mProvisioningObserver = new ContentObserver(new Handler()) {
+        @Override
+        public void onChange(boolean selfChange) {
+            final boolean provisioned = 0 != Settings.Secure.getInt(
+                    mContext.getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 0);
+            if (provisioned != mDeviceProvisioned) {
+                mDeviceProvisioned = provisioned;
+                updateNotificationIcons();
+            }
+        }
+    };
+
     public void start() {
         mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
                 .getDefaultDisplay();
 
+        mProvisioningObserver.onChange(false); // set up
+        mContext.getContentResolver().registerContentObserver(
+                Settings.Secure.getUriFor(Settings.Secure.DEVICE_PROVISIONED), true,
+                mProvisioningObserver);
+
         mWindowManager = IWindowManager.Stub.asInterface(
                 ServiceManager.getService(Context.WINDOW_SERVICE));
 
@@ -754,7 +776,7 @@
     protected abstract boolean shouldDisableNavbarGestures();
 
     protected boolean isTopNotification(ViewGroup parent, NotificationData.Entry entry) {
-        return parent.indexOfChild(entry.row) == 0;
+        return parent != null && parent.indexOfChild(entry.row) == 0;
     }
 
     public void updateNotification(IBinder key, StatusBarNotification notification) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index d40a763..6842b17 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -745,13 +745,19 @@
     }
 
     private void loadNotificationShade() {
+        if (mPile == null) return;
+
         int N = mNotificationData.size();
 
         ArrayList<View> toShow = new ArrayList<View>();
 
+        final boolean provisioned = isDeviceProvisioned();
+        // If the device hasn't been through Setup, we only show system notifications
         for (int i=0; i<N; i++) {
-            View row = mNotificationData.get(N-i-1).row;
-            toShow.add(row);
+            Entry ent = mNotificationData.get(N-i-1);
+            if (provisioned || "android".equals(ent.notification.pkg)) {
+                toShow.add(ent.row);
+            }
         }
 
         ArrayList<View> toRemove = new ArrayList<View>();
@@ -772,6 +778,8 @@
                 mPile.addView(v, i);
             }
         }
+
+        mSettingsButton.setEnabled(isDeviceProvisioned());
     }
 
     private void reloadAllNotificationIcons() {
@@ -782,6 +790,8 @@
 
     @Override
     protected void updateNotificationIcons() {
+        if (mNotificationIcons == null) return;
+
         loadNotificationShade();
 
         final LinearLayout.LayoutParams params
@@ -795,9 +805,12 @@
 
         ArrayList<View> toShow = new ArrayList<View>();
 
+        final boolean provisioned = isDeviceProvisioned();
+        // If the device hasn't been through Setup, we only show system notifications
         for (int i=0; i<N; i++) {
             Entry ent = mNotificationData.get(N-i-1);
-            if (ent.notification.score >= HIDE_ICONS_BELOW_SCORE) {
+            if ((provisioned && ent.notification.score >= HIDE_ICONS_BELOW_SCORE)
+                    || "android".equals(ent.notification.pkg)) {
                 toShow.add(ent.icon);
             }
         }
@@ -1660,6 +1673,9 @@
         // no ticking in lights-out mode
         if (!areLightsOn()) return;
 
+        // no ticking in Setup
+        if (!isDeviceProvisioned()) return;
+
         // Show the ticker if one is requested. Also don't do this
         // until status bar window is attached to the window manager,
         // because...  well, what's the point otherwise?  And trying to
@@ -2028,6 +2044,9 @@
 
     private View.OnClickListener mSettingsButtonListener = new View.OnClickListener() {
         public void onClick(View v) {
+            // We take this as a good indicator that Setup is running and we shouldn't
+            // allow you to go somewhere else
+            if (!isDeviceProvisioned()) return;
             try {
                 // Dismiss the lock screen when Settings starts.
                 ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
diff --git a/policy/src/com/android/internal/policy/impl/LockScreen.java b/policy/src/com/android/internal/policy/impl/LockScreen.java
index 30cb530..d37207c 100644
--- a/policy/src/com/android/internal/policy/impl/LockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/LockScreen.java
@@ -62,6 +62,8 @@
     private static final String ENABLE_MENU_KEY_FILE = "/data/local/enable_menu_key";
     private static final int WAIT_FOR_ANIMATION_TIMEOUT = 0;
     private static final int STAY_ON_WHILE_GRABBED_TIMEOUT = 30000;
+    private static final String ASSIST_ICON_METADATA_NAME =
+            "com.android.systemui.action_assist_icon";
 
     private LockPatternUtils mLockPatternUtils;
     private KeyguardUpdateMonitor mUpdateMonitor;
@@ -290,8 +292,6 @@
 
         MultiWaveViewMethods(MultiWaveView multiWaveView) {
             mMultiWaveView = multiWaveView;
-
-            // TODO: get search icon.  See Launcher.updateGlobalSearchIcon()
         }
 
         public boolean isTargetPresent(int resId) {
@@ -310,6 +310,26 @@
             if (mMultiWaveView.getTargetResourceId() != resId) {
                 mMultiWaveView.setTargetResources(resId);
             }
+
+            // Update the search icon with drawable from the search .apk
+            if (!mSearchDisabled) {
+                SearchManager searchManager = getSearchManager();
+                if (searchManager != null) {
+                    ComponentName component = searchManager.getGlobalSearchActivity();
+                    if (component != null) {
+                        if (!mMultiWaveView.replaceTargetDrawablesIfPresent(component,
+                                ASSIST_ICON_METADATA_NAME,
+                                com.android.internal.R.drawable.ic_lockscreen_search)) {
+                            Slog.w(TAG, "Couldn't grab icon from package " + component);
+                        }
+                    } else {
+                        Slog.w(TAG, "No search icon specified in package " + component);
+                    }
+                } else {
+                    Slog.w(TAG, "No SearchManager");
+                }
+            }
+
             setEnabled(com.android.internal.R.drawable.ic_lockscreen_camera, !mCameraDisabled);
             setEnabled(com.android.internal.R.drawable.ic_lockscreen_search, !mSearchDisabled);
         }
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 469b4f1..5aa0d16 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -2285,6 +2285,10 @@
 
         public void animateTo(int target, int sensorTarget, int mask, int animationDuration) {
             synchronized(this) {
+                if (isAnimating() && (mask ^ currentMask) != 0) {
+                    // current animation is unrelated to new animation, jump to final values
+                    cancelAnimation();
+                }
                 startValue = currentValue;
                 endValue = target;
                 startSensorValue = mHighestLightSensorValue;
@@ -2409,7 +2413,8 @@
 
     private boolean isScreenTurningOffLocked() {
         return (mScreenBrightnessAnimator.isAnimating()
-                && mScreenBrightnessAnimator.endValue == PowerManager.BRIGHTNESS_OFF);
+                && mScreenBrightnessAnimator.endValue == PowerManager.BRIGHTNESS_OFF
+                && (mScreenBrightnessAnimator.currentMask & SCREEN_BRIGHT_BIT) != 0);
     }
 
     private boolean shouldLog(long time) {
diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java
index 67bdabd..d97b022 100644
--- a/services/java/com/android/server/accessibility/TouchExplorer.java
+++ b/services/java/com/android/server/accessibility/TouchExplorer.java
@@ -327,9 +327,10 @@
                         if (mSendHoverEnterDelayed.isPending()) {
                             mSendHoverEnterDelayed.remove();
                             mSendHoverExitDelayed.remove();
-                            mPerformLongPressDelayed.remove();
                         }
 
+                        mPerformLongPressDelayed.remove();
+
                         // If we have the first tap schedule a long press and break
                         // since we do not want to schedule hover enter because
                         // the delayed callback will kick in before the long click.
@@ -396,6 +397,7 @@
                                     // exploring so start sending events.
                                     mSendHoverEnterDelayed.forceSendAndRemove();
                                     mSendHoverExitDelayed.remove();
+                                    mPerformLongPressDelayed.remove();
                                     sendMotionEvent(event, MotionEvent.ACTION_HOVER_MOVE,
                                             pointerIdBits, policyFlags);
                                 }
@@ -422,6 +424,7 @@
                             mSendHoverExitDelayed.remove();
                             mPerformLongPressDelayed.remove();
                         } else {
+                            mPerformLongPressDelayed.remove();
                             // If the user is touch exploring the second pointer may be
                             // performing a double tap to activate an item without need
                             // for the user to lift his exploring finger.
@@ -446,9 +449,6 @@
                         if (isDraggingGesture(event)) {
                             // Two pointers moving in the same direction within
                             // a given distance perform a drag.
-                            mSendHoverEnterDelayed.remove();
-                            mSendHoverExitDelayed.remove();
-                            mPerformLongPressDelayed.remove();
                             mCurrentState = STATE_DRAGGING;
                             mDraggingPointerId = pointerId;
                             sendMotionEvent(event, MotionEvent.ACTION_DOWN, pointerIdBits,
@@ -469,6 +469,7 @@
                             mSendHoverExitDelayed.remove();
                             mPerformLongPressDelayed.remove();
                         } else {
+                            mPerformLongPressDelayed.remove();
                             // We are sending events so send exit and gesture
                             // end since we transition to another state.
                             sendExitEventsIfNeeded(policyFlags);
@@ -1247,6 +1248,11 @@
 
         @Override
         public void run() {
+            // Active pointers should not be zero when running this command.
+            if (mReceivedPointerTracker.getActivePointerCount() == 0) {
+                return;
+            }
+
             // If the last touched explored location is not within the focused
             // window we will long press at that exact spot, otherwise we find the
             // accessibility focus and if the tap is within its bounds we long press
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index efbf0d4..2053299 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -8078,7 +8078,7 @@
                 }
                 if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
                         "New transit: " + transit);
-            } else if ((oldWallpaper != null) && (oldWallpaper != mWallpaperTarget)) {
+            } else if (oldWallpaper != null) {
                 // We are transitioning from an activity with
                 // a wallpaper to one without.
                 transit = WindowManagerPolicy.TRANSIT_WALLPAPER_CLOSE;