Loading android/app/aidl/android/bluetooth/IBluetooth.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -250,9 +250,9 @@ interface IBluetooth boolean removeActiveDevice(in int profiles, in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") boolean registerBluetoothConnectionCallback(in IBluetoothConnectionCallback callback, in AttributionSource attributionSource); oneway void registerBluetoothConnectionCallback(in IBluetoothConnectionCallback callback, in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") boolean unregisterBluetoothConnectionCallback(in IBluetoothConnectionCallback callback, in AttributionSource attributionSource); oneway void unregisterBluetoothConnectionCallback(in IBluetoothConnectionCallback callback, in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") boolean canBondWithoutDialog(in BluetoothDevice device, in AttributionSource attributionSource); Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +5 −6 Original line number Diff line number Diff line Loading @@ -3346,32 +3346,31 @@ public class AdapterService extends Service { } @Override public boolean registerBluetoothConnectionCallback( public void registerBluetoothConnectionCallback( IBluetoothConnectionCallback callback, AttributionSource source) { AdapterService service = getService(); if (service == null || !callerIsSystemOrActiveOrManagedUser( service, TAG, "registerBluetoothConnectionCallback") || !Utils.checkConnectPermissionForDataDelivery(service, source, TAG)) { return false; return; } enforceBluetoothPrivilegedPermission(service); service.mBluetoothConnectionCallbacks.add(callback); return true; } @Override public boolean unregisterBluetoothConnectionCallback( public void unregisterBluetoothConnectionCallback( IBluetoothConnectionCallback callback, AttributionSource source) { AdapterService service = getService(); if (service == null || !callerIsSystemOrActiveOrManagedUser( service, TAG, "unregisterBluetoothConnectionCallback") || !Utils.checkConnectPermissionForDataDelivery(service, source, TAG)) { return false; return; } enforceBluetoothPrivilegedPermission(service); return service.mBluetoothConnectionCallbacks.remove(callback); service.mBluetoothConnectionCallbacks.remove(callback); } @Override Loading framework/java/android/bluetooth/BluetoothAdapter.java +28 −27 Original line number Diff line number Diff line Loading @@ -4804,28 +4804,28 @@ public final class BluetoothAdapter { } synchronized (mBluetoothConnectionCallbackExecutorMap) { // If the callback map is empty, we register the service-to-app callback if (mBluetoothConnectionCallbackExecutorMap.containsKey(callback)) { throw new IllegalArgumentException("This callback has already been registered"); } if (mBluetoothConnectionCallbackExecutorMap.isEmpty()) { // If the callback map is empty, we register the service-to-app callback mServiceLock.readLock().lock(); try { if (mService != null) { if (!mService.registerBluetoothConnectionCallback( mConnectionCallback, mAttributionSource)) { if (mService == null) { return false; } } mService.registerBluetoothConnectionCallback( mConnectionCallback, mAttributionSource); } catch (RemoteException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); mBluetoothConnectionCallbackExecutorMap.remove(callback); return false; } finally { mServiceLock.readLock().unlock(); } } // Adds the passed in callback to our map of callbacks to executors if (mBluetoothConnectionCallbackExecutorMap.containsKey(callback)) { throw new IllegalArgumentException("This callback has already been registered"); } mBluetoothConnectionCallbackExecutorMap.put(callback, executor); } Loading Loading @@ -4854,29 +4854,30 @@ public final class BluetoothAdapter { } synchronized (mBluetoothConnectionCallbackExecutorMap) { if (mBluetoothConnectionCallbackExecutorMap.remove(callback) != null) { return false; } } if (!mBluetoothConnectionCallbackExecutorMap.isEmpty()) { if (!mBluetoothConnectionCallbackExecutorMap.containsKey(callback)) { return true; } mBluetoothConnectionCallbackExecutorMap.remove(callback); if (mBluetoothConnectionCallbackExecutorMap.isEmpty()) { // If the callback map is empty, we unregister the service-to-app callback mServiceLock.readLock().lock(); try { if (mService != null) { return mService.unregisterBluetoothConnectionCallback( mConnectionCallback, mAttributionSource); if (mService == null) { return true; } mService.unregisterBluetoothConnectionCallback( mConnectionCallback, mAttributionSource); } catch (RemoteException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } finally { mServiceLock.readLock().unlock(); } } } return false; return true; } /** Loading Loading
android/app/aidl/android/bluetooth/IBluetooth.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -250,9 +250,9 @@ interface IBluetooth boolean removeActiveDevice(in int profiles, in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") boolean registerBluetoothConnectionCallback(in IBluetoothConnectionCallback callback, in AttributionSource attributionSource); oneway void registerBluetoothConnectionCallback(in IBluetoothConnectionCallback callback, in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") boolean unregisterBluetoothConnectionCallback(in IBluetoothConnectionCallback callback, in AttributionSource attributionSource); oneway void unregisterBluetoothConnectionCallback(in IBluetoothConnectionCallback callback, in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") boolean canBondWithoutDialog(in BluetoothDevice device, in AttributionSource attributionSource); Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +5 −6 Original line number Diff line number Diff line Loading @@ -3346,32 +3346,31 @@ public class AdapterService extends Service { } @Override public boolean registerBluetoothConnectionCallback( public void registerBluetoothConnectionCallback( IBluetoothConnectionCallback callback, AttributionSource source) { AdapterService service = getService(); if (service == null || !callerIsSystemOrActiveOrManagedUser( service, TAG, "registerBluetoothConnectionCallback") || !Utils.checkConnectPermissionForDataDelivery(service, source, TAG)) { return false; return; } enforceBluetoothPrivilegedPermission(service); service.mBluetoothConnectionCallbacks.add(callback); return true; } @Override public boolean unregisterBluetoothConnectionCallback( public void unregisterBluetoothConnectionCallback( IBluetoothConnectionCallback callback, AttributionSource source) { AdapterService service = getService(); if (service == null || !callerIsSystemOrActiveOrManagedUser( service, TAG, "unregisterBluetoothConnectionCallback") || !Utils.checkConnectPermissionForDataDelivery(service, source, TAG)) { return false; return; } enforceBluetoothPrivilegedPermission(service); return service.mBluetoothConnectionCallbacks.remove(callback); service.mBluetoothConnectionCallbacks.remove(callback); } @Override Loading
framework/java/android/bluetooth/BluetoothAdapter.java +28 −27 Original line number Diff line number Diff line Loading @@ -4804,28 +4804,28 @@ public final class BluetoothAdapter { } synchronized (mBluetoothConnectionCallbackExecutorMap) { // If the callback map is empty, we register the service-to-app callback if (mBluetoothConnectionCallbackExecutorMap.containsKey(callback)) { throw new IllegalArgumentException("This callback has already been registered"); } if (mBluetoothConnectionCallbackExecutorMap.isEmpty()) { // If the callback map is empty, we register the service-to-app callback mServiceLock.readLock().lock(); try { if (mService != null) { if (!mService.registerBluetoothConnectionCallback( mConnectionCallback, mAttributionSource)) { if (mService == null) { return false; } } mService.registerBluetoothConnectionCallback( mConnectionCallback, mAttributionSource); } catch (RemoteException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); mBluetoothConnectionCallbackExecutorMap.remove(callback); return false; } finally { mServiceLock.readLock().unlock(); } } // Adds the passed in callback to our map of callbacks to executors if (mBluetoothConnectionCallbackExecutorMap.containsKey(callback)) { throw new IllegalArgumentException("This callback has already been registered"); } mBluetoothConnectionCallbackExecutorMap.put(callback, executor); } Loading Loading @@ -4854,29 +4854,30 @@ public final class BluetoothAdapter { } synchronized (mBluetoothConnectionCallbackExecutorMap) { if (mBluetoothConnectionCallbackExecutorMap.remove(callback) != null) { return false; } } if (!mBluetoothConnectionCallbackExecutorMap.isEmpty()) { if (!mBluetoothConnectionCallbackExecutorMap.containsKey(callback)) { return true; } mBluetoothConnectionCallbackExecutorMap.remove(callback); if (mBluetoothConnectionCallbackExecutorMap.isEmpty()) { // If the callback map is empty, we unregister the service-to-app callback mServiceLock.readLock().lock(); try { if (mService != null) { return mService.unregisterBluetoothConnectionCallback( mConnectionCallback, mAttributionSource); if (mService == null) { return true; } mService.unregisterBluetoothConnectionCallback( mConnectionCallback, mAttributionSource); } catch (RemoteException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } finally { mServiceLock.readLock().unlock(); } } } return false; return true; } /** Loading