/** Converts this OnBlobRetrievedListener to a parcelable object */
@NonNull
- static IOnBlobRetrievedListener toAIDL(final OnBlobRetrievedListener listener) {
+ static IOnBlobRetrievedListener toAIDL(@NonNull final OnBlobRetrievedListener listener) {
return new IOnBlobRetrievedListener.Stub() {
@Override
public void onBlobRetrieved(final StatusParcelable statusParcelable, final String l2Key,
final String name, final Blob blob) {
- listener.onBlobRetrieved(new Status(statusParcelable), l2Key, name, blob);
+ // NonNull, but still don't crash the system server if null
+ if (null != listener) {
+ listener.onBlobRetrieved(new Status(statusParcelable), l2Key, name, blob);
+ }
}
};
}
/** Converts this OnL2KeyResponseListener to a parcelable object */
@NonNull
- static IOnL2KeyResponseListener toAIDL(final OnL2KeyResponseListener listener) {
+ static IOnL2KeyResponseListener toAIDL(@NonNull final OnL2KeyResponseListener listener) {
return new IOnL2KeyResponseListener.Stub() {
@Override
public void onL2KeyResponse(final StatusParcelable statusParcelable,
final String l2Key) {
- listener.onL2KeyResponse(new Status(statusParcelable), l2Key);
+ // NonNull, but still don't crash the system server if null
+ if (null != listener) {
+ listener.onL2KeyResponse(new Status(statusParcelable), l2Key);
+ }
}
};
}
/** Converts this OnNetworkAttributesRetrievedListener to a parcelable object */
@NonNull
static IOnNetworkAttributesRetrievedListener toAIDL(
- final OnNetworkAttributesRetrievedListener listener) {
+ @NonNull final OnNetworkAttributesRetrievedListener listener) {
return new IOnNetworkAttributesRetrievedListener.Stub() {
@Override
public void onNetworkAttributesRetrieved(final StatusParcelable statusParcelable,
final String l2Key,
final NetworkAttributesParcelable networkAttributesParcelable) {
- listener.onNetworkAttributesRetrieved(
- new Status(statusParcelable), l2Key,
- new NetworkAttributes(networkAttributesParcelable));
+ // NonNull, but still don't crash the system server if null
+ if (null != listener) {
+ listener.onNetworkAttributesRetrieved(
+ new Status(statusParcelable), l2Key,
+ new NetworkAttributes(networkAttributesParcelable));
+ }
}
};
}
/** Converts this OnSameL3NetworkResponseListener to a parcelable object */
@NonNull
- static IOnSameL3NetworkResponseListener toAIDL(final OnSameL3NetworkResponseListener listener) {
+ static IOnSameL3NetworkResponseListener toAIDL(
+ @NonNull final OnSameL3NetworkResponseListener listener) {
return new IOnSameL3NetworkResponseListener.Stub() {
@Override
public void onSameL3NetworkResponse(final StatusParcelable statusParcelable,
final SameL3NetworkResponseParcelable sameL3NetworkResponseParcelable) {
- listener.onSameL3NetworkResponse(
- new Status(statusParcelable),
- new SameL3NetworkResponse(sameL3NetworkResponseParcelable));
+ // NonNull, but still don't crash the system server if null
+ if (null != listener) {
+ listener.onSameL3NetworkResponse(
+ new Status(statusParcelable),
+ new SameL3NetworkResponse(sameL3NetworkResponseParcelable));
+ }
}
};
}
package android.net.ipmemorystore;
import android.annotation.NonNull;
+import android.annotation.Nullable;
/**
* A listener for the IpMemoryStore to return a status to a client.
/** Converts this OnStatusListener to a parcelable object */
@NonNull
- static IOnStatusListener toAIDL(final OnStatusListener listener) {
+ static IOnStatusListener toAIDL(@Nullable final OnStatusListener listener) {
return new IOnStatusListener.Stub() {
@Override
public void onComplete(final StatusParcelable statusParcelable) {
- listener.onComplete(new Status(statusParcelable));
+ if (null != listener) {
+ listener.onComplete(new Status(statusParcelable));
+ }
}
};
}