Merge "Add flag to hide disabled keyguard options."
diff --git a/res/layout/app_preferred_settings.xml b/res/layout/app_preferred_settings.xml
index 7c6a45f..533887d 100644
--- a/res/layout/app_preferred_settings.xml
+++ b/res/layout/app_preferred_settings.xml
@@ -1,21 +1,20 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-/*
-** Copyright 2015, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+     Copyright (C) 2015 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
 -->
+
 <ScrollView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
@@ -44,6 +43,7 @@
             android:layout_gravity="center_vertical"
             android:paddingStart="?android:attr/listPreferredItemPaddingStart"
             android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
+
             <TextView android:id="@+id/auto_launch"
                 android:textAppearance="?android:attr/textAppearanceSmall"
                 android:layout_alignParentStart="true"
@@ -57,6 +57,7 @@
                 android:layout_below="@id/auto_launch"
                 android:paddingTop="4dip"
                 android:orientation="horizontal">
+
                 <View
                     android:layout_width="120dip"
                     android:layout_height="0dip"
@@ -72,8 +73,11 @@
                     android:layout_height="wrap_content"
                     android:layout_weight="0.4"
                     android:text="@string/clear_activities" />
+
             </LinearLayout>
+
         </RelativeLayout>
 
     </LinearLayout>
+
 </ScrollView>
diff --git a/res/layout/installed_app_details.xml b/res/layout/installed_app_details.xml
index ccbe105..cebec28 100644
--- a/res/layout/installed_app_details.xml
+++ b/res/layout/installed_app_details.xml
@@ -16,6 +16,7 @@
 ** limitations under the License.
 */
 -->
+
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/all_details"
diff --git a/res/layout/permission_settings.xml b/res/layout/permission_settings.xml
index 8233c81..f08b9d6 100644
--- a/res/layout/permission_settings.xml
+++ b/res/layout/permission_settings.xml
@@ -1,21 +1,20 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-/*
-** Copyright 2015, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+     Copyright (C) 2015 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
 -->
+
 <ScrollView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
diff --git a/res/layout/storage_settings.xml b/res/layout/storage_settings.xml
index b8dddfd..a73cf4c 100644
--- a/res/layout/storage_settings.xml
+++ b/res/layout/storage_settings.xml
@@ -1,21 +1,20 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-/*
-** Copyright 2015, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+     Copyright (C) 2015 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
 -->
+
 <ScrollView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d99570b..744cf0b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -285,18 +285,8 @@
     <!-- Bluetooth settings.  Message for disabling a profile of a bluetooth device. [CHAR LIMIT=NONE] -->
     <string name="bluetooth_disable_profile_message">This will disable:&lt;br>&lt;b><xliff:g id="profile_name">%1$s</xliff:g>&lt;/b>&lt;br>&lt;br>From:&lt;br>&lt;b><xliff:g id="device_name">%2$s</xliff:g>&lt;/b></string>
 
-    <!-- Bluetooth settings.  Message when connected to a device, except for phone audio. [CHAR LIMIT=40] -->
-    <string name="bluetooth_connected_no_headset">Connected (no phone)</string>
-    <!-- Bluetooth settings.  Message when connected to a device, except for media audio. [CHAR LIMIT=40] -->
-    <string name="bluetooth_connected_no_a2dp">Connected (no media)</string>
-    <!-- Bluetooth settings.  Message when connected to a device, except for map. [CHAR LIMIT=40] -->
-    <string name="bluetooth_connected_no_map">Connected (no message access)</string>
-    <!-- Bluetooth settings.  Message when connected to a device, except for phone/media audio. [CHAR LIMIT=40] -->
-    <string name="bluetooth_connected_no_headset_no_a2dp">Connected (no phone or media)</string>
     <!-- Bluetooth settings.  Message when the device state is unknown -->
     <string name="bluetooth_unknown" />
-    <!--Bluetooth settings screen, summary text under individual Bluetooth devices when pairing -->
-    <string name="bluetooth_pairing">Pairing\u2026</string>
     <!--Bluetooth settings screen, summary text for Bluetooth device with no name -->
     <string name="bluetooth_device">Unnamed Bluetooth device</string>
     <!--Bluetooth settings screen, text that appears in heading bar when scanning for devices -->
@@ -6010,36 +6000,36 @@
    <string name="slot_number">(Slot<xliff:g id="slot_num">%1$d</xliff:g>)</string>
 
    <!-- New strings needed for App Info 2 -->
-   <!-- Preference label for app default launch settings -->
+   <!-- Preference label for app default launch settings [CHAR LIMIT=35]-->
    <string name="launch_by_default">Launch by default</string>
 
-   <!-- Summary for app storage preference -->
+   <!-- Summary for app storage preference [CHAR LIMIT=15] -->
    <string name="storage_summary_format"><xliff:g id="size" example="30.00MB">%1$s</xliff:g> used in <xliff:g id="storage_type" example="internal memory">%2$s</xliff:g></string>
-   <!-- Internal storage label -->
+   <!-- Internal storage label [CHAR LIMIT=25] -->
    <string name="storage_type_internal">internal memory</string>
-   <!-- External storage label -->
+   <!-- External storage label [CHAR LIMIT=25] -->
    <string name="storage_type_external">external memory</string>
 
-   <!-- App notification summary with notifications enabled -->
+   <!-- App notification summary with notifications enabled [CHAR LIMIT=40] -->
    <string name="notifications_enabled">On</string>
-   <!-- App notification summary with notifications disabled -->
+   <!-- App notification summary with notifications disabled [CHAR LIMIT=40] -->
    <string name="notifications_disabled">Block</string>
-   <!-- App notification summary with notifications sensitive -->
+   <!-- App notification summary with notifications sensitive [CHAR LIMIT=40] -->
    <string name="notifications_sensitive">Sensitive</string>
-   <!-- App notification summary with notifications priority -->
+   <!-- App notification summary with notifications priority [CHAR LIMIT=40] -->
    <string name="notifications_priority">Priority</string>
-   <!-- App notification summary with notifications priority and sensitive -->
+   <!-- App notification summary with notifications priority and sensitive [CHAR LIMIT=40] -->
    <string name="notifications_priority_sensitive">Priority &amp; Sensitive</string>
 
-   <!-- Permissions preference summary -->
+   <!-- Permissions preference summary [CHAR LIMIT=40] -->
    <plurals name="permissions_summary">
        <item quantity="one"><xliff:g id="count" example="1">%d</xliff:g> permission granted</item>
        <item quantity="other"><xliff:g id="count" example="10">%d</xliff:g> permissions granted</item>
    </plurals>
 
-   <!-- Launch defaults preference summary with some set -->
+   <!-- Launch defaults preference summary with some set [CHAR LIMIT=40] -->
    <string name="launch_defaults_some">Some defaults set</string>
-   <!-- Launch defaults preference summary with none set -->
+   <!-- Launch defaults preference summary with none set [CHAR LIMIT=40] -->
    <string name="launch_defaults_none">No defaults set</string>
 
 </resources>
diff --git a/src/com/android/settings/AppHeader.java b/src/com/android/settings/AppHeader.java
index 5cd126a..cd76e80 100644
--- a/src/com/android/settings/AppHeader.java
+++ b/src/com/android/settings/AppHeader.java
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package com.android.settings;
 
 import android.app.Activity;
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index af793f7..aeb3827 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -416,8 +416,8 @@
         };
 
         private void removeAllFingerprintTemplates() {
-            mFingerprintManager.startListening(mReceiver);
-            if (mFingerprintManager != null) {
+            if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected()) {
+                mFingerprintManager.startListening(mReceiver);
                 mFingerprintManager.remove(0 /* all fingerprint templates */);
             }
         }
diff --git a/src/com/android/settings/applications/AppInfoBase.java b/src/com/android/settings/applications/AppInfoBase.java
index 2203a21..81edde2 100644
--- a/src/com/android/settings/applications/AppInfoBase.java
+++ b/src/com/android/settings/applications/AppInfoBase.java
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package com.android.settings.applications;
 
 import android.app.Activity;
@@ -151,15 +152,29 @@
     protected abstract AlertDialog createDialog(int id, int errorCode);
 
     @Override
-    public void onRunningStateChanged(boolean running) { }
+    public void onRunningStateChanged(boolean running) {
+        // No op.
+    }
+
     @Override
-    public void onRebuildComplete(ArrayList<AppEntry> apps) { }
+    public void onRebuildComplete(ArrayList<AppEntry> apps) {
+        // No op.
+    }
+
     @Override
-    public void onPackageIconChanged() { }
+    public void onPackageIconChanged() {
+        // No op.
+    }
+
     @Override
-    public void onPackageSizeChanged(String packageName) { }
+    public void onPackageSizeChanged(String packageName) {
+        // No op.
+    }
+
     @Override
-    public void onAllSizesComputed() { }
+    public void onAllSizesComputed() {
+        // No op.
+    }
 
     @Override
     public void onPackageListChanged() {
diff --git a/src/com/android/settings/applications/AppLaunchSettings.java b/src/com/android/settings/applications/AppLaunchSettings.java
index 6379102..24a6fe0 100644
--- a/src/com/android/settings/applications/AppLaunchSettings.java
+++ b/src/com/android/settings/applications/AppLaunchSettings.java
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package com.android.settings.applications;
 
 import android.app.AlertDialog;
diff --git a/src/com/android/settings/applications/AppPermissionSettings.java b/src/com/android/settings/applications/AppPermissionSettings.java
index a5b4895..496faf5 100644
--- a/src/com/android/settings/applications/AppPermissionSettings.java
+++ b/src/com/android/settings/applications/AppPermissionSettings.java
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package com.android.settings.applications;
 
 import android.app.AlertDialog;
diff --git a/src/com/android/settings/applications/AppStorageSettings.java b/src/com/android/settings/applications/AppStorageSettings.java
index 5ae5e8f..3df01ed 100644
--- a/src/com/android/settings/applications/AppStorageSettings.java
+++ b/src/com/android/settings/applications/AppStorageSettings.java
@@ -45,7 +45,7 @@
 import com.android.settings.applications.ApplicationsState.Callbacks;
 
 public class AppStorageSettings extends AppInfoWithHeader implements OnClickListener, Callbacks {
-    private static final String TAG = "AppStorageSettings";
+    private static final String TAG = AppStorageSettings.class.getSimpleName();
 
     //internal constants used in Handler
     private static final int OP_SUCCESSFUL = 1;
diff --git a/src/com/android/settings/applications/HeaderPreference.java b/src/com/android/settings/applications/HeaderPreference.java
index 57fe9f3..a3d4bde 100644
--- a/src/com/android/settings/applications/HeaderPreference.java
+++ b/src/com/android/settings/applications/HeaderPreference.java
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package com.android.settings.applications;
 
 import android.content.Context;
diff --git a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
index 67c026b..0bb54b2 100644
--- a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
+++ b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
@@ -112,7 +112,7 @@
          */
         setTitle(mCachedDevice.getName());
 
-        int summaryResId = getConnectionSummary();
+        int summaryResId = mCachedDevice.getConnectionSummary();
         if (summaryResId != 0) {
             setSummary(summaryResId);
         } else {
@@ -232,60 +232,6 @@
         }
     }
 
-    private int getConnectionSummary() {
-        final CachedBluetoothDevice cachedDevice = mCachedDevice;
-
-        boolean profileConnected = false;       // at least one profile is connected
-        boolean a2dpNotConnected = false;       // A2DP is preferred but not connected
-        boolean headsetNotConnected = false;    // Headset is preferred but not connected
-
-        for (LocalBluetoothProfile profile : cachedDevice.getProfiles()) {
-            int connectionStatus = cachedDevice.getProfileConnectionState(profile);
-
-            switch (connectionStatus) {
-                case BluetoothProfile.STATE_CONNECTING:
-                case BluetoothProfile.STATE_DISCONNECTING:
-                    return Utils.getConnectionStateSummary(connectionStatus);
-
-                case BluetoothProfile.STATE_CONNECTED:
-                    profileConnected = true;
-                    break;
-
-                case BluetoothProfile.STATE_DISCONNECTED:
-                    if (profile.isProfileReady()) {
-                        if (profile instanceof A2dpProfile) {
-                            a2dpNotConnected = true;
-                        } else if (profile instanceof HeadsetProfile) {
-                            headsetNotConnected = true;
-                        }
-                    }
-                    break;
-            }
-        }
-
-        if (profileConnected) {
-            if (a2dpNotConnected && headsetNotConnected) {
-                return R.string.bluetooth_connected_no_headset_no_a2dp;
-            } else if (a2dpNotConnected) {
-                return R.string.bluetooth_connected_no_a2dp;
-            } else if (headsetNotConnected) {
-                return R.string.bluetooth_connected_no_headset;
-            } else {
-                return R.string.bluetooth_connected;
-            }
-        }
-
-        switch (cachedDevice.getBondState()) {
-            case BluetoothDevice.BOND_BONDING:
-                return R.string.bluetooth_pairing;
-
-            case BluetoothDevice.BOND_BONDED:
-            case BluetoothDevice.BOND_NONE:
-            default:
-                return 0;
-        }
-    }
-
     private int getBtClassDrawable() {
         BluetoothClass btClass = mCachedDevice.getBtClass();
         if (btClass != null) {
diff --git a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
index b2a703d..f07a9f2 100644
--- a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
+++ b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
@@ -220,4 +220,6 @@
             updateProgressUi(false);
         }
     }
+
+    public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) { }
 }
diff --git a/src/com/android/settings/bluetooth/DockService.java b/src/com/android/settings/bluetooth/DockService.java
index c4f6485..020ca0c 100644
--- a/src/com/android/settings/bluetooth/DockService.java
+++ b/src/com/android/settings/bluetooth/DockService.java
@@ -937,6 +937,7 @@
         public void onBluetoothStateChanged(int bluetoothState) { }
         public void onDeviceAdded(CachedBluetoothDevice cachedDevice) { }
         public void onDeviceDeleted(CachedBluetoothDevice cachedDevice) { }
+        public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) { }
 
         @Override
         public void onScanningStateChanged(boolean started) {