Loading framework/java/android/bluetooth/BluetoothAdapter.java +11 −1 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import android.bluetooth.le.ScanSettings; import android.compat.annotation.UnsupportedAppUsage; import android.content.AttributionSource; import android.content.Context; import android.content.pm.PackageManager; import android.os.Binder; import android.os.BluetoothServiceManager; import android.os.Build; Loading Loading @@ -3685,11 +3686,20 @@ public final class BluetoothAdapter { return false; } // Preserve legacy compatibility where apps were depending on // registerStateChangeCallback() performing a permissions check which // has been relaxed in modern platform versions if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.R && context.checkSelfPermission(android.Manifest.permission.BLUETOOTH) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Need BLUETOOTH permission"); } BluetoothProfile profileProxy = constructor.apply(context, this); BluetoothProfileConnector connector = new BluetoothProfileConnector(profileProxy, profile); mProfileConnectors.put(profileProxy, connector); connector.connect(context, listener); connector.connect(context.getPackageName(), listener); return true; } Loading framework/java/android/bluetooth/BluetoothProfileConnector.java +0 −16 Original line number Diff line number Diff line Loading @@ -18,9 +18,6 @@ package android.bluetooth; import android.annotation.SuppressLint; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; import android.os.Handler; import android.os.IBinder; import android.os.Looper; Loading Loading @@ -165,19 +162,6 @@ public final class BluetoothProfileConnector extends Handler { } } void connect(Context context, BluetoothProfile.ServiceListener listener) { // Preserve legacy compatibility where apps were depending on // registerStateChangeCallback() performing a permissions check which // has been relaxed in modern platform versions if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.R && context.checkSelfPermission(android.Manifest.permission.BLUETOOTH) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Need BLUETOOTH permission"); } connect(context.getPackageName(), listener); } /** @hide */ public void connect(String packageName, BluetoothProfile.ServiceListener listener) { mPackageName = packageName; Loading Loading
framework/java/android/bluetooth/BluetoothAdapter.java +11 −1 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import android.bluetooth.le.ScanSettings; import android.compat.annotation.UnsupportedAppUsage; import android.content.AttributionSource; import android.content.Context; import android.content.pm.PackageManager; import android.os.Binder; import android.os.BluetoothServiceManager; import android.os.Build; Loading Loading @@ -3685,11 +3686,20 @@ public final class BluetoothAdapter { return false; } // Preserve legacy compatibility where apps were depending on // registerStateChangeCallback() performing a permissions check which // has been relaxed in modern platform versions if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.R && context.checkSelfPermission(android.Manifest.permission.BLUETOOTH) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Need BLUETOOTH permission"); } BluetoothProfile profileProxy = constructor.apply(context, this); BluetoothProfileConnector connector = new BluetoothProfileConnector(profileProxy, profile); mProfileConnectors.put(profileProxy, connector); connector.connect(context, listener); connector.connect(context.getPackageName(), listener); return true; } Loading
framework/java/android/bluetooth/BluetoothProfileConnector.java +0 −16 Original line number Diff line number Diff line Loading @@ -18,9 +18,6 @@ package android.bluetooth; import android.annotation.SuppressLint; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; import android.os.Handler; import android.os.IBinder; import android.os.Looper; Loading Loading @@ -165,19 +162,6 @@ public final class BluetoothProfileConnector extends Handler { } } void connect(Context context, BluetoothProfile.ServiceListener listener) { // Preserve legacy compatibility where apps were depending on // registerStateChangeCallback() performing a permissions check which // has been relaxed in modern platform versions if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.R && context.checkSelfPermission(android.Manifest.permission.BLUETOOTH) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Need BLUETOOTH permission"); } connect(context.getPackageName(), listener); } /** @hide */ public void connect(String packageName, BluetoothProfile.ServiceListener listener) { mPackageName = packageName; Loading