Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d960cc4a authored by David Brazdil's avatar David Brazdil
Browse files

Show hidden API warning once per process

In order to not spam users with warning toasts, add a boolean flag
that guards the displaying of a warning message about hidden API
usage and is set after the first time a message is shown.

Bug: 64382372
Test: manual
Change-Id: If7ea995ddf4727a15eccf55dad42ef7775b1fc91
parent b6d5a85a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -7071,7 +7071,10 @@ public class Activity extends ContextThemeWrapper
        boolean isApiWarningEnabled = SystemProperties.getInt("ro.art.hiddenapi.warning", 0) == 1;

        if (isAppDebuggable || isApiWarningEnabled) {
            if (VMRuntime.getRuntime().hasUsedHiddenApi()) {
            if (!mMainThread.mHiddenApiWarningShown && VMRuntime.getRuntime().hasUsedHiddenApi()) {
                // Only show the warning once per process.
                mMainThread.mHiddenApiWarningShown = true;

                String appName = getApplicationInfo().loadLabel(getPackageManager())
                        .toString();
                String warning = "Detected problems with API compatiblity\n"
+1 −0
Original line number Diff line number Diff line
@@ -266,6 +266,7 @@ public final class ActivityThread {
    boolean mJitEnabled = false;
    boolean mSomeActivitiesChanged = false;
    boolean mUpdatingSystemConfig = false;
    /* package */ boolean mHiddenApiWarningShown = false;

    // These can be accessed by multiple threads; mResourcesManager is the lock.
    // XXX For now we keep around information about all packages we have