From 79db6e580790e49b44bc826f6b02ee1f6a41d0ca Mon Sep 17 00:00:00 2001 From: Svet Ganov Date: Wed, 7 Apr 2021 09:02:45 +0000 Subject: [PATCH] Remove annotations from generated class until tests updated Codegen is a tool that generates parcelable classes from field declarations. Hence, the @SystemApi annotations are placed on the field and the tool propagetes them to the generated APIs. We need to update the AnnotationTest to either ingore these generated classes or ignore private fields annotated with @SystemApi as they are not API in practice. This CL removes the annotations to fix the test. bug: 184086213 Test: atest android.signature.cts.api.AnnotationTest Change-Id: Ibe9059f20d95d4cda4eb402704e3c4c002ff0e47 --- core/java/android/content/AttributionSource.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/core/java/android/content/AttributionSource.java b/core/java/android/content/AttributionSource.java index c851519e9b507..b13bf0940d347 100644 --- a/core/java/android/content/AttributionSource.java +++ b/core/java/android/content/AttributionSource.java @@ -21,15 +21,12 @@ import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.TestApi; -import android.app.AppGlobals; import android.os.Binder; import android.os.Build; import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; import android.os.Process; -import android.os.RemoteException; -import android.os.UserHandle; import android.permission.PermissionManager; import android.util.ArraySet; @@ -93,6 +90,8 @@ import java.util.Set; // TODO: Codegen applies method level annotations to argument vs the generated member (@SystemApi) // TODO: Codegen doesn't properly read/write IBinder members // TODO: Codegen doesn't properly handle Set arguments +// TODO: Codegen requires @SystemApi annotations on fields which breaks +// android.signature.cts.api.AnnotationTest (need to update the test) // @DataClass(genEqualsHashCode = true, genConstructor = false, genBuilder = true) public final class AttributionSource implements Parcelable { /** @@ -153,8 +152,6 @@ public final class AttributionSource implements Parcelable { * * @hide */ - @SystemApi - @RequiresPermission(android.Manifest.permission.RENOUNCE_PERMISSIONS) @DataClass.ParcelWith(RenouncedPermissionsParcelling.class) private @Nullable Set mRenouncedPermissions = null; @@ -516,7 +513,7 @@ public final class AttributionSource implements Parcelable { private @Nullable String mPackageName; private @Nullable String mAttributionTag; private @Nullable IBinder mToken; - private @SystemApi @RequiresPermission(android.Manifest.permission.RENOUNCE_PERMISSIONS) @Nullable Set mRenouncedPermissions; + private @Nullable Set mRenouncedPermissions; private @Nullable AttributionSource mNext; private long mBuilderFieldsSet = 0L;