summaryrefslogtreecommitdiffstats
path: root/core/java/android/app/Activity.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-06-09 23:33:50 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-09 23:33:52 +0000
commit476695227393b6c35c6777754b0e3b6448ceb7d2 (patch)
tree1ea49051f4cadd6bc07c70d39e4924e04bd4c0a0 /core/java/android/app/Activity.java
parent64d6ce8a661fd63b90b4c9f3f7d400208cb2430a (diff)
parenta3acdb33df7c7be7ff3d9f376ff833e4b0c1d897 (diff)
downloadframeworks_base-476695227393b6c35c6777754b0e3b6448ceb7d2.zip
frameworks_base-476695227393b6c35c6777754b0e3b6448ceb7d2.tar.gz
frameworks_base-476695227393b6c35c6777754b0e3b6448ceb7d2.tar.bz2
Merge "Fix issue #21621920: VI: need mechanism to get current request" into mnc-dev
Diffstat (limited to 'core/java/android/app/Activity.java')
-rw-r--r--core/java/android/app/Activity.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 90567c7..2a76a19 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -4279,6 +4279,10 @@ public class Activity extends ContextThemeWrapper
if (mParent == null) {
int result = ActivityManager.START_RETURN_INTENT_TO_CALLER;
try {
+ Uri referrer = onProvideReferrer();
+ if (referrer != null) {
+ intent.putExtra(Intent.EXTRA_REFERRER, referrer);
+ }
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess();
result = ActivityManagerNative.getDefault()
@@ -4463,6 +4467,10 @@ public class Activity extends ContextThemeWrapper
@Override
public void startActivityForResult(
String who, Intent intent, int requestCode, @Nullable Bundle options) {
+ Uri referrer = onProvideReferrer();
+ if (referrer != null) {
+ intent.putExtra(Intent.EXTRA_REFERRER, referrer);
+ }
Instrumentation.ActivityResult ar =
mInstrumentation.execStartActivity(
this, mMainThread.getApplicationThread(), mToken, who,
@@ -4616,6 +4624,16 @@ public class Activity extends ContextThemeWrapper
}
/**
+ * Override to generate the desired referrer for the content currently being shown
+ * by the app. The default implementation returns null, meaning the referrer will simply
+ * be the android-app: of the package name of this activity. Return a non-null Uri to
+ * have that supplied as the {@link Intent#EXTRA_REFERRER} of any activities started from it.
+ */
+ public Uri onProvideReferrer() {
+ return null;
+ }
+
+ /**
* Return the name of the package that invoked this activity. This is who
* the data in {@link #setResult setResult()} will be sent to. You can
* use this information to validate that the recipient is allowed to