From e0a3884cb627efc650e19fbe76b1b3343468cf57 Mon Sep 17 00:00:00 2001 From: Craig Mautner Date: Mon, 16 Dec 2013 16:14:02 -0800 Subject: Extend stack management to other displays. - Abandon ActivityContainer.startActivity() in favor of IActivityManager.startActivityAsUserInContainer(). - Modify Am to test starting an activity on a container. - Create a DisplayContext as the base context if the activity token is on a different display. - Test for home display in more cases when manipulating home stack. - Rename mDisplayInfos => mActivityDisplays. - Create new method for moving task to front of stack regardless of which display it is on. Change-Id: I4fcb83ae844c5839ee3e2722229623d1a80ed921 --- core/java/android/app/ActivityThread.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'core/java/android/app/ActivityThread.java') diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index d849965..c66cd40 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -2214,15 +2214,26 @@ public final class ActivityThread { ContextImpl appContext = new ContextImpl(); appContext.init(r.packageInfo, r.token, this); appContext.setOuterContext(activity); + Context baseContext = appContext; + + final DisplayManagerGlobal dm = DisplayManagerGlobal.getInstance(); + try { + IActivityContainer container = + ActivityManagerNative.getDefault().getEnclosingActivityContainer(r.token); + final int displayId = container.getDisplayId(); + if (displayId > Display.DEFAULT_DISPLAY) { + Display display = dm.getRealDisplay(displayId, r.token); + baseContext = appContext.createDisplayContext(display); + } + } catch (RemoteException e) { + } // For debugging purposes, if the activity's package name contains the value of // the "debug.use-second-display" system property as a substring, then show // its content on a secondary display if there is one. - Context baseContext = appContext; String pkgName = SystemProperties.get("debug.second-display.pkg"); if (pkgName != null && !pkgName.isEmpty() && r.packageInfo.mPackageName.contains(pkgName)) { - DisplayManagerGlobal dm = DisplayManagerGlobal.getInstance(); for (int displayId : dm.getDisplayIds()) { if (displayId != Display.DEFAULT_DISPLAY) { Display display = dm.getRealDisplay(displayId, r.token); -- cgit v1.1