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.Nullable;
import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.app.ActivityThread;
import android.os.Parcel;
@@ -62,6 +63,7 @@ public final class AutofillOptions implements Parcelable {
* List of allowlisted activities.
*/
@Nullable
@SuppressLint("NullableCollection")
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
* will be enabled.
*/
@SuppressLint("NullableCollection")
@Nullable
public ArrayMap<String, Long> disabledActivities;

View File

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

View File

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

View File

@@ -82,6 +82,7 @@ public final class InlineSuggestionInfo implements Parcelable {
public static InlineSuggestionInfo newInlineSuggestionInfo(
@NonNull InlinePresentationSpec presentationSpec,
@NonNull @Source String source,
@SuppressLint("NullableCollection")
@Nullable String[] autofillHints, @NonNull @Type String type, boolean 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.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.app.ActivityManager;
import android.os.RemoteException;
@@ -101,6 +102,7 @@ public class TaskOrganizer extends WindowOrganizer {
/** Gets direct child tasks (ordered from top-to-bottom) */
@RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
@Nullable
@SuppressLint("NullableCollection")
public static List<ActivityManager.RunningTaskInfo> getChildTasks(
@NonNull WindowContainerToken parent, @NonNull int[] activityTypes) {
try {
@@ -113,6 +115,7 @@ public class TaskOrganizer extends WindowOrganizer {
/** Gets all root tasks on a display (ordered from top-to-bottom) */
@RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS)
@Nullable
@SuppressLint("NullableCollection")
public static List<ActivityManager.RunningTaskInfo> getRootTasks(
int displayId, @NonNull int[] activityTypes) {
try {

View File

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

View File

@@ -20,6 +20,7 @@ import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
@@ -775,7 +776,8 @@ public abstract class NetworkAgent {
* @param underlyingNetworks the new list of underlying networks.
* @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)
? new ArrayList<>(underlyingNetworks) : null;
queueOrSendMessage(reg -> reg.sendUnderlyingNetworks(underlyingArray));

View File

@@ -18,6 +18,7 @@ package android.telecom;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.net.Uri;
@@ -67,7 +68,8 @@ public final class ConnectionRequest implements Parcelable {
* Sets the participants for the resulting {@link ConnectionRequest}
* @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;
return this;
}

View File

@@ -18,6 +18,7 @@ package android.telephony.ims;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.telephony.ims.stub.SipDelegate;
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
* 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