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 17 package android.app.usage; 18 19 import android.app.PendingIntent; 20 import android.app.usage.BroadcastResponseStats; 21 import android.app.usage.BroadcastResponseStatsList; 22 import android.app.usage.UsageEvents; 23 import android.content.pm.ParceledListSlice; 24 25 import java.util.Map; 26 27 /** 28 * System private API for talking with the UsageStatsManagerService. 29 * 30 * {@hide} 31 */ 32 interface IUsageStatsManager { 33 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) queryUsageStats(int bucketType, long beginTime, long endTime, String callingPackage, int userId)34 ParceledListSlice queryUsageStats(int bucketType, long beginTime, long endTime, 35 String callingPackage, int userId); 36 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) queryConfigurationStats(int bucketType, long beginTime, long endTime, String callingPackage)37 ParceledListSlice queryConfigurationStats(int bucketType, long beginTime, long endTime, 38 String callingPackage); queryEventStats(int bucketType, long beginTime, long endTime, String callingPackage)39 ParceledListSlice queryEventStats(int bucketType, long beginTime, long endTime, 40 String callingPackage); queryEvents(long beginTime, long endTime, String callingPackage)41 UsageEvents queryEvents(long beginTime, long endTime, String callingPackage); queryEventsForPackage(long beginTime, long endTime, String callingPackage)42 UsageEvents queryEventsForPackage(long beginTime, long endTime, String callingPackage); queryEventsForUser(long beginTime, long endTime, int userId, String callingPackage)43 UsageEvents queryEventsForUser(long beginTime, long endTime, int userId, String callingPackage); queryEventsForPackageForUser(long beginTime, long endTime, int userId, String pkg, String callingPackage)44 UsageEvents queryEventsForPackageForUser(long beginTime, long endTime, int userId, String pkg, String callingPackage); 45 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) setAppInactive(String packageName, boolean inactive, int userId)46 void setAppInactive(String packageName, boolean inactive, int userId); 47 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) isAppInactive(String packageName, int userId, String callingPackage)48 boolean isAppInactive(String packageName, int userId, String callingPackage); onCarrierPrivilegedAppsChanged()49 void onCarrierPrivilegedAppsChanged(); reportChooserSelection(String packageName, int userId, String contentType, in String[] annotations, String action)50 void reportChooserSelection(String packageName, int userId, String contentType, 51 in String[] annotations, String action); getAppStandbyBucket(String packageName, String callingPackage, int userId)52 int getAppStandbyBucket(String packageName, String callingPackage, int userId); setAppStandbyBucket(String packageName, int bucket, int userId)53 void setAppStandbyBucket(String packageName, int bucket, int userId); getAppStandbyBuckets(String callingPackage, int userId)54 ParceledListSlice getAppStandbyBuckets(String callingPackage, int userId); setAppStandbyBuckets(in ParceledListSlice appBuckets, int userId)55 void setAppStandbyBuckets(in ParceledListSlice appBuckets, int userId); getAppMinStandbyBucket(String packageName, String callingPackage, int userId)56 int getAppMinStandbyBucket(String packageName, String callingPackage, int userId); setEstimatedLaunchTime(String packageName, long estimatedLaunchTime, int userId)57 void setEstimatedLaunchTime(String packageName, long estimatedLaunchTime, int userId); setEstimatedLaunchTimes(in ParceledListSlice appLaunchTimes, int userId)58 void setEstimatedLaunchTimes(in ParceledListSlice appLaunchTimes, int userId); registerAppUsageObserver(int observerId, in String[] packages, long timeLimitMs, in PendingIntent callback, String callingPackage)59 void registerAppUsageObserver(int observerId, in String[] packages, long timeLimitMs, 60 in PendingIntent callback, String callingPackage); unregisterAppUsageObserver(int observerId, String callingPackage)61 void unregisterAppUsageObserver(int observerId, String callingPackage); registerUsageSessionObserver(int sessionObserverId, in String[] observed, long timeLimitMs, long sessionThresholdTimeMs, in PendingIntent limitReachedCallbackIntent, in PendingIntent sessionEndCallbackIntent, String callingPackage)62 void registerUsageSessionObserver(int sessionObserverId, in String[] observed, long timeLimitMs, 63 long sessionThresholdTimeMs, in PendingIntent limitReachedCallbackIntent, 64 in PendingIntent sessionEndCallbackIntent, String callingPackage); unregisterUsageSessionObserver(int sessionObserverId, String callingPackage)65 void unregisterUsageSessionObserver(int sessionObserverId, String callingPackage); registerAppUsageLimitObserver(int observerId, in String[] packages, long timeLimitMs, long timeUsedMs, in PendingIntent callback, String callingPackage)66 void registerAppUsageLimitObserver(int observerId, in String[] packages, long timeLimitMs, 67 long timeUsedMs, in PendingIntent callback, String callingPackage); unregisterAppUsageLimitObserver(int observerId, String callingPackage)68 void unregisterAppUsageLimitObserver(int observerId, String callingPackage); reportUsageStart(in IBinder activity, String token, String callingPackage)69 void reportUsageStart(in IBinder activity, String token, String callingPackage); reportPastUsageStart(in IBinder activity, String token, long timeAgoMs, String callingPackage)70 void reportPastUsageStart(in IBinder activity, String token, long timeAgoMs, 71 String callingPackage); reportUsageStop(in IBinder activity, String token, String callingPackage)72 void reportUsageStop(in IBinder activity, String token, String callingPackage); reportUserInteraction(String packageName, int userId)73 void reportUserInteraction(String packageName, int userId); getUsageSource()74 int getUsageSource(); forceUsageSourceSettingRead()75 void forceUsageSourceSettingRead(); getLastTimeAnyComponentUsed(String packageName, String callingPackage)76 long getLastTimeAnyComponentUsed(String packageName, String callingPackage); 77 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS)") queryBroadcastResponseStats( String packageName, long id, String callingPackage, int userId)78 BroadcastResponseStatsList queryBroadcastResponseStats( 79 String packageName, long id, String callingPackage, int userId); 80 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS)") clearBroadcastResponseStats(String packageName, long id, String callingPackage, int userId)81 void clearBroadcastResponseStats(String packageName, long id, String callingPackage, 82 int userId); 83 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS)") clearBroadcastEvents(String callingPackage, int userId)84 void clearBroadcastEvents(String callingPackage, int userId); 85 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG)") getAppStandbyConstant(String key)86 String getAppStandbyConstant(String key); 87 } 88