1# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14on init 15 # cpuctl subsystem 16 # set background cpuctl 17 mkdir /dev/cpuctl/background 18 chmod 0755 /dev/cpuctl/background 19 chmod 0755 /dev/cpuctl/background/tasks 20 chown system system /dev/cpuctl/background 21 chown system system /dev/cpuctl/background/tasks 22 write /dev/cpuctl/background/cpu.shares 512 23 24 # cpuset subsystem 25 # write cpus in background 26 write /dev/cpuset/background/cpus 0 27 28 # freezer subsystem 29 # create freezer of cgroup point 30 mkdir /dev/freezer 31 chown system system /dev/freezer 32 chmod 0755 /dev/freezer 33 mount cgroup none /dev/freezer freezer 34 35 # create directory of frozen and thawed 36 mkdir /dev/freezer/frozen 37 mkdir /dev/freezer/thawed 38 39 # change permissions 40 chown system system /dev/freezer/frozen 41 chown system system /dev/freezer/frozen/tasks 42 chown system system /dev/freezer/thawed 43 chown system system /dev/freezer/thawed/tasks 44 chmod 0755 /dev/freezer/frozen 45 chmod 0755 /dev/freezer/frozen/tasks 46 chmod 0755 /dev/freezer/thawed 47 chmod 0755 /dev/freezer/thawed/tasks 48 49 # write freezer state 50 write /dev/freezer/frozen/freezer.state FROZEN 51 write /dev/freezer/thawed/freezer.state THAWED 52 53on boot 54 # Add permision for powermanager to control suspend 55 # It should be executed before foundation started 56 # because powermanager will run in foundation process 57 chown radio system /sys/power/wake_lock 58 chown radio system /sys/power/wake_unlock 59 chmod 0664 /sys/power/wakeup_count 60 start foundation 61 62service foundation /system/bin/sa_main /system/profile/foundation.xml 63 class foundation 64 priority -20 65 user system 66 group system 67 seclabel u:r:foundation:s0 68 capabilities SYS_PTRACE KILL SYS_BOOT 69