From 27432dba6b3529b75c025c58b43c22eef43a4b15 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Wed, 14 Nov 2018 10:17:57 -0800 Subject: [PATCH] API: Make implicit APIs from type usage explicit API stubs generation implicitly made any types used by an API also part of that API. This has caused DeviceIdAttestationException and ImsFeature.Capabilities to become implicit APIs, so they are added to the API files. After this, using non-API types in APIs will become an error to prevent implicit APIs occuring in the future. Bug: 119556446 Test: METALAVA_PREPEND_ARGS="--error ReferencesHidden" make Exempt-From-Owner-Approval: Identical CL has been approved on other branch Change-Id: I5fe4f20502b8d4e287b28e9f07139456d4191e22 Merged-In: I5fe4f20502b8d4e287b28e9f07139456d4191e22 (cherry picked from commit 8f91e5fde8272e2040c60222d6a5ba0314fa44ac) --- api/system-current.txt | 7 ++++++- api/test-current.txt | 5 +++++ .../keystore/DeviceIdAttestationException.java | 5 +++++ .../android/telephony/ims/feature/ImsFeature.java | 12 ++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/api/system-current.txt b/api/system-current.txt index aac8ebd29052e..4174a0c16168d 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -4327,6 +4327,11 @@ package android.security.keystore { field public static final int ID_TYPE_SERIAL = 1; // 0x1 } + public class DeviceIdAttestationException extends java.lang.Exception { + ctor public DeviceIdAttestationException(java.lang.String); + ctor public DeviceIdAttestationException(java.lang.String, java.lang.Throwable); + } + } package android.security.keystore.recovery { @@ -6320,7 +6325,7 @@ package android.telephony.ims.feature { field public static final int PROCESS_CALL_IMS = 0; // 0x0 } - public static class MmTelFeature.MmTelCapabilities { + public static class MmTelFeature.MmTelCapabilities extends android.telephony.ims.feature.ImsFeature.Capabilities { ctor public MmTelFeature.MmTelCapabilities(); ctor public deprecated MmTelFeature.MmTelCapabilities(android.telephony.ims.feature.ImsFeature.Capabilities); ctor public MmTelFeature.MmTelCapabilities(int); diff --git a/api/test-current.txt b/api/test-current.txt index c09ff9880ce7d..43988d955417a 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -800,6 +800,11 @@ package android.security.keystore { field public static final int ID_TYPE_SERIAL = 1; // 0x1 } + public class DeviceIdAttestationException extends java.lang.Exception { + ctor public DeviceIdAttestationException(java.lang.String); + ctor public DeviceIdAttestationException(java.lang.String, java.lang.Throwable); + } + public static final class KeyGenParameterSpec.Builder { method public android.security.keystore.KeyGenParameterSpec.Builder setUniqueIdIncluded(boolean); } diff --git a/keystore/java/android/security/keystore/DeviceIdAttestationException.java b/keystore/java/android/security/keystore/DeviceIdAttestationException.java index e18d193b043be..13f50b144e308 100644 --- a/keystore/java/android/security/keystore/DeviceIdAttestationException.java +++ b/keystore/java/android/security/keystore/DeviceIdAttestationException.java @@ -16,11 +16,16 @@ package android.security.keystore; +import android.annotation.SystemApi; +import android.annotation.TestApi; + /** * Thrown when {@link AttestationUtils} is unable to attest the given device ids. * * @hide */ +@SystemApi +@TestApi public class DeviceIdAttestationException extends Exception { /** * Constructs a new {@code DeviceIdAttestationException} with the current stack trace and the diff --git a/telephony/java/android/telephony/ims/feature/ImsFeature.java b/telephony/java/android/telephony/ims/feature/ImsFeature.java index 7f69f43f6cea2..3f22f98048664 100644 --- a/telephony/java/android/telephony/ims/feature/ImsFeature.java +++ b/telephony/java/android/telephony/ims/feature/ImsFeature.java @@ -211,12 +211,19 @@ public abstract class ImsFeature { * Contains the capabilities defined and supported by an ImsFeature in the form of a bit mask. * @hide */ + @SystemApi // SystemApi only because it was leaked through type usage in a previous release. public static class Capabilities { protected int mCapabilities = 0; + /** + * @hide + */ public Capabilities() { } + /** + * @hide + */ protected Capabilities(int capabilities) { mCapabilities = capabilities; } @@ -224,6 +231,7 @@ public abstract class ImsFeature { /** * @param capabilities Capabilities to be added to the configuration in the form of a * bit mask. + * @hide */ public void addCapabilities(int capabilities) { mCapabilities |= capabilities; @@ -232,6 +240,7 @@ public abstract class ImsFeature { /** * @param capabilities Capabilities to be removed to the configuration in the form of a * bit mask. + * @hide */ public void removeCapabilities(int capabilities) { mCapabilities &= ~capabilities; @@ -239,6 +248,7 @@ public abstract class ImsFeature { /** * @return true if all of the capabilities specified are capable. + * @hide */ public boolean isCapable(int capabilities) { return (mCapabilities & capabilities) == capabilities; @@ -246,6 +256,7 @@ public abstract class ImsFeature { /** * @return a deep copy of the Capabilites. + * @hide */ public Capabilities copy() { return new Capabilities(mCapabilities); @@ -253,6 +264,7 @@ public abstract class ImsFeature { /** * @return a bitmask containing the capability flags directly. + * @hide */ public int getMask() { return mCapabilities;