Loading src/com/android/settings/core/instrumentation/SettingsIntelligenceLogWriter.java +14 −4 Original line number Diff line number Diff line Loading @@ -128,15 +128,20 @@ public class SettingsIntelligenceLogWriter implements LogWriter { mLogHandler.post(() -> { mSettingsLogList.add(settingsLog); }); if (action == SettingsEnums.ACTION_CONTEXTUAL_CARD_DISMISS) { // Directly send this event to notify SI instantly that the card is dismissed mLogHandler.sendLog(); } else { mLogHandler.scheduleSendLog(); } } @VisibleForTesting static byte[] serialize(List<SettingsLog> settingsLogs) { final int size = settingsLogs.size(); final ByteArrayOutputStream bout = new ByteArrayOutputStream(); final DataOutputStream output = new DataOutputStream(bout); // Data is "size, length, bytearray, length, bytearray ..." // The data format is "size, length, byte array, length, byte array ..." try { output.writeInt(size); for (SettingsLog settingsLog : settingsLogs) { Loading @@ -159,14 +164,19 @@ public class SettingsIntelligenceLogWriter implements LogWriter { private class SendLogHandler extends Handler { public SendLogHandler(Looper looper) { SendLogHandler(Looper looper) { super(looper); } public void scheduleSendLog() { void scheduleSendLog() { removeCallbacks(mSendLogsRunnable); postDelayed(mSendLogsRunnable, MESSAGE_DELAY); } void sendLog() { removeCallbacks(mSendLogsRunnable); post(mSendLogsRunnable); } } private final Runnable mSendLogsRunnable = () -> { Loading Loading
src/com/android/settings/core/instrumentation/SettingsIntelligenceLogWriter.java +14 −4 Original line number Diff line number Diff line Loading @@ -128,15 +128,20 @@ public class SettingsIntelligenceLogWriter implements LogWriter { mLogHandler.post(() -> { mSettingsLogList.add(settingsLog); }); if (action == SettingsEnums.ACTION_CONTEXTUAL_CARD_DISMISS) { // Directly send this event to notify SI instantly that the card is dismissed mLogHandler.sendLog(); } else { mLogHandler.scheduleSendLog(); } } @VisibleForTesting static byte[] serialize(List<SettingsLog> settingsLogs) { final int size = settingsLogs.size(); final ByteArrayOutputStream bout = new ByteArrayOutputStream(); final DataOutputStream output = new DataOutputStream(bout); // Data is "size, length, bytearray, length, bytearray ..." // The data format is "size, length, byte array, length, byte array ..." try { output.writeInt(size); for (SettingsLog settingsLog : settingsLogs) { Loading @@ -159,14 +164,19 @@ public class SettingsIntelligenceLogWriter implements LogWriter { private class SendLogHandler extends Handler { public SendLogHandler(Looper looper) { SendLogHandler(Looper looper) { super(looper); } public void scheduleSendLog() { void scheduleSendLog() { removeCallbacks(mSendLogsRunnable); postDelayed(mSendLogsRunnable, MESSAGE_DELAY); } void sendLog() { removeCallbacks(mSendLogsRunnable); post(mSendLogsRunnable); } } private final Runnable mSendLogsRunnable = () -> { Loading