• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright (c) 2022 Huawei Device Co., Ltd.
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 #include "init_hook.h"
18 #include "init_utils.h"
19 #include "plugin_adapter.h"
20 #include "securec.h"
21 
GetServiceStartCtrl(size_t * size)22 const ParamCmdInfo *GetServiceStartCtrl(size_t *size)
23 {
24     static const ParamCmdInfo ctrlParam[] = {
25         {"ohos.ctl.start", "start", "start "},
26         {"ohos.ctl.stop", "stop", "stop "},
27     };
28     *size = ARRAY_LENGTH(ctrlParam);
29     return ctrlParam;
30 }
31 
GetServiceCtl(size_t * size)32 const ParamCmdInfo *GetServiceCtl(size_t *size)
33 {
34     static const ParamCmdInfo installParam[] = {
35         {"ohos.servicectrl.install", "install", "install" },
36         {"ohos.servicectrl.uninstall", "uninstall", "uninstall" },
37         {"ohos.servicectrl.clear", "clear", "clear" },
38         {"ohos.servicectrl.bootchart", "bootchart", "bootchart" },
39         {"ohos.servicectrl.timer_start", "timer_start", "timer_start " },
40         {"ohos.servicectrl.timer_stop", "timer_stop", "timer_stop" },
41     };
42     *size = ARRAY_LENGTH(installParam);
43     return installParam;
44 }
45 
46 #ifdef OHOS_LITE
GetStartupPowerCtl(size_t * size)47 const ParamCmdInfo *GetStartupPowerCtl(size_t *size)
48 {
49     static const ParamCmdInfo powerCtrlArg[] = {
50         {"reboot,shutdown", "reboot.shutdown", "reboot.shutdown"},
51         {"reboot,updater", "reboot.updater", "reboot.updater"},
52         {"reboot,flashd", "reboot.flashd", "reboot.flashd"},
53         {"reboot,charge", "reboot.charge", "reboot.charge"},
54         {"reboot", "reboot", "reboot"},
55     };
56     *size = ARRAY_LENGTH(powerCtrlArg);
57     return powerCtrlArg;
58 }
59 #endif
60 
GetOtherSpecial(size_t * size)61 const ParamCmdInfo *GetOtherSpecial(size_t *size)
62 {
63     static const ParamCmdInfo other[] = {
64         {"bootevent.", "bootevent.", "bootevent"},
65         {"persist.init.debug.", "persist.init.debug.", "setloglevel"},
66     };
67     *size = ARRAY_LENGTH(other);
68     return other;
69 }
70