Merge "Bring back screenshot API." into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d1419ed29a
@@ -28909,6 +28909,7 @@ package android.service.voice {
|
||||
method public void onDestroy();
|
||||
method public boolean[] onGetSupportedCommands(java.lang.String[]);
|
||||
method public void onHandleAssist(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent);
|
||||
method public void onHandleScreenshot(android.graphics.Bitmap);
|
||||
method public void onHide();
|
||||
method public boolean onKeyDown(int, android.view.KeyEvent);
|
||||
method public boolean onKeyLongPress(int, android.view.KeyEvent);
|
||||
@@ -28931,6 +28932,7 @@ package android.service.voice {
|
||||
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
|
||||
field public static final int SHOW_WITH_SCREENSHOT = 2; // 0x2
|
||||
}
|
||||
|
||||
public static final class VoiceInteractionSession.AbortVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
|
||||
|
||||
@@ -31046,6 +31046,7 @@ package android.service.voice {
|
||||
method public void onDestroy();
|
||||
method public boolean[] onGetSupportedCommands(java.lang.String[]);
|
||||
method public void onHandleAssist(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent);
|
||||
method public void onHandleScreenshot(android.graphics.Bitmap);
|
||||
method public void onHide();
|
||||
method public boolean onKeyDown(int, android.view.KeyEvent);
|
||||
method public boolean onKeyLongPress(int, android.view.KeyEvent);
|
||||
@@ -31068,6 +31069,7 @@ package android.service.voice {
|
||||
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
|
||||
field public static final int SHOW_WITH_SCREENSHOT = 2; // 0x2
|
||||
}
|
||||
|
||||
public static final class VoiceInteractionSession.AbortVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
|
||||
|
||||
@@ -80,7 +80,6 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
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.
|
||||
*/
|
||||
@@ -1162,7 +1161,6 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
onHandleAssist(data);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public void onHandleScreenshot(Bitmap screenshot) {
|
||||
}
|
||||
|
||||
|
||||
@@ -180,8 +180,6 @@ final class VoiceInteractionSessionConnection implements ServiceConnection {
|
||||
|
||||
public boolean showLocked(Bundle args, int flags,
|
||||
IVoiceInteractionSessionShowCallback showCallback) {
|
||||
// For now we never allow screenshots.
|
||||
flags &= ~VoiceInteractionSession.SHOW_WITH_SCREENSHOT;
|
||||
if (mBound) {
|
||||
if (!mFullyBound) {
|
||||
mFullyBound = mContext.bindServiceAsUser(mBindIntent, mFullConnection,
|
||||
@@ -190,13 +188,15 @@ final class VoiceInteractionSessionConnection implements ServiceConnection {
|
||||
new UserHandle(mUser));
|
||||
}
|
||||
mShown = true;
|
||||
boolean allDataEnabled = Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
||||
Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1, mUser) != 0;
|
||||
mShowArgs = args;
|
||||
mShowFlags = flags;
|
||||
mHaveAssistData = false;
|
||||
if ((flags& VoiceInteractionSession.SHOW_WITH_ASSIST) != 0) {
|
||||
if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ASSIST_STRUCTURE, mCallingUid,
|
||||
mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED
|
||||
&& isStructureEnabled()) {
|
||||
&& allDataEnabled) {
|
||||
try {
|
||||
mAm.requestAssistContextExtras(ActivityManager.ASSIST_CONTEXT_FULL,
|
||||
mAssistReceiver);
|
||||
@@ -212,7 +212,8 @@ final class VoiceInteractionSessionConnection implements ServiceConnection {
|
||||
mHaveScreenshot = false;
|
||||
if ((flags& VoiceInteractionSession.SHOW_WITH_SCREENSHOT) != 0) {
|
||||
if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ASSIST_SCREENSHOT, mCallingUid,
|
||||
mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED) {
|
||||
mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED
|
||||
&& allDataEnabled) {
|
||||
try {
|
||||
mIWindowManager.requestAssistScreenshot(mScreenshotReceiver);
|
||||
} catch (RemoteException e) {
|
||||
@@ -466,11 +467,6 @@ final class VoiceInteractionSessionConnection implements ServiceConnection {
|
||||
mService = null;
|
||||
}
|
||||
|
||||
private boolean isStructureEnabled() {
|
||||
return Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
||||
Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1, mUser) != 0;
|
||||
}
|
||||
|
||||
public void dump(String prefix, PrintWriter pw) {
|
||||
pw.print(prefix); pw.print("mToken="); pw.println(mToken);
|
||||
pw.print(prefix); pw.print("mShown="); pw.println(mShown);
|
||||
|
||||
Reference in New Issue
Block a user