API: Suppress existing NullableCollections lints (S edition)

Bug: 152525509
Test: make checkapi
Change-Id: Idf96709bf93ef49ca5ad3cdd1f14d06e0d9e09d7
Exempt-From-Owner-Approval: API lint large scale change
This commit is contained in:
Adrian Roos
2021-01-29 19:15:22 +01:00
parent e148e669b7
commit d7f33cd648
21 changed files with 59 additions and 17 deletions

View File

@@ -21,6 +21,7 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.SystemApi.Client;
import android.annotation.TestApi;
@@ -1275,6 +1276,7 @@ public final class PendingIntent implements Parcelable {
* @param flags MATCH_* flags from {@link android.content.pm.PackageManager}.
* @hide
*/
@SuppressLint("NullableCollection")
@RequiresPermission(permission.GET_INTENT_SENDER_INTENT)
@SystemApi(client = Client.MODULE_LIBRARIES)
public @Nullable List<ResolveInfo> queryIntentComponents(@ResolveInfoFlags int flags) {

View File

@@ -2,6 +2,7 @@ package android.app.assist;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.app.Activity;
import android.content.ComponentName;
@@ -1542,6 +1543,7 @@ public class AssistStructure implements Parcelable {
* {@link View#getOnReceiveContentMimeTypes()} for details.
*/
@Nullable
@SuppressLint("NullableCollection")
public String[] getOnReceiveContentMimeTypes() {
return mOnReceiveContentMimeTypes;
}

View File

@@ -17,6 +17,7 @@ package android.app.search;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.os.Bundle;
import android.os.Parcel;
@@ -46,6 +47,7 @@ public final class Query implements Parcelable {
public Query(@NonNull String input,
long timestamp,
@SuppressLint("NullableCollection")
@Nullable Bundle extras) {
mInput = input;
mTimestamp = timestamp;
@@ -69,6 +71,7 @@ public final class Query implements Parcelable {
}
@Nullable
@SuppressLint("NullableCollection")
public Bundle getExtras() {
return mExtras;
}

View File

@@ -18,6 +18,7 @@ package android.app.search;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.app.PendingIntent;
import android.content.Intent;
@@ -167,6 +168,7 @@ public final class SearchAction implements Parcelable {
/**
* Returns the extra bundle for this object.
*/
@SuppressLint("NullableCollection")
public @Nullable Bundle getExtras() {
return mExtras;
}
@@ -325,7 +327,8 @@ public final class SearchAction implements Parcelable {
* Sets the extra.
*/
@NonNull
public SearchAction.Builder setExtras(@Nullable Bundle extras) {
public SearchAction.Builder setExtras(
@SuppressLint("NullableCollection") @Nullable Bundle extras) {
mExtras = extras;
return this;
}

View File

@@ -17,6 +17,7 @@ package android.app.search;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.os.Bundle;
import android.os.Parcel;
@@ -52,7 +53,7 @@ public final class SearchContext implements Parcelable {
public SearchContext(int resultTypes,
int queryTimeoutMillis,
@Nullable Bundle extras) {
@SuppressLint("NullableCollection") @Nullable Bundle extras) {
mResultTypes = resultTypes;
mTimeoutMillis = queryTimeoutMillis;
mExtras = extras;
@@ -83,6 +84,7 @@ public final class SearchContext implements Parcelable {
}
@Nullable
@SuppressLint("NullableCollection")
public Bundle getExtras() {
return mExtras;
}

View File

@@ -17,6 +17,7 @@ package android.app.search;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.appwidget.AppWidgetProviderInfo;
import android.content.pm.ShortcutInfo;
@@ -224,6 +225,7 @@ public final class SearchTarget implements Parcelable {
* Return extra bundle.
*/
@Nullable
@SuppressLint("NullableCollection")
public Bundle getExtras() {
return mExtras;
}
@@ -386,7 +388,7 @@ public final class SearchTarget implements Parcelable {
* TODO: add comment
*/
@NonNull
public Builder setExtras(@Nullable Bundle extras) {
public Builder setExtras(@SuppressLint("NullableCollection") @Nullable Bundle extras) {
mExtras = extras;
return this;
}

View File

@@ -6134,6 +6134,7 @@ public abstract class Context {
@UiContext
@NonNull
public Context createWindowContext(@NonNull Display display, @WindowType int type,
@SuppressLint("NullableCollection")
@Nullable Bundle options) {
throw new RuntimeException("Not implemented. Must override in a subclass.");
}

View File

@@ -222,7 +222,7 @@ public class PackageInfo implements Parcelable {
* &lt;attribution&gt;} tags included under &lt;manifest&gt;, or null if there were none. This
* is only filled if the flag {@link PackageManager#GET_ATTRIBUTIONS} was set.
*/
@SuppressWarnings("ArrayReturn")
@SuppressWarnings({"ArrayReturn", "NullableCollection"})
public @Nullable Attribution[] attributions;
/**

View File

@@ -129,14 +129,14 @@ public final class Dataset implements Parcelable {
/** @hide */
@TestApi
@SuppressLint("ConcreteCollection")
@SuppressLint({"ConcreteCollection", "NullableCollection"})
public @Nullable ArrayList<AutofillId> getFieldIds() {
return mFieldIds;
}
/** @hide */
@TestApi
@SuppressLint("ConcreteCollection")
@SuppressLint({"ConcreteCollection", "NullableCollection"})
public @Nullable ArrayList<AutofillValue> getFieldValues() {
return mFieldValues;
}

View File

@@ -345,7 +345,8 @@ public class VoiceInteractionService extends Service {
*/
@SystemApi
@HotwordConfigResult
public final int setHotwordDetectionConfig(@Nullable Bundle options) {
public final int setHotwordDetectionConfig(
@SuppressLint("NullableCollection") @Nullable Bundle options) {
if (mSystemService == null) {
throw new IllegalStateException("Not available until onReady() is called");
}

View File

@@ -19,6 +19,7 @@ package android.view;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.content.ClipData;
import android.content.ClipDescription;
@@ -204,6 +205,7 @@ public final class ContentInfo {
* the IME.
*/
@Nullable
@SuppressLint("NullableCollection")
public Bundle getExtras() {
return mExtras;
}
@@ -347,7 +349,7 @@ public final class ContentInfo {
* @return this builder
*/
@NonNull
public Builder setExtras(@Nullable Bundle extras) {
public Builder setExtras(@SuppressLint("NullableCollection") @Nullable Bundle extras) {
mExtras = extras;
return this;
}

View File

@@ -41,6 +41,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Size;
import android.annotation.StyleRes;
import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.annotation.UiContext;
import android.annotation.UiThread;
@@ -9030,7 +9031,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* not be null or empty if a non-null listener is passed in.
* @param listener The listener to use. This can be null to reset to the default behavior.
*/
public void setOnReceiveContentListener(@Nullable String[] mimeTypes,
public void setOnReceiveContentListener(
@SuppressLint("NullableCollection") @Nullable String[] mimeTypes,
@Nullable OnReceiveContentListener listener) {
if (listener != null) {
Preconditions.checkArgument(mimeTypes != null && mimeTypes.length > 0,
@@ -9106,6 +9108,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @return The MIME types accepted by {@link #performReceiveContent} for this view (may
* include patterns such as "image/*").
*/
@SuppressLint("NullableCollection")
@Nullable
public String[] getOnReceiveContentMimeTypes() {
return mOnReceiveContentMimeTypes;

View File

@@ -18,6 +18,7 @@ package android.view;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.os.Bundle;
@@ -377,7 +378,8 @@ public abstract class ViewStructure {
* <p>Should only be set when the node is used for Autofill or Content Capture purposes - it
* will be ignored when used for Assist.
*/
public void setOnReceiveContentMimeTypes(@Nullable String[] mimeTypes) {}
public void setOnReceiveContentMimeTypes(
@SuppressLint("NullableCollection") @Nullable String[] mimeTypes) {}
/**
* Sets the {@link android.text.InputType} bits of this node.

View File

@@ -187,7 +187,8 @@ public final class TextServicesManager {
* @return The spell checker session of the spell checker.
*/
@Nullable
public SpellCheckerSession newSpellCheckerSession(@Nullable Bundle bundle,
public SpellCheckerSession newSpellCheckerSession(
@SuppressLint("NullableCollection") @Nullable Bundle bundle,
@SuppressLint("UseIcu") @Nullable Locale locale,
@NonNull SpellCheckerSessionListener listener,
@SuppressLint("ListenerLast") boolean referToSpellCheckerLanguageSettings,
@@ -277,6 +278,7 @@ public final class TextServicesManager {
* @return The list of currently enabled spell checkers.
*/
@Nullable
@SuppressLint("NullableCollection")
public List<SpellCheckerInfo> getEnabledSpellCheckersList() {
final SpellCheckerInfo[] enabledSpellCheckers = getEnabledSpellCheckers();
return enabledSpellCheckers != null ? Arrays.asList(enabledSpellCheckers) : null;

View File

@@ -31,6 +31,7 @@ import android.annotation.FloatRange;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.os.Parcel;
@@ -1775,6 +1776,7 @@ public final class GnssMeasurement implements Parcelable {
*/
@Nullable
@SystemApi
@SuppressLint("NullableCollection")
public Collection<CorrelationVector> getCorrelationVectors() {
return mReadOnlyCorrelationVectors;
}
@@ -1785,7 +1787,9 @@ public final class GnssMeasurement implements Parcelable {
* @hide
*/
@TestApi
public void setCorrelationVectors(@Nullable Collection<CorrelationVector> correlationVectors) {
public void setCorrelationVectors(
@SuppressLint("NullableCollection")
@Nullable Collection<CorrelationVector> correlationVectors) {
if (correlationVectors == null || correlationVectors.isEmpty()) {
resetCorrelationVectors();
} else {

View File

@@ -2233,6 +2233,7 @@ public class LocationManager {
* @see #getGnssCapabilities()
*/
@Nullable
@SuppressLint("NullableCollection")
public List<GnssAntennaInfo> getGnssAntennaInfos() {
try {
return mService.getGnssAntennaInfos();

View File

@@ -255,7 +255,9 @@ public abstract class LocationProviderBase {
/**
* Implements optional custom commands.
*/
public abstract void onSendExtraCommand(@NonNull String command, @Nullable Bundle extras);
public abstract void onSendExtraCommand(@NonNull String command,
@SuppressLint("NullableCollection")
@Nullable Bundle extras);
private final class Service extends ILocationProvider.Stub {

View File

@@ -23,6 +23,7 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.content.Context;
@@ -90,7 +91,9 @@ public class MusicRecognitionManager {
* supplied bundle
*/
void onRecognitionSucceeded(@NonNull RecognitionRequest recognitionRequest,
@NonNull MediaMetadata result, @Nullable Bundle extras);
@NonNull MediaMetadata result,
@SuppressLint("NullableCollection")
@Nullable Bundle extras);
/**
* Invoked when the search is not successful (possibly but not necessarily due to error).

View File

@@ -20,6 +20,7 @@ import static com.android.internal.util.function.pooled.PooledLambda.obtainMessa
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.app.Service;
import android.content.Intent;
@@ -53,7 +54,9 @@ public abstract class MusicRecognitionService extends Service {
* @param extras extra data to be supplied back to the caller. Note that all executable
* parameters and file descriptors would be removed from the supplied bundle
*/
void onRecognitionSucceeded(@NonNull MediaMetadata result, @Nullable Bundle extras);
void onRecognitionSucceeded(@NonNull MediaMetadata result,
@SuppressLint("NullableCollection")
@Nullable Bundle extras);
/**
* Call this method if the search does not find a result on an error occurred.

View File

@@ -22,6 +22,7 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.content.Context;
import android.hardware.tv.tuner.V1_0.Constants;
@@ -1017,6 +1018,7 @@ public class Tuner implements AutoCloseable {
* failed.
*/
@Nullable
@SuppressLint("NullableCollection")
public List<FrontendInfo> getAvailableFrontendInfos() {
FrontendInfo[] feInfoList = getFrontendInfoListInternal();
if (feInfoList == null) {

View File

@@ -20,6 +20,7 @@ import android.annotation.CallbackExecutor;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.app.AlarmManager;
@@ -948,8 +949,9 @@ public class WifiNl80211Manager {
* has been set up).
*/
public boolean startScan(@NonNull String ifaceName, @WifiAnnotations.ScanType int scanType,
@Nullable Set<Integer> freqs, @Nullable List<byte[]> hiddenNetworkSSIDs,
@Nullable Bundle extraScanningParams) {
@SuppressLint("NullableCollection") @Nullable Set<Integer> freqs,
@SuppressLint("NullableCollection") @Nullable List<byte[]> hiddenNetworkSSIDs,
@SuppressLint("NullableCollection") @Nullable Bundle extraScanningParams) {
IWifiScannerImpl scannerImpl = getScannerImpl(ifaceName);
if (scannerImpl == null) {
Log.e(TAG, "No valid wificond scanner interface handler for iface=" + ifaceName);