From 534e85494eb345bb5c8b61e7d2b3247bc3eb4109 Mon Sep 17 00:00:00 2001 From: Matthew Ng Date: Mon, 16 Oct 2017 14:34:52 -0700 Subject: [PATCH] Prevent dismiss divider going minimized to recents for other users The bus event DockedFirstAnimationFrameEvent was not fired to DividerView from secondary to system user so the last snap target for DividerView was not recorded instead the bottom of the screen was the last target. Since the bottom of the screen is last recorded, when unminimizing, the dividerview goes to the bottom of the screen and dismisses. This is fixed by piping the event from the secondary to system user so that DividerView can get the event. Fixes: 67326180 Test: manual - go to secondary user, drag to dock and minimize, press recents button Change-Id: Icd7497c49826d04dc907ef2eff3a5248e78ef67b --- .../recents/IRecentsSystemUserCallbacks.aidl | 1 + .../com/android/systemui/recents/Recents.java | 18 ++++++++++++++++++ .../systemui/recents/RecentsSystemUser.java | 6 ++++++ 3 files changed, 25 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/recents/IRecentsSystemUserCallbacks.aidl b/packages/SystemUI/src/com/android/systemui/recents/IRecentsSystemUserCallbacks.aidl index cc7798e8721b4..58d8d8fd600ad 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/IRecentsSystemUserCallbacks.aidl +++ b/packages/SystemUI/src/com/android/systemui/recents/IRecentsSystemUserCallbacks.aidl @@ -31,5 +31,6 @@ oneway interface IRecentsSystemUserCallbacks { void sendRecentsDrawnEvent(); void sendDockingTopTaskEvent(int dragMode, in Rect initialRect); void sendLaunchRecentsEvent(); + void sendDockedFirstAnimationFrameEvent(); void setWaitingForTransitionStartEvent(boolean waitingForTransitionStart); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java index b96bd9b2d7cbc..ed4e674c0a552 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java @@ -53,6 +53,7 @@ import com.android.systemui.RecentsComponent; import com.android.systemui.SystemUI; import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.activity.ConfigurationChangedEvent; +import com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent; import com.android.systemui.recents.events.activity.DockedTopTaskEvent; import com.android.systemui.recents.events.activity.LaunchTaskFailedEvent; import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent; @@ -596,6 +597,23 @@ public class Recents extends SystemUI } } + public final void onBusEvent(DockedFirstAnimationFrameEvent event) { + SystemServicesProxy ssp = Recents.getSystemServices(); + int processUser = ssp.getProcessUser(); + if (!ssp.isSystemUser(processUser)) { + postToSystemUser(new Runnable() { + @Override + public void run() { + try { + mUserToSystemCallbacks.sendDockedFirstAnimationFrameEvent(); + } catch (RemoteException e) { + Log.e(TAG, "Callback failed", e); + } + } + }); + } + } + /** * Handle screen pinning request. */ diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsSystemUser.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsSystemUser.java index 1285626015d21..ff1f7dc5a2a8a 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsSystemUser.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsSystemUser.java @@ -27,6 +27,7 @@ import android.util.SparseArray; import com.android.systemui.EventLogConstants; import com.android.systemui.EventLogTags; import com.android.systemui.recents.events.EventBus; +import com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent; import com.android.systemui.recents.events.activity.DockedTopTaskEvent; import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent; import com.android.systemui.recents.events.component.SetWaitingForTransitionStartEvent; @@ -107,6 +108,11 @@ public class RecentsSystemUser extends IRecentsSystemUserCallbacks.Stub { EventBus.getDefault().post(new RecentsActivityStartingEvent()); } + @Override + public void sendDockedFirstAnimationFrameEvent() throws RemoteException { + EventBus.getDefault().post(new DockedFirstAnimationFrameEvent()); + } + @Override public void setWaitingForTransitionStartEvent(boolean waitingForTransitionStart) { EventBus.getDefault().post(new SetWaitingForTransitionStartEvent(