OSDN Git Service

Once we decide to show Home settings, keep it shown forever
authorChristopher Tate <ctate@google.com>
Tue, 8 Oct 2013 18:30:19 +0000 (11:30 -0700)
committerChristopher Tate <ctate@google.com>
Tue, 8 Oct 2013 18:33:03 +0000 (11:33 -0700)
Principle of Least Surprise FTW.

Bug 11131794

Change-Id: I1df720fa86fb870aa74a5d0074ca966843317f12

src/com/android/settings/HomeSettings.java
src/com/android/settings/Settings.java

index 14e1d9f..eb659e2 100644 (file)
@@ -49,7 +49,8 @@ public class HomeSettings extends SettingsPreferenceFragment {
 
     static final int REQUESTING_UNINSTALL = 10;
 
-    public static final String CURRENT_HOME = "current_home";
+    public static final String HOME_PREFS = "home_prefs";
+    public static final String HOME_PREFS_DO_SHOW = "do_show";
 
     public static final String HOME_SHOW_NOTICE = "show";
 
index eb98fec..2b8bde2 100644 (file)
@@ -686,6 +686,12 @@ public class Settings extends PreferenceActivity
     }
 
     private boolean updateHomeSettingHeaders(Header header) {
+        // Once we decide to show Home settings, keep showing it forever
+        SharedPreferences sp = getSharedPreferences(HomeSettings.HOME_PREFS, Context.MODE_PRIVATE);
+        if (sp.getBoolean(HomeSettings.HOME_PREFS_DO_SHOW, false)) {
+            return true;
+        }
+
         try {
             final ArrayList<ResolveInfo> homeApps = new ArrayList<ResolveInfo>();
             getPackageManager().getHomeActivities(homeApps);
@@ -712,6 +718,8 @@ public class Settings extends PreferenceActivity
             // Can't look up the home activity; bail on configuring the icon
             Log.w(LOG_TAG, "Problem looking up home activity!", e);
         }
+
+        sp.edit().putBoolean(HomeSettings.HOME_PREFS_DO_SHOW, true).apply();
         return true;
     }