Always initialize local boolean variables when possible

It's currently possible to reference deviceModeChanged in InputReader
while it's in an unknown state. Change the style of initialization
here and a few other places to better prevent this type of error.

Bug: 11433748
Change-Id: Ib332406aefb7cdb16b6a21e00dceaeca34679853
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index feed31c..03852a5 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -2135,12 +2135,11 @@
         }
     }
 
-    bool metaStateChanged = false;
     int32_t oldMetaState = mMetaState;
     int32_t newMetaState = updateMetaState(keyCode, down, oldMetaState);
-    if (oldMetaState != newMetaState) {
+    bool metaStateChanged = oldMetaState != newMetaState;
+    if (metaStateChanged) {
         mMetaState = newMetaState;
-        metaStateChanged = true;
         updateLedState(false);
     }
 
@@ -2932,7 +2931,6 @@
     int32_t rawHeight = mRawPointerAxes.y.maxValue - mRawPointerAxes.y.minValue + 1;
 
     // Get associated display dimensions.
-    bool viewportChanged = false;
     DisplayViewport newViewport;
     if (mParameters.hasAssociatedDisplay) {
         if (!mConfig.getDisplayInfo(mParameters.associatedDisplayIsExternal, &newViewport)) {
@@ -2946,9 +2944,9 @@
     } else {
         newViewport.setNonDisplayViewport(rawWidth, rawHeight);
     }
-    if (mViewport != newViewport) {
+    bool viewportChanged = mViewport != newViewport;
+    if (viewportChanged) {
         mViewport = newViewport;
-        viewportChanged = true;
 
         if (mDeviceMode == DEVICE_MODE_DIRECT || mDeviceMode == DEVICE_MODE_POINTER) {
             // Convert rotated viewport to natural surface coordinates.
@@ -3017,9 +3015,8 @@
     }
 
     // If moving between pointer modes, need to reset some state.
-    bool deviceModeChanged;
-    if (mDeviceMode != oldDeviceMode) {
-        deviceModeChanged = true;
+    bool deviceModeChanged = mDeviceMode != oldDeviceMode;
+    if (deviceModeChanged) {
         mOrientedRanges.clear();
     }