Merge "Override StatusHints.equals" into lmp-dev
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index a326aad..4d35509 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -701,8 +701,13 @@
             final boolean forceHwAccelerated = (attrs.privateFlags &
                     WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED) != 0;
 
-            if (!HardwareRenderer.sRendererDisabled || (HardwareRenderer.sSystemRendererDisabled
-                    && forceHwAccelerated)) {
+            if (fakeHwAccelerated) {
+                // This is exclusively for the preview windows the window manager
+                // shows for launching applications, so they will look more like
+                // the app being launched.
+                mAttachInfo.mHardwareAccelerationRequested = true;
+            } else if (!HardwareRenderer.sRendererDisabled
+                    || (HardwareRenderer.sSystemRendererDisabled && forceHwAccelerated)) {
                 if (mAttachInfo.mHardwareRenderer != null) {
                     mAttachInfo.mHardwareRenderer.destroy();
                 }
@@ -714,13 +719,6 @@
                     mAttachInfo.mHardwareAccelerated =
                             mAttachInfo.mHardwareAccelerationRequested = true;
                 }
-            } else if (fakeHwAccelerated) {
-                // The window had wanted to use hardware acceleration, but this
-                // is not allowed in its process.  By setting this flag, it can
-                // still render as if it was accelerated.  This is basically for
-                // the preview windows the window manager shows for launching
-                // applications, so they will look more like the app being launched.
-                mAttachInfo.mHardwareAccelerationRequested = true;
             }
         }
     }
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 4a99ef3..3d23cb7 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -1714,7 +1714,7 @@
                         // the activity based on affinity...  now that we
                         // are actually launching it, we can assign the
                         // base intent.
-                        intentActivity.task.setIntent(intent, r.info);
+                        intentActivity.task.setIntent(r);
                     }
                     // If the target task is not in the front, then we need
                     // to bring it to the front...  except...  well, with
@@ -1771,7 +1771,7 @@
                         // not be too hard...
                         reuseTask = intentActivity.task;
                         reuseTask.performClearTaskLocked();
-                        reuseTask.setIntent(r.intent, r.info);
+                        reuseTask.setIntent(r);
                     } else if ((launchFlags&Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0
                             || launchSingleInstance || launchSingleTask) {
                         // In this situation we want to remove all activities
@@ -1786,7 +1786,7 @@
                                 // intents for the top activity, so make sure
                                 // the task now has the identity of the new
                                 // intent.
-                                top.task.setIntent(r.intent, r.info);
+                                top.task.setIntent(r);
                             }
                             ActivityStack.logStartActivity(EventLogTags.AM_NEW_INTENT,
                                     r, top.task);
@@ -1815,7 +1815,7 @@
                             ActivityStack.logStartActivity(EventLogTags.AM_NEW_INTENT, r,
                                     intentActivity.task);
                             if (intentActivity.frontOfTask) {
-                                intentActivity.task.setIntent(r.intent, r.info);
+                                intentActivity.task.setIntent(r);
                             }
                             intentActivity.deliverNewIntentLocked(callingUid, r.intent);
                         } else if (!r.intent.filterEquals(intentActivity.task.intent)) {
@@ -1841,7 +1841,7 @@
                         // at the bottom of its stack, but that's a little hard
                         // to do with the current organization of the code so
                         // for now we'll just drop it.
-                        intentActivity.task.setIntent(r.intent, r.info);
+                        intentActivity.task.setIntent(r);
                     }
                     if (!addingToTask && reuseTask == null) {
                         // We didn't do anything...  but it was needed (a.k.a., client
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index d0ec106..ccca657 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -220,7 +220,15 @@
         return System.currentTimeMillis() - lastActiveTime;
     }
 
-    void setIntent(Intent _intent, ActivityInfo info) {
+    /** Sets the original intent, and the calling uid and package. */
+    void setIntent(ActivityRecord r) {
+        setIntent(r.intent, r.info);
+        mCallingUid = r.launchedFromUid;
+        mCallingPackage = r.launchedFromPackage;
+    }
+
+    /** Sets the original intent, _without_ updating the calling uid or package. */
+    private void setIntent(Intent _intent, ActivityInfo info) {
         if (intent == null) {
             mNeverRelinquishIdentity =
                     (info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0;
@@ -723,7 +731,7 @@
     void updateEffectiveIntent() {
         final int effectiveRootIndex = findEffectiveRootIndex();
         final ActivityRecord r = mActivities.get(effectiveRootIndex);
-        setIntent(r.intent, r.info);
+        setIntent(r);
     }
 
     void saveTaskDescription(ActivityManager.TaskDescription taskDescription,