Loading core/java/android/app/usage/UsageEvents.java +44 −0 Original line number Diff line number Diff line Loading @@ -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. */ Loading Loading @@ -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. Loading data/etc/privapp-permissions-platform.xml +2 −0 Original line number Diff line number Diff line Loading @@ -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"> Loading packages/Shell/AndroidManifest.xml +2 −1 Original line number Diff line number Diff line Loading @@ -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. --> Loading services/core/java/android/app/usage/UsageStatsManagerInternal.java +3 −9 Original line number Diff line number Diff line Loading @@ -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 Loading services/people/java/com/android/server/people/data/UsageStatsQueryHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
core/java/android/app/usage/UsageEvents.java +44 −0 Original line number Diff line number Diff line Loading @@ -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. */ Loading Loading @@ -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. Loading
data/etc/privapp-permissions-platform.xml +2 −0 Original line number Diff line number Diff line Loading @@ -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"> Loading
packages/Shell/AndroidManifest.xml +2 −1 Original line number Diff line number Diff line Loading @@ -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. --> Loading
services/core/java/android/app/usage/UsageStatsManagerInternal.java +3 −9 Original line number Diff line number Diff line Loading @@ -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 Loading
services/people/java/com/android/server/people/data/UsageStatsQueryHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -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