blob: 62b24e9995e8b43c476d786fb45a4caf0bfd8448 [file] [log] [blame]
Dianne Hackborne22b3b12014-05-07 18:06:44 -07001/**
2 * Copyright (c) 2014, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy 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,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Adam Lesinski0debc9a2014-07-16 19:09:13 -070017package android.app.usage;
Dianne Hackborne22b3b12014-05-07 18:06:44 -070018
Amith Yamasani62ec27e92018-03-11 14:42:06 -070019import android.app.PendingIntent;
Adam Lesinski35168002014-07-21 15:25:30 -070020import android.app.usage.UsageEvents;
21import android.content.pm.ParceledListSlice;
Adam Lesinski0debc9a2014-07-16 19:09:13 -070022
Amith Yamasanie8789312017-12-10 14:34:26 -080023import java.util.Map;
24
Adam Lesinski0debc9a2014-07-16 19:09:13 -070025/**
26 * System private API for talking with the UsageStatsManagerService.
27 *
28 * {@hide}
29 */
30interface IUsageStatsManager {
Andrei Oneaf650e3c2019-02-25 13:15:54 +000031 @UnsupportedAppUsage
Adam Lesinski35168002014-07-21 15:25:30 -070032 ParceledListSlice queryUsageStats(int bucketType, long beginTime, long endTime,
33 String callingPackage);
Andrei Oneaf650e3c2019-02-25 13:15:54 +000034 @UnsupportedAppUsage
Adam Lesinski7f61e962014-09-02 16:43:52 -070035 ParceledListSlice queryConfigurationStats(int bucketType, long beginTime, long endTime,
36 String callingPackage);
Dianne Hackbornced54392018-02-26 13:07:42 -080037 ParceledListSlice queryEventStats(int bucketType, long beginTime, long endTime,
38 String callingPackage);
Adam Lesinski35168002014-07-21 15:25:30 -070039 UsageEvents queryEvents(long beginTime, long endTime, String callingPackage);
Suprabh Shukla217ccda2018-02-23 17:57:12 -080040 UsageEvents queryEventsForPackage(long beginTime, long endTime, String callingPackage);
Julia Reynolds1b61d0182018-05-21 14:11:43 -040041 UsageEvents queryEventsForUser(long beginTime, long endTime, int userId, String callingPackage);
42 UsageEvents queryEventsForPackageForUser(long beginTime, long endTime, int userId, String pkg, String callingPackage);
Andrei Oneaf650e3c2019-02-25 13:15:54 +000043 @UnsupportedAppUsage
Amith Yamasanie5f33042015-05-08 13:20:22 -070044 void setAppInactive(String packageName, boolean inactive, int userId);
Andrei Oneaf650e3c2019-02-25 13:15:54 +000045 @UnsupportedAppUsage
Amith Yamasanie5f33042015-05-08 13:20:22 -070046 boolean isAppInactive(String packageName, int userId);
Amith Yamasaniaf575b92015-05-29 15:35:26 -070047 void whitelistAppTemporarily(String packageName, long duration, int userId);
Amith Yamasani4ec63682016-02-19 12:55:27 -080048 void onCarrierPrivilegedAppsChanged();
Kang Li53b43142016-11-14 14:38:25 -080049 void reportChooserSelection(String packageName, int userId, String contentType,
50 in String[] annotations, String action);
Amith Yamasani17fffee2017-09-29 13:17:43 -070051 int getAppStandbyBucket(String packageName, String callingPackage, int userId);
52 void setAppStandbyBucket(String packageName, int bucket, int userId);
Suprabh Shukla868bde22018-02-20 20:59:52 -080053 ParceledListSlice getAppStandbyBuckets(String callingPackage, int userId);
54 void setAppStandbyBuckets(in ParceledListSlice appBuckets, int userId);
Amith Yamasani62ec27e92018-03-11 14:42:06 -070055 void registerAppUsageObserver(int observerId, in String[] packages, long timeLimitMs,
56 in PendingIntent callback, String callingPackage);
57 void unregisterAppUsageObserver(int observerId, String callingPackage);
Michael Wachenschwanz0f472842018-10-23 23:02:48 -070058 void registerUsageSessionObserver(int sessionObserverId, in String[] observed, long timeLimitMs,
59 long sessionThresholdTimeMs, in PendingIntent limitReachedCallbackIntent,
60 in PendingIntent sessionEndCallbackIntent, String callingPackage);
61 void unregisterUsageSessionObserver(int sessionObserverId, String callingPackage);
Varun Shah2546cef2019-01-11 15:50:54 -080062 void registerAppUsageLimitObserver(int observerId, in String[] packages, long timeLimitMs,
Varun Shah9f58b7c2019-03-01 10:36:21 -080063 long timeRemainingMs, in PendingIntent callback, String callingPackage);
Varun Shah2546cef2019-01-11 15:50:54 -080064 void unregisterAppUsageLimitObserver(int observerId, String callingPackage);
Michael Wachenschwanz36778522018-11-12 11:06:19 -080065 void reportUsageStart(in IBinder activity, String token, String callingPackage);
66 void reportPastUsageStart(in IBinder activity, String token, long timeAgoMs,
67 String callingPackage);
68 void reportUsageStop(in IBinder activity, String token, String callingPackage);
Michael Wachenschwanz0b4ab1f2019-01-07 13:59:10 -080069 int getUsageSource();
70 void forceUsageSourceSettingRead();
Adam Lesinski0debc9a2014-07-16 19:09:13 -070071}