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

Commit 21315b15 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by android-build-merger
Browse files

Merge "Don't show unsupported sdk warning in test harness." into pi-dev

am: 444885b1

Change-Id: I750ffef919badf38d759a32b1067702692d2a9c2
parents 728dc5ea 444885b1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ package android.app {

  public class ActivityManager {
    method public void addOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener, int);
    method public void alwaysShowUnsupportedCompileSdkWarning(android.content.ComponentName);
    method public int getPackageImportance(java.lang.String);
    method public long getTotalRam();
    method public int getUidImportance(int);
+18 −0
Original line number Diff line number Diff line
@@ -3744,6 +3744,24 @@ public class ActivityManager {
        return SystemProperties.getBoolean("ro.test_harness", false);
    }

    /**
     * Unsupported compiled sdk warning should always be shown for the intput activity
     * even in cases where the system would normally not show the warning. E.g. when running in a
     * test harness.
     *
     * @param activity The component name of the activity to always show the warning for.
     *
     * @hide
     */
    @TestApi
    public void alwaysShowUnsupportedCompileSdkWarning(ComponentName activity) {
        try {
            getService().alwaysShowUnsupportedCompileSdkWarning(activity);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Returns the launch count of each installed package.
     *
+3 −0
Original line number Diff line number Diff line
@@ -703,4 +703,7 @@ interface IActivityManager {
     */
    void registerRemoteAnimationForNextActivityStart(in String packageName,
           in RemoteAnimationAdapter adapter);

    /** @see android.app.ActivityManager#alwaysShowUnsupportedCompileSdkWarning */
    void alwaysShowUnsupportedCompileSdkWarning(in ComponentName activity);
}
+13 −0
Original line number Diff line number Diff line
@@ -26708,4 +26708,17 @@ public class ActivityManagerService extends IActivityManager.Stub
            }
        }
    }
    /** @see android.app.ActivityManager#alwaysShowUnsupportedCompileSdkWarning */
    @Override
    public void alwaysShowUnsupportedCompileSdkWarning(ComponentName activity) {
        synchronized (this) {
            final long origId = Binder.clearCallingIdentity();
            try {
                mAppWarnings.alwaysShowUnsupportedCompileSdkWarning(activity);
            } finally {
                Binder.restoreCallingIdentity(origId);
            }
        }
    }
}
+19 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package com.android.server.am;

import android.annotation.UiThread;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
@@ -39,6 +41,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

/**
@@ -64,6 +67,15 @@ class AppWarnings {
    private UnsupportedCompileSdkDialog mUnsupportedCompileSdkDialog;
    private DeprecatedTargetSdkVersionDialog mDeprecatedTargetSdkVersionDialog;

    /** @see android.app.ActivityManager#alwaysShowUnsupportedCompileSdkWarning */
    private HashSet<ComponentName> mAlwaysShowUnsupportedCompileSdkWarningActivities =
            new HashSet<>();

    /** @see android.app.ActivityManager#alwaysShowUnsupportedCompileSdkWarning */
    void alwaysShowUnsupportedCompileSdkWarning(ComponentName activity) {
        mAlwaysShowUnsupportedCompileSdkWarningActivities.add(activity);
    }

    /**
     * Creates a new warning dialog manager.
     * <p>
@@ -110,6 +122,13 @@ class AppWarnings {
            return;
        }

        if (ActivityManager.isRunningInTestHarness()
                && !mAlwaysShowUnsupportedCompileSdkWarningActivities.contains(r.realActivity)) {
            // Don't show warning if we are running in a test harness and we don't have to always
            // show for this activity.
            return;
        }

        // If the application was built against an pre-release SDK that's older than the current
        // platform OR if the current platform is pre-release and older than the SDK against which
        // the application was built OR both are pre-release with the same SDK_INT but different