Is PackageManager.getComponentEnabledSettings() persistent between cold starts?

前端 未结 1 1097
余生分开走
余生分开走 2021-02-10 06:24

If I use the code below to disable a static BroadcastReceiver defined in AndroidManifest.xml, will it be re-enabled after a reboot? It doesn\'t appear to be but the docs don\'t

1条回答
  •  孤城傲影
    2021-02-10 06:33

    Is PackageManager.getComponentEnabledSettings() persistent between cold starts?

    Yes. It will be reset on an application uninstall/reinstall. It will be reset if you reset it yourself with setComponentEnabledSetting(). It'll be reset if something with superuser privileges resets it (e.g., the device might have some manager app for controlling ACTION_BOOT_COMPLETED). And I'm not sure what happens on an app upgrade, as I haven't tried that scenario. Otherwise, it should stay persistent.

    If I use the code below to disable a static BroadcastReceiver defined in AndroidManifest.xml, will it be re-enabled after a reboot?

    No.

    0 讨论(0)
提交回复
热议问题