Merge "Always send VIEW_CLICKED event from AdapterView.performItemClick()" 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/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java
index 20e1610..0f002a9 100644
--- a/core/java/android/hardware/camera2/CameraManager.java
+++ b/core/java/android/hardware/camera2/CameraManager.java
@@ -56,7 +56,7 @@
 public final class CameraManager {
 
     private static final String TAG = "CameraManager";
-    private final boolean DEBUG;
+    private final boolean DEBUG = false;
 
     private static final int USE_CALLING_UID = -1;
 
@@ -73,7 +73,6 @@
      * @hide
      */
     public CameraManager(Context context) {
-        DEBUG = Log.isLoggable(TAG, Log.DEBUG);
         synchronized(mLock) {
             mContext = context;
         }
@@ -722,7 +721,7 @@
             implements IBinder.DeathRecipient {
 
         private static final String TAG = "CameraManagerGlobal";
-        private final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
+        private final boolean DEBUG = false;
 
         // Singleton instance
         private static final CameraManagerGlobal gCameraManager =
diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java
index cf091a9..ac29f80 100644
--- a/core/java/android/hardware/camera2/CameraMetadata.java
+++ b/core/java/android/hardware/camera2/CameraMetadata.java
@@ -51,7 +51,7 @@
 public abstract class CameraMetadata<TKey> {
 
     private static final String TAG = "CameraMetadataAb";
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     /**
      * Set a camera metadata field to a value. The field definitions can be
@@ -131,7 +131,7 @@
              CameraMetadata<TKey> instance,
              int[] filterTags) {
 
-        if (VERBOSE) Log.v(TAG, "getKeysStatic for " + type);
+        if (DEBUG) Log.v(TAG, "getKeysStatic for " + type);
 
         // TotalCaptureResult does not have any of the keys on it, use CaptureResult instead
         if (type.equals(TotalCaptureResult.class)) {
@@ -163,10 +163,10 @@
                     if (shouldKeyBeAdded(key, field, filterTags)) {
                         keyList.add(key);
 
-                        if (VERBOSE) {
+                        if (DEBUG) {
                             Log.v(TAG, "getKeysStatic - key was added - " + key);
                         }
-                    } else if (VERBOSE) {
+                    } else if (DEBUG) {
                         Log.v(TAG, "getKeysStatic - key was filtered - " + key);
                     }
                 }
diff --git a/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java b/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java
index 7f4a76c..7a39dd5 100644
--- a/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java
+++ b/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java
@@ -38,7 +38,7 @@
 
 public class CameraCaptureSessionImpl extends CameraCaptureSession {
     private static final String TAG = "CameraCaptureSession";
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     /** Simple integer ID for session for debugging */
     private final int mId;
@@ -124,7 +124,7 @@
 
         if (configureSuccess) {
             mStateCallback.onConfigured(this);
-            if (VERBOSE) Log.v(TAG, mIdString + "Created session successfully");
+            if (DEBUG) Log.v(TAG, mIdString + "Created session successfully");
             mConfigureSuccess = true;
         } else {
             mStateCallback.onConfigureFailed(this);
@@ -160,7 +160,7 @@
 
         handler = checkHandler(handler, callback);
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, mIdString + "capture - request " + request + ", callback " + callback +
                     " handler " + handler);
         }
@@ -194,7 +194,7 @@
 
         handler = checkHandler(handler, callback);
 
-        if (VERBOSE) {
+        if (DEBUG) {
             CaptureRequest[] requestArray = requests.toArray(new CaptureRequest[0]);
             Log.v(TAG, mIdString + "captureBurst - requests " + Arrays.toString(requestArray) +
                     ", callback " + callback + " handler " + handler);
@@ -218,7 +218,7 @@
 
         handler = checkHandler(handler, callback);
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, mIdString + "setRepeatingRequest - request " + request + ", callback " +
                     callback + " handler" + " " + handler);
         }
@@ -247,7 +247,7 @@
 
         handler = checkHandler(handler, callback);
 
-        if (VERBOSE) {
+        if (DEBUG) {
             CaptureRequest[] requestArray = requests.toArray(new CaptureRequest[0]);
             Log.v(TAG, mIdString + "setRepeatingBurst - requests " + Arrays.toString(requestArray) +
                     ", callback " + callback + " handler" + "" + handler);
@@ -261,7 +261,7 @@
     public synchronized void stopRepeating() throws CameraAccessException {
         checkNotClosed();
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, mIdString + "stopRepeating");
         }
 
@@ -272,7 +272,7 @@
     public synchronized void abortCaptures() throws CameraAccessException {
         checkNotClosed();
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, mIdString + "abortCaptures");
         }
 
@@ -325,7 +325,7 @@
          * but this would introduce nondeterministic behavior.
          */
 
-        if (VERBOSE) Log.v(TAG, mIdString + "replaceSessionClose");
+        if (DEBUG) Log.v(TAG, mIdString + "replaceSessionClose");
 
         // Set up fast shutdown. Possible alternative paths:
         // - This session is active, so close() below starts the shutdown drain
@@ -345,11 +345,11 @@
     public synchronized void close() {
 
         if (mClosed) {
-            if (VERBOSE) Log.v(TAG, mIdString + "close - reentering");
+            if (DEBUG) Log.v(TAG, mIdString + "close - reentering");
             return;
         }
 
-        if (VERBOSE) Log.v(TAG, mIdString + "close - first time");
+        if (DEBUG) Log.v(TAG, mIdString + "close - first time");
 
         mClosed = true;
 
@@ -498,7 +498,7 @@
 
             @Override
             public void onDisconnected(CameraDevice camera) {
-                if (VERBOSE) Log.v(TAG, mIdString + "onDisconnected");
+                if (DEBUG) Log.v(TAG, mIdString + "onDisconnected");
                 close();
             }
 
@@ -513,14 +513,14 @@
                 mIdleDrainer.taskStarted();
                 mActive = true;
 
-                if (VERBOSE) Log.v(TAG, mIdString + "onActive");
+                if (DEBUG) Log.v(TAG, mIdString + "onActive");
                 mStateCallback.onActive(session);
             }
 
             @Override
             public void onIdle(CameraDevice camera) {
                 boolean isAborting;
-                if (VERBOSE) Log.v(TAG, mIdString + "onIdle");
+                if (DEBUG) Log.v(TAG, mIdString + "onIdle");
 
                 synchronized (session) {
                     isAborting = mAborting;
@@ -562,17 +562,17 @@
                 // TODO: Queue captures during abort instead of failing them
                 // since the app won't be able to distinguish the two actives
                 // Don't signal the application since there's no clean mapping here
-                if (VERBOSE) Log.v(TAG, mIdString + "onBusy");
+                if (DEBUG) Log.v(TAG, mIdString + "onBusy");
             }
 
             @Override
             public void onUnconfigured(CameraDevice camera) {
-                if (VERBOSE) Log.v(TAG, mIdString + "onUnconfigured");
+                if (DEBUG) Log.v(TAG, mIdString + "onUnconfigured");
             }
 
             @Override
             public void onSurfacePrepared(Surface surface) {
-                if (VERBOSE) Log.v(TAG, mIdString + "onPrepared");
+                if (DEBUG) Log.v(TAG, mIdString + "onPrepared");
                 mStateCallback.onSurfacePrepared(session, surface);
             }
 
@@ -631,7 +631,7 @@
              * If the camera is already "IDLE" and no aborts are pending,
              * then the drain immediately finishes.
              */
-            if (VERBOSE) Log.v(TAG, mIdString + "onSequenceDrained");
+            if (DEBUG) Log.v(TAG, mIdString + "onSequenceDrained");
 
 
             // Fire session close as soon as all sequences are complete.
@@ -652,7 +652,7 @@
     private class AbortDrainListener implements TaskDrainer.DrainListener {
         @Override
         public void onDrained() {
-            if (VERBOSE) Log.v(TAG, mIdString + "onAbortDrained");
+            if (DEBUG) Log.v(TAG, mIdString + "onAbortDrained");
             synchronized (CameraCaptureSessionImpl.this) {
                 /*
                  * Any queued aborts have now completed.
@@ -676,7 +676,7 @@
     private class IdleDrainListener implements TaskDrainer.DrainListener {
         @Override
         public void onDrained() {
-            if (VERBOSE) Log.v(TAG, mIdString + "onIdleDrained");
+            if (DEBUG) Log.v(TAG, mIdString + "onIdleDrained");
 
             // Take device lock before session lock so that we can call back into device
             // without causing a deadlock
@@ -690,7 +690,7 @@
                  *
                  * This operation is idempotent; a session will not be closed twice.
                  */
-                    if (VERBOSE)
+                    if (DEBUG)
                         Log.v(TAG, mIdString + "Session drain complete, skip unconfigure: " +
                                 mSkipUnconfigure);
 
@@ -712,7 +712,7 @@
                         // TODO: call onError instead of onClosed if this happens
                     } catch (IllegalStateException e) {
                         // Camera is already closed, so nothing left to do
-                        if (VERBOSE) Log.v(TAG, mIdString +
+                        if (DEBUG) Log.v(TAG, mIdString +
                                 "Camera was already closed or busy, skipping unconfigure");
                     }
 
diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
index c4e8b15..e60e266 100644
--- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
+++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
@@ -58,7 +58,7 @@
  */
 public class CameraDeviceImpl extends CameraDevice {
     private final String TAG;
-    private final boolean DEBUG;
+    private final boolean DEBUG = false;
 
     private static final int REQUEST_ID_NONE = -1;
 
@@ -240,7 +240,6 @@
             tag = tag.substring(0, MAX_TAG_LEN);
         }
         TAG = tag;
-        DEBUG = Log.isLoggable(TAG, Log.DEBUG);
 
         Integer partialCount =
                 mCharacteristics.get(CameraCharacteristics.REQUEST_PARTIAL_RESULT_COUNT);
diff --git a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
index b8b7d12..10dd8ae 100644
--- a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
+++ b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java
@@ -222,7 +222,8 @@
     }
 
     private static final String TAG = "CameraMetadataJV";
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
+
     // this should be in sync with HAL_PIXEL_FORMAT_BLOB defined in graphics.h
     public static final int NATIVE_JPEG_FORMAT = 0x21;
 
@@ -1197,7 +1198,7 @@
 
     @SuppressWarnings({ "unchecked", "rawtypes" })
     private static void registerAllMarshalers() {
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, "Shall register metadata marshalers");
         }
 
@@ -1234,7 +1235,7 @@
         for (MarshalQueryable query : queryList) {
             MarshalRegistry.registerMarshalQueryable(query);
         }
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, "Registered metadata marshalers");
         }
     }
diff --git a/core/java/android/hardware/camera2/legacy/CameraDeviceState.java b/core/java/android/hardware/camera2/legacy/CameraDeviceState.java
index 89e2d98..2c2ad1c2 100644
--- a/core/java/android/hardware/camera2/legacy/CameraDeviceState.java
+++ b/core/java/android/hardware/camera2/legacy/CameraDeviceState.java
@@ -41,7 +41,7 @@
  */
 public class CameraDeviceState {
     private static final String TAG = "CameraDeviceState";
-    private static final boolean DEBUG = Log.isLoggable(LegacyCameraDevice.DEBUG_PROP, Log.DEBUG);
+    private static final boolean DEBUG = false;
 
     private static final int STATE_ERROR = 0;
     private static final int STATE_UNCONFIGURED = 1;
diff --git a/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java b/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java
index edad00f..bc0a3a8 100644
--- a/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java
+++ b/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java
@@ -61,7 +61,7 @@
 public class CameraDeviceUserShim implements ICameraDeviceUser {
     private static final String TAG = "CameraDeviceUserShim";
 
-    private static final boolean DEBUG = Log.isLoggable(LegacyCameraDevice.DEBUG_PROP, Log.DEBUG);
+    private static final boolean DEBUG = false;
     private static final int OPEN_CAMERA_TIMEOUT_MS = 5000; // 5 sec (same as api1 cts timeout)
 
     private final LegacyCameraDevice mLegacyDevice;
diff --git a/core/java/android/hardware/camera2/legacy/CaptureCollector.java b/core/java/android/hardware/camera2/legacy/CaptureCollector.java
index 8404e86..eb48a01 100644
--- a/core/java/android/hardware/camera2/legacy/CaptureCollector.java
+++ b/core/java/android/hardware/camera2/legacy/CaptureCollector.java
@@ -34,7 +34,7 @@
 public class CaptureCollector {
     private static final String TAG = "CaptureCollector";
 
-    private static final boolean DEBUG = Log.isLoggable(LegacyCameraDevice.DEBUG_PROP, Log.DEBUG);
+    private static final boolean DEBUG = false;
 
     private static final int FLAG_RECEIVED_JPEG = 1;
     private static final int FLAG_RECEIVED_JPEG_TS = 2;
diff --git a/core/java/android/hardware/camera2/legacy/GLThreadManager.java b/core/java/android/hardware/camera2/legacy/GLThreadManager.java
index b160d2a..152d82d 100644
--- a/core/java/android/hardware/camera2/legacy/GLThreadManager.java
+++ b/core/java/android/hardware/camera2/legacy/GLThreadManager.java
@@ -35,7 +35,7 @@
  */
 public class GLThreadManager {
     private final String TAG;
-    private static final boolean DEBUG = Log.isLoggable(LegacyCameraDevice.DEBUG_PROP, Log.DEBUG);
+    private static final boolean DEBUG = false;
 
     private static final int MSG_NEW_CONFIGURATION = 1;
     private static final int MSG_NEW_FRAME = 2;
diff --git a/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java b/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java
index b5a019d..098c2d8 100644
--- a/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java
+++ b/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java
@@ -59,10 +59,9 @@
  * </p>
  */
 public class LegacyCameraDevice implements AutoCloseable {
-    public static final String DEBUG_PROP = "HAL1ShimLogging";
     private final String TAG;
 
-    private static final boolean DEBUG = Log.isLoggable(LegacyCameraDevice.DEBUG_PROP, Log.DEBUG);
+    private static final boolean DEBUG = false;
     private final int mCameraId;
     private final CameraCharacteristics mStaticCharacteristics;
     private final ICameraDeviceCallbacks mDeviceCallbacks;
diff --git a/core/java/android/hardware/camera2/legacy/LegacyFaceDetectMapper.java b/core/java/android/hardware/camera2/legacy/LegacyFaceDetectMapper.java
index e576beb..882a7f4 100644
--- a/core/java/android/hardware/camera2/legacy/LegacyFaceDetectMapper.java
+++ b/core/java/android/hardware/camera2/legacy/LegacyFaceDetectMapper.java
@@ -44,7 +44,7 @@
 @SuppressWarnings("deprecation")
 public class LegacyFaceDetectMapper {
     private static String TAG = "LegacyFaceDetectMapper";
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     private final Camera mCamera;
     /** Is the camera capable of face detection? */
@@ -97,7 +97,7 @@
                 }
             }
 
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, "onFaceDetection - read " + lengthFaces + " faces");
             }
         }
@@ -170,13 +170,13 @@
                 if (enableFaceDetect) {
                     mCamera.startFaceDetection();
 
-                    if (VERBOSE) {
+                    if (DEBUG) {
                         Log.v(TAG, "processFaceDetectMode - start face detection");
                     }
                 } else {
                     mCamera.stopFaceDetection();
 
-                    if (VERBOSE) {
+                    if (DEBUG) {
                         Log.v(TAG, "processFaceDetectMode - stop face detection");
                     }
 
@@ -248,7 +248,7 @@
             }
         }
 
-        if (VERBOSE && previousFaces != faces) { // Log only in verbose and IF the faces changed
+        if (DEBUG && previousFaces != faces) { // Log only in verbose and IF the faces changed
             Log.v(TAG, "mapResultFaces - changed to " + ListUtils.listToString(convertedFaces));
         }
 
diff --git a/core/java/android/hardware/camera2/legacy/LegacyFocusStateMapper.java b/core/java/android/hardware/camera2/legacy/LegacyFocusStateMapper.java
index d5ec71a..d33c09e 100644
--- a/core/java/android/hardware/camera2/legacy/LegacyFocusStateMapper.java
+++ b/core/java/android/hardware/camera2/legacy/LegacyFocusStateMapper.java
@@ -38,7 +38,7 @@
 @SuppressWarnings("deprecation")
 public class LegacyFocusStateMapper {
     private static String TAG = "LegacyFocusStateMapper";
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     private final Camera mCamera;
 
@@ -90,7 +90,7 @@
         final String afMode = parameters.getFocusMode();
 
         if (!Objects.equals(mAfModePrevious, afMode)) {
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, "processRequestTriggers - AF mode switched from " + mAfModePrevious +
                         " to " + afMode);
             }
@@ -120,7 +120,7 @@
                     synchronized (mLock) {
                         int latestAfRun = mAfRun;
 
-                        if (VERBOSE) {
+                        if (DEBUG) {
                             Log.v(TAG,
                                     "onAutoFocusMoving - start " + start + " latest AF run " +
                                             latestAfRun + ", last AF run " + currentAfRun
@@ -192,7 +192,7 @@
                     mAfState = afStateAfterStart;
                 }
 
-                if (VERBOSE) {
+                if (DEBUG) {
                     Log.v(TAG, "processRequestTriggers - got AF_TRIGGER_START, " +
                             "new AF run is " + currentAfRun);
                 }
@@ -208,7 +208,7 @@
                         synchronized (mLock) {
                             int latestAfRun = mAfRun;
 
-                            if (VERBOSE) {
+                            if (DEBUG) {
                                 Log.v(TAG, "onAutoFocus - success " + success + " latest AF run " +
                                         latestAfRun + ", last AF run " + currentAfRun);
                             }
@@ -255,7 +255,7 @@
 
                     mCamera.cancelAutoFocus();
 
-                    if (VERBOSE) {
+                    if (DEBUG) {
                         Log.v(TAG, "processRequestTriggers - got AF_TRIGGER_CANCEL, " +
                                 "new AF run is " + updatedAfRun);
                     }
@@ -288,7 +288,7 @@
             newAfState = mAfState;
         }
 
-        if (VERBOSE && newAfState != mAfStatePrevious) {
+        if (DEBUG && newAfState != mAfStatePrevious) {
             Log.v(TAG, String.format("mapResultTriggers - afState changed from %s to %s",
                     afStateToString(mAfStatePrevious), afStateToString(newAfState)));
         }
diff --git a/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java b/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java
index 943e421..33a802b 100644
--- a/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java
+++ b/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java
@@ -55,7 +55,7 @@
 @SuppressWarnings("deprecation")
 public class LegacyMetadataMapper {
     private static final String TAG = "LegacyMetadataMapper";
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     private static final long NS_PER_MS = 1000000;
 
@@ -152,7 +152,7 @@
         params.unflatten(parameters);
         mapCharacteristicsFromParameters(m, params);
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, "createCharacteristics metadata:");
             Log.v(TAG, "--------------------------------------------------- (start)");
             m.dumpToLog();
@@ -284,7 +284,7 @@
             Camera.Size maxJpegSize = SizeAreaComparator.findLargestByArea(jpegSizes);
             float jpegAspectRatio = maxJpegSize.width * 1.0f / maxJpegSize.height;
 
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, String.format("mapScalerStreamConfigs - largest JPEG area %dx%d, AR=%f",
                         maxJpegSize.width, maxJpegSize.height, jpegAspectRatio));
             }
@@ -300,7 +300,7 @@
                         PREVIEW_ASPECT_RATIO_TOLERANCE) {
                     previewSizes.remove(index); // Assume removing from end is O(1)
 
-                    if (VERBOSE) {
+                    if (DEBUG) {
                         Log.v(TAG, String.format(
                                 "mapScalerStreamConfigs - removed preview size %dx%d, AR=%f "
                                         + "was not the same",
@@ -329,7 +329,7 @@
         for (int format : p.getSupportedPreviewFormats()) {
             if (ImageFormat.isPublicFormat(format) && format != ImageFormat.NV21) {
                 appendStreamConfig(availableStreamConfigs, format, previewSizes);
-            } else if (VERBOSE) {
+            } else if (DEBUG) {
                 /*
                  *  Do not add any formats unknown to us
                  * (since it would fail runtime checks in StreamConfigurationMap)
@@ -388,7 +388,7 @@
             int j = 0;
             for (String mode : antiBandingModes) {
                 int convertedMode = convertAntiBandingMode(mode);
-                if (VERBOSE && convertedMode == -1) {
+                if (DEBUG && convertedMode == -1) {
                     Log.v(TAG, "Antibanding mode " + ((mode == null) ? "NULL" : mode) +
                             " not supported, skipping...");
                 } else {
@@ -525,7 +525,7 @@
 
             m.set(CONTROL_AF_AVAILABLE_MODES, ArrayUtils.toIntArray(afAvail));
 
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, "mapControlAf - control.afAvailableModes set to " +
                         ListUtils.listToString(afAvail));
             }
@@ -575,7 +575,7 @@
 
             m.set(CONTROL_AWB_AVAILABLE_MODES, ArrayUtils.toIntArray(awbAvail));
 
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, "mapControlAwb - control.awbAvailableModes set to " +
                         ListUtils.listToString(awbAvail));
             }
@@ -681,7 +681,7 @@
          *  We can tell if the lens is fixed focus;
          *  but if it's not, we can't tell the minimum focus distance, so leave it null then.
          */
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, "mapLens - focus-mode='" + p.getFocusMode() + "'");
         }
 
@@ -691,11 +691,11 @@
              */
             m.set(LENS_INFO_MINIMUM_FOCUS_DISTANCE, LENS_INFO_MINIMUM_FOCUS_DISTANCE_FIXED_FOCUS);
 
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, "mapLens - lens.info.minimumFocusDistance = 0");
             }
         } else {
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, "mapLens - lens.info.minimumFocusDistance is unknown");
             }
         }
@@ -1342,7 +1342,7 @@
                 }
             }
 
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, "createRequestTemplate (templateId=" + templateId + ")," +
                         " afMode=" + afMode + ", minimumFocusDistance=" + minimumFocusDistance);
             }
diff --git a/core/java/android/hardware/camera2/legacy/LegacyRequestMapper.java b/core/java/android/hardware/camera2/legacy/LegacyRequestMapper.java
index 3688610..d5d7f0d 100644
--- a/core/java/android/hardware/camera2/legacy/LegacyRequestMapper.java
+++ b/core/java/android/hardware/camera2/legacy/LegacyRequestMapper.java
@@ -42,7 +42,7 @@
 @SuppressWarnings("deprecation")
 public class LegacyRequestMapper {
     private static final String TAG = "LegacyRequestMapper";
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     /** Default quality for android.jpeg.quality, android.jpeg.thumbnailQuality */
     private static final byte DEFAULT_JPEG_QUALITY = 85;
@@ -75,7 +75,7 @@
 
             if (params.isZoomSupported()) {
                 params.setZoom(zoomData.zoomIndex);
-            } else if (VERBOSE) {
+            } else if (DEBUG) {
                 Log.v(TAG, "convertRequestToMetadata - zoom is not supported");
             }
         }
@@ -210,7 +210,7 @@
                 params.setAutoExposureLock(aeLock);
             }
 
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, "convertRequestToMetadata - control.aeLock set to " + aeLock);
             }
 
@@ -231,7 +231,7 @@
                 params.setFocusMode(focusMode);
             }
 
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, "convertRequestToMetadata - control.afMode "
                         + afMode + " mapped to " + focusMode);
             }
@@ -250,7 +250,7 @@
                 params.setWhiteBalance(whiteBalanceMode);
             }
 
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, "convertRequestToMetadata - control.awbMode "
                         + awbMode + " mapped to " + whiteBalanceMode);
             }
@@ -520,7 +520,7 @@
                             " regions, ignoring all beyond the first " + maxNumMeteringAreas);
         }
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, "convertMeteringRegionsToLegacy - " + regionName + " areas = "
                     + ParameterUtils.stringFromAreaList(meteringAreaList));
         }
@@ -593,7 +593,7 @@
             p.setFlashMode(flashModeSetting);
         }
 
-        if (VERBOSE) {
+        if (DEBUG) {
                 Log.v(TAG,
                         "mapAeAndFlashMode - set flash.mode (api1) to " + flashModeSetting
                         + ", requested (api2) " + flashMode
diff --git a/core/java/android/hardware/camera2/legacy/LegacyResultMapper.java b/core/java/android/hardware/camera2/legacy/LegacyResultMapper.java
index bad1d28a..ce85005 100644
--- a/core/java/android/hardware/camera2/legacy/LegacyResultMapper.java
+++ b/core/java/android/hardware/camera2/legacy/LegacyResultMapper.java
@@ -42,7 +42,7 @@
 @SuppressWarnings("deprecation")
 public class LegacyResultMapper {
     private static final String TAG = "LegacyResultMapper";
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     private LegacyRequest mCachedRequest = null;
     private CameraMetadataNative mCachedResult = null;
@@ -88,7 +88,7 @@
             result.set(SENSOR_TIMESTAMP, timestamp);
         }
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, "cachedConvertResultMetadata - cached? " + cached +
                     " timestamp = " + timestamp);
 
@@ -306,7 +306,7 @@
         {
             boolean lock = p.isAutoExposureLockSupported() ? p.getAutoExposureLock() : false;
             m.set(CONTROL_AE_LOCK, lock);
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG,
                         "mapAe - android.control.aeLock = " + lock +
                         ", supported = " + p.isAutoExposureLockSupported());
@@ -332,7 +332,7 @@
 
         // control.aeRegions
         if (p.getMaxNumMeteringAreas() > 0) {
-            if (VERBOSE) {
+            if (DEBUG) {
                 String meteringAreas = p.get("metering-areas");
                 Log.v(TAG, "mapAe - parameter dump; metering-areas: " + meteringAreas);
             }
@@ -352,7 +352,7 @@
 
         // control.afRegions
         if (p.getMaxNumFocusAreas() > 0) {
-            if (VERBOSE) {
+            if (DEBUG) {
                 String focusAreas = p.get("focus-areas");
                 Log.v(TAG, "mapAe - parameter dump; focus-areas: " + focusAreas);
             }
@@ -392,7 +392,7 @@
             }
         }
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG,
                     "Metering rectangles for " + regionName + ": "
                      + ListUtils.listToString(meteringRectList));
diff --git a/core/java/android/hardware/camera2/legacy/ParameterUtils.java b/core/java/android/hardware/camera2/legacy/ParameterUtils.java
index 32bbc51..3cfd020 100644
--- a/core/java/android/hardware/camera2/legacy/ParameterUtils.java
+++ b/core/java/android/hardware/camera2/legacy/ParameterUtils.java
@@ -225,7 +225,7 @@
     }
 
     private static final String TAG = "ParameterUtils";
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     /** getZoomRatios stores zoom ratios in 1/100 increments, e.x. a zoom of 3.2 is 320 */
     private static final int ZOOM_RATIO_MULTIPLIER = 100;
@@ -398,7 +398,7 @@
         Rect cropRegionAsPreview =
                 shrinkToSameAspectRatioCentered(previewCrop, actualCrop);
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, "getClosestAvailableZoomCrop - actualCrop = " + actualCrop);
             Log.v(TAG,
                     "getClosestAvailableZoomCrop - previewCrop = " + previewCrop);
@@ -418,7 +418,7 @@
         List<Rect> availablePreviewCropRegions =
                 getAvailablePreviewZoomCropRectangles(params, activeArray, streamSize);
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG,
                     "getClosestAvailableZoomCrop - availableReportedCropRegions = " +
                             ListUtils.listToString(availableReportedCropRegions));
@@ -758,7 +758,7 @@
             userCropRegion = activeArraySizeOnly;
         }
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, "convertScalerCropRegion - user crop region was " + userCropRegion);
         }
 
@@ -768,7 +768,7 @@
                 previewSize, userCropRegion,
                 /*out*/reportedCropRegion, /*out*/previewCropRegion);
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, "convertScalerCropRegion - zoom calculated to: " +
                     "zoomIndex = " + zoomIdx +
                     ", reported crop region = " + reportedCropRegion +
@@ -862,7 +862,7 @@
             reportedMetering = reportedMeteringRect.rect;
         }
 
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, String.format(
                     "convertMeteringRectangleToLegacy - activeArray = %s, meteringRect = %s, " +
                     "previewCrop = %s, meteringArea = %s, previewMetering = %s, " +
diff --git a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java
index 691798f..5ea1ab8 100644
--- a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java
+++ b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java
@@ -62,10 +62,9 @@
     private final int mCameraId;
     private final RequestHandlerThread mRequestThread;
 
-    private static final boolean DEBUG = Log.isLoggable(LegacyCameraDevice.DEBUG_PROP, Log.DEBUG);
+    private static final boolean DEBUG = false;
     // For slightly more spammy messages that will get repeated every frame
-    private static final boolean VERBOSE =
-            Log.isLoggable(LegacyCameraDevice.DEBUG_PROP, Log.VERBOSE);
+    private static final boolean VERBOSE = false;
     private Camera mCamera;
     private final CameraCharacteristics mCharacteristics;
 
diff --git a/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java b/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java
index 615b2c8..f928a555 100644
--- a/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java
+++ b/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java
@@ -49,7 +49,7 @@
  */
 public class SurfaceTextureRenderer {
     private static final String TAG = SurfaceTextureRenderer.class.getSimpleName();
-    private static final boolean DEBUG = Log.isLoggable(LegacyCameraDevice.DEBUG_PROP, Log.DEBUG);
+    private static final boolean DEBUG = false;
     private static final int EGL_RECORDABLE_ANDROID = 0x3142; // from EGL/eglext.h
     private static final int GL_MATRIX_SIZE = 16;
     private static final int VERTEX_POS_SIZE = 3;
diff --git a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableArray.java b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableArray.java
index d89518b..ebc74f0 100644
--- a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableArray.java
+++ b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableArray.java
@@ -39,7 +39,7 @@
 public class MarshalQueryableArray<T> implements MarshalQueryable<T> {
 
     private static final String TAG = MarshalQueryableArray.class.getSimpleName();
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     private class MarshalerArray extends Marshaler<T> {
         private final Class<T> mClass;
@@ -81,7 +81,7 @@
                             + "; but there are " + (remaining % elementSize) + " left over bytes");
                 }
 
-                if (VERBOSE) {
+                if (DEBUG) {
                     Log.v(TAG, String.format(
                             "Attempting to unpack array (count = %d, element size = %d, bytes "
                             + "remaining = %d) for type %s",
diff --git a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableEnum.java b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableEnum.java
index fa53db2..621a418 100644
--- a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableEnum.java
+++ b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableEnum.java
@@ -38,7 +38,7 @@
 public class MarshalQueryableEnum<T extends Enum<T>> implements MarshalQueryable<T> {
 
     private static final String TAG = MarshalQueryableEnum.class.getSimpleName();
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     private static final int UINT8_MIN = 0x0;
     private static final int UINT8_MAX = (1 << Byte.SIZE) - 1;
@@ -110,7 +110,7 @@
                 Class<?> typeClass = (Class<?>)managedType.getType();
 
                 if (typeClass.isEnum()) {
-                    if (VERBOSE) {
+                    if (DEBUG) {
                         Log.v(TAG, "possible enum detected for " + typeClass);
                     }
 
@@ -151,7 +151,7 @@
                     "Expected values array to be the same size as the enumTypes values "
                             + values.length + " for type " + enumType);
         }
-        if (VERBOSE) {
+        if (DEBUG) {
             Log.v(TAG, "Registered enum values for type " + enumType + " values");
         }
 
diff --git a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableParcelable.java b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableParcelable.java
index 0b7a4bf..fdde205 100644
--- a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableParcelable.java
+++ b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableParcelable.java
@@ -34,7 +34,7 @@
         implements MarshalQueryable<T> {
 
     private static final String TAG = "MarshalParcelable";
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     private static final String FIELD_CREATOR = "CREATOR";
 
@@ -70,7 +70,7 @@
 
         @Override
         public void marshal(T value, ByteBuffer buffer) {
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, "marshal " + value);
             }
 
@@ -100,7 +100,7 @@
 
         @Override
         public T unmarshal(ByteBuffer buffer) {
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG, "unmarshal, buffer remaining " + buffer.remaining());
             }
 
@@ -142,7 +142,7 @@
                 buffer.reset();
                 buffer.position(buffer.position() + actualLength);
 
-                if (VERBOSE) {
+                if (DEBUG) {
                     Log.v(TAG, "unmarshal, parcel length was " + actualLength);
                     Log.v(TAG, "unmarshal, value is " + value);
                 }
@@ -165,7 +165,7 @@
                 value.writeToParcel(parcel, /*flags*/0);
                 int length = parcel.marshall().length;
 
-                if (VERBOSE) {
+                if (DEBUG) {
                     Log.v(TAG, "calculateMarshalSize, length when parceling "
                             + value + " is " + length);
                 }
diff --git a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableString.java b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableString.java
index bf518bb..d2c3908 100644
--- a/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableString.java
+++ b/core/java/android/hardware/camera2/marshal/impl/MarshalQueryableString.java
@@ -31,7 +31,7 @@
 public class MarshalQueryableString implements MarshalQueryable<String> {
 
     private static final String TAG = MarshalQueryableString.class.getSimpleName();
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     private static final Charset UTF8_CHARSET = Charset.forName("UTF-8");
     private static final byte NUL = (byte)'\0'; // used as string terminator
@@ -72,7 +72,7 @@
                 stringLength++;
             }
 
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG,
                         "unmarshal - scanned " + stringLength + " characters; found null? "
                                 + foundNull);
diff --git a/core/java/android/hardware/camera2/utils/ArrayUtils.java b/core/java/android/hardware/camera2/utils/ArrayUtils.java
index 79a335c..99ddf6e 100644
--- a/core/java/android/hardware/camera2/utils/ArrayUtils.java
+++ b/core/java/android/hardware/camera2/utils/ArrayUtils.java
@@ -28,7 +28,7 @@
 public class ArrayUtils {
 
     private static final String TAG = "ArrayUtils";
-    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private static final boolean DEBUG = false;
 
     /** Return the index of {@code needle} in the {@code array}, or else {@code -1} */
     public static <T> int getArrayIndex(T[] array, T needle) {
@@ -117,7 +117,7 @@
 
             // Guard against unexpected values
             if (strIndex < 0) {
-                if (VERBOSE) Log.v(TAG, "Ignoring invalid value " + str);
+                if (DEBUG) Log.v(TAG, "Ignoring invalid value " + str);
                 continue;
             }
 
diff --git a/core/java/android/hardware/camera2/utils/TaskDrainer.java b/core/java/android/hardware/camera2/utils/TaskDrainer.java
index dc09f62..7c46e50 100644
--- a/core/java/android/hardware/camera2/utils/TaskDrainer.java
+++ b/core/java/android/hardware/camera2/utils/TaskDrainer.java
@@ -52,7 +52,7 @@
     }
 
     private static final String TAG = "TaskDrainer";
-    private final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+    private final boolean DEBUG = false;
 
     private final Handler mHandler;
     private final DrainListener mListener;
@@ -110,7 +110,7 @@
      */
     public void taskStarted(T task) {
         synchronized (mLock) {
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG + "[" + mName + "]", "taskStarted " + task);
             }
 
@@ -141,7 +141,7 @@
      */
     public void taskFinished(T task) {
         synchronized (mLock) {
-            if (VERBOSE) {
+            if (DEBUG) {
                 Log.v(TAG + "[" + mName + "]", "taskFinished " + task);
             }
 
@@ -163,7 +163,7 @@
     public void beginDrain() {
         synchronized (mLock) {
             if (!mDraining) {
-                if (VERBOSE) {
+                if (DEBUG) {
                     Log.v(TAG + "[" + mName + "]", "beginDrain started");
                 }
 
@@ -172,7 +172,7 @@
                 // If all tasks that had started had already finished by now, fire #onDrained
                 checkIfDrainFinished();
             } else {
-                if (VERBOSE) {
+                if (DEBUG) {
                     Log.v(TAG + "[" + mName + "]", "beginDrain ignored");
                 }
             }
@@ -190,7 +190,7 @@
         mHandler.post(new Runnable() {
             @Override
             public void run() {
-                if (VERBOSE) {
+                if (DEBUG) {
                     Log.v(TAG + "[" + mName + "]", "onDrained");
                 }
 
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/text/Layout.java b/core/java/android/text/Layout.java
index f176240..f7027f9 100644
--- a/core/java/android/text/Layout.java
+++ b/core/java/android/text/Layout.java
@@ -1121,6 +1121,7 @@
      * closest to the specified horizontal position.
      */
     public int getOffsetForHorizontal(int line, float horiz) {
+        // TODO: use Paint.getOffsetForAdvance to avoid binary search
         int max = getLineEnd(line) - 1;
         int min = getLineStart(line);
         Directions dirs = getLineDirections(line);
diff --git a/core/java/android/text/TextLine.java b/core/java/android/text/TextLine.java
index 479242c..605b91d 100644
--- a/core/java/android/text/TextLine.java
+++ b/core/java/android/text/TextLine.java
@@ -739,16 +739,14 @@
 
         float ret = 0;
 
-        int contextLen = contextEnd - contextStart;
         if (needWidth || (c != null && (wp.bgColor != 0 || wp.underlineColor != 0 || runIsRtl))) {
             if (mCharsValid) {
-                ret = wp.getTextRunAdvances(mChars, start, runLen,
-                        contextStart, contextLen, runIsRtl, null, 0);
+                ret = wp.getRunAdvance(mChars, start, contextEnd, contextStart, contextEnd,
+                        runIsRtl, end);
             } else {
                 int delta = mStart;
-                ret = wp.getTextRunAdvances(mText, delta + start,
-                        delta + end, delta + contextStart, delta + contextEnd,
-                        runIsRtl, null, 0);
+                ret = wp.getRunAdvance(mText, delta + start, delta + contextEnd,
+                        delta + contextStart, delta + contextEnd, runIsRtl, delta + end);
             }
         }
 
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/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/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/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/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/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) {