From fc6e0cce6ff1a79da56f6f048956e91e0147043a Mon Sep 17 00:00:00 2001
From: Kurt Partridge <kep@google.com>
Date: Thu, 23 Aug 2012 20:49:07 -0700
Subject: [PATCH] [Rlog19] ResearchLog remove unnecessary logSegment{start,end}

Change-Id: I73b7765c764e5f1035f1c37df45345f26aa5acb1
---
 java/src/com/android/inputmethod/research/LogBuffer.java      | 4 ++++
 java/src/com/android/inputmethod/research/ResearchLogger.java | 1 +
 2 files changed, 5 insertions(+)

diff --git a/java/src/com/android/inputmethod/research/LogBuffer.java b/java/src/com/android/inputmethod/research/LogBuffer.java
index ae7b1579a9..a3c3e89de4 100644
--- a/java/src/com/android/inputmethod/research/LogBuffer.java
+++ b/java/src/com/android/inputmethod/research/LogBuffer.java
@@ -110,4 +110,8 @@ public class LogBuffer {
         }
         return logUnit;
     }
+
+    public boolean isEmpty() {
+        return mLogUnits.isEmpty();
+    }
 }
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java
index 151190ad5a..bf7e78ad7c 100644
--- a/java/src/com/android/inputmethod/research/ResearchLogger.java
+++ b/java/src/com/android/inputmethod/research/ResearchLogger.java
@@ -701,6 +701,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
     /* package for test */ void publishLogBuffer(final LogBuffer logBuffer,
             final ResearchLog researchLog, final boolean isIncludingPrivateData) {
         final LogUnit openingLogUnit = new LogUnit();
+        if (logBuffer.isEmpty()) return;
         openingLogUnit.addLogStatement(LOGSTATEMENT_LOG_SEGMENT_OPENING, SystemClock.uptimeMillis(),
                 isIncludingPrivateData);
         researchLog.publish(openingLogUnit, true /* isIncludingPrivateData */);
-- 
GitLab