Merge "Always bind to new media source, clear session callback" into qt-qpr1-dev
diff --git a/service/src/com/android/car/vms/VmsClientManager.java b/service/src/com/android/car/vms/VmsClientManager.java
index cfadea3..f2c4813 100644
--- a/service/src/com/android/car/vms/VmsClientManager.java
+++ b/service/src/com/android/car/vms/VmsClientManager.java
@@ -368,8 +368,8 @@
                 return;
             }
 
-            if (!mUserManager.isUserUnlocked(mCurrentUser)) {
-                Log.i(TAG, "Waiting for foreground user to be unlocked.");
+            if (!mUserManager.isUserUnlockingOrUnlocked(mCurrentUser)) {
+                Log.i(TAG, "Waiting for foreground user " + mCurrentUser + " to be unlocked.");
                 return;
             }
 
diff --git a/tests/carservice_unit_test/src/com/android/car/vms/VmsClientManagerTest.java b/tests/carservice_unit_test/src/com/android/car/vms/VmsClientManagerTest.java
index ec52fad..e1c9d9a 100644
--- a/tests/carservice_unit_test/src/com/android/car/vms/VmsClientManagerTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/vms/VmsClientManagerTest.java
@@ -1035,13 +1035,15 @@
     }
 
     private void notifyUserSwitched(int foregroundUserId, boolean isForegroundUserUnlocked) {
-        when(mUserManager.isUserUnlocked(foregroundUserId)).thenReturn(isForegroundUserUnlocked);
+        when(mUserManager.isUserUnlockingOrUnlocked(foregroundUserId))
+                .thenReturn(isForegroundUserUnlocked);
         mForegroundUserId = foregroundUserId; // Member variable used by verifyUserBind()
         mClientManager.mUserCallback.onSwitchUser(foregroundUserId);
     }
 
     private void notifyUserUnlocked(int foregroundUserId, boolean isForegroundUserUnlocked) {
-        when(mUserManager.isUserUnlocked(foregroundUserId)).thenReturn(isForegroundUserUnlocked);
+        when(mUserManager.isUserUnlockingOrUnlocked(foregroundUserId))
+                .thenReturn(isForegroundUserUnlocked);
         mClientManager.mUserCallback.onUserLockChanged(foregroundUserId, isForegroundUserUnlocked);
     }