2022-03-02 06:21:10 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2022-06-08 07:40:16 +00:00
|
|
|
import { AsyncCallback , Callback} from './basic';
|
2022-03-02 06:21:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides methods for managing bundle usage statistics,
|
|
|
|
* including the methods for querying bundle usage information and state data.
|
|
|
|
*
|
|
|
|
* <p>You can use the methods defined in this class to query
|
|
|
|
* the usage history and states of bundles in a specified period.
|
|
|
|
* The system stores the query result in a {@link BundleStateInfo} or {@link BundleActiveState} instance and
|
|
|
|
* then returns it to you.
|
2022-04-19 07:15:43 +00:00
|
|
|
*
|
2022-03-02 06:21:10 +00:00
|
|
|
* @since 7
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics
|
2022-03-02 06:21:10 +00:00
|
|
|
*/
|
|
|
|
declare namespace bundleState {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 7
|
2022-03-09 09:03:20 +00:00
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.BundleStatsInfo
|
2022-03-02 06:21:10 +00:00
|
|
|
*/
|
|
|
|
interface BundleStateInfo {
|
|
|
|
/**
|
|
|
|
* the identifier of BundleStateInfo.
|
|
|
|
*/
|
|
|
|
id: number;
|
|
|
|
/**
|
|
|
|
* the total duration, in milliseconds.
|
|
|
|
*/
|
|
|
|
abilityInFgTotalTime?: number;
|
|
|
|
/**
|
|
|
|
* the last time when the application was accessed, in milliseconds.
|
|
|
|
*/
|
|
|
|
abilityPrevAccessTime?: number;
|
|
|
|
/**
|
|
|
|
* the last time when the application was visible in the foreground, in milliseconds.
|
|
|
|
*/
|
|
|
|
abilityPrevSeenTime?: number;
|
|
|
|
/**
|
|
|
|
* the total duration, in milliseconds.
|
|
|
|
*/
|
|
|
|
abilitySeenTotalTime?: number;
|
|
|
|
/**
|
|
|
|
* the bundle name of the application.
|
|
|
|
*/
|
|
|
|
bundleName?: string;
|
|
|
|
/**
|
|
|
|
* the total duration, in milliseconds.
|
|
|
|
*/
|
|
|
|
fgAbilityAccessTotalTime?: number;
|
|
|
|
/**
|
|
|
|
* the last time when the foreground application was accessed, in milliseconds.
|
|
|
|
*/
|
|
|
|
fgAbilityPrevAccessTime?: number;
|
|
|
|
/**
|
|
|
|
* the time of the first bundle usage record in this {@code BundleActiveInfo} object,
|
|
|
|
* in milliseconds.
|
|
|
|
*/
|
|
|
|
infosBeginTime?: number;
|
|
|
|
/**
|
|
|
|
* the time of the last bundle usage record in this {@code BundleActiveInfo} object,
|
|
|
|
* in milliseconds.
|
|
|
|
*/
|
|
|
|
infosEndTime?: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Merges a specified {@link BundleActiveInfo} object with this {@link BundleActiveInfo} object.
|
|
|
|
* The bundle name of both objects must be the same.
|
2022-04-19 07:15:43 +00:00
|
|
|
*
|
2022-03-02 06:21:10 +00:00
|
|
|
* @since 7
|
2022-03-09 09:03:20 +00:00
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
2022-03-02 06:21:10 +00:00
|
|
|
* @param toMerge Indicates the {@link BundleActiveInfo} object to merge.
|
|
|
|
* if the bundle names of the two {@link BundleActiveInfo} objects are different.
|
|
|
|
*/
|
|
|
|
merge(toMerge: BundleStateInfo): void;
|
|
|
|
}
|
|
|
|
|
2022-04-19 07:15:43 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
2022-08-19 02:27:27 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.HapFormInfo
|
2022-04-19 07:15:43 +00:00
|
|
|
*/
|
|
|
|
interface BundleActiveFormInfo {
|
|
|
|
/**
|
|
|
|
* the form name.
|
|
|
|
*/
|
|
|
|
formName: string;
|
|
|
|
/**
|
|
|
|
* the form dimension.
|
|
|
|
*/
|
|
|
|
formDimension: number;
|
|
|
|
/**
|
|
|
|
* the form id.
|
|
|
|
*/
|
|
|
|
formId: number;
|
|
|
|
/**
|
|
|
|
* the last time when the form was accessed, in milliseconds..
|
|
|
|
*/
|
|
|
|
formLastUsedTime: number;
|
|
|
|
/**
|
|
|
|
* the click count of module.
|
|
|
|
*/
|
|
|
|
count: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
2022-08-19 02:27:27 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.HapModuleInfo
|
2022-04-19 07:15:43 +00:00
|
|
|
*/
|
|
|
|
interface BundleActiveModuleInfo {
|
|
|
|
/**
|
|
|
|
* the device id of module.
|
|
|
|
*/
|
|
|
|
deviceId?: string;
|
|
|
|
/**
|
|
|
|
* the bundle name.
|
|
|
|
*/
|
|
|
|
bundleName: string;
|
|
|
|
/**
|
|
|
|
* the module name.
|
|
|
|
*/
|
|
|
|
moduleName: string;
|
|
|
|
/**
|
|
|
|
* the main ability name of module.
|
|
|
|
*/
|
|
|
|
abilityName?: string;
|
|
|
|
/**
|
|
|
|
* the label id of application.
|
|
|
|
*/
|
|
|
|
appLabelId?: number;
|
|
|
|
/**
|
|
|
|
* the label id of module.
|
|
|
|
*/
|
|
|
|
labelId?: number;
|
|
|
|
/**
|
|
|
|
* the description id of application.
|
|
|
|
*/
|
|
|
|
descriptionId?: number;
|
|
|
|
/**
|
|
|
|
* the ability id of main ability.
|
|
|
|
*/
|
|
|
|
abilityLableId?: number;
|
|
|
|
/**
|
|
|
|
* the description id of main ability.
|
|
|
|
*/
|
|
|
|
abilityDescriptionId?: number;
|
|
|
|
/**
|
|
|
|
* the icon id of main ability.
|
|
|
|
*/
|
|
|
|
abilityIconId?: number;
|
|
|
|
/**
|
|
|
|
* the launch count of module.
|
|
|
|
*/
|
|
|
|
launchedCount: number;
|
|
|
|
/**
|
|
|
|
* the last time when the module was accessed, in milliseconds.
|
|
|
|
*/
|
|
|
|
lastModuleUsedTime: number;
|
|
|
|
/**
|
|
|
|
* the form usage record list of current module.
|
|
|
|
*/
|
|
|
|
formRecords: Array<BundleActiveFormInfo>;
|
|
|
|
}
|
|
|
|
|
2022-06-08 07:40:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
2022-06-09 08:27:55 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.DeviceEventStats
|
2022-06-08 07:40:16 +00:00
|
|
|
*/
|
|
|
|
interface BundleActiveEventState {
|
|
|
|
/**
|
|
|
|
* the bundle name or system event name.
|
|
|
|
*/
|
2022-06-08 07:52:24 +00:00
|
|
|
name: string;
|
2022-06-08 07:40:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* the event id.
|
|
|
|
*/
|
|
|
|
eventId: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* the the event occurrence number.
|
|
|
|
*/
|
|
|
|
count: number;
|
|
|
|
}
|
|
|
|
|
2022-03-02 06:21:10 +00:00
|
|
|
/**
|
|
|
|
* @since 7
|
2022-03-09 09:03:20 +00:00
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.BundleEvents
|
2022-03-02 06:21:10 +00:00
|
|
|
*/
|
|
|
|
interface BundleActiveState {
|
|
|
|
/**
|
|
|
|
* the usage priority group of the application.
|
|
|
|
*/
|
|
|
|
appUsagePriorityGroup?: number;
|
|
|
|
/**
|
|
|
|
* the bundle name.
|
|
|
|
*/
|
|
|
|
bundleName?: string;
|
|
|
|
/**
|
|
|
|
* the shortcut ID.
|
|
|
|
*/
|
|
|
|
indexOfLink?: string;
|
|
|
|
/**
|
|
|
|
* the class name.
|
|
|
|
*/
|
|
|
|
nameOfClass?: string;
|
|
|
|
/**
|
|
|
|
* the time when this state occurred, in milliseconds.
|
|
|
|
*/
|
|
|
|
stateOccurredTime?: number;
|
|
|
|
/**
|
|
|
|
* the state type.
|
|
|
|
*/
|
|
|
|
stateType?: number;
|
|
|
|
}
|
2022-06-08 07:40:16 +00:00
|
|
|
/**
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
|
2022-08-19 02:27:27 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.AppGroupCallbackInfo
|
2022-06-08 07:40:16 +00:00
|
|
|
*/
|
|
|
|
interface BundleActiveGroupCallbackInfo {
|
|
|
|
/*
|
2022-06-08 08:17:18 +00:00
|
|
|
* the usage old group of the application
|
|
|
|
*/
|
|
|
|
appUsageOldGroup: number;
|
|
|
|
/*
|
|
|
|
* the usage new group of the application
|
|
|
|
*/
|
|
|
|
appUsageNewGroup: number;
|
|
|
|
/*
|
|
|
|
* the use id
|
|
|
|
*/
|
|
|
|
userId: number;
|
2022-06-08 07:40:16 +00:00
|
|
|
/*
|
2022-06-08 08:17:18 +00:00
|
|
|
* the change reason
|
|
|
|
*/
|
|
|
|
changeReason: number;
|
|
|
|
/*
|
|
|
|
* the bundle name
|
|
|
|
*/
|
|
|
|
bundleName: string;
|
2022-06-08 07:40:16 +00:00
|
|
|
}
|
2022-03-02 06:21:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether the application with a specified bundle name is in the idle state.
|
|
|
|
*
|
|
|
|
* @since 7
|
2022-03-09 09:03:20 +00:00
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
|
2022-03-02 06:21:10 +00:00
|
|
|
* @param bundleName Indicates the bundle name of the application to query.
|
|
|
|
* @return Returns {@code true} if the application is idle in a particular period;
|
|
|
|
* returns {@code false} otherwise. The time range of the particular period is defined by the system,
|
|
|
|
* which may be hours or days.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.isIdleState
|
2022-03-02 06:21:10 +00:00
|
|
|
*/
|
|
|
|
function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void;
|
|
|
|
function isIdleState(bundleName: string): Promise<boolean>;
|
|
|
|
|
2022-06-08 08:37:20 +00:00
|
|
|
/**
|
|
|
|
* Queries the usage priority group of the calling application.
|
|
|
|
*
|
|
|
|
* <p>The priority defined in a priority group restricts the resource usage of an application,
|
|
|
|
* for example, restricting the running of background tasks. </p>
|
|
|
|
*
|
|
|
|
* @since 7
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
|
|
|
|
* @return Returns the usage priority group of the calling application.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.queryAppGroup
|
2022-06-08 08:37:20 +00:00
|
|
|
*/
|
|
|
|
function queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void;
|
|
|
|
function queryAppUsagePriorityGroup(): Promise<number>;
|
|
|
|
|
2022-03-02 06:21:10 +00:00
|
|
|
/**
|
|
|
|
* @since 7
|
2022-03-09 09:03:20 +00:00
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.BundleStatsMap
|
2022-03-02 06:21:10 +00:00
|
|
|
*/
|
|
|
|
interface BundleActiveInfoResponse {
|
|
|
|
[key: string]: BundleStateInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Queries usage information about each bundle within a specified period.
|
2022-04-19 07:15:43 +00:00
|
|
|
*
|
2022-03-02 06:21:10 +00:00
|
|
|
* <p>This method queries usage information at the {@link #BY_OPTIMIZED} interval by default.</p>
|
|
|
|
*
|
|
|
|
* @since 7
|
2022-03-09 09:03:20 +00:00
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
|
|
|
* @permission ohos.permission.BUNDLE_ACTIVE_INFO
|
2022-03-02 06:21:10 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @param begin Indicates the start time of the query period, in milliseconds.
|
|
|
|
* @param end Indicates the end time of the query period, in milliseconds.
|
|
|
|
* @return Returns the {@link BundleActiveInfoResponse} objects containing the usage information about each bundle.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.queryBundleStatsInfos
|
2022-03-02 06:21:10 +00:00
|
|
|
*/
|
|
|
|
function queryBundleStateInfos(begin: number, end: number, callback: AsyncCallback<BundleActiveInfoResponse>): void;
|
|
|
|
function queryBundleStateInfos(begin: number, end: number): Promise<BundleActiveInfoResponse>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Declares interval type.
|
2022-04-19 07:15:43 +00:00
|
|
|
*
|
2022-03-02 06:21:10 +00:00
|
|
|
* @since 7
|
2022-03-09 09:03:20 +00:00
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.IntervalType
|
2022-03-02 06:21:10 +00:00
|
|
|
*/
|
|
|
|
export enum IntervalType {
|
|
|
|
/**
|
|
|
|
* Indicates the interval type that will determine the optimal interval based on the start and end time.
|
|
|
|
*/
|
|
|
|
BY_OPTIMIZED = 0,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates the daily interval.
|
|
|
|
*/
|
|
|
|
BY_DAILY = 1,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates the weekly interval.
|
|
|
|
*/
|
|
|
|
BY_WEEKLY = 2,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates the monthly interval.
|
|
|
|
*/
|
|
|
|
BY_MONTHLY = 3,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates the annually interval.
|
|
|
|
*/
|
|
|
|
BY_ANNUALLY = 4
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Queries usage information about each bundle within a specified period at a specified interval.
|
|
|
|
*
|
|
|
|
* @since 7
|
2022-03-09 09:03:20 +00:00
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
|
|
|
* @permission ohos.permission.BUNDLE_ACTIVE_INFO
|
2022-03-02 06:21:10 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @param byInterval Indicates the interval at which the usage statistics are queried.
|
|
|
|
* The value can be {@link #BY_OPTIMIZED}, {@link #BY_DAILY},
|
|
|
|
* {@link #BY_WEEKLY}, {@link #BY_MONTHLY}, or {@link #BY_ANNUALLY}.
|
|
|
|
* @param begin Indicates the start time of the query period, in milliseconds.
|
|
|
|
* @param end Indicates the end time of the query period, in milliseconds.
|
|
|
|
* @return Returns the list of {@link BundleStateInfo} objects containing the usage information about each bundle.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.queryBundleStatsInfoByInterval
|
2022-03-02 06:21:10 +00:00
|
|
|
*/
|
|
|
|
function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback<Array<BundleStateInfo>>): void;
|
|
|
|
function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise<Array<BundleStateInfo>>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Queries state data of all bundles within a specified period identified by the start and end time.
|
|
|
|
*
|
|
|
|
* @since 7
|
2022-03-09 09:03:20 +00:00
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
|
|
|
* @permission ohos.permission.BUNDLE_ACTIVE_INFO
|
2022-03-02 06:21:10 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @param begin Indicates the start time of the query period, in milliseconds.
|
|
|
|
* @param end Indicates the end time of the query period, in milliseconds.
|
|
|
|
* @return Returns the list of {@link BundleActiveState} objects containing the state data of all bundles.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.queryBundleEvents
|
2022-03-02 06:21:10 +00:00
|
|
|
*/
|
|
|
|
function queryBundleActiveStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveState>>): void;
|
|
|
|
function queryBundleActiveStates(begin: number, end: number): Promise<Array<BundleActiveState>>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Queries state data of the current bundle within a specified period.
|
|
|
|
*
|
|
|
|
* @since 7
|
2022-03-09 09:03:20 +00:00
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
2022-03-02 06:21:10 +00:00
|
|
|
* @param begin Indicates the start time of the query period, in milliseconds.
|
|
|
|
* @param end Indicates the end time of the query period, in milliseconds.
|
|
|
|
* @return Returns the {@link BundleActiveState} object Array containing the state data of the current bundle.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.queryCurrentBundleEvents
|
2022-03-02 06:21:10 +00:00
|
|
|
*/
|
|
|
|
function queryCurrentBundleActiveStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveState>>): void;
|
|
|
|
function queryCurrentBundleActiveStates(begin: number, end: number): Promise<Array<BundleActiveState>>;
|
2022-04-19 07:15:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Queries recently module usage records.
|
|
|
|
*
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
|
|
|
* @permission ohos.permission.BUNDLE_ACTIVE_INFO
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @param maxNum Indicates max record number in result, max value is 1000, default value is 1000.
|
2022-04-19 08:01:54 +00:00
|
|
|
* @return Returns the {@link BundleActiveModuleInfo} object Array containing the usage data of the modules.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.queryModuleUsageRecords
|
2022-04-19 07:15:43 +00:00
|
|
|
*/
|
|
|
|
function getRecentlyUsedModules(maxNum?: number, callback: AsyncCallback<Array<BundleActiveModuleInfo>>): void;
|
|
|
|
function getRecentlyUsedModules(maxNum?: number): Promise<Array<BundleActiveModuleInfo>>;
|
2022-06-08 07:40:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Queries the usage priority group of the calling application.
|
|
|
|
*
|
|
|
|
* <p>The priority defined in a priority group restricts the resource usage of an application,
|
|
|
|
* for example, restricting the running of background tasks. </p>
|
|
|
|
*
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
|
2022-06-08 08:11:49 +00:00
|
|
|
* @permission ohos.permission.BUNDLE_ACTIVE_INFO
|
2022-06-08 08:05:38 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2022-06-08 08:11:49 +00:00
|
|
|
* @param bundleName, name of the application.
|
2022-06-08 07:40:16 +00:00
|
|
|
* @return Returns the usage priority group of the calling application.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.queryAppGroup
|
2022-06-08 07:40:16 +00:00
|
|
|
*/
|
|
|
|
function queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<number>): void;
|
|
|
|
function queryAppUsagePriorityGroup(bundleName? : string): Promise<number>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Declares group type.
|
|
|
|
*
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
|
2022-08-19 02:27:27 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.GroupType
|
2022-06-08 07:40:16 +00:00
|
|
|
*/
|
|
|
|
export enum GroupType {
|
|
|
|
/**
|
|
|
|
* Indicates the alive group.
|
|
|
|
*/
|
|
|
|
ACTIVE_GROUP_ALIVE = 10,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates the daily group.
|
|
|
|
*/
|
|
|
|
ACTIVE_GROUP_DAILY = 20,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates the fixed group.
|
|
|
|
*/
|
|
|
|
ACTIVE_GROUP_FIXED = 30,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates the rare group.
|
|
|
|
*/
|
|
|
|
ACTIVE_GROUP_RARE = 40,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates the limit group.
|
|
|
|
*/
|
|
|
|
ACTIVE_GROUP_LIMIT = 50,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates the never group.
|
|
|
|
*/
|
|
|
|
ACTIVE_GROUP_NEVER = 60
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set bundle group by bundleName and number.
|
|
|
|
*
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
|
2022-06-08 08:09:11 +00:00
|
|
|
* @permission ohos.permission.BUNDLE_ACTIVE_INFO
|
2022-06-08 08:05:38 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2022-06-08 08:09:11 +00:00
|
|
|
* @param bundleName, name of the application.
|
2022-06-08 08:05:38 +00:00
|
|
|
* @param newGroup,the group of the application whose name is bundleName.
|
2022-06-08 07:40:16 +00:00
|
|
|
* @return Returns the result of setBundleGroup, true of false.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.setAppGroup
|
2022-06-08 07:40:16 +00:00
|
|
|
*/
|
2022-06-09 08:27:55 +00:00
|
|
|
function setBundleGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback<void>): void;
|
|
|
|
function setBundleGroup(bundleName: string, newGroup: GroupType): Promise<void>;
|
2022-06-08 07:40:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* register callback to service.
|
|
|
|
*
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
|
2022-06-08 08:09:11 +00:00
|
|
|
* @permission ohos.permission.BUNDLE_ACTIVE_INFO
|
2022-06-08 08:05:38 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2022-06-08 08:09:11 +00:00
|
|
|
* @param Callback<BundleActiveGroupCallbackInfo>, callback when application group change,return the BundleActiveGroupCallbackInfo.
|
2022-06-08 07:40:16 +00:00
|
|
|
* @return Returns BundleActiveGroupCallbackInfo when the group of bundle changed. the result of AsyncCallback is true or false.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.registerAppGroupCallBack
|
2022-06-08 07:40:16 +00:00
|
|
|
*/
|
2022-06-09 08:27:55 +00:00
|
|
|
function registerGroupCallBack(callback: Callback<BundleActiveGroupCallbackInfo>, callback: AsyncCallback<void>): void;
|
|
|
|
function registerGroupCallBack(callback: Callback<BundleActiveGroupCallbackInfo>): Promise<void>;
|
2022-06-08 07:40:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* unRegister callback from service.
|
|
|
|
*
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
|
2022-06-08 08:09:11 +00:00
|
|
|
* @permission ohos.permission.BUNDLE_ACTIVE_INFO
|
2022-06-08 08:05:38 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2022-06-08 07:40:16 +00:00
|
|
|
* @return Returns the result of unRegisterGroupCallBack, true of false.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-09-15 01:38:36 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.unRegisterAppGroupCallBack
|
2022-06-08 07:40:16 +00:00
|
|
|
*/
|
2022-06-09 08:27:55 +00:00
|
|
|
function unRegisterGroupCallBack(callback: AsyncCallback<void>): void;
|
|
|
|
function unRegisterGroupCallBack(): Promise<void>;
|
2022-06-08 07:40:16 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Queries system event states data within a specified period identified by the start and end time.
|
|
|
|
*
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
|
|
|
* @permission ohos.permission.BUNDLE_ACTIVE_INFO
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @param begin Indicates the start time of the query period, in milliseconds.
|
|
|
|
* @param end Indicates the end time of the query period, in milliseconds.
|
|
|
|
* @return Returns the {@link BundleActiveEventState} object Array containing the event states data.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-10-13 11:20:58 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.queryDeviceEventStats
|
2022-06-08 07:40:16 +00:00
|
|
|
*/
|
|
|
|
function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void;
|
|
|
|
function queryBundleActiveEventStates(begin: number, end: number): Promise<Array<BundleActiveEventState>>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Queries app notification number within a specified period identified by the start and end time.
|
|
|
|
*
|
|
|
|
* @since 9
|
|
|
|
* @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
|
|
|
|
* @permission ohos.permission.BUNDLE_ACTIVE_INFO
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @param begin Indicates the start time of the query period, in milliseconds.
|
|
|
|
* @param end Indicates the end time of the query period, in milliseconds.
|
|
|
|
* @return Returns the {@link BundleActiveEventState} object Array containing the event states data.
|
2022-09-09 02:53:50 +00:00
|
|
|
* @deprecated since 9
|
2022-10-11 12:30:10 +00:00
|
|
|
* @useinstead @ohos.resourceschedule.usageStatistics.queryNotificationEventStats
|
2022-06-08 07:40:16 +00:00
|
|
|
*/
|
|
|
|
function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void;
|
|
|
|
function queryAppNotificationNumber(begin: number, end: number): Promise<Array<BundleActiveEventState>>;
|
2022-03-02 06:21:10 +00:00
|
|
|
}
|
|
|
|
|
2022-04-19 07:15:43 +00:00
|
|
|
export default bundleState;
|
|
|
|
|