diff options
| author | Sander Alewijnse <salewijnse@google.com> | 2014-08-19 18:07:47 +0100 |
|---|---|---|
| committer | Sander Alewijnse <salewijnse@google.com> | 2014-08-19 18:09:26 +0100 |
| commit | 1ac37a41991fae97729699468d536959e350bc11 (patch) | |
| tree | 42a1ea754f64ed97602d43aaacfe75f06234528d /src/com/android/settings/HomeSettings.java | |
| parent | d05dd864d6f26a1577cbcb25a43ddf9d3e638299 (diff) | |
| download | packages_apps_Settings-1ac37a41991fae97729699468d536959e350bc11.tar.gz packages_apps_Settings-1ac37a41991fae97729699468d536959e350bc11.tar.bz2 packages_apps_Settings-1ac37a41991fae97729699468d536959e350bc11.zip | |
Add extra to home settings starting intent.
If intent contains a specific extra the picker will be
retricted to launchers that support managed profiles
no matter whether there are managed profiles present.
Bug:15099904
Change-Id: I31ab74afee7b5a790cb7aa621fff72f640fcedaf
Diffstat (limited to 'src/com/android/settings/HomeSettings.java')
| -rw-r--r-- | src/com/android/settings/HomeSettings.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/com/android/settings/HomeSettings.java b/src/com/android/settings/HomeSettings.java index 817c61acc..2ac93c642 100644 --- a/src/com/android/settings/HomeSettings.java +++ b/src/com/android/settings/HomeSettings.java @@ -19,6 +19,7 @@ package com.android.settings; import java.util.ArrayList; import java.util.List; +import android.app.Activity; import android.app.ActivityManager; import android.content.BroadcastReceiver; import android.content.ComponentName; @@ -59,6 +60,10 @@ import com.android.settings.search.SearchIndexableRaw; public class HomeSettings extends SettingsPreferenceFragment implements Indexable { static final String TAG = "HomeSettings"; + // Boolean extra, indicates only launchers that support managed profiles should be shown. + // Note: must match the constant defined in ManagedProvisioning + private static final String EXTRA_SUPPORT_MANAGED_PROFILES = "support_managed_profiles"; + static final int REQUESTING_UNINSTALL = 10; public static final String HOME_PREFS = "home_prefs"; @@ -118,6 +123,8 @@ public class HomeSettings extends SettingsPreferenceFragment implements Indexabl mPm.replacePreferredActivity(mHomeFilter, IntentFilter.MATCH_CATEGORY_EMPTY, mHomeComponentSet, newHome.activityName); + + getActivity().setResult(Activity.RESULT_OK); } void uninstallApp(HomeAppPreference pref) { @@ -175,7 +182,10 @@ public class HomeSettings extends SettingsPreferenceFragment implements Indexabl mPrefs = new ArrayList<HomeAppPreference>(); mHomeComponentSet = new ComponentName[homeActivities.size()]; int prefIndex = 0; - boolean hasManagedProfile = hasManagedProfile(); + boolean supportManagedProfilesExtra = + getActivity().getIntent().getBooleanExtra(EXTRA_SUPPORT_MANAGED_PROFILES, false); + boolean mustSupportManagedProfile = hasManagedProfile() + || supportManagedProfilesExtra; for (int i = 0; i < homeActivities.size(); i++) { final ResolveInfo candidate = homeActivities.get(i); final ActivityInfo info = candidate.activityInfo; @@ -186,7 +196,7 @@ public class HomeSettings extends SettingsPreferenceFragment implements Indexabl CharSequence name = info.loadLabel(mPm); HomeAppPreference pref; - if (hasManagedProfile && !launcherHasManagedProfilesFeature(candidate)) { + if (mustSupportManagedProfile && !launcherHasManagedProfilesFeature(candidate)) { pref = new HomeAppPreference(context, activityName, prefIndex, icon, name, this, info, false /* not enabled */, getResources().getString(R.string.home_work_profile_not_supported)); @@ -207,6 +217,10 @@ public class HomeSettings extends SettingsPreferenceFragment implements Indexabl } if (mCurrentHome != null) { + if (mCurrentHome.isEnabled()) { + getActivity().setResult(Activity.RESULT_OK); + } + new Handler().post(new Runnable() { public void run() { mCurrentHome.setChecked(true); |
