Merge "Don\'t deliver broadcast to apps that are being backed up" into nyc-dev
am: fc2a7ce7ac
* commit 'fc2a7ce7acc5ede8b26f35819c8287df1fed135c':
Don't deliver broadcast to apps that are being backed up
Change-Id: I531ddd28dd24ff567814cb455059ca9ddb24f145
This commit is contained in:
@@ -16863,6 +16863,13 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the app is a regular app (uid >= 10000) and not the system server or phone
|
||||||
|
// process, etc, then mark it as being in full backup so that certain calls to the
|
||||||
|
// process can be blocked. This is not reset to false anywhere because we kill the
|
||||||
|
// process after the full backup is done and the ProcessRecord will vaporize anyway.
|
||||||
|
if (UserHandle.isApp(app.uid) && backupMode == IApplicationThread.BACKUP_MODE_FULL) {
|
||||||
|
proc.inFullBackup = true;
|
||||||
|
}
|
||||||
r.app = proc;
|
r.app = proc;
|
||||||
mBackupTarget = r;
|
mBackupTarget = r;
|
||||||
mBackupAppName = app.packageName;
|
mBackupAppName = app.packageName;
|
||||||
|
|||||||
@@ -258,6 +258,11 @@ public final class BroadcastQueue {
|
|||||||
if (app.thread == null) {
|
if (app.thread == null) {
|
||||||
throw new RemoteException();
|
throw new RemoteException();
|
||||||
}
|
}
|
||||||
|
if (app.inFullBackup) {
|
||||||
|
skipReceiverLocked(r);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
r.receiver = app.thread.asBinder();
|
r.receiver = app.thread.asBinder();
|
||||||
r.curApp = app;
|
r.curApp = app;
|
||||||
app.curReceiver = r;
|
app.curReceiver = r;
|
||||||
@@ -341,13 +346,17 @@ public final class BroadcastQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
logBroadcastReceiverDiscardLocked(r);
|
skipReceiverLocked(r);
|
||||||
finishReceiverLocked(r, r.resultCode, r.resultData,
|
|
||||||
r.resultExtras, r.resultAbort, false);
|
|
||||||
scheduleBroadcastsLocked();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void skipReceiverLocked(BroadcastRecord r) {
|
||||||
|
logBroadcastReceiverDiscardLocked(r);
|
||||||
|
finishReceiverLocked(r, r.resultCode, r.resultData,
|
||||||
|
r.resultExtras, r.resultAbort, false);
|
||||||
|
scheduleBroadcastsLocked();
|
||||||
|
}
|
||||||
|
|
||||||
public void scheduleBroadcastsLocked() {
|
public void scheduleBroadcastsLocked() {
|
||||||
if (DEBUG_BROADCAST) Slog.v(TAG_BROADCAST, "Schedule broadcasts ["
|
if (DEBUG_BROADCAST) Slog.v(TAG_BROADCAST, "Schedule broadcasts ["
|
||||||
+ mQueueName + "]: current="
|
+ mQueueName + "]: current="
|
||||||
@@ -641,9 +650,17 @@ public final class BroadcastQueue {
|
|||||||
try {
|
try {
|
||||||
if (DEBUG_BROADCAST_LIGHT) Slog.i(TAG_BROADCAST,
|
if (DEBUG_BROADCAST_LIGHT) Slog.i(TAG_BROADCAST,
|
||||||
"Delivering to " + filter + " : " + r);
|
"Delivering to " + filter + " : " + r);
|
||||||
performReceiveLocked(filter.receiverList.app, filter.receiverList.receiver,
|
if (filter.receiverList.app != null && filter.receiverList.app.inFullBackup) {
|
||||||
new Intent(r.intent), r.resultCode, r.resultData,
|
// Skip delivery if full backup in progress
|
||||||
r.resultExtras, r.ordered, r.initialSticky, r.userId);
|
// If it's an ordered broadcast, we need to continue to the next receiver.
|
||||||
|
if (ordered) {
|
||||||
|
skipReceiverLocked(r);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
performReceiveLocked(filter.receiverList.app, filter.receiverList.receiver,
|
||||||
|
new Intent(r.intent), r.resultCode, r.resultData,
|
||||||
|
r.resultExtras, r.ordered, r.initialSticky, r.userId);
|
||||||
|
}
|
||||||
if (ordered) {
|
if (ordered) {
|
||||||
r.state = BroadcastRecord.CALL_DONE_RECEIVE;
|
r.state = BroadcastRecord.CALL_DONE_RECEIVE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,6 +192,9 @@ final class ProcessRecord {
|
|||||||
// app that installed the package.
|
// app that installed the package.
|
||||||
ComponentName errorReportReceiver;
|
ComponentName errorReportReceiver;
|
||||||
|
|
||||||
|
// Process is currently hosting a backup agent for backup or restore
|
||||||
|
public boolean inFullBackup;
|
||||||
|
|
||||||
void dump(PrintWriter pw, String prefix) {
|
void dump(PrintWriter pw, String prefix) {
|
||||||
final long now = SystemClock.uptimeMillis();
|
final long now = SystemClock.uptimeMillis();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user