记录自己学习android系统启动以及 recovery过程(3)----------factory data reset -> reboot

本文详细介绍了Android系统中执行factory data reset到reboot的过程,涉及Settings.java、MasterClear.java、PowerManagerService及kernel层面的重启机制。在reboot过程中,uboot会检查/cache/recovery文件,根据条件进入recovery模式,区别于正常系统启动的挂载与根目录处理。
摘要由CSDN通过智能技术生成

记录自己学习android系统启动以及 recovery过程(3)----------factory data reset -> reboot

如有不对,请指正,谢谢

在android系统中,依次执行:setting->privacy->factory data reset->reset phone->erase everything后,系统进入重启,并启动recovery。

下面是我锻炼英语的时候写的,英语语法很简单,而且应该还有错误,但是步骤很清楚

各个步骤如下:

1.      setting->privacy

          Calling onCreate function in packages/apps/Settings/src/com/android/settings/Settings.javawill display setting dialog, the dialog mode is decided by the xml file named packages/apps/settings/res/xml/settings.xml.

          The content about privacy is as thefollowing:

        <!-- Privacy -->

        <com.android.settings.IconPreferenceScreen
            settings:icon="@drawable/ic_settings_privacy"
            android:title="@string/privacy_settings"
            android:key="privacy_settings">
            <intent
                android:action="android.intent.action.MAIN"
                android:targetPackage="com.android.settings"
                android:targetClass="com.android.settings.PrivacySettings" />
        </com.android.settings.IconPreferenceScreen>
            From that we kown while the button is clicked, the targetClass PrivacySettingswill run!!

            Get in packages/apps/Settings/src/com/android/settings/PrivateSettings.java!

2.      Privacy->factorydata reset         

3.      Factorydata reset->reset phone

           2 and 3 is Similarly to the step1.

           Get in packages/apps/Settings/src/com/android/settings/MasterClear.java!

4.      Reset phone->reboot

          This step is complex, asfollowing:

          a) In MasterClear.java file,

                       there is a ClickListener to sendout an intent named MASTER_CLEAR while not include erase SD card. The code is:

    /**
     * The user has gone through the multiple confirmation, so now we go ahead
     * and invoke the Checkin Service to reset the device to its factory-default
     * state (rebooting in the process).
     */
    private Button.OnClickListener mFinalClickListener = new Button.OnClickListener() {
            public void onClick(View v) {
                if (Utils.isMonkeyRunning()) {
                    return;
                }

                if (mExternalStorage.isChecked()) {
                    Intent intent = new Intent(ExternalStorageFormatter.FORMAT_AND_FACTORY_RESET);
                    intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME);
                    startService(intent);
                } else {
                    sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
                    // Intent handling is asynchronous -- assume it will happen soon.
                }
            }
        };
</
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值