summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-03-16 17:15:53 -0700
committerDianne Hackborn <hackbod@google.com>2015-03-17 16:45:51 -0700
commit27eac1d58fe0b7ca3a2e27f5ed64eff232745f45 (patch)
treec1f0dc2a368ab1c7db1be81dc02b020eea0d1628 /core/java/android
parent7438f814f16ff1ced53d93a2fe9e3973490f3843 (diff)
downloadframeworks_base-27eac1d58fe0b7ca3a2e27f5ed64eff232745f45.zip
frameworks_base-27eac1d58fe0b7ca3a2e27f5ed64eff232745f45.tar.gz
frameworks_base-27eac1d58fe0b7ca3a2e27f5ed64eff232745f45.tar.bz2
Add ability to get a screenshot for assist.
New flag you pass in to startSession() to say you want it, new callback on VoiceInteractionSession to receive it. Change-Id: I61fdcfdee41a60d46036a2ef16681a9b4181115a
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/service/voice/IVoiceInteractionSession.aidl2
-rw-r--r--core/java/android/service/voice/VoiceInteractionService.java8
-rw-r--r--core/java/android/service/voice/VoiceInteractionSession.java21
-rw-r--r--core/java/android/view/IWindowManager.aidl9
4 files changed, 34 insertions, 6 deletions
diff --git a/core/java/android/service/voice/IVoiceInteractionSession.aidl b/core/java/android/service/voice/IVoiceInteractionSession.aidl
index 797457a..4f4b2d5 100644
--- a/core/java/android/service/voice/IVoiceInteractionSession.aidl
+++ b/core/java/android/service/voice/IVoiceInteractionSession.aidl
@@ -17,6 +17,7 @@
package android.service.voice;
import android.content.Intent;
+import android.graphics.Bitmap;
import android.os.Bundle;
/**
@@ -26,6 +27,7 @@ oneway interface IVoiceInteractionSession {
void show(in Bundle sessionArgs, int flags);
void hide();
void handleAssist(in Bundle assistData);
+ void handleScreenshot(in Bitmap screenshot);
void taskStarted(in Intent intent, int taskId);
void taskFinished(in Intent intent, int taskId);
void closeSystemDialogs();
diff --git a/core/java/android/service/voice/VoiceInteractionService.java b/core/java/android/service/voice/VoiceInteractionService.java
index 0c01b25..419b92b 100644
--- a/core/java/android/service/voice/VoiceInteractionService.java
+++ b/core/java/android/service/voice/VoiceInteractionService.java
@@ -71,11 +71,17 @@ 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
+ * 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;
+ /**
+ * 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;
+
IVoiceInteractionService mInterface = new IVoiceInteractionService.Stub() {
@Override public void ready() {
mHandler.sendEmptyMessage(MSG_READY);
diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java
index 11eaa06..7a5bb90 100644
--- a/core/java/android/service/voice/VoiceInteractionSession.java
+++ b/core/java/android/service/voice/VoiceInteractionSession.java
@@ -22,6 +22,7 @@ import android.app.VoiceInteractor;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
+import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.Region;
import android.inputmethodservice.SoftInputWindow;
@@ -179,6 +180,12 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback {
}
@Override
+ public void handleScreenshot(Bitmap screenshot) {
+ mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_HANDLE_SCREENSHOT,
+ screenshot));
+ }
+
+ @Override
public void taskStarted(Intent intent, int taskId) {
mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageIO(MSG_TASK_STARTED,
taskId, intent));
@@ -323,8 +330,9 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback {
static final int MSG_CLOSE_SYSTEM_DIALOGS = 102;
static final int MSG_DESTROY = 103;
static final int MSG_HANDLE_ASSIST = 104;
- static final int MSG_SHOW = 105;
- static final int MSG_HIDE = 106;
+ static final int MSG_HANDLE_SCREENSHOT = 105;
+ static final int MSG_SHOW = 106;
+ static final int MSG_HIDE = 107;
class MyCallbacks implements HandlerCaller.Callback, SoftInputWindow.Callback {
@Override
@@ -396,9 +404,13 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback {
doDestroy();
break;
case MSG_HANDLE_ASSIST:
- if (DEBUG) Log.d(TAG, "onHandleAssist: " + (Bundle)msg.obj);
+ if (DEBUG) Log.d(TAG, "onHandleAssist: " + msg.obj);
onHandleAssist((Bundle) msg.obj);
break;
+ case MSG_HANDLE_SCREENSHOT:
+ if (DEBUG) Log.d(TAG, "onHandleScreenshot: " + msg.obj);
+ onHandleScreenshot((Bitmap) msg.obj);
+ break;
case MSG_SHOW:
if (DEBUG) Log.d(TAG, "doShow: args=" + msg.obj
+ " flags=" + msg.arg1);
@@ -768,6 +780,9 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback {
public void onHandleAssist(Bundle assistBundle) {
}
+ public void onHandleScreenshot(Bitmap screenshot) {
+ }
+
public boolean onKeyDown(int keyCode, KeyEvent event) {
return false;
}
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 8ac8bc5..d6625c8 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -16,6 +16,7 @@
package android.view;
+import com.android.internal.app.IAssistScreenshotReceiver;
import com.android.internal.view.IInputContext;
import com.android.internal.view.IInputMethodClient;
@@ -220,10 +221,14 @@ interface IWindowManager
boolean isRotationFrozen();
/**
+ * Used only for assist -- request a screenshot of the current application.
+ */
+ boolean requestAssistScreenshot(IAssistScreenshotReceiver receiver);
+
+ /**
* Create a screenshot of the applications currently displayed.
*/
- Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth,
- int maxHeight, boolean force565);
+ Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight);
/**
* Called by the status bar to notify Views of changes to System UI visiblity.