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

Commit eee372ca authored by Siim Sammul's avatar Siim Sammul Committed by Automerger Merge Worker
Browse files

Merge "Fix process source propagation for binder calls stats settings so that...

Merge "Fix process source propagation for binder calls stats settings so that it is correctly reported in the pushed atom BinderLatencyReported." into sc-dev am: fc7b3733 am: c7a7ae12

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

Change-Id: Ie8b2cc257a57abab980c32eba5604835ea2f3ac5
parents db102b41 c7a7ae12
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -1196,15 +1196,12 @@ public class BinderCallsStats implements BinderInternal.Observer {
        private final Context mContext;
        private final KeyValueListParser mParser = new KeyValueListParser(',');
        private final BinderCallsStats mBinderCallsStats;
        private final int mProcessSource;

        public SettingsObserver(Context context, BinderCallsStats binderCallsStats,
                    int processSource) {
        public SettingsObserver(Context context, BinderCallsStats binderCallsStats) {
            super(BackgroundThread.getHandler());
            mContext = context;
            context.getContentResolver().registerContentObserver(mUri, false, this);
            mBinderCallsStats = binderCallsStats;
            mProcessSource = processSource;
            // Always kick once to ensure that we match current state
            onChange();
        }
+5 −0
Original line number Diff line number Diff line
@@ -370,4 +370,9 @@ public class BinderLatencyObserver {
    public Runnable getStatsdPushRunnable() {
        return mLatencyObserverRunnable;
    }

    @VisibleForTesting
    public int getProcessSource() {
        return mProcessSource;
    }
}
+34 −0
Original line number Diff line number Diff line
@@ -991,6 +991,40 @@ public class BinderCallsStatsTest {
        assertEquals(true, bcs.getCollectLatencyData());
    }

    @Test
    public void testProcessSource() {
        BinderCallsStats defaultCallsStats = new BinderCallsStats(
                new BinderCallsStats.Injector());

        BinderCallsStats systemServerCallsStats = new BinderCallsStats(
                new BinderCallsStats.Injector(),
                com.android.internal.os.BinderLatencyProto.Dims.SYSTEM_SERVER);

        BinderCallsStats telephonyCallsStats = new BinderCallsStats(
                new BinderCallsStats.Injector(),
                com.android.internal.os.BinderLatencyProto.Dims.TELEPHONY);

        BinderCallsStats bluetoothCallsStats = new BinderCallsStats(
                new BinderCallsStats.Injector(),
                com.android.internal.os.BinderLatencyProto.Dims.BLUETOOTH);

        assertEquals(
                com.android.internal.os.BinderLatencyProto.Dims.SYSTEM_SERVER,
                defaultCallsStats.getLatencyObserver().getProcessSource());

        assertEquals(
                com.android.internal.os.BinderLatencyProto.Dims.SYSTEM_SERVER,
                systemServerCallsStats.getLatencyObserver().getProcessSource());

        assertEquals(
                com.android.internal.os.BinderLatencyProto.Dims.TELEPHONY,
                telephonyCallsStats.getLatencyObserver().getProcessSource());

        assertEquals(
                com.android.internal.os.BinderLatencyProto.Dims.BLUETOOTH,
                bluetoothCallsStats.getLatencyObserver().getProcessSource());
    }

    private static class TestHandler extends Handler {
        ArrayList<Runnable> mRunnables = new ArrayList<>();