diff --git a/src/com/android/settings/bluetooth/BluetoothEnabler.java b/src/com/android/settings/bluetooth/BluetoothEnabler.java index bbf5fcc1c8d..70a8097e167 100644 --- a/src/com/android/settings/bluetooth/BluetoothEnabler.java +++ b/src/com/android/settings/bluetooth/BluetoothEnabler.java @@ -166,6 +166,6 @@ public final class BluetoothEnabler implements CompoundButton.OnCheckedChangeLis private void updateSearchIndex(boolean isBluetoothOn) { Index.getInstance(mContext).updateFromClassNameResource( - BluetoothSettings.class.getName(), isBluetoothOn); + BluetoothSettings.class.getName(), false, isBluetoothOn); } } diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java index 887bba015dc..d5d97f5b022 100644 --- a/src/com/android/settings/search/Index.java +++ b/src/com/android/settings/search/Index.java @@ -362,7 +362,17 @@ public class Index { return updateInternal(); } - public boolean updateFromClassNameResource(String className, boolean includeInSearchResults) { + /** + * Update the Index for a specific class name resources + * + * @param className the class name (typically a fragment name). + * @param rebuild true means that you want to delete the data from the Index first. + * @param includeInSearchResults true means that you want the bit "enabled" set so that the + * data will be seen included into the search results + * @return true of the Index update has been successful. + */ + public boolean updateFromClassNameResource(String className, boolean rebuild, + boolean includeInSearchResults) { if (className == null) { throw new IllegalArgumentException("class name cannot be null!"); } @@ -372,6 +382,9 @@ public class Index { return false; } res.enabled = includeInSearchResults; + if (rebuild) { + deleteIndexableData(res); + } addIndexableData(res); mDataToProcess.forceUpdate = true; boolean result = updateInternal(); @@ -1029,13 +1042,13 @@ public class Index { try { database.beginTransaction(); + if (dataToDelete.size() > 0) { + processDataToDelete(database, localeStr, dataToDelete); + } if (dataToUpdate.size() > 0) { processDataToUpdate(database, localeStr, dataToUpdate, nonIndexableKeys, forceUpdate); } - if (dataToDelete.size() > 0) { - processDataToDelete(database, localeStr, dataToDelete); - } database.setTransactionSuccessful(); result = true; } finally { diff --git a/src/com/android/settings/wifi/WifiEnabler.java b/src/com/android/settings/wifi/WifiEnabler.java index e41429b239e..9f141ffd7df 100644 --- a/src/com/android/settings/wifi/WifiEnabler.java +++ b/src/com/android/settings/wifi/WifiEnabler.java @@ -20,12 +20,10 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.database.ContentObserver; import android.net.NetworkInfo; import android.net.wifi.SupplicantState; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; -import android.os.UserHandle; import android.provider.Settings; import android.widget.CompoundButton; import android.widget.Switch; @@ -157,7 +155,7 @@ public class WifiEnabler implements CompoundButton.OnCheckedChangeListener { private void updateSearchIndex(boolean isWiFiOn) { Index.getInstance(mContext).updateFromClassNameResource( - WifiSettings.class.getName(), isWiFiOn); + WifiSettings.class.getName(), false, isWiFiOn); } private void setSwitchChecked(boolean checked) {