Add usage stats entries about how many times keyboard are expanded/folded

This CL introduces a pair of new usage stats entries so that we can know how many times the keyboard are expanded/folded on Android.

No visible change is intended.

BUG=none
TEST=compile

git-svn-id: https://mozc.googlecode.com/svn/trunk@446 a6090854-d499-a067-5803-1114d4e51264
diff --git a/src/android/src/com/google/android/inputmethod/japanese/MozcService.java b/src/android/src/com/google/android/inputmethod/japanese/MozcService.java
index c7e7686..0cfa18e 100644
--- a/src/android/src/com/google/android/inputmethod/japanese/MozcService.java
+++ b/src/android/src/com/google/android/inputmethod/japanese/MozcService.java
@@ -60,6 +60,7 @@
 import org.mozc.android.inputmethod.japanese.protobuf.ProtoCommands.Request.SpaceOnAlphanumeric;
 import org.mozc.android.inputmethod.japanese.protobuf.ProtoCommands.Request.SpecialRomanjiTable;
 import org.mozc.android.inputmethod.japanese.protobuf.ProtoCommands.SessionCommand;
+import org.mozc.android.inputmethod.japanese.protobuf.ProtoCommands.SessionCommand.UsageStatsEvent;
 import org.mozc.android.inputmethod.japanese.protobuf.ProtoConfig.Config;
 import org.mozc.android.inputmethod.japanese.protobuf.ProtoConfig.Config.SelectionShortcut;
 import org.mozc.android.inputmethod.japanese.protobuf.ProtoConfig.Config.SessionKeymap;
@@ -281,6 +282,11 @@
     @Override
     public void onFireFeedbackEvent(FeedbackEvent event) {
       feedbackManager.fireFeedback(event);
+      if (event.equals(FeedbackEvent.INPUTVIEW_EXPAND)) {
+        sessionExecutor.sendUsageStatsEvent(UsageStatsEvent.KEYBOARD_EXPAND_EVENT);
+      } else if (event.equals(FeedbackEvent.INPUTVIEW_FOLD)) {
+        sessionExecutor.sendUsageStatsEvent(UsageStatsEvent.KEYBOARD_FOLD_EVENT);
+      }
     }
 
     @Override
diff --git a/src/android/src/com/google/android/inputmethod/japanese/session/SessionExecutor.java b/src/android/src/com/google/android/inputmethod/japanese/session/SessionExecutor.java
index 07f0352..bfee8be 100644
--- a/src/android/src/com/google/android/inputmethod/japanese/session/SessionExecutor.java
+++ b/src/android/src/com/google/android/inputmethod/japanese/session/SessionExecutor.java
@@ -743,13 +743,7 @@
       default:
         event = UsageStatsEvent.SUBMITTED_CANDIDATE_ROW_GE10;
     }
-    evaluateAsynchronously(
-        Input.newBuilder()
-        .setType(CommandType.SEND_COMMAND)
-        .setCommand(SessionCommand.newBuilder()
-            .setType(SessionCommand.CommandType.USAGE_STATS_EVENT)
-            .setUsageStatsEvent(event)),
-        null, null);
+    sendUsageStatsEvent(event);
   }
   /**
    * Sends {@code RESET_CONTEXT} command to the server asynchronously.
@@ -1000,4 +994,14 @@
         triggeringKeyEvent, callback, callbackHandler);
     handler.sendMessage(handler.obtainMessage(ExecutorMainCallback.PASS_TO_CALLBACK, context));
   }
+
+  public void sendUsageStatsEvent(UsageStatsEvent event) {
+    evaluateAsynchronously(
+        Input.newBuilder()
+        .setType(CommandType.SEND_COMMAND)
+        .setCommand(SessionCommand.newBuilder()
+            .setType(SessionCommand.CommandType.USAGE_STATS_EVENT)
+            .setUsageStatsEvent(event)),
+        null, null);
+  }
 }
diff --git a/src/data/usage_stats/stats.def b/src/data/usage_stats/stats.def
index f1d2f4f..d3e0bd7 100644
--- a/src/data/usage_stats/stats.def
+++ b/src/data/usage_stats/stats.def
@@ -538,6 +538,9 @@
 SubmittedCandidateRow8
 SubmittedCandidateRow9
 SubmittedCandidateRowGE10
+# The count of the fold/expand keyboard event.
+KeyboardFoldEvent
+KeyboardExpandEvent
 
 # for windows
 
diff --git a/src/mozc_version_template.txt b/src/mozc_version_template.txt
index 9a523c5..34b2191 100644
--- a/src/mozc_version_template.txt
+++ b/src/mozc_version_template.txt
@@ -1,6 +1,6 @@
 MAJOR=2
 MINOR=16
-BUILD=1985
+BUILD=1986
 REVISION=102
 # NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
 # downloaded by NaCl Mozc.
diff --git a/src/session/commands.proto b/src/session/commands.proto
index ea6727f..869b284 100644
--- a/src/session/commands.proto
+++ b/src/session/commands.proto
@@ -479,6 +479,8 @@
     SUBMITTED_CANDIDATE_ROW_8 = 17;
     SUBMITTED_CANDIDATE_ROW_9 = 18;
     SUBMITTED_CANDIDATE_ROW_GE10 = 19;
+    KEYBOARD_FOLD_EVENT = 20;
+    KEYBOARD_EXPAND_EVENT = 21;
   }
   optional UsageStatsEvent usage_stats_event = 7;
   optional int32 usage_stats_event_int_value = 9;
diff --git a/src/session/session_usage_observer.cc b/src/session/session_usage_observer.cc
index 3a2dfc3..859bb92 100644
--- a/src/session/session_usage_observer.cc
+++ b/src/session/session_usage_observer.cc
@@ -361,6 +361,12 @@
     case commands::SessionCommand::SUBMITTED_CANDIDATE_ROW_GE10:
       UsageStats::IncrementCount("SubmittedCandidateRowGE10");
       break;
+    case commands::SessionCommand::KEYBOARD_FOLD_EVENT:
+      UsageStats::IncrementCount("KeyboardFoldEvent");
+      break;
+    case commands::SessionCommand::KEYBOARD_EXPAND_EVENT:
+      UsageStats::IncrementCount("KeyboardExpandEvent");
+      break;
     default:
       LOG(WARNING) << "client side usage stats event has invalid category";
       break;