Loading android/app/src/com/android/bluetooth/ChangeIds.java +0 −9 Original line number Diff line number Diff line Loading @@ -29,13 +29,4 @@ public class ChangeIds { @ChangeId @EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE) public static final long ENFORCE_CONNECT = 211757425L; /** * Starting with {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}, * {@link android.Manifest.permission.BLUETOOTH_PRIVILEGED} permission is enforced in * {@link A2dpService#setCodecConfigPreference}. */ @ChangeId @EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE) public static final long ENFORCE_CODEC_CONFIG_PRIVILEGED = 268572180L; } android/app/src/com/android/bluetooth/a2dp/A2dpService.java +2 −15 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.bluetooth.a2dp; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static com.android.bluetooth.ChangeIds.ENFORCE_CODEC_CONFIG_PRIVILEGED; import static com.android.bluetooth.Utils.checkCallerTargetSdk; import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission; import static com.android.bluetooth.Utils.enforceCdmAssociation; Loading @@ -26,7 +25,6 @@ import static com.android.bluetooth.Utils.hasBluetoothPrivilegedPermission; import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.app.compat.CompatChanges; import android.bluetooth.BluetoothA2dp; import android.bluetooth.BluetoothA2dp.OptionalCodecsPreferenceStatus; import android.bluetooth.BluetoothA2dp.OptionalCodecsSupportStatus; Loading Loading @@ -1491,18 +1489,7 @@ public class A2dpService extends ProfileService { if (service == null) { return; } boolean checkPrivilegedNeeded = false; final int callingUid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); try { checkPrivilegedNeeded = CompatChanges.isChangeEnabled(ENFORCE_CODEC_CONFIG_PRIVILEGED, callingUid); } finally { Binder.restoreCallingIdentity(token); } if (checkPrivilegedNeeded) { enforceBluetoothPrivilegedPermission(service); } else if (!hasBluetoothPrivilegedPermission(service)) { if (!hasBluetoothPrivilegedPermission(service)) { enforceCdmAssociation(service.mCompanionDeviceManager, service, source.getPackageName(), Binder.getCallingUid(), device); } Loading framework/java/android/bluetooth/BluetoothA2dp.java +2 −5 Original line number Diff line number Diff line Loading @@ -811,11 +811,8 @@ public final class BluetoothA2dp implements BluetoothProfile { /** * Sets the codec configuration preference. * * The {@link android.Manifest.permission.BLUETOOTH_PRIVILEGED} permission is required for * apps targeting {@link android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE} or higher. For apps * targeting lower SDK versions without the * {@link android.Manifest.permission.BLUETOOTH_PRIVILEGED} permission, a * {@link android.companion.CompanionDeviceManager} association is required. * For apps without the {@link android.Manifest.permission.BLUETOOTH_PRIVILEGED} permission * a {@link android.companion.CompanionDeviceManager} association is required. * * @param device the remote Bluetooth device. * @param codecConfig the codec configuration preference Loading Loading
android/app/src/com/android/bluetooth/ChangeIds.java +0 −9 Original line number Diff line number Diff line Loading @@ -29,13 +29,4 @@ public class ChangeIds { @ChangeId @EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE) public static final long ENFORCE_CONNECT = 211757425L; /** * Starting with {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}, * {@link android.Manifest.permission.BLUETOOTH_PRIVILEGED} permission is enforced in * {@link A2dpService#setCodecConfigPreference}. */ @ChangeId @EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE) public static final long ENFORCE_CODEC_CONFIG_PRIVILEGED = 268572180L; }
android/app/src/com/android/bluetooth/a2dp/A2dpService.java +2 −15 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.bluetooth.a2dp; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static com.android.bluetooth.ChangeIds.ENFORCE_CODEC_CONFIG_PRIVILEGED; import static com.android.bluetooth.Utils.checkCallerTargetSdk; import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission; import static com.android.bluetooth.Utils.enforceCdmAssociation; Loading @@ -26,7 +25,6 @@ import static com.android.bluetooth.Utils.hasBluetoothPrivilegedPermission; import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.app.compat.CompatChanges; import android.bluetooth.BluetoothA2dp; import android.bluetooth.BluetoothA2dp.OptionalCodecsPreferenceStatus; import android.bluetooth.BluetoothA2dp.OptionalCodecsSupportStatus; Loading Loading @@ -1491,18 +1489,7 @@ public class A2dpService extends ProfileService { if (service == null) { return; } boolean checkPrivilegedNeeded = false; final int callingUid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); try { checkPrivilegedNeeded = CompatChanges.isChangeEnabled(ENFORCE_CODEC_CONFIG_PRIVILEGED, callingUid); } finally { Binder.restoreCallingIdentity(token); } if (checkPrivilegedNeeded) { enforceBluetoothPrivilegedPermission(service); } else if (!hasBluetoothPrivilegedPermission(service)) { if (!hasBluetoothPrivilegedPermission(service)) { enforceCdmAssociation(service.mCompanionDeviceManager, service, source.getPackageName(), Binder.getCallingUid(), device); } Loading
framework/java/android/bluetooth/BluetoothA2dp.java +2 −5 Original line number Diff line number Diff line Loading @@ -811,11 +811,8 @@ public final class BluetoothA2dp implements BluetoothProfile { /** * Sets the codec configuration preference. * * The {@link android.Manifest.permission.BLUETOOTH_PRIVILEGED} permission is required for * apps targeting {@link android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE} or higher. For apps * targeting lower SDK versions without the * {@link android.Manifest.permission.BLUETOOTH_PRIVILEGED} permission, a * {@link android.companion.CompanionDeviceManager} association is required. * For apps without the {@link android.Manifest.permission.BLUETOOTH_PRIVILEGED} permission * a {@link android.companion.CompanionDeviceManager} association is required. * * @param device the remote Bluetooth device. * @param codecConfig the codec configuration preference Loading