1 /*
2  * Copyright (c) 2020-2022 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 #ifndef POLICY_PERSET_H
17 #define POLICY_PERSET_H
18 
19 #include "policy_define.h"
20 
21 FeaturePolicy pmsFeature[] = {
22     {
23         "PmsFeature",
24         {
25             {
26                 .type = RANGE,
27                 .uidMin = 0,
28                 .uidMax = __INT_MAX__,
29             },
30         },
31     },
32     {
33         "PmsInnerFeature",
34         {
35             {
36                 .type = RANGE,
37                 .uidMin = 0,
38                 .uidMax = 999,
39             },
40         },
41     },
42 };
43 
44 FeaturePolicy amsFeature[] = {
45     {
46         "AmsFeature",
47         {
48             {
49                 .type = RANGE,
50                 .uidMin = 0,
51                 .uidMax = __INT_MAX__,
52             },
53         }
54     },
55     {
56         "AmsInnerFeature",
57         {
58             {
59                 .type = FIXED,
60                 .fixedUid = {2}
61             },
62         }
63     },
64 };
65 
66 FeaturePolicy bmsFeature[] = {
67     {
68         "BmsFeature",
69         {
70             {
71                 .type = FIXED,
72                 .fixedUid = {2, 3, 8}
73             },
74             {
75                 .type = RANGE,
76                 .uidMin = 100,
77                 .uidMax = __INT_MAX__,
78             },
79         }
80     },
81     {
82         "BmsInnerFeature",
83         {
84             {
85                 .type = FIXED,
86                 .fixedUid = {2, 3, 8}
87             },
88             {
89                 .type = RANGE,
90                 .uidMin = 100,
91                 .uidMax = 999,
92             },
93         }
94     },
95 };
96 
97 FeaturePolicy bdsFeature[] = {
98     {
99         NULL,
100         {
101             {
102                 .type = FIXED,
103                 .fixedUid = {7}
104             },
105         }
106     },
107 };
108 
109 FeaturePolicy dmsFeature[] = {
110     {
111         "dmslite",
112         {
113             {
114                 .type = RANGE,
115                 .uidMin = 0,
116                 .uidMax = __INT_MAX__,
117             },
118         }
119     },
120 };
121 
122 FeaturePolicy samgrFeature[] = {
123     {
124         NULL,
125         {
126             {
127                 .type = RANGE,
128                 .uidMin = 0,
129                 .uidMax = __INT_MAX__,
130             },
131         }
132     },
133 };
134 
135 FeaturePolicy appspawnFeature[] = {
136     {
137         NULL,
138         {
139             {
140                 .type = FIXED,
141                 .fixedUid = {7}
142             },
143         }
144     },
145 };
146 
147 FeaturePolicy imsFeature[] = {
148     {
149         NULL,
150         {
151             {
152                 .type = RANGE,
153                 .uidMin = 100,
154                 .uidMax = __INT_MAX__,
155             },
156             {
157                 .type = FIXED,
158                 .fixedUid = {2, 7}
159             },
160         }
161     },
162 };
163 
164 FeaturePolicy wmsFeature[] = {
165     {
166         NULL,
167         {
168             {
169                 .type = RANGE,
170                 .uidMin = 100,
171                 .uidMax = __INT_MAX__,
172             },
173             {
174                 .type = FIXED,
175                 .fixedUid = {2, 7}
176             },
177         }
178     },
179 };
180 
181 FeaturePolicy sensorFeature[] = {
182     {
183         NULL,
184         {
185             {
186                 .type = RANGE,
187                 .uidMin = 0,
188                 .uidMax = __INT_MAX__,
189             },
190         }
191     },
192 };
193 
194 FeaturePolicy aiFeature[] = {
195     {
196         NULL,
197         {
198             {
199                 .type = RANGE,
200                 .uidMin = 0,
201                 .uidMax = __INT_MAX__,
202             },
203         }
204     },
205 };
206 
207 FeaturePolicy powermgrFeature[] = {
208     {
209         "screensaver",
210         {
211             {
212                 .type = RANGE,
213                 .uidMin = 0,
214                 .uidMax = 1000,
215             },
216         },
217     },
218     {
219         "powermanage",
220         {
221             {
222                 .type = RANGE,
223                 .uidMin = 0,
224                 .uidMax = __INT_MAX__,
225             },
226         },
227     },
228 };
229 
230 FeaturePolicy timertaskFeature[] = {
231     {
232         "timertask_fea",
233         {
234             {
235                 .type = RANGE,
236                 .uidMin = 0,
237                 .uidMax = 999,
238             },
239         },
240     },
241 };
242 
243 FeaturePolicy softbusFeature[] = {
244     {
245         NULL,
246         {
247             {
248                 .type = RANGE,
249                 .uidMin = 0,
250                 .uidMax = __INT_MAX__,
251             },
252         },
253     },
254 };
255 
256 FeaturePolicy playerFeature[] = {
257     {
258         NULL,
259         {
260             {
261                 .type = RANGE,
262                 .uidMin = 0,
263                 .uidMax = __INT_MAX__,
264             },
265         },
266     },
267 };
268 
269 FeaturePolicy cameraFeature[] = {
270     {
271         NULL,
272         {
273             {
274                 .type = RANGE,
275                 .uidMin = 0,
276                 .uidMax = __INT_MAX__,
277             },
278         },
279     },
280 };
281 
282 FeaturePolicy recorderFeature[] = {
283     {
284         NULL,
285         {
286             {
287                 .type = RANGE,
288                 .uidMin = 0,
289                 .uidMax = __INT_MAX__,
290             },
291         },
292     },
293 };
294 
295 FeaturePolicy audioCapturerFeature[] = {
296     {
297         NULL,
298         {
299             {
300                 .type = RANGE,
301                 .uidMin = 0,
302                 .uidMax = __INT_MAX__,
303             },
304         },
305     },
306 };
307 
308 FeaturePolicy devAuthFeature[] = {
309     {
310         NULL,
311         {
312             {
313                 .type = RANGE,
314                 .uidMin = 0,
315                 .uidMax = 999,
316             },
317         },
318     },
319 };
320 
321 FeaturePolicy batteryFeature[] = {
322     {
323         "battery_feature",
324         {
325             {
326                 .type = RANGE,
327                 .uidMin = 0,
328                 .uidMax = __INT_MAX__,
329             },
330         },
331     },
332 };
333 
334 FeaturePolicy deviceManagerFeature[] = {
335     {
336         NULL,
337         {
338             {
339                 .type = RANGE,
340                 .uidMin = 0,
341                 .uidMax = __INT_MAX__,
342             },
343         },
344     },
345 };
346 
347 FeaturePolicy wifiFeature[] = {
348     {
349         NULL,
350         {
351             {
352                 .type = RANGE,
353                 .uidMin = 0,
354                 .uidMax = __INT_MAX__,
355             },
356         },
357     },
358     {
359         "wifidevice",
360         {
361             {
362                 .type = RANGE,
363                 .uidMin = 0,
364                 .uidMax = __INT_MAX__,
365             },
366         },
367     },
368     {
369         "wifiscan",
370         {
371             {
372                 .type = RANGE,
373                 .uidMin = 0,
374                 .uidMax = __INT_MAX__,
375             },
376         },
377     },
378 };
379 
380 FeaturePolicy devAttestFeature[] = {
381     {
382         "attest_feature",
383         {
384             {
385                 .type = RANGE,
386                 .uidMin = 0,
387                 .uidMax = __INT_MAX__,
388             },
389         },
390     },
391 };
392 
393 FeaturePolicy dslmFeature[] = {
394     {
395         "dslm_feature",
396         {
397             {
398                 .type = RANGE,
399                 .uidMin = 0,
400                 .uidMax = __INT_MAX__,
401             },
402         },
403     },
404 };
405 
406 FeaturePolicy huksFeature[] = {
407     {
408         "huks_feature",
409         {
410             {
411                 .type = RANGE,
412                 .uidMin = 0,
413                 .uidMax = __INT_MAX__,
414             },
415         },
416     },
417 };
418 
419 static PolicySetting g_presetPolicies[] = {
420     {"permissionms", pmsFeature, 2},
421     {"abilityms", amsFeature, 2},
422     {"bundlems", bmsFeature, 2},
423     {"dtbschedsrv", dmsFeature, 1},
424     {"samgr", samgrFeature, 1},
425     {"appspawn", appspawnFeature, 1},
426     {"IMS", imsFeature, 1},
427     {"WMS", wmsFeature, 1},
428     {"bundle_daemon", bdsFeature, 1},
429     {"sensor_service", sensorFeature, 1},
430     {"ai_service", aiFeature, 1},
431     {"powermgr", powermgrFeature, 2},
432     {"timertask_srv", timertaskFeature, 1},
433     {"softbus_service", softbusFeature, 1},
434     {"PlayerServer", playerFeature, 1},
435     {"CameraServer", cameraFeature, 1},
436     {"RecorderServer", recorderFeature, 1},
437     {"AudioCapServer", audioCapturerFeature, 1},
438     {"devauth_svc", devAuthFeature, 1},
439     {"battery_service", batteryFeature, 1},
440     {"dev_mgr_svc", deviceManagerFeature, 1},
441     {"wifisrvlite", wifiFeature, 3},
442     {"attest_service", devAttestFeature, 1},
443     {"dslm_service", dslmFeature, 1},
444     {"huks_service", huksFeature, 1}
445 };
446 
447 static int g_presetPolicySize = sizeof(g_presetPolicies) / sizeof(PolicySetting);
448 
449 #endif // POLICY_PERSET_H
450