2022-10-18 17:13:17 -04:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
|
|
|
Date: Thu, 18 Aug 2022 10:04:46 +0300
|
|
|
|
Subject: [PATCH] fix DevicePolicyManager#logoutUser() never succeeding
|
|
|
|
|
|
|
|
To succeed, userId to switch to needs to be set with setLogoutUserIdLocked(), but this is not done
|
|
|
|
in both callers of this method (both of which are "End session" buttons), making them no-ops.
|
|
|
|
---
|
|
|
|
.../server/devicepolicy/DevicePolicyManagerService.java | 6 ++++++
|
|
|
|
1 file changed, 6 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
2024-02-10 12:41:35 -05:00
|
|
|
index c1da90d85e42..76dabbb24868 100644
|
2022-10-18 17:13:17 -04:00
|
|
|
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
|
|
|
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
2024-02-10 12:41:35 -05:00
|
|
|
@@ -11182,6 +11182,12 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
2022-10-18 17:13:17 -04:00
|
|
|
Preconditions.checkCallAuthorization(canManageUsers(caller)
|
|
|
|
|| hasCallingOrSelfPermission(permission.INTERACT_ACROSS_USERS));
|
|
|
|
|
|
|
|
+ synchronized (getLockObject()) {
|
|
|
|
+ if (getLogoutUserIdUnchecked() == UserHandle.USER_NULL) {
|
|
|
|
+ setLogoutUserIdLocked(UserHandle.USER_SYSTEM);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
int currentUserId = getCurrentForegroundUserId();
|
|
|
|
if (VERBOSE_LOG) {
|
|
|
|
Slogf.v(LOG_TAG, "logout() called by uid %d; current user is %d", caller.getUid(),
|