From edb6a0123071c812d5a347804d88e14240aa6ab3 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Fri, 26 Jan 2018 12:52:43 +0000 Subject: [PATCH] LogoutAction should store current user id before swithcing - Without this currentUserId will change and SysUI crash when trying to stop system user Bug: 71889217 Test: No crash when using logout button, and user is stopped Change-Id: Ifeb083fd61f5cccf7dba4e3e3c2618762f6233b8 --- .../android/systemui/globalactions/GlobalActionsDialog.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java index 0f34513bc40fb..238ab299aa5e1 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java @@ -587,9 +587,9 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, // switching user mHandler.postDelayed(() -> { try { + int currentUserId = getCurrentUser().id; ActivityManager.getService().switchUser(UserHandle.USER_SYSTEM); - ActivityManager.getService().stopUser(getCurrentUser().id, true /*force*/, - null); + ActivityManager.getService().stopUser(currentUserId, true /*force*/, null); } catch (RemoteException re) { Log.e(TAG, "Couldn't logout user " + re); }