Add external Preferences indexing
- define SettingsSearchIndexablesProvider as an internal SearchIndexablesProvider - protect access thru using android.permission.READ_SEARCH_INDEXABLES - update WallpaperTypeSettings and WifiSettings for taking care of the new model - update the Dashboard for taking care about external Icons for the search result - update sqlite model/version for taking care about Intents (enable launching external applications for showing the settings) Change-Id: I2e38599327e6480f1754f52666becce0884cee9d
This commit is contained in:
@@ -94,14 +94,12 @@ import com.android.settings.dashboard.DashboardSummary;
|
||||
import com.android.settings.deviceinfo.Memory;
|
||||
import com.android.settings.deviceinfo.UsbSettings;
|
||||
import com.android.settings.fuelgauge.PowerUsageSummary;
|
||||
import com.android.settings.indexer.Index;
|
||||
import com.android.settings.indexer.IndexableRef;
|
||||
import com.android.settings.search.Index;
|
||||
import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
|
||||
import com.android.settings.inputmethod.KeyboardLayoutPickerFragment;
|
||||
import com.android.settings.inputmethod.SpellCheckersSettings;
|
||||
import com.android.settings.inputmethod.UserDictionaryList;
|
||||
import com.android.settings.location.LocationSettings;
|
||||
import com.android.settings.net.DataUsageMeteredSettings;
|
||||
import com.android.settings.nfc.AndroidBeam;
|
||||
import com.android.settings.nfc.PaymentSettings;
|
||||
import com.android.settings.print.PrintJobSettingsFragment;
|
||||
@@ -342,76 +340,6 @@ public class SettingsActivity extends Activity
|
||||
}
|
||||
};
|
||||
|
||||
private static int NO_DATA_RES_ID = 0;
|
||||
|
||||
/**
|
||||
* Indexable data description.
|
||||
*
|
||||
* Known restriction: we are only searching (for now) the first level of Settings.
|
||||
*/
|
||||
private static IndexableRef[] INDEXABLE_REFS = new IndexableRef[] {
|
||||
new IndexableRef(1, NO_DATA_RES_ID,
|
||||
WifiSettings.class.getName(),
|
||||
R.drawable.ic_settings_wireless),
|
||||
new IndexableRef(2, R.xml.bluetooth_settings,
|
||||
BluetoothSettings.class.getName(),
|
||||
R.drawable.ic_settings_bluetooth2),
|
||||
new IndexableRef(3, R.xml.data_usage_metered_prefs,
|
||||
DataUsageMeteredSettings.class.getName(),
|
||||
R.drawable.ic_settings_data_usage),
|
||||
new IndexableRef(4, R.xml.wireless_settings,
|
||||
WirelessSettings.class.getName(),
|
||||
R.drawable.empty_icon),
|
||||
new IndexableRef(5, R.xml.home_selection,
|
||||
HomeSettings.class.getName(),
|
||||
R.drawable.ic_settings_home),
|
||||
new IndexableRef(6, R.xml.sound_settings,
|
||||
SoundSettings.class.getName(),
|
||||
R.drawable.ic_settings_sound),
|
||||
new IndexableRef(7, R.xml.display_settings,
|
||||
DisplaySettings.class.getName(),
|
||||
R.drawable.ic_settings_display),
|
||||
new IndexableRef(7, NO_DATA_RES_ID,
|
||||
WallpaperTypeSettings.class.getName(),
|
||||
R.drawable.ic_settings_display),
|
||||
new IndexableRef(8, R.xml.device_info_memory,
|
||||
Memory.class.getName(),
|
||||
R.drawable.ic_settings_storage),
|
||||
new IndexableRef(9, R.xml.power_usage_summary,
|
||||
PowerUsageSummary.class.getName(),
|
||||
R.drawable.ic_settings_battery),
|
||||
new IndexableRef(10, R.xml.user_settings,
|
||||
UserSettings.class.getName(),
|
||||
R.drawable.ic_settings_multiuser),
|
||||
new IndexableRef(11, R.xml.location_settings,
|
||||
LocationSettings.class.getName(),
|
||||
R.drawable.ic_settings_location),
|
||||
new IndexableRef(12, R.xml.security_settings,
|
||||
SecuritySettings.class.getName(),
|
||||
R.drawable.ic_settings_security),
|
||||
new IndexableRef(13, R.xml.language_settings,
|
||||
InputMethodAndLanguageSettings.class.getName(),
|
||||
R.drawable.ic_settings_language),
|
||||
new IndexableRef(14, R.xml.privacy_settings,
|
||||
PrivacySettings.class.getName(),
|
||||
R.drawable.ic_settings_backup),
|
||||
new IndexableRef(15, R.xml.date_time_prefs,
|
||||
DateTimeSettings.class.getName(),
|
||||
R.drawable.ic_settings_date_time),
|
||||
new IndexableRef(16, R.xml.accessibility_settings,
|
||||
AccessibilitySettings.class.getName(),
|
||||
R.drawable.ic_settings_accessibility),
|
||||
new IndexableRef(17, R.xml.print_settings,
|
||||
PrintSettingsFragment.class.getName(),
|
||||
com.android.internal.R.drawable.ic_print),
|
||||
new IndexableRef(18, R.xml.development_prefs,
|
||||
DevelopmentSettings.class.getName(),
|
||||
R.drawable.ic_settings_development),
|
||||
new IndexableRef(19, R.xml.device_info_settings,
|
||||
DeviceInfoSettings.class.getName(),
|
||||
R.drawable.ic_settings_about),
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) {
|
||||
// Override the fragment title for Wallpaper settings
|
||||
@@ -552,7 +480,6 @@ public class SettingsActivity extends Activity
|
||||
getWindow().setUiOptions(getIntent().getIntExtra(EXTRA_UI_OPTIONS, 0));
|
||||
}
|
||||
|
||||
Index.getInstance(this).addIndexableData(INDEXABLE_REFS);
|
||||
Index.getInstance(this).update();
|
||||
|
||||
mAuthenticatorHelper = new AuthenticatorHelper();
|
||||
@@ -913,22 +840,6 @@ public class SettingsActivity extends Activity
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch the fragment pane to show the given preference fragment.
|
||||
*
|
||||
* (used for initial fragment)
|
||||
*
|
||||
* @param fragmentName The name of the fragment to display.
|
||||
* @param args Optional arguments to supply to the fragment.
|
||||
* @param validate true means that the fragment's Header needs to be validated.
|
||||
* @param title The title of the fragment to display.
|
||||
*/
|
||||
private void switchToHeader(String fragmentName, Bundle args, boolean validate,
|
||||
CharSequence title) {
|
||||
setSelectedHeader(null);
|
||||
switchToHeaderInner(fragmentName, args, validate, false, title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to a specific Header with taking care of validation, Title and BackStack
|
||||
*/
|
||||
|
Reference in New Issue
Block a user