Merge "Add Connection.setAudioModeIsVoip"
diff --git a/api/current.txt b/api/current.txt
index 06b2cad..f597943 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -12354,6 +12354,7 @@
     method public T get(android.hardware.camera2.CameraCharacteristics.Key<T>);
     method public java.util.List<android.hardware.camera2.CaptureRequest.Key<?>> getAvailableCaptureRequestKeys();
     method public java.util.List<android.hardware.camera2.CaptureResult.Key<?>> getAvailableCaptureResultKeys();
+    field public static final android.hardware.camera2.CameraCharacteristics.Key COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES;
     field public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_AVAILABLE_ANTIBANDING_MODES;
     field public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_AVAILABLE_MODES;
     field public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES;
@@ -12426,17 +12427,10 @@
   }
 
   public abstract class CameraDevice implements java.lang.AutoCloseable {
-    method public abstract deprecated int capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
-    method public abstract deprecated int captureBurst(java.util.List<android.hardware.camera2.CaptureRequest>, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
     method public abstract void close();
-    method public abstract deprecated void configureOutputs(java.util.List<android.view.Surface>) throws android.hardware.camera2.CameraAccessException;
     method public abstract android.hardware.camera2.CaptureRequest.Builder createCaptureRequest(int) throws android.hardware.camera2.CameraAccessException;
     method public abstract void createCaptureSession(java.util.List<android.view.Surface>, android.hardware.camera2.CameraCaptureSession.StateListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
-    method public abstract deprecated void flush() throws android.hardware.camera2.CameraAccessException;
     method public abstract java.lang.String getId();
-    method public abstract deprecated int setRepeatingBurst(java.util.List<android.hardware.camera2.CaptureRequest>, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
-    method public abstract deprecated int setRepeatingRequest(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
-    method public abstract deprecated void stopRepeating() throws android.hardware.camera2.CameraAccessException;
     field public static final int TEMPLATE_MANUAL = 6; // 0x6
     field public static final int TEMPLATE_PREVIEW = 1; // 0x1
     field public static final int TEMPLATE_RECORD = 3; // 0x3
@@ -12445,26 +12439,12 @@
     field public static final int TEMPLATE_ZERO_SHUTTER_LAG = 5; // 0x5
   }
 
-  public static abstract deprecated class CameraDevice.CaptureListener {
-    ctor public CameraDevice.CaptureListener();
-    method public void onCaptureCompleted(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, android.hardware.camera2.TotalCaptureResult);
-    method public void onCaptureFailed(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, android.hardware.camera2.CaptureFailure);
-    method public void onCaptureProgressed(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, android.hardware.camera2.CaptureResult);
-    method public void onCaptureSequenceAborted(android.hardware.camera2.CameraDevice, int);
-    method public void onCaptureSequenceCompleted(android.hardware.camera2.CameraDevice, int, long);
-    method public void onCaptureStarted(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, long);
-  }
-
   public static abstract class CameraDevice.StateListener {
     ctor public CameraDevice.StateListener();
-    method public deprecated void onActive(android.hardware.camera2.CameraDevice);
-    method public deprecated void onBusy(android.hardware.camera2.CameraDevice);
     method public void onClosed(android.hardware.camera2.CameraDevice);
     method public abstract void onDisconnected(android.hardware.camera2.CameraDevice);
     method public abstract void onError(android.hardware.camera2.CameraDevice, int);
-    method public deprecated void onIdle(android.hardware.camera2.CameraDevice);
     method public abstract void onOpened(android.hardware.camera2.CameraDevice);
-    method public deprecated void onUnconfigured(android.hardware.camera2.CameraDevice);
     field public static final int ERROR_CAMERA_DEVICE = 4; // 0x4
     field public static final int ERROR_CAMERA_DISABLED = 3; // 0x3
     field public static final int ERROR_CAMERA_IN_USE = 1; // 0x1
@@ -12488,6 +12468,9 @@
 
   public abstract class CameraMetadata {
     method public java.util.List<TKey> getKeys();
+    field public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST = 1; // 0x1
+    field public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_HIGH_QUALITY = 2; // 0x2
+    field public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF = 0; // 0x0
     field public static final int COLOR_CORRECTION_MODE_FAST = 1; // 0x1
     field public static final int COLOR_CORRECTION_MODE_HIGH_QUALITY = 2; // 0x2
     field public static final int COLOR_CORRECTION_MODE_TRANSFORM_MATRIX = 0; // 0x0
@@ -12677,6 +12660,7 @@
     method public java.lang.Object getTag();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.hardware.camera2.CaptureRequest.Key BLACK_LEVEL_LOCK;
+    field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_ABERRATION_CORRECTION_MODE;
     field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_GAINS;
     field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_MODE;
     field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_TRANSFORM;
@@ -12748,6 +12732,7 @@
     method public android.hardware.camera2.CaptureRequest getRequest();
     method public int getSequenceId();
     field public static final android.hardware.camera2.CaptureResult.Key BLACK_LEVEL_LOCK;
+    field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_ABERRATION_CORRECTION_MODE;
     field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_GAINS;
     field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_MODE;
     field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_TRANSFORM;
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java
index f85a7dc..a435fba 100644
--- a/cmds/pm/src/com/android/commands/pm/Pm.java
+++ b/cmds/pm/src/com/android/commands/pm/Pm.java
@@ -21,7 +21,6 @@
 import android.app.IActivityManager;
 import android.content.ComponentName;
 import android.content.pm.ApplicationInfo;
-import android.content.pm.ContainerEncryptionParams;
 import android.content.pm.FeatureInfo;
 import android.content.pm.IPackageDataObserver;
 import android.content.pm.IPackageDeleteObserver;
@@ -48,24 +47,19 @@
 import android.os.UserHandle;
 import android.os.UserManager;
 
+import com.android.internal.content.PackageHelper;
+import com.android.internal.util.ArrayUtils;
+
 import java.io.File;
 import java.io.FileDescriptor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
-import java.security.InvalidAlgorithmParameterException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 import java.util.WeakHashMap;
 
-import javax.crypto.SecretKey;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.SecretKeySpec;
-
-import com.android.internal.content.PackageHelper;
-import com.android.internal.util.ArrayUtils;
-
 public final class Pm {
     IPackageManager mPm;
     IUserManager mUm;
@@ -816,13 +810,6 @@
 
         String opt;
 
-        String algo = null;
-        byte[] iv = null;
-        byte[] key = null;
-
-        String macAlgo = null;
-        byte[] macKey = null;
-        byte[] tag = null;
         String originatingUriString = null;
         String referrer = null;
         String abi = null;
@@ -848,42 +835,6 @@
                 installFlags |= PackageManager.INSTALL_INTERNAL;
             } else if (opt.equals("-d")) {
                 installFlags |= PackageManager.INSTALL_ALLOW_DOWNGRADE;
-            } else if (opt.equals("--algo")) {
-                algo = nextOptionData();
-                if (algo == null) {
-                    System.err.println("Error: must supply argument for --algo");
-                    return;
-                }
-            } else if (opt.equals("--iv")) {
-                iv = hexToBytes(nextOptionData());
-                if (iv == null) {
-                    System.err.println("Error: must supply argument for --iv");
-                    return;
-                }
-            } else if (opt.equals("--key")) {
-                key = hexToBytes(nextOptionData());
-                if (key == null) {
-                    System.err.println("Error: must supply argument for --key");
-                    return;
-                }
-            } else if (opt.equals("--macalgo")) {
-                macAlgo = nextOptionData();
-                if (macAlgo == null) {
-                    System.err.println("Error: must supply argument for --macalgo");
-                    return;
-                }
-            } else if (opt.equals("--mackey")) {
-                macKey = hexToBytes(nextOptionData());
-                if (macKey == null) {
-                    System.err.println("Error: must supply argument for --mackey");
-                    return;
-                }
-            } else if (opt.equals("--tag")) {
-                tag = hexToBytes(nextOptionData());
-                if (tag == null) {
-                    System.err.println("Error: must supply argument for --tag");
-                    return;
-                }
             } else if (opt.equals("--originating-uri")) {
                 originatingUriString = nextOptionData();
                 if (originatingUriString == null) {
@@ -924,43 +875,6 @@
             }
         }
 
-        final ContainerEncryptionParams encryptionParams;
-        if (algo != null || iv != null || key != null || macAlgo != null || macKey != null
-                || tag != null) {
-            if (algo == null || iv == null || key == null) {
-                System.err.println("Error: all of --algo, --iv, and --key must be specified");
-                return;
-            }
-
-            if (macAlgo != null || macKey != null || tag != null) {
-                if (macAlgo == null || macKey == null || tag == null) {
-                    System.err.println("Error: all of --macalgo, --mackey, and --tag must "
-                            + "be specified");
-                    return;
-                }
-            }
-
-            try {
-                final SecretKey encKey = new SecretKeySpec(key, "RAW");
-
-                final SecretKey macSecretKey;
-                if (macKey == null || macKey.length == 0) {
-                    macSecretKey = null;
-                } else {
-                    macSecretKey = new SecretKeySpec(macKey, "RAW");
-                }
-
-                encryptionParams = new ContainerEncryptionParams(algo, new IvParameterSpec(iv),
-                        encKey, macAlgo, null, macSecretKey, tag, -1, -1, -1);
-            } catch (InvalidAlgorithmParameterException e) {
-                e.printStackTrace();
-                return;
-            }
-        } else {
-            encryptionParams = null;
-        }
-
-        final Uri apkURI;
         final Uri verificationURI;
         final Uri originatingURI;
         final Uri referrerURI;
@@ -980,9 +894,7 @@
         // Populate apkURI, must be present
         final String apkFilePath = nextArg();
         System.err.println("\tpkg: " + apkFilePath);
-        if (apkFilePath != null) {
-            apkURI = Uri.fromFile(new File(apkFilePath));
-        } else {
+        if (apkFilePath == null) {
             System.err.println("Error: no package specified");
             return;
         }
@@ -1001,9 +913,8 @@
             VerificationParams verificationParams = new VerificationParams(verificationURI,
                     originatingURI, referrerURI, VerificationParams.NO_UID, null);
 
-            mPm.installPackageWithVerificationEncryptionAndAbiOverrideEtc(apkURI, null,
-                    obs, installFlags, installerPackageName, verificationParams,
-                    encryptionParams, abi);
+            mPm.installPackage(apkFilePath, obs, installFlags, installerPackageName,
+                    verificationParams, abi);
 
             synchronized (obs) {
                 while (!obs.finished) {
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 184e10c..7c8c83a 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -1484,6 +1484,7 @@
                 case ON_NEW_ACTIVITY_OPTIONS:
                     Pair<IBinder, ActivityOptions> pair = (Pair<IBinder, ActivityOptions>) msg.obj;
                     onNewActivityOptions(pair.first, pair.second);
+                    break;
                 case STOP_MEDIA_PLAYING:
                     handleStopMediaPlaying((IBinder) msg.obj);
                     break;
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index e2f3c60..97f1e50 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -29,11 +29,11 @@
 import android.content.pm.IPackageDataObserver;
 import android.content.pm.IPackageDeleteObserver;
 import android.content.pm.IPackageInstallObserver;
-import android.content.pm.IPackageInstallObserver2;
 import android.content.pm.IPackageManager;
 import android.content.pm.IPackageMoveObserver;
 import android.content.pm.IPackageStatsObserver;
 import android.content.pm.InstrumentationInfo;
+import android.content.pm.ManifestDigest;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageInstaller;
 import android.content.pm.PackageItemInfo;
@@ -44,15 +44,14 @@
 import android.content.pm.ProviderInfo;
 import android.content.pm.ResolveInfo;
 import android.content.pm.ServiceInfo;
-import android.content.pm.ManifestDigest;
 import android.content.pm.VerificationParams;
 import android.content.pm.VerifierDeviceIdentity;
 import android.content.res.Resources;
 import android.content.res.XmlResourceParser;
-import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
+import android.os.Bundle;
 import android.os.Process;
 import android.os.RemoteException;
 import android.os.UserHandle;
@@ -1112,47 +1111,36 @@
     @Override
     public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags,
                                String installerPackageName) {
-        try {
-            mPM.installPackageEtc(packageURI, observer, null, flags, installerPackageName);
-        } catch (RemoteException e) {
-            // Should never happen!
-        }
+        final VerificationParams verificationParams = new VerificationParams(null, null,
+                null, VerificationParams.NO_UID, null);
+        installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags,
+                installerPackageName, verificationParams, null);
     }
 
     @Override
     public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer,
             int flags, String installerPackageName, Uri verificationURI,
             ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) {
-        try {
-            mPM.installPackageWithVerificationEtc(packageURI, observer, null, flags,
-                    installerPackageName, verificationURI, manifestDigest, encryptionParams);
-        } catch (RemoteException e) {
-            // Should never happen!
-        }
+        final VerificationParams verificationParams = new VerificationParams(verificationURI, null,
+                null, VerificationParams.NO_UID, manifestDigest);
+        installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags,
+                installerPackageName, verificationParams, encryptionParams);
     }
 
     @Override
     public void installPackageWithVerificationAndEncryption(Uri packageURI,
             IPackageInstallObserver observer, int flags, String installerPackageName,
             VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
-        try {
-            mPM.installPackageWithVerificationAndEncryptionEtc(packageURI, observer, null,
-                    flags, installerPackageName, verificationParams, encryptionParams);
-        } catch (RemoteException e) {
-            // Should never happen!
-        }
+        installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags,
+                installerPackageName, verificationParams, encryptionParams);
     }
 
-    // Expanded observer-API versions
     @Override
     public void installPackage(Uri packageURI, PackageInstallObserver observer,
             int flags, String installerPackageName) {
-        try {
-            mPM.installPackageEtc(packageURI, null, observer.getBinder(),
-                    flags, installerPackageName);
-        } catch (RemoteException e) {
-            // Should never happen!
-        }
+        final VerificationParams verificationParams = new VerificationParams(null, null,
+                null, VerificationParams.NO_UID, null);
+        installCommon(packageURI, observer, flags, installerPackageName, verificationParams, null);
     }
 
     @Override
@@ -1160,24 +1148,35 @@
             PackageInstallObserver observer, int flags, String installerPackageName,
             Uri verificationURI, ManifestDigest manifestDigest,
             ContainerEncryptionParams encryptionParams) {
-        try {
-            mPM.installPackageWithVerificationEtc(packageURI, null, observer.getBinder(), flags,
-                    installerPackageName, verificationURI, manifestDigest, encryptionParams);
-        } catch (RemoteException e) {
-            // Should never happen!
-        }
+        final VerificationParams verificationParams = new VerificationParams(verificationURI, null,
+                null, VerificationParams.NO_UID, manifestDigest);
+        installCommon(packageURI, observer, flags, installerPackageName, verificationParams,
+                encryptionParams);
     }
 
     @Override
     public void installPackageWithVerificationAndEncryption(Uri packageURI,
             PackageInstallObserver observer, int flags, String installerPackageName,
             VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
+        installCommon(packageURI, observer, flags, installerPackageName, verificationParams,
+                encryptionParams);
+    }
+
+    private void installCommon(Uri packageURI,
+            PackageInstallObserver observer, int flags, String installerPackageName,
+            VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
+        if (!"file".equals(packageURI.getScheme())) {
+            throw new UnsupportedOperationException("Only file:// URIs are supported");
+        }
+        if (encryptionParams != null) {
+            throw new UnsupportedOperationException("ContainerEncryptionParams not supported");
+        }
+
+        final String originPath = packageURI.getPath();
         try {
-            mPM.installPackageWithVerificationAndEncryptionEtc(packageURI, null,
-                    observer.getBinder(), flags, installerPackageName, verificationParams,
-                    encryptionParams);
-        } catch (RemoteException e) {
-            // Should never happen!
+            mPM.installPackage(originPath, observer.getBinder(), flags, installerPackageName,
+                    verificationParams, null);
+        } catch (RemoteException ignored) {
         }
     }
 
@@ -1523,6 +1522,22 @@
         return dr;
     }
 
+    private static class LegacyPackageInstallObserver extends PackageInstallObserver {
+        private final IPackageInstallObserver mLegacy;
+
+        public LegacyPackageInstallObserver(IPackageInstallObserver legacy) {
+            mLegacy = legacy;
+        }
+
+        @Override
+        public void packageInstalled(String basePackageName, Bundle extras, int returnCode) {
+            try {
+                mLegacy.packageInstalled(basePackageName, returnCode);
+            } catch (RemoteException ignored) {
+            }
+        }
+    }
+
     private final ContextImpl mContext;
     private final IPackageManager mPM;
 
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 40dec8f..58d3526 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -189,18 +189,12 @@
     List<InstrumentationInfo> queryInstrumentation(
             String targetPackage, int flags);
 
-    /**
-     * Install a package.
-     *
-     * @param packageURI The location of the package file to install.
-     * @param observer a callback to use to notify when the package installation in finished.
-     * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE},
-     * {@link #REPLACE_EXISITING_PACKAGE}
-     * @param installerPackageName Optional package name of the application that is performing the
-     * installation. This identifies which market the package came from.
-     */
-    void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags,
-            in String installerPackageName);
+    void installPackage(in String originPath,
+            in IPackageInstallObserver2 observer,
+            int flags,
+            in String installerPackageName,
+            in VerificationParams verificationParams,
+            in String packageAbiOverride);
 
     void finishPackageInstall(int token);
 
@@ -412,37 +406,6 @@
     boolean setInstallLocation(int loc);
     int getInstallLocation();
 
-    void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer,
-            int flags, in String installerPackageName, in Uri verificationURI,
-            in ManifestDigest manifestDigest, in ContainerEncryptionParams encryptionParams);
-
-    void installPackageWithVerificationAndEncryption(in Uri packageURI,
-            in IPackageInstallObserver observer, int flags, in String installerPackageName,
-            in VerificationParams verificationParams,
-            in ContainerEncryptionParams encryptionParams);
-
-    /** Expanded observer versions */
-    void installPackageEtc(in Uri packageURI, IPackageInstallObserver observer,
-            IPackageInstallObserver2 observer2, int flags, in String installerPackageName);
-
-    void installPackageWithVerificationEtc(in Uri packageURI,
-            in IPackageInstallObserver observer, IPackageInstallObserver2 observer2,
-            int flags, in String installerPackageName, in Uri verificationURI,
-            in ManifestDigest manifestDigest, in ContainerEncryptionParams encryptionParams);
-
-    void installPackageWithVerificationAndEncryptionEtc(in Uri packageURI,
-            in IPackageInstallObserver observer, in IPackageInstallObserver2 observer2,
-            int flags, in String installerPackageName,
-            in VerificationParams verificationParams,
-            in ContainerEncryptionParams encryptionParams);
-
-    void installPackageWithVerificationEncryptionAndAbiOverrideEtc(in Uri packageURI,
-            in IPackageInstallObserver observer, in IPackageInstallObserver2 observer2,
-            int flags, in String installerPackageName,
-            in VerificationParams verificationParams,
-            in ContainerEncryptionParams encryptionParams,
-        in String packageAbiOverride);
-
     int installExistingPackageAsUser(String packageName, int userId);
 
     void verifyPendingInstall(int id, int verificationCode);
diff --git a/core/java/android/hardware/camera2/CameraCaptureSession.java b/core/java/android/hardware/camera2/CameraCaptureSession.java
index d98bdc2..c6f98dc 100644
--- a/core/java/android/hardware/camera2/CameraCaptureSession.java
+++ b/core/java/android/hardware/camera2/CameraCaptureSession.java
@@ -660,8 +660,8 @@
          *
          * <p>Due to the asynchronous nature of the camera device, not all submitted captures
          * are immediately processed. It is possible to clear out the pending requests
-         * by a variety of operations such as {@link CameraDevice#stopRepeating} or
-         * {@link CameraDevice#flush}. When such an event happens,
+         * by a variety of operations such as {@link CameraCaptureSession#stopRepeating} or
+         * {@link CameraCaptureSession#abortCaptures}. When such an event happens,
          * {@link #onCaptureSequenceCompleted} will not be called.</p>
          *
          * <p>The default implementation does nothing.</p>
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index c9a88f8..0d85530 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -289,6 +289,20 @@
 
 
     /**
+     * <p>The set of aberration correction modes supported by this camera device.</p>
+     * <p>This metadata lists the valid modes for {@link CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE android.colorCorrection.aberrationCorrectionMode}.
+     * If no aberration correction modes are available for a device, this list will solely include
+     * OFF mode.</p>
+     * <p>For FULL capability device ({@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} <code>==</code> FULL), OFF must be
+     * included.</p>
+     *
+     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+     * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
+     */
+    public static final Key<int[]> COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES =
+            new Key<int[]>("android.colorCorrection.availableAberrationCorrectionModes", int[].class);
+
+    /**
      * <p>The set of auto-exposure antibanding modes that are
      * supported by this camera device.</p>
      * <p>Not all of the auto-exposure anti-banding modes may be
diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java
index 1f89d33..c461511 100644
--- a/core/java/android/hardware/camera2/CameraDevice.java
+++ b/core/java/android/hardware/camera2/CameraDevice.java
@@ -133,6 +133,7 @@
      * <p>Set up a new output set of Surfaces for the camera device.</p>
      *
      * @deprecated Use {@link #createCaptureSession} instead
+     * @hide
      */
     @Deprecated
     public abstract void configureOutputs(List<Surface> outputs) throws CameraAccessException;
@@ -278,6 +279,7 @@
      * <p>Submit a request for an image to be captured by this CameraDevice.</p>
      *
      * @deprecated Use {@link CameraCaptureSession#capture} instead
+     * @hide
      */
     @Deprecated
     public abstract int capture(CaptureRequest request, CaptureListener listener, Handler handler)
@@ -287,6 +289,7 @@
      * Submit a list of requests to be captured in sequence as a burst.
      *
      * @deprecated Use {@link CameraCaptureSession#captureBurst} instead
+     * @hide
      */
     @Deprecated
     public abstract int captureBurst(List<CaptureRequest> requests, CaptureListener listener,
@@ -296,6 +299,7 @@
      * Request endlessly repeating capture of images by this CameraDevice.
      *
      * @deprecated Use {@link CameraCaptureSession#setRepeatingRequest} instead
+     * @hide
      */
     @Deprecated
     public abstract int setRepeatingRequest(CaptureRequest request, CaptureListener listener,
@@ -306,6 +310,7 @@
      * CameraDevice.</p>
      *
      * @deprecated Use {@link CameraCaptureSession#setRepeatingBurst} instead
+     * @hide
      */
     @Deprecated
     public abstract int setRepeatingBurst(List<CaptureRequest> requests, CaptureListener listener,
@@ -317,6 +322,7 @@
      * {@link #setRepeatingBurst}.
      *
      * @deprecated Use {@link CameraCaptureSession#stopRepeating} instead
+     * @hide
      */
     @Deprecated
     public abstract void stopRepeating() throws CameraAccessException;
@@ -326,6 +332,7 @@
      * possible.
      *
      * @deprecated Use {@link CameraCaptureSession#abortCaptures} instead
+     * @hide
      */
     @Deprecated
     public abstract void flush() throws CameraAccessException;
@@ -353,6 +360,7 @@
      * submitted to the camera device.</p>
      *
      * @deprecated Use {@link CameraCaptureSession.CaptureListener} instead
+     * @hide
      */
     @Deprecated
     public static abstract class CaptureListener {
@@ -537,6 +545,7 @@
          * The method called when a camera device has no outputs configured.
          *
          * @deprecated Use {@link #onOpened} instead.
+         * @hide
          */
         @Deprecated
         public void onUnconfigured(CameraDevice camera) {
@@ -548,6 +557,7 @@
          * {@link CaptureRequest capture requests}.
          *
          * @deprecated Use {@link CameraCaptureSession.StateListener#onActive} instead.
+         * @hide
          */
         @Deprecated
         public void onActive(CameraDevice camera) {
@@ -558,6 +568,7 @@
          * The method called when a camera device is busy.
          *
          * @deprecated Use {@link CameraCaptureSession.StateListener#onConfigured} instead.
+         * @hide
          */
         @Deprecated
         public void onBusy(CameraDevice camera) {
@@ -584,6 +595,7 @@
          * submitted capture requests and has reached an idle state.
          *
          * @deprecated Use {@link CameraCaptureSession.StateListener#onReady} instead.
+         * @hide
          */
         @Deprecated
         public void onIdle(CameraDevice camera) {
diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java
index 53c8a52..6c3f7dd 100644
--- a/core/java/android/hardware/camera2/CameraMetadata.java
+++ b/core/java/android/hardware/camera2/CameraMetadata.java
@@ -317,12 +317,19 @@
      * <li>android.lens.info.shadingMapSize</li>
      * </ul>
      * </li>
+     * <li>Manual aberration correction control (if aberration correction is supported)<ul>
+     * <li>{@link CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE android.colorCorrection.aberrationCorrectionMode}</li>
+     * <li>{@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES android.colorCorrection.availableAberrationCorrectionModes}</li>
+     * </ul>
+     * </li>
      * </ul>
      * <p>If auto white balance is enabled, then the camera device
      * will accurately report the values applied by AWB in the result.</p>
      * <p>A given camera device may also support additional post-processing
      * controls, but this capability only covers the above list of controls.</p>
      *
+     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+     * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES
      * @see CaptureRequest#COLOR_CORRECTION_GAINS
      * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
      * @see CaptureRequest#SHADING_MODE
@@ -664,6 +671,30 @@
     public static final int COLOR_CORRECTION_MODE_HIGH_QUALITY = 2;
 
     //
+    // Enumeration values for CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+    //
+
+    /**
+     * <p>No aberration correction is applied.</p>
+     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+     */
+    public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF = 0;
+
+    /**
+     * <p>Aberration correction will not slow down capture rate
+     * relative to sensor raw output.</p>
+     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+     */
+    public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST = 1;
+
+    /**
+     * <p>Aberration correction operates at improved quality but reduced
+     * capture rate (relative to sensor raw output).</p>
+     * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+     */
+    public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_HIGH_QUALITY = 2;
+
+    //
     // Enumeration values for CaptureRequest#CONTROL_AE_ANTIBANDING_MODE
     //
 
diff --git a/core/java/android/hardware/camera2/CaptureFailure.java b/core/java/android/hardware/camera2/CaptureFailure.java
index 35f9af1..2c505e5 100644
--- a/core/java/android/hardware/camera2/CaptureFailure.java
+++ b/core/java/android/hardware/camera2/CaptureFailure.java
@@ -36,7 +36,8 @@
     public static final int REASON_ERROR = 0;
 
     /**
-     * The capture has failed due to a {@link CameraDevice#flush} call from the application.
+     * The capture has failed due to a {@link CameraCaptureSession#abortCaptures} call from the
+     * application.
      *
      * @see #getReason()
      */
@@ -64,7 +65,7 @@
      * Get the request associated with this failed capture.
      *
      * <p>Whenever a request is unsuccessfully captured, with
-     * {@link CameraDevice.CaptureListener#onCaptureFailed},
+     * {@link CameraCaptureSession.CaptureListener#onCaptureFailed},
      * the {@code failed capture}'s {@code getRequest()} will return that {@code request}.
      * </p>
      *
@@ -127,7 +128,7 @@
 
     /**
      * The sequence ID for this failed capture that was returned by the
-     * {@link CameraDevice#capture} family of functions.
+     * {@link CameraCaptureSession#capture} family of functions.
      *
      * <p>The sequence ID is a unique monotonically increasing value starting from 0,
      * incremented every time a new group of requests is submitted to the CameraDevice.</p>
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index 91ff7fa..e8014b0 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -245,7 +245,7 @@
      * <p>This tag is not used for anything by the camera device, but can be
      * used by an application to easily identify a CaptureRequest when it is
      * returned by
-     * {@link CameraDevice.CaptureListener#onCaptureCompleted CaptureListener.onCaptureCompleted}
+     * {@link CameraCaptureSession.CaptureListener#onCaptureCompleted CaptureListener.onCaptureCompleted}
      * </p>
      *
      * @return the last tag Object set on this request, or {@code null} if
@@ -435,7 +435,7 @@
          * <p>This tag is not used for anything by the camera device, but can be
          * used by an application to easily identify a CaptureRequest when it is
          * returned by
-         * {@link CameraDevice.CaptureListener#onCaptureCompleted CaptureListener.onCaptureCompleted}
+         * {@link CameraCaptureSession.CaptureListener#onCaptureCompleted CaptureListener.onCaptureCompleted}
          *
          * @param tag an arbitrary Object to store with this request
          * @see CaptureRequest#getTag
@@ -558,6 +558,29 @@
             new Key<android.hardware.camera2.params.RggbChannelVector>("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class);
 
     /**
+     * <p>Mode of operation for the chromatic aberration correction algorithm.</p>
+     * <p>This must be set to a valid mode from
+     * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES android.colorCorrection.availableAberrationCorrectionModes}.</p>
+     * <p>Chromatic (color) aberration is caused by the fact that different wavelengths of light
+     * can not focus on the same point after exiting from the lens. This metadata defines
+     * the high level control of chromatic aberration correction algorithm, which aims to
+     * minimize the chromatic artifacts that may occur along the object boundaries in an
+     * image.</p>
+     * <p>FAST/HIGH_QUALITY both mean that camera device determined aberration
+     * correction will be applied. HIGH_QUALITY mode indicates that the camera device will
+     * use the highest-quality aberration correction algorithms, even if it slows down
+     * capture rate. FAST means the camera device will not slow down capture rate when
+     * applying aberration correction.</p>
+     *
+     * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES
+     * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF
+     * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST
+     * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_HIGH_QUALITY
+     */
+    public static final Key<Integer> COLOR_CORRECTION_ABERRATION_CORRECTION_MODE =
+            new Key<Integer>("android.colorCorrection.aberrationCorrectionMode", int.class);
+
+    /**
      * <p>The desired setting for the camera device's auto-exposure
      * algorithm's antibanding compensation.</p>
      * <p>Some kinds of lighting fixtures, such as some fluorescent
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index be2d960..956e64f 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -255,8 +255,8 @@
      * Get the request associated with this result.
      *
      * <p>Whenever a request has been fully or partially captured, with
-     * {@link CameraDevice.CaptureListener#onCaptureCompleted} or
-     * {@link CameraDevice.CaptureListener#onCaptureProgressed}, the {@code result}'s
+     * {@link CameraCaptureSession.CaptureListener#onCaptureCompleted} or
+     * {@link CameraCaptureSession.CaptureListener#onCaptureProgressed}, the {@code result}'s
      * {@code getRequest()} will return that {@code request}.
      * </p>
      *
@@ -295,7 +295,7 @@
 
     /**
      * The sequence ID for this failure that was returned by the
-     * {@link CameraDevice#capture} family of functions.
+     * {@link CameraCaptureSession#capture} family of functions.
      *
      * <p>The sequence ID is a unique monotonically increasing value starting from 0,
      * incremented every time a new group of requests is submitted to the CameraDevice.</p>
@@ -403,6 +403,29 @@
             new Key<android.hardware.camera2.params.RggbChannelVector>("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class);
 
     /**
+     * <p>Mode of operation for the chromatic aberration correction algorithm.</p>
+     * <p>This must be set to a valid mode from
+     * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES android.colorCorrection.availableAberrationCorrectionModes}.</p>
+     * <p>Chromatic (color) aberration is caused by the fact that different wavelengths of light
+     * can not focus on the same point after exiting from the lens. This metadata defines
+     * the high level control of chromatic aberration correction algorithm, which aims to
+     * minimize the chromatic artifacts that may occur along the object boundaries in an
+     * image.</p>
+     * <p>FAST/HIGH_QUALITY both mean that camera device determined aberration
+     * correction will be applied. HIGH_QUALITY mode indicates that the camera device will
+     * use the highest-quality aberration correction algorithms, even if it slows down
+     * capture rate. FAST means the camera device will not slow down capture rate when
+     * applying aberration correction.</p>
+     *
+     * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES
+     * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF
+     * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST
+     * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_HIGH_QUALITY
+     */
+    public static final Key<Integer> COLOR_CORRECTION_ABERRATION_CORRECTION_MODE =
+            new Key<Integer>("android.colorCorrection.aberrationCorrectionMode", int.class);
+
+    /**
      * <p>The desired setting for the camera device's auto-exposure
      * algorithm's antibanding compensation.</p>
      * <p>Some kinds of lighting fixtures, such as some fluorescent
diff --git a/core/java/android/hardware/camera2/TotalCaptureResult.java b/core/java/android/hardware/camera2/TotalCaptureResult.java
index 2647959..226f09d 100644
--- a/core/java/android/hardware/camera2/TotalCaptureResult.java
+++ b/core/java/android/hardware/camera2/TotalCaptureResult.java
@@ -73,7 +73,7 @@
      *
      * <p>The list size will be inclusive between {@code 1} and
      * {@link CameraCharacteristics#REQUEST_PARTIAL_RESULT_COUNT}, in ascending order
-     * of when {@link CameraDevice.CaptureListener#onCaptureProgressed} was invoked.</p>
+     * of when {@link CameraCaptureSession.CaptureListener#onCaptureProgressed} was invoked.</p>
      *
      * @return unmodifiable list of partial results
      */
diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
index e55ee67..92046f3 100644
--- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
+++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
@@ -299,7 +299,6 @@
         return mCameraId;
     }
 
-    @Override
     public void configureOutputs(List<Surface> outputs) throws CameraAccessException {
         // Treat a null input the same an empty list
         if (outputs == null) {
@@ -435,7 +434,6 @@
         }
     }
 
-    @Override
     public int capture(CaptureRequest request, CaptureListener listener, Handler handler)
             throws CameraAccessException {
         if (DEBUG) {
@@ -446,7 +444,6 @@
         return submitCaptureRequest(requestList, listener, handler, /*streaming*/false);
     }
 
-    @Override
     public int captureBurst(List<CaptureRequest> requests, CaptureListener listener,
             Handler handler) throws CameraAccessException {
         if (requests == null || requests.isEmpty()) {
@@ -599,7 +596,6 @@
         }
     }
 
-    @Override
     public int setRepeatingRequest(CaptureRequest request, CaptureListener listener,
             Handler handler) throws CameraAccessException {
         List<CaptureRequest> requestList = new ArrayList<CaptureRequest>();
@@ -607,7 +603,6 @@
         return submitCaptureRequest(requestList, listener, handler, /*streaming*/true);
     }
 
-    @Override
     public int setRepeatingBurst(List<CaptureRequest> requests, CaptureListener listener,
             Handler handler) throws CameraAccessException {
         if (requests == null || requests.isEmpty()) {
@@ -616,7 +611,6 @@
         return submitCaptureRequest(requests, listener, handler, /*streaming*/true);
     }
 
-    @Override
     public void stopRepeating() throws CameraAccessException {
 
         try (ScopedLock scopedLock = mCloseLock.acquireExclusiveLock()) {
@@ -669,7 +663,6 @@
         }
     }
 
-    @Override
     public void flush() throws CameraAccessException {
         try (ScopedLock scopedLock = mCloseLock.acquireExclusiveLock()) {
             checkIfCameraClosedOrInError();
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 8dfa227..ffbe2cb 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -2666,6 +2666,10 @@
      * The audio input device code for a S/PDIF digital connection
      */
     public static final int DEVICE_IN_SPDIF = AudioSystem.DEVICE_IN_SPDIF;
+    /** @hide
+     * The audio input device code for audio loopback
+     */
+    public static final int DEVICE_IN_LOOPBACK = AudioSystem.DEVICE_IN_LOOPBACK;
 
     /**
      * Return true if the device code corresponds to an output device.
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 87468d6..392d953 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -312,6 +312,7 @@
     public static final int DEVICE_IN_LINE = DEVICE_BIT_IN | 0x8000;
     public static final int DEVICE_IN_SPDIF = DEVICE_BIT_IN | 0x10000;
     public static final int DEVICE_IN_BLUETOOTH_A2DP = DEVICE_BIT_IN | 0x20000;
+    public static final int DEVICE_IN_LOOPBACK = DEVICE_BIT_IN | 0x40000;
     public static final int DEVICE_IN_DEFAULT = DEVICE_BIT_IN | DEVICE_BIT_DEFAULT;
 
     public static final int DEVICE_IN_ALL = (DEVICE_IN_COMMUNICATION |
@@ -332,6 +333,7 @@
                                              DEVICE_IN_LINE |
                                              DEVICE_IN_SPDIF |
                                              DEVICE_IN_BLUETOOTH_A2DP |
+                                             DEVICE_IN_LOOPBACK |
                                              DEVICE_IN_DEFAULT);
     public static final int DEVICE_IN_ALL_SCO = DEVICE_IN_BLUETOOTH_SCO_HEADSET;
     public static final int DEVICE_IN_ALL_USB = (DEVICE_IN_USB_ACCESSORY |
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 65a6004..ef8302d 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -37,7 +37,7 @@
     <color name="system_primary_color">#ff263238</color>
     <color name="system_secondary_color">#ff384248</color>
     <color name="system_accent_color">#ff80CBC4</color><!-- deep teal 200 -->
-    <color name="system_error_color">#fff0592b</color>
+    <color name="system_warning_color">#fff4511e</color><!-- deep orange 600 -->
     <color name="qs_tile_divider">#29ffffff</color><!-- 16% white -->
     <color name="qs_tile_text">#B3FFFFFF</color><!-- 70% white -->
     <color name="qs_subhead">#66FFFFFF</color><!-- 40% white -->
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index ddacd82..8241c2e 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -326,4 +326,5 @@
     <!-- The thickness of the colored border around the current user. -->
     <dimen name="keyguard_user_switcher_border_thickness">2dp</dimen>
 
+    <dimen name="data_usage_graph_marker_width">4dp</dimen>
 </resources>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index a6e5fea..ff60f1d 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -550,6 +550,14 @@
     <string name="quick_settings_cellular_detail_title">Cellular data</string>
     <!-- QuickSettings: Cellular detail panel, data usage title [CHAR LIMIT=NONE] -->
     <string name="quick_settings_cellular_detail_data_usage">Data usage</string>
+    <!-- QuickSettings: Cellular detail panel, remaining data title [CHAR LIMIT=NONE] -->
+    <string name="quick_settings_cellular_detail_remaining_data">Remaining data</string>
+    <!-- QuickSettings: Cellular detail panel, over limit title [CHAR LIMIT=NONE] -->
+    <string name="quick_settings_cellular_detail_over_limit">Over limit</string>
+    <!-- QuickSettings: Cellular detail panel, data used format string [CHAR LIMIT=NONE] -->
+    <string name="quick_settings_cellular_detail_data_used"><xliff:g id="data_used" example="2.0 GB">%s</xliff:g> used</string>
+    <!-- QuickSettings: Cellular detail panel, data limit format string [CHAR LIMIT=NONE] -->
+    <string name="quick_settings_cellular_detail_data_limit"><xliff:g id="data_limit" example="2.0 GB">%s</xliff:g> limit</string>
 
     <!-- Recents: The empty recents string. [CHAR LIMIT=NONE] -->
     <string name="recents_empty_message">No recent apps</string>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/DataUsageGraph.java b/packages/SystemUI/src/com/android/systemui/qs/DataUsageGraph.java
index 8b1c778..fa11af6 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/DataUsageGraph.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/DataUsageGraph.java
@@ -17,6 +17,7 @@
 package com.android.systemui.qs;
 
 import android.content.Context;
+import android.content.res.Resources;
 import android.graphics.Canvas;
 import android.graphics.Paint;
 import android.graphics.RectF;
@@ -28,7 +29,10 @@
 public class DataUsageGraph extends View {
 
     private final int mBackgroundColor;
+    private final int mTrackColor;
     private final int mUsageColor;
+    private final int mOverlimitColor;
+    private final int mMarkerWidth;
     private final RectF mTmpRect = new RectF();
     private final Paint mTmpPaint = new Paint();
 
@@ -39,8 +43,12 @@
 
     public DataUsageGraph(Context context, AttributeSet attrs) {
         super(context, attrs);
-        mBackgroundColor = context.getResources().getColor(R.color.data_usage_graph_track);
-        mUsageColor = context.getResources().getColor(R.color.system_accent_color);
+        final Resources res = context.getResources();
+        mBackgroundColor = res.getColor(R.color.system_primary_color);
+        mTrackColor = res.getColor(R.color.data_usage_graph_track);
+        mUsageColor = res.getColor(R.color.system_accent_color);
+        mOverlimitColor = res.getColor(R.color.system_warning_color);
+        mMarkerWidth = res.getDimensionPixelSize(R.dimen.data_usage_graph_marker_width);
     }
 
     public void setLevels(long maxLevel, long limitLevel, long warningLevel, long usageLevel) {
@@ -60,14 +68,38 @@
         final int w = getWidth();
         final int h = getHeight();
 
-        // draw background
+        // draw track
         r.set(0, 0, w, h);
-        p.setColor(mBackgroundColor);
+        p.setColor(mTrackColor);
         canvas.drawRect(r, p);
 
+        final boolean hasLimit = mLimitLevel > 0;
+        final boolean overLimit = hasLimit && mUsageLevel > mLimitLevel;
+
+        final long maxLevel = hasLimit ? Math.max(mUsageLevel, mLimitLevel) : mMaxLevel;
+        final long usageLevel = hasLimit ? Math.min(mUsageLevel, mLimitLevel) : mUsageLevel;
+        float usageRight = w * (usageLevel / (float) maxLevel);
+        if (overLimit) {
+            usageRight -= (mMarkerWidth / 2);
+            usageRight = Math.min(usageRight, w - mMarkerWidth * 2);
+            usageRight = Math.max(usageRight, mMarkerWidth);
+        }
+
         // draw usage
-        r.set(0, 0, w * mUsageLevel / (float) mMaxLevel, h);
+        r.set(0, 0, usageRight, h);
         p.setColor(mUsageColor);
         canvas.drawRect(r, p);
+
+        if (overLimit) {
+            // draw gap
+            r.set(usageRight, 0, usageRight + mMarkerWidth, h);
+            p.setColor(mBackgroundColor);
+            canvas.drawRect(r, p);
+
+            // draw overlimit
+            r.set(usageRight + mMarkerWidth, 0, w, h);
+            p.setColor(mOverlimitColor);
+            canvas.drawRect(r, p);
+        }
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 51befd6..9c1dc8e 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -126,6 +126,7 @@
     }
 
     private void handleSetTileVisibility(View v, boolean visible) {
+        if (visible == (v.getVisibility() == VISIBLE)) return;
         v.setVisibility(visible ? VISIBLE : GONE);
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java b/packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java
index d5fe033..d9447f7 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java
@@ -42,15 +42,17 @@
     public SignalTileView(Context context) {
         super(context);
 
-        mIn = new ImageView(context);
-        mIn.setImageResource(R.drawable.ic_qs_signal_in);
-        mIn.setColorFilter(FILTER);
-        addView(mIn);
+        mIn = addTrafficView(R.drawable.ic_qs_signal_in);
+        mOut = addTrafficView(R.drawable.ic_qs_signal_out);
+    }
 
-        mOut = new ImageView(context);
-        mOut.setImageResource(R.drawable.ic_qs_signal_out);
-        mOut.setColorFilter(FILTER);
-        addView(mOut);
+    private ImageView addTrafficView(int icon) {
+        final ImageView traffic = new ImageView(mContext);
+        traffic.setImageResource(icon);
+        traffic.setColorFilter(FILTER);
+        traffic.setAlpha(0f);
+        addView(traffic);
+        return traffic;
     }
 
     @Override
@@ -102,18 +104,22 @@
         } else {
             mOverlay.setVisibility(GONE);
         }
-        setVisibility(mIn, s.activityIn);
-        setVisibility(mOut, s.activityOut);
+        final boolean shown = isShown();
+        setVisibility(mIn, shown, s.activityIn);
+        setVisibility(mOut, shown, s.activityOut);
     }
 
-    private void setVisibility(View view, boolean visible) {
-        final float newAlpha = visible ? 1 : 0;
-        if (view.getAlpha() != newAlpha) {
+    private void setVisibility(View view, boolean shown, boolean visible) {
+        final float newAlpha = shown && visible ? 1 : 0;
+        if (view.getAlpha() == newAlpha) return;
+        if (shown) {
             view.animate()
                 .setDuration(visible ? SHORT_DURATION : DEFAULT_DURATION)
                 .alpha(newAlpha)
                 .withLayer()
                 .start();
+        } else {
+            view.setAlpha(newAlpha);
         }
     }
 }
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
index 9048ee8..1f12b2a 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
@@ -215,10 +215,36 @@
                     .inflate(R.layout.data_usage, parent, false);
             final DataUsageInfo info = mController.getDataUsageInfo();
             if (info == null) return v;
+            final Resources res = mContext.getResources();
+            int titleId;
+            long bytes;
+            int usageColor = R.color.system_accent_color;
+            String top = null, bottom = null;
+            if (info.limitLevel <= 0) { // no limit
+                titleId = R.string.quick_settings_cellular_detail_data_usage;
+                bytes = info.usageLevel;
+            } else if (info.usageLevel <= info.limitLevel) { // under limit
+                titleId = R.string.quick_settings_cellular_detail_remaining_data;
+                bytes = info.limitLevel - info.usageLevel;
+                top = res.getString(R.string.quick_settings_cellular_detail_data_used,
+                        formatBytes(info.usageLevel));
+                bottom = res.getString(R.string.quick_settings_cellular_detail_data_limit,
+                        formatBytes(info.limitLevel));
+            } else { // over limit
+                titleId = R.string.quick_settings_cellular_detail_over_limit;
+                bytes = info.usageLevel - info.limitLevel;
+                top = res.getString(R.string.quick_settings_cellular_detail_data_used,
+                        formatBytes(info.usageLevel));
+                bottom = res.getString(R.string.quick_settings_cellular_detail_data_limit,
+                        formatBytes(info.limitLevel));
+                usageColor = R.color.system_warning_color;
+            }
+
             final TextView title = (TextView) v.findViewById(android.R.id.title);
-            title.setText(R.string.quick_settings_cellular_detail_data_usage);
+            title.setText(titleId);
             final TextView usage = (TextView) v.findViewById(R.id.usage_text);
-            usage.setText(formatBytes(info.usageLevel));
+            usage.setText(formatBytes(bytes));
+            usage.setTextColor(res.getColor(usageColor));
             final DataUsageGraph graph = (DataUsageGraph) v.findViewById(R.id.usage_graph);
             graph.setLevels(info.maxLevel, info.limitLevel, info.warningLevel, info.usageLevel);
             final TextView carrier = (TextView) v.findViewById(R.id.usage_carrier_text);
@@ -226,9 +252,11 @@
             final TextView period = (TextView) v.findViewById(R.id.usage_period_text);
             period.setText(info.period);
             final TextView infoTop = (TextView) v.findViewById(R.id.usage_info_top_text);
-            // TODO
+            infoTop.setVisibility(top != null ? View.VISIBLE : View.GONE);
+            infoTop.setText(top);
             final TextView infoBottom = (TextView) v.findViewById(R.id.usage_info_bottom_text);
-            // TODO
+            infoBottom.setVisibility(bottom != null ? View.VISIBLE : View.GONE);
+            infoBottom.setText(bottom);
             return v;
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileDataController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileDataController.java
index 40549e8..ac9d807 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileDataController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileDataController.java
@@ -25,6 +25,8 @@
 import android.net.ConnectivityManager;
 import android.net.INetworkStatsService;
 import android.net.INetworkStatsSession;
+import android.net.NetworkPolicy;
+import android.net.NetworkPolicyManager;
 import android.net.NetworkStatsHistory;
 import android.net.NetworkTemplate;
 import android.os.RemoteException;
@@ -49,6 +51,7 @@
     private final TelephonyManager mTelephonyManager;
     private final ConnectivityManager mConnectivityManager;
     private final INetworkStatsService mStatsService;
+    private final NetworkPolicyManager mPolicyManager;
 
     private INetworkStatsSession mSession;
     private Callback mCallback;
@@ -59,6 +62,8 @@
         mConnectivityManager = ConnectivityManager.from(context);
         mStatsService = INetworkStatsService.Stub.asInterface(
                 ServiceManager.getService(Context.NETWORK_STATS_SERVICE));
+        mPolicyManager = NetworkPolicyManager.from(mContext);
+
         try {
             mSession = mStatsService.openSession();
         } catch (RemoteException e) {
@@ -85,6 +90,7 @@
             return warn("no stats session");
         }
         final NetworkTemplate template = NetworkTemplate.buildTemplateMobileAll(subscriberId);
+        final NetworkPolicy policy = findNetworkPolicy(template);
         try {
             final NetworkStatsHistory history = mSession.getHistoryForNetwork(template, FIELDS);
             final long now = System.currentTimeMillis();
@@ -105,12 +111,30 @@
             usage.maxLevel = (long) (totalBytes / .4);
             usage.usageLevel = totalBytes;
             usage.period = MMM_D.format(new Date(start)) + " - " + MMM_D.format(new Date(end));
+            if (policy != null) {
+                usage.limitLevel = policy.limitBytes > 0 ? policy.limitBytes : 0;
+                usage.warningLevel = policy.warningBytes > 0 ? policy.warningBytes : 0;
+            }
             return usage;
         } catch (RemoteException e) {
             return warn("remote call failed");
         }
     }
 
+    private NetworkPolicy findNetworkPolicy(NetworkTemplate template) {
+        if (mPolicyManager == null || template == null) return null;
+        final NetworkPolicy[] policies = mPolicyManager.getNetworkPolicies();
+        if (policies == null) return null;
+        final int N = policies.length;
+        for (int i = 0; i < N; i++) {
+            final NetworkPolicy policy = policies[i];
+            if (policy != null && template.equals(policy.template)) {
+                return policy;
+            }
+        }
+        return null;
+    }
+
     private static String historyEntryToString(NetworkStatsHistory.Entry entry) {
         return entry == null ? null : new StringBuilder("Entry[")
                 .append("bucketDuration=").append(entry.bucketDuration)
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 1bd837b..88598c9 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -33,6 +33,7 @@
 import android.os.UserHandle;
 import android.telephony.CellLocation;
 import android.telephony.DataConnectionRealTimeInfo;
+import android.telephony.Rlog;
 import android.telephony.TelephonyManager;
 import android.telephony.SubscriptionManager;
 import android.telephony.PhoneStateListener;
@@ -46,7 +47,6 @@
 import android.telephony.PreciseDataConnectionState;
 import android.telephony.PreciseDisconnectCause;
 import android.text.TextUtils;
-import android.util.Slog;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -177,7 +177,7 @@
         public void handleMessage(Message msg) {
             switch (msg.what) {
                 case MSG_USER_SWITCHED: {
-                    Slog.d(TAG, "MSG_USER_SWITCHED userId=" + msg.arg1);
+                    log("MSG_USER_SWITCHED userId=" + msg.arg1);
                     int numPhones = TelephonyManager.getDefault().getPhoneCount();
                     for (int sub = 0; sub < numPhones; sub++) {
                         TelephonyRegistry.this.notifyCellLocationUsingSubId(sub, mCellLocation[sub]);
@@ -185,7 +185,7 @@
                     break;
                 }
                 case MSG_UPDATE_DEFAULT_SUB: {
-                    Slog.d(TAG, "MSG_UPDATE_DEFAULT_SUB subid=" + mDefaultSubId);
+                    log("MSG_UPDATE_DEFAULT_SUB subid=" + mDefaultSubId);
                     // Default subscription id changed, update the changed default subscription
                     // id in  all the legacy application listener records.
                     synchronized (mRecords) {
@@ -206,15 +206,15 @@
         @Override
         public void onReceive(Context context, Intent intent) {
             String action = intent.getAction();
-            Slog.d(TAG, "mBroadcastReceiver: action=" + action);
+            log("mBroadcastReceiver: action=" + action);
             if (Intent.ACTION_USER_SWITCHED.equals(action)) {
                 int userHandle = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0);
-                if (DBG) Slog.d(TAG, "onReceive: userHandle=" + userHandle);
+                if (DBG) log("onReceive: userHandle=" + userHandle);
                 mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCHED, userHandle, 0));
             } else if (action.equals(TelephonyIntents.ACTION_DEFAULT_SUBSCRIPTION_CHANGED)) {
                 mDefaultSubId = intent.getLongExtra(PhoneConstants.SUBSCRIPTION_KEY,
                         SubscriptionManager.getDefaultSubId());
-                if (DBG) Slog.d(TAG, "onReceive: mDefaultSubId=" + mDefaultSubId);
+                if (DBG) log("onReceive: mDefaultSubId=" + mDefaultSubId);
                 mHandler.sendMessage(mHandler.obtainMessage(MSG_UPDATE_DEFAULT_SUB, 0, 0));
             }
         }
@@ -238,7 +238,7 @@
         mDefaultSubId = SubscriptionManager.getDefaultSubId();
 
         int numPhones = TelephonyManager.getDefault().getPhoneCount();
-        if (DBG) Slog.d(TAG, "TelephonyRegistor: ctor numPhones=" + numPhones);
+        if (DBG) log("TelephonyRegistor: ctor numPhones=" + numPhones);
         mNumPhones = numPhones;
         mCallState = new int[numPhones];
         mDataActivity = new int[numPhones];
@@ -288,7 +288,7 @@
         filter.addAction(Intent.ACTION_USER_SWITCHED);
         filter.addAction(Intent.ACTION_USER_REMOVED);
         filter.addAction(TelephonyIntents.ACTION_DEFAULT_SUBSCRIPTION_CHANGED);
-        Slog.d(TAG, "systemRunning register for intents");
+        log("systemRunning register for intents");
         mContext.registerReceiver(mBroadcastReceiver, filter);
     }
 
@@ -308,8 +308,8 @@
             boolean notifyNow, long subId, boolean isLegacyApp) {
         int callerUid = UserHandle.getCallingUserId();
         int myUid = UserHandle.myUserId();
-        if (VDBG) {
-            Slog.d(TAG, "listen: E pkg=" + pkgForDebug + " events=0x" + Integer.toHexString(events)
+        if (true /*VDBG*/) {
+            log("listen: E pkg=" + pkgForDebug + " events=0x" + Integer.toHexString(events)
                 + " notifyNow=" + notifyNow + " subId=" + subId
                 + " isLegacyApp=" + isLegacyApp
                 + " myUid=" + myUid
@@ -347,14 +347,14 @@
                     if (r.subId == SubscriptionManager.DEFAULT_SUB_ID) {
                         r.subId = mDefaultSubId;
                         r.isLegacyApp = true; // r.subId is to be update when default changes.
-                        if (DBG) Slog.i(TAG, "listen: DEFAULT_SUB_ID");
+                        if (true/*DBG*/) log("listen: DEFAULT_SUB_ID");
                     }
                     mRecords.add(r);
-                    if (DBG) Slog.i(TAG, "listen: add new record");
+                    if (true/*DBG*/) log("listen: add new record");
                 }
                 int phoneId = SubscriptionManager.getPhoneId(subId);
                 r.events = events;
-                if (DBG) Slog.i(TAG, "listen: set events record=" + r);
+                if (true/*DBG*/) log("listen: set events record=" + r);
                 if (notifyNow && validatePhoneId(phoneId)) {
                     if ((events & PhoneStateListener.LISTEN_SERVICE_STATE) != 0) {
                         try {
@@ -392,7 +392,7 @@
                     }
                     if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_CELL_LOCATION)) {
                         try {
-                            if (DBG_LOC) Slog.d(TAG, "listen: mCellLocation = "
+                            if (DBG_LOC) log("listen: mCellLocation = "
                                     + mCellLocation[phoneId]);
                             r.callback.onCellLocationChanged(
                                     new Bundle(mCellLocation[phoneId]));
@@ -439,7 +439,7 @@
                     }
                     if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_CELL_INFO)) {
                         try {
-                            if (DBG_LOC) Slog.d(TAG, "listen: mCellInfo[" + phoneId + "] = "
+                            if (DBG_LOC) log("listen: mCellInfo[" + phoneId + "] = "
                                     + mCellInfo.get(phoneId));
                             r.callback.onCellInfoChanged(mCellInfo.get(phoneId));
                         } catch (RemoteException ex) {
@@ -512,8 +512,8 @@
         if (!checkNotifyPermission("notifyCallState()")) {
             return;
         }
-        if (VDBG) {
-            Slog.d(TAG, "notifyCallStateUsingSubId: subId=" + subId
+        if (true /*VDBG*/) {
+            log("notifyCallStateUsingSubId: subId=" + subId
                 + " state=" + state + " incomingNumber=" + incomingNumber);
         }
         synchronized (mRecords) {
@@ -548,10 +548,10 @@
         }
         if (subId == SubscriptionManager.DEFAULT_SUB_ID) {
             subId = mDefaultSubId;
-            Slog.d(TAG, "notifyServiceStateUsingSubId: using mDefaultSubId=" + mDefaultSubId);
+            log("notifyServiceStateUsingSubId: using mDefaultSubId=" + mDefaultSubId);
         }
-        if (VDBG) {
-            Slog.d(TAG, "notifyServiceStateUsingSubId: subId=" + subId
+        if (true/*VDBG*/) {
+            log("notifyServiceStateUsingSubId: subId=" + subId
                 + " state=" + state);
         }
         synchronized (mRecords) {
@@ -559,10 +559,13 @@
             if (validatePhoneId(phoneId)) {
                 mServiceState[phoneId] = state;
                 for (Record r : mRecords) {
+                    log("notifyServiceStateUsingSubId: r.events=0x" + Integer.toHexString(r.events) + " r.subId=" + r.subId + " subId=" + subId + " state=" + state);
                     // FIXME: use DEFAULT_SUB_ID instead??
                     if (((r.events & PhoneStateListener.LISTEN_SERVICE_STATE) != 0) &&
                             (r.subId == subId)) {
                         try {
+                            log("notifyServiceStateUsingSubId: call onSSC subId=" + subId
+                                    + " state=" + state);
                             r.callback.onServiceStateChanged(new ServiceState(state));
                         } catch (RemoteException ex) {
                             mRemoveList.add(r.binder);
@@ -570,7 +573,7 @@
                     }
                 }
             } else {
-                Slog.d(TAG, "notifyServiceStateUsingSubId: INVALID phoneId=" + phoneId);
+                log("notifyServiceStateUsingSubId: INVALID phoneId=" + phoneId);
             }
             handleRemoveListLocked();
         }
@@ -585,18 +588,21 @@
         if (!checkNotifyPermission("notifySignalStrength()")) {
             return;
         }
-        if (VDBG) {
-            Slog.d(TAG, "notifySignalStrengthUsingSubId: subId=" + subId
+        if (true/*VDBG*/) {
+            log("notifySignalStrengthUsingSubId: subId=" + subId
                 + " signalStrength=" + signalStrength);
         }
         synchronized (mRecords) {
             int phoneId = SubscriptionManager.getPhoneId(subId);
             if (validatePhoneId(phoneId)) {
+                log("notifySignalStrengthUsingSubId: valid phoneId=" + phoneId);
                 mSignalStrength[phoneId] = signalStrength;
                 for (Record r : mRecords) {
+                    log("notifySignalStrengthUsingSubId: r.events=0x" + Integer.toHexString(r.events) + " r.subId=" + r.subId + " subId=" + subId);
                     if (((r.events & PhoneStateListener.LISTEN_SIGNAL_STRENGTHS) != 0) &&
                         (r.subId == subId)){
                         try {
+                            log("notifySignalStrengthUsingSubId: callback.onSsS ss=" + signalStrength);
                             r.callback.onSignalStrengthsChanged(new SignalStrength(signalStrength));
                         } catch (RemoteException ex) {
                             mRemoveList.add(r.binder);
@@ -606,13 +612,16 @@
                         (r.subId == subId)) {
                         try {
                             int gsmSignalStrength = signalStrength.getGsmSignalStrength();
-                            r.callback.onSignalStrengthChanged((gsmSignalStrength == 99 ? -1
-                                    : gsmSignalStrength));
+                            int ss = (gsmSignalStrength == 99 ? -1 : gsmSignalStrength);
+                            log("notifySignalStrengthUsingSubId: callback.onSS gsmSS=" + gsmSignalStrength + " ss=" + ss);
+                            r.callback.onSignalStrengthChanged(ss);
                         } catch (RemoteException ex) {
                             mRemoveList.add(r.binder);
                         }
                     }
                 }
+            } else {
+                log("notifySignalStrengthUsingSubId: invalid phoneId=" + phoneId);
             }
             handleRemoveListLocked();
         }
@@ -628,7 +637,7 @@
             return;
         }
         if (VDBG) {
-            Slog.d(TAG, "notifyCellInfoUsingSubId: subId=" + subId
+            log("notifyCellInfoUsingSubId: subId=" + subId
                 + " cellInfo=" + cellInfo);
         }
 
@@ -641,7 +650,7 @@
                             && r.subId == subId) {
                         try {
                             if (DBG_LOC) {
-                                Slog.d(TAG, "notifyCellInfo: mCellInfo=" + cellInfo + " r=" + r);
+                                log("notifyCellInfo: mCellInfo=" + cellInfo + " r=" + r);
                             }
                             r.callback.onCellInfoChanged(cellInfo);
                         } catch (RemoteException ex) {
@@ -666,7 +675,7 @@
                         PhoneStateListener.LISTEN_DATA_CONNECTION_REAL_TIME_INFO)) {
                     try {
                         if (DBG_LOC) {
-                            Slog.d(TAG, "notifyDataConnectionRealTimeInfo: mDcRtInfo="
+                            log("notifyDataConnectionRealTimeInfo: mDcRtInfo="
                                     + mDcRtInfo + " r=" + r);
                         }
                         r.callback.onDataConnectionRealTimeInfoChanged(mDcRtInfo);
@@ -688,7 +697,7 @@
             return;
         }
         if (VDBG) {
-            Slog.d(TAG, "notifyMessageWaitingChangedUsingSubId: subId=" + subId
+            log("notifyMessageWaitingChangedUsingSubId: subId=" + subId
                 + " mwi=" + mwi);
         }
         synchronized (mRecords) {
@@ -719,7 +728,7 @@
             return;
         }
         if (VDBG) {
-            Slog.d(TAG, "notifyCallForwardingChangedUsingSubId: subId=" + subId
+            log("notifyCallForwardingChangedUsingSubId: subId=" + subId
                 + " cfi=" + cfi);
         }
         synchronized (mRecords) {
@@ -781,7 +790,7 @@
             return;
         }
         if (VDBG) {
-            Slog.i(TAG, "notifyDataConnectionUsingSubId: subId=" + subId
+            log("notifyDataConnectionUsingSubId: subId=" + subId
                 + " state=" + state + " isDataConnectivityPossible=" + isDataConnectivityPossible
                 + " reason='" + reason
                 + "' apn='" + apn + "' apnType=" + apnType + " networkType=" + networkType
@@ -820,14 +829,14 @@
             }
             if (modified) {
                 if (DBG) {
-                    Slog.d(TAG, "onDataConnectionStateChanged(" + mDataConnectionState[phoneId]
+                    log("onDataConnectionStateChanged(" + mDataConnectionState[phoneId]
                         + ", " + mDataConnectionNetworkType[phoneId] + ")");
                 }
                 for (Record r : mRecords) {
                     if (((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) &&
                             (r.subId == subId)) {
                         try {
-                            Slog.d(TAG,"Notify data connection state changed on sub: " +
+                            log("Notify data connection state changed on sub: " +
                                     subId);
                             r.callback.onDataConnectionStateChanged(mDataConnectionState[phoneId],
                                     mDataConnectionNetworkType[phoneId]);
@@ -867,7 +876,7 @@
             return;
         }
         if (VDBG) {
-            Slog.d(TAG, "notifyDataConnectionFailedUsingSubId: subId=" + subId
+            log("notifyDataConnectionFailedUsingSubId: subId=" + subId
                 + " reason=" + reason + " apnType=" + apnType);
         }
         synchronized (mRecords) {
@@ -895,13 +904,13 @@
     }
 
     public void notifyCellLocationUsingSubId(long subId, Bundle cellLocation) {
-        Slog.d(TAG, "notifyCellLocationUsingSubId: subId=" + subId
+        log("notifyCellLocationUsingSubId: subId=" + subId
                 + " cellLocation=" + cellLocation);
         if (!checkNotifyPermission("notifyCellLocation()")) {
             return;
         }
         if (VDBG) {
-            Slog.d(TAG, "notifyCellLocationUsingSubId: subId=" + subId
+            log("notifyCellLocationUsingSubId: subId=" + subId
                 + " cellLocation=" + cellLocation);
         }
         synchronized (mRecords) {
@@ -913,7 +922,7 @@
                             && r.subId == subId) {
                         try {
                             if (DBG_LOC) {
-                                Slog.d(TAG, "notifyCellLocation: cellLocation=" + cellLocation
+                                log("notifyCellLocation: cellLocation=" + cellLocation
                                         + " r=" + r);
                             }
                             r.callback.onCellLocationChanged(new Bundle(cellLocation));
@@ -1221,7 +1230,7 @@
         }
         String msg = "Modify Phone State Permission Denial: " + method + " from pid="
                 + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid();
-        if (DBG) Slog.w(TAG, msg);
+        if (DBG) log(msg);
         return false;
     }
 
@@ -1267,7 +1276,7 @@
             foregroundUser = ActivityManager.getCurrentUser();
             valid = r.callerUid ==  foregroundUser && (r.events & events) != 0;
             if (DBG | DBG_LOC) {
-                Slog.d(TAG, "validateEventsAndUserLocked: valid=" + valid
+                log("validateEventsAndUserLocked: valid=" + valid
                         + " r.callerUid=" + r.callerUid + " foregroundUser=" + foregroundUser
                         + " r.events=" + r.events + " events=" + events);
             }
@@ -1279,7 +1288,11 @@
 
     private boolean validatePhoneId(int phoneId) {
         boolean valid = (phoneId >= 0) && (phoneId < mNumPhones);
-        if (VDBG) Slog.d(TAG, "validatePhoneId: " + valid);
+        if (VDBG) log("validatePhoneId: " + valid);
         return valid;
     }
+
+    private static void log(String s) {
+        Rlog.d(TAG, s);
+    }
 }
diff --git a/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java b/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java
index c299981..e3d8ee2 100644
--- a/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java
+++ b/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java
@@ -228,7 +228,12 @@
     }
 
     private void mayCancelOneTouchRecord(int address) {
-        // TODO: implement this.
+        List<OneTouchRecordAction> actions = getActions(OneTouchRecordAction.class);
+        for (OneTouchRecordAction action : actions) {
+            if (action.getRecorderAddress() == address) {
+                removeAction(action);
+            }
+        }
     }
 
     private void mayDisableSystemAudioAndARC(int address) {
diff --git a/services/core/java/com/android/server/hdmi/OneTouchRecordAction.java b/services/core/java/com/android/server/hdmi/OneTouchRecordAction.java
new file mode 100644
index 0000000..7646027
--- /dev/null
+++ b/services/core/java/com/android/server/hdmi/OneTouchRecordAction.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.hdmi;
+
+/**
+ * Feature action that performs one touch record.
+ * This class only provides a skeleton of one touch play and has no detail implementaion.
+ */
+public class OneTouchRecordAction extends FeatureAction {
+    private final int mRecorderAddress;
+
+    OneTouchRecordAction(HdmiCecLocalDevice source, int recorderAddress) {
+        super(source);
+        mRecorderAddress = recorderAddress;
+    }
+
+    @Override
+    boolean start() {
+        return false;
+    }
+
+    @Override
+    boolean processCommand(HdmiCecMessage cmd) {
+        return false;
+    }
+
+    @Override
+    void handleTimerEvent(int state) {
+    }
+
+    int getRecorderAddress() {
+        return mRecorderAddress;
+    }
+}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 911c034a..27c008c 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -25,6 +25,7 @@
 import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
 import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
 import static android.content.pm.PackageManager.INSTALL_EXTERNAL;
+import static android.content.pm.PackageManager.INSTALL_FAILED_USER_RESTRICTED;
 import static android.content.pm.PackageManager.INSTALL_FORWARD_LOCK;
 import static android.content.pm.PackageParser.isApkFile;
 import static android.os.Process.PACKAGE_INFO_GID;
@@ -87,7 +88,6 @@
 import android.content.ServiceConnection;
 import android.content.pm.ActivityInfo;
 import android.content.pm.ApplicationInfo;
-import android.content.pm.ContainerEncryptionParams;
 import android.content.pm.FeatureInfo;
 import android.content.pm.IPackageDataObserver;
 import android.content.pm.IPackageDeleteObserver;
@@ -1093,15 +1093,8 @@
                         }
                         if (args.observer != null) {
                             try {
-                                args.observer.packageInstalled(res.name, res.returnCode);
-                            } catch (RemoteException e) {
-                                Slog.i(TAG, "Observer no longer exists.");
-                            }
-                        }
-                        if (args.observer2 != null) {
-                            try {
                                 Bundle extras = extrasForInstallResult(res);
-                                args.observer2.packageInstalled(res.name, extras, res.returnCode);
+                                args.observer.packageInstalled(res.name, extras, res.returnCode);
                             } catch (RemoteException e) {
                                 Slog.i(TAG, "Observer no longer exists.");
                             }
@@ -7617,104 +7610,19 @@
         private final boolean mIsPrivileged;
     }
 
-    /*
-     * The old-style observer methods all just trampoline to the newer signature with
-     * expanded install observer API.  The older API continues to work but does not
-     * supply the additional details of the Observer2 API.
-     */
-
-    /* Called when a downloaded package installation has been confirmed by the user */
-    public void installPackage(
-            final Uri packageURI, final IPackageInstallObserver observer, final int flags) {
-        installPackageEtc(packageURI, observer, null, flags, null);
-    }
-
-    /* Called when a downloaded package installation has been confirmed by the user */
     @Override
-    public void installPackage(
-            final Uri packageURI, final IPackageInstallObserver observer, final int flags,
-            final String installerPackageName) {
-        installPackageWithVerificationEtc(packageURI, observer, null, flags,
-                installerPackageName, null, null, null);
-    }
-
-    @Override
-    public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer,
-            int flags, String installerPackageName, Uri verificationURI,
-            ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) {
-        VerificationParams verificationParams = new VerificationParams(verificationURI, null, null,
-                VerificationParams.NO_UID, manifestDigest);
-        installPackageWithVerificationAndEncryptionEtc(packageURI, observer, null, flags,
-                installerPackageName, verificationParams, encryptionParams);
-    }
-
-    @Override
-    public void installPackageWithVerificationAndEncryption(Uri packageURI,
-            IPackageInstallObserver observer, int flags, String installerPackageName,
-            VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
-        installPackageWithVerificationAndEncryptionEtc(packageURI, observer, null, flags,
-                installerPackageName, verificationParams, encryptionParams);
-    }
-
-    /*
-     * And here are the "live" versions that take both observer arguments
-     */
-    public void installPackageEtc(
-            final Uri packageURI, final IPackageInstallObserver observer,
-            IPackageInstallObserver2 observer2, final int flags) {
-        installPackageEtc(packageURI, observer, observer2, flags, null);
-    }
-
-    public void installPackageEtc(
-            final Uri packageURI, final IPackageInstallObserver observer,
-            final IPackageInstallObserver2 observer2, final int flags,
-            final String installerPackageName) {
-        installPackageWithVerificationEtc(packageURI, observer, observer2, flags,
-                installerPackageName, null, null, null);
-    }
-
-    @Override
-    public void installPackageWithVerificationEtc(Uri packageURI, IPackageInstallObserver observer,
-            IPackageInstallObserver2 observer2,
-            int flags, String installerPackageName, Uri verificationURI,
-            ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) {
-        VerificationParams verificationParams = new VerificationParams(verificationURI, null, null,
-                VerificationParams.NO_UID, manifestDigest);
-        installPackageWithVerificationAndEncryptionEtc(packageURI, observer, observer2, flags,
-                installerPackageName, verificationParams, encryptionParams);
-    }
-
-    /*
-     * All of the installPackage...*() methods redirect to this one for the master implementation
-     */
-    public void installPackageWithVerificationAndEncryptionEtc(Uri packageURI,
-            IPackageInstallObserver observer, IPackageInstallObserver2 observer2,
-            int flags, String installerPackageName,
-            VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
-        if (observer == null && observer2 == null) {
-            throw new IllegalArgumentException("No install observer supplied");
-        }
-        installPackageWithVerificationEncryptionAndAbiOverrideEtc(packageURI, observer, observer2,
-                flags, installerPackageName, verificationParams, encryptionParams, null);
-    }
-
-    @Override
-    public void installPackageWithVerificationEncryptionAndAbiOverrideEtc(Uri packageURI,
-            IPackageInstallObserver observer, IPackageInstallObserver2 observer2,
-            int flags, String installerPackageName,
-            VerificationParams verificationParams, ContainerEncryptionParams encryptionParams,
+    public void installPackage(String originPath, IPackageInstallObserver2 observer, int flags,
+            String installerPackageName, VerificationParams verificationParams,
             String packageAbiOverride) {
         mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INSTALL_PACKAGES,
                 null);
 
+        final File originFile = new File(originPath);
         final int uid = Binder.getCallingUid();
         if (isUserRestricted(UserHandle.getUserId(uid), UserManager.DISALLOW_INSTALL_APPS)) {
             try {
                 if (observer != null) {
-                    observer.packageInstalled("", PackageManager.INSTALL_FAILED_USER_RESTRICTED);
-                }
-                if (observer2 != null) {
-                    observer2.packageInstalled("", null, PackageManager.INSTALL_FAILED_USER_RESTRICTED);
+                    observer.packageInstalled("", null, INSTALL_FAILED_USER_RESTRICTED);
                 }
             } catch (RemoteException re) {
             }
@@ -7729,7 +7637,6 @@
         }
 
         final int filteredFlags;
-
         if (uid == Process.SHELL_UID || uid == 0) {
             if (DEBUG_INSTALL) {
                 Slog.v(TAG, "Install from ADB");
@@ -7741,18 +7648,9 @@
 
         verificationParams.setInstallerUid(uid);
 
-        if (!"file".equals(packageURI.getScheme())) {
-            throw new UnsupportedOperationException("Only file:// URIs are supported");
-        }
-        final File fromFile = new File(packageURI.getPath());
-
-        if (encryptionParams != null) {
-            throw new UnsupportedOperationException("ContainerEncryptionParams not supported");
-        }
-
         final Message msg = mHandler.obtainMessage(INIT_COPY);
-        msg.obj = new InstallParams(fromFile, observer, observer2, filteredFlags,
-                installerPackageName, verificationParams, user, packageAbiOverride);
+        msg.obj = new InstallParams(originFile, observer, filteredFlags, installerPackageName,
+                verificationParams, user, packageAbiOverride);
         mHandler.sendMessage(msg);
     }
 
@@ -8469,8 +8367,7 @@
          */
         boolean originTrusted;
 
-        final IPackageInstallObserver observer;
-        final IPackageInstallObserver2 observer2;
+        final IPackageInstallObserver2 observer;
         int flags;
         final String installerPackageName;
         final VerificationParams verificationParams;
@@ -8479,14 +8376,13 @@
         final String packageAbiOverride;
         final String packageInstructionSetOverride;
 
-        InstallParams(File originFile, IPackageInstallObserver observer,
-                IPackageInstallObserver2 observer2, int flags, String installerPackageName,
-                VerificationParams verificationParams, UserHandle user, String packageAbiOverride) {
+        InstallParams(File originFile, IPackageInstallObserver2 observer, int flags,
+                String installerPackageName, VerificationParams verificationParams, UserHandle user,
+                String packageAbiOverride) {
             super(user);
             this.originFile = Preconditions.checkNotNull(originFile);
             this.originTrusted = false;
             this.observer = observer;
-            this.observer2 = observer2;
             this.flags = flags;
             this.installerPackageName = installerPackageName;
             this.verificationParams = verificationParams;
@@ -9018,8 +8914,7 @@
 
         // TODO: define inherit location
 
-        final IPackageInstallObserver observer;
-        final IPackageInstallObserver2 observer2;
+        final IPackageInstallObserver2 observer;
         // Always refers to PackageManager flags only
         final int flags;
         final String installerPackageName;
@@ -9028,15 +8923,13 @@
         final String instructionSet;
         final String abiOverride;
 
-        InstallArgs(File originFile, boolean originTrusted, IPackageInstallObserver observer,
-                IPackageInstallObserver2 observer2, int flags, String installerPackageName,
-                ManifestDigest manifestDigest, UserHandle user, String instructionSet,
-                String abiOverride) {
+        InstallArgs(File originFile, boolean originTrusted, IPackageInstallObserver2 observer,
+                int flags, String installerPackageName, ManifestDigest manifestDigest,
+                UserHandle user, String instructionSet, String abiOverride) {
             this.originFile = originFile;
             this.originTrusted = originTrusted;
             this.flags = flags;
             this.observer = observer;
-            this.observer2 = observer2;
             this.installerPackageName = installerPackageName;
             this.manifestDigest = manifestDigest;
             this.user = user;
@@ -9113,10 +9006,9 @@
 
         /** New install */
         FileInstallArgs(InstallParams params) {
-            super(params.originFile, params.originTrusted, params.observer, params.observer2,
-                    params.flags, params.installerPackageName, params.getManifestDigest(),
-                    params.getUser(), params.packageInstructionSetOverride,
-                    params.packageAbiOverride);
+            super(params.originFile, params.originTrusted, params.observer, params.flags,
+                    params.installerPackageName, params.getManifestDigest(), params.getUser(),
+                    params.packageInstructionSetOverride, params.packageAbiOverride);
             if (isFwdLocked()) {
                 throw new IllegalArgumentException("Forward locking only supported in ASEC");
             }
@@ -9125,7 +9017,7 @@
         /** Existing install */
         FileInstallArgs(String codePath, String resourcePath, String nativeLibraryPath,
                 String instructionSet) {
-            super(null, false, null, null, 0, null, null, null, instructionSet, null);
+            super(null, false, null, 0, null, null, null, instructionSet, null);
             this.codeFile = (codePath != null) ? new File(codePath) : null;
             this.resourceFile = (resourcePath != null) ? new File(resourcePath) : null;
             this.nativeLibraryFile = (nativeLibraryPath != null) ? new File(nativeLibraryPath) : null;
@@ -9133,7 +9025,7 @@
 
         /** New install from existing */
         FileInstallArgs(File originFile, String instructionSet) {
-            super(originFile, true, null, null, 0, null, null, null, instructionSet, null);
+            super(originFile, true, null, 0, null, null, null, instructionSet, null);
         }
 
         boolean checkFreeStorage(IMediaContainerService imcs) throws RemoteException {
@@ -9393,16 +9285,15 @@
 
         /** New install */
         AsecInstallArgs(InstallParams params) {
-            super(params.originFile, params.originTrusted, params.observer, params.observer2,
-                    params.flags, params.installerPackageName, params.getManifestDigest(),
-                    params.getUser(), params.packageInstructionSetOverride,
-                    params.packageAbiOverride);
+            super(params.originFile, params.originTrusted, params.observer, params.flags,
+                    params.installerPackageName, params.getManifestDigest(), params.getUser(),
+                    params.packageInstructionSetOverride, params.packageAbiOverride);
         }
 
         /** Existing install */
         AsecInstallArgs(String fullCodePath, String fullResourcePath, String nativeLibraryPath,
                 String instructionSet, boolean isExternal, boolean isForwardLocked) {
-            super(null, false, null, null, (isExternal ? INSTALL_EXTERNAL : 0)
+            super(null, false, null, (isExternal ? INSTALL_EXTERNAL : 0)
                     | (isForwardLocked ? INSTALL_FORWARD_LOCK : 0), null, null, null,
                     instructionSet, null);
             // Extract cid from fullCodePath
@@ -9414,7 +9305,7 @@
         }
 
         AsecInstallArgs(String cid, String instructionSet, boolean isForwardLocked) {
-            super(null, false, null, null, (isAsecExternal(cid) ? INSTALL_EXTERNAL : 0)
+            super(null, false, null, (isAsecExternal(cid) ? INSTALL_EXTERNAL : 0)
                     | (isForwardLocked ? INSTALL_FORWARD_LOCK : 0), null, null, null,
                     instructionSet, null);
             this.cid = cid;
@@ -9424,7 +9315,7 @@
         /** New install from existing */
         AsecInstallArgs(File originPackageFile, String cid, String instructionSet,
                 boolean isExternal, boolean isForwardLocked) {
-            super(originPackageFile, true, null, null, (isExternal ? INSTALL_EXTERNAL : 0)
+            super(originPackageFile, true, null, (isExternal ? INSTALL_EXTERNAL : 0)
                     | (isForwardLocked ? INSTALL_FORWARD_LOCK : 0), null, null, null,
                     instructionSet, null);
             this.cid = cid;
diff --git a/telecomm/java/android/telecomm/PhoneAccount.java b/telecomm/java/android/telecomm/PhoneAccount.java
index e972aee..fa7120d 100644
--- a/telecomm/java/android/telecomm/PhoneAccount.java
+++ b/telecomm/java/android/telecomm/PhoneAccount.java
@@ -28,6 +28,7 @@
 import android.util.Log;
 
 import java.util.MissingResourceException;
+import java.util.Objects;
 
 /**
  * Represents a distinct account, line of service or call placement method that
@@ -42,9 +43,8 @@
     private final ComponentName mComponentName;
     private final String mId;
     private final Uri mHandle;
-    private final int mLabelResId;
-    private final int mShortDescriptionResId;
-    private final int mIconResId;
+    private final String mLabel;
+    private final String mShortDescription;
     private final boolean mIsEnabled;
     private final boolean mIsSystemDefault;
 
@@ -59,9 +59,8 @@
         mComponentName = componentName;
         mId = id;
         mHandle = handle;
-        mLabelResId = 0;  // labelResId;
-        mShortDescriptionResId = 0;  // shortDescriptionResId;
-        mIconResId = 0;  // iconResId;
+        mLabel = label;
+        mShortDescription = shortDescription;
         mIsSystemDefault = isSystemDefault;
         mIsEnabled = isEnabled;
     }
@@ -103,10 +102,12 @@
      *
      * @param context The invoking {@code Context}, used for retrieving resources.
      *
+     * TODO(ihab): If don't need context, remove param
+     *
      * @return A label for this {@code PhoneAccount}.
      */
     public String getLabel(Context context) {
-        return getString(context, mLabelResId);
+        return mLabel;
     }
 
     /**
@@ -114,12 +115,19 @@
      *
      * @param context The invoking {@code Context}, used for retrieving resources.
      *
+     * TODO(ihab): If don't need context, remove param
+     *
      * @return A description for this {@code PhoneAccount}.
      */
     public String getShortDescription(Context context) {
-        return getString(context, mShortDescriptionResId);
+        return mShortDescription;
     }
 
+    // TODO(ihab): Representation of the icons
+    //
+    // Refactor to pass a Bitmap (scale it at runtime), but if they don't pass one, fall
+    // back to the android:icon attr in the manifest (<service /> first, <application /> second)
+
     /**
      * An icon to represent this {@code PhoneAccount} in a user interface.
      *
@@ -128,7 +136,7 @@
      * @return An icon for this {@code PhoneAccount}.
      */
     public Drawable getIcon(Context context) {
-        return getIcon(context, mIconResId, NO_DENSITY);
+        return null;  // TODO(ihab): See above
     }
 
     /**
@@ -140,7 +148,7 @@
      * @return An icon for this {@code PhoneAccount}.
      */
     public Drawable getIcon(Context context, int density) {
-        return getIcon(context, mIconResId, density);
+        return null;  // TODO(ihab): See above
     }
 
     /**
@@ -169,9 +177,8 @@
         out.writeParcelable(mComponentName, flags);
         out.writeString(mId);
         out.writeString(mHandle != null ? mHandle.toString() : "");
-        out.writeInt(mLabelResId);
-        out.writeInt(mShortDescriptionResId);
-        out.writeInt(mIconResId);
+        out.writeString(mLabel);
+        out.writeString(mShortDescription);
         out.writeInt(mIsEnabled ? 1 : 0);
         out.writeInt(mIsSystemDefault ? 1 : 0);
     }
@@ -192,49 +199,22 @@
         mId = in.readString();
         String uriString = in.readString();
         mHandle = uriString.length() > 0 ? Uri.parse(uriString) : null;
-        mLabelResId = in.readInt();
-        mShortDescriptionResId = in.readInt();
-        mIconResId = in.readInt();
+        mLabel = in.readString();
+        mShortDescription = in.readString();
         mIsEnabled = in.readInt() == 1;
         mIsSystemDefault = in.readInt() == 1;
     }
 
-    private String getString(Context context, int resId) {
-        Context packageContext;
-        try {
-            packageContext = context.createPackageContext(mComponentName.getPackageName(), 0);
-        } catch (PackageManager.NameNotFoundException e) {
-            if (Rlog.isLoggable(LOG_TAG, Log.WARN)) {
-                Rlog.w(LOG_TAG, "Cannot find package " + mComponentName.getPackageName());
-            }
-            return null;
-        }
-        String result = packageContext.getString(resId);
-        if (result == null && Rlog.isLoggable(LOG_TAG, Log.WARN)) {
-            Rlog.w(LOG_TAG, "Cannot find string " + resId + " in package " +
-                    mComponentName.getPackageName());
-        }
-        return result;
+    @Override
+    public boolean equals(Object other) {
+        return
+                other instanceof PhoneAccount &&
+                Objects.equals(mComponentName, ((PhoneAccount) other).mComponentName) &&
+                Objects.equals(mId, ((PhoneAccount) other).mId);
     }
 
-    private Drawable getIcon(Context context, int resId, int density) {
-        Context packageContext;
-        try {
-            packageContext = context.createPackageContext(mComponentName.getPackageName(), 0);
-        } catch (PackageManager.NameNotFoundException e) {
-            if (Rlog.isLoggable(LOG_TAG, Log.WARN)) {
-                Rlog.w(LOG_TAG, "Cannot find package " + mComponentName.getPackageName());
-            }
-            return null;
-        }
-        try {
-            return density == NO_DENSITY ?
-                    packageContext.getResources().getDrawable(resId) :
-                    packageContext.getResources().getDrawableForDensity(resId, density);
-        } catch (MissingResourceException e) {
-            Rlog.e(LOG_TAG, "Cannot find icon " + resId + " in package " +
-                    mComponentName.getPackageName() + ": " + e.toString());
-            return null;
-        }
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(mComponentName) + Objects.hashCode(mId);
     }
 }
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/Android.mk b/tests/Camera2Tests/SmartCamera/SimpleCamera/Android.mk
index 801c81c..4e3675f 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/Android.mk
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/Android.mk
@@ -23,7 +23,7 @@
 LOCAL_PROGUARD_ENABLED := disabled
 
 # comment it out for now since we need use some hidden APIs
-# LOCAL_SDK_VERSION := current
+LOCAL_SDK_VERSION := current
 
 LOCAL_STATIC_JAVA_LIBRARIES := android-ex-camera2
 
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/samples/simplecamera/Camera2Source.java b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/samples/simplecamera/Camera2Source.java
index 6876f5a..05057f2 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/samples/simplecamera/Camera2Source.java
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/samples/simplecamera/Camera2Source.java
@@ -22,6 +22,7 @@
 import android.hardware.camera2.CameraAccessException;
 import android.hardware.camera2.CameraCharacteristics;
 import android.hardware.camera2.CameraDevice;
+import android.hardware.camera2.CameraCaptureSession;
 import android.hardware.camera2.CameraManager;
 import android.hardware.camera2.CaptureFailure;
 import android.hardware.camera2.CaptureRequest;
@@ -37,6 +38,7 @@
 import android.view.Surface;
 import com.android.ex.camera2.blocking.BlockingCameraManager;
 import com.android.ex.camera2.blocking.BlockingCameraManager.BlockingOpenException;
+import com.android.ex.camera2.blocking.BlockingSessionListener;
 import androidx.media.filterfw.Filter;
 import androidx.media.filterfw.Frame;
 import androidx.media.filterfw.FrameImage2D;
@@ -56,6 +58,7 @@
     private static final String TAG = "Camera2Source";
     private CameraManager mCameraManager;
     private CameraDevice mCamera;
+    private CameraCaptureSession mCameraSession;
     private RenderScript mRS;
     private Surface mSurface;
     private CameraCharacteristics mProperties;
@@ -67,6 +70,8 @@
     private Allocation mAllocationOut;
     private Bitmap mBitmap;
 
+    private static final long SESSION_TIMEOUT_MS = 2000;
+
     class MyCameraListener extends CameraManager.AvailabilityListener {
 
         @Override
@@ -83,10 +88,10 @@
 
     }
 
-    class MyCaptureListener extends CameraDevice.CaptureListener {
+    class MyCaptureListener extends CameraCaptureSession.CaptureListener {
 
         @Override
-        public void onCaptureCompleted(CameraDevice camera, CaptureRequest request,
+        public void onCaptureCompleted(CameraCaptureSession camera, CaptureRequest request,
                 TotalCaptureResult result) {
             // TODO Auto-generated method stub
             Log.v(TAG, "in onCaptureComplete");
@@ -94,7 +99,7 @@
         }
 
         @Override
-        public void onCaptureFailed(CameraDevice camera, CaptureRequest request,
+        public void onCaptureFailed(CameraCaptureSession camera, CaptureRequest request,
                 CaptureFailure failure) {
             // TODO Auto-generated method stub
             Log.v(TAG, "onCaptureFailed is being called");
@@ -184,16 +189,21 @@
         surfaces.add(mSurface);
         CaptureRequest.Builder mCaptureRequest = null;
         try {
-            mCamera.configureOutputs(surfaces);
+            BlockingSessionListener blkSession = new BlockingSessionListener();
+
+            mCamera.createCaptureSession(surfaces, blkSession, mHandler);
             mCaptureRequest = mCamera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
             mCaptureRequest.addTarget(mSurface);
+
+            mCameraSession = blkSession.waitAndGetSession(SESSION_TIMEOUT_MS);
+
         } catch (CameraAccessException e) {
             e.printStackTrace();
             throw new RuntimeException(e);
         }
 
         try {
-            mCamera.setRepeatingRequest(mCaptureRequest.build(), new MyCaptureListener(),
+            mCameraSession.setRepeatingRequest(mCaptureRequest.build(), new MyCaptureListener(),
                     mHandler);
         } catch (CameraAccessException e) {
             e.printStackTrace();
diff --git a/wifi/java/android/net/wifi/ScanResult.java b/wifi/java/android/net/wifi/ScanResult.java
index 8191edd..0dbf5ca 100644
--- a/wifi/java/android/net/wifi/ScanResult.java
+++ b/wifi/java/android/net/wifi/ScanResult.java
@@ -63,6 +63,20 @@
      */
     public long seen;
 
+    /** @hide */
+    public static final int ENABLED                                          = 0;
+    /** @hide */
+    public static final int AUTO_ROAM_DISABLED                               = 16;
+    /** @hide */
+    public static final int AUTO_JOIN_DISABLED                               = 32;
+    /** @hide */
+    public static final int AUTHENTICATIO_ERROR                              = 128;
+
+    /**
+     * Status: indicating join status
+     * @hide
+     */
+    public int status;
 
     /**
      * The approximate distance to the AP in centimeter, if available.  Else
@@ -160,6 +174,7 @@
             distanceSdCm = source.distanceSdCm;
             seen = source.seen;
             passpoint = source.passpoint;
+            status = source.status;
         }
     }
 
@@ -194,7 +209,9 @@
                 append("(cm)");
 
         sb.append(", passpoint: ").append(passpoint != null ? "yes" : "no");
-
+        if (status != 0) {
+            sb.append(", status: ").append(status);
+        }
         return sb.toString();
     }
 
@@ -219,6 +236,7 @@
         dest.writeInt(distanceCm);
         dest.writeInt(distanceSdCm);
         dest.writeLong(seen);
+        dest.writeInt(status);
         if (passpoint != null) {
             dest.writeInt(1);
             passpoint.writeToParcel(dest, flags);
@@ -256,6 +274,7 @@
                     in.readInt()
                 );
                 sr.seen = in.readLong();
+                sr.status = in.readInt();
                 if (in.readInt() == 1) {
                     sr.passpoint = WifiPasspointInfo.CREATOR.createFromParcel(in);
                 }
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index ae16102..e99ea35 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -2241,8 +2241,9 @@
     public void enableVerboseLogging (int verbose) {
         try {
             mService.enableVerboseLogging(verbose);
-        } catch (RemoteException e) {
-
+        } catch (Exception e) {
+            //ignore any failure here
+            Log.e(TAG, "enableVerboseLogging " + e.toString());
         }
     }