Conditionally remove settings that aren't required on the tablet.
Bug: 2985267
Changes not done : SD card related stuff, as we need some way still
to figure out if there is a real SD card in the device.
Change-Id: I21c41f18ebe6c050981918481a7f6d69f04b65d0
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 460ca96..2ce0bcc 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -18,7 +18,6 @@
import android.app.Activity;
import android.app.Fragment;
-import android.app.Fragment.InstantiationException;
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
@@ -130,17 +129,12 @@
}
private boolean showFragment(String fragmentClass, Bundle extras) {
- try {
- Fragment f = Fragment.instantiate(this, fragmentClass, extras);
- if (f instanceof SettingsPreferenceFragment) {
- ((SettingsPreferenceFragment) f).setOnStateListener(this);
- }
- getFragmentManager().openTransaction().replace(R.id.prefs, f).commit();
- return true;
- } catch (InstantiationException exc) {
- Log.d(TAG, "Couldn't instantiate fragment " + fragmentClass);
- return false;
+ Fragment f = Fragment.instantiate(this, fragmentClass, extras);
+ if (f instanceof SettingsPreferenceFragment) {
+ ((SettingsPreferenceFragment) f).setOnStateListener(this);
}
+ getFragmentManager().openTransaction().replace(R.id.prefs, f).commit();
+ return true;
}
private void addToBreadCrumbs(Fragment fragment) {
@@ -209,9 +203,6 @@
PreferenceGroup parent = (PreferenceGroup) findPreference(KEY_PARENT);
Utils.updatePreferenceToSpecificActivityOrRemove(activity, parent,
KEY_SYNC_SETTINGS, 0);
- Utils.updatePreferenceToSpecificActivityOrRemove(activity, parent,
- KEY_SEARCH_SETTINGS, 0);
-
Preference dockSettings = parent.findPreference(KEY_DOCK_SETTINGS);
if (activity.getResources().getBoolean(R.bool.has_dock_settings) == false
&& dockSettings != null) {
@@ -222,6 +213,11 @@
KEY_OPERATOR_SETTINGS);
Utils.updatePreferenceToSpecificActivityFromMetaDataOrRemove(activity, parent,
KEY_MANUFACTURER_SETTINGS);
+
+ Preference callSettings = parent.findPreference(KEY_CALL_SETTINGS);
+ if (!Utils.isVoiceCapable(activity) && callSettings != null) {
+ parent.removePreference(callSettings);
+ }
}
@Override