Keep media sessions for stopping user until the stopping is completed
If a user is quickly *switched back*, the user can be started again without cleaning up its processes, while the onStopUser() is called in the middle. It's because onStopUser() is for 'stopping is started' but it may be canceled if the user is started again quickly. Bug: 154965421 Test: Manual test on AAE emulator with Android-Q, and Pixel 3a XL with Android-R. Change-Id: I6e51f865dd9e97edd8a465eeba02966b242525b2
This commit is contained in:
@@ -334,13 +334,10 @@ public class MediaSessionService extends SystemService implements Monitor {
|
|||||||
updateUser();
|
updateUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the user with the userId is removed.
|
|
||||||
@Override
|
@Override
|
||||||
public void onStopUser(int userId) {
|
public void onCleanupUser(int userId) {
|
||||||
if (DEBUG) Log.d(TAG, "onStopUser: " + userId);
|
if (DEBUG) Log.d(TAG, "onCleanupUser: " + userId);
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
// TODO: Also handle removing user in updateUser() because adding/switching user is
|
|
||||||
// handled in updateUser().
|
|
||||||
FullUserRecord user = getFullUserRecordLocked(userId);
|
FullUserRecord user = getFullUserRecordLocked(userId);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
if (user.mFullUserId == userId) {
|
if (user.mFullUserId == userId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user