• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023  Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit BackgroundTasksKit
19 */
20
21import { AsyncCallback, Callback } from './@ohos.base';
22
23/**
24 * Provides methods for managing bundle usage statistics,
25 * including the methods for querying bundle usage information and state data.
26 *
27 * <p>You can use the methods defined in this class to query
28 * the usage history and states of bundles in a specified period.
29 * The system stores the query result in a {@link BundleStatsInfo} instance and
30 * then returns it to you.
31 *
32 * @namespace usageStatistics
33 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
34 * @since 9
35 */
36declare namespace usageStatistics {
37  /**
38   * @interface BundleStatsInfo
39   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
40   * @systemapi Hide this for inner system use.
41   * @since 9
42   */
43  interface BundleStatsInfo {
44    /**
45     * The identifier of BundleStatsInfo.
46     * @type { number }
47     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
48     * @systemapi Hide this for inner system use.
49     * @since 9
50     */
51    id: number;
52
53    /**
54     * The total duration, in milliseconds.
55     * @type { ?number }
56     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
57     * @systemapi Hide this for inner system use.
58     * @since 9
59     */
60    abilityInFgTotalTime?: number;
61
62    /**
63     * The last time when the application was accessed, in milliseconds.
64     * @type { ?number }
65     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
66     * @systemapi Hide this for inner system use.
67     * @since 9
68     */
69    abilityPrevAccessTime?: number;
70
71    /**
72     * The last time when the application was visible in the foreground, in milliseconds.
73     * @type { ?number }
74     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
75     * @systemapi Hide this for inner system use.
76     * @since 9
77     */
78    abilityPrevSeenTime?: number;
79
80    /**
81     * The total duration, in milliseconds.
82     * @type { ?number }
83     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
84     * @systemapi Hide this for inner system use.
85     * @since 9
86     */
87    abilitySeenTotalTime?: number;
88
89    /**
90     * The bundle name of the application.
91     * @type { ?string }
92     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
93     * @systemapi Hide this for inner system use.
94     * @since 9
95     */
96    bundleName?: string;
97
98    /**
99     * The total duration, in milliseconds.
100     * @type { ?number }
101     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
102     * @systemapi Hide this for inner system use.
103     * @since 9
104     */
105    fgAbilityAccessTotalTime?: number;
106
107    /**
108     * The last time when the foreground application was accessed, in milliseconds.
109     * @type { ?number }
110     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
111     * @systemapi Hide this for inner system use.
112     * @since 9
113     */
114    fgAbilityPrevAccessTime?: number;
115
116    /**
117     * The time of the first bundle usage record in this {@code BundleActiveInfo} object,
118     * in milliseconds.
119     * @type { ?number }
120     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
121     * @systemapi Hide this for inner system use.
122     * @since 9
123     */
124    infosBeginTime?: number;
125
126    /**
127     * The time of the last bundle usage record in this {@code BundleActiveInfo} object,
128     * in milliseconds.
129     * @type { ?number }
130     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
131     * @systemapi Hide this for inner system use.
132     * @since 9
133     */
134    infosEndTime?: number;
135  }
136
137  /**
138   * @interface HapFormInfo
139   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
140   * @systemapi Hide this for inner system use.
141   * @since 9
142   */
143  interface HapFormInfo {
144    /**
145     * The form name.
146     * @type { string }
147     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
148     * @systemapi Hide this for inner system use.
149     * @since 9
150     */
151    formName: string;
152
153    /**
154     * The form dimension.
155     * @type { number }
156     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
157     * @systemapi Hide this for inner system use.
158     * @since 9
159     */
160    formDimension: number;
161
162    /**
163     * The form id.
164     * @type { number }
165     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
166     * @systemapi Hide this for inner system use.
167     * @since 9
168     */
169    formId: number;
170
171    /**
172     * The last time when the form was accessed, in milliseconds..
173     * @type { number }
174     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
175     * @systemapi Hide this for inner system use.
176     * @since 9
177     */
178    formLastUsedTime: number;
179
180    /**
181     * The click count of module.
182     * @type { number }
183     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
184     * @systemapi Hide this for inner system use.
185     * @since 9
186     */
187    count: number;
188  }
189
190  /**
191   * @interface HapModuleInfo
192   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
193   * @systemapi Hide this for inner system use.
194   * @since 9
195   */
196  interface HapModuleInfo {
197    /**
198     * The device id of module.
199     * @type { ?string }
200     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
201     * @systemapi Hide this for inner system use.
202     * @since 9
203     */
204    deviceId?: string;
205
206    /**
207     * The bundle name.
208     * @type { string }
209     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
210     * @systemapi Hide this for inner system use.
211     * @since 9
212     */
213    bundleName: string;
214
215    /**
216     * The module name.
217     * @type { string }
218     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
219     * @systemapi Hide this for inner system use.
220     * @since 9
221     */
222    moduleName: string;
223
224    /**
225     * The main ability name of module.
226     * @type { ?string }
227     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
228     * @systemapi Hide this for inner system use.
229     * @since 9
230     */
231    abilityName?: string;
232
233    /**
234     * The label id of application.
235     * @type { ?number }
236     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
237     * @systemapi Hide this for inner system use.
238     * @since 9
239     */
240    appLabelId?: number;
241
242    /**
243     * The label id of module.
244     * @type { ?number }
245     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
246     * @systemapi Hide this for inner system use.
247     * @since 9
248     */
249    labelId?: number;
250
251    /**
252     * The description id of application.
253     * @type { ?number }
254     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
255     * @systemapi Hide this for inner system use.
256     * @since 9
257     */
258    descriptionId?: number;
259
260    /**
261     * The ability id of main ability.
262     * @type { ?number }
263     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
264     * @systemapi Hide this for inner system use.
265     * @since 9
266     */
267    abilityLableId?: number;
268
269    /**
270     * The description id of main ability.
271     * @type { ?number }
272     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
273     * @systemapi Hide this for inner system use.
274     * @since 9
275     */
276    abilityDescriptionId?: number;
277
278    /**
279     * The icon id of main ability.
280     * @type { ?number }
281     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
282     * @systemapi Hide this for inner system use.
283     * @since 9
284     */
285    abilityIconId?: number;
286
287    /**
288     * The launch count of module.
289     * @type { number }
290     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
291     * @systemapi Hide this for inner system use.
292     * @since 9
293     */
294    launchedCount: number;
295
296    /**
297     * The last time when the module was accessed, in milliseconds.
298     * @type { number }
299     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
300     * @systemapi Hide this for inner system use.
301     * @since 9
302     */
303    lastModuleUsedTime: number;
304
305    /**
306     * The form usage record list of current module.
307     * @type { Array<HapFormInfo> }
308     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
309     * @systemapi Hide this for inner system use.
310     * @since 9
311     */
312    formRecords: Array<HapFormInfo>;
313  }
314
315  /**
316   * @interface DeviceEventStats
317   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
318   * @systemapi Hide this for inner system use.
319   * @since 9
320   */
321  interface DeviceEventStats {
322    /**
323     * The bundle name or system event name.
324     * @type { string }
325     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
326     * @systemapi Hide this for inner system use.
327     * @since 9
328     */
329    name: string;
330
331    /**
332     * The event id.
333     * @type { number }
334     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
335     * @systemapi Hide this for inner system use.
336     * @since 9
337     */
338    eventId: number;
339
340    /**
341     * The the event occurrence number.
342     * @type { number }
343     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
344     * @systemapi Hide this for inner system use.
345     * @since 9
346     */
347    count: number;
348  }
349
350  /**
351   * @interface BundleEvents
352   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
353   * @systemapi Hide this for inner system use.
354   * @since 9
355   */
356  interface BundleEvents {
357    /**
358     * The usage group of the application.
359     * @type { ?number }
360     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
361     * @systemapi Hide this for inner system use.
362     * @since 9
363     */
364    appGroup?: number;
365
366    /**
367     * The bundle name.
368     * @type { ?string }
369     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
370     * @systemapi Hide this for inner system use.
371     * @since 9
372     */
373    bundleName?: string;
374
375    /**
376     * The shortcut ID.
377     * @type { ?string }
378     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
379     * @systemapi Hide this for inner system use.
380     * @since 9
381     */
382    indexOfLink?: string;
383
384    /**
385     * The class name.
386     * @type { ?string }
387     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
388     * @systemapi Hide this for inner system use.
389     * @since 9
390     */
391    nameOfClass?: string;
392
393    /**
394     * The time when this state occurred, in milliseconds.
395     * @type { ?number }
396     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
397     * @systemapi Hide this for inner system use.
398     * @since 9
399     */
400    eventOccurredTime?: number;
401
402    /**
403     * The event id.
404     * @type { ?number }
405     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
406     * @systemapi Hide this for inner system use.
407     * @since 9
408     */
409    eventId?: number;
410  }
411
412  /**
413   * @interface AppGroupCallbackInfo
414   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
415   * @systemapi Hide this for inner system use.
416   * @since 9
417   */
418  interface AppGroupCallbackInfo {
419    /**
420     * The usage old group of the application
421     * @type { number }
422     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
423     * @systemapi Hide this for inner system use.
424     * @since 9
425     */
426    appOldGroup: number;
427
428    /**
429     * The usage new group of the application
430     * @type { number }
431     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
432     * @systemapi Hide this for inner system use.
433     * @since 9
434     */
435    appNewGroup: number;
436
437    /**
438     * The use id
439     * @type { number }
440     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
441     * @systemapi Hide this for inner system use.
442     * @since 9
443     */
444    userId: number;
445
446    /**
447     * The change reason
448     * @type { number }
449     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
450     * @systemapi Hide this for inner system use.
451     * @since 9
452     */
453    changeReason: number;
454
455    /**
456     * The bundle name
457     * @type { string }
458     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
459     * @systemapi Hide this for inner system use.
460     * @since 9
461     */
462    bundleName: string;
463  }
464
465  /**
466   * Checks whether the application with a specified bundle name is in the idle state.
467   *
468   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
469   * @param { string } bundleName - Indicates the bundle name of the application to query.
470   * @param { AsyncCallback<boolean> } callback - the callback of isIdleState.
471   * <p> boolean value is true mean the application is idle in a particular period; false mean otherwise.
472   * The time range of the particular period is defined by the system, which may be hours or days.</p>
473   * @throws { BusinessError } 201 - Permission denied.
474   * @throws { BusinessError } 202 - Not System App.
475   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
476   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
477   * @throws { BusinessError } 801 - Capability not supported.
478   * @throws { BusinessError } 10000001 - Memory operation failed.
479   * @throws { BusinessError } 10000002 - Parcel operation failed.
480   * @throws { BusinessError } 10000003 - System service operation failed.
481   * @throws { BusinessError } 10000004 - IPC failed.
482   * @throws { BusinessError } 10000006 - Failed to get the application information.
483   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
484   * @systemapi Hide this for inner system use.
485   * @since 9
486   */
487  function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void;
488
489  /**
490   * Checks whether the application with a specified bundle name is in the idle state.
491   *
492   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
493   * @param { string } bundleName - Indicates the bundle name of the application to query.
494   * @returns { Promise<boolean> } the promise returned by isIdleState.
495   * <p> boolean value is true mean the application is idle in a particular period; false mean otherwise.
496   * The time range of the particular period is defined by the system, which may be hours or days.</p>
497   * @throws { BusinessError } 201 - Permission denied.
498   * @throws { BusinessError } 202 - Not System App.
499   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
500   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
501   * @throws { BusinessError } 801 - Capability not supported.
502   * @throws { BusinessError } 10000001 - Memory operation failed.
503   * @throws { BusinessError } 10000002 - Parcel operation failed.
504   * @throws { BusinessError } 10000003 - System service operation failed.
505   * @throws { BusinessError } 10000004 - IPC failed.
506   * @throws { BusinessError } 10000006 - Failed to get the application information.
507   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
508   * @systemapi Hide this for inner system use.
509   * @since 9
510   */
511  function isIdleState(bundleName: string): Promise<boolean>;
512
513  /**
514   * Checks whether the application with a specified bundle name is in the idle state.
515   *
516   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
517   * @param { string } bundleName - Indicates the bundle name of the application to query.
518   * @returns { boolean }
519   * <p> boolean value is true mean the application is idle in a particular period; false mean otherwise.
520   * The time range of the particular period is defined by the system, which may be hours or days.</p>
521   * @throws { BusinessError } 201 - Permission denied.
522   * @throws { BusinessError } 202 - Not System App.
523   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
524   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
525   * @throws { BusinessError } 801 - Capability not supported.
526   * @throws { BusinessError } 10000001 - Memory operation failed.
527   * @throws { BusinessError } 10000002 - Parcel operation failed.
528   * @throws { BusinessError } 10000003 - System service operation failed.
529   * @throws { BusinessError } 10000004 - IPC failed.
530   * @throws { BusinessError } 10000006 - Failed to get the application information.
531   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
532   * @systemapi Hide this for inner system use.
533   * @since 10
534   */
535  function isIdleStateSync(bundleName: string): boolean;
536
537  /**
538   * Queries the app group of the calling application.
539   * <p>The priority defined in a priority group restricts the resource usage of an application,
540   * for example, restricting the running of background tasks. </p>
541   *
542   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
543   * @param { AsyncCallback<number> } callback - the callback of queryAppGroup.
544   * <p> Returns the app group of the calling application.</p>
545   * @throws { BusinessError } 201 - Permission denied.
546   * @throws { BusinessError } 202 - Not System App.
547   * @throws { BusinessError } 401 - Parameter error. Possible cause: Parameter verification failed.
548   * @throws { BusinessError } 801 - Capability not supported.
549   * @throws { BusinessError } 10000001 - Memory operation failed.
550   * @throws { BusinessError } 10000002 - Parcel operation failed.
551   * @throws { BusinessError } 10000003 - System service operation failed.
552   * @throws { BusinessError } 10000004 - IPC failed.
553   * @throws { BusinessError } 10000005 - Application is not installed.
554   * @throws { BusinessError } 10000006 - Failed to get the application information.
555   * @throws { BusinessError } 10100002 - Failed to get the application group information.
556   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
557   * @systemapi Hide this for inner system use.
558   * @since 9
559   */
560  function queryAppGroup(callback: AsyncCallback<number>): void;
561
562  /**
563   * Queries the app group of the calling application.
564   * <p>The priority defined in a priority group restricts the resource usage of an application,
565   * for example, restricting the running of background tasks. </p>
566   *
567   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
568   * @returns { Promise<number> } the promise returned by queryAppGroup.
569   * <p> Returns the app group of the calling application.</p>
570   * @throws { BusinessError } 201 - Permission denied.
571   * @throws { BusinessError } 202 - Not System App.
572   * @throws { BusinessError } 401 - Parameter error. Possible cause: Parameter verification failed.
573   * @throws { BusinessError } 801 - Capability not supported.
574   * @throws { BusinessError } 10000001 - Memory operation failed.
575   * @throws { BusinessError } 10000002 - Parcel operation failed.
576   * @throws { BusinessError } 10000003 - System service operation failed.
577   * @throws { BusinessError } 10000004 - IPC failed.
578   * @throws { BusinessError } 10000005 - Application is not installed.
579   * @throws { BusinessError } 10000006 - Failed to get the application information.
580   * @throws { BusinessError } 10100002 - Failed to get the application group information.
581   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
582   * @systemapi Hide this for inner system use.
583   * @since 9
584   */
585  function queryAppGroup(): Promise<number>;
586
587  /**
588   * Queries the app group of the calling application.
589   * <p>The priority defined in a priority group restricts the resource usage of an application,
590   * for example, restricting the running of background tasks. </p>
591   *
592   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
593   * @returns { number } Returns the app group of the calling application.
594   * @throws { BusinessError } 201 - Permission denied.
595   * @throws { BusinessError } 202 - Not System App.
596   * @throws { BusinessError } 401 - Parameter error. Possible cause: Parameter verification failed.
597   * @throws { BusinessError } 801 - Capability not supported.
598   * @throws { BusinessError } 10000001 - Memory operation failed.
599   * @throws { BusinessError } 10000002 - Parcel operation failed.
600   * @throws { BusinessError } 10000003 - System service operation failed.
601   * @throws { BusinessError } 10000004 - IPC failed.
602   * @throws { BusinessError } 10000005 - Application is not installed.
603   * @throws { BusinessError } 10000006 - Failed to get the application information.
604   * @throws { BusinessError } 10100002 - Failed to get the application group information.
605   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
606   * @systemapi Hide this for inner system use.
607   * @since 10
608   */
609  function queryAppGroupSync(): number;
610
611  /**
612   * Queries the usage priority group by bundleName.
613   * <p>The priority defined in a priority group restricts the resource usage of an application,
614   * for example, restricting the running of background tasks. </p>
615   *
616   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
617   * @param { string } bundleName - name of the application.
618   * @param { AsyncCallback<number> } callback - the callback of queryAppGroup.
619   * <p> the usage priority group of the calling application.</p>
620   * @throws { BusinessError } 201 - Permission denied.
621   * @throws { BusinessError } 202 - Not System App.
622   * @throws { BusinessError } 401 - Parameter error. Possible cause: Parameter verification failed.
623   * @throws { BusinessError } 801 - Capability not supported.
624   * @throws { BusinessError } 10000001 - Memory operation failed.
625   * @throws { BusinessError } 10000002 - Parcel operation failed.
626   * @throws { BusinessError } 10000003 - System service operation failed.
627   * @throws { BusinessError } 10000004 - IPC failed.
628   * @throws { BusinessError } 10000005 - Application is not installed.
629   * @throws { BusinessError } 10000006 - Failed to get the application information.
630   * @throws { BusinessError } 10100002 - Failed to get the application group information.
631   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
632   * @systemapi Hide this for inner system use.
633   * @since 9
634   */
635  function queryAppGroup(bundleName: string, callback: AsyncCallback<number>): void;
636
637  /**
638   * Queries the usage priority group by bundleName.
639   * <p>The priority defined in a priority group restricts the resource usage of an application,
640   * for example, restricting the running of background tasks. </p>
641   *
642   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
643   * @param { string } bundleName - name of the application.
644   * @returns { Promise<number> } the promise returned by queryAppGroup.
645   * <p> the usage priority group of the calling application.</p>
646   * @throws { BusinessError } 201 - Permission denied.
647   * @throws { BusinessError } 202 - Not System App.
648   * @throws { BusinessError } 401 - Parameter error. Possible cause: Parameter verification failed.
649   * @throws { BusinessError } 801 - Capability not supported.
650   * @throws { BusinessError } 10000001 - Memory operation failed.
651   * @throws { BusinessError } 10000002 - Parcel operation failed.
652   * @throws { BusinessError } 10000003 - System service operation failed.
653   * @throws { BusinessError } 10000004 - IPC failed.
654   * @throws { BusinessError } 10000005 - Application is not installed.
655   * @throws { BusinessError } 10000006 - Failed to get the application information.
656   * @throws { BusinessError } 10100002 - Failed to get the application group information.
657   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
658   * @systemapi Hide this for inner system use.
659   * @since 9
660   */
661  function queryAppGroup(bundleName: string): Promise<number>;
662
663  /**
664   * Queries the usage priority group by bundleName.
665   * <p>The priority defined in a priority group restricts the resource usage of an application,
666   * for example, restricting the running of background tasks. </p>
667   *
668   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
669   * @param { string } bundleName - name of the application.
670   * @returns { number } the usage priority group of the calling application.
671   * @throws { BusinessError } 201 - Permission denied.
672   * @throws { BusinessError } 202 - Not System App.
673   * @throws { BusinessError } 401 - Parameter error. Possible cause: Parameter verification failed.
674   * @throws { BusinessError } 801 - Capability not supported.
675   * @throws { BusinessError } 10000001 - Memory operation failed.
676   * @throws { BusinessError } 10000002 - Parcel operation failed.
677   * @throws { BusinessError } 10000003 - System service operation failed.
678   * @throws { BusinessError } 10000004 - IPC failed.
679   * @throws { BusinessError } 10000005 - Application is not installed.
680   * @throws { BusinessError } 10000006 - Failed to get the application information.
681   * @throws { BusinessError } 10100002 - Failed to get the application group information.
682   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
683   * @systemapi Hide this for inner system use.
684   * @since 10
685   */
686  function queryAppGroupSync(bundleName: string): number;
687
688  /**
689   * @typedef { Record<string, BundleStatsInfo> }
690   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
691   * @systemapi Hide this for inner system use.
692   * @since 9
693   */
694  type BundleStatsMap = Record<string, BundleStatsInfo>;
695
696  /**
697   * Queries usage information about each bundle within a specified period.
698   * <p>This method queries usage information at the {@link #BY_OPTIMIZED} interval by default.</p>
699   *
700   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
701   * @param { number } begin - Indicates the start time of the query period, in milliseconds.
702   * @param { number } end - Indicates the end time of the query period, in milliseconds.
703   * @param { AsyncCallback<BundleStatsMap> } callback - the callback of queryBundleStatsInfos,
704   * <p> the {@link BundleStatsMap} objects containing the usage information about each bundle.</p>
705   * @throws { BusinessError } 201 - Permission denied.
706   * @throws { BusinessError } 202 - Not System App.
707   * @throws { BusinessError } 401 - Parameter error. Possible cause: Parameter verification failed.
708   * @throws { BusinessError } 801 - Capability not supported.
709   * @throws { BusinessError } 10000001 - Memory operation failed.
710   * @throws { BusinessError } 10000002 - Parcel operation failed.
711   * @throws { BusinessError } 10000003 - System service operation failed.
712   * @throws { BusinessError } 10000004 - IPC failed.
713   * @throws { BusinessError } 10000006 - Failed to get the application information.
714   * @throws { BusinessError } 10000007 - Failed to get the system time.
715   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
716   * @systemapi Hide this for inner system use.
717   * @since 9
718   */
719  function queryBundleStatsInfos(begin: number, end: number, callback: AsyncCallback<BundleStatsMap>): void;
720
721  /**
722   * Queries usage information about each bundle within a specified period.
723   * <p>This method queries usage information at the {@link #BY_OPTIMIZED} interval by default.</p>
724   *
725   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
726   * @param { number } begin - Indicates the start time of the query period, in milliseconds.
727   * @param { number } end - Indicates the end time of the query period, in milliseconds.
728   * @returns { Promise<BundleStatsMap> } the promise returned by queryBundleStatsInfos.
729   * <p> the {@link BundleStatsMap} objects containing the usage information about each bundle.</p>
730   * @throws { BusinessError } 201 - Permission denied.
731   * @throws { BusinessError } 202 - Not System App.
732   * @throws { BusinessError } 401 - Parameter error. Possible cause: Parameter verification failed.
733   * @throws { BusinessError } 801 - Capability not supported.
734   * @throws { BusinessError } 10000001 - Memory operation failed.
735   * @throws { BusinessError } 10000002 - Parcel operation failed.
736   * @throws { BusinessError } 10000003 - System service operation failed.
737   * @throws { BusinessError } 10000004 - IPC failed.
738   * @throws { BusinessError } 10000006 - Failed to get the application information.
739   * @throws { BusinessError } 10000007 - Failed to get the system time.
740   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
741   * @systemapi Hide this for inner system use.
742   * @since 9
743   */
744  function queryBundleStatsInfos(begin: number, end: number): Promise<BundleStatsMap>;
745
746  /**
747   * Declares interval type.
748   *
749   * @enum { number }
750   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
751   * @systemapi Hide this for inner system use.
752   * @since 9
753   */
754  export enum IntervalType {
755    /**
756     * Indicates the interval type that will determine the optimal interval based on the start and end time.
757     *
758     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
759     * @systemapi Hide this for inner system use.
760     * @since 9
761     */
762    BY_OPTIMIZED = 0,
763
764    /**
765     * Indicates the daily interval.
766     *
767     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
768     * @systemapi Hide this for inner system use.
769     * @since 9
770     */
771    BY_DAILY = 1,
772
773    /**
774     * Indicates the weekly interval.
775     *
776     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
777     * @systemapi Hide this for inner system use.
778     * @since 9
779     */
780    BY_WEEKLY = 2,
781
782    /**
783     * Indicates the monthly interval.
784     *
785     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
786     * @systemapi Hide this for inner system use.
787     * @since 9
788     */
789    BY_MONTHLY = 3,
790
791    /**
792     * Indicates the annually interval.
793     *
794     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
795     * @systemapi Hide this for inner system use.
796     * @since 9
797     */
798    BY_ANNUALLY = 4
799  }
800
801  /**
802   * Queries usage information about each bundle within a specified period at a specified interval.
803   *
804   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
805   * @param { IntervalType } byInterval - Indicates the interval at which the usage statistics are queried.
806   * <p> The value can be {@link #BY_OPTIMIZED}, {@link #BY_DAILY},
807   * {@link #BY_WEEKLY}, {@link #BY_MONTHLY}, or {@link #BY_ANNUALLY}.</p>
808   * @param { number } begin - Indicates the start time of the query period, in milliseconds.
809   * @param { number } end - Indicates the end time of the query period, in milliseconds.
810   * @param { AsyncCallback<Array<BundleStatsInfo>> } callback - the callback of queryBundleStatsInfoByInterval.
811   * <p> the list of {@link BundleStatsInfo} objects containing the usage information about each bundle.</p>
812   * @throws { BusinessError } 201 - Permission denied.
813   * @throws { BusinessError } 202 - Not System App.
814   * @throws { BusinessError } 401 - Parameter error. Possible cause: Parameter verification failed.
815   * @throws { BusinessError } 801 - Capability not supported.
816   * @throws { BusinessError } 10000001 - Memory operation failed.
817   * @throws { BusinessError } 10000002 - Parcel operation failed.
818   * @throws { BusinessError } 10000003 - System service operation failed.
819   * @throws { BusinessError } 10000004 - IPC failed.
820   * @throws { BusinessError } 10000006 - Failed to get the application information.
821   * @throws { BusinessError } 10000007 - Failed to get the system time.
822   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
823   * @systemapi Hide this for inner system use.
824   * @since 9
825   */
826  function queryBundleStatsInfoByInterval(
827    byInterval: IntervalType,
828    begin: number,
829    end: number,
830    callback: AsyncCallback<Array<BundleStatsInfo>>
831  ): void;
832
833  /**
834   * Queries usage information about each bundle within a specified period at a specified interval.
835   *
836   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
837   * @param { IntervalType } byInterval - Indicates the interval at which the usage statistics are queried.
838   * <p> The value can be {@link #BY_OPTIMIZED}, {@link #BY_DAILY},
839   * {@link #BY_WEEKLY}, {@link #BY_MONTHLY}, or {@link #BY_ANNUALLY}.</p>
840   * @param { number } begin - Indicates the start time of the query period, in milliseconds.
841   * @param { number } end - Indicates the end time of the query period, in milliseconds.
842   * @returns { Promise<Array<BundleStatsInfo>> } the promise returned by queryBundleStatsInfoByInterval.
843   * <p> the list of {@link BundleStatsInfo} objects containing the usage information about each bundle.</p>
844   * @throws { BusinessError } 201 - Permission denied.
845   * @throws { BusinessError } 202 - Not System App.
846   * @throws { BusinessError } 401 - Parameter error. Possible cause: Parameter verification failed.
847   * @throws { BusinessError } 801 - Capability not supported.
848   * @throws { BusinessError } 10000001 - Memory operation failed.
849   * @throws { BusinessError } 10000002 - Parcel operation failed.
850   * @throws { BusinessError } 10000003 - System service operation failed.
851   * @throws { BusinessError } 10000004 - IPC failed.
852   * @throws { BusinessError } 10000006 - Failed to get the application information.
853   * @throws { BusinessError } 10000007 - Failed to get the system time.
854   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
855   * @systemapi Hide this for inner system use.
856   * @since 9
857   */
858  function queryBundleStatsInfoByInterval(
859    byInterval: IntervalType,
860    begin: number,
861    end: number
862  ): Promise<Array<BundleStatsInfo>>;
863
864  /**
865   * Queries state data of all bundles within a specified period identified by the start and end time.
866   *
867   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
868   * @param { number } begin - Indicates the start time of the query period, in milliseconds.
869   * @param { number } end - Indicates the end time of the query period, in milliseconds.
870   * @param { AsyncCallback<Array<BundleEvents>> } callback - the promise returned by queryBundleEvents.
871   * <p> the list of {@link BundleEvents} objects containing the state data of all bundles.</p>
872   * @throws { BusinessError } 201 - Permission denied.
873   * @throws { BusinessError } 202 - Not System App.
874   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
875   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
876   * @throws { BusinessError } 801 - Capability not supported.
877   * @throws { BusinessError } 10000001 - Memory operation failed.
878   * @throws { BusinessError } 10000002 - Parcel operation failed.
879   * @throws { BusinessError } 10000003 - System service operation failed.
880   * @throws { BusinessError } 10000004 - IPC failed.
881   * @throws { BusinessError } 10000006 - Failed to get the application information.
882   * @throws { BusinessError } 10000007 - Failed to get the system time.
883   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
884   * @systemapi Hide this for inner system use.
885   * @since 9
886   */
887  function queryBundleEvents(begin: number, end: number, callback: AsyncCallback<Array<BundleEvents>>): void;
888
889  /**
890   * Queries state data of all bundles within a specified period identified by the start and end time.
891   *
892   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
893   * @param { number } begin - Indicates the start time of the query period, in milliseconds.
894   * @param { number } end - Indicates the end time of the query period, in milliseconds.
895   * @returns { Promise<Array<BundleEvents>> } the promise returned by queryBundleEvents.
896   * <p> the list of {@link BundleEvents} objects containing the state data of all bundles.</p>
897   * @throws { BusinessError } 201 - Permission denied.
898   * @throws { BusinessError } 202 - Not System App.
899   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
900   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
901   * @throws { BusinessError } 801 - Capability not supported.
902   * @throws { BusinessError } 10000001 - Memory operation failed.
903   * @throws { BusinessError } 10000002 - Parcel operation failed.
904   * @throws { BusinessError } 10000003 - System service operation failed.
905   * @throws { BusinessError } 10000004 - IPC failed.
906   * @throws { BusinessError } 10000006 - Failed to get the application information.
907   * @throws { BusinessError } 10000007 - Failed to get the system time.
908   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
909   * @systemapi Hide this for inner system use.
910   * @since 9
911   */
912  function queryBundleEvents(begin: number, end: number): Promise<Array<BundleEvents>>;
913
914  /**
915   * Queries state data of the current bundle within a specified period.
916   *
917   * @param { number } begin - Indicates the start time of the query period, in milliseconds.
918   * @param { number } end - Indicates the end time of the query period, in milliseconds.
919   * @param { AsyncCallback<Array<BundleEvents>> } callback - the callback of queryCurrentBundleEvents.
920   * <p> the {@link BundleEvents} object Array containing the state data of the current bundle.</p>
921   * @throws { BusinessError } 202 - Not System App.
922   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
923   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
924   * @throws { BusinessError } 801 - Capability not supported.
925   * @throws { BusinessError } 10000001 - Memory operation failed.
926   * @throws { BusinessError } 10000002 - Parcel operation failed.
927   * @throws { BusinessError } 10000003 - System service operation failed.
928   * @throws { BusinessError } 10000004 - IPC failed.
929   * @throws { BusinessError } 10000006 - Failed to get the application information.
930   * @throws { BusinessError } 10000007 - Failed to get the system time.
931   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
932   * @systemapi Hide this for inner system use.
933   * @since 9
934   */
935  function queryCurrentBundleEvents(begin: number, end: number, callback: AsyncCallback<Array<BundleEvents>>): void;
936
937  /**
938   * Queries state data of the current bundle within a specified period.
939   *
940   * @param { number } begin - Indicates the start time of the query period, in milliseconds.
941   * @param { number } end - Indicates the end time of the query period, in milliseconds.
942   * @returns { Promise<Array<BundleEvents>> } the promise returned by queryCurrentBundleEvents.
943   * <p> the {@link BundleEvents} object Array containing the state data of the current bundle.</p>
944   * @throws { BusinessError } 202 - Not System App.
945   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
946   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
947   * @throws { BusinessError } 801 - Capability not supported.
948   * @throws { BusinessError } 10000001 - Memory operation failed.
949   * @throws { BusinessError } 10000002 - Parcel operation failed.
950   * @throws { BusinessError } 10000003 - System service operation failed.
951   * @throws { BusinessError } 10000004 - IPC failed.
952   * @throws { BusinessError } 10000006 - Failed to get the application information.
953   * @throws { BusinessError } 10000007 - Failed to get the system time.
954   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
955   * @systemapi Hide this for inner system use.
956   * @since 9
957   */
958  function queryCurrentBundleEvents(begin: number, end: number): Promise<Array<BundleEvents>>;
959
960  /**
961   * Queries recently module usage records with maxNum.
962   *
963   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
964   * @param { number } maxNum - Indicates max record number in result, max value is 1000, default value is 1000.
965   * @param { AsyncCallback<Array<HapModuleInfo>> } callback - the callback of queryModuleUsageRecords.
966   * <p> the {@link HapModuleInfo} object Array containing the usage data of the modules.</p>
967   * @throws { BusinessError } 201 - Permission denied.
968   * @throws { BusinessError } 202 - Not System App.
969   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
970   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
971   * @throws { BusinessError } 801 - Capability not supported.
972   * @throws { BusinessError } 10000001 - Memory operation failed.
973   * @throws { BusinessError } 10000002 - Parcel operation failed.
974   * @throws { BusinessError } 10000003 - System service operation failed.
975   * @throws { BusinessError } 10000004 - IPC failed.
976   * @throws { BusinessError } 10000006 - Failed to get the application information.
977   * @throws { BusinessError } 10000007 - Failed to get the system time.
978   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
979   * @systemapi Hide this for inner system use.
980   * @since 9
981   */
982  function queryModuleUsageRecords(maxNum: number, callback: AsyncCallback<Array<HapModuleInfo>>): void;
983
984  /**
985   * Queries recently module usage records with maxNum.
986   *
987   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
988   * @param { number } maxNum - Indicates max record number in result, max value is 1000, default value is 1000.
989   * @returns { Promise<Array<HapModuleInfo>> } the promise returned by queryModuleUsageRecords.
990   * <p> the {@link HapModuleInfo} object Array containing the usage data of the modules.</p>
991   * @throws { BusinessError } 201 - Permission denied.
992   * @throws { BusinessError } 202 - Not System App.
993   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
994   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
995   * @throws { BusinessError } 801 - Capability not supported.
996   * @throws { BusinessError } 10000001 - Memory operation failed.
997   * @throws { BusinessError } 10000002 - Parcel operation failed.
998   * @throws { BusinessError } 10000003 - System service operation failed.
999   * @throws { BusinessError } 10000004 - IPC failed.
1000   * @throws { BusinessError } 10000006 - Failed to get the application information.
1001   * @throws { BusinessError } 10000007 - Failed to get the system time.
1002   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
1003   * @systemapi Hide this for inner system use.
1004   * @since 9
1005   */
1006  function queryModuleUsageRecords(maxNum: number): Promise<Array<HapModuleInfo>>;
1007
1008  /**
1009   * Queries recently module usage records.
1010   *
1011   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
1012   * @param { AsyncCallback<Array<HapModuleInfo>> } callback - the callback of queryModuleUsageRecords.
1013   * <p> the {@link HapModuleInfo} object Array containing the usage data of the modules.</p>
1014   * @throws { BusinessError } 201 - Permission denied.
1015   * @throws { BusinessError } 202 - Not System App.
1016   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
1017   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
1018   * @throws { BusinessError } 801 - Capability not supported.
1019   * @throws { BusinessError } 10000001 - Memory operation failed.
1020   * @throws { BusinessError } 10000002 - Parcel operation failed.
1021   * @throws { BusinessError } 10000003 - System service operation failed.
1022   * @throws { BusinessError } 10000004 - IPC failed.
1023   * @throws { BusinessError } 10000006 - Failed to get the application information.
1024   * @throws { BusinessError } 10000007 - Failed to get the system time.
1025   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
1026   * @systemapi Hide this for inner system use.
1027   * @since 9
1028   */
1029  function queryModuleUsageRecords(callback: AsyncCallback<Array<HapModuleInfo>>): void;
1030
1031  /**
1032   * Queries recently module usage records.
1033   *
1034   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
1035   * @returns { Promise<Array<HapModuleInfo>> } the promise returned by queryModuleUsageRecords.
1036   * <p> the {@link HapModuleInfo} object Array containing the usage data of the modules.</p>
1037   * @throws { BusinessError } 201 - Permission denied.
1038   * @throws { BusinessError } 202 - Not System App.
1039   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
1040   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
1041   * @throws { BusinessError } 801 - Capability not supported.
1042   * @throws { BusinessError } 10000001 - Memory operation failed.
1043   * @throws { BusinessError } 10000002 - Parcel operation failed.
1044   * @throws { BusinessError } 10000003 - System service operation failed.
1045   * @throws { BusinessError } 10000004 - IPC failed.
1046   * @throws { BusinessError } 10000006 - Failed to get the application information.
1047   * @throws { BusinessError } 10000007 - Failed to get the system time.
1048   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
1049   * @systemapi Hide this for inner system use.
1050   * @since 9
1051   */
1052  function queryModuleUsageRecords(): Promise<Array<HapModuleInfo>>;
1053
1054  /**
1055   * Declares group type.
1056   *
1057   * @enum { number }
1058   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1059   * @systemapi Hide this for inner system use.
1060   * @since 9
1061   */
1062  export enum GroupType {
1063    /**
1064     * Indicates the alive group.
1065     *
1066     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1067     * @systemapi Hide this for inner system use.
1068     * @since 9
1069     */
1070    ALIVE_GROUP = 10,
1071
1072    /**
1073     * Indicates the daily group.
1074     *
1075     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1076     * @systemapi Hide this for inner system use.
1077     * @since 9
1078     */
1079    DAILY_GROUP = 20,
1080
1081    /**
1082     * Indicates the fixed group.
1083     *
1084     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1085     * @systemapi Hide this for inner system use.
1086     * @since 9
1087     */
1088    FIXED_GROUP = 30,
1089
1090    /**
1091     * Indicates the rare group.
1092     *
1093     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1094     * @systemapi Hide this for inner system use.
1095     * @since 9
1096     */
1097    RARE_GROUP = 40,
1098
1099    /**
1100     * Indicates the limit group.
1101     *
1102     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1103     * @systemapi Hide this for inner system use.
1104     * @since 9
1105     */
1106    LIMITED_GROUP = 50,
1107
1108    /**
1109     * Indicates the never group.
1110     *
1111     * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1112     * @systemapi Hide this for inner system use.
1113     * @since 9
1114     */
1115    NEVER_GROUP = 60
1116  }
1117
1118  /**
1119   * Set app group by bundleName.
1120   *
1121   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
1122   * @param { string } bundleName - name of the application.
1123   * @param { GroupType } newGroup - the group of the application whose name is bundleName.
1124   * @param { AsyncCallback<void> } callback - the callback of setAppGroup.
1125   * @throws { BusinessError } 201 - Permission denied.
1126   * @throws { BusinessError } 202 - Not System App.
1127   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
1128   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
1129   * @throws { BusinessError } 801 - Capability not supported.
1130   * @throws { BusinessError } 10000001 - Memory operation failed.
1131   * @throws { BusinessError } 10000002 - Parcel operation failed.
1132   * @throws { BusinessError } 10000003 - System service operation failed.
1133   * @throws { BusinessError } 10000004 - IPC failed.
1134   * @throws { BusinessError } 10000006 - Failed to get the application information.
1135   * @throws { BusinessError } 10100001 - Repeated operation on the application group.
1136   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1137   * @systemapi Hide this for inner system use.
1138   * @since 9
1139   */
1140  function setAppGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback<void>): void;
1141
1142  /**
1143   * Set app group by bundleName.
1144   *
1145   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
1146   * @param { string } bundleName - name of the application.
1147   * @param { GroupType } newGroup - the group of the application whose name is bundleName.
1148   * @returns { Promise<void> } the promise returned by setAppGroup.
1149   * @throws { BusinessError } 201 - Permission denied.
1150   * @throws { BusinessError } 202 - Not System App.
1151   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
1152   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
1153   * @throws { BusinessError } 801 - Capability not supported.
1154   * @throws { BusinessError } 10000001 - Memory operation failed.
1155   * @throws { BusinessError } 10000002 - Parcel operation failed.
1156   * @throws { BusinessError } 10000003 - System service operation failed.
1157   * @throws { BusinessError } 10000004 - IPC failed.
1158   * @throws { BusinessError } 10000006 - Failed to get the application information.
1159   * @throws { BusinessError } 10100001 - Repeated operation on the application group.
1160   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1161   * @systemapi Hide this for inner system use.
1162   * @since 9
1163   */
1164  function setAppGroup(bundleName: string, newGroup: GroupType): Promise<void>;
1165
1166  /**
1167   * Register appGroup change callback to service.
1168   *
1169   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
1170   * @param { Callback<AppGroupCallbackInfo> } groupCallback -
1171   * <p> callback of AppGroupCallbackInfo when the group of app changed.</p>
1172   * @param { AsyncCallback<void> } callback - the callback of registerAppGroupCallBack.
1173   * @throws { BusinessError } 201 - Permission denied.
1174   * @throws { BusinessError } 202 - Not System App.
1175   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
1176   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
1177   * @throws { BusinessError } 801 - Capability not supported.
1178   * @throws { BusinessError } 10000001 - Memory operation failed.
1179   * @throws { BusinessError } 10000002 - Parcel operation failed.
1180   * @throws { BusinessError } 10000003 - System service operation failed.
1181   * @throws { BusinessError } 10000004 - IPC failed.
1182   * @throws { BusinessError } 10100001 - Repeated operation on the application group.
1183   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1184   * @systemapi Hide this for inner system use.
1185   * @since 9
1186   */
1187  function registerAppGroupCallBack(groupCallback: Callback<AppGroupCallbackInfo>, callback: AsyncCallback<void>): void;
1188
1189  /**
1190   * Register appGroup change callback to service.
1191   *
1192   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
1193   * @param { Callback<AppGroupCallbackInfo> } groupCallback -
1194   * <p> callback of AppGroupCallbackInfo when the group of app changed.</p>
1195   * @returns { Promise<void> } the promise returned by registerAppGroupCallBack.
1196   * @throws { BusinessError } 201 - Permission denied.
1197   * @throws { BusinessError } 202 - Not System App.
1198   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
1199   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
1200   * @throws { BusinessError } 801 - Capability not supported.
1201   * @throws { BusinessError } 10000001 - Memory operation failed.
1202   * @throws { BusinessError } 10000002 - Parcel operation failed.
1203   * @throws { BusinessError } 10000003 - System service operation failed.
1204   * @throws { BusinessError } 10000004 - IPC failed.
1205   * @throws { BusinessError } 10100001 - Repeated operation on the application group.
1206   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1207   * @systemapi Hide this for inner system use.
1208   * @since 9
1209   */
1210  function registerAppGroupCallBack(groupCallback: Callback<AppGroupCallbackInfo>): Promise<void>;
1211
1212  /**
1213   * Unregister appGroup change callback from service.
1214   *
1215   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
1216   * @param { AsyncCallback<void> } callback - the callback of unregisterAppGroupCallBack.
1217   * @throws { BusinessError } 201 - Permission denied.
1218   * @throws { BusinessError } 202 - Not System App.
1219   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
1220   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
1221   * @throws { BusinessError } 801 - Capability not supported.
1222   * @throws { BusinessError } 10000001 - Memory operation failed.
1223   * @throws { BusinessError } 10000002 - Parcel operation failed.
1224   * @throws { BusinessError } 10000003 - System service operation failed.
1225   * @throws { BusinessError } 10000004 - IPC failed.
1226   * @throws { BusinessError } 10100001 - Repeated operation on the application group.
1227   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1228   * @systemapi Hide this for inner system use.
1229   * @since 9
1230   */
1231  function unregisterAppGroupCallBack(callback: AsyncCallback<void>): void;
1232
1233  /**
1234   * Unregister appGroup change callback from service.
1235   *
1236   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
1237   * @returns { Promise<void> } the promise returned by unregisterAppGroupCallBack.
1238   * @throws { BusinessError } 201 - Permission denied.
1239   * @throws { BusinessError } 202 - Not System App.
1240   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
1241   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
1242   * @throws { BusinessError } 801 - Capability not supported.
1243   * @throws { BusinessError } 10000001 - Memory operation failed.
1244   * @throws { BusinessError } 10000002 - Parcel operation failed.
1245   * @throws { BusinessError } 10000003 - System service operation failed.
1246   * @throws { BusinessError } 10000004 - IPC failed.
1247   * @throws { BusinessError } 10100001 - Repeated operation on the application group.
1248   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
1249   * @systemapi Hide this for inner system use.
1250   * @since 9
1251   */
1252  function unregisterAppGroupCallBack(): Promise<void>;
1253
1254  /**
1255   * Queries device event states data within a specified period identified by the start and end time.
1256   *
1257   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
1258   * @param { number } begin - Indicates the start time of the query period, in milliseconds.
1259   * @param { number } end - Indicates the end time of the query period, in milliseconds.
1260   * @param { AsyncCallback<Array<DeviceEventStats>> } callback - the callback of queryDeviceEventStats.
1261   * <p> the {@link DeviceEventStats} object Array containing the event states data.</p>
1262   * @throws { BusinessError } 201 - Permission denied.
1263   * @throws { BusinessError } 202 - Not System App.
1264   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
1265   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
1266   * @throws { BusinessError } 801 - Capability not supported.
1267   * @throws { BusinessError } 10000001 - Memory operation failed.
1268   * @throws { BusinessError } 10000002 - Parcel operation failed.
1269   * @throws { BusinessError } 10000003 - System service operation failed.
1270   * @throws { BusinessError } 10000004 - IPC failed.
1271   * @throws { BusinessError } 10000006 - Failed to get the application information.
1272   * @throws { BusinessError } 10000007 - Failed to get the system time.
1273   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
1274   * @systemapi Hide this for inner system use.
1275   * @since 9
1276   */
1277  function queryDeviceEventStats(begin: number, end: number, callback: AsyncCallback<Array<DeviceEventStats>>): void;
1278
1279  /**
1280   * Queries device event states data within a specified period identified by the start and end time.
1281   *
1282   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
1283   * @param { number } begin - Indicates the start time of the query period, in milliseconds.
1284   * @param { number } end - Indicates the end time of the query period, in milliseconds.
1285   * @returns { Promise<Array<DeviceEventStats>> } the promise returned by queryDeviceEventStats.
1286   * <p> the {@link DeviceEventStats} object Array containing the event states data.</p>
1287   * @throws { BusinessError } 201 - Permission denied.
1288   * @throws { BusinessError } 202 - Not System App.
1289   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
1290   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
1291   * @throws { BusinessError } 801 - Capability not supported.
1292   * @throws { BusinessError } 10000001 - Memory operation failed.
1293   * @throws { BusinessError } 10000002 - Parcel operation failed.
1294   * @throws { BusinessError } 10000003 - System service operation failed.
1295   * @throws { BusinessError } 10000004 - IPC failed.
1296   * @throws { BusinessError } 10000006 - Failed to get the application information.
1297   * @throws { BusinessError } 10000007 - Failed to get the system time.
1298   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
1299   * @systemapi Hide this for inner system use.
1300   * @since 9
1301   */
1302  function queryDeviceEventStats(begin: number, end: number): Promise<Array<DeviceEventStats>>;
1303
1304  /**
1305   * Queries app notification number within a specified period identified by the start and end time.
1306   *
1307   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
1308   * @param { number } begin - Indicates the start time of the query period, in milliseconds.
1309   * @param { number } end - Indicates the end time of the query period, in milliseconds.
1310   * @param { AsyncCallback<Array<DeviceEventStats>> } callback - the callback of queryNotificationEventStats.
1311   * <p> the {@link DeviceEventStats} object Array containing the event states data.</p>
1312   * @throws { BusinessError } 201 - Permission denied.
1313   * @throws { BusinessError } 202 - Not System App.
1314   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
1315   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
1316   * @throws { BusinessError } 801 - Capability not supported.
1317   * @throws { BusinessError } 10000001 - Memory operation failed.
1318   * @throws { BusinessError } 10000002 - Parcel operation failed.
1319   * @throws { BusinessError } 10000003 - System service operation failed.
1320   * @throws { BusinessError } 10000004 - IPC failed.
1321   * @throws { BusinessError } 10000006 - Failed to get the application information.
1322   * @throws { BusinessError } 10000007 - Failed to get the system time.
1323   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
1324   * @systemapi Hide this for inner system use.
1325   * @since 9
1326   */
1327  function queryNotificationEventStats(
1328    begin: number,
1329    end: number,
1330    callback: AsyncCallback<Array<DeviceEventStats>>
1331  ): void;
1332
1333  /**
1334   * Queries app notification number within a specified period identified by the start and end time.
1335   *
1336   * @permission ohos.permission.BUNDLE_ACTIVE_INFO
1337   * @param { number } begin - Indicates the start time of the query period, in milliseconds.
1338   * @param { number } end - Indicates the end time of the query period, in milliseconds.
1339   * @returns { Promise<Array<DeviceEventStats>> } the promise returned by queryNotificationEventStats.
1340   * <p> the {@link DeviceEventStats} object Array containing the event states data.</p>
1341   * @throws { BusinessError } 201 - Permission denied.
1342   * @throws { BusinessError } 202 - Not System App.
1343   * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified;
1344   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
1345   * @throws { BusinessError } 801 - Capability not supported.
1346   * @throws { BusinessError } 10000001 - Memory operation failed.
1347   * @throws { BusinessError } 10000002 - Parcel operation failed.
1348   * @throws { BusinessError } 10000003 - System service operation failed.
1349   * @throws { BusinessError } 10000004 - IPC failed.
1350   * @throws { BusinessError } 10000006 - Failed to get the application information.
1351   * @throws { BusinessError } 10000007 - Failed to get the system time.
1352   * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App
1353   * @systemapi Hide this for inner system use.
1354   * @since 9
1355   */
1356  function queryNotificationEventStats(begin: number, end: number): Promise<Array<DeviceEventStats>>;
1357}
1358
1359export default usageStatistics;
1360