Merge "Fix bug #7663550 ActionBar menu items should probably use android:textAlignment="viewStart"" into jb-mr1.1-dev
diff --git a/core/java/android/appwidget/AppWidgetHost.java b/core/java/android/appwidget/AppWidgetHost.java
index 6a99ccd..fa3bf4d 100644
--- a/core/java/android/appwidget/AppWidgetHost.java
+++ b/core/java/android/appwidget/AppWidgetHost.java
@@ -60,6 +60,7 @@
         public void updateAppWidget(int appWidgetId, RemoteViews views) {
             if (isLocalBinder() && views != null) {
                 views = views.clone();
+                views.setUser(mUser);
             }
             Message msg = mHandler.obtainMessage(HANDLE_UPDATE);
             msg.arg1 = appWidgetId;
@@ -123,6 +124,8 @@
     Callbacks mCallbacks = new Callbacks();
     final HashMap<Integer,AppWidgetHostView> mViews = new HashMap<Integer, AppWidgetHostView>();
     private OnClickHandler mOnClickHandler;
+    // Optionally set by lockscreen
+    private UserHandle mUser;
 
     public AppWidgetHost(Context context, int hostId) {
         this(context, hostId, null, context.getMainLooper());
@@ -137,9 +140,15 @@
         mOnClickHandler = handler;
         mHandler = new UpdateHandler(looper);
         mDisplayMetrics = context.getResources().getDisplayMetrics();
+        mUser = Process.myUserHandle();
         bindService();
     }
 
+    /** @hide */
+    public void setUserId(int userId) {
+        mUser = new UserHandle(userId);
+    }
+
     private static void bindService() {
         synchronized (sServiceLock) {
             if (sService == null) {
@@ -179,6 +188,9 @@
 
         final int N = updatedIds.length;
         for (int i=0; i<N; i++) {
+            if (updatedViews.get(i) != null) {
+                updatedViews.get(i).setUser(new UserHandle(userId));
+            }
             updateAppWidgetView(updatedIds[i], updatedViews.get(i));
         }
     }
@@ -350,6 +362,7 @@
     public final AppWidgetHostView createView(Context context, int appWidgetId,
             AppWidgetProviderInfo appWidget) {
         AppWidgetHostView view = onCreateView(context, appWidgetId, appWidget);
+        view.setUserId(mUser.getIdentifier());
         view.setOnClickHandler(mOnClickHandler);
         view.setAppWidget(appWidgetId, appWidget);
         synchronized (mViews) {
@@ -358,6 +371,9 @@
         RemoteViews views;
         try {
             views = sService.getAppWidgetViews(appWidgetId);
+            if (views != null) {
+                views.setUser(mUser);
+            }
         } catch (RemoteException e) {
             throw new RuntimeException("system server dead?", e);
         }
diff --git a/core/java/android/appwidget/AppWidgetHostView.java b/core/java/android/appwidget/AppWidgetHostView.java
index 52771ee..700bba8 100644
--- a/core/java/android/appwidget/AppWidgetHostView.java
+++ b/core/java/android/appwidget/AppWidgetHostView.java
@@ -31,7 +31,9 @@
 import android.os.Bundle;
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.os.Process;
 import android.os.SystemClock;
+import android.os.UserHandle;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.util.SparseArray;
@@ -85,6 +87,7 @@
     Bitmap mOld;
     Paint mOldPaint = new Paint();
     private OnClickHandler mOnClickHandler;
+    private UserHandle mUser;
 
     /**
      * Create a host view.  Uses default fade animations.
@@ -112,12 +115,17 @@
     public AppWidgetHostView(Context context, int animationIn, int animationOut) {
         super(context);
         mContext = context;
-
+        mUser = Process.myUserHandle();
         // We want to segregate the view ids within AppWidgets to prevent
         // problems when those ids collide with view ids in the AppWidgetHost.
         setIsRootNamespace(true);
     }
 
+    /** @hide */
+    public void setUserId(int userId) {
+        mUser = new UserHandle(userId);
+    }
+
     /**
      * Pass the given handler to RemoteViews when updating this widget. Unless this
      * is done immediatly after construction, a call to {@link #updateAppWidget(RemoteViews)}
@@ -465,7 +473,8 @@
 
         try {
             // Return if cloned successfully, otherwise default
-            return mContext.createPackageContext(packageName, Context.CONTEXT_RESTRICTED);
+            return mContext.createPackageContextAsUser(packageName, Context.CONTEXT_RESTRICTED,
+                    mUser);
         } catch (NameNotFoundException e) {
             Log.e(TAG, "Package name " + packageName + " not found");
             return mContext;
@@ -539,8 +548,8 @@
 
         try {
             if (mInfo != null) {
-                Context theirContext = mContext.createPackageContext(
-                        mInfo.provider.getPackageName(), Context.CONTEXT_RESTRICTED);
+                Context theirContext = mContext.createPackageContextAsUser(
+                        mInfo.provider.getPackageName(), Context.CONTEXT_RESTRICTED, mUser);
                 mRemoteContext = theirContext;
                 LayoutInflater inflater = (LayoutInflater)
                         theirContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java
index f3841d5..305fd5c 100644
--- a/core/java/android/view/DisplayInfo.java
+++ b/core/java/android/view/DisplayInfo.java
@@ -285,6 +285,16 @@
         getMetricsWithSize(outMetrics, cih, logicalWidth, logicalHeight);
     }
 
+    public int getNaturalWidth() {
+        return rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180 ?
+                logicalWidth : logicalHeight;
+    }
+
+    public int getNaturalHeight() {
+        return rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180 ?
+                logicalHeight : logicalWidth;
+    }
+
     private void getMetricsWithSize(DisplayMetrics outMetrics, CompatibilityInfoHolder cih,
             int width, int height) {
         outMetrics.densityDpi = outMetrics.noncompatDensityDpi = logicalDensityDpi;
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 1c613245..5b7a5af 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -1304,17 +1304,11 @@
                 }
             }
 
-            if ((status & DisplayList.STATUS_INVOKE) != 0) {
-                scheduleFunctors(attachInfo, true);
-            }
-        }
-
-        private void scheduleFunctors(View.AttachInfo attachInfo, boolean delayed) {
-            mFunctorsRunnable.attachInfo = attachInfo;
-            if (!attachInfo.mHandler.hasCallbacks(mFunctorsRunnable)) {
-                // delay the functor callback by a few ms so it isn't polled constantly
-                attachInfo.mHandler.postDelayed(mFunctorsRunnable,
-                                                delayed ? FUNCTOR_PROCESS_DELAY : 0);
+            if ((status & DisplayList.STATUS_INVOKE) != 0 ||
+                    attachInfo.mHandler.hasCallbacks(mFunctorsRunnable)) {
+                attachInfo.mHandler.removeCallbacks(mFunctorsRunnable);
+                mFunctorsRunnable.attachInfo = attachInfo;
+                attachInfo.mHandler.postDelayed(mFunctorsRunnable, FUNCTOR_PROCESS_DELAY);
             }
         }
 
@@ -1329,7 +1323,9 @@
         boolean attachFunctor(View.AttachInfo attachInfo, int functor) {
             if (mCanvas != null) {
                 mCanvas.attachFunctor(functor);
-                scheduleFunctors(attachInfo, false);
+                mFunctorsRunnable.attachInfo = attachInfo;
+                attachInfo.mHandler.removeCallbacks(mFunctorsRunnable);
+                attachInfo.mHandler.postDelayed(mFunctorsRunnable,  0);
                 return true;
             }
             return false;
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 0fe2a8e3..2b6cbcf 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -74,7 +74,7 @@
     void setEventDispatching(boolean enabled);
     void addWindowToken(IBinder token, int type);
     void removeWindowToken(IBinder token);
-    void addAppToken(int addPos, IApplicationToken token,
+    void addAppToken(int addPos, int userId, IApplicationToken token,
             int groupId, int requestedOrientation, boolean fullscreen, boolean showWhenLocked);
     void setAppGroupId(IBinder token, int groupId);
     void setAppOrientation(IApplicationToken token, int requestedOrientation);
diff --git a/core/java/android/widget/RemoteViewsAdapter.java b/core/java/android/widget/RemoteViewsAdapter.java
index c122bb2..b088c59 100644
--- a/core/java/android/widget/RemoteViewsAdapter.java
+++ b/core/java/android/widget/RemoteViewsAdapter.java
@@ -21,6 +21,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedList;
+
 import android.appwidget.AppWidgetManager;
 import android.content.Context;
 import android.content.Intent;
@@ -33,7 +34,6 @@
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.util.Log;
-import android.util.Pair;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.MeasureSpec;
@@ -90,13 +90,15 @@
     private Handler mMainQueue;
 
     // We cache the FixedSizeRemoteViewsCaches across orientation. These are the related data
-    // structures;
-    private static final HashMap<Pair<Intent.FilterComparison, Integer>, FixedSizeRemoteViewsCache>
-            sCachedRemoteViewsCaches = new HashMap<Pair<Intent.FilterComparison, Integer>,
+    // structures; 
+    private static final HashMap<RemoteViewsCacheKey,
+            FixedSizeRemoteViewsCache> sCachedRemoteViewsCaches
+            = new HashMap<RemoteViewsCacheKey,
                     FixedSizeRemoteViewsCache>();
-    private static final HashMap<Pair<Intent.FilterComparison, Integer>, Runnable>
-            sRemoteViewsCacheRemoveRunnables = new HashMap<Pair<Intent.FilterComparison, Integer>,
-            Runnable>();
+    private static final HashMap<RemoteViewsCacheKey, Runnable>
+            sRemoteViewsCacheRemoveRunnables
+            = new HashMap<RemoteViewsCacheKey, Runnable>();
+
     private static HandlerThread sCacheRemovalThread;
     private static Handler sCacheRemovalQueue;
 
@@ -771,6 +773,33 @@
         }
     }
 
+    static class RemoteViewsCacheKey {
+        final Intent.FilterComparison filter;
+        final int widgetId;
+        final int userId;
+
+        RemoteViewsCacheKey(Intent.FilterComparison filter, int widgetId, int userId) {
+            this.filter = filter;
+            this.widgetId = widgetId;
+            this.userId = userId;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (!(o instanceof RemoteViewsCacheKey)) {
+                return false;
+            }
+            RemoteViewsCacheKey other = (RemoteViewsCacheKey) o;
+            return other.filter.equals(filter) && other.widgetId == widgetId
+                    && other.userId == userId;
+        }
+
+        @Override
+        public int hashCode() {
+            return (filter == null ? 0 : filter.hashCode()) ^ (widgetId << 2) ^ (userId << 10);
+        }
+    }
+
     public RemoteViewsAdapter(Context context, Intent intent, RemoteAdapterConnectionCallback callback) {
         mContext = context;
         mIntent = intent;
@@ -786,7 +815,6 @@
         } else {
             mUserId = UserHandle.myUserId();
         }
-
         // Strip the previously injected app widget id from service intent
         if (intent.hasExtra(RemoteViews.EXTRA_REMOTEADAPTER_APPWIDGET_ID)) {
             intent.removeExtra(RemoteViews.EXTRA_REMOTEADAPTER_APPWIDGET_ID);
@@ -808,8 +836,8 @@
         mCallback = new WeakReference<RemoteAdapterConnectionCallback>(callback);
         mServiceConnection = new RemoteViewsAdapterServiceConnection(this);
 
-        Pair<Intent.FilterComparison, Integer> key = new Pair<Intent.FilterComparison, Integer>
-                (new Intent.FilterComparison(mIntent), mAppWidgetId);
+        RemoteViewsCacheKey key = new RemoteViewsCacheKey(new Intent.FilterComparison(mIntent),
+                mAppWidgetId, mUserId);
 
         synchronized(sCachedRemoteViewsCaches) {
             if (sCachedRemoteViewsCaches.containsKey(key)) {
@@ -850,8 +878,8 @@
     }
 
     public void saveRemoteViewsCache() {
-        final Pair<Intent.FilterComparison, Integer> key = new Pair<Intent.FilterComparison,
-                Integer> (new Intent.FilterComparison(mIntent), mAppWidgetId);
+        final RemoteViewsCacheKey key = new RemoteViewsCacheKey(
+                new Intent.FilterComparison(mIntent), mAppWidgetId, mUserId);
 
         synchronized(sCachedRemoteViewsCaches) {
             // If we already have a remove runnable posted for this key, remove it.
@@ -973,6 +1001,7 @@
         long itemId = 0;
         try {
             remoteViews = factory.getViewAt(position);
+            remoteViews.setUser(new UserHandle(mUserId));
             itemId = factory.getItemId(position);
         } catch (RemoteException e) {
             Log.e(TAG, "Error in updateRemoteViews(" + position + "): " + e.getMessage());
diff --git a/core/java/android/widget/Toast.java b/core/java/android/widget/Toast.java
index 485bd37..1d85126 100644
--- a/core/java/android/widget/Toast.java
+++ b/core/java/android/widget/Toast.java
@@ -374,8 +374,11 @@
                 // remove the old view if necessary
                 handleHide();
                 mView = mNextView;
-                mWM = (WindowManager)mView.getContext().getApplicationContext()
-                        .getSystemService(Context.WINDOW_SERVICE);
+                Context context = mView.getContext().getApplicationContext();
+                if (context == null) {
+                    context = mView.getContext();
+                }
+                mWM = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
                 // We can resolve the Gravity here by using the Locale for getting
                 // the layout direction
                 final Configuration config = mView.getContext().getResources().getConfiguration();
diff --git a/core/res/res/layout/notification_template_base.xml b/core/res/res/layout/notification_template_base.xml
index 134f45e..d2e25c1 100644
--- a/core/res/res/layout/notification_template_base.xml
+++ b/core/res/res/layout/notification_template_base.xml
@@ -61,7 +61,6 @@
             <ViewStub android:id="@+id/time"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_gravity="center"
                 android:layout_weight="0"
                 android:visibility="gone"
                 android:layout="@layout/notification_template_part_time"
@@ -69,7 +68,6 @@
             <ViewStub android:id="@+id/chronometer"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_gravity="center"
                 android:layout_weight="0"
                 android:visibility="gone"
                 android:layout="@layout/notification_template_part_chronometer"
diff --git a/core/res/res/layout/notification_template_big_base.xml b/core/res/res/layout/notification_template_big_base.xml
index b5da486..7cc6650 100644
--- a/core/res/res/layout/notification_template_big_base.xml
+++ b/core/res/res/layout/notification_template_big_base.xml
@@ -66,7 +66,6 @@
                 <ViewStub android:id="@+id/time"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_gravity="center"
                     android:layout_weight="0"
                     android:visibility="gone"
                     android:layout="@layout/notification_template_part_time"
@@ -74,7 +73,6 @@
                 <ViewStub android:id="@+id/chronometer"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_gravity="center"
                     android:layout_weight="0"
                     android:visibility="gone"
                     android:layout="@layout/notification_template_part_chronometer"
diff --git a/core/res/res/layout/notification_template_big_text.xml b/core/res/res/layout/notification_template_big_text.xml
index 01f1acf..7e6da22 100644
--- a/core/res/res/layout/notification_template_big_text.xml
+++ b/core/res/res/layout/notification_template_big_text.xml
@@ -68,7 +68,6 @@
                 <ViewStub android:id="@+id/time"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_gravity="center"
                     android:layout_weight="0"
                     android:visibility="gone"
                     android:layout="@layout/notification_template_part_time"
@@ -76,7 +75,6 @@
                 <ViewStub android:id="@+id/chronometer"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_gravity="center"
                     android:layout_weight="0"
                     android:visibility="gone"
                     android:layout="@layout/notification_template_part_chronometer"
diff --git a/core/res/res/layout/notification_template_inbox.xml b/core/res/res/layout/notification_template_inbox.xml
index 1b7e659..1eec871 100644
--- a/core/res/res/layout/notification_template_inbox.xml
+++ b/core/res/res/layout/notification_template_inbox.xml
@@ -69,7 +69,6 @@
                 <ViewStub android:id="@+id/time"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_gravity="center"
                     android:layout_weight="0"
                     android:visibility="gone"
                     android:layout="@layout/notification_template_part_time"
@@ -77,7 +76,6 @@
                 <ViewStub android:id="@+id/chronometer"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_gravity="center"
                     android:layout_weight="0"
                     android:visibility="gone"
                     android:layout="@layout/notification_template_part_chronometer"
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index 158f03e..6769a6c 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -91,7 +91,7 @@
     <string name="roamingText0" msgid="7170335472198694945">"Indikátor roamingu svítí"</string>
     <string name="roamingText1" msgid="5314861519752538922">"Indikátor roamingu nesvítí"</string>
     <string name="roamingText2" msgid="8969929049081268115">"Indikátor roamingu bliká"</string>
-    <string name="roamingText3" msgid="5148255027043943317">"Není v blízkosti"</string>
+    <string name="roamingText3" msgid="5148255027043943317">"Není v okolí"</string>
     <string name="roamingText4" msgid="8808456682550796530">"Mimo budovu"</string>
     <string name="roamingText5" msgid="7604063252850354350">"Roaming – preferovaný systém"</string>
     <string name="roamingText6" msgid="2059440825782871513">"Roaming – dostupný systém"</string>
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index 53604b5..765149e 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -113,7 +113,7 @@
     <string name="httpError" msgid="7956392511146698522">"Ошибка сети."</string>
     <string name="httpErrorLookup" msgid="4711687456111963163">"Не удалось найти страницу по этому URL."</string>
     <string name="httpErrorUnsupportedAuthScheme" msgid="6299980280442076799">"Схема аутентификации сайта не поддерживается."</string>
-    <string name="httpErrorAuth" msgid="1435065629438044534">"Аутентификация не выполнена."</string>
+    <string name="httpErrorAuth" msgid="1435065629438044534">"Ошибка аутентификации."</string>
     <string name="httpErrorProxyAuth" msgid="1788207010559081331">"Не удалось выполнить аутентификацию через прокси-сервер."</string>
     <string name="httpErrorConnect" msgid="8714273236364640549">"Не удалось подключиться к серверу."</string>
     <string name="httpErrorIO" msgid="2340558197489302188">"Не удалось подключиться к серверу. Повторите попытку позже."</string>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 80c2a13..99fbf95 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -3094,7 +3094,7 @@
     <!-- Choice in the ringtone picker.  If chosen, the default ringtone will be used. This fills in the actual ringtone's title into the message. -->
     <string name="ringtone_default_with_actual">Default ringtone (<xliff:g id="actual_ringtone">%1$s</xliff:g>)</string>
     <!-- Choice in the ringtone picker.  If chosen, there will be silence instead of a ringtone played. -->
-    <string name="ringtone_silent">Silent</string>
+    <string name="ringtone_silent">None</string>
     <!-- The title of the ringtone picker dialog. -->
     <string name="ringtone_picker_title">Ringtones</string>
     <!-- If there is ever a ringtone set for some setting, but that ringtone can no longer be resolved, t his is shown instead.  For example, if the ringtone was on a SD card and it had been removed, this woudl be shown for ringtones on that SD card. -->
diff --git a/data/fonts/DroidSansThai.ttf b/data/fonts/DroidSansThai.ttf
index c078be0..15b00c2 100644
--- a/data/fonts/DroidSansThai.ttf
+++ b/data/fonts/DroidSansThai.ttf
Binary files differ
diff --git a/data/fonts/fallback_fonts.xml b/data/fonts/fallback_fonts.xml
index 50ff437..999ddc4 100644
--- a/data/fonts/fallback_fonts.xml
+++ b/data/fonts/fallback_fonts.xml
@@ -103,6 +103,11 @@
     </family>
     <family>
         <fileset>
+            <file>Lohit-Telugu.ttf</file>
+        </fileset>
+    </family>
+    <family>
+        <fileset>
             <file>DroidSansFallback.ttf</file>
         </fileset>
     </family>
@@ -111,13 +116,10 @@
             <file lang="ja">MTLmr3m.ttf</file>
         </fileset>
     </family>
-    <!--
-        Fonts below this point have problematic glyphs and should not be moved
-        higher in the fallback list until those glyphs have been fixed.
+    <!-- Note: complex scripts (i.e. those requiring shaping in Harfbuzz) have
+         a cumulative limit of 64k glyphs. Thus, if they are placed after the
+         large fonts such as DroidSansFallback, they are likely to render
+         incorrectly. Please use caution when putting fonts toward the end of
+         the list.
     -->
-    <family>
-        <fileset>
-            <file>Lohit-Telugu.ttf</file> <!-- masks U+FFBC-10007 -->
-        </fileset>
-    </family>
 </familyset>
diff --git a/docs/html/design/index.jd b/docs/html/design/index.jd
index 1e6b40c..b19422b 100644
--- a/docs/html/design/index.jd
+++ b/docs/html/design/index.jd
@@ -2,6 +2,37 @@
 header.hide=1
 footer.hide=1
 @jd:body
+<style>
+#butterbar-wrapper {
+  position:absolute;
+  top:0;
+  left:0;
+  width:100%;
+}
+#butterbar {
+  width:940px;
+  margin:0 auto;
+}
+#butterbar-message {
+  background-color:#f80;
+  float:right;
+  font-size:12px;
+  font-weight:bold;
+  padding:0 10px;
+  border-radius: 0 0 5px 5px;
+}
+#butterbar-message a {color:#fff !important}
+#butterbar-message a:hover {text-decoration:underline;}
+</style>
+
+ <div id="butterbar-wrapper" >
+  <div id="butterbar" >
+    <div id="butterbar-message">
+<a target="_blank" href="https://docs.google.com/a/google.com/forms/d/17EFbvdm4FYkocc83EcrKhyhP5Y6tbns_eiBSeQ6ojxU/viewform">
+      Take the Android Developer Survey</a>
+    </div>
+  </div>
+</div>
 
 <style>
 #landing-graphic-container {
diff --git a/docs/html/develop/index.jd b/docs/html/develop/index.jd
index 3ca7b80..70d3f6d 100644
--- a/docs/html/develop/index.jd
+++ b/docs/html/develop/index.jd
@@ -4,6 +4,37 @@
 carousel=1
 tabbedList=1
 @jd:body
+<style>
+#butterbar-wrapper {
+  position:absolute;
+  top:0;
+  left:0;
+  width:100%;
+}
+#butterbar {
+  width:940px;
+  margin:0 auto;
+}
+#butterbar-message {
+  background-color:#f80;
+  float:right;
+  font-size:12px;
+  font-weight:bold;
+  padding:0 10px;
+  border-radius: 0 0 5px 5px;
+}
+#butterbar-message a {color:#fff !important}
+#butterbar-message a:hover {text-decoration:underline;}
+</style>
+
+ <div id="butterbar-wrapper" >
+  <div id="butterbar" >
+    <div id="butterbar-message">
+<a target="_blank" href="https://docs.google.com/a/google.com/forms/d/17EFbvdm4FYkocc83EcrKhyhP5Y6tbns_eiBSeQ6ojxU/viewform">
+      Take the Android Developer Survey</a>
+    </div>
+  </div>
+</div>
 
 <style>
 #noplayer-message {
diff --git a/docs/html/distribute/googleplay/promote/brand.jd b/docs/html/distribute/googleplay/promote/brand.jd
index 834f8a9..63b1f03 100644
--- a/docs/html/distribute/googleplay/promote/brand.jd
+++ b/docs/html/distribute/googleplay/promote/brand.jd
@@ -109,7 +109,7 @@
     <p style="text-align:center">
        <a href="{@docRoot}images/brand/Google_Play_Store_48.png">48x48</a> |
        <a href="{@docRoot}images/brand/Google_Play_Store_96.png">96x96</a><br>
-       <a href="{@docRoot}images/brand/Google_Play_Store.ai">Illustrator (.ai)</a>
+       <a href="{@docRoot}downloads/brand/Google_Play_Store.ai">Illustrator (.ai)</a>
        </p>
   </div>
   
@@ -129,7 +129,7 @@
     <p style="text-align:center">
        <a href="{@docRoot}images/brand/en_app_rgb_wo_45.png">129x45</a> |
        <a href="{@docRoot}images/brand/en_app_rgb_wo_60.png">172x60</a><br>
-       <a href="{@docRoot}images/brand/en_app_rgb_wo.ai">Illustrator (.ai)</a></p>
+       <a href="{@docRoot}downloads/brand/en_app_rgb_wo.ai">Illustrator (.ai)</a></p>
   </div>
       
   <div style="float:right;clear:right;width:172px;margin-left:30px">
@@ -137,7 +137,7 @@
     <p style="text-align:center">
        <a href="{@docRoot}images/brand/en_generic_rgb_wo_45.png">129x45</a> |
        <a href="{@docRoot}images/brand/en_generic_rgb_wo_60.png">172x60</a><br>
-       <a href="{@docRoot}images/brand/en_generic_rgb_wo.ai">Illustrator (.ai)</a></p>
+       <a href="{@docRoot}downloads/brand/en_generic_rgb_wo.ai">Illustrator (.ai)</a></p>
   </div>
          
   <p>The "Get it on Google Play" and "Android App on Google Play" logos are badges that you
diff --git a/docs/html/distribute/index.jd b/docs/html/distribute/index.jd
index c0ed6a8..a950971 100644
--- a/docs/html/distribute/index.jd
+++ b/docs/html/distribute/index.jd
@@ -2,7 +2,37 @@
 header.hide=1
 
 @jd:body
+<style>
+#butterbar-wrapper {
+  position:absolute;
+  top:0;
+  left:0;
+  width:100%;
+}
+#butterbar {
+  width:940px;
+  margin:0 auto;
+}
+#butterbar-message {
+  background-color:#f80;
+  float:right;
+  font-size:12px;
+  font-weight:bold;
+  padding:0 10px;
+  border-radius: 0 0 5px 5px;
+}
+#butterbar-message a {color:#fff !important}
+#butterbar-message a:hover {text-decoration:underline;}
+</style>
 
+ <div id="butterbar-wrapper" >
+  <div id="butterbar" >
+    <div id="butterbar-message">
+<a target="_blank" href="https://docs.google.com/a/google.com/forms/d/17EFbvdm4FYkocc83EcrKhyhP5Y6tbns_eiBSeQ6ojxU/viewform">
+      Take the Android Developer Survey</a>
+    </div>
+  </div>
+</div>
     
     
     <div class="marquee">
diff --git a/docs/html/google/backup/index.jd b/docs/html/google/backup/index.jd
new file mode 100644
index 0000000..cbed01a
--- /dev/null
+++ b/docs/html/google/backup/index.jd
@@ -0,0 +1,79 @@
+page.title=Android Backup Service
+@jd:body
+
+
+<p>Android Backup Service provides a <em>backup transport</em> for Android's <a
+href="{@docRoot}guide/topics/data/backup.html">data backup</a> framework, which allows you
+to copy a user's persistent app data to remote "cloud" storage. Backing up persistent data
+this way provides a restore point for the app on most devices running Android 2.2 or
+higher. The backup service is <em>not</em> designed for synchronizing application data with other
+clients or saving data that you'd like to access at random during the
+application lifecycle.</p>
+
+<p>The Android Backup Service offered by Google provides a backup
+transport on most devices that include Google Play Store and backs up your app data to Google
+servers. The backup transport may differ
+from device to device and which backup transport is available on any device is
+transparent to your application.</p>
+
+<p>In order to use Android Backup Service, you must <a href="{@docRoot}google/backup/signup.html"
+>register your app</a> with the service to receive a key that you must
+include in your Android manifest.</p>
+
+<p class="note"><strong>Note:</strong> Registering your application with Android Backup
+Service does not guarantee that it will always back up data using this service
+from Google. If you support
+data backup in your application, then it will back up using whichever transport is enabled
+on the device. Registering with Android Backup Service allows your application to back up
+when the backup transport on the device is provided by Android Backup Service.</p>
+
+<p>For more information about how data backup works on Android and how to use it in your app,
+read the <a href="{@docRoot}guide/topics/data/backup.html">Data Backup</a> guide.</p>
+
+
+
+<h2>Adding the Backup Service Key to the Manifest</h2>
+
+<p>Once you <a href="{@docRoot}google/backup/signup.html"
+>register your app</a>, you'll receive a Backup Service Key,
+which you must include in your Android manifest file with the following syntax:</p>
+
+<pre class="prettyprint">
+&lt;application>
+    &lt;meta-data android:name="com.google.android.backup.api_key"
+               android:value="<em>your_backup_service_key</em>" /&gt;
+    ...
+&lt;/application>
+</pre>
+
+<p>Insert your Backup Service Key in the <code>android:value</code> attribute and place the
+<code>&lt;meta-data&gt;</code> element inside your Android manifest's
+<code>&lt;application&gt;</code> element.</p>
+
+<p>When a device that uses Android Backup Service runs your application,
+the system verifies that your Backup Service Key is valid and Android Backup Service saves the
+user's data to Google servers using the primary Google account on the device.</p>
+
+<p>If your application
+does not provide a valid Backup Service Key, then backup will not occur. If the device does not
+provide backup using Android Backup Service, then the <code>&lt;meta-data&gt;</code> element and
+Backup Service Key are ignored&mdash;your application will work normally, but will either back up
+data using a different backup transport or not perform backup at all. Either
+way, your application is unaware of what transport is used, if at all, and otherwise
+operates normally.</p>
+
+<p>For more information about how to provide data backup in your Android application, see the <a
+href="{@docRoot}guide/topics/data/backup.html">Data Backup</a> guide.</p>
+
+
+<h2>User Privacy</h2>
+
+<p>At Google, we are keenly aware of the trust users place in us and our responsibility to protect
+users' privacy. Google securely transmits backup data to and from Google servers in order to provide
+backup and restore features. Google treats this data as personal information in accordance with
+Google's <a href="http://www.google.com/privacypolicy.html">Privacy Policy</a>.</p>
+
+<p>In addition, users can disable data backup functionality through the Android
+system's privacy settings. When a user disables backup, Android Backup Service deletes all saved
+backup data. A user can re-enable backup on the device, but Android Backup Service will not restore
+any previously deleted data.</p>
diff --git a/docs/html/google/backup/signup.jd b/docs/html/google/backup/signup.jd
new file mode 100644
index 0000000..d5c26a1
--- /dev/null
+++ b/docs/html/google/backup/signup.jd
@@ -0,0 +1,269 @@
+page.title=Register for Android Backup Service
+@jd:body
+
+
+<p>If you are developing an Android application that supports <a
+href="http://developer.android.com/guide/topics/data/backup.html">data backup</a>, you must
+register your application with Android Backup Service in order to backup your app's data
+using the backup transport provided by Google. Registering your app provides you a Backup
+Service Key that verifies your application and allows backup when
+Android Backup Service is available on the user's device. Registration with Android Backup Service
+is free.</p>
+
+<p>A single Backup Service Key is valid for only the application with which you register using the
+form below. If you have multiple applications for which you would like a Backup Service Key, then
+you must register each application to receive a unique Backup Service Key for each one.</p>
+
+<p>For more information about developing with Android Backup Service, read the <a
+href="{@docRoot}guide/topics/data/backup.html">Data Backup</a> guide.</p>
+
+<p>Before you can register with Android Backup Service,
+you must agree to the following terms of service.</p>
+
+
+
+
+<div class="sdk-terms" onfocus="this.blur()" style="width:678px"
+><h2 class="norule">Terms of Service</h2>
+This is the terms of service for the Android Backup Service.
+
+<h3>1. Your relationship with Google</h3>
+1.1 Your use of the Android Backup Service (referred to as the &quot;Service&quot; in this document) is subject to the terms of a legal agreement between you and Google. &quot;Google&quot; means Google Inc., whose principal place of business is at 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States. This document explains how the agreement is made up, and sets out some of the terms of that agreement.
+
+1.2 Unless otherwise agreed in writing with Google, your agreement with Google will always include, at a minimum, the terms and conditions set out in this document. These are referred to below as the &quot;Terms&quot;.
+
+1.3 The Terms form a legally binding agreement between you and Google in relation to your use of the Service. It is important that you take the time to read them carefully.
+
+<h3>2. Accepting the Terms</h3>
+2.1 In order to use the Service, you must first agree to the Terms. You may not use the Service if you do not accept the Terms.
+
+2.2 You can accept the Terms by clicking to accept or agree to the Terms, where this option is made available to you by Google.
+
+2.3 You may not use the Service and may not accept the Terms if you are not of legal age to form a binding contract with Google.
+
+2.4 You represent that you have full power, capacity and authority to accept these Terms. If you are accepting on behalf of your employer or another entity, you represent that you have full legal authority to bind your employer or such entity to these Terms. If you don't have the legal authority to bind, please ensure that an authorized person from your entity consents to and accepts these Terms.
+
+<h3>3. Provision of the Service by Google</h3>
+3.1 Google has subsidiaries and affiliated legal entities around the world (&quot;Subsidiaries and Affiliates&quot;). Sometimes, these companies will be providing the Service to you on behalf of Google itself. You acknowledge and agree that Subsidiaries and Affiliates will be entitled to provide the Service to you.
+
+3.2 Google is constantly innovating in order to provide the best possible experience for its users. You acknowledge and agree that the form and nature of the Service which Google provides may change from time to time without prior notice to you.
+
+3.3 As part of this continuing innovation, you acknowledge and agree that Google may stop (permanently or temporarily) providing the Service (or any features within the Service) to you or to users generally at Google's sole discretion, without prior notice to you. You may stop using the Service at any time. You do not need to specifically inform Google when you stop using the Service.
+
+3.4 You acknowledge and agree that if Google disables your Backup Service Key, you and the Android application(s) you developed (&quot;Application(s)&quot;) may be prevented from accessing the Service and any content that is stored with the Service.
+
+3.5 You acknowledge and agree that Google may set a fixed upper limit on the number of backup transmissions you may send or receive through the Service or on the amount of storage space used for the provision of the Service at any time, at Google's discretion. You agree to abide by any such fixed upper limits.
+
+<h3>4. Use of the Service by you</h3>
+4.1 In order to access the Service, you must have a unique application identifier (&quot;Package Name&quot;) for your Application as described in the documentation for the Service.
+
+4.2 After supplying Google with the Package Name and accepting the Terms, you will be issued an alphanumeric key (&quot;Backup Service Key&quot;) assigned to you by Google that is uniquely associated with your Application. Your Application must include this Backup Service Key as described in the documentation for the Service.
+
+4.3 There is currently no limit to the number of Backup Service Keys you may obtain in this manner provided that you use a different Package Name for each Backup Service Key you obtain. You agree that each Backup Service Key is only valid for Applications with the corresponding Package Name. You agree that Google may, in its sole discretion, impose a limit on the number of Backup Service Keys that may be obtained in the future. You agree that your continued use of any of the Backup Service Keys assigned by Google, or distribution of any Applications using such Backup Service Keys, constitutes your continued agreement to these Terms.
+
+4.4 You agree to use the Service only for purposes that are permitted by (a) the Terms and (b) any applicable law, regulation, third-party terms of service, or generally accepted practices or guidelines in the relevant jurisdictions (including any laws regarding the export of data or software to and from the United States or other relevant countries).
+
+4.5 You agree not to access (or attempt to access) any of the Service by any means other than through the interfaces, methods, and APIs that are provided by Google, unless you have been specifically allowed to do so in a separate agreement with Google.
+
+4.6 You agree that you will not engage in any activity that interferes with or disrupts the Service (or the servers and networks which are connected to the Service), or the servers or networks of any third-party.
+
+4.7 You agree that your use of the Service will be in compliance with any documentation guidelines provided by Google and that failure to comply with the documentation guidelines may result in the disabling of the Backup Service Key(s) for your Application(s).
+
+4.8 Unless you have been specifically permitted to do so in a separate agreement with Google, you agree that you will not reproduce, duplicate, copy, sell, trade or resell (a) use of the Service, or (b) access to the Service.
+
+4.9 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) your and your Application's use of the Service, any breach of your obligations under the Terms, and for the consequences (including any loss or damage which Google may suffer) of any such breach.
+
+4.10 You agree that in your use of the Service, you and your Applications will protect the privacy and legal rights of users. You must provide legally adequate privacy notice and protection for users whose data your Applications back up to the Service. Further, your Application may only use that information for the limited purpose of backing up the data to the Service unless the user has given you permission for further use. If the user has not given you permission to back up information to the Service, you may not transmit such information to the Service.
+
+4.11 You agree that you and your Applications will not transmit or store sensitive user information, such as user names, passwords, or credit card numbers, through the Service.
+
+<h3>5. Security</h3>
+5.1 You agree and understand that you are responsible for maintaining the security associated with any information you provide to access the Service as well as of the Backup Service Key(s) assigned to you by Google. You agree that only you are authorized to use the Backup Service Key(s) assigned to you.
+
+5.2 Accordingly, you agree that you will be solely responsible to Google for all activities that occur in connection with your access to the Service, as well as the Backup Service Key.
+
+5.3 If you become aware of any unauthorized use of your Backup Service Key(s) you agree to notify Google immediately.
+
+<h3>6. Privacy and your personal information</h3>
+6.1 For information about Google's data protection practices, please read Google's privacy policy at <a href="http://www.google.com/privacy.html">http://www.google.com/privacy.html</a>. This policy explains how Google treats your personal information when you use the Service.
+
+6.2 You agree to the use of your data in accordance with Google's privacy policies.
+
+<h3>7. Content in the Service</h3>
+7.1 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any Content that you or your Applications transmit or store through the Service and for the consequences of your actions (including any loss or damage which Google may suffer) by doing so. You agree that you are solely responsible for (A) any Content that is transmitted through the Service by your Applications, and (B) any Content that Devices retrieve from the Service by virtue of your Applications. For purposes of the Terms, &quot;Content&quot; means information such as data, messages, settings information, written text, computer software, music, audio files or other sounds, photographs, videos or other images. &quot;Device(s)&quot; means device(s) powered by the Android operating system.
+
+7.2 You agree that you will not transmit any Content through the Service that is copyrighted, protected by trade secret or otherwise subject to third party proprietary rights, including patent, privacy and publicity rights, unless you are the owner of such rights or have permission from their rightful owner to transmit the Content through the Service.
+
+<h3>8. Proprietary rights</h3>
+8.1 You acknowledge and agree that Google (or Google's licensors) own all legal right, title and interest in and to the Service, including any intellectual property rights which subsist in the Service (whether those rights happen to be registered or not, and wherever in the world those rights may exist).
+
+8.2 Unless you have agreed otherwise in writing with Google, nothing in the Terms gives you a right to use any of Google's trade names, trademarks, service marks, logos, domain names, and other distinctive brand features.
+
+8.3 If you have been given an explicit right to use any of these brand features in a separate written agreement with Google, then you agree that your use of such features shall be in compliance with that agreement, any applicable provisions of the Terms, and Google's brand feature use guidelines as updated from time to time. These guidelines can be viewed online at <a href="http://www.google.com/permissions/guidelines.html">http://www.google.com/permissions/ guidelines.html</a> (or such other URL as Google may provide for this purpose from time to time).
+
+8.4 You agree that you shall not remove, obscure, or alter any proprietary rights notices (including copyright, trade mark notices) which may be affixed to or contained within the Service.
+
+<h3>9. License from Google</h3>
+9.1 Subject to terms and conditions of these Terms, Google gives you a personal, worldwide, royalty-free, non-assignable and non-exclusive license to use the Service as provided to you by Google. This license is for the sole purpose of enabling you to use and enjoy the benefit of the Service as provided by Google, in the manner permitted by the Terms. 
+
+9.2 You may not (and you may not permit anyone else to) copy, modify, create a derivative work of, reverse engineer, decompile or otherwise attempt to extract the source code from the Service or any part thereof, unless this is expressly permitted or required by law, or unless you have been specifically told that you may do so by Google, in writing.
+
+9.3 Unless Google has given you specific written permission to do so, you may not assign (or grant a sub-license of) your rights to use the Service, grant a security interest in or over your rights to use the Service, or otherwise transfer any part of your rights to use the Service.
+
+<h3>10. Your code</h3>
+10.1 Google claims no ownership or control over any source code written by you to be used with the Service. You retain copyright and any other rights you already hold in this code, and you are responsible for protecting those rights, as appropriate.
+
+<h3>11. Ending your relationship with Google</h3>
+11.1 The Terms will continue to apply until terminated by either you or Google as set out below.
+
+11.2 You may terminate your legal agreement with Google by discontinuing your use of the Service at any time.
+
+11.3 Google may, at any time, terminate its legal agreement with you if:
+
+  (A) you have breached any provision of the Terms (or have acted in manner which clearly shows that you do not intend to, or are unable to comply with the provisions of the Terms); or
+
+  (B) Google is required to do so by law (for example, where the provision of the Service to you is, or becomes, unlawful); or
+
+  (C) Google is transitioning to no longer providing the Service; or
+
+  (D) your Application fails to meet the documentation guidelines provided by Google.
+
+11.4 Nothing in this Section shall affect Google's rights regarding provision of the Service under Section 3 of the Terms.
+
+11.5 When these Terms come to an end, all of the legal rights, obligations and liabilities that you and Google have benefited from, been subject to (or which have accrued over time whilst the Terms have been in force) or which are expressed to continue indefinitely, shall be unaffected by this cessation, and the provisions of Sections 12, 13 and Paragraph 16 shall continue to apply to such rights, obligations and liabilities indefinitely.
+
+<h3>12. EXCLUSION OF WARRANTIES</h3>
+12.1 NOTHING IN THESE TERMS, INCLUDING SECTIONS 12 AND 13, SHALL EXCLUDE OR LIMIT GOOGLE'S WARRANTY OR LIABILITY FOR LOSSES WHICH MAY NOT BE LAWFULLY EXCLUDED OR LIMITED BY APPLICABLE LAW. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF CERTAIN WARRANTIES OR CONDITIONS OR THE LIMITATION OR EXCLUSION OF LIABILITY FOR LOSS OR DAMAGE CAUSED BY NEGLIGENCE, BREACH OF CONTRACT OR BREACH OF IMPLIED TERMS, OR INCIDENTAL OR CONSEQUENTIAL DAMAGES. ACCORDINGLY, ONLY THE LIMITATIONS WHICH ARE LAWFUL IN YOUR JURISDICTION WILL APPLY TO YOU AND OUR LIABILITY WILL BE LIMITED TO THE MAXIMUM EXTENT PERMITTED BY LAW.
+
+12.2 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SERVICE IS AT YOUR SOLE RISK AND THAT THE SERVICE AND CONTENT ARE PROVIDED &quot;AS IS&quot; AND &quot;AS AVAILABLE&quot;.
+
+12.3 IN PARTICULAR, GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS LICENSORS DO NOT REPRESENT OR WARRANT TO YOU THAT:
+
+  (A) YOUR USE OF THE SERVICE WILL MEET YOUR REQUIREMENTS,
+
+  (B) YOUR USE OF THE SERVICE WILL BE UNINTERRUPTED, TIMELY, SECURE OR FREE FROM ERROR, AND
+
+  (C) THAT DEFECTS IN THE OPERATION OR FUNCTIONALITY OF ANY SOFTWARE PROVIDED TO YOU AS PART OF THE SERVICE WILL BE CORRECTED.
+
+12.4 NO ADVICE OR INFORMATION, WHETHER ORAL OR WRITTEN, OBTAINED BY YOU FROM GOOGLE OR THROUGH OR FROM THE SERVICE SHALL CREATE ANY WARRANTY NOT EXPRESSLY STATED IN THE TERMS.
+
+12.5 GOOGLE FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+
+<h3>13. LIMITATION OF LIABILITY</h3>
+13.1 SUBJECT TO OVERALL PROVISION IN PARAGRAPH 12.1 ABOVE, YOU EXPRESSLY UNDERSTAND AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU FOR:
+
+  (A) ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL CONSEQUENTIAL OR EXEMPLARY DAMAGES WHICH MAY BE INCURRED BY YOU, HOWEVER CAUSED AND UNDER ANY THEORY OF LIABILITY. THIS SHALL INCLUDE, BUT NOT BE LIMITED TO, ANY LOSS OF PROFIT (WHETHER INCURRED DIRECTLY OR INDIRECTLY), ANY LOSS OF GOODWILL OR BUSINESS REPUTATION, ANY LOSS OF DATA SUFFERED, COST OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICE, OR OTHER INTANGIBLE LOSS;
+
+  (B) ANY LOSS OR DAMAGE WHICH MAY BE INCURRED BY YOU, INCLUDING BUT NOT LIMITED TO LOSS OR DAMAGE AS A RESULT OF:
+
+    (I) ANY CHANGES WHICH GOOGLE MAY MAKE TO THE SERVICE, OR FOR ANY PERMANENT OR TEMPORARY CESSATION IN THE PROVISION OF THE SERVICE (OR ANY FEATURES WITHIN THE SERVICE);
+
+    (II) THE DELETION OF, CORRUPTION OF, OR FAILURE TO STORE, ANY CONTENT AND OTHER COMMUNICATIONS DATA MAINTAINED OR TRANSMITTED BY OR THROUGH YOUR USE OF THE SERVICE;
+
+    (III) YOUR FAILURE TO PROVIDE GOOGLE WITH ACCURATE ACCOUNT INFORMATION; OR
+
+    (IV) YOUR FAILURE TO KEEP YOUR PASSWORD OR ACCOUNT DETAILS SECURE AND CONFIDENTIAL.
+
+13.2 THE LIMITATIONS ON GOOGLE'S LIABILITY TO YOU IN PARAGRAPH 13.1 ABOVE SHALL APPLY WHETHER OR NOT GOOGLE HAS BEEN ADVISED OF OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING.
+
+<h3>14. Indemnification</h3>
+14.1 You agree to hold harmless and indemnify Google, and its subsidiaries, affiliates, officers, agents, employees, or licensors from and against any third party claim arising from or in any way related to (a) your breach of the Terms, (b) your use of the Service, or (c) your violation of applicable laws, rules or regulations in connection with the Service, including any liability or expense arising from all claims, losses, damages (actual and consequential), suits, judgments, litigation costs and attorneys' fees, of every kind and nature. In such a case, Google will provide you with written notice of such claim, suit or action.
+
+<h3>15. Changes to the Terms</h3>
+15.1 Due to things like changes to the law or changes to functionality offered through the Service, Google may need to change these Terms from time to time. You should look at the Terms regularly. We'll post notice of the modified Terms within, or through, the Service. Once the modified Terms are posted, the changes will become effective immediately, and you are deemed to have accepted the modified Terms if you continue to use the Service. If you do not agree to the modified Terms for the Service, please stop using the Service.
+
+<h3>16. General legal terms</h3>
+16.1 The Terms constitute the whole legal agreement between you and Google and govern your use of the Service (but excluding any service which Google may provide to you under a separate written agreement), and completely replace any prior agreements between you and Google in relation to the Service.
+
+16.2 You agree that Google may provide you with notices, including those regarding changes to the Terms, by email, regular mail, or postings on the Service.
+
+16.3 You agree that if Google does not exercise or enforce any legal right or remedy which is contained in the Terms (or which Google has the benefit of under any applicable law), this will not be taken to be a formal waiver of Google's rights and that those rights or remedies will still be available to Google.
+
+16.4 If any court of law, having the jurisdiction to decide on this matter, rules that any provision of these Terms is invalid, then that provision will be removed from the Terms without affecting the rest of the Terms. The remaining provisions of the Terms will continue to be valid and enforceable.
+
+16.5 You acknowledge and agree that each member of the group of companies of which Google is the parent shall be third party beneficiaries to the Terms and that such other companies shall be entitled to directly enforce, and rely upon, any provision of the Terms which confers a benefit on (or rights in favor of) them. Other than this, no other person or company shall be third party beneficiaries to the Terms.
+
+16.6 The Terms, and your relationship with Google under the Terms, shall be governed by the laws of the State of California without regard to its conflict of laws provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located within the county of Santa Clara, California to resolve any legal matter arising from the Terms. Notwithstanding this, you agree that Google shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction.
+</div>
+
+
+
+
+
+
+
+
+
+
+
+<div id="sdk-terms-form">
+<p>
+<input id="agree" type="checkbox" name="agreeTerms" value="1" onclick="onFormInput()">
+<label id="agreeLabel" for="agree">I have read and agree
+with the Android Backup Service Terms of Service</label>
+</p>
+<p>
+<label id="pnameLabel" for="pname">Application package name:</label>
+<input id="pname" type="text" name="pname" size="47" value="" onkeyup="onFormInput()"
+onfocus="boxFocusChanged(this,true)" onblur="boxFocusChanged(this,false)"/>
+</p>
+<p><a href="" class="button disabled" id="registerButton" 
+onclick="onRegister(); return false;" >Register with Android Backup Service</a></p>
+</div>
+
+
+<script type="text/javascript">
+
+  var DEFAULT_TEXT = "com.example.android.app";
+  $("#pname").attr('value', DEFAULT_TEXT);
+  $("#pname").css({'color':'#aaaaaa'});
+
+  function onRegister() {
+    var packagename = $("#pname").val();
+    if (packagename.match(/[\s]/)) {
+        alert("Your package name cannot contain spaces. Please try again.");
+    } else if ($("input#agree").is(':checked')
+        && packagename.length
+        && packagename != DEFAULT_TEXT) {
+      window.location = "http://play.google.com/apps/publish/GetBackupApiKey?p=" +
+                      encodeURIComponent(packagename);
+    } else {
+      $("label#agreeLabel,label#pnameLabel").parent().stop().animate({color: "#258AAF"}, 200,
+        function() {$("label#agreeLabel,label#pnameLabel").parent().stop().animate({color: "#222"}, 200)}
+      );
+    }
+  }
+  
+  function boxFocusChanged(obj, focused) {
+    if (focused) {
+      if(obj.value == DEFAULT_TEXT){
+        obj.value = "";
+        obj.style.color="#000000";
+      }
+    } else {
+      if(obj.value == ""){
+        obj.value = DEFAULT_TEXT;
+        obj.style.color="#aaaaaa";
+      }
+    }
+  }
+  
+  
+  function onFormInput() {
+    /* verify that the TOS is agreed and a bit version is chosen */
+    var packagename = $("#pname").val();
+    if ($("input#agree").is(":checked")
+        && packagename.length
+        && packagename != DEFAULT_TEXT) {      
+      /* reveal the button */
+      $("a#registerButton").removeClass('disabled');
+    } else {
+      $("a#registerButton").addClass('disabled');
+    }
+  }
+
+</script>
+
+
+  </div><!-- end terms -->
+</form>
diff --git a/docs/html/google/backup/terms.jd b/docs/html/google/backup/terms.jd
new file mode 100644
index 0000000..decb0d8
--- /dev/null
+++ b/docs/html/google/backup/terms.jd
@@ -0,0 +1,505 @@
+page.title=Android Backup Service Terms of Service
+@jd:body
+
+
+
+<h3>1. Your relationship with Google</h3>
+
+<p>1.1
+Your use of the Android Backup Service (referred to as the &quot;Service&quot;
+in this document) is subject to the terms of a legal agreement between you and
+Google. &quot;Google&quot; means Google Inc., whose principal place of business
+is at 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States. This
+document explains how the agreement is made up, and sets out some of the terms
+of that agreement.</p>
+
+<p>1.2
+Unless otherwise agreed in writing with Google, your agreement with Google will
+always include, at a minimum, the terms and conditions set out in this
+document. These are referred to below as the &quot;Terms&quot;.</p>
+
+<p>1.3 The
+Terms form a legally binding agreement between you and Google in relation to
+your use of the Service. It is important that you take the time to read them
+carefully.</p>
+
+
+
+
+
+<h2>2. Accepting the Terms</h2>
+
+<p>2.1 In
+order to use the Service, you must first agree to the Terms. You may not use
+the Service if you do not accept the Terms.</p>
+
+<p>2.2 You
+can accept the Terms by clicking to accept or agree to the Terms, where
+this option is made available to you by Google.</p>
+
+<p>2.3 You
+may not use the Service and may not accept the Terms if you are not of legal
+age to form a binding contract with Google.</p>
+
+<p>2.4
+You represent that you have full power,
+capacity and authority to accept these Terms. If you are accepting on behalf of your employer or
+another entity, you represent that you have full legal authority to bind your employer
+or such entity to these Terms. If
+you don't have the legal authority to bind, please ensure that an authorized
+person from your entity consents to and accepts these Terms.</p>
+
+
+
+
+
+<h2>3. Provision of the Service by Google</h2>
+
+<p>3.1
+Google has subsidiaries and affiliated legal entities around the world (&quot;Subsidiaries
+and Affiliates&quot;). Sometimes,
+these companies will be providing the Service to you on behalf of Google
+itself. You acknowledge and agree that Subsidiaries and Affiliates will be
+entitled to provide the Service to you.</p>
+
+<p>3.2
+Google is constantly innovating in order to provide the best possible
+experience for its users. You acknowledge and agree that the form and nature of
+the Service which Google provides may change from time to time without prior
+notice to you.</p>
+
+<p>3.3 As
+part of this continuing innovation, you acknowledge and agree that Google may
+stop (permanently or temporarily) providing the Service (or any features within
+the Service) to you or to users generally at Google's sole discretion, without
+prior notice to you. You may stop using the Service at any time. You do not
+need to specifically inform Google when you stop using the Service.</p>
+
+<p>3.4 You
+acknowledge and agree that if Google disables your Backup Service Key, you and the Android
+application(s) you developed (&quot;Application(s)&quot;) may be prevented from accessing
+the Service and any content that is stored with the Service.</p>
+
+<p>3.5 You
+acknowledge and agree that Google may set a fixed upper limit on the number of
+backup transmissions you may send or receive through the Service or on the
+amount of storage space used for the provision of the Service at any time, at
+Google's discretion. You agree to
+abide by any such fixed upper limits.</p>
+
+
+
+
+
+<h2>4. Use of the Service by you</h2>
+
+<p>4.1 In
+order to access the Service, you must have a unique application identifier
+(&quot;Package Name&quot;) for your Application as described in the documentation for the
+Service.</p>
+
+<p>4.2
+After supplying Google with the Package Name and accepting the Terms, you will
+be issued an alphanumeric key (&quot;Backup Service Key&quot;) assigned to you by Google that is
+uniquely associated with your Application. Your Application must include this Backup Service Key as
+described in the documentation for the Service.</p>
+
+<p>4.3
+There is currently no limit to the number of Backup Service Keys you may obtain in this
+manner provided that you use a different Package Name for each Backup Service Key you
+obtain. You agree that each Backup Service Key is only valid for Applications with the corresponding
+Package Name. You agree that Google may, in its sole
+discretion, impose a limit on the number of Backup Service Keys that may be obtained in
+the future. You agree that your
+continued use of any of the Backup Service Keys assigned by Google, or distribution of any
+Applications using such Backup Service Keys, constitutes your continued agreement to these
+Terms.</p>
+
+<p>4.4 You
+agree to use the Service only for purposes that are permitted by (a) the Terms
+and (b) any applicable law, regulation, third-party terms of service, or
+generally accepted practices or guidelines in the relevant jurisdictions
+(including any laws regarding the export of data or software to and from the
+United States or other relevant countries).</p>
+
+<p>4.5 You
+agree not to access (or attempt to access) any of the Service by any means
+other than through the interfaces, methods, and APIs that are provided by
+Google, unless you have been specifically allowed to do so in a separate
+agreement with Google.</p>
+
+<p>4.6 You
+agree that you will not engage in any activity that interferes with or disrupts
+the Service (or the servers and networks which are connected to the Service),
+or the servers or networks of any third-party.</p>
+
+<p>4.7 You
+agree that your use of the Service will be in compliance with any documentation
+guidelines provided by Google and that failure to comply with the documentation
+guidelines may result in the disabling of the Backup Service Key(s) for your
+Application(s).</p>
+
+<p>4.8
+Unless you have been specifically permitted to do so in a separate agreement
+with Google, you agree that you will not reproduce, duplicate, copy, sell,
+trade or resell (a) use of the Service, or (b) access to the Service.</p>
+
+<p>4.9 You
+agree that you are solely responsible for (and that Google has no
+responsibility to you or to any third party for) your and your Application's
+use of the Service, any breach of your obligations under the Terms, and for the
+consequences (including any loss or damage which Google may suffer) of any such
+breach.</p>
+
+<p>4.10 You agree that in your use of the Service, you and
+your Applications will protect the privacy and legal rights of users. You must
+provide legally adequate privacy notice and protection for users whose data
+your Applications back up to the Service. Further, your Application may only
+use that information for the limited purpose of backing up the data to the
+Service unless the user has given you permission for further use. If the user has not given you
+permission to back up information to the Service, you may not transmit such
+information to the Service.</p>
+
+<p>4.11 You agree
+that you and your Applications will not transmit or store sensitive user
+information, such as user names, passwords, or credit card numbers, through the
+Service.</p>
+
+
+
+
+
+<h2>5. Security</h2>
+
+<p>5.1 You
+agree and understand that you are responsible for maintaining the security
+associated with any information you provide to access the Service as well as of
+the Backup Service Key(s) assigned to you by Google. You agree that only you are authorized to use
+the Backup Service Key(s) assigned to you.</p>
+
+<p>5.2
+Accordingly, you agree that you will be solely responsible to Google for all
+activities that occur in connection with your access to the Service, as well as
+the Backup Service Key.</p>
+
+<p>5.3 If
+you become aware of any unauthorized use of your Backup Service Key(s) you agree to notify
+Google immediately.</p>
+
+
+
+
+
+<h2>6. Privacy and your personal information</h2>
+
+<p>6.1 For
+information about Google's data protection practices, please read Google's
+privacy policy at <a
+href="http://www.google.com/privacy.html">http://www.google.com/privacy.html</a>.
+This policy explains how Google treats your personal information when you use
+the Service.</p>
+
+<p>6.2 You
+agree to the use of your data in accordance with Google's privacy policies.</p>
+
+
+
+
+
+<h2>7. Content in the Service</h2>
+
+<p>7.1 You
+agree that you are solely responsible for (and that Google has no
+responsibility to you or to any third party for) any Content that you or your
+Applications transmit or store through the Service and for the consequences of
+your actions (including any loss or damage which Google may suffer) by doing
+so. You agree that you are solely
+responsible for (A) any Content that is transmitted through the Service by your
+Applications, and (B) any Content that Devices retrieve from the Service by
+virtue of your Applications. For
+purposes of the Terms, &quot;Content&quot; means information such as data, messages,
+settings information, written text, computer software, music, audio files or
+other sounds, photographs, videos or other images. &quot;Device(s)&quot; means device(s) powered by
+the Android operating system.</p>
+
+<p>7.2 You
+agree that you will not transmit any Content through the Service that is
+copyrighted, protected by trade secret or otherwise subject to third party
+proprietary rights, including patent, privacy and publicity rights, unless you
+are the owner of such rights or have permission from their rightful owner to
+transmit the Content through the Service.</p>
+
+
+
+
+
+<h2>8. Proprietary rights</h2>
+
+<p>8.1 You
+acknowledge and agree that Google (or Google's licensors) own all legal right,
+title and interest in and to the Service, including any intellectual property
+rights which subsist in the Service (whether those rights happen to be
+registered or not, and wherever in the world those rights may exist).</p>
+
+<p>8.2
+Unless you have agreed otherwise in writing with Google, nothing in the Terms
+gives you a right to use any of Google's trade names, trademarks, service
+marks, logos, domain names, and other distinctive brand features.</p>
+
+<p>8.3 If
+you have been given an explicit right to use any of these brand features in a
+separate written agreement with Google, then you agree that your use of such
+features shall be in compliance with that agreement, any applicable provisions
+of the Terms, and Google's brand feature use guidelines as updated from time to
+time. These guidelines can be viewed online at <a
+href="http://www.google.com/permissions/guidelines.html">http://www.google.com/permissions/
+guidelines.html</a> (or such other URL as Google may
+provide for this purpose from time to time).</p>
+
+<p>8.4 You
+agree that you shall not remove, obscure, or alter any proprietary rights
+notices (including copyright, trade mark notices) which may be affixed to or
+contained within the Service.</p>
+
+
+
+
+
+<h2>9. License from Google</h2>
+
+<p>9.1
+Subject to terms and conditions of these Terms, Google gives you a personal,
+worldwide, royalty-free, non-assignable and non-exclusive license to use the
+Service as provided to you by Google. This license is for the sole purpose of
+enabling you to use and enjoy the benefit of the Service as provided by Google,
+in the manner permitted by the Terms. </p>
+
+<p>9.2 You
+may not (and you may not permit anyone else to) copy, modify, create a
+derivative work of, reverse engineer, decompile or otherwise attempt to extract
+the source code from the Service or any part thereof, unless this is expressly
+permitted or required by law, or unless you have been specifically told that
+you may do so by Google, in writing.</p>
+
+<p>9.3
+Unless Google has given you specific written permission to do so, you may not
+assign (or grant a sub-license of) your rights to use the Service, grant a
+security interest in or over your rights to use the Service, or otherwise
+transfer any part of your rights to use the Service.</p>
+
+
+
+
+
+<h2>10. Your code</h2>
+
+<p>10.1
+Google claims no ownership or control over any source code written by you to be
+used with the Service. You retain copyright and any other rights you already
+hold in this code, and you are responsible for protecting those rights, as
+appropriate.</p>
+
+
+
+
+
+<h2>11. Ending your relationship
+with Google</h2>
+
+<p>11.1
+The Terms will continue to apply until terminated by either you or Google as
+set out below.</p>
+
+<p>11.2
+You may terminate your legal agreement with Google by discontinuing your use of
+the Service at any time.</p>
+
+<p>11.3
+Google may, at any time, terminate its legal agreement with you if:</p>
+
+<p style='margin-left:1.0em;'> (A) you have breached any provision of the Terms (or have
+acted in manner which clearly shows that you do not intend to, or are unable to
+comply with the provisions of the Terms); or</p>
+
+<p style='margin-left:1.0em;'> (B) Google is required to do so by law (for example, where
+the provision of the Service to you is, or becomes, unlawful); or</p>
+
+<p style='margin-left:1.0em;'> (C) Google is
+transitioning to no longer providing the Service; or</p>
+
+<p style='margin-left:1.0em;'> (D) your Application fails to meet the documentation
+guidelines provided by Google.</p>
+
+<p>11.4
+Nothing in this Section shall affect Google's rights regarding provision of the
+Service under Section 3 of the Terms.</p>
+
+<p>11.5
+When these Terms come to an end, all of the legal rights, obligations and
+liabilities that you and Google have benefited from, been subject to (or which
+have accrued over time whilst the Terms have been in force) or which are
+expressed to continue indefinitely, shall be unaffected by this cessation, and
+the provisions of Sections 12, 13 and Paragraph 16 shall continue to apply to
+such rights, obligations and liabilities indefinitely.</p>
+
+
+
+
+
+<h2>12. EXCLUSION OF WARRANTIES</h2>
+
+<p>12.1
+NOTHING IN THESE TERMS, INCLUDING SECTIONS 12 AND 13, SHALL EXCLUDE OR LIMIT
+GOOGLE'S WARRANTY OR LIABILITY FOR LOSSES WHICH MAY NOT BE LAWFULLY EXCLUDED OR
+LIMITED BY APPLICABLE LAW. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF
+CERTAIN WARRANTIES OR CONDITIONS OR THE LIMITATION OR EXCLUSION OF LIABILITY
+FOR LOSS OR DAMAGE CAUSED BY NEGLIGENCE, BREACH OF CONTRACT OR BREACH OF
+IMPLIED TERMS, OR INCIDENTAL OR CONSEQUENTIAL DAMAGES. ACCORDINGLY, ONLY THE
+LIMITATIONS WHICH ARE LAWFUL IN YOUR JURISDICTION WILL APPLY TO YOU AND OUR
+LIABILITY WILL BE LIMITED TO THE MAXIMUM EXTENT PERMITTED BY LAW.</p>
+
+<p>12.2
+YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SERVICE IS AT YOUR SOLE
+RISK AND THAT THE SERVICE AND CONTENT ARE PROVIDED &quot;AS IS&quot; AND
+&quot;AS AVAILABLE&quot;.</p>
+
+<p>12.3 IN
+PARTICULAR, GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS LICENSORS DO NOT
+REPRESENT OR WARRANT TO YOU THAT:</p>
+
+<p style='margin-left:1.0em;'>(A) YOUR USE OF THE SERVICE WILL MEET YOUR REQUIREMENTS,</p>
+
+<p style='margin-left:1.0em;'>(B) YOUR USE OF THE SERVICE WILL BE UNINTERRUPTED, TIMELY,
+SECURE OR FREE FROM ERROR, AND</p>
+
+<p style='margin-left:1.0em;'>(C) THAT DEFECTS IN THE OPERATION OR FUNCTIONALITY OF ANY
+SOFTWARE PROVIDED TO YOU AS PART OF THE SERVICE WILL BE CORRECTED.</p>
+
+<p>12.4 NO
+ADVICE OR INFORMATION, WHETHER ORAL OR WRITTEN, OBTAINED BY YOU FROM GOOGLE OR
+THROUGH OR FROM THE SERVICE SHALL CREATE ANY WARRANTY NOT EXPRESSLY STATED IN
+THE TERMS.</p>
+
+<p>12.5
+GOOGLE FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND,
+WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED
+WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
+AND NON-INFRINGEMENT.</p>
+
+
+
+
+
+<h2>13. LIMITATION OF LIABILITY</h2>
+
+<p>13.1
+SUBJECT TO OVERALL PROVISION IN PARAGRAPH 12.1 ABOVE, YOU EXPRESSLY UNDERSTAND
+AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS LICENSORS SHALL
+NOT BE LIABLE TO YOU FOR:</p>
+
+<p style='margin-left:1.0em;'> (A) ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL CONSEQUENTIAL
+OR EXEMPLARY DAMAGES WHICH MAY BE INCURRED BY YOU, HOWEVER CAUSED AND UNDER ANY
+THEORY OF LIABILITY. THIS SHALL INCLUDE, BUT NOT BE LIMITED TO, ANY LOSS OF
+PROFIT (WHETHER INCURRED DIRECTLY OR INDIRECTLY), ANY LOSS OF GOODWILL OR
+BUSINESS REPUTATION, ANY LOSS OF DATA SUFFERED, COST OF PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICE, OR OTHER INTANGIBLE LOSS;</p>
+
+<p style='margin-left:1.0em;'> (B) ANY LOSS OR DAMAGE WHICH MAY BE INCURRED BY YOU,
+INCLUDING BUT NOT LIMITED TO LOSS OR DAMAGE AS A RESULT OF:</p>
+
+<p style='margin-left:2em;'> (I) ANY
+CHANGES WHICH GOOGLE MAY MAKE TO THE SERVICE, OR FOR ANY PERMANENT OR TEMPORARY
+CESSATION IN THE PROVISION OF THE SERVICE (OR ANY FEATURES WITHIN THE
+SERVICE);</p>
+
+<p style='margin-left:2em;'> (II) THE DELETION OF, CORRUPTION OF, OR FAILURE TO STORE,
+ANY CONTENT AND OTHER COMMUNICATIONS DATA MAINTAINED OR TRANSMITTED BY OR
+THROUGH YOUR USE OF THE SERVICE;</p>
+
+<p style='margin-left:2em;'> (III) YOUR FAILURE TO PROVIDE GOOGLE WITH ACCURATE ACCOUNT
+INFORMATION; OR</p>
+
+<p style='margin-left:2em;'> (IV) YOUR FAILURE TO KEEP YOUR PASSWORD OR ACCOUNT DETAILS
+SECURE AND CONFIDENTIAL.</p>
+
+<p>13.2
+THE LIMITATIONS ON GOOGLE'S LIABILITY TO YOU IN PARAGRAPH 13.1 ABOVE SHALL
+APPLY WHETHER OR NOT GOOGLE HAS BEEN ADVISED OF OR SHOULD HAVE BEEN AWARE OF
+THE POSSIBILITY OF ANY SUCH LOSSES ARISING.</p>
+
+
+
+
+
+<h2>14. Indemnification</h2>
+
+<p>14.1 You agree to hold
+harmless and indemnify Google, and its subsidiaries, affiliates, officers,
+agents, employees, or licensors from and against any third party claim arising
+from or in any way related to (a) your breach of the Terms, (b) your use of the
+Service, or (c) your violation of applicable laws, rules or regulations in
+connection with the Service, including any liability or expense arising from
+all claims, losses, damages (actual and consequential), suits, judgments,
+litigation costs and attorneys' fees, of every kind and nature. In such a case,
+Google will provide you with written notice of such claim, suit or action.</p>
+
+
+
+
+
+<h2>15. Changes to the Terms</h2>
+
+<p>15.1
+Due to things like changes to the law or changes to
+functionality offered through the Service, Google may need to change these Terms from time to
+time. You should look at the Terms regularly. We'll post
+notice of the modified Terms within, or through, the Service. Once the modified Terms are posted,
+the changes will become effective immediately, and you are deemed to have accepted the modified
+Terms if you continue to use the Service. If you do not agree to the modified
+Terms for the Service, please stop using the Service.</p>
+
+
+
+
+
+<h2>16. General legal terms</h2>
+
+<p>16.1
+The Terms constitute the whole legal agreement between you and Google and
+govern your use of the Service (but excluding any service which Google may
+provide to you under a separate written agreement), and completely replace any
+prior agreements between you and Google in relation to the Service.</p>
+
+<p>16.2
+You agree that Google may provide you with notices, including those regarding
+changes to the Terms, by email, regular mail, or postings on the Service.</p>
+
+<p>16.3
+You agree that if Google does not exercise or enforce any legal right or remedy
+which is contained in the Terms (or which Google has the benefit of under any
+applicable law), this will not be taken to be a formal waiver of Google's
+rights and that those rights or remedies will still be available to Google.</p>
+
+<p>16.4 If
+any court of law, having the jurisdiction to decide on this matter, rules that
+any provision of these Terms is invalid, then that provision will be removed
+from the Terms without affecting the rest of the Terms. The remaining
+provisions of the Terms will continue to be valid and enforceable.</p>
+
+<p>16.5
+You acknowledge and agree that each member of the group of companies of which
+Google is the parent shall be third party beneficiaries to the Terms and that
+such other companies shall be entitled to directly enforce, and rely upon, any
+provision of the Terms which confers a benefit on (or rights in favor of) them.
+Other than this, no other person or company shall be third party beneficiaries
+to the Terms.</p>
+
+<p>16.6
+The Terms, and your relationship with Google under the Terms, shall be governed
+by the laws of the State of California without regard to its conflict of laws
+provisions. You and Google agree to submit to the exclusive jurisdiction of the
+courts located within the county of Santa Clara, California to resolve any
+legal matter arising from the Terms. Notwithstanding this, you agree that
+Google shall still be allowed to apply for injunctive remedies (or an
+equivalent type of urgent legal relief) in any jurisdiction.</p>
+
diff --git a/docs/html/google/google_toc.cs b/docs/html/google/google_toc.cs
index bb9cb50..b6e26e3 100644
--- a/docs/html/google/google_toc.cs
+++ b/docs/html/google/google_toc.cs
@@ -111,38 +111,50 @@
         </ul>
       </li>
     </ul>
+  </li>
+
+  <li class="nav-section">
+      <div class="nav-section-header"><a href="<?cs var:toroot ?>google/gcm/index.html">
+        <span class="en">Google Cloud Messaging</span></a>
+      </div>
+      <ul>
+        <li><a href="<?cs var:toroot?>google/gcm/gs.html">
+            <span class="en">Getting Started</span></a>
+        </li>
+        <li><a href="<?cs var:toroot?>google/gcm/gcm.html">
+            <span class="en">Architectural Overview</span></a>
+        </li>
+        <li><a href="<?cs var:toroot?>google/gcm/demo.html">
+            <span class="en">Demo App Tutorial</span></a>
+        </li>
+        <li><a href="<?cs var:toroot?>google/gcm/adv.html">
+            <span class="en">Advanced Topics</span></a>
+        </li>
+        <li><a href="<?cs var:toroot?>google/gcm/c2dm.html">
+            <span class="en">Migration</span></a>
+        </li>
+        <li id="gcm-tree-list" class="nav-section">
+          <div class="nav-section-header">
+            <a href="<?cs var:toroot ?>reference/gcm-packages.html">
+              <span class="en">Reference</span>
+            </a>
+          <div>
+        </li>
+      </ul>
+  </li>
 
 
-    <li class="nav-section">
-        <div class="nav-section-header"><a href="<?cs var:toroot ?>google/gcm/index.html">
-          <span class="en">Google Cloud Messaging</span></a>
-        </div>
-        <ul>
-          <li><a href="<?cs var:toroot?>google/gcm/gs.html">
-              <span class="en">Getting Started</span></a>
-          </li>
-          <li><a href="<?cs var:toroot?>google/gcm/gcm.html">
-              <span class="en">Architectural Overview</span></a>
-          </li>
-          <li><a href="<?cs var:toroot?>google/gcm/demo.html">
-              <span class="en">Demo App Tutorial</span></a>
-          </li>
-          <li><a href="<?cs var:toroot?>google/gcm/adv.html">
-              <span class="en">Advanced Topics</span></a>
-          </li>
-          <li><a href="<?cs var:toroot?>google/gcm/c2dm.html">
-              <span class="en">Migration</span></a>
-          </li>
-          <li id="gcm-tree-list" class="nav-section">
-            <div class="nav-section-header">
-              <a href="<?cs var:toroot ?>reference/gcm-packages.html">
-                <span class="en">Reference</span>
-              </a>
-            <div>
+  <li class="nav-section">
+    <div class="nav-section-header"><a href="<?cs var:toroot ?>google/backup/index.html">
+      Android Backup Service</a>
+    </div>
+    <ul>
+      <li><a href="<?cs var:toroot?>google/backup/signup.html">
+          Register</a>
       </li>
+    </ul>
+  </li>
 
-        </ul>
-      </li>
 </ul>
 
 <script type="text/javascript">
diff --git a/docs/html/google/index.jd b/docs/html/google/index.jd
index 49eac1c..1c83e78 100644
--- a/docs/html/google/index.jd
+++ b/docs/html/google/index.jd
@@ -30,7 +30,7 @@
 cloud messaging.</p>
   <p>Although these Google services are not included in the Android platform, they are
   supported by most Android-powered devices. When using these services, you can
-  distribute your app to all device with Google Play running Android 2.2
+  distribute your app on Google Play to all devices running Android 2.2
   or higher, and some services support even more devices.</p>
 </div>
 </div>
diff --git a/docs/html/google/play-services/maps.jd b/docs/html/google/play-services/maps.jd
index 58f4c7d..5a4aaf4 100644
--- a/docs/html/google/play-services/maps.jd
+++ b/docs/html/google/play-services/maps.jd
@@ -74,7 +74,7 @@
     
     <h4>3. Read the documentation</h4>
     
-    <p>Read the <a href="https://devsite.googleplex.com/maps/terms">Google Maps
+    <p>Read the <a href="https://developers.google.com/maps/terms">Google Maps
     API Terms of Service</a>.</p>
     
     <p>For quick access while developing your Android apps, the
diff --git a/docs/html/google/play-services/overview.jd b/docs/html/google/play-services/overview.jd
deleted file mode 100644
index 5ea72d9..0000000
--- a/docs/html/google/play-services/overview.jd
+++ /dev/null
@@ -1,49 +0,0 @@
-page.title=Overview
-@jd:body
-
-<p>
-Google Play services is a platform delivered by the Google Play Store that offers integration with Google products,
-such as Google+, in Android apps. The Google Play services platform consists of a services component that runs on
-the device and a thin client library that you package with your app. The following diagram shows the interaction
-between the two components:
-</p>
-
-<img src="{@docRoot}images/play-services-diagram.png" />
-
-<p>
-    The Google Play services component is delivered as an APK through the Google Play Store, so
-    updates to Google Play services are not dependent on carrier or OEM system image updates. Newer
-    devices will also have Google Play services as part of the device's system image, but updates
-    are still pushed to these newer devices through the Google Play Store. In general, devices
-    running Android 2.2 (Froyo) or later that have the Google Play Store receive updates within a
-    few days. This allows you to leverage the newest APIs for Google products and reach most of the
-    devices in the Android ecosystem. Devices older than Android 2.2 or devices without the Google
-    Play Store app are not supported.
-</p>
-
-<p>
-    The Google Play services component contains much of the logic to communicate with the specific
-    Google product that you want to interact with. An easy-to-use authentication flow is also
-    provided to gain access to supported Google products, which provides consistency for both the
-    developer and user. From the developer's point of view, requesting credentials is mostly taken
-    care of by the services component through calls to the client library. From the user's point of
-    view, authorization is granted with a few simple clicks.
-</p>
-
-<p>
-    The client library contains the interfaces to call into the services component. It also contains
-    APIs that allow you to resolve any issues at runtime such as a missing, disabled, or out-of-date
-    Google Play services APK. The client library has a light footprint if you use
-    ProGuard as part of your build process, so it won't have an adverse impact on your app's file size. See the
-    <a href="{@docRoot}google/play-services/overview.html">Downloading and Configuring the Google Play services SDK</a> for more
-    information on how to configure
-    <a href="{@docRoot}tools/help/proguard.html">ProGuard</a>.
-</p>
-
-<p>
-    If you want to access added features or products that are periodically added to the client
-    library, you can upgrade to a new version as they are released. However, upgrading is not
-    necessary if you don't care about new features or bug fixes in the new versions of the client
-    library. We anticipate more Google services to be continuously added, so be on the lookout for
-    these updates.
-</p>
\ No newline at end of file
diff --git a/docs/html/google/play-services/setup.jd b/docs/html/google/play-services/setup.jd
index ec5d26f..0cf2df3 100644
--- a/docs/html/google/play-services/setup.jd
+++ b/docs/html/google/play-services/setup.jd
@@ -7,35 +7,63 @@
     downloadable package from the <a href="{@docRoot}tools/help/sdk-manager.html">SDK
     Manager</a>. The download includes the client library and code samples.
 </p>
-
+    
 <p>
-    To set up the Google Play services SDK:
+    To develop using the <a href="{@docRoot}reference/gms-packages.html">Google
+    Play services APIs</a>, you must download the Google Play services SDK.
+    Additionally, you must provide a physical <strong>development device</strong> on
+    which you can run and debug your app. You can develop on any compatible Android
+    device that runs Android 2.2 or higher and includes the Google Play Store.
+    Ideally, you would develop and test the app on a variety of devices, including
+    both phones and tablets. 
 </p>
 
+<p class="note"><strong>Note</strong>: Google Play services is not supported on the
+Android emulator &mdash; to develop using the APIs, you need to provide a development
+device such as an Android phone or tablet.</p>
+
+<p>To install the Google Play services SDK for development:</p>
+
 <ol>
-    <li>
-        Launch Eclipse and select <b>Window &gt; Android SDK Manager</b> or run <code>android</code>
-        at the command line.
-    </li>
-    <li>
-        Scroll to the bottom of the package list and select <b>Extras &gt; Google Play services</b>.
-        The Google Play services SDK is downloaded to your computer and installed in your Android SDK environment at
-        <code>&lt;android-sdk-folder&gt;/extras/google/google_play_services/</code>.
-    </li>
-    <li>Copy the <code>&lt;android-sdk-folder&gt;/extras/google/google_play_services/libproject/google-play-services_lib</code>        
-        library project to a location in your project's source tree.
-    <p>If you are using Eclipse, import the library project into your workspace. Click <b>File > Import...</b>, select <b>Android > Existing
-    Android Code into Workspace</b>, and browse to the copy of the library project to import it.</p>
-    </li>
-    <li>Reference the library project in your Android project.
-        <p>See the 
-        <a href="{@docRoot}tools/projects/projects-eclipse.html#ReferencingLibraryProject">Referencing a Library Project for Eclipse</a>
-        or <a href="{@docRoot}tools/projects/projects-cmdline.html#ReferencingLibraryProject">Referencing a Library Project on the Command Line</a>
-        for more information on how to do this.</p>
-    </li>
-    <li>If you are using <a href="{@docRoot}tools/help/proguard.html">ProGuard</a>, add the following
-        lines in the <code>&lt;project_directory&gt;/proguard-project.txt</code> file
-        to prevent ProGuard from stripping away required classes:
+  <li>Launch the SDK Manager.
+   <ul>
+    <li>From Eclipse (with <a href="{@docRoot}tools/help/adt.html">ADT</a>),
+    select <strong>Window</strong> &gt; <strong>Android SDK Manager</strong>.</li>
+    <li>On Windows, double-click the <code>SDK Manager.exe</code> file at the root of the Android
+  SDK directory.</li>
+    <li>On Mac or Linux, open a terminal and navigate to the <code>tools/</code> directory in the
+  Android SDK, then execute <code>android sdk</code>.</li>
+    </ul>
+  </li>
+  <li>
+      Scroll to the bottom of the package list, select <b>Extras &gt; Google Play services</b>,
+      and install it.
+      <p>The Google Play services SDK is saved in your Android SDK environment at
+      <code>&lt;android-sdk-folder&gt;/extras/google/google_play_services/</code>.</p>
+  </li>
+  <li>Copy the <code>&lt;android-sdk-folder&gt;/extras/google/google_play_services/libproject/google-play-services_lib</code>        
+      library project into the source tree where you maintain your Android app projects.
+  <p>If you are using Eclipse, import the library project into your workspace. Click <b>File > Import</b>, select <b>Android > Existing
+  Android Code into Workspace</b>, and browse to the copy of the library project to import it.</p>
+  </li>
+</ol>
+
+
+<p>To set up a project to use the Google Play services SDK:</p>
+
+<ol>
+  <li>Reference the library project in your Android project.
+      <p>See the 
+      <a href="{@docRoot}tools/projects/projects-eclipse.html#ReferencingLibraryProject">Referencing a Library Project for Eclipse</a>
+      or <a href="{@docRoot}tools/projects/projects-cmdline.html#ReferencingLibraryProject">Referencing a Library Project on the Command Line</a>
+      for more information on how to do this.</p>
+      <p class="note"><strong>Note:</strong>
+      You should be referencing a copy of the library that you copied to your
+      source tree&mdash;you should not reference the library from the Android SDK directory.</p>
+  </li>
+  <li>If you are using <a href="{@docRoot}tools/help/proguard.html">ProGuard</a>, add the following
+      lines in the <code>&lt;project_directory&gt;/proguard-project.txt</code> file
+      to prevent ProGuard from stripping away required classes:
 <pre>
 -keep class * extends java.util.ListResourceBundle {
     protected Object[][] getContents();
diff --git a/docs/html/google/play/billing/billing_admin.jd b/docs/html/google/play/billing/billing_admin.jd
index 2413ae5..c0f46d0 100755
--- a/docs/html/google/play/billing/billing_admin.jd
+++ b/docs/html/google/play/billing/billing_admin.jd
@@ -11,6 +11,7 @@
     <li><a href="#billing-purchase-type">Choosing a Purchase Type</a></li>
     <li><a href="#billing-testing-setup">Setting up Test Accounts</a></li>
     <li><a href="#billing-refunds">Handling Refunds</a></li>
+    <li><a href="#billing-refunds">Working with Order Numbers</a></li>
     <li><a href="#billing-support">Where to Get Support</a></li>
   </ol>
   <h2>Downloads</h2>
@@ -39,13 +40,13 @@
 site, registering test accounts, and handling refunds when necessary.</p>
 
 <p>You must have a Google Play publisher account to register test accounts. And you must have a
-Google Wallet merchant account to create a product list and issue refunds to your users. If you
+Google Checkout merchant account to create a product list and issue refunds to your users. If you
 already have a publisher account on Google Play, you can use your existing account. You do not
 need to register for a new account to support in-app billing. If you do not have a publisher
 account, you can register as a Google Play developer and set up a publisher account at the
 Google Play <a href="http://play.google.com/apps/publish">publisher site</a>. If you do not have a
-Google Wallet merchant account, you can register for one at the <a
-href="http://checkout.google.com">Google Wallet site</a>.</p>
+Google Checkout merchant account, you can register for one at the <a
+href="http://checkout.google.com">Google Checkout site</a>.</p>
 
 <h2 id="billing-list-setup">Creating a Product List</h2>
 
@@ -56,7 +57,7 @@
 
 <p>You can access an application's product list by clicking the <strong>In-App Products</strong>
 link that appears under each of the applications that are listed for your publisher account (see
-figure 1). The <strong>In-App Products</strong> link appears only if you have a Google Wallet
+figure 1). The <strong>In-App Products</strong> link appears only if you have a Google Checkout
 merchant account and an application's manifest includes the <code>com.android.vending.BILLING</code>
 permission.</p>
 
@@ -78,7 +79,7 @@
 </p>
 
 <p>You can create a product list for any published application or any draft application that's been
-uploaded and saved to the Google Play site. However, you must have a Google Wallet merchant
+uploaded and saved to the Google Play site. However, you must have a Google Checkout merchant
 account and the application's manifest must include the <code>com.android.vending.BILLING</code>
 permission. If an application's manifest does not include this permission, you will be able to edit
 existing items in the product list but you will not be able to add new items to the list. For more
@@ -432,19 +433,49 @@
 
 <p>In-app billing does not allow users to send a refund request to Google Play. Refunds for
 in-app purchases must be directed to you (the application developer). You can then process the
-refund through your Google Wallet merchant account. When you do this, Google Play receives a
-refund notification from Google Wallet, and Google Play sends a refund message to your
+refund through your Google Checkout merchant account. When you do this, Google Play receives a
+refund notification from Google Checkout, and Google Play sends a refund message to your
 application. For more information, see <a
 href="{@docRoot}google/play/billing/billing_overview.html#billing-action-notify">Handling
 IN_APP_NOTIFY messages</a> and <a
 href="http://www.google.com/support/androidmarket/bin/answer.py?answer=1153485">In-app Billing
 Pricing</a>.</p>
 
-<p class="caution"><strong>Important:</strong> You cannot use the Google Wallet API to issue
+<p class="caution"><strong>Important:</strong> You cannot use the Google Checkout API to issue
 refunds or cancel in-app billing transactions. You must do this manually through your Google
-Wallet merchant account. However, you can use the Google Wallet API to retrieve order
+Checkout merchant account. However, you can use the Google Checkout API to retrieve order
 information.</p>
 
+<h2 id="orderId">Working with Order Numbers</h2>
+
+<p>When a user purchases an in-app item, Google Checkout assigns the transaction
+a unique and permanent order number. Google Play provides that order number to
+you at the conclusion of the purchase flow, as the value of the
+<code>orderId</code> field of the <code>PURCHASE_STATE_CHANGED</code>
+intent.</p>
+
+<p>In your app, you can use the order number as a general-purpose identifier for
+the in-app purchase transaction. After the purchase, you can use the order
+number as a means of tracking the transaction in reconciliation reports and for
+customer support.</p>
+
+<p>The order number itself is a string consisting of numbers only, with a format
+assigned and managed by Google Checkout.</p>
+
+<p>For transactions dated 5 December 2012 or later, Google Checkout assigns a
+Merchant Order Number (rather than a Google Order Number) and reports the Merchant
+Order Number as the value of <code>orderID</code>. Here's an
+example:</p>
+
+<pre>"orderId" : "12999556515565155651.5565135565155651"</pre>
+
+<p>For transactions dated previous to 5 December 2012, Google checkout assigned
+a Google Order Number and reported that number as the value of
+<code>orderID</code>. Here's an example of an <code>orderID</code> holding a
+Google Order Number:</p>
+
+<pre>"orderId" : "556515565155651"</pre>
+
 <h2 id="billing-testing-setup">Setting Up Test Accounts</h2>
 
 <p>The Google Play publisher site lets you set up one or more test accounts. A test account is a
diff --git a/docs/html/google/play/billing/billing_integrate.jd b/docs/html/google/play/billing/billing_integrate.jd
index 2ca7c83..b7e2667 100755
--- a/docs/html/google/play/billing/billing_integrate.jd
+++ b/docs/html/google/play/billing/billing_integrate.jd
@@ -242,7 +242,7 @@
     List</a>.</p>
     <p class="note"><strong>Note:</strong> You must publish the items in your product
     list (<code>sword_001</code> and <code>potion_001</code>) even though you are not publishing the
-    sample application. Also, you must have a Google Wallet Merchant account to add items to the
+    sample application. Also, you must have a Google Checkout Merchant account to add items to the
     sample application's product list.</p>
   </li>
 </ol>
@@ -255,7 +255,7 @@
 <ol>
   <li><strong>Make sure you have at least one test account registered under your Google Play
   publisher account.</strong>
-    <p>You cannot purchase items from yourself (Google Wallet prohibits this), so you need to
+    <p>You cannot purchase items from yourself (Google Checkout prohibits this), so you need to
     create at least one test account that you can use to purchase items in the sample application.
     To learn how to set up a test account, see <a
     href="{@docRoot}google/play/billing/billing_testing.html#billing-testing-setup">Setting up Test
@@ -294,7 +294,7 @@
   </li>
   <li><strong>Run the application and purchase the sword or the potion.</strong>
     <p>When you use a test account to purchase items, the test account is billed through Google
-    Wallet and your Google Wallet Merchant account receives a payout for the purchase.
+    Wallet and your Google Checkout Merchant account receives a payout for the purchase.
     Therefore, you may want to refund purchases that are made with test accounts, otherwise the
     purchases will show up as actual payouts to your merchant account.</p>
 </ol>
diff --git a/docs/html/google/play/billing/billing_overview.jd b/docs/html/google/play/billing/billing_overview.jd
index 4b2a643..be9dc8d 100755
--- a/docs/html/google/play/billing/billing_overview.jd
+++ b/docs/html/google/play/billing/billing_overview.jd
@@ -265,7 +265,7 @@
 <pre class="no-pretty-print" style="color:black">{ "nonce" : 1836535032137741465,
   "orders" :
     [{ "notificationId" : "android.test.purchased",
-       "orderId" : "transactionId.android.test.purchased",
+       "orderId" : "12999556515565155651.5565135565155651",
        "packageName" : "com.example.dungeons",
        "productId" : "android.test.purchased",
        "developerPayload" : "bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ",
@@ -439,7 +439,7 @@
 to "managed per user account."</p>
 
 <p>In the second case, your application can receive an <code>IN_APP_NOTIFY</code> broadcast intent
-when Google Play receives a refund notification from Google Wallet. In this case, Google
+when Google Play receives a refund notification from Google Checkout. In this case, Google
 Play sends an <code>IN_APP_NOTIFY</code> message to your application. Your application can handle
 this message the same way it handles responses from an application-initiated
 <code>REQUEST_PURCHASE</code> message so that ultimately your application receives a
@@ -448,9 +448,9 @@
 <code>PURCHASE_STATE_CHANGED</code> broadcast intent. Also, the <code>purchaseState</code> field in
 the JSON string is set to 2.</p>
 
-<p class="caution"><strong>Important:</strong> You cannot use the Google Wallet API to
+<p class="caution"><strong>Important:</strong> You cannot use the Google Checkout API to
 issue refunds or cancel in-app billing transactions. You must do this manually through your
-Google Wallet merchant account. However, you can use the Google Wallet API to retrieve order
+Google Checkout merchant account. However, you can use the Google Checkout API to retrieve order
 information.</p>
 
 <h2 id="billing-security">Security Controls</h2>
@@ -488,7 +488,7 @@
 <ul>
   <li>In-app billing can be implemented only in applications that you publish through Google
   Play.</li>
-  <li>You must have a Google Wallet Merchant account to use Google Play In-app Billing.</li>
+  <li>You must have a Google Checkout Merchant account to use Google Play In-app Billing.</li>
   <li>In-app billing requires version 2.3.4 (or higher) of the Android Market application.
   To support subscriptions, version 3.5 or higher of the Google Play app is required. On devices
   running Android 3.0, version 5.0.12 (or higher) of the MyApps application is required.</li>
diff --git a/docs/html/google/play/billing/billing_reference.jd b/docs/html/google/play/billing/billing_reference.jd
index e78c99f..0c82fd5 100755
--- a/docs/html/google/play/billing/billing_reference.jd
+++ b/docs/html/google/play/billing/billing_reference.jd
@@ -105,7 +105,7 @@
   <td><code>RESULT_ERROR</code></td>
   <td>6</td>
   <td>Indicates an unexpected server error. For example, this error is triggered if you try to
-purchase an item from yourself, which is not allowed by Google Wallet.</td>
+purchase an item from yourself, which is not allowed by Google Checkout.</td>
 </tr>
 </table>
 
@@ -394,8 +394,10 @@
 </tr>
 <tr>
   <td>orderId</td>
-  <td>A unique order identifier for the transaction. This corresponds to the Google Wallet Order
-  ID.</td>
+  <td>A unique order identifier for the transaction. This corresponds to the transaction's Merchant
+  Order Number. For transactions dated previous to 5 December 2012, the orderID correcponds to the transaction's 
+  Google Order Number. For more information, see <a href="{@docRoot}google/play/billing/billing_admin.html#orderId">Working
+  with order numbers</a>.</td>
 </tr>
 <tr>
   <td>packageName</td>
diff --git a/docs/html/google/play/billing/billing_subscriptions.jd b/docs/html/google/play/billing/billing_subscriptions.jd
index 5980d83..1217d8a 100755
--- a/docs/html/google/play/billing/billing_subscriptions.jd
+++ b/docs/html/google/play/billing/billing_subscriptions.jd
@@ -107,7 +107,7 @@
 <p>When users purchase subscriptions in your apps, Google Play handles all
 checkout details so your apps never have to directly process any financial
 transactions. Google Play processes all payments for subscriptions through
-Google Wallet, just as it does for standard in-app products and app purchases.
+Google Checkout, just as it does for standard in-app products and app purchases.
 This ensures a consistent and familiar purchase flow for your users.</p>
 
 <img src="{@docRoot}images/billing_subscription_flow.png" style="border:4px solid ddd;">
@@ -221,10 +221,10 @@
 either of two intervals:</p>
 
 <ul>
-  <li>Monthly &mdash; Google Play bills the customer’s Google Wallet account at
+  <li>Monthly &mdash; Google Play bills the customer’s Google Checkout account at
   the time of purchase and monthly subsequent to the purchase date (exact billing
   intervals can vary slightly over time)</li>
-  <li>Annually &mdash; Google Play bills the customer's Google Wallet account at
+  <li>Annually &mdash; Google Play bills the customer's Google Checkout account at
   the time of purchase and again on the same date in subsequent years.</li>
 </ul>
 
@@ -238,7 +238,7 @@
 Direct Carrier Billing) that was originally used to purchase the
 subscription.</p>
 
-<p>When the subscription payment is approved by Google Wallet, Google Play
+<p>When the subscription payment is approved by Google Checkout, Google Play
 provides a purchase token back to the purchasing app through the In-app Billing
 API. For details, see <a href="#token">Purchase token</a>, below. Your apps can
 store the token locally or pass it to your backend servers, which can then use
@@ -343,7 +343,7 @@
 <h3 id="payment">Payment processing and policies</h3>
 
 <p>In general, the terms of Google Play allow you to sell in-app subscriptions
-only through the standard payment processor, Google Wallet. For purchases of any
+only through the standard payment processor, Google Checkout. For purchases of any
 subscription products, just as for other in-app products and apps, the
 transaction fee for subscriptions, just as for other in-app purchases, is the
 same as the transaction fee for application purchases (30%).</p>
@@ -356,6 +356,22 @@
 href="http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=140504">policies
 document</a>.</p>
 
+<h3 id="orderId">Subscription Order Numbers</h3>
+
+<p>To help you track transactions relating to a given subscription, Google
+Checkout provides a base Merchant Order Number for all recurrences of the subscription and denotes
+each recurring transaction by appending an integer as follows: </p>
+
+<p><span style="color:#777"><code style="color:#777">12999556515565155651.5565135565155651</code> (base order number)</span><br />
+<code>12999556515565155651.5565135565155651..0</code> (initial purchase orderID)<br />
+<code>12999556515565155651.5565135565155651..1</code> (first recurrence orderID)<br />
+<code>12999556515565155651.5565135565155651..2</code> (second recurrence orderID)<br />
+...<br /></p>
+
+<p>Google Play provides that order number to as the value of the
+<code>orderId</code> field of the <code>PURCHASE_STATE_CHANGED</code>
+intent.</p>
+
 <h3 id="requirements">System requirements for subscriptions</h3>
 
 <p>In-app purchases of subscriptions are supported only on devices that meet
@@ -440,7 +456,7 @@
 token, a string value that uniquely identifies (and associates) a user ID and a
 subscription ID. Google Play generates the purchase token when the user
 completes the purchase of a subscription product (and payment is approved by
-Google Wallet) and then sends it to the purchasing app on the device through the
+Google Checkout) and then sends it to the purchasing app on the device through the
 In-app Billing API. </p>
 
 <p>At the conclusion of a <code>PURCHASE_REQUEST</code> message flow, your app
@@ -456,7 +472,7 @@
 <pre class="no-pretty-print" style="color:black">{ "nonce" : 1836535032137741465,
   "orders" :
     [{ "notificationId" : "android.test.purchased",
-       "orderId" : "transactionId.android.test.purchased",
+       "orderId" : "12999556515565155651.5565135565155651"
        "packageName" : "com.example.dungeons",
        "productId" : "android.test.purchased",
        "developerPayload" : "bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ",
diff --git a/docs/html/google/play/billing/billing_testing.jd b/docs/html/google/play/billing/billing_testing.jd
index edf7e70..4cbcde1 100755
--- a/docs/html/google/play/billing/billing_testing.jd
+++ b/docs/html/google/play/billing/billing_testing.jd
@@ -62,7 +62,7 @@
 
 <img src="{@docRoot}images/billing_test_flow.png" height="381" id="figure1" />
 <p class="img-caption">
-  <strong>Figure 1.</strong> Wallet flow for the special reserved item android.test.purchased.
+  <strong>Figure 1.</strong>Wallet flow for the special reserved item android.test.purchased.
 </p>
 
 <p>You do not need to list the reserved products in your application's product list. Google Play
@@ -91,8 +91,8 @@
     <p>When you make an in-app billing request with this product ID, Google Play responds as
     though the purchase was refunded. Refunds cannot be initiated through Google Play's in-app
     billing service. Refunds must be initiated by you (the merchant). After you process a refund
-    request through your Google Wallet account, a refund message is sent to your application by
-    Google Play. This occurs only when Google Play gets notification from Google Wallet that
+    request through your Google Checkout account, a refund message is sent to your application by
+    Google Play. This occurs only when Google Play gets notification from Google Checkout that
     a refund has been made. For more information about refunds, see <a
     href="{@docRoot}google/play/billing/billing_overview.html#billing-action-notify">Handling
     IN_APP_NOTIFY messages</a> and <a
@@ -216,7 +216,7 @@
 
 <p>To test your in-app billing implementation with actual in-app purchases, you will need to
 register at least one test account on the Google Play publisher site. You cannot use your
-developer account to test the complete in-app purchase process because Google Wallet does not let
+developer account to test the complete in-app purchase process because Google Checkout does not let
 you buy items from yourself. If you have not set up test accounts before, see <a
 href="{@docRoot}google/play/billing/billing_admin.html#billing-testing-setup">Setting up test
 accounts</a>.</p>
@@ -224,8 +224,8 @@
 <p>Also, a test account can purchase an item in your product list only if the item is published. The
 application does not need to be published, but the item does need to be published.</p>
 
-<p>When you use a test account to purchase items, the test account is billed through Google Wallet
-and your Google Wallet Merchant account receives a payout for the purchase. Therefore, you may
+<p>When you use a test account to purchase items, the test account is billed through Google Checkout
+and your Google Checkout Merchant account receives a payout for the purchase. Therefore, you may
 want to refund purchases that are made with test accounts, otherwise the purchases will show up as
 actual payouts to your merchant account.</p>
 
diff --git a/docs/html/google/play/billing/index.jd b/docs/html/google/play/billing/index.jd
index f229696..c3c7a24 100755
--- a/docs/html/google/play/billing/index.jd
+++ b/docs/html/google/play/billing/index.jd
@@ -8,8 +8,11 @@
 
 <div class="sidebox-wrapper">
 <div class="sidebox">
-  <p><strong>Free trials for subscriptions</strong> <span class="new" style="font-size:.78em;">New!</span></p>
-  <p>You can now offer users a configurable <a href="{@docRoot}google/play/billing/billing_subscriptions.html#trials">free trial period</a> for your in-app subscriptions. You can set up trials with a simple change in the Developer Console&mdash;no change to your app code is needed. 
+  <h2><strong>New in In-App Billing</strong></h2>
+  <ul>
+  <li><strong>New order number format</strong>&mdash; Starting 5 December, orders are reported in Merchant Order Number format. See <a href="{@docRoot}google/play/billing/billing_admin.html#orderId">Working with Order Numbers</a> for an example.</li>
+  <li><strong>Free trials</strong>&mdash;You can now offer users a configurable <a href="/google/play/billing/billing_subscriptions.html#trials">free trial period</a> for your in-app subscriptions. You can set up trials with a simple change in the Developer Console&mdash;no change to your app code is needed.</li>
+ </ul>
 </div>
 </div>
 
@@ -29,7 +32,7 @@
 
 <p>Any application that you publish through Google Play can implement In-app Billing. No special
 account or registration is required other than an Android Market publisher account and a Google
-Wallet Merchant account. Also, because the service uses no dedicated framework APIs, you can add
+Checkout merchant account. Also, because the service uses no dedicated framework APIs, you can add
 in-app billing to any application that uses a minimum API level of 4 or higher.</p>
 
 <p>To help you integrate in-app billing into your application, the Android SDK
diff --git a/docs/html/guide/webapps/webview.jd b/docs/html/guide/webapps/webview.jd
index 66b5501..9ea0a10 100644
--- a/docs/html/guide/webapps/webview.jd
+++ b/docs/html/guide/webapps/webview.jd
@@ -158,7 +158,7 @@
 <p>For example, you can include the following class in your Android application:</p>
 
 <pre>
-public class JavaScriptInterface {
+public class WebAppInterface {
     Context mContext;
 
     /** Instantiate the interface and set the context */
@@ -167,13 +167,22 @@
     }
 
     /** Show a toast from the web page */
+    &#64;JavascriptInterface
     public void showToast(String toast) {
         Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
     }
 }
 </pre>
 
-<p>In this example, the {@code JavaScriptInterface} class allows the web page to create a {@link
+<p class="caution"><strong>Caution:</strong> If you've set your <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a>
+to 17 or higher, <strong>you
+must add the {@code &#64;JavascriptInterface} annotation</strong> to any method that you want
+available your web page code (the method must also be public). If you do not provide the
+annotation, then the method will not accessible by your web page when running on Android 4.2 or
+higher.</p>
+
+<p>In this example, the {@code WebAppInterface} class allows the web page to create a {@link
 android.widget.Toast} message, using the {@code showToast()} method.</p>
 
 <p>You can bind this class to the JavaScript that runs in your {@link android.webkit.WebView} with
@@ -182,12 +191,12 @@
 
 <pre>
 WebView webView = (WebView) findViewById(R.id.webview);
-webView.addJavascriptInterface(new JavaScriptInterface(this), "Android");
+webView.addJavascriptInterface(new WebAppInterface(this), "Android");
 </pre>
 
 <p>This creates an interface called {@code Android} for JavaScript running in the {@link
 android.webkit.WebView}. At this point, your web application has access to the {@code
-JavaScriptInterface} class. For example, here's some HTML and JavaScript that creates a toast
+WebAppInterface} class. For example, here's some HTML and JavaScript that creates a toast
 message using the new interface when the user clicks a button:</p>
 
 <pre>
@@ -203,7 +212,7 @@
 <p>There's no need to initialize the {@code Android} interface from JavaScript. The {@link
 android.webkit.WebView} automatically makes it
 available to your web page. So, at the click of the button, the {@code showAndroidToast()}
-function uses the {@code Android} interface to call the {@code JavaScriptInterface.showToast()}
+function uses the {@code Android} interface to call the {@code WebAppInterface.showToast()}
 method.</p>
 
 <p class="note"><strong>Note:</strong> The object that is bound to your JavaScript runs in
diff --git a/docs/html/images/screens_support/avds-config.png b/docs/html/images/screens_support/avds-config.png
index c7d534c..97bd5f6 100644
--- a/docs/html/images/screens_support/avds-config.png
+++ b/docs/html/images/screens_support/avds-config.png
Binary files differ
diff --git a/docs/html/images/training/firstapp/adt-firstapp-setup.png b/docs/html/images/training/firstapp/adt-firstapp-setup.png
index daf02b25..bf95285 100644
--- a/docs/html/images/training/firstapp/adt-firstapp-setup.png
+++ b/docs/html/images/training/firstapp/adt-firstapp-setup.png
Binary files differ
diff --git a/docs/html/images/training/firstapp/adt-new-activity.png b/docs/html/images/training/firstapp/adt-new-activity.png
index 2d579d3..c396793 100644
--- a/docs/html/images/training/firstapp/adt-new-activity.png
+++ b/docs/html/images/training/firstapp/adt-new-activity.png
Binary files differ
diff --git a/docs/html/index.jd b/docs/html/index.jd
index e91b68c..0dc1757 100644
--- a/docs/html/index.jd
+++ b/docs/html/index.jd
@@ -4,6 +4,38 @@
 page.metaDescription=The official site for Android developers. Provides the Android SDK and documentation for app developers and designers.
 @jd:body
 
+<style>
+#butterbar-wrapper {
+  position:absolute;
+  top:0;
+  left:0;
+  width:100%;
+}
+#butterbar {
+  width:940px;
+  margin:0 auto;
+}
+#butterbar-message {
+  background-color:#f80;
+  float:right;
+  font-size:12px;
+  font-weight:bold;
+  padding:0 10px;
+  border-radius: 0 0 5px 5px;
+}
+#butterbar-message a {color:#fff !important}
+#butterbar-message a:hover {text-decoration:underline;}
+</style>
+
+ <div id="butterbar-wrapper" >
+  <div id="butterbar" >
+    <div id="butterbar-message">
+<a target="_blank" href="https://docs.google.com/a/google.com/forms/d/17EFbvdm4FYkocc83EcrKhyhP5Y6tbns_eiBSeQ6ojxU/viewform">
+      Take the Android Developer Survey</a>
+    </div>
+  </div>
+</div>
+
 
 <div class="wrap">
     <!-- Slideshow -->
diff --git a/docs/html/sdk/installing/adding-packages.jd b/docs/html/sdk/installing/adding-packages.jd
index 2853db1..bba936e 100644
--- a/docs/html/sdk/installing/adding-packages.jd
+++ b/docs/html/sdk/installing/adding-packages.jd
@@ -21,18 +21,24 @@
 </ul>
 </li>
 
-<li>When the Android SDK Manager opens, it automatically selects a set of recommended packages,
-as shown in figure 1.
-Simply click <strong>Install</strong> to install the recommended packages. The Android SDK Manager
-installs the selected packages into
-your Android SDK environment.</li>
+<li>The SDK Manager shows all the SDK packages available for you to add to your Android SDK.
+As a minimum configuration for your SDK, we recommend you install the following:
+<ul>
+ <li>The latest Tools packages (check the <strong>Tools</strong> folder).</li>
+ <li>The latest version of Android (check the first <strong>Android</strong> folder).</li>
+ <li>The Android Support Library (open the <strong>Extras</strong> folder and check
+  <strong>Android Support Library</strong>).</li>
+</ul>
+
+<p>Once you've chosen your packages, click <strong>Install</strong>. The Android SDK Manager
+installs the selected packages into your Android SDK environment.</li>
 </ol>
 
-<p>If you install the recommended packages, you're now ready to start developing apps!
-To start developing, read <a href="{@docRoot}training/basics/firstapp/index.html"
+<p>With these packages installed, you're ready to start developing.
+To get started, read <a href="{@docRoot}training/basics/firstapp/index.html"
 >Building Your First App</a>.</p>
 
-<img src="/images/sdk_manager_packages.png" alt="" />
+<img src="/images/sdk_manager_packages.png" alt="" height="396" />
 <p class="img-caption"><strong>Figure 1.</strong> The Android SDK Manager shows the
 SDK packages that are available, already installed, or for which an update is available.</p>
 
@@ -40,15 +46,18 @@
 
 <h3>Additional information</h3>
 
-<p>For more information about using the SDK Manager and some of the available packages,
-see the <a href="{@docRoot}tools/help/sdk-manager.html">SDK Manager</a> document.</p>
-
-<p>Everything you need to develop Android apps is on this web site, including <a
+<ul>
+  <li>For more information about using the SDK Manager and some of the available packages,
+see the <a href="{@docRoot}tools/help/sdk-manager.html">SDK Manager</a> document.</li>
+  <li>This web site provides all information you need to develop Android apps, including <a
 href="{@docRoot}design/index.html">design guidelines</a>,
 <a href="{@docRoot}training/index.html">developer training</a>, <a
 href="{@docRoot}reference/packages.html">API reference</a>, and information
-about how you can <a href="{@docRoot}distribute/index.html">distribute your app</a>.
-For additional resources about developing and distributing your app, see the
-<a href="{@docRoot}support.html">Developer Support Resources</a>.</p>
+about how you can <a href="{@docRoot}distribute/index.html">distribute your app</a>. We recommend
+you begin by reading <a href="{@docRoot}training/basics/firstapp/index.html"
+>Building Your First App</a>.</li>
+  <li>For additional resources about developing and distributing your app, see the
+<a href="{@docRoot}support.html">Developer Support Resources</a>.</li>
+</ul>
 
 
diff --git a/docs/html/training/basics/firstapp/building-ui.jd b/docs/html/training/basics/firstapp/building-ui.jd
index bc6c47c..0f18861 100644
--- a/docs/html/training/basics/firstapp/building-ui.jd
+++ b/docs/html/training/basics/firstapp/building-ui.jd
@@ -62,7 +62,7 @@
 </div>
 </div>
 
-<img src="{@docRoot}images/viewgroup.png" alt="" width="400" />
+<img src="{@docRoot}images/viewgroup.png" alt="" width="400" height="214" />
 <p class="img-caption"><strong>Figure 1.</strong> Illustration of how {@link
 android.view.ViewGroup} objects form branches in the layout and contain other {@link
 android.view.View} objects.</p>
@@ -83,7 +83,7 @@
 lesson, you’re going to work directly with the XML, so click the <em>activity_main.xml</em> tab at
 the bottom of the screen to open the XML editor.</p>
 
-<p>The BlankActivity template you used to start this project creates the
+<p>The BlankActivity template you chose when you created this project includes the
 <code>activity_main.xml</code> file with a {@link
 android.widget.RelativeLayout} root view and a {@link android.widget.TextView} child view.</p>
 
@@ -225,9 +225,9 @@
 string resource.</p>
 
 <p>By default, your Android project includes a string resource file at
-<code>res/values/strings.xml</code>. Open this file and delete the {@code &lt;string>} element
-named <code>"hello_world"</code>. Then add a new one named
-<code>"edit_message"</code> and set the value to "Enter a message."</p>
+<code>res/values/strings.xml</code>. Add a new string named
+<code>"edit_message"</code> and set the value to "Enter a message." (You can delete
+the "hello_world" string.)</p>
 
 <p>While you’re in this file, also add a "Send" string for the button you’ll soon add, called
 <code>"button_send"</code>.</p>
diff --git a/docs/html/training/basics/firstapp/creating-project.jd b/docs/html/training/basics/firstapp/creating-project.jd
index 2ea8b2f..9516e37 100644
--- a/docs/html/training/basics/firstapp/creating-project.jd
+++ b/docs/html/training/basics/firstapp/creating-project.jd
@@ -42,7 +42,7 @@
 
 <p class="note"><strong>Note:</strong> You should already have the Android SDK installed, and if
 you're using Eclipse, you should also have the <a href="{@docRoot}tools/sdk/eclipse-adt.html">ADT
-plugin</a> installed (version 20.0.0 or higher). If you don't have these, follow the guide to <a
+plugin</a> installed (version 21.0.0 or higher). If you don't have these, follow the guide to <a
 href="{@docRoot}sdk/installing/index.html">Installing the Android SDK</a> before you start this
 lesson.</p>
 
@@ -50,13 +50,10 @@
 <h2 id="Eclipse">Create a Project with Eclipse</h2>
 
 <ol>
-  <li>In Eclipse, click New Android
-    App Project <img src="{@docRoot}images/tools/new_adt_project.png" 
-             style="vertical-align:baseline;margin:0" />
-    in the toolbar.  (If you don’t see this button,
-then you have not installed the ADT plugin&mdash;see <a
-href="{@docRoot}sdk/installing/installing-adt.html">Installing the Eclipse Plugin</a>.)
-  </li>
+  <li>Click <strong>New</strong> <img src="{@docRoot}images/tools/eclipse-new.png" 
+  style="vertical-align:baseline;margin:0" /> in the toolbar.</li>
+  <li>In the window that appears, open the <strong>Android</strong> folder,
+  select <strong>Android Application Project</strong>, and click <strong>Next</strong>.</li>
 
 <div class="figure" style="width:420px">
 <img src="{@docRoot}images/training/firstapp/adt-firstapp-setup.png" alt="" />
@@ -65,16 +62,35 @@
 
   <li>Fill in the form that appears:
     <ul>
-      <li><em>Application Name</em> is the app name that appears to users.
+      <li><strong>Application Name</strong> is the app name that appears to users.
           For this project, use "My First App."</p></li>
-      <li><em>Project Name</em> is the name of your project directory and the name visible in Eclipse.</li>
-      <li><em>Package Name</em> is the package namespace for your app (following the same
+      <li><strong>Project Name</strong> is the name of your project directory and the name visible in Eclipse.</li>
+      <li><strong>Package Name</strong> is the package namespace for your app (following the same
 rules as packages in the Java programming language). Your package name
 must be unique across all packages installed on the Android system. For this reason, it's generally
 best if you use a name that begins with the reverse domain name of your organization or
 publisher entity. For this project, you can use something like "com.example.myfirstapp."
 However, you cannot publish your app on Google Play using the "com.example" namespace.</li>
-      <li><em>Build SDK</em> is the platform version against which you will compile your app.
+      <li><strong>Minimum Required SDK</strong> is the lowest version of Android that your app supports,
+      indicated using the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels"
+      >API level</a>.
+        To support as many devices as possible, you should set this to the lowest version available
+        that allows your app to provide its core feature set. If any feature of your app is possible
+        only on newer versions of Android and it's not critical to the app's core feature set, you
+        can enable the feature only when running on the versions that support it (as
+        discussed in <a href="{@docRoot}training/basics/supporting-devices/platforms.html"
+        >Supporting Different Platform Versions</a>).
+        Leave this set to the default value for this project.
+      </li>
+      <li><strong>Target SDK</strong> indicates the highest version of Android (also using the
+      <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels"
+      >API level</a>) with which you
+      have tested with your application.
+        <p>As new versions of Android become available, you should
+      test your app on the new version and update this value to match the latest API level
+      in order to take advantage of new platform features.</p>
+      </li>
+      <li><strong>Compile With</strong> is the platform version against which you will compile your app.
         By default, this is set to the latest version of Android available in your SDK. (It should
         be Android 4.1 or greater; if you don't have such a version available, you must install one
         using the <a href="{@docRoot}sdk/installing/adding-packages.html">SDK Manager</a>).
@@ -82,17 +98,14 @@
 support older versions, but setting the build target to the latest version allows you to
 enable new features and optimize your app for a great user experience on the latest
 devices.</li>
-      <li><em>Minimum Required SDK</em> is the lowest version of Android that your app supports.
-        To support as many devices as possible, you should set this to the lowest version available
-        that allows your app to provide its core feature set. If any feature of your app is possible
-        only on newer versions of Android and it's not critical to the app's core feature set, you
-        can enable the feature only when running on the versions that support it.
-        <p>Leave this set to the default value for this project.</p>
+       <li><strong>Theme</strong> specifies the Android UI style to apply for your app. You can leave
+       this alone.</li>
     </ul>
     <p>Click <strong>Next</strong>.</p>
   </li>
-  
-  <li>The following screen provides tools to help you create a launcher icon for your app.
+  <li>On the next screen to configure the project, leave the default selections and click
+  <strong>Next</strong>.</li>
+  <li>The next screen can help you create a launcher icon for your app.
     <p>You can customize an icon in several ways and the tool generates an icon for all
     screen densities. Before you publish your app, you should be sure your icon meets
     the specifications defined in the <a
diff --git a/docs/html/training/basics/firstapp/running-app.jd b/docs/html/training/basics/firstapp/running-app.jd
index 80603b2..7866083 100644
--- a/docs/html/training/basics/firstapp/running-app.jd
+++ b/docs/html/training/basics/firstapp/running-app.jd
@@ -102,10 +102,16 @@
   </li>
 </ol>
 
-<p>To run the app from Eclipse, open one of your project's files and click
-Run <img src="{@docRoot}images/tools/eclipse-run.png" style="vertical-align:baseline;margin:0" />
-from the toolbar. Eclipse installs the app on your connected device and starts
-it.</p>
+<p>To run the app from Eclipse:</p>
+<ol>
+  <li>Open one of your project's files and click
+<strong>Run</strong> <img
+src="{@docRoot}images/tools/eclipse-run.png" style="vertical-align:baseline;margin:0" />
+from the toolbar.</li>
+  <li>In the <strong>Run as</strong> window that appears, select
+  <strong>Android Application</strong> and click <strong>OK</strong>.</li>
+</ol>
+<p>Eclipse installs the app on your connected device and starts it.</p>
 
 
 <p>Or to run your app from a command line:</p>
@@ -159,9 +165,16 @@
   <li>After the emulator boots up, unlock the emulator screen.</li>
 </ol>
 
-<p>To run the app from Eclipse, open one of your project's files and click
-Run <img src="{@docRoot}images/tools/eclipse-run.png" style="vertical-align:baseline;margin:0" />
-from the toolbar. Eclipse installs the app on your AVD and starts it.</p>
+<p>To run the app from Eclipse:</p>
+<ol>
+  <li>Open one of your project's files and click
+<strong>Run</strong> <img
+src="{@docRoot}images/tools/eclipse-run.png" style="vertical-align:baseline;margin:0" />
+from the toolbar.</li>
+  <li>In the <strong>Run as</strong> window that appears, select
+  <strong>Android Application</strong> and click <strong>OK</strong>.</li>
+</ol>
+<p>Eclipse installs the app on your AVD and starts it.</p>
 
 
 <p>Or to run your app from the command line:</p>
diff --git a/docs/html/training/basics/firstapp/starting-activity.jd b/docs/html/training/basics/firstapp/starting-activity.jd
index 3dafcfa..8943c9d 100644
--- a/docs/html/training/basics/firstapp/starting-activity.jd
+++ b/docs/html/training/basics/firstapp/starting-activity.jd
@@ -19,11 +19,7 @@
   <li><a href="#RespondToButton">Respond to the Send Button</a></li>
   <li><a href="#BuildIntent">Build an Intent</a></li>
   <li><a href="#StartActivity">Start the Second Activity</a></li>
-  <li><a href="#CreateActivity">Create the Second Activity</a>
-    <ol>
-      <li><a href="#AddToManifest">Add it to the manifest</a></li>
-    </ol>
-  </li>
+  <li><a href="#CreateActivity">Create the Second Activity</a></li>
   <li><a href="#ReceiveIntent">Receive the Intent</a></li>
   <li><a href="#DisplayMessage">Display the Message</a></li>
 </ol>
@@ -49,8 +45,8 @@
 
 <h2 id="RespondToButton">Respond to the Send Button</h2>
 
-<p>To respond to the button's on-click event, open the <code>main.xml</code> layout file and add the
-<a
+<p>To respond to the button's on-click event, open the <code>activity_main.xml</code>
+layout file and add the <a
 href="{@docRoot}reference/android/view/View.html#attr_android:onClick">{@code android:onClick}</a>
 attribute to the {@link android.widget.Button &lt;Button>} element:</p>
 
@@ -67,7 +63,8 @@
 android:onClick}</a> attribute’s value, <code>"sendMessage"</code>, is the name of a method in your
 activity that the system calls when the user clicks the button.</p>
 
-<p>Open the <code>MainActivity</code> class and add the corresponding method:</p>
+<p>Open the <code>MainActivity</code> class (located in the project's
+<code>src/</code> directory) and add the corresponding method:</p>
 
 <pre>
 /** Called when the user clicks the Send button */
@@ -76,6 +73,11 @@
 }
 </pre>
 
+<p>This requires that you import the {@link android.view.View} class:</p>
+<pre>
+import android.view.View;
+</pre>
+
 <p class="note"><strong>Tip:</strong> In Eclipse, press Ctrl + Shift + O to import missing classes
 (Cmd + Shift + O on Mac).</p>
 
@@ -137,7 +139,8 @@
 Ignore the error for now; you’ll create the class soon.</p>
 
 <p>An intent not only allows you to start another activity, but it can carry a bundle of data to the
-activity as well. So, use {@link android.app.Activity#findViewById findViewById()} to get the
+activity as well. Inside the {@code sendMessage()} method,
+use {@link android.app.Activity#findViewById findViewById()} to get the
 {@link android.widget.EditText} element and add its text value to the intent:</p>
 
 <pre>
@@ -147,11 +150,17 @@
 intent.putExtra(EXTRA_MESSAGE, message);
 </pre>
 
+<p class="note"><strong>Note:</strong>
+You now need import statements for <code>android.content.Intent</code>
+and <code>android.widget.EditText</code>. You'll define the <code>EXTRA_MESSAGE</code>
+constant in a moment.</p>
+
 <p>An {@link android.content.Intent} can carry a collection of various data types as key-value
 pairs called <em>extras</em>. The {@link android.content.Intent#putExtra putExtra()} method takes the
 key name in the first parameter and the value in the second parameter.</p>
 
-<p>In order for the next activity to query the extra data, you should define your key using a
+<p>In order for the next activity to query the extra data, you should define the key
+for your intent's extra using a
 public constant. So add the {@code EXTRA_MESSAGE} definition to the top of the {@code
 MainActivity} class:</p>
 
@@ -166,9 +175,11 @@
 as a prefix. This ensures they are unique, in case your app interacts with other apps.</p>
 
 
+
+
 <h2 id="StartActivity">Start the Second Activity</h2>
 
-<p>To start an activity, you simply need to call {@link android.app.Activity#startActivity
+<p>To start an activity, call {@link android.app.Activity#startActivity
 startActivity()} and pass it your {@link android.content.Intent}. The system receives this call
 and starts an instance of the {@link android.app.Activity}
 specified by the {@link android.content.Intent}.</p>
@@ -202,19 +213,19 @@
 <p>To create a new activity using Eclipse:</p>
 
 <ol>
-  <li>Click New <img src="{@docRoot}images/tools/eclipse-new.png" 
+  <li>Click <strong>New</strong> <img src="{@docRoot}images/tools/eclipse-new.png" 
   style="vertical-align:baseline;margin:0" /> in the toolbar.</li>
   <li>In the window that appears, open the <strong>Android</strong> folder
   and select <strong>Android Activity</strong>. Click <strong>Next</strong>.</li>
   <li>Select <strong>BlankActivity</strong> and click <strong>Next</strong>.</li>
   <li>Fill in the activity details:
     <ul>
-      <li><em>Project</em>: MyFirstApp</li>
-      <li><em>Activity Name</em>: DisplayMessageActivity</li>
-      <li><em>Layout Name</em>: activity_display_message</li>
-      <li><em>Navigation Type</em>: None</li>
-      <li><em>Hierarchial Parent</em>: com.example.myfirstapp.MainActivity</li>
-      <li><em>Title</em>: My Message</li>
+      <li><strong>Project</strong>: MyFirstApp</li>
+      <li><strong>Activity Name</strong>: DisplayMessageActivity</li>
+      <li><strong>Layout Name</strong>: activity_display_message</li>
+      <li><strong>Title</strong>: My Message</li>
+      <li><strong>Hierarchial Parent</strong>: com.example.myfirstapp.MainActivity</li>
+      <li><strong>Navigation Type</strong>: None</li>
     </ul>
     <p>Click <strong>Finish</strong>.</p>
   </li>
@@ -224,44 +235,94 @@
 {@code DisplayMessageActivity.java} in the project's <code>src/</code> directory, next to
 the original {@code MainActivity.java} file.</p>
 
-<p>Open the {@code DisplayMessageActivity.java} file. If you used Eclipse to create it, the class
+<p>Open the {@code DisplayMessageActivity.java} file. If you used Eclipse to create this
+activity:</p>
+<ul>
+  <li>The class
 already includes an implementation of the required {@link android.app.Activity#onCreate onCreate()}
-method. There's also an implementation of the {@link android.app.Activity#onCreateOptionsMenu
+method.</li>
+  <li>There's also an implementation of the {@link android.app.Activity#onCreateOptionsMenu
 onCreateOptionsMenu()} method, but
-you won't need it for this app so you can remove it. The class should look like this:</p>
+you won't need it for this app so you can remove it.</li>
+  <li>There's also an implementation of {@link android.app.Activity#onOptionsItemSelected
+  onOptionsItemSelected()} which handles the behavior for the action bar's <em>Up</em> behavior.
+  Keep this one the way it is.</li>
+</ul>
+
+<p>The class should look like this:</p>
 
 <pre>
 public class DisplayMessageActivity extends Activity {
     &#64;Override
-    public void onCreate(Bundle savedInstanceState) {
+    protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_display_message);
+        // Show the Up button in the action bar.
+        getActionBar().setDisplayHomeAsUpEnabled(true);
+    }
+
+    &#64;Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+        case android.R.id.home:
+            NavUtils.navigateUpFromSameTask(this);
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
     }
 }
 </pre>
 
+<p>If you used an IDE other than Eclipse, update your {@code DisplayMessageActivity}
+class with the above code.</p>
+
 <p>All subclasses of {@link android.app.Activity} must implement the {@link
 android.app.Activity#onCreate onCreate()} method. The system calls this when creating a new
-instance of the activity. It is where you must define the activity layout and where you should
+instance of the activity. This method is where you must define the activity layout
+with the {@link android.app.Activity#setContentView setContentView()} method
+and is where you should
 perform initial setup for the activity components.</p>
 
+<p class="note"><strong>Note:</strong> If you are using an IDE other than Eclipse, your project
+does not contain the {@code activity_display_message} layout that's requested by
+{@link android.app.Activity#setContentView setContentView()}. That's OK because
+you will update this method later and won't be using that layout.</p>
+
+
+<h3 id="AddTitle">Add the title string</h3>
+
+<p>If you used Eclipse, you can skip to the <a href="#AddToManifest">next section</a>,
+because the template provides
+the title string for the new activity.</p>
+
+<p>If you're using an IDE other than Eclipse,
+add the new activity's title to the {@code strings.xml} file:</p>
+<pre>
+&lt;resources>
+    ...
+    &lt;string name="title_activity_display_message">My Message&lt;/string>
+&lt;/resources>
+</pre>
+
 
 
 <h3 id="AddToManifest">Add it to the manifest</h3>
 
-<p>You must declare all activities in your manifest file, <code>AndroidManifest.xml</code>, using an
+<p>All activities must be declared in your manifest file, <code>AndroidManifest.xml</code>, using an
 <a
 href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity>}</a> element.</p>
 
-<p>When you use the Eclipse tools to create the activity, it creates a default entry. It should
+<p>When you use the Eclipse tools to create the activity, it creates a default entry. If you're
+using a different IDE, you need to add the manifest entry yourself. It should
 look like this:</p>
 
 <pre>
 &lt;application ... >
     ...
     &lt;activity
-        android:name=".DisplayMessageActivity"
-        android:label="@string/title_activity_display_message" >
+        android:name="com.example.myfirstapp.DisplayMessageActivity"
+        android:label="@string/title_activity_display_message"
+        android:parentActivityName="com.example.myfirstapp.MainActivity" >
         &lt;meta-data
             android:name="android.support.PARENT_ACTIVITY"
             android:value="com.example.myfirstapp.MainActivity" />
@@ -269,24 +330,32 @@
 &lt;/application>
 </pre>
 
-<p>The <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code
-  &lt;meta-data>}</a> element declares the name of this activity's parent activity
-  within the app's logical hierarchy. The Android <a
-href="{@docRoot}tools/extras/support-library.html">Support Library</a> uses this information
-  to implement default navigation behaviors, such as <a
-        href="{@docRoot}design/patterns/navigation.html">Up navigation</a>.</p>
+<p>The <a href="{@docRoot}guide/topics/manifest/activity-element.html#parent">{@code
+android:parentActivityName}</a> attribute declares the name of this activity's parent activity
+within the app's logical hierarchy. The system uses this value
+to implement default navigation behaviors, such as <a
+href="{@docRoot}design/patterns/navigation.html">Up navigation</a> on
+Android 4.1 (API level 16) and higher. You can provide the same navigation behaviors for
+older versions of Android by using the
+<a href="{@docRoot}tools/extras/support-library.html">Support Library</a> and adding
+the <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code
+&lt;meta-data>}</a> element as shown here.</p>
 
-<p class="note"><strong>Note:</strong> During <a
-href="{@docRoot}sdk/installing/adding-packages.html">installation</a>, you should have downloaded
-the latest Support Library. Eclipse automatically includes this library in your app project (you
-can see the library's JAR file listed under <em>Android Dependencies</em>). If you're not using
-Eclipse, you may need to manually add the library to your project&mdash;follow this guide for <a
-href="{@docRoot}tools/extras/support-library.html#SettingUp">setting up the Support Library</a>.</p>
+<p class="note"><strong>Note:</strong> Your Android SDK should already include
+the latest Android Support Library. It's included with the ADT Bundle but if you're using
+a different IDE, you should have installed it during the
+<a href="{@docRoot}sdk/installing/adding-packages.html">Adding Platforms and Packages</a> step.
+When using the templates in Eclipse, the Support Library is automatically added to your app project
+(you can see the library's JAR file listed under <em>Android Dependencies</em>). If you're not using
+Eclipse, you need to manually add the library to your project&mdash;follow the guide for <a
+href="{@docRoot}tools/extras/support-library.html#SettingUp">setting up the Support Library</a>
+then return here.</p>
 
-<p>The app is now runnable because the {@link android.content.Intent} in the
-first activity now resolves to the {@code DisplayMessageActivity} class. If you run the app now,
-clicking the Send button starts the second activity, but it's still using the default
-"Hello world" layout.</p>
+<p>If you're developing with Eclipse, you can run the app now, but not much happens.
+Clicking the Send button starts the second activity but it uses
+a default "Hello world" layout provided by the template. You'll soon update the
+activity to instead display a custom text view, so if you're using a different IDE,
+don't worry that the app won't yet compile.</p>
 
 
 <h2 id="ReceiveIntent">Receive the Intent</h2>
diff --git a/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java b/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java
index f137373..f909158 100644
--- a/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java
+++ b/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java
@@ -249,7 +249,11 @@
             }
         }
 
-        mCallback.reportLocation(mFusedLocation);
+        if (mCallback != null) {
+          mCallback.reportLocation(mFusedLocation);
+        } else {
+          Log.w(TAG, "Location updates received while fusion engine not started");
+        }
     }
 
     /** Called on mLooper thread */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 7035006..5d9c7bc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -16,6 +16,10 @@
 
 package com.android.systemui.statusbar.phone;
 
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Iterator;
+
 import android.animation.ObjectAnimator;
 import android.animation.TimeAnimator;
 import android.animation.TimeAnimator.TimeListener;
@@ -73,7 +77,93 @@
 
     private TimeAnimator mTimeAnimator;
     private ObjectAnimator mPeekAnimator;
-    private VelocityTracker mVelocityTracker;
+    private FlingTracker mVelocityTracker;
+
+    /**
+     * A very simple low-pass velocity filter for motion events; not nearly as sophisticated as
+     * VelocityTracker but optimized for the kinds of gestures we expect to see in status bar
+     * panels.
+     */
+    private static class FlingTracker {
+        static final boolean DEBUG = false;
+        final int MAX_EVENTS = 8;
+        final float DECAY = 0.75f;
+        ArrayDeque<MotionEventCopy> mEventBuf = new ArrayDeque<MotionEventCopy>(MAX_EVENTS);
+        float mVX, mVY = 0;
+        private static class MotionEventCopy {
+            public MotionEventCopy(float x2, float y2, long eventTime) {
+                this.x = x2;
+                this.y = y2;
+                this.t = eventTime;
+            }
+            public float x, y;
+            public long t;
+        }
+        public FlingTracker() {
+        }
+        public void addMovement(MotionEvent event) {
+            if (mEventBuf.size() == MAX_EVENTS) {
+                mEventBuf.remove();
+            }
+            mEventBuf.add(new MotionEventCopy(event.getX(), event.getY(), event.getEventTime()));
+        }
+        public void computeCurrentVelocity(long timebase) {
+            if (FlingTracker.DEBUG) {
+                Slog.v("FlingTracker", "computing velocities for " + mEventBuf.size() + " events");
+            }
+            mVX = mVY = 0;
+            MotionEventCopy last = null;
+            int i = 0;
+            float totalweight = 0f;
+            float weight = 10f;
+            for (final Iterator<MotionEventCopy> iter = mEventBuf.descendingIterator();
+                    iter.hasNext();) {
+                final MotionEventCopy event = iter.next();
+                if (last != null) {
+                    final float dt = (float) (event.t - last.t) / timebase;
+                    final float dx = (event.x - last.x);
+                    final float dy = (event.y - last.y);
+                    if (FlingTracker.DEBUG) {
+                        Slog.v("FlingTracker", String.format("   [%d] dx=%.1f dy=%.1f dt=%.0f vx=%.1f vy=%.1f",
+                                i,
+                                dx, dy, dt,
+                                (dx/dt),
+                                (dy/dt)
+                                ));
+                    }
+                    mVX += weight * dx / dt;
+                    mVY += weight * dy / dt;
+                    totalweight += weight;
+                    weight *= DECAY;
+                }
+                last = event;
+                i++;
+            }
+            mVX /= totalweight;
+            mVY /= totalweight;
+
+            if (FlingTracker.DEBUG) {
+                Slog.v("FlingTracker", "computed: vx=" + mVX + " vy=" + mVY);
+            }
+        }
+        public float getXVelocity() {
+            return mVX;
+        }
+        public float getYVelocity() {
+            return mVY;
+        }
+        public void recycle() {
+            mEventBuf.clear();
+        }
+
+        static FlingTracker sTracker;
+        static FlingTracker obtain() {
+            if (sTracker == null) {
+                sTracker = new FlingTracker();
+            }
+            return sTracker;
+        }
+    }
 
     private int[] mAbsPos = new int[2];
     PanelBar mBar;
@@ -268,7 +358,7 @@
                             mHandleView.setPressed(true);
                             postInvalidate(); // catch the press state change
                             mInitialTouchY = y;
-                            mVelocityTracker = VelocityTracker.obtain();
+                            mVelocityTracker = FlingTracker.obtain();
                             trackMovement(event);
                             mTimeAnimator.cancel(); // end any outstanding animations
                             mBar.onTrackingStarted(PanelView.this);
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
index 8502d78..801b627 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -80,6 +80,7 @@
     private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView
     private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid;
     private int mAppWidgetToShow;
+    private int mPreviousWidgetPage = -1;
 
     private boolean mCheckAppWidgetConsistencyOnBootCompleted = false;
     private boolean mCleanupAppWidgetsOnBootCompleted = false;
@@ -132,6 +133,7 @@
         mUserId = mLockPatternUtils.getCurrentUser();
         mAppWidgetHost = new AppWidgetHost(
                 context, APPWIDGET_HOST_ID, mOnClickHandler, Looper.myLooper());
+        mAppWidgetHost.setUserId(mUserId);
         cleanupAppWidgetIds();
 
         mAppWidgetManager = AppWidgetManager.getInstance(mContext);
@@ -286,6 +288,11 @@
 
         showPrimarySecurityScreen(false);
         updateSecurityViews();
+
+        // Make sure at least this view is focusable in case nothing below it is. Otherwise,
+        // requestFocus() on this view will fail and allow events, such as volume keys, to be
+        // handled by the fallback handler.  See bug 7546960 for details.
+        setFocusableInTouchMode(true);
     }
 
     private boolean shouldEnableAddWidget() {
@@ -881,6 +888,7 @@
         if (mViewStateManager != null) {
             mViewStateManager.showUsabilityHints();
         }
+        requestFocus();
     }
 
     @Override
@@ -900,10 +908,12 @@
         if (cameraPage != null) {
             cameraPage.onScreenTurnedOff();
         }
+        clearFocus();
     }
 
     public void clearAppWidgetToShow() {
         mAppWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;
+        mPreviousWidgetPage = -1;
     }
 
     @Override
@@ -1291,10 +1301,22 @@
            showAppropriateWidgetPage();
         }
     };
+    Runnable mOnRestoreUpdatePageRunnable = new Runnable() {
+        @Override
+        public void run() {
+            mSwitchPageRunnable.run();
+
+            // We need to update the alpha's of the hints and content after setting the current page
+            mViewStateManager.showUsabilityHints();
+        };
+    };
+
 
     static class SavedState extends BaseSavedState {
         int transportState;
         int appWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;
+        // Note the appWidgetContainerPage is only used if the appWidgetToShow is invalid
+        int appWidgetContainerPage = -1;
 
         SavedState(Parcelable superState) {
             super(superState);
@@ -1304,6 +1326,7 @@
             super(in);
             this.transportState = in.readInt();
             this.appWidgetToShow = in.readInt();
+            this.appWidgetContainerPage = in.readInt();
         }
 
         @Override
@@ -1311,6 +1334,7 @@
             super.writeToParcel(out, flags);
             out.writeInt(this.transportState);
             out.writeInt(this.appWidgetToShow);
+            out.writeInt(this.appWidgetContainerPage);
         }
 
         public static final Parcelable.Creator<SavedState> CREATOR
@@ -1332,6 +1356,7 @@
         SavedState ss = new SavedState(superState);
         ss.transportState = mViewStateManager.getTransportState();
         ss.appWidgetToShow = mAppWidgetToShow;
+        ss.appWidgetContainerPage = mAppWidgetContainer.getCurrentPage();
         return ss;
     }
 
@@ -1346,7 +1371,8 @@
         super.onRestoreInstanceState(ss.getSuperState());
         mViewStateManager.setTransportState(ss.transportState);
         mAppWidgetToShow = ss.appWidgetToShow;
-        post(mSwitchPageRunnable);
+        mPreviousWidgetPage = ss.appWidgetContainerPage;
+        post(mOnRestoreUpdatePageRunnable);
     }
 
     @Override
@@ -1403,6 +1429,9 @@
             }
             mAppWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;
         }
+        if (mPreviousWidgetPage > -1) {
+            return mPreviousWidgetPage;
+        }
         // if music playing, show transport
         if (isMusicPlaying) {
             if (DEBUG) Log.d(TAG, "Music playing, show transport");
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
index efd09e0..dac852a 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
@@ -216,6 +216,7 @@
 
         if (force || mKeyguardView == null) {
             inflateKeyguardView(options);
+            mKeyguardView.requestFocus();
         }
         updateUserActivityTimeoutInWindowLayoutParams();
         mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
diff --git a/services/java/com/android/server/AttributeCache.java b/services/java/com/android/server/AttributeCache.java
index 81378dc..81613c6 100644
--- a/services/java/com/android/server/AttributeCache.java
+++ b/services/java/com/android/server/AttributeCache.java
@@ -23,6 +23,7 @@
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.content.res.TypedArray;
+import android.os.UserHandle;
 import android.util.SparseArray;
 
 import java.util.HashMap;
@@ -34,52 +35,54 @@
  */
 public final class AttributeCache {
     private static AttributeCache sInstance = null;
-    
+
     private final Context mContext;
-    private final WeakHashMap<String, Package> mPackages =
-            new WeakHashMap<String, Package>();
+    private final SparseArray<WeakHashMap<String, Package>> mPackages =
+            new SparseArray<WeakHashMap<String, Package>>();
     private final Configuration mConfiguration = new Configuration();
-    
+
     public final static class Package {
         public final Context context;
         private final SparseArray<HashMap<int[], Entry>> mMap
                 = new SparseArray<HashMap<int[], Entry>>();
-        
+
         public Package(Context c) {
             context = c;
         }
     }
-    
+
     public final static class Entry {
         public final Context context;
         public final TypedArray array;
-        
+
         public Entry(Context c, TypedArray ta) {
             context = c;
             array = ta;
         }
     }
-    
+
     public static void init(Context context) {
         if (sInstance == null) {
             sInstance = new AttributeCache(context);
         }
     }
-    
+
     public static AttributeCache instance() {
         return sInstance;
     }
-    
+
     public AttributeCache(Context context) {
         mContext = context;
     }
-    
+
     public void removePackage(String packageName) {
         synchronized (this) {
-            mPackages.remove(packageName);
+            for (int i=0; i<mPackages.size(); i++) {
+                mPackages.valueAt(i).remove(packageName);
+            }
         }
     }
-    
+
     public void updateConfiguration(Configuration config) {
         synchronized (this) {
             int changes = mConfiguration.updateFrom(config);
@@ -93,10 +96,21 @@
             }
         }
     }
-    
-    public Entry get(String packageName, int resId, int[] styleable) {
+
+    public void removeUser(int userId) {
         synchronized (this) {
-            Package pkg = mPackages.get(packageName);
+            mPackages.remove(userId);
+        }
+    }
+
+    public Entry get(int userId, String packageName, int resId, int[] styleable) {
+        synchronized (this) {
+            WeakHashMap<String, Package> packages = mPackages.get(userId);
+            if (packages == null) {
+                packages = new WeakHashMap<String, Package>();
+                mPackages.put(userId, packages);
+            }
+            Package pkg = packages.get(packageName);
             HashMap<int[], Entry> map = null;
             Entry ent = null;
             if (pkg != null) {
@@ -110,7 +124,8 @@
             } else {
                 Context context;
                 try {
-                    context = mContext.createPackageContext(packageName, 0);
+                    context = mContext.createPackageContextAsUser(packageName, 0,
+                            new UserHandle(userId));
                     if (context == null) {
                         return null;
                     }
@@ -118,7 +133,7 @@
                     return null;
                 }
                 pkg = new Package(context);
-                mPackages.put(packageName, pkg);
+                packages.put(packageName, pkg);
             }
             
             if (map == null) {
diff --git a/services/java/com/android/server/BluetoothManagerService.java b/services/java/com/android/server/BluetoothManagerService.java
index 7f52157..5a2088c 100755
--- a/services/java/com/android/server/BluetoothManagerService.java
+++ b/services/java/com/android/server/BluetoothManagerService.java
@@ -513,8 +513,8 @@
         }
     }
     public String getAddress() {
-        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
-                                                "Need BLUETOOTH ADMIN permission");
+        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM,
+                                                "Need BLUETOOTH permission");
 
         if ((Binder.getCallingUid() != Process.SYSTEM_UID) &&
             (!checkIfCallerIsForegroundUser())) {
@@ -538,8 +538,8 @@
     }
 
     public String getName() {
-        mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
-                                                "Need BLUETOOTH ADMIN permission");
+        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM,
+                                                "Need BLUETOOTH permission");
 
         if ((Binder.getCallingUid() != Process.SYSTEM_UID) &&
             (!checkIfCallerIsForegroundUser())) {
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 8eb532d..94e0bd4 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -444,7 +444,9 @@
             final int userId = getChangingUserId();
             final boolean retval = userId == mSettings.getCurrentUserId();
             if (DEBUG) {
-                Slog.d(TAG, "--- ignore this call back from a background user: " + userId);
+                if (!retval) {
+                    Slog.d(TAG, "--- ignore this call back from a background user: " + userId);
+                }
             }
             return retval;
         }
@@ -658,7 +660,7 @@
         } catch (RemoteException e) {
             Slog.w(TAG, "Couldn't get current user ID; guessing it's 0", e);
         }
-        mMyPackageMonitor.register(mContext, null, true);
+        mMyPackageMonitor.register(mContext, null, UserHandle.ALL, true);
 
         // mSettings should be created before buildInputMethodListLocked
         mSettings = new InputMethodSettings(
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index 0d4a1c2..f21f826 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -1710,6 +1710,7 @@
             for (UpdateRecord r : deadUpdateRecords) {
                 r.disposeLocked(true);
             }
+            applyRequirementsLocked(provider);
         }
     }
 
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index e2be577..37d7ce7 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -110,6 +110,11 @@
     private static final int NOTIFICATION_PRIORITY_MULTIPLIER = 10;
     private static final int SCORE_DISPLAY_THRESHOLD = Notification.PRIORITY_MIN * NOTIFICATION_PRIORITY_MULTIPLIER;
 
+    // Notifications with scores below this will not interrupt the user, either via LED or
+    // sound or vibration
+    private static final int SCORE_INTERRUPTION_THRESHOLD =
+            Notification.PRIORITY_LOW * NOTIFICATION_PRIORITY_MULTIPLIER;
+
     private static final boolean ENABLE_BLOCKED_NOTIFICATIONS = true;
     private static final boolean ENABLE_BLOCKED_TOASTS = true;
 
@@ -991,6 +996,9 @@
             return;
         }
 
+        // Should this notification make noise, vibe, or use the LED?
+        final boolean canInterrupt = (score >= SCORE_INTERRUPTION_THRESHOLD);
+
         synchronized (mNotificationList) {
             NotificationRecord r = new NotificationRecord(pkg, tag, id, 
                     callingUid, callingPid, userId,
@@ -1042,7 +1050,8 @@
                     long identity = Binder.clearCallingIdentity();
                     try {
                         r.statusBarKey = mStatusBar.addNotification(n);
-                        if ((n.notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0) {
+                        if ((n.notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0
+                                && canInterrupt) {
                             mAttentionLight.pulse();
                         }
                     }
@@ -1073,6 +1082,7 @@
                         && (notification.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0 ))
                     && (r.userId == UserHandle.USER_ALL ||
                         (r.userId == userId && r.userId == currentUser))
+                    && canInterrupt
                     && mSystemReady) {
 
                 final AudioManager audioManager = (AudioManager) mContext
@@ -1171,7 +1181,8 @@
             }
             //Slog.i(TAG, "notification.lights="
             //        + ((old.notification.lights.flags & Notification.FLAG_SHOW_LIGHTS) != 0));
-            if ((notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0) {
+            if ((notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0
+                    && canInterrupt) {
                 mLights.add(r);
                 updateLightsLocked();
             } else {
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index d15b854..409480f 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -14551,6 +14551,10 @@
                 // Clean up all state and processes associated with the user.
                 // Kill all the processes for the user.
                 forceStopUserLocked(userId);
+                AttributeCache ac = AttributeCache.instance();
+                if (ac != null) {
+                    ac.removeUser(userId);
+                }
             }
         }
 
diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java
index 749dc66..de0f9ca 100644
--- a/services/java/com/android/server/am/ActivityRecord.java
+++ b/services/java/com/android/server/am/ActivityRecord.java
@@ -407,7 +407,7 @@
             packageName = aInfo.applicationInfo.packageName;
             launchMode = aInfo.launchMode;
             
-            AttributeCache.Entry ent = AttributeCache.instance().get(packageName,
+            AttributeCache.Entry ent = AttributeCache.instance().get(userId, packageName,
                     realTheme, com.android.internal.R.styleable.Window);
             fullscreen = ent != null && !ent.array.getBoolean(
                     com.android.internal.R.styleable.Window_windowIsFloating, false)
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index 4546dc3..27dd732 100755
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -1810,8 +1810,8 @@
                         }
                         mHistory.add(addPos, r);
                         r.putInHistory();
-                        mService.mWindowManager.addAppToken(addPos, r.appToken, r.task.taskId,
-                                r.info.screenOrientation, r.fullscreen,
+                        mService.mWindowManager.addAppToken(addPos, r.userId, r.appToken,
+                                r.task.taskId, r.info.screenOrientation, r.fullscreen,
                                 (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0);
                         if (VALIDATE_TOKENS) {
                             validateAppTokensLocked();
@@ -1875,8 +1875,8 @@
                 mNoAnimActivities.remove(r);
             }
             r.updateOptionsLocked(options);
-            mService.mWindowManager.addAppToken(
-                    addPos, r.appToken, r.task.taskId, r.info.screenOrientation, r.fullscreen,
+            mService.mWindowManager.addAppToken(addPos, r.userId, r.appToken,
+                    r.task.taskId, r.info.screenOrientation, r.fullscreen,
                     (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0);
             boolean doShow = true;
             if (newTask) {
@@ -1914,8 +1914,8 @@
         } else {
             // If this is the first activity, don't do any fancy animations,
             // because there is nothing for it to animate on top of.
-            mService.mWindowManager.addAppToken(addPos, r.appToken, r.task.taskId,
-                    r.info.screenOrientation, r.fullscreen,
+            mService.mWindowManager.addAppToken(addPos, r.userId, r.appToken,
+                    r.task.taskId, r.info.screenOrientation, r.fullscreen,
                     (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0);
             ActivityOptions.abort(options);
         }
diff --git a/services/java/com/android/server/display/DisplayManagerService.java b/services/java/com/android/server/display/DisplayManagerService.java
index e58a0a5cb..e09970e 100644
--- a/services/java/com/android/server/display/DisplayManagerService.java
+++ b/services/java/com/android/server/display/DisplayManagerService.java
@@ -41,6 +41,7 @@
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 /**
  * Manages attached displays.
@@ -152,6 +153,10 @@
             new SparseArray<LogicalDisplay>();
     private int mNextNonDefaultDisplayId = Display.DEFAULT_DISPLAY + 1;
 
+    // List of all display transaction listeners.
+    private final CopyOnWriteArrayList<DisplayTransactionListener> mDisplayTransactionListeners =
+            new CopyOnWriteArrayList<DisplayTransactionListener>();
+
     // Set to true if all displays have been blanked by the power manager.
     private int mAllDisplayBlankStateFromPowerManager;
 
@@ -261,6 +266,36 @@
     }
 
     /**
+     * Registers a display transaction listener to provide the client a chance to
+     * update its surfaces within the same transaction as any display layout updates.
+     *
+     * @param listener The listener to register.
+     */
+    public void registerDisplayTransactionListener(DisplayTransactionListener listener) {
+        if (listener == null) {
+            throw new IllegalArgumentException("listener must not be null");
+        }
+
+        // List is self-synchronized copy-on-write.
+        mDisplayTransactionListeners.add(listener);
+    }
+
+    /**
+     * Unregisters a display transaction listener to provide the client a chance to
+     * update its surfaces within the same transaction as any display layout updates.
+     *
+     * @param listener The listener to unregister.
+     */
+    public void unregisterDisplayTransactionListener(DisplayTransactionListener listener) {
+        if (listener == null) {
+            throw new IllegalArgumentException("listener must not be null");
+        }
+
+        // List is self-synchronized copy-on-write.
+        mDisplayTransactionListeners.remove(listener);
+    }
+
+    /**
      * Overrides the display information of a particular logical display.
      * This is used by the window manager to control the size and characteristics
      * of the default display.  It is expected to apply the requested change
@@ -298,6 +333,11 @@
 
             performTraversalInTransactionLocked();
         }
+
+        // List is self-synchronized copy-on-write.
+        for (DisplayTransactionListener listener : mDisplayTransactionListeners) {
+            listener.onDisplayTransaction();
+        }
     }
 
     /**
diff --git a/services/java/com/android/server/display/DisplayTransactionListener.java b/services/java/com/android/server/display/DisplayTransactionListener.java
new file mode 100644
index 0000000..34eb8f9
--- /dev/null
+++ b/services/java/com/android/server/display/DisplayTransactionListener.java
@@ -0,0 +1,26 @@
+/*
+ * 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 com.android.server.display;
+
+/**
+ * Called within a Surface transaction whenever the size or orientation of a
+ * display may have changed.  Provides an opportunity for the client to
+ * update the position of its surfaces as part of the same transaction.
+ */
+public interface DisplayTransactionListener {
+    void onDisplayTransaction();
+}
diff --git a/services/java/com/android/server/dreams/DreamController.java b/services/java/com/android/server/dreams/DreamController.java
index 1ab6a77..45ae2c5 100644
--- a/services/java/com/android/server/dreams/DreamController.java
+++ b/services/java/com/android/server/dreams/DreamController.java
@@ -44,6 +44,9 @@
 final class DreamController {
     private static final String TAG = "DreamController";
 
+    // How long we wait for a newly bound dream to create the service connection
+    private static final int DREAM_CONNECTION_TIMEOUT = 5 * 1000;
+
     private final Context mContext;
     private final Handler mHandler;
     private final Listener mListener;
@@ -58,6 +61,16 @@
 
     private DreamRecord mCurrentDream;
 
+    private final Runnable mStopUnconnectedDreamRunnable = new Runnable() {
+        @Override
+        public void run() {
+            if (mCurrentDream != null && mCurrentDream.mBound && !mCurrentDream.mConnected) {
+                Slog.w(TAG, "Bound dream did not connect in the time allotted");
+                stopDream();
+            }
+        }
+    };
+
     public DreamController(Context context, Handler handler, Listener listener) {
         mContext = context;
         mHandler = handler;
@@ -116,6 +129,7 @@
         }
 
         mCurrentDream.mBound = true;
+        mHandler.postDelayed(mStopUnconnectedDreamRunnable, DREAM_CONNECTION_TIMEOUT);
     }
 
     public void stopDream() {
@@ -128,6 +142,8 @@
         Slog.i(TAG, "Stopping dream: name=" + oldDream.mName
                 + ", isTest=" + oldDream.mIsTest + ", userId=" + oldDream.mUserId);
 
+        mHandler.removeCallbacks(mStopUnconnectedDreamRunnable);
+
         if (oldDream.mSentStartBroadcast) {
             mContext.sendBroadcastAsUser(mDreamingStoppedIntent, UserHandle.ALL);
         }
@@ -200,6 +216,7 @@
         public final int mUserId;
 
         public boolean mBound;
+        public boolean mConnected;
         public IDreamService mService;
         public boolean mSentStartBroadcast;
 
@@ -231,6 +248,7 @@
             mHandler.post(new Runnable() {
                 @Override
                 public void run() {
+                    mConnected = true;
                     if (mCurrentDream == DreamRecord.this && mService == null) {
                         attach(IDreamService.Stub.asInterface(service));
                     }
diff --git a/services/java/com/android/server/power/DisplayPowerController.java b/services/java/com/android/server/power/DisplayPowerController.java
index 317fec0..724e126 100644
--- a/services/java/com/android/server/power/DisplayPowerController.java
+++ b/services/java/com/android/server/power/DisplayPowerController.java
@@ -19,6 +19,7 @@
 import com.android.server.LightsService;
 import com.android.server.TwilightService;
 import com.android.server.TwilightService.TwilightState;
+import com.android.server.display.DisplayManagerService;
 
 import android.animation.Animator;
 import android.animation.ObjectAnimator;
@@ -29,7 +30,6 @@
 import android.hardware.SensorEventListener;
 import android.hardware.SensorManager;
 import android.hardware.SystemSensorManager;
-import android.hardware.display.DisplayManager;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
@@ -40,7 +40,6 @@
 import android.util.Slog;
 import android.util.Spline;
 import android.util.TimeUtils;
-import android.view.Display;
 
 import java.io.PrintWriter;
 
@@ -183,7 +182,7 @@
     private final TwilightService mTwilight;
 
     // The display manager.
-    private final DisplayManager mDisplayManager;
+    private final DisplayManagerService mDisplayManager;
 
     // The sensor manager.
     private final SensorManager mSensorManager;
@@ -346,6 +345,7 @@
      */
     public DisplayPowerController(Looper looper, Context context, Notifier notifier,
             LightsService lights, TwilightService twilight,
+            DisplayManagerService displayManager,
             DisplayBlanker displayBlanker,
             Callbacks callbacks, Handler callbackHandler) {
         mHandler = new DisplayControllerHandler(looper);
@@ -357,7 +357,7 @@
         mLights = lights;
         mTwilight = twilight;
         mSensorManager = new SystemSensorManager(mHandler.getLooper());
-        mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE);
+        mDisplayManager = displayManager;
 
         final Resources resources = context.getResources();
 
@@ -518,9 +518,8 @@
     }
 
     private void initialize() {
-        Display display = mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY);
         mPowerState = new DisplayPowerState(
-                new ElectronBeam(display), mDisplayBlanker,
+                new ElectronBeam(mDisplayManager), mDisplayBlanker,
                 mLights.getLight(LightsService.LIGHT_ID_BACKLIGHT));
 
         mElectronBeamOnAnimator = ObjectAnimator.ofFloat(
diff --git a/services/java/com/android/server/power/ElectronBeam.java b/services/java/com/android/server/power/ElectronBeam.java
index 9a53648..8e19e11 100644
--- a/services/java/com/android/server/power/ElectronBeam.java
+++ b/services/java/com/android/server/power/ElectronBeam.java
@@ -16,6 +16,9 @@
 
 package com.android.server.power;
 
+import com.android.server.display.DisplayManagerService;
+import com.android.server.display.DisplayTransactionListener;
+
 import android.graphics.Bitmap;
 import android.graphics.PixelFormat;
 import android.opengl.EGL14;
@@ -72,14 +75,13 @@
     private boolean mPrepared;
     private int mMode;
 
-    private final Display mDisplay;
-    private final DisplayInfo mDisplayInfo = new DisplayInfo();
+    private final DisplayManagerService mDisplayManager;
     private int mDisplayLayerStack; // layer stack associated with primary display
-    private int mDisplayRotation;
     private int mDisplayWidth;      // real width, not rotated
     private int mDisplayHeight;     // real height, not rotated
     private SurfaceSession mSurfaceSession;
     private Surface mSurface;
+    private NaturalSurfaceLayout mSurfaceLayout;
     private EGLDisplay mEglDisplay;
     private EGLConfig mEglConfig;
     private EGLContext mEglContext;
@@ -111,8 +113,8 @@
      */
     public static final int MODE_FADE = 2;
 
-    public ElectronBeam(Display display) {
-        mDisplay = display;
+    public ElectronBeam(DisplayManagerService displayManager) {
+        mDisplayManager = displayManager;
     }
 
     /**
@@ -129,18 +131,12 @@
 
         mMode = mode;
 
-        // Get the display size and adjust it for rotation.
-        mDisplay.getDisplayInfo(mDisplayInfo);
-        mDisplayLayerStack = mDisplay.getLayerStack();
-        mDisplayRotation = mDisplayInfo.rotation;
-        if (mDisplayRotation == Surface.ROTATION_90
-                || mDisplayRotation == Surface.ROTATION_270) {
-            mDisplayWidth = mDisplayInfo.logicalHeight;
-            mDisplayHeight = mDisplayInfo.logicalWidth;
-        } else {
-            mDisplayWidth = mDisplayInfo.logicalWidth;
-            mDisplayHeight = mDisplayInfo.logicalHeight;
-        }
+        // Get the display size and layer stack.
+        // This is not expected to change while the electron beam surface is showing.
+        DisplayInfo displayInfo = mDisplayManager.getDisplayInfo(Display.DEFAULT_DISPLAY);
+        mDisplayLayerStack = displayInfo.layerStack;
+        mDisplayWidth = displayInfo.getNaturalWidth();
+        mDisplayHeight = displayInfo.getNaturalHeight();
 
         // Prepare the surface for drawing.
         if (!tryPrepare()) {
@@ -551,24 +547,8 @@
             mSurface.setLayerStack(mDisplayLayerStack);
             mSurface.setSize(mDisplayWidth, mDisplayHeight);
 
-            switch (mDisplayRotation) {
-                case Surface.ROTATION_0:
-                    mSurface.setPosition(0, 0);
-                    mSurface.setMatrix(1, 0, 0, 1);
-                    break;
-                case Surface.ROTATION_90:
-                    mSurface.setPosition(0, mDisplayWidth);
-                    mSurface.setMatrix(0, -1, 1, 0);
-                    break;
-                case Surface.ROTATION_180:
-                    mSurface.setPosition(mDisplayWidth, mDisplayHeight);
-                    mSurface.setMatrix(-1, 0, 0, -1);
-                    break;
-                case Surface.ROTATION_270:
-                    mSurface.setPosition(mDisplayHeight, 0);
-                    mSurface.setMatrix(0, 1, -1, 0);
-                    break;
-            }
+            mSurfaceLayout = new NaturalSurfaceLayout(mDisplayManager, mSurface);
+            mSurfaceLayout.onDisplayTransaction();
         } finally {
             Surface.closeTransaction();
         }
@@ -601,6 +581,8 @@
 
     private void destroySurface() {
         if (mSurface != null) {
+            mSurfaceLayout.dispose();
+            mSurfaceLayout = null;
             Surface.openTransaction();
             try {
                 mSurface.destroy();
@@ -711,10 +693,63 @@
         pw.println("  mPrepared=" + mPrepared);
         pw.println("  mMode=" + mMode);
         pw.println("  mDisplayLayerStack=" + mDisplayLayerStack);
-        pw.println("  mDisplayRotation=" + mDisplayRotation);
         pw.println("  mDisplayWidth=" + mDisplayWidth);
         pw.println("  mDisplayHeight=" + mDisplayHeight);
         pw.println("  mSurfaceVisible=" + mSurfaceVisible);
         pw.println("  mSurfaceAlpha=" + mSurfaceAlpha);
     }
+
+    /**
+     * Keeps a surface aligned with the natural orientation of the device.
+     * Updates the position and transformation of the matrix whenever the display
+     * is rotated.  This is a little tricky because the display transaction
+     * callback can be invoked on any thread, not necessarily the thread that
+     * owns the electron beam.
+     */
+    private static final class NaturalSurfaceLayout implements DisplayTransactionListener {
+        private final DisplayManagerService mDisplayManager;
+        private Surface mSurface;
+
+        public NaturalSurfaceLayout(DisplayManagerService displayManager, Surface surface) {
+            mDisplayManager = displayManager;
+            mSurface = surface;
+            mDisplayManager.registerDisplayTransactionListener(this);
+        }
+
+        public void dispose() {
+            synchronized (this) {
+                mSurface = null;
+            }
+            mDisplayManager.unregisterDisplayTransactionListener(this);
+        }
+
+        @Override
+        public void onDisplayTransaction() {
+            synchronized (this) {
+                if (mSurface == null) {
+                    return;
+                }
+
+                DisplayInfo displayInfo = mDisplayManager.getDisplayInfo(Display.DEFAULT_DISPLAY);
+                switch (displayInfo.rotation) {
+                    case Surface.ROTATION_0:
+                        mSurface.setPosition(0, 0);
+                        mSurface.setMatrix(1, 0, 0, 1);
+                        break;
+                    case Surface.ROTATION_90:
+                        mSurface.setPosition(0, displayInfo.logicalHeight);
+                        mSurface.setMatrix(0, -1, 1, 0);
+                        break;
+                    case Surface.ROTATION_180:
+                        mSurface.setPosition(displayInfo.logicalWidth, displayInfo.logicalHeight);
+                        mSurface.setMatrix(-1, 0, 0, -1);
+                        break;
+                    case Surface.ROTATION_270:
+                        mSurface.setPosition(displayInfo.logicalWidth, 0);
+                        mSurface.setMatrix(0, 1, -1, 0);
+                        break;
+                }
+            }
+        }
+    }
 }
diff --git a/services/java/com/android/server/power/PowerManagerService.java b/services/java/com/android/server/power/PowerManagerService.java
index 2690442..7f83c17 100644
--- a/services/java/com/android/server/power/PowerManagerService.java
+++ b/services/java/com/android/server/power/PowerManagerService.java
@@ -432,7 +432,7 @@
             // The display power controller runs on the power manager service's
             // own handler thread.
             mDisplayPowerController = new DisplayPowerController(mHandler.getLooper(),
-                    mContext, mNotifier, mLightsService, twilight,
+                    mContext, mNotifier, mLightsService, twilight, mDisplayManagerService,
                     mDisplayBlanker, mDisplayPowerControllerCallbacks, mHandler);
 
             mSettingsObserver = new SettingsObserver(mHandler);
diff --git a/services/java/com/android/server/wm/AppWindowToken.java b/services/java/com/android/server/wm/AppWindowToken.java
index 7efffe5..2802ad7 100644
--- a/services/java/com/android/server/wm/AppWindowToken.java
+++ b/services/java/com/android/server/wm/AppWindowToken.java
@@ -37,6 +37,8 @@
  * really activity) that is displaying windows.
  */
 class AppWindowToken extends WindowToken {
+    // The user who owns this app window token.
+    final int userId;
     // Non-null only for application tokens.
     final IApplicationToken appToken;
 
@@ -98,9 +100,10 @@
     // Input application handle used by the input dispatcher.
     final InputApplicationHandle mInputApplicationHandle;
 
-    AppWindowToken(WindowManagerService _service, IApplicationToken _token) {
+    AppWindowToken(WindowManagerService _service, int _userId, IApplicationToken _token) {
         super(_service, _token.asBinder(),
                 WindowManager.LayoutParams.TYPE_APPLICATION, true);
+        userId = _userId;
         appWindowToken = this;
         appToken = _token;
         mInputApplicationHandle = new InputApplicationHandle(this);
@@ -225,7 +228,8 @@
     void dump(PrintWriter pw, String prefix) {
         super.dump(pw, prefix);
         if (appToken != null) {
-            pw.print(prefix); pw.println("app=true");
+            pw.print(prefix); pw.print("app=true");
+                    pw.print(" userId="); pw.println(userId);
         }
         if (allAppWindows.size() > 0) {
             pw.print(prefix); pw.print("allAppWindows="); pw.println(allAppWindows);
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 9ba83d0..003f4db 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -3200,7 +3200,7 @@
         return info;
     }
 
-    private AttributeCache.Entry getCachedAnimations(WindowManager.LayoutParams lp) {
+    private AttributeCache.Entry getCachedAnimations(int userId, WindowManager.LayoutParams lp) {
         if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: layout params pkg="
                 + (lp != null ? lp.packageName : null)
                 + " resId=0x" + (lp != null ? Integer.toHexString(lp.windowAnimations) : null));
@@ -3215,13 +3215,13 @@
             }
             if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package="
                     + packageName);
-            return AttributeCache.instance().get(packageName, resId,
+            return AttributeCache.instance().get(userId, packageName, resId,
                     com.android.internal.R.styleable.WindowAnimation);
         }
         return null;
     }
 
-    private AttributeCache.Entry getCachedAnimations(String packageName, int resId) {
+    private AttributeCache.Entry getCachedAnimations(int userId, String packageName, int resId) {
         if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: package="
                 + packageName + " resId=0x" + Integer.toHexString(resId));
         if (packageName != null) {
@@ -3230,17 +3230,17 @@
             }
             if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package="
                     + packageName);
-            return AttributeCache.instance().get(packageName, resId,
+            return AttributeCache.instance().get(userId, packageName, resId,
                     com.android.internal.R.styleable.WindowAnimation);
         }
         return null;
     }
 
-    Animation loadAnimation(WindowManager.LayoutParams lp, int animAttr) {
+    Animation loadAnimation(int userId, WindowManager.LayoutParams lp, int animAttr) {
         int anim = 0;
         Context context = mContext;
         if (animAttr >= 0) {
-            AttributeCache.Entry ent = getCachedAnimations(lp);
+            AttributeCache.Entry ent = getCachedAnimations(userId, lp);
             if (ent != null) {
                 context = ent.context;
                 anim = ent.array.getResourceId(animAttr, 0);
@@ -3252,11 +3252,11 @@
         return null;
     }
 
-    private Animation loadAnimation(String packageName, int resId) {
+    private Animation loadAnimation(int userId, String packageName, int resId) {
         int anim = 0;
         Context context = mContext;
         if (resId >= 0) {
-            AttributeCache.Entry ent = getCachedAnimations(packageName, resId);
+            AttributeCache.Entry ent = getCachedAnimations(userId, packageName, resId);
             if (ent != null) {
                 context = ent.context;
                 anim = resId;
@@ -3484,7 +3484,7 @@
             Animation a;
             boolean initialized = false;
             if (mNextAppTransitionType == ActivityOptions.ANIM_CUSTOM) {
-                a = loadAnimation(mNextAppTransitionPackage, enter ?
+                a = loadAnimation(atoken.userId, mNextAppTransitionPackage, enter ?
                         mNextAppTransitionEnter : mNextAppTransitionExit);
                 if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
                         "applyAnimation: atoken=" + atoken
@@ -3565,7 +3565,7 @@
                                 : com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseExitAnimation;
                         break;
                 }
-                a = animAttr != 0 ? loadAnimation(lp, animAttr) : null;
+                a = animAttr != 0 ? loadAnimation(atoken.userId, lp, animAttr) : null;
                 if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
                         "applyAnimation: atoken=" + atoken
                         + " anim=" + a
@@ -3752,7 +3752,7 @@
     }
 
     @Override
-    public void addAppToken(int addPos, IApplicationToken token,
+    public void addAppToken(int addPos, int userId, IApplicationToken token,
             int groupId, int requestedOrientation, boolean fullscreen, boolean showWhenLocked) {
         if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
                 "addAppToken()")) {
@@ -3779,7 +3779,7 @@
                 Slog.w(TAG, "Attempted to add existing app token: " + token);
                 return;
             }
-            atoken = new AppWindowToken(this, token);
+            atoken = new AppWindowToken(this, userId, token);
             atoken.inputDispatchingTimeoutNanos = inputDispatchingTimeoutNanos;
             atoken.groupId = groupId;
             atoken.appFullscreen = fullscreen;
@@ -4396,8 +4396,8 @@
             if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Checking theme of starting window: 0x"
                     + Integer.toHexString(theme));
             if (theme != 0) {
-                AttributeCache.Entry ent = AttributeCache.instance().get(pkg, theme,
-                        com.android.internal.R.styleable.Window);
+                AttributeCache.Entry ent = AttributeCache.instance().get(wtoken.userId,
+                        pkg, theme, com.android.internal.R.styleable.Window);
                 if (ent == null) {
                     // Whoops!  App doesn't exist.  Um.  Okay.  We'll just
                     // pretend like we didn't see that.
diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java
index d7fcc67..10784fe 100644
--- a/services/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/java/com/android/server/wm/WindowStateAnimator.java
@@ -14,6 +14,7 @@
 import android.graphics.Rect;
 import android.graphics.Region;
 import android.os.Debug;
+import android.os.UserHandle;
 import android.util.Slog;
 import android.view.DisplayInfo;
 import android.view.Surface;
@@ -1533,7 +1534,8 @@
                         break;
                 }
                 if (attr >= 0) {
-                    a = mService.loadAnimation(mWin.mAttrs, attr);
+                    a = mService.loadAnimation(UserHandle.getUserId(mWin.mOwnerUid),
+                            mWin.mAttrs, attr);
                 }
             }
             if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG,
diff --git a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
index af74da2..e2cb65d 100644
--- a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
+++ b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
@@ -17,9 +17,9 @@
 
 import android.app.ActivityManager;
 import android.app.ActivityManager.ProcessErrorStateInfo;
-import android.app.IActivityManager.WaitResult;
 import android.app.ActivityManagerNative;
 import android.app.IActivityManager;
+import android.app.IActivityManager.WaitResult;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
@@ -70,7 +70,9 @@
         for (String app : mNameToResultKey.keySet()) {
             try {
                 startApp(app, results);
-                closeApp();
+                sleep(750);
+                closeApp(app);
+                sleep(2000);
             } catch (NameNotFoundException e) {
                 Log.i(TAG, "Application " + app + " not found");
             }
@@ -147,16 +149,23 @@
             return;
         }
         results.putString(mNameToResultKey.get(appName), String.valueOf(result.thisTime));
-        sleep(1000);
     }
 
-    private void closeApp() {
+    private void closeApp(String appName) {
         Intent homeIntent = new Intent(Intent.ACTION_MAIN);
         homeIntent.addCategory(Intent.CATEGORY_HOME);
         homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                 | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
         getInstrumentation().getContext().startActivity(homeIntent);
-        sleep(1000);
+        Intent startIntent = mNameToIntent.get(appName);
+        if (startIntent != null) {
+            String packageName = startIntent.getComponent().getPackageName();
+            try {
+                mAm.forceStopPackage(packageName, UserHandle.USER_CURRENT);
+            } catch (RemoteException e) {
+                Log.w(TAG, "Error closing app", e);
+            }
+        }
     }
 
     private void sleep(int time) {
diff --git a/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java b/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java
index 746ac06..596f722 100644
--- a/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java
+++ b/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java
@@ -93,7 +93,7 @@
         }
         
         try {
-            mWm.addAppToken(0, null, 0, 0, false, false);
+            mWm.addAppToken(0, 0, null, 0, 0, false, false);
             fail("IWindowManager.addAppToken did not throw SecurityException as"
                     + " expected");
         } catch (SecurityException e) {
diff --git a/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java b/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
index 3e625f9..091c6e5 100644
--- a/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
+++ b/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
@@ -87,7 +87,7 @@
     // ---- unused implementation of IWindowManager ----
 
     @Override
-    public void addAppToken(int arg0, IApplicationToken arg1, int arg2, int arg3, boolean arg4,
+    public void addAppToken(int arg0, int arg1p5, IApplicationToken arg1, int arg2, int arg3, boolean arg4,
                             boolean arg5)
             throws RemoteException {
         // TODO Auto-generated method stub