diff options
| author | 2023-11-29 17:12:36 +0000 | |
|---|---|---|
| committer | 2023-11-29 17:12:36 +0000 | |
| commit | 65c2ce9da3e7b015025d9c7294ba317e9b0995db (patch) | |
| tree | 7fa28435639bb7f7baccd25d002b8ebad12622db | |
| parent | 567d3ebd94557bdd14dd1d99c2f3395ba8d20a56 (diff) | |
| parent | f09eeecb87585a98f478853e83e99570e44d85da (diff) | |
Merge "Update tests to verify the new interaction event extras" into main
| -rw-r--r-- | services/tests/servicestests/src/com/android/server/usage/IntervalStatsTests.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/services/tests/servicestests/src/com/android/server/usage/IntervalStatsTests.java b/services/tests/servicestests/src/com/android/server/usage/IntervalStatsTests.java index 2be3f1e81897..517f48346b30 100644 --- a/services/tests/servicestests/src/com/android/server/usage/IntervalStatsTests.java +++ b/services/tests/servicestests/src/com/android/server/usage/IntervalStatsTests.java @@ -21,8 +21,11 @@ import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertTrue; import static junit.framework.Assert.fail; +import android.app.usage.Flags; import android.app.usage.UsageEvents; +import android.app.usage.UsageStatsManager; import android.content.res.Configuration; +import android.os.PersistableBundle; import android.test.suitebuilder.annotation.SmallTest; import androidx.test.runner.AndroidJUnit4; @@ -99,6 +102,17 @@ public class IntervalStatsTests { case UsageEvents.Event.LOCUS_ID_SET: event.mLocusId = "locus" + (i % 7); //"random" locus break; + case UsageEvents.Event.USER_INTERACTION: + if (Flags.userInteractionTypeApi()) { + // "random" user interaction extras. + PersistableBundle extras = new PersistableBundle(); + extras.putString(UsageStatsManager.EXTRA_EVENT_CATEGORY, + "fake.namespace.category" + (i % 13)); + extras.putString(UsageStatsManager.EXTRA_EVENT_ACTION, + "fakeaction" + (i % 13)); + event.mExtras = extras; + } + break; } intervalStats.addEvent(event); |