Loading android/apishim/Android.bp +6 −8 Original line number Diff line number Diff line Loading @@ -21,9 +21,7 @@ java_defaults { name: "BluetoothShimsDefaults", libs: [ "androidx.annotation_annotation", ], static_libs : [ "modules-utils-build_system" "modules-utils-build", ], apex_available: [ "com.android.btservices", Loading @@ -40,7 +38,7 @@ java_library { "BluetoothShimsDefaults", ], srcs: ["common/**/*.java"], sdk_version: "system_current", sdk_version: "module_current", visibility: ["//visibility:private"], } Loading Loading @@ -70,10 +68,10 @@ java_library { "34/**/*.java", ], libs: [ "BluetoothShimsCommon", "BluetoothApi33Shims", "BluetoothShimsCommon", ], sdk_version: "module_current", sdk_version: "module_34", visibility: ["//visibility:private"], } Loading @@ -83,9 +81,9 @@ java_library { "BluetoothShimsDefaults", ], static_libs: [ "BluetoothShimsCommon", "BluetoothApi33Shims", "BluetoothApi34Shims", "BluetoothShimsCommon", ], visibility: [ "//packages/modules/Bluetooth/android/app", Loading framework/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ java_defaults { static_libs: [ "PlatformProperties", "bluetooth_flags_java_lib", "modules-utils-build", "modules-utils-expresslog", "service-bluetooth-binder-aidl", ], Loading framework/java/android/bluetooth/BluetoothManager.java +12 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.bluetooth; import static com.android.modules.utils.build.SdkLevel.isAtLeastU; import android.annotation.RequiresFeature; import android.annotation.RequiresNoPermission; import android.annotation.RequiresPermission; Loading Loading @@ -56,14 +58,20 @@ public final class BluetoothManager { /** @hide */ public BluetoothManager(Context context) { mAdapter = BluetoothAdapter.createAdapter(context.getAttributionSource()); if (com.android.bluetooth.flags.Flags.overrideContextToSpecifyDeviceId() && isAtLeastU()) { // Pin the context DeviceId prevent the associated attribution source to be obsolete // TODO: b/343739429 -- pass the context to BluetoothAdapter constructor instead mContext = context.createDeviceContext(Context.DEVICE_ID_DEFAULT); } else { mContext = context; } mAdapter = BluetoothAdapter.createAdapter(mContext.getAttributionSource()); } /** * Get the BLUETOOTH Adapter for this device. * Get the BluetoothAdapter for this device. * * @return the BLUETOOTH Adapter * @return the BluetoothAdapter */ @RequiresNoPermission public BluetoothAdapter getAdapter() { Loading Loading
android/apishim/Android.bp +6 −8 Original line number Diff line number Diff line Loading @@ -21,9 +21,7 @@ java_defaults { name: "BluetoothShimsDefaults", libs: [ "androidx.annotation_annotation", ], static_libs : [ "modules-utils-build_system" "modules-utils-build", ], apex_available: [ "com.android.btservices", Loading @@ -40,7 +38,7 @@ java_library { "BluetoothShimsDefaults", ], srcs: ["common/**/*.java"], sdk_version: "system_current", sdk_version: "module_current", visibility: ["//visibility:private"], } Loading Loading @@ -70,10 +68,10 @@ java_library { "34/**/*.java", ], libs: [ "BluetoothShimsCommon", "BluetoothApi33Shims", "BluetoothShimsCommon", ], sdk_version: "module_current", sdk_version: "module_34", visibility: ["//visibility:private"], } Loading @@ -83,9 +81,9 @@ java_library { "BluetoothShimsDefaults", ], static_libs: [ "BluetoothShimsCommon", "BluetoothApi33Shims", "BluetoothApi34Shims", "BluetoothShimsCommon", ], visibility: [ "//packages/modules/Bluetooth/android/app", Loading
framework/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ java_defaults { static_libs: [ "PlatformProperties", "bluetooth_flags_java_lib", "modules-utils-build", "modules-utils-expresslog", "service-bluetooth-binder-aidl", ], Loading
framework/java/android/bluetooth/BluetoothManager.java +12 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.bluetooth; import static com.android.modules.utils.build.SdkLevel.isAtLeastU; import android.annotation.RequiresFeature; import android.annotation.RequiresNoPermission; import android.annotation.RequiresPermission; Loading Loading @@ -56,14 +58,20 @@ public final class BluetoothManager { /** @hide */ public BluetoothManager(Context context) { mAdapter = BluetoothAdapter.createAdapter(context.getAttributionSource()); if (com.android.bluetooth.flags.Flags.overrideContextToSpecifyDeviceId() && isAtLeastU()) { // Pin the context DeviceId prevent the associated attribution source to be obsolete // TODO: b/343739429 -- pass the context to BluetoothAdapter constructor instead mContext = context.createDeviceContext(Context.DEVICE_ID_DEFAULT); } else { mContext = context; } mAdapter = BluetoothAdapter.createAdapter(mContext.getAttributionSource()); } /** * Get the BLUETOOTH Adapter for this device. * Get the BluetoothAdapter for this device. * * @return the BLUETOOTH Adapter * @return the BluetoothAdapter */ @RequiresNoPermission public BluetoothAdapter getAdapter() { Loading