@FlaggedApi: Enforce using constants instead of literals
Enables a lint that forces useing @FlaggedApi(..Flags.FLAG_FOO) instead
of @FlaggedApi("...FLAG_FOO"). This avoids the potential for typos
causing APIs to not ship as intended.
Bug: 322505144
Test: make checkapi
Flag: EXEMPT lint only
Change-Id: I3a78d918a38927b74c68a216cebf4b5bb692cbfa
diff --git a/api/Android.bp b/api/Android.bp
index cdc5cd1..7326203 100644
--- a/api/Android.bp
+++ b/api/Android.bp
@@ -387,6 +387,7 @@
"--error NoSettingsProvider",
"--error UnhiddenSystemApi",
"--error UnflaggedApi",
+ "--error FlaggedApiLiteral",
"--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.*",
// Disable CallbackInterface, as Java 8 default interface methods avoid the extensibility
// issue interfaces had previously.
diff --git a/core/api/lint-baseline.txt b/core/api/lint-baseline.txt
index 1dcafd1..4ada53e 100644
--- a/core/api/lint-baseline.txt
+++ b/core/api/lint-baseline.txt
@@ -383,6 +383,36 @@
Method javax.microedition.khronos.egl.EGL10.eglCreatePixmapSurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, Object, int[]): @Deprecated annotation (present) and @deprecated doc tag (not present) do not match
+FlaggedApiLiteral: android.Manifest.permission#BIND_APP_FUNCTION_SERVICE:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.app.appfunctions.flags.Flags.FLAG_ENABLE_APP_FUNCTION_MANAGER).
+FlaggedApiLiteral: android.Manifest.permission#BIND_TV_AD_SERVICE:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.media.tv.flags.Flags.FLAG_ENABLE_AD_SERVICE_FW).
+FlaggedApiLiteral: android.Manifest.permission#MANAGE_DEVICE_POLICY_THREAD_NETWORK:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (com.android.net.thread.platform.flags.Flags.FLAG_THREAD_USER_RESTRICTION_ENABLED).
+FlaggedApiLiteral: android.Manifest.permission#QUERY_ADVANCED_PROTECTION_MODE:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.security.Flags.FLAG_AAPM_API).
+FlaggedApiLiteral: android.Manifest.permission#RANGING:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.permission.flags.Flags.FLAG_RANGING_PERMISSION_ENABLED).
+FlaggedApiLiteral: android.Manifest.permission#REQUEST_OBSERVE_DEVICE_UUID_PRESENCE:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.companion.Flags.FLAG_DEVICE_PRESENCE).
+FlaggedApiLiteral: android.R.attr#adServiceTypes:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.media.tv.flags.Flags.FLAG_ENABLE_AD_SERVICE_FW).
+FlaggedApiLiteral: android.R.attr#intentMatchingFlags:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.security.Flags.FLAG_ENABLE_INTENT_MATCHING_FLAGS).
+FlaggedApiLiteral: android.R.attr#languageSettingsActivity:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.view.inputmethod.Flags.FLAG_IME_SWITCHER_REVAMP_API).
+FlaggedApiLiteral: android.R.attr#optional:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.content.pm.Flags.FLAG_SDK_LIB_INDEPENDENCE).
+FlaggedApiLiteral: android.R.attr#supplementalDescription:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.view.accessibility.Flags.FLAG_SUPPLEMENTAL_DESCRIPTION).
+FlaggedApiLiteral: android.accessibilityservice.AccessibilityService#OVERLAY_RESULT_INTERNAL_ERROR:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.view.accessibility.Flags.FLAG_A11Y_OVERLAY_CALLBACKS).
+FlaggedApiLiteral: android.accessibilityservice.AccessibilityService#OVERLAY_RESULT_INVALID:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.view.accessibility.Flags.FLAG_A11Y_OVERLAY_CALLBACKS).
+FlaggedApiLiteral: android.accessibilityservice.AccessibilityService#OVERLAY_RESULT_SUCCESS:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.view.accessibility.Flags.FLAG_A11Y_OVERLAY_CALLBACKS).
+
+
InvalidNullabilityOverride: android.app.Notification.TvExtender#extend(android.app.Notification.Builder) parameter #0:
Invalid nullability on parameter `builder` in method `extend`. Parameters of overrides cannot be NonNull if the super parameter is unannotated.
InvalidNullabilityOverride: android.media.midi.MidiUmpDeviceService#onBind(android.content.Intent) parameter #0:
diff --git a/core/api/system-lint-baseline.txt b/core/api/system-lint-baseline.txt
index 78577e2..7c43891 100644
--- a/core/api/system-lint-baseline.txt
+++ b/core/api/system-lint-baseline.txt
@@ -501,6 +501,52 @@
Method javax.microedition.khronos.egl.EGL10.eglCreatePixmapSurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, Object, int[]): @Deprecated annotation (present) and @deprecated doc tag (not present) do not match
+
+
+FlaggedApiLiteral: android.Manifest.permission#ACCESS_LAST_KNOWN_CELL_ID:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (com.android.server.telecom.flags.Flags.FLAG_TELECOM_RESOLVE_HIDDEN_DEPENDENCIES).
+FlaggedApiLiteral: android.Manifest.permission#BACKUP_HEALTH_CONNECT_DATA_AND_SETTINGS:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.permission.flags.Flags.FLAG_HEALTH_CONNECT_BACKUP_RESTORE_PERMISSION_ENABLED).
+FlaggedApiLiteral: android.Manifest.permission#BIND_VERIFICATION_AGENT:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.content.pm.Flags.FLAG_VERIFICATION_SERVICE).
+FlaggedApiLiteral: android.Manifest.permission#EMBED_ANY_APP_IN_UNTRUSTED_MODE:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (com.android.window.flags.Flags.FLAG_UNTRUSTED_EMBEDDING_ANY_APP_PERMISSION).
+FlaggedApiLiteral: android.Manifest.permission#EXECUTE_APP_FUNCTIONS:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.app.appfunctions.flags.Flags.FLAG_ENABLE_APP_FUNCTION_MANAGER).
+FlaggedApiLiteral: android.Manifest.permission#EXECUTE_APP_FUNCTIONS_TRUSTED:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.app.appfunctions.flags.Flags.FLAG_ENABLE_APP_FUNCTION_MANAGER).
+FlaggedApiLiteral: android.Manifest.permission#MANAGE_GLOBAL_PICTURE_QUALITY_SERVICE:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.media.tv.flags.Flags.FLAG_MEDIA_QUALITY_FW).
+FlaggedApiLiteral: android.Manifest.permission#MANAGE_GLOBAL_SOUND_QUALITY_SERVICE:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.media.tv.flags.Flags.FLAG_MEDIA_QUALITY_FW).
+FlaggedApiLiteral: android.Manifest.permission#QUARANTINE_APPS:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.content.pm.Flags.FLAG_QUARANTINED_ENABLED).
+FlaggedApiLiteral: android.Manifest.permission#QUERY_DEVICE_STOLEN_STATE:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.app.admin.flags.Flags.FLAG_DEVICE_THEFT_API_ENABLED).
+FlaggedApiLiteral: android.Manifest.permission#READ_BLOCKED_NUMBERS:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (com.android.server.telecom.flags.Flags.FLAG_TELECOM_RESOLVE_HIDDEN_DEPENDENCIES).
+FlaggedApiLiteral: android.Manifest.permission#RECEIVE_SANDBOX_TRIGGER_AUDIO:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.permission.flags.Flags.FLAG_VOICE_ACTIVATION_PERMISSION_APIS).
+FlaggedApiLiteral: android.Manifest.permission#REGISTER_NSD_OFFLOAD_ENGINE:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.net.platform.flags.Flags.FLAG_REGISTER_NSD_OFFLOAD_ENGINE).
+FlaggedApiLiteral: android.Manifest.permission#RESTORE_HEALTH_CONNECT_DATA_AND_SETTINGS:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.permission.flags.Flags.FLAG_HEALTH_CONNECT_BACKUP_RESTORE_PERMISSION_ENABLED).
+FlaggedApiLiteral: android.Manifest.permission#SET_ADVANCED_PROTECTION_MODE:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.security.Flags.FLAG_AAPM_API).
+FlaggedApiLiteral: android.Manifest.permission#SINGLE_USER_TIS_ACCESS:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.media.tv.flags.Flags.FLAG_KIDS_MODE_TVDB_SHARING).
+FlaggedApiLiteral: android.Manifest.permission#THREAD_NETWORK_PRIVILEGED:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (com.android.net.thread.platform.flags.Flags.FLAG_THREAD_ENABLED_PLATFORM).
+FlaggedApiLiteral: android.Manifest.permission#VERIFICATION_AGENT:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.content.pm.Flags.FLAG_VERIFICATION_SERVICE).
+FlaggedApiLiteral: android.Manifest.permission#VIBRATE_VENDOR_EFFECTS:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.os.vibrator.Flags.FLAG_VENDOR_VIBRATION_EFFECTS).
+FlaggedApiLiteral: android.Manifest.permission#WRITE_BLOCKED_NUMBERS:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (com.android.server.telecom.flags.Flags.FLAG_TELECOM_RESOLVE_HIDDEN_DEPENDENCIES).
+FlaggedApiLiteral: android.R.attr#backgroundPermission:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (android.permission.flags.Flags.FLAG_REPLACE_BODY_SENSOR_PERMISSION_ENABLED).
+
+
GenericException: android.app.prediction.AppPredictor#finalize():
Methods must not throw generic exceptions (`java.lang.Throwable`)
GenericException: android.hardware.location.ContextHubClient#finalize():
diff --git a/core/api/test-lint-baseline.txt b/core/api/test-lint-baseline.txt
index b4a3abc..08bb082 100644
--- a/core/api/test-lint-baseline.txt
+++ b/core/api/test-lint-baseline.txt
@@ -511,6 +511,12 @@
Method javax.microedition.khronos.egl.EGL10.eglCreatePixmapSurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, Object, int[]): @Deprecated annotation (present) and @deprecated doc tag (not present) do not match
+FlaggedApiLiteral: android.Manifest.permission#ACCESSIBILITY_MOTION_EVENT_OBSERVING:
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (com.android.server.accessibility.Flags.FLAG_MOTION_EVENT_OBSERVING, however this flag doesn't seem to exist).
+FlaggedApiLiteral: android.net.wifi.sharedconnectivity.app.SharedConnectivityManager#getBroadcastReceiver():
+ @FlaggedApi contains a string literal, but should reference the field generated by aconfig (com.android.wifi.flags.Flags.FLAG_SHARED_CONNECTIVITY_BROADCAST_RECEIVER_TEST_API, however this flag doesn't seem to exist).
+
+
InvalidNullabilityOverride: android.window.WindowProviderService#getSystemService(String) parameter #0:
Invalid nullability on parameter `name` in method `getSystemService`. Parameters of overrides cannot be NonNull if the super parameter is unannotated.
InvalidNullabilityOverride: android.window.WindowProviderService#onConfigurationChanged(android.content.res.Configuration) parameter #0: