[nearby] Catches NPE in ChreDiscoveryProvider

Test: -m
Ignore-AOSP-First: neary not in aosp yet
Fix: 298597342
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5d07eee4c1671a3d1d6b6669c338d098cfe488f9)
Merged-In: I1ef411aea6db6d0c169aa08c303f4234c77baed9
Change-Id: I1ef411aea6db6d0c169aa08c303f4234c77baed9
This commit is contained in:
Xinyi Zhou
2023-09-11 15:38:52 -07:00
committed by Android Build Cherrypicker Worker
parent a3eb71b633
commit e899d26468
2 changed files with 3 additions and 1 deletions

View File

@@ -284,6 +284,8 @@ public class NearbyManager {
*/ */
public void queryOffloadCapability(@NonNull @CallbackExecutor Executor executor, public void queryOffloadCapability(@NonNull @CallbackExecutor Executor executor,
@NonNull Consumer<OffloadCapability> callback) { @NonNull Consumer<OffloadCapability> callback) {
Objects.requireNonNull(executor);
Objects.requireNonNull(callback);
try { try {
mService.queryOffloadCapability(new OffloadTransport(executor, callback)); mService.queryOffloadCapability(new OffloadTransport(executor, callback));
} catch (RemoteException e) { } catch (RemoteException e) {

View File

@@ -155,7 +155,7 @@ public class ChreDiscoveryProvider extends AbstractDiscoveryProvider {
builder.setFastPairSupported(version != ChreCommunication.INVALID_NANO_APP_VERSION); builder.setFastPairSupported(version != ChreCommunication.INVALID_NANO_APP_VERSION);
try { try {
callback.onQueryComplete(builder.build()); callback.onQueryComplete(builder.build());
} catch (RemoteException e) { } catch (RemoteException | NullPointerException e) {
e.printStackTrace(); e.printStackTrace();
} }
}); });