Merge "Camera2: Remove isLoggable" into mnc-dev
diff --git a/api/current.txt b/api/current.txt
index 5a9be90..28c344e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -28889,11 +28889,9 @@
     method public void showSession(android.os.Bundle, int);
     field public static final java.lang.String SERVICE_INTERFACE = "android.service.voice.VoiceInteractionService";
     field public static final java.lang.String SERVICE_META_DATA = "android.voice_interaction";
-    field public static final int START_SOURCE_ASSIST_GESTURE = 4; // 0x4
-    field public static final int START_WITH_ASSIST = 1; // 0x1
   }
 
-  public abstract class VoiceInteractionSession implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback {
+  public class VoiceInteractionSession implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback {
     ctor public VoiceInteractionSession(android.content.Context);
     ctor public VoiceInteractionSession(android.content.Context, android.os.Handler);
     method public void finish();
@@ -28901,20 +28899,15 @@
     method public android.view.LayoutInflater getLayoutInflater();
     method public android.app.Dialog getWindow();
     method public void hide();
-    method public void hideWindow();
-    method public void onAbortVoice(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.os.Bundle);
     method public void onBackPressed();
-    method public abstract void onCancel(android.service.voice.VoiceInteractionSession.Request);
+    method public void onCancelRequest(android.service.voice.VoiceInteractionSession.Request);
     method public void onCloseSystemDialogs();
-    method public abstract void onCommand(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.String, android.os.Bundle);
-    method public void onCompleteVoice(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.os.Bundle);
     method public void onComputeInsets(android.service.voice.VoiceInteractionSession.Insets);
     method public void onConfigurationChanged(android.content.res.Configuration);
-    method public abstract void onConfirm(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.os.Bundle);
-    method public void onCreate(android.os.Bundle, int);
+    method public void onCreate();
     method public android.view.View onCreateContentView();
     method public void onDestroy();
-    method public boolean[] onGetSupportedCommands(android.service.voice.VoiceInteractionSession.Caller, java.lang.String[]);
+    method public boolean[] onGetSupportedCommands(java.lang.String[]);
     method public void onHandleAssist(android.os.Bundle, android.app.AssistStructure, android.app.AssistContent);
     method public void onHide();
     method public boolean onKeyDown(int, android.view.KeyEvent);
@@ -28922,7 +28915,11 @@
     method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
     method public boolean onKeyUp(int, android.view.KeyEvent);
     method public void onLowMemory();
-    method public abstract void onPickOption(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+    method public void onRequestAbortVoice(android.service.voice.VoiceInteractionSession.AbortVoiceRequest);
+    method public void onRequestCommand(android.service.voice.VoiceInteractionSession.CommandRequest);
+    method public void onRequestCompleteVoice(android.service.voice.VoiceInteractionSession.CompleteVoiceRequest);
+    method public void onRequestConfirmation(android.service.voice.VoiceInteractionSession.ConfirmationRequest);
+    method public void onRequestPickOption(android.service.voice.VoiceInteractionSession.PickOptionRequest);
     method public void onShow(android.os.Bundle, int);
     method public void onTaskFinished(android.content.Intent, int);
     method public void onTaskStarted(android.content.Intent, int);
@@ -28930,12 +28927,31 @@
     method public void setContentView(android.view.View);
     method public void setKeepAwake(boolean);
     method public void setTheme(int);
-    method public void show();
-    method public void showWindow();
+    method public void show(android.os.Bundle, int);
     method public void startVoiceActivity(android.content.Intent);
+    field public static final int SHOW_SOURCE_ASSIST_GESTURE = 4; // 0x4
+    field public static final int SHOW_WITH_ASSIST = 1; // 0x1
   }
 
-  public static class VoiceInteractionSession.Caller {
+  public static final class VoiceInteractionSession.AbortVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method public java.lang.CharSequence getMessage();
+    method public void sendAbortResult(android.os.Bundle);
+  }
+
+  public static final class VoiceInteractionSession.CommandRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method public java.lang.String getCommand();
+    method public void sendIntermediateResult(android.os.Bundle);
+    method public void sendResult(android.os.Bundle);
+  }
+
+  public static final class VoiceInteractionSession.CompleteVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method public java.lang.CharSequence getMessage();
+    method public void sendCompleteResult(android.os.Bundle);
+  }
+
+  public static final class VoiceInteractionSession.ConfirmationRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method public java.lang.CharSequence getPrompt();
+    method public void sendConfirmationResult(boolean, android.os.Bundle);
   }
 
   public static final class VoiceInteractionSession.Insets {
@@ -28948,13 +28964,18 @@
     field public final android.graphics.Region touchableRegion;
   }
 
+  public static final class VoiceInteractionSession.PickOptionRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method public android.app.VoiceInteractor.PickOptionRequest.Option[] getOptions();
+    method public java.lang.CharSequence getPrompt();
+    method public void sendIntermediatePickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+    method public void sendPickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+  }
+
   public static class VoiceInteractionSession.Request {
-    method public void sendAbortVoiceResult(android.os.Bundle);
-    method public void sendCancelResult();
-    method public void sendCommandResult(boolean, android.os.Bundle);
-    method public void sendCompleteVoiceResult(android.os.Bundle);
-    method public void sendConfirmResult(boolean, android.os.Bundle);
-    method public void sendPickOptionResult(boolean, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+    method public void cancel();
+    method public java.lang.String getCallingPackage();
+    method public int getCallingUid();
+    method public android.os.Bundle getExtras();
   }
 
   public abstract class VoiceInteractionSessionService extends android.app.Service {
@@ -30080,6 +30101,7 @@
     method public final void setConferenceableConnections(java.util.List<android.telecom.Connection>);
     method public final void setConnectionCapabilities(int);
     method public final void setConnectionTime(long);
+    method public final void setDialing();
     method public final void setDisconnected(android.telecom.DisconnectCause);
     method public final void setExtras(android.os.Bundle);
     method public final void setOnHold();
diff --git a/api/system-current.txt b/api/system-current.txt
index b4315fe..5218595 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -31015,11 +31015,9 @@
     method public void showSession(android.os.Bundle, int);
     field public static final java.lang.String SERVICE_INTERFACE = "android.service.voice.VoiceInteractionService";
     field public static final java.lang.String SERVICE_META_DATA = "android.voice_interaction";
-    field public static final int START_SOURCE_ASSIST_GESTURE = 4; // 0x4
-    field public static final int START_WITH_ASSIST = 1; // 0x1
   }
 
-  public abstract class VoiceInteractionSession implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback {
+  public class VoiceInteractionSession implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback {
     ctor public VoiceInteractionSession(android.content.Context);
     ctor public VoiceInteractionSession(android.content.Context, android.os.Handler);
     method public void finish();
@@ -31027,20 +31025,15 @@
     method public android.view.LayoutInflater getLayoutInflater();
     method public android.app.Dialog getWindow();
     method public void hide();
-    method public void hideWindow();
-    method public void onAbortVoice(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.os.Bundle);
     method public void onBackPressed();
-    method public abstract void onCancel(android.service.voice.VoiceInteractionSession.Request);
+    method public void onCancelRequest(android.service.voice.VoiceInteractionSession.Request);
     method public void onCloseSystemDialogs();
-    method public abstract void onCommand(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.String, android.os.Bundle);
-    method public void onCompleteVoice(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.os.Bundle);
     method public void onComputeInsets(android.service.voice.VoiceInteractionSession.Insets);
     method public void onConfigurationChanged(android.content.res.Configuration);
-    method public abstract void onConfirm(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.os.Bundle);
-    method public void onCreate(android.os.Bundle, int);
+    method public void onCreate();
     method public android.view.View onCreateContentView();
     method public void onDestroy();
-    method public boolean[] onGetSupportedCommands(android.service.voice.VoiceInteractionSession.Caller, java.lang.String[]);
+    method public boolean[] onGetSupportedCommands(java.lang.String[]);
     method public void onHandleAssist(android.os.Bundle, android.app.AssistStructure, android.app.AssistContent);
     method public void onHide();
     method public boolean onKeyDown(int, android.view.KeyEvent);
@@ -31048,7 +31041,11 @@
     method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
     method public boolean onKeyUp(int, android.view.KeyEvent);
     method public void onLowMemory();
-    method public abstract void onPickOption(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+    method public void onRequestAbortVoice(android.service.voice.VoiceInteractionSession.AbortVoiceRequest);
+    method public void onRequestCommand(android.service.voice.VoiceInteractionSession.CommandRequest);
+    method public void onRequestCompleteVoice(android.service.voice.VoiceInteractionSession.CompleteVoiceRequest);
+    method public void onRequestConfirmation(android.service.voice.VoiceInteractionSession.ConfirmationRequest);
+    method public void onRequestPickOption(android.service.voice.VoiceInteractionSession.PickOptionRequest);
     method public void onShow(android.os.Bundle, int);
     method public void onTaskFinished(android.content.Intent, int);
     method public void onTaskStarted(android.content.Intent, int);
@@ -31056,12 +31053,31 @@
     method public void setContentView(android.view.View);
     method public void setKeepAwake(boolean);
     method public void setTheme(int);
-    method public void show();
-    method public void showWindow();
+    method public void show(android.os.Bundle, int);
     method public void startVoiceActivity(android.content.Intent);
+    field public static final int SHOW_SOURCE_ASSIST_GESTURE = 4; // 0x4
+    field public static final int SHOW_WITH_ASSIST = 1; // 0x1
   }
 
-  public static class VoiceInteractionSession.Caller {
+  public static final class VoiceInteractionSession.AbortVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method public java.lang.CharSequence getMessage();
+    method public void sendAbortResult(android.os.Bundle);
+  }
+
+  public static final class VoiceInteractionSession.CommandRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method public java.lang.String getCommand();
+    method public void sendIntermediateResult(android.os.Bundle);
+    method public void sendResult(android.os.Bundle);
+  }
+
+  public static final class VoiceInteractionSession.CompleteVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method public java.lang.CharSequence getMessage();
+    method public void sendCompleteResult(android.os.Bundle);
+  }
+
+  public static final class VoiceInteractionSession.ConfirmationRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method public java.lang.CharSequence getPrompt();
+    method public void sendConfirmationResult(boolean, android.os.Bundle);
   }
 
   public static final class VoiceInteractionSession.Insets {
@@ -31074,13 +31090,18 @@
     field public final android.graphics.Region touchableRegion;
   }
 
+  public static final class VoiceInteractionSession.PickOptionRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method public android.app.VoiceInteractor.PickOptionRequest.Option[] getOptions();
+    method public java.lang.CharSequence getPrompt();
+    method public void sendIntermediatePickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+    method public void sendPickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+  }
+
   public static class VoiceInteractionSession.Request {
-    method public void sendAbortVoiceResult(android.os.Bundle);
-    method public void sendCancelResult();
-    method public void sendCommandResult(boolean, android.os.Bundle);
-    method public void sendCompleteVoiceResult(android.os.Bundle);
-    method public void sendConfirmResult(boolean, android.os.Bundle);
-    method public void sendPickOptionResult(boolean, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+    method public void cancel();
+    method public java.lang.String getCallingPackage();
+    method public int getCallingUid();
+    method public android.os.Bundle getExtras();
   }
 
   public abstract class VoiceInteractionSessionService extends android.app.Service {
@@ -32236,6 +32257,7 @@
     method public final deprecated void setConnectTimeMillis(long);
     method public final void setConnectionCapabilities(int);
     method public final void setConnectionTime(long);
+    method public final void setDialing();
     method public final void setDisconnected(android.telecom.DisconnectCause);
     method public final void setExtras(android.os.Bundle);
     method public final void setOnHold();
diff --git a/core/java/android/app/VoiceInteractor.java b/core/java/android/app/VoiceInteractor.java
index a412952..ba27c54 100644
--- a/core/java/android/app/VoiceInteractor.java
+++ b/core/java/android/app/VoiceInteractor.java
@@ -510,7 +510,7 @@
     }
 
     /**
-     * Execute an extended command using the trusted system VoiceInteractionService.
+     * Execute a vendor-specific command using the trusted system VoiceInteractionService.
      * This allows an Activity to request additional information from the user needed to
      * complete an action (e.g. booking a table might have several possible times that the
      * user could select from or an app might need the user to agree to a terms of service).
diff --git a/core/java/android/database/DatabaseUtils.java b/core/java/android/database/DatabaseUtils.java
index e61664c..227066d 100644
--- a/core/java/android/database/DatabaseUtils.java
+++ b/core/java/android/database/DatabaseUtils.java
@@ -270,7 +270,7 @@
         window.setStartPosition(position);
         window.setNumColumns(numColumns);
         if (cursor.moveToPosition(position)) {
-            do {
+            rowloop: do {
                 if (!window.allocRow()) {
                     break;
                 }
@@ -307,7 +307,7 @@
                     }
                     if (!success) {
                         window.freeLastRow();
-                        break;
+                        break rowloop;
                     }
                 }
                 position += 1;
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index 4fe257c..d5867a9 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -1068,20 +1068,35 @@
 
     /**
      * <p>The correction coefficients to correct for this camera device's
-     * radial lens distortion.</p>
-     * <p>Three cofficients <code>[kappa_1, kappa_2, kappa_3]</code> that
-     * can be used to correct the lens's radial 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 )
-     * y_c = y_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 )
+     * radial and tangential lens distortion.</p>
+     * <p>Three radial distortion coefficients <code>[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 ) +
+     *        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 ) +
+     *        kappa_5 * (2 * x_i * y_i) + kappa_4 * ( r^2 + 2 * y_i^2 )
      * </code></pre>
-     * <p>where <code>[x_i, y_i]</code> are normalized coordinates with <code>(0,0)</code>
-     * at the lens optical center, and <code>[-1, 1]</code> are the edges of
-     * the active pixel array; and where <code>[x_c, y_c]</code> are the
-     * corrected normalized coordinates with radial distortion
-     * removed; and <code>r^2 = x_i^2 + y_i^2</code>.</p>
+     * <p>Here, <code>[x_c, y_c]</code> are the coordinates to sample in the
+     * input image that correspond to the pixel values in the
+     * corrected image at the coordinate <code>[x_i, y_i]</code>:</p>
+     * <pre><code> correctedImage(x_i, y_i) = sample_at(x_c, y_c, inputImage)
+     * </code></pre>
+     * <p>The pixel coordinates are defined in a normalized
+     * coordinate system related to the
+     * android.lens.intrinsicCalibration calibration fields.
+     * Both <code>[x_i, y_i]</code> and <code>[x_c, y_c]</code> have <code>(0,0)</code> at the
+     * lens optical center <code>[c_x, c_y]</code>. The maximum magnitudes
+     * of both x and y coordinates are normalized to be 1 at the
+     * edge further from the optical center, so the range
+     * for both dimensions is <code>-1 &lt;= x &lt;= 1</code>.</p>
+     * <p>Finally, <code>r</code> represents the radial distance from the
+     * optical center, <code>r^2 = x_i^2 + y_i^2</code>, and its magnitude
+     * is therefore no larger than <code>|r| &lt;= sqrt(2)</code>.</p>
+     * <p>The distortion model used is the Brown-Conrady model.</p>
      * <p><b>Units</b>:
-     * Coefficients for a 6th-degree even radial polynomial.</p>
+     * Unitless coefficients.</p>
      * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
      */
     @PublicKey
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index 96faad2..df6c986 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -2649,20 +2649,35 @@
 
     /**
      * <p>The correction coefficients to correct for this camera device's
-     * radial lens distortion.</p>
-     * <p>Three cofficients <code>[kappa_1, kappa_2, kappa_3]</code> that
-     * can be used to correct the lens's radial 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 )
-     * y_c = y_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 )
+     * radial and tangential lens distortion.</p>
+     * <p>Three radial distortion coefficients <code>[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 ) +
+     *        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 ) +
+     *        kappa_5 * (2 * x_i * y_i) + kappa_4 * ( r^2 + 2 * y_i^2 )
      * </code></pre>
-     * <p>where <code>[x_i, y_i]</code> are normalized coordinates with <code>(0,0)</code>
-     * at the lens optical center, and <code>[-1, 1]</code> are the edges of
-     * the active pixel array; and where <code>[x_c, y_c]</code> are the
-     * corrected normalized coordinates with radial distortion
-     * removed; and <code>r^2 = x_i^2 + y_i^2</code>.</p>
+     * <p>Here, <code>[x_c, y_c]</code> are the coordinates to sample in the
+     * input image that correspond to the pixel values in the
+     * corrected image at the coordinate <code>[x_i, y_i]</code>:</p>
+     * <pre><code> correctedImage(x_i, y_i) = sample_at(x_c, y_c, inputImage)
+     * </code></pre>
+     * <p>The pixel coordinates are defined in a normalized
+     * coordinate system related to the
+     * android.lens.intrinsicCalibration calibration fields.
+     * Both <code>[x_i, y_i]</code> and <code>[x_c, y_c]</code> have <code>(0,0)</code> at the
+     * lens optical center <code>[c_x, c_y]</code>. The maximum magnitudes
+     * of both x and y coordinates are normalized to be 1 at the
+     * edge further from the optical center, so the range
+     * for both dimensions is <code>-1 &lt;= x &lt;= 1</code>.</p>
+     * <p>Finally, <code>r</code> represents the radial distance from the
+     * optical center, <code>r^2 = x_i^2 + y_i^2</code>, and its magnitude
+     * is therefore no larger than <code>|r| &lt;= sqrt(2)</code>.</p>
+     * <p>The distortion model used is the Brown-Conrady model.</p>
      * <p><b>Units</b>:
-     * Coefficients for a 6th-degree even radial polynomial.</p>
+     * Unitless coefficients.</p>
      * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
      */
     @PublicKey
diff --git a/core/java/android/service/voice/VoiceInteractionService.java b/core/java/android/service/voice/VoiceInteractionService.java
index 77e2125..8119049 100644
--- a/core/java/android/service/voice/VoiceInteractionService.java
+++ b/core/java/android/service/voice/VoiceInteractionService.java
@@ -70,25 +70,6 @@
      */
     public static final String SERVICE_META_DATA = "android.voice_interaction";
 
-    /**
-     * Flag for use with {@link #showSession}: request that the session be started with
-     * assist data from the currently focused activity.
-     */
-    public static final int START_WITH_ASSIST = 1<<0;
-
-    /**
-     * @hide
-     * Flag for use with {@link #showSession}: request that the session be started with
-     * a screen shot of the currently focused activity.
-     */
-    public static final int START_WITH_SCREENSHOT = 1<<1;
-
-    /**
-     * Flag for use with {@link #showSession}: indicate that the session has been started from the
-     * system assist gesture.
-     */
-    public static final int START_SOURCE_ASSIST_GESTURE = 1<<2;
-
     IVoiceInteractionService mInterface = new IVoiceInteractionService.Stub() {
         @Override public void ready() {
             mHandler.sendEmptyMessage(MSG_READY);
@@ -176,6 +157,10 @@
      * Request that the associated {@link android.service.voice.VoiceInteractionSession} be
      * shown to the user, starting it if necessary.
      * @param args Arbitrary arguments that will be propagated to the session.
+     * @param flags Indicates additional optional behavior that should be performed.  May
+     * be {@link VoiceInteractionSession#SHOW_WITH_ASSIST VoiceInteractionSession.SHOW_WITH_ASSIST}
+     * to request that the system generate and deliver assist data on the current foreground
+     * app as part of showing the session UI.
      */
     public void showSession(Bundle args, int flags) {
         if (mSystemService == null) {
diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java
index f09b6a2..48ad5a8 100644
--- a/core/java/android/service/voice/VoiceInteractionSession.java
+++ b/core/java/android/service/voice/VoiceInteractionSession.java
@@ -68,11 +68,29 @@
  * when done.  It can also initiate voice interactions with applications by calling
  * {@link #startVoiceActivity}</p>.
  */
-public abstract class VoiceInteractionSession implements KeyEvent.Callback,
-        ComponentCallbacks2 {
+public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCallbacks2 {
     static final String TAG = "VoiceInteractionSession";
     static final boolean DEBUG = true;
 
+    /**
+     * Flag received in {@link #onShow}: originator requested that the session be started with
+     * assist data from the currently focused activity.
+     */
+    public static final int SHOW_WITH_ASSIST = 1<<0;
+
+    /**
+     * @hide
+     * Flag received in {@link #onShow}: originator requested that the session be started with
+     * a screen shot of the currently focused activity.
+     */
+    public static final int SHOW_WITH_SCREENSHOT = 1<<1;
+
+    /**
+     * Flag for use with {@link #onShow}: indicates that the session has been started from the
+     * system assist gesture.
+     */
+    public static final int SHOW_SOURCE_ASSIST_GESTURE = 1<<2;
+
     final Context mContext;
     final HandlerCaller mHandlerCaller;
 
@@ -105,10 +123,12 @@
         @Override
         public IVoiceInteractorRequest startConfirmation(String callingPackage,
                 IVoiceInteractorCallback callback, CharSequence prompt, Bundle extras) {
-            Request request = newRequest(callback);
-            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageOOOO(MSG_START_CONFIRMATION,
-                    new Caller(callingPackage, Binder.getCallingUid()), request,
-                    prompt, extras));
+            ConfirmationRequest request = new ConfirmationRequest(callingPackage,
+                    Binder.getCallingUid(), callback, VoiceInteractionSession.this,
+                    prompt, extras);
+            addRequest(request);
+            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_CONFIRMATION,
+                    request));
             return request.mInterface;
         }
 
@@ -116,47 +136,54 @@
         public IVoiceInteractorRequest startPickOption(String callingPackage,
                 IVoiceInteractorCallback callback, CharSequence prompt,
                 VoiceInteractor.PickOptionRequest.Option[] options, Bundle extras) {
-            Request request = newRequest(callback);
-            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageOOOOO(MSG_START_PICK_OPTION,
-                    new Caller(callingPackage, Binder.getCallingUid()), request,
-                    prompt, options, extras));
+            PickOptionRequest request = new PickOptionRequest(callingPackage,
+                    Binder.getCallingUid(), callback, VoiceInteractionSession.this,
+                    prompt, options, extras);
+            addRequest(request);
+            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_PICK_OPTION,
+                    request));
             return request.mInterface;
         }
 
         @Override
         public IVoiceInteractorRequest startCompleteVoice(String callingPackage,
                 IVoiceInteractorCallback callback, CharSequence message, Bundle extras) {
-            Request request = newRequest(callback);
-            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageOOOO(MSG_START_COMPLETE_VOICE,
-                    new Caller(callingPackage, Binder.getCallingUid()), request,
-                    message, extras));
+            CompleteVoiceRequest request = new CompleteVoiceRequest(callingPackage,
+                    Binder.getCallingUid(), callback, VoiceInteractionSession.this,
+                    message, extras);
+            addRequest(request);
+            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_COMPLETE_VOICE,
+                    request));
             return request.mInterface;
         }
 
         @Override
         public IVoiceInteractorRequest startAbortVoice(String callingPackage,
                 IVoiceInteractorCallback callback, CharSequence message, Bundle extras) {
-            Request request = newRequest(callback);
-            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageOOOO(MSG_START_ABORT_VOICE,
-                    new Caller(callingPackage, Binder.getCallingUid()), request,
-                    message, extras));
+            AbortVoiceRequest request = new AbortVoiceRequest(callingPackage,
+                    Binder.getCallingUid(), callback, VoiceInteractionSession.this,
+                    message, extras);
+            addRequest(request);
+            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_ABORT_VOICE,
+                    request));
             return request.mInterface;
         }
 
         @Override
         public IVoiceInteractorRequest startCommand(String callingPackage,
                 IVoiceInteractorCallback callback, String command, Bundle extras) {
-            Request request = newRequest(callback);
-            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageOOOO(MSG_START_COMMAND,
-                    new Caller(callingPackage, Binder.getCallingUid()), request,
-                    command, extras));
+            CommandRequest request = new CommandRequest(callingPackage,
+                    Binder.getCallingUid(), callback, VoiceInteractionSession.this,
+                    command, extras);
+            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_COMMAND,
+                    request));
             return request.mInterface;
         }
 
         @Override
         public boolean[] supportsCommands(String callingPackage, String[] commands) {
             Message msg = mHandlerCaller.obtainMessageIOO(MSG_SUPPORTS_COMMANDS,
-                    0, new Caller(callingPackage, Binder.getCallingUid()), commands);
+                    0, commands, null);
             SomeArgs args = mHandlerCaller.sendMessageAndWait(msg);
             if (args != null) {
                 boolean[] res = (boolean[])args.arg1;
@@ -222,7 +249,16 @@
         }
     };
 
-    public static class Request {
+    /** @hide */
+    public static class Caller {
+    }
+
+    /**
+     * Base class representing a request from a voice-driver app to perform a particular
+     * voice operation with the user.  See related subclasses for the types of requests
+     * that are possible.
+     */
+    public static class Request extends Caller {
         final IVoiceInteractorRequest mInterface = new IVoiceInteractorRequest.Stub() {
             @Override
             public void cancel() throws RemoteException {
@@ -233,12 +269,40 @@
                 }
             }
         };
+        final String mCallingPackage;
+        final int mCallingUid;
         final IVoiceInteractorCallback mCallback;
         final WeakReference<VoiceInteractionSession> mSession;
+        final Bundle mExtras;
 
-        Request(IVoiceInteractorCallback callback, VoiceInteractionSession session) {
+        Request(String packageName, int uid, IVoiceInteractorCallback callback,
+                VoiceInteractionSession session, Bundle extras) {
+            mCallingPackage = packageName;
+            mCallingUid = uid;
             mCallback = callback;
             mSession = session.mWeakRef;
+            mExtras = extras;
+        }
+
+        /**
+         * Return the uid of the application that initiated the request.
+         */
+        public int getCallingUid() {
+            return mCallingUid;
+        }
+
+        /**
+         * Return the package name of the application that initiated the request.
+         */
+        public String getCallingPackage() {
+            return mCallingPackage;
+        }
+
+        /**
+         * Return any additional extra information that was supplied as part of the request.
+         */
+        public Bundle getExtras() {
+            return mExtras;
         }
 
         void finishRequest() {
@@ -255,6 +319,7 @@
             }
         }
 
+        /** @hide */
         public void sendConfirmResult(boolean confirmed, Bundle result) {
             try {
                 if (DEBUG) Log.d(TAG, "sendConfirmResult: req=" + mInterface
@@ -265,6 +330,7 @@
             }
         }
 
+        /** @hide */
         public void sendPickOptionResult(boolean finished,
                 VoiceInteractor.PickOptionRequest.Option[] selections, Bundle result) {
             try {
@@ -279,6 +345,7 @@
             }
         }
 
+        /** @hide */
         public void sendCompleteVoiceResult(Bundle result) {
             try {
                 if (DEBUG) Log.d(TAG, "sendCompleteVoiceResult: req=" + mInterface
@@ -289,6 +356,7 @@
             }
         }
 
+        /** @hide */
         public void sendAbortVoiceResult(Bundle result) {
             try {
                 if (DEBUG) Log.d(TAG, "sendConfirmResult: req=" + mInterface
@@ -299,6 +367,7 @@
             }
         }
 
+        /** @hide */
         public void sendCommandResult(boolean finished, Bundle result) {
             try {
                 if (DEBUG) Log.d(TAG, "sendCommandResult: req=" + mInterface
@@ -311,7 +380,15 @@
             }
         }
 
+        /** @hide */
         public void sendCancelResult() {
+            cancel();
+        }
+
+        /**
+         * ASk the app to cancel this current request.
+         */
+        public void cancel() {
             try {
                 if (DEBUG) Log.d(TAG, "sendCancelResult: req=" + mInterface);
                 finishRequest();
@@ -321,13 +398,200 @@
         }
     }
 
-    public static class Caller {
-        final String packageName;
-        final int uid;
+    /**
+     * A request for confirmation from the user of an operation, as per
+     * {@link android.app.VoiceInteractor.ConfirmationRequest
+     * VoiceInteractor.ConfirmationRequest}.
+     */
+    public static final class ConfirmationRequest extends Request {
+        final CharSequence mPrompt;
 
-        Caller(String _packageName, int _uid) {
-            packageName = _packageName;
-            uid = _uid;
+        ConfirmationRequest(String packageName, int uid, IVoiceInteractorCallback callback,
+                VoiceInteractionSession session, CharSequence prompt, Bundle extras) {
+            super(packageName, uid, callback, session, extras);
+            mPrompt = prompt;
+        }
+
+        /**
+         * Return the prompt informing the user of what will happen, as per
+         * {@link android.app.VoiceInteractor.ConfirmationRequest
+         * VoiceInteractor.ConfirmationRequest}.
+         */
+        public CharSequence getPrompt() {
+            return mPrompt;
+        }
+
+        /**
+         * Report that the voice interactor has confirmed the operation with the user, resulting
+         * in a call to
+         * {@link android.app.VoiceInteractor.ConfirmationRequest#onConfirmationResult
+         * VoiceInteractor.ConfirmationRequest.onConfirmationResult}.
+         */
+        public void sendConfirmationResult(boolean confirmed, Bundle result) {
+            sendConfirmResult(confirmed, result);
+        }
+    }
+
+    /**
+     * A request for the user to pick from a set of option, as per
+     * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
+     */
+    public static final class PickOptionRequest extends Request {
+        final CharSequence mPrompt;
+        final VoiceInteractor.PickOptionRequest.Option[] mOptions;
+
+        PickOptionRequest(String packageName, int uid, IVoiceInteractorCallback callback,
+                VoiceInteractionSession session, CharSequence prompt,
+                VoiceInteractor.PickOptionRequest.Option[] options, Bundle extras) {
+            super(packageName, uid, callback, session, extras);
+            mPrompt = prompt;
+            mOptions = options;
+        }
+
+        /**
+         * Return the prompt informing the user of what they are picking, as per
+         * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
+         */
+        public CharSequence getPrompt() {
+            return mPrompt;
+        }
+
+        /**
+         * Return the set of options the user is picking from, as per
+         * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
+         */
+        public VoiceInteractor.PickOptionRequest.Option[] getOptions() {
+            return mOptions;
+        }
+
+        /**
+         * Report an intermediate option selection from the request, without completing it (the
+         * request is still active and the app is waiting for the final option selection),
+         * resulting in a call to
+         * {@link android.app.VoiceInteractor.PickOptionRequest#onPickOptionResult
+         * VoiceInteractor.PickOptionRequest.onPickOptionResult} with false for finished.
+         */
+        public void sendIntermediatePickOptionResult(
+                VoiceInteractor.PickOptionRequest.Option[] selections, Bundle result) {
+            sendPickOptionResult(false, selections, result);
+        }
+
+        /**
+         * Report the final option selection for the request, completing the request
+         * and resulting in a call to
+         * {@link android.app.VoiceInteractor.PickOptionRequest#onPickOptionResult
+         * VoiceInteractor.PickOptionRequest.onPickOptionResult} with false for finished.
+         */
+        public void sendPickOptionResult(
+                VoiceInteractor.PickOptionRequest.Option[] selections, Bundle result) {
+            sendPickOptionResult(true, selections, result);
+        }
+    }
+
+    /**
+     * A request to simply inform the user that the voice operation has completed, as per
+     * {@link android.app.VoiceInteractor.CompleteVoiceRequest
+     * VoiceInteractor.CompleteVoiceRequest}.
+     */
+    public static final class CompleteVoiceRequest extends Request {
+        final CharSequence mMessage;
+
+        CompleteVoiceRequest(String packageName, int uid, IVoiceInteractorCallback callback,
+                VoiceInteractionSession session, CharSequence message, Bundle extras) {
+            super(packageName, uid, callback, session, extras);
+            mMessage = message;
+        }
+
+        /**
+         * Return the message informing the user of the completion, as per
+         * {@link android.app.VoiceInteractor.CompleteVoiceRequest
+         * VoiceInteractor.CompleteVoiceRequest}.
+         */
+        public CharSequence getMessage() {
+            return mMessage;
+        }
+
+        /**
+         * Report that the voice interactor has finished completing the voice operation, resulting
+         * in a call to
+         * {@link android.app.VoiceInteractor.CompleteVoiceRequest#onCompleteResult
+         * VoiceInteractor.CompleteVoiceRequest.onCompleteResult}.
+         */
+        public void sendCompleteResult(Bundle result) {
+            sendCompleteVoiceResult(result);
+        }
+    }
+
+    /**
+     * A request to report that the current user interaction can not be completed with voice, as per
+     * {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}.
+     */
+    public static final class AbortVoiceRequest extends Request {
+        final CharSequence mMessage;
+
+        AbortVoiceRequest(String packageName, int uid, IVoiceInteractorCallback callback,
+                VoiceInteractionSession session, CharSequence message, Bundle extras) {
+            super(packageName, uid, callback, session, extras);
+            mMessage = message;
+        }
+
+        /**
+         * Return the message informing the user of the problem, as per
+         * {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}.
+         */
+        public CharSequence getMessage() {
+            return mMessage;
+        }
+
+        /**
+         * Report that the voice interactor has finished aborting the voice operation, resulting
+         * in a call to
+         * {@link android.app.VoiceInteractor.AbortVoiceRequest#onAbortResult
+         * VoiceInteractor.AbortVoiceRequest.onAbortResult}.
+         */
+        public void sendAbortResult(Bundle result) {
+            sendAbortVoiceResult(result);
+        }
+    }
+
+    /**
+     * A generic vendor-specific request, as per
+     * {@link android.app.VoiceInteractor.CommandRequest VoiceInteractor.CommandRequest}.
+     */
+    public static final class CommandRequest extends Request {
+        final String mCommand;
+
+        CommandRequest(String packageName, int uid, IVoiceInteractorCallback callback,
+                VoiceInteractionSession session, String command, Bundle extras) {
+            super(packageName, uid, callback, session, extras);
+            mCommand = command;
+        }
+
+        /**
+         * Return the command that is being executed, as per
+         * {@link android.app.VoiceInteractor.CommandRequest VoiceInteractor.CommandRequest}.
+         */
+        public String getCommand() {
+            return mCommand;
+        }
+
+        /**
+         * Report an intermediate result of the request, without completing it (the request
+         * is still active and the app is waiting for the final result), resulting in a call to
+         * {@link android.app.VoiceInteractor.CommandRequest#onCommandResult
+         * VoiceInteractor.CommandRequest.onCommandResult} with false for isCompleted.
+         */
+        public void sendIntermediateResult(Bundle result) {
+            sendCommandResult(false, result);
+        }
+
+        /**
+         * Report the final result of the request, completing the request and resulting in a call to
+         * {@link android.app.VoiceInteractor.CommandRequest#onCommandResult
+         * VoiceInteractor.CommandRequest.onCommandResult} with true for isCompleted.
+         */
+        public void sendResult(Bundle result) {
+            sendCommandResult(true, result);
         }
     }
 
@@ -354,50 +618,33 @@
             SomeArgs args;
             switch (msg.what) {
                 case MSG_START_CONFIRMATION:
-                    args = (SomeArgs)msg.obj;
-                    if (DEBUG) Log.d(TAG, "onConfirm: req=" + ((Request) args.arg2).mInterface
-                            + " prompt=" + args.arg3 + " extras=" + args.arg4);
-                    onConfirm((Caller)args.arg1, (Request)args.arg2, (CharSequence)args.arg3,
-                            (Bundle)args.arg4);
+                    if (DEBUG) Log.d(TAG, "onConfirm: req=" + msg.obj);
+                    onRequestConfirmation((ConfirmationRequest) msg.obj);
                     break;
                 case MSG_START_PICK_OPTION:
-                    args = (SomeArgs)msg.obj;
-                    if (DEBUG) Log.d(TAG, "onPickOption: req=" + ((Request) args.arg2).mInterface
-                            + " prompt=" + args.arg3 + " options=" + args.arg4
-                            + " extras=" + args.arg5);
-                    onPickOption((Caller)args.arg1, (Request)args.arg2, (CharSequence)args.arg3,
-                            (VoiceInteractor.PickOptionRequest.Option[])args.arg4,
-                            (Bundle)args.arg5);
+                    if (DEBUG) Log.d(TAG, "onPickOption: req=" + msg.obj);
+                    onRequestPickOption((PickOptionRequest) msg.obj);
                     break;
                 case MSG_START_COMPLETE_VOICE:
-                    args = (SomeArgs)msg.obj;
-                    if (DEBUG) Log.d(TAG, "onCompleteVoice: req=" + ((Request) args.arg2).mInterface
-                            + " message=" + args.arg3 + " extras=" + args.arg4);
-                    onCompleteVoice((Caller) args.arg1, (Request) args.arg2,
-                            (CharSequence) args.arg3, (Bundle) args.arg4);
+                    if (DEBUG) Log.d(TAG, "onCompleteVoice: req=" + msg.obj);
+                    onRequestCompleteVoice((CompleteVoiceRequest) msg.obj);
                     break;
                 case MSG_START_ABORT_VOICE:
-                    args = (SomeArgs)msg.obj;
-                    if (DEBUG) Log.d(TAG, "onAbortVoice: req=" + ((Request) args.arg2).mInterface
-                            + " message=" + args.arg3 + " extras=" + args.arg4);
-                    onAbortVoice((Caller) args.arg1, (Request) args.arg2, (CharSequence) args.arg3,
-                            (Bundle) args.arg4);
+                    if (DEBUG) Log.d(TAG, "onAbortVoice: req=" + msg.obj);
+                    onRequestAbortVoice((AbortVoiceRequest) msg.obj);
                     break;
                 case MSG_START_COMMAND:
-                    args = (SomeArgs)msg.obj;
-                    if (DEBUG) Log.d(TAG, "onCommand: req=" + ((Request) args.arg2).mInterface
-                            + " command=" + args.arg3 + " extras=" + args.arg4);
-                    onCommand((Caller) args.arg1, (Request) args.arg2, (String) args.arg3,
-                            (Bundle) args.arg4);
+                    if (DEBUG) Log.d(TAG, "onCommand: req=" + msg.obj);
+                    onRequestCommand((CommandRequest) msg.obj);
                     break;
                 case MSG_SUPPORTS_COMMANDS:
                     args = (SomeArgs)msg.obj;
-                    if (DEBUG) Log.d(TAG, "onGetSupportedCommands: cmds=" + args.arg2);
-                    args.arg1 = onGetSupportedCommands((Caller) args.arg1, (String[]) args.arg2);
+                    if (DEBUG) Log.d(TAG, "onGetSupportedCommands: cmds=" + args.arg1);
+                    args.arg1 = onGetSupportedCommands((String[]) args.arg1);
                     break;
                 case MSG_CANCEL:
                     if (DEBUG) Log.d(TAG, "onCancel: req=" + ((Request)msg.obj));
-                    onCancel((Request)msg.obj);
+                    onCancelRequest((Request) msg.obj);
                     break;
                 case MSG_TASK_STARTED:
                     if (DEBUG) Log.d(TAG, "onTaskStarted: intent=" + msg.obj
@@ -526,12 +773,8 @@
         return mContext;
     }
 
-    Request newRequest(IVoiceInteractorCallback callback) {
-        synchronized (this) {
-            Request req = new Request(callback, this);
-            mActiveRequests.put(req.mInterface.asBinder(), req);
-            return req;
-        }
+    void addRequest(Request req) {
+        mActiveRequests.put(req.mInterface.asBinder(), req);
     }
 
     Request removeRequest(IBinder reqInterface) {
@@ -630,7 +873,12 @@
         mContentFrame = (FrameLayout)mRootView.findViewById(android.R.id.content);
     }
 
+    /** @hide */
     public void show() {
+        show(null, 0);
+    }
+
+    public void show(Bundle args, int showFlags) {
         try {
             mSystemService.showSessionFromSession(mToken, null, 0);
         } catch (RemoteException e) {
@@ -644,11 +892,11 @@
         }
     }
 
-    /** TODO: remove */
+    /** @hide */
     public void showWindow() {
     }
 
-    /** TODO: remove */
+    /** @hide */
     public void hideWindow() {
     }
 
@@ -677,7 +925,9 @@
      * <p>As the voice activity runs, it can retrieve a {@link android.app.VoiceInteractor}
      * through which it can perform voice interactions through your session.  These requests
      * for voice interactions will appear as callbacks on {@link #onGetSupportedCommands},
-     * {@link #onConfirm}, {@link #onCommand}, and {@link #onCancel}.
+     * {@link #onRequestConfirmation}, {@link #onRequestPickOption},
+     * {@link #onRequestCompleteVoice}, {@link #onRequestAbortVoice},
+     * or {@link #onRequestCommand}
      *
      * <p>You will receive a call to {@link #onTaskStarted} when the task starts up
      * and {@link #onTaskFinished} when the last activity has finished.
@@ -748,8 +998,25 @@
         }
     }
 
+    /**
+     * Initiatize a new session.  At this point you don't know exactly what this
+     * session will be used for; you will find that out in {@link #onShow}.
+     */
+    public void onCreate() {
+        doOnCreate();
+    }
+
     /** @hide */
     public void onCreate(Bundle args) {
+        doOnCreate();
+    }
+    
+    /** @hide */
+    public void onCreate(Bundle args, int showFlags) {
+        doOnCreate();
+    }
+
+    private void doOnCreate() {
         mTheme = mTheme != 0 ? mTheme
                 : com.android.internal.R.style.Theme_DeviceDefault_VoiceInteractionSession;
         mInflater = (LayoutInflater)mContext.getSystemService(
@@ -766,15 +1033,6 @@
     }
 
     /**
-     * Initiatize a new session.  The given args and showFlags are the initial values
-     * passed to {@link VoiceInteractionService#showSession VoiceInteractionService.showSession},
-     * if possible.  Normally you should handle these in {@link #onShow}.
-     */
-    public void onCreate(Bundle args, int showFlags) {
-        onCreate(args);
-    }
-
-    /**
      * Called when the session UI is going to be shown.  This is called after
      * {@link #onCreateContentView} (if the session's content UI needed to be created) and
      * immediately prior to the window being shown.  This may be called while the window
@@ -928,18 +1186,45 @@
         hide();
     }
 
+    /** @hide */
+    public boolean[] onGetSupportedCommands(Caller caller, String[] commands) {
+        return new boolean[commands.length];
+    }
+    /** @hide */
+    public void onConfirm(Caller caller, Request request, CharSequence prompt,
+            Bundle extras) {
+    }
+    /** @hide */
+    public void onPickOption(Caller caller, Request request, CharSequence prompt,
+            VoiceInteractor.PickOptionRequest.Option[] options, Bundle extras) {
+    }
+    /** @hide */
+    public void onCompleteVoice(Caller caller, Request request, CharSequence message,
+           Bundle extras) {
+        request.sendCompleteVoiceResult(null);
+    }
+    /** @hide */
+    public void onAbortVoice(Caller caller, Request request, CharSequence message, Bundle extras) {
+        request.sendAbortVoiceResult(null);
+    }
+    /** @hide */
+    public void onCommand(Caller caller, Request request, String command, Bundle extras) {
+    }
+    /** @hide */
+    public void onCancel(Request request) {
+    }
+
     /**
      * Request to query for what extended commands the session supports.
      *
-     * @param caller Who is making the request.
      * @param commands An array of commands that are being queried.
      * @return Return an array of booleans indicating which of each entry in the
      * command array is supported.  A true entry in the array indicates the command
      * is supported; false indicates it is not.  The default implementation returns
      * an array of all false entries.
      */
-    public boolean[] onGetSupportedCommands(Caller caller, String[] commands) {
-        return new boolean[commands.length];
+    public boolean[] onGetSupportedCommands(String[] commands) {
+        return onGetSupportedCommands(new Caller(), commands);
     }
 
     /**
@@ -947,31 +1232,22 @@
      * corresponding to a {@link android.app.VoiceInteractor.ConfirmationRequest
      * VoiceInteractor.ConfirmationRequest}.
      *
-     * @param caller Who is making the request.
      * @param request The active request.
-     * @param prompt The prompt informing the user of what will happen, as per
-     * {@link android.app.VoiceInteractor.ConfirmationRequest VoiceInteractor.ConfirmationRequest}.
-     * @param extras Any additional information, as per
-     * {@link android.app.VoiceInteractor.ConfirmationRequest VoiceInteractor.ConfirmationRequest}.
      */
-    public abstract void onConfirm(Caller caller, Request request, CharSequence prompt,
-            Bundle extras);
+    public void onRequestConfirmation(ConfirmationRequest request) {
+        onConfirm(request, request, request.getPrompt(), request.getExtras());
+    }
 
     /**
      * Request for the user to pick one of N options, corresponding to a
      * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
      *
-     * @param caller Who is making the request.
      * @param request The active request.
-     * @param prompt The prompt informing the user of what they are picking, as per
-     * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
-     * @param options The set of options the user is picking from, as per
-     * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
-     * @param extras Any additional information, as per
-     * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
      */
-    public abstract void onPickOption(Caller caller, Request request, CharSequence prompt,
-            VoiceInteractor.PickOptionRequest.Option[] options, Bundle extras);
+    public void onRequestPickOption(PickOptionRequest request) {
+        onPickOption(request, request, request.getPrompt(), request.getOptions(),
+                request.getExtras());
+    }
 
     /**
      * Request to complete the voice interaction session because the voice activity successfully
@@ -980,18 +1256,10 @@
      * VoiceInteractor.CompleteVoiceRequest}.  The default implementation just sends an empty
      * confirmation back to allow the activity to exit.
      *
-     * @param caller Who is making the request.
      * @param request The active request.
-     * @param message The message informing the user of the problem, as per
-     * {@link android.app.VoiceInteractor.CompleteVoiceRequest
-     * VoiceInteractor.CompleteVoiceRequest}.
-     * @param extras Any additional information, as per
-     * {@link android.app.VoiceInteractor.CompleteVoiceRequest
-     * VoiceInteractor.CompleteVoiceRequest}.
      */
-    public void onCompleteVoice(Caller caller, Request request, CharSequence message,
-           Bundle extras) {
-        request.sendCompleteVoiceResult(null);
+    public void onRequestCompleteVoice(CompleteVoiceRequest request) {
+        onCompleteVoice(request, request, request.getMessage(), request.getExtras());
     }
 
     /**
@@ -1001,15 +1269,10 @@
      * VoiceInteractor.AbortVoiceRequest}.  The default implementation just sends an empty
      * confirmation back to allow the activity to exit.
      *
-     * @param caller Who is making the request.
      * @param request The active request.
-     * @param message The message informing the user of the problem, as per
-     * {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}.
-     * @param extras Any additional information, as per
-     * {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}.
      */
-    public void onAbortVoice(Caller caller, Request request, CharSequence message, Bundle extras) {
-        request.sendAbortVoiceResult(null);
+    public void onRequestAbortVoice(AbortVoiceRequest request) {
+        onAbortVoice(request, request, request.getMessage(), request.getExtras());
     }
 
     /**
@@ -1017,20 +1280,21 @@
      * corresponding to a {@link android.app.VoiceInteractor.CommandRequest
      * VoiceInteractor.CommandRequest}.
      *
-     * @param caller Who is making the request.
      * @param request The active request.
-     * @param command The command that is being executed, as per
-     * {@link android.app.VoiceInteractor.CommandRequest VoiceInteractor.CommandRequest}.
-     * @param extras Any additional information, as per
-     * {@link android.app.VoiceInteractor.CommandRequest VoiceInteractor.CommandRequest}.
      */
-    public abstract void onCommand(Caller caller, Request request, String command, Bundle extras);
+    public void onRequestCommand(CommandRequest request) {
+        onCommand(request, request, request.getCommand(), request.getExtras());
+    }
 
     /**
      * Called when the {@link android.app.VoiceInteractor} has asked to cancel a {@link Request}
-     * that was previously delivered to {@link #onConfirm} or {@link #onCommand}.
+     * that was previously delivered to {@link #onRequestConfirmation},
+     * {@link #onRequestPickOption}, {@link #onRequestCompleteVoice}, {@link #onRequestAbortVoice},
+     * or {@link #onRequestCommand}.
      *
      * @param request The request that is being canceled.
      */
-    public abstract void onCancel(Request request);
+    public void onCancelRequest(Request request) {
+        onCancel(request);
+    }
 }
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index e963f53..a3332fa 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -820,44 +820,36 @@
         mOwnerThread = Thread.currentThread();
 
         final TypedArray a = context.obtainStyledAttributes(
-                attrs, com.android.internal.R.styleable.AbsListView, defStyleAttr, defStyleRes);
+                attrs, R.styleable.AbsListView, defStyleAttr, defStyleRes);
 
-        Drawable d = a.getDrawable(com.android.internal.R.styleable.AbsListView_listSelector);
-        if (d != null) {
-            setSelector(d);
+        final Drawable selector = a.getDrawable(R.styleable.AbsListView_listSelector);
+        if (selector != null) {
+            setSelector(selector);
         }
 
-        mDrawSelectorOnTop = a.getBoolean(
-                com.android.internal.R.styleable.AbsListView_drawSelectorOnTop, false);
+        mDrawSelectorOnTop = a.getBoolean(R.styleable.AbsListView_drawSelectorOnTop, false);
 
-        boolean stackFromBottom = a.getBoolean(R.styleable.AbsListView_stackFromBottom, false);
-        setStackFromBottom(stackFromBottom);
+        setStackFromBottom(a.getBoolean(
+                R.styleable.AbsListView_stackFromBottom, false));
+        setScrollingCacheEnabled(a.getBoolean(
+                R.styleable.AbsListView_scrollingCache, true));
+        setTextFilterEnabled(a.getBoolean(
+                R.styleable.AbsListView_textFilterEnabled, false));
+        setTranscriptMode(a.getInt(
+                R.styleable.AbsListView_transcriptMode, TRANSCRIPT_MODE_DISABLED));
+        setCacheColorHint(a.getColor(
+                R.styleable.AbsListView_cacheColorHint, 0));
+        setSmoothScrollbarEnabled(a.getBoolean(
+                R.styleable.AbsListView_smoothScrollbar, true));
+        setChoiceMode(a.getInt(
+                R.styleable.AbsListView_choiceMode, CHOICE_MODE_NONE));
 
-        boolean scrollingCacheEnabled = a.getBoolean(R.styleable.AbsListView_scrollingCache, true);
-        setScrollingCacheEnabled(scrollingCacheEnabled);
-
-        boolean useTextFilter = a.getBoolean(R.styleable.AbsListView_textFilterEnabled, false);
-        setTextFilterEnabled(useTextFilter);
-
-        int transcriptMode = a.getInt(R.styleable.AbsListView_transcriptMode,
-                TRANSCRIPT_MODE_DISABLED);
-        setTranscriptMode(transcriptMode);
-
-        int color = a.getColor(R.styleable.AbsListView_cacheColorHint, 0);
-        setCacheColorHint(color);
-
-        boolean enableFastScroll = a.getBoolean(R.styleable.AbsListView_fastScrollEnabled, false);
-        setFastScrollEnabled(enableFastScroll);
-
-        int fastScrollStyle = a.getResourceId(R.styleable.AbsListView_fastScrollStyle, 0);
-        setFastScrollStyle(fastScrollStyle);
-
-        boolean smoothScrollbar = a.getBoolean(R.styleable.AbsListView_smoothScrollbar, true);
-        setSmoothScrollbarEnabled(smoothScrollbar);
-
-        setChoiceMode(a.getInt(R.styleable.AbsListView_choiceMode, CHOICE_MODE_NONE));
-        setFastScrollAlwaysVisible(
-                a.getBoolean(R.styleable.AbsListView_fastScrollAlwaysVisible, false));
+        setFastScrollEnabled(a.getBoolean(
+                R.styleable.AbsListView_fastScrollEnabled, false));
+        setFastScrollStyle(a.getResourceId(
+                R.styleable.AbsListView_fastScrollStyle, 0));
+        setFastScrollAlwaysVisible(a.getBoolean(
+                R.styleable.AbsListView_fastScrollAlwaysVisible, false));
 
         a.recycle();
     }
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index ea18c12..c1ec6e6 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -659,11 +659,16 @@
             return super.getCount() + mServiceTargets.size() + mCallerTargets.size();
         }
 
-        public int getCallerTargetsCount() {
+        @Override
+        public int getUnfilteredCount() {
+            return super.getUnfilteredCount() + mServiceTargets.size() + mCallerTargets.size();
+        }
+
+        public int getCallerTargetCount() {
             return mCallerTargets.size();
         }
 
-        public int getServiceTargetsCount() {
+        public int getServiceTargetCount() {
             return mServiceTargets.size();
         }
 
@@ -696,6 +701,11 @@
 
         @Override
         public TargetInfo getItem(int position) {
+            return targetInfoForPosition(position, true);
+        }
+
+        @Override
+        public TargetInfo targetInfoForPosition(int position, boolean filtered) {
             int offset = 0;
 
             final int callerTargetCount = mCallerTargets.size();
@@ -710,7 +720,8 @@
             }
             offset += serviceTargetCount;
 
-            return super.getItem(position - offset);
+            return filtered ? super.getItem(position - offset)
+                    : getDisplayInfoAt(position - offset);
         }
 
         public void addServiceResults(DisplayResolveInfo origTarget, List<ChooserTarget> targets) {
@@ -764,8 +775,8 @@
         @Override
         public int getCount() {
             return (int) (
-                    Math.ceil((float) mChooserListAdapter.getCallerTargetsCount() / mColumnCount)
-                    + Math.ceil((float) mChooserListAdapter.getServiceTargetsCount() / mColumnCount)
+                    Math.ceil((float) mChooserListAdapter.getCallerTargetCount() / mColumnCount)
+                    + Math.ceil((float) mChooserListAdapter.getServiceTargetCount() / mColumnCount)
                     + Math.ceil((float) mChooserListAdapter.getStandardTargetCount() / mColumnCount)
             );
         }
@@ -845,14 +856,14 @@
         }
 
         int getFirstRowPosition(int row) {
-            final int callerCount = mChooserListAdapter.getCallerTargetsCount();
+            final int callerCount = mChooserListAdapter.getCallerTargetCount();
             final int callerRows = (int) Math.ceil((float) callerCount / mColumnCount);
 
             if (row < callerRows) {
                 return row * mColumnCount;
             }
 
-            final int serviceCount = mChooserListAdapter.getServiceTargetsCount();
+            final int serviceCount = mChooserListAdapter.getServiceTargetCount();
             final int serviceRows = (int) Math.ceil((float) serviceCount / mColumnCount);
 
             if (row < callerRows + serviceRows) {
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 4696757..ba4af89 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -785,7 +785,7 @@
         }
         mAlwaysUseOption = alwaysUseOption;
 
-        int count = mAdapter.mDisplayList.size();
+        int count = mAdapter.getUnfilteredCount();
         if (count > 1 || (count == 1 && mAdapter.getOtherProfile() != null)) {
             setContentView(layoutId);
             mAdapterView = (AbsListView) findViewById(R.id.resolver_list);
@@ -1392,6 +1392,18 @@
             return result;
         }
 
+        public int getUnfilteredCount() {
+            return mDisplayList.size();
+        }
+
+        public int getDisplayInfoCount() {
+            return mDisplayList.size();
+        }
+
+        public DisplayResolveInfo getDisplayInfoAt(int index) {
+            return mDisplayList.get(index);
+        }
+
         public TargetInfo getItem(int position) {
             if (mFilterLastUsed && mLastChosenPosition >= 0 && position >= mLastChosenPosition) {
                 position++;
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index a04218a..22c0680 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -2219,12 +2219,14 @@
         private final ColorViewState mStatusColorViewState = new ColorViewState(
                 SYSTEM_UI_FLAG_FULLSCREEN, FLAG_TRANSLUCENT_STATUS,
                 Gravity.TOP,
+                Gravity.LEFT,
                 STATUS_BAR_BACKGROUND_TRANSITION_NAME,
                 com.android.internal.R.id.statusBarBackground,
                 FLAG_FULLSCREEN);
         private final ColorViewState mNavigationColorViewState = new ColorViewState(
                 SYSTEM_UI_FLAG_HIDE_NAVIGATION, FLAG_TRANSLUCENT_NAVIGATION,
                 Gravity.BOTTOM,
+                Gravity.RIGHT,
                 NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME,
                 com.android.internal.R.id.navigationBarBackground,
                 0 /* hideWindowFlag */);
@@ -2240,6 +2242,7 @@
         private int mLastRightInset = 0;
         private boolean mLastHasTopStableInset = false;
         private boolean mLastHasBottomStableInset = false;
+        private boolean mLastHasRightStableInset = false;
         private int mLastWindowFlags = 0;
 
         private int mRootScrollY = 0;
@@ -2882,12 +2885,19 @@
                     boolean hasBottomStableInset = insets.getStableInsetBottom() != 0;
                     disallowAnimate |= (hasBottomStableInset != mLastHasBottomStableInset);
                     mLastHasBottomStableInset = hasBottomStableInset;
+
+                    boolean hasRightStableInset = insets.getStableInsetRight() != 0;
+                    disallowAnimate |= (hasRightStableInset != mLastHasRightStableInset);
+                    mLastHasRightStableInset = hasRightStableInset;
                 }
 
                 updateColorViewInt(mStatusColorViewState, sysUiVisibility, mStatusBarColor,
-                        mLastTopInset, animate && !disallowAnimate);
+                        mLastTopInset, false /* matchVertical */, animate && !disallowAnimate);
+
+                boolean navBarToRightEdge = mLastBottomInset == 0 && mLastRightInset > 0;
+                int navBarSize = navBarToRightEdge ? mLastRightInset : mLastBottomInset;
                 updateColorViewInt(mNavigationColorViewState, sysUiVisibility, mNavigationBarColor,
-                        mLastBottomInset, animate && !disallowAnimate);
+                        navBarSize, navBarToRightEdge, animate && !disallowAnimate);
             }
 
             // When we expand the window with FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, we still need
@@ -2931,9 +2941,20 @@
             return insets;
         }
 
+        /**
+         * Update a color view
+         *
+         * @param state the color view to update.
+         * @param sysUiVis the current systemUiVisibility to apply.
+         * @param color the current color to apply.
+         * @param size the current size in the non-parent-matching dimension.
+         * @param verticalBar if true the view is attached to a vertical edge, otherwise to a
+         *                    horizontal edge,
+         * @param animate if true, the change will be animated.
+         */
         private void updateColorViewInt(final ColorViewState state, int sysUiVis, int color,
-                int height, boolean animate) {
-            boolean show = height > 0 && (sysUiVis & state.systemUiHideFlag) == 0
+                int size, boolean verticalBar, boolean animate) {
+            boolean show = size > 0 && (sysUiVis & state.systemUiHideFlag) == 0
                     && (getAttributes().flags & state.hideWindowFlag) == 0
                     && (getAttributes().flags & state.translucentFlag) == 0
                     && (color & Color.BLACK) != 0
@@ -2942,6 +2963,10 @@
             boolean visibilityChanged = false;
             View view = state.view;
 
+            int resolvedHeight = verticalBar ? LayoutParams.MATCH_PARENT : size;
+            int resolvedWidth = verticalBar ? size : LayoutParams.MATCH_PARENT;
+            int resolvedGravity = verticalBar ? state.horizontalGravity : state.verticalGravity;
+
             if (view == null) {
                 if (show) {
                     state.view = view = new View(mContext);
@@ -2952,8 +2977,7 @@
                     view.setVisibility(INVISIBLE);
                     state.targetVisibility = VISIBLE;
 
-                    addView(view, new LayoutParams(LayoutParams.MATCH_PARENT, height,
-                            Gravity.START | state.verticalGravity));
+                    addView(view, new LayoutParams(resolvedWidth, resolvedHeight, resolvedGravity));
                     updateColorViewTranslations();
                 }
             } else {
@@ -2962,8 +2986,11 @@
                 state.targetVisibility = vis;
                 if (show) {
                     LayoutParams lp = (LayoutParams) view.getLayoutParams();
-                    if (lp.height != height) {
-                        lp.height = height;
+                    if (lp.height != resolvedHeight || lp.width != resolvedWidth
+                            || lp.gravity != resolvedGravity) {
+                        lp.height = resolvedHeight;
+                        lp.width = resolvedWidth;
+                        lp.gravity = resolvedGravity;
                         view.setLayoutParams(lp);
                     }
                     view.setBackgroundColor(color);
@@ -4878,16 +4905,18 @@
         final int systemUiHideFlag;
         final int translucentFlag;
         final int verticalGravity;
+        final int horizontalGravity;
         final String transitionName;
         final int hideWindowFlag;
 
         ColorViewState(int systemUiHideFlag,
-                int translucentFlag, int verticalGravity,
+                int translucentFlag, int verticalGravity, int horizontalGravity,
                 String transitionName, int id, int hideWindowFlag) {
             this.id = id;
             this.systemUiHideFlag = systemUiHideFlag;
             this.translucentFlag = translucentFlag;
             this.verticalGravity = verticalGravity;
+            this.horizontalGravity = horizontalGravity;
             this.transitionName = transitionName;
             this.hideWindowFlag = hideWindowFlag;
         }
diff --git a/core/java/com/android/internal/widget/FloatingToolbar.java b/core/java/com/android/internal/widget/FloatingToolbar.java
index 3cff59a..1fc0ac3 100644
--- a/core/java/com/android/internal/widget/FloatingToolbar.java
+++ b/core/java/com/android/internal/widget/FloatingToolbar.java
@@ -353,10 +353,14 @@
          *      from.
          */
         public FloatingToolbarPopup(View parent) {
+            mMarginHorizontal = parent.getResources()
+                    .getDimensionPixelSize(R.dimen.floating_toolbar_horizontal_margin);
+            mMarginVertical = parent.getResources()
+                    .getDimensionPixelSize(R.dimen.floating_toolbar_vertical_margin);
             mParent = Preconditions.checkNotNull(parent);
             mContentContainer = createContentContainer(parent.getContext());
             mPopupWindow = createPopupWindow(mContentContainer);
-            mShowAnimation = createGrowFadeInFromBottom(mContentContainer);
+            mShowAnimation = createGrowFadeInFromBottom(mContentContainer, mMarginHorizontal);
             mDismissAnimation = createShrinkFadeOutFromBottomAnimation(
                     mContentContainer,
                     150,  // startDelay
@@ -376,17 +380,15 @@
                             mPopupWindow.dismiss();
                         }
                     });
-            mMarginHorizontal = parent.getResources()
-                    .getDimensionPixelSize(R.dimen.floating_toolbar_horizontal_margin);
-            mMarginVertical = parent.getResources()
-                    .getDimensionPixelSize(R.dimen.floating_toolbar_vertical_margin);
         }
 
         /**
          * Lays out buttons for the specified menu items.
          */
-        public void layoutMenuItems(List<MenuItem> menuItems,
-                MenuItem.OnMenuItemClickListener menuItemClickListener, int suggestedWidth) {
+        public void layoutMenuItems(
+                List<MenuItem> menuItems,
+                MenuItem.OnMenuItemClickListener menuItemClickListener,
+                int suggestedWidth) {
             Preconditions.checkNotNull(menuItems);
 
             mContentContainer.removeAllViews();
@@ -593,7 +595,9 @@
             final int startWidth = mContentContainer.getWidth();
             final int startHeight = mContentContainer.getHeight();
             final float startY = mContentContainer.getY();
-            final float right = mContentContainer.getX() + mContentContainer.getWidth();
+            final float left = mContentContainer.getX();
+            final float right = left + mContentContainer.getWidth();
+            final boolean rtl = mContentContainer.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
             Animation widthAnimation = new Animation() {
                 @Override
                 protected void applyTransformation(float interpolatedTime, Transformation t) {
@@ -601,7 +605,11 @@
                     int deltaWidth = (int) (interpolatedTime * (targetWidth - startWidth));
                     params.width = startWidth + deltaWidth;
                     mContentContainer.setLayoutParams(params);
-                    mContentContainer.setX(right - mContentContainer.getWidth());
+                    if (rtl) {
+                        mContentContainer.setX(left);
+                    } else {
+                        mContentContainer.setX(right - mContentContainer.getWidth());
+                    }
                 }
             };
             Animation heightAnimation = new Animation() {
@@ -644,9 +652,11 @@
             final int targetHeight = mainPanelSize.getHeight();
             final int startWidth = mContentContainer.getWidth();
             final int startHeight = mContentContainer.getHeight();
-            final float right = mContentContainer.getX() + mContentContainer.getWidth();
             final float bottom = mContentContainer.getY() + mContentContainer.getHeight();
             final boolean morphedUpwards = (mOverflowDirection == OVERFLOW_DIRECTION_UP);
+            final float left = mContentContainer.getX();
+            final float right = left + mContentContainer.getWidth();
+            final boolean rtl = mContentContainer.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
             Animation widthAnimation = new Animation() {
                 @Override
                 protected void applyTransformation(float interpolatedTime, Transformation t) {
@@ -654,7 +664,11 @@
                     int deltaWidth = (int) (interpolatedTime * (targetWidth - startWidth));
                     params.width = startWidth + deltaWidth;
                     mContentContainer.setLayoutParams(params);
-                    mContentContainer.setX(right - mContentContainer.getWidth());
+                    if (rtl) {
+                        mContentContainer.setX(left);
+                    } else {
+                        mContentContainer.setX(right - mContentContainer.getWidth());
+                    }
                 }
             };
             Animation heightAnimation = new Animation() {
@@ -747,9 +761,7 @@
          */
         private void positionMainPanel() {
             Preconditions.checkNotNull(mMainPanel);
-            float x = mPopupWindow.getWidth()
-                    - (mMainPanel.getView().getMeasuredWidth() + mMarginHorizontal);
-            mContentContainer.setX(x);
+            mContentContainer.setX(mMarginHorizontal);
 
             float y = mMarginVertical;
             if  (mOverflowDirection == OVERFLOW_DIRECTION_UP) {
@@ -1320,12 +1332,14 @@
      *
      * @param view  The view to animate
      */
-    private static AnimatorSet createGrowFadeInFromBottom(View view) {
+    private static AnimatorSet createGrowFadeInFromBottom(View view, int x) {
         AnimatorSet growFadeInFromBottomAnimation =  new AnimatorSet();
         growFadeInFromBottomAnimation.playTogether(
                 ObjectAnimator.ofFloat(view, View.SCALE_X, 0.5f, 1).setDuration(125),
                 ObjectAnimator.ofFloat(view, View.SCALE_Y, 0.5f, 1).setDuration(125),
-                ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1).setDuration(75));
+                ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1).setDuration(75),
+                // Make sure that view.x is always fixed throughout the duration of this animation.
+                ObjectAnimator.ofFloat(view, View.X, x, x));
         growFadeInFromBottomAnimation.setStartDelay(50);
         return growFadeInFromBottomAnimation;
     }
diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml
index f9fcf38..f7a42fa 100644
--- a/core/res/res/values/styles_material.xml
+++ b/core/res/res/values/styles_material.xml
@@ -348,12 +348,12 @@
     </style>
 
     <style name="TextAppearance.Material.Widget.ActionBar.Menu"
-           parent="TextAppearance.Material.Menu">
+           parent="TextAppearance.Material.Widget.Button">
         <item name="textColor">?attr/actionMenuTextColor</item>
         <item name="textAllCaps">@bool/config_actionMenuItemAllCaps</item>
     </style>
     <style name="TextAppearance.Material.Widget.ActionBar.Menu.Inverse"
-           parent="TextAppearance.Material.Menu.Inverse">
+           parent="TextAppearance.Material.Widget.Button.Inverse">
         <item name="textColor">?attr/actionMenuTextColor</item>
         <item name="textAllCaps">@bool/config_actionMenuItemAllCaps</item>
     </style>
diff --git a/docs/html/preview/api-overview.jd b/docs/html/preview/api-overview.jd
index e6c851b..1686d79 100644
--- a/docs/html/preview/api-overview.jd
+++ b/docs/html/preview/api-overview.jd
@@ -20,7 +20,7 @@
   <li><a href="#authentication">Authentication</a>
     <ol>
       <li><a href="#fingerprint-authentication">Fingerprint Authentication</a></li>
-      <li><a href="#confirm-credentials">Confirm Credentials</a></li>
+      <li><a href="#confirm-credential">Confirm Credential</a></li>
     </ol>
   </li>
   <li><a href="#direct-share">Direct Share</a></li>
@@ -144,7 +144,7 @@
 </li>
 </ol>
 
-<h3 id="confirm-credentials">Confirm Credentials</h3>
+<h3 id="confirm-credential">Confirm Credential</h3>
 <p>Your app can authenticate users based on how recently they last unlocked their device. This
 feature frees users from having to remember additional app-specific passwords, and avoids the need
 for you to implement your own authentication user interface. Your app should use this feature in
@@ -164,8 +164,8 @@
 </p>
 
 <p>To see an app implementation of this feature, refer to the
-<a href="https://github.com/googlesamples/android-ConfirmCredentials" class="external-link">
-  Confirm Credentials sample</a>.</p>
+<a href="https://github.com/googlesamples/android-ConfirmCredential" class="external-link">
+  Confirm Credential sample</a>.</p>
 
 <h2 id="direct-share">Direct Share</h2>
 
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 668f80a..13714d3 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -77,7 +77,6 @@
 import java.util.Scanner;
 import java.util.Set;
 import java.util.Vector;
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.lang.ref.WeakReference;
 
 /**
@@ -624,9 +623,6 @@
     private int mUsage = -1;
     private boolean mBypassInterruptionPolicy;
 
-    // use AtomicBoolean instead of boolean so we can use the same member both as a flag and a lock.
-    private AtomicBoolean mPreparing = new AtomicBoolean();
-
     /**
      * Default constructor. Consider using one of the create() methods for
      * synchronously instantiating a MediaPlayer from a Uri or resource.
@@ -1166,10 +1162,6 @@
      * @throws IllegalStateException if it is called in an invalid state
      */
     public void prepare() throws IOException, IllegalStateException {
-        // The synchronous version of prepare also recieves a MEDIA_PREPARED message.
-        synchronized (mPreparing) {
-            mPreparing.set(true);
-        }
         _prepare();
         scanInternalSubtitleTracks();
     }
@@ -1186,14 +1178,7 @@
      *
      * @throws IllegalStateException if it is called in an invalid state
      */
-    public void prepareAsync() throws IllegalStateException {
-        synchronized (mPreparing) {
-            mPreparing.set(true);
-        }
-        _prepareAsync();
-    }
-
-    private native void _prepareAsync() throws IllegalStateException;
+    public native void prepareAsync() throws IllegalStateException;
 
     /**
      * Starts or resumes playback. If playback had previously been paused,
@@ -1244,9 +1229,6 @@
      * initialized.
      */
     public void stop() throws IllegalStateException {
-        synchronized (mPreparing) {
-            mPreparing.set(false);
-        }
         stayAwake(false);
         _stop();
     }
@@ -1676,9 +1658,6 @@
      * at the same time.
      */
     public void release() {
-        synchronized (mPreparing) {
-            mPreparing.set(false);
-        }
         stayAwake(false);
         updateSurfaceScreenOn();
         mOnPreparedListener = null;
@@ -1705,9 +1684,6 @@
      * data source and calling prepare().
      */
     public void reset() {
-        synchronized (mPreparing) {
-            mPreparing.set(false);
-        }
         mSelectedSubtitleTrackIndex = -1;
         synchronized(mOpenSubtitleSources) {
             for (final InputStream is: mOpenSubtitleSources) {
@@ -2828,11 +2804,15 @@
             }
             switch(msg.what) {
             case MEDIA_PREPARED:
-                synchronized (mPreparing) {
-                    if (mPreparing.get()) {
-                        scanInternalSubtitleTracks();
-                        mPreparing.set(false);
-                    }
+                try {
+                    scanInternalSubtitleTracks();
+                } catch (RuntimeException e) {
+                    // send error message instead of crashing;
+                    // send error message instead of inlining a call to onError
+                    // to avoid code duplication.
+                    Message msg2 = obtainMessage(
+                            MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, MEDIA_ERROR_UNSUPPORTED, null);
+                    sendMessage(msg2);
                 }
                 if (mOnPreparedListener != null)
                     mOnPreparedListener.onPrepared(mMediaPlayer);
@@ -2908,7 +2888,13 @@
                     Log.i(TAG, "Info (" + msg.arg1 + "," + msg.arg2 + ")");
                     break;
                 case MEDIA_INFO_METADATA_UPDATE:
-                    scanInternalSubtitleTracks();
+                    try {
+                        scanInternalSubtitleTracks();
+                    } catch (RuntimeException e) {
+                        Message msg2 = obtainMessage(
+                                MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, MEDIA_ERROR_UNSUPPORTED, null);
+                        sendMessage(msg2);
+                    }
                     // fall through
 
                 case MEDIA_INFO_EXTERNAL_METADATA_UPDATE:
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 9c67278..d8041f4 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -1045,7 +1045,7 @@
     {"_setDataSource",      "(Landroid/media/MediaDataSource;)V",(void *)android_media_MediaPlayer_setDataSourceCallback },
     {"_setVideoSurface",    "(Landroid/view/Surface;)V",        (void *)android_media_MediaPlayer_setVideoSurface},
     {"_prepare",            "()V",                              (void *)android_media_MediaPlayer_prepare},
-    {"_prepareAsync",       "()V",                              (void *)android_media_MediaPlayer_prepareAsync},
+    {"prepareAsync",        "()V",                              (void *)android_media_MediaPlayer_prepareAsync},
     {"_start",              "()V",                              (void *)android_media_MediaPlayer_start},
     {"_stop",               "()V",                              (void *)android_media_MediaPlayer_stop},
     {"getVideoWidth",       "()I",                              (void *)android_media_MediaPlayer_getVideoWidth},
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
index 68803b3..f324933 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
@@ -205,7 +205,9 @@
      * Gets the current list of access points.
      */
     public List<AccessPoint> getAccessPoints() {
-        return mAccessPoints;
+        synchronized (mAccessPoints) {
+            return new ArrayList<>(mAccessPoints);
+        }
     }
 
     public WifiManager getManager() {
@@ -230,14 +232,14 @@
 
     public void dump(PrintWriter pw) {
         pw.println("  - wifi tracker ------");
-        for (AccessPoint accessPoint : mAccessPoints) {
+        for (AccessPoint accessPoint : getAccessPoints()) {
             pw.println("  " + accessPoint);
         }
     }
 
     private void updateAccessPoints() {
         // Swap the current access points into a cached list.
-        ArrayList<AccessPoint> cachedAccessPoints = new ArrayList<>(mAccessPoints);
+        List<AccessPoint> cachedAccessPoints = getAccessPoints();
         ArrayList<AccessPoint> accessPoints = new ArrayList<>();
 
         // Clear out the configs so we don't think something is saved when it isn't.
@@ -330,7 +332,7 @@
         mMainHandler.sendEmptyMessage(MainHandler.MSG_ACCESS_POINT_CHANGED);
     }
 
-    private AccessPoint getCachedOrCreate(ScanResult result, ArrayList<AccessPoint> cache) {
+    private AccessPoint getCachedOrCreate(ScanResult result, List<AccessPoint> cache) {
         final int N = cache.size();
         for (int i = 0; i < N; i++) {
             if (cache.get(i).matches(result)) {
@@ -342,7 +344,7 @@
         return new AccessPoint(mContext, result);
     }
 
-    private AccessPoint getCachedOrCreate(WifiConfiguration config, ArrayList<AccessPoint> cache) {
+    private AccessPoint getCachedOrCreate(WifiConfiguration config, List<AccessPoint> cache) {
         final int N = cache.size();
         for (int i = 0; i < N; i++) {
             if (cache.get(i).matches(config)) {
@@ -380,7 +382,9 @@
             }
         }
         if (reorder) {
-            Collections.sort(mAccessPoints);
+            synchronized (mAccessPoints) {
+                Collections.sort(mAccessPoints);
+            }
             mMainHandler.sendEmptyMessage(MainHandler.MSG_ACCESS_POINT_CHANGED);
         }
     }
diff --git a/packages/SystemUI/res/anim/ic_signal_blink_1.xml b/packages/SystemUI/res/anim/ic_signal_blink_1.xml
index ab1905a..64580d1 100644
--- a/packages/SystemUI/res/anim/ic_signal_blink_1.xml
+++ b/packages/SystemUI/res/anim/ic_signal_blink_1.xml
@@ -23,16 +23,16 @@
         android:valueType="colorType">
         <keyframe
             android:fraction="0.0"
-            android:value="@color/light_mode_icon_color_dual_tone_fill"/>
+            android:value="?attr/fillColor"/>
         <keyframe
             android:fraction="0.32"
-            android:value="@color/light_mode_icon_color_dual_tone_fill"/>
+            android:value="?attr/fillColor"/>
         <keyframe
             android:fraction="0.33"
-            android:value="@color/light_mode_icon_color_dual_tone_background"/>
+            android:value="?attr/backgroundColor"/>
         <keyframe
             android:fraction="1.0"
-            android:value="@color/light_mode_icon_color_dual_tone_background"/>
+            android:value="?attr/backgroundColor"/>
     </propertyValuesHolder>
 
 </objectAnimator>
diff --git a/packages/SystemUI/res/anim/ic_signal_blink_2.xml b/packages/SystemUI/res/anim/ic_signal_blink_2.xml
index 1b7ace2..f055cd07 100644
--- a/packages/SystemUI/res/anim/ic_signal_blink_2.xml
+++ b/packages/SystemUI/res/anim/ic_signal_blink_2.xml
@@ -23,22 +23,22 @@
         android:valueType="colorType">
         <keyframe
             android:fraction="0.0"
-            android:value="@color/light_mode_icon_color_dual_tone_background"/>
+            android:value="?attr/backgroundColor"/>
         <keyframe
             android:fraction="0.32"
-            android:value="@color/light_mode_icon_color_dual_tone_background"/>
+            android:value="?attr/backgroundColor"/>
         <keyframe
             android:fraction="0.33"
-            android:value="@color/light_mode_icon_color_dual_tone_fill"/>
+            android:value="?attr/fillColor"/>
         <keyframe
             android:fraction="0.66"
-            android:value="@color/light_mode_icon_color_dual_tone_fill"/>
+            android:value="?attr/fillColor"/>
         <keyframe
             android:fraction="0.67"
-            android:value="@color/light_mode_icon_color_dual_tone_background"/>
+            android:value="?attr/backgroundColor"/>
         <keyframe
             android:fraction="1.0"
-            android:value="@color/light_mode_icon_color_dual_tone_background"/>
+            android:value="?attr/backgroundColor"/>
     </propertyValuesHolder>
 
 </objectAnimator>
diff --git a/packages/SystemUI/res/anim/ic_signal_blink_3.xml b/packages/SystemUI/res/anim/ic_signal_blink_3.xml
index cee831c..abcd774 100644
--- a/packages/SystemUI/res/anim/ic_signal_blink_3.xml
+++ b/packages/SystemUI/res/anim/ic_signal_blink_3.xml
@@ -23,16 +23,16 @@
         android:valueType="colorType">
         <keyframe
             android:fraction="0.0"
-            android:value="@color/light_mode_icon_color_dual_tone_background"/>
+            android:value="?attr/backgroundColor"/>
         <keyframe
             android:fraction="0.66"
-            android:value="@color/light_mode_icon_color_dual_tone_background"/>
+            android:value="?attr/backgroundColor"/>
         <keyframe
             android:fraction="0.67"
-            android:value="@color/light_mode_icon_color_dual_tone_fill"/>
+            android:value="?attr/fillColor"/>
         <keyframe
             android:fraction="1.0"
-            android:value="@color/light_mode_icon_color_dual_tone_fill"/>
+            android:value="?attr/fillColor"/>
     </propertyValuesHolder>
 
 </objectAnimator>
diff --git a/packages/SystemUI/res/anim/ic_signal_dark_blink_1.xml b/packages/SystemUI/res/anim/ic_signal_dark_blink_1.xml
deleted file mode 100644
index 9d398fa..0000000
--- a/packages/SystemUI/res/anim/ic_signal_dark_blink_1.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
-    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.
--->
-<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
-    android:interpolator="@android:anim/linear_interpolator"
-    android:duration="@integer/carrier_network_change_anim_time"
-    android:repeatCount="-1">
-
-    <propertyValuesHolder
-        android:propertyName="fillColor"
-        android:valueType="colorType">
-        <keyframe
-            android:fraction="0.0"
-            android:value="@color/dark_mode_icon_color_dual_tone_fill"/>
-        <keyframe
-            android:fraction="0.32"
-            android:value="@color/dark_mode_icon_color_dual_tone_fill"/>
-        <keyframe
-            android:fraction="0.33"
-            android:value="@color/dark_mode_icon_color_dual_tone_background"/>
-        <keyframe
-            android:fraction="1.0"
-            android:value="@color/dark_mode_icon_color_dual_tone_background"/>
-    </propertyValuesHolder>
-
-</objectAnimator>
diff --git a/packages/SystemUI/res/anim/ic_signal_dark_blink_2.xml b/packages/SystemUI/res/anim/ic_signal_dark_blink_2.xml
deleted file mode 100644
index c6e213d..0000000
--- a/packages/SystemUI/res/anim/ic_signal_dark_blink_2.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<!--
-    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.
--->
-<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
-    android:interpolator="@android:anim/linear_interpolator"
-    android:duration="@integer/carrier_network_change_anim_time"
-    android:repeatCount="-1">
-
-    <propertyValuesHolder
-        android:propertyName="fillColor"
-        android:valueType="colorType">
-        <keyframe
-            android:fraction="0.0"
-            android:value="@color/dark_mode_icon_color_dual_tone_background"/>
-        <keyframe
-            android:fraction="0.32"
-            android:value="@color/dark_mode_icon_color_dual_tone_background"/>
-        <keyframe
-            android:fraction="0.33"
-            android:value="@color/dark_mode_icon_color_dual_tone_fill"/>
-        <keyframe
-            android:fraction="0.66"
-            android:value="@color/dark_mode_icon_color_dual_tone_fill"/>
-        <keyframe
-            android:fraction="0.67"
-            android:value="@color/dark_mode_icon_color_dual_tone_background"/>
-        <keyframe
-            android:fraction="1.0"
-            android:value="@color/dark_mode_icon_color_dual_tone_background"/>
-    </propertyValuesHolder>
-
-</objectAnimator>
diff --git a/packages/SystemUI/res/anim/ic_signal_dark_blink_3.xml b/packages/SystemUI/res/anim/ic_signal_dark_blink_3.xml
deleted file mode 100644
index dce148c..0000000
--- a/packages/SystemUI/res/anim/ic_signal_dark_blink_3.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
-    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.
--->
-<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
-    android:interpolator="@android:anim/linear_interpolator"
-    android:duration="@integer/carrier_network_change_anim_time"
-    android:repeatCount="-1">
-
-    <propertyValuesHolder
-        android:propertyName="fillColor"
-        android:valueType="colorType">
-        <keyframe
-            android:fraction="0.0"
-            android:value="@color/dark_mode_icon_color_dual_tone_background"/>
-        <keyframe
-            android:fraction="0.66"
-            android:value="@color/dark_mode_icon_color_dual_tone_background"/>
-        <keyframe
-            android:fraction="0.67"
-            android:value="@color/dark_mode_icon_color_dual_tone_fill"/>
-        <keyframe
-            android:fraction="1.0"
-            android:value="@color/dark_mode_icon_color_dual_tone_fill"/>
-    </propertyValuesHolder>
-
-</objectAnimator>
diff --git a/packages/SystemUI/res/drawable/stat_sys_signal_dark_carrier_network_change_animation.xml b/packages/SystemUI/res/drawable/stat_sys_signal_dark_carrier_network_change_animation.xml
deleted file mode 100644
index ff49d4c..0000000
--- a/packages/SystemUI/res/drawable/stat_sys_signal_dark_carrier_network_change_animation.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
-    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/stat_sys_signal_carrier_network_change" >
-    <target
-        android:name="dot1"
-        android:animation="@anim/ic_signal_dark_blink_1"/>
-    <target
-        android:name="dot2"
-        android:animation="@anim/ic_signal_dark_blink_2"/>
-    <target
-        android:name="dot3"
-        android:animation="@anim/ic_signal_dark_blink_3"/>
-</animated-vector>
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 dcf0438..a9e8b38 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
@@ -162,10 +162,9 @@
         }
 
         @Override
-        public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon,
-                int darkStatusIcon, int statusType, int qsType, boolean activityIn,
-                boolean activityOut, String typeContentDescription, String description,
-                boolean isWide, int subId) {
+        public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
+                int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
+                String description, boolean isWide, int subId) {
             if (qsIcon == null) {
                 // Not data sim, don't display.
                 return;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 3a97a41..5f151e8 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -880,8 +880,10 @@
                     }
 
                     // Start the focus animation when alt-tabbing
-                    if (mConfig.launchedWithAltTab && !mConfig.launchedHasConfigurationChanged) {
-                        TaskView tv = getChildViewForTask(mStack.getTasks().get(mFocusedTaskIndex));
+                    ArrayList<Task> tasks = mStack.getTasks();
+                    if (mConfig.launchedWithAltTab && !mConfig.launchedHasConfigurationChanged &&
+                            0 <= mFocusedTaskIndex && mFocusedTaskIndex < tasks.size()) {
+                        TaskView tv = getChildViewForTask(tasks.get(mFocusedTaskIndex));
                         if (tv != null) {
                             tv.setFocusedTask(true);
                         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
index 991bde5..a66f8ec 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
@@ -180,13 +180,12 @@
     }
 
     @Override
-    public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int darkStatusIcon,
-            int statusType, int qsType, boolean activityIn, boolean activityOut,
-            String typeContentDescription, String description, boolean isWide, int subId) {
+    public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
+            int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
+            String description, boolean isWide, int subId) {
         PhoneState state = getOrInflateState(subId);
         state.mMobileVisible = statusIcon.visible;
         state.mMobileStrengthId = statusIcon.icon;
-        state.mMobileDarkStrengthId = darkStatusIcon;
         state.mMobileTypeId = statusType;
         state.mMobileDescription = statusIcon.contentDescription;
         state.mMobileTypeDescription = typeContentDescription;
@@ -426,7 +425,7 @@
     private class PhoneState {
         private final int mSubId;
         private boolean mMobileVisible = false;
-        private int mMobileStrengthId = 0, mMobileDarkStrengthId = 0, mMobileTypeId = 0;
+        private int mMobileStrengthId = 0, mMobileTypeId = 0;
         private boolean mIsMobileTypeIconWide;
         private String mMobileDescription, mMobileTypeDescription;
 
@@ -483,9 +482,8 @@
             mMobileDark.setPaddingRelative(mIsMobileTypeIconWide ? mWideTypeIconStartPadding : 0,
                     0, 0, 0);
 
-            if (DEBUG) Log.d(TAG, String.format("mobile: %s sig=%d dark=%d typ=%d",
-                        (mMobileVisible ? "VISIBLE" : "GONE"), mMobileStrengthId,
-                        mMobileDarkStrengthId, mMobileTypeId));
+            if (DEBUG) Log.d(TAG, String.format("mobile: %s sig=%d typ=%d",
+                        (mMobileVisible ? "VISIBLE" : "GONE"), mMobileStrengthId, mMobileTypeId));
 
             mMobileType.setVisibility(mMobileTypeId != 0 ? View.VISIBLE : View.GONE);
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
index a712d29..134c579 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
@@ -33,8 +33,6 @@
     private final IStatusBarService mBarService;
 
     private boolean mLightsOut;
-    private boolean mVertical;
-    private int mRequestedMode;
 
     public NavigationBarTransitions(NavigationBarView view) {
         super(view, R.drawable.nav_background);
@@ -43,31 +41,11 @@
                 ServiceManager.getService(Context.STATUS_BAR_SERVICE));
     }
 
-    public void init(boolean isVertical) {
-        setVertical(isVertical);
+    public void init() {
         applyModeBackground(-1, getMode(), false /*animate*/);
         applyMode(getMode(), false /*animate*/, true /*force*/);
     }
 
-    public void setVertical(boolean isVertical) {
-        mVertical = isVertical;
-        transitionTo(mRequestedMode, false /*animate*/);
-    }
-
-    @Override
-    public void transitionTo(int mode, boolean animate) {
-        mRequestedMode = mode;
-        if (mVertical) {
-            // translucent mode not allowed when vertical
-            if (mode == MODE_TRANSLUCENT || mode == MODE_TRANSPARENT) {
-                mode = MODE_OPAQUE;
-            } else if (mode == MODE_LIGHTS_OUT_TRANSPARENT) {
-                mode = MODE_LIGHTS_OUT;
-            }
-        }
-        super.transitionTo(mode, animate);
-    }
-
     @Override
     protected void onTransition(int oldMode, int newMode, boolean animate) {
         super.onTransition(oldMode, newMode, animate);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 1dec227..636c511 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -47,7 +47,6 @@
 import android.widget.LinearLayout;
 
 import com.android.systemui.R;
-import com.android.systemui.statusbar.BaseStatusBar;
 import com.android.systemui.statusbar.DelegateViewHelper;
 import com.android.systemui.statusbar.policy.DeadZone;
 import com.android.systemui.statusbar.policy.KeyButtonView;
@@ -454,7 +453,7 @@
         mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone);
 
         // force the low profile & disabled states into compliance
-        mBarTransitions.init(mVertical);
+        mBarTransitions.init();
         setDisabledFlags(mDisabledFlags, true /* force */);
         setMenuVisibility(mShowMenu, true /* force */);
 
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 1e4aa61..5ff4ddb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -349,6 +349,9 @@
                 if (!mUserSetup && mStatusBarView != null)
                     animateCollapseQuickSettings();
             }
+            if (mIconPolicy != null) {
+                mIconPolicy.setCurrentUserSetup(mUserSetup);
+            }
         }
     };
 
@@ -554,6 +557,7 @@
 
         // Lastly, call to the icon policy to install/update all the icons.
         mIconPolicy = new PhoneStatusBarPolicy(mContext, mCastController, mHotspotController);
+        mIconPolicy.setCurrentUserSetup(mUserSetup);
         mSettingsObserver.onChange(false); // set up
 
         mHeadsUpObserver.onChange(true); // set up
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index 7c10c66..0872e06 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -18,6 +18,7 @@
 
 import android.app.ActivityManagerNative;
 import android.app.AlarmManager;
+import android.app.AlarmManager.AlarmClockInfo;
 import android.app.IUserSwitchObserver;
 import android.app.StatusBarManager;
 import android.bluetooth.BluetoothAdapter;
@@ -75,6 +76,7 @@
 
     private boolean mZenVisible;
     private boolean mVolumeVisible;
+    private boolean mCurrentUserSetup;
 
     private int mZen;
 
@@ -175,11 +177,12 @@
     }
 
     private void updateAlarm() {
-        final boolean hasAlarm = mAlarmManager.getNextAlarmClock(UserHandle.USER_CURRENT) != null;
+        final AlarmClockInfo alarm = mAlarmManager.getNextAlarmClock(UserHandle.USER_CURRENT);
+        final boolean hasAlarm = alarm != null && alarm.getTriggerTime() > 0;
         final boolean zenNone = mZen == Global.ZEN_MODE_NO_INTERRUPTIONS;
-        mService.setIconVisibility(SLOT_ALARM_CLOCK, hasAlarm);
         mService.setIcon(SLOT_ALARM_CLOCK, zenNone ? R.drawable.stat_sys_alarm_dim
                 : R.drawable.stat_sys_alarm, 0, null);
+        mService.setIconVisibility(SLOT_ALARM_CLOCK, mCurrentUserSetup && hasAlarm);
     }
 
     private final void updateSimState(Intent intent) {
@@ -391,4 +394,10 @@
         mKeyguardVisible = visible;
         updateManagedProfile();
     }
+
+    public void setCurrentUserSetup(boolean userSetup) {
+        if (mCurrentUserSetup == userSetup) return;
+        mCurrentUserSetup = userSetup;
+        updateAlarm();
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java
index 7f52191..e618cb8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java
@@ -124,17 +124,16 @@
 
     @Override
     public void setMobileDataIndicators(final IconState statusIcon, final IconState qsIcon,
-            final int darkStatusIcon, final int statusType, final int qsType,
-            final boolean activityIn, final boolean activityOut,
-            final String typeContentDescription, final String description, final boolean isWide,
-            final int subId) {
+            final int statusType, final int qsType,final boolean activityIn,
+            final boolean activityOut, final String typeContentDescription,
+            final String description, final boolean isWide, final int subId) {
         post(new Runnable() {
             @Override
             public void run() {
                 for (SignalCallback signalCluster : mSignalCallbacks) {
-                    signalCluster.setMobileDataIndicators(statusIcon, qsIcon, darkStatusIcon,
-                            statusType, qsType, activityIn, activityOut, typeContentDescription,
-                            description, isWide, subId);
+                    signalCluster.setMobileDataIndicators(statusIcon, qsIcon, statusType, qsType,
+                            activityIn, activityOut, typeContentDescription, description, isWide,
+                            subId);
                 }
             }
         });
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index 0d59953..cfc95bf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -117,7 +117,7 @@
 
     public void setCarrierNetworkChangeMode(boolean carrierNetworkChangeMode) {
         mCurrentState.carrierNetworkChangeMode = carrierNetworkChangeMode;
-        notifyListenersIfNecessary();
+        updateTelephony();
     }
 
     /**
@@ -220,13 +220,9 @@
                         && mCurrentState.activityOut;
         showDataIcon &= mCurrentState.isDefault;
         int typeIcon = showDataIcon ? icons.mDataType : 0;
-        mCallbackHandler.setMobileDataIndicators(statusIcon, qsIcon, getCurrentDarkIconId(),
-                typeIcon, qsTypeIcon, activityIn, activityOut, dataContentDescription, description,
-                icons.mIsWide, mSubscriptionInfo.getSubscriptionId());
-    }
-
-    private int getCurrentDarkIconId() {
-        return getCurrentIconId(false /* light */);
+        mCallbackHandler.setMobileDataIndicators(statusIcon, qsIcon, typeIcon, qsTypeIcon,
+                activityIn, activityOut, dataContentDescription, description, icons.mIsWide,
+                mSubscriptionInfo.getSubscriptionId());
     }
 
     @Override
@@ -478,17 +474,8 @@
                 int sbNullState, int qsNullState, int sbDiscState, int qsDiscState,
                 int discContentDesc, int dataContentDesc, int dataType, boolean isWide,
                 int qsDataType) {
-            this(name, sbIcons, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState,
-                    sbDiscState, sbDiscState, qsDiscState, discContentDesc, dataContentDesc,
-                    dataType, isWide, qsDataType);
-        }
-
-        public MobileIconGroup(String name, int[][] sbIcons, int[][] sbDarkIcons, int[][] qsIcons,
-                int[] contentDesc, int sbNullState, int qsNullState, int sbDiscState,
-                int sbDarkDiscState, int qsDiscState, int discContentDesc, int dataContentDesc,
-                int dataType, boolean isWide, int qsDataType) {
-            super(name, sbIcons, sbDarkIcons, qsIcons, contentDesc, sbNullState, qsNullState,
-                    sbDiscState, sbDarkDiscState, qsDiscState, discContentDesc);
+            super(name, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, sbDiscState,
+                    qsDiscState, discContentDesc);
             mDataContentDescription = dataContentDesc;
             mDataType = dataType;
             mIsWide = isWide;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
index 070ca63..38656ee 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -38,9 +38,9 @@
         void setWifiIndicators(boolean enabled, IconState statusIcon, IconState qsIcon,
                 boolean activityIn, boolean activityOut, String description);
 
-        void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int darkStatusIcon,
-                int statusType, int qsType, boolean activityIn, boolean activityOut,
-                String typeContentDescription, String description, boolean isWide, int subId);
+        void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
+                int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
+                String description, boolean isWide, int subId);
         void setSubs(List<SubscriptionInfo> subs);
         void setNoSims(boolean show);
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalCallbackAdapter.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalCallbackAdapter.java
index 83a7d3d..dce889f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalCallbackAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalCallbackAdapter.java
@@ -35,10 +35,9 @@
     }
 
     @Override
-    public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon,
-            int darkStatusIcon, int statusType, int qsType, boolean activityIn,
-            boolean activityOut, String typeContentDescription, String description,
-            boolean isWide, int subId) {
+    public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
+            int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
+            String description, boolean isWide, int subId) {
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
index e6ca646..5e9447e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
@@ -133,22 +133,10 @@
      * Gets the signal icon for SB based on current state of connected, enabled, and level.
      */
     public int getCurrentIconId() {
-        return getCurrentIconId(true /* light */);
-    }
-
-    protected int getCurrentIconId(boolean light) {
         if (mCurrentState.connected) {
-            if (light) {
-                return getIcons().mSbIcons[mCurrentState.inetCondition][mCurrentState.level];
-            } else {
-                return getIcons().mSbDarkIcons[mCurrentState.inetCondition][mCurrentState.level];
-            }
+            return getIcons().mSbIcons[mCurrentState.inetCondition][mCurrentState.level];
         } else if (mCurrentState.enabled) {
-            if (light) {
-                return getIcons().mSbDiscState;
-            } else {
-                return getIcons().mSbDarkDiscState;
-            }
+            return getIcons().mSbDiscState;
         } else {
             return getIcons().mSbNullState;
         }
@@ -229,13 +217,11 @@
      */
     static class IconGroup {
         final int[][] mSbIcons;
-        final int[][] mSbDarkIcons;
         final int[][] mQsIcons;
         final int[] mContentDesc;
         final int mSbNullState;
         final int mQsNullState;
         final int mSbDiscState;
-        final int mSbDarkDiscState;
         final int mQsDiscState;
         final int mDiscContentDesc;
         // For logging.
@@ -244,22 +230,13 @@
         public IconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc,
                 int sbNullState, int qsNullState, int sbDiscState, int qsDiscState,
                 int discContentDesc) {
-            this(name, sbIcons, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState,
-                    sbDiscState, sbDiscState, qsDiscState, discContentDesc);
-        }
-
-        public IconGroup(String name, int[][] sbIcons, int[][] sbDarkIcons, int[][] qsIcons,
-                int[] contentDesc, int sbNullState, int qsNullState, int sbDiscState,
-                int sbDarkDiscState, int qsDiscState, int discContentDesc) {
             mName = name;
             mSbIcons = sbIcons;
-            mSbDarkIcons = sbDarkIcons;
             mQsIcons = qsIcons;
             mContentDesc = contentDesc;
             mSbNullState = sbNullState;
             mQsNullState = qsNullState;
             mSbDiscState = sbDiscState;
-            mSbDarkDiscState = sbDarkDiscState;
             mQsDiscState = qsDiscState;
             mDiscContentDesc = discContentDesc;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
index fa4d464..8a27653 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
@@ -73,24 +73,15 @@
             { R.drawable.stat_sys_signal_carrier_network_change_animation,
               R.drawable.stat_sys_signal_carrier_network_change_animation,
               R.drawable.stat_sys_signal_carrier_network_change_animation,
+              R.drawable.stat_sys_signal_carrier_network_change_animation,
               R.drawable.stat_sys_signal_carrier_network_change_animation },
             { R.drawable.stat_sys_signal_carrier_network_change_animation,
               R.drawable.stat_sys_signal_carrier_network_change_animation,
               R.drawable.stat_sys_signal_carrier_network_change_animation,
+              R.drawable.stat_sys_signal_carrier_network_change_animation,
               R.drawable.stat_sys_signal_carrier_network_change_animation }
         };
 
-    static final int[][] TELEPHONY_CARRIER_NETWORK_CHANGE_DARK = {
-            { R.drawable.stat_sys_signal_dark_carrier_network_change_animation,
-              R.drawable.stat_sys_signal_dark_carrier_network_change_animation,
-              R.drawable.stat_sys_signal_dark_carrier_network_change_animation,
-              R.drawable.stat_sys_signal_dark_carrier_network_change_animation },
-            { R.drawable.stat_sys_signal_dark_carrier_network_change_animation,
-              R.drawable.stat_sys_signal_dark_carrier_network_change_animation,
-              R.drawable.stat_sys_signal_dark_carrier_network_change_animation,
-              R.drawable.stat_sys_signal_dark_carrier_network_change_animation }
-        };
-
     static final int[][] QS_TELEPHONY_CARRIER_NETWORK_CHANGE = {
         { R.drawable.ic_qs_signal_carrier_network_change_animation,
           R.drawable.ic_qs_signal_carrier_network_change_animation,
@@ -216,8 +207,6 @@
     static final int ICON_1X = R.drawable.stat_sys_data_fully_connected_1x;
     static final int ICON_CARRIER_NETWORK_CHANGE =
             R.drawable.stat_sys_signal_carrier_network_change_animation;
-    static final int ICON_CARRIER_NETWORK_CHANGE_DARK =
-            R.drawable.stat_sys_signal_dark_carrier_network_change_animation;
 
     static final int QS_ICON_LTE = R.drawable.ic_qs_signal_lte;
     static final int QS_ICON_3G = R.drawable.ic_qs_signal_3g;
@@ -229,12 +218,10 @@
     static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup(
             "CARRIER_NETWORK_CHANGE",
             TelephonyIcons.TELEPHONY_CARRIER_NETWORK_CHANGE,
-            TelephonyIcons.TELEPHONY_CARRIER_NETWORK_CHANGE_DARK,
             TelephonyIcons.QS_TELEPHONY_CARRIER_NETWORK_CHANGE,
             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
             0, 0,
             TelephonyIcons.ICON_CARRIER_NETWORK_CHANGE,
-            TelephonyIcons.ICON_CARRIER_NETWORK_CHANGE_DARK,
             TelephonyIcons.QS_ICON_CARRIER_NETWORK_CHANGE,
             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
             R.string.accessibility_carrier_network_change_mode,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
index c14d06f..5055bfe 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
@@ -94,7 +94,6 @@
     public void testSignalCallback_setMobileDataIndicators() {
         IconState status = new IconState(true, 0, "");
         IconState qs = new IconState(true, 1, "");
-        int dark = 2;
         boolean in = true;
         boolean out = true;
         String typeDescription = "Test 1";
@@ -103,13 +102,12 @@
         int qsType = R.drawable.ic_qs_signal_1x;
         boolean wide = true;
         int subId = 5;
-        mHandler.setMobileDataIndicators(status, qs, dark, type, qsType, in, out, typeDescription,
+        mHandler.setMobileDataIndicators(status, qs, type, qsType, in, out, typeDescription,
                 description, wide, subId);
         waitForCallbacks();
 
         ArgumentCaptor<IconState> statusArg = ArgumentCaptor.forClass(IconState.class);
         ArgumentCaptor<IconState> qsArg = ArgumentCaptor.forClass(IconState.class);
-        ArgumentCaptor<Integer> darkStrengthArg = ArgumentCaptor.forClass(Integer.class);
         ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class);
         ArgumentCaptor<Integer> qsTypeIconArg = ArgumentCaptor.forClass(Integer.class);
         ArgumentCaptor<Boolean> inArg = ArgumentCaptor.forClass(Boolean.class);
@@ -118,13 +116,12 @@
         ArgumentCaptor<String> descArg = ArgumentCaptor.forClass(String.class);
         ArgumentCaptor<Boolean> wideArg = ArgumentCaptor.forClass(Boolean.class);
         ArgumentCaptor<Integer> subIdArg = ArgumentCaptor.forClass(Integer.class);
-        Mockito.verify(mSignalCallback).setMobileDataIndicators(statusArg.capture(), qsArg.capture(),
-                darkStrengthArg.capture(), typeIconArg.capture(), qsTypeIconArg.capture(),
-                inArg.capture(), outArg.capture(), typeContentArg.capture(), descArg.capture(),
-                wideArg.capture(), subIdArg.capture());
+        Mockito.verify(mSignalCallback).setMobileDataIndicators(statusArg.capture(),
+                qsArg.capture(), typeIconArg.capture(), qsTypeIconArg.capture(), inArg.capture(),
+                outArg.capture(), typeContentArg.capture(), descArg.capture(), wideArg.capture(),
+                subIdArg.capture());
         assertEquals(status, statusArg.getValue());
         assertEquals(qs, qsArg.getValue());
-        assertEquals(dark, (int) darkStrengthArg.getValue());
         assertEquals(type, (int) typeIconArg.getValue());
         assertEquals(qsType, (int) qsTypeIconArg.getValue());
         assertEquals(in, (boolean) inArg.getValue());
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 2d6bb68..441bb16 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -258,7 +258,6 @@
                     ArgumentCaptor.forClass(IconState.class).capture(),
                     iconArg.capture(),
                     ArgumentCaptor.forClass(Integer.class).capture(),
-                    ArgumentCaptor.forClass(Integer.class).capture(),
                     typeIconArg.capture(), dataInArg.capture(), dataOutArg.capture(),
                     ArgumentCaptor.forClass(String.class).capture(),
                     ArgumentCaptor.forClass(String.class).capture(),
@@ -275,20 +274,14 @@
     }
 
     protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon) {
-        verifyLastMobileDataIndicators(visible, icon, icon, typeIcon);
-    }
-
-    protected void verifyLastMobileDataIndicators(boolean visible, int strengthIcon,
-            int darkStrengthIcon, int typeIcon) {
         ArgumentCaptor<IconState> iconArg = ArgumentCaptor.forClass(IconState.class);
-        ArgumentCaptor<Integer> darkStrengthIconArg = ArgumentCaptor.forClass(Integer.class);
         ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class);
 
         // TODO: Verify all fields.
         Mockito.verify(mCallbackHandler, Mockito.atLeastOnce()).setMobileDataIndicators(
                 iconArg.capture(),
                 ArgumentCaptor.forClass(IconState.class).capture(),
-                darkStrengthIconArg.capture(), typeIconArg.capture(),
+                typeIconArg.capture(),
                 ArgumentCaptor.forClass(Integer.class).capture(),
                 ArgumentCaptor.forClass(Boolean.class).capture(),
                 ArgumentCaptor.forClass(Boolean.class).capture(),
@@ -298,9 +291,6 @@
                 ArgumentCaptor.forClass(Integer.class).capture());
         IconState iconState = iconArg.getValue();
 
-        assertEquals("Signal strength icon in status bar", strengthIcon, iconState.icon);
-        assertEquals("Signal strength icon (dark mode) in status bar", darkStrengthIcon,
-                (int) darkStrengthIconArg.getValue());
         assertEquals("Data icon in status bar", typeIcon, (int) typeIconArg.getValue());
         assertEquals("Visibility in status bar", visible, iconState.visible);
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
index 874fdf9..dd6f272 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
@@ -438,7 +438,6 @@
       // Out of service and carrier network change is true, show special indicator
       verifyLastMobileDataIndicators(true /* visible */,
               TelephonyIcons.TELEPHONY_CARRIER_NETWORK_CHANGE[0][0] /* strengthIcon */,
-              TelephonyIcons.TELEPHONY_CARRIER_NETWORK_CHANGE_DARK[0][0] /* darkStrengthIcon */,
               0 /* typeIcon */);
 
       // Revert back
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java
index 70a5821..bea138e 100644
--- a/rs/java/android/renderscript/Allocation.java
+++ b/rs/java/android/renderscript/Allocation.java
@@ -1052,6 +1052,7 @@
                               mSelectedLOD, mSelectedFace.mID,
                               count, 1, data.getID(mRS), dataOff, 0,
                               data.mSelectedLOD, data.mSelectedFace.mID);
+        Trace.traceEnd(RenderScript.TRACE_TAG);
     }
 
     private void validate2DRange(int xoff, int yoff, int w, int h) {
@@ -1213,19 +1214,22 @@
      * @param data the Bitmap to be copied
      */
     public void copy2DRangeFrom(int xoff, int yoff, Bitmap data) {
-        Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFrom");
-        mRS.validate();
-        if (data.getConfig() == null) {
-            Bitmap newBitmap = Bitmap.createBitmap(data.getWidth(), data.getHeight(), Bitmap.Config.ARGB_8888);
-            Canvas c = new Canvas(newBitmap);
-            c.drawBitmap(data, 0, 0, null);
-            copy2DRangeFrom(xoff, yoff, newBitmap);
-            return;
+        try {
+            Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFrom");
+            mRS.validate();
+            if (data.getConfig() == null) {
+                Bitmap newBitmap = Bitmap.createBitmap(data.getWidth(), data.getHeight(), Bitmap.Config.ARGB_8888);
+                Canvas c = new Canvas(newBitmap);
+                c.drawBitmap(data, 0, 0, null);
+                copy2DRangeFrom(xoff, yoff, newBitmap);
+                return;
+            }
+            validateBitmapFormat(data);
+            validate2DRange(xoff, yoff, data.getWidth(), data.getHeight());
+            mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, data);
+        } finally {
+            Trace.traceEnd(RenderScript.TRACE_TAG);
         }
-        validateBitmapFormat(data);
-        validate2DRange(xoff, yoff, data.getWidth(), data.getHeight());
-        mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, data);
-        Trace.traceEnd(RenderScript.TRACE_TAG);
     }
 
     private void validate3DRange(int xoff, int yoff, int zoff, int w, int h, int d) {
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index ad671c6..742f570 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -64,6 +64,7 @@
 import java.util.Locale;
 import java.util.Random;
 import java.util.TimeZone;
+import java.util.TreeSet;
 
 import static android.app.AlarmManager.RTC_WAKEUP;
 import static android.app.AlarmManager.RTC;
@@ -1055,6 +1056,28 @@
                     pw.print(" = "); pw.println(sdf.format(new Date(nextWakeupRTC)));
             pw.print("Num time change events: "); pw.println(mNumTimeChanged);
 
+            pw.println();
+            pw.println("Next alarm clock information: ");
+            final TreeSet<Integer> users = new TreeSet<>();
+            for (int i = 0; i < mNextAlarmClockForUser.size(); i++) {
+                users.add(mNextAlarmClockForUser.keyAt(i));
+            }
+            for (int i = 0; i < mPendingSendNextAlarmClockChangedForUser.size(); i++) {
+                users.add(mPendingSendNextAlarmClockChangedForUser.keyAt(i));
+            }
+            for (int user : users) {
+                final AlarmManager.AlarmClockInfo next = mNextAlarmClockForUser.get(user);
+                final long time = next != null ? next.getTriggerTime() : 0;
+                final boolean pendingSend = mPendingSendNextAlarmClockChangedForUser.get(user);
+                pw.print("  user:"); pw.print(user);
+                pw.print(" pendingSend:"); pw.print(pendingSend);
+                pw.print(" time:"); pw.print(time);
+                if (time > 0) {
+                    pw.print(" = "); pw.print(sdf.format(new Date(time)));
+                    pw.print(" = "); TimeUtils.formatDuration(time, nowRTC, pw);
+                }
+                pw.println();
+            }
             if (mAlarmBatches.size() > 0) {
                 pw.println();
                 pw.print("Pending alarm batches: ");
@@ -1706,8 +1729,8 @@
      */
     public static class IncreasingTimeOrder implements Comparator<Alarm> {
         public int compare(Alarm a1, Alarm a2) {
-            long when1 = a1.when;
-            long when2 = a2.when;
+            long when1 = a1.whenElapsed;
+            long when2 = a2.whenElapsed;
             if (when1 - when2 > 0) {
                 return 1;
             }
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index 35bdceb..8834497 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -46,6 +46,7 @@
 import android.service.voice.IVoiceInteractionSession;
 import android.service.voice.VoiceInteractionService;
 import android.service.voice.VoiceInteractionServiceInfo;
+import android.service.voice.VoiceInteractionSession;
 import android.speech.RecognitionService;
 import android.text.TextUtils;
 import android.util.Slog;
@@ -732,9 +733,9 @@
                 final long caller = Binder.clearCallingIdentity();
                 try {
                     mImpl.showSessionLocked(new Bundle() /* sessionArgs */,
-                            VoiceInteractionService.START_SOURCE_ASSIST_GESTURE
-                                    | VoiceInteractionService.START_WITH_ASSIST
-                                    | VoiceInteractionService.START_WITH_SCREENSHOT,
+                            VoiceInteractionSession.SHOW_SOURCE_ASSIST_GESTURE
+                                    | VoiceInteractionSession.SHOW_WITH_ASSIST
+                                    | VoiceInteractionSession.SHOW_WITH_SCREENSHOT,
                             showCallback);
                 } finally {
                     Binder.restoreCallingIdentity(caller);
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
index 1117373..b4629f2 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
@@ -40,6 +40,7 @@
 import android.service.voice.IVoiceInteractionSession;
 import android.service.voice.IVoiceInteractionSessionService;
 import android.service.voice.VoiceInteractionService;
+import android.service.voice.VoiceInteractionSession;
 import android.util.Slog;
 import android.view.IWindowManager;
 import android.view.WindowManager;
@@ -180,7 +181,7 @@
     public boolean showLocked(Bundle args, int flags,
             IVoiceInteractionSessionShowCallback showCallback) {
         // For now we never allow screenshots.
-        flags &= ~VoiceInteractionService.START_WITH_SCREENSHOT;
+        flags &= ~VoiceInteractionSession.SHOW_WITH_SCREENSHOT;
         if (mBound) {
             if (!mFullyBound) {
                 mFullyBound = mContext.bindServiceAsUser(mBindIntent, mFullConnection,
@@ -192,7 +193,7 @@
             mShowArgs = args;
             mShowFlags = flags;
             mHaveAssistData = false;
-            if ((flags&VoiceInteractionService.START_WITH_ASSIST) != 0) {
+            if ((flags& VoiceInteractionSession.SHOW_WITH_ASSIST) != 0) {
                 if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ASSIST_STRUCTURE, mCallingUid,
                         mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED
                         && isStructureEnabled()) {
@@ -209,7 +210,7 @@
                 mAssistData = null;
             }
             mHaveScreenshot = false;
-            if ((flags&VoiceInteractionService.START_WITH_SCREENSHOT) != 0) {
+            if ((flags& VoiceInteractionSession.SHOW_WITH_SCREENSHOT) != 0) {
                 if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ASSIST_SCREENSHOT, mCallingUid,
                         mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED) {
                     try {
diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java
index 9db0b92..b18feb5 100644
--- a/telecomm/java/android/telecom/Conference.java
+++ b/telecomm/java/android/telecom/Conference.java
@@ -295,6 +295,13 @@
     }
 
     /**
+     * Sets state to be dialing.
+     */
+    public final void setDialing() {
+        setState(Connection.STATE_DIALING);
+    }
+
+    /**
      * Sets state to be active.
      */
     public final void setActive() {
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index f9e48b6..e2bbc62 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -22,6 +22,7 @@
 
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
+import android.hardware.camera2.CameraManager;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
@@ -339,65 +340,92 @@
         public void onExtrasChanged(Connection c, Bundle extras) {}
     }
 
+    /**
+     * Provides a means of controlling the video session associated with a {@link Connection}.
+     * <p>
+     * Implementations create a custom subclass of {@link VideoProvider} and the
+     * {@link ConnectionService} creates an instance sets it on the {@link Connection} using
+     * {@link Connection#setVideoProvider(VideoProvider)}.  Any connection which supports video
+     * should set the {@link VideoProvider}.
+     * <p>
+     * The {@link VideoProvider} serves two primary purposes: it provides a means for Telecom and
+     * {@link InCallService} implementations to issue requests related to the video session;
+     * it provides a means for the {@link ConnectionService} to report events and information
+     * related to the video session to Telecom and the {@link InCallService} implementations.
+     * <p>
+     * {@link InCallService} implementations interact with the {@link VideoProvider} via
+     * {@link android.telecom.InCallService.VideoCall}.
+     */
     public static abstract class VideoProvider {
 
         /**
          * Video is not being received (no protocol pause was issued).
+         * @see #handleCallSessionEvent(int)
          */
         public static final int SESSION_EVENT_RX_PAUSE = 1;
 
         /**
-         * Video reception has resumed after a SESSION_EVENT_RX_PAUSE.
+         * Video reception has resumed after a {@link #SESSION_EVENT_RX_PAUSE}.
+         * @see #handleCallSessionEvent(int)
          */
         public static final int SESSION_EVENT_RX_RESUME = 2;
 
         /**
          * Video transmission has begun. This occurs after a negotiated start of video transmission
          * when the underlying protocol has actually begun transmitting video to the remote party.
+         * @see #handleCallSessionEvent(int)
          */
         public static final int SESSION_EVENT_TX_START = 3;
 
         /**
          * Video transmission has stopped. This occurs after a negotiated stop of video transmission
          * when the underlying protocol has actually stopped transmitting video to the remote party.
+         * @see #handleCallSessionEvent(int)
          */
         public static final int SESSION_EVENT_TX_STOP = 4;
 
         /**
-         * A camera failure has occurred for the selected camera.  The In-Call UI can use this as a
-         * cue to inform the user the camera is not available.
+         * A camera failure has occurred for the selected camera.  The {@link InCallService} can use
+         * this as a cue to inform the user the camera is not available.
+         * @see #handleCallSessionEvent(int)
          */
         public static final int SESSION_EVENT_CAMERA_FAILURE = 5;
 
         /**
-         * Issued after {@code SESSION_EVENT_CAMERA_FAILURE} when the camera is once again ready for
-         * operation.  The In-Call UI can use this as a cue to inform the user that the camera has
-         * become available again.
+         * Issued after {@link #SESSION_EVENT_CAMERA_FAILURE} when the camera is once again ready
+         * for operation.  The {@link InCallService} can use this as a cue to inform the user that
+         * the camera has become available again.
+         * @see #handleCallSessionEvent(int)
          */
         public static final int SESSION_EVENT_CAMERA_READY = 6;
 
         /**
          * Session modify request was successful.
+         * @see #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)
          */
         public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1;
 
         /**
          * Session modify request failed.
+         * @see #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)
          */
         public static final int SESSION_MODIFY_REQUEST_FAIL = 2;
 
         /**
          * Session modify request ignored due to invalid parameters.
+         * @see #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)
          */
         public static final int SESSION_MODIFY_REQUEST_INVALID = 3;
 
         /**
          * Session modify request timed out.
+         * @see #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)
          */
         public static final int SESSION_MODIFY_REQUEST_TIMED_OUT = 4;
 
         /**
-         * Session modify request rejected by remote UE.
+         * Session modify request rejected by remote user.
+         * @see #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)
          */
         public static final int SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE = 5;
 
@@ -569,9 +597,17 @@
         }
 
         /**
-         * Sets the camera to be used for video recording in a video connection.
+         * Sets the camera to be used for the outgoing video.
+         * <p>
+         * The {@link VideoProvider} should respond by communicating the capabilities of the chosen
+         * camera via
+         * {@link VideoProvider#changeCameraCapabilities(VideoProfile.CameraCapabilities)}.
+         * <p>
+         * Sent from the {@link InCallService} via
+         * {@link InCallService.VideoCall#setCamera(String)}.
          *
-         * @param cameraId The id of the camera.
+         * @param cameraId The id of the camera (use ids as reported by
+         * {@link CameraManager#getCameraIdList()}).
          */
         public abstract void onSetCamera(String cameraId);
 
@@ -579,21 +615,30 @@
          * Sets the surface to be used for displaying a preview of what the user's camera is
          * currently capturing.  When video transmission is enabled, this is the video signal which
          * is sent to the remote device.
+         * <p>
+         * Sent from the {@link InCallService} via
+         * {@link InCallService.VideoCall#setPreviewSurface(Surface)}.
          *
-         * @param surface The surface.
+         * @param surface The {@link Surface}.
          */
         public abstract void onSetPreviewSurface(Surface surface);
 
         /**
          * Sets the surface to be used for displaying the video received from the remote device.
+         * <p>
+         * Sent from the {@link InCallService} via
+         * {@link InCallService.VideoCall#setDisplaySurface(Surface)}.
          *
-         * @param surface The surface.
+         * @param surface The {@link Surface}.
          */
         public abstract void onSetDisplaySurface(Surface surface);
 
         /**
          * Sets the device orientation, in degrees.  Assumes that a standard portrait orientation of
          * the device is 0 degrees.
+         * <p>
+         * Sent from the {@link InCallService} via
+         * {@link InCallService.VideoCall#setDeviceOrientation(int)}.
          *
          * @param rotation The device orientation, in degrees.
          */
@@ -601,57 +646,100 @@
 
         /**
          * Sets camera zoom ratio.
+         * <p>
+         * Sent from the {@link InCallService} via {@link InCallService.VideoCall#setZoom(float)}.
          *
          * @param value The camera zoom ratio.
          */
         public abstract void onSetZoom(float value);
 
         /**
-         * Issues a request to modify the properties of the current session.  The request is
-         * sent to the remote device where it it handled by the In-Call UI.
-         * Some examples of session modification requests: upgrade connection from audio to video,
-         * downgrade connection from video to audio, pause video.
+         * Issues a request to modify the properties of the current video session.
+         * <p>
+         * Example scenarios include: requesting an audio-only call to be upgraded to a
+         * bi-directional video call, turning on or off the user's camera, sending a pause signal
+         * when the {@link InCallService} is no longer the foreground application.
+         * <p>
+         * If the {@link VideoProvider} determines a request to be invalid, it should call
+         * {@link #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)} to report the
+         * invalid request back to the {@link InCallService}.
+         * <p>
+         * Where a request requires confirmation from the user of the peer device, the
+         * {@link VideoProvider} must communicate the request to the peer device and handle the
+         * user's response.  {@link #receiveSessionModifyResponse(int, VideoProfile, VideoProfile)}
+         * is used to inform the {@link InCallService} of the result of the request.
+         * <p>
+         * Sent from the {@link InCallService} via
+         * {@link InCallService.VideoCall#sendSessionModifyRequest(VideoProfile)}.
          *
-         * @param fromProfile The video properties prior to the request.
-         * @param toProfile The video properties with the requested changes made.
+         * @param fromProfile The video profile prior to the request.
+         * @param toProfile The video profile with the requested changes made.
          */
         public abstract void onSendSessionModifyRequest(VideoProfile fromProfile,
                 VideoProfile toProfile);
 
-        /**te
-         * Provides a response to a request to change the current connection session video
-         * properties.
-         * This is in response to a request the InCall UI has received via the InCall UI.
+        /**
+         * Provides a response to a request to change the current video session properties.
+         * <p>
+         * For example, if the peer requests and upgrade from an audio-only call to a bi-directional
+         * video call, could decline the request and keep the call as audio-only.
+         * In such a scenario, the {@code responseProfile} would have a video state of
+         * {@link VideoProfile#STATE_AUDIO_ONLY}.  If the user had decided to accept the request,
+         * the video state would be {@link VideoProfile#STATE_BIDIRECTIONAL}.
+         * <p>
+         * Sent from the {@link InCallService} via
+         * {@link InCallService.VideoCall#sendSessionModifyResponse(VideoProfile)} in response to
+         * a {@link InCallService.VideoCall.Callback#onSessionModifyRequestReceived(VideoProfile)}
+         * callback.
          *
-         * @param responseProfile The response connection video properties.
+         * @param responseProfile The response video profile.
          */
         public abstract void onSendSessionModifyResponse(VideoProfile responseProfile);
 
         /**
-         * Issues a request to the video provider to retrieve the camera capabilities.
-         * Camera capabilities are reported back to the caller via the In-Call UI.
+         * Issues a request to the {@link VideoProvider} to retrieve the camera capabilities.
+         * <p>
+         * The {@link VideoProvider} should respond by communicating the capabilities of the chosen
+         * camera via
+         * {@link VideoProvider#changeCameraCapabilities(VideoProfile.CameraCapabilities)}.
+         * <p>
+         * Sent from the {@link InCallService} via
+         * {@link InCallService.VideoCall#requestCameraCapabilities()}.
          */
         public abstract void onRequestCameraCapabilities();
 
         /**
-         * Issues a request to the video telephony framework to retrieve the cumulative data usage
-         * for the current connection.  Data usage is reported back to the caller via the
-         * InCall UI.
+         * Issues a request to the {@link VideoProvider} to retrieve the current data usage for the
+         * video component of the current {@link Connection}.
+         * <p>
+         * The {@link VideoProvider} should respond by communicating current data usage, in bytes,
+         * via {@link VideoProvider#setCallDataUsage(long)}.
+         * <p>
+         * Sent from the {@link InCallService} via
+         * {@link InCallService.VideoCall#requestCallDataUsage()}.
          */
         public abstract void onRequestConnectionDataUsage();
 
         /**
-         * Provides the video telephony framework with the URI of an image to be displayed to remote
-         * devices when the video signal is paused.
+         * Provides the {@link VideoProvider} with the {@link Uri} of an image to be displayed to
+         * the peer device when the video signal is paused.
+         * <p>
+         * Sent from the {@link InCallService} via
+         * {@link InCallService.VideoCall#setPauseImage(Uri)}.
          *
          * @param uri URI of image to display.
          */
         public abstract void onSetPauseImage(Uri uri);
 
         /**
-         * Invokes callback method defined in listening {@link InCallService} implementations.
+         * Used to inform listening {@link InCallService} implementations when the
+         * {@link VideoProvider} receives a session modification request.
+         * <p>
+         * Received by the {@link InCallService} via
+         * {@link InCallService.VideoCall.Callback#onSessionModifyRequestReceived(VideoProfile)},
          *
-         * @param videoProfile The requested video connection profile.
+         * @param videoProfile The requested video profile.
+         * @see #onSendSessionModifyRequest(VideoProfile, VideoProfile)
          */
         public void receiveSessionModifyRequest(VideoProfile videoProfile) {
             if (mVideoCallbacks != null) {
@@ -665,14 +753,22 @@
         }
 
         /**
-         * Invokes callback method defined in listening {@link InCallService} implementations.
+         * Used to inform listening {@link InCallService} implementations when the
+         * {@link VideoProvider} receives a response to a session modification request.
+         * <p>
+         * Received by the {@link InCallService} via
+         * {@link InCallService.VideoCall.Callback#onSessionModifyResponseReceived(int,
+         * VideoProfile, VideoProfile)}.
          *
          * @param status Status of the session modify request.  Valid values are
          *               {@link VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS},
          *               {@link VideoProvider#SESSION_MODIFY_REQUEST_FAIL},
-         *               {@link VideoProvider#SESSION_MODIFY_REQUEST_INVALID}
-         * @param requestedProfile The original request which was sent to the remote device.
-         * @param responseProfile The actual profile changes made by the remote device.
+         *               {@link VideoProvider#SESSION_MODIFY_REQUEST_INVALID},
+         *               {@link VideoProvider#SESSION_MODIFY_REQUEST_TIMED_OUT},
+         *               {@link VideoProvider#SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE}
+         * @param requestedProfile The original request which was sent to the peer device.
+         * @param responseProfile The actual profile changes agreed to by the peer device.
+         * @see #onSendSessionModifyRequest(VideoProfile, VideoProfile)
          */
         public void receiveSessionModifyResponse(int status,
                 VideoProfile requestedProfile, VideoProfile responseProfile) {
@@ -688,14 +784,18 @@
         }
 
         /**
-         * Invokes callback method defined in listening {@link InCallService} implementations.
+         * Used to inform listening {@link InCallService} implementations when the
+         * {@link VideoProvider} reports a call session event.
+         * <p>
+         * Received by the {@link InCallService} via
+         * {@link InCallService.VideoCall.Callback#onCallSessionEvent(int)}.
          *
-         * Valid values are: {@link VideoProvider#SESSION_EVENT_RX_PAUSE},
-         * {@link VideoProvider#SESSION_EVENT_RX_RESUME},
-         * {@link VideoProvider#SESSION_EVENT_TX_START},
-         * {@link VideoProvider#SESSION_EVENT_TX_STOP}
-         *
-         * @param event The event.
+         * @param event The event.  Valid values are: {@link VideoProvider#SESSION_EVENT_RX_PAUSE},
+         *      {@link VideoProvider#SESSION_EVENT_RX_RESUME},
+         *      {@link VideoProvider#SESSION_EVENT_TX_START},
+         *      {@link VideoProvider#SESSION_EVENT_TX_STOP},
+         *      {@link VideoProvider#SESSION_EVENT_CAMERA_FAILURE},
+         *      {@link VideoProvider#SESSION_EVENT_CAMERA_READY}.
          */
         public void handleCallSessionEvent(int event) {
             if (mVideoCallbacks != null) {
@@ -709,7 +809,14 @@
         }
 
         /**
-         * Invokes callback method defined in listening {@link InCallService} implementations.
+         * Used to inform listening {@link InCallService} implementations when the dimensions of the
+         * peer's video have changed.
+         * <p>
+         * This could occur if, for example, the peer rotates their device, changing the aspect
+         * ratio of the video, or if the user switches between the back and front cameras.
+         * <p>
+         * Received by the {@link InCallService} via
+         * {@link InCallService.VideoCall.Callback#onPeerDimensionsChanged(int, int)}.
          *
          * @param width  The updated peer video width.
          * @param height The updated peer video height.
@@ -726,9 +833,18 @@
         }
 
         /**
-         * Invokes callback method defined in listening {@link InCallService} implementations.
+         * Used to inform listening {@link InCallService} implementations when the data usage of the
+         * video associated with the current {@link Connection} has changed.
+         * <p>
+         * This could be in response to a preview request via
+         * {@link #onRequestConnectionDataUsage()}, or as a periodic update by the
+         * {@link VideoProvider}.
+         * <p>
+         * Received by the {@link InCallService} via
+         * {@link InCallService.VideoCall.Callback#onCallDataUsageChanged(long)}.
          *
-         * @param dataUsage The updated data usage.
+         * @param dataUsage The updated data usage (in bytes).  Reported as the cumulative bytes
+         *                  used since the start of the call.
          */
         public void setCallDataUsage(long dataUsage) {
             if (mVideoCallbacks != null) {
@@ -742,9 +858,9 @@
         }
 
         /**
-         * Invokes callback method defined in listening {@link InCallService} implementations.
+         * @see #setCallDataUsage(long)
          *
-         * @param dataUsage The updated data usage.
+         * @param dataUsage The updated data usage (in byes).
          * @deprecated - Use {@link #setCallDataUsage(long)} instead.
          * @hide
          */
@@ -753,9 +869,18 @@
         }
 
         /**
-         * Invokes callback method defined in listening {@link InCallService} implementations.
+         * Used to inform listening {@link InCallService} implementations when the capabilities of
+         * the current camera have changed.
+         * <p>
+         * The {@link VideoProvider} should call this in response to
+         * {@link VideoProvider#onRequestCameraCapabilities()}, or when the current camera is
+         * changed via {@link VideoProvider#onSetCamera(String)}.
+         * <p>
+         * Received by the {@link InCallService} via
+         * {@link InCallService.VideoCall.Callback#onCameraCapabilitiesChanged(
+         * VideoProfile.CameraCapabilities)}.
          *
-         * @param cameraCapabilities The changed camera capabilities.
+         * @param cameraCapabilities The new camera capabilities.
          */
         public void changeCameraCapabilities(VideoProfile.CameraCapabilities cameraCapabilities) {
             if (mVideoCallbacks != null) {
@@ -769,15 +894,17 @@
         }
 
         /**
-         * Invokes callback method defined in listening {@link InCallService} implementations.
+         * Used to inform listening {@link InCallService} implementations when the video quality
+         * of the call has changed.
+         * <p>
+         * Received by the {@link InCallService} via
+         * {@link InCallService.VideoCall.Callback#onVideoQualityChanged(int)}.
          *
-         * Allowed values:
-         * {@link VideoProfile#QUALITY_HIGH},
-         * {@link VideoProfile#QUALITY_MEDIUM},
-         * {@link VideoProfile#QUALITY_LOW},
-         * {@link VideoProfile#QUALITY_DEFAULT}.
-         *
-         * @param videoQuality The updated video quality.
+         * @param videoQuality The updated video quality.  Valid values:
+         *      {@link VideoProfile#QUALITY_HIGH},
+         *      {@link VideoProfile#QUALITY_MEDIUM},
+         *      {@link VideoProfile#QUALITY_LOW},
+         *      {@link VideoProfile#QUALITY_DEFAULT}.
          */
         public void changeVideoQuality(int videoQuality) {
             if (mVideoCallbacks != null) {
diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java
index e37cff7..f7f4425 100644
--- a/telecomm/java/android/telecom/InCallService.java
+++ b/telecomm/java/android/telecom/InCallService.java
@@ -20,6 +20,7 @@
 import android.annotation.SystemApi;
 import android.app.Service;
 import android.content.Intent;
+import android.hardware.camera2.CameraManager;
 import android.net.Uri;
 import android.os.Handler;
 import android.os.IBinder;
@@ -387,7 +388,8 @@
     }
 
     /**
-     * Class to invoke functionality related to video calls.
+     * Used to issue commands to the {@link Connection.VideoProvider} associated with a
+     * {@link Call}.
      */
     public static abstract class VideoCall {
 
@@ -410,14 +412,17 @@
         public abstract void registerCallback(VideoCall.Callback callback, Handler handler);
 
         /**
-         * Clears the video call listener set via {@link #registerCallback}.
+         * Clears the video call callback set via {@link #registerCallback}.
          */
         public abstract void unregisterCallback(VideoCall.Callback callback);
 
         /**
-         * Sets the camera to be used for video recording in a video call.
+         * Sets the camera to be used for the outgoing video.
+         * <p>
+         * Handled by {@link Connection.VideoProvider#onSetCamera(String)}.
          *
-         * @param cameraId The id of the camera.
+         * @param cameraId The id of the camera (use ids as reported by
+         * {@link CameraManager#getCameraIdList()}).
          */
         public abstract void setCamera(String cameraId);
 
@@ -425,21 +430,27 @@
          * Sets the surface to be used for displaying a preview of what the user's camera is
          * currently capturing.  When video transmission is enabled, this is the video signal which
          * is sent to the remote device.
+         * <p>
+         * Handled by {@link Connection.VideoProvider#onSetPreviewSurface(Surface)}.
          *
-         * @param surface The surface.
+         * @param surface The {@link Surface}.
          */
         public abstract void setPreviewSurface(Surface surface);
 
         /**
          * Sets the surface to be used for displaying the video received from the remote device.
+         * <p>
+         * Handled by {@link Connection.VideoProvider#onSetDisplaySurface(Surface)}.
          *
-         * @param surface The surface.
+         * @param surface The {@link Surface}.
          */
         public abstract void setDisplaySurface(Surface surface);
 
         /**
          * Sets the device orientation, in degrees.  Assumes that a standard portrait orientation of
          * the device is 0 degrees.
+         * <p>
+         * Handled by {@link Connection.VideoProvider#onSetDeviceOrientation(int)}.
          *
          * @param rotation The device orientation, in degrees.
          */
@@ -447,109 +458,145 @@
 
         /**
          * Sets camera zoom ratio.
+         * <p>
+         * Handled by {@link Connection.VideoProvider#onSetZoom(float)}.
          *
          * @param value The camera zoom ratio.
          */
         public abstract void setZoom(float value);
 
         /**
-         * Issues a request to modify the properties of the current session.  The request is sent to
-         * the remote device where it it handled by
-         * {@link VideoCall.Callback#onSessionModifyRequestReceived}.
-         * Some examples of session modification requests: upgrade call from audio to video,
-         * downgrade call from video to audio, pause video.
+         * Issues a request to modify the properties of the current video session.
+         * <p>
+         * Example scenarios include: requesting an audio-only call to be upgraded to a
+         * bi-directional video call, turning on or off the user's camera, sending a pause signal
+         * when the {@link InCallService} is no longer the foreground application.
+         * <p>
+         * Handled by
+         * {@link Connection.VideoProvider#onSendSessionModifyRequest(VideoProfile, VideoProfile)}.
          *
          * @param requestProfile The requested call video properties.
          */
         public abstract void sendSessionModifyRequest(VideoProfile requestProfile);
 
         /**
-         * Provides a response to a request to change the current call session video
-         * properties.
-         * This is in response to a request the InCall UI has received via
-         * {@link VideoCall.Callback#onSessionModifyRequestReceived}.
-         * The response is handled on the remove device by
-         * {@link VideoCall.Callback#onSessionModifyResponseReceived}.
+         * Provides a response to a request to change the current call video session
+         * properties.  This should be called in response to a request the {@link InCallService} has
+         * received via {@link VideoCall.Callback#onSessionModifyRequestReceived}.
+         * <p>
+         * Handled by
+         * {@link Connection.VideoProvider#onSendSessionModifyResponse(VideoProfile)}.
          *
          * @param responseProfile The response call video properties.
          */
         public abstract void sendSessionModifyResponse(VideoProfile responseProfile);
 
         /**
-         * Issues a request to the video provider to retrieve the camera capabilities.
-         * Camera capabilities are reported back to the caller via
-         * {@link VideoCall.Callback#onCameraCapabilitiesChanged(CameraCapabilities)}.
+         * Issues a request to the {@link Connection.VideoProvider} to retrieve the capabilities
+         * of the current camera.  The current camera is selected using
+         * {@link VideoCall#setCamera(String)}.
+         * <p>
+         * Camera capabilities are reported to the caller via
+         * {@link VideoCall.Callback#onCameraCapabilitiesChanged(VideoProfile.CameraCapabilities)}.
+         * <p>
+         * Handled by {@link Connection.VideoProvider#onRequestCameraCapabilities()}.
          */
         public abstract void requestCameraCapabilities();
 
         /**
-         * Issues a request to the video telephony framework to retrieve the cumulative data usage for
-         * the current call.  Data usage is reported back to the caller via
-         * {@link VideoCall.Callback#onCallDataUsageChanged}.
+         * Issues a request to the {@link Connection.VideoProvider} to retrieve the cumulative data
+         * usage for the video component of the current call (in bytes).  Data usage is reported
+         * to the caller via {@link VideoCall.Callback#onCallDataUsageChanged}.
+         * <p>
+         * Handled by {@link Connection.VideoProvider#onRequestConnectionDataUsage()}.
          */
         public abstract void requestCallDataUsage();
 
         /**
-         * Provides the video telephony framework with the URI of an image to be displayed to remote
-         * devices when the video signal is paused.
+         * Provides the {@link Connection.VideoProvider} with the {@link Uri} of an image to be
+         * displayed to the peer device when the video signal is paused.
+         * <p>
+         * Handled by {@link Connection.VideoProvider#onSetPauseImage(Uri)}.
          *
          * @param uri URI of image to display.
          */
         public abstract void setPauseImage(Uri uri);
 
         /**
-         * Callback class which invokes callbacks after video call actions occur.
+         * The {@link InCallService} extends this class to provide a means of receiving callbacks
+         * from the {@link Connection.VideoProvider}.<p>
+         * When the {@link InCallService} receives the
+         * {@link Call.Callback#onVideoCallChanged(Call, VideoCall)} callback, it should create an
+         * instance its {@link VideoCall.Callback} implementation and set it on the
+         * {@link VideoCall} using {@link VideoCall#registerCallback(Callback)}.
          */
         public static abstract class Callback {
             /**
-             * Called when a session modification request is received from the remote device.
-             * The remote request is sent via
-             * {@link Connection.VideoProvider#onSendSessionModifyRequest}. The InCall UI
-             * is responsible for potentially prompting the user whether they wish to accept the new
-             * call profile (e.g. prompt user if they wish to accept an upgrade from an audio to a
-             * video call) and should call
-             * {@link Connection.VideoProvider#onSendSessionModifyResponse} to indicate
-             * the video settings the user has agreed to.
+             * Called when the {@link Connection.VideoProvider} receives a session modification
+             * request is received from the peer device.
+             * <p>
+             * The {@link InCallService} may potentially prompt the user to confirm whether they
+             * wish to accept the request, or decide to automatically accept the request.  In either
+             * case the {@link InCallService} should call
+             * {@link VideoCall#sendSessionModifyResponse(VideoProfile)} to indicate the video
+             * profile agreed upon.
+             * <p>
+             * Callback originates from
+             * {@link Connection.VideoProvider#receiveSessionModifyRequest(VideoProfile)}.
              *
-             * @param videoProfile The requested video call profile.
+             * @param videoProfile The requested video profile.
              */
             public abstract void onSessionModifyRequestReceived(VideoProfile videoProfile);
 
             /**
-             * Called when a response to a session modification request is received from the remote
-             * device. The remote InCall UI sends the response using
-             * {@link Connection.VideoProvider#onSendSessionModifyResponse}.
+             * Called when the {@link Connection.VideoProvider} receives a response to a session
+             * modification request previously sent to the peer device.
+             * <p>
+             * The new video state should not be considered active by the {@link InCallService}
+             * until the {@link Call} video state changes (the
+             * {@link Call.Callback#onDetailsChanged(Call, Call.Details)} callback is triggered
+             * when the video state changes).
+             * <p>
+             * Callback originates from
+             * {@link Connection.VideoProvider#receiveSessionModifyResponse(int, VideoProfile,
+             *      VideoProfile)}.
              *
              * @param status Status of the session modify request.  Valid values are
-             *               {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS},
-             *               {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_FAIL},
-             *               {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_INVALID}
-             * @param requestedProfile The original request which was sent to the remote device.
-             * @param responseProfile The actual profile changes made by the remote device.
+             *      {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS},
+             *      {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_FAIL},
+             *      {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_INVALID},
+             *      {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_TIMED_OUT},
+             *      {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE}.
+             * @param requestedProfile The original request which was sent to the peer device.
+             * @param responseProfile The actual profile changes made by the peer device.
              */
             public abstract void onSessionModifyResponseReceived(int status,
                     VideoProfile requestedProfile, VideoProfile responseProfile);
 
             /**
-             * Handles events related to the current session which the client may wish to handle.
-             * These are separate from requested changes to the session due to the underlying
-             * protocol or connection.
+             * Handles events related to the current video session which the {@link InCallService}
+             * may wish to handle. These are separate from requested changes to the session due to
+             * the underlying protocol or connection.
+             * <p>
+             * Callback originates from
+             * {@link Connection.VideoProvider#handleCallSessionEvent(int)}.
              *
-             * Valid values are:
-             * {@link Connection.VideoProvider#SESSION_EVENT_RX_PAUSE},
-             * {@link Connection.VideoProvider#SESSION_EVENT_RX_RESUME},
-             * {@link Connection.VideoProvider#SESSION_EVENT_TX_START},
-             * {@link Connection.VideoProvider#SESSION_EVENT_TX_STOP},
-             * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_FAILURE},
-             * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_READY}
-             *
-             * @param event The event.
+             * @param event The event.  Valid values are:
+             *      {@link Connection.VideoProvider#SESSION_EVENT_RX_PAUSE},
+             *      {@link Connection.VideoProvider#SESSION_EVENT_RX_RESUME},
+             *      {@link Connection.VideoProvider#SESSION_EVENT_TX_START},
+             *      {@link Connection.VideoProvider#SESSION_EVENT_TX_STOP},
+             *      {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_FAILURE},
+             *      {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_READY}.
              */
             public abstract void onCallSessionEvent(int event);
 
             /**
-             * Handles a change to the video dimensions from the remote caller (peer). This could
-             * happen if, for example, the peer changes orientation of their device.
+             * Handles a change to the video dimensions from the peer device. This could happen if,
+             * for example, the peer changes orientation of their device, or switches cameras.
+             * <p>
+             * Callback originates from
+             * {@link Connection.VideoProvider#changePeerDimensions(int, int)}.
              *
              * @param width  The updated peer video width.
              * @param height The updated peer video height.
@@ -558,20 +605,41 @@
 
             /**
              * Handles a change to the video quality.
+             * <p>
+             * Callback originates from {@link Connection.VideoProvider#changeVideoQuality(int)}.
              *
-             * @param videoQuality  The updated peer video quality.
+             * @param videoQuality  The updated peer video quality.  Valid values:
+             *      {@link VideoProfile#QUALITY_HIGH},
+             *      {@link VideoProfile#QUALITY_MEDIUM},
+             *      {@link VideoProfile#QUALITY_LOW},
+             *      {@link VideoProfile#QUALITY_DEFAULT}.
              */
             public abstract void onVideoQualityChanged(int videoQuality);
 
             /**
-             * Handles an update to the total data used for the current session.
+             * Handles an update to the total data used for the current video session.
+             * <p>
+             * Used by the {@link Connection.VideoProvider} in response to
+             * {@link VideoCall#requestCallDataUsage()}.  May also be called periodically by the
+             * {@link Connection.VideoProvider}.
+             * <p>
+             * Callback originates from {@link Connection.VideoProvider#setCallDataUsage(long)}.
              *
-             * @param dataUsage The updated data usage.
+             * @param dataUsage The updated data usage (in bytes).
              */
             public abstract void onCallDataUsageChanged(long dataUsage);
 
             /**
-             * Handles a change in camera capabilities.
+             * Handles a change in the capabilities of the currently selected camera.
+             * <p>
+             * Used by the {@link Connection.VideoProvider} in response to
+             * {@link VideoCall#requestCameraCapabilities()}.  The {@link Connection.VideoProvider}
+             * may also report the camera capabilities after a call to
+             * {@link VideoCall#setCamera(String)}.
+             * <p>
+             * Callback originates from
+             * {@link Connection.VideoProvider#changeCameraCapabilities(
+             *      VideoProfile.CameraCapabilities)}.
              *
              * @param cameraCapabilities The changed camera capabilities.
              */
diff --git a/tests/Assist/src/com/android/test/assist/AssistInteractionSession.java b/tests/Assist/src/com/android/test/assist/AssistInteractionSession.java
index 0b522c0..e4ea0bc 100644
--- a/tests/Assist/src/com/android/test/assist/AssistInteractionSession.java
+++ b/tests/Assist/src/com/android/test/assist/AssistInteractionSession.java
@@ -17,16 +17,13 @@
 package com.android.test.assist;
 
 import android.animation.Animator;
-import android.animation.RevealAnimator;
 import android.animation.ValueAnimator;
 import android.app.VoiceInteractor;
 import android.content.Context;
 import android.graphics.Color;
 import android.os.Bundle;
 import android.os.Handler;
-import android.service.voice.VoiceInteractionService;
 import android.service.voice.VoiceInteractionSession;
-import android.util.Log;
 import android.view.View;
 import android.view.ViewAnimationUtils;
 import android.view.ViewTreeObserver;
@@ -105,7 +102,7 @@
     @Override
     public void onShow(Bundle args, int showFlags) {
         super.onShow(args, showFlags);
-        if ((showFlags & VoiceInteractionService.START_SOURCE_ASSIST_GESTURE) != 0) {
+        if ((showFlags & SHOW_SOURCE_ASSIST_GESTURE) != 0) {
             mBackground.getViewTreeObserver().addOnPreDrawListener(
                     new ViewTreeObserver.OnPreDrawListener() {
                         @Override
diff --git a/tests/VectorDrawableTest/res/anim/blink.xml b/tests/VectorDrawableTest/res/anim/blink.xml
index 2af0b48..714f491 100644
--- a/tests/VectorDrawableTest/res/anim/blink.xml
+++ b/tests/VectorDrawableTest/res/anim/blink.xml
@@ -22,7 +22,7 @@
     <propertyValuesHolder
         android:propertyName="fillColor"
         android:valueType="colorType"
-        android:valueFrom="#ff3838"
-        android:valueTo="?attr/color1" />
+        android:valueFrom="?attr/color1"
+        android:valueTo="@android:color/white" />
 
 </objectAnimator>
diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java
index 15196b4..578e356 100644
--- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java
+++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java
@@ -23,6 +23,7 @@
 import android.service.voice.AlwaysOnHotwordDetector.Callback;
 import android.service.voice.AlwaysOnHotwordDetector.EventPayload;
 import android.service.voice.VoiceInteractionService;
+import android.service.voice.VoiceInteractionSession;
 import android.util.Log;
 
 import java.util.Arrays;
@@ -79,7 +80,7 @@
             Bundle args = new Bundle();
             args.putParcelable("intent", new Intent(this, TestInteractionActivity.class));
             args.putBundle("assist", intent.getExtras());
-            startSession(args, START_WITH_ASSIST|START_WITH_SCREENSHOT);
+            startSession(args, VoiceInteractionSession.SHOW_WITH_ASSIST | VoiceInteractionSession.SHOW_WITH_SCREENSHOT);
         } else {
             Log.w(TAG, "Not starting -- not current voice interaction service");
         }
diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
index 70a6336..f66a9ce 100644
--- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
+++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
@@ -69,7 +69,7 @@
 
     @Override
     public void onCreate(Bundle args, int startFlags) {
-        super.onCreate(args);
+        super.onCreate(args, startFlags);
         ActivityManager am = getContext().getSystemService(ActivityManager.class);
         am.setWatchHeapLimit(40*1024*1024);
     }
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index f03ec58..a2518fa 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -16,6 +16,7 @@
 
 package com.android.layoutlib.bridge.android;
 
+import com.android.SdkConstants;
 import com.android.ide.common.rendering.api.AssetRepository;
 import com.android.ide.common.rendering.api.ILayoutPullParser;
 import com.android.ide.common.rendering.api.LayoutLog;
@@ -62,6 +63,7 @@
 import android.graphics.drawable.Drawable;
 import android.hardware.display.DisplayManager;
 import android.net.Uri;
+import android.os.Build.VERSION_CODES;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
@@ -146,6 +148,29 @@
     private ClassLoader mClassLoader;
     private IBinder mBinder;
 
+
+    /**
+     * Some applications that target both pre API 17 and post API 17, set the newer attrs to
+     * reference the older ones. For example, android:paddingStart will resolve to
+     * android:paddingLeft. This way the apps need to only define paddingLeft at any other place.
+     * This a map from value to attribute name. Warning for missing references shouldn't be logged
+     * if value and attr name pair is the same as an entry in this map.
+     */
+    private static Map<String, String> RTL_ATTRS = new HashMap<String, String>(10);
+
+    static {
+        RTL_ATTRS.put("?android:attr/paddingLeft", "paddingStart");
+        RTL_ATTRS.put("?android:attr/paddingRight", "paddingEnd");
+        RTL_ATTRS.put("?android:attr/layout_marginLeft", "layout_marginStart");
+        RTL_ATTRS.put("?android:attr/layout_marginRight", "layout_marginEnd");
+        RTL_ATTRS.put("?android:attr/layout_toLeft", "layout_toStartOf");
+        RTL_ATTRS.put("?android:attr/layout_toRight", "layout_toEndOf");
+        RTL_ATTRS.put("?android:attr/layout_alignParentLeft", "layout_alignParentStart");
+        RTL_ATTRS.put("?android:attr/layout_alignParentRight", "layout_alignParentEnd");
+        RTL_ATTRS.put("?android:attr/drawableLeft", "drawableStart");
+        RTL_ATTRS.put("?android:attr/drawableRight", "drawableEnd");
+    }
+
     /**
      * @param projectKey An Object identifying the project. This is used for the cache mechanism.
      * @param metrics the {@link DisplayMetrics}.
@@ -830,6 +855,22 @@
                         }
 
                         resValue = mRenderResources.resolveResValue(resValue);
+
+                        // If the value is a reference to another theme attribute that doesn't
+                        // exist, we should log a warning and omit it.
+                        String val = resValue.getValue();
+                        if (val != null && val.startsWith(SdkConstants.PREFIX_THEME_REF)) {
+                            if (!attrName.equals(RTL_ATTRS.get(val)) ||
+                                    getApplicationInfo().targetSdkVersion <
+                                            VERSION_CODES.JELLY_BEAN_MR1) {
+                                // Only log a warning if the referenced value isn't one of the RTL
+                                // attributes, or the app targets old API.
+                                Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE_THEME_ATTR,
+                                        String.format("Failed to find '%s' in current theme.", val),
+                                        val);
+                            }
+                            resValue = null;
+                        }
                     }
 
                     ta.bridgeSetValue(index, attrName, frameworkAttr, resValue);
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/DependencyFinder.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/DependencyFinder.java
index 7690fcd..61b64a2 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/DependencyFinder.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/DependencyFinder.java
@@ -307,7 +307,9 @@
 
             try {
                 // exclude classes that are part of the default JRE (the one executing this program)
-                if (getClass().getClassLoader().loadClass(className) != null) {
+                // or in java package (we won't be able to load them anyway).
+                if (className.startsWith("java.") ||
+                        getClass().getClassLoader().loadClass(className) != null) {
                     return;
                 }
             } catch (ClassNotFoundException e) {