Loading framework/java/android/bluetooth/BluetoothMap.java +35 −29 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.compat.annotation.UnsupportedAppUsage; import android.content.AttributionSource; import android.content.Context; import android.os.Build; import android.os.IBinder; import android.os.IpcDataCache; import android.os.RemoteException; import android.util.CloseGuard; Loading Loading @@ -377,21 +378,26 @@ public final class BluetoothMap implements BluetoothProfile, AutoCloseable { IpcDataCache.invalidateCache(IpcDataCache.MODULE_BLUETOOTH, api); } private static final IpcDataCache .QueryHandler<Pair<IBluetoothMap, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionQuery = new IpcDataCache.QueryHandler<>() { private static final IpcDataCache.QueryHandler< Pair<IBinder, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionQuery = new IpcDataCache.QueryHandler<>() { @RequiresBluetoothConnectPermission @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) @Override public Integer apply(Pair<IBluetoothMap, Pair<AttributionSource, BluetoothDevice>> pairQuery) { IBluetoothMap service = pairQuery.first; public Integer apply( Pair<IBinder, Pair<AttributionSource, BluetoothDevice>> pairQuery) { IBluetoothMap service = IBluetoothMap.Stub.asInterface(pairQuery.first); AttributionSource source = pairQuery.second.first; BluetoothDevice device = pairQuery.second.second; if (DBG) { log("getConnectionState(" + device.getAnonymizedAddress() + ") uncached"); log( "getConnectionState(" + device.getAnonymizedAddress() + ") uncached"); } final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); try { service.getConnectionState(device, source, recv); return recv.awaitResultNoInterrupt(getSyncTimeout()) Loading @@ -404,10 +410,10 @@ public final class BluetoothMap implements BluetoothProfile, AutoCloseable { private static final String GET_CONNECTION_STATE_API = "BluetoothMap_getConnectionState"; private static final BluetoothCache<Pair<IBluetoothMap, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionCache = new BluetoothCache<>(GET_CONNECTION_STATE_API, sBluetoothConnectionQuery); private static final BluetoothCache< Pair<IBinder, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionCache = new BluetoothCache<>(GET_CONNECTION_STATE_API, sBluetoothConnectionQuery); /** * Get connection state of device Loading @@ -426,7 +432,7 @@ public final class BluetoothMap implements BluetoothProfile, AutoCloseable { } else if (isEnabled() && isValidDevice(device)) { try { return sBluetoothConnectionCache.query( new Pair<>(service, new Pair<>(mAttributionSource, device))); new Pair<>(service.asBinder(), new Pair<>(mAttributionSource, device))); } catch (RuntimeException e) { if (!(e.getCause() instanceof TimeoutException) && !(e.getCause() instanceof RemoteException)) { Loading framework/java/android/bluetooth/BluetoothSap.java +35 −29 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.compat.annotation.UnsupportedAppUsage; import android.content.AttributionSource; import android.content.Context; import android.os.Build; import android.os.IBinder; import android.os.IpcDataCache; import android.os.RemoteException; import android.util.CloseGuard; Loading Loading @@ -374,21 +375,26 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable { IpcDataCache.invalidateCache(IpcDataCache.MODULE_BLUETOOTH, api); } private static final IpcDataCache .QueryHandler<Pair<IBluetoothSap, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionQuery = new IpcDataCache.QueryHandler<>() { private static final IpcDataCache.QueryHandler< Pair<IBinder, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionQuery = new IpcDataCache.QueryHandler<>() { @RequiresBluetoothConnectPermission @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) @Override public Integer apply(Pair<IBluetoothSap, Pair<AttributionSource, BluetoothDevice>> pairQuery) { IBluetoothSap service = pairQuery.first; public Integer apply( Pair<IBinder, Pair<AttributionSource, BluetoothDevice>> pairQuery) { IBluetoothSap service = IBluetoothSap.Stub.asInterface(pairQuery.first); AttributionSource source = pairQuery.second.first; BluetoothDevice device = pairQuery.second.second; if (DBG) { log("getConnectionState(" + device.getAnonymizedAddress() + ") uncached"); log( "getConnectionState(" + device.getAnonymizedAddress() + ") uncached"); } final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); try { service.getConnectionState(device, source, recv); return recv.awaitResultNoInterrupt(getSyncTimeout()) Loading @@ -401,10 +407,10 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable { private static final String GET_CONNECTION_STATE_API = "BluetoothSap_getConnectionState"; private static final BluetoothCache<Pair<IBluetoothSap, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionCache = new BluetoothCache<>(GET_CONNECTION_STATE_API, sBluetoothConnectionQuery); private static final BluetoothCache< Pair<IBinder, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionCache = new BluetoothCache<>(GET_CONNECTION_STATE_API, sBluetoothConnectionQuery); /** * Get connection state of device Loading @@ -423,7 +429,7 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable { } else if (isEnabled() && isValidDevice(device)) { try { return sBluetoothConnectionCache.query( new Pair<>(service, new Pair<>(mAttributionSource, device))); new Pair<>(service.asBinder(), new Pair<>(mAttributionSource, device))); } catch (RuntimeException e) { if (!(e.getCause() instanceof TimeoutException) && !(e.getCause() instanceof RemoteException)) { Loading Loading
framework/java/android/bluetooth/BluetoothMap.java +35 −29 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.compat.annotation.UnsupportedAppUsage; import android.content.AttributionSource; import android.content.Context; import android.os.Build; import android.os.IBinder; import android.os.IpcDataCache; import android.os.RemoteException; import android.util.CloseGuard; Loading Loading @@ -377,21 +378,26 @@ public final class BluetoothMap implements BluetoothProfile, AutoCloseable { IpcDataCache.invalidateCache(IpcDataCache.MODULE_BLUETOOTH, api); } private static final IpcDataCache .QueryHandler<Pair<IBluetoothMap, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionQuery = new IpcDataCache.QueryHandler<>() { private static final IpcDataCache.QueryHandler< Pair<IBinder, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionQuery = new IpcDataCache.QueryHandler<>() { @RequiresBluetoothConnectPermission @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) @Override public Integer apply(Pair<IBluetoothMap, Pair<AttributionSource, BluetoothDevice>> pairQuery) { IBluetoothMap service = pairQuery.first; public Integer apply( Pair<IBinder, Pair<AttributionSource, BluetoothDevice>> pairQuery) { IBluetoothMap service = IBluetoothMap.Stub.asInterface(pairQuery.first); AttributionSource source = pairQuery.second.first; BluetoothDevice device = pairQuery.second.second; if (DBG) { log("getConnectionState(" + device.getAnonymizedAddress() + ") uncached"); log( "getConnectionState(" + device.getAnonymizedAddress() + ") uncached"); } final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); try { service.getConnectionState(device, source, recv); return recv.awaitResultNoInterrupt(getSyncTimeout()) Loading @@ -404,10 +410,10 @@ public final class BluetoothMap implements BluetoothProfile, AutoCloseable { private static final String GET_CONNECTION_STATE_API = "BluetoothMap_getConnectionState"; private static final BluetoothCache<Pair<IBluetoothMap, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionCache = new BluetoothCache<>(GET_CONNECTION_STATE_API, sBluetoothConnectionQuery); private static final BluetoothCache< Pair<IBinder, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionCache = new BluetoothCache<>(GET_CONNECTION_STATE_API, sBluetoothConnectionQuery); /** * Get connection state of device Loading @@ -426,7 +432,7 @@ public final class BluetoothMap implements BluetoothProfile, AutoCloseable { } else if (isEnabled() && isValidDevice(device)) { try { return sBluetoothConnectionCache.query( new Pair<>(service, new Pair<>(mAttributionSource, device))); new Pair<>(service.asBinder(), new Pair<>(mAttributionSource, device))); } catch (RuntimeException e) { if (!(e.getCause() instanceof TimeoutException) && !(e.getCause() instanceof RemoteException)) { Loading
framework/java/android/bluetooth/BluetoothSap.java +35 −29 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.compat.annotation.UnsupportedAppUsage; import android.content.AttributionSource; import android.content.Context; import android.os.Build; import android.os.IBinder; import android.os.IpcDataCache; import android.os.RemoteException; import android.util.CloseGuard; Loading Loading @@ -374,21 +375,26 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable { IpcDataCache.invalidateCache(IpcDataCache.MODULE_BLUETOOTH, api); } private static final IpcDataCache .QueryHandler<Pair<IBluetoothSap, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionQuery = new IpcDataCache.QueryHandler<>() { private static final IpcDataCache.QueryHandler< Pair<IBinder, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionQuery = new IpcDataCache.QueryHandler<>() { @RequiresBluetoothConnectPermission @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) @Override public Integer apply(Pair<IBluetoothSap, Pair<AttributionSource, BluetoothDevice>> pairQuery) { IBluetoothSap service = pairQuery.first; public Integer apply( Pair<IBinder, Pair<AttributionSource, BluetoothDevice>> pairQuery) { IBluetoothSap service = IBluetoothSap.Stub.asInterface(pairQuery.first); AttributionSource source = pairQuery.second.first; BluetoothDevice device = pairQuery.second.second; if (DBG) { log("getConnectionState(" + device.getAnonymizedAddress() + ") uncached"); log( "getConnectionState(" + device.getAnonymizedAddress() + ") uncached"); } final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); try { service.getConnectionState(device, source, recv); return recv.awaitResultNoInterrupt(getSyncTimeout()) Loading @@ -401,10 +407,10 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable { private static final String GET_CONNECTION_STATE_API = "BluetoothSap_getConnectionState"; private static final BluetoothCache<Pair<IBluetoothSap, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionCache = new BluetoothCache<>(GET_CONNECTION_STATE_API, sBluetoothConnectionQuery); private static final BluetoothCache< Pair<IBinder, Pair<AttributionSource, BluetoothDevice>>, Integer> sBluetoothConnectionCache = new BluetoothCache<>(GET_CONNECTION_STATE_API, sBluetoothConnectionQuery); /** * Get connection state of device Loading @@ -423,7 +429,7 @@ public final class BluetoothSap implements BluetoothProfile, AutoCloseable { } else if (isEnabled() && isValidDevice(device)) { try { return sBluetoothConnectionCache.query( new Pair<>(service, new Pair<>(mAttributionSource, device))); new Pair<>(service.asBinder(), new Pair<>(mAttributionSource, device))); } catch (RuntimeException e) { if (!(e.getCause() instanceof TimeoutException) && !(e.getCause() instanceof RemoteException)) { Loading