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

Commit 091e0257 authored by Rubin Xu's avatar Rubin Xu Committed by Gerrit Code Review
Browse files

Merge "HSUM: Fix profile unlock notification" into main

parents 67ee8348 92df2bb4
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -43,6 +43,16 @@ flag {
  bug: "295324350"
  bug: "295324350"
}
}


flag {
  name: "hsum_unlock_notification_fix"
  namespace: "enterprise"
  description: "Using the right userId when starting the work profile unlock flow "
  bug: "327350831"
  metadata {
      purpose: PURPOSE_BUGFIX
  }
}

flag {
flag {
  name: "dumpsys_policy_engine_migration_enabled"
  name: "dumpsys_policy_engine_migration_enabled"
  namespace: "enterprise"
  namespace: "enterprise"
+12 −4
Original line number Original line Diff line number Diff line
@@ -724,12 +724,13 @@ public class LockSettingsService extends ILockSettings.Stub {
                    !mUserManager.isQuietModeEnabled(userHandle)) {
                    !mUserManager.isQuietModeEnabled(userHandle)) {
                // Only show notifications for managed profiles once their parent
                // Only show notifications for managed profiles once their parent
                // user is unlocked.
                // user is unlocked.
                showEncryptionNotificationForProfile(userHandle, reason);
                showEncryptionNotificationForProfile(userHandle, parent.getUserHandle(), reason);
            }
            }
        }
        }
    }
    }


    private void showEncryptionNotificationForProfile(UserHandle user, String reason) {
    private void showEncryptionNotificationForProfile(UserHandle user, UserHandle parent,
            String reason) {
        CharSequence title = getEncryptionNotificationTitle();
        CharSequence title = getEncryptionNotificationTitle();
        CharSequence message = getEncryptionNotificationMessage();
        CharSequence message = getEncryptionNotificationMessage();
        CharSequence detail = getEncryptionNotificationDetail();
        CharSequence detail = getEncryptionNotificationDetail();
@@ -746,8 +747,15 @@ public class LockSettingsService extends ILockSettings.Stub {


        unlockIntent.setFlags(
        unlockIntent.setFlags(
                Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        PendingIntent intent = PendingIntent.getActivity(mContext, 0, unlockIntent,
        PendingIntent intent;
        if (android.app.admin.flags.Flags.hsumUnlockNotificationFix()) {
            intent = PendingIntent.getActivityAsUser(mContext, 0, unlockIntent,
                    PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE_UNAUDITED,
                    null, parent);
        } else {
            intent = PendingIntent.getActivity(mContext, 0, unlockIntent,
                    PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE_UNAUDITED);
                    PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE_UNAUDITED);
        }


        Slogf.d(TAG, "Showing encryption notification for user %d; reason: %s",
        Slogf.d(TAG, "Showing encryption notification for user %d; reason: %s",
                user.getIdentifier(), reason);
                user.getIdentifier(), reason);