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

Commit 88ebac42 authored by Dimuthu Gamage's avatar Dimuthu Gamage
Browse files

Adding isInstantApp API to UsageEvents

Extending UsageEvents.Event to include isInstantApp()

Bug: 111407095
Test: Expecting to add cts tests to the added API methods
Change-Id: Iead337a23deddc58fa1f2f4a1cc3036572147951
parent def16857
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1127,6 +1127,7 @@ package android.app.usage {
    method public String getNotificationChannelId();
    method @Nullable public String getTaskRootClassName();
    method @Nullable public String getTaskRootPackageName();
    method public boolean isInstantApp();
    field public static final int NOTIFICATION_INTERRUPTION = 12; // 0xc
    field public static final int NOTIFICATION_SEEN = 10; // 0xa
    field public static final int SLICE_PINNED = 14; // 0xe
+13 −1
Original line number Diff line number Diff line
@@ -404,6 +404,16 @@ public final class UsageEvents implements Parcelable {
            return mPackage;
        }

        /**
         * Indicates whether it is an instant app.
         * STOPSHIP b/111407095: Add GTS tests for the newly added API method.
         * @hide
         */
        @SystemApi
        public boolean isInstantApp() {
            return (mFlags & FLAG_IS_PACKAGE_INSTANT_APP) == FLAG_IS_PACKAGE_INSTANT_APP;
        }

        /**
         * The class name of the source of this event. This may be null for
         * certain events.
@@ -530,7 +540,7 @@ public final class UsageEvents implements Parcelable {

        /** @hide */
        public Event getObfuscatedIfInstantApp() {
            if ((mFlags & FLAG_IS_PACKAGE_INSTANT_APP) == 0) {
            if (!isInstantApp()) {
                return this;
            }
            final Event ret = new Event(this);
@@ -735,6 +745,7 @@ public final class UsageEvents implements Parcelable {
                p.writeString(event.mNotificationChannelId);
                break;
        }
        p.writeInt(event.mFlags);
    }

    /**
@@ -802,6 +813,7 @@ public final class UsageEvents implements Parcelable {
                eventOut.mNotificationChannelId = p.readString();
                break;
        }
        eventOut.mFlags = p.readInt();
    }

    @Override