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

Commit 08774f2f authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Remove ActivityRecord#okToShowLocked" into sc-v2-dev

parents 296e07d9 b8728418
Loading
Loading
Loading
Loading
+3 −18
Original line number Diff line number Diff line
@@ -285,7 +285,6 @@ import android.os.RemoteException;
import android.os.SystemClock;
import android.os.Trace;
import android.os.UserHandle;
import android.os.storage.StorageManager;
import android.service.contentcapture.ActivityEvent;
import android.service.dreams.DreamActivity;
import android.service.dreams.DreamManagerInternal;
@@ -730,7 +729,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    // TODO: rename to mNoDisplay
    @VisibleForTesting
    boolean noDisplay;
    boolean mShowForAllUsers;
    final boolean mShowForAllUsers;
    // TODO: Make this final
    int mTargetSdk;

@@ -5304,7 +5303,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    void updateVisibilityIgnoringKeyguard(boolean behindFullscreenActivity) {
        visibleIgnoringKeyguard = (!behindFullscreenActivity || mLaunchTaskBehind)
                && okToShowLocked();
                && showToCurrentUser();
    }

    boolean shouldBeVisible() {
@@ -6341,22 +6340,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        return this;
    }

    /** Checks whether the activity should be shown for current user. */
    public boolean okToShowLocked() {
        // We cannot show activities when the device is locked and the application is not
        // encryption aware.
        if (!StorageManager.isUserKeyUnlocked(mUserId)
                && !info.applicationInfo.isEncryptionAware()) {
            return false;
        }

        return (info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0
                || (mTaskSupervisor.isCurrentProfileLocked(mUserId)
                && mAtmService.mAmInternal.isUserRunning(mUserId, 0 /* flags */));
    }

    boolean canBeTopRunning() {
        return !finishing && okToShowLocked();
        return !finishing && showToCurrentUser();
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -2357,7 +2357,7 @@ class ActivityStarter {
        // of this in the record so that we can skip it when trying to find
        // the top running activity.
        mDoResume = doResume;
        if (!doResume || !r.okToShowLocked() || mLaunchTaskBehind) {
        if (!doResume || !r.showToCurrentUser() || mLaunchTaskBehind) {
            r.delayedResume = true;
            mDoResume = false;
        }
+0 −6
Original line number Diff line number Diff line
@@ -1872,12 +1872,6 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
        mHandler.obtainMessage(LAUNCH_TASK_BEHIND_COMPLETE, token).sendToTarget();
    }

    /** Checks whether the userid is a profile of the current user. */
    boolean isCurrentProfileLocked(int userId) {
        if (userId == mRootWindowContainer.mCurrentUser) return true;
        return mService.mAmInternal.isCurrentProfile(userId);
    }

    /**
     * Processes the activities to be stopped or destroyed. This should be called when the resumed
     * activities are idle or drawn.
+1 −1
Original line number Diff line number Diff line
@@ -1965,7 +1965,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>

    private boolean startActivityForAttachedApplicationIfNeeded(ActivityRecord r,
            WindowProcessController app, ActivityRecord top) {
        if (r.finishing || !r.okToShowLocked() || !r.visibleIgnoringKeyguard || r.app != null
        if (r.finishing || !r.showToCurrentUser() || !r.visibleIgnoringKeyguard || r.app != null
                || app.mUid != r.info.applicationInfo.uid || !app.mName.equals(r.processName)) {
            return false;
        }
+2 −2
Original line number Diff line number Diff line
@@ -5159,7 +5159,7 @@ class Task extends TaskFragment {
                }

                final ActivityRecord prev = baseTask.getActivity(
                        a -> a.mStartingData != null && a.okToShowLocked());
                        a -> a.mStartingData != null && a.showToCurrentUser());
                r.showStartingWindow(prev, newTask, isTaskSwitch,
                        true /* startActivity */, sourceRecord);
            }
@@ -5530,7 +5530,7 @@ class Task extends TaskFragment {

            // Don't refocus if invisible to current user
            final ActivityRecord top = tr.getTopNonFinishingActivity();
            if (top == null || !top.okToShowLocked()) {
            if (top == null || !top.showToCurrentUser()) {
                positionChildAtTop(tr);
                if (top != null) {
                    mTaskSupervisor.mRecentTasks.add(top.getTask());
Loading