Merge "Correct sequencing of widget vs boot-complete broadcasts" into qt-dev
am: 335dfdec1e
Change-Id: I31bd10f7b3b90cc7f8cab6817f13cc694f8a4d47
This commit is contained in:
@@ -725,6 +725,14 @@ public class BroadcastDispatcher {
|
|||||||
final Dumper dumper = new Dumper(pw, queueName, dumpPackage, sdf);
|
final Dumper dumper = new Dumper(pw, queueName, dumpPackage, sdf);
|
||||||
boolean printed = false;
|
boolean printed = false;
|
||||||
|
|
||||||
|
dumper.setHeading("Currently in flight");
|
||||||
|
dumper.setLabel("In-Flight Ordered Broadcast");
|
||||||
|
if (mCurrentBroadcast != null) {
|
||||||
|
dumper.dump(mCurrentBroadcast);
|
||||||
|
} else {
|
||||||
|
pw.println(" (null)");
|
||||||
|
}
|
||||||
|
|
||||||
dumper.setHeading("Active ordered broadcasts");
|
dumper.setHeading("Active ordered broadcasts");
|
||||||
dumper.setLabel("Active Ordered Broadcast");
|
dumper.setLabel("Active Ordered Broadcast");
|
||||||
for (Deferrals d : mAlarmBroadcasts) {
|
for (Deferrals d : mAlarmBroadcasts) {
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ class UserController implements Handler.Callback {
|
|||||||
// Spin up app widgets prior to boot-complete, so they can be ready promptly
|
// Spin up app widgets prior to boot-complete, so they can be ready promptly
|
||||||
mInjector.startUserWidgets(userId);
|
mInjector.startUserWidgets(userId);
|
||||||
|
|
||||||
Slog.i(TAG, "Sending BOOT_COMPLETE user #" + userId);
|
Slog.i(TAG, "Posting BOOT_COMPLETED user #" + userId);
|
||||||
// Do not report secondary users, runtime restarts or first boot/upgrade
|
// Do not report secondary users, runtime restarts or first boot/upgrade
|
||||||
if (userId == UserHandle.USER_SYSTEM
|
if (userId == UserHandle.USER_SYSTEM
|
||||||
&& !mInjector.isRuntimeRestarted() && !mInjector.isFirstBootOrUpgrade()) {
|
&& !mInjector.isRuntimeRestarted() && !mInjector.isFirstBootOrUpgrade()) {
|
||||||
@@ -572,18 +572,26 @@ class UserController implements Handler.Callback {
|
|||||||
bootIntent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT
|
bootIntent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT
|
||||||
| Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND
|
| Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND
|
||||||
| Intent.FLAG_RECEIVER_OFFLOAD);
|
| Intent.FLAG_RECEIVER_OFFLOAD);
|
||||||
mInjector.broadcastIntent(bootIntent, null, new IIntentReceiver.Stub() {
|
// Widget broadcasts are outbound via FgThread, so to guarantee sequencing
|
||||||
@Override
|
// we also send the boot_completed broadcast from that thread.
|
||||||
public void performReceive(Intent intent, int resultCode, String data,
|
final int callingUid = Binder.getCallingUid();
|
||||||
Bundle extras, boolean ordered, boolean sticky, int sendingUser)
|
final int callingPid = Binder.getCallingPid();
|
||||||
throws RemoteException {
|
FgThread.getHandler().post(() -> {
|
||||||
Slog.i(UserController.TAG, "Finished processing BOOT_COMPLETED for u" + userId);
|
mInjector.broadcastIntent(bootIntent, null,
|
||||||
mBootCompleted = true;
|
new IIntentReceiver.Stub() {
|
||||||
}
|
@Override
|
||||||
}, 0, null, null,
|
public void performReceive(Intent intent, int resultCode, String data,
|
||||||
new String[]{android.Manifest.permission.RECEIVE_BOOT_COMPLETED},
|
Bundle extras, boolean ordered, boolean sticky, int sendingUser)
|
||||||
AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID,
|
throws RemoteException {
|
||||||
Binder.getCallingUid(), Binder.getCallingPid(), userId);
|
Slog.i(UserController.TAG, "Finished processing BOOT_COMPLETED for u"
|
||||||
|
+ userId);
|
||||||
|
mBootCompleted = true;
|
||||||
|
}
|
||||||
|
}, 0, null, null,
|
||||||
|
new String[]{android.Manifest.permission.RECEIVE_BOOT_COMPLETED},
|
||||||
|
AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID,
|
||||||
|
callingUid, callingPid, userId);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
int restartUser(final int userId, final boolean foreground) {
|
int restartUser(final int userId, final boolean foreground) {
|
||||||
|
|||||||
Reference in New Issue
Block a user