Keyguard: Ensure that a widget and page is attached before attaching the ChallengeLayout.OnBouncerStateChangedListener

otherwise it can result in a NPE due that the page was not loaded. Especially on low end
devices this can happen (see zoomOutToBouncer() method @KeyguardWidgetPager)

Change-Id: I7e940eb2fdf885f158f4c5ff2872ebafcda76da0

Conflicts:
	packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
Find wall clock RTC through sysfs

Devices may have multiple RTCs.  By default the kernel uses rtc0 to
store the system time, but devices may override this (or even specify
that none of them should be used for system time).

Userspace can indirectly find the designated RTC through sysfs.  During
AlarmManagerService initialization, enumerate through all rtc class
devices to locate the device with attribute hctosys=1.

This is only done on devices without /dev/alarm, which has its own
in-kernel mechanism to pick the RTC.

Change-Id: Ife2b342c3590133ed316ddaf1799cbc1bfa6e6d9
Signed-off-by: Greg Hackmann <ghackmann@google.com>

Conflicts:
	services/jni/com_android_server_AlarmManagerService.cpp
Adding disconnect cause to the Android call log.

We'd like to add call disconnect cause codes to the Android call log
content provider.

As part of this work we're also consolidating the definition of call
disconnect codes in a single place. The integer constants defined in
android.telephony.DisconnectCause will be used everywhere and the
following two enums will be removed:
 - android.internal.telephony.Connection.DisconnectCause
 - com.android.services.telephony.common.Call.DisconnectCause

Change-Id: I84a3fd5182a51d07fc7d81076e4b2c15ff26c61c

Conflicts:
	telephony/java/android/telephony/DisconnectCause.java
Telephony API extension v2

Added new AndroidManifest permission:

android.permission.READ_PRECISE_PHONE_STATE

Added the following PhoneStateListeners and corresponding broadcast intents:

onPreciseCallStateChanged(PreciseCallState callState);
onPreciseDataConnectionStateChanged(PreciseDataConnectionState dataConnectionState);

broadcastPreciseCallStateChanged(int ringingCallState, int foregroundCallState, int backgroundCallState,
	int disconnectCause, int preciseDisconnectCause)
broadcastPreciseDataConnectionStateChanged(int state, int networkType, String apnType, String apn,
	String reason, LinkProperties linkProperties, String failCause)

Added TelephonyManager intent actions with their extras and constants:

public static final String ACTION_PRECISE_CALL_STATE_CHANGED = "android.intent.action.PRECISE_CALL_STATE";
public static final String ACTION_PRECISE_DATA_CONNECTION_STATE_CHANGED = "android.intent.action.PRECISE_DATA_CONNECTION_STATE_CHANGED";

public static final int PRECISE_CALL_STATE_*

Moved public static final int DISCONNECT_CAUSE_* from PreciseCallState.java to a new class DisconnectCause.java

Moved public static final int PRECISE_DISCONNECT_CAUSE_* from PreciseCallState.java to a new class PreciseDisconnectCause.java

Change-Id: If3b88c679507c529b746046c4a17cf6d9974bd09

Conflicts:
	telephony/java/android/telephony/DisconnectCause.java
	telephony/java/android/telephony/PhoneStateListener.java
Parallel shutdown

Decrease shutdown time by doing some shutdown tasks in parallel.

There are two threads executing during the shut down: the ShutdownThread
and a separate thread for the radio shutdown. However, the execution is
done in serial, as the ShutdownThread immediately joins on the radio
thread.

This commit will move the shutdown of the radio to the beginning of
shutdown and execute it in parallel to the shutdown of the rest of the
system.

The flow of the two threads during shutdown is now:

Radio Thread
  * Start shutdown of the radio
  * Wait for radio off or time out
  * Notify that the radio is done
ShutdownThread
  * Broadcast ACTION_SHUTDOWN as a parallel broadcast. (The receivers
    will get as much time to handle onReceive as it takes execute the
    rest of the tasks in the shut down flow. If they are not done in
    that time, we don't care.)
  * Shutdown ActivityManager
  * Shutdown MountService
  * Wait for MountService and radio to notify done
  * Vibrate
  * Low level shutdown

Change-Id: Ifdd8a9c75337fd9d00148a0d2b9917e10fa60634