dre: Setup sim restart shell script

sm8450 and above have a very annoying SMS receiving bug where for some
carriers it won't work after a device restart if QTI telephony injection
isn't available, but one of the workarounds is to either use airplane
mode toggle or eject the sim card and reinsert it

Instead of doing that? Let's try and automate disabling and enabling the
sim card

EDIT: Some sm6375 devices have this problem too.

Co-authored-by: Marc Bourgoin <themard85@gmail.com>
Change-Id: I76732c2a668ff179e32050aee4abe315de3d9357
This commit is contained in:
egaunnac 2024-04-18 20:48:35 -06:00 committed by Albert Tang
parent b84af64fcc
commit 6b3d12eedd
6 changed files with 40 additions and 0 deletions

View file

@ -265,6 +265,7 @@ PRODUCT_PACKAGES += \
init.qcom.sh \
init.qcom.usb.rc \
init.qcom.usb.sh \
init.sim.restart.sh \
init.target.rc \
ueventd.oplus.rc \
ueventd.qcom.rc

View file

@ -76,3 +76,8 @@ sh_binary {
src: "init.qcom.sh",
vendor: true,
}
sh_binary {
name: "init.sim.restart.sh",
src: "init.sim.restart.sh",
}

View file

@ -44,6 +44,7 @@ on property:sys.boot_completed=1
copy /vendor/etc/Oppo_QC_LTM_Commercial_SM8250_2020_01_15.pfm /mnt/vendor/persist/data/pfm/licenses/1000-1000-no-exp-1186717196.pfm
chmod 0600 /mnt/vendor/persist/data/pfm/licenses/1000-1000-no-exp-1186717196.pfm
chown system system /mnt/vendor/persist/data/pfm/licenses/1000-1000-no-exp-1186717196.pfm
start sim-restart
on property:vendor.post_boot.parsed=1
# IRQ Tuning
@ -109,3 +110,9 @@ service oplus_sensor_fb /odm/bin/oplus_sensor_fb
group system
class late_start
oneshot
service sim-restart /system/bin/init.sim.restart.sh
user root
class main
oneshot
disabled

12
init/init.sim.restart.sh Executable file
View file

@ -0,0 +1,12 @@
#!/system/bin/sh
#
# Copyright (C) 2024 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
service call phone 186 i32 0 i32 0
sleep 0.5
service call phone 186 i32 0 i32 1

View file

@ -0,0 +1 @@
/system/bin/init\.sim\.restart\.sh u:object_r:init_sim_restart_exec:s0

View file

@ -0,0 +1,14 @@
type init_sim_restart, domain, coredomain;
type init_sim_restart_exec, system_file_type, exec_type, file_type;
init_daemon_domain(init_sim_restart)
allow init_sim_restart init:unix_stream_socket connectto;
allow init_sim_restart property_socket:sock_file write;
allow init_sim_restart shell_exec:file { execute getattr map read };
allow init_sim_restart toolbox_exec:file { execute execute_no_trans getattr map open read };
allow init_sim_restart radio:binder call;
allow init_sim_restart radio_service:service_manager find;
allow init_sim_restart servicemanager:binder call;
allow init_sim_restart system_file:file execute_no_trans;