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

Commit 53c403b8 authored by Jigar Thakkar's avatar Jigar Thakkar Committed by Android (Google) Code Review
Browse files

Merge "Add debug logs for private space auto-lock" into main

parents e3a19063 7d78525f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -600,8 +600,11 @@ public class UserManagerService extends IUserManager.Stub {
        public void onReceive(Context context, Intent intent) {
            if (isAutoLockForPrivateSpaceEnabled()) {
                if (ACTION_SCREEN_OFF.equals(intent.getAction())) {
                    Slog.d(LOG_TAG, "SCREEN_OFF broadcast received");
                    maybeScheduleMessageToAutoLockPrivateSpace();
                } else if (ACTION_SCREEN_ON.equals(intent.getAction())) {
                    Slog.d(LOG_TAG, "SCREEN_ON broadcast received, "
                            + "removing queued message to auto-lock private space");
                    // Remove any queued messages since the device is interactive again
                    mHandler.removeCallbacksAndMessages(PRIVATE_SPACE_AUTO_LOCK_MESSAGE_TOKEN);
                }
@@ -619,6 +622,8 @@ public class UserManagerService extends IUserManager.Stub {
                        getMainUserIdUnchecked());
        if (privateSpaceAutoLockPreference
                != Settings.Secure.PRIVATE_SPACE_AUTO_LOCK_AFTER_INACTIVITY) {
            Slogf.d(LOG_TAG, "Not scheduling auto-lock on inactivity,"
                    + "preference is set to %d", privateSpaceAutoLockPreference);
            return;
        }
        int privateProfileUserId = getPrivateProfileUserId();
@@ -632,6 +637,7 @@ public class UserManagerService extends IUserManager.Stub {
    @VisibleForTesting
    void scheduleMessageToAutoLockPrivateSpace(int userId, Object token,
            long delayInMillis) {
        Slog.i(LOG_TAG, "Scheduling auto-lock message");
        mHandler.postDelayed(() -> {
            final PowerManager powerManager = mContext.getSystemService(PowerManager.class);
            if (powerManager != null && !powerManager.isInteractive()) {