Clean up search code.

Fix up coding style and add a few missing TypedArray.recycle() calls.
Also make filtering code more efficient.

Change-Id: Ie3824b41ae40010686ff3cb6cab7f12d19843834

Conflicts:
	src/com/android/settings/Settings.java
Settings : Make search locale friendly

Change-Id: I3ae4b074af7a0ab4105f35d3ee8d6e5ef004af3d

Conflicts:
	AndroidManifest.xml
Settings : Get actionbar post extra retrieval

Fetching the actionbar before the extras are utilized causes the parentActivityName
to be null and no home as up enabled.

Change-Id: Ic3395c4a2e0c04aee4efab5345cb604475691016

Conflicts:
	src/com/android/settings/Settings.java
Show parent fragment name in option search.

For doing that, parent titles were missing for options placed in
fragments which are directly invoked by a settings header. Fixit.

Change-Id: Iad9340fa76eb6f2f38f4b0d7b84f2c7fa357b162
Settings : Preserve title id

Change-Id: Ieea43e5ebe955ae31190daa0db635611c4ec7f49
Settings: Don't match action bar parent for search on tablets.

Also adjust IME flags to
a) show the search icon as action key and
b) to not appear fullscreen in landscape

Change-Id: I9bc9851d39aa4d6dbed40df63dd4ea8df6f4c3f9
Settings : Scroll to preference on search and highlight

Change-Id: I93c4106d022b416205cc33cf5dbdf5d7635a002a

Conflicts:
	src/com/android/settings/Settings.java
	src/com/android/settings/SettingsPreferenceFragment.java
Highlight search string match.

Change-Id: I72c0380512028674c91f287325f221a686a4821d
Improve search performance.

The normalization regex is slow (5-10ms per entry on mako), so better
pre-cache it. Also cache the icons, as the number of icons is vastly
smaller than the number of potential search results, so they'll be
reused very often.

The regex change alone brings the duration of a single filter run down
to ~20ms from ~1200ms on mako.

Change-Id: Ia0fa9c554d0d585a52c8a2b87eecbf045388c961
Settings: Disable search item in some fragments.

Change-Id: I17ed6945f34f2fe7bb18674124f8a8989145b8c1
Settings: Bump SettingsSearch db version.

Change-Id: I0ba3be71f61fcae9c2fe67064b5f890fdd0abb2c
Fix
Improve search UX prior to load being finished.

Show a informative hint in that case.
Also clean up code somewhat.

Change-Id: I57f37bc60fbaef2ea0db0b0c3227df125b0e4ab9

Conflicts:
	res/values/cm_strings.xml
Check locale when populating DB instead of using separate receiver.

This makes reloading the search data race condition free. Previously,
when invoking search directly after the locale change, one would get the
results for the old or the new locale depending on timing between the
broadcast being delivered and the activity restart.

Change-Id: I35bc11a7f68e655e00fe53b829deea613da74f69
settings: properly count preferences in group

When the first preference in a settings preference fragment is a caterory, this method cannot
find the first preference of the group, returning an incorrect position.
xe: Lockscreen Settings -> Screen settings

Reason for that is that there's no way to differentiate 0 from -0. Fix
that by avoiding overloading integer semantics and clearly splitting the
result count from the 'was stopAt found' flag.

Change-Id: I68cfde27b9860246b1cc3671dfb35320c4ff3ea8
Apply match spans synchronously to avoid a race condition

Using the match start/end positions from both the main thread (when
updating UI) and the filter thread (when the filter constraint changed)
at the same time can lead into exceptions. Make sure to update the positions used by
the UI thread only from there.

07-11 03:26:18.845: E/AndroidRuntime(12765): Process: com.android.settings, PID: 12765
07-11 03:26:18.845: E/AndroidRuntime(12765): java.lang.IndexOutOfBoundsException: setSpan (-1 ... -1) starts before 0
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1021)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:592)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:588)
07-11 03:26:18.845: E/AndroidRuntime(12765): at com.android.settings.search.SettingsSearchFilterAdapter.getView(SettingsSearchFilterAdapter.java:216)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.widget.AbsListView.obtainView(AbsListView.java:2255)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.widget.ListPopupWindow.obtainView(ListPopupWindow.java:1585)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.widget.ListView.measureHeightOfChildren(ListView.java:1263)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.widget.ListPopupWindow.buildDropDown(ListPopupWindow.java:1167)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.widget.ListPopupWindow.show(ListPopupWindow.java:554)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.widget.AutoCompleteTextView.showDropDown(AutoCompleteTextView.java:1096)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.widget.AutoCompleteTextView.updateDropDownForFilter(AutoCompleteTextView.java:971)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.widget.AutoCompleteTextView.access00(AutoCompleteTextView.java:91)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.widget.AutoCompleteTextView.run(AutoCompleteTextView.java:1268)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.os.Handler.handleCallback(Handler.java:733)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.os.Handler.dispatchMessage(Handler.java:95)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.os.Looper.loop(Looper.java:136)
07-11 03:26:18.845: E/AndroidRuntime(12765): at android.app.ActivityThread.main(ActivityThread.java:5140)
07-11 03:26:18.845: E/AndroidRuntime(12765): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 03:26:18.845: E/AndroidRuntime(12765): at java.lang.reflect.Method.invoke(Method.java:515)
07-11 03:26:18.845: E/AndroidRuntime(12765): at com.android.internal.os.ZygoteInit.run(ZygoteInit.java:795)
07-11 03:26:18.845: E/AndroidRuntime(12765): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
07-11 03:26:18.845: E/AndroidRuntime(12765): at dalvik.system.NativeStart.main(Native Method)

Change-Id: I60cff301d3bfb15ea2bbf63fcae524af0ae0b8a6
settings: prevent multiple highlights in settings search

xe: Developer Options -> Launch Tools. The Process Stats is highlighted along
with Launch Tools, because the view of the latter is reused for the former and the
latter later gets a new view. Fix that by making sure to cancel old
highlights when triggering a new one.

Change-Id: Ibf2068628e5024d61495d4f9968811c77e120918
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Settings: Always show search on multipane devices.

    - Disable in more fragments for clean up.

Change-Id: Ia82f89ca8394e9d3dcf7dc80d2dfccdbe6fa9bc7

Conflicts:
	src/com/android/settings/Settings.java
Partition info