summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2013-04-11 18:36:34 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-11 18:36:34 -0700
commit8773a5c52e5ecacbf132ea3e3e6de2e7dfb3492b (patch)
tree8ef92ba6751d89911ac364453eff762e99a48f5b
parentb735e1d426d65007011a3d915ea8e2cdd0002ecb (diff)
parent26c702c395fbbd833c2ae8d155ed4605b36c5472 (diff)
downloadframeworks_base-8773a5c52e5ecacbf132ea3e3e6de2e7dfb3492b.zip
frameworks_base-8773a5c52e5ecacbf132ea3e3e6de2e7dfb3492b.tar.gz
frameworks_base-8773a5c52e5ecacbf132ea3e3e6de2e7dfb3492b.tar.bz2
am 26c702c3: am ba880da4: Merge "Fix issue #7643046: Activity.getCallingPackage() bogusly returns null..." into jb-mr2-dev
* commit '26c702c395fbbd833c2ae8d155ed4605b36c5472': Fix issue #7643046: Activity.getCallingPackage() bogusly returns null...
-rw-r--r--core/java/android/app/Activity.java14
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java2
2 files changed, 11 insertions, 5 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 31074e2..a26bdbc 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -4030,10 +4030,16 @@ public class Activity extends ContextThemeWrapper
* use this information to validate that the recipient is allowed to
* receive the data.
*
- * <p>Note: if the calling activity is not expecting a result (that is it
+ * <p class="note">Note: if the calling activity is not expecting a result (that is it
* did not use the {@link #startActivityForResult}
* form that includes a request code), then the calling package will be
- * null.
+ * null.</p>
+ *
+ * <p class="note">Note: prior to {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2},
+ * the result from this method was unstable. If the process hosting the calling
+ * package was no longer running, it would return null instead of the proper package
+ * name. You can use {@link #getCallingActivity()} and retrieve the package name
+ * from that instead.</p>
*
* @return The package of the activity that will receive your
* reply, or null if none.
@@ -4052,12 +4058,12 @@ public class Activity extends ContextThemeWrapper
* can use this information to validate that the recipient is allowed to
* receive the data.
*
- * <p>Note: if the calling activity is not expecting a result (that is it
+ * <p class="note">Note: if the calling activity is not expecting a result (that is it
* did not use the {@link #startActivityForResult}
* form that includes a request code), then the calling package will be
* null.
*
- * @return String The full name of the activity that will receive your
+ * @return The ComponentName of the activity that will receive your
* reply, or null if none.
*/
public ComponentName getCallingActivity() {
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index ef16a0d..c6b3648 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -4581,7 +4581,7 @@ public final class ActivityManagerService extends ActivityManagerNative
public String getCallingPackage(IBinder token) {
synchronized (this) {
ActivityRecord r = getCallingRecordLocked(token);
- return r != null && r.app != null ? r.info.packageName : null;
+ return r != null ? r.info.packageName : null;
}
}