From 795cbfb1c1719fa597d9911aa4a39ad8d7dbbc3e Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Fri, 26 Jan 2018 12:23:15 +0000 Subject: [PATCH] Control hidden API toast with a system property CL Id0a4200f912ac3303026cb26b6d8974c47332828 sets a system property "ro.art.hiddenapi.warning" for non-release, non-user builds. This patch reads that flag and unless the flag is set, will only ever show the warning message if the app is debuggable. Test: manual Bug: 64382372 Change-Id: I9b552792779589a7a91818a82d5c86141fc0a30b --- core/java/android/app/Activity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 2e7a0ed86fdb2..3abb24ce7b20e 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -7044,7 +7044,7 @@ public class Activity extends ContextThemeWrapper boolean isAppDebuggable = (mApplication.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; - // This property is set for all builds except final release + // This property is set for all non-user builds except final release boolean isDlwarningEnabled = SystemProperties.getInt("ro.bionic.ld.warning", 0) == 1; if (isAppDebuggable || isDlwarningEnabled) { @@ -7067,8 +7067,8 @@ public class Activity extends ContextThemeWrapper } } - // We might disable this for final builds. - boolean isApiWarningEnabled = true; + // This property is set for all non-user builds except final release + boolean isApiWarningEnabled = SystemProperties.getInt("ro.art.hiddenapi.warning", 0) == 1; if (isAppDebuggable || isApiWarningEnabled) { if (VMRuntime.getRuntime().hasUsedHiddenApi()) {