Merge "Add metadata for pre-distortion dimensions." into mnc-dev
diff --git a/api/current.txt b/api/current.txt
index 1139802..e6bbdbe 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -30538,6 +30538,7 @@
     field public static final java.lang.String ACTION_CHANGE_DEFAULT_DIALER = "android.telecom.action.CHANGE_DEFAULT_DIALER";
     field public static final java.lang.String ACTION_CHANGE_PHONE_ACCOUNTS = "android.telecom.action.CHANGE_PHONE_ACCOUNTS";
     field public static final java.lang.String ACTION_CONNECTION_SERVICE_CONFIGURE = "android.telecom.action.CONNECTION_SERVICE_CONFIGURE";
+    field public static final java.lang.String ACTION_DEFAULT_DIALER_CHANGED = "android.telecom.action.DEFAULT_DIALER_CHANGED";
     field public static final java.lang.String ACTION_INCOMING_CALL = "android.telecom.action.INCOMING_CALL";
     field public static final java.lang.String ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS = "android.telecom.action.SHOW_CALL_ACCESSIBILITY_SETTINGS";
     field public static final java.lang.String ACTION_SHOW_CALL_SETTINGS = "android.telecom.action.SHOW_CALL_SETTINGS";
@@ -30615,9 +30616,11 @@
     field public static final java.lang.String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool";
     field public static final java.lang.String KEY_CARRIER_VOLTE_PROVISIONED_BOOL = "carrier_volte_provisioned_bool";
     field public static final java.lang.String KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL = "carrier_volte_tty_supported_bool";
+    field public static final java.lang.String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool";
+    field public static final java.lang.String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string";
     field public static final java.lang.String KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL = "disable_cdma_activation_code_bool";
     field public static final java.lang.String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool";
-    field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "key_enable_dialer_vibration_bool";
+    field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_vibration_bool";
     field public static final java.lang.String KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL = "has_in_call_noise_suppression_bool";
     field public static final java.lang.String KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL = "hide_carrier_network_settings_bool";
     field public static final java.lang.String KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL = "ignore_sim_network_locked_events_bool";
diff --git a/api/system-current.txt b/api/system-current.txt
index 0f59896..fb3c874 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -32754,6 +32754,7 @@
     field public static final java.lang.String ACTION_CHANGE_DEFAULT_DIALER = "android.telecom.action.CHANGE_DEFAULT_DIALER";
     field public static final java.lang.String ACTION_CHANGE_PHONE_ACCOUNTS = "android.telecom.action.CHANGE_PHONE_ACCOUNTS";
     field public static final java.lang.String ACTION_CONNECTION_SERVICE_CONFIGURE = "android.telecom.action.CONNECTION_SERVICE_CONFIGURE";
+    field public static final java.lang.String ACTION_DEFAULT_DIALER_CHANGED = "android.telecom.action.DEFAULT_DIALER_CHANGED";
     field public static final java.lang.String ACTION_INCOMING_CALL = "android.telecom.action.INCOMING_CALL";
     field public static final java.lang.String ACTION_PHONE_ACCOUNT_REGISTERED = "android.telecom.action.PHONE_ACCOUNT_REGISTERED";
     field public static final java.lang.String ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS = "android.telecom.action.SHOW_CALL_ACCESSIBILITY_SETTINGS";
@@ -32835,9 +32836,11 @@
     field public static final java.lang.String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool";
     field public static final java.lang.String KEY_CARRIER_VOLTE_PROVISIONED_BOOL = "carrier_volte_provisioned_bool";
     field public static final java.lang.String KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL = "carrier_volte_tty_supported_bool";
+    field public static final java.lang.String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool";
+    field public static final java.lang.String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string";
     field public static final java.lang.String KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL = "disable_cdma_activation_code_bool";
     field public static final java.lang.String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool";
-    field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "key_enable_dialer_vibration_bool";
+    field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_vibration_bool";
     field public static final java.lang.String KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL = "has_in_call_noise_suppression_bool";
     field public static final java.lang.String KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL = "hide_carrier_network_settings_bool";
     field public static final java.lang.String KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL = "ignore_sim_network_locked_events_bool";
diff --git a/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java b/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java
index 161c339..834a587 100644
--- a/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java
+++ b/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java
@@ -28,10 +28,10 @@
 public final class BluetoothActivityEnergyInfo implements Parcelable {
     private final long mTimestamp;
     private final int mBluetoothStackState;
-    private final int mControllerTxTimeMs;
-    private final int mControllerRxTimeMs;
-    private final int mControllerIdleTimeMs;
-    private final int mControllerEnergyUsed;
+    private final long mControllerTxTimeMs;
+    private final long mControllerRxTimeMs;
+    private final long mControllerIdleTimeMs;
+    private final long mControllerEnergyUsed;
 
     public static final int BT_STACK_STATE_INVALID = 0;
     public static final int BT_STACK_STATE_STATE_ACTIVE = 1;
@@ -39,7 +39,7 @@
     public static final int BT_STACK_STATE_STATE_IDLE = 3;
 
     public BluetoothActivityEnergyInfo(long timestamp, int stackState,
-                                       int txTime, int rxTime, int idleTime, int energyUsed) {
+                                       long txTime, long rxTime, long idleTime, long energyUsed) {
         mTimestamp = timestamp;
         mBluetoothStackState = stackState;
         mControllerTxTimeMs = txTime;
@@ -65,10 +65,10 @@
         public BluetoothActivityEnergyInfo createFromParcel(Parcel in) {
             long timestamp = in.readLong();
             int stackState = in.readInt();
-            int txTime = in.readInt();
-            int rxTime = in.readInt();
-            int idleTime = in.readInt();
-            int energyUsed = in.readInt();
+            long txTime = in.readLong();
+            long rxTime = in.readLong();
+            long idleTime = in.readLong();
+            long energyUsed = in.readLong();
             return new BluetoothActivityEnergyInfo(timestamp, stackState,
                     txTime, rxTime, idleTime, energyUsed);
         }
@@ -80,10 +80,10 @@
     public void writeToParcel(Parcel out, int flags) {
         out.writeLong(mTimestamp);
         out.writeInt(mBluetoothStackState);
-        out.writeInt(mControllerTxTimeMs);
-        out.writeInt(mControllerRxTimeMs);
-        out.writeInt(mControllerIdleTimeMs);
-        out.writeInt(mControllerEnergyUsed);
+        out.writeLong(mControllerTxTimeMs);
+        out.writeLong(mControllerRxTimeMs);
+        out.writeLong(mControllerIdleTimeMs);
+        out.writeLong(mControllerEnergyUsed);
     }
 
     public int describeContents() {
@@ -100,21 +100,21 @@
     /**
      * @return tx time in ms
      */
-    public int getControllerTxTimeMillis() {
+    public long getControllerTxTimeMillis() {
         return mControllerTxTimeMs;
     }
 
     /**
      * @return rx time in ms
      */
-    public int getControllerRxTimeMillis() {
+    public long getControllerRxTimeMillis() {
         return mControllerRxTimeMs;
     }
 
     /**
      * @return idle time in ms
      */
-    public int getControllerIdleTimeMillis() {
+    public long getControllerIdleTimeMillis() {
         return mControllerIdleTimeMs;
     }
 
@@ -122,7 +122,7 @@
      * product of current(mA), voltage(V) and time(ms)
      * @return energy used
      */
-    public int getControllerEnergyUsed() {
+    public long getControllerEnergyUsed() {
         return mControllerEnergyUsed;
     }
 
@@ -137,8 +137,8 @@
      * @return if the record is valid
      */
     public boolean isValid() {
-        return ((getControllerTxTimeMillis() !=0) ||
-                (getControllerRxTimeMillis() !=0) ||
-                (getControllerIdleTimeMillis() !=0));
+        return ((mControllerTxTimeMs !=0) ||
+                (mControllerRxTimeMs !=0) ||
+                (mControllerIdleTimeMs !=0));
     }
 }
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index 04510d9..152bc22 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -1109,13 +1109,13 @@
     /**
      * <p>The correction coefficients to correct for this camera device's
      * radial and tangential lens distortion.</p>
-     * <p>Three radial distortion coefficients <code>[kappa_1, kappa_2,
+     * <p>Four radial distortion coefficients <code>[kappa_0, kappa_1, kappa_2,
      * kappa_3]</code> and two tangential distortion coefficients
      * <code>[kappa_4, kappa_5]</code> that can be used to correct the
      * lens's geometric distortion with the mapping equations:</p>
-     * <pre><code> x_c = x_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
+     * <pre><code> x_c = x_i * ( kappa_0 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
      *        kappa_4 * (2 * x_i * y_i) + kappa_5 * ( r^2 + 2 * x_i^2 )
-     *  y_c = y_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
+     *  y_c = y_i * ( kappa_0 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
      *        kappa_5 * (2 * x_i * y_i) + kappa_4 * ( r^2 + 2 * y_i^2 )
      * </code></pre>
      * <p>Here, <code>[x_c, y_c]</code> are the coordinates to sample in the
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index 3bb2fdb..479583c 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -2671,13 +2671,13 @@
     /**
      * <p>The correction coefficients to correct for this camera device's
      * radial and tangential lens distortion.</p>
-     * <p>Three radial distortion coefficients <code>[kappa_1, kappa_2,
+     * <p>Four radial distortion coefficients <code>[kappa_0, kappa_1, kappa_2,
      * kappa_3]</code> and two tangential distortion coefficients
      * <code>[kappa_4, kappa_5]</code> that can be used to correct the
      * lens's geometric distortion with the mapping equations:</p>
-     * <pre><code> x_c = x_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
+     * <pre><code> x_c = x_i * ( kappa_0 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
      *        kappa_4 * (2 * x_i * y_i) + kappa_5 * ( r^2 + 2 * x_i^2 )
-     *  y_c = y_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
+     *  y_c = y_i * ( kappa_0 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) +
      *        kappa_5 * (2 * x_i * y_i) + kappa_4 * ( r^2 + 2 * y_i^2 )
      * </code></pre>
      * <p>Here, <code>[x_c, y_c]</code> are the coordinates to sample in the
diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
index 8512b23..a1ebe6a 100644
--- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
+++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
@@ -2053,8 +2053,10 @@
                 requestMetadata, /*reprocess*/false, CameraCaptureSession.SESSION_ID_NONE);
 
         // Overwrite the capture intent to make sure a good value is set.
-        Surface[] surfaces = (Surface[])outputSurfaces.toArray();
-        if (outputSurfaces.size() == 1 && SurfaceUtils.isSurfaceForHwVideoEncoder(surfaces[0])) {
+        Iterator<Surface> iterator = outputSurfaces.iterator();
+        Surface firstSurface = iterator.next();
+        Surface secondSurface = null;
+        if (outputSurfaces.size() == 1 && SurfaceUtils.isSurfaceForHwVideoEncoder(firstSurface)) {
             singleTargetRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT,
                     CaptureRequest.CONTROL_CAPTURE_INTENT_PREVIEW);
         } else {
@@ -2071,19 +2073,20 @@
                     requestMetadata, /*reprocess*/false, CameraCaptureSession.SESSION_ID_NONE);
             doubleTargetRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT,
                     CaptureRequest.CONTROL_CAPTURE_INTENT_VIDEO_RECORD);
-            doubleTargetRequestBuilder.addTarget(surfaces[0]);
-            doubleTargetRequestBuilder.addTarget(surfaces[1]);
+            doubleTargetRequestBuilder.addTarget(firstSurface);
+            secondSurface = iterator.next();
+            doubleTargetRequestBuilder.addTarget(secondSurface);
             doubleTargetRequestBuilder.setPartOfCHSRequestList(/*partOfCHSList*/true);
             // Make sure singleTargetRequestBuilder contains only recording surface for
             // preview + recording case.
-            Surface recordingSurface = surfaces[0];
+            Surface recordingSurface = firstSurface;
             if (!SurfaceUtils.isSurfaceForHwVideoEncoder(recordingSurface)) {
-                recordingSurface = surfaces[1];
+                recordingSurface = secondSurface;
             }
             singleTargetRequestBuilder.addTarget(recordingSurface);
         } else {
             // Single output case: either recording or preview.
-            singleTargetRequestBuilder.addTarget(surfaces[0]);
+            singleTargetRequestBuilder.addTarget(firstSurface);
         }
 
         // Generate the final request list.
diff --git a/core/java/android/text/style/TtsSpan.java b/core/java/android/text/style/TtsSpan.java
index c40f11f..93a156b 100644
--- a/core/java/android/text/style/TtsSpan.java
+++ b/core/java/android/text/style/TtsSpan.java
@@ -165,7 +165,7 @@
 
     /**
      * The text associated with this span is a series of characters that have to
-     * be read verbatim. The engine will attempt to ready out any character like
+     * be read verbatim. The engine will attempt to read out any character like
      * punctuation but excluding whitespace. {@link #ARG_VERBATIM} is required.
      * Also accepts the arguments {@link #ARG_GENDER},
      * {@link #ARG_ANIMACY}, {@link #ARG_MULTIPLICITY} and {@link #ARG_CASE}.
diff --git a/core/java/android/transition/Explode.java b/core/java/android/transition/Explode.java
index 788676a..3445ef2 100644
--- a/core/java/android/transition/Explode.java
+++ b/core/java/android/transition/Explode.java
@@ -90,7 +90,7 @@
         float startY = endY + mTempLoc[1];
 
         return TranslationAnimationCreator.createAnimation(view, endValues, bounds.left, bounds.top,
-                startX, startY, endX, endY, sDecelerate);
+                startX, startY, endX, endY, sDecelerate, this);
     }
 
     @Override
@@ -119,7 +119,7 @@
         endY += mTempLoc[1];
 
         return TranslationAnimationCreator.createAnimation(view, startValues,
-                viewPosX, viewPosY, startX, startY, endX, endY, sAccelerate);
+                viewPosX, viewPosY, startX, startY, endX, endY, sAccelerate, this);
     }
 
     private void calculateOut(View sceneRoot, Rect bounds, int[] outVector) {
diff --git a/core/java/android/transition/Slide.java b/core/java/android/transition/Slide.java
index be1d907..9063b43 100644
--- a/core/java/android/transition/Slide.java
+++ b/core/java/android/transition/Slide.java
@@ -231,7 +231,7 @@
         float startY = mSlideCalculator.getGoneY(sceneRoot, view);
         return TranslationAnimationCreator
                 .createAnimation(view, endValues, position[0], position[1],
-                        startX, startY, endX, endY, sDecelerate);
+                        startX, startY, endX, endY, sDecelerate, this);
     }
 
     @Override
@@ -247,6 +247,6 @@
         float endY = mSlideCalculator.getGoneY(sceneRoot, view);
         return TranslationAnimationCreator
                 .createAnimation(view, startValues, position[0], position[1],
-                        startX, startY, endX, endY, sAccelerate);
+                        startX, startY, endX, endY, sAccelerate, this);
     }
 }
diff --git a/core/java/android/transition/TranslationAnimationCreator.java b/core/java/android/transition/TranslationAnimationCreator.java
index de71fd7..1554975 100644
--- a/core/java/android/transition/TranslationAnimationCreator.java
+++ b/core/java/android/transition/TranslationAnimationCreator.java
@@ -22,6 +22,7 @@
 import android.animation.ObjectAnimator;
 import android.animation.TimeInterpolator;
 import android.graphics.Path;
+import android.transition.Transition.TransitionListener;
 import android.view.View;
 
 /**
@@ -48,7 +49,8 @@
      * a previous interruption, in which case it moves from the current position to (endX, endY).
      */
     static Animator createAnimation(View view, TransitionValues values, int viewPosX, int viewPosY,
-            float startX, float startY, float endX, float endY, TimeInterpolator interpolator) {
+            float startX, float startY, float endX, float endY, TimeInterpolator interpolator,
+            Transition transition) {
         float terminalX = view.getTranslationX();
         float terminalY = view.getTranslationY();
         int[] startPosition = (int[]) values.view.getTag(R.id.transitionPosition);
@@ -73,13 +75,15 @@
 
         TransitionPositionListener listener = new TransitionPositionListener(view, values.view,
                 startPosX, startPosY, terminalX, terminalY);
+        transition.addListener(listener);
         anim.addListener(listener);
         anim.addPauseListener(listener);
         anim.setInterpolator(interpolator);
         return anim;
     }
 
-    private static class TransitionPositionListener extends AnimatorListenerAdapter {
+    private static class TransitionPositionListener extends AnimatorListenerAdapter implements
+            TransitionListener {
 
         private final View mViewInHierarchy;
         private final View mMovingView;
@@ -117,8 +121,6 @@
 
         @Override
         public void onAnimationEnd(Animator animator) {
-            mMovingView.setTranslationX(mTerminalX);
-            mMovingView.setTranslationY(mTerminalY);
         }
 
         @Override
@@ -134,6 +136,28 @@
             mMovingView.setTranslationX(mPausedX);
             mMovingView.setTranslationY(mPausedY);
         }
+
+        @Override
+        public void onTransitionStart(Transition transition) {
+        }
+
+        @Override
+        public void onTransitionEnd(Transition transition) {
+            mMovingView.setTranslationX(mTerminalX);
+            mMovingView.setTranslationY(mTerminalY);
+        }
+
+        @Override
+        public void onTransitionCancel(Transition transition) {
+        }
+
+        @Override
+        public void onTransitionPause(Transition transition) {
+        }
+
+        @Override
+        public void onTransitionResume(Transition transition) {
+        }
     }
 
 }
diff --git a/core/java/com/android/internal/app/AssistUtils.java b/core/java/com/android/internal/app/AssistUtils.java
new file mode 100644
index 0000000..b520384
--- /dev/null
+++ b/core/java/com/android/internal/app/AssistUtils.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2015 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.internal.app;
+
+import android.app.SearchManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.provider.Settings;
+import android.util.Log;
+
+/**
+ * Utility method for dealing with the assistant aspects of
+ * {@link com.android.internal.app.IVoiceInteractionManagerService IVoiceInteractionManagerService}.
+ */
+public class AssistUtils {
+
+    private static final String TAG = "AssistUtils";
+
+    private final Context mContext;
+    private final IVoiceInteractionManagerService mVoiceInteractionManagerService;
+
+    public AssistUtils(Context context) {
+        mContext = context;
+        mVoiceInteractionManagerService = IVoiceInteractionManagerService.Stub.asInterface(
+                ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE));
+    }
+
+    public void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback) {
+        try {
+            mVoiceInteractionManagerService.showSessionForActiveService(showCallback);
+        } catch (RemoteException e) {
+            Log.w(TAG, "Failed to call showSessionForActiveService", e);
+        }
+    }
+
+    public void launchVoiceAssistFromKeyguard() {
+        try {
+            mVoiceInteractionManagerService.launchVoiceAssistFromKeyguard();
+        } catch (RemoteException e) {
+            Log.w(TAG, "Failed to call launchVoiceAssistFromKeyguard", e);
+        }
+    }
+
+    public boolean activeServiceSupportsAssistGesture() {
+        try {
+            return mVoiceInteractionManagerService != null
+                    && mVoiceInteractionManagerService.activeServiceSupportsAssist();
+        } catch (RemoteException e) {
+            Log.w(TAG, "Failed to call activeServiceSupportsAssistGesture", e);
+            return false;
+        }
+    }
+
+    public boolean activeServiceSupportsLaunchFromKeyguard() {
+        try {
+            return mVoiceInteractionManagerService != null
+                    && mVoiceInteractionManagerService.activeServiceSupportsLaunchFromKeyguard();
+        } catch (RemoteException e) {
+            Log.w(TAG, "Failed to call activeServiceSupportsLaunchFromKeyguard", e);
+            return false;
+        }
+    }
+
+    public ComponentName getActiveServiceComponentName() {
+        try {
+            return mVoiceInteractionManagerService.getActiveServiceComponentName();
+        } catch (RemoteException e) {
+            Log.w(TAG, "Failed to call getActiveServiceComponentName", e);
+            return null;
+        }
+    }
+
+    public boolean isSessionRunning() {
+        try {
+            return mVoiceInteractionManagerService != null
+                    && mVoiceInteractionManagerService.isSessionRunning();
+        } catch (RemoteException e) {
+            Log.w(TAG, "Failed to call isSessionRunning", e);
+            return false;
+        }
+    }
+
+    public void hideCurrentSession() {
+        try {
+            mVoiceInteractionManagerService.hideCurrentSession();
+        } catch (RemoteException e) {
+            Log.w(TAG, "Failed to call hideCurrentSession", e);
+        }
+    }
+
+    public ComponentName getAssistComponentForUser(int userId) {
+        final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(),
+                Settings.Secure.ASSISTANT, userId);
+        if (setting != null) {
+            return ComponentName.unflattenFromString(setting);
+        }
+
+        // Fallback to keep backward compatible behavior when there is no user setting.
+        if (activeServiceSupportsAssistGesture()) {
+            return getActiveServiceComponentName();
+        }
+
+        Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
+                .getAssistIntent(mContext, false, userId);
+        if (intent != null) {
+            return intent.getComponent();
+        }
+
+        return null;
+    }
+
+}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index a434a13..65c064b 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -289,6 +289,8 @@
     <protected-broadcast android:name="android.location.GPS_FIX_CHANGE" />
     <protected-broadcast android:name="android.net.proxy.PAC_REFRESH" />
 
+    <protected-broadcast android:name="android.telecom.action.DEFAULT_DIALER_CHANGED" />
+
     <protected-broadcast
         android:name="com.android.server.connectivityservice.CONNECTED_TO_PROVISIONING_NETWORK_ACTION" />
 
diff --git a/data/fonts/DroidSansMono.ttf b/data/fonts/DroidSansMono.ttf
index 4085cee..b7bf5b4 100644
--- a/data/fonts/DroidSansMono.ttf
+++ b/data/fonts/DroidSansMono.ttf
Binary files differ
diff --git a/docs/html/training/tv/publishing/checklist.jd b/docs/html/training/tv/publishing/checklist.jd
index 865a89b..6259721 100644
--- a/docs/html/training/tv/publishing/checklist.jd
+++ b/docs/html/training/tv/publishing/checklist.jd
@@ -67,12 +67,12 @@
 
 <li>
   Eliminate requirements for unsupported hardware in your app.
-  <p>See <a href="training/tv/start/hardware.html#declare-hardware-requirements">Declaring hardware requirements for TV</a>.</p>
+  <p>See <a href="{@docRoot}training/tv/start/hardware.html#declare-hardware-requirements">Declaring hardware requirements for TV</a>.</p>
 </li>
 
 <li>
   Ensure permissions do not imply hardware requirements
-  <p>See <a href="training/tv/start/hardware.html#hardware-permissions">Declaring permissions that imply hardware features</a>.</p>
+  <p>See <a href="{@docRoot}training/tv/start/hardware.html#hardware-permissions">Declaring permissions that imply hardware features</a>.</p>
 </li>
 
 </ol>
diff --git a/keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java
index b93424d..2de60fd 100644
--- a/keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java
@@ -624,7 +624,7 @@
             int keySizeBits,
             KeyGenParameterSpec spec) {
         // Constraints:
-        // 1. Key must be authorized for signing.
+        // 1. Key must be authorized for signing without user authentication.
         // 2. Signature digest must be one of key's authorized digests.
         // 3. For RSA keys, the digest output size must not exceed modulus size minus space needed
         //    for RSA PKCS#1 signature padding (about 29 bytes: minimum 10 bytes of padding + 15--19
@@ -636,6 +636,10 @@
             // Key not authorized for signing
             return null;
         }
+        if (spec.isUserAuthenticationRequired()) {
+            // Key not authorized for use without user authentication
+            return null;
+        }
         if (!spec.isDigestsSpecified()) {
             // Key not authorized for any digests -- can't sign
             return null;
diff --git a/packages/SystemUI/res/anim/ic_dnd_disable_alpha_animation.xml b/packages/SystemUI/res/anim/ic_dnd_disable_alpha_animation.xml
new file mode 100644
index 0000000..21caab4
--- /dev/null
+++ b/packages/SystemUI/res/anim/ic_dnd_disable_alpha_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="350"
+        android:propertyName="alpha"
+        android:valueFrom="1.0"
+        android:valueTo="0.3"
+        android:valueType="floatType"
+        android:interpolator="@android:interpolator/linear" />
+</set>
diff --git a/packages/SystemUI/res/anim/ic_dnd_disable_bar01_0_animation.xml b/packages/SystemUI/res/anim/ic_dnd_disable_bar01_0_animation.xml
new file mode 100644
index 0000000..a914687c
--- /dev/null
+++ b/packages/SystemUI/res/anim/ic_dnd_disable_bar01_0_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="350"
+        android:propertyName="pathData"
+        android:valueFrom="M 0.680404663086,3.53039550781 c 0.0,0.0 -0.01416015625,0.00492858886719 -0.01416015625,0.00492858886719 c 0.0,0.0 1.41400146484,-1.41400146484 1.41400146484,-1.41400146484 c 0.0,0.0 0.0151519775391,-0.00492858886719 0.0151519775391,-0.00492858886719 c 0.0,0.0 -1.41499328613,1.41400146484 -1.41499328613,1.41400146484 Z"
+        android:valueTo="M 0.680404663086,3.53039550781 c 0.0,0.0 20.0110015869,20.0110015869 20.0110015869,20.0110015869 c 0.0,0.0 1.41400146484,-1.41400146484 1.41400146484,-1.41400146484 c 0.0,0.0 -20.0100097656,-20.0110015869 -20.0100097656,-20.0110015869 c 0.0,0.0 -1.41499328613,1.41400146484 -1.41499328613,1.41400146484 Z"
+        android:valueType="pathType"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/packages/SystemUI/res/anim/ic_dnd_disable_mask_1_animation.xml b/packages/SystemUI/res/anim/ic_dnd_disable_mask_1_animation.xml
new file mode 100644
index 0000000..3c60c013
--- /dev/null
+++ b/packages/SystemUI/res/anim/ic_dnd_disable_mask_1_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="350"
+        android:propertyName="pathData"
+        android:valueFrom="M -9.67768859863,-9.82725524902 c 0.0,0.0 -7.8091583252,7.18409729004 -7.8091583252,7.18409729004 c 0.0,0.0 20.9320983887,20.9321136475 20.9320983887,20.9321136475 c 0.0,0.0 15.041595459,-15.0416717529 15.041595459,-15.0416717529 c 0.0,0.0 -20.5361938477,-20.536239624 -20.5361938477,-20.536239624 c 0.0,0.0 -6.20835876465,6.05171203613 -6.20835876465,6.05171203613 c 0.0,0.0 0.219390869141,0.219299316406 0.219390869141,0.219299316406 c 0.0,0.0 -1.41998291016,1.40998840332 -1.41998291016,1.40998840332 c 0.0,0.0 -0.219390869141,-0.219299316406 -0.219390869141,-0.219299316406 Z"
+        android:valueTo="M -9.67768859863,-9.82725524902 c 0.0,0.0 -7.8091583252,7.18409729004 -7.8091583252,7.18409729004 c 0.0,0.0 20.9320983887,20.9321136475 20.9320983887,20.9321136475 c 0.0,0.0 15.041595459,-15.0416717529 15.041595459,-15.0416717529 c 0.0,0.0 -20.5361938477,-20.536239624 -20.5361938477,-20.536239624 c 0.0,0.0 -6.20835876465,6.05171203613 -6.20835876465,6.05171203613 c 0.0,0.0 20.4531555176,20.4530792236 20.4531555176,20.4530792236 c 0.0,0.0 -1.41999816895,1.40995788574 -1.41999816895,1.40995788574 c 0.0,0.0 -20.4531402588,-20.4530487061 -20.4531402588,-20.4530487061 Z"
+        android:valueType="pathType"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_alpha_animation.xml b/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_alpha_animation.xml
new file mode 100644
index 0000000..21caab4
--- /dev/null
+++ b/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_alpha_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="350"
+        android:propertyName="alpha"
+        android:valueFrom="1.0"
+        android:valueTo="0.3"
+        android:valueType="floatType"
+        android:interpolator="@android:interpolator/linear" />
+</set>
diff --git a/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_mask_1_animation.xml b/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_mask_1_animation.xml
new file mode 100644
index 0000000..8d3296e
--- /dev/null
+++ b/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_mask_1_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="350"
+        android:propertyName="pathData"
+        android:valueFrom="M -9.67768859863,-9.82725524902 c 0.0,0.0 -7.8091583252,7.18409729004 -7.8091583252,7.18409729004 c 0.0,0.0 20.9320983887,20.9321136475 20.9320983887,20.9321136475 c 0.0,0.0 15.041595459,-15.0416717529 15.041595459,-15.0416717529 c 0.0,0.0 -20.5361938477,-20.536239624 -20.5361938477,-20.536239624 c 0.0,0.0 -6.20835876465,6.05171203613 -6.20835876465,6.05171203613 c 0.0,0.0 0.219390869141,0.219299316406 0.219390869141,0.219299316406 c 0.0,0.0 -1.41998291016,1.40998840332 -1.41998291016,1.40998840332 c 0.0,0.0 -0.219390869141,-0.219299316406 -0.219390869141,-0.219299316406 Z"
+        android:valueTo="M -9.67768859863,-9.82725524902 c 0.0,0.0 -7.8091583252,7.18409729004 -7.8091583252,7.18409729004 c 0.0,0.0 20.9320983887,20.9321136475 20.9320983887,20.9321136475 c 0.0,0.0 15.041595459,-15.0416717529 15.041595459,-15.0416717529 c 0.0,0.0 -20.5361938477,-20.536239624 -20.5361938477,-20.536239624 c 0.0,0.0 -6.20835876465,6.05171203613 -6.20835876465,6.05171203613 c 0.0,0.0 19.8804626465,19.8695220947 19.8804626465,19.8695220947 c 0.0,0.0 -1.41999816895,1.40995788574 -1.41999816895,1.40995788574 c 0.0,0.0 -19.8804473877,-19.8694915771 -19.8804473877,-19.8694915771 Z"
+        android:valueType="pathType"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_outer_ring_merged_animation.xml b/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_outer_ring_merged_animation.xml
new file mode 100644
index 0000000..2626499
--- /dev/null
+++ b/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_outer_ring_merged_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="350"
+        android:propertyName="pathData"
+        android:valueFrom="M 0.0,-10.0 c -5.5,0.0 -10.0,4.5 -10.0,10.0 c 0.0,5.5 4.5,10.0 10.0,10.0 c 5.5,0.0 10.0,-4.5 10.0,-10.0 c 0.0,-5.5 -4.5,-10.0 -10.0,-10.0 Z M 0.0,8.5 c -4.69999694824,0.0 -8.5,-3.80000305176 -8.5,-8.5 c 0.0,-4.69999694824 3.80000305176,-8.5 8.5,-8.5 c 4.69999694824,0.0 8.5,3.80000305176 8.5,8.5 c 0.0,4.69999694824 -3.80000305176,8.5 -8.5,8.5 Z M -11.3195953369,-8.46960449219 c 0.0,0.0 -0.0141754150391,0.00492858886719 -0.014175415039,0.00492858886719 c 0.0,0.0 1.41400146484,-1.41400146484 1.41400146484,-1.41400146484 c 0.0,0.0 0.0151672363281,-0.00492858886719 0.0151672363281,-0.00492858886719 c 0.0,0.0 -1.41499328613,1.41400146484 -1.41499328613,1.41400146484 Z M 3.0,1.0 c 0.0,0.0 -6.0,0.0 -6.0,0.0 c 0.0,0.0 0.0,-2.0 0.0,-2.0 c 0.0,0.0 6.0,0.0 6.0,0.0 c 0.0,0.0 0.0,2.0 0.0,2.0 Z M 0.0,-6.0 c -3.30000305176,0.0 -6.0,2.69999694824 -6.0,6.0 c 0.0,3.30000305176 2.69999694824,6.0 6.0,6.0 c 3.30000305176,0.0 6.0,-2.69999694824 6.0,-6.0 c 0.0,-3.30000305176 -2.60000610352,-6.0 -6.0,-6.0 Z"
+        android:valueTo="M 0.0,-10.0 c -5.5,0.0 -10.0,4.5 -10.0,10.0 c 0.0,5.5 4.5,10.0 10.0,10.0 c 5.5,0.0 10.0,-4.5 10.0,-10.0 c 0.0,-5.5 -4.5,-10.0 -10.0,-10.0 Z M 0.0,8.5 c -4.69999694824,0.0 -8.5,-3.80000305176 -8.5,-8.5 c 0.0,-4.69999694824 3.80000305176,-8.5 8.5,-8.5 c 4.69999694824,0.0 8.5,3.80000305176 8.5,8.5 c 0.0,4.69999694824 -3.80000305176,8.5 -8.5,8.5 Z M -11.3195953369,-8.46960449219 c 0.0,0.0 20.0109863281,20.0110015869 20.0109863281,20.0110015869 c 0.0,0.0 1.41400146484,-1.41400146484 1.41400146484,-1.41400146484 c 0.0,0.0 -20.0099945068,-20.0110015869 -20.0099945068,-20.0110015869 c 0.0,0.0 -1.41499328613,1.41400146484 -1.41499328613,1.41400146484 Z M 5.0,1.0 c 0.0,0.0 -10.0,0.0 -10.0,0.0 c 0.0,0.0 0.0,-2.0 0.0,-2.0 c 0.0,0.0 10.0,0.0 10.0,0.0 c 0.0,0.0 0.0,2.0 0.0,2.0 Z M 0.0,-10.0 c -5.52000427246,0.0 -10.0,4.47999572754 -10.0,10.0 c 0.0,5.52000427246 4.47999572754,10.0 10.0,10.0 c 5.52000427246,0.0 10.0,-4.47999572754 10.0,-10.0 c 0.0,-5.52000427246 -4.47999572754,-10.0 -10.0,-10.0 Z"
+        android:valueType="pathType"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/packages/SystemUI/res/drawable/ic_dnd_disable.xml b/packages/SystemUI/res/drawable/ic_dnd_disable.xml
new file mode 100644
index 0000000..ba4692a
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_dnd_disable.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:name="ic_dnd_disable"
+    android:width="24dp"
+    android:viewportWidth="24"
+    android:height="24dp"
+    android:viewportHeight="24" >
+    <group
+        android:name="dnd_icon"
+        android:translateX="12"
+        android:translateY="12" >
+        <clip-path
+            android:name="mask_1"
+            android:pathData="M -9.67768859863,-9.82725524902 c 0.0,0.0 -7.8091583252,7.18409729004 -7.8091583252,7.18409729004 c 0.0,0.0 20.9320983887,20.9321136475 20.9320983887,20.9321136475 c 0.0,0.0 15.041595459,-15.0416717529 15.041595459,-15.0416717529 c 0.0,0.0 -20.5361938477,-20.536239624 -20.5361938477,-20.536239624 c 0.0,0.0 -6.20835876465,6.05171203613 -6.20835876465,6.05171203613 c 0.0,0.0 0.219390869141,0.219299316406 0.219390869141,0.219299316406 c 0.0,0.0 -1.41998291016,1.40998840332 -1.41998291016,1.40998840332 c 0.0,0.0 -0.219390869141,-0.219299316406 -0.219390869141,-0.219299316406 Z" />
+        <group
+            android:name="bar01"
+            android:translateX="-12"
+            android:translateY="-12" >
+            <path
+                android:name="bar01_0"
+                android:pathData="M 0.680404663086,3.53039550781 c 0.0,0.0 -0.01416015625,0.00492858886719 -0.01416015625,0.00492858886719 c 0.0,0.0 1.41400146484,-1.41400146484 1.41400146484,-1.41400146484 c 0.0,0.0 0.0151519775391,-0.00492858886719 0.0151519775391,-0.00492858886719 c 0.0,0.0 -1.41499328613,1.41400146484 -1.41499328613,1.41400146484 Z"
+                android:fillColor="#FFFFFFFF" />
+        </group>
+        <group
+            android:name="circle" >
+            <path
+                android:name="icon_center_merged"
+                android:pathData="M 5.0,1.0 c 0.0,0.0 -10.0,0.0 -10.0,0.0 c 0.0,0.0 0.0,-2.0 0.0,-2.0 c 0.0,0.0 10.0,0.0 10.0,0.0 c 0.0,0.0 0.0,2.0 0.0,2.0 Z M 0.0,-10.0 c -5.52000427246,0.0 -10.0,4.47999572754 -10.0,10.0 c 0.0,5.52000427246 4.47999572754,10.0 10.0,10.0 c 5.52000427246,0.0 10.0,-4.47999572754 10.0,-10.0 c 0.0,-5.52000427246 -4.47999572754,-10.0 -10.0,-10.0 Z"
+                android:fillColor="#FFFFFFFF" />
+        </group>
+    </group>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_dnd_disable_animation.xml b/packages/SystemUI/res/drawable/ic_dnd_disable_animation.xml
new file mode 100644
index 0000000..13ed767
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_dnd_disable_animation.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<animated-vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:drawable="@drawable/ic_dnd_disable" >
+    <target
+        android:name="mask_1"
+        android:animation="@anim/ic_dnd_disable_mask_1_animation" />
+    <target
+        android:name="bar01_0"
+        android:animation="@anim/ic_dnd_disable_bar01_0_animation" />
+    <target
+        android:name="ic_dnd_disable"
+        android:animation="@anim/ic_dnd_disable_alpha_animation" />
+</animated-vector>
diff --git a/packages/SystemUI/res/drawable/ic_dnd_total_silence_disable.xml b/packages/SystemUI/res/drawable/ic_dnd_total_silence_disable.xml
new file mode 100644
index 0000000..1a33255
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_dnd_total_silence_disable.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:name="ic_dnd_total_silence_disable"
+    android:width="24dp"
+    android:viewportWidth="24"
+    android:height="24dp"
+    android:viewportHeight="24" >
+    <group
+        android:name="tot_silence"
+        android:translateX="12"
+        android:translateY="12" >
+        <clip-path
+            android:name="mask_1"
+            android:pathData="M -9.67768859863,-9.82725524902 c 0.0,0.0 -7.8091583252,7.18409729004 -7.8091583252,7.18409729004 c 0.0,0.0 20.9320983887,20.9321136475 20.9320983887,20.9321136475 c 0.0,0.0 15.041595459,-15.0416717529 15.041595459,-15.0416717529 c 0.0,0.0 -20.5361938477,-20.536239624 -20.5361938477,-20.536239624 c 0.0,0.0 -6.20835876465,6.05171203613 -6.20835876465,6.05171203613 c 0.0,0.0 0.219390869141,0.219299316406 0.219390869141,0.219299316406 c 0.0,0.0 -1.41998291016,1.40998840332 -1.41998291016,1.40998840332 c 0.0,0.0 -0.219390869141,-0.219299316406 -0.219390869141,-0.219299316406 Z" />
+        <group
+            android:name="icon_shape" >
+            <path
+                android:name="outer_ring_merged"
+                android:pathData="M 0.0,-10.0 c -5.5,0.0 -10.0,4.5 -10.0,10.0 c 0.0,5.5 4.5,10.0 10.0,10.0 c 5.5,0.0 10.0,-4.5 10.0,-10.0 c 0.0,-5.5 -4.5,-10.0 -10.0,-10.0 Z M 0.0,8.5 c -4.69999694824,0.0 -8.5,-3.80000305176 -8.5,-8.5 c 0.0,-4.69999694824 3.80000305176,-8.5 8.5,-8.5 c 4.69999694824,0.0 8.5,3.80000305176 8.5,8.5 c 0.0,4.69999694824 -3.80000305176,8.5 -8.5,8.5 Z M -11.3195953369,-8.46960449219 c 0.0,0.0 -0.0141754150391,0.00492858886719 -0.014175415039,0.00492858886719 c 0.0,0.0 1.41400146484,-1.41400146484 1.41400146484,-1.41400146484 c 0.0,0.0 0.0151672363281,-0.00492858886719 0.0151672363281,-0.00492858886719 c 0.0,0.0 -1.41499328613,1.41400146484 -1.41499328613,1.41400146484 Z M 3.0,1.0 c 0.0,0.0 -6.0,0.0 -6.0,0.0 c 0.0,0.0 0.0,-2.0 0.0,-2.0 c 0.0,0.0 6.0,0.0 6.0,0.0 c 0.0,0.0 0.0,2.0 0.0,2.0 Z M 0.0,-6.0 c -3.30000305176,0.0 -6.0,2.69999694824 -6.0,6.0 c 0.0,3.30000305176 2.69999694824,6.0 6.0,6.0 c 3.30000305176,0.0 6.0,-2.69999694824 6.0,-6.0 c 0.0,-3.30000305176 -2.60000610352,-6.0 -6.0,-6.0 Z"
+                android:fillColor="#FFFFFFFF" />
+        </group>
+    </group>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_dnd_total_silence_disable_animation.xml b/packages/SystemUI/res/drawable/ic_dnd_total_silence_disable_animation.xml
new file mode 100644
index 0000000..c0b2d69
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_dnd_total_silence_disable_animation.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+<animated-vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:drawable="@drawable/ic_dnd_total_silence_disable" >
+    <target
+        android:name="mask_1"
+        android:animation="@anim/ic_dnd_total_silence_disable_mask_1_animation" />
+    <target
+        android:name="outer_ring_merged"
+        android:animation="@anim/ic_dnd_total_silence_disable_outer_ring_merged_animation" />
+    <target
+        android:name="ic_dnd_total_silence_disable"
+        android:animation="@anim/ic_dnd_total_silence_disable_alpha_animation" />
+</animated-vector>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index a6313ad..37601884 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -164,7 +164,7 @@
     <dimen name="pull_span_min">25dp</dimen>
 
     <dimen name="qs_tile_height">88dp</dimen>
-    <dimen name="qs_tile_icon_size">28dp</dimen>
+    <dimen name="qs_tile_icon_size">24dp</dimen>
     <dimen name="qs_tile_text_size">12sp</dimen>
     <dimen name="qs_tile_divider_height">1dp</dimen>
     <dimen name="qs_panel_padding">16dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 1e7ee98..445ecb6 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -16,7 +16,6 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.RemoteException;
-import android.os.ServiceManager;
 import android.os.UserHandle;
 import android.provider.Settings;
 import android.util.Log;
@@ -28,12 +27,15 @@
 import android.view.WindowManager;
 import android.widget.ImageView;
 
-import com.android.internal.app.IVoiceInteractionManagerService;
+import com.android.internal.app.AssistUtils;
 import com.android.internal.app.IVoiceInteractionSessionShowCallback;
 import com.android.systemui.R;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.phone.PhoneStatusBar;
 
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
 /**
  * Class to manage everything related to assist in SystemUI.
  */
@@ -55,7 +57,7 @@
     private final WindowManager mWindowManager;
     private AssistOrbContainer mView;
     private final PhoneStatusBar mBar;
-    private final IVoiceInteractionManagerService mVoiceInteractionManagerService;
+    private final AssistUtils mAssistUtils;
 
     private ComponentName mAssistComponent;
 
@@ -92,8 +94,7 @@
         mContext = context;
         mBar = bar;
         mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
-        mVoiceInteractionManagerService = IVoiceInteractionManagerService.Stub.asInterface(
-                ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE));
+        mAssistUtils = new AssistUtils(context);
 
         mContext.getContentResolver().registerContentObserver(
                 Settings.Secure.getUriFor(Settings.Secure.ASSISTANT), false,
@@ -140,11 +141,7 @@
     }
 
     public void hideAssist() {
-        try {
-            mVoiceInteractionManagerService.hideCurrentSession();
-        } catch (RemoteException e) {
-            Log.w(TAG, "Failed to call hideCurrentSession", e);
-        }
+        mAssistUtils.hideCurrentSession();
     }
 
     private WindowManager.LayoutParams getLayoutParams() {
@@ -216,58 +213,27 @@
     }
 
     private void startVoiceInteractor() {
-        try {
-            mVoiceInteractionManagerService.showSessionForActiveService(mShowCallback);
-        } catch (RemoteException e) {
-            Log.w(TAG, "Failed to call showSessionForActiveService", e);
-        }
+        mAssistUtils.showSessionForActiveService(mShowCallback);
     }
 
     public void launchVoiceAssistFromKeyguard() {
-        try {
-            mVoiceInteractionManagerService.launchVoiceAssistFromKeyguard();
-        } catch (RemoteException e) {
-            Log.w(TAG, "Failed to call launchVoiceAssistFromKeyguard", e);
-        }
+        mAssistUtils.launchVoiceAssistFromKeyguard();
     }
 
     private boolean getVoiceInteractorSupportsAssistGesture() {
-        try {
-            return mVoiceInteractionManagerService != null
-                    && mVoiceInteractionManagerService.activeServiceSupportsAssist();
-        } catch (RemoteException e) {
-            Log.w(TAG, "Failed to call activeServiceSupportsAssistGesture", e);
-            return false;
-        }
+        return mAssistUtils.activeServiceSupportsAssistGesture();
     }
 
     public boolean canVoiceAssistBeLaunchedFromKeyguard() {
-        try {
-            return mVoiceInteractionManagerService != null
-                    && mVoiceInteractionManagerService.activeServiceSupportsLaunchFromKeyguard();
-        } catch (RemoteException e) {
-            Log.w(TAG, "Failed to call activeServiceSupportsLaunchFromKeyguard", e);
-            return false;
-        }
+        return mAssistUtils.activeServiceSupportsLaunchFromKeyguard();
     }
 
     public ComponentName getVoiceInteractorComponentName() {
-        try {
-            return mVoiceInteractionManagerService.getActiveServiceComponentName();
-        } catch (RemoteException e) {
-            Log.w(TAG, "Failed to call getActiveServiceComponentName", e);
-            return null;
-        }
+        return mAssistUtils.getActiveServiceComponentName();
     }
 
     private boolean isVoiceSessionRunning() {
-        try {
-            return mVoiceInteractionManagerService != null
-                    && mVoiceInteractionManagerService.isSessionRunning();
-        } catch (RemoteException e) {
-            Log.w(TAG, "Failed to call isSessionRunning", e);
-            return false;
-        }
+        return mAssistUtils.isSessionRunning();
     }
 
     public void destroy() {
@@ -324,26 +290,11 @@
     }
 
     private void updateAssistInfo() {
-        final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(),
-                Settings.Secure.ASSISTANT, UserHandle.USER_CURRENT);
-        if (setting != null) {
-            mAssistComponent = ComponentName.unflattenFromString(setting);
-            return;
-        }
+        mAssistComponent = mAssistUtils.getAssistComponentForUser(UserHandle.USER_CURRENT);
+    }
 
-        // Fallback to keep backward compatible behavior when there is no user setting.
-        if (getVoiceInteractorSupportsAssistGesture()) {
-            mAssistComponent = getVoiceInteractorComponentName();
-            return;
-        }
-
-        Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
-                .getAssistIntent(mContext, false, UserHandle.USER_CURRENT);
-        if (intent != null) {
-            mAssistComponent = intent.getComponent();
-            return;
-        }
-
-        mAssistComponent = null;
+    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+        pw.println("AssistManager state:");
+        pw.print("  mAssistComponent="); pw.println(mAssistComponent);
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index f00fed5..c06b34f 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -371,7 +371,6 @@
         @Override
         public void onDeviceProvisioned() {
             sendUserPresentBroadcast();
-            updateInputRestricted();
         }
 
         @Override
@@ -947,7 +946,7 @@
      * was suppressed by an app that disabled the keyguard or we haven't been provisioned yet.
      */
     public boolean isInputRestricted() {
-        return mShowing || mNeedToReshowWhenReenabled || shouldWaitForProvisioning();
+        return mShowing || mNeedToReshowWhenReenabled;
     }
 
     private void updateInputRestricted() {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index c8212c2..9761cd1 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -242,6 +242,9 @@
     }
 
     private void handleSetTileVisibility(View v, int visibility) {
+        if (visibility == VISIBLE && !mGridContentVisible) {
+            visibility = INVISIBLE;
+        }
         if (visibility == v.getVisibility()) return;
         v.setVisibility(visibility);
     }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
index f4d6f04..f97f519 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
@@ -38,6 +38,7 @@
 
 /** Quick settings tile: Do not disturb **/
 public class DndTile extends QSTile<QSTile.BooleanState> {
+
     private static final Intent ZEN_SETTINGS =
             new Intent(Settings.ACTION_ZEN_MODE_SETTINGS);
 
@@ -47,6 +48,14 @@
     private static final String ACTION_SET_VISIBLE = "com.android.systemui.dndtile.SET_VISIBLE";
     private static final String EXTRA_VISIBLE = "visible";
 
+    private static final QSTile.Icon TOTAL_SILENCE =
+            ResourceIcon.get(R.drawable.ic_qs_dnd_on_total_silence);
+
+    private final AnimationIcon mDisable =
+            new AnimationIcon(R.drawable.ic_dnd_disable_animation);
+    private final AnimationIcon mDisableTotalSilence =
+            new AnimationIcon(R.drawable.ic_dnd_total_silence_disable_animation);
+
     private final ZenModeController mController;
     private final DndDetailAdapter mDetailAdapter;
 
@@ -89,6 +98,8 @@
 
     @Override
     public void handleClick() {
+        mDisable.setAllowAnimation(true);
+        mDisableTotalSilence.setAllowAnimation(true);
         MetricsLogger.action(mContext, getMetricsCategory(), !mState.value);
         if (mState.value) {
             mController.setZen(Global.ZEN_MODE_OFF, null, TAG);
@@ -114,7 +125,7 @@
                         R.string.accessibility_quick_settings_dnd_priority_on);
                 break;
             case Global.ZEN_MODE_NO_INTERRUPTIONS:
-                state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_on_total_silence);
+                state.icon = TOTAL_SILENCE;
                 state.label = mContext.getString(R.string.quick_settings_dnd_none_label);
                 state.contentDescription = mContext.getString(
                         R.string.accessibility_quick_settings_dnd_none_on);
@@ -126,7 +137,7 @@
                         R.string.accessibility_quick_settings_dnd_alarms_on);
                 break;
             default:
-                state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_off);
+                state.icon = TOTAL_SILENCE.equals(state.icon) ? mDisableTotalSilence : mDisable;
                 state.label = mContext.getString(R.string.quick_settings_dnd_label);
                 state.contentDescription =  mContext.getString(
                         R.string.accessibility_quick_settings_dnd_off);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index c77e7f0..69198ed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -2687,6 +2687,9 @@
         if (mNextAlarmController != null) {
             mNextAlarmController.dump(fd, pw, args);
         }
+        if (mAssistManager != null) {
+            mAssistManager.dump(fd, pw, args);
+        }
         if (mSecurityController != null) {
             mSecurityController.dump(fd, pw, args);
         }
diff --git a/services/core/java/com/android/server/IntentResolver.java b/services/core/java/com/android/server/IntentResolver.java
index 744156b..3359060 100644
--- a/services/core/java/com/android/server/IntentResolver.java
+++ b/services/core/java/com/android/server/IntentResolver.java
@@ -731,6 +731,10 @@
             if (filter.getAutoVerify()) {
                 if (localVerificationLOGV || debug) {
                     Slog.v(TAG, "  Filter verified: " + isFilterVerified(filter));
+                    int authorities = filter.countDataAuthorities();
+                    for (int z = 0; z < authorities; z++) {
+                        Slog.v(TAG, "   " + filter.getDataAuthority(z).getHost());
+                    }
                 }
             }
 
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 421ba86..e9b9767 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -5267,7 +5267,7 @@
         }
         int callerUid = Binder.getCallingUid();
         // Only the system server can kill an application
-        if (callerUid == Process.SYSTEM_UID) {
+        if (UserHandle.getAppId(callerUid) == Process.SYSTEM_UID) {
             // Post an aysnc message to kill the application
             Message msg = mHandler.obtainMessage(KILL_APPLICATION_MSG);
             msg.arg1 = appid;
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java
index b56e326..c973386 100644
--- a/services/core/java/com/android/server/am/BatteryStatsService.java
+++ b/services/core/java/com/android/server/am/BatteryStatsService.java
@@ -1167,6 +1167,10 @@
             BluetoothActivityEnergyInfo info = adapter.getControllerActivityEnergyInfo(
                     BluetoothAdapter.ACTIVITY_ENERGY_INFO_REFRESHED);
             if (info != null && info.isValid()) {
+                if (info.getControllerEnergyUsed() < 0 || info.getControllerIdleTimeMillis() < 0 ||
+                        info.getControllerRxTimeMillis() < 0 || info.getControllerTxTimeMillis() < 0) {
+                    Slog.wtf(TAG, "Bluetooth energy data is invalid: " + info);
+                }
                 return info;
             }
         }
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index a24bd52..548d93c 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -268,6 +268,7 @@
     static final boolean DEBUG_SETTINGS = false;
     static final boolean DEBUG_PREFERRED = false;
     static final boolean DEBUG_UPGRADE = false;
+    static final boolean DEBUG_DOMAIN_VERIFICATION = false;
     private static final boolean DEBUG_BACKUP = true;
     private static final boolean DEBUG_INSTALL = false;
     private static final boolean DEBUG_REMOVE = false;
@@ -279,7 +280,6 @@
     private static final boolean DEBUG_VERIFY = false;
     private static final boolean DEBUG_DEXOPT = false;
     private static final boolean DEBUG_ABI_SELECTION = false;
-    private static final boolean DEBUG_DOMAIN_VERIFICATION = false;
 
     private static final int RADIO_UID = Process.PHONE_UID;
     private static final int LOG_UID = Process.LOG_UID;
@@ -11818,50 +11818,45 @@
         final int verificationId = mIntentFilterVerificationToken++;
         int count = 0;
         final String packageName = pkg.packageName;
-        ArrayList<String> allHosts = new ArrayList<>();
+        boolean needToVerify = false;
 
         synchronized (mPackages) {
+            // If any filters need to be verified, then all need to be.
             for (PackageParser.Activity a : pkg.activities) {
                 for (ActivityIntentInfo filter : a.intents) {
-                    boolean needsFilterVerification = filter.needsVerification();
-                    if (needsFilterVerification && needsNetworkVerificationLPr(filter)) {
-                        if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
-                                "Verification needed for IntentFilter:" + filter.toString());
-                        mIntentFilterVerifier.addOneIntentFilterVerification(
-                                verifierUid, userId, verificationId, filter, packageName);
-                        count++;
-                    } else if (!needsFilterVerification) {
-                        if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
-                                "No verification needed for IntentFilter:" + filter.toString());
-                        if (hasValidDomains(filter)) {
-                            ArrayList<String> hosts = filter.getHostsList();
-                            if (hosts.size() > 0) {
-                                allHosts.addAll(hosts);
-                            } else {
-                                if (allHosts.isEmpty()) {
-                                    allHosts.add("*");
-                                }
-                            }
+                    if (filter.needsVerification() && needsNetworkVerificationLPr(filter)) {
+                        if (DEBUG_DOMAIN_VERIFICATION) {
+                            Slog.d(TAG, "Intent filter needs verification, so processing all filters");
                         }
-                    } else {
-                        if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
-                                "Verification already done for IntentFilter:" + filter.toString());
+                        needToVerify = true;
+                        break;
+                    }
+                }
+            }
+            if (needToVerify) {
+                for (PackageParser.Activity a : pkg.activities) {
+                    for (ActivityIntentInfo filter : a.intents) {
+                        boolean needsFilterVerification = filter.hasWebDataURI();
+                        if (needsFilterVerification && needsNetworkVerificationLPr(filter)) {
+                            if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+                                    "Verification needed for IntentFilter:" + filter.toString());
+                            mIntentFilterVerifier.addOneIntentFilterVerification(
+                                    verifierUid, userId, verificationId, filter, packageName);
+                            count++;
+                        }
                     }
                 }
             }
         }
 
         if (count > 0) {
-            mIntentFilterVerifier.startVerifications(userId);
-            if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Started " + count
+            if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Starting " + count
                     + " IntentFilter verification" + (count > 1 ? "s" : "")
-                    +  " for userId:" + userId + "!");
+                    +  " for userId:" + userId);
+            mIntentFilterVerifier.startVerifications(userId);
         } else {
-            if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
-                    "No need to start any IntentFilter verification!");
-            if (allHosts.size() > 0 && mSettings.createIntentFilterVerificationIfNeededLPw(
-                    packageName, allHosts) != null) {
-                scheduleWriteSettingsLocked();
+            if (DEBUG_DOMAIN_VERIFICATION) {
+                Slog.d(TAG, "No filters or not all autoVerify for " + packageName);
             }
         }
     }
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 8f2db30..cd50946 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -27,6 +27,7 @@
 import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED;
 import static android.os.Process.SYSTEM_UID;
 import static android.os.Process.PACKAGE_INFO_GID;
+import static com.android.server.pm.PackageManagerService.DEBUG_DOMAIN_VERIFICATION;
 
 import android.content.IntentFilter;
 import android.content.pm.ActivityInfo;
@@ -977,7 +978,9 @@
     IntentFilterVerificationInfo getIntentFilterVerificationLPr(String packageName) {
         PackageSetting ps = mPackages.get(packageName);
         if (ps == null) {
-            Slog.w(PackageManagerService.TAG, "No package known for name: " + packageName);
+            if (DEBUG_DOMAIN_VERIFICATION) {
+                Slog.w(PackageManagerService.TAG, "No package known: " + packageName);
+            }
             return null;
         }
         return ps.getIntentFilterVerificationInfo();
@@ -988,20 +991,26 @@
             ArrayList<String> domains) {
         PackageSetting ps = mPackages.get(packageName);
         if (ps == null) {
-            Slog.w(PackageManagerService.TAG, "No package known for name: " + packageName);
+            if (DEBUG_DOMAIN_VERIFICATION) {
+                Slog.w(PackageManagerService.TAG, "No package known: " + packageName);
+            }
             return null;
         }
         IntentFilterVerificationInfo ivi = ps.getIntentFilterVerificationInfo();
         if (ivi == null) {
             ivi = new IntentFilterVerificationInfo(packageName, domains);
             ps.setIntentFilterVerificationInfo(ivi);
-            Slog.d(PackageManagerService.TAG,
-                    "Creating new IntentFilterVerificationInfo for packageName: " + packageName);
+            if (DEBUG_DOMAIN_VERIFICATION) {
+                Slog.d(PackageManagerService.TAG,
+                        "Creating new IntentFilterVerificationInfo for pkg: " + packageName);
+            }
         } else {
             ivi.setDomains(domains);
-            Slog.d(PackageManagerService.TAG,
-                    "Setting domains to existing IntentFilterVerificationInfo for packageName: " +
-                            packageName + " and with domains: " + ivi.getDomainsString());
+            if (DEBUG_DOMAIN_VERIFICATION) {
+                Slog.d(PackageManagerService.TAG,
+                        "Setting domains to existing IntentFilterVerificationInfo for pkg: " +
+                                packageName + " and with domains: " + ivi.getDomainsString());
+            }
         }
         return ivi;
     }
@@ -1009,7 +1018,9 @@
     int getIntentFilterVerificationStatusLPr(String packageName, int userId) {
         PackageSetting ps = mPackages.get(packageName);
         if (ps == null) {
-            Slog.w(PackageManagerService.TAG, "No package known for name: " + packageName);
+            if (DEBUG_DOMAIN_VERIFICATION) {
+                Slog.w(PackageManagerService.TAG, "No package known: " + packageName);
+            }
             return INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED;
         }
         int status = ps.getDomainVerificationStatusForUser(userId);
@@ -1025,14 +1036,18 @@
         // Update the status for the current package
         PackageSetting current = mPackages.get(packageName);
         if (current == null) {
-            Slog.w(PackageManagerService.TAG, "No package known for name: " + packageName);
+            if (DEBUG_DOMAIN_VERIFICATION) {
+                Slog.w(PackageManagerService.TAG, "No package known: " + packageName);
+            }
             return false;
         }
         current.setDomainVerificationStatusForUser(status, userId);
 
         if (current.getIntentFilterVerificationInfo() == null) {
-            Slog.w(PackageManagerService.TAG,
-                    "No IntentFilterVerificationInfo known for name: " + packageName);
+            if (DEBUG_DOMAIN_VERIFICATION) {
+                Slog.w(PackageManagerService.TAG,
+                        "No IntentFilterVerificationInfo known: " + packageName);
+            }
             return false;
         }
 
@@ -1080,7 +1095,9 @@
     boolean removeIntentFilterVerificationLPw(String packageName, int userId) {
         PackageSetting ps = mPackages.get(packageName);
         if (ps == null) {
-            Slog.w(PackageManagerService.TAG, "No package known for name: " + packageName);
+            if (DEBUG_DOMAIN_VERIFICATION) {
+                Slog.w(PackageManagerService.TAG, "No package known: " + packageName);
+            }
             return false;
         }
         ps.clearDomainVerificationStatusForUser(userId);
@@ -1549,8 +1566,10 @@
         if (verificationInfo != null && verificationInfo.getPackageName() != null) {
             serializer.startTag(null, TAG_DOMAIN_VERIFICATION);
             verificationInfo.writeToXml(serializer);
-            Log.d(TAG, "Wrote domain verification for package: "
-                    + verificationInfo.getPackageName());
+            if (DEBUG_DOMAIN_VERIFICATION) {
+                Slog.d(TAG, "Wrote domain verification for package: "
+                        + verificationInfo.getPackageName());
+            }
             serializer.endTag(null, TAG_DOMAIN_VERIFICATION);
         }
     }
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 368e137..0cd8c19 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -124,6 +124,16 @@
             "android.telecom.action.CHANGE_DEFAULT_DIALER";
 
     /**
+     * Broadcast intent action indicating that the current default dialer has changed.
+     * The string extra {@link #EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME} will contain the
+     * name of the package that the default dialer was changed to.
+     *
+     * @see #EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME
+     */
+    public static final String ACTION_DEFAULT_DIALER_CHANGED =
+            "android.telecom.action.DEFAULT_DIALER_CHANGED";
+
+    /**
      * Extra value used to provide the package name for {@link #ACTION_CHANGE_DEFAULT_DIALER}.
      */
     public static final String EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME =
@@ -774,6 +784,31 @@
     }
 
     /**
+     * Used to set the default dialer package.
+     *
+     * @param packageName to set the default dialer to..
+     *
+     * @result {@code true} if the default dialer was successfully changed, {@code false} if
+     *         the specified package does not correspond to an installed dialer, or is already
+     *         the default dialer.
+     *
+     * Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE}
+     * Requires permission: {@link android.Manifest.permission#WRITE_SECURE_SETTINGS}
+     *
+     * @hide
+     */
+    public boolean setDefaultDialer(String packageName) {
+        try {
+            if (isServiceConnected()) {
+                return getTelecomService().setDefaultDialer(packageName);
+            }
+        } catch (RemoteException e) {
+            Log.e(TAG, "RemoteException attempting to set the default dialer.", e);
+        }
+        return false;
+    }
+
+    /**
      * Used to determine the dialer package that is preloaded on the system partition.
      *
      * @return package name for the system dialer package or null if no system dialer is preloaded.
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index da0c547..bcfee30 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -84,7 +84,7 @@
      * from config.xml under apps/Contacts.
      */
     public static final String
-            KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "key_enable_dialer_vibration_bool";
+            KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_vibration_bool";
 
     /** Flag indicating if dtmf tone type is enabled */
     public static final String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool";
@@ -185,6 +185,13 @@
      */
     public static final String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool";
 
+    /**
+     * Flag specifying whether WFC over IMS should be available for carrier: independent of
+     * carrier provisioning. If false: hard disabled. If true: then depends on carrier
+     * provisioning, availability etc.
+     */
+    public static final String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool";
+
     /** Flag specifying whether VoLTE availability is based on provisioning. */
     public static final String KEY_CARRIER_VOLTE_PROVISIONED_BOOL = "carrier_volte_provisioned_bool";
 
@@ -200,6 +207,13 @@
      */
     public static final String KEY_VOLTE_REPLACEMENT_RAT_INT = "volte_replacement_rat_int";
 
+    /**
+     * The default sim call manager to use when the default dialer doesn't implement one. A sim call
+     * manager can control and route outgoing and incoming phone calls, even if they're placed
+     * using another connection service (PSTN, for example).
+     */
+    public static final String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string";
+
     /* The following 3 fields are related to carrier visual voicemail. */
 
     /**
@@ -232,6 +246,34 @@
      */
     public static final String KEY_CARRIER_VVM_PACKAGE_NAME_STRING = "carrier_vvm_package_name_string";
 
+    /**
+     * Flag specifying whether an additional (client initiated) intent needs to be sent on System
+     * update
+     * @hide
+     */
+    public static final String KEY_CI_ACTION_ON_SYS_UPDATE_BOOL = "ci_action_on_sys_update_bool";
+
+    /**
+     * Intent to be sent for the additional action on System update
+     * @hide
+     */
+    public static final String KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING =
+            "ci_action_on_sys_update_intent_string";
+
+    /**
+     * Extra to be included in the intent sent for additional action on System update
+     * @hide
+     */
+    public static final String KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING =
+            "ci_action_on_sys_update_extra_string";
+
+    /**
+     * Value of extra included in intent sent for additional action on System update
+     * @hide
+     */
+    public static final String KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_VAL_STRING =
+            "ci_action_on_sys_update_extra_val_string";
+
     // These variables are used by the MMS service and exposed through another API, {@link
     // SmsManager}. The variable names and string values are copied from there.
     public static final String KEY_MMS_ALIAS_ENABLED_BOOL = "aliasEnabled";
@@ -278,6 +320,7 @@
         sDefaults.putBoolean(KEY_AUTO_RETRY_ENABLED_BOOL, false);
         sDefaults.putBoolean(KEY_CARRIER_SETTINGS_ENABLE_BOOL, false);
         sDefaults.putBoolean(KEY_CARRIER_VOLTE_AVAILABLE_BOOL, false);
+        sDefaults.putBoolean(KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL, false);
         sDefaults.putBoolean(KEY_CARRIER_VOLTE_PROVISIONED_BOOL, false);
         sDefaults.putBoolean(KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL, true);
         sDefaults.putBoolean(KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL, false);
@@ -300,10 +343,15 @@
         sDefaults.putBoolean(KEY_VOICE_PRIVACY_DISABLE_UI_BOOL, false);
         sDefaults.putBoolean(KEY_WORLD_PHONE_BOOL, false);
         sDefaults.putInt(KEY_VOLTE_REPLACEMENT_RAT_INT, 0);
+        sDefaults.putString(KEY_DEFAULT_SIM_CALL_MANAGER_STRING, "");
         sDefaults.putString(KEY_VVM_DESTINATION_NUMBER_STRING, "");
         sDefaults.putInt(KEY_VVM_PORT_NUMBER_INT, 0);
         sDefaults.putString(KEY_VVM_TYPE_STRING, "");
         sDefaults.putString(KEY_CARRIER_VVM_PACKAGE_NAME_STRING, "");
+        sDefaults.putBoolean(KEY_CI_ACTION_ON_SYS_UPDATE_BOOL, false);
+        sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING, "");
+        sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING, "");
+        sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_VAL_STRING, "");
 
         // MMS defaults
         sDefaults.putBoolean(KEY_MMS_ALIAS_ENABLED_BOOL, false);
diff --git a/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java b/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java
index 0f73342..035317e 100644
--- a/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java
+++ b/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java
@@ -39,22 +39,22 @@
     /**
      * @hide
      */
-    public int mControllerTxTimeMs;
+    public long mControllerTxTimeMs;
 
     /**
      * @hide
      */
-    public int mControllerRxTimeMs;
+    public long mControllerRxTimeMs;
 
     /**
      * @hide
      */
-    public int mControllerIdleTimeMs;
+    public long mControllerIdleTimeMs;
 
     /**
      * @hide
      */
-    public int mControllerEnergyUsed;
+    public long mControllerEnergyUsed;
 
     public static final int STACK_STATE_INVALID = 0;
     public static final int STACK_STATE_STATE_ACTIVE = 1;
@@ -62,7 +62,7 @@
     public static final int STACK_STATE_STATE_IDLE = 3;
 
     public WifiActivityEnergyInfo(long timestamp, int stackState,
-                                  int txTime, int rxTime, int idleTime, int energyUsed) {
+                                  long txTime, long rxTime, long idleTime, long energyUsed) {
         mTimestamp = timestamp;
         mStackState = stackState;
         mControllerTxTimeMs = txTime;
@@ -88,10 +88,10 @@
         public WifiActivityEnergyInfo createFromParcel(Parcel in) {
             long timestamp = in.readLong();
             int stackState = in.readInt();
-            int txTime = in.readInt();
-            int rxTime = in.readInt();
-            int idleTime = in.readInt();
-            int energyUsed = in.readInt();
+            long txTime = in.readLong();
+            long rxTime = in.readLong();
+            long idleTime = in.readLong();
+            long energyUsed = in.readLong();
             return new WifiActivityEnergyInfo(timestamp, stackState,
                     txTime, rxTime, idleTime, energyUsed);
         }
@@ -103,10 +103,10 @@
     public void writeToParcel(Parcel out, int flags) {
         out.writeLong(mTimestamp);
         out.writeInt(mStackState);
-        out.writeInt(mControllerTxTimeMs);
-        out.writeInt(mControllerRxTimeMs);
-        out.writeInt(mControllerIdleTimeMs);
-        out.writeInt(mControllerEnergyUsed);
+        out.writeLong(mControllerTxTimeMs);
+        out.writeLong(mControllerRxTimeMs);
+        out.writeLong(mControllerIdleTimeMs);
+        out.writeLong(mControllerEnergyUsed);
     }
 
     public int describeContents() {
@@ -123,30 +123,29 @@
     /**
      * @return tx time in ms
      */
-    public int getControllerTxTimeMillis() {
-        return (int)mControllerTxTimeMs;
+    public long getControllerTxTimeMillis() {
+        return mControllerTxTimeMs;
     }
 
     /**
      * @return rx time in ms
      */
-    public int getControllerRxTimeMillis() {
-        return (int)mControllerRxTimeMs;
+    public long getControllerRxTimeMillis() {
+        return mControllerRxTimeMs;
     }
 
     /**
      * @return idle time in ms
      */
-    public int getControllerIdleTimeMillis() {
-        return (int)mControllerIdleTimeMs;
+    public long getControllerIdleTimeMillis() {
+        return mControllerIdleTimeMs;
     }
 
-
     /**
      * product of current(mA), voltage(V) and time(ms)
      * @return energy used
      */
-    public int getControllerEnergyUsed() {
+    public long getControllerEnergyUsed() {
         return mControllerEnergyUsed;
     }
     /**
@@ -160,8 +159,8 @@
      * @return if the record is valid
      */
     public boolean isValid() {
-        return ((getControllerTxTimeMillis() !=0) ||
-                (getControllerRxTimeMillis() !=0) ||
-                (getControllerIdleTimeMillis() !=0));
+        return ((mControllerTxTimeMs !=0) ||
+                (mControllerRxTimeMs !=0) ||
+                (mControllerIdleTimeMs !=0));
     }
 }