Loading framework/java/android/bluetooth/BluetoothLeBroadcast.java +13 −15 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.Executor; import java.util.concurrent.TimeoutException; Loading Loading @@ -402,14 +403,16 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi /** * Register a {@link Callback} that will be invoked during the operation of this profile. * * Repeated registration of the same <var>callback</var> object will have no effect after * the first call to this method, even when the <var>executor</var> is different. API caller * would have to call {@link #unregisterCallback(Callback)} with * the same callback object before registering it again. * Repeated registration of the same <var>callback</var> object after the first call to this * method will result with IllegalArgumentException being thrown, even when the * <var>executor</var> is different. API caller would have to call * {@link #unregisterCallback(Callback)} with the same callback object before registering it * again. * * @param executor an {@link Executor} to execute given callback * @param callback user implementation of the {@link Callback} * @throws IllegalArgumentException if a null executor, sink, or callback is given * @throws NullPointerException if a null executor, or callback is given, or * IllegalArgumentException if the same <var>callback<var> is already registered. * @hide */ @SystemApi Loading @@ -420,12 +423,8 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi }) public void registerCallback(@NonNull @CallbackExecutor Executor executor, @NonNull Callback callback) { if (executor == null) { throw new IllegalArgumentException("executor cannot be null"); } if (callback == null) { throw new IllegalArgumentException("callback cannot be null"); } Objects.requireNonNull(executor, "executor cannot be null"); Objects.requireNonNull(callback, "callback cannot be null"); if (!isEnabled()) { throw new IllegalStateException("service not enabled"); } Loading Loading @@ -466,7 +465,8 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi * <p>Callbacks are automatically unregistered when application process goes away * * @param callback user implementation of the {@link Callback} * @throws IllegalArgumentException when callback is null or when no callback is registered * @throws NullPointerException when callback is null or IllegalArgumentException when no * callback is registered * @hide */ @SystemApi Loading @@ -476,9 +476,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi android.Manifest.permission.BLUETOOTH_PRIVILEGED, }) public void unregisterCallback(@NonNull Callback callback) { if (callback == null) { throw new IllegalArgumentException("callback cannot be null"); } Objects.requireNonNull(callback, "callback cannot be null"); if (DBG) log("unregisterCallback"); Loading framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java +13 −15 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.Executor; /** Loading Loading @@ -509,14 +510,16 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au /** * Register a {@link Callback} that will be invoked during the operation of this profile. * * Repeated registration of the same <var>callback</var> object will have no effect after the * first call to this method, even when the <var>executor</var> is different. Caller would have * to call {@link #unregisterCallback(Callback)} with the same callback object before * registering it again. * Repeated registration of the same <var>callback</var> object after the first call to this * method will result with IllegalArgumentException being thrown, even when the * <var>executor</var> is different. API caller would have to call * {@link #unregisterCallback(Callback)} with the same callback object before registering it * again. * * @param executor an {@link Executor} to execute given callback * @param callback user implementation of the {@link Callback} * @throws IllegalArgumentException if a null executor, sink, or callback is given * @throws NullPointerException if a null executor, or callback is given, or * IllegalArgumentException if the same <var>callback<var> is already registered. * @hide */ @SystemApi Loading @@ -527,12 +530,8 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au }) public void registerCallback(@NonNull @CallbackExecutor Executor executor, @NonNull Callback callback) { if (executor == null) { throw new IllegalArgumentException("executor cannot be null"); } if (callback == null) { throw new IllegalArgumentException("callback cannot be null"); } Objects.requireNonNull(executor, "executor cannot be null"); Objects.requireNonNull(callback, "callback cannot be null"); log("registerCallback"); final IBluetoothLeBroadcastAssistant service = getService(); if (service == null) { Loading @@ -555,7 +554,8 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au * <p>Callbacks are automatically unregistered when application process goes away. * * @param callback user implementation of the {@link Callback} * @throws IllegalArgumentException when callback is null or when no callback is registered * @throws NullPointerException when callback is null or IllegalArgumentException when no * callback is registered * @hide */ @SystemApi Loading @@ -565,9 +565,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au android.Manifest.permission.BLUETOOTH_PRIVILEGED, }) public void unregisterCallback(@NonNull Callback callback) { if (callback == null) { throw new IllegalArgumentException("callback cannot be null"); } Objects.requireNonNull(callback, "callback cannot be null"); log("unregisterCallback"); final IBluetoothLeBroadcastAssistant service = getService(); if (service == null) { Loading Loading
framework/java/android/bluetooth/BluetoothLeBroadcast.java +13 −15 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.Executor; import java.util.concurrent.TimeoutException; Loading Loading @@ -402,14 +403,16 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi /** * Register a {@link Callback} that will be invoked during the operation of this profile. * * Repeated registration of the same <var>callback</var> object will have no effect after * the first call to this method, even when the <var>executor</var> is different. API caller * would have to call {@link #unregisterCallback(Callback)} with * the same callback object before registering it again. * Repeated registration of the same <var>callback</var> object after the first call to this * method will result with IllegalArgumentException being thrown, even when the * <var>executor</var> is different. API caller would have to call * {@link #unregisterCallback(Callback)} with the same callback object before registering it * again. * * @param executor an {@link Executor} to execute given callback * @param callback user implementation of the {@link Callback} * @throws IllegalArgumentException if a null executor, sink, or callback is given * @throws NullPointerException if a null executor, or callback is given, or * IllegalArgumentException if the same <var>callback<var> is already registered. * @hide */ @SystemApi Loading @@ -420,12 +423,8 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi }) public void registerCallback(@NonNull @CallbackExecutor Executor executor, @NonNull Callback callback) { if (executor == null) { throw new IllegalArgumentException("executor cannot be null"); } if (callback == null) { throw new IllegalArgumentException("callback cannot be null"); } Objects.requireNonNull(executor, "executor cannot be null"); Objects.requireNonNull(callback, "callback cannot be null"); if (!isEnabled()) { throw new IllegalStateException("service not enabled"); } Loading Loading @@ -466,7 +465,8 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi * <p>Callbacks are automatically unregistered when application process goes away * * @param callback user implementation of the {@link Callback} * @throws IllegalArgumentException when callback is null or when no callback is registered * @throws NullPointerException when callback is null or IllegalArgumentException when no * callback is registered * @hide */ @SystemApi Loading @@ -476,9 +476,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi android.Manifest.permission.BLUETOOTH_PRIVILEGED, }) public void unregisterCallback(@NonNull Callback callback) { if (callback == null) { throw new IllegalArgumentException("callback cannot be null"); } Objects.requireNonNull(callback, "callback cannot be null"); if (DBG) log("unregisterCallback"); Loading
framework/java/android/bluetooth/BluetoothLeBroadcastAssistant.java +13 −15 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.Executor; /** Loading Loading @@ -509,14 +510,16 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au /** * Register a {@link Callback} that will be invoked during the operation of this profile. * * Repeated registration of the same <var>callback</var> object will have no effect after the * first call to this method, even when the <var>executor</var> is different. Caller would have * to call {@link #unregisterCallback(Callback)} with the same callback object before * registering it again. * Repeated registration of the same <var>callback</var> object after the first call to this * method will result with IllegalArgumentException being thrown, even when the * <var>executor</var> is different. API caller would have to call * {@link #unregisterCallback(Callback)} with the same callback object before registering it * again. * * @param executor an {@link Executor} to execute given callback * @param callback user implementation of the {@link Callback} * @throws IllegalArgumentException if a null executor, sink, or callback is given * @throws NullPointerException if a null executor, or callback is given, or * IllegalArgumentException if the same <var>callback<var> is already registered. * @hide */ @SystemApi Loading @@ -527,12 +530,8 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au }) public void registerCallback(@NonNull @CallbackExecutor Executor executor, @NonNull Callback callback) { if (executor == null) { throw new IllegalArgumentException("executor cannot be null"); } if (callback == null) { throw new IllegalArgumentException("callback cannot be null"); } Objects.requireNonNull(executor, "executor cannot be null"); Objects.requireNonNull(callback, "callback cannot be null"); log("registerCallback"); final IBluetoothLeBroadcastAssistant service = getService(); if (service == null) { Loading @@ -555,7 +554,8 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au * <p>Callbacks are automatically unregistered when application process goes away. * * @param callback user implementation of the {@link Callback} * @throws IllegalArgumentException when callback is null or when no callback is registered * @throws NullPointerException when callback is null or IllegalArgumentException when no * callback is registered * @hide */ @SystemApi Loading @@ -565,9 +565,7 @@ public final class BluetoothLeBroadcastAssistant implements BluetoothProfile, Au android.Manifest.permission.BLUETOOTH_PRIVILEGED, }) public void unregisterCallback(@NonNull Callback callback) { if (callback == null) { throw new IllegalArgumentException("callback cannot be null"); } Objects.requireNonNull(callback, "callback cannot be null"); log("unregisterCallback"); final IBluetoothLeBroadcastAssistant service = getService(); if (service == null) { Loading