summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/am/BroadcastQueueImpl.java16
-rw-r--r--services/core/java/com/android/server/am/BroadcastQueueModernImpl.java3
-rw-r--r--services/core/java/com/android/server/am/BroadcastRecord.java6
-rw-r--r--services/core/java/com/android/server/am/ProcessRecord.java5
-rw-r--r--services/tests/mockingservicestests/src/com/android/server/am/BroadcastQueueModernImplTest.java2
5 files changed, 24 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/am/BroadcastQueueImpl.java b/services/core/java/com/android/server/am/BroadcastQueueImpl.java
index c6165cd3220e..8688f25ba002 100644
--- a/services/core/java/com/android/server/am/BroadcastQueueImpl.java
+++ b/services/core/java/com/android/server/am/BroadcastQueueImpl.java
@@ -269,7 +269,7 @@ public class BroadcastQueueImpl extends BroadcastQueue {
Activity.RESULT_CANCELED, null, null,
false, false, oldRecord.shareIdentity, oldRecord.userId,
oldRecord.callingUid, r.callingUid, r.callerPackage,
- SystemClock.uptimeMillis() - oldRecord.enqueueTime, 0);
+ SystemClock.uptimeMillis() - oldRecord.enqueueTime, 0, 0);
} catch (RemoteException e) {
Slog.w(TAG, "Failure ["
+ mQueueName + "] sending broadcast result of "
@@ -617,7 +617,10 @@ public class BroadcastQueueImpl extends BroadcastQueue {
r.curApp.info.packageName,
r.callerPackage,
r.calculateTypeForLogging(),
- r.getDeliveryGroupPolicy());
+ r.getDeliveryGroupPolicy(),
+ r.intent.getFlags(),
+ BroadcastRecord.getReceiverPriority(curReceiver),
+ r.callerProcState);
}
if (state == BroadcastRecord.IDLE) {
Slog.w(TAG_BROADCAST, "finishReceiver [" + mQueueName + "] called but state is IDLE");
@@ -748,7 +751,7 @@ public class BroadcastQueueImpl extends BroadcastQueue {
Intent intent, int resultCode, String data, Bundle extras,
boolean ordered, boolean sticky, boolean shareIdentity, int sendingUser,
int receiverUid, int callingUid, String callingPackage,
- long dispatchDelay, long receiveDelay) throws RemoteException {
+ long dispatchDelay, long receiveDelay, int priority) throws RemoteException {
// If the broadcaster opted-in to sharing their identity, then expose package visibility for
// the receiver.
if (shareIdentity) {
@@ -798,7 +801,8 @@ public class BroadcastQueueImpl extends BroadcastQueue {
dispatchDelay, receiveDelay, 0 /* finish_delay */,
SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL,
app != null ? app.info.packageName : null, callingPackage,
- r.calculateTypeForLogging(), r.getDeliveryGroupPolicy());
+ r.calculateTypeForLogging(), r.getDeliveryGroupPolicy(), r.intent.getFlags(),
+ priority, r.callerProcState);
}
}
@@ -879,7 +883,7 @@ public class BroadcastQueueImpl extends BroadcastQueue {
r.resultExtras, r.ordered, r.initialSticky, r.shareIdentity, r.userId,
filter.receiverList.uid, r.callingUid, r.callerPackage,
r.dispatchTime - r.enqueueTime,
- r.receiverTime - r.dispatchTime);
+ r.receiverTime - r.dispatchTime, filter.getPriority());
// parallel broadcasts are fire-and-forget, not bookended by a call to
// finishReceiverLocked(), so we manage their activity-start token here
if (filter.receiverList.app != null
@@ -1170,7 +1174,7 @@ public class BroadcastQueueImpl extends BroadcastQueue {
r.resultData, r.resultExtras, false, false, r.shareIdentity,
r.userId, r.callingUid, r.callingUid, r.callerPackage,
r.dispatchTime - r.enqueueTime,
- now - r.dispatchTime);
+ now - r.dispatchTime, 0);
logBootCompletedBroadcastCompletionLatencyIfPossible(r);
// Set this to null so that the reference
// (local and remote) isn't kept in the mBroadcastHistory.
diff --git a/services/core/java/com/android/server/am/BroadcastQueueModernImpl.java b/services/core/java/com/android/server/am/BroadcastQueueModernImpl.java
index 93fb91ab8cdd..8380308812d5 100644
--- a/services/core/java/com/android/server/am/BroadcastQueueModernImpl.java
+++ b/services/core/java/com/android/server/am/BroadcastQueueModernImpl.java
@@ -1933,7 +1933,8 @@ class BroadcastQueueModernImpl extends BroadcastQueue {
FrameworkStatsLog.write(BROADCAST_DELIVERY_EVENT_REPORTED, uid, senderUid, actionName,
receiverType, type, dispatchDelay, receiveDelay, finishDelay, packageState,
app != null ? app.info.packageName : null, r.callerPackage,
- r.calculateTypeForLogging(), r.getDeliveryGroupPolicy());
+ r.calculateTypeForLogging(), r.getDeliveryGroupPolicy(), r.intent.getFlags(),
+ BroadcastRecord.getReceiverPriority(receiver), r.callerProcState);
}
}
diff --git a/services/core/java/com/android/server/am/BroadcastRecord.java b/services/core/java/com/android/server/am/BroadcastRecord.java
index cfdb13393e80..67d43fd30bad 100644
--- a/services/core/java/com/android/server/am/BroadcastRecord.java
+++ b/services/core/java/com/android/server/am/BroadcastRecord.java
@@ -44,6 +44,8 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UptimeMillisLong;
+import android.app.ActivityManager;
+import android.app.ActivityManager.ProcessState;
import android.app.ActivityManagerInternal;
import android.app.AppOpsManager;
import android.app.BackgroundStartPrivileges;
@@ -93,6 +95,7 @@ final class BroadcastRecord extends Binder {
final @Nullable String callerFeatureId; // which feature in the package sent this
final int callingPid; // the pid of who sent this
final int callingUid; // the uid of who sent this
+ final @ProcessState int callerProcState; // Procstate of the caller process at enqueue time.
final int originalStickyCallingUid;
// if this is a sticky broadcast, the Uid of the original sender
@@ -462,6 +465,8 @@ final class BroadcastRecord extends Binder {
callerFeatureId = _callerFeatureId;
callingPid = _callingPid;
callingUid = _callingUid;
+ callerProcState = callerApp == null ? ActivityManager.PROCESS_STATE_UNKNOWN
+ : callerApp.getCurProcState();
callerInstantApp = _callerInstantApp;
callerInstrumented = isCallerInstrumented(_callerApp, _callingUid);
resolvedType = _resolvedType;
@@ -515,6 +520,7 @@ final class BroadcastRecord extends Binder {
callerFeatureId = from.callerFeatureId;
callingPid = from.callingPid;
callingUid = from.callingUid;
+ callerProcState = from.callerProcState;
callerInstantApp = from.callerInstantApp;
callerInstrumented = from.callerInstrumented;
ordered = from.ordered;
diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java
index d6495c78574c..267d2464e0d5 100644
--- a/services/core/java/com/android/server/am/ProcessRecord.java
+++ b/services/core/java/com/android/server/am/ProcessRecord.java
@@ -669,6 +669,11 @@ class ProcessRecord implements WindowProcessListener {
return mOnewayThread;
}
+ @GuardedBy(anyOf = {"mService", "mProcLock"})
+ int getCurProcState() {
+ return mState.getCurProcState();
+ }
+
@GuardedBy({"mService", "mProcLock"})
public void makeActive(IApplicationThread thread, ProcessStatsService tracker) {
mProfile.onProcessActive(thread, tracker);
diff --git a/services/tests/mockingservicestests/src/com/android/server/am/BroadcastQueueModernImplTest.java b/services/tests/mockingservicestests/src/com/android/server/am/BroadcastQueueModernImplTest.java
index 948687ae1645..582685cf009e 100644
--- a/services/tests/mockingservicestests/src/com/android/server/am/BroadcastQueueModernImplTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/am/BroadcastQueueModernImplTest.java
@@ -1407,7 +1407,7 @@ public final class BroadcastQueueModernImplTest {
eq(BROADCAST_DELIVERY_EVENT_REPORTED__RECEIVER_TYPE__MANIFEST),
eq(BROADCAST_DELIVERY_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_COLD),
anyLong(), anyLong(), anyLong(), anyInt(), nullable(String.class),
- anyString(), anyInt(), anyInt()),
+ anyString(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt()),
times(1));
}