Grant "Nearby devices" to Bluetooth MIDI service.

MidiManager.BLUETOOTH_MIDI_SERVICE_PACKAGE is a built-in package
which mediates Bluetooth MIDI connections.  It functions similar to
CompanionDeviceManager and has no UI to request runtime permissions,
since it's proxying operations on behalf of other apps which have
already requested the permission.

Bug: 184920451
Test: manual
Change-Id: Ifd92ba0c701bb3d2aa927cac7c61cb435437444a
This commit is contained in:
Jeff Sharkey
2021-04-29 16:07:09 -06:00
parent 9693ec26d9
commit 093e12ef1d

View File

@@ -37,6 +37,7 @@ import android.content.pm.PermissionInfo;
import android.content.pm.ProviderInfo;
import android.content.pm.ResolveInfo;
import android.media.RingtoneManager;
import android.media.midi.MidiManager;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
@@ -866,6 +867,11 @@ final class DefaultPermissionGrantPolicy {
grantPermissionsToSystemPackage(pm, systemCaptionsServicePackageName, userId,
MICROPHONE_PERMISSIONS);
}
// Bluetooth MIDI Service
grantSystemFixedPermissionsToSystemPackage(pm,
MidiManager.BLUETOOTH_MIDI_SERVICE_PACKAGE, userId,
NEARBY_DEVICES_PERMISSIONS);
}
private String getDefaultSystemHandlerActivityPackageForCategory(PackageManagerWrapper pm,