Merge "Ignore task-info changed callbacks in uninitialized Divider" into rvc-dev am: 695a430cb5

Change-Id: Ib4f7966acdd84eacf916b38e45bfc4a8cc36f608
This commit is contained in:
Evan Rosky
2020-04-22 18:43:48 +00:00
committed by Automerger Merge Worker
2 changed files with 10 additions and 9 deletions

View File

@@ -33,10 +33,8 @@ import android.view.SurfaceControl;
import android.view.SurfaceSession;
import android.window.TaskOrganizer;
import java.util.ArrayList;
class SplitScreenTaskOrganizer extends TaskOrganizer {
private static final String TAG = "SplitScreenTaskOrganizer";
private static final String TAG = "SplitScreenTaskOrg";
private static final boolean DEBUG = Divider.DEBUG;
RunningTaskInfo mPrimary;
@@ -45,7 +43,6 @@ class SplitScreenTaskOrganizer extends TaskOrganizer {
SurfaceControl mSecondarySurface;
SurfaceControl mPrimaryDim;
SurfaceControl mSecondaryDim;
ArrayList<SurfaceControl> mHomeAndRecentsSurfaces = new ArrayList<>();
Rect mHomeBounds = new Rect();
final Divider mDivider;
private boolean mSplitScreenSupported = false;
@@ -110,6 +107,15 @@ class SplitScreenTaskOrganizer extends TaskOrganizer {
* presentations based on the contents of the split regions.
*/
private void handleTaskInfoChanged(RunningTaskInfo info) {
if (!mSplitScreenSupported) {
// This shouldn't happen; but apparently there is a chance that SysUI crashes without
// system server receiving binder-death (or maybe it receives binder-death too late?).
// In this situation, when sys-ui restarts, the split root-tasks will still exist so
// there is a small window of time during init() where WM might send messages here
// before init() fails. So, avoid a cycle of crashes by returning early.
Log.e(TAG, "Got handleTaskInfoChanged when not initialized: " + info);
return;
}
final boolean secondaryWasHomeOrRecents = mSecondary.topActivityType == ACTIVITY_TYPE_HOME
|| mSecondary.topActivityType == ACTIVITY_TYPE_RECENTS;
final boolean primaryWasEmpty = mPrimary.topActivityType == ACTIVITY_TYPE_UNDEFINED;

View File

@@ -174,12 +174,8 @@ public class WindowManagerProxy {
if (rootTasks.isEmpty()) {
return false;
}
tiles.mHomeAndRecentsSurfaces.clear();
for (int i = rootTasks.size() - 1; i >= 0; --i) {
final ActivityManager.RunningTaskInfo rootTask = rootTasks.get(i);
if (isHomeOrRecentTask(rootTask)) {
tiles.mHomeAndRecentsSurfaces.add(rootTask.token.getLeash());
}
// Only move resizeable task to split secondary. WM will just ignore this anyways...
if (!rootTask.isResizable()) continue;
// Only move fullscreen tasks to split secondary.
@@ -211,7 +207,6 @@ public class WindowManagerProxy {
// Set launch root first so that any task created after getChildContainers and
// before reparent (pretty unlikely) are put into fullscreen.
TaskOrganizer.setLaunchRoot(Display.DEFAULT_DISPLAY, null);
tiles.mHomeAndRecentsSurfaces.clear();
// TODO(task-org): Once task-org is more complete, consider using Appeared/Vanished
// plus specific APIs to clean this up.
List<ActivityManager.RunningTaskInfo> primaryChildren =