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

Commit 09d70fb6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Implement test harness mode"

parents 844ff30b a96d3d3f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3941,7 +3941,8 @@ package android.app {
    method public boolean isBackgroundRestricted();
    method @Deprecated public boolean isInLockTaskMode();
    method public boolean isLowRamDevice();
    method public static boolean isRunningInTestHarness();
    method @Deprecated public static boolean isRunningInTestHarness();
    method public static boolean isRunningInUserTestHarness();
    method public static boolean isUserAMonkey();
    method @RequiresPermission(android.Manifest.permission.KILL_BACKGROUND_PROCESSES) public void killBackgroundProcesses(String);
    method @RequiresPermission(android.Manifest.permission.REORDER_TASKS) public void moveTaskToFront(int, int);
+20 −0
Original line number Diff line number Diff line
@@ -3529,11 +3529,31 @@ public class ActivityManager {

    /**
     * Returns "true" if device is running in a test harness.
     *
     * @deprecated this method is false for all user builds. Users looking to check if their device
     * is running in a device farm should see {@link #isRunningInUserTestHarness()}.
     */
    @Deprecated
    public static boolean isRunningInTestHarness() {
        return SystemProperties.getBoolean("ro.test_harness", false);
    }

    /**
     * Returns "true" if the device is running in Test Harness Mode.
     *
     * <p>Test Harness Mode is a feature that allows devices to run without human interaction in a
     * device farm/testing harness (such as Firebase Test Lab). You should check this method if you
     * want your app to behave differently when running in a test harness to skip setup screens that
     * would impede UI testing. e.g. a keyboard application that has a full screen setup page for
     * the first time it is launched.
     *
     * <p>Note that you should <em>not</em> use this to determine whether or not your app is running
     * an instrumentation test, as it is not set for a standard device running a test.
     */
    public static boolean isRunningInUserTestHarness() {
        return SystemProperties.getBoolean("persist.sys.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
+4 −0
Original line number Diff line number Diff line
@@ -1748,6 +1748,10 @@
    <permission android:name="android.permission.MANAGE_BLUETOOTH_WHEN_WIRELESS_CONSENT_REQUIRED"
        android:protectionLevel="signature" />

    <!-- @hide Allows the device to be reset, clearing all data and enables Test Harness Mode. -->
    <permission android:name="android.permission.ENABLE_TEST_HARNESS_MODE"
        android:protectionLevel="signature" />

    <!-- ================================== -->
    <!-- Permissions for accessing accounts -->
    <!-- ================================== -->
+2 −0
Original line number Diff line number Diff line
@@ -166,6 +166,8 @@
    <uses-permission android:name="android.permission.CONTROL_KEYGUARD" />
    <uses-permission android:name="android.permission.SUSPEND_APPS" />
    <uses-permission android:name="android.permission.READ_CLIPBOARD_IN_BACKGROUND" />
    <!-- Permission needed to wipe the device for Test Harness Mode -->
    <uses-permission android:name="android.permission.ENABLE_TEST_HARNESS_MODE" />

    <uses-permission android:name="android.permission.MANAGE_APPOPS" />

+13 −0
Original line number Diff line number Diff line
@@ -31,6 +31,19 @@ public interface PersistentDataBlockManagerInternal {
     */
    byte[] getFrpCredentialHandle();

    /** Stores the data used to enable the Test Harness Mode after factory-resetting. */
    void setTestHarnessModeData(byte[] data);

    /**
     * Retrieves the data used to place the device into Test Harness Mode.
     *
     * @throws IllegalStateException if the underlying storage is corrupt or inaccessible.
     */
    byte[] getTestHarnessModeData();

    /** Clear out the Test Harness Mode data. */
    void clearTestHarnessModeData();

    /** Update the OEM unlock enabled bit, bypassing user restriction checks. */
    void forceOemUnlockEnabled(boolean enabled);
}
Loading