diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2014-08-08 19:35:06 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-08 17:26:08 +0000 |
commit | 09076e5f3c90dbc1a3bdf6f000e0c99dd2bb45b4 (patch) | |
tree | 6dcf9a99b58418c262a22c2f48c577f967bddac8 /src | |
parent | dc16286ff32dfc4d087938461d0beca29b6167a3 (diff) | |
parent | 22a2a49b445b8721c8194eedf3608ea81c62ccef (diff) | |
download | packages_apps_Settings-09076e5f3c90dbc1a3bdf6f000e0c99dd2bb45b4.zip packages_apps_Settings-09076e5f3c90dbc1a3bdf6f000e0c99dd2bb45b4.tar.gz packages_apps_Settings-09076e5f3c90dbc1a3bdf6f000e0c99dd2bb45b4.tar.bz2 |
Merge "Fix bug #16896118 SIM cards should ONLY appear in search results for devices with 2+ SIM slots" into lmp-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/SettingsActivity.java | 2 | ||||
-rw-r--r-- | src/com/android/settings/Utils.java | 12 | ||||
-rw-r--r-- | src/com/android/settings/search/SearchIndexableResources.java | 2 | ||||
-rw-r--r-- | src/com/android/settings/sim/SimSettings.java | 36 |
4 files changed, 38 insertions, 14 deletions
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index bb5ac00..bf0d9a1 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -1042,7 +1042,7 @@ public class SettingsActivity extends Activity } // Show the SIM Cards setting if there are more than 2 SIMs installed. - if(tile.id != R.id.sim_settings || SimSettings.showSimCardScreen(this)){ + if(tile.id != R.id.sim_settings || Utils.showSimCardTile(this)){ category.addTile(tile); } diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java index 255ab58..e88c0fc 100644 --- a/src/com/android/settings/Utils.java +++ b/src/com/android/settings/Utils.java @@ -820,4 +820,16 @@ public final class Utils { if (icon == null) return null; return CircleFramedDrawable.getInstance(context, icon); } + + /** + * Return whether or not the user should have a SIM Cards option in Settings. + * TODO: Change back to returning true if count is greater than one after testing. + * TODO: See bug 16533525. + */ + public static boolean showSimCardTile(Context context) { + final TelephonyManager tm = + (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); + + return tm.getSimCount() > 0; + } } diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java index a3d2b8d..e0e09a8 100644 --- a/src/com/android/settings/search/SearchIndexableResources.java +++ b/src/com/android/settings/search/SearchIndexableResources.java @@ -92,7 +92,7 @@ public final class SearchIndexableResources { sResMap.put(SimSettings.class.getName(), new SearchIndexableResource( Ranking.getRankForClassName(SimSettings.class.getName()), - R.xml.sim_settings, + NO_DATA_RES_ID, SimSettings.class.getName(), R.drawable.ic_sim_sd)); diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java index 15c5548..9762c51 100644 --- a/src/com/android/settings/sim/SimSettings.java +++ b/src/com/android/settings/sim/SimSettings.java @@ -16,6 +16,7 @@ package com.android.settings.sim; +import android.provider.SearchIndexableResource; import com.android.settings.R; import android.app.AlertDialog; @@ -55,6 +56,7 @@ import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.TelephonyIntents; import com.android.settings.RestrictedSettingsFragment; import com.android.settings.SettingsPreferenceFragment; +import com.android.settings.Utils; import com.android.settings.notification.DropDownPreference; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.Indexable; @@ -86,18 +88,6 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable private SubInfoRecord mCalls = null; private SubInfoRecord mSMS = null; - /** - * Return whether or not the user should have a SIM Cards option in Settings. - * TODO: Change back to returning true if count is greater than one after testing. - * TODO: See bug 16533525. - */ - public static boolean showSimCardScreen(Context context) { - final TelephonyManager tm = - (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); - - return tm.getSimCount() > 0; - } - public SimSettings() { super(DISALLOW_CONFIG_SIM); } @@ -369,4 +359,26 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable builder.create().show(); } } + + /** + * For search + */ + public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = + new BaseSearchIndexProvider() { + @Override + public List<SearchIndexableResource> getXmlResourcesToIndex(Context context, + boolean enabled) { + ArrayList<SearchIndexableResource> result = + new ArrayList<SearchIndexableResource>(); + + if (Utils.showSimCardTile(context)) { + SearchIndexableResource sir = new SearchIndexableResource(context); + sir.xmlResId = R.xml.sim_settings; + result.add(sir); + } + + return result; + } + }; + } |