Merge "Referencing static interpolators.	"
diff --git a/api/current.txt b/api/current.txt
index 537ae8a..3260d4c 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -6319,7 +6319,6 @@
   public static class NetworkStats.Bucket {
     ctor public NetworkStats.Bucket();
     method public long getEndTimeStamp();
-    method public int getMetering();
     method public int getRoaming();
     method public long getRxBytes();
     method public long getRxPackets();
@@ -6328,9 +6327,6 @@
     method public long getTxBytes();
     method public long getTxPackets();
     method public int getUid();
-    field public static final int METERING_ALL = -1; // 0xffffffff
-    field public static final int METERING_DEFAULT = 1; // 0x1
-    field public static final int METERING_METERED = 2; // 0x2
     field public static final int ROAMING_ALL = -1; // 0xffffffff
     field public static final int ROAMING_DEFAULT = 1; // 0x1
     field public static final int ROAMING_ROAMING = 2; // 0x2
@@ -22993,7 +22989,7 @@
     method public void stopRecording();
   }
 
-  public class TvRecordingClient.RecordingCallback {
+  public static abstract class TvRecordingClient.RecordingCallback {
     ctor public TvRecordingClient.RecordingCallback();
     method public void onConnected();
     method public void onDisconnected();
diff --git a/api/system-current.txt b/api/system-current.txt
index 1091ff1..ef6506d 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -6576,7 +6576,6 @@
   public static class NetworkStats.Bucket {
     ctor public NetworkStats.Bucket();
     method public long getEndTimeStamp();
-    method public int getMetering();
     method public int getRoaming();
     method public long getRxBytes();
     method public long getRxPackets();
@@ -6585,9 +6584,6 @@
     method public long getTxBytes();
     method public long getTxPackets();
     method public int getUid();
-    field public static final int METERING_ALL = -1; // 0xffffffff
-    field public static final int METERING_DEFAULT = 1; // 0x1
-    field public static final int METERING_METERED = 2; // 0x2
     field public static final int ROAMING_ALL = -1; // 0xffffffff
     field public static final int ROAMING_DEFAULT = 1; // 0x1
     field public static final int ROAMING_ROAMING = 2; // 0x2
@@ -24520,7 +24516,7 @@
     method public void stopRecording();
   }
 
-  public class TvRecordingClient.RecordingCallback {
+  public static abstract class TvRecordingClient.RecordingCallback {
     ctor public TvRecordingClient.RecordingCallback();
     method public void onConnected();
     method public void onDisconnected();
diff --git a/api/test-current.txt b/api/test-current.txt
index 09a9cca..db1ca19 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -6321,7 +6321,6 @@
   public static class NetworkStats.Bucket {
     ctor public NetworkStats.Bucket();
     method public long getEndTimeStamp();
-    method public int getMetering();
     method public int getRoaming();
     method public long getRxBytes();
     method public long getRxPackets();
@@ -6330,9 +6329,6 @@
     method public long getTxBytes();
     method public long getTxPackets();
     method public int getUid();
-    field public static final int METERING_ALL = -1; // 0xffffffff
-    field public static final int METERING_DEFAULT = 1; // 0x1
-    field public static final int METERING_METERED = 2; // 0x2
     field public static final int ROAMING_ALL = -1; // 0xffffffff
     field public static final int ROAMING_DEFAULT = 1; // 0x1
     field public static final int ROAMING_ROAMING = 2; // 0x2
@@ -23002,7 +22998,7 @@
     method public void stopRecording();
   }
 
-  public class TvRecordingClient.RecordingCallback {
+  public static abstract class TvRecordingClient.RecordingCallback {
     ctor public TvRecordingClient.RecordingCallback();
     method public void onConnected();
     method public void onDisconnected();
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 100e67b..99c275c 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -4660,6 +4660,16 @@
         }
     }
 
+    /**
+     * Public entrypoint to stop profiling. This is required to end profiling when the app crashes,
+     * so that profiler data won't be lost.
+     *
+     * @hide
+     */
+    public void stopProfiling() {
+        mProfiler.stopProfiling();
+    }
+
     static final void handleDumpHeap(boolean managed, DumpHeapData dhd) {
         if (managed) {
             try {
diff --git a/core/java/android/app/usage/NetworkStats.java b/core/java/android/app/usage/NetworkStats.java
index d263646..5622207 100644
--- a/core/java/android/app/usage/NetworkStats.java
+++ b/core/java/android/app/usage/NetworkStats.java
@@ -151,21 +151,6 @@
         public static final int UID_TETHERING = TrafficStats.UID_TETHERING;
 
         /**
-         * Combined usage across all metering states.
-         */
-        public static final int METERING_ALL = -1;
-
-        /**
-         * Usage not accounted for in any other metering state.
-         */
-        public static final int METERING_DEFAULT = 0x1;
-
-        /**
-         * Metered usage.
-         */
-        public static final int METERING_METERED = 0x2;
-
-        /**
          * Combined usage across all roaming states.
          */
         public static final int ROAMING_ALL = -1;
@@ -182,7 +167,6 @@
 
         private int mUid;
         private int mState;
-        private int mMetering;
         private int mRoaming;
         private long mBeginTimeStamp;
         private long mEndTimeStamp;
@@ -247,18 +231,6 @@
         }
 
         /**
-         * Metering state. One of the following values:<p/>
-         * <ul>
-         * <li>{@link #METERING_ALL}</li>
-         * <li>{@link #METERING_DEFAULT}</li>
-         * <li>{@link #METERING_METERED}</li>
-         * </ul>
-         */
-        public int getMetering() {
-            return mMetering;
-        }
-
-        /**
          * Roaming state. One of the following values:<p/>
          * <ul>
          * <li>{@link #ROAMING_ALL}</li>
@@ -463,8 +435,6 @@
     private void fillBucketFromSummaryEntry(Bucket bucketOut) {
         bucketOut.mUid = Bucket.convertUid(mRecycledSummaryEntry.uid);
         bucketOut.mState = Bucket.convertState(mRecycledSummaryEntry.set);
-        // TODO: Implement metering tracking.
-        bucketOut.mMetering = Bucket.METERING_ALL;
         bucketOut.mRoaming = Bucket.convertRoaming(mRecycledSummaryEntry.roaming);
         bucketOut.mBeginTimeStamp = mStartTimeStamp;
         bucketOut.mEndTimeStamp = mEndTimeStamp;
@@ -512,7 +482,6 @@
                         mRecycledHistoryEntry);
                 bucketOut.mUid = Bucket.convertUid(getUid());
                 bucketOut.mState = Bucket.STATE_ALL;
-                bucketOut.mMetering = Bucket.METERING_ALL;
                 bucketOut.mRoaming = Bucket.ROAMING_ALL;
                 bucketOut.mBeginTimeStamp = mRecycledHistoryEntry.bucketStart;
                 bucketOut.mEndTimeStamp = mRecycledHistoryEntry.bucketStart +
diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java
index f81658e..3b8b7cb 100644
--- a/core/java/com/android/internal/os/RuntimeInit.java
+++ b/core/java/com/android/internal/os/RuntimeInit.java
@@ -86,6 +86,13 @@
                     Clog_e(TAG, message.toString(), e);
                 }
 
+                // Try to end profiling. If a profiler is running at this point, and we kill the
+                // process (below), the in-memory buffer will be lost. So try to stop, which will
+                // flush the buffer. (This makes method trace profiling useful to debug crashes.)
+                if (ActivityThread.currentActivityThread() != null) {
+                    ActivityThread.currentActivityThread().stopProfiling();
+                }
+
                 // Bring up crash dialog, wait for it to be dismissed
                 ActivityManagerNative.getDefault().handleApplicationCrash(
                         mApplicationObject, new ApplicationErrorReport.CrashInfo(e));
diff --git a/media/java/android/media/tv/TvRecordingClient.java b/media/java/android/media/tv/TvRecordingClient.java
index 865e000..73f1e32 100644
--- a/media/java/android/media/tv/TvRecordingClient.java
+++ b/media/java/android/media/tv/TvRecordingClient.java
@@ -184,7 +184,7 @@
      * Callback used to receive various status updates on the
      * {@link android.media.tv.TvInputService.RecordingSession}
      */
-    public class RecordingCallback {
+    public abstract static class RecordingCallback {
         /**
          * This is called when a recording session initiated by a call to
          * {@link #connect(String, Uri)} has been established.
diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
index bce7223..4d66e10 100644
--- a/services/core/java/com/android/server/pm/PackageDexOptimizer.java
+++ b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
@@ -70,8 +70,7 @@
     }
 
     static boolean canOptimizePackage(PackageParser.Package pkg) {
-        return pkg.canHaveOatDir() &&
-                ((pkg.applicationInfo.flags & ApplicationInfo.FLAG_HAS_CODE) != 0);
+        return (pkg.applicationInfo.flags & ApplicationInfo.FLAG_HAS_CODE) != 0;
     }
 
     /**