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