From bf589bb5b6939fb6e5586c58bc35ad74916f3b0c Mon Sep 17 00:00:00 2001 From: Jeff Chang Date: Thu, 20 Dec 2018 20:19:58 +0800 Subject: [PATCH] Introduce the display ID to TaskKey Let the recents app to know the recent task was running from which display. Bug: 118266305 Test: 1. atest ActivityManagerRecentTaskInfoTest 2. atest TaskRecordTests Change-Id: Ief2538056d414d8317b495ea45d50ccb2dc4518f --- .../recents/model/RecentsTaskLoadPlan.java | 2 +- .../systemui/shared/recents/model/Task.java | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java index 7c6a76f1e25da..2df79d87b1fe9 100644 --- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java +++ b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java @@ -113,7 +113,7 @@ public class RecentsTaskLoadPlan { : t.realActivity; final int windowingMode = t.configuration.windowConfiguration.getWindowingMode(); TaskKey taskKey = new TaskKey(t.persistentId, windowingMode, t.baseIntent, - sourceComponent, t.userId, t.lastActiveTime); + sourceComponent, t.userId, t.lastActiveTime, t.displayId); boolean isFreeformTask = windowingMode == WINDOWING_MODE_FREEFORM; boolean isStackTask = !isFreeformTask; diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/Task.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/Task.java index 7558efae6c230..5b9ee1c47e870 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/Task.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/Task.java @@ -16,6 +16,8 @@ package com.android.systemui.shared.recents.model; +import static android.view.Display.DEFAULT_DISPLAY; + import android.app.ActivityManager; import android.app.ActivityManager.TaskDescription; import android.content.ComponentName; @@ -62,6 +64,12 @@ public class Task { @ViewDebug.ExportedProperty(category="recents") public long lastActiveTime; + /** + * The id of the task was running from which display. + */ + @ViewDebug.ExportedProperty(category = "recents") + public final int displayId; + // The source component name which started this task public final ComponentName sourceComponent; @@ -79,6 +87,7 @@ public class Task { this.sourceComponent = sourceComponent; this.userId = t.userId; this.lastActiveTime = t.lastActiveTime; + this.displayId = t.displayId; updateHashCode(); } @@ -90,6 +99,19 @@ public class Task { this.sourceComponent = sourceComponent; this.userId = userId; this.lastActiveTime = lastActiveTime; + this.displayId = DEFAULT_DISPLAY; + updateHashCode(); + } + + public TaskKey(int id, int windowingMode, Intent intent, + ComponentName sourceComponent, int userId, long lastActiveTime, int displayId) { + this.id = id; + this.windowingMode = windowingMode; + this.baseIntent = intent; + this.sourceComponent = sourceComponent; + this.userId = userId; + this.lastActiveTime = lastActiveTime; + this.displayId = displayId; updateHashCode(); }