FastScroller: Fix to use appropriate index

Fix FastScroller to use appropriate index to determine the
the position of a section while calculating the y coordinates
of thumb. In case of last section, use totalItemCount to determine
next section position.

Change-Id: I89bfd483949b5c14f85303b50380a73b4a4e635e
Add additional Method that check whether a table is empty or not

Application Devleopers are using queryNumEntries API
implemented by "COUNT(*)" to check whether a table is empty or not.
COUNT(*)  has to process the entire table to compute the result.
But, "EXISTS" can stop after a single matching row has been found.
So, Using "EXISTS" is more faster than "COUNT(*)"
I added new API using "EXISTS" to check whether a table is empty or not

Change-Id: Idcc2633d0a5349c59f41e125cf34c9dc6622cdbe
PreferenceActivity should not leave message in looper when destroyed

When a PreferenceActivity is destroyed as soon as created,
there is a problematic case that messages for the activity are
sometimes left in the looper even after the activity is destroyed.
For example, by clearing user data of the selecting IME on
Settings apk, com.android.settings.Settings is re-launched
2 times successively. (Destory->Create->Destroy->Create)
Due to the left message, application crash can happen.
(NullPointerException at BackStackRecord.getBreadCrumbTitle())

Two cases have been found to observe this issue.
[Case 1]
 1,Launch IME in advance.
 2,Go to Settings >Apps > All and choose the IME package.
 3,Click "Clear data"
 4,Application crash occurs on com.android.settings.
[Case 2]
 1,Go to Settings > Language&input > Language.
 2,ListView dialog to choose language is shown.
 3,Rotate the tablet 180 degree so that 90 degree rotation occurs twice.
 4,Application crash occurs on com.android.settings.

Change-Id: I5ce36ea7a40ab7bc7737b7dca6641a4c3d77a480
HALO colors: a lil improvement

Shouldn't break themeability this time, the custom colors has it's own halo bg

Conflicts:
	packages/SystemUI/res/drawable-hdpi/halo_bg.png
	packages/SystemUI/res/drawable-mdpi/halo_bg.png
	packages/SystemUI/res/drawable-nodpi/bubble_l.9.png
	packages/SystemUI/res/drawable-nodpi/bubble_r.9.png
	packages/SystemUI/res/drawable-xhdpi/halo_bg.png
	packages/SystemUI/res/values/colors.xml
	packages/SystemUI/src/com/android/systemui/statusbar/halo/HaloProperties.java

Change-Id: Icfbdfa2e0f44527a80f1e9365a243a654c61a9a2

Conflicts:
	packages/SystemUI/res/values/colors.xml
	packages/SystemUI/src/com/android/systemui/statusbar/halo/HaloProperties.java
Fix circle not theming
HALO Style revamp

- speech bubbles are centered
- number batches are roundand simplified, same color as in g+
- markers appear as dots above the bubble
- hiding and dimissing triggers text hints
- couple of bugfixes

WARNING: some of the drawables are good for xhdpi only for now and must
be scaled down for the other resolutions

Change-Id: Ib656664f6f8c42b747df18d65d1e3fb40cb7480c

Conflicts:
	packages/SystemUI/res/drawable-hdpi/halo_pulse1.png
	packages/SystemUI/res/drawable-mdpi/halo_number.9.png
	packages/SystemUI/res/drawable-mdpi/halo_pulse1.png
	packages/SystemUI/res/drawable-nodpi/bubble_black_l.9.png
	packages/SystemUI/res/drawable-nodpi/bubble_black_r.9.png
	packages/SystemUI/res/drawable-xhdpi/halo_number.9.png
	packages/SystemUI/res/drawable-xhdpi/halo_pulse1.png
	packages/SystemUI/res/layout/halo_speech.xml
	packages/SystemUI/src/com/android/systemui/statusbar/halo/Halo.java

Conflicts:
	packages/SystemUI/res/drawable-hdpi/halo_pulse1.png
	packages/SystemUI/res/drawable-mdpi/halo_number.9.png
	packages/SystemUI/res/drawable-mdpi/halo_pulse1.png
	packages/SystemUI/res/drawable-nodpi/bubble_black_l.9.png
	packages/SystemUI/res/drawable-nodpi/bubble_black_r.9.png
	packages/SystemUI/res/drawable-xhdpi/halo_number.9.png
	packages/SystemUI/res/drawable-xhdpi/halo_pulse1.png
Finish the floating activity again

Change-Id: I1db29ddd2c056d7645f1028e084face815a44e0c
HALO hiddenstate-fix + smaller numberbatch

once HALO is hidden an orientationchange won't wake it up getting in
your way.

Change-Id: Id7c2232e4e3e6e49392becbdcddeb1a494faafc8
HALO cleanup & better drawables

Change-Id: I7afb5f1e473e9611059e1ea2acfaa9d307696449

Conflicts:
	packages/SystemUI/res/drawable-hdpi/halo_marker_l.png
	packages/SystemUI/res/drawable-hdpi/halo_marker_r.png
	packages/SystemUI/res/drawable-mdpi/halo_marker_l.png
	packages/SystemUI/res/drawable-mdpi/halo_marker_r.png
	packages/SystemUI/res/drawable-xhdpi/halo_marker_l.png
	packages/SystemUI/res/drawable-xhdpi/halo_marker_r.png

Conflicts:
	packages/SystemUI/res/drawable-hdpi/halo_marker_l.png
	packages/SystemUI/res/drawable-hdpi/halo_marker_r.png
	packages/SystemUI/res/drawable-mdpi/halo_marker_l.png
	packages/SystemUI/res/drawable-mdpi/halo_marker_r.png
	packages/SystemUI/res/drawable-nodpi/bubble_black_l.9.png
	packages/SystemUI/res/drawable-nodpi/bubble_black_r.9.png
	packages/SystemUI/res/drawable-xhdpi/halo_marker_l.png
	packages/SystemUI/res/drawable-xhdpi/halo_marker_r.png
HALO hide bugfix, smaller numberbatch still

Change-Id: I5a94e0a7c39a7369cae2b0cabdbe8696eb15dbc5
HALO new vertical gestures (NOT READY FOR RELEASE)

itroduces step gestures

-- Clear all notifications
-- Clear current notification

(*)

-- Hide HALO
-- Silence HALO until woken

Change-Id: I4b5bb7ec612dc0eb1d95e970348b15fba1d79df0

Conflicts:
	packages/SystemUI/res/drawable-xhdpi/halo_back_left.png
	packages/SystemUI/res/drawable-xhdpi/halo_back_right.png
	packages/SystemUI/res/drawable-xhdpi/halo_dismiss.png
HALO clearall/silence (STILL NOT READY FOR RELEASE)

but working ...

Change-Id: Ie1c25f4ad60d2fac6321417c6fcf93e3dccd9d93

Conflicts:
	packages/SystemUI/res/drawable-xhdpi/halo_dismiss.png
	packages/SystemUI/src/com/android/systemui/statusbar/halo/Halo.java

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/halo/Halo.java
HALO clearall-fix + dismiss icon (READY, BUT NEW STYLE IS XHDPI ONLY!)

Change-Id: I5d47a2dda9139445503f4e93f9a72c02b48cb88d

Conflicts:
	packages/SystemUI/res/drawable-xhdpi/halo_dismiss.png
HALO cleanup & clearall-nap

Change-Id: I05e45812fa10e3f6b3818ac4a96d94c7d0d5d125
HALO: make a trusted overlay

Change-Id: I009be0361c73ec536277641d235b0c495bc43db6
Clean up Halo stuff.

Change-Id: I565fbb272254354e1909668f7467d22065e66ee8

Conflicts:
	packages/SystemUI/res/drawable-nodpi/bubble_black_l.9.png
	packages/SystemUI/res/drawable-nodpi/bubble_black_r.9.png
	packages/SystemUI/res/drawable-nodpi/bubble_l.9.png
	packages/SystemUI/res/drawable-nodpi/bubble_r.9.png
	packages/SystemUI/res/drawable-xhdpi/halo_bg.png
HALO cleanup

Conflicts:
	packages/SystemUI/res/drawable-nodpi/bubble_l_custom.9.png
	packages/SystemUI/res/drawable-nodpi/bubble_r_custom.9.png

Change-Id: I21e2535c6ae2fdc8e03bd7fe07b6a9a8751884d8
HALO: Speech bubble, fix padding