Loading core/java/android/app/admin/flags/flags.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -528,3 +528,13 @@ flag { description: "Enable any user (not just the Main User) to be a DeviceOwner" bug: "435271558" } flag { name: "fix_hsum_bugreport_share_crash" namespace: "enterprise" description: "[HSUM][Framework Bug][DO] TestDPC crashes when sharing a bugreport requested from TestDPC" bug: "341879351" metadata { purpose: PURPOSE_BUGFIX } } services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +15 −3 Original line number Diff line number Diff line Loading @@ -358,6 +358,7 @@ import android.compat.annotation.EnabledSince; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; Loading Loading @@ -9565,8 +9566,19 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { void sendBugreportToDeviceOwner(Uri bugreportUri, String bugreportHash) { synchronized (getLockObject()) { final Intent intent = new Intent(DeviceAdminReceiver.ACTION_BUGREPORT_SHARE); final int deviceOwnerUserId = mOwners.getDeviceOwnerUserId(); final Uri bugreportUriForUser; if (Flags.fixHsumBugreportShareCrash()) { // Bugreports are collected by the shell, which runs as UserHandle.USER_SYSTEM. bugreportUriForUser = ContentProvider.createContentUriForUser( bugreportUri, UserHandle.of(UserHandle.USER_SYSTEM)); } else { bugreportUriForUser = bugreportUri; } intent.setComponent(mOwners.getDeviceOwnerComponent()); intent.setDataAndType(bugreportUri, RemoteBugreportManager.BUGREPORT_MIMETYPE); intent.setDataAndType(bugreportUriForUser, RemoteBugreportManager.BUGREPORT_MIMETYPE); intent.putExtra(DeviceAdminReceiver.EXTRA_BUGREPORT_HASH, bugreportHash); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); Loading @@ -9574,10 +9586,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { .getService(UriGrantsManagerInternal.class); final NeededUriGrants needed = ugm.checkGrantUriPermissionFromIntent(intent, Process.SHELL_UID, mOwners.getDeviceOwnerComponent().getPackageName(), mOwners.getDeviceOwnerUserId()); deviceOwnerUserId); ugm.grantUriPermissionUncheckedFromIntent(needed, null); mContext.sendBroadcastAsUser(intent, UserHandle.of(mOwners.getDeviceOwnerUserId())); mContext.sendBroadcastAsUser(intent, UserHandle.of(deviceOwnerUserId)); } } Loading
core/java/android/app/admin/flags/flags.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -528,3 +528,13 @@ flag { description: "Enable any user (not just the Main User) to be a DeviceOwner" bug: "435271558" } flag { name: "fix_hsum_bugreport_share_crash" namespace: "enterprise" description: "[HSUM][Framework Bug][DO] TestDPC crashes when sharing a bugreport requested from TestDPC" bug: "341879351" metadata { purpose: PURPOSE_BUGFIX } }
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +15 −3 Original line number Diff line number Diff line Loading @@ -358,6 +358,7 @@ import android.compat.annotation.EnabledSince; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; Loading Loading @@ -9565,8 +9566,19 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { void sendBugreportToDeviceOwner(Uri bugreportUri, String bugreportHash) { synchronized (getLockObject()) { final Intent intent = new Intent(DeviceAdminReceiver.ACTION_BUGREPORT_SHARE); final int deviceOwnerUserId = mOwners.getDeviceOwnerUserId(); final Uri bugreportUriForUser; if (Flags.fixHsumBugreportShareCrash()) { // Bugreports are collected by the shell, which runs as UserHandle.USER_SYSTEM. bugreportUriForUser = ContentProvider.createContentUriForUser( bugreportUri, UserHandle.of(UserHandle.USER_SYSTEM)); } else { bugreportUriForUser = bugreportUri; } intent.setComponent(mOwners.getDeviceOwnerComponent()); intent.setDataAndType(bugreportUri, RemoteBugreportManager.BUGREPORT_MIMETYPE); intent.setDataAndType(bugreportUriForUser, RemoteBugreportManager.BUGREPORT_MIMETYPE); intent.putExtra(DeviceAdminReceiver.EXTRA_BUGREPORT_HASH, bugreportHash); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); Loading @@ -9574,10 +9586,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { .getService(UriGrantsManagerInternal.class); final NeededUriGrants needed = ugm.checkGrantUriPermissionFromIntent(intent, Process.SHELL_UID, mOwners.getDeviceOwnerComponent().getPackageName(), mOwners.getDeviceOwnerUserId()); deviceOwnerUserId); ugm.grantUriPermissionUncheckedFromIntent(needed, null); mContext.sendBroadcastAsUser(intent, UserHandle.of(mOwners.getDeviceOwnerUserId())); mContext.sendBroadcastAsUser(intent, UserHandle.of(deviceOwnerUserId)); } }