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

Commit 65c2ce9d authored by Xin Guan's avatar Xin Guan Committed by Android (Google) Code Review
Browse files

Merge "Update tests to verify the new interaction event extras" into main

parents 567d3ebd f09eeecb
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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);