Merge "Add @UnsupportedAppUsage annotations"

This commit is contained in:
Treehugger Robot
2018-08-17 07:46:52 +00:00
committed by Gerrit Code Review
13 changed files with 47 additions and 35 deletions

View File

@ -2017,11 +2017,6 @@ Landroid/R$styleable;->Window:[I
Landroid/R$styleable;->Window_windowBackground:I
Landroid/R$styleable;->Window_windowFrame:I
Landroid/security/Credentials;->convertToPem([Ljava/security/cert/Certificate;)[B
Landroid/security/Credentials;->getInstance()Landroid/security/Credentials;
Landroid/security/Credentials;->install(Landroid/content/Context;Ljava/lang/String;[B)V
Landroid/security/Credentials;->install(Landroid/content/Context;Ljava/security/KeyPair;)V
Landroid/security/Credentials;->unlock(Landroid/content/Context;)V
Landroid/security/GateKeeper;->getSecureUserId()J
Landroid/security/IKeyChainService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/security/IKeyChainService;
Landroid/security/IKeyChainService;->requestPrivateKey(Ljava/lang/String;)Ljava/lang/String;
Landroid/security/IKeystoreService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/security/IKeystoreService;
@ -2040,36 +2035,6 @@ Landroid/security/IKeystoreService;->reset()I
Landroid/security/IKeystoreService;->sign(Ljava/lang/String;[B)[B
Landroid/security/IKeystoreService;->ungrant(Ljava/lang/String;I)I
Landroid/security/IKeystoreService;->verify(Ljava/lang/String;[B[B)I
Landroid/security/keymaster/ExportResult;->CREATOR:Landroid/os/Parcelable$Creator;
Landroid/security/keymaster/KeyCharacteristics;-><init>()V
Landroid/security/keymaster/KeyCharacteristics;->readFromParcel(Landroid/os/Parcel;)V
Landroid/security/keymaster/KeymasterArguments;-><init>()V
Landroid/security/keymaster/KeymasterArguments;->addEnum(II)V
Landroid/security/keymaster/KeymasterArguments;->addUnsignedInt(IJ)V
Landroid/security/keymaster/KeymasterArguments;->addUnsignedLong(ILjava/math/BigInteger;)V
Landroid/security/keymaster/KeymasterArguments;->CREATOR:Landroid/os/Parcelable$Creator;
Landroid/security/keymaster/KeymasterArguments;->readFromParcel(Landroid/os/Parcel;)V
Landroid/security/keymaster/KeymasterBlob;->CREATOR:Landroid/os/Parcelable$Creator;
Landroid/security/keymaster/OperationResult;->CREATOR:Landroid/os/Parcelable$Creator;
Landroid/security/KeyStore$State;->LOCKED:Landroid/security/KeyStore$State;
Landroid/security/KeyStore$State;->UNLOCKED:Landroid/security/KeyStore$State;
Landroid/security/keystore/AndroidKeyStoreProvider;->getKeyStoreOperationHandle(Ljava/lang/Object;)J
Landroid/security/keystore/KeyGenParameterSpec;->getUid()I
Landroid/security/keystore/KeyGenParameterSpec;->isUniqueIdIncluded()Z
Landroid/security/KeyStore;->delete(Ljava/lang/String;)Z
Landroid/security/KeyStore;->get(Ljava/lang/String;)[B
Landroid/security/KeyStore;->getApplicationContext()Landroid/content/Context;
Landroid/security/KeyStore;->getInstance()Landroid/security/KeyStore;
Landroid/security/KeyStore;->getKeyStoreException(I)Landroid/security/KeyStoreException;
Landroid/security/KeyStore;->isEmpty()Z
Landroid/security/KeyStore;->NO_ERROR:I
Landroid/security/KeyStore;->reset()Z
Landroid/security/KeyStore;->state()Landroid/security/KeyStore$State;
Landroid/security/KeyStore;->state(I)Landroid/security/KeyStore$State;
Landroid/security/KeyStore;->unlock(Ljava/lang/String;)Z
Landroid/security/KeystoreArguments;-><init>([[B)V
Landroid/security/KeystoreArguments;->CREATOR:Landroid/os/Parcelable$Creator;
Landroid/security/net/config/RootTrustManager;->checkServerTrusted([Ljava/security/cert/X509Certificate;Ljava/lang/String;Ljava/lang/String;)Ljava/util/List;
Landroid/service/carrier/ICarrierMessagingCallback$Stub;-><init>()V
Landroid/service/carrier/ICarrierMessagingService;->filterSms(Landroid/service/carrier/MessagePdu;Ljava/lang/String;IILandroid/service/carrier/ICarrierMessagingCallback;)V
Landroid/service/dreams/IDreamManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/dreams/IDreamManager;

View File

@ -16,6 +16,7 @@
package android.security;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@ -27,6 +28,7 @@ import android.os.Parcelable;
public class KeystoreArguments implements Parcelable {
public byte[][] args;
@UnsupportedAppUsage
public static final Parcelable.Creator<KeystoreArguments> CREATOR = new
Parcelable.Creator<KeystoreArguments>() {
public KeystoreArguments createFromParcel(Parcel in) {
@ -41,6 +43,7 @@ public class KeystoreArguments implements Parcelable {
args = null;
}
@UnsupportedAppUsage
public KeystoreArguments(byte[][] args) {
this.args = args;
}

View File

@ -16,6 +16,7 @@
package android.security.keymaster;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@ -27,6 +28,7 @@ public class ExportResult implements Parcelable {
public final int resultCode;
public final byte[] exportData;
@UnsupportedAppUsage
public static final Parcelable.Creator<ExportResult> CREATOR = new
Parcelable.Creator<ExportResult>() {
public ExportResult createFromParcel(Parcel in) {

View File

@ -16,6 +16,7 @@
package android.security.keymaster;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@ -44,6 +45,7 @@ public class KeyCharacteristics implements Parcelable {
}
};
@UnsupportedAppUsage
public KeyCharacteristics() {}
protected KeyCharacteristics(Parcel in) {
@ -61,6 +63,7 @@ public class KeyCharacteristics implements Parcelable {
hwEnforced.writeToParcel(out, flags);
}
@UnsupportedAppUsage
public void readFromParcel(Parcel in) {
swEnforced = KeymasterArguments.CREATOR.createFromParcel(in);
hwEnforced = KeymasterArguments.CREATOR.createFromParcel(in);

View File

@ -16,6 +16,7 @@
package android.security.keymaster;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@ -40,6 +41,7 @@ public class KeymasterArguments implements Parcelable {
private List<KeymasterArgument> mArguments;
@UnsupportedAppUsage
public static final Parcelable.Creator<KeymasterArguments> CREATOR = new
Parcelable.Creator<KeymasterArguments>() {
@Override
@ -53,6 +55,7 @@ public class KeymasterArguments implements Parcelable {
}
};
@UnsupportedAppUsage
public KeymasterArguments() {
mArguments = new ArrayList<KeymasterArgument>();
}
@ -66,6 +69,7 @@ public class KeymasterArguments implements Parcelable {
*
* @throws IllegalArgumentException if {@code tag} is not an enum tag.
*/
@UnsupportedAppUsage
public void addEnum(int tag, int value) {
int tagType = KeymasterDefs.getTagType(tag);
if ((tagType != KeymasterDefs.KM_ENUM) && (tagType != KeymasterDefs.KM_ENUM_REP)) {
@ -137,6 +141,7 @@ public class KeymasterArguments implements Parcelable {
* @throws IllegalArgumentException if {@code tag} is not an unsigned 32-bit int tag or if
* {@code value} is outside of the permitted range [0; 2^32).
*/
@UnsupportedAppUsage
public void addUnsignedInt(int tag, long value) {
int tagType = KeymasterDefs.getTagType(tag);
if ((tagType != KeymasterDefs.KM_UINT) && (tagType != KeymasterDefs.KM_UINT_REP)) {
@ -173,6 +178,7 @@ public class KeymasterArguments implements Parcelable {
* @throws IllegalArgumentException if {@code tag} is not an unsigned 64-bit long tag or if
* {@code value} is outside of the permitted range [0; 2^64).
*/
@UnsupportedAppUsage
public void addUnsignedLong(int tag, BigInteger value) {
int tagType = KeymasterDefs.getTagType(tag);
if ((tagType != KeymasterDefs.KM_ULONG) && (tagType != KeymasterDefs.KM_ULONG_REP)) {
@ -358,6 +364,7 @@ public class KeymasterArguments implements Parcelable {
out.writeTypedList(mArguments);
}
@UnsupportedAppUsage
public void readFromParcel(Parcel in) {
in.readTypedList(mArguments, KeymasterArgument.CREATOR);
}

View File

@ -16,6 +16,7 @@
package android.security.keymaster;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@ -28,6 +29,7 @@ public class KeymasterBlob implements Parcelable {
public KeymasterBlob(byte[] blob) {
this.blob = blob;
}
@UnsupportedAppUsage
public static final Parcelable.Creator<KeymasterBlob> CREATOR = new
Parcelable.Creator<KeymasterBlob>() {
public KeymasterBlob createFromParcel(Parcel in) {

View File

@ -16,6 +16,7 @@
package android.security.keymaster;
import android.annotation.UnsupportedAppUsage;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
@ -33,6 +34,7 @@ public class OperationResult implements Parcelable {
public final byte[] output;
public final KeymasterArguments outParams;
@UnsupportedAppUsage
public static final Parcelable.Creator<OperationResult> CREATOR = new
Parcelable.Creator<OperationResult>() {
@Override

View File

@ -21,6 +21,7 @@ import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.List;
import android.annotation.UnsupportedAppUsage;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLSession;
@ -121,6 +122,7 @@ public class RootTrustManager extends X509ExtendedTrustManager {
* This interface is used by conscrypt and android.net.http.X509TrustManagerExtensions do not
* modify without modifying those callers.
*/
@UnsupportedAppUsage
public List<X509Certificate> checkServerTrusted(X509Certificate[] certs, String authType,
String hostname) throws CertificateException {
if (hostname == null && mConfig.hasPerDomainConfigs()) {

View File

@ -16,6 +16,7 @@
package android.security;
import android.annotation.UnsupportedAppUsage;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
@ -172,6 +173,7 @@ public class Credentials {
private static Credentials singleton;
@UnsupportedAppUsage
public static Credentials getInstance() {
if (singleton == null) {
singleton = new Credentials();
@ -179,6 +181,7 @@ public class Credentials {
return singleton;
}
@UnsupportedAppUsage
public void unlock(Context context) {
try {
Intent intent = new Intent(UNLOCK_ACTION);
@ -197,6 +200,7 @@ public class Credentials {
}
}
@UnsupportedAppUsage
public void install(Context context, KeyPair pair) {
try {
Intent intent = KeyChain.createInstallIntent();
@ -208,6 +212,7 @@ public class Credentials {
}
}
@UnsupportedAppUsage
public void install(Context context, String type, byte[] value) {
try {
Intent intent = KeyChain.createInstallIntent();

View File

@ -16,6 +16,7 @@
package android.security;
import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.RemoteException;
import android.os.ServiceManager;
@ -42,6 +43,7 @@ public abstract class GateKeeper {
return service;
}
@UnsupportedAppUsage
public static long getSecureUserId() throws IllegalStateException {
try {
return getService().getSecureUserId(UserHandle.myUserId());

View File

@ -16,6 +16,7 @@
package android.security;
import android.annotation.UnsupportedAppUsage;
import android.app.ActivityManager;
import android.app.ActivityThread;
import android.app.Application;
@ -57,6 +58,7 @@ public class KeyStore {
private static final String TAG = "KeyStore";
// ResponseCodes - see system/security/keystore/include/keystore/keystore.h
@UnsupportedAppUsage
public static final int NO_ERROR = 1;
public static final int LOCKED = 2;
public static final int UNINITIALIZED = 3;
@ -129,7 +131,9 @@ public class KeyStore {
// States
public enum State {
@UnsupportedAppUsage
UNLOCKED,
@UnsupportedAppUsage
LOCKED,
UNINITIALIZED
};
@ -146,6 +150,7 @@ public class KeyStore {
mContext = getApplicationContext();
}
@UnsupportedAppUsage
public static Context getApplicationContext() {
Application application = ActivityThread.currentApplication();
if (application == null) {
@ -155,6 +160,7 @@ public class KeyStore {
return application;
}
@UnsupportedAppUsage
public static KeyStore getInstance() {
IKeystoreService keystore = IKeystoreService.Stub.asInterface(ServiceManager
.getService("android.security.keystore"));
@ -168,6 +174,7 @@ public class KeyStore {
return mToken;
}
@UnsupportedAppUsage
public State state(int userId) {
final int ret;
try {
@ -185,6 +192,7 @@ public class KeyStore {
}
}
@UnsupportedAppUsage
public State state() {
return state(UserHandle.myUserId());
}
@ -206,6 +214,7 @@ public class KeyStore {
}
}
@UnsupportedAppUsage
public byte[] get(String key) {
return get(key, UID_SELF);
}
@ -236,6 +245,7 @@ public class KeyStore {
}
}
@UnsupportedAppUsage
public boolean delete(String key) {
return delete(key, UID_SELF);
}
@ -272,6 +282,7 @@ public class KeyStore {
return list(prefix, UID_SELF);
}
@UnsupportedAppUsage
public boolean reset() {
try {
return mBinder.reset() == NO_ERROR;
@ -322,6 +333,7 @@ public class KeyStore {
}
}
@UnsupportedAppUsage
public boolean unlock(String password) {
return unlock(UserHandle.getUserId(Process.myUid()), password);
}
@ -338,6 +350,7 @@ public class KeyStore {
}
}
@UnsupportedAppUsage
public boolean isEmpty() {
return isEmpty(UserHandle.myUserId());
}
@ -807,6 +820,7 @@ public class KeyStore {
* Returns a {@link KeyStoreException} corresponding to the provided keystore/keymaster error
* code.
*/
@UnsupportedAppUsage
public static KeyStoreException getKeyStoreException(int errorCode) {
if (errorCode > 0) {
// KeyStore layer error

View File

@ -17,6 +17,7 @@
package android.security.keystore;
import android.annotation.NonNull;
import android.annotation.UnsupportedAppUsage;
import android.security.KeyStore;
import android.security.keymaster.ExportResult;
import android.security.keymaster.KeyCharacteristics;
@ -156,6 +157,7 @@ public class AndroidKeyStoreProvider extends Provider {
* by AndroidKeyStore provider.
* @throws IllegalStateException if the provided primitive is not initialized.
*/
@UnsupportedAppUsage
public static long getKeyStoreOperationHandle(Object cryptoPrimitive) {
if (cryptoPrimitive == null) {
throw new NullPointerException();

View File

@ -20,6 +20,7 @@ import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.app.KeyguardManager;
import android.hardware.fingerprint.FingerprintManager;
import android.security.GateKeeper;
@ -366,6 +367,7 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
*
* @hide
*/
@UnsupportedAppUsage
public int getUid() {
return mUid;
}
@ -640,6 +642,7 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
*
* Returns {@code true} if the attestation certificate will contain a unique ID field.
*/
@UnsupportedAppUsage
public boolean isUniqueIdIncluded() {
return mUniqueIdIncluded;
}