OSDN Git Service

Fix NPE when checking if recents should be launched in docked mode.
authorFilip Gruszczynski <gruszczy@google.com>
Sun, 17 Jan 2016 17:12:31 +0000 (09:12 -0800)
committerFilip Gruszczynski <gruszczy@google.com>
Sun, 17 Jan 2016 17:14:57 +0000 (09:14 -0800)
In some cases the activity starting method might return early with
positive return code, even though it skipped doing most of the work
and the target stack is not set. We need to protect ourselves from
an NPE in that case.

Bug: 26541093

Change-Id: I7227ad8efa30c52dd8178ad3c9d8b2263c89a74f

services/core/java/com/android/server/am/ActivityStarter.java

index 58c14f1..ab0263c 100644 (file)
@@ -1034,7 +1034,8 @@ class ActivityStarter {
     }
 
     private void launchRecentsAppIfNeeded(ActivityStack topStack) {
-        if (topStack.mStackId == HOME_STACK_ID && mTargetStack.mStackId == DOCKED_STACK_ID) {
+        if (topStack.mStackId == HOME_STACK_ID && mTargetStack != null
+                && mTargetStack.mStackId == DOCKED_STACK_ID) {
             // We launch an activity while being in home stack, which means either launcher or
             // recents into docked stack. We don't want the launched activity to be alone in a
             // docked stack, so we want to immediately launch recents too.