summaryrefslogtreecommitdiffstats
path: root/core/java/android/app/ActivityThread.java
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-09-25 09:34:42 -0700
committerJean-Baptiste Queru <jbq@google.com>2012-09-25 09:34:45 -0700
commit7a7c6aa0c35d80145e163d9e637180d3be127441 (patch)
treee14816d5c053ad68a1658eb6573e51ac30125d21 /core/java/android/app/ActivityThread.java
parent641c36f918aa549c192aff129dcb01aa3e558a6b (diff)
parentefd43bdb831351f1b0332ec3d55197e61e38bbb3 (diff)
downloadframeworks_base-7a7c6aa0c35d80145e163d9e637180d3be127441.zip
frameworks_base-7a7c6aa0c35d80145e163d9e637180d3be127441.tar.gz
frameworks_base-7a7c6aa0c35d80145e163d9e637180d3be127441.tar.bz2
Merge into jb-mr1-dev
Change-Id: I821410e9ffcc7148139465c04ef335f0becc18c2
Diffstat (limited to 'core/java/android/app/ActivityThread.java')
-rw-r--r--core/java/android/app/ActivityThread.java30
1 files changed, 27 insertions, 3 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index aa8ef21..e613e04 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -65,6 +65,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.SystemClock;
+import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.util.AndroidRuntimeException;
@@ -2114,9 +2115,7 @@ public final class ActivityThread {
+ ", dir=" + r.packageInfo.getAppDir());
if (activity != null) {
- ContextImpl appContext = new ContextImpl();
- appContext.init(r.packageInfo, r.token, this);
- appContext.setOuterContext(activity);
+ Context appContext = createBaseContextForActivity(r, activity);
CharSequence title = r.activityInfo.loadLabel(appContext.getPackageManager());
Configuration config = new Configuration(mCompatConfiguration);
if (DEBUG_CONFIGURATION) Slog.v(TAG, "Launching activity "
@@ -2181,6 +2180,31 @@ public final class ActivityThread {
return activity;
}
+ private Context createBaseContextForActivity(ActivityClientRecord r,
+ final Activity activity) {
+ ContextImpl appContext = new ContextImpl();
+ appContext.init(r.packageInfo, r.token, this);
+ appContext.setOuterContext(activity);
+
+ // 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);
+ baseContext = appContext.createDisplayContext(display);
+ break;
+ }
+ }
+ }
+ return baseContext;
+ }
+
private void handleLaunchActivity(ActivityClientRecord r, Intent customIntent) {
// If we are getting ready to gc after going to the background, well
// we are back active so skip it.