Add debug logs for private space auto-lock
Bug: 319624844, 324208963
Test: Tested manually by flashing a local build
Flag: ACONFIG android.multiuser.support_autolock_for_private_space
NEXTFOOD
Change-Id: I0e259f964fc5764b0724f517362d8c2471582812
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index b1976cd..964bff0 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -600,8 +600,11 @@
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 @@
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 @@
@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()) {