记录自己学习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.
}
}
};
</