Android RescueParty

RescueParty简介

检测persistent app的crash, 添加于2017年。Google对此的说明是
Utilities to help rescue the system from crash loops. Callers are expected to report boot events and persistent app crashes, and if they happen frequently enough this class will slowly escalate through several rescue operations before finally rebooting and prompting the user if they want to wipe data as a last resort.

分成5个level

level_none = 0
level_reset_settings_untrusted_defaults
level_reset_settings_untrusted_changes
level_reset_settings_trusted_defaults
level_factory_reset = 4

不同rescueLevel的处理

void executeRescueLevelInternal()
1 - level_reset_settings_untrusted_defaults
resetAllSettings(reset_mode_untrusted_defaults)
2 - level_reset_settings_untrusted_changes
resetAllSettings(reset_mode_untrusted_changes)
3 - level_reset_settings_trusted_defaults
resetAllSettings(reset_mode_trusted_defaults)
4 - level_factory_reset
RecoverySystem.rebootPromptAndWipeUserData(context, TAG)
到这里就直接重启到factory reset界面

如何禁用RescueParty

如下条件满足其一即可

  • persist.sys.enable_rescue = false
  • persist.sys.disable_rescue = true
  • Build.IS_ENG
  • Build.IS_USERDEBUG && isUsbActive() # 连上usb adb