2

I researched previous questions with this topic but unfortunately nothing has worked.

I am trying to disable status bar from users sliding from top of device upon bootup with this command to the adb console (which will be re-nabled if you reboot the phone, changes are discarded after reboot):

service call activity 42 s16 com.android.systemui

so that when my application boots up, they cannot slide from top to see status bar. I put that line in a script called init_remove.sh with lines below:

#!/system/bin/sh
service call activity 42 s16 com.android.systemui 

whenever the user reboots his phone, I want the init.rc file to start a service to run that script every time. I added these lines of code to the end of the init.rc file:

# service to remove status bar
service init_remove /system/etc/init_remove.sh
     user root
     oneshot

I then recompiled the uramdisk.img file and pushed it to my rooted device. The new init.rc can be seen with the added changes but I can still swipe from top to view status bar.

What am I doing wrong

EDIT: I now even tried this in init.rc file to start my service from the suggestion below:

on property:init.svc.zygote=running
    start init_remove

on property:init.svc.servicemanager=running
    start init_remove
     .
     .
     .

but still no change...are my property triggers wrong?

EDIT 2 DAYS LATER:

So now I know my service is being noticed when init is running, but cannot be executed because of permissions issues seen below:

init: cannot execve('/system/bin/myscript'): Permission denied

as seen by the output on the console. My updated new service in the init.rc:

on boot
    start myscript
service myscript /system/bin/myscript
    user system
    disabled
    oneshot

I run the service as system since supposedly it has rw, and execute permissions: but it still cannot exec. What I think could be the problem is that the mountpoint for the filesystem is listed as read-only, seen by mount command:

/ $ mount
rootfs / rootfs rw,relatime 0 0
tmpfs /dev tmpfs rw,seclabel,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
none /sys/fs/cgroup tmpfs rw,seclabel,relatime,mode=750,gid=1000 0 0
tmpfs /mnt/secure tmpfs rw,seclabel,relatime,mode=700 0 0
tmpfs /mnt/asec tmpfs rw,seclabel,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,seclabel,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/shm tmpfs rw,seclabel,relatime,size=1024k,mode=775,uid=1013,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
pstore /sys/fs/pstore pstore rw,relatime 0 0
/dev/block/mmcblk3p1 /boot vfat rw,noatime,nodiratime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
/dev/block/mmcblk3p2 /recovery vfat rw,noatime,nodiratime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
/dev/block/mmcblk3p5 /system ext4 ro,seclabel,relatime,data=ordered 0 0
/dev/block/mmcblk3p4 /data ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,noauto_da_alloc,errors=panic,data=ordered 0 0
/dev/block/mmcblk3p6 /cache ext4 rw,seclabel,nosuid,nodev,relatime,data=ordered 0 0
/dev/block/mmcblk3p7 /device ext4 ro,seclabel,nosuid,nodev,relatime,data=ordered 0 0
adb /dev/usb-ffs/adb functionfs rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
/dev/fuse /mnt/shell/emulated fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/block/vold/179:1 /mnt/media_rw/extsd vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/fuse /storage/extsd fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0

But I cannot figure out where in the init.rc file I can set the partition that /system filesystem to rw (and execute) when it mounts.

1

As always, the answer was simpler (although it tooks hours of research) than I thought.

Explanation

The answer was that init was not viewing the file as executable. The system call execve, I found out returns errors of Permission denied because it cannot determine it is the right file type to execute, amidst other errors that could cause it. Since @Agu.Thade mentioned if I had permissions, I researched into it more. After about 16 hours of trying to work around ro filesystem crap that I thought was causing the issue, I realized that all the executables in the /system/bin folder were green and my script was white (regular file). So using the chmod advice from @Agu.Thade, I tried to chmod +x from adb which returned Bad mode.

Answer

Three hours later, I finally figured maybe I should pull the script to my computer, chmod +x myscript and adb push myscript /system/bin/. I did so, ran ls, and SURE ENOUGH, the file turned green (recognized as executable). Did a reboot, and of course, my script ran.

0

That's just the service declaration, there need to be some means to start the service for it to work. You have to call

start init_remove

in your desired trigger event for the service to be started, different triggers are available depending on the boot position, for your case start your "init_remove" service after system services and zygote have started.

Alternatively you can also use some service classes that are in your init script and your script will be run automatically along with the services in your specified class without a need of an explicit start.

Check the init syntax readme here

  • I'm been trying to look for triggers that happen after zygote and system services. I don't know if I should use post-init or something like that. I will keep researching...thanks for answer, I will accept when I get solve it. – Eric Reyna Jan 24 '17 at 14:04
  • please see my edit above for what I tried – Eric Reyna Jan 24 '17 at 16:10
  • Find a trigger closest to boot completion, that should work as all system services would have been started by then. e.g if your init scripts have sys.boot_completed=1 property trigger then it might be a good place to start – AguThadeus Jan 24 '17 at 19:31
  • I tried that. but I get this error: init: cannot execve('/system/etc/init_remove.sh'): Permission denied because the whole filesystem is read only. I would have to do a remount manually – Eric Reyna Jan 24 '17 at 20:11
  • Some progress...please see my updated edit above – Eric Reyna Jan 26 '17 at 16:10
0

You don't even need to pull into your computer You only need to use chmod 755 myscript And voila, that's all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.