OSDN Git Service

Fixing issue with screen pinning screen not showing for secondary users.
authorWinson <winsonc@google.com>
Wed, 15 Jun 2016 19:31:03 +0000 (12:31 -0700)
committerWinson <winsonc@google.com>
Wed, 15 Jun 2016 21:01:58 +0000 (14:01 -0700)
- Catch the exception when removing a view that is not yet attached.
  This is not an issue because we are in the process of attaching it for
  the first time anyways.
- Ensure that we post the calls from the secondary user in the main
  thread for the system user.  Especially since this calls through to
  add the view for the new screen pinning window.

Bug: 29341417
Change-Id: If0e29a77ddb67426115f1d5d9f1adb580a1f07df

packages/SystemUI/src/com/android/systemui/recents/RecentsSystemUser.java
packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java

index 913da18..3921a20 100644 (file)
@@ -30,6 +30,7 @@ import com.android.systemui.recents.events.EventBus;
 import com.android.systemui.recents.events.activity.DockedTopTaskEvent;
 import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
 import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
+import com.android.systemui.recents.misc.ForegroundThread;
 
 /**
  * An implementation of the system user's Recents interface to be called remotely by secondary
@@ -78,12 +79,16 @@ public class RecentsSystemUser extends IRecentsSystemUserCallbacks.Stub {
 
     @Override
     public void updateRecentsVisibility(boolean visible) {
-        mImpl.onVisibilityChanged(mContext, visible);
+        ForegroundThread.getHandler().post(() -> {
+            mImpl.onVisibilityChanged(mContext, visible);
+        });
     }
 
     @Override
     public void startScreenPinning(int taskId) {
-        mImpl.onStartScreenPinning(mContext, taskId);
+        ForegroundThread.getHandler().post(() -> {
+            mImpl.onStartScreenPinning(mContext, taskId);
+        });
     }
 
     @Override
index 992b13f..b961055 100644 (file)
@@ -72,7 +72,12 @@ public class ScreenPinningRequest implements View.OnClickListener {
     }
 
     public void showPrompt(int taskId, boolean allowCancel) {
-        clearPrompt();
+        try {
+            clearPrompt();
+        } catch (IllegalArgumentException e) {
+            // If the call to show the prompt fails due to the request window not already being
+            // attached, then just ignore the error since we will be re-adding it below.
+        }
 
         this.taskId = taskId;