Merge "Use new DevicePolicyManager#logoutUser() methods" into tm-dev
This commit is contained in:
@@ -4474,23 +4474,6 @@ public class ActivityManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs out current current foreground user by switching to the system user and stopping the
|
|
||||||
* user being switched from.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public static void logoutCurrentUser() {
|
|
||||||
int currentUser = ActivityManager.getCurrentUser();
|
|
||||||
if (currentUser != UserHandle.USER_SYSTEM) {
|
|
||||||
try {
|
|
||||||
getService().switchUser(UserHandle.USER_SYSTEM);
|
|
||||||
getService().stopUser(currentUser, /* force= */ false, null);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
e.rethrowFromSystemServer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops the given {@code userId}.
|
* Stops the given {@code userId}.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1067,13 +1067,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
|||||||
// Add a little delay before executing, to give the dialog a chance to go away before
|
// Add a little delay before executing, to give the dialog a chance to go away before
|
||||||
// switching user
|
// switching user
|
||||||
mHandler.postDelayed(() -> {
|
mHandler.postDelayed(() -> {
|
||||||
try {
|
mDevicePolicyManager.logoutUser();
|
||||||
int currentUserId = getCurrentUser().id;
|
|
||||||
mIActivityManager.switchUser(UserHandle.USER_SYSTEM);
|
|
||||||
mIActivityManager.stopUser(currentUserId, true /*force*/, null);
|
|
||||||
} catch (RemoteException re) {
|
|
||||||
Log.e(TAG, "Couldn't logout user " + re);
|
|
||||||
}
|
|
||||||
}, mDialogPressDelay);
|
}, mDialogPressDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -575,13 +575,7 @@ public class KeyguardIndicationController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int currentUserId = KeyguardUpdateMonitor.getCurrentUser();
|
int currentUserId = KeyguardUpdateMonitor.getCurrentUser();
|
||||||
try {
|
mDevicePolicyManager.logoutUser();
|
||||||
mIActivityManager.switchUser(UserHandle.USER_SYSTEM);
|
|
||||||
mIActivityManager.stopUser(currentUserId, true /* force */,
|
|
||||||
null);
|
|
||||||
} catch (RemoteException re) {
|
|
||||||
Log.e(TAG, "Failed to logout user", re);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.build(),
|
.build(),
|
||||||
false);
|
false);
|
||||||
|
|||||||
@@ -447,14 +447,6 @@ public class UserSwitcherController implements Dumpable {
|
|||||||
mResumeUserOnGuestLogout = resume;
|
mResumeUserOnGuestLogout = resume;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logoutCurrentUser() {
|
|
||||||
int currentUser = mUserTracker.getUserId();
|
|
||||||
if (currentUser != UserHandle.USER_SYSTEM) {
|
|
||||||
pauseRefreshUsers();
|
|
||||||
ActivityManager.logoutCurrentUser();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the current user is a system user.
|
* Returns whether the current user is a system user.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user