summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-09-21 17:02:35 -0700
committerJeff Brown <jeffbrown@google.com>2012-09-24 14:37:25 -0700
commitefd43bdb831351f1b0332ec3d55197e61e38bbb3 (patch)
treeb6a8ec111bd057b082de3f1fdd81d72851b86fde /core
parente87bf030766198bf5e1fe846167dba766e27fb3f (diff)
downloadframeworks_base-efd43bdb831351f1b0332ec3d55197e61e38bbb3.zip
frameworks_base-efd43bdb831351f1b0332ec3d55197e61e38bbb3.tar.gz
frameworks_base-efd43bdb831351f1b0332ec3d55197e61e38bbb3.tar.bz2
Force activities to run on the second display for testing.
This is a simple hack for testing and development purposes. It makes the framework place the main window of an activity on to a secondary display instead of on the default display. Set the "debug.second-display.pkg" to a substring of the package name of the activity that you want to have show up on the secondary display, such as "com.example.android.apis" Bug: 7183618 Change-Id: I0a9e7f27c8ff253253b9de57d4bc49f31d95a0e2
Diffstat (limited to 'core')
-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 67ecf5b..640f083 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;
@@ -2089,9 +2090,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 "
@@ -2156,6 +2155,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.