Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6e0a1cf authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Automerger Merge Worker
Browse files

Merge changes from topics "log-intent-flags", "priority-procstate" into...

Merge changes from topics "log-intent-flags", "priority-procstate" into udc-dev am: dc0a6563 am: 95f66c39

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23561700



Change-Id: I55cd922550256539ab80de4d19a409896d6965da
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b00fe326 95f66c39
Loading
Loading
Loading
Loading
+10 −6
Original line number Original line Diff line number Diff line
@@ -269,7 +269,7 @@ public class BroadcastQueueImpl extends BroadcastQueue {
                                Activity.RESULT_CANCELED, null, null,
                                Activity.RESULT_CANCELED, null, null,
                                false, false, oldRecord.shareIdentity, oldRecord.userId,
                                false, false, oldRecord.shareIdentity, oldRecord.userId,
                                oldRecord.callingUid, r.callingUid, r.callerPackage,
                                oldRecord.callingUid, r.callingUid, r.callerPackage,
                                SystemClock.uptimeMillis() - oldRecord.enqueueTime, 0);
                                SystemClock.uptimeMillis() - oldRecord.enqueueTime, 0, 0);
                    } catch (RemoteException e) {
                    } catch (RemoteException e) {
                        Slog.w(TAG, "Failure ["
                        Slog.w(TAG, "Failure ["
                                + mQueueName + "] sending broadcast result of "
                                + mQueueName + "] sending broadcast result of "
@@ -617,7 +617,10 @@ public class BroadcastQueueImpl extends BroadcastQueue {
                    r.curApp.info.packageName,
                    r.curApp.info.packageName,
                    r.callerPackage,
                    r.callerPackage,
                    r.calculateTypeForLogging(),
                    r.calculateTypeForLogging(),
                    r.getDeliveryGroupPolicy());
                    r.getDeliveryGroupPolicy(),
                    r.intent.getFlags(),
                    BroadcastRecord.getReceiverPriority(curReceiver),
                    r.callerProcState);
        }
        }
        if (state == BroadcastRecord.IDLE) {
        if (state == BroadcastRecord.IDLE) {
            Slog.w(TAG_BROADCAST, "finishReceiver [" + mQueueName + "] called but state is 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,
            Intent intent, int resultCode, String data, Bundle extras,
            boolean ordered, boolean sticky, boolean shareIdentity, int sendingUser,
            boolean ordered, boolean sticky, boolean shareIdentity, int sendingUser,
            int receiverUid, int callingUid, String callingPackage,
            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
        // If the broadcaster opted-in to sharing their identity, then expose package visibility for
        // the receiver.
        // the receiver.
        if (shareIdentity) {
        if (shareIdentity) {
@@ -798,7 +801,8 @@ public class BroadcastQueueImpl extends BroadcastQueue {
                    dispatchDelay, receiveDelay, 0 /* finish_delay */,
                    dispatchDelay, receiveDelay, 0 /* finish_delay */,
                    SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL,
                    SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL,
                    app != null ? app.info.packageName : null, callingPackage,
                    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,
                        r.resultExtras, r.ordered, r.initialSticky, r.shareIdentity, r.userId,
                        filter.receiverList.uid, r.callingUid, r.callerPackage,
                        filter.receiverList.uid, r.callingUid, r.callerPackage,
                        r.dispatchTime - r.enqueueTime,
                        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
                // parallel broadcasts are fire-and-forget, not bookended by a call to
                // finishReceiverLocked(), so we manage their activity-start token here
                // finishReceiverLocked(), so we manage their activity-start token here
                if (filter.receiverList.app != null
                if (filter.receiverList.app != null
@@ -1170,7 +1174,7 @@ public class BroadcastQueueImpl extends BroadcastQueue {
                                    r.resultData, r.resultExtras, false, false, r.shareIdentity,
                                    r.resultData, r.resultExtras, false, false, r.shareIdentity,
                                    r.userId, r.callingUid, r.callingUid, r.callerPackage,
                                    r.userId, r.callingUid, r.callingUid, r.callerPackage,
                                    r.dispatchTime - r.enqueueTime,
                                    r.dispatchTime - r.enqueueTime,
                                    now - r.dispatchTime);
                                    now - r.dispatchTime, 0);
                            logBootCompletedBroadcastCompletionLatencyIfPossible(r);
                            logBootCompletedBroadcastCompletionLatencyIfPossible(r);
                            // Set this to null so that the reference
                            // Set this to null so that the reference
                            // (local and remote) isn't kept in the mBroadcastHistory.
                            // (local and remote) isn't kept in the mBroadcastHistory.
+2 −1
Original line number Original line Diff line number Diff line
@@ -1933,7 +1933,8 @@ class BroadcastQueueModernImpl extends BroadcastQueue {
            FrameworkStatsLog.write(BROADCAST_DELIVERY_EVENT_REPORTED, uid, senderUid, actionName,
            FrameworkStatsLog.write(BROADCAST_DELIVERY_EVENT_REPORTED, uid, senderUid, actionName,
                    receiverType, type, dispatchDelay, receiveDelay, finishDelay, packageState,
                    receiverType, type, dispatchDelay, receiveDelay, finishDelay, packageState,
                    app != null ? app.info.packageName : null, r.callerPackage,
                    app != null ? app.info.packageName : null, r.callerPackage,
                    r.calculateTypeForLogging(), r.getDeliveryGroupPolicy());
                    r.calculateTypeForLogging(), r.getDeliveryGroupPolicy(), r.intent.getFlags(),
                    BroadcastRecord.getReceiverPriority(receiver), r.callerProcState);
        }
        }
    }
    }


+6 −0
Original line number Original line Diff line number Diff line
@@ -44,6 +44,8 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.annotation.UptimeMillisLong;
import android.annotation.UptimeMillisLong;
import android.app.ActivityManager;
import android.app.ActivityManager.ProcessState;
import android.app.ActivityManagerInternal;
import android.app.ActivityManagerInternal;
import android.app.AppOpsManager;
import android.app.AppOpsManager;
import android.app.BackgroundStartPrivileges;
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 @Nullable String callerFeatureId; // which feature in the package sent this
    final int callingPid;   // the pid of who sent this
    final int callingPid;   // the pid of who sent this
    final int callingUid;   // the uid 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;
    final int originalStickyCallingUid;
            // if this is a sticky broadcast, the Uid of the original sender
            // if this is a sticky broadcast, the Uid of the original sender
@@ -462,6 +465,8 @@ final class BroadcastRecord extends Binder {
        callerFeatureId = _callerFeatureId;
        callerFeatureId = _callerFeatureId;
        callingPid = _callingPid;
        callingPid = _callingPid;
        callingUid = _callingUid;
        callingUid = _callingUid;
        callerProcState = callerApp == null ? ActivityManager.PROCESS_STATE_UNKNOWN
                : callerApp.getCurProcState();
        callerInstantApp = _callerInstantApp;
        callerInstantApp = _callerInstantApp;
        callerInstrumented = isCallerInstrumented(_callerApp, _callingUid);
        callerInstrumented = isCallerInstrumented(_callerApp, _callingUid);
        resolvedType = _resolvedType;
        resolvedType = _resolvedType;
@@ -515,6 +520,7 @@ final class BroadcastRecord extends Binder {
        callerFeatureId = from.callerFeatureId;
        callerFeatureId = from.callerFeatureId;
        callingPid = from.callingPid;
        callingPid = from.callingPid;
        callingUid = from.callingUid;
        callingUid = from.callingUid;
        callerProcState = from.callerProcState;
        callerInstantApp = from.callerInstantApp;
        callerInstantApp = from.callerInstantApp;
        callerInstrumented = from.callerInstrumented;
        callerInstrumented = from.callerInstrumented;
        ordered = from.ordered;
        ordered = from.ordered;
+5 −0
Original line number Original line Diff line number Diff line
@@ -669,6 +669,11 @@ class ProcessRecord implements WindowProcessListener {
        return mOnewayThread;
        return mOnewayThread;
    }
    }


    @GuardedBy(anyOf = {"mService", "mProcLock"})
    int getCurProcState() {
        return mState.getCurProcState();
    }

    @GuardedBy({"mService", "mProcLock"})
    @GuardedBy({"mService", "mProcLock"})
    public void makeActive(IApplicationThread thread, ProcessStatsService tracker) {
    public void makeActive(IApplicationThread thread, ProcessStatsService tracker) {
        mProfile.onProcessActive(thread, tracker);
        mProfile.onProcessActive(thread, tracker);
+1 −1
Original line number Original line Diff line number Diff line
@@ -1407,7 +1407,7 @@ public final class BroadcastQueueModernImplTest {
                eq(BROADCAST_DELIVERY_EVENT_REPORTED__RECEIVER_TYPE__MANIFEST),
                eq(BROADCAST_DELIVERY_EVENT_REPORTED__RECEIVER_TYPE__MANIFEST),
                eq(BROADCAST_DELIVERY_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_COLD),
                eq(BROADCAST_DELIVERY_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_COLD),
                anyLong(), anyLong(), anyLong(), anyInt(), nullable(String.class),
                anyLong(), anyLong(), anyLong(), anyInt(), nullable(String.class),
                anyString(), anyInt(), anyInt()),
                anyString(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt()),
                times(1));
                times(1));
    }
    }