dumpstate: touch: Init touch_predump service
go/touch_predump Test: b/318578275 Test: Locally flash to check dump_touch logs on dogfood devices Bug: 287907308 Change-Id: Ibc9df367549dd69c83936a7fd08465f7bb53ce80
This commit is contained in:
parent
d8f09cbcef
commit
8a52cae4dd
9 changed files with 122 additions and 0 deletions
17
touch/predump/Android.bp
Normal file
17
touch/predump/Android.bp
Normal file
|
@ -0,0 +1,17 @@
|
|||
package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
sh_binary {
|
||||
name: "predump_touch.sh",
|
||||
src: "predump_touch.sh",
|
||||
init_rc: ["init.touch.predump.rc"],
|
||||
vendor: true,
|
||||
}
|
||||
|
||||
sh_binary {
|
||||
name: "dump_touch.sh",
|
||||
src: "dump_touch.sh",
|
||||
vendor: true,
|
||||
sub_dir: "dump",
|
||||
}
|
25
touch/predump/dump_touch.sh
Normal file
25
touch/predump/dump_touch.sh
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/vendor/bin/sh
|
||||
|
||||
DIR=/data/vendor/dump_touch
|
||||
LOCKFILE="$DIR"/dumping
|
||||
LOGFILE="$DIR"/dump.log
|
||||
|
||||
if [ ! -f $LOCKFILE ]
|
||||
then
|
||||
echo "-----------------------------------------------------"
|
||||
echo "Error : PreDump Touch Logs couldn't be found."
|
||||
echo "-----------------------------------------------------"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
state=$(cat $LOCKFILE)
|
||||
if [ "$state" != 2 ]
|
||||
then
|
||||
echo "Unexpected state! Expected 2 but found ${state}" >> $LOGFILE
|
||||
fi
|
||||
|
||||
cat $LOGFILE
|
||||
echo "" > $LOGFILE
|
||||
|
||||
echo 0 > $LOCKFILE
|
||||
|
12
touch/predump/init.touch.predump.rc
Normal file
12
touch/predump/init.touch.predump.rc
Normal file
|
@ -0,0 +1,12 @@
|
|||
service vendor.touch_dumpstate /vendor/bin/predump_touch.sh
|
||||
class main
|
||||
user system
|
||||
group system shell
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
on post-fs-data
|
||||
mkdir /data/vendor/dump_touch 0775 system system
|
||||
|
||||
on property:init.svc.dumpstatez=running
|
||||
start vendor.touch_dumpstate
|
4
touch/predump/predump_touch.mk
Normal file
4
touch/predump/predump_touch.mk
Normal file
|
@ -0,0 +1,4 @@
|
|||
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/predump/sepolicy
|
||||
|
||||
PRODUCT_PACKAGES += predump_touch.sh
|
||||
PRODUCT_PACKAGES += dump_touch.sh
|
44
touch/predump/predump_touch.sh
Normal file
44
touch/predump/predump_touch.sh
Normal file
|
@ -0,0 +1,44 @@
|
|||
#!/vendor/bin/sh
|
||||
|
||||
DIR=/data/vendor/dump_touch
|
||||
SCRIPT_DIR=/vendor/bin/dump_touch
|
||||
LOCKFILE="$DIR"/dumping
|
||||
LOGFILE="$DIR"/dump.log
|
||||
|
||||
if [ ! -f $LOCKFILE ]
|
||||
then
|
||||
#Init Setup
|
||||
echo 0 > $LOCKFILE
|
||||
echo "" > $LOGFILE
|
||||
chmod 660 $LOCKFILE
|
||||
chmod 660 $LOGFILE
|
||||
fi
|
||||
|
||||
echo $(date) >> $LOGFILE
|
||||
|
||||
state=$(cat $LOCKFILE)
|
||||
if [ "$state" != 0 ]
|
||||
then
|
||||
echo "Unexpected state! Expected 0 but found ${state}" >> $LOGFILE
|
||||
fi
|
||||
|
||||
echo 1 > $LOCKFILE
|
||||
|
||||
for entry in "$SCRIPT_DIR"/*.sh
|
||||
do
|
||||
echo "----------------------------------" >> $LOGFILE
|
||||
echo "$entry" >> $LOGFILE
|
||||
echo "----------------------------------" >> $LOGFILE
|
||||
sh $entry >> $LOGFILE
|
||||
echo "----------------------------------" >> $LOGFILE
|
||||
done
|
||||
|
||||
state=$(cat $LOCKFILE)
|
||||
if [ "$state" != 1 ]
|
||||
then
|
||||
echo "Unexpected state! Expected 1 but found ${state}" >> $LOGFILE
|
||||
fi
|
||||
|
||||
echo 2 > $LOCKFILE
|
||||
|
||||
|
5
touch/predump/sepolicy/dump_touch.te
Normal file
5
touch/predump/sepolicy/dump_touch.te
Normal file
|
@ -0,0 +1,5 @@
|
|||
pixel_bugreport(dump_touch)
|
||||
|
||||
allow dump_touch vendor_touch_dump_file:dir r_dir_perms;
|
||||
allow dump_touch vendor_touch_dump_file:file rw_file_perms;
|
||||
allow dump_touch vendor_toolbox_exec:file execute_no_trans;
|
1
touch/predump/sepolicy/file.te
Normal file
1
touch/predump/sepolicy/file.te
Normal file
|
@ -0,0 +1 @@
|
|||
type vendor_touch_dump_file, file_type, data_file_type;
|
5
touch/predump/sepolicy/file_contexts
Normal file
5
touch/predump/sepolicy/file_contexts
Normal file
|
@ -0,0 +1,5 @@
|
|||
/vendor/bin/predump_touch\.sh u:object_r:predump_touch_exec:s0
|
||||
/vendor/bin/dump/dump_touch\.sh u:object_r:dump_touch_exec:s0
|
||||
/data/vendor/dump_touch/dump\.log u:object_r:vendor_touch_dump_file:s0
|
||||
/data/vendor/dump_touch/dumping u:object_r:vendor_touch_dump_file:s0
|
||||
/data/vendor/dump_touch u:object_r:vendor_touch_dump_file:s0
|
9
touch/predump/sepolicy/predump_touch.te
Normal file
9
touch/predump/sepolicy/predump_touch.te
Normal file
|
@ -0,0 +1,9 @@
|
|||
type predump_touch, domain;
|
||||
type predump_touch_exec, vendor_file_type, exec_type, file_type;
|
||||
init_daemon_domain(predump_touch)
|
||||
|
||||
allow predump_touch vendor_touch_dump_file:dir rw_dir_perms;
|
||||
allow predump_touch vendor_touch_dump_file:file create_file_perms;
|
||||
|
||||
allow predump_touch vendor_toolbox_exec:file execute_no_trans;
|
||||
allow predump_touch vendor_shell_exec:file execute_no_trans;
|
Loading…
Add table
Add a link
Reference in a new issue