blob: b1500c1938208b42ef915944fccc46e4e53a13c8 [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 {
Adam Lesinski35168002014-07-21 15:25:30 -070031 ParceledListSlice queryUsageStats(int bucketType, long beginTime, long endTime,
32 String callingPackage);
Adam Lesinski7f61e962014-09-02 16:43:52 -070033 ParceledListSlice queryConfigurationStats(int bucketType, long beginTime, long endTime,
34 String callingPackage);
Dianne Hackbornced54392018-02-26 13:07:42 -080035 ParceledListSlice queryEventStats(int bucketType, long beginTime, long endTime,
36 String callingPackage);
Adam Lesinski35168002014-07-21 15:25:30 -070037 UsageEvents queryEvents(long beginTime, long endTime, String callingPackage);
Suprabh Shukla217ccda2018-02-23 17:57:12 -080038 UsageEvents queryEventsForPackage(long beginTime, long endTime, String callingPackage);
Julia Reynolds1b61d0182018-05-21 14:11:43 -040039 UsageEvents queryEventsForUser(long beginTime, long endTime, int userId, String callingPackage);
40 UsageEvents queryEventsForPackageForUser(long beginTime, long endTime, int userId, String pkg, String callingPackage);
Amith Yamasanie5f33042015-05-08 13:20:22 -070041 void setAppInactive(String packageName, boolean inactive, int userId);
42 boolean isAppInactive(String packageName, int userId);
Amith Yamasaniaf575b92015-05-29 15:35:26 -070043 void whitelistAppTemporarily(String packageName, long duration, int userId);
Amith Yamasani4ec63682016-02-19 12:55:27 -080044 void onCarrierPrivilegedAppsChanged();
Kang Li53b43142016-11-14 14:38:25 -080045 void reportChooserSelection(String packageName, int userId, String contentType,
46 in String[] annotations, String action);
Amith Yamasani17fffee2017-09-29 13:17:43 -070047 int getAppStandbyBucket(String packageName, String callingPackage, int userId);
48 void setAppStandbyBucket(String packageName, int bucket, int userId);
Suprabh Shukla868bde22018-02-20 20:59:52 -080049 ParceledListSlice getAppStandbyBuckets(String callingPackage, int userId);
50 void setAppStandbyBuckets(in ParceledListSlice appBuckets, int userId);
Amith Yamasani62ec27e92018-03-11 14:42:06 -070051 void registerAppUsageObserver(int observerId, in String[] packages, long timeLimitMs,
52 in PendingIntent callback, String callingPackage);
53 void unregisterAppUsageObserver(int observerId, String callingPackage);
Michael Wachenschwanz0f472842018-10-23 23:02:48 -070054 void registerUsageSessionObserver(int sessionObserverId, in String[] observed, long timeLimitMs,
55 long sessionThresholdTimeMs, in PendingIntent limitReachedCallbackIntent,
56 in PendingIntent sessionEndCallbackIntent, String callingPackage);
57 void unregisterUsageSessionObserver(int sessionObserverId, String callingPackage);
Varun Shah2546cef2019-01-11 15:50:54 -080058 void registerAppUsageLimitObserver(int observerId, in String[] packages, long timeLimitMs,
59 in PendingIntent callback, String callingPackage);
60 void unregisterAppUsageLimitObserver(int observerId, String callingPackage);
Michael Wachenschwanz36778522018-11-12 11:06:19 -080061 void reportUsageStart(in IBinder activity, String token, String callingPackage);
62 void reportPastUsageStart(in IBinder activity, String token, long timeAgoMs,
63 String callingPackage);
64 void reportUsageStop(in IBinder activity, String token, String callingPackage);
Michael Wachenschwanz0b4ab1f2019-01-07 13:59:10 -080065 int getUsageSource();
66 void forceUsageSourceSettingRead();
Adam Lesinski0debc9a2014-07-16 19:09:13 -070067}