Merge "Revert "Block adb from changing certain settings value when corresponding user""
diff --git a/core/java/android/net/metrics/NetworkMetrics.java b/core/java/android/net/metrics/NetworkMetrics.java
index 2425bba..66d92c4 100644
--- a/core/java/android/net/metrics/NetworkMetrics.java
+++ b/core/java/android/net/metrics/NetworkMetrics.java
@@ -98,6 +98,9 @@
 
     /** Accumulate a single netd sock_diag poll result reported by netd. */
     public void addTcpStatsResult(int sent, int lost, int rttUs, int sentAckDiffMs) {
+        if (pendingSummary == null) {
+            pendingSummary = new Summary(netId, transports);
+        }
         pendingSummary.tcpLossRate.count(lost, sent);
         pendingSummary.roundTripTimeUs.count(rttUs);
         pendingSummary.sentAckTimeDiffenceMs.count(sentAckDiffMs);
diff --git a/services/accessibility/java/com/android/server/accessibility/TouchExplorer.java b/services/accessibility/java/com/android/server/accessibility/TouchExplorer.java
index 3419b80..84a8d45 100644
--- a/services/accessibility/java/com/android/server/accessibility/TouchExplorer.java
+++ b/services/accessibility/java/com/android/server/accessibility/TouchExplorer.java
@@ -21,7 +21,6 @@
 import android.os.Handler;
 import android.util.Slog;
 import android.view.InputDevice;
-import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.MotionEvent.PointerCoords;
 import android.view.MotionEvent.PointerProperties;
@@ -296,7 +295,8 @@
                 // Already handled.
             } break;
             default:
-                throw new IllegalStateException("Illegal state: " + mCurrentState);
+                Slog.e(LOG_TAG, "Illegal state: " + mCurrentState);
+                clear(event, policyFlags);
         }
     }
 
@@ -649,8 +649,10 @@
         }
         switch (event.getActionMasked()) {
             case MotionEvent.ACTION_DOWN: {
-                throw new IllegalStateException("Dragging state can be reached only if two "
+                Slog.e(LOG_TAG, "Dragging state can be reached only if two "
                         + "pointers are already down");
+                clear(event, policyFlags);
+                return;
             }
             case MotionEvent.ACTION_POINTER_DOWN: {
                 // We are in dragging state so we have two pointers and another one
@@ -741,8 +743,10 @@
     private void handleMotionEventStateDelegating(MotionEvent event, int policyFlags) {
         switch (event.getActionMasked()) {
             case MotionEvent.ACTION_DOWN: {
-                throw new IllegalStateException("Delegating state can only be reached if "
+                Slog.e(LOG_TAG, "Delegating state can only be reached if "
                         + "there is at least one pointer down!");
+                clear(event, policyFlags);
+                return;
             }
             case MotionEvent.ACTION_UP: {
                 // Offset the event if we are doing a long press as the
@@ -1093,7 +1097,7 @@
             case STATE_GESTURE_DETECTING:
                 return "STATE_GESTURE_DETECTING";
             default:
-                throw new IllegalArgumentException("Unknown state: " + state);
+                return "Unknown state: " + state;
         }
     }