diff options
author | Jose Lima <joselima@google.com> | 2014-05-27 20:00:27 -0700 |
---|---|---|
committer | Jose Lima <joselima@google.com> | 2014-05-27 20:55:11 -0700 |
commit | 58e66d69f9f239a444a90c7ff5eae32557fe350c (patch) | |
tree | c950654b1255cc5ed236c7b478ad1e9126ba4e8d /services | |
parent | bbd8e6ffc600e078984cb68acf51c660c5c9fc81 (diff) | |
download | frameworks_base-58e66d69f9f239a444a90c7ff5eae32557fe350c.zip frameworks_base-58e66d69f9f239a444a90c7ff5eae32557fe350c.tar.gz frameworks_base-58e66d69f9f239a444a90c7ff5eae32557fe350c.tar.bz2 |
Only allow 1 Stack on Leanback-only devices
- For Leanback only devices we will force all activities to
live in the same app stack. This is a design decision for the
shy/gregarious changes we are planning to implement for
leanback devices.
Change-Id: I5e65f9b079830a9485b5a136700993755c3f555f
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/am/ActivityStackSupervisor.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index ae7fab3..f487536 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -207,6 +207,10 @@ public final class ActivityStackSupervisor implements DisplayListener { /** Set when we have taken too long waiting to go to sleep. */ boolean mSleepTimeout = false; + /** Indicates if we are running on a Leanback-only (TV) device. Only initialized after + * setWindowManager is called. **/ + private boolean mLeanbackOnlyDevice; + /** * We don't want to allow the device to go to sleep while in the process * of launching an activity. This is primarily to allow alarm intent @@ -271,6 +275,9 @@ public final class ActivityStackSupervisor implements DisplayListener { mHomeStack = mFocusedStack = mLastFocusedStack = getStack(HOME_STACK_ID); mInputManagerInternal = LocalServices.getService(InputManagerInternal.class); + + // Initialize this here, now that we can get a valid reference to PackageManager. + mLeanbackOnlyDevice = isLeanbackOnlyDevice(); } } @@ -1387,7 +1394,10 @@ public final class ActivityStackSupervisor implements DisplayListener { ActivityStack adjustStackFocus(ActivityRecord r, boolean newTask) { final TaskRecord task = r.task; - if (r.isApplicationActivity() || (task != null && task.isApplicationTask())) { + + // On leanback only devices we should keep all activities in the same stack. + if (!mLeanbackOnlyDevice && + (r.isApplicationActivity() || (task != null && task.isApplicationTask()))) { if (task != null) { final ActivityStack taskStack = task.stack; if (taskStack.isOnHomeDisplay()) { @@ -3440,4 +3450,16 @@ public final class ActivityStackSupervisor implements DisplayListener { return "VirtualActivityDisplay={" + mDisplayId + "}"; } } + + private boolean isLeanbackOnlyDevice() { + boolean onLeanbackOnly = false; + try { + onLeanbackOnly = AppGlobals.getPackageManager().hasSystemFeature( + PackageManager.FEATURE_LEANBACK_ONLY); + } catch (RemoteException e) { + // noop + } + + return onLeanbackOnly; + } } |