Move SysUI boot-complete event earlier

Replace Intent.ACTION_BOOT_COMPLETED receiver with
Intent.ACTION_LOCKED_BOOT_COMPLETED.

This makes the timings of the onBootCompleted() callback more
predictable.

Previously, onBootCompleted() was typically called after the system user
unlocked (e.g. the primary user has entered their PIN). However, there
were edge-cases where it could be called earlier. For example, to
support secondary users we also checked the sysprop sys.boot_completed
during startup. This meant that if SysUI crashed, onBootCompleted()
could be called before the system is unlocked.

Test: manual
Bug: 259474752
Change-Id: I06e61f77f723308f9a82b4756a4c71092e1f308c
This commit is contained in:
Peter Kalauskas
2022-11-17 08:17:25 -08:00
parent d16866aaf3
commit c4f57dbd3b

View File

@@ -115,7 +115,8 @@ public class SystemUIApplication extends Application implements
setTheme(R.style.Theme_SystemUI);
if (Process.myUserHandle().equals(UserHandle.SYSTEM)) {
IntentFilter bootCompletedFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
IntentFilter bootCompletedFilter = new
IntentFilter(Intent.ACTION_LOCKED_BOOT_COMPLETED);
bootCompletedFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
// If SF GPU context priority is set to realtime, then SysUI should run at high.