Revert "Add maxTargetSdk restriction to unused APIs."

This reverts commit 3950aab83b.

Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397

Bug: 171886397
Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
This commit is contained in:
Hongwei Wang
2020-10-28 19:38:11 +00:00
parent 3950aab83b
commit 2feaa993c2
8 changed files with 39 additions and 44 deletions

View File

@@ -34,7 +34,6 @@ import android.net.NetworkTemplate;
import android.net.netstats.provider.INetworkStatsProviderCallback;
import android.net.netstats.provider.NetworkStatsProvider;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
@@ -130,7 +129,7 @@ public class NetworkStatsManager {
/**
* {@hide}
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public NetworkStatsManager(Context context) throws ServiceNotFoundException {
this(context, INetworkStatsService.Stub.asInterface(
ServiceManager.getServiceOrThrow(Context.NETWORK_STATS_SERVICE)));
@@ -154,7 +153,7 @@ public class NetworkStatsManager {
}
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
@TestApi
public void setPollForce(boolean pollForce) {
if (pollForce) {

View File

@@ -23,7 +23,6 @@ import android.annotation.SystemService;
import android.annotation.TestApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
@@ -77,7 +76,7 @@ public class EthernetManager {
* @param isAvailable {@code true} if Ethernet port exists.
* @hide
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
void onAvailabilityChanged(String iface, boolean isAvailable);
}
@@ -98,7 +97,7 @@ public class EthernetManager {
* @return the Ethernet Configuration, contained in {@link IpConfiguration}.
* @hide
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public IpConfiguration getConfiguration(String iface) {
try {
return mService.getConfiguration(iface);
@@ -111,7 +110,7 @@ public class EthernetManager {
* Set Ethernet configuration.
* @hide
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public void setConfiguration(String iface, IpConfiguration config) {
try {
mService.setConfiguration(iface, config);
@@ -124,7 +123,7 @@ public class EthernetManager {
* Indicates whether the system currently has one or more Ethernet interfaces.
* @hide
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public boolean isAvailable() {
return getAvailableInterfaces().length > 0;
}
@@ -135,7 +134,7 @@ public class EthernetManager {
* @param iface Ethernet interface name
* @hide
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public boolean isAvailable(String iface) {
try {
return mService.isAvailable(iface);
@@ -150,7 +149,7 @@ public class EthernetManager {
* @throws IllegalArgumentException If the listener is null.
* @hide
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public void addListener(Listener listener) {
if (listener == null) {
throw new IllegalArgumentException("listener must not be null");
@@ -169,7 +168,7 @@ public class EthernetManager {
* Returns an array of available Ethernet interface names.
* @hide
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public String[] getAvailableInterfaces() {
try {
return mService.getAvailableInterfaces();
@@ -184,7 +183,7 @@ public class EthernetManager {
* @throws IllegalArgumentException If the listener is null.
* @hide
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public void removeListener(Listener listener) {
if (listener == null) {
throw new IllegalArgumentException("listener must not be null");

View File

@@ -42,7 +42,7 @@ interface INetworkStatsService {
* PACKAGE_USAGE_STATS permission is always checked. If PACKAGE_USAGE_STATS is not granted
* READ_NETWORK_USAGE_STATS is checked for.
*/
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
@UnsupportedAppUsage
INetworkStatsSession openSessionForUsageStats(int flags, String callingPackage);
/** Return data layer snapshot of UID network usage. */

View File

@@ -21,7 +21,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
@@ -220,11 +219,11 @@ public final class NetworkStats implements Parcelable {
* generated.
*/
private long elapsedRealtime;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
private int size;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
private int capacity;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
private String[] iface;
@UnsupportedAppUsage
private int[] uid;
@@ -232,21 +231,21 @@ public final class NetworkStats implements Parcelable {
private int[] set;
@UnsupportedAppUsage
private int[] tag;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
private int[] metered;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
private int[] roaming;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
private int[] defaultNetwork;
@UnsupportedAppUsage
private long[] rxBytes;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
private long[] rxPackets;
@UnsupportedAppUsage
private long[] txBytes;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
private long[] txPackets;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
private long[] operations;
/**
@@ -259,7 +258,7 @@ public final class NetworkStats implements Parcelable {
@SystemApi
public static class Entry {
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public String iface;
/** @hide */
@UnsupportedAppUsage
@@ -268,7 +267,7 @@ public final class NetworkStats implements Parcelable {
@UnsupportedAppUsage
public int set;
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public int tag;
/**
* Note that this is only populated w/ the default value when read from /proc or written
@@ -295,20 +294,20 @@ public final class NetworkStats implements Parcelable {
@UnsupportedAppUsage
public long rxBytes;
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public long rxPackets;
/** @hide */
@UnsupportedAppUsage
public long txBytes;
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public long txPackets;
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public long operations;
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public Entry() {
this(IFACE_ALL, UID_ALL, SET_DEFAULT, TAG_NONE, 0L, 0L, 0L, 0L, 0L);
}
@@ -455,7 +454,7 @@ public final class NetworkStats implements Parcelable {
}
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public NetworkStats(Parcel parcel) {
elapsedRealtime = parcel.readLong();
size = parcel.readInt();

View File

@@ -32,7 +32,6 @@ import static android.text.format.DateUtils.SECOND_IN_MILLIS;
import static com.android.internal.util.ArrayUtils.total;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.service.NetworkStatsHistoryBucketProto;
@@ -92,18 +91,18 @@ public class NetworkStatsHistory implements Parcelable {
public static class Entry {
public static final long UNKNOWN = -1;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public long bucketDuration;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public long bucketStart;
public long activeTime;
@UnsupportedAppUsage
public long rxBytes;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public long rxPackets;
@UnsupportedAppUsage
public long txBytes;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public long txPackets;
public long operations;
}
@@ -135,7 +134,7 @@ public class NetworkStatsHistory implements Parcelable {
recordEntireHistory(existing);
}
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public NetworkStatsHistory(Parcel in) {
bucketDuration = in.readLong();
bucketStart = readLongArray(in);
@@ -221,7 +220,7 @@ public class NetworkStatsHistory implements Parcelable {
return 0;
}
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public int size() {
return bucketCount;
}
@@ -259,7 +258,7 @@ public class NetworkStatsHistory implements Parcelable {
* Return index of bucket that contains or is immediately before the
* requested time.
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public int getIndexBefore(long time) {
int index = Arrays.binarySearch(bucketStart, 0, bucketCount, time);
if (index < 0) {
@@ -287,7 +286,7 @@ public class NetworkStatsHistory implements Parcelable {
/**
* Return specific stats entry.
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public Entry getValues(int i, Entry recycle) {
final Entry entry = recycle != null ? recycle : new Entry();
entry.bucketStart = bucketStart[i];

View File

@@ -37,7 +37,6 @@ import static android.net.wifi.WifiInfo.sanitizeSsid;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.Annotation.NetworkType;
@@ -160,7 +159,7 @@ public class NetworkTemplate implements Parcelable {
* Template to match metered {@link ConnectivityManager#TYPE_MOBILE} networks,
* regardless of IMSI.
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public static NetworkTemplate buildTemplateMobileWildcard() {
return new NetworkTemplate(MATCH_MOBILE_WILDCARD, null, null);
}

View File

@@ -565,7 +565,7 @@ public class TrafficStats {
}
/** {@hide} */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public static long getMobileTcpRxPackets() {
long total = 0;
for (String iface : getMobileIfaces()) {
@@ -581,7 +581,7 @@ public class TrafficStats {
}
/** {@hide} */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@UnsupportedAppUsage
public static long getMobileTcpTxPackets() {
long total = 0;
for (String iface : getMobileIfaces()) {

View File

@@ -25,7 +25,7 @@ import android.os.Messenger;
*/
interface INsdManager
{
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
@UnsupportedAppUsage
Messenger getMessenger();
void setEnabled(boolean enable);
}