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

Commit a792fea0 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

BroadcastQueue: mark dump methods @NeverCompile.

Per docs on the annotation, dump-related code should be marked with
this annotation to save odex space.

Bug: 245771249
Test: atest FrameworksMockingServicesTests:BroadcastRecordTest
Test: atest FrameworksMockingServicesTests:BroadcastQueueTest
Test: atest FrameworksMockingServicesTests:BroadcastQueueModernImplTest
Change-Id: I30471e5c2bffda4871734a67d07dff6b127a356f
parent 09f25fac
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -10689,6 +10689,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
    }
    @NeverCompile
    void dumpBroadcastsLocked(FileDescriptor fd, PrintWriter pw, String[] args,
            int opti, boolean dumpAll, String dumpPackage) {
        boolean needSep = false;
@@ -10833,6 +10834,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
    }
    @NeverCompile
    void dumpBroadcastStatsLocked(FileDescriptor fd, PrintWriter pw, String[] args,
            int opti, boolean dumpAll, String dumpPackage) {
        if (mCurBroadcastStats == null) {
@@ -10866,6 +10868,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
    }
    @NeverCompile
    void dumpBroadcastStatsCheckinLocked(FileDescriptor fd, PrintWriter pw, String[] args,
            int opti, boolean fullCheckin, String dumpPackage) {
        if (mCurBroadcastStats == null) {
+3 −0
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ import android.util.KeyValueListParser;
import android.util.Slog;
import android.util.TimeUtils;

import dalvik.annotation.optimization.NeverCompile;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@@ -321,6 +323,7 @@ public class BroadcastConstants {
    /**
     * Standard dumpsys support; invoked from BroadcastQueue dump
     */
    @NeverCompile
    public void dump(@NonNull IndentingPrintWriter pw) {
        synchronized (this) {
            pw.print("Broadcast parameters (key=");
+10 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.server.AlarmManagerInternal;
import com.android.server.LocalServices;

import dalvik.annotation.optimization.NeverCompile;

import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -82,12 +84,14 @@ public class BroadcastDispatcher {
            return broadcasts.isEmpty();
        }

        @NeverCompile
        void dumpDebug(ProtoOutputStream proto, long fieldId) {
            for (BroadcastRecord br : broadcasts) {
                br.dumpDebug(proto, fieldId);
            }
        }

        @NeverCompile
        void dumpLocked(Dumper d) {
            for (BroadcastRecord br : broadcasts) {
                d.dump(br);
@@ -145,6 +149,7 @@ public class BroadcastDispatcher {
            return mPrinted;
        }

        @NeverCompile
        void dump(BroadcastRecord br) {
            if (mDumpPackage == null || mDumpPackage.equals(br.callerPackage)) {
                if (!mPrinted) {
@@ -424,6 +429,7 @@ public class BroadcastDispatcher {
            return size;
        }

        @NeverCompile
        public void dump(Dumper dumper, String action) {
            SparseArray<BroadcastRecord> brs = getDeferredList(action);
            if (brs == null) {
@@ -434,6 +440,7 @@ public class BroadcastDispatcher {
            }
        }

        @NeverCompile
        public void dumpDebug(ProtoOutputStream proto, long fieldId) {
            for (int i = 0, size = mDeferredLockedBootCompletedBroadcasts.size(); i < size; i++) {
                mDeferredLockedBootCompletedBroadcasts.valueAt(i).dumpDebug(proto, fieldId);
@@ -443,6 +450,7 @@ public class BroadcastDispatcher {
            }
        }

        @NeverCompile
        private void dumpBootCompletedBroadcastRecord(SparseArray<BroadcastRecord> brs) {
            for (int i = 0, size = brs.size(); i < size; i++) {
                final Object receiver = brs.valueAt(i).receivers.get(0);
@@ -840,6 +848,7 @@ public class BroadcastDispatcher {
    /**
     * Standard proto dump entry point
     */
    @NeverCompile
    public void dumpDebug(ProtoOutputStream proto, long fieldId) {
        if (mCurrentBroadcast != null) {
            mCurrentBroadcast.dumpDebug(proto, fieldId);
@@ -1167,6 +1176,7 @@ public class BroadcastDispatcher {

    // ----------------------------------

    @NeverCompile
    boolean dumpLocked(PrintWriter pw, String dumpPackage, String queueName,
            SimpleDateFormat sdf) {
        final Dumper dumper = new Dumper(pw, queueName, dumpPackage, sdf);
+7 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ import android.util.PrintWriterPrinter;
import android.util.Printer;
import android.util.proto.ProtoOutputStream;

import dalvik.annotation.optimization.NeverCompile;

import java.io.PrintWriter;

final class BroadcastFilter extends IntentFilter {
@@ -53,6 +55,7 @@ final class BroadcastFilter extends IntentFilter {
        exported = _exported;
    }

    @NeverCompile
    public void dumpDebug(ProtoOutputStream proto, long fieldId) {
        long token = proto.start(fieldId);
        super.dumpDebug(proto, BroadcastFilterProto.INTENT_FILTER);
@@ -64,20 +67,24 @@ final class BroadcastFilter extends IntentFilter {
        proto.end(token);
    }

    @NeverCompile
    public void dump(PrintWriter pw, String prefix) {
        dumpInReceiverList(pw, new PrintWriterPrinter(pw), prefix);
        receiverList.dumpLocal(pw, prefix);
    }

    @NeverCompile
    public void dumpBrief(PrintWriter pw, String prefix) {
        dumpBroadcastFilterState(pw, prefix);
    }

    @NeverCompile
    public void dumpInReceiverList(PrintWriter pw, Printer pr, String prefix) {
        super.dump(pr, prefix);
        dumpBroadcastFilterState(pw, prefix);
    }

    @NeverCompile
    void dumpBroadcastFilterState(PrintWriter pw, String prefix) {
        if (requiredPermission != null) {
            pw.print(prefix); pw.print("requiredPermission="); pw.println(requiredPermission);
+4 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import android.os.Bundle;
import android.util.TimeUtils;
import android.util.proto.ProtoOutputStream;

import dalvik.annotation.optimization.NeverCompile;

import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -90,6 +92,7 @@ public class BroadcastHistory {
        else return x;
    }

    @NeverCompile
    public void dumpDebug(ProtoOutputStream proto) {
        int lastIndex = mHistoryNext;
        int ringIndex = lastIndex;
@@ -123,6 +126,7 @@ public class BroadcastHistory {
        } while (ringIndex != lastIndex);
    }

    @NeverCompile
    public boolean dumpLocked(PrintWriter pw, String dumpPackage, String queueName,
            SimpleDateFormat sdf, boolean dumpAll, boolean needSep) {
        int i;
Loading