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

Commit 4e21e319 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Obfuscate visibility of notification-related events."

parents d2dc4cca 0cbb6b63
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -41,6 +41,43 @@ public final class UsageEvents implements Parcelable {
    /** @hide */
    public static final String INSTANT_APP_CLASS_NAME = "android.instant_class";

    /** @hide */
    public static final String OBFUSCATED_NOTIFICATION_CHANNEL_ID = "unknown_channel_id";

    /**
     * Flag: indicates to not obfuscate or hide any usage event data when being queried.
     * @hide
     */
    public static final int SHOW_ALL_EVENT_DATA = 0x00000000;

    /**
     * Flag: indicates to obfuscate package and class names for instant apps when querying usage
     * events.
     * @hide
     */
    public static final int OBFUSCATE_INSTANT_APPS = 0x00000001;

    /**
     * Flag: indicates to hide all {@link Event#SHORTCUT_INVOCATION} events when querying usage
     * events.
     * @hide
     */
    public static final int HIDE_SHORTCUT_EVENTS = 0x00000002;

    /**
     * Flag: indicates to obfuscate the notification channel id for all notification events,
     * such as {@link Event#NOTIFICATION_SEEN} and {@link Event#NOTIFICATION_INTERRUPTION} events,
     * when querying usage events.
     * @hide
     */
    public static final int OBFUSCATE_NOTIFICATION_EVENTS = 0x00000004;

    /**
     * Flag: indicates to hide all {@link Event#LOCUS_ID_SET} events when querying usage events.
     * @hide
     */
    public static final int HIDE_LOCUS_EVENTS = 0x00000008;

    /**
     * An event representing a state change for a component.
     */
@@ -627,6 +664,13 @@ public final class UsageEvents implements Parcelable {
            return ret;
        }

        /** @hide */
        public Event getObfuscatedNotificationEvent() {
            final Event ret = new Event(this);
            ret.mNotificationChannelId = OBFUSCATED_NOTIFICATION_CHANNEL_ID;
            return ret;
        }

        /**
         * Returns the locusId for this event if the event is of type {@link #LOCUS_ID_SET},
         * otherwise it returns null.
+2 −0
Original line number Diff line number Diff line
@@ -381,6 +381,8 @@ applications that come with the platform
        <permission name="android.permission.REBOOT"/>
        <!-- Permission required for access VIBRATOR_STATE. -->
        <permission name="android.permission.ACCESS_VIBRATOR_STATE"/>
        <!-- Permission required for UsageStatsTest CTS test. -->
        <permission name="android.permission.MANAGE_NOTIFICATIONS"/>
    </privapp-permissions>

    <privapp-permissions package="com.android.statementservice">
+2 −1
Original line number Diff line number Diff line
@@ -253,7 +253,8 @@
    <!-- Permission required for CTS test - ShortcutManagerUsageTest -->
    <uses-permission android:name="android.permission.ACCESS_SHORTCUTS"/>

     <!-- Permission required for CTS test - UsageStatsTest -->
    <!-- Permissions required for CTS test - UsageStatsTest -->
    <uses-permission android:name="android.permission.MANAGE_NOTIFICATIONS"/>
    <uses-permission android:name="android.permission.ACCESS_LOCUS_ID_USAGE_STATS"/>

    <!-- Permissions required to test ambient display. -->
+3 −9
Original line number Diff line number Diff line
@@ -216,17 +216,11 @@ public abstract class UsageStatsManagerInternal {
    /**
     * Returns the events for the user in the given time period.
     *
     * @param obfuscateInstantApps whether instant app package names need to be obfuscated in the
     *     result.
     * @param hideShortcutInvocationEvents whether the {@link UsageEvents.Event#SHORTCUT_INVOCATION}
     *     events need to be excluded from the result.
     * @param hideLocusIdEvents whether the {@link UsageEvents.Event#LOCUS_ID_SET}
     *     events need to be excluded from the result.
     *
     * @param flags defines the visibility of certain usage events - see flags defined in
     * {@link UsageEvents}.
     */
    public abstract UsageEvents queryEventsForUser(@UserIdInt int userId, long beginTime,
            long endTime, boolean obfuscateInstantApps, boolean hideShortcutInvocationEvents,
            boolean hideLocusIdEvents);
            long endTime, int flags);

    /**
     * Used to persist the last time a job was run for this app, in order to make decisions later
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ class UsageStatsQueryHelper {
     */
    boolean querySince(long sinceTime) {
        UsageEvents usageEvents = mUsageStatsManagerInternal.queryEventsForUser(
                mUserId, sinceTime, System.currentTimeMillis(), false, false, false);
                mUserId, sinceTime, System.currentTimeMillis(), UsageEvents.SHOW_ALL_EVENT_DATA);
        if (usageEvents == null) {
            return false;
        }
Loading