Loading tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +40 −20 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import android.os.DeadObjectException; import android.os.Parcelable; import android.os.RemoteException; import android.os.SystemClock; import android.os.Trace; import android.text.TextUtils; import android.util.Log; import android.view.InputDevice; Loading Loading @@ -524,16 +525,19 @@ public final class LauncherInstrumentation { Closable addContextLayer(String piece) { mDiagnosticContext.addLast(piece); Trace.beginSection("Context: " + piece); log("Entering context: " + piece); return () -> { Trace.endSection(); log("Leaving context: " + piece); mDiagnosticContext.removeLast(); }; } public void dumpViewHierarchy() { final ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { Trace.beginSection("dumpViewHierarchy"); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); mDevice.dumpWindowHierarchy(stream); stream.flush(); stream.close(); Loading @@ -542,6 +546,8 @@ public final class LauncherInstrumentation { } } catch (IOException e) { Log.e(TAG, "error dumping XML to logcat", e); } finally { Trace.endSection(); } } Loading Loading @@ -621,6 +627,8 @@ public final class LauncherInstrumentation { */ public void checkForAnomaly( boolean ignoreNavmodeChangeStates, boolean ignoreOnlySystemUiViews) { try { Trace.beginSection("checkForAnomaly"); if (mTestAnomalyChecker != null) mTestAnomalyChecker.run(); final String systemAnomalyMessage = Loading @@ -631,6 +639,9 @@ public final class LauncherInstrumentation { "http://go/tapl : Tests are broken by a non-Launcher system error: " + systemAnomalyMessage, false))); } } finally { Trace.endSection(); } } private String getVisiblePackages() { Loading Loading @@ -1005,16 +1016,20 @@ public final class LauncherInstrumentation { } public void waitForLauncherInitialized() { try { Trace.beginSection("waitForLauncherInitialized"); for (int i = 0; i < 100; ++i) { if (getTestInfo( TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED). getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD)) { if (getTestInfo(TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED).getBoolean( TestProtocol.TEST_INFO_RESPONSE_FIELD)) { return; } SystemClock.sleep(100); } checkForAnomaly(); fail("Launcher didn't initialize"); } finally { Trace.endSection(); } } public boolean isLauncherActivityStarted() { Loading Loading @@ -1259,8 +1274,13 @@ public final class LauncherInstrumentation { } boolean isLauncherVisible() { try { Trace.beginSection("isLauncherVisible"); mDevice.waitForIdle(); return hasLauncherObject(getAnyObjectSelector()); } finally { Trace.endSection(); } } boolean isLauncherContainerVisible() { Loading Loading
tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +40 −20 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import android.os.DeadObjectException; import android.os.Parcelable; import android.os.RemoteException; import android.os.SystemClock; import android.os.Trace; import android.text.TextUtils; import android.util.Log; import android.view.InputDevice; Loading Loading @@ -524,16 +525,19 @@ public final class LauncherInstrumentation { Closable addContextLayer(String piece) { mDiagnosticContext.addLast(piece); Trace.beginSection("Context: " + piece); log("Entering context: " + piece); return () -> { Trace.endSection(); log("Leaving context: " + piece); mDiagnosticContext.removeLast(); }; } public void dumpViewHierarchy() { final ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { Trace.beginSection("dumpViewHierarchy"); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); mDevice.dumpWindowHierarchy(stream); stream.flush(); stream.close(); Loading @@ -542,6 +546,8 @@ public final class LauncherInstrumentation { } } catch (IOException e) { Log.e(TAG, "error dumping XML to logcat", e); } finally { Trace.endSection(); } } Loading Loading @@ -621,6 +627,8 @@ public final class LauncherInstrumentation { */ public void checkForAnomaly( boolean ignoreNavmodeChangeStates, boolean ignoreOnlySystemUiViews) { try { Trace.beginSection("checkForAnomaly"); if (mTestAnomalyChecker != null) mTestAnomalyChecker.run(); final String systemAnomalyMessage = Loading @@ -631,6 +639,9 @@ public final class LauncherInstrumentation { "http://go/tapl : Tests are broken by a non-Launcher system error: " + systemAnomalyMessage, false))); } } finally { Trace.endSection(); } } private String getVisiblePackages() { Loading Loading @@ -1005,16 +1016,20 @@ public final class LauncherInstrumentation { } public void waitForLauncherInitialized() { try { Trace.beginSection("waitForLauncherInitialized"); for (int i = 0; i < 100; ++i) { if (getTestInfo( TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED). getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD)) { if (getTestInfo(TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED).getBoolean( TestProtocol.TEST_INFO_RESPONSE_FIELD)) { return; } SystemClock.sleep(100); } checkForAnomaly(); fail("Launcher didn't initialize"); } finally { Trace.endSection(); } } public boolean isLauncherActivityStarted() { Loading Loading @@ -1259,8 +1274,13 @@ public final class LauncherInstrumentation { } boolean isLauncherVisible() { try { Trace.beginSection("isLauncherVisible"); mDevice.waitForIdle(); return hasLauncherObject(getAnyObjectSelector()); } finally { Trace.endSection(); } } boolean isLauncherContainerVisible() { Loading