Disabling android services in init.rc

11,881

Solution 1

Assuming that you have sucessfully booted, then you can shutdown the android framework with this command:

setprop vold.decrypt trigger_shutdown_framework

This command was implemented as part of the encryption system in Honeycomb. It will shutdown all but the core native sevices:

  • init
  • adbd - so that you can still adb shell into the phone
  • servicemanager - Which handles the native (not android) serivces
  • ueventd

You can restart the android framework with the command:

setprop vold.decrypt trigger_restart_framework

Obviously you must be root to do this.

Solution 2

I searched a lot, and came to a particular solution to disable the Android services which might work, there is a init.rc file in Android source code

./system/core/rootdir/init.rc

this init.rc file describes the system services, file system and other parameters that need to be set up. As init process is the first process which get executed after the kernel loaded,the init process looks for this init.rc script file and then parsed it and launch the system service processes.

There is a service called Zygote (dalvic VM) used to initialise the SystemServer.java,the first java component to run in the system,which contains declarations for all the Android services.

service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server class main
socket zygote stream 660 root system
onrestart write /sys/android_power/request_state wake
onrestart write /sys/power/state on
onrestart restart media
onrestart restart netd

the android services are declared in run() method of SystemServer.java.The path for the file is
/frameworks/base/services/java/com/android/server/SystemServer.java

If we comment out the zygote,the android services might not initialized.I haven't tested it due to some panic in kernel booting but hope it will be the solution.:)

Share:
11,881
rk_P
Author by

rk_P

Updated on June 12, 2022

Comments

  • rk_P
    rk_P almost 2 years

    I am working on a new hardware platform on which i need to flash Android OS.. For initial testing i need to stop all the Android services are there in android init.rc file. I searched for the init.rc file in my code base ./bootable/diskinstaller/init.rc ./bootable/recovery/etc/init.rc ./system/core/rootdir/init.rc , I need to know about how to identify the android services in the init.rc ?.I am thinking of disabling the android dalvik VM. to stop all the android related services is it good to stop the dalvic VM or just disabling all the services one by one? Thanks!