DeskClock: restore vibrations after screen is turned off

android.server.VibratorService forcefully clears out all vibrations
after the screen is turned off. If an alarm is going off, we do not want
the power button to only stop vibrations.

Change-Id: Ic7bc556d7cf5529b23b482c34e986853ad4ba4f2
Signed-off-by: Roman Birg <roman@cyngn.com>
DeskClock: Add selection for external device

User can choose external audio file as the ringtone for each alarm.

Change-Id: I98fe4f823e29161f4aa45d0bbca6c90d94c689f9
WorldClock: Add some worldwide cities and update timezone

Add some cities info to xml.
When local is changed, the timezone in setting page should be
refreshed.

Change-Id: If13beeb3c92227f67819f016e4631913fc6daca7
WorldClock: Fix cities/time zone entries

* Remove duplicate entries
* Fix time zones for cities

Change-Id: I90a70b3059595f429eb5b12ad62aad953773d29c
DeskClock: Sometimes alarm can't stop while coming a MT voice call

Alarm can't stop sometimes.
Add stopCurrentAlarm() in PhoneStateListener to stop Alarm when receive a call.

Change-Id: Ie9dadb5f050ec066e7c3e0156bdf8f40f398e9c7
CRs-Fixed: 620428
DeskClock: Alarm Vibrator can't stop while coming a MT voice call
- Alarm Vibrator can't stop while coming a MT voice call
- Add inTelephoneCall condition to stop Alarm Vibrate when receive a call.

Change-Id: I2728a217ac3b9d962c61a7291bb65178a7518436
CRs-Fixed: 635036
DeskClock: Search cities with any part of the name

Only the the starting part of the name could be used to search.
Therefore, when try to search the cities with the middle or ending
part of the name, no expected result will be listed.

Use contains() method instead of startsWith() to match the search,
so that all the names containing the search string will be listed
in the result.

CRs-Fixed: 637280

Change-Id: I670a163b9c4df575445b58eeb1cc5070a557550e
DeskClock: Avoid alarm ringtone changed as silent

When rotating the device, the alarm activity will recreate and
set default ringtone as silent, which lead to the music picker
unavailable. Add configChanges property for the activity.

Change-Id: Ia14d7d431a96709aafd707217f139415ccaedb49
CRs-Fixed: 640960
DeskClock: Fix the delay or missed condition of the alarm after boot

After boot completed, if low memory condition happens or some ordered
broadcasts have time out,it will cause some delay to some other ordered
broadcasts like "change_state" broadcast for alarm. Because alarm is
very sensitive to the time, its broadcast should be changed into one
with high priority. And the priority of AlarmInitReceiver should be
impoved to receive the BOOT_COMPLETE action in time. Otherwise the
alarm will be missed if AlarmInitReceiver receive the action after
the alarm time.

CRs-Fixed: 621073
Change-Id: I18f37378e5eef0504c9c412d3a2ff85487093245
DeskClock: Fixed the ringtone name display incorrect when delete music file

It only displays FALLBACKRING when set alarm ringtone by file explorer,
is caused by that it not handle the file uri which from file explorer
in getRingToneTitle method.

Add the judgement to get the file uri and get the right title of alarm
ringtone.

CRs-Fixed: 546747

Change-Id: I50ac325c1a636fb2a2985fbc15839fab9e31e0cc
DeskClock: handle call events on alarm

Alarm clock ringing while incoming call received.

When call ringing,alarm clock time arrived.Only Call ringing and no alarm
clock ringing.and after hang up the phone,alarm start ring.
When alarm ringing,receive a call,the alarm is stopped,and it can answer
or hang up the phone.after hang up the phone ,there has some reminder.

CRs-Fixed: 638868

Change-Id: If26b4f1f50f76ee4bd2873fefbda5d22551b002d
DeskClock: handle call events on alarm

Alarm clock ringing while incoming call received.

When call ringing,alarm clock time arrived.Only Call ringing and no alarm
clock ringing.and after hang up the phone,alarm start ring.
When alarm ringing,receive a call,the alarm is stopped,and it can answer
or hang up the phone.after hang up the phone ,there has some reminder.

Change-Id: Id1bdf689f709e78ced30cec06cbc93a7a06a5b3b
CRs-Fixed: 638868
DeskClock: Request user to confirm power-on device on power-off alarm event

Show a dialog to request user confirmation to power on the
phone when power-off alarm pops up and user dismisses it.
On user confirmation power-on the phone.Otherwise,keep the
phone switched off.

CRs-fixed: 637275

Change-Id: I20250fa3a86bc51cfaa3bd8b26906755f2726556
WorldClock:The Next icon is not working when search city on World clock

The Next icon is not working when search city on World clock

Change the Next icon to Done icon, when tap the Done icon, hide the
SoftInput.

CRs-Fixed: 655251

Change-Id: I40944db97cbd285f70556c0afb4dab9498221b19
DeskClock: Avoid DeskClock layout displays abnormally on landscape.

- ConfigChanges property for DeskClock activity won't let the activity
recreate and re-layout when rotating the device.
- Delete the activity property. Meanwhile, when the activity recreate
it will reset music seletion source to be zero which lead to the music
picker uri null. Save and restore the seletion before re-createing.

Change-Id: If680f0b262231cf3b8b7186c9dbacea7c0d1574e
CRs-Fixed: 655098
DeskClock: Fix DeskClock crash when click dismiss clock

It is the NullPointerException which cause this crash happen

Add a condition to exclude the NullPointerException.

CRs-fixed: 650830

Change-Id: Id45a1ce757dc1876f56bd5d49ba5376760ec4cb8
DeskClock: Fix alarm name display abnormal when choose audio

Lack the handle to uri whose authority is document.

When we judge the uri is from document ,we obtain its name as
title for alarm name.

CRs-fixed: 662043

Change-Id: I588678ee8102adbe661a155e7650f7b50bb5b85e
WorldClock: modify some cities on city list

There are two Kiev but no Seoul,Adelaide,Kamchatka in world clock

Delete one of kiev and add the Kamchatka.Seoul and Adelaide already exist

CRs-Fixed: 670916

Change-Id: Ia7f9a4384249aca09365eef89e6d798ad29bac6f
WorldClock: Remove duplicate Kiev translation entries

* Previous commit removed Kiev

Change-Id: I795f3ec44285905e0a9ce801115900967c3f55fc
DeskClock: The alarm ringtone name display error

Select the downloaded music,there is no operation to get the name
from the uri.If restart Alarm,there is no permission to get the
title from the uri.

No matter in which database,the music has the same id.We can only
get the info of the music from other database by id in uri.
Then set the name to the alarm.

CRs-Fixed: 671742

Change-Id: I33611023e52ee6192e0949b2a17883bf66b747c0