Merge "Fix the bug that queries UsageStatsService for locked users" into rvc-dev
This commit is contained in:
@@ -72,13 +72,13 @@ public class PeopleService extends SystemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserUnlocking(@NonNull TargetUser targetUser) {
|
||||
mDataManager.onUserUnlocked(targetUser.getUserIdentifier());
|
||||
public void onUserUnlocked(@NonNull TargetUser user) {
|
||||
mDataManager.onUserUnlocked(user.getUserIdentifier());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserStopping(@NonNull TargetUser targetUser) {
|
||||
mDataManager.onUserStopped(targetUser.getUserIdentifier());
|
||||
public void onUserStopping(@NonNull TargetUser user) {
|
||||
mDataManager.onUserStopping(user.getUserIdentifier());
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -198,13 +198,13 @@ public class DataManager {
|
||||
DataMaintenanceService.scheduleJob(mContext, userId);
|
||||
}
|
||||
|
||||
/** This method is called when a user is stopped. */
|
||||
public void onUserStopped(int userId) {
|
||||
/** This method is called when a user is stopping. */
|
||||
public void onUserStopping(int userId) {
|
||||
if (mUserDataArray.indexOfKey(userId) >= 0) {
|
||||
mUserDataArray.get(userId).setUserStopped();
|
||||
}
|
||||
if (mUsageStatsQueryFutures.indexOfKey(userId) >= 0) {
|
||||
mUsageStatsQueryFutures.valueAt(userId).cancel(true);
|
||||
mUsageStatsQueryFutures.get(userId).cancel(true);
|
||||
}
|
||||
if (mBroadcastReceivers.indexOfKey(userId) >= 0) {
|
||||
mContext.unregisterReceiver(mBroadcastReceivers.get(userId));
|
||||
|
||||
@@ -269,7 +269,7 @@ public final class DataManagerTest {
|
||||
assertEquals(1, conversations.size());
|
||||
assertEquals("sc_1", conversations.get(0).getShortcutId());
|
||||
|
||||
mDataManager.onUserStopped(USER_ID_PRIMARY);
|
||||
mDataManager.onUserStopping(USER_ID_PRIMARY);
|
||||
conversations = getConversationsInPrimary();
|
||||
assertTrue(conversations.isEmpty());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user