/** Set when we have taken too long waiting to go to sleep. */
boolean mSleepTimeout = false;
+ private final boolean mLeanbackOnlyDevice = isLeanbackOnlyDevice();
+
/**
* 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
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()) {
return "VirtualActivityDisplay={" + mDisplayId + "}";
}
}
+
+ private boolean isLeanbackOnlyDevice() {
+ boolean onLeanbackOnly = false;
+ try {
+ onLeanbackOnly = AppGlobals.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_LEANBACK_ONLY);
+ } catch (RemoteException e) {
+ // noop
+ }
+
+ return onLeanbackOnly;
+ }
}