Merge "Update time when turning on screen, in addition to waking up" into mnc-dev
diff --git a/Android.mk b/Android.mk
index a7a2ecb..18d9c69 100644
--- a/Android.mk
+++ b/Android.mk
@@ -750,6 +750,7 @@
     -since $(SRC_API_DIR)/20.txt 20 \
     -since $(SRC_API_DIR)/21.txt 21 \
     -since $(SRC_API_DIR)/22.txt 22 \
+    -since $(SRC_API_DIR)/23.txt 23 \
 		-werror -hide 111 -hide 113 \
 		-overview $(LOCAL_PATH)/core/java/overview.html
 
@@ -787,7 +788,7 @@
 
 ## SDK version identifiers used in the published docs
   # major[.minor] version for current SDK. (full releases only)
-framework_docs_SDK_VERSION:=5.1
+framework_docs_SDK_VERSION:=6.0
   # release version (ie "Release x")  (full releases only)
 framework_docs_SDK_REL_ID:=1
 
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index cf28490..ae8cae8 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1267,7 +1267,7 @@
 
          If this string is empty or the specified package does not exist, then
          the platform will search for an SMS app and use that (if there is one)-->
-    <string name="default_sms_application" translatable="false"></string>
+    <string name="default_sms_application" translatable="false">com.android.messaging</string>
 
     <!-- Default web browser.  This is the package name of the application that will
          be the default browser when the device first boots.  Afterwards the user
diff --git a/docs/html/guide/topics/manifest/uses-sdk-element.jd b/docs/html/guide/topics/manifest/uses-sdk-element.jd
index 3ac87ef..642b820 100644
--- a/docs/html/guide/topics/manifest/uses-sdk-element.jd
+++ b/docs/html/guide/topics/manifest/uses-sdk-element.jd
@@ -19,7 +19,6 @@
       <li><a href="#testing">Testing against higher API Levels</a></li>
     </ol>
   </li>
-  <li><a href="#provisional">Using a Provisional API Level</a></li>
   <li><a href="#filtering">Filtering the Reference Documentation by API Level</a></li>
 </ol>
 </div>
@@ -227,6 +226,11 @@
 <table>
   <tr><th>Platform Version</th><th>API Level</th><th>VERSION_CODE</th><th>Notes</th></tr>
 
+    <tr><td>Android 6.0</td>
+    <td><a href="{@docRoot}sdk/api_diff/23/changes.html" title="Diff Report">23</a></td>
+    <td>{@link android.os.Build.VERSION_CODES#M}</td>
+    <td><a href="{@docRoot}preview/api-overview.html">API Changes</a></td></tr>
+
     <tr><td><a href="{@docRoot}about/versions/android-5.1.html">Android 5.1</a></td>
     <td><a href="{@docRoot}sdk/api_diff/22/changes.html" title="Diff Report">22</a></td>
     <td>{@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1}</td>
@@ -552,29 +556,6 @@
 of the Android platform it runs. See the table at the top of this document for
 a list of platform versions and their API Levels. </p>
 
-<h2 id="provisional">Using a Provisional API Level</h2>
-
-<p>In some cases, an "Early Look" Android SDK platform may be available. To let
-you begin developing on the platform although the APIs may not be final, the
-platform's API Level integer will not be specified. You must instead use the
-platform's <em>provisional API Level</em> in your application manifest, in order
-to build applications against the platform. A provisional API Level is not an
-integer, but a string matching the codename of the unreleased platform version.
-The provisional API Level will be specified in the release notes for the Early
-Look SDK release notes and is case-sensitive.</p>
-
-<p>The use of a provisional API Level is designed to protect developers and
-device users from inadvertently publishing or installing applications based on
-the Early Look framework API, which may not run properly on actual devices
-running the final system image.</p>
-
-<p>The provisional API Level will only be valid while using the Early Look SDK
-and can only be used to run applications in the emulator. An application using
-the provisional API Level can never be installed on an Android device. At the
-final release of the platform, you must replace any instances of the provisional
-API Level in your application manifest with the final platform's actual API
-Level integer.</p>
-
 
 <h2 id="filtering">Filtering the Reference Documentation by API Level</h2>
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java
index daa84ad..a04edf7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java
@@ -164,11 +164,18 @@
             // Our current device is still valid.
             return;
         }
+        mLastDevice = null;
         for (CachedBluetoothDevice device : getDevices()) {
             if (device.isConnected()) {
                 mLastDevice = device;
             }
         }
+        if (mLastDevice == null && mConnectionState == BluetoothAdapter.STATE_CONNECTED) {
+            // If somehow we think we are connected, but have no connected devices, we aren't
+            // connected.
+            mConnectionState = BluetoothAdapter.STATE_DISCONNECTED;
+            mHandler.sendEmptyMessage(H.MSG_STATE_CHANGED);
+        }
     }
 
     @Override
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 2a79a47..489bcdb 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -5493,10 +5493,6 @@
         // may happen in a future call to goToSleep.
         synchronized (mLock) {
             mAwake = true;
-            if (mKeyguardDelegate != null) {
-                mHandler.removeMessages(MSG_KEYGUARD_DRAWN_TIMEOUT);
-                mHandler.sendEmptyMessageDelayed(MSG_KEYGUARD_DRAWN_TIMEOUT, 1000);
-            }
 
             updateWakeGestureListenerLp();
             updateOrientationListenerLp();
@@ -5586,6 +5582,8 @@
             mScreenOnListener = screenOnListener;
 
             if (mKeyguardDelegate != null) {
+                mHandler.removeMessages(MSG_KEYGUARD_DRAWN_TIMEOUT);
+                mHandler.sendEmptyMessageDelayed(MSG_KEYGUARD_DRAWN_TIMEOUT, 1000);
                 mKeyguardDelegate.onScreenTurningOn(mKeyguardDrawnCallback);
             } else {
                 if (DEBUG_WAKEUP) Slog.d(TAG,