UsageReportingTest: use gotoKeyguard() to trigger the STOPPED state.

When the screen lock is set to None, then call mUiDevice.sleep(). The secondary activity in the split screen does not change to the STOPPED state, which is still in the PAUSED state. Therefore, we need to use gotoKeyguard() to trigger the STOPPED state of the secondary Activity.

Test: run cts -m CtsUsageStatsTestCases -t android.app.usage.cts.UsageReportingTest#testSplitscreenSameTokenTwoMissedStop

Bug: 138556459

Signed-off-by: duanyangqi <duanyangqi@xiaomi.com>
diff --git a/tests/tests/app.usage/src/android/app/usage/cts/UsageReportingTest.java b/tests/tests/app.usage/src/android/app/usage/cts/UsageReportingTest.java
index 6d21843..a5e780c 100644
--- a/tests/tests/app.usage/src/android/app/usage/cts/UsageReportingTest.java
+++ b/tests/tests/app.usage/src/android/app/usage/cts/UsageReportingTest.java
@@ -344,10 +344,12 @@
         mUsageStatsManager.reportUsageStart(activity1, TOKEN_0);
         assertAppOrTokenUsed(mFullToken0, true);
 
-        // Send the device to sleep to get onStop called for the token reporting activities.
-        mUiDevice.sleep();
-        Thread.sleep(1000);
-        assertAppOrTokenUsed(mFullToken0, false);
+        // Send the device to keyguard to get onStop called for the token reporting activities.
+        try (final LockScreenSession lockScreenSession = new LockScreenSession()) {
+            lockScreenSession.gotoKeyguard();
+            Thread.sleep(1000);
+            assertAppOrTokenUsed(mFullToken0, false);
+        }
     }
 
     private void assertAppOrTokenUsed(String entity, boolean expected) throws Exception {