Move the check for launcher managed profile support.
Bug:19260244
Change-Id: I13ecdc5470cb4546754b245c09adbde4f22bbacd
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 144cc33..a410e45 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -505,15 +505,6 @@
// Header views don't count.
return;
}
- ResolveInfo resolveInfo = mAdapter.resolveInfoForPosition(position, true);
- if (mResolvingHome && hasManagedProfile()
- && !supportsManagedProfiles(resolveInfo)) {
- Toast.makeText(this, String.format(getResources().getString(
- com.android.internal.R.string.activity_resolver_work_profiles_support),
- resolveInfo.activityInfo.loadLabel(getPackageManager()).toString()),
- Toast.LENGTH_LONG).show();
- return;
- }
final int checkedPos = mListView.getCheckedItemPosition();
final boolean hasValidSelection = checkedPos != ListView.INVALID_POSITION;
if (mAlwaysUseOption && (!hasValidSelection || mLastSelected != checkedPos)) {
@@ -579,7 +570,6 @@
mListView.getCheckedItemPosition() : mAdapter.getFilteredPosition(),
id == R.id.button_always,
mAlwaysUseOption);
- dismiss();
}
void startSelected(int which, boolean always, boolean filtered) {
@@ -587,6 +577,14 @@
return;
}
ResolveInfo ri = mAdapter.resolveInfoForPosition(which, filtered);
+ if (mResolvingHome && hasManagedProfile() && !supportsManagedProfiles(ri)) {
+ Toast.makeText(this, String.format(getResources().getString(
+ com.android.internal.R.string.activity_resolver_work_profiles_support),
+ ri.activityInfo.loadLabel(getPackageManager()).toString()),
+ Toast.LENGTH_LONG).show();
+ return;
+ }
+
Intent intent = mAdapter.intentForPosition(which, filtered);
onIntentSelected(ri, intent, always);
finish();