Merge "Fix process source propagation for binder calls stats settings so that it is correctly reported in the pushed atom BinderLatencyReported."
This commit is contained in:
@@ -930,15 +930,12 @@ public class BinderCallsStats implements BinderInternal.Observer {
|
|||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final KeyValueListParser mParser = new KeyValueListParser(',');
|
private final KeyValueListParser mParser = new KeyValueListParser(',');
|
||||||
private final BinderCallsStats mBinderCallsStats;
|
private final BinderCallsStats mBinderCallsStats;
|
||||||
private final int mProcessSource;
|
|
||||||
|
|
||||||
public SettingsObserver(Context context, BinderCallsStats binderCallsStats,
|
public SettingsObserver(Context context, BinderCallsStats binderCallsStats) {
|
||||||
int processSource) {
|
|
||||||
super(BackgroundThread.getHandler());
|
super(BackgroundThread.getHandler());
|
||||||
mContext = context;
|
mContext = context;
|
||||||
context.getContentResolver().registerContentObserver(mUri, false, this);
|
context.getContentResolver().registerContentObserver(mUri, false, this);
|
||||||
mBinderCallsStats = binderCallsStats;
|
mBinderCallsStats = binderCallsStats;
|
||||||
mProcessSource = processSource;
|
|
||||||
// Always kick once to ensure that we match current state
|
// Always kick once to ensure that we match current state
|
||||||
onChange();
|
onChange();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -332,4 +332,9 @@ public class BinderLatencyObserver {
|
|||||||
public Runnable getStatsdPushRunnable() {
|
public Runnable getStatsdPushRunnable() {
|
||||||
return mLatencyObserverRunnable;
|
return mLatencyObserverRunnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public int getProcessSource() {
|
||||||
|
return mProcessSource;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -835,6 +835,40 @@ public class BinderCallsStatsTest {
|
|||||||
assertEquals(0, bcs.getLatencyObserver().getLatencyHistograms().size());
|
assertEquals(0, bcs.getLatencyObserver().getLatencyHistograms().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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 {
|
private static class TestHandler extends Handler {
|
||||||
ArrayList<Runnable> mRunnables = new ArrayList<>();
|
ArrayList<Runnable> mRunnables = new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user