Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82279696 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Removed use of leanback mode in ActivityManager."

parents c5874fb8 8b06a583
Loading
Loading
Loading
Loading
+55 −76
Original line number Diff line number Diff line
@@ -295,10 +295,6 @@ 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
@@ -446,9 +442,6 @@ 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();
        }
    }

@@ -1780,9 +1773,9 @@ public final class ActivityStackSupervisor implements DisplayListener {
    ActivityStack computeStackFocus(ActivityRecord r, boolean newTask, Rect bounds) {
        final TaskRecord task = r.task;

        // On leanback only devices we should keep all activities in the same stack.
        if (!mLeanbackOnlyDevice &&
                (r.isApplicationActivity() || (task != null && task.isApplicationTask()))) {
        if (!(r.isApplicationActivity() || (task != null && task.isApplicationTask()))) {
            return mHomeStack;
        }

        ActivityStack stack;

@@ -1843,8 +1836,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
                + r + " stackId=" + stack.mStackId);
        return stack;
    }
        return mHomeStack;
    }

    boolean setFocusedStack(ActivityRecord r, String reason) {
        if (r == null) {
@@ -3198,7 +3189,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
     */
    private boolean restoreRecentTaskLocked(TaskRecord task, int stackId) {
        if (stackId == INVALID_STACK_ID) {
            stackId = mLeanbackOnlyDevice ? mHomeStack.mStackId : task.getLaunchStackId();
            stackId = task.getLaunchStackId();
        }
        if (task.stack != null) {
            // Task has already been restored once. See if we need to do anything more
@@ -4924,18 +4915,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
        }
    }

    private boolean isLeanbackOnlyDevice() {
        boolean onLeanbackOnly = false;
        try {
            onLeanbackOnly = AppGlobals.getPackageManager().hasSystemFeature(
                    PackageManager.FEATURE_LEANBACK_ONLY);
        } catch (RemoteException e) {
            // noop
        }

        return onLeanbackOnly;
    }

    /**
     * Adjust bounds to stay within stack bounds.
     *