Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9e07f0a authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Fix the bug that queries UsageStatsService for locked users" into...

Merge "Fix the bug that queries UsageStatsService for locked users" into rvc-dev am: 24a1ea3f am: 779812c6 am: fe1c8335

Change-Id: I93b0f801ec6ec4958ff0e083ea21ac7761eb9faf
parents 9128775d fe1c8335
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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
+3 −3
Original line number Diff line number Diff line
@@ -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));
+1 −1
Original line number Diff line number Diff line
@@ -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());
    }