summaryrefslogtreecommitdiffstats
path: root/core/java/android/app/Instrumentation.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-06-08 17:07:40 -0700
committerDianne Hackborn <hackbod@google.com>2015-06-09 14:15:49 -0700
commita3acdb33df7c7be7ff3d9f376ff833e4b0c1d897 (patch)
tree452c3cd2b7a2706fcbdcd1432e820c71e31b13bb /core/java/android/app/Instrumentation.java
parentea7438e4a698945b3e3a7786cff726c337291a68 (diff)
downloadframeworks_base-a3acdb33df7c7be7ff3d9f376ff833e4b0c1d897.zip
frameworks_base-a3acdb33df7c7be7ff3d9f376ff833e4b0c1d897.tar.gz
frameworks_base-a3acdb33df7c7be7ff3d9f376ff833e4b0c1d897.tar.bz2
Fix issue #21621920: VI: need mechanism to get current request
Add new APIs to associate a Request with a name, get all active requests, and get active request by name. Also add a new Activity.onProvideReferrer() which will allow applications to propagate referrer information to the assistant (and other apps they launch) in a consistent way. Change-Id: I4ef74b5ed07447da9303a74a1bdf42e4966df363
Diffstat (limited to 'core/java/android/app/Instrumentation.java')
-rw-r--r--core/java/android/app/Instrumentation.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java
index 0cc57ba..653f1b6 100644
--- a/core/java/android/app/Instrumentation.java
+++ b/core/java/android/app/Instrumentation.java
@@ -24,6 +24,7 @@ import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.hardware.input.InputManager;
+import android.net.Uri;
import android.os.Bundle;
import android.os.Debug;
import android.os.IBinder;
@@ -1439,7 +1440,7 @@ public class Instrumentation {
* objects and dispatches this call to the system activity manager; you can
* override this to watch for the application to start an activity, and
* modify what happens when it does.
- *
+ *
* <p>This method returns an {@link ActivityResult} object, which you can
* use when intercepting application calls to avoid performing the start
* activity action but still return the result the application is
@@ -1448,10 +1449,10 @@ public class Instrumentation {
* you would like the application to see, and don't call up to the super
* class. Note that an application is only expecting a result if
* <var>requestCode</var> is &gt;= 0.
- *
+ *
* <p>This method throws {@link android.content.ActivityNotFoundException}
* if there was no Activity found to run the given Intent.
- *
+ *
* @param who The Context from which the activity is being started.
* @param contextThread The main thread of the Context from which the activity
* is being started.
@@ -1464,23 +1465,27 @@ public class Instrumentation {
* @param requestCode Identifier for this request's result; less than zero
* if the caller is not expecting a result.
* @param options Addition options.
- *
+ *
* @return To force the return of a particular result, return an
* ActivityResult object containing the desired data; otherwise
* return null. The default implementation always returns null.
- *
+ *
* @throws android.content.ActivityNotFoundException
- *
+ *
* @see Activity#startActivity(Intent)
* @see Activity#startActivityForResult(Intent, int)
* @see Activity#startActivityFromChild
- *
+ *
* {@hide}
*/
public ActivityResult execStartActivity(
Context who, IBinder contextThread, IBinder token, Activity target,
Intent intent, int requestCode, Bundle options) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
+ Uri referrer = target != null ? target.onProvideReferrer() : null;
+ if (referrer != null) {
+ intent.putExtra(Intent.EXTRA_REFERRER, referrer);
+ }
if (mActivityMonitors != null) {
synchronized (mSync) {
final int N = mActivityMonitors.size();