Adam Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 5 | * use this file except in compliance with the License. You may obtain a copy |
| 6 | * of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | * License for the specific language governing permissions and limitations |
| 14 | * under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.app.usage; |
| 18 | |
Yuliya Kamatkova | 48c3807 | 2020-01-09 15:43:25 -0800 | [diff] [blame] | 19 | import android.annotation.NonNull; |
| 20 | import android.annotation.Nullable; |
Amith Yamasani | 53f06ea | 2018-01-05 17:53:46 -0800 | [diff] [blame] | 21 | import android.annotation.UserIdInt; |
Amith Yamasani | afbccb7 | 2017-11-27 10:44:24 -0800 | [diff] [blame] | 22 | import android.app.usage.UsageStatsManager.StandbyBuckets; |
Adam Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 23 | import android.content.ComponentName; |
Yuliya Kamatkova | 48c3807 | 2020-01-09 15:43:25 -0800 | [diff] [blame] | 24 | import android.content.LocusId; |
Adam Lesinski | 7f61e96 | 2014-09-02 16:43:52 -0700 | [diff] [blame] | 25 | import android.content.res.Configuration; |
Yuliya Kamatkova | 48c3807 | 2020-01-09 15:43:25 -0800 | [diff] [blame] | 26 | import android.os.IBinder; |
Varun Shah | 2546cef | 2019-01-11 15:50:54 -0800 | [diff] [blame] | 27 | import android.os.UserHandle; |
Varun Shah | 3a31520 | 2019-07-24 16:33:42 -0700 | [diff] [blame] | 28 | import android.os.UserManager; |
Adam Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 29 | |
Daniel Nishi | cf9d19e | 2017-01-23 14:33:42 -0800 | [diff] [blame] | 30 | import java.util.List; |
Sudheer Shanka | 101c353 | 2018-01-08 16:28:42 -0800 | [diff] [blame] | 31 | import java.util.Set; |
Ritesh Reddy | 8a6ce2c | 2015-12-17 17:03:54 +0000 | [diff] [blame] | 32 | |
Adam Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 33 | /** |
| 34 | * UsageStatsManager local system service interface. |
| 35 | * |
| 36 | * {@hide} Only for use within the system server. |
| 37 | */ |
| 38 | public abstract class UsageStatsManagerInternal { |
| 39 | |
| 40 | /** |
Varun Shah | 3a31520 | 2019-07-24 16:33:42 -0700 | [diff] [blame] | 41 | * Reports an event to the UsageStatsManager. <br/> |
| 42 | * <em>Note: Starting from {@link android.os.Build.VERSION_CODES#R Android R}, if the user's |
| 43 | * device is not in an unlocked state (as defined by {@link UserManager#isUserUnlocked()}), |
| 44 | * then this event will be added to a queue and processed once the device is unlocked.</em> |
Adam Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 45 | * |
Adam Lesinski | 7f61e96 | 2014-09-02 16:43:52 -0700 | [diff] [blame] | 46 | * @param component The component for which this event occurred. |
Adam Lesinski | 3c15351 | 2014-07-23 17:34:34 -0700 | [diff] [blame] | 47 | * @param userId The user id to which the component belongs to. |
Adam Lesinski | 7f61e96 | 2014-09-02 16:43:52 -0700 | [diff] [blame] | 48 | * @param eventType The event that occurred. Valid values can be found at |
Hui Yu | 03d1240 | 2018-12-06 18:00:37 -0800 | [diff] [blame] | 49 | * {@link UsageEvents} |
| 50 | * @param instanceId For activity, hashCode of ActivityRecord's appToken. |
| 51 | * For non-activity, it is not used. |
Michael Wachenschwanz | 0b4ab1f | 2019-01-07 13:59:10 -0800 | [diff] [blame] | 52 | * @param taskRoot For activity, the name of the package at the root of the task |
| 53 | * For non-activity, it is not used. |
Adam Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 54 | */ |
Hui Yu | 03d1240 | 2018-12-06 18:00:37 -0800 | [diff] [blame] | 55 | public abstract void reportEvent(ComponentName component, @UserIdInt int userId, int eventType, |
Michael Wachenschwanz | 0b4ab1f | 2019-01-07 13:59:10 -0800 | [diff] [blame] | 56 | int instanceId, ComponentName taskRoot); |
Adam Lesinski | 7f61e96 | 2014-09-02 16:43:52 -0700 | [diff] [blame] | 57 | |
| 58 | /** |
Varun Shah | 3a31520 | 2019-07-24 16:33:42 -0700 | [diff] [blame] | 59 | * Reports an event to the UsageStatsManager. <br/> |
| 60 | * <em>Note: Starting from {@link android.os.Build.VERSION_CODES#R Android R}, if the user's |
| 61 | * device is not in an unlocked state (as defined by {@link UserManager#isUserUnlocked()}), |
| 62 | * then this event will be added to a queue and processed once the device is unlocked.</em> |
Adam Lesinski | 978a1ed | 2015-03-02 11:37:24 -0800 | [diff] [blame] | 63 | * |
| 64 | * @param packageName The package for which this event occurred. |
| 65 | * @param userId The user id to which the component belongs to. |
| 66 | * @param eventType The event that occurred. Valid values can be found at |
| 67 | * {@link UsageEvents} |
| 68 | */ |
Amith Yamasani | 53f06ea | 2018-01-05 17:53:46 -0800 | [diff] [blame] | 69 | public abstract void reportEvent(String packageName, @UserIdInt int userId, int eventType); |
Adam Lesinski | 978a1ed | 2015-03-02 11:37:24 -0800 | [diff] [blame] | 70 | |
| 71 | /** |
Varun Shah | 3a31520 | 2019-07-24 16:33:42 -0700 | [diff] [blame] | 72 | * Reports a configuration change to the UsageStatsManager. <br/> |
| 73 | * <em>Note: Starting from {@link android.os.Build.VERSION_CODES#R Android R}, if the user's |
| 74 | * device is not in an unlocked state (as defined by {@link UserManager#isUserUnlocked()}), |
| 75 | * then this event will be added to a queue and processed once the device is unlocked.</em> |
Adam Lesinski | 7f61e96 | 2014-09-02 16:43:52 -0700 | [diff] [blame] | 76 | * |
| 77 | * @param config The new device configuration. |
| 78 | */ |
Amith Yamasani | 53f06ea | 2018-01-05 17:53:46 -0800 | [diff] [blame] | 79 | public abstract void reportConfigurationChange(Configuration config, @UserIdInt int userId); |
Adam Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 80 | |
| 81 | /** |
Varun Shah | 3a31520 | 2019-07-24 16:33:42 -0700 | [diff] [blame] | 82 | * Reports that an application has posted an interruptive notification. <br/> |
| 83 | * <em>Note: Starting from {@link android.os.Build.VERSION_CODES#R Android R}, if the user's |
| 84 | * device is not in an unlocked state (as defined by {@link UserManager#isUserUnlocked()}), |
| 85 | * then this event will be added to a queue and processed once the device is unlocked.</em> |
Julia Reynolds | 1fac86e | 2018-03-07 08:30:37 -0500 | [diff] [blame] | 86 | * |
| 87 | * @param packageName The package name of the app that posted the notification |
| 88 | * @param channelId The ID of the NotificationChannel to which the notification was posted |
| 89 | * @param userId The user in which the notification was posted |
| 90 | */ |
| 91 | public abstract void reportInterruptiveNotification(String packageName, String channelId, |
| 92 | @UserIdInt int userId); |
| 93 | |
| 94 | /** |
Varun Shah | 3a31520 | 2019-07-24 16:33:42 -0700 | [diff] [blame] | 95 | * Reports that an action equivalent to a ShortcutInfo is taken by the user. <br/> |
| 96 | * <em>Note: Starting from {@link android.os.Build.VERSION_CODES#R Android R}, if the user's |
| 97 | * device is not in an unlocked state (as defined by {@link UserManager#isUserUnlocked()}), |
| 98 | * then this event will be added to a queue and processed once the device is unlocked.</em> |
Makoto Onuki | ac04250 | 2016-05-20 16:39:42 -0700 | [diff] [blame] | 99 | * |
| 100 | * @param packageName The package name of the shortcut publisher |
| 101 | * @param shortcutId The ID of the shortcut in question |
| 102 | * @param userId The user in which the content provider was accessed. |
| 103 | * |
| 104 | * @see android.content.pm.ShortcutManager#reportShortcutUsed(String) |
| 105 | */ |
Amith Yamasani | 53f06ea | 2018-01-05 17:53:46 -0800 | [diff] [blame] | 106 | public abstract void reportShortcutUsage(String packageName, String shortcutId, |
| 107 | @UserIdInt int userId); |
Makoto Onuki | ac04250 | 2016-05-20 16:39:42 -0700 | [diff] [blame] | 108 | |
| 109 | /** |
Amith Yamasani | 37a40c2 | 2015-06-17 13:25:42 -0700 | [diff] [blame] | 110 | * Reports that a content provider has been accessed by a foreground app. |
| 111 | * @param name The authority of the content provider |
| 112 | * @param pkgName The package name of the content provider |
| 113 | * @param userId The user in which the content provider was accessed. |
| 114 | */ |
Amith Yamasani | 53f06ea | 2018-01-05 17:53:46 -0800 | [diff] [blame] | 115 | public abstract void reportContentProviderUsage(String name, String pkgName, |
| 116 | @UserIdInt int userId); |
Amith Yamasani | 37a40c2 | 2015-06-17 13:25:42 -0700 | [diff] [blame] | 117 | |
Yuliya Kamatkova | 48c3807 | 2020-01-09 15:43:25 -0800 | [diff] [blame] | 118 | |
| 119 | /** |
| 120 | * Reports locusId update for a given activity. |
| 121 | * |
| 122 | * @param activity The component name of the app. |
| 123 | * @param userId The user id of who uses the app. |
| 124 | * @param locusId The locusId a unique, stable id that identifies this activity. |
| 125 | * @param appToken ActivityRecord's appToken. |
| 126 | * {@link UsageEvents} |
| 127 | * @hide |
| 128 | */ |
| 129 | public abstract void reportLocusUpdate(@NonNull ComponentName activity, @UserIdInt int userId, |
| 130 | @Nullable LocusId locusId, @NonNull IBinder appToken); |
| 131 | |
Amith Yamasani | 37a40c2 | 2015-06-17 13:25:42 -0700 | [diff] [blame] | 132 | /** |
Adam Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 133 | * Prepares the UsageStatsService for shutdown. |
| 134 | */ |
| 135 | public abstract void prepareShutdown(); |
Amith Yamasani | b0ff322 | 2015-03-04 09:56:14 -0800 | [diff] [blame] | 136 | |
| 137 | /** |
Hui Yu | b1d243a | 2018-12-13 12:02:00 -0800 | [diff] [blame] | 138 | * When the device power button is long pressed for 3.5 seconds, prepareForPossibleShutdown() |
| 139 | * is called. |
| 140 | */ |
| 141 | public abstract void prepareForPossibleShutdown(); |
| 142 | |
| 143 | /** |
Amith Yamasani | b0ff322 | 2015-03-04 09:56:14 -0800 | [diff] [blame] | 144 | * Returns true if the app has not been used for a certain amount of time. How much time? |
| 145 | * Could be hours, could be days, who knows? |
| 146 | * |
| 147 | * @param packageName |
Dianne Hackborn | fcc95a6 | 2015-11-02 13:43:29 -0800 | [diff] [blame] | 148 | * @param uidForAppId The uid of the app, which will be used for its app id |
Amith Yamasani | b0ff322 | 2015-03-04 09:56:14 -0800 | [diff] [blame] | 149 | * @param userId |
| 150 | * @return |
| 151 | */ |
Amith Yamasani | 53f06ea | 2018-01-05 17:53:46 -0800 | [diff] [blame] | 152 | public abstract boolean isAppIdle(String packageName, int uidForAppId, @UserIdInt int userId); |
Amith Yamasani | b0ff322 | 2015-03-04 09:56:14 -0800 | [diff] [blame] | 153 | |
| 154 | /** |
Christopher Tate | a732f01 | 2017-10-26 17:26:53 -0700 | [diff] [blame] | 155 | * Returns the app standby bucket that the app is currently in. This accessor does |
| 156 | * <em>not</em> obfuscate instant apps. |
| 157 | * |
| 158 | * @param packageName |
| 159 | * @param userId |
| 160 | * @param nowElapsed The current time, in the elapsedRealtime time base |
| 161 | * @return the AppStandby bucket code the app currently resides in. If the app is |
| 162 | * unknown in the given user, STANDBY_BUCKET_NEVER is returned. |
| 163 | */ |
Amith Yamasani | 53f06ea | 2018-01-05 17:53:46 -0800 | [diff] [blame] | 164 | @StandbyBuckets public abstract int getAppStandbyBucket(String packageName, |
| 165 | @UserIdInt int userId, long nowElapsed); |
Christopher Tate | a732f01 | 2017-10-26 17:26:53 -0700 | [diff] [blame] | 166 | |
| 167 | /** |
Dianne Hackborn | 4a503b1 | 2015-08-06 22:19:06 -0700 | [diff] [blame] | 168 | * Returns all of the uids for a given user where all packages associating with that uid |
| 169 | * are in the app idle state -- there are no associated apps that are not idle. This means |
| 170 | * all of the returned uids can be safely considered app idle. |
| 171 | */ |
Amith Yamasani | 53f06ea | 2018-01-05 17:53:46 -0800 | [diff] [blame] | 172 | public abstract int[] getIdleUidsForUser(@UserIdInt int userId); |
Dianne Hackborn | 4a503b1 | 2015-08-06 22:19:06 -0700 | [diff] [blame] | 173 | |
Amith Yamasani | 53f06ea | 2018-01-05 17:53:46 -0800 | [diff] [blame] | 174 | /** Backup/Restore API */ |
| 175 | public abstract byte[] getBackupPayload(@UserIdInt int userId, String key); |
Ritesh Reddy | 8a6ce2c | 2015-12-17 17:03:54 +0000 | [diff] [blame] | 176 | |
Amith Yamasani | 53f06ea | 2018-01-05 17:53:46 -0800 | [diff] [blame] | 177 | /** |
| 178 | * ? |
| 179 | * @param userId |
| 180 | * @param key |
| 181 | * @param payload |
| 182 | */ |
| 183 | public abstract void applyRestoredPayload(@UserIdInt int userId, String key, byte[] payload); |
Ritesh Reddy | 8a6ce2c | 2015-12-17 17:03:54 +0000 | [diff] [blame] | 184 | |
Makoto Onuki | ad62301 | 2017-05-15 09:29:34 -0700 | [diff] [blame] | 185 | /** |
Sudheer Shanka | 101c353 | 2018-01-08 16:28:42 -0800 | [diff] [blame] | 186 | * Called by DevicePolicyManagerService to inform that a new admin has been added. |
| 187 | * |
| 188 | * @param packageName the package in which the admin component is part of. |
| 189 | * @param userId the userId in which the admin has been added. |
| 190 | */ |
| 191 | public abstract void onActiveAdminAdded(String packageName, int userId); |
| 192 | |
| 193 | /** |
| 194 | * Called by DevicePolicyManagerService to inform about the active admins in an user. |
| 195 | * |
| 196 | * @param adminApps the set of active admins in {@param userId} or null if there are none. |
| 197 | * @param userId the userId to which the admin apps belong. |
| 198 | */ |
| 199 | public abstract void setActiveAdminApps(Set<String> adminApps, int userId); |
| 200 | |
| 201 | /** |
Sudheer Shanka | c53c47f | 2018-01-16 12:01:00 -0800 | [diff] [blame] | 202 | * Called by DevicePolicyManagerService during boot to inform that admin data is loaded and |
| 203 | * pushed to UsageStatsService. |
| 204 | */ |
| 205 | public abstract void onAdminDataAvailable(); |
| 206 | |
| 207 | /** |
Makoto Onuki | ad62301 | 2017-05-15 09:29:34 -0700 | [diff] [blame] | 208 | * Return usage stats. |
| 209 | * |
| 210 | * @param obfuscateInstantApps whether instant app package names need to be obfuscated in the |
| 211 | * result. |
| 212 | */ |
Amith Yamasani | 53f06ea | 2018-01-05 17:53:46 -0800 | [diff] [blame] | 213 | public abstract List<UsageStats> queryUsageStatsForUser(@UserIdInt int userId, int interval, |
| 214 | long beginTime, long endTime, boolean obfuscateInstantApps); |
| 215 | |
| 216 | /** |
Danning Chen | 6a5982f | 2020-01-14 16:03:49 -0800 | [diff] [blame] | 217 | * Returns the events for the user in the given time period. |
Danning Chen | 001eb8f | 2020-01-30 17:30:28 -0800 | [diff] [blame] | 218 | * |
Varun Shah | 0cbb6b6 | 2020-02-04 14:01:12 -0800 | [diff] [blame] | 219 | * @param flags defines the visibility of certain usage events - see flags defined in |
| 220 | * {@link UsageEvents}. |
Danning Chen | 6a5982f | 2020-01-14 16:03:49 -0800 | [diff] [blame] | 221 | */ |
| 222 | public abstract UsageEvents queryEventsForUser(@UserIdInt int userId, long beginTime, |
Varun Shah | 0cbb6b6 | 2020-02-04 14:01:12 -0800 | [diff] [blame] | 223 | long endTime, int flags); |
Danning Chen | 6a5982f | 2020-01-14 16:03:49 -0800 | [diff] [blame] | 224 | |
| 225 | /** |
Amith Yamasani | 53f06ea | 2018-01-05 17:53:46 -0800 | [diff] [blame] | 226 | * Used to persist the last time a job was run for this app, in order to make decisions later |
| 227 | * whether a job should be deferred until later. The time passed in should be in elapsed |
| 228 | * realtime since boot. |
| 229 | * @param packageName the app that executed a job. |
| 230 | * @param userId the user associated with the job. |
| 231 | * @param elapsedRealtime the time when the job was executed, in elapsed realtime millis since |
| 232 | * boot. |
| 233 | */ |
| 234 | public abstract void setLastJobRunTime(String packageName, @UserIdInt int userId, |
| 235 | long elapsedRealtime); |
| 236 | |
| 237 | /** |
| 238 | * Returns the time in millis since a job was executed for this app, in elapsed realtime |
| 239 | * timebase. This value can be larger than the current elapsed realtime if the job was executed |
| 240 | * before the device was rebooted. The default value is {@link Long#MAX_VALUE}. |
| 241 | * @param packageName the app you're asking about. |
| 242 | * @param userId the user associated with the job. |
| 243 | * @return the time in millis since a job was last executed for the app, provided it was |
| 244 | * indicated here before by a call to {@link #setLastJobRunTime(String, int, long)}. |
| 245 | */ |
| 246 | public abstract long getTimeSinceLastJobRun(String packageName, @UserIdInt int userId); |
Christopher Tate | d117b29 | 2018-01-05 17:32:36 -0800 | [diff] [blame] | 247 | |
| 248 | /** |
| 249 | * Report a few data points about an app's job state at the current time. |
| 250 | * |
| 251 | * @param packageName the app whose job state is being described |
| 252 | * @param userId which user the app is associated with |
| 253 | * @param numDeferredJobs the number of pending jobs that were deferred |
| 254 | * due to bucketing policy |
| 255 | * @param timeSinceLastJobRun number of milliseconds since the last time one of |
| 256 | * this app's jobs was executed |
| 257 | */ |
| 258 | public abstract void reportAppJobState(String packageName, @UserIdInt int userId, |
| 259 | int numDeferredJobs, long timeSinceLastJobRun); |
Makoto Onuki | 75ad249 | 2018-03-28 14:42:42 -0700 | [diff] [blame] | 260 | |
| 261 | /** |
Michael Wachenschwanz | c329520 | 2019-02-20 17:19:52 -0800 | [diff] [blame] | 262 | * Report a sync that was scheduled. |
Makoto Onuki | d5f25d2 | 2018-05-22 16:02:17 -0700 | [diff] [blame] | 263 | * |
| 264 | * @param packageName name of the package that owns the sync adapter. |
| 265 | * @param userId which user the app is associated with |
Michael Wachenschwanz | c329520 | 2019-02-20 17:19:52 -0800 | [diff] [blame] | 266 | * @param exempted is sync app standby exempted |
Makoto Onuki | d5f25d2 | 2018-05-22 16:02:17 -0700 | [diff] [blame] | 267 | */ |
Michael Wachenschwanz | c329520 | 2019-02-20 17:19:52 -0800 | [diff] [blame] | 268 | public abstract void reportSyncScheduled(String packageName, @UserIdInt int userId, |
| 269 | boolean exempted); |
Makoto Onuki | d5f25d2 | 2018-05-22 16:02:17 -0700 | [diff] [blame] | 270 | |
| 271 | /** |
| 272 | * Report a sync that was scheduled by a foreground app is about to be executed. |
Makoto Onuki | 75ad249 | 2018-03-28 14:42:42 -0700 | [diff] [blame] | 273 | * |
| 274 | * @param packageName name of the package that owns the sync adapter. |
| 275 | * @param userId which user the app is associated with |
| 276 | */ |
| 277 | public abstract void reportExemptedSyncStart(String packageName, @UserIdInt int userId); |
Varun Shah | 2546cef | 2019-01-11 15:50:54 -0800 | [diff] [blame] | 278 | |
| 279 | /** |
| 280 | * Returns an object describing the app usage limit for the given package which was set via |
| 281 | * {@link UsageStatsManager#registerAppUsageLimitObserver}. |
| 282 | * If there are multiple limits that apply to the package, the one with the smallest |
| 283 | * time remaining will be returned. |
| 284 | * |
| 285 | * @param packageName name of the package whose app usage limit will be returned |
| 286 | * @param user the user associated with the limit |
| 287 | * @return an {@link AppUsageLimitData} object describing the app time limit containing |
| 288 | * the given package, with the smallest time remaining. |
| 289 | */ |
| 290 | public abstract AppUsageLimitData getAppUsageLimit(String packageName, UserHandle user); |
| 291 | |
| 292 | /** A class which is used to share the usage limit data for an app or a group of apps. */ |
| 293 | public static class AppUsageLimitData { |
Varun Shah | 2546cef | 2019-01-11 15:50:54 -0800 | [diff] [blame] | 294 | private final long mTotalUsageLimit; |
| 295 | private final long mUsageRemaining; |
| 296 | |
Varun Shah | 9c6f72b | 2019-01-25 21:13:56 -0800 | [diff] [blame] | 297 | public AppUsageLimitData(long totalUsageLimit, long usageRemaining) { |
Varun Shah | 2546cef | 2019-01-11 15:50:54 -0800 | [diff] [blame] | 298 | this.mTotalUsageLimit = totalUsageLimit; |
| 299 | this.mUsageRemaining = usageRemaining; |
| 300 | } |
| 301 | |
Varun Shah | 2546cef | 2019-01-11 15:50:54 -0800 | [diff] [blame] | 302 | public long getTotalUsageLimit() { |
| 303 | return mTotalUsageLimit; |
| 304 | } |
| 305 | public long getUsageRemaining() { |
| 306 | return mUsageRemaining; |
| 307 | } |
| 308 | } |
Varun Shah | 2c0b9f5 | 2019-11-26 16:41:13 -0800 | [diff] [blame] | 309 | |
| 310 | /** |
| 311 | * Called by {@link com.android.server.usage.UsageStatsIdleService} when the device is idle to |
| 312 | * prune usage stats data for uninstalled packages. |
| 313 | * |
| 314 | * @param userId the user associated with the job |
| 315 | * @return {@code true} if the pruning was successful, {@code false} otherwise |
| 316 | */ |
| 317 | public abstract boolean pruneUninstalledPackagesData(@UserIdInt int userId); |
Varun Shah | a7f9c76 | 2020-05-04 19:36:54 -0700 | [diff] [blame] | 318 | |
| 319 | /** |
| 320 | * Called by {@link com.android.server.usage.UsageStatsIdleService} between 24 to 48 hours of |
| 321 | * when the user is first unlocked to update the usage stats package mappings data that might |
| 322 | * be stale or have existed from a restore and belongs to packages that are not installed for |
| 323 | * this user anymore. |
| 324 | * Note: this is only executed for the system user. |
| 325 | * |
| 326 | * @return {@code true} if the updating was successful, {@code false} otherwise |
| 327 | */ |
| 328 | public abstract boolean updatePackageMappingsData(); |
Adam Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 329 | } |