From a4ba0e442aee1bfa31b66f82f43a920be59047fb Mon Sep 17 00:00:00 2001 From: Mathew Inwood Date: Thu, 5 Apr 2018 15:44:20 +0100 Subject: Replace ALL_LISTS policy with JUST_WARN. It seems pretty unlikely that we'd ever want to disallow access to the light greylist in P, since doing do would break do many apps. We don't need this policy here as an opt-in for apps now, since the StrictMode work will achieve the same thing. Instead, make a "just warn" policy which allows access to all APIs, but leaves the detection and logging logic in place. This gives us the option of disabling enforcement, but still gathering logs to find out which apps use which APIs. Bug: 77517571 Test: Boot device Test: Hardcode policy of HIDDEN_API_ENFORCEMENT_JUST_WARN and verify log Merged-In: I588f347716a79ac5887b74763c8afc16b3be699b Change-Id: I588f347716a79ac5887b74763c8afc16b3be699b (cherry picked from commit a6d02fb1041bf19161fd4d74bcf5a1cd87495245) --- core/java/android/content/pm/ApplicationInfo.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index ebc88ff7116b..d9a1ce0ec7a0 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -1059,11 +1059,12 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { */ public static final int HIDDEN_API_ENFORCEMENT_NONE = 0; /** - * Light grey list enforcement, the strictest option. Enforces the light grey, dark grey and - * black lists. + * No API enforcement, but enable the detection logic and warnings. Observed behaviour is the + * sane as {@link #HIDDEN_API_ENFORCEMENT_NONE} but you may see warnings in the log when APIs + * are accessed. * @hide * */ - public static final int HIDDEN_API_ENFORCEMENT_ALL_LISTS = 1; + public static final int HIDDEN_API_ENFORCEMENT_JUST_WARN = 1; /** * Dark grey list enforcement. Enforces the dark grey and black lists * @hide @@ -1085,7 +1086,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { @IntDef(prefix = { "HIDDEN_API_ENFORCEMENT_" }, value = { HIDDEN_API_ENFORCEMENT_DEFAULT, HIDDEN_API_ENFORCEMENT_NONE, - HIDDEN_API_ENFORCEMENT_ALL_LISTS, + HIDDEN_API_ENFORCEMENT_JUST_WARN, HIDDEN_API_ENFORCEMENT_DARK_GREY_AND_BLACK, HIDDEN_API_ENFORCEMENT_BLACK, }) -- cgit v1.2.3-59-g8ed1b