Back out of Home settings when penultimate home app is uninstalled
When the user deletes the last-but-one, there's nothing more that they can do in Home settings (and we'll be suppressing it from the top level of the Settings UI as well), so we now back out with a dialog explaining the situation. Bug 10918801 Change-Id: Id03169dace976f7de639e3b3ab3d50ed161258d8
This commit is contained in:
@@ -23,6 +23,7 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
@@ -50,6 +51,8 @@ public class HomeSettings extends SettingsPreferenceFragment {
|
||||
|
||||
public static final String CURRENT_HOME = "current_home";
|
||||
|
||||
public static final String HOME_SHOW_NOTICE = "show";
|
||||
|
||||
PreferenceGroup mPrefGroup;
|
||||
|
||||
PackageManager mPm;
|
||||
@@ -57,6 +60,7 @@ public class HomeSettings extends SettingsPreferenceFragment {
|
||||
ArrayList<HomeAppPreference> mPrefs;
|
||||
HomeAppPreference mCurrentHome = null;
|
||||
final IntentFilter mHomeFilter;
|
||||
boolean mShowNotice;
|
||||
|
||||
public HomeSettings() {
|
||||
mHomeFilter = new IntentFilter(Intent.ACTION_MAIN);
|
||||
@@ -126,6 +130,17 @@ public class HomeSettings extends SettingsPreferenceFragment {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we're down to just one possible home app, back out of this settings
|
||||
// fragment and show a dialog explaining to the user that they won't see
|
||||
// 'Home' settings now until such time as there are multiple available.
|
||||
if (mPrefs.size() < 2) {
|
||||
if (mShowNotice) {
|
||||
mShowNotice = false;
|
||||
Settings.requestHomeNotice();
|
||||
}
|
||||
finishFragment();
|
||||
}
|
||||
}
|
||||
|
||||
void buildHomeActivitiesList() {
|
||||
@@ -176,6 +191,9 @@ public class HomeSettings extends SettingsPreferenceFragment {
|
||||
|
||||
mPm = getPackageManager();
|
||||
mPrefGroup = (PreferenceGroup) findPreference("home");
|
||||
|
||||
Bundle args = getArguments();
|
||||
mShowNotice = (args != null) && args.getBoolean(HOME_SHOW_NOTICE, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user