diff options
| author | Adrian Roos <roosa@google.com> | 2018-12-11 19:47:33 +0100 |
|---|---|---|
| committer | Adrian Roos <roosa@google.com> | 2018-12-12 15:02:26 +0100 |
| commit | 6115769c1663b64f6d7130041c590b5920fd8db0 (patch) | |
| tree | f83c145f6f32b975eb8c93c57c144351658ae554 /core/java/android | |
| parent | e3a133095e9fb707e02a766d597566c7dae46d6e (diff) | |
API: Clean up redundant and ineffective usages of SystemApi and TestApi
Everything that is marked SystemApi or TestApi, but not @hide is still
part of the public SDK, it is therefore not sound to have that combination.
In the future, specifing such a combination will be considered an error
to prevent inadvertently exposing SystemApi and TestApi as public API.
Bug: 115333477
Change-Id: Ibd5d6a22862fdbc1e20a1cb3925280f5a682edea
Merged-In: Ibd5d6a22862fdbc1e20a1cb3925280f5a682edea
Test: METALAVA_PREPEND_ARGS="--error UnhiddenSystemApi" m checkapi
Exempt-From-Owner-Approval: API cleanup
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/admin/DeviceAdminReceiver.java | 2 | ||||
| -rw-r--r-- | core/java/android/app/admin/SystemUpdatePolicy.java | 3 | ||||
| -rw-r--r-- | core/java/android/database/sqlite/SQLiteDebug.java | 2 | ||||
| -rw-r--r-- | core/java/android/net/TrafficStats.java | 2 | ||||
| -rw-r--r-- | core/java/android/net/http/X509TrustManagerExtensions.java | 2 | ||||
| -rw-r--r-- | core/java/android/os/HwBinder.java | 21 | ||||
| -rw-r--r-- | core/java/android/os/IHwBinder.java | 9 | ||||
| -rw-r--r-- | core/java/android/os/IHwInterface.java | 1 | ||||
| -rw-r--r-- | core/java/android/os/SystemUpdateManager.java | 13 | ||||
| -rw-r--r-- | core/java/android/os/UpdateEngine.java | 12 | ||||
| -rw-r--r-- | core/java/android/os/UpdateEngineCallback.java | 2 | ||||
| -rw-r--r-- | core/java/android/service/notification/Condition.java | 16 | ||||
| -rw-r--r-- | core/java/android/service/notification/ConditionProviderService.java | 2 | ||||
| -rw-r--r-- | core/java/android/service/textclassifier/TextClassifierService.java | 3 |
14 files changed, 0 insertions, 90 deletions
diff --git a/core/java/android/app/admin/DeviceAdminReceiver.java b/core/java/android/app/admin/DeviceAdminReceiver.java index 1c9477d08cb3..6fb0d7ec33ae 100644 --- a/core/java/android/app/admin/DeviceAdminReceiver.java +++ b/core/java/android/app/admin/DeviceAdminReceiver.java @@ -23,7 +23,6 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; -import android.annotation.SystemApi; import android.app.Service; import android.content.BroadcastReceiver; import android.content.ComponentName; @@ -755,7 +754,6 @@ public class DeviceAdminReceiver extends BroadcastReceiver { * @deprecated Do not use */ @Deprecated - @SystemApi public void onReadyForUserInitialization(Context context, Intent intent) { } diff --git a/core/java/android/app/admin/SystemUpdatePolicy.java b/core/java/android/app/admin/SystemUpdatePolicy.java index 2a451ff07672..96dbc760278f 100644 --- a/core/java/android/app/admin/SystemUpdatePolicy.java +++ b/core/java/android/app/admin/SystemUpdatePolicy.java @@ -691,13 +691,11 @@ public final class SystemUpdatePolicy implements Parcelable { mFreezePeriods.stream().map(n -> n.toString()).collect(Collectors.joining(","))); } - @SystemApi @Override public int describeContents() { return 0; } - @SystemApi @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(mPolicyType); @@ -714,7 +712,6 @@ public final class SystemUpdatePolicy implements Parcelable { } } - @SystemApi public static final Parcelable.Creator<SystemUpdatePolicy> CREATOR = new Parcelable.Creator<SystemUpdatePolicy>() { diff --git a/core/java/android/database/sqlite/SQLiteDebug.java b/core/java/android/database/sqlite/SQLiteDebug.java index d39252130d4b..48f8ac97254a 100644 --- a/core/java/android/database/sqlite/SQLiteDebug.java +++ b/core/java/android/database/sqlite/SQLiteDebug.java @@ -119,7 +119,6 @@ public final class SQLiteDebug { /** * contains statistics about a database */ - @TestApi public static class DbStats { /** name of the database */ public String dbName; @@ -151,7 +150,6 @@ public final class SQLiteDebug { * return all pager and database stats for the current process. * @return {@link PagerStats} */ - @TestApi public static PagerStats getDatabaseInfo() { PagerStats stats = new PagerStats(); nativeGetPagerStats(stats); diff --git a/core/java/android/net/TrafficStats.java b/core/java/android/net/TrafficStats.java index 1b22911f0cdc..bbb809d528be 100644 --- a/core/java/android/net/TrafficStats.java +++ b/core/java/android/net/TrafficStats.java @@ -274,7 +274,6 @@ public class TrafficStats { * Changes only take effect during subsequent calls to * {@link #tagSocket(Socket)}. */ - @SystemApi @SuppressLint("Doclava125") public static void setThreadStatsUid(int uid) { NetworkManagementSocketTagger.setThreadSocketStatsUid(uid); @@ -313,7 +312,6 @@ public class TrafficStats { * * @see #setThreadStatsUid(int) */ - @SystemApi @SuppressLint("Doclava125") public static void clearThreadStatsUid() { NetworkManagementSocketTagger.setThreadSocketStatsUid(-1); diff --git a/core/java/android/net/http/X509TrustManagerExtensions.java b/core/java/android/net/http/X509TrustManagerExtensions.java index f9b6dfce32ff..280dad0284b6 100644 --- a/core/java/android/net/http/X509TrustManagerExtensions.java +++ b/core/java/android/net/http/X509TrustManagerExtensions.java @@ -16,7 +16,6 @@ package android.net.http; -import android.annotation.SystemApi; import android.security.net.config.UserCertificateSource; import com.android.org.conscrypt.TrustManagerImpl; @@ -133,7 +132,6 @@ public class X509TrustManagerExtensions { * Returns {@code true} if the TrustManager uses the same trust configuration for the provided * hostnames. */ - @SystemApi public boolean isSameTrustConfiguration(String hostname1, String hostname2) { if (mIsSameTrustConfiguration == null) { return true; diff --git a/core/java/android/os/HwBinder.java b/core/java/android/os/HwBinder.java index 228fe7a3dae5..3de3494e7ea7 100644 --- a/core/java/android/os/HwBinder.java +++ b/core/java/android/os/HwBinder.java @@ -32,10 +32,7 @@ public abstract class HwBinder implements IHwBinder { /** * Create and initialize a HwBinder object and the native objects * used to allow this to participate in hwbinder transactions. - * - * @hide */ - @SystemApi public HwBinder() { native_setup(); @@ -44,7 +41,6 @@ public abstract class HwBinder implements IHwBinder { mNativeContext); } - /** @hide */ @Override public final native void transact( int code, HwParcel request, HwParcel reply, int flags) @@ -57,10 +53,7 @@ public abstract class HwBinder implements IHwBinder { * @param request parceled transaction * @param reply object to parcel reply into * @param flags transaction flags to be chosen by wire protocol - * - * @hide */ - @SystemApi public abstract void onTransact( int code, HwParcel request, HwParcel reply, int flags) throws RemoteException; @@ -69,9 +62,7 @@ public abstract class HwBinder implements IHwBinder { * Registers this service with the hwservicemanager. * * @param serviceName instance name of the service - * @hide */ - @SystemApi public native final void registerService(String serviceName) throws RemoteException; @@ -81,9 +72,7 @@ public abstract class HwBinder implements IHwBinder { * @param iface fully-qualified interface name for example foo.bar@1.3::IBaz * @param serviceName the instance name of the service for example default. * @throws NoSuchElementException when the service is unavailable - * @hide */ - @SystemApi public static final IHwBinder getService( String iface, String serviceName) @@ -96,9 +85,7 @@ public abstract class HwBinder implements IHwBinder { * @param serviceName the instance name of the service for example default. * @param retry whether to wait for the service to start if it's not already started * @throws NoSuchElementException when the service is unavailable - * @hide */ - @SystemApi public static native final IHwBinder getService( String iface, String serviceName, @@ -112,9 +99,7 @@ public abstract class HwBinder implements IHwBinder { * @param maxThreads total number of threads to create (includes this thread if * callerWillJoin is true) * @param callerWillJoin whether joinRpcThreadpool will be called in advance - * @hide */ - @SystemApi public static native final void configureRpcThreadpool( long maxThreads, boolean callerWillJoin); @@ -124,10 +109,7 @@ public abstract class HwBinder implements IHwBinder { * a threadpool with callerWillJoin true and then registering * the provided service if this thread doesn't need to do * anything else. - * - * @hide */ - @SystemApi public static native final void joinRpcThreadpool(); // Returns address of the "freeFunction". @@ -155,10 +137,7 @@ public abstract class HwBinder implements IHwBinder { * - tries to enable atracing (if enabled) * - tries to enable coverage dumps (if running in VTS) * - tries to enable record and replay (if running in VTS) - * - * @hide */ - @SystemApi public static void enableInstrumentation() { native_report_sysprop_change(); } diff --git a/core/java/android/os/IHwBinder.java b/core/java/android/os/IHwBinder.java index fbdf27e38d67..249eb3aa3456 100644 --- a/core/java/android/os/IHwBinder.java +++ b/core/java/android/os/IHwBinder.java @@ -28,10 +28,7 @@ public interface IHwBinder { * @param request parceled transaction * @param reply object to parcel reply into * @param flags transaction flags to be chosen by wire protocol - * - * @hide */ - @SystemApi public void transact( int code, HwParcel request, HwParcel reply, int flags) throws RemoteException; @@ -40,23 +37,19 @@ public interface IHwBinder { * Return as IHwInterface instance only if this implements descriptor. * * @param descriptor for example foo.bar@1.0::IBaz - * @hide */ - @SystemApi public IHwInterface queryLocalInterface(String descriptor); /** * Interface for receiving a callback when the process hosting a service * has gone away. */ - @SystemApi public interface DeathRecipient { /** * Callback for a registered process dying. * * @param cookie cookie this death recipient was registered with. */ - @SystemApi public void serviceDied(long cookie); } @@ -67,13 +60,11 @@ public interface IHwBinder { * @param recipient callback object to be called on object death. * @param cookie value to be given to callback on object death. */ - @SystemApi public boolean linkToDeath(DeathRecipient recipient, long cookie); /** * Unregisters the death recipient from this binder. * * @param recipient callback to no longer recieve death notifications on this binder. */ - @SystemApi public boolean unlinkToDeath(DeathRecipient recipient); } diff --git a/core/java/android/os/IHwInterface.java b/core/java/android/os/IHwInterface.java index 1d9e2b0197c7..f9edd5bf8883 100644 --- a/core/java/android/os/IHwInterface.java +++ b/core/java/android/os/IHwInterface.java @@ -23,6 +23,5 @@ public interface IHwInterface { /** * @return the binder object that corresponds to this interface. */ - @SystemApi public IHwBinder asBinder(); } diff --git a/core/java/android/os/SystemUpdateManager.java b/core/java/android/os/SystemUpdateManager.java index ce3e225975f0..9146731f8f9f 100644 --- a/core/java/android/os/SystemUpdateManager.java +++ b/core/java/android/os/SystemUpdateManager.java @@ -34,62 +34,51 @@ public class SystemUpdateManager { private static final String TAG = "SystemUpdateManager"; /** The status key of the system update info, expecting an int value. */ - @SystemApi public static final String KEY_STATUS = "status"; /** The title of the current update, expecting a String value. */ - @SystemApi public static final String KEY_TITLE = "title"; /** Whether it is a security update, expecting a boolean value. */ - @SystemApi public static final String KEY_IS_SECURITY_UPDATE = "is_security_update"; /** The build fingerprint after installing the current update, expecting a String value. */ - @SystemApi public static final String KEY_TARGET_BUILD_FINGERPRINT = "target_build_fingerprint"; /** The security patch level after installing the current update, expecting a String value. */ - @SystemApi public static final String KEY_TARGET_SECURITY_PATCH_LEVEL = "target_security_patch_level"; /** * The KEY_STATUS value that indicates there's no update status info available. */ - @SystemApi public static final int STATUS_UNKNOWN = 0; /** * The KEY_STATUS value that indicates there's no pending update. */ - @SystemApi public static final int STATUS_IDLE = 1; /** * The KEY_STATUS value that indicates an update is available for download, but pending user * approval to start. */ - @SystemApi public static final int STATUS_WAITING_DOWNLOAD = 2; /** * The KEY_STATUS value that indicates an update is in progress (i.e. downloading or installing * has started). */ - @SystemApi public static final int STATUS_IN_PROGRESS = 3; /** * The KEY_STATUS value that indicates an update is available for install. */ - @SystemApi public static final int STATUS_WAITING_INSTALL = 4; /** * The KEY_STATUS value that indicates an update will be installed after a reboot. This applies * to both of A/B and non-A/B OTAs. */ - @SystemApi public static final int STATUS_WAITING_REBOOT = 5; private final ISystemUpdateManager mService; @@ -110,7 +99,6 @@ public class SystemUpdateManager { * * @throws SecurityException if the caller is not allowed to read the info. */ - @SystemApi @RequiresPermission(anyOf = { android.Manifest.permission.READ_SYSTEM_UPDATE_INFO, android.Manifest.permission.RECOVERY, @@ -137,7 +125,6 @@ public class SystemUpdateManager { * @throws IllegalArgumentException if @link #KEY_STATUS} does not exist. * @throws SecurityException if the caller is not allowed to update the info. */ - @SystemApi @RequiresPermission(android.Manifest.permission.RECOVERY) public void updateSystemUpdateInfo(PersistableBundle infoBundle) { if (infoBundle == null || !infoBundle.containsKey(KEY_STATUS)) { diff --git a/core/java/android/os/UpdateEngine.java b/core/java/android/os/UpdateEngine.java index 24c9c9177360..8f2826c16b63 100644 --- a/core/java/android/os/UpdateEngine.java +++ b/core/java/android/os/UpdateEngine.java @@ -54,7 +54,6 @@ public class UpdateEngine { * Error code from the update engine. Values must agree with the ones in * system/update_engine/common/error_code.h. */ - @SystemApi public static final class ErrorCodeConstants { public static final int SUCCESS = 0; public static final int ERROR = 1; @@ -74,7 +73,6 @@ public class UpdateEngine { * Update status code from the update engine. Values must agree with the * ones in system/update_engine/client_library/include/update_engine/update_status.h. */ - @SystemApi public static final class UpdateStatusConstants { public static final int IDLE = 0; public static final int CHECKING_FOR_UPDATE = 1; @@ -95,7 +93,6 @@ public class UpdateEngine { /** * Creates a new instance. */ - @SystemApi public UpdateEngine() { mUpdateEngine = IUpdateEngine.Stub.asInterface( ServiceManager.getService(UPDATE_ENGINE_SERVICE)); @@ -106,7 +103,6 @@ public class UpdateEngine { * status change, and when the update completes. A handler can be supplied * to control which thread runs the callback, or null. */ - @SystemApi public boolean bind(final UpdateEngineCallback callback, final Handler handler) { synchronized (mUpdateEngineCallbackLock) { mUpdateEngineCallback = new IUpdateEngineCallback.Stub() { @@ -150,7 +146,6 @@ public class UpdateEngine { /** * Equivalent to {@code bind(callback, null)}. */ - @SystemApi public boolean bind(final UpdateEngineCallback callback) { return bind(callback, null); } @@ -183,7 +178,6 @@ public class UpdateEngine { * }; * </pre> */ - @SystemApi public void applyPayload(String url, long offset, long size, String[] headerKeyValuePairs) { try { mUpdateEngine.applyPayload(url, offset, size, headerKeyValuePairs); @@ -201,7 +195,6 @@ public class UpdateEngine { * <p>See {@link #suspend} for a way to temporarily stop an in-progress * update with the ability to resume it later. */ - @SystemApi public void cancel() { try { mUpdateEngine.cancel(); @@ -214,7 +207,6 @@ public class UpdateEngine { * Suspends an in-progress update. This can be undone by calling * {@link #resume}. */ - @SystemApi public void suspend() { try { mUpdateEngine.suspend(); @@ -226,7 +218,6 @@ public class UpdateEngine { /** * Resumes a suspended update. */ - @SystemApi public void resume() { try { mUpdateEngine.resume(); @@ -244,7 +235,6 @@ public class UpdateEngine { * {@code UPDATED_NEED_REBOOT}, so your callback can remove any outstanding * notification that rebooting into the new system is possible. */ - @SystemApi public void resetStatus() { try { mUpdateEngine.resetStatus(); @@ -256,7 +246,6 @@ public class UpdateEngine { /** * Unbinds the last bound callback function. */ - @SystemApi public boolean unbind() { synchronized (mUpdateEngineCallbackLock) { if (mUpdateEngineCallback == null) { @@ -281,7 +270,6 @@ public class UpdateEngine { * @param payloadMetadataFilename the location of the metadata without the * {@code file://} prefix. */ - @SystemApi public boolean verifyPayloadMetadata(String payloadMetadataFilename) { try { return mUpdateEngine.verifyPayloadApplicable(payloadMetadataFilename); diff --git a/core/java/android/os/UpdateEngineCallback.java b/core/java/android/os/UpdateEngineCallback.java index afff60abb22b..f07294e222e2 100644 --- a/core/java/android/os/UpdateEngineCallback.java +++ b/core/java/android/os/UpdateEngineCallback.java @@ -37,7 +37,6 @@ public abstract class UpdateEngineCallback { * be one of the values from {@link UpdateEngine.UpdateStatusConstants}, * and {@code percent} will be valid [TODO: in which cases?]. */ - @SystemApi public abstract void onStatusUpdate(int status, float percent); /** @@ -45,6 +44,5 @@ public abstract class UpdateEngineCallback { * unsuccessfully. The value of {@code errorCode} will be one of the * values from {@link UpdateEngine.ErrorCodeConstants}. */ - @SystemApi public abstract void onPayloadApplicationComplete(int errorCode); } diff --git a/core/java/android/service/notification/Condition.java b/core/java/android/service/notification/Condition.java index b6c6bdc00bbe..16f66a54c0c4 100644 --- a/core/java/android/service/notification/Condition.java +++ b/core/java/android/service/notification/Condition.java @@ -17,7 +17,6 @@ package android.service.notification; import android.annotation.IntDef; -import android.annotation.SystemApi; import android.content.Context; import android.net.Uri; import android.os.Parcel; @@ -35,7 +34,6 @@ import java.util.Objects; */ public final class Condition implements Parcelable { - @SystemApi public static final String SCHEME = "condition"; /** @hide */ @@ -59,14 +57,10 @@ public final class Condition implements Parcelable { */ public static final int STATE_TRUE = 1; - @SystemApi public static final int STATE_UNKNOWN = 2; - @SystemApi public static final int STATE_ERROR = 3; - @SystemApi public static final int FLAG_RELEVANT_NOW = 1 << 0; - @SystemApi public static final int FLAG_RELEVANT_ALWAYS = 1 << 1; /** @@ -81,9 +75,7 @@ public final class Condition implements Parcelable { */ public final String summary; - @SystemApi public final String line1; - @SystemApi public final String line2; /** @@ -94,9 +86,7 @@ public final class Condition implements Parcelable { @State public final int state; - @SystemApi public final int flags; - @SystemApi public final int icon; /** @@ -108,7 +98,6 @@ public final class Condition implements Parcelable { this(id, summary, "", "", -1, state, FLAG_RELEVANT_ALWAYS); } - @SystemApi public Condition(Uri id, String summary, String line1, String line2, int icon, int state, int flags) { if (id == null) throw new IllegalArgumentException("id is required"); @@ -177,7 +166,6 @@ public final class Condition implements Parcelable { proto.end(token); } - @SystemApi public static String stateToString(int state) { if (state == STATE_FALSE) return "STATE_FALSE"; if (state == STATE_TRUE) return "STATE_TRUE"; @@ -186,7 +174,6 @@ public final class Condition implements Parcelable { throw new IllegalArgumentException("state is invalid: " + state); } - @SystemApi public static String relevanceToString(int flags) { final boolean now = (flags & FLAG_RELEVANT_NOW) != 0; final boolean always = (flags & FLAG_RELEVANT_ALWAYS) != 0; @@ -219,7 +206,6 @@ public final class Condition implements Parcelable { return 0; } - @SystemApi public Condition copy() { final Parcel parcel = Parcel.obtain(); try { @@ -231,14 +217,12 @@ public final class Condition implements Parcelable { } } - @SystemApi public static Uri.Builder newId(Context context) { return new Uri.Builder() .scheme(Condition.SCHEME) .authority(context.getPackageName()); } - @SystemApi public static boolean isValidId(Uri id, String pkg) { return id != null && SCHEME.equals(id.getScheme()) && pkg.equals(id.getAuthority()); } diff --git a/core/java/android/service/notification/ConditionProviderService.java b/core/java/android/service/notification/ConditionProviderService.java index 6fc689ab07cf..5203c8f4bb27 100644 --- a/core/java/android/service/notification/ConditionProviderService.java +++ b/core/java/android/service/notification/ConditionProviderService.java @@ -17,7 +17,6 @@ package android.service.notification; import android.annotation.SdkConstant; -import android.annotation.SystemApi; import android.annotation.TestApi; import android.app.ActivityManager; import android.app.INotificationManager; @@ -107,7 +106,6 @@ public abstract class ConditionProviderService extends Service { */ abstract public void onConnected(); - @SystemApi public void onRequestConditions(int relevance) {} /** diff --git a/core/java/android/service/textclassifier/TextClassifierService.java b/core/java/android/service/textclassifier/TextClassifierService.java index b461c0daaca5..2417e591cb2b 100644 --- a/core/java/android/service/textclassifier/TextClassifierService.java +++ b/core/java/android/service/textclassifier/TextClassifierService.java @@ -80,7 +80,6 @@ public abstract class TextClassifierService extends Service { * {@link android.Manifest.permission#BIND_TEXTCLASSIFIER_SERVICE} permission so * that other applications can not abuse it. */ - @SystemApi public static final String SERVICE_INTERFACE = "android.service.textclassifier.TextClassifierService"; @@ -371,9 +370,7 @@ public abstract class TextClassifierService extends Service { * Callbacks for TextClassifierService results. * * @param <T> the type of the result - * @hide */ - @SystemApi public interface Callback<T> { /** * Returns the result. |
