From 172708b5399343615a2d456ee14fc02542c17f7a Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Tue, 29 May 2018 17:28:58 -0400 Subject: [PATCH] Use disableForUser in StatusBarManager If a secondary user is added to the device and in the middle of SUW, the SUW process can be killed via ADB. This will cause the process to get restarted and call StatusBarManager#disable()/disable2(), which uses the StatusBarManagerService methods that use the current uid. The fix is to use Binder.getCallingUserHandle() in StatusBarManager so that the SUW from another user can't affect the current user unless it is current. Test: start SUW from new user, cancel set up and go back to primary user. Kill the SUW process. Nav bars remain un-hidden Change-Id: Ie6f648827d8d384ae87f74e2d746b7566a7b9011 Fixes: 78360699 --- core/java/android/app/StatusBarManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java index 4a092140ed785..3d1b73bebb79c 100644 --- a/core/java/android/app/StatusBarManager.java +++ b/core/java/android/app/StatusBarManager.java @@ -121,9 +121,10 @@ public class StatusBarManager { */ public void disable(int what) { try { + final int userId = Binder.getCallingUserHandle().getIdentifier(); final IStatusBarService svc = getService(); if (svc != null) { - svc.disable(what, mToken, mContext.getPackageName()); + svc.disableForUser(what, mToken, mContext.getPackageName(), userId); } } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); @@ -138,9 +139,10 @@ public class StatusBarManager { */ public void disable2(@Disable2Flags int what) { try { + final int userId = Binder.getCallingUserHandle().getIdentifier(); final IStatusBarService svc = getService(); if (svc != null) { - svc.disable2(what, mToken, mContext.getPackageName()); + svc.disable2ForUser(what, mToken, mContext.getPackageName(), userId); } } catch (RemoteException ex) { throw ex.rethrowFromSystemServer();