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

Commit 32a96b8a authored by Ming-Shin Lu's avatar Ming-Shin Lu
Browse files

Add Intrsumentation#resetInTouchMode for instrumenting

As IWindowManager#setInTouchMode(boolean) will override the global touch
mode state for testing usage, it would be nice to add an API for
restoring the original default touch mode state after the test.

Bug: 220180252
Bug: 220907843
Test: m checkapi
Change-Id: I60909e7da5be3158e2630848f2b6b4b213fc3a01
parent 2773ac9c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5623,6 +5623,7 @@ package android.app {
    method public boolean onException(Object, Throwable);
    method public void onStart();
    method public void removeMonitor(android.app.Instrumentation.ActivityMonitor);
    method public void resetInTouchMode();
    method public void runOnMainSync(Runnable);
    method public void sendCharacterSync(int);
    method public void sendKeyDownUpSync(int);
+9 −0
Original line number Diff line number Diff line
@@ -392,6 +392,15 @@ public class Instrumentation {
        }
    }

    /**
     * Resets the {@link #setInTouchMode touch mode} to the device default.
     */
    public void resetInTouchMode() {
        final boolean defaultInTouchMode = getContext().getResources().getBoolean(
                com.android.internal.R.bool.config_defaultInTouchMode);
        setInTouchMode(defaultInTouchMode);
    }

    /**
     * Schedule a callback for when the application's main thread goes idle
     * (has no more events to process).