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

Commit ff66f329 authored by Felipe Leme's avatar Felipe Leme
Browse files

Added number of receivers to ReceiverListProto.

Also added checks for null app on ReceiverList.

Bug: 226224551
Test: adb shell dumpsys activity --proto broadcasts receivers --uid 1000 > ~/tmp/proto.pb && \
  cd $ANDROID_BUILD_TOP && \
  printproto --proto frameworks/base/core/proto/android/server/activitymanagerservice.proto --message com.android.server.am.ActivityManagerServiceDumpBroadcastsProto --raw_protocol_buffer ~/tmp/proto.pb

Change-Id: I2ef27878a416fb388a7516ad88803f4965c36525
parent 1d56918a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ message ReceiverListProto {
    repeated BroadcastFilterProto filters = 7;
    // Used to find this ReceiverList object in IntentResolver
    optional string hex_hash = 8;
    optional int32 number_receivers = 9;
}

message ProcessRecordProto {
+7 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.am;

import android.annotation.Nullable;
import android.content.IIntentReceiver;
import android.content.IntentFilter;
import android.os.Binder;
@@ -37,7 +38,7 @@ final class ReceiverList extends ArrayList<BroadcastFilter>
        implements IBinder.DeathRecipient {
    final ActivityManagerService owner;
    public final IIntentReceiver receiver;
    public final ProcessRecord app;
    public final @Nullable ProcessRecord app;
    public final int pid;
    public final int uid;
    public final int userId;
@@ -46,7 +47,7 @@ final class ReceiverList extends ArrayList<BroadcastFilter>

    String stringName;

    ReceiverList(ActivityManagerService _owner, ProcessRecord _app,
    ReceiverList(ActivityManagerService _owner, @Nullable ProcessRecord _app,
            int _pid, int _uid, int _userId, IIntentReceiver _receiver) {
        owner = _owner;
        receiver = _receiver;
@@ -82,7 +83,10 @@ final class ReceiverList extends ArrayList<BroadcastFilter>

    void dumpDebug(ProtoOutputStream proto, long fieldId) {
        long token = proto.start(fieldId);
        if (app != null) {
            app.dumpDebug(proto, ReceiverListProto.APP);
            proto.write(ReceiverListProto.NUMBER_RECEIVERS, app.mReceivers.numberOfReceivers());
        }
        proto.write(ReceiverListProto.PID, pid);
        proto.write(ReceiverListProto.UID, uid);
        proto.write(ReceiverListProto.USER, userId);