From 173f711e03dfce70d76c3b45f764a4f6b682a3b3 Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Fri, 27 Mar 2015 15:14:00 -0700 Subject: [PATCH] Ensure that we capture all paths for starting activity for result -> AppWidgetManagerCompatVL uses an IntentSender to launch the widget config activity (to handle the case of cross profile config activities) -> Launcher was not overriding this method, and so not capturing the fact that we are waiting for a result. issue 19723510 Change-Id: If5751e6d23d31c9f7b3b85f9464a93f935487cec --- src/com/android/launcher3/Launcher.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index a8fd79e478..56a74e5636 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -42,6 +42,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; +import android.content.IntentSender; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; @@ -2079,10 +2080,26 @@ public class Launcher extends Activity @Override public void startActivityForResult(Intent intent, int requestCode) { + onStartForResult(requestCode); + super.startActivityForResult(intent, requestCode); + } + + @Override + public void startIntentSenderForResult (IntentSender intent, int requestCode, + Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) { + onStartForResult(requestCode); + try { + super.startIntentSenderForResult(intent, requestCode, + fillInIntent, flagsMask, flagsValues, extraFlags, options); + } catch (IntentSender.SendIntentException e) { + throw new ActivityNotFoundException(); + } + } + + private void onStartForResult(int requestCode) { if (requestCode >= 0) { setWaitingForResult(true); } - super.startActivityForResult(intent, requestCode); } /**