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

Commit 2e49bfa6 authored by Adam Lesinski's avatar Adam Lesinski Committed by Android (Google) Code Review
Browse files

Merge "UsageStats: Change INTERACTION to SYSTEM_INTERACTION" into mnc-dev

parents 06f3cd8e c8e87292
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6123,10 +6123,10 @@ package android.app.usage {
    method public java.lang.String getPackageName();
    method public long getTimeStamp();
    field public static final int CONFIGURATION_CHANGE = 5; // 0x5
    field public static final int INTERACTION = 6; // 0x6
    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 USER_INTERACTION = 7; // 0x7
  }
  public final class UsageStats implements android.os.Parcelable {
+1 −1
Original line number Diff line number Diff line
@@ -6313,10 +6313,10 @@ package android.app.usage {
    method public java.lang.String getPackageName();
    method public long getTimeStamp();
    field public static final int CONFIGURATION_CHANGE = 5; // 0x5
    field public static final int INTERACTION = 6; // 0x6
    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 USER_INTERACTION = 7; // 0x7
  }
  public final class UsageStats implements android.os.Parcelable {
+8 −2
Original line number Diff line number Diff line
@@ -68,9 +68,15 @@ public final class UsageEvents implements Parcelable {
        public static final int CONFIGURATION_CHANGE = 5;

        /**
         * An event type denoting that a package was interacted with in some way.
         * An event type denoting that a package was interacted with in some way by the system.
         * @hide
         */
        public static final int INTERACTION = 6;
        public static final int SYSTEM_INTERACTION = 6;

        /**
         * An event type denoting that a package was interacted with in some way by the user.
         */
        public static final int USER_INTERACTION = 7;

        /**
         * {@hide}
+22 −0
Original line number Diff line number Diff line
@@ -41,10 +41,18 @@ public final class UsageStats implements Parcelable {
    public long mEndTimeStamp;

    /**
     * Last time used by the user with an explicit action (notification, activity launch).
     * {@hide}
     */
    public long mLastTimeUsed;

    /**
     * The last time the package was used via implicit, non-user initiated actions (service
     * was bound, etc).
     * {@hide}
     */
    public long mLastTimeSystemUsed;

    /**
     * Last time the package was used and the beginning of the idle countdown.
     * This uses a different timebase that is about how much the device has been in use in general.
@@ -82,6 +90,7 @@ public final class UsageStats implements Parcelable {
        mLaunchCount = stats.mLaunchCount;
        mLastEvent = stats.mLastEvent;
        mBeginIdleTime = stats.mBeginIdleTime;
        mLastTimeSystemUsed = stats.mLastTimeSystemUsed;
    }

    public String getPackageName() {
@@ -117,6 +126,16 @@ public final class UsageStats implements Parcelable {
        return mLastTimeUsed;
    }

    /**
     * @hide
     * Get the last time this package was used by the system (not the user). This can be different
     * from {@link #getLastTimeUsed()} when the system binds to one of this package's services.
     * See {@link System#currentTimeMillis()}.
     */
    public long getLastTimeSystemUsed() {
        return mLastTimeSystemUsed;
    }

    /**
     * @hide
     * Get the last time this package was active, measured in milliseconds. This timestamp
@@ -151,6 +170,7 @@ public final class UsageStats implements Parcelable {
            mEndTimeStamp = right.mEndTimeStamp;
            mLastTimeUsed = right.mLastTimeUsed;
            mBeginIdleTime = right.mBeginIdleTime;
            mLastTimeSystemUsed = right.mLastTimeSystemUsed;
        }
        mBeginTimeStamp = Math.min(mBeginTimeStamp, right.mBeginTimeStamp);
        mTotalTimeInForeground += right.mTotalTimeInForeground;
@@ -172,6 +192,7 @@ public final class UsageStats implements Parcelable {
        dest.writeInt(mLaunchCount);
        dest.writeInt(mLastEvent);
        dest.writeLong(mBeginIdleTime);
        dest.writeLong(mLastTimeSystemUsed);
    }

    public static final Creator<UsageStats> CREATOR = new Creator<UsageStats>() {
@@ -186,6 +207,7 @@ public final class UsageStats implements Parcelable {
            stats.mLaunchCount = in.readInt();
            stats.mLastEvent = in.readInt();
            stats.mBeginIdleTime = in.readLong();
            stats.mLastTimeSystemUsed = in.readLong();
            return stats;
        }

+1 −1
Original line number Diff line number Diff line
@@ -18624,7 +18624,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            if (packages != null) {
                for (int i = 0; i < packages.length; i++) {
                    mUsageStatsService.reportEvent(packages[i], app.userId,
                            UsageEvents.Event.INTERACTION);
                            UsageEvents.Event.SYSTEM_INTERACTION);
                }
            }
        }
Loading