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

Commit aafbf429 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8983512 from 43c3022f to tm-qpr1-release

Change-Id: Iddbd968d64f86b58b51e608ff67b98023c18fcca
parents 0ff9a9ad 43c3022f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1906,6 +1906,7 @@ public class AppOpsManager {
            OP_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER,
            OP_SCHEDULE_EXACT_ALARM,
            OP_MANAGE_MEDIA,
            OP_GET_USAGE_STATS,
    };

    /**
+2 −11
Original line number Diff line number Diff line
@@ -956,16 +956,7 @@ public abstract class BatteryStats implements Parcelable {

        public static final int NUM_WIFI_BATCHED_SCAN_BINS = 5;

        /**
         * Note that these must match the constants in android.os.PowerManager.
         * Also, if the user activity types change, the BatteryStatsImpl.VERSION must
         * also be bumped.
         */
        static final String[] USER_ACTIVITY_TYPES = {
            "other", "button", "touch", "accessibility", "attention"
        };

        public static final int NUM_USER_ACTIVITY_TYPES = USER_ACTIVITY_TYPES.length;
        public static final int NUM_USER_ACTIVITY_TYPES = PowerManager.USER_ACTIVITY_EVENT_MAX + 1;

        public abstract void noteUserActivityLocked(int type);
        public abstract boolean hasUserActivity();
@@ -6177,7 +6168,7 @@ public abstract class BatteryStats implements Parcelable {
                        }
                        sb.append(val);
                        sb.append(" ");
                        sb.append(Uid.USER_ACTIVITY_TYPES[i]);
                        sb.append(PowerManager.userActivityEventToString(i));
                    }
                }
                if (hasData) {
+38 −0
Original line number Diff line number Diff line
@@ -344,6 +344,44 @@ public final class PowerManager {
     */
    public static final int USER_ACTIVITY_EVENT_DEVICE_STATE = 6;

    /**
     * @hide
     */
    public static final int USER_ACTIVITY_EVENT_MAX =  USER_ACTIVITY_EVENT_DEVICE_STATE;

    /**
     * @hide
     */
    @IntDef(prefix = { "USER_ACTIVITY_EVENT_" }, value = {
            USER_ACTIVITY_EVENT_OTHER,
            USER_ACTIVITY_EVENT_BUTTON,
            USER_ACTIVITY_EVENT_TOUCH,
            USER_ACTIVITY_EVENT_ACCESSIBILITY,
            USER_ACTIVITY_EVENT_ATTENTION,
            USER_ACTIVITY_EVENT_FACE_DOWN,
            USER_ACTIVITY_EVENT_DEVICE_STATE,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface UserActivityEvent{}

    /**
     *
     * Convert the user activity event to a string for debugging purposes.
     * @hide
     */
    public static String userActivityEventToString(@UserActivityEvent int userActivityEvent) {
        switch (userActivityEvent) {
            case USER_ACTIVITY_EVENT_OTHER: return "other";
            case USER_ACTIVITY_EVENT_BUTTON: return "button";
            case USER_ACTIVITY_EVENT_TOUCH: return "touch";
            case USER_ACTIVITY_EVENT_ACCESSIBILITY: return "accessibility";
            case USER_ACTIVITY_EVENT_ATTENTION: return "attention";
            case USER_ACTIVITY_EVENT_FACE_DOWN: return "faceDown";
            case USER_ACTIVITY_EVENT_DEVICE_STATE: return "deviceState";
            default: return Integer.toString(userActivityEvent);
        }
    }

    /**
     * User activity flag: If already dimmed, extend the dim timeout
     * but do not brighten.  This flag is useful for keeping the screen on
+2 −1
Original line number Diff line number Diff line
@@ -1971,7 +1971,8 @@ public class UserManager {
    /** @hide */
    public UserManager(Context context, IUserManager service) {
        mService = service;
        mContext = context.getApplicationContext();
        Context appContext = context.getApplicationContext();
        mContext = (appContext == null ? context : appContext);
        mUserId = context.getUserId();
    }

+6 −5
Original line number Diff line number Diff line
@@ -6144,7 +6144,8 @@ public class BatteryStatsImpl extends BatteryStats {
    }
    @GuardedBy("this")
    public void noteUserActivityLocked(int uid, int event, long elapsedRealtimeMs, long uptimeMs) {
    public void noteUserActivityLocked(int uid, @PowerManager.UserActivityEvent int event,
            long elapsedRealtimeMs, long uptimeMs) {
        if (mOnBatteryInternal) {
            uid = mapUid(uid);
            getUidStatsLocked(uid, elapsedRealtimeMs, uptimeMs).noteUserActivityLocked(event);
@@ -9956,14 +9957,14 @@ public class BatteryStatsImpl extends BatteryStats {
        }
        @Override
        public void noteUserActivityLocked(int type) {
        public void noteUserActivityLocked(@PowerManager.UserActivityEvent int event) {
            if (mUserActivityCounters == null) {
                initUserActivityLocked();
            }
            if (type >= 0 && type < NUM_USER_ACTIVITY_TYPES) {
                mUserActivityCounters[type].stepAtomic();
            if (event >= 0 && event < NUM_USER_ACTIVITY_TYPES) {
                mUserActivityCounters[event].stepAtomic();
            } else {
                Slog.w(TAG, "Unknown user activity type " + type + " was specified.",
                Slog.w(TAG, "Unknown user activity event " + event + " was specified.",
                        new Throwable());
            }
        }
Loading