Merge "Fix NPE in CompanionDeviceServiceConnector" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2d3584caeb
@@ -51,12 +51,12 @@ class CompanionDeviceServiceConnector extends ServiceConnector.Impl<ICompanionDe
|
|||||||
void onBindingDied(@UserIdInt int userId, @NonNull String packageName);
|
void onBindingDied(@UserIdInt int userId, @NonNull String packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserIdInt
|
private final @UserIdInt int mUserId;
|
||||||
private final int mUserId;
|
private final @NonNull ComponentName mComponentName;
|
||||||
@NonNull
|
// IMPORTANT: this can (and will!) be null (at the moment, CompanionApplicationController only
|
||||||
private final ComponentName mComponentName;
|
// installs a listener to the primary ServiceConnector), hence we should always null-check the
|
||||||
@Nullable
|
// reference before calling on it.
|
||||||
private Listener mListener;
|
private @Nullable Listener mListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a CompanionDeviceServiceConnector instance.
|
* Create a CompanionDeviceServiceConnector instance.
|
||||||
@@ -125,7 +125,9 @@ class CompanionDeviceServiceConnector extends ServiceConnector.Impl<ICompanionDe
|
|||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "onBindingDied() " + mComponentName.toShortString());
|
if (DEBUG) Log.d(TAG, "onBindingDied() " + mComponentName.toShortString());
|
||||||
|
|
||||||
mListener.onBindingDied(mUserId, mComponentName.getPackageName());
|
if (mListener != null) {
|
||||||
|
mListener.onBindingDied(mUserId, mComponentName.getPackageName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user