summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorTim Kilbourn <tkilbourn@google.com>2015-06-05 16:18:09 -0700
committerTim Kilbourn <tkilbourn@google.com>2015-06-05 23:26:39 +0000
commit0e5f110fc915a9b044eb04cd07ae7ac588eacc8f (patch)
treee671eecf7529eff338bb38d8638d82d01814e938 /core/java
parent3e85c1ed0cce70164dfe6f8ffa4bf3695c4ce0ba (diff)
downloadframeworks_base-0e5f110fc915a9b044eb04cd07ae7ac588eacc8f.zip
frameworks_base-0e5f110fc915a9b044eb04cd07ae7ac588eacc8f.tar.gz
frameworks_base-0e5f110fc915a9b044eb04cd07ae7ac588eacc8f.tar.bz2
Pass an args bundle to launchAssistAction.
In order to track the input device that was used to trigger assist, the input device id is sent as an extra in the assist intent whenever it is available. This is particularly useful on TVs, when an app may want to know whether the input device has a microphone. Bug: 21666123 Change-Id: I0f8c09e2f617606bef481bdff924cb6b9b47dd12
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ActivityManagerNative.java8
-rw-r--r--core/java/android/app/IActivityManager.java4
-rw-r--r--core/java/android/app/ISearchManager.aidl2
-rw-r--r--core/java/android/app/SearchManager.java4
-rw-r--r--core/java/android/content/Intent.java7
-rw-r--r--core/java/com/android/internal/policy/PhoneWindow.java5
6 files changed, 21 insertions, 9 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index b6cec60..9112f12 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -2208,7 +2208,8 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
int requestType = data.readInt();
String hint = data.readString();
int userHandle = data.readInt();
- boolean res = launchAssistIntent(intent, requestType, hint, userHandle);
+ Bundle args = data.readBundle();
+ boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
reply.writeNoException();
reply.writeInt(res ? 1 : 0);
return true;
@@ -5378,8 +5379,8 @@ class ActivityManagerProxy implements IActivityManager
reply.recycle();
}
- public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
- throws RemoteException {
+ public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
+ Bundle args) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
@@ -5387,6 +5388,7 @@ class ActivityManagerProxy implements IActivityManager
data.writeInt(requestType);
data.writeString(hint);
data.writeInt(userHandle);
+ data.writeBundle(args);
mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
reply.readException();
boolean res = reply.readInt() != 0;
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 249cdb2..6d84229 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -438,8 +438,8 @@ public interface IActivityManager extends IInterface {
public void reportAssistContextExtras(IBinder token, Bundle extras,
AssistStructure structure, AssistContent content) throws RemoteException;
- public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
- throws RemoteException;
+ public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
+ Bundle args) throws RemoteException;
public void killUid(int uid, String reason) throws RemoteException;
diff --git a/core/java/android/app/ISearchManager.aidl b/core/java/android/app/ISearchManager.aidl
index 6d27910..6094012 100644
--- a/core/java/android/app/ISearchManager.aidl
+++ b/core/java/android/app/ISearchManager.aidl
@@ -31,5 +31,5 @@ interface ISearchManager {
ComponentName getGlobalSearchActivity();
ComponentName getWebSearchActivity();
ComponentName getAssistIntent(int userHandle);
- boolean launchAssistAction(String hint, int userHandle);
+ boolean launchAssistAction(String hint, int userHandle, in Bundle args);
}
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index fa27631..45799a1 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -985,12 +985,12 @@ public class SearchManager
* Launch an assist action for the current top activity.
* @hide
*/
- public boolean launchAssistAction(String hint, int userHandle) {
+ public boolean launchAssistAction(String hint, int userHandle, Bundle args) {
try {
if (mService == null) {
return false;
}
- return mService.launchAssistAction(hint, userHandle);
+ return mService.launchAssistAction(hint, userHandle, args);
} catch (RemoteException re) {
Log.e(TAG, "launchAssistAction() failed: " + re);
return false;
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index c01ce4f..5c23204 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1274,6 +1274,13 @@ public class Intent implements Parcelable, Cloneable {
"android.intent.extra.ASSIST_INPUT_HINT_KEYBOARD";
/**
+ * An optional field on {@link #ACTION_ASSIST} containing the InputDevice id
+ * that was used to invoke the assist.
+ */
+ public static final String EXTRA_ASSIST_INPUT_DEVICE_ID =
+ "android.intent.extra.ASSIST_INPUT_DEVICE_ID";
+
+ /**
* Activity Action: List all available applications
* <p>Input: Nothing.
* <p>Output: nothing.
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index 14065b1..c010dfe 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -75,6 +75,7 @@ import com.android.internal.widget.SwipeDismissLayout;
import android.app.ActivityManager;
import android.app.KeyguardManager;
import android.content.Context;
+import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources.Theme;
@@ -4319,8 +4320,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if (!result && (getContext().getResources().getConfiguration().uiMode
& Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_TELEVISION) {
// On TVs, if the app doesn't implement search, we want to launch assist.
+ Bundle args = new Bundle();
+ args.putInt(Intent.EXTRA_ASSIST_INPUT_DEVICE_ID, event.getDeviceId());
return ((SearchManager)getContext().getSystemService(Context.SEARCH_SERVICE))
- .launchAssistAction(null, UserHandle.myUserId());
+ .launchAssistAction(null, UserHandle.myUserId(), args);
}
return result;
}