Add maxTargetSdk restriction to unused APIs.

These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
This commit is contained in:
Mathew Inwood
2020-10-27 11:47:29 +00:00
parent 69bca6a513
commit 72f07d6a8a
642 changed files with 2403 additions and 2030 deletions

View File

@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import java.io.BufferedReader;
import java.io.FileReader;
@@ -85,7 +86,7 @@ public class EventLog {
private static final byte FLOAT_TYPE = 4;
/** @param data containing event, read from the system */
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
/*package*/ Event(byte[] data) {
mBuffer = ByteBuffer.wrap(data);
mBuffer.order(ByteOrder.nativeOrder());

View File

@@ -23,6 +23,7 @@ import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.UserHandle;
import android.os.UserManager;
@@ -51,7 +52,7 @@ public class IconDrawableFactory {
return appInfo.isInstantApp() || mUm.hasBadge(userId);
}
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public Drawable getBadgedIcon(ApplicationInfo appInfo) {
return getBadgedIcon(appInfo, UserHandle.getUserId(appInfo.uid));
}

View File

@@ -17,6 +17,7 @@
package android.util;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.SystemClock;
import java.io.FileDescriptor;
@@ -112,7 +113,7 @@ public final class LocalLog {
ReadOnlyLocalLog(LocalLog log) {
mLog = log;
}
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
mLog.dump(pw);
}
@@ -127,7 +128,7 @@ public final class LocalLog {
}
}
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public ReadOnlyLocalLog readOnlyLocalLog() {
return new ReadOnlyLocalLog(this);
}

View File

@@ -17,6 +17,7 @@
package android.util;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import java.io.Writer;
@@ -39,7 +40,7 @@ public class LogWriter extends Writer {
* {@link android.util.Log#ERROR Log.ERROR}.
* @param tag A string tag to associate with each printed log statement.
*/
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public LogWriter(int priority, String tag) {
mPriority = priority;
mTag = tag;

View File

@@ -18,6 +18,7 @@ package android.util;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.Preconditions;
@@ -45,7 +46,7 @@ public class LongArray implements Cloneable {
/**
* Creates an empty LongArray with the default initial capacity.
*/
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public LongArray() {
this(10);
}
@@ -104,7 +105,7 @@ public class LongArray implements Cloneable {
*
* @throws IndexOutOfBoundsException when index < 0 || index > size()
*/
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public void add(int index, long value) {
ensureCapacity(1);
int rightSegment = mSize - index;
@@ -208,7 +209,7 @@ public class LongArray implements Cloneable {
/**
* Returns the number of values in this array.
*/
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public int size() {
return mSize;
}

View File

@@ -26,6 +26,7 @@ import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkInfo;
import android.net.SntpClient;
import android.os.Build;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
@@ -138,7 +139,7 @@ public class NtpTrustedTime implements TrustedTime {
return sSingleton;
}
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public boolean forceRefresh() {
synchronized (this) {
NtpConnectionInfo connectionInfo = getNtpConnectionInfo();
@@ -181,7 +182,7 @@ public class NtpTrustedTime implements TrustedTime {
* @deprecated Use {@link #getCachedTimeResult()} to obtain a {@link TimeResult} atomically.
*/
@Deprecated
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public boolean hasCache() {
return mTimeResult != null;
}
@@ -208,7 +209,7 @@ public class NtpTrustedTime implements TrustedTime {
* @deprecated Use {@link #getCachedTimeResult()} to obtain a {@link TimeResult} atomically.
*/
@Deprecated
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public long currentTimeMillis() {
TimeResult timeResult = mTimeResult;
if (timeResult == null) {
@@ -227,7 +228,7 @@ public class NtpTrustedTime implements TrustedTime {
* @deprecated Use {@link #getCachedTimeResult()} to obtain a {@link TimeResult} atomically.
*/
@Deprecated
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public long getCachedNtpTime() {
if (LOGD) Log.d(TAG, "getCachedNtpTime() cache hit");
TimeResult timeResult = mTimeResult;
@@ -240,7 +241,7 @@ public class NtpTrustedTime implements TrustedTime {
* @deprecated Use {@link #getCachedTimeResult()} to obtain a {@link TimeResult} atomically.
*/
@Deprecated
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public long getCachedNtpTimeReference() {
TimeResult timeResult = mTimeResult;
return timeResult == null ? 0 : timeResult.getElapsedRealtimeMillis();

View File

@@ -16,6 +16,7 @@ package android.util;
import android.compat.annotation.UnsupportedAppUsage;
import android.graphics.Path;
import android.os.Build;
import dalvik.annotation.optimization.FastNative;
@@ -29,7 +30,7 @@ public class PathParser {
* @param pathString The string representing a path, the same as "d" string in svg file.
* @return the generated Path object.
*/
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static Path createPathFromPathData(String pathString) {
if (pathString == null) {
throw new IllegalArgumentException("Path string can not be null.");

View File

@@ -19,6 +19,7 @@ import static com.android.internal.util.Preconditions.checkNotNull;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import java.io.IOException;
import java.io.InvalidObjectException;
@@ -77,9 +78,9 @@ public final class Rational extends Number implements Comparable<Rational> {
* Do not change the order of these fields or add new instance fields to maintain the
* Serializable compatibility across API revisions.
*/
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
private final int mNumerator;
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
private final int mDenominator;
/**

View File

@@ -18,6 +18,7 @@ package android.util;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
@@ -51,7 +52,7 @@ public class RecurrenceRule implements Parcelable {
@VisibleForTesting
public static Clock sClock = Clock.systemDefaultZone();
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public final ZonedDateTime start;
public final ZonedDateTime end;
public final Period period;
@@ -68,7 +69,7 @@ public class RecurrenceRule implements Parcelable {
}
@Deprecated
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static RecurrenceRule buildRecurringMonthly(int dayOfMonth, ZoneId zone) {
// Assume we started last January, since it has all possible days
final ZonedDateTime now = ZonedDateTime.now(sClock).withZoneSameInstant(zone);

View File

@@ -89,7 +89,7 @@ public final class Slog {
* will always be handled asynchronously. Primarily for use by coding running within
* the system process.
*/
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static int wtf(String tag, String msg) {
return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, false, true);
}
@@ -130,7 +130,7 @@ public final class Slog {
return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, tr, false, true);
}
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static int println(int priority, String tag, String msg) {
return Log.println_native(Log.LOG_ID_SYSTEM, priority, tag, msg);
}

View File

@@ -363,7 +363,7 @@ public class TimeUtils {
* @return String representation of the time.
* @hide
*/
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static String logTimeOfDay(long millis) {
Calendar c = Calendar.getInstance();
if (millis >= 0) {

View File

@@ -17,6 +17,7 @@
package android.util;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
/**
* Interface that provides trusted time information, possibly coming from an NTP
@@ -52,7 +53,7 @@ public interface TrustedTime {
* @deprecated Only kept for UnsupportedAppUsage. Do not use. See {@link NtpTrustedTime}
*/
@Deprecated
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public long getCacheAge();
/**