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

Commit 4e12de81 authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

Unhiding APIs in UsageEvents for public use

These apis are needed to interpret standby bucket change history
when using UsageStatsManager#queryEventsForSelf

Test: atest android.app.usage.cts.UsageStatsTest#testQueryEventsForSelf

Bug: 71906213
Change-Id: Ib9f458bf32089ad30c97eca9dd5cc4df5a392191
parent f2939ab2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -7418,12 +7418,14 @@ package android.app.usage {
    method public int getEventType();
    method public java.lang.String getPackageName();
    method public java.lang.String getShortcutId();
    method public int getStandbyBucket();
    method public long getTimeStamp();
    field public static final int CONFIGURATION_CHANGE = 5; // 0x5
    field public static final int MOVE_TO_BACKGROUND = 2; // 0x2
    field public static final int MOVE_TO_FOREGROUND = 1; // 0x1
    field public static final int NONE = 0; // 0x0
    field public static final int SHORTCUT_INVOCATION = 8; // 0x8
    field public static final int STANDBY_BUCKET_CHANGED = 11; // 0xb
    field public static final int USER_INTERACTION = 7; // 0x7
  }
+0 −2
Original line number Diff line number Diff line
@@ -718,10 +718,8 @@ package android.app.usage {

  public static final class UsageEvents.Event {
    method public java.lang.String getNotificationChannelId();
    method public int getStandbyBucket();
    field public static final int NOTIFICATION_INTERRUPTION = 12; // 0xc
    field public static final int NOTIFICATION_SEEN = 10; // 0xa
    field public static final int STANDBY_BUCKET_CHANGED = 11; // 0xb
  }

  public final class UsageStatsManager {
+10 −8
Original line number Diff line number Diff line
@@ -109,11 +109,11 @@ public final class UsageEvents implements Parcelable {
        public static final int NOTIFICATION_SEEN = 10;

        /**
         * An event type denoting a change in App Standby Bucket. Additional bucket information
         * is contained in mBucketAndReason.
         * @hide
         * An event type denoting a change in App Standby Bucket. The new bucket can be
         * retrieved by calling {@link #getStandbyBucket()}.
         *
         * @see UsageStatsManager#getAppStandbyBucket()
         */
        @SystemApi
        public static final int STANDBY_BUCKET_CHANGED = 11;

        /**
@@ -254,8 +254,11 @@ public final class UsageEvents implements Parcelable {
        /**
         * The event type.
         *
         * See {@link #MOVE_TO_BACKGROUND}
         * See {@link #MOVE_TO_FOREGROUND}
         * @see #MOVE_TO_BACKGROUND
         * @see #MOVE_TO_FOREGROUND
         * @see #CONFIGURATION_CHANGE
         * @see #USER_INTERACTION
         * @see #STANDBY_BUCKET_CHANGED
         */
        public int getEventType() {
            return mEventType;
@@ -283,9 +286,8 @@ public final class UsageEvents implements Parcelable {
         * Returns the standby bucket of the app, if the event is of type
         * {@link #STANDBY_BUCKET_CHANGED}, otherwise returns 0.
         * @return the standby bucket associated with the event.
         * @hide
         *
         */
        @SystemApi
        public int getStandbyBucket() {
            return (mBucketAndReason & 0xFFFF0000) >>> 16;
        }