Alarm: Show a warning toast when alarm volume is set to silent

Change-Id: I97edae55351101046def5058a2459ab88edf2d0d
Signed-off-by: cj360 <ayunker551@gmail.com>

Conflicts:
	res/values/cm_strings.xml
DeskClock: Add back user-defined world cities

Ported from:
 * http://review.cyanogenmod.org/#/c/33001/
 * http://review.cyanogenmod.org/#/c/44805/

Change-Id: Icec0c4f47431abf53382bd3f536dfea211220f4a
Signed-off-by: cj360 <ayunker551@gmail.com>

Conflicts:
	res/values/cm_strings.xml
DeskClock: Fix crash when click the dismiss in the notification

Startactivity without new task flag will lead app crash. The Deskclock
will start activity from broadcast receiver, this action need add flag
FLAG_ACTIVITY_NEW_TASK

Add the flag of FLAG_ACTIVITY_NEW_TASK for startactivity in onreceive.

CRs-fixed: 690390

Change-Id: I3723a49892ff86b1f54d9ab4b90d8c39f04d0fe5

(cherry picked from commit ac70287f7e8549e7498b1b8efaf4adecb3d3aaa6)
Signed-off-by: cj360 <ayunker551@gmail.com>

Conflicts:
	src/com/android/deskclock/alarms/AlarmStateManager.java
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

(cherry picked from commit 32b783b232d81bbbc29d9ffda1b75ccffe3ed0ef)
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

(cherry picked from commit ec6a9fd46dccfabc2d0fde71a88b7535d0edfc80)
Signed-off-by: cj360 <ayunker551@gmail.com>

Conflicts:
	src/com/android/deskclock/alarms/AlarmStateManager.java
DeskClock: Fix NullPointerException in AlarmClockFragment

RingtoneManager.getRingtone could return null so add a check for that

Change-Id: Ic3ec042e7c3fe02eee6388a469f19624d90fdddd

(cherry picked from commit 5081fd98bfc35a511fe4eb3478e75cfc1e7b6347)
Signed-off-by: cj360 <ayunker551@gmail.com>

Conflicts:
	src/com/android/deskclock/AlarmClockFragment.java
DeskClock: Add feature to play random song as an alarm.

Change-Id: I38c346beb0746fcebd224e9641e2d397183ba9a2

(cherry picked from commit f8d1754d3cc68cc5abc6cf2d4b79a1dfa374c104)
Signed-off-by: cj360 <ayunker551@gmail.com>

Conflicts:
	res/values/cm_strings.xml
	src/com/android/deskclock/AlarmClockFragment.java
DeskClock: Support double-digit hours for timers

Change-Id: I8aa4960c03d710ca7889c8d91701ca5b5376c9ef

(cherry picked from commit 37ac19f96b43b5d76922ceececfee2a0dd12aa2a)
DeskClock: Avoid DeskClock layout abnormal on landscape

When the activity recreates 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

(cherry picked from commit 9ba0345654a6d5eb21458d8f100cbf3bb3f0fc20)
Alarm: Use dedicated alarm type for poweroff alarm.

RTC_POWEROFF_WAKEUP is a new alarm type introduced by framework
to perform poweroff alarm. The time (RTC_WAKEUP) set to framework
is not the same as the alarm time set in deskclock.  In this case
the RTC register might not be correctly set. So both RTC_WAKEUP
and RTC_POWEROFF_WAKEUP types need to be set at the same time:
RTC_WAKEUP type will handle the normal alarm process, and
RTC_POWEROFF_WAKEUP is used to set the correct alarm time to RTC
register.

Change-Id: Ic03f87018e163adf6f6e6013963a497d340fbec7

(cherry picked from commit b26ef3565026e4919f3a64c5b098b888e14ac6f0)