SecurityException: android.permission.INTERACT_ACROSS_USERS отсутствует для доступа Bluetooth - PullRequest
0 голосов
/ 13 ноября 2018

Возникла эта проблема в не системном приложении при попытке сделать: «BluetoothAdapter :: getProfileProxy».Наблюдается только на Android 8.1, но не воспроизводится.

Caused by: java.lang.SecurityException: query intent receivers: Neither user 15010171 nor current process has android.permission.INTERACT_ACROSS_USERS.
at android.os.Parcel.readException(Parcel.java:2021)
at android.os.Parcel.readException(Parcel.java:1967)
at android.content.pm.IPackageManager$Stub$Proxy.queryIntentServices(IPackageManager.java:4830)
at android.app.ApplicationPackageManager.queryIntentServicesAsUser(ApplicationPackageManager.java:1255)
at android.content.Intent.resolveSystemServiceAsUser(Intent.java:8365)
at android.bluetooth.BluetoothA2dp.doBind(BluetoothA2dp.java:432)
at android.bluetooth.BluetoothA2dp.<init>(BluetoothA2dp.java:405)
at android.bluetooth.BluetoothAdapter.getProfileProxy(BluetoothAdapter.java:3034) 

Вопросы:

  • Почему это разрешение "INTERACT_ACROSS_USERS" становится проблемой.(мы проверяем на наличие разрешения Bluetooth)

  • Согласно https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/bluetooth/BluetoothA2dp.java

    boolean doBind() {
    Intent intent = new Intent(IBluetoothA2dp.class.getName());
    ComponentName comp = intent.resolveSystemService(mContext.getPackageManager(), 0);
    intent.setComponent(comp); ...
    

    Похоже, проблема с разрешением находится где-то еще - в какой-то системной службе.

Хотите знать, кто-то может объяснить проблему.

...