Merge changes from topic "nullablecollection"

* changes:
  API: Suppress existing NullableCollections lints (TaskOrganizer)
  API: Suppress existing NullableCollections lints
This commit is contained in:
Adrian Roos
2021-02-04 15:53:34 +00:00
committed by Gerrit Code Review
9 changed files with 22 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ package android.content;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.TestApi; import android.annotation.TestApi;
import android.app.ActivityThread; import android.app.ActivityThread;
import android.os.Parcel; import android.os.Parcel;
@@ -62,6 +63,7 @@ public final class AutofillOptions implements Parcelable {
* List of allowlisted activities. * List of allowlisted activities.
*/ */
@Nullable @Nullable
@SuppressLint("NullableCollection")
public ArraySet<ComponentName> whitelistedActivitiesForAugmentedAutofill; public ArraySet<ComponentName> whitelistedActivitiesForAugmentedAutofill;
/** /**
@@ -73,6 +75,7 @@ public final class AutofillOptions implements Parcelable {
* The disabled Activities of the package. key is component name string, value is when they * The disabled Activities of the package. key is component name string, value is when they
* will be enabled. * will be enabled.
*/ */
@SuppressLint("NullableCollection")
@Nullable @Nullable
public ArrayMap<String, Long> disabledActivities; public ArrayMap<String, Long> disabledActivities;

View File

@@ -17,6 +17,7 @@ package android.content;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.TestApi; import android.annotation.TestApi;
import android.app.ActivityThread; import android.app.ActivityThread;
import android.os.Parcel; import android.os.Parcel;
@@ -73,6 +74,7 @@ public final class ContentCaptureOptions implements Parcelable {
* for all acitivites in the package). * for all acitivites in the package).
*/ */
@Nullable @Nullable
@SuppressLint("NullableCollection")
public final ArraySet<ComponentName> whitelistedComponents; public final ArraySet<ComponentName> whitelistedComponents;
/** /**
@@ -96,6 +98,7 @@ public final class ContentCaptureOptions implements Parcelable {
*/ */
public ContentCaptureOptions(int loggingLevel, int maxBufferSize, int idleFlushingFrequencyMs, public ContentCaptureOptions(int loggingLevel, int maxBufferSize, int idleFlushingFrequencyMs,
int textChangeFlushingFrequencyMs, int logHistorySize, int textChangeFlushingFrequencyMs, int logHistorySize,
@SuppressLint("NullableCollection")
@Nullable ArraySet<ComponentName> whitelistedComponents) { @Nullable ArraySet<ComponentName> whitelistedComponents) {
this(/* lite= */ false, loggingLevel, maxBufferSize, idleFlushingFrequencyMs, this(/* lite= */ false, loggingLevel, maxBufferSize, idleFlushingFrequencyMs,
textChangeFlushingFrequencyMs, logHistorySize, whitelistedComponents); textChangeFlushingFrequencyMs, logHistorySize, whitelistedComponents);

View File

@@ -5001,7 +5001,7 @@ public abstract class PackageManager {
* *
* @hide * @hide
*/ */
@SuppressWarnings("HiddenAbstractMethod") @SuppressWarnings({"HiddenAbstractMethod", "NullableCollection"})
@TestApi @TestApi
public abstract @Nullable String[] getNamesForUids(int[] uids); public abstract @Nullable String[] getNamesForUids(int[] uids);

View File

@@ -82,6 +82,7 @@ public final class InlineSuggestionInfo implements Parcelable {
public static InlineSuggestionInfo newInlineSuggestionInfo( public static InlineSuggestionInfo newInlineSuggestionInfo(
@NonNull InlinePresentationSpec presentationSpec, @NonNull InlinePresentationSpec presentationSpec,
@NonNull @Source String source, @NonNull @Source String source,
@SuppressLint("NullableCollection")
@Nullable String[] autofillHints, @NonNull @Type String type, boolean isPinned) { @Nullable String[] autofillHints, @NonNull @Type String type, boolean isPinned) {
return new InlineSuggestionInfo(presentationSpec, source, autofillHints, type, isPinned); return new InlineSuggestionInfo(presentationSpec, source, autofillHints, type, isPinned);
} }

View File

@@ -20,6 +20,7 @@ import android.annotation.BinderThread;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.annotation.RequiresPermission; import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.TestApi; import android.annotation.TestApi;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.os.RemoteException; import android.os.RemoteException;
@@ -101,6 +102,7 @@ public class TaskOrganizer extends WindowOrganizer {
/** Gets direct child tasks (ordered from top-to-bottom) */ /** Gets direct child tasks (ordered from top-to-bottom) */
@RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
@Nullable @Nullable
@SuppressLint("NullableCollection")
public static List<ActivityManager.RunningTaskInfo> getChildTasks( public static List<ActivityManager.RunningTaskInfo> getChildTasks(
@NonNull WindowContainerToken parent, @NonNull int[] activityTypes) { @NonNull WindowContainerToken parent, @NonNull int[] activityTypes) {
try { try {
@@ -113,6 +115,7 @@ public class TaskOrganizer extends WindowOrganizer {
/** Gets all root tasks on a display (ordered from top-to-bottom) */ /** Gets all root tasks on a display (ordered from top-to-bottom) */
@RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
@Nullable @Nullable
@SuppressLint("NullableCollection")
public static List<ActivityManager.RunningTaskInfo> getRootTasks( public static List<ActivityManager.RunningTaskInfo> getRootTasks(
int displayId, @NonNull int[] activityTypes) { int displayId, @NonNull int[] activityTypes) {
try { try {

View File

@@ -1445,6 +1445,7 @@ public class LocationManager {
@TestApi @TestApi
@RequiresPermission(Manifest.permission.READ_DEVICE_CONFIG) @RequiresPermission(Manifest.permission.READ_DEVICE_CONFIG)
@Nullable @Nullable
@SuppressWarnings("NullableCollection")
public List<String> getProviderPackages(@NonNull String provider) { public List<String> getProviderPackages(@NonNull String provider) {
try { try {
return mService.getProviderPackages(provider); return mService.getProviderPackages(provider);

View File

@@ -20,6 +20,7 @@ import android.annotation.IntDef;
import android.annotation.IntRange; import android.annotation.IntRange;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage; import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context; import android.content.Context;
@@ -775,7 +776,8 @@ public abstract class NetworkAgent {
* @param underlyingNetworks the new list of underlying networks. * @param underlyingNetworks the new list of underlying networks.
* @see {@link VpnService.Builder#setUnderlyingNetworks(Network[])} * @see {@link VpnService.Builder#setUnderlyingNetworks(Network[])}
*/ */
public final void setUnderlyingNetworks(@Nullable List<Network> underlyingNetworks) { public final void setUnderlyingNetworks(
@SuppressLint("NullableCollection") @Nullable List<Network> underlyingNetworks) {
final ArrayList<Network> underlyingArray = (underlyingNetworks != null) final ArrayList<Network> underlyingArray = (underlyingNetworks != null)
? new ArrayList<>(underlyingNetworks) : null; ? new ArrayList<>(underlyingNetworks) : null;
queueOrSendMessage(reg -> reg.sendUnderlyingNetworks(underlyingArray)); queueOrSendMessage(reg -> reg.sendUnderlyingNetworks(underlyingArray));

View File

@@ -18,6 +18,7 @@ package android.telecom;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.annotation.TestApi; import android.annotation.TestApi;
import android.net.Uri; import android.net.Uri;
@@ -67,7 +68,8 @@ public final class ConnectionRequest implements Parcelable {
* Sets the participants for the resulting {@link ConnectionRequest} * Sets the participants for the resulting {@link ConnectionRequest}
* @param participants The participants to which the {@link Connection} is to connect. * @param participants The participants to which the {@link Connection} is to connect.
*/ */
public @NonNull Builder setParticipants(@Nullable List<Uri> participants) { public @NonNull Builder setParticipants(
@SuppressLint("NullableCollection") @Nullable List<Uri> participants) {
this.mParticipants = participants; this.mParticipants = participants;
return this; return this;
} }

View File

@@ -18,6 +18,7 @@ package android.telephony.ims;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.telephony.ims.stub.SipDelegate; import android.telephony.ims.stub.SipDelegate;
import android.telephony.ims.stub.SipTransportImplBase; import android.telephony.ims.stub.SipTransportImplBase;
@@ -52,7 +53,9 @@ public interface DelegateStateCallback {
* implementing this feature elsewhere. If all features of this {@link SipDelegate} are * implementing this feature elsewhere. If all features of this {@link SipDelegate} are
* denied, this method should still be called. * denied, this method should still be called.
*/ */
void onCreated(@NonNull SipDelegate delegate, @Nullable Set<FeatureTagState> deniedTags); void onCreated(@NonNull SipDelegate delegate,
@SuppressLint("NullableCollection") // TODO(b/154763999): Mark deniedTags @Nonnull
@Nullable Set<FeatureTagState> deniedTags);
/** /**
* This must be called by the ImsService after the framework calls * This must be called by the ImsService after the framework calls