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

Commit 4151ee5d 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

Change-Id: I447044f9249b31be112f53ba74b98a4aff887f86
parents b6c9dbd8 779812c6
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());
    }