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

Commit 6369ffad authored by Jonathan Scott's avatar Jonathan Scott
Browse files

Fix incorrect check for Sysuser.

Test: btest a.d.c.MaximumTimeOffTest
Test: btest a.d.c.OrganizationOwnedProfileOwnerTest
Bug: 254834861

Change-Id: I07f489f6b4eadccbdb6289b4aec3f85b7e450611
parent f1fdb580
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1091,13 +1091,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                // (ACTION_DATE_CHANGED), or when manual clock adjustment is made
                // (ACTION_TIME_CHANGED)
                updateSystemUpdateFreezePeriodsRecord(/* saveIfChanged */ true);
                final int userId = getManagedUserId(UserHandle.USER_SYSTEM);
                final int userId = getManagedUserId(mUserManager.getMainUser().getIdentifier());
                if (userId >= 0) {
                    updatePersonalAppsSuspension(userId, mUserManager.isUserUnlocked(userId));
                }
            } else if (ACTION_PROFILE_OFF_DEADLINE.equals(action)) {
                Slogf.i(LOG_TAG, "Profile off deadline alarm was triggered");
                final int userId = getManagedUserId(UserHandle.USER_SYSTEM);
                final int userId = getManagedUserId(mUserManager.getMainUser().getIdentifier());
                if (userId >= 0) {
                    updatePersonalAppsSuspension(userId, mUserManager.isUserUnlocked(userId));
                } else {
@@ -18188,8 +18188,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                        .addAction(turnProfileOnButton)
                        .addExtras(extras)
                        .build();
        mInjector.getNotificationManager().notify(
                SystemMessage.NOTE_PERSONAL_APPS_SUSPENDED, notification);
        mInjector.getNotificationManager().notifyAsUser(
                null, SystemMessage.NOTE_PERSONAL_APPS_SUSPENDED, notification,
                UserHandle.of(getProfileParentId(profileUserId)));
    }
    private String getPersonalAppSuspensionButtonText() {
+2 −2
Original line number Diff line number Diff line
@@ -7396,7 +7396,7 @@ public class DevicePolicyManagerTest extends DpmTestBase {
        verify(getServices().alarmManager, times(1)).set(anyInt(), eq(PROFILE_OFF_DEADLINE), any());
        // Now the user should see a warning notification.
        verify(getServices().notificationManager, times(1))
                .notify(anyInt(), any());
                .notifyAsUser(any(), anyInt(), any(), any());
        // Apps shouldn't be suspended yet.
        verifyZeroInteractions(getServices().ipackageManager);
        clearInvocations(getServices().alarmManager);
@@ -7410,7 +7410,7 @@ public class DevicePolicyManagerTest extends DpmTestBase {
        verifyZeroInteractions(getServices().alarmManager);
        // Now the user should see a notification about suspended apps.
        verify(getServices().notificationManager, times(1))
                .notify(anyInt(), any());
                .notifyAsUser(any(), anyInt(), any(), any());
        // Verify that the apps are suspended.
        verify(getServices().ipackageManager, times(1)).setPackagesSuspendedAsUser(
                any(), eq(true), any(), any(), any(), any(), anyInt());