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

Commit c45d739d authored by Tony Mak's avatar Tony Mak Committed by android-build-merger
Browse files

Show work challenge directly when there is no device lock

am: 8c536f91

* commit '8c536f91':
  Show work challenge directly when there is no device lock
parents 88d33911 8c536f91
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -11420,7 +11420,20 @@ public final class ActivityManagerService extends ActivityManagerNative
                final long ident = Binder.clearCallingIdentity();
                try {
                    final int currentUserId = mUserController.getCurrentUserIdLocked();
                    startHomeActivityLocked(currentUserId, "notifyProfileLocked");
                    // Get the focused task before launching launcher.
                    final int taskId = (mFocusedActivity == null)
                            ? -1 : mFocusedActivity.task.taskId;
                    startHomeActivityLocked(currentUserId, "notifyLockedProfile");
                    if (mUserController.isLockScreenDisabled(currentUserId)) {
                        // If there is no device lock, we first go to launcher and then resume the
                        // original task. Work challenge will be shown because we intercepted
                        // startActivityFromRecentsInner and the reason why we switch to home stack
                        // first is to prevent pressing back button brings user back to the work
                        // app.
                        if (taskId != -1) {
                            startActivityFromRecentsInner(taskId, null);
                        }
                    }
                } finally {
                    Binder.restoreCallingIdentity(ident);
                }
+5 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import static com.android.server.am.ActivityManagerService.SYSTEM_USER_UNLOCK_MS
import static com.android.server.am.ActivityManagerService.USER_SWITCH_TIMEOUT_MSG;

import android.annotation.NonNull;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.app.AppOpsManager;
import android.app.Dialog;
@@ -1340,6 +1341,10 @@ final class UserController {
        return km.isDeviceLocked(userId);
    }

    boolean isLockScreenDisabled(@UserIdInt int userId) {
        return mLockPatternUtils.isLockScreenDisabled(userId);
    }

    void dump(PrintWriter pw, boolean dumpAll) {
        pw.println("  mStartedUsers:");
        for (int i = 0; i < mStartedUsers.size(); i++) {