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

Commit 51c6761d authored by Ilyas Sung's avatar Ilyas Sung
Browse files

Ensure security log broadcast is sent to the correct user on Headless.

Bug: 329626244
Test: MixedDeviceOwnerTest#testSecurityLoggingDelegate
Change-Id: I847688f0b0d8d1c956f0e10091e2b563af4d6fb9
parent bc9c179f
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -203,3 +203,13 @@ flag {
  description: "Guards a new flow for recursive required enterprise app list merging"
  bug: "319084618"
}

flag {
  name: "headless_device_owner_delegate_security_logging_bug_fix"
  namespace: "enterprise"
  description: "Fix delegate security logging for single user headless DO."
  bug: "289515470"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
+7 −1
Original line number Diff line number Diff line
@@ -9028,8 +9028,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
    void sendDeviceOwnerOrProfileOwnerCommand(String action, Bundle extras, int userId) {
        if (userId == UserHandle.USER_ALL) {
            if (Flags.headlessDeviceOwnerDelegateSecurityLoggingBugFix()
                    && getHeadlessDeviceOwnerModeForDeviceOwner()
                    == HEADLESS_DEVICE_OWNER_MODE_SINGLE_USER) {
                userId = mOwners.getDeviceOwnerUserId();
            } else {
                userId = UserHandle.USER_SYSTEM;
            }
        }
        boolean inForeground = false;
        ComponentName receiverComponent = null;
        if (action.equals(DeviceAdminReceiver.ACTION_NETWORK_LOGS_AVAILABLE)) {