Dianne Hackborn | e22b3b1 | 2014-05-07 18:06:44 -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"); |
| 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 Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 17 | package android.app.usage; |
Dianne Hackborn | e22b3b1 | 2014-05-07 18:06:44 -0700 | [diff] [blame] | 18 | |
Amith Yamasani | 62ec27e9 | 2018-03-11 14:42:06 -0700 | [diff] [blame] | 19 | import android.app.PendingIntent; |
Adam Lesinski | 3516800 | 2014-07-21 15:25:30 -0700 | [diff] [blame] | 20 | import android.app.usage.UsageEvents; |
| 21 | import android.content.pm.ParceledListSlice; |
Adam Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 22 | |
Amith Yamasani | e878931 | 2017-12-10 14:34:26 -0800 | [diff] [blame] | 23 | import java.util.Map; |
| 24 | |
Adam Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 25 | /** |
| 26 | * System private API for talking with the UsageStatsManagerService. |
| 27 | * |
| 28 | * {@hide} |
| 29 | */ |
| 30 | interface IUsageStatsManager { |
Adam Lesinski | 3516800 | 2014-07-21 15:25:30 -0700 | [diff] [blame] | 31 | ParceledListSlice queryUsageStats(int bucketType, long beginTime, long endTime, |
| 32 | String callingPackage); |
Adam Lesinski | 7f61e96 | 2014-09-02 16:43:52 -0700 | [diff] [blame] | 33 | ParceledListSlice queryConfigurationStats(int bucketType, long beginTime, long endTime, |
| 34 | String callingPackage); |
Dianne Hackborn | ced5439 | 2018-02-26 13:07:42 -0800 | [diff] [blame] | 35 | ParceledListSlice queryEventStats(int bucketType, long beginTime, long endTime, |
| 36 | String callingPackage); |
Adam Lesinski | 3516800 | 2014-07-21 15:25:30 -0700 | [diff] [blame] | 37 | UsageEvents queryEvents(long beginTime, long endTime, String callingPackage); |
Suprabh Shukla | 217ccda | 2018-02-23 17:57:12 -0800 | [diff] [blame] | 38 | UsageEvents queryEventsForPackage(long beginTime, long endTime, String callingPackage); |
Julia Reynolds | 1b61d018 | 2018-05-21 14:11:43 -0400 | [diff] [blame] | 39 | UsageEvents queryEventsForUser(long beginTime, long endTime, int userId, String callingPackage); |
| 40 | UsageEvents queryEventsForPackageForUser(long beginTime, long endTime, int userId, String pkg, String callingPackage); |
Amith Yamasani | e5f3304 | 2015-05-08 13:20:22 -0700 | [diff] [blame] | 41 | void setAppInactive(String packageName, boolean inactive, int userId); |
| 42 | boolean isAppInactive(String packageName, int userId); |
Amith Yamasani | af575b9 | 2015-05-29 15:35:26 -0700 | [diff] [blame] | 43 | void whitelistAppTemporarily(String packageName, long duration, int userId); |
Amith Yamasani | 4ec6368 | 2016-02-19 12:55:27 -0800 | [diff] [blame] | 44 | void onCarrierPrivilegedAppsChanged(); |
Kang Li | 53b4314 | 2016-11-14 14:38:25 -0800 | [diff] [blame] | 45 | void reportChooserSelection(String packageName, int userId, String contentType, |
| 46 | in String[] annotations, String action); |
Amith Yamasani | 17fffee | 2017-09-29 13:17:43 -0700 | [diff] [blame] | 47 | int getAppStandbyBucket(String packageName, String callingPackage, int userId); |
| 48 | void setAppStandbyBucket(String packageName, int bucket, int userId); |
Suprabh Shukla | 868bde2 | 2018-02-20 20:59:52 -0800 | [diff] [blame] | 49 | ParceledListSlice getAppStandbyBuckets(String callingPackage, int userId); |
| 50 | void setAppStandbyBuckets(in ParceledListSlice appBuckets, int userId); |
Amith Yamasani | 62ec27e9 | 2018-03-11 14:42:06 -0700 | [diff] [blame] | 51 | void registerAppUsageObserver(int observerId, in String[] packages, long timeLimitMs, |
| 52 | in PendingIntent callback, String callingPackage); |
| 53 | void unregisterAppUsageObserver(int observerId, String callingPackage); |
Michael Wachenschwanz | 0f47284 | 2018-10-23 23:02:48 -0700 | [diff] [blame] | 54 | 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 Shah | 2546cef | 2019-01-11 15:50:54 -0800 | [diff] [blame] | 58 | void registerAppUsageLimitObserver(int observerId, in String[] packages, long timeLimitMs, |
| 59 | in PendingIntent callback, String callingPackage); |
| 60 | void unregisterAppUsageLimitObserver(int observerId, String callingPackage); |
Michael Wachenschwanz | 3677852 | 2018-11-12 11:06:19 -0800 | [diff] [blame] | 61 | 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 Wachenschwanz | 0b4ab1f | 2019-01-07 13:59:10 -0800 | [diff] [blame] | 65 | int getUsageSource(); |
| 66 | void forceUsageSourceSettingRead(); |
Adam Lesinski | 0debc9a | 2014-07-16 19:09:13 -0700 | [diff] [blame] | 67 | } |