AlarmManagerService: Fix FWR before boot completed

Root cause: AlarmManagerService send broadcast of TIMEZONE_CHANGED
before boot completed lead to IllegalStateException in AMS and system
skip StartWindowManagerService, and finally got crashed.
Modification: add flag Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT.

Change-Id: Iab9cd5acfeabd114371a8aaaa406a4a1c5919f98
Merged-In: Iab9cd5acfeabd114371a8aaaa406a4a1c5919f98
Test: Monkey
Bug: 79550062

(Cherrypick for R)

Change-Id: I802b90c55946cfac0f64cb69072588b0acb03cc2
This commit is contained in:
jianzhou
2018-05-11 14:47:12 +08:00
committed by Christopher Tate
parent 680c708af1
commit acce5e4a64

View File

@@ -1670,6 +1670,7 @@ class AlarmManagerService extends SystemService {
Intent intent = new Intent(Intent.ACTION_TIMEZONE_CHANGED);
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING
| Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND
| Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
| Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS);
intent.putExtra("time-zone", zone.getID());
getContext().sendBroadcastAsUser(intent, UserHandle.ALL);