diff options
45 files changed, 1054 insertions, 724 deletions
diff --git a/api/current.txt b/api/current.txt index 5a9be90b6736..28c344e7ebe4 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28889,11 +28889,9 @@ package android.service.voice { 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 @@ package android.service.voice { 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 @@ package android.service.voice { 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 @@ package android.service.voice { 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 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 class VoiceInteractionSession.Caller { + 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 @@ package android.service.voice { 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 @@ package android.telecom { 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 b4315fe1ecb2..5218595c2d7f 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -31015,11 +31015,9 @@ package android.service.voice { 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 @@ package android.service.voice { 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 @@ package android.service.voice { 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 @@ package android.service.voice { 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 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 class VoiceInteractionSession.Caller { + 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 @@ package android.service.voice { 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 @@ package android.telecom { 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 a4129520ccce..ba27c546c0e7 100644 --- a/core/java/android/app/VoiceInteractor.java +++ b/core/java/android/app/VoiceInteractor.java @@ -510,7 +510,7 @@ public class VoiceInteractor { } /** - * 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/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index 4fe257c9e6f5..d5867a9654f1 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -1068,20 +1068,35 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri /** * <p>The correction coefficients to correct for this camera device's - * radial lens distortion.</p> - * <p>Three cofficients <code>[kappa_1, kappa_2, kappa_3]</code> that - * can be used to correct the lens's radial geometric - * distortion with the mapping equations:</p> - * <pre><code> x_c = x_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) - * y_c = y_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) + * radial and tangential lens distortion.</p> + * <p>Three radial distortion coefficients <code>[kappa_1, kappa_2, + * kappa_3]</code> and two tangential distortion coefficients + * <code>[kappa_4, kappa_5]</code> that can be used to correct the + * lens's geometric distortion with the mapping equations:</p> + * <pre><code> x_c = x_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) + + * kappa_4 * (2 * x_i * y_i) + kappa_5 * ( r^2 + 2 * x_i^2 ) + * y_c = y_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) + + * kappa_5 * (2 * x_i * y_i) + kappa_4 * ( r^2 + 2 * y_i^2 ) * </code></pre> - * <p>where <code>[x_i, y_i]</code> are normalized coordinates with <code>(0,0)</code> - * at the lens optical center, and <code>[-1, 1]</code> are the edges of - * the active pixel array; and where <code>[x_c, y_c]</code> are the - * corrected normalized coordinates with radial distortion - * removed; and <code>r^2 = x_i^2 + y_i^2</code>.</p> + * <p>Here, <code>[x_c, y_c]</code> are the coordinates to sample in the + * input image that correspond to the pixel values in the + * corrected image at the coordinate <code>[x_i, y_i]</code>:</p> + * <pre><code> correctedImage(x_i, y_i) = sample_at(x_c, y_c, inputImage) + * </code></pre> + * <p>The pixel coordinates are defined in a normalized + * coordinate system related to the + * android.lens.intrinsicCalibration calibration fields. + * Both <code>[x_i, y_i]</code> and <code>[x_c, y_c]</code> have <code>(0,0)</code> at the + * lens optical center <code>[c_x, c_y]</code>. The maximum magnitudes + * of both x and y coordinates are normalized to be 1 at the + * edge further from the optical center, so the range + * for both dimensions is <code>-1 <= x <= 1</code>.</p> + * <p>Finally, <code>r</code> represents the radial distance from the + * optical center, <code>r^2 = x_i^2 + y_i^2</code>, and its magnitude + * is therefore no larger than <code>|r| <= sqrt(2)</code>.</p> + * <p>The distortion model used is the Brown-Conrady model.</p> * <p><b>Units</b>: - * Coefficients for a 6th-degree even radial polynomial.</p> + * Unitless coefficients.</p> * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> */ @PublicKey diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 96faad285af6..df6c986da819 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -2649,20 +2649,35 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { /** * <p>The correction coefficients to correct for this camera device's - * radial lens distortion.</p> - * <p>Three cofficients <code>[kappa_1, kappa_2, kappa_3]</code> that - * can be used to correct the lens's radial geometric - * distortion with the mapping equations:</p> - * <pre><code> x_c = x_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) - * y_c = y_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) + * radial and tangential lens distortion.</p> + * <p>Three radial distortion coefficients <code>[kappa_1, kappa_2, + * kappa_3]</code> and two tangential distortion coefficients + * <code>[kappa_4, kappa_5]</code> that can be used to correct the + * lens's geometric distortion with the mapping equations:</p> + * <pre><code> x_c = x_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) + + * kappa_4 * (2 * x_i * y_i) + kappa_5 * ( r^2 + 2 * x_i^2 ) + * y_c = y_i * ( 1 + kappa_1 * r^2 + kappa_2 * r^4 + kappa_3 * r^6 ) + + * kappa_5 * (2 * x_i * y_i) + kappa_4 * ( r^2 + 2 * y_i^2 ) * </code></pre> - * <p>where <code>[x_i, y_i]</code> are normalized coordinates with <code>(0,0)</code> - * at the lens optical center, and <code>[-1, 1]</code> are the edges of - * the active pixel array; and where <code>[x_c, y_c]</code> are the - * corrected normalized coordinates with radial distortion - * removed; and <code>r^2 = x_i^2 + y_i^2</code>.</p> + * <p>Here, <code>[x_c, y_c]</code> are the coordinates to sample in the + * input image that correspond to the pixel values in the + * corrected image at the coordinate <code>[x_i, y_i]</code>:</p> + * <pre><code> correctedImage(x_i, y_i) = sample_at(x_c, y_c, inputImage) + * </code></pre> + * <p>The pixel coordinates are defined in a normalized + * coordinate system related to the + * android.lens.intrinsicCalibration calibration fields. + * Both <code>[x_i, y_i]</code> and <code>[x_c, y_c]</code> have <code>(0,0)</code> at the + * lens optical center <code>[c_x, c_y]</code>. The maximum magnitudes + * of both x and y coordinates are normalized to be 1 at the + * edge further from the optical center, so the range + * for both dimensions is <code>-1 <= x <= 1</code>.</p> + * <p>Finally, <code>r</code> represents the radial distance from the + * optical center, <code>r^2 = x_i^2 + y_i^2</code>, and its magnitude + * is therefore no larger than <code>|r| <= sqrt(2)</code>.</p> + * <p>The distortion model used is the Brown-Conrady model.</p> * <p><b>Units</b>: - * Coefficients for a 6th-degree even radial polynomial.</p> + * Unitless coefficients.</p> * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> */ @PublicKey diff --git a/core/java/android/service/voice/VoiceInteractionService.java b/core/java/android/service/voice/VoiceInteractionService.java index 77e2125b75da..8119049bf3d9 100644 --- a/core/java/android/service/voice/VoiceInteractionService.java +++ b/core/java/android/service/voice/VoiceInteractionService.java @@ -70,25 +70,6 @@ public class VoiceInteractionService extends Service { */ 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 @@ public class VoiceInteractionService extends Service { * 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 f09b6a22a94d..48ad5a887c35 100644 --- a/core/java/android/service/voice/VoiceInteractionSession.java +++ b/core/java/android/service/voice/VoiceInteractionSession.java @@ -68,11 +68,29 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; * 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, @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 abstract class VoiceInteractionSession implements KeyEvent.Callback, 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 abstract class VoiceInteractionSession implements KeyEvent.Callback, } }; - 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, } } }; + 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, } } + /** @hide */ public void sendConfirmResult(boolean confirmed, Bundle result) { try { if (DEBUG) Log.d(TAG, "sendConfirmResult: req=" + mInterface @@ -265,6 +330,7 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, } } + /** @hide */ public void sendPickOptionResult(boolean finished, VoiceInteractor.PickOptionRequest.Option[] selections, Bundle result) { try { @@ -279,6 +345,7 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, } } + /** @hide */ public void sendCompleteVoiceResult(Bundle result) { try { if (DEBUG) Log.d(TAG, "sendCompleteVoiceResult: req=" + mInterface @@ -289,6 +356,7 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, } } + /** @hide */ public void sendAbortVoiceResult(Bundle result) { try { if (DEBUG) Log.d(TAG, "sendConfirmResult: req=" + mInterface @@ -299,6 +367,7 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, } } + /** @hide */ public void sendCommandResult(boolean finished, Bundle result) { try { if (DEBUG) Log.d(TAG, "sendCommandResult: req=" + mInterface @@ -311,7 +380,15 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, } } + /** @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 abstract class VoiceInteractionSession implements KeyEvent.Callback, } } - 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; + + 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; + } - Caller(String _packageName, int _uid) { - packageName = _packageName; - uid = _uid; + /** + * 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, } } - /** TODO: remove */ + /** @hide */ public void showWindow() { } - /** TODO: remove */ + /** @hide */ public void hideWindow() { } @@ -677,7 +925,9 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, * <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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, } } + /** + * 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, } /** - * 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, * 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, * 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, * 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 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback, * 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 f176240dbb73..f7027f9e20b8 100644 --- a/core/java/android/text/Layout.java +++ b/core/java/android/text/Layout.java @@ -1121,6 +1121,7 @@ public abstract class Layout { * 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 479242c85695..605b91dee9c0 100644 --- a/core/java/android/text/TextLine.java +++ b/core/java/android/text/TextLine.java @@ -739,16 +739,14 @@ class TextLine { 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 e963f53dd915..a3332fa21f2c 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -820,44 +820,36 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te 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); - } - - mDrawSelectorOnTop = a.getBoolean( - com.android.internal.R.styleable.AbsListView_drawSelectorOnTop, false); - - boolean stackFromBottom = a.getBoolean(R.styleable.AbsListView_stackFromBottom, false); - setStackFromBottom(stackFromBottom); - - 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)); + final Drawable selector = a.getDrawable(R.styleable.AbsListView_listSelector); + if (selector != null) { + setSelector(selector); + } + + mDrawSelectorOnTop = a.getBoolean(R.styleable.AbsListView_drawSelectorOnTop, false); + + 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)); + + 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 ea18c12a38ec..c1ec6e6907cd 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -659,11 +659,16 @@ public class ChooserActivity extends ResolverActivity { 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 @@ public class ChooserActivity extends ResolverActivity { @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 @@ public class ChooserActivity extends ResolverActivity { } 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 @@ public class ChooserActivity extends ResolverActivity { @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 @@ public class ChooserActivity extends ResolverActivity { } 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 46967577707a..ba4af8967a25 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -785,7 +785,7 @@ public class ResolverActivity extends Activity { } 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 @@ public class ResolverActivity extends Activity { 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/widget/FloatingToolbar.java b/core/java/com/android/internal/widget/FloatingToolbar.java index 3cff59a316d4..1fc0ac30d8d7 100644 --- a/core/java/com/android/internal/widget/FloatingToolbar.java +++ b/core/java/com/android/internal/widget/FloatingToolbar.java @@ -353,10 +353,14 @@ public final class FloatingToolbar { * from. */ public FloatingToolbarPopup(View parent) { + mMarginHorizontal = parent.getResources() + .getDimensionPixelSize(R.dimen.floating_toolbar_horizontal_margin); + mMarginVertical = parent.getResources() + .getDimensionPixelSize(R.dimen.floating_toolbar_vertical_margin); mParent = Preconditions.checkNotNull(parent); mContentContainer = createContentContainer(parent.getContext()); mPopupWindow = createPopupWindow(mContentContainer); - mShowAnimation = createGrowFadeInFromBottom(mContentContainer); + mShowAnimation = createGrowFadeInFromBottom(mContentContainer, mMarginHorizontal); mDismissAnimation = createShrinkFadeOutFromBottomAnimation( mContentContainer, 150, // startDelay @@ -376,17 +380,15 @@ public final class FloatingToolbar { mPopupWindow.dismiss(); } }); - mMarginHorizontal = parent.getResources() - .getDimensionPixelSize(R.dimen.floating_toolbar_horizontal_margin); - mMarginVertical = parent.getResources() - .getDimensionPixelSize(R.dimen.floating_toolbar_vertical_margin); } /** * Lays out buttons for the specified menu items. */ - public void layoutMenuItems(List<MenuItem> menuItems, - MenuItem.OnMenuItemClickListener menuItemClickListener, int suggestedWidth) { + public void layoutMenuItems( + List<MenuItem> menuItems, + MenuItem.OnMenuItemClickListener menuItemClickListener, + int suggestedWidth) { Preconditions.checkNotNull(menuItems); mContentContainer.removeAllViews(); @@ -593,7 +595,9 @@ public final class FloatingToolbar { final int startWidth = mContentContainer.getWidth(); final int startHeight = mContentContainer.getHeight(); final float startY = mContentContainer.getY(); - final float right = mContentContainer.getX() + mContentContainer.getWidth(); + final float left = mContentContainer.getX(); + final float right = left + mContentContainer.getWidth(); + final boolean rtl = mContentContainer.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; Animation widthAnimation = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { @@ -601,7 +605,11 @@ public final class FloatingToolbar { int deltaWidth = (int) (interpolatedTime * (targetWidth - startWidth)); params.width = startWidth + deltaWidth; mContentContainer.setLayoutParams(params); - mContentContainer.setX(right - mContentContainer.getWidth()); + if (rtl) { + mContentContainer.setX(left); + } else { + mContentContainer.setX(right - mContentContainer.getWidth()); + } } }; Animation heightAnimation = new Animation() { @@ -644,9 +652,11 @@ public final class FloatingToolbar { final int targetHeight = mainPanelSize.getHeight(); final int startWidth = mContentContainer.getWidth(); final int startHeight = mContentContainer.getHeight(); - final float right = mContentContainer.getX() + mContentContainer.getWidth(); final float bottom = mContentContainer.getY() + mContentContainer.getHeight(); final boolean morphedUpwards = (mOverflowDirection == OVERFLOW_DIRECTION_UP); + final float left = mContentContainer.getX(); + final float right = left + mContentContainer.getWidth(); + final boolean rtl = mContentContainer.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; Animation widthAnimation = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { @@ -654,7 +664,11 @@ public final class FloatingToolbar { int deltaWidth = (int) (interpolatedTime * (targetWidth - startWidth)); params.width = startWidth + deltaWidth; mContentContainer.setLayoutParams(params); - mContentContainer.setX(right - mContentContainer.getWidth()); + if (rtl) { + mContentContainer.setX(left); + } else { + mContentContainer.setX(right - mContentContainer.getWidth()); + } } }; Animation heightAnimation = new Animation() { @@ -747,9 +761,7 @@ public final class FloatingToolbar { */ private void positionMainPanel() { Preconditions.checkNotNull(mMainPanel); - float x = mPopupWindow.getWidth() - - (mMainPanel.getView().getMeasuredWidth() + mMarginHorizontal); - mContentContainer.setX(x); + mContentContainer.setX(mMarginHorizontal); float y = mMarginVertical; if (mOverflowDirection == OVERFLOW_DIRECTION_UP) { @@ -1320,12 +1332,14 @@ public final class FloatingToolbar { * * @param view The view to animate */ - private static AnimatorSet createGrowFadeInFromBottom(View view) { + private static AnimatorSet createGrowFadeInFromBottom(View view, int x) { AnimatorSet growFadeInFromBottomAnimation = new AnimatorSet(); growFadeInFromBottomAnimation.playTogether( ObjectAnimator.ofFloat(view, View.SCALE_X, 0.5f, 1).setDuration(125), ObjectAnimator.ofFloat(view, View.SCALE_Y, 0.5f, 1).setDuration(125), - ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1).setDuration(75)); + ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1).setDuration(75), + // Make sure that view.x is always fixed throughout the duration of this animation. + ObjectAnimator.ofFloat(view, View.X, x, x)); growFadeInFromBottomAnimation.setStartDelay(50); return growFadeInFromBottomAnimation; } diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml index f9fcf38e395f..f7a42fa707be 100644 --- a/core/res/res/values/styles_material.xml +++ b/core/res/res/values/styles_material.xml @@ -348,12 +348,12 @@ please see styles_device_defaults.xml. </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 e6c851b09886..1686d79213ba 100644 --- a/docs/html/preview/api-overview.jd +++ b/docs/html/preview/api-overview.jd @@ -20,7 +20,7 @@ page.image=images/cards/card-api-overview_16-9_2x.png <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 @@ adb -e emu finger touch <finger_id> </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 @@ method to re-authenticate the user within your app. </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 668f80a9b21b..13714d3517ca 100644 --- a/media/java/android/media/MediaPlayer.java +++ b/media/java/android/media/MediaPlayer.java @@ -77,7 +77,6 @@ import java.util.Map; 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 @@ public class MediaPlayer implements SubtitleController.Listener 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 @@ public class MediaPlayer implements SubtitleController.Listener * @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 @@ public class MediaPlayer implements SubtitleController.Listener * * @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 @@ public class MediaPlayer implements SubtitleController.Listener * initialized. */ public void stop() throws IllegalStateException { - synchronized (mPreparing) { - mPreparing.set(false); - } stayAwake(false); _stop(); } @@ -1676,9 +1658,6 @@ public class MediaPlayer implements SubtitleController.Listener * at the same time. */ public void release() { - synchronized (mPreparing) { - mPreparing.set(false); - } stayAwake(false); updateSurfaceScreenOn(); mOnPreparedListener = null; @@ -1705,9 +1684,6 @@ public class MediaPlayer implements SubtitleController.Listener * 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 @@ public class MediaPlayer implements SubtitleController.Listener } 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 @@ public class MediaPlayer implements SubtitleController.Listener 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 9c6727869478..d8041f4bff04 100644 --- a/media/jni/android_media_MediaPlayer.cpp +++ b/media/jni/android_media_MediaPlayer.cpp @@ -1045,7 +1045,7 @@ static JNINativeMethod gMethods[] = { {"_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/res/anim/ic_signal_blink_1.xml b/packages/SystemUI/res/anim/ic_signal_blink_1.xml index ab1905af4e76..64580d189c0d 100644 --- a/packages/SystemUI/res/anim/ic_signal_blink_1.xml +++ b/packages/SystemUI/res/anim/ic_signal_blink_1.xml @@ -23,16 +23,16 @@ android:valueType="colorType"> <keyframe android:fraction="0.0" - android:value="@color/light_mode_icon_color_dual_tone_fill"/> + android:value="?attr/fillColor"/> <keyframe android:fraction="0.32" - android:value="@color/light_mode_icon_color_dual_tone_fill"/> + android:value="?attr/fillColor"/> <keyframe android:fraction="0.33" - android:value="@color/light_mode_icon_color_dual_tone_background"/> + android:value="?attr/backgroundColor"/> <keyframe android:fraction="1.0" - android:value="@color/light_mode_icon_color_dual_tone_background"/> + android:value="?attr/backgroundColor"/> </propertyValuesHolder> </objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_signal_blink_2.xml b/packages/SystemUI/res/anim/ic_signal_blink_2.xml index 1b7ace252ea3..f055cd078558 100644 --- a/packages/SystemUI/res/anim/ic_signal_blink_2.xml +++ b/packages/SystemUI/res/anim/ic_signal_blink_2.xml @@ -23,22 +23,22 @@ android:valueType="colorType"> <keyframe android:fraction="0.0" - android:value="@color/light_mode_icon_color_dual_tone_background"/> + android:value="?attr/backgroundColor"/> <keyframe android:fraction="0.32" - android:value="@color/light_mode_icon_color_dual_tone_background"/> + android:value="?attr/backgroundColor"/> <keyframe android:fraction="0.33" - android:value="@color/light_mode_icon_color_dual_tone_fill"/> + android:value="?attr/fillColor"/> <keyframe android:fraction="0.66" - android:value="@color/light_mode_icon_color_dual_tone_fill"/> + android:value="?attr/fillColor"/> <keyframe android:fraction="0.67" - android:value="@color/light_mode_icon_color_dual_tone_background"/> + android:value="?attr/backgroundColor"/> <keyframe android:fraction="1.0" - android:value="@color/light_mode_icon_color_dual_tone_background"/> + android:value="?attr/backgroundColor"/> </propertyValuesHolder> </objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_signal_blink_3.xml b/packages/SystemUI/res/anim/ic_signal_blink_3.xml index cee831c0d7d3..abcd77410220 100644 --- a/packages/SystemUI/res/anim/ic_signal_blink_3.xml +++ b/packages/SystemUI/res/anim/ic_signal_blink_3.xml @@ -23,16 +23,16 @@ android:valueType="colorType"> <keyframe android:fraction="0.0" - android:value="@color/light_mode_icon_color_dual_tone_background"/> + android:value="?attr/backgroundColor"/> <keyframe android:fraction="0.66" - android:value="@color/light_mode_icon_color_dual_tone_background"/> + android:value="?attr/backgroundColor"/> <keyframe android:fraction="0.67" - android:value="@color/light_mode_icon_color_dual_tone_fill"/> + android:value="?attr/fillColor"/> <keyframe android:fraction="1.0" - android:value="@color/light_mode_icon_color_dual_tone_fill"/> + android:value="?attr/fillColor"/> </propertyValuesHolder> </objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_signal_dark_blink_1.xml b/packages/SystemUI/res/anim/ic_signal_dark_blink_1.xml deleted file mode 100644 index 9d398faad706..000000000000 --- a/packages/SystemUI/res/anim/ic_signal_dark_blink_1.xml +++ /dev/null @@ -1,38 +0,0 @@ -<!-- - Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@android:anim/linear_interpolator" - android:duration="@integer/carrier_network_change_anim_time" - android:repeatCount="-1"> - - <propertyValuesHolder - android:propertyName="fillColor" - android:valueType="colorType"> - <keyframe - android:fraction="0.0" - android:value="@color/dark_mode_icon_color_dual_tone_fill"/> - <keyframe - android:fraction="0.32" - android:value="@color/dark_mode_icon_color_dual_tone_fill"/> - <keyframe - android:fraction="0.33" - android:value="@color/dark_mode_icon_color_dual_tone_background"/> - <keyframe - android:fraction="1.0" - android:value="@color/dark_mode_icon_color_dual_tone_background"/> - </propertyValuesHolder> - -</objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_signal_dark_blink_2.xml b/packages/SystemUI/res/anim/ic_signal_dark_blink_2.xml deleted file mode 100644 index c6e213d2848a..000000000000 --- a/packages/SystemUI/res/anim/ic_signal_dark_blink_2.xml +++ /dev/null @@ -1,44 +0,0 @@ -<!-- - Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@android:anim/linear_interpolator" - android:duration="@integer/carrier_network_change_anim_time" - android:repeatCount="-1"> - - <propertyValuesHolder - android:propertyName="fillColor" - android:valueType="colorType"> - <keyframe - android:fraction="0.0" - android:value="@color/dark_mode_icon_color_dual_tone_background"/> - <keyframe - android:fraction="0.32" - android:value="@color/dark_mode_icon_color_dual_tone_background"/> - <keyframe - android:fraction="0.33" - android:value="@color/dark_mode_icon_color_dual_tone_fill"/> - <keyframe - android:fraction="0.66" - android:value="@color/dark_mode_icon_color_dual_tone_fill"/> - <keyframe - android:fraction="0.67" - android:value="@color/dark_mode_icon_color_dual_tone_background"/> - <keyframe - android:fraction="1.0" - android:value="@color/dark_mode_icon_color_dual_tone_background"/> - </propertyValuesHolder> - -</objectAnimator> diff --git a/packages/SystemUI/res/anim/ic_signal_dark_blink_3.xml b/packages/SystemUI/res/anim/ic_signal_dark_blink_3.xml deleted file mode 100644 index dce148cf4100..000000000000 --- a/packages/SystemUI/res/anim/ic_signal_dark_blink_3.xml +++ /dev/null @@ -1,38 +0,0 @@ -<!-- - Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@android:anim/linear_interpolator" - android:duration="@integer/carrier_network_change_anim_time" - android:repeatCount="-1"> - - <propertyValuesHolder - android:propertyName="fillColor" - android:valueType="colorType"> - <keyframe - android:fraction="0.0" - android:value="@color/dark_mode_icon_color_dual_tone_background"/> - <keyframe - android:fraction="0.66" - android:value="@color/dark_mode_icon_color_dual_tone_background"/> - <keyframe - android:fraction="0.67" - android:value="@color/dark_mode_icon_color_dual_tone_fill"/> - <keyframe - android:fraction="1.0" - android:value="@color/dark_mode_icon_color_dual_tone_fill"/> - </propertyValuesHolder> - -</objectAnimator> diff --git a/packages/SystemUI/res/drawable/stat_sys_signal_dark_carrier_network_change_animation.xml b/packages/SystemUI/res/drawable/stat_sys_signal_dark_carrier_network_change_animation.xml deleted file mode 100644 index ff49d4cfdb13..000000000000 --- a/packages/SystemUI/res/drawable/stat_sys_signal_dark_carrier_network_change_animation.xml +++ /dev/null @@ -1,27 +0,0 @@ -<!-- - Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" - android:drawable="@drawable/stat_sys_signal_carrier_network_change" > - <target - android:name="dot1" - android:animation="@anim/ic_signal_dark_blink_1"/> - <target - android:name="dot2" - android:animation="@anim/ic_signal_dark_blink_2"/> - <target - android:name="dot3" - android:animation="@anim/ic_signal_dark_blink_3"/> -</animated-vector> diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index dcf0438b64ad..a9e8b383a8a0 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -162,10 +162,9 @@ public class CellularTile extends QSTile<QSTile.SignalState> { } @Override - public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, - int darkStatusIcon, int statusType, int qsType, boolean activityIn, - boolean activityOut, String typeContentDescription, String description, - boolean isWide, int subId) { + public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, + int qsType, boolean activityIn, boolean activityOut, String typeContentDescription, + String description, boolean isWide, int subId) { if (qsIcon == null) { // Not data sim, don't display. return; diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java index 3a97a417e419..5f151e87a680 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 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } // Start the focus animation when alt-tabbing - if (mConfig.launchedWithAltTab && !mConfig.launchedHasConfigurationChanged) { - TaskView tv = getChildViewForTask(mStack.getTasks().get(mFocusedTaskIndex)); + ArrayList<Task> tasks = mStack.getTasks(); + if (mConfig.launchedWithAltTab && !mConfig.launchedHasConfigurationChanged && + 0 <= mFocusedTaskIndex && mFocusedTaskIndex < tasks.size()) { + TaskView tv = getChildViewForTask(tasks.get(mFocusedTaskIndex)); if (tv != null) { tv.setFocusedTask(true); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java index 991bde52a254..a66f8ecb7ed8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java @@ -180,13 +180,12 @@ public class SignalClusterView } @Override - public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int darkStatusIcon, - int statusType, int qsType, boolean activityIn, boolean activityOut, - String typeContentDescription, String description, boolean isWide, int subId) { + public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, + int qsType, boolean activityIn, boolean activityOut, String typeContentDescription, + String description, boolean isWide, int subId) { PhoneState state = getOrInflateState(subId); state.mMobileVisible = statusIcon.visible; state.mMobileStrengthId = statusIcon.icon; - state.mMobileDarkStrengthId = darkStatusIcon; state.mMobileTypeId = statusType; state.mMobileDescription = statusIcon.contentDescription; state.mMobileTypeDescription = typeContentDescription; @@ -426,7 +425,7 @@ public class SignalClusterView private class PhoneState { private final int mSubId; private boolean mMobileVisible = false; - private int mMobileStrengthId = 0, mMobileDarkStrengthId = 0, mMobileTypeId = 0; + private int mMobileStrengthId = 0, mMobileTypeId = 0; private boolean mIsMobileTypeIconWide; private String mMobileDescription, mMobileTypeDescription; @@ -483,9 +482,8 @@ public class SignalClusterView mMobileDark.setPaddingRelative(mIsMobileTypeIconWide ? mWideTypeIconStartPadding : 0, 0, 0, 0); - if (DEBUG) Log.d(TAG, String.format("mobile: %s sig=%d dark=%d typ=%d", - (mMobileVisible ? "VISIBLE" : "GONE"), mMobileStrengthId, - mMobileDarkStrengthId, mMobileTypeId)); + if (DEBUG) Log.d(TAG, String.format("mobile: %s sig=%d typ=%d", + (mMobileVisible ? "VISIBLE" : "GONE"), mMobileStrengthId, mMobileTypeId)); mMobileType.setVisibility(mMobileTypeId != 0 ? View.VISIBLE : View.GONE); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java index 7f5219177e5f..e618cb87887d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CallbackHandler.java @@ -124,17 +124,16 @@ public class CallbackHandler extends Handler implements EmergencyListener, Signa @Override public void setMobileDataIndicators(final IconState statusIcon, final IconState qsIcon, - final int darkStatusIcon, final int statusType, final int qsType, - final boolean activityIn, final boolean activityOut, - final String typeContentDescription, final String description, final boolean isWide, - final int subId) { + final int statusType, final int qsType,final boolean activityIn, + final boolean activityOut, final String typeContentDescription, + final String description, final boolean isWide, final int subId) { post(new Runnable() { @Override public void run() { for (SignalCallback signalCluster : mSignalCallbacks) { - signalCluster.setMobileDataIndicators(statusIcon, qsIcon, darkStatusIcon, - statusType, qsType, activityIn, activityOut, typeContentDescription, - description, isWide, subId); + signalCluster.setMobileDataIndicators(statusIcon, qsIcon, statusType, qsType, + activityIn, activityOut, typeContentDescription, description, isWide, + subId); } } }); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index 0d5995325231..cfc95bfba372 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -117,7 +117,7 @@ public class MobileSignalController extends SignalController< public void setCarrierNetworkChangeMode(boolean carrierNetworkChangeMode) { mCurrentState.carrierNetworkChangeMode = carrierNetworkChangeMode; - notifyListenersIfNecessary(); + updateTelephony(); } /** @@ -220,13 +220,9 @@ public class MobileSignalController extends SignalController< && mCurrentState.activityOut; showDataIcon &= mCurrentState.isDefault; int typeIcon = showDataIcon ? icons.mDataType : 0; - mCallbackHandler.setMobileDataIndicators(statusIcon, qsIcon, getCurrentDarkIconId(), - typeIcon, qsTypeIcon, activityIn, activityOut, dataContentDescription, description, - icons.mIsWide, mSubscriptionInfo.getSubscriptionId()); - } - - private int getCurrentDarkIconId() { - return getCurrentIconId(false /* light */); + mCallbackHandler.setMobileDataIndicators(statusIcon, qsIcon, typeIcon, qsTypeIcon, + activityIn, activityOut, dataContentDescription, description, icons.mIsWide, + mSubscriptionInfo.getSubscriptionId()); } @Override @@ -478,17 +474,8 @@ public class MobileSignalController extends SignalController< int sbNullState, int qsNullState, int sbDiscState, int qsDiscState, int discContentDesc, int dataContentDesc, int dataType, boolean isWide, int qsDataType) { - this(name, sbIcons, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, - sbDiscState, sbDiscState, qsDiscState, discContentDesc, dataContentDesc, - dataType, isWide, qsDataType); - } - - public MobileIconGroup(String name, int[][] sbIcons, int[][] sbDarkIcons, int[][] qsIcons, - int[] contentDesc, int sbNullState, int qsNullState, int sbDiscState, - int sbDarkDiscState, int qsDiscState, int discContentDesc, int dataContentDesc, - int dataType, boolean isWide, int qsDataType) { - super(name, sbIcons, sbDarkIcons, qsIcons, contentDesc, sbNullState, qsNullState, - sbDiscState, sbDarkDiscState, qsDiscState, discContentDesc); + super(name, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, sbDiscState, + qsDiscState, discContentDesc); mDataContentDescription = dataContentDesc; mDataType = dataType; mIsWide = isWide; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java index 070ca637d31e..38656ee0781e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -38,9 +38,9 @@ public interface NetworkController { void setWifiIndicators(boolean enabled, IconState statusIcon, IconState qsIcon, boolean activityIn, boolean activityOut, String description); - void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int darkStatusIcon, - int statusType, int qsType, boolean activityIn, boolean activityOut, - String typeContentDescription, String description, boolean isWide, int subId); + void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, + int qsType, boolean activityIn, boolean activityOut, String typeContentDescription, + String description, boolean isWide, int subId); void setSubs(List<SubscriptionInfo> subs); void setNoSims(boolean show); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalCallbackAdapter.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalCallbackAdapter.java index 83a7d3dd42fe..dce889f831da 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalCallbackAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalCallbackAdapter.java @@ -35,10 +35,9 @@ public class SignalCallbackAdapter implements SignalCallback { } @Override - public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, - int darkStatusIcon, int statusType, int qsType, boolean activityIn, - boolean activityOut, String typeContentDescription, String description, - boolean isWide, int subId) { + public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType, + int qsType, boolean activityIn, boolean activityOut, String typeContentDescription, + String description, boolean isWide, int subId) { } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java index e6ca64692079..5e9447e57170 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java @@ -133,22 +133,10 @@ public abstract class SignalController<T extends SignalController.State, * Gets the signal icon for SB based on current state of connected, enabled, and level. */ public int getCurrentIconId() { - return getCurrentIconId(true /* light */); - } - - protected int getCurrentIconId(boolean light) { if (mCurrentState.connected) { - if (light) { - return getIcons().mSbIcons[mCurrentState.inetCondition][mCurrentState.level]; - } else { - return getIcons().mSbDarkIcons[mCurrentState.inetCondition][mCurrentState.level]; - } + return getIcons().mSbIcons[mCurrentState.inetCondition][mCurrentState.level]; } else if (mCurrentState.enabled) { - if (light) { - return getIcons().mSbDiscState; - } else { - return getIcons().mSbDarkDiscState; - } + return getIcons().mSbDiscState; } else { return getIcons().mSbNullState; } @@ -229,13 +217,11 @@ public abstract class SignalController<T extends SignalController.State, */ static class IconGroup { final int[][] mSbIcons; - final int[][] mSbDarkIcons; final int[][] mQsIcons; final int[] mContentDesc; final int mSbNullState; final int mQsNullState; final int mSbDiscState; - final int mSbDarkDiscState; final int mQsDiscState; final int mDiscContentDesc; // For logging. @@ -244,22 +230,13 @@ public abstract class SignalController<T extends SignalController.State, public IconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc, int sbNullState, int qsNullState, int sbDiscState, int qsDiscState, int discContentDesc) { - this(name, sbIcons, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, - sbDiscState, sbDiscState, qsDiscState, discContentDesc); - } - - public IconGroup(String name, int[][] sbIcons, int[][] sbDarkIcons, int[][] qsIcons, - int[] contentDesc, int sbNullState, int qsNullState, int sbDiscState, - int sbDarkDiscState, int qsDiscState, int discContentDesc) { mName = name; mSbIcons = sbIcons; - mSbDarkIcons = sbDarkIcons; mQsIcons = qsIcons; mContentDesc = contentDesc; mSbNullState = sbNullState; mQsNullState = qsNullState; mSbDiscState = sbDiscState; - mSbDarkDiscState = sbDarkDiscState; mQsDiscState = qsDiscState; mDiscContentDesc = discContentDesc; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java index fa4d46434808..8a27653b8673 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java @@ -73,24 +73,15 @@ class TelephonyIcons { { R.drawable.stat_sys_signal_carrier_network_change_animation, R.drawable.stat_sys_signal_carrier_network_change_animation, R.drawable.stat_sys_signal_carrier_network_change_animation, + R.drawable.stat_sys_signal_carrier_network_change_animation, R.drawable.stat_sys_signal_carrier_network_change_animation }, { R.drawable.stat_sys_signal_carrier_network_change_animation, R.drawable.stat_sys_signal_carrier_network_change_animation, R.drawable.stat_sys_signal_carrier_network_change_animation, + R.drawable.stat_sys_signal_carrier_network_change_animation, R.drawable.stat_sys_signal_carrier_network_change_animation } }; - static final int[][] TELEPHONY_CARRIER_NETWORK_CHANGE_DARK = { - { R.drawable.stat_sys_signal_dark_carrier_network_change_animation, - R.drawable.stat_sys_signal_dark_carrier_network_change_animation, - R.drawable.stat_sys_signal_dark_carrier_network_change_animation, - R.drawable.stat_sys_signal_dark_carrier_network_change_animation }, - { R.drawable.stat_sys_signal_dark_carrier_network_change_animation, - R.drawable.stat_sys_signal_dark_carrier_network_change_animation, - R.drawable.stat_sys_signal_dark_carrier_network_change_animation, - R.drawable.stat_sys_signal_dark_carrier_network_change_animation } - }; - static final int[][] QS_TELEPHONY_CARRIER_NETWORK_CHANGE = { { R.drawable.ic_qs_signal_carrier_network_change_animation, R.drawable.ic_qs_signal_carrier_network_change_animation, @@ -216,8 +207,6 @@ class TelephonyIcons { static final int ICON_1X = R.drawable.stat_sys_data_fully_connected_1x; static final int ICON_CARRIER_NETWORK_CHANGE = R.drawable.stat_sys_signal_carrier_network_change_animation; - static final int ICON_CARRIER_NETWORK_CHANGE_DARK = - R.drawable.stat_sys_signal_dark_carrier_network_change_animation; static final int QS_ICON_LTE = R.drawable.ic_qs_signal_lte; static final int QS_ICON_3G = R.drawable.ic_qs_signal_3g; @@ -229,12 +218,10 @@ class TelephonyIcons { static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup( "CARRIER_NETWORK_CHANGE", TelephonyIcons.TELEPHONY_CARRIER_NETWORK_CHANGE, - TelephonyIcons.TELEPHONY_CARRIER_NETWORK_CHANGE_DARK, TelephonyIcons.QS_TELEPHONY_CARRIER_NETWORK_CHANGE, AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH, 0, 0, TelephonyIcons.ICON_CARRIER_NETWORK_CHANGE, - TelephonyIcons.ICON_CARRIER_NETWORK_CHANGE_DARK, TelephonyIcons.QS_ICON_CARRIER_NETWORK_CHANGE, AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0], R.string.accessibility_carrier_network_change_mode, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java index c14d06f04cc4..5055bfefe889 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java @@ -94,7 +94,6 @@ public class CallbackHandlerTest extends AndroidTestCase { public void testSignalCallback_setMobileDataIndicators() { IconState status = new IconState(true, 0, ""); IconState qs = new IconState(true, 1, ""); - int dark = 2; boolean in = true; boolean out = true; String typeDescription = "Test 1"; @@ -103,13 +102,12 @@ public class CallbackHandlerTest extends AndroidTestCase { int qsType = R.drawable.ic_qs_signal_1x; boolean wide = true; int subId = 5; - mHandler.setMobileDataIndicators(status, qs, dark, type, qsType, in, out, typeDescription, + mHandler.setMobileDataIndicators(status, qs, type, qsType, in, out, typeDescription, description, wide, subId); waitForCallbacks(); ArgumentCaptor<IconState> statusArg = ArgumentCaptor.forClass(IconState.class); ArgumentCaptor<IconState> qsArg = ArgumentCaptor.forClass(IconState.class); - ArgumentCaptor<Integer> darkStrengthArg = ArgumentCaptor.forClass(Integer.class); ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class); ArgumentCaptor<Integer> qsTypeIconArg = ArgumentCaptor.forClass(Integer.class); ArgumentCaptor<Boolean> inArg = ArgumentCaptor.forClass(Boolean.class); @@ -118,13 +116,12 @@ public class CallbackHandlerTest extends AndroidTestCase { ArgumentCaptor<String> descArg = ArgumentCaptor.forClass(String.class); ArgumentCaptor<Boolean> wideArg = ArgumentCaptor.forClass(Boolean.class); ArgumentCaptor<Integer> subIdArg = ArgumentCaptor.forClass(Integer.class); - Mockito.verify(mSignalCallback).setMobileDataIndicators(statusArg.capture(), qsArg.capture(), - darkStrengthArg.capture(), typeIconArg.capture(), qsTypeIconArg.capture(), - inArg.capture(), outArg.capture(), typeContentArg.capture(), descArg.capture(), - wideArg.capture(), subIdArg.capture()); + Mockito.verify(mSignalCallback).setMobileDataIndicators(statusArg.capture(), + qsArg.capture(), typeIconArg.capture(), qsTypeIconArg.capture(), inArg.capture(), + outArg.capture(), typeContentArg.capture(), descArg.capture(), wideArg.capture(), + subIdArg.capture()); assertEquals(status, statusArg.getValue()); assertEquals(qs, qsArg.getValue()); - assertEquals(dark, (int) darkStrengthArg.getValue()); assertEquals(type, (int) typeIconArg.getValue()); assertEquals(qsType, (int) qsTypeIconArg.getValue()); assertEquals(in, (boolean) inArg.getValue()); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java index 2d6bb68a03a3..441bb168a30b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java @@ -258,7 +258,6 @@ public class NetworkControllerBaseTest extends SysuiTestCase { ArgumentCaptor.forClass(IconState.class).capture(), iconArg.capture(), ArgumentCaptor.forClass(Integer.class).capture(), - ArgumentCaptor.forClass(Integer.class).capture(), typeIconArg.capture(), dataInArg.capture(), dataOutArg.capture(), ArgumentCaptor.forClass(String.class).capture(), ArgumentCaptor.forClass(String.class).capture(), @@ -275,20 +274,14 @@ public class NetworkControllerBaseTest extends SysuiTestCase { } protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon) { - verifyLastMobileDataIndicators(visible, icon, icon, typeIcon); - } - - protected void verifyLastMobileDataIndicators(boolean visible, int strengthIcon, - int darkStrengthIcon, int typeIcon) { ArgumentCaptor<IconState> iconArg = ArgumentCaptor.forClass(IconState.class); - ArgumentCaptor<Integer> darkStrengthIconArg = ArgumentCaptor.forClass(Integer.class); ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class); // TODO: Verify all fields. Mockito.verify(mCallbackHandler, Mockito.atLeastOnce()).setMobileDataIndicators( iconArg.capture(), ArgumentCaptor.forClass(IconState.class).capture(), - darkStrengthIconArg.capture(), typeIconArg.capture(), + typeIconArg.capture(), ArgumentCaptor.forClass(Integer.class).capture(), ArgumentCaptor.forClass(Boolean.class).capture(), ArgumentCaptor.forClass(Boolean.class).capture(), @@ -298,9 +291,6 @@ public class NetworkControllerBaseTest extends SysuiTestCase { ArgumentCaptor.forClass(Integer.class).capture()); IconState iconState = iconArg.getValue(); - assertEquals("Signal strength icon in status bar", strengthIcon, iconState.icon); - assertEquals("Signal strength icon (dark mode) in status bar", darkStrengthIcon, - (int) darkStrengthIconArg.getValue()); assertEquals("Data icon in status bar", typeIcon, (int) typeIconArg.getValue()); assertEquals("Visibility in status bar", visible, iconState.visible); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java index 874fdf90916f..dd6f272404a5 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java @@ -438,7 +438,6 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest { // Out of service and carrier network change is true, show special indicator verifyLastMobileDataIndicators(true /* visible */, TelephonyIcons.TELEPHONY_CARRIER_NETWORK_CHANGE[0][0] /* strengthIcon */, - TelephonyIcons.TELEPHONY_CARRIER_NETWORK_CHANGE_DARK[0][0] /* darkStrengthIcon */, 0 /* typeIcon */); // Revert back diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java index 70a5821bd6a3..bea138e73dbf 100644 --- a/rs/java/android/renderscript/Allocation.java +++ b/rs/java/android/renderscript/Allocation.java @@ -1052,6 +1052,7 @@ public class Allocation extends BaseObj { mSelectedLOD, mSelectedFace.mID, count, 1, data.getID(mRS), dataOff, 0, data.mSelectedLOD, data.mSelectedFace.mID); + Trace.traceEnd(RenderScript.TRACE_TAG); } private void validate2DRange(int xoff, int yoff, int w, int h) { @@ -1213,19 +1214,22 @@ public class Allocation extends BaseObj { * @param data the Bitmap to be copied */ public void copy2DRangeFrom(int xoff, int yoff, Bitmap data) { - Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFrom"); - mRS.validate(); - if (data.getConfig() == null) { - Bitmap newBitmap = Bitmap.createBitmap(data.getWidth(), data.getHeight(), Bitmap.Config.ARGB_8888); - Canvas c = new Canvas(newBitmap); - c.drawBitmap(data, 0, 0, null); - copy2DRangeFrom(xoff, yoff, newBitmap); - return; + try { + Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFrom"); + mRS.validate(); + if (data.getConfig() == null) { + Bitmap newBitmap = Bitmap.createBitmap(data.getWidth(), data.getHeight(), Bitmap.Config.ARGB_8888); + Canvas c = new Canvas(newBitmap); + c.drawBitmap(data, 0, 0, null); + copy2DRangeFrom(xoff, yoff, newBitmap); + return; + } + validateBitmapFormat(data); + validate2DRange(xoff, yoff, data.getWidth(), data.getHeight()); + mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, data); + } finally { + Trace.traceEnd(RenderScript.TRACE_TAG); } - validateBitmapFormat(data); - validate2DRange(xoff, yoff, data.getWidth(), data.getHeight()); - mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, data); - Trace.traceEnd(RenderScript.TRACE_TAG); } private void validate3DRange(int xoff, int yoff, int zoff, int w, int h, int d) { diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java index 35bdceb34b90..8834497f2f9b 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.IVoiceInteractionService; 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 @@ public class VoiceInteractionManagerService extends SystemService { 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 111737335874..b4629f252bb7 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.provider.Settings; 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 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { 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 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { 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 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { 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 9db0b92ef8a3..b18feb53f995 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -295,6 +295,13 @@ public abstract class Conference extends Conferenceable { } /** + * 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 f9e48b6ff61d..e2bbc6274cbe 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -22,6 +22,7 @@ import com.android.internal.telecom.IVideoProvider; 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 abstract class Connection extends Conferenceable { 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 @@ public abstract class Connection extends Conferenceable { } /** - * 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 @@ public abstract class Connection extends Conferenceable { * 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 @@ public abstract class Connection extends Conferenceable { /** * 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 @@ public abstract class Connection extends Conferenceable { } /** - * 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 @@ public abstract class Connection extends Conferenceable { } /** - * 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 @@ public abstract class Connection extends Conferenceable { } /** - * 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 @@ public abstract class Connection extends Conferenceable { } /** - * 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 @@ public abstract class Connection extends Conferenceable { } /** - * 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 @@ public abstract class Connection extends Conferenceable { } /** - * 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 @@ public abstract class Connection extends Conferenceable { } /** - * Invokes callback method defined in listening {@link InCallService} implementations. - * - * Allowed values: - * {@link VideoProfile#QUALITY_HIGH}, - * {@link VideoProfile#QUALITY_MEDIUM}, - * {@link VideoProfile#QUALITY_LOW}, - * {@link VideoProfile#QUALITY_DEFAULT}. + * 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)}. * - * @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 e37cff763b34..f7f442549cdb 100644 --- a/telecomm/java/android/telecom/InCallService.java +++ b/telecomm/java/android/telecom/InCallService.java @@ -20,6 +20,7 @@ import android.annotation.SdkConstant; 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 @@ public abstract class InCallService extends Service { } /** - * 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 class InCallService extends Service { 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 @@ public abstract class InCallService extends Service { * 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 @@ public abstract class InCallService extends Service { /** * 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 @@ public abstract class InCallService extends Service { /** * 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 0b522c0578bb..e4ea0bc1c31e 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 @@ public class AssistInteractionSession extends VoiceInteractionSession { @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 15196b442738..578e356461d6 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; 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 @@ public class MainInteractionService extends VoiceInteractionService { 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 70a633693661..f66a9ce63c13 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 @@ public class MainInteractionSession extends VoiceInteractionSession @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); } |