1#
2# Copyright (C) 2019 The Android Open-Source Project
3#
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#
18# This file inherits from init.${ro.boot.hardware.platform}.rc plus additional
19# configs only used by XR targets.
20#
21import /vendor/etc/init/hw/init.${ro.hardware}.common.rc
22
23on init
24    # Temporarily stop booting into VR directly due to battery drain.
25    # TODO(b/131327495): Re-enable this once VrHeadsetPowerPolicyService or its
26    #                    equivalent lands in Android master.
27    setprop ro.boot.vr 0
28
29    # Setup cpusets used by the VR services.
30    mkdir /dev/cpuset/kernel 0750 root system
31    write /dev/cpuset/kernel/cpus 0
32    write /dev/cpuset/kernel/mems 0
33    chown system system /dev/cpuset/kernel/tasks
34    chmod 0660 /dev/cpuset/kernel/tasks
35
36    mkdir /dev/cpuset/system 0750 root system
37    write /dev/cpuset/system/cpus 0
38    write /dev/cpuset/system/mems 0
39    chown system system /dev/cpuset/system/tasks
40    chmod 0660 /dev/cpuset/system/tasks
41
42    mkdir /dev/cpuset/system/performance 0750 root system
43    write /dev/cpuset/system/performance/cpus 0
44    write /dev/cpuset/system/performance/mems 0
45    chown system system /dev/cpuset/system/performance/tasks
46    chmod 0660 /dev/cpuset/system/performance/tasks
47
48    mkdir /dev/cpuset/system/background 0750 root system
49    write /dev/cpuset/system/background/cpus 0
50    write /dev/cpuset/system/background/mems 0
51    chown system system /dev/cpuset/system/background/tasks
52    chmod 0660 /dev/cpuset/system/background/tasks
53
54    mkdir /dev/cpuset/application 0750 root system
55    write /dev/cpuset/application/cpus 0
56    write /dev/cpuset/application/mems 0
57    chown system system /dev/cpuset/application/tasks
58    chmod 0660 /dev/cpuset/application/tasks
59
60    mkdir /dev/cpuset/application/performance 0750 root system
61    write /dev/cpuset/application/performance/cpus 0
62    write /dev/cpuset/application/performance/mems 0
63    chown system system /dev/cpuset/application/performance/tasks
64    chmod 0660 /dev/cpuset/application/performance/tasks
65
66    mkdir /dev/cpuset/application/background 0750 root system
67    write /dev/cpuset/application/background/cpus 0
68    write /dev/cpuset/application/background/mems 0
69    chown system system /dev/cpuset/application/background/tasks
70    chmod 0660 /dev/cpuset/application/background/tasks
71
72    # Create UDS structure for base VR services.
73    mkdir /dev/socket/pdx 0775 system system
74    mkdir /dev/socket/pdx/system 0775 system system
75    mkdir /dev/socket/pdx/system/buffer_hub 0775 system system
76    mkdir /dev/socket/pdx/system/performance 0775 system system
77    mkdir /dev/socket/pdx/system/vr 0775 system system
78    mkdir /dev/socket/pdx/system/vr/display 0775 system system
79    mkdir /dev/socket/pdx/system/vr/pose 0775 system system
80    mkdir /dev/socket/pdx/system/vr/sensors 0775 system system
81
82on boot
83    # Update DVR cpusets to boot-time values.
84    write /dev/cpuset/kernel/cpus 0-7
85    write /dev/cpuset/system/cpus 0-7
86    write /dev/cpuset/system/performance/cpus 0-7
87    write /dev/cpuset/system/background/cpus 0-7
88    write /dev/cpuset/system/cpus 0-7
89    write /dev/cpuset/application/cpus 0-7
90    write /dev/cpuset/application/performance/cpus 0-7
91    write /dev/cpuset/application/background/cpus 0-7
92    write /dev/cpuset/application/cpus 0-7
93
94    # ftm4 VR mode
95    chown system system /sys/devices/virtual/input/ftm4_touch/vrmode
96
97on property:sys.boot_completed=1
98    # Update DVR cpusets to runtime values.
99    write /dev/cpuset/kernel/cpus 2,3
100    write /dev/cpuset/system/performance/cpus 6-7
101    write /dev/cpuset/system/background/cpus 0-1
102    write /dev/cpuset/system/cpus 0-1,6-7
103    write /dev/cpuset/application/performance/cpus 4-5
104    write /dev/cpuset/application/background/cpus 0-1
105    write /dev/cpuset/application/cpus 0-1,4-5
106