Android factory reset Flow

Source: Internet
Author: User

From: http://blog.csdn.net/yahoozhuo/article/details/6403140

===== Application process =====
====> Frameworks/base/services/Java/COM/Android/Server/masterclearjavaser. Java
Recoverysystem. rebootwipeuserdata (context );

====> Framesworks/base/CORE/Java/Android/OS/recoverysystem. Java
Rebootwipeuserdata ==> bootcommand (context, "-- wipe_data ");
After bootcommand writes the parameter "-- wipe_data" to/Cache/recovery/command,
Call pm. Reboot ("recovery ");

====> Frameworks/base/CORE/Java/Android/OS/power. Java
Reboot ==> rebootnative

====> Frameworks/base/CORE/JNI/android_ OS _power.cpp
JNI ing
{"Rebootnative", "(ljava/lang/string;) V", (void *) android_ OS _power_reboot },
Android_ OS _power_reboot ==>__ reboot

====> Bionic/libc/arch-arm/syscils/_ reboot. s
LDR R7, =__ nr_reboot // bionic/libc/include/sys/linux-syscalls.h
B _ set_syscall_errno

# DEFINE _ nr_reboot (_ nr_syscall_base + 88)

===== Kernel process =====
====> Kernel/ARCH/ARM/kernel/CILS. s
/* 88 */call (sys_reboot)

Http://blog.csdn.net/yahoozhuo/article/details/6403140

====> Kernel/sys. c
Sys_reboot is defined in kernel/include/Linux/syscils. H, and is implemented in kernel/sys. c

Here, determine the buffer content and use a register to record whether it is the recovery mode, so that the boot loader can query it.
Sys_reboot will call kernel_restart
Kernel_restart calls each Schema-specific machine_restart, that is, machine_restart executes each Schema-specific function.

====> Kernel/ARCH/ARM/kernel/process. c
Machine_restart ==> arm_pm_restart ==> arm_machine_restart ==> arch_reset

====> Kernel/ARCH/ARM/Mach-tegra/include/Mach/system. h
Arch_reset

===== Bootloader process ====
Restart the machine and re-enter the bootloader. Bootloader first reads the register content and determines whether to enter the recovery mode or other mode based on this value.
Bootloader then loads the recovery kernel.

===== Recovery application process ====
The init. RC in the recovery kernel runs the recovery

The recovery application reads cache, recovery, and command.
Read the parameter and perform the corresponding operation. Here the parameter is -- wipe_data, which is placed in cache/recovery/command.

After clearing data and cache, restart the system. At this time, the register parameter rb_autoboot written during kernel restart is different from the previous one.
Bionic/libc/include/sys/reboot. h
# Define rb_autoboot linux_reboot_assist_restart
The bootloader will not be started in recovery mode, but will be started normally.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.