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

Commit e814b85e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Don't show the embedded activities if visible needed activity without...

Merge "Don't show the embedded activities if visible needed activity without showWhenLocked" into sc-v2-dev am: ae3c5c8c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15723579

Change-Id: Icd814d7fbe2475cff30b94251b549194c5955b97
parents edfd748d ae3c5c8c
Loading
Loading
Loading
Loading
+27 −6
Original line number Original line Diff line number Diff line
@@ -4157,18 +4157,39 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     *         conditions a) above.
     *         conditions a) above.
     *         Multi-windowing mode will be exited if {@code true} is returned.
     *         Multi-windowing mode will be exited if {@code true} is returned.
     */
     */
    boolean canShowWhenLocked() {
    private static boolean canShowWhenLocked(ActivityRecord r) {
        if (!inPinnedWindowingMode() && (mShowWhenLocked || containsShowWhenLockedWindow())) {
        if (r == null || r.getTaskFragment() == null) {
            return false;
        }
        if (!r.inPinnedWindowingMode() && (r.mShowWhenLocked || r.containsShowWhenLockedWindow())) {
            return true;
            return true;
        } else if (mInheritShownWhenLocked) {
        } else if (r.mInheritShownWhenLocked) {
            final ActivityRecord r = task.getActivityBelow(this);
            final ActivityRecord activity = r.getTaskFragment().getActivityBelow(r);
            return r != null && !r.inPinnedWindowingMode() && (r.mShowWhenLocked
            return activity != null && !activity.inPinnedWindowingMode()
                    || r.containsShowWhenLockedWindow());
                    && (activity.mShowWhenLocked || activity.containsShowWhenLockedWindow());
        } else {
        } else {
            return false;
            return false;
        }
        }
    }
    }


    /**
     *  Determines if the activity can show while lock-screen is displayed. System displays
     *  activities while lock-screen is displayed only if all activities
     *  {@link #canShowWhenLocked(ActivityRecord)}.
     *  @see #canShowWhenLocked(ActivityRecord)
     */
    boolean canShowWhenLocked() {
        final TaskFragment taskFragment = getTaskFragment();
        if (taskFragment != null && taskFragment.getAdjacentTaskFragment() != null
                && taskFragment.isEmbedded()) {
            final TaskFragment adjacentTaskFragment = taskFragment.getAdjacentTaskFragment();
            final ActivityRecord r = adjacentTaskFragment.getTopNonFinishingActivity();
            return canShowWhenLocked(this) && canShowWhenLocked(r);
        } else {
            return canShowWhenLocked(this);
        }
    }

    /**
    /**
     * @return Whether we are allowed to show non-starting windows at the moment. We disallow
     * @return Whether we are allowed to show non-starting windows at the moment. We disallow
     *         showing windows during transitions in case we have windows that have wide-color-gamut
     *         showing windows during transitions in case we have windows that have wide-color-gamut