summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDan Sandler <dsandler@android.com>2014-04-14 17:54:21 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-04-14 17:54:22 +0000
commit352e108259bcb3305f034cfb042287d43a5e8f80 (patch)
tree9335c30335ee0082a86bbdeb3fb5fdd75dfe24fc /packages
parentdb8b130a19484cb6018667905e64d42ab793654f (diff)
parentf3e3140696ca775fe2f62868addb1eec2b1c18fa (diff)
downloadframeworks_base-352e108259bcb3305f034cfb042287d43a5e8f80.zip
frameworks_base-352e108259bcb3305f034cfb042287d43a5e8f80.tar.gz
frameworks_base-352e108259bcb3305f034cfb042287d43a5e8f80.tar.bz2
Merge "Merge remote-tracking branch 'goog/master-lockscreen-dev'"
Diffstat (limited to 'packages')
-rw-r--r--packages/BackupRestoreConfirmation/res/values-sk/strings.xml2
-rw-r--r--packages/DocumentsUI/res/values-it/strings.xml2
-rw-r--r--packages/DocumentsUI/res/values-pl/strings.xml4
-rw-r--r--packages/FusedLocation/res/values-fr-rCA/strings.xml2
-rw-r--r--packages/Keyguard/Android.mk8
-rw-r--r--packages/Keyguard/AndroidManifest.xml3
-rw-r--r--packages/Keyguard/res/layout-land/keyguard_host_view.xml2
-rw-r--r--packages/Keyguard/res/layout-land/keyguard_simple_host_view.xml2
-rw-r--r--packages/Keyguard/res/layout-land/keyguard_widget_pager.xml2
-rw-r--r--packages/Keyguard/res/layout-port/keyguard_host_view.xml2
-rw-r--r--packages/Keyguard/res/layout-port/keyguard_simple_host_view.xml2
-rw-r--r--packages/Keyguard/res/layout-port/keyguard_widget_pager.xml2
-rw-r--r--packages/Keyguard/res/layout-sw600dp-port/keyguard_host_view.xml2
-rw-r--r--packages/Keyguard/res/layout/keyguard_account_view.xml2
-rw-r--r--packages/Keyguard/res/layout/keyguard_bouncer.xml31
-rw-r--r--packages/Keyguard/res/layout/keyguard_face_unlock_view.xml2
-rw-r--r--packages/Keyguard/res/layout/keyguard_multi_user_selector.xml2
-rw-r--r--packages/Keyguard/res/layout/keyguard_password_view.xml2
-rw-r--r--packages/Keyguard/res/layout/keyguard_pattern_view.xml2
-rw-r--r--packages/Keyguard/res/layout/keyguard_pin_view.xml2
-rw-r--r--packages/Keyguard/res/layout/keyguard_presentation.xml2
-rw-r--r--packages/Keyguard/res/layout/keyguard_selector_view.xml2
-rw-r--r--packages/Keyguard/res/layout/keyguard_sim_pin_view.xml2
-rw-r--r--packages/Keyguard/res/layout/keyguard_sim_puk_view.xml2
-rw-r--r--packages/Keyguard/res/layout/keyguard_status_area.xml2
-rw-r--r--packages/Keyguard/res/layout/keyguard_status_view.xml55
-rw-r--r--packages/Keyguard/res/values-sk/strings.xml2
-rw-r--r--packages/Keyguard/res/values-vi/strings.xml2
-rw-r--r--packages/Keyguard/res/values/dimens.xml2
-rw-r--r--packages/Keyguard/res/values/styles.xml3
-rw-r--r--packages/Keyguard/src/com/android/keyguard/CameraWidgetFrame.java8
-rw-r--r--packages/Keyguard/src/com/android/keyguard/EmergencyButton.java5
-rw-r--r--packages/Keyguard/src/com/android/keyguard/FaceUnlock.java6
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java2
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java2
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java32
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardDisplayManager.java8
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardFaceUnlockView.java2
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java8
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserAvatar.java6
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java2
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java2
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java2
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java11
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java2
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java2
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java5
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java10
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java2
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java4
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java38
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java35
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java575
-rw-r--r--packages/Keyguard/src/com/android/keyguard/MultiUserAvatarCache.java11
-rw-r--r--packages/Keyguard/src/com/android/keyguard/PagedView.java2
-rw-r--r--packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java2
-rw-r--r--packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java71
-rw-r--r--packages/Keyguard/src/com/android/keyguard/analytics/KeyguardAnalytics.java6
-rw-r--r--packages/PrintSpooler/res/values-da/strings.xml4
-rw-r--r--packages/PrintSpooler/res/values-sl/strings.xml2
-rw-r--r--packages/PrintSpooler/res/values-sw/strings.xml4
-rw-r--r--packages/Shell/res/values-sk/strings.xml4
-rw-r--r--packages/SystemUI/Android.mk6
-rw-r--r--packages/SystemUI/AndroidManifest.xml19
-rw-r--r--packages/SystemUI/res/drawable/ic_notify_button_bg.xml4
-rw-r--r--packages/SystemUI/res/layout-sw600dp/super_status_bar.xml52
-rw-r--r--packages/SystemUI/res/layout/navigation_bar.xml1
-rw-r--r--packages/SystemUI/res/layout/status_bar.xml1
-rw-r--r--packages/SystemUI/res/layout/status_bar_expanded.xml12
-rw-r--r--packages/SystemUI/res/layout/status_bar_expanded_header.xml25
-rw-r--r--packages/SystemUI/res/layout/status_bar_flip_button.xml37
-rw-r--r--packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml51
-rw-r--r--packages/SystemUI/res/layout/status_bar_notification_row.xml1
-rw-r--r--packages/SystemUI/res/layout/super_status_bar.xml25
-rw-r--r--packages/SystemUI/res/layout/user_switcher_host.xml36
-rw-r--r--packages/SystemUI/res/layout/user_switcher_item.xml40
-rw-r--r--packages/SystemUI/res/values-sw600dp/config.xml2
-rw-r--r--packages/SystemUI/res/values-sw600dp/dimens.xml9
-rw-r--r--packages/SystemUI/res/values/colors.xml6
-rw-r--r--packages/SystemUI/res/values/config.xml4
-rw-r--r--packages/SystemUI/res/values/dimens.xml6
-rw-r--r--packages/SystemUI/res/values/strings.xml5
-rw-r--r--packages/SystemUI/res/values/styles.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/SystemUIApplication.java111
-rw-r--r--packages/SystemUI/src/com/android/systemui/SystemUIService.java55
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java (renamed from packages/Keyguard/src/com/android/keyguard/KeyguardService.java)112
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java (renamed from packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java)319
-rw-r--r--packages/SystemUI/src/com/android/systemui/settings/UserSwitcherHostView.java172
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java73
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/LatestItemView.java118
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java69
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java139
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java68
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java226
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java25
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java194
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java200
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java56
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java14
109 files changed, 2146 insertions, 1256 deletions
diff --git a/packages/BackupRestoreConfirmation/res/values-sk/strings.xml b/packages/BackupRestoreConfirmation/res/values-sk/strings.xml
index 12f562b..21e21b5 100644
--- a/packages/BackupRestoreConfirmation/res/values-sk/strings.xml
+++ b/packages/BackupRestoreConfirmation/res/values-sk/strings.xml
@@ -24,7 +24,7 @@
<string name="restore_confirm_text" msgid="7499866728030461776">"Z pripojeného počítača bolo vyžiadané úplné obnovenie všetkých údajov. Chcete túto akciu povoliť?\n\nAk ste toto obnovenie nevyžiadali vy, túto operáciu nepovoľujte. Táto akcia nahradí všetky údaje v zariadení."</string>
<string name="allow_restore_button_label" msgid="3081286752277127827">"Obnoviť údaje"</string>
<string name="deny_restore_button_label" msgid="1724367334453104378">"Neobnoviť"</string>
- <string name="current_password_text" msgid="8268189555578298067">"Zadajte svoje aktuálne heslo záloh nižšie:"</string>
+ <string name="current_password_text" msgid="8268189555578298067">"Zadajte svoje aktuálne heslo pre zálohu nižšie:"</string>
<string name="device_encryption_restore_text" msgid="1570864916855208992">"Zadajte svoje heslo na šifrovanie zariadenia nižšie."</string>
<string name="device_encryption_backup_text" msgid="5866590762672844664">"Zadajte svoje heslo na šifrovanie zariadenia nižšie. Bude tiež použité na šifrovanie archívu zálohy."</string>
<string name="backup_enc_password_text" msgid="4981585714795233099">"Zadajte heslo, ktoré sa použije pri šifrovaní údajov úplnej zálohy. Ak pole ponecháte prázdne, použije sa vaše aktuálne heslo zálohy:"</string>
diff --git a/packages/DocumentsUI/res/values-it/strings.xml b/packages/DocumentsUI/res/values-it/strings.xml
index baca387..28323b6 100644
--- a/packages/DocumentsUI/res/values-it/strings.xml
+++ b/packages/DocumentsUI/res/values-it/strings.xml
@@ -38,7 +38,7 @@
<string name="save_error" msgid="6167009778003223664">"Impossibile salvare il documento"</string>
<string name="create_error" msgid="3735649141335444215">"Impossibile creare la cartella"</string>
<string name="query_error" msgid="1222448261663503501">"Impossibile chiedere documenti"</string>
- <string name="root_recent" msgid="4470053704320518133">"Recenti"</string>
+ <string name="root_recent" msgid="4470053704320518133">"Recente"</string>
<string name="root_available_bytes" msgid="8568452858617033281">"<xliff:g id="SIZE">%1$s</xliff:g> liberi"</string>
<string name="root_type_service" msgid="2178854894416775409">"Servizi di archiviazione"</string>
<string name="root_type_shortcut" msgid="3318760609471618093">"Scorciatoie"</string>
diff --git a/packages/DocumentsUI/res/values-pl/strings.xml b/packages/DocumentsUI/res/values-pl/strings.xml
index 42cec9c..f4e5582 100644
--- a/packages/DocumentsUI/res/values-pl/strings.xml
+++ b/packages/DocumentsUI/res/values-pl/strings.xml
@@ -44,8 +44,8 @@
<string name="root_type_shortcut" msgid="3318760609471618093">"Skróty"</string>
<string name="root_type_device" msgid="7121342474653483538">"Urządzenia"</string>
<string name="root_type_apps" msgid="8838065367985945189">"Więcej aplikacji"</string>
- <string name="pref_advanced_devices" msgid="903257239609301276">"Pokaż urządzenia zaawansowane"</string>
- <string name="pref_file_size" msgid="2826879315743961459">"Pokaż rozmiar pliku"</string>
+ <string name="pref_advanced_devices" msgid="903257239609301276">"Wyświetl urządzenia zaawansowane"</string>
+ <string name="pref_file_size" msgid="2826879315743961459">"Wyświetl rozmiar pliku"</string>
<string name="pref_device_size" msgid="3542106883278997222">"Wyświetl rozmiar urządzenia"</string>
<string name="empty" msgid="7858882803708117596">"Brak elementów"</string>
<string name="toast_no_application" msgid="1339885974067891667">"Nie można otworzyć pliku"</string>
diff --git a/packages/FusedLocation/res/values-fr-rCA/strings.xml b/packages/FusedLocation/res/values-fr-rCA/strings.xml
index c7d33af..0d2cccc 100644
--- a/packages/FusedLocation/res/values-fr-rCA/strings.xml
+++ b/packages/FusedLocation/res/values-fr-rCA/strings.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_label" msgid="5379477904423203699">"Tables de fusion"</string>
+ <string name="app_label" msgid="5379477904423203699">"Fused Location"</string>
</resources>
diff --git a/packages/Keyguard/Android.mk b/packages/Keyguard/Android.mk
index 5b08674..1be44f9 100644
--- a/packages/Keyguard/Android.mk
+++ b/packages/Keyguard/Android.mk
@@ -19,7 +19,7 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-subdir-Iaidl-files) \
$(call all-proto-files-under,src)
-LOCAL_PACKAGE_NAME := Keyguard
+LOCAL_MODULE := Keyguard
LOCAL_CERTIFICATE := platform
@@ -30,6 +30,8 @@ LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := optional_field_style=accessors
-include $(BUILD_PACKAGE)
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-#include $(call all-makefiles-under,$(LOCAL_PATH))
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+#include $(call all-makefiles-under,$(LOCAL_PATH)) \ No newline at end of file
diff --git a/packages/Keyguard/AndroidManifest.xml b/packages/Keyguard/AndroidManifest.xml
index b2d2ec5..352317d 100644
--- a/packages/Keyguard/AndroidManifest.xml
+++ b/packages/Keyguard/AndroidManifest.xml
@@ -46,8 +46,5 @@
android:persistent="true"
android:supportsRtl="true">
- <service android:name=".KeyguardService"
- android:exported="true" />
-
</application>
</manifest>
diff --git a/packages/Keyguard/res/layout-land/keyguard_host_view.xml b/packages/Keyguard/res/layout-land/keyguard_host_view.xml
index 9f1c1f0..1d596d3 100644
--- a/packages/Keyguard/res/layout-land/keyguard_host_view.xml
+++ b/packages/Keyguard/res/layout-land/keyguard_host_view.xml
@@ -21,7 +21,7 @@
and the security view. -->
<com.android.keyguard.KeyguardHostView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_host_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/packages/Keyguard/res/layout-land/keyguard_simple_host_view.xml b/packages/Keyguard/res/layout-land/keyguard_simple_host_view.xml
index ebd0a64..49b4212 100644
--- a/packages/Keyguard/res/layout-land/keyguard_simple_host_view.xml
+++ b/packages/Keyguard/res/layout-land/keyguard_simple_host_view.xml
@@ -21,7 +21,7 @@
and the security view. -->
<com.android.keyguard.KeyguardSimpleHostView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_host_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
diff --git a/packages/Keyguard/res/layout-land/keyguard_widget_pager.xml b/packages/Keyguard/res/layout-land/keyguard_widget_pager.xml
index da31065..50c2709 100644
--- a/packages/Keyguard/res/layout-land/keyguard_widget_pager.xml
+++ b/packages/Keyguard/res/layout-land/keyguard_widget_pager.xml
@@ -19,7 +19,7 @@
<!-- This is the selector widget that allows the user to select an action. -->
<com.android.keyguard.KeyguardWidgetCarousel
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingLeft="25dp"
android:paddingRight="25dp"
diff --git a/packages/Keyguard/res/layout-port/keyguard_host_view.xml b/packages/Keyguard/res/layout-port/keyguard_host_view.xml
index 136b296..8223db4 100644
--- a/packages/Keyguard/res/layout-port/keyguard_host_view.xml
+++ b/packages/Keyguard/res/layout-port/keyguard_host_view.xml
@@ -21,7 +21,7 @@
and the security view. -->
<com.android.keyguard.KeyguardHostView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_host_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/packages/Keyguard/res/layout-port/keyguard_simple_host_view.xml b/packages/Keyguard/res/layout-port/keyguard_simple_host_view.xml
index cba7667..ed600b0 100644
--- a/packages/Keyguard/res/layout-port/keyguard_simple_host_view.xml
+++ b/packages/Keyguard/res/layout-port/keyguard_simple_host_view.xml
@@ -21,7 +21,7 @@
and the security view. -->
<com.android.keyguard.KeyguardSimpleHostView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_host_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
diff --git a/packages/Keyguard/res/layout-port/keyguard_widget_pager.xml b/packages/Keyguard/res/layout-port/keyguard_widget_pager.xml
index d0a07ca..6d7d864 100644
--- a/packages/Keyguard/res/layout-port/keyguard_widget_pager.xml
+++ b/packages/Keyguard/res/layout-port/keyguard_widget_pager.xml
@@ -19,7 +19,7 @@
<!-- This is the selector widget that allows the user to select an action. -->
<com.android.keyguard.KeyguardWidgetPager
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/app_widget_container"
android:paddingLeft="25dp"
diff --git a/packages/Keyguard/res/layout-sw600dp-port/keyguard_host_view.xml b/packages/Keyguard/res/layout-sw600dp-port/keyguard_host_view.xml
index 85f6b6d..ba2f3a6 100644
--- a/packages/Keyguard/res/layout-sw600dp-port/keyguard_host_view.xml
+++ b/packages/Keyguard/res/layout-sw600dp-port/keyguard_host_view.xml
@@ -21,7 +21,7 @@
and the security view. -->
<com.android.keyguard.KeyguardHostView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_host_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/packages/Keyguard/res/layout/keyguard_account_view.xml b/packages/Keyguard/res/layout/keyguard_account_view.xml
index 766effa..bde2ec6 100644
--- a/packages/Keyguard/res/layout/keyguard_account_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_account_view.xml
@@ -18,7 +18,7 @@
-->
<com.android.keyguard.KeyguardAccountView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_account_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/packages/Keyguard/res/layout/keyguard_bouncer.xml b/packages/Keyguard/res/layout/keyguard_bouncer.xml
new file mode 100644
index 0000000..dedf427
--- /dev/null
+++ b/packages/Keyguard/res/layout/keyguard_bouncer.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2014 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
+ -->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <View android:id="@+id/bouncer_background"
+ android:background="#aa000000"
+ android:clickable="true"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+
+ <include layout="@layout/keyguard_simple_host_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+</FrameLayout>
+
diff --git a/packages/Keyguard/res/layout/keyguard_face_unlock_view.xml b/packages/Keyguard/res/layout/keyguard_face_unlock_view.xml
index 94c68a5..8c8ec7a 100644
--- a/packages/Keyguard/res/layout/keyguard_face_unlock_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_face_unlock_view.xml
@@ -20,7 +20,7 @@
<!-- This is the screen that allows the user to unlock by showing their face. -->
<com.android.keyguard.KeyguardFaceUnlockView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_face_unlock_view"
android:orientation="vertical"
android:layout_width="match_parent"
diff --git a/packages/Keyguard/res/layout/keyguard_multi_user_selector.xml b/packages/Keyguard/res/layout/keyguard_multi_user_selector.xml
index c1d5326..83036ab 100644
--- a/packages/Keyguard/res/layout/keyguard_multi_user_selector.xml
+++ b/packages/Keyguard/res/layout/keyguard_multi_user_selector.xml
@@ -17,7 +17,7 @@
*/
-->
<com.android.keyguard.KeyguardMultiUserSelectorView
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
androidprv:layout_childType="userSwitcher"
android:id="@+id/keyguard_user_selector"
diff --git a/packages/Keyguard/res/layout/keyguard_password_view.xml b/packages/Keyguard/res/layout/keyguard_password_view.xml
index d8012bf..ed3f0e0 100644
--- a/packages/Keyguard/res/layout/keyguard_password_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_password_view.xml
@@ -18,7 +18,7 @@
-->
<com.android.keyguard.KeyguardPasswordView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_password_view"
android:orientation="vertical"
android:layout_width="match_parent"
diff --git a/packages/Keyguard/res/layout/keyguard_pattern_view.xml b/packages/Keyguard/res/layout/keyguard_pattern_view.xml
index 0c9380c..3d7820f 100644
--- a/packages/Keyguard/res/layout/keyguard_pattern_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_pattern_view.xml
@@ -22,7 +22,7 @@
is the portrait layout. -->
<com.android.keyguard.KeyguardPatternView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_pattern_view"
android:orientation="vertical"
android:layout_width="match_parent"
diff --git a/packages/Keyguard/res/layout/keyguard_pin_view.xml b/packages/Keyguard/res/layout/keyguard_pin_view.xml
index 00c6a21..a804c8c 100644
--- a/packages/Keyguard/res/layout/keyguard_pin_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_pin_view.xml
@@ -19,7 +19,7 @@
<com.android.keyguard.KeyguardPINView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_pin_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/packages/Keyguard/res/layout/keyguard_presentation.xml b/packages/Keyguard/res/layout/keyguard_presentation.xml
index 7df0b70..ab676aa 100644
--- a/packages/Keyguard/res/layout/keyguard_presentation.xml
+++ b/packages/Keyguard/res/layout/keyguard_presentation.xml
@@ -20,7 +20,7 @@
<!-- This is a view that shows general status information in Keyguard. -->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/presentation"
android:layout_width="match_parent"
android:layout_height="match_parent">
diff --git a/packages/Keyguard/res/layout/keyguard_selector_view.xml b/packages/Keyguard/res/layout/keyguard_selector_view.xml
index 6cb5e67..d3064ed 100644
--- a/packages/Keyguard/res/layout/keyguard_selector_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_selector_view.xml
@@ -20,7 +20,7 @@
<!-- This is the selector widget that allows the user to select an action. -->
<com.android.keyguard.KeyguardSelectorView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_selector_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml b/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml
index eccac19..e96220e 100644
--- a/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml
@@ -19,7 +19,7 @@
<!-- This is the SIM PIN view that allows the user to enter a SIM PIN to unlock the device. -->
<com.android.keyguard.KeyguardSimPinView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_sim_pin_view"
android:orientation="vertical"
android:layout_width="match_parent"
diff --git a/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml b/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml
index fe37203..bf15ba0 100644
--- a/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml
@@ -20,7 +20,7 @@
carrier-provided PUK code and entering a new SIM PIN for it. -->
<com.android.keyguard.KeyguardSimPukView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_sim_puk_view"
android:orientation="vertical"
android:layout_width="match_parent"
diff --git a/packages/Keyguard/res/layout/keyguard_status_area.xml b/packages/Keyguard/res/layout/keyguard_status_area.xml
index 98ba512..2730517 100644
--- a/packages/Keyguard/res/layout/keyguard_status_area.xml
+++ b/packages/Keyguard/res/layout/keyguard_status_area.xml
@@ -20,7 +20,7 @@
<!-- This is a view that shows general status information in Keyguard. -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
diff --git a/packages/Keyguard/res/layout/keyguard_status_view.xml b/packages/Keyguard/res/layout/keyguard_status_view.xml
index a4d298a..3b3a069 100644
--- a/packages/Keyguard/res/layout/keyguard_status_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_status_view.xml
@@ -18,43 +18,38 @@
-->
<!-- This is a view that shows general status information in Keyguard. -->
-<com.android.keyguard.KeyguardWidgetFrame
+<com.android.keyguard.KeyguardStatusView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
+ xmlns:androidprv="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyguard_status_view"
+ android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
androidprv:layout_maxWidth="@dimen/keyguard_security_width"
androidprv:layout_maxHeight="@dimen/keyguard_security_height"
- android:gravity="center">
-
- <com.android.keyguard.KeyguardStatusView
- android:id="@+id/keyguard_status_view_face_palm"
- android:orientation="vertical"
+ android:gravity="center_horizontal|top"
+ android:layout_marginTop="32dp"
+ android:layout_marginBottom="32dp"
+ android:contentDescription="@string/keyguard_accessibility_status">
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center_horizontal|top"
- android:contentDescription="@string/keyguard_accessibility_status">
- <LinearLayout
- android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal|top"
+ android:orientation="vertical"
+ android:focusable="true">
+ <TextClock
+ android:id="@+id/clock_view"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
- android:orientation="vertical"
- android:focusable="true">
- <TextClock
- android:id="@+id/clock_view"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal|top"
- android:textColor="@color/clock_white"
- android:singleLine="true"
- style="@style/widget_big_thin"
- android:format12Hour="@string/keyguard_widget_12_hours_format"
- android:format24Hour="@string/keyguard_widget_24_hours_format"
- android:baselineAligned="true"
- android:layout_marginBottom="@dimen/bottom_text_spacing_digital" />
+ android:textColor="@color/clock_white"
+ android:singleLine="true"
+ style="@style/widget_big_thin"
+ android:format12Hour="@string/keyguard_widget_12_hours_format"
+ android:format24Hour="@string/keyguard_widget_24_hours_format"
+ android:baselineAligned="true"
+ android:layout_marginBottom="@dimen/bottom_text_spacing_digital" />
- <include layout="@layout/keyguard_status_area" />
- </LinearLayout>
- </com.android.keyguard.KeyguardStatusView>
-</com.android.keyguard.KeyguardWidgetFrame>
+ <include layout="@layout/keyguard_status_area" />
+ </LinearLayout>
+</com.android.keyguard.KeyguardStatusView>
diff --git a/packages/Keyguard/res/values-sk/strings.xml b/packages/Keyguard/res/values-sk/strings.xml
index 89ac293..cdf8ca9 100644
--- a/packages/Keyguard/res/values-sk/strings.xml
+++ b/packages/Keyguard/res/values-sk/strings.xml
@@ -35,7 +35,7 @@
<string name="keyguard_low_battery" msgid="8143808018719173859">"Pripojte nabíjačku."</string>
<string name="keyguard_instructions_when_pattern_disabled" msgid="1332288268600329841">"Telefón odomknete stlačením tlačidla Menu."</string>
<string name="keyguard_network_locked_message" msgid="9169717779058037168">"Sieť je zablokovaná"</string>
- <string name="keyguard_missing_sim_message_short" msgid="494980561304211931">"Nie je vložená karta SIM"</string>
+ <string name="keyguard_missing_sim_message_short" msgid="494980561304211931">"Nie je vložená karta SIM."</string>
<string name="keyguard_missing_sim_message" product="tablet" msgid="1445849005909260039">"V tablete nie je žiadna karta SIM."</string>
<string name="keyguard_missing_sim_message" product="default" msgid="3481110395508637643">"V telefóne nie je žiadna karta SIM."</string>
<string name="keyguard_missing_sim_instructions" msgid="5210891509995942250">"Vložte kartu SIM."</string>
diff --git a/packages/Keyguard/res/values-vi/strings.xml b/packages/Keyguard/res/values-vi/strings.xml
index c775467..19eb4c5 100644
--- a/packages/Keyguard/res/values-vi/strings.xml
+++ b/packages/Keyguard/res/values-vi/strings.xml
@@ -75,7 +75,7 @@
<string name="keyguard_accessibility_transport_thumbs_down_description" msgid="8101433677192177861">"Bài hát được đánh dấu không thích"</string>
<string name="keyguard_accessibility_transport_heart_description" msgid="2336943232474689887">"Trái tim"</string>
<string name="keyguard_accessibility_show_bouncer" msgid="5425837272418176176">"Mở khóa để tiếp tục"</string>
- <string name="keyguard_accessibility_hide_bouncer" msgid="7896992171878309358">"Quá trình chạy bị hủy"</string>
+ <string name="keyguard_accessibility_hide_bouncer" msgid="7896992171878309358">"Quá trình khởi chạy bị hủy"</string>
<string name="keyguard_accessibility_delete_widget_start" msgid="4096550552634391451">"Thả <xliff:g id="WIDGET_INDEX">%1$s</xliff:g> để xóa."</string>
<string name="keyguard_accessibility_delete_widget_end" msgid="508833506780909393">"<xliff:g id="WIDGET_INDEX">%1$s</xliff:g> sẽ không bị xóa."</string>
<string name="password_keyboard_label_symbol_key" msgid="992280756256536042">"?123"</string>
diff --git a/packages/Keyguard/res/values/dimens.xml b/packages/Keyguard/res/values/dimens.xml
index 71e9924..c05f834 100644
--- a/packages/Keyguard/res/values/dimens.xml
+++ b/packages/Keyguard/res/values/dimens.xml
@@ -158,7 +158,7 @@
<dimen name="bottom_text_spacing_digital">-8dp</dimen>
<dimen name="label_font_size">14dp</dimen>
<dimen name="widget_label_font_size">14dp</dimen>
- <dimen name="widget_big_font_size">80dp</dimen>
+ <dimen name="widget_big_font_size">60dp</dimen>
<dimen name="big_font_size">120dp</dimen>
</resources>
diff --git a/packages/Keyguard/res/values/styles.xml b/packages/Keyguard/res/values/styles.xml
index 80fcf75..4a034aa 100644
--- a/packages/Keyguard/res/values/styles.xml
+++ b/packages/Keyguard/res/values/styles.xml
@@ -56,8 +56,7 @@
<!-- Built-in clock widget stuff -->
<style name="widget_label">
<item name="android:textStyle">bold</item>
- <item name="android:textAllCaps">true</item>
- <item name="android:fontFamily">sans-serif-condensed</item>
+ <item name="android:fontFamily">sans-serif-light</item>
<item name="android:textSize">@dimen/widget_label_font_size</item>
</style>
<style name="big_thin">
diff --git a/packages/Keyguard/src/com/android/keyguard/CameraWidgetFrame.java b/packages/Keyguard/src/com/android/keyguard/CameraWidgetFrame.java
index 74e6f33..2bf74ea 100644
--- a/packages/Keyguard/src/com/android/keyguard/CameraWidgetFrame.java
+++ b/packages/Keyguard/src/com/android/keyguard/CameraWidgetFrame.java
@@ -38,7 +38,7 @@ import com.android.keyguard.KeyguardActivityLauncher.CameraWidgetInfo;
public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnClickListener {
private static final String TAG = CameraWidgetFrame.class.getSimpleName();
- private static final boolean DEBUG = KeyguardHostView.DEBUG;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
private static final int WIDGET_ANIMATION_DURATION = 250; // ms
private static final int WIDGET_WAIT_DURATION = 400; // ms
private static final int RECOVERY_DELAY = 1000; // ms
@@ -113,12 +113,14 @@ public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnCli
private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
private boolean mShowing;
- void onKeyguardVisibilityChanged(boolean showing) {
+
+ @Override
+ public void onKeyguardVisibilityChanged(boolean showing) {
if (mShowing == showing)
return;
mShowing = showing;
CameraWidgetFrame.this.onKeyguardVisibilityChanged(mShowing);
- };
+ }
};
private static final class FixedSizeFrameLayout extends FrameLayout {
diff --git a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
index fd56613..4ed37d4 100644
--- a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
+++ b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
@@ -48,10 +48,11 @@ public class EmergencyButton extends Button {
updateEmergencyCallButton(simState, phoneState);
}
- void onPhoneStateChanged(int phoneState) {
+ @Override
+ public void onPhoneStateChanged(int phoneState) {
State simState = KeyguardUpdateMonitor.getInstance(mContext).getSimState();
updateEmergencyCallButton(simState, phoneState);
- };
+ }
};
private LockPatternUtils mLockPatternUtils;
private PowerManager mPowerManager;
diff --git a/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java b/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java
index de839c6..2f14003 100644
--- a/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java
+++ b/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java
@@ -37,8 +37,9 @@ import android.view.View;
public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
private static final String TAG = "FULLockscreen";
+ private static final String FACE_LOCK_PACKAGE = "com.android.facelock";
private final Context mContext;
private final LockPatternUtils mLockPatternUtils;
@@ -128,7 +129,8 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
if (!mBoundToService) {
Log.d(TAG, "Binding to Face Unlock service for user="
+ mLockPatternUtils.getCurrentUser());
- mContext.bindServiceAsUser(new Intent(IFaceLockInterface.class.getName()),
+ mContext.bindServiceAsUser(
+ new Intent(IFaceLockInterface.class.getName()).setPackage(FACE_LOCK_PACKAGE),
mConnection,
Context.BIND_AUTO_CREATE,
new UserHandle(mLockPatternUtils.getCurrentUser()));
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
index 3950159..4b386b6 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
@@ -231,7 +231,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
if (mCallback != null) {
- mCallback.userActivity(KeyguardViewManager.DIGIT_PRESS_WAKE_MILLIS);
+ mCallback.userActivity(KeyguardConstants.DIGIT_PRESS_WAKE_MILLIS);
}
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java b/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java
index 0d5e477..25f3383 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java
@@ -43,7 +43,7 @@ import java.util.List;
public abstract class KeyguardActivityLauncher {
private static final String TAG = KeyguardActivityLauncher.class.getSimpleName();
- private static final boolean DEBUG = KeyguardHostView.DEBUG;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
private static final String META_DATA_KEYGUARD_LAYOUT = "com.android.keyguard.layout";
private static final Intent SECURE_CAMERA_INTENT =
new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE)
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java b/packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java
new file mode 100644
index 0000000..bfa95f3
--- /dev/null
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2014 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
+ */
+
+package com.android.keyguard;
+
+/**
+ * Defines constants for the Keyguard.
+ */
+public class KeyguardConstants {
+
+ /**
+ * Turns on debugging information for the whole Keyguard. This is very verbose and should only
+ * be used temporarily for debugging.
+ */
+ public static final boolean DEBUG = false;
+
+ /** Timeout used for key presses. */
+ public static final int DIGIT_PRESS_WAKE_MILLIS = 5000;
+}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardDisplayManager.java b/packages/Keyguard/src/com/android/keyguard/KeyguardDisplayManager.java
index 6bcbd6c..55f965c 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardDisplayManager.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardDisplayManager.java
@@ -30,18 +30,18 @@ import android.view.WindowManager;
public class KeyguardDisplayManager {
protected static final String TAG = "KeyguardDisplayManager";
- private static boolean DEBUG = KeyguardViewMediator.DEBUG;
+ private static boolean DEBUG = KeyguardConstants.DEBUG;
Presentation mPresentation;
private MediaRouter mMediaRouter;
private Context mContext;
private boolean mShowing;
- KeyguardDisplayManager(Context context) {
+ public KeyguardDisplayManager(Context context) {
mContext = context;
mMediaRouter = (MediaRouter) mContext.getSystemService(Context.MEDIA_ROUTER_SERVICE);
}
- void show() {
+ public void show() {
if (!mShowing) {
if (DEBUG) Slog.v(TAG, "show");
mMediaRouter.addCallback(MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY,
@@ -51,7 +51,7 @@ public class KeyguardDisplayManager {
mShowing = true;
}
- void hide() {
+ public void hide() {
if (mShowing) {
if (DEBUG) Slog.v(TAG, "hide");
mMediaRouter.removeCallback(mMediaRouterCallback);
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardFaceUnlockView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardFaceUnlockView.java
index c2cd32f..900d16e 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardFaceUnlockView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardFaceUnlockView.java
@@ -36,7 +36,7 @@ import java.lang.Math;
public class KeyguardFaceUnlockView extends LinearLayout implements KeyguardSecurityView {
private static final String TAG = "FULKeyguardFaceUnlockView";
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
private KeyguardSecurityCallback mKeyguardSecurityCallback;
private LockPatternUtils mLockPatternUtils;
private BiometricSensorUnlock mBiometricUnlock;
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
index 2e76f19..7cfd684 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
@@ -61,7 +61,7 @@ import java.util.List;
public class KeyguardHostView extends KeyguardViewBase {
private static final String TAG = "KeyguardHostView";
- public static boolean DEBUG = KeyguardViewMediator.DEBUG;
+ public static boolean DEBUG = KeyguardConstants.DEBUG;
public static boolean DEBUGXPORT = true; // debug music transport control
// Transport control states.
@@ -118,7 +118,7 @@ public class KeyguardHostView extends KeyguardViewBase {
void userActivity();
}
- /*package*/ interface OnDismissAction {
+ public interface OnDismissAction {
/* returns true if the dismiss should be deferred */
boolean onDismiss();
}
@@ -241,7 +241,7 @@ public class KeyguardHostView extends KeyguardViewBase {
}
}
@Override
- void onMusicClientIdChanged(
+ public void onMusicClientIdChanged(
int clientGeneration, boolean clearing, android.app.PendingIntent intent) {
// Set transport state to invisible until we know music is playing (below)
if (DEBUGXPORT && (mClientGeneration != clientGeneration || clearing)) {
@@ -449,7 +449,7 @@ public class KeyguardHostView extends KeyguardViewBase {
}
@Override
- protected void setLockPatternUtils(LockPatternUtils utils) {
+ public void setLockPatternUtils(LockPatternUtils utils) {
super.setLockPatternUtils(utils);
getSecurityContainer().updateSecurityViews(mViewStateManager.isBouncing());
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserAvatar.java b/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserAvatar.java
index aa2ae0e..3aec55c 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserAvatar.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserAvatar.java
@@ -37,7 +37,7 @@ import android.widget.TextView;
class KeyguardMultiUserAvatar extends FrameLayout {
private static final String TAG = KeyguardMultiUserAvatar.class.getSimpleName();
- private static final boolean DEBUG = KeyguardHostView.DEBUG;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
private ImageView mUserImage;
private TextView mUserName;
@@ -123,7 +123,7 @@ class KeyguardMultiUserAvatar extends FrameLayout {
mUserName = (TextView) findViewById(R.id.keyguard_user_name);
mFramed = (KeyguardCircleFramedDrawable)
- KeyguardViewMediator.getAvatarCache().get(user.id);
+ MultiUserAvatarCache.getInstance().get(user.id);
// If we can't find it or the params don't match, create the drawable again
if (mFramed == null
@@ -143,7 +143,7 @@ class KeyguardMultiUserAvatar extends FrameLayout {
mFramed = new KeyguardCircleFramedDrawable(icon, (int) mIconSize, mFrameColor, mStroke,
mFrameShadowColor, mShadowRadius, mHighlightColor);
- KeyguardViewMediator.getAvatarCache().put(user.id, mFramed);
+ MultiUserAvatarCache.getInstance().put(user.id, mFramed);
}
mFramed.reset();
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
index 14de6dd..b4308c6 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
@@ -44,7 +44,7 @@ import java.util.List;
public class KeyguardPatternView extends LinearLayout implements KeyguardSecurityView {
private static final String TAG = "SecurityPatternView";
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
// how long before we clear the wrong pattern
private static final int PATTERN_CLEAR_TIMEOUT_MS = 2000;
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
index 0f62100..8425c48 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -30,7 +30,7 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSecurityView {
- private static final boolean DEBUG = KeyguardViewMediator.DEBUG;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
private static final String TAG = "KeyguardSecurityView";
private KeyguardSecurityModel mSecurityModel;
private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java
index 70a0e44..07239d1 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java
@@ -38,7 +38,7 @@ import com.android.internal.widget.LockPatternUtils;
*/
public class KeyguardSecurityViewFlipper extends ViewFlipper implements KeyguardSecurityView {
private static final String TAG = "KeyguardSecurityViewFlipper";
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
private Rect mTempRect = new Rect();
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java
index 97aec68..03e7b07 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java
@@ -36,7 +36,6 @@ import com.android.internal.widget.multiwaveview.GlowPadView;
import com.android.internal.widget.multiwaveview.GlowPadView.OnTriggerListener;
public class KeyguardSelectorView extends LinearLayout implements KeyguardSecurityView {
- private static final boolean DEBUG = KeyguardHostView.DEBUG;
private static final String TAG = "SecuritySelectorView";
private static final String ASSIST_ICON_METADATA_NAME =
"com.android.systemui.action_assist_icon";
@@ -57,12 +56,10 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri
public void onTrigger(View v, int target) {
final int resId = mGlowPadView.getResourceIdForTarget(target);
- switch (resId) {
- case R.drawable.ic_lockscreen_unlock_phantom:
- case R.drawable.ic_lockscreen_unlock:
- mCallback.userActivity(0);
- mCallback.dismiss(false);
- break;
+ if (resId == R.drawable.ic_lockscreen_unlock_phantom
+ || resId == R.drawable.ic_lockscreen_unlock) {
+ mCallback.userActivity(0);
+ mCallback.dismiss(false);
}
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java
index ae7ac97..d6a4f52 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java
@@ -41,7 +41,7 @@ import android.widget.TextView.OnEditorActionListener;
public class KeyguardSimPinView extends KeyguardAbsKeyInputView
implements KeyguardSecurityView, OnEditorActionListener, TextWatcher {
private static final String LOG_TAG = "KeyguardSimPinView";
- private static final boolean DEBUG = KeyguardViewMediator.DEBUG;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
public static final String TAG = "KeyguardSimPinView";
private ProgressDialog mSimUnlockProgressDialog = null;
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java
index ca4f811..04cbde1 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java
@@ -42,7 +42,7 @@ import com.android.internal.telephony.PhoneConstants;
public class KeyguardSimPukView extends KeyguardAbsKeyInputView
implements KeyguardSecurityView, OnEditorActionListener, TextWatcher {
private static final String LOG_TAG = "KeyguardSimPukView";
- private static final boolean DEBUG = KeyguardViewMediator.DEBUG;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
public static final String TAG = "KeyguardSimPukView";
private ProgressDialog mSimUnlockProgressDialog = null;
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java
index cf983cb..5d5168c 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java
@@ -38,11 +38,6 @@ public class KeyguardSimpleHostView extends KeyguardViewBase {
}
@Override
- public void verifyUnlock() {
- // TODO Auto-generated method stub
- }
-
- @Override
public void cleanUp() {
// TODO Auto-generated method stub
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java
index 0bfee38..ae55c4a 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java
@@ -33,7 +33,7 @@ import com.android.internal.widget.LockPatternUtils;
import java.util.Locale;
public class KeyguardStatusView extends GridLayout {
- private static final boolean DEBUG = KeyguardViewMediator.DEBUG;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
private static final String TAG = "KeyguardStatusView";
private LockPatternUtils mLockPatternUtils;
@@ -50,22 +50,22 @@ public class KeyguardStatusView extends GridLayout {
}
@Override
- void onKeyguardVisibilityChanged(boolean showing) {
+ public void onKeyguardVisibilityChanged(boolean showing) {
if (showing) {
if (DEBUG) Slog.v(TAG, "refresh statusview showing:" + showing);
refresh();
}
- };
+ }
@Override
public void onScreenTurnedOn() {
setEnableMarquee(true);
- };
+ }
@Override
public void onScreenTurnedOff(int why) {
setEnableMarquee(false);
- };
+ }
};
public KeyguardStatusView(Context context) {
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java
index a7cd909..0d472ae 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardTransportControlView.java
@@ -60,7 +60,7 @@ import java.util.TimeZone;
public class KeyguardTransportControlView extends FrameLayout {
private static final int RESET_TO_METADATA_DELAY = 5000;
- protected static final boolean DEBUG = false;
+ protected static final boolean DEBUG = KeyguardConstants.DEBUG;
protected static final String TAG = "TransportControlView";
private static final boolean ANIMATE_TRANSITIONS = true;
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 88c78ab..73c2840 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -72,7 +72,7 @@ import java.util.ArrayList;
public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private static final String TAG = "KeyguardUpdateMonitor";
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
private static final boolean DEBUG_SIM_STATES = DEBUG || false;
private static final int FAILED_BIOMETRIC_UNLOCK_ATTEMPTS_BEFORE_BACKUP = 3;
private static final int LOW_BATTERY_THRESHOLD = 20;
@@ -679,7 +679,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
* broadcast and hence not handle the event. This method is ultimately called by
* PhoneWindowManager in this case.
*/
- protected void dispatchBootCompleted() {
+ public void dispatchBootCompleted() {
mHandler.sendEmptyMessage(MSG_BOOT_COMPLETED);
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
index 556711b..862931e 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
@@ -20,7 +20,7 @@ import android.app.admin.DevicePolicyManager;
import android.graphics.Bitmap;
import android.media.AudioManager;
import android.os.SystemClock;
-import android.util.Log;
+import android.telephony.TelephonyManager;
import android.view.WindowManagerPolicy;
import com.android.internal.telephony.IccCardConstants;
@@ -28,7 +28,7 @@ import com.android.internal.telephony.IccCardConstants;
/**
* Callback for general information relevant to lock screen.
*/
-class KeyguardUpdateMonitorCallback {
+public class KeyguardUpdateMonitorCallback {
private static final long VISIBILITY_CHANGED_COLLAPSE_MS = 1000;
private long mVisibilityChangedCalled;
@@ -40,12 +40,12 @@ class KeyguardUpdateMonitorCallback {
*
* @param status current battery status
*/
- void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) { }
+ public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) { }
/**
* Called once per minute or when the time changes.
*/
- void onTimeChanged() { }
+ public void onTimeChanged() { }
/**
* Called when the carrier PLMN or SPN changes.
@@ -54,14 +54,14 @@ class KeyguardUpdateMonitorCallback {
* be displayed.
* @param spn The service provider name. May be null if it shouldn't be displayed.
*/
- void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) { }
+ public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) { }
/**
* Called when the ringer mode changes.
* @param state the current ringer state, as defined in
* {@link AudioManager#RINGER_MODE_CHANGED_ACTION}
*/
- void onRingerModeChanged(int state) { }
+ public void onRingerModeChanged(int state) { }
/**
* Called when the phone state changes. String will be one of:
@@ -69,15 +69,15 @@ class KeyguardUpdateMonitorCallback {
* {@link TelephonyManager@EXTRA_STATE_RINGING}
* {@link TelephonyManager#EXTRA_STATE_OFFHOOK
*/
- void onPhoneStateChanged(int phoneState) { }
+ public void onPhoneStateChanged(int phoneState) { }
/**
* Called when the visibility of the keyguard changes.
* @param showing Indicates if the keyguard is now visible.
*/
- void onKeyguardVisibilityChanged(boolean showing) { }
+ public void onKeyguardVisibilityChanged(boolean showing) { }
- void onKeyguardVisibilityChangedRaw(boolean showing) {
+ public void onKeyguardVisibilityChangedRaw(boolean showing) {
final long now = SystemClock.elapsedRealtime();
if (showing == mShowing
&& (now - mVisibilityChangedCalled) < VISIBILITY_CHANGED_COLLAPSE_MS) return;
@@ -90,44 +90,44 @@ class KeyguardUpdateMonitorCallback {
* Called when visibility of lockscreen clock changes, such as when
* obscured by a widget.
*/
- void onClockVisibilityChanged() { }
+ public void onClockVisibilityChanged() { }
/**
* Called when the device becomes provisioned
*/
- void onDeviceProvisioned() { }
+ public void onDeviceProvisioned() { }
/**
* Called when the device policy changes.
* See {@link DevicePolicyManager#ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED}
*/
- void onDevicePolicyManagerStateChanged() { }
+ public void onDevicePolicyManagerStateChanged() { }
/**
* Called when the user change begins.
*/
- void onUserSwitching(int userId) { }
+ public void onUserSwitching(int userId) { }
/**
* Called when the user change is complete.
*/
- void onUserSwitchComplete(int userId) { }
+ public void onUserSwitchComplete(int userId) { }
/**
* Called when the SIM state changes.
* @param simState
*/
- void onSimStateChanged(IccCardConstants.State simState) { }
+ public void onSimStateChanged(IccCardConstants.State simState) { }
/**
* Called when a user is removed.
*/
- void onUserRemoved(int userId) { }
+ public void onUserRemoved(int userId) { }
/**
* Called when the user's info changed.
*/
- void onUserInfoChanged(int userId) { }
+ public void onUserInfoChanged(int userId) { }
/**
* Called when boot completed.
@@ -135,12 +135,12 @@ class KeyguardUpdateMonitorCallback {
* Note, this callback will only be received if boot complete occurs after registering with
* KeyguardUpdateMonitor.
*/
- void onBootCompleted() { }
+ public void onBootCompleted() { }
/**
* Called when audio client attaches or detaches from AudioManager.
*/
- void onMusicClientIdChanged(int clientGeneration, boolean clearing, PendingIntent intent) { }
+ public void onMusicClientIdChanged(int clientGeneration, boolean clearing, PendingIntent intent) { }
/**
* Called when the audio playback state changes.
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java
index 78f4506..bc0f364 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java
@@ -60,7 +60,7 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
private AudioManager mAudioManager;
private TelephonyManager mTelephonyManager = null;
- protected KeyguardViewMediator.ViewMediatorCallback mViewMediatorCallback;
+ protected ViewMediatorCallback mViewMediatorCallback;
protected LockPatternUtils mLockPatternUtils;
private OnDismissAction mDismissAction;
@@ -68,7 +68,7 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
// they will be handled here for specific media types such as music, otherwise
// the audio service will bring up the volume dialog.
private static final boolean KEYGUARD_MANAGES_VOLUME = true;
- private static final boolean DEBUG = false;
+ public static final boolean DEBUG = KeyguardConstants.DEBUG;
private static final String TAG = "KeyguardViewBase";
private KeyguardSecurityContainer mSecurityContainer;
@@ -107,7 +107,6 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
mSecurityContainer.setSecurityCallback(this);
mSecurityContainer.showPrimarySecurityScreen(false);
// mSecurityContainer.updateSecurityViews(false /* not bouncing */);
- setBackButtonEnabled(false);
}
/**
@@ -120,15 +119,11 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
/**
* Dismisses the keyguard by going to the next screen or making it gone.
+ *
+ * @return True if the keyguard is done.
*/
- public void dismiss() {
- dismiss(false);
- }
-
- private void setBackButtonEnabled(boolean enabled) {
- setSystemUiVisibility(enabled ?
- getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_BACK :
- getSystemUiVisibility() | View.STATUS_BAR_DISABLE_BACK);
+ public boolean dismiss() {
+ return dismiss(false);
}
protected void showBouncer(boolean show) {
@@ -141,8 +136,7 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
public boolean handleBackKey() {
if (mSecurityContainer.getCurrentSecuritySelection() == SecurityMode.Account) {
- // go back to primary screen and re-disable back
- setBackButtonEnabled(false);
+ // go back to primary screen
mSecurityContainer.showPrimarySecurityScreen(false /*turningOff*/);
return true;
}
@@ -205,12 +199,6 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
@Override
public void onSecurityModeChanged(SecurityMode securityMode, boolean needsInput) {
- // Enable or disable the back button based on security mode
- if (securityMode == SecurityMode.Account && !mLockPatternUtils.isPermanentlyLocked()) {
- // we're showing account as a backup, provide a way to get back to primary
- setBackButtonEnabled(true);
- }
-
if (mViewMediatorCallback != null) {
mViewMediatorCallback.setNeedsInput(needsInput);
}
@@ -231,7 +219,7 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
/**
* Called when the screen turned off.
*/
- protected void onScreenTurnedOff() {
+ public void onScreenTurnedOff() {
if (DEBUG) Log.d(TAG, String.format("screen off, instance %s at %s",
Integer.toHexString(hashCode()), SystemClock.uptimeMillis()));
// Once the screen turns off, we no longer consider this to be first boot and we want the
@@ -245,7 +233,7 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
/**
* Called when the screen turned on.
*/
- protected void onScreenTurnedOn() {
+ public void onScreenTurnedOn() {
if (DEBUG) Log.d(TAG, "screen on, instance " + Integer.toHexString(hashCode()));
mSecurityContainer.showPrimarySecurityScreen(false);
mSecurityContainer.onResume(KeyguardSecurityView.SCREEN_ON);
@@ -433,8 +421,7 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
return false;
}
- public void setViewMediatorCallback(
- KeyguardViewMediator.ViewMediatorCallback viewMediatorCallback) {
+ public void setViewMediatorCallback(ViewMediatorCallback viewMediatorCallback) {
mViewMediatorCallback = viewMediatorCallback;
// Update ViewMediator with the current input method requirements
mViewMediatorCallback.setNeedsInput(mSecurityContainer.needsInput());
@@ -484,7 +471,7 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
mActivityLauncher.launchCamera(getHandler(), null);
}
- protected void setLockPatternUtils(LockPatternUtils utils) {
+ public void setLockPatternUtils(LockPatternUtils utils) {
mLockPatternUtils = utils;
mSecurityContainer.setLockPatternUtils(utils);
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java
deleted file mode 100644
index 5b35ba8..0000000
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-package com.android.keyguard;
-
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-
-import com.android.internal.policy.IKeyguardShowCallback;
-import com.android.internal.widget.LockPatternUtils;
-import com.android.keyguard.analytics.KeyguardAnalytics;
-
-import org.xmlpull.v1.XmlPullParser;
-
-import android.app.ActivityManager;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.pm.ActivityInfo;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.PixelFormat;
-import android.graphics.PorterDuff;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.Parcelable;
-import android.os.RemoteException;
-import android.os.SystemProperties;
-import android.provider.Settings;
-import android.util.Log;
-import android.util.Slog;
-import android.util.SparseArray;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewManager;
-import android.view.WindowManager;
-import android.widget.FrameLayout;
-
-/**
- * Manages creating, showing, hiding and resetting the keyguard. Calls back
- * via {@link KeyguardViewMediator.ViewMediatorCallback} to poke
- * the wake lock and report that the keyguard is done, which is in turn,
- * reported to this class by the current {@link KeyguardViewBase}.
- */
-public class KeyguardViewManager {
- private final static boolean DEBUG = KeyguardViewMediator.DEBUG;
- private static String TAG = "KeyguardViewManager";
- public final static String IS_SWITCHING_USER = "is_switching_user";
-
- // Delay dismissing keyguard to allow animations to complete.
- private static final int HIDE_KEYGUARD_DELAY = 500;
-
- // Timeout used for keypresses
- static final int DIGIT_PRESS_WAKE_MILLIS = 5000;
- private static final boolean ENABLE_SIMPLE_KEYGUARD = false;
-
- private final Context mContext;
- private final ViewManager mViewManager;
- private final KeyguardViewMediator.ViewMediatorCallback mViewMediatorCallback;
- private final KeyguardAnalytics.Callback mAnalyticsCallback;
-
- private WindowManager.LayoutParams mWindowLayoutParams;
- private boolean mNeedsInput = false;
-
- private ViewManagerHost mKeyguardHost;
- private KeyguardViewBase mKeyguardView;
-
- private boolean mScreenOn = false;
- private LockPatternUtils mLockPatternUtils;
-
- private KeyguardUpdateMonitorCallback mBackgroundChanger = new KeyguardUpdateMonitorCallback() {
- @Override
- public void onSetBackground(Bitmap bmp) {
- mKeyguardHost.setCustomBackground(bmp != null ?
- new BitmapDrawable(mContext.getResources(), bmp) : null);
- updateShowWallpaper(bmp == null);
- }
- };
-
- public interface ShowListener {
- void onShown(IBinder windowToken);
- };
-
- /**
- * @param context Used to create views.
- * @param viewManager Keyguard will be attached to this.
- * @param callback Used to notify of changes.
- * @param lockPatternUtils
- */
- public KeyguardViewManager(Context context, ViewManager viewManager,
- KeyguardViewMediator.ViewMediatorCallback callback,
- LockPatternUtils lockPatternUtils, KeyguardAnalytics.Callback analyticsCallback) {
- mContext = context;
- mViewManager = viewManager;
- mViewMediatorCallback = callback;
- mLockPatternUtils = lockPatternUtils;
- mAnalyticsCallback = analyticsCallback;
- }
-
- /**
- * Show the keyguard. Will handle creating and attaching to the view manager
- * lazily.
- */
- public synchronized void show(Bundle options) {
- if (DEBUG) Log.d(TAG, "show(); mKeyguardView==" + mKeyguardView);
- if (mAnalyticsCallback != null) {
- mAnalyticsCallback.onShow();
- }
-
- boolean enableScreenRotation = shouldEnableScreenRotation();
-
- maybeCreateKeyguardLocked(enableScreenRotation, false, options);
- maybeEnableScreenRotation(enableScreenRotation);
-
- // Disable common aspects of the system/status/navigation bars that are not appropriate or
- // useful on any keyguard screen but can be re-shown by dialogs or SHOW_WHEN_LOCKED
- // activities. Other disabled bits are handled by the KeyguardViewMediator talking
- // directly to the status bar service.
- int visFlags = View.STATUS_BAR_DISABLE_HOME;
- if (shouldEnableTranslucentDecor()) {
- mWindowLayoutParams.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
- | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
- }
- if (DEBUG) Log.v(TAG, "show:setSystemUiVisibility(" + Integer.toHexString(visFlags)+")");
- mKeyguardHost.setSystemUiVisibility(visFlags);
-
- mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
- mKeyguardHost.setVisibility(View.VISIBLE);
- mKeyguardView.show();
- mKeyguardView.requestFocus();
- }
-
- private boolean shouldEnableScreenRotation() {
- Resources res = mContext.getResources();
- return SystemProperties.getBoolean("lockscreen.rot_override",false)
- || res.getBoolean(R.bool.config_enableLockScreenRotation);
- }
-
- private boolean shouldEnableTranslucentDecor() {
- Resources res = mContext.getResources();
- return res.getBoolean(R.bool.config_enableLockScreenTranslucentDecor);
- }
-
- class ViewManagerHost extends FrameLayout {
- private static final int BACKGROUND_COLOR = 0x70000000;
-
- private Drawable mCustomBackground;
-
- // This is a faster way to draw the background on devices without hardware acceleration
- private final Drawable mBackgroundDrawable = new Drawable() {
- @Override
- public void draw(Canvas canvas) {
- if (mCustomBackground != null) {
- final Rect bounds = mCustomBackground.getBounds();
- final int vWidth = getWidth();
- final int vHeight = getHeight();
-
- final int restore = canvas.save();
- canvas.translate(-(bounds.width() - vWidth) / 2,
- -(bounds.height() - vHeight) / 2);
- mCustomBackground.draw(canvas);
- canvas.restoreToCount(restore);
- } else {
- canvas.drawColor(BACKGROUND_COLOR, PorterDuff.Mode.SRC);
- }
- }
-
- @Override
- public void setAlpha(int alpha) {
- }
-
- @Override
- public void setColorFilter(ColorFilter cf) {
- }
-
- @Override
- public int getOpacity() {
- return PixelFormat.TRANSLUCENT;
- }
- };
-
- public ViewManagerHost(Context context) {
- super(context);
- setBackground(mBackgroundDrawable);
- }
-
- public void setCustomBackground(Drawable d) {
- mCustomBackground = d;
- if (d != null) {
- d.setColorFilter(BACKGROUND_COLOR, PorterDuff.Mode.SRC_OVER);
- }
- computeCustomBackgroundBounds();
- invalidate();
- }
-
- private void computeCustomBackgroundBounds() {
- if (mCustomBackground == null) return; // Nothing to do
- if (!isLaidOut()) return; // We'll do this later
-
- final int bgWidth = mCustomBackground.getIntrinsicWidth();
- final int bgHeight = mCustomBackground.getIntrinsicHeight();
- final int vWidth = getWidth();
- final int vHeight = getHeight();
-
- final float bgAspect = (float) bgWidth / bgHeight;
- final float vAspect = (float) vWidth / vHeight;
-
- if (bgAspect > vAspect) {
- mCustomBackground.setBounds(0, 0, (int) (vHeight * bgAspect), vHeight);
- } else {
- mCustomBackground.setBounds(0, 0, vWidth, (int) (vWidth / bgAspect));
- }
- }
-
- @Override
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- super.onSizeChanged(w, h, oldw, oldh);
- computeCustomBackgroundBounds();
- }
-
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- if (mKeyguardHost.getVisibility() == View.VISIBLE) {
- // only propagate configuration messages if we're currently showing
- maybeCreateKeyguardLocked(shouldEnableScreenRotation(), true, null);
- } else {
- if (DEBUG) Log.v(TAG, "onConfigurationChanged: view not visible");
- }
- }
-
- @Override
- public boolean dispatchKeyEvent(KeyEvent event) {
- if (mKeyguardView != null) {
- // Always process back and menu keys, regardless of focus
- if (event.getAction() == KeyEvent.ACTION_DOWN) {
- int keyCode = event.getKeyCode();
- if (keyCode == KeyEvent.KEYCODE_BACK && mKeyguardView.handleBackKey()) {
- return true;
- } else if (keyCode == KeyEvent.KEYCODE_MENU && mKeyguardView.handleMenuKey()) {
- return true;
- }
- }
- // Always process media keys, regardless of focus
- if (mKeyguardView.dispatchKeyEvent(event)) {
- return true;
- }
- }
- return super.dispatchKeyEvent(event);
- }
-
- @Override
- public boolean dispatchTouchEvent(MotionEvent ev) {
- boolean result = false;
- if (mAnalyticsCallback != null) {
- result = mAnalyticsCallback.onTouchEvent(ev, getWidth(), getHeight()) || result;
- }
- return super.dispatchTouchEvent(ev) || result;
- }
- }
-
- SparseArray<Parcelable> mStateContainer = new SparseArray<Parcelable>();
- private int mCurrentLayout;
-
- private void maybeCreateKeyguardLocked(boolean enableScreenRotation, boolean force,
- Bundle options) {
- if (mKeyguardHost != null) {
- mKeyguardHost.saveHierarchyState(mStateContainer);
- }
-
- if (mKeyguardHost == null) {
- if (DEBUG) Log.d(TAG, "keyguard host is null, creating it...");
-
- mKeyguardHost = new ViewManagerHost(mContext);
-
- int flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
- | WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
- | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
-
- if (!mNeedsInput) {
- flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
- }
-
- final int stretch = ViewGroup.LayoutParams.MATCH_PARENT;
- final int type = WindowManager.LayoutParams.TYPE_KEYGUARD;
- WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
- stretch, stretch, type, flags, PixelFormat.TRANSLUCENT);
- lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
- lp.windowAnimations = R.style.Animation_LockScreen;
- lp.screenOrientation = enableScreenRotation ?
- ActivityInfo.SCREEN_ORIENTATION_USER : ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
-
- if (ActivityManager.isHighEndGfx()) {
- lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
- lp.privateFlags |=
- WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED;
- }
- lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SET_NEEDS_MENU_KEY;
- lp.inputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
- lp.setTitle("Keyguard");
- mWindowLayoutParams = lp;
- mViewManager.addView(mKeyguardHost, lp);
-
- KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mBackgroundChanger);
- }
-
- if (force || mKeyguardView == null) {
- mKeyguardHost.setCustomBackground(null);
- mKeyguardHost.removeAllViews();
- int layout = (allowNotificationsOnSecureKeyguard() && ENABLE_SIMPLE_KEYGUARD)
- ? R.layout.keyguard_simple_host_view
- : R.layout.keyguard_host_view;
- if (mCurrentLayout != layout) {
- mStateContainer.clear(); // don't restore to the wrong view hierarchy
- mCurrentLayout = layout;
- }
- mKeyguardView = inflateKeyguardView(options, layout);
- mKeyguardView.requestFocus();
- }
- updateUserActivityTimeoutInWindowLayoutParams();
- mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
-
- mKeyguardHost.restoreHierarchyState(mStateContainer);
- }
-
- private boolean allowNotificationsOnSecureKeyguard() {
- ContentResolver cr = mContext.getContentResolver();
- return Settings.Global.getInt(cr, Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0) == 1;
- }
-
- private KeyguardViewBase inflateKeyguardView(Bundle options, int layoutId) {
- View v = mKeyguardHost.findViewById(R.id.keyguard_host_view);
- if (v != null) {
- mKeyguardHost.removeView(v);
- }
- final LayoutInflater inflater = LayoutInflater.from(mContext);
- View view = inflater.inflate(layoutId, mKeyguardHost, true);
- KeyguardViewBase keyguard = (KeyguardViewBase) view.findViewById(R.id.keyguard_host_view);
- keyguard.setLockPatternUtils(mLockPatternUtils);
- keyguard.setViewMediatorCallback(mViewMediatorCallback);
- keyguard.onUserSwitching(options != null && options.getBoolean(IS_SWITCHING_USER));
- keyguard.onCreateOptions(options);
- return keyguard;
- }
-
- public void updateUserActivityTimeout() {
- updateUserActivityTimeoutInWindowLayoutParams();
- mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
- }
-
- private void updateUserActivityTimeoutInWindowLayoutParams() {
- // Use the user activity timeout requested by the keyguard view, if any.
- if (mKeyguardView != null) {
- long timeout = mKeyguardView.getUserActivityTimeout();
- if (timeout >= 0) {
- mWindowLayoutParams.userActivityTimeout = timeout;
- return;
- }
- }
-
- // Otherwise, use the default timeout.
- mWindowLayoutParams.userActivityTimeout = KeyguardViewMediator.AWAKE_INTERVAL_DEFAULT_MS;
- }
-
- private void maybeEnableScreenRotation(boolean enableScreenRotation) {
- // TODO: move this outside
- if (enableScreenRotation) {
- if (DEBUG) Log.d(TAG, "Rotation sensor for lock screen On!");
- mWindowLayoutParams.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
- } else {
- if (DEBUG) Log.d(TAG, "Rotation sensor for lock screen Off!");
- mWindowLayoutParams.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
- }
- mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
- }
-
- void updateShowWallpaper(boolean show) {
- if (show) {
- mWindowLayoutParams.flags |= WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
- } else {
- mWindowLayoutParams.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
- }
- mWindowLayoutParams.format = show ? PixelFormat.TRANSLUCENT : PixelFormat.OPAQUE;
-
- mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
- }
-
- public void setNeedsInput(boolean needsInput) {
- mNeedsInput = needsInput;
- if (mWindowLayoutParams != null) {
- if (needsInput) {
- mWindowLayoutParams.flags &=
- ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
- } else {
- mWindowLayoutParams.flags |=
- WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
- }
-
- try {
- mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
- } catch (java.lang.IllegalArgumentException e) {
- // TODO: Ensure this method isn't called on views that are changing...
- Log.w(TAG,"Can't update input method on " + mKeyguardHost + " window not attached");
- }
- }
- }
-
- /**
- * Reset the state of the view.
- */
- public synchronized void reset(Bundle options) {
- if (DEBUG) Log.d(TAG, "reset()");
- // User might have switched, check if we need to go back to keyguard
- // TODO: It's preferable to stay and show the correct lockscreen or unlock if none
- maybeCreateKeyguardLocked(shouldEnableScreenRotation(), true, options);
- }
-
- public synchronized void onScreenTurnedOff() {
- if (DEBUG) Log.d(TAG, "onScreenTurnedOff()");
- mScreenOn = false;
- if (mKeyguardView != null) {
- mKeyguardView.onScreenTurnedOff();
- }
- }
-
- public synchronized void onScreenTurnedOn(final IKeyguardShowCallback callback) {
- if (DEBUG) Log.d(TAG, "onScreenTurnedOn()");
- mScreenOn = true;
-
- // If keyguard is not showing, we need to inform PhoneWindowManager with a null
- // token so it doesn't wait for us to draw...
- final IBinder token = isShowing() ? mKeyguardHost.getWindowToken() : null;
-
- if (DEBUG && token == null) Slog.v(TAG, "send wm null token: "
- + (mKeyguardHost == null ? "host was null" : "not showing"));
-
- if (mKeyguardView != null) {
- mKeyguardView.onScreenTurnedOn();
-
- // Caller should wait for this window to be shown before turning
- // on the screen.
- if (callback != null) {
- if (mKeyguardHost.getVisibility() == View.VISIBLE) {
- // Keyguard may be in the process of being shown, but not yet
- // updated with the window manager... give it a chance to do so.
- mKeyguardHost.post(new Runnable() {
- @Override
- public void run() {
- try {
- callback.onShown(token);
- } catch (RemoteException e) {
- Slog.w(TAG, "Exception calling onShown():", e);
- }
- }
- });
- } else {
- try {
- callback.onShown(token);
- } catch (RemoteException e) {
- Slog.w(TAG, "Exception calling onShown():", e);
- }
- }
- }
- } else if (callback != null) {
- try {
- callback.onShown(token);
- } catch (RemoteException e) {
- Slog.w(TAG, "Exception calling onShown():", e);
- }
- }
- if (mAnalyticsCallback != null) {
- mAnalyticsCallback.onScreenOn();
- }
- }
-
- public synchronized void verifyUnlock() {
- if (DEBUG) Log.d(TAG, "verifyUnlock()");
- show(null);
- mKeyguardView.verifyUnlock();
- }
-
- /**
- * Hides the keyguard view
- */
- public synchronized void hide() {
- if (DEBUG) Log.d(TAG, "hide()");
-
- if (mAnalyticsCallback != null) {
- mAnalyticsCallback.onHide();
- }
-
- if (mKeyguardHost != null) {
- mKeyguardHost.setVisibility(View.GONE);
-
- // We really only want to preserve keyguard state for configuration changes. Hence
- // we should clear state of widgets (e.g. Music) when we hide keyguard so it can
- // start with a fresh state when we return.
- mStateContainer.clear();
-
- // Don't do this right away, so we can let the view continue to animate
- // as it goes away.
- if (mKeyguardView != null) {
- final KeyguardViewBase lastView = mKeyguardView;
- mKeyguardView = null;
- mKeyguardHost.postDelayed(new Runnable() {
- @Override
- public void run() {
- synchronized (KeyguardViewManager.this) {
- lastView.cleanUp();
- // Let go of any large bitmaps.
- mKeyguardHost.setCustomBackground(null);
- updateShowWallpaper(true);
- mKeyguardHost.removeView(lastView);
- mViewMediatorCallback.keyguardGone();
- }
- }
- }, HIDE_KEYGUARD_DELAY);
- }
- }
- }
-
- /**
- * Dismisses the keyguard by going to the next screen or making it gone.
- */
- public synchronized void dismiss() {
- if (mScreenOn) {
- mKeyguardView.dismiss();
- }
- }
-
- /**
- * @return Whether the keyguard is showing
- */
- public synchronized boolean isShowing() {
- return (mKeyguardHost != null && mKeyguardHost.getVisibility() == View.VISIBLE);
- }
-
- public void showAssistant() {
- if (mKeyguardView != null) {
- mKeyguardView.showAssistant();
- }
- }
-
- public void dispatch(MotionEvent event) {
- if (mKeyguardView != null) {
- mKeyguardView.onExternalMotionEvent(event);
- }
- }
-
- public void launchCamera() {
- if (mKeyguardView != null) {
- mKeyguardView.launchCamera();
- }
- }
-}
diff --git a/packages/Keyguard/src/com/android/keyguard/MultiUserAvatarCache.java b/packages/Keyguard/src/com/android/keyguard/MultiUserAvatarCache.java
index 9930e72..7128211 100644
--- a/packages/Keyguard/src/com/android/keyguard/MultiUserAvatarCache.java
+++ b/packages/Keyguard/src/com/android/keyguard/MultiUserAvatarCache.java
@@ -22,12 +22,21 @@ import java.util.HashMap;
public class MultiUserAvatarCache {
+ private static MultiUserAvatarCache sInstance;
+
private final HashMap<Integer, Drawable> mCache;
- public MultiUserAvatarCache() {
+ private MultiUserAvatarCache() {
mCache = new HashMap<Integer, Drawable>();
}
+ public static MultiUserAvatarCache getInstance() {
+ if (sInstance == null) {
+ sInstance = new MultiUserAvatarCache();
+ }
+ return sInstance;
+ }
+
public void clear(int userId) {
mCache.remove(userId);
}
diff --git a/packages/Keyguard/src/com/android/keyguard/PagedView.java b/packages/Keyguard/src/com/android/keyguard/PagedView.java
index d233ee9..b42a085 100644
--- a/packages/Keyguard/src/com/android/keyguard/PagedView.java
+++ b/packages/Keyguard/src/com/android/keyguard/PagedView.java
@@ -56,7 +56,7 @@ import java.util.ArrayList;
public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarchyChangeListener {
private static final int WARP_SNAP_DURATION = 160;
private static final String TAG = "WidgetPagedView";
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
private static final boolean DEBUG_WARP = false;
protected static final int INVALID_PAGE = -1;
private static final int WARP_PEEK_ANIMATION_DURATION = 150;
diff --git a/packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java b/packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java
index 3d515ce..ab9286b 100644
--- a/packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java
+++ b/packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java
@@ -45,7 +45,7 @@ import android.widget.Scroller;
*/
public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout {
private static final String TAG = "SlidingChallengeLayout";
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = KeyguardConstants.DEBUG;
// The drag handle is measured in dp above & below the top edge of the
// challenge view; these parameters change based on whether the challenge
diff --git a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java
new file mode 100644
index 0000000..1f23785
--- /dev/null
+++ b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2014 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
+ */
+
+package com.android.keyguard;
+
+/**
+ * The callback used by the keyguard view to tell the {@link KeyguardViewMediator}
+ * various things.
+ */
+public interface ViewMediatorCallback {
+ /**
+ * Reports user activity and requests that the screen stay on.
+ */
+ void userActivity();
+
+ /**
+ * Reports user activity and requests that the screen stay on for at least
+ * the specified amount of time.
+ * @param millis The amount of time in millis. This value is currently ignored.
+ */
+ void userActivity(long millis);
+
+ /**
+ * Report that the keyguard is done.
+ * @param authenticated Whether the user securely got past the keyguard.
+ * the only reason for this to be false is if the keyguard was instructed
+ * to appear temporarily to verify the user is supposed to get past the
+ * keyguard, and the user fails to do so.
+ */
+ void keyguardDone(boolean authenticated);
+
+ /**
+ * Report that the keyguard is done drawing.
+ */
+ void keyguardDoneDrawing();
+
+ /**
+ * Tell ViewMediator that the current view needs IME input
+ * @param needsInput
+ */
+ void setNeedsInput(boolean needsInput);
+
+ /**
+ * Tell view mediator that the keyguard view's desired user activity timeout
+ * has changed and needs to be reapplied to the window.
+ */
+ void onUserActivityTimeoutChanged();
+
+ /**
+ * Report that the keyguard is dismissable, pending the next keyguardDone call.
+ */
+ void keyguardDonePending();
+
+ /**
+ * Report when keyguard is actually gone
+ */
+ void keyguardGone();
+}
diff --git a/packages/Keyguard/src/com/android/keyguard/analytics/KeyguardAnalytics.java b/packages/Keyguard/src/com/android/keyguard/analytics/KeyguardAnalytics.java
index 55750cc..20af2f1 100644
--- a/packages/Keyguard/src/com/android/keyguard/analytics/KeyguardAnalytics.java
+++ b/packages/Keyguard/src/com/android/keyguard/analytics/KeyguardAnalytics.java
@@ -80,7 +80,7 @@ public class KeyguardAnalytics implements SensorEventListener {
public void onScreenOn();
public void onScreenOff();
public boolean onTouchEvent(MotionEvent ev, int width, int height);
- public void onSetHidden(boolean hidden);
+ public void onSetOccluded(boolean hidden);
}
public interface SessionTypeAdapter {
@@ -256,11 +256,11 @@ public class KeyguardAnalytics implements SensorEventListener {
}
@Override
- public void onSetHidden(boolean hidden) {
+ public void onSetOccluded(boolean hidden) {
synchronized (KeyguardAnalytics.this) {
if (hidden != mHidden) {
if (DEBUG) {
- Log.d(TAG, "onSetHidden(" + hidden + ")");
+ Log.d(TAG, "onSetOccluded(" + hidden + ")");
}
mHidden = hidden;
if (hidden) {
diff --git a/packages/PrintSpooler/res/values-da/strings.xml b/packages/PrintSpooler/res/values-da/strings.xml
index 1a871f8..74190b4 100644
--- a/packages/PrintSpooler/res/values-da/strings.xml
+++ b/packages/PrintSpooler/res/values-da/strings.xml
@@ -69,8 +69,8 @@
<item msgid="2762241247228983754">"Farve"</item>
</string-array>
<string-array name="orientation_labels">
- <item msgid="4061931020926489228">"Stående"</item>
- <item msgid="3199660090246166812">"Liggende"</item>
+ <item msgid="4061931020926489228">"Portræt"</item>
+ <item msgid="3199660090246166812">"Landskab"</item>
</string-array>
<string-array name="page_options_labels">
<item msgid="7421377442011699994">"Alle"</item>
diff --git a/packages/PrintSpooler/res/values-sl/strings.xml b/packages/PrintSpooler/res/values-sl/strings.xml
index e299508..5d4fe94 100644
--- a/packages/PrintSpooler/res/values-sl/strings.xml
+++ b/packages/PrintSpooler/res/values-sl/strings.xml
@@ -69,7 +69,7 @@
<item msgid="2762241247228983754">"Barvno"</item>
</string-array>
<string-array name="orientation_labels">
- <item msgid="4061931020926489228">"Pokončno"</item>
+ <item msgid="4061931020926489228">"Navpično"</item>
<item msgid="3199660090246166812">"Ležeče"</item>
</string-array>
<string-array name="page_options_labels">
diff --git a/packages/PrintSpooler/res/values-sw/strings.xml b/packages/PrintSpooler/res/values-sw/strings.xml
index a84e9b3..55c8687 100644
--- a/packages/PrintSpooler/res/values-sw/strings.xml
+++ b/packages/PrintSpooler/res/values-sw/strings.xml
@@ -31,7 +31,7 @@
<string name="install_for_print_preview" msgid="6366303997385509332">"Sakinisha kitazamaji cha PDF kwa onyesho la kuchungulia"</string>
<string name="printing_app_crashed" msgid="854477616686566398">"Programu ya kuchapisha imeacha kufanya kazi"</string>
<string name="page_count_unknown" msgid="6058852665954511124">"Kurasa"</string>
- <string name="generating_print_job" msgid="3119608742651698916">"Inaleta kazi ya kuchapisha"</string>
+ <string name="generating_print_job" msgid="3119608742651698916">"Inazanzisha kazi ya kuchapisha"</string>
<string name="save_as_pdf" msgid="5718454119847596853">"Hifadhi kama PDF"</string>
<string name="all_printers" msgid="5018829726861876202">"Printa zote..."</string>
<string name="print_dialog" msgid="32628687461331979">"Chapisha mazungumzo"</string>
@@ -63,7 +63,7 @@
<string name="no_connection_to_printer" msgid="2159246915977282728">"Hakuna muunganisho kwa printa"</string>
<string name="reason_unknown" msgid="5507940196503246139">"haijulikani"</string>
<string name="printer_unavailable" msgid="2434170617003315690">"<xliff:g id="PRINT_JOB_NAME">%1$s</xliff:g> - haipatikani"</string>
- <string name="print_error_default_message" msgid="8568506918983980567">"Haikuweza kuleta kazi ya kuchapisha"</string>
+ <string name="print_error_default_message" msgid="8568506918983980567">"Haikuweza kuunda kazi ya kuchapisha"</string>
<string-array name="color_mode_labels">
<item msgid="7602948745415174937">"Nyeusi na Nyeupe"</item>
<item msgid="2762241247228983754">"Rangi"</item>
diff --git a/packages/Shell/res/values-sk/strings.xml b/packages/Shell/res/values-sk/strings.xml
index 59c3ccf..99f36f9 100644
--- a/packages/Shell/res/values-sk/strings.xml
+++ b/packages/Shell/res/values-sk/strings.xml
@@ -17,8 +17,8 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_label" msgid="3701846017049540910">"Prostredie"</string>
- <string name="bugreport_finished_title" msgid="2293711546892863898">"Hlásenie o chybách bolo vytvorené"</string>
- <string name="bugreport_finished_text" msgid="3559904746859400732">"Hlásenie o chybách môžete zdielať klepnutím"</string>
+ <string name="bugreport_finished_title" msgid="2293711546892863898">"Správa o chybách sa zaznamenala"</string>
+ <string name="bugreport_finished_text" msgid="3559904746859400732">"Dotykom môžete zdieľať správu o chybách"</string>
<string name="bugreport_confirm" msgid="5130698467795669780">"Správy o chybách obsahujú údaje z rôznych súborov denníkov systému vrátane osobných a súkromných informácií. Zdieľajte ich iba s dôveryhodnými aplikáciami a ľuďmi."</string>
<string name="bugreport_confirm_repeat" msgid="4926842460688645058">"Zobraziť túto správu nabudúce"</string>
</resources>
diff --git a/packages/SystemUI/Android.mk b/packages/SystemUI/Android.mk
index f8f064a..69c6159 100644
--- a/packages/SystemUI/Android.mk
+++ b/packages/SystemUI/Android.mk
@@ -6,6 +6,7 @@ LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
src/com/android/systemui/EventLogTags.logtags
+LOCAL_STATIC_JAVA_LIBRARIES := Keyguard
LOCAL_JAVA_LIBRARIES := telephony-common
LOCAL_PACKAGE_NAME := SystemUI
@@ -14,6 +15,11 @@ LOCAL_PRIVILEGED_MODULE := true
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
+LOCAL_RESOURCE_DIR := \
+ frameworks/base/packages/Keyguard/res \
+ $(LOCAL_PATH)/res
+LOCAL_AAPT_FLAGS := --auto-add-overlay --extra-packages com.android.keyguard
+
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 3424eed..d371d70 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -89,11 +89,20 @@
<!-- Keyguard -->
<uses-permission android:name="android.permission.CONTROL_KEYGUARD" />
+ <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
+ <uses-permission android:name="android.permission.GET_ACCOUNTS" />
+ <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
+ <uses-permission android:name="android.permission.BIND_DEVICE_ADMIN" />
+ <uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
+ <uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL" />
+ <uses-permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE" />
+ <uses-permission android:name="android.permission.TRUST_LISTENER" />
<!-- Wifi Display -->
<uses-permission android:name="android.permission.CONFIGURE_WIFI_DISPLAY" />
<application
+ android:name=".SystemUIApplication"
android:persistent="true"
android:allowClearUserData="false"
android:allowBackup="false"
@@ -101,7 +110,11 @@
android:label="@string/app_label"
android:icon="@*android:drawable/platlogo"
android:process="com.android.systemui"
- android:supportsRtl="true">
+ android:supportsRtl="true"
+ android:theme="@style/systemui_theme">
+ <!-- Keep theme in sync with SystemUIApplication.onCreate().
+ Setting the theme on the application does not affect views inflated by services.
+ The application theme is set again from onCreate to take effect for those views. -->
<!-- Broadcast receiver that gets the broadcast at boot time and starts
up everything else.
@@ -258,6 +271,10 @@
</intent-filter>
</service>
+ <service
+ android:name=".keyguard.KeyguardService"
+ android:exported="true" />
+
<activity android:name=".Somnambulator"
android:label="@string/start_dreams"
android:icon="@mipmap/ic_launcher_dreams"
diff --git a/packages/SystemUI/res/drawable/ic_notify_button_bg.xml b/packages/SystemUI/res/drawable/ic_notify_button_bg.xml
index 85f1ea2..3a47261 100644
--- a/packages/SystemUI/res/drawable/ic_notify_button_bg.xml
+++ b/packages/SystemUI/res/drawable/ic_notify_button_bg.xml
@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@*android:drawable/list_selector_pressed_holo_dark" />
- <item android:drawable="@*android:drawable/list_selector_disabled_holo_dark" />
+ <item android:state_pressed="true"
+ android:drawable="@*android:drawable/list_selector_pressed_holo_dark" />
</selector>
diff --git a/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml b/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml
deleted file mode 100644
index 0947c6f..0000000
--- a/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, 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.
-*/
--->
-
-<!-- This is the combined status bar / notification panel window. -->
-<com.android.systemui.statusbar.phone.StatusBarWindowView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
- android:focusable="true"
- android:descendantFocusability="afterDescendants"
- android:fitsSystemWindows="true"
- >
-
- <include layout="@layout/status_bar"
- android:layout_width="match_parent"
- android:layout_height="@*android:dimen/status_bar_height"
- />
-
-
- <com.android.systemui.statusbar.phone.PanelHolder
- android:id="@+id/panel_holder"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginTop="@*android:dimen/status_bar_height"
- >
- <include layout="@layout/status_bar_expanded"
- android:layout_width="@dimen/notification_panel_width"
- android:layout_height="wrap_content"
- android:layout_gravity="start|top"
- />
- <include layout="@layout/quick_settings"
- android:layout_width="@dimen/notification_panel_width"
- android:layout_height="wrap_content"
- android:layout_gravity="end|top"
- />
- </com.android.systemui.statusbar.phone.PanelHolder>
-</com.android.systemui.statusbar.phone.StatusBarWindowView>
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index 5488a87..a6fb443 100644
--- a/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/packages/SystemUI/res/layout/navigation_bar.xml
@@ -169,6 +169,7 @@
android:scaleType="center"
android:visibility="gone"
android:contentDescription="@string/accessibility_camera_button"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
/>
</FrameLayout>
diff --git a/packages/SystemUI/res/layout/status_bar.xml b/packages/SystemUI/res/layout/status_bar.xml
index ea6be1b..1b35537 100644
--- a/packages/SystemUI/res/layout/status_bar.xml
+++ b/packages/SystemUI/res/layout/status_bar.xml
@@ -27,7 +27,6 @@
android:orientation="vertical"
android:focusable="true"
android:descendantFocusability="afterDescendants"
- android:fitsSystemWindows="true"
>
<ImageView
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml
index a7ec064..8f4417e 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded.xml
@@ -36,6 +36,14 @@
android:layout_gravity="bottom"
/>
+ <ViewStub android:id="@+id/keyguard_flip_stub"
+ android:layout="@layout/status_bar_flip_button"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:layout_gravity="right|top"
+ android:layout_marginTop="@*android:dimen/status_bar_height"
+ android:visibility="gone" />
+
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -49,6 +57,10 @@
android:layout_height="@dimen/notification_panel_header_height"
/>
+ <include
+ layout="@layout/keyguard_status_view"
+ android:visibility="gone" />
+
<TextView
android:id="@+id/emergency_calls_only"
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network.EmergencyOnly"
diff --git a/packages/SystemUI/res/layout/status_bar_expanded_header.xml b/packages/SystemUI/res/layout/status_bar_expanded_header.xml
index 9aa7cfd..56523db 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded_header.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded_header.xml
@@ -81,29 +81,10 @@
android:src="@drawable/ic_notify_clear"
android:background="@drawable/ic_notify_button_bg"
android:contentDescription="@string/accessibility_clear_all"
- />
+ />
- <FrameLayout android:id="@+id/settings_button_holder"
+ <include layout="@layout/status_bar_flip_button"
android:layout_width="50dp"
android:layout_height="50dp"
- android:layout_marginStart="12dp"
- >
- <ImageView android:id="@+id/settings_button"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:scaleType="center"
- android:src="@drawable/ic_notify_settings"
- android:background="@drawable/ic_notify_button_bg"
- android:contentDescription="@string/accessibility_desc_quick_settings"
- />
- <ImageView android:id="@+id/notification_button"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:scaleType="center"
- android:src="@drawable/ic_notifications"
- android:background="@drawable/ic_notify_button_bg"
- android:visibility="gone"
- android:contentDescription="@string/accessibility_notifications_button"
- />
- </FrameLayout>
+ android:layout_marginStart="12dp" />
</LinearLayout>
diff --git a/packages/SystemUI/res/layout/status_bar_flip_button.xml b/packages/SystemUI/res/layout/status_bar_flip_button.xml
new file mode 100644
index 0000000..db672ea
--- /dev/null
+++ b/packages/SystemUI/res/layout/status_bar_flip_button.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2014 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
+ -->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/settings_button_holder"
+ android:layout_width="50dp"
+ android:layout_height="50dp">
+ <ImageView android:id="@+id/settings_button"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:scaleType="center"
+ android:src="@drawable/ic_notify_settings"
+ android:background="@drawable/ic_notify_button_bg"
+ android:contentDescription="@string/accessibility_desc_quick_settings" />
+ <ImageView android:id="@+id/notification_button"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:scaleType="center"
+ android:src="@drawable/ic_notifications"
+ android:background="@drawable/ic_notify_button_bg"
+ android:visibility="gone"
+ android:contentDescription="@string/accessibility_notifications_button" />
+</FrameLayout> \ No newline at end of file
diff --git a/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml b/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml
new file mode 100644
index 0000000..79b03ce
--- /dev/null
+++ b/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml
@@ -0,0 +1,51 @@
+<!--
+ ~ Copyright (C) 2014 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
+ -->
+
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ >
+ <com.android.systemui.statusbar.LatestItemView
+ android:id="@+id/container"
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:layout_marginTop="@dimen/notification_divider_height"
+ android:focusable="true"
+ android:clickable="true"
+ android:background="@*android:drawable/notification_quantum_bg_dim"
+ >
+ <TextView
+ android:id="@+id/more_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:gravity="center_horizontal"
+ android:textColor="@color/keyguard_overflow_content_color"
+ android:textAllCaps="true"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ />
+ <com.android.systemui.statusbar.NotificationOverflowIconsView
+ android:id="@+id/overflow_icons_view"
+ android:layout_gravity="end|center_vertical"
+ android:gravity="end"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ android:layout_width="120dp"
+ android:layout_height="wrap_content"
+ />
+ </com.android.systemui.statusbar.LatestItemView>
+</FrameLayout>
diff --git a/packages/SystemUI/res/layout/status_bar_notification_row.xml b/packages/SystemUI/res/layout/status_bar_notification_row.xml
index e74e568..d61d8b9 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_row.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_row.xml
@@ -32,6 +32,7 @@
android:layout_marginTop="@dimen/notification_divider_height"
android:focusable="true"
android:clickable="true"
+ android:background="@*android:drawable/notification_quantum_bg"
>
<com.android.internal.widget.SizeAdaptiveLayout android:id="@+id/expanded"
diff --git a/packages/SystemUI/res/layout/super_status_bar.xml b/packages/SystemUI/res/layout/super_status_bar.xml
index 2b56618..9176d24 100644
--- a/packages/SystemUI/res/layout/super_status_bar.xml
+++ b/packages/SystemUI/res/layout/super_status_bar.xml
@@ -20,32 +20,29 @@
<!-- This is the combined status bar / notification panel window. -->
<com.android.systemui.statusbar.phone.StatusBarWindowView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:focusable="true"
- android:descendantFocusability="afterDescendants"
- android:fitsSystemWindows="true"
- android:background="@android:color/transparent"
- >
+ android:descendantFocusability="afterDescendants">
<include layout="@layout/status_bar"
android:layout_width="match_parent"
- android:layout_height="@*android:dimen/status_bar_height"
- />
+ android:layout_height="@*android:dimen/status_bar_height" />
<com.android.systemui.statusbar.phone.PanelHolder
android:id="@+id/panel_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
- >
+ android:layout_marginTop="@dimen/panel_holder_padding_top"
+ android:layout_marginBottom="@*android:dimen/navigation_bar_height">
<include layout="@layout/status_bar_expanded"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- />
+ android:layout_width="@dimen/notification_panel_width"
+ android:layout_height="wrap_content"
+ android:layout_gravity="start|top" />
<ViewStub android:id="@+id/quick_settings_stub"
android:layout="@layout/quick_settings"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- />
+ android:layout_width="@dimen/notification_panel_width"
+ android:layout_height="match_parent" />
</com.android.systemui.statusbar.phone.PanelHolder>
</com.android.systemui.statusbar.phone.StatusBarWindowView>
diff --git a/packages/SystemUI/res/layout/user_switcher_host.xml b/packages/SystemUI/res/layout/user_switcher_host.xml
new file mode 100644
index 0000000..bc56cf6
--- /dev/null
+++ b/packages/SystemUI/res/layout/user_switcher_host.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ Copyright (C) 2014 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
+ -->
+
+<!-- FrameLayout -->
+<com.android.systemui.settings.UserSwitcherHostView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="#dd000000">
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@*android:dimen/volume_panel_top"
+ android:background="@*android:drawable/dialog_full_holo_dark">
+ <ListView android:id="@android:id/list"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:listitem="@layout/user_switcher_item"/>
+ </FrameLayout>
+</com.android.systemui.settings.UserSwitcherHostView> \ No newline at end of file
diff --git a/packages/SystemUI/res/layout/user_switcher_item.xml b/packages/SystemUI/res/layout/user_switcher_item.xml
new file mode 100644
index 0000000..43a85e7
--- /dev/null
+++ b/packages/SystemUI/res/layout/user_switcher_item.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2014 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
+ -->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="64dp"
+ android:orientation="horizontal"
+ tools:context=".settings.UserSwitcherDialog">
+ <ImageView
+ android:layout_width="64dp"
+ android:layout_height="match_parent"
+ android:id="@+id/user_picture"
+ tools:src="@drawable/dessert_zombiegingerbread"/>
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:id="@+id/user_name"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:padding="8dp"
+ android:gravity="center_vertical"
+ tools:text="Hiroshi Lockheimer"
+ />
+</LinearLayout>
diff --git a/packages/SystemUI/res/values-sw600dp/config.xml b/packages/SystemUI/res/values-sw600dp/config.xml
index b77f1e0..440ead6 100644
--- a/packages/SystemUI/res/values-sw600dp/config.xml
+++ b/packages/SystemUI/res/values-sw600dp/config.xml
@@ -30,5 +30,5 @@
<integer name="quick_settings_user_time_settings_tile_span">1</integer>
<!-- Enable the "flip settings" panel -->
- <bool name="config_hasFlipSettingsPanel">false</bool>
+ <bool name="config_hasFlipSettingsPanel">true</bool>
</resources>
diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml
index 45f6af3..b4fafec 100644
--- a/packages/SystemUI/res/values-sw600dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp/dimens.xml
@@ -24,8 +24,8 @@
<dimen name="notification_panel_margin_left">16dp</dimen>
<!-- Gravity for the notification & quick settings panels -->
- <!-- 0x800033 = start|top ; 0x800035 = end|top -->
- <integer name="notification_panel_layout_gravity">0x800033</integer>
+ <!-- 0x31 = top|center_horizontal ; 0x800035 = end|top -->
+ <integer name="notification_panel_layout_gravity">0x31</integer>
<integer name="settings_panel_layout_gravity">0x800035</integer>
<!-- Diameter of outer shape drawable shown in navbar search-->
@@ -41,9 +41,8 @@
<dimen name="status_bar_recents_thumbnail_width">200dp</dimen>
<dimen name="status_bar_recents_thumbnail_height">177dp</dimen>
- <!-- On tablet-sized devices, we allocate the rightmost third(ish) of the draggable status bar
- to quick settings. -->
- <item type="dimen" name="settings_panel_dragzone_fraction">35%</item>
+ <!-- On tablets, panels drop from the statusbar instead of overlapping it. -->
+ <dimen name="panel_holder_padding_top">@*android:dimen/status_bar_height</dimen>
<!-- Minimum fraction of the screen that should be taken up by the notification panel. -->
<item type="dimen" name="notification_panel_min_height_frac">40%</item>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 5cf0453..59e8360 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -31,7 +31,8 @@
<drawable name="notification_item_background_legacy_color">#ffaaaaaa</drawable>
<drawable name="heads_up_notification_bg_pressed">#ff33B5E5</drawable>
<drawable name="notification_header_bg">#FF000000</drawable>
- <color name="notification_panel_scrim_color">#B0000000</color>
+ <color name="notification_panel_scrim_color">#A0000000</color>
+ <color name="notification_panel_scrim_color_keyguard">#80000000</color>
<color name="batterymeter_frame_color">#66FFFFFF</color><!-- 40% white -->
<color name="batterymeter_charge_color">#FFFFFFFF</color>
<color name="batterymeter_bolt_color">#FFFFFFFF</color>
@@ -45,4 +46,7 @@
<!-- Tint color for active Quick Settings icons. -->
<color name="ic_qs_on">#ffffffff</color>
+
+ <!-- Tint color for the content on the notification overflow card. -->
+ <color name="keyguard_overflow_content_color">#ff666666</color>
</resources>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 672c1d0..e305d94 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -114,5 +114,9 @@
<integer name="recents_filter_animate_new_views_min_duration">125</integer>
<!-- The min animation duration for animating views that are newly visible. -->
<integer name="recents_animate_task_bar_enter_duration">200</integer>
+
+ <!-- The maximum count of notifications on Keyguard. The rest will be collapsed in an overflow
+ card. -->
+ <integer name="keyguard_max_notification_count">4</integer>
</resources>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 2c8f9a1..5e7db8b 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -167,6 +167,9 @@
<!-- Extra space above the clock in the panel -->
<dimen name="notification_panel_header_padding_top">0dp</dimen>
+ <!-- Extra space above the panel holder -->
+ <dimen name="panel_holder_padding_top">0dp</dimen>
+
<!-- Layout parameters for the notification panel -->
<dimen name="notification_panel_margin_bottom">0dp</dimen>
<dimen name="notification_panel_margin_left">0dp</dimen>
@@ -257,4 +260,7 @@
<!-- Width of the zen mode interstitial dialog. -->
<dimen name="zen_mode_dialog_width">320dp</dimen>
+
+ <!-- Camera affordance drag distance -->
+ <dimen name="camera_drag_distance">100dp</dimen>
</resources>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index ad10545..d994a5b 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -534,4 +534,9 @@
</plurals>
<!-- Zen mode: Summary notification content text. [CHAR LIMIT=NONE] -->
<string name="zen_mode_notification_text">Touch to show</string>
+
+ <!-- Text for overflow card on Keyguard when there is not enough space for all notifications on Keyguard. [CHAR LIMIT=12] -->
+ <plurals name="keyguard_more_overflow_text">
+ <item quantity="other">%d more</item>
+ </plurals>
</resources>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 0ece8e0..8ab646d 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -168,5 +168,7 @@
<!-- Note: must be dp to fit in status bar -->
<item name="android:textSize">14dp</item>
</style>
-
+
+ <style name="systemui_theme" parent="@android:style/Theme.DeviceDefault" />
+
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
new file mode 100644
index 0000000..0f55683
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2014 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
+ */
+
+package com.android.systemui;
+
+import android.app.Application;
+import android.content.res.Configuration;
+import android.util.Log;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Application class for SystemUI.
+ */
+public class SystemUIApplication extends Application {
+
+ private static final String TAG = "SystemUIService";
+ private static final boolean DEBUG = false;
+
+ /**
+ * The classes of the stuff to start.
+ */
+ private final Class<?>[] SERVICES = new Class[] {
+ com.android.systemui.keyguard.KeyguardViewMediator.class,
+ com.android.systemui.recent.Recents.class,
+ com.android.systemui.statusbar.SystemBars.class,
+ com.android.systemui.usb.StorageNotification.class,
+ com.android.systemui.power.PowerUI.class,
+ com.android.systemui.media.RingtonePlayer.class,
+ com.android.systemui.settings.SettingsUI.class,
+ };
+
+ /**
+ * Hold a reference on the stuff we start.
+ */
+ private final SystemUI[] mServices = new SystemUI[SERVICES.length];
+ private boolean mServicesStarted;
+ private final Map<Class<?>, Object> mComponents = new HashMap<Class<?>, Object>();
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ // Set the application theme that is inherited by all services. Note that setting the
+ // application theme in the manifest does only work for activities. Keep this in sync with
+ // the theme set there.
+ setTheme(R.style.systemui_theme);
+ }
+
+ /**
+ * Makes sure that all the SystemUI services are running. If they are already running, this is a
+ * no-op. This is needed to conditinally start all the services, as we only need to have it in
+ * the main process.
+ *
+ * <p>This method must only be called from the main thread.</p>
+ */
+ public void startServicesIfNeeded() {
+ if (mServicesStarted) {
+ return;
+ }
+ final int N = SERVICES.length;
+ for (int i=0; i<N; i++) {
+ Class<?> cl = SERVICES[i];
+ if (DEBUG) Log.d(TAG, "loading: " + cl);
+ try {
+ mServices[i] = (SystemUI)cl.newInstance();
+ } catch (IllegalAccessException ex) {
+ throw new RuntimeException(ex);
+ } catch (InstantiationException ex) {
+ throw new RuntimeException(ex);
+ }
+ mServices[i].mContext = this;
+ mServices[i].mComponents = mComponents;
+ if (DEBUG) Log.d(TAG, "running: " + mServices[i]);
+ mServices[i].start();
+ }
+ mServicesStarted = true;
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ if (mServicesStarted) {
+ int len = mServices.length;
+ for (int i = 0; i < len; i++) {
+ mServices[i].onConfigurationChanged(newConfig);
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getComponent(Class<T> interfaceType) {
+ return (T) mComponents.get(interfaceType);
+ }
+
+ public SystemUI[] getServices() {
+ return mServices;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIService.java b/packages/SystemUI/src/com/android/systemui/SystemUIService.java
index ca5f7d1..05e5f6b 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIService.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIService.java
@@ -18,65 +18,19 @@ package com.android.systemui;
import android.app.Service;
import android.content.Intent;
-import android.content.res.Configuration;
import android.os.IBinder;
-import android.util.Log;
import java.io.FileDescriptor;
import java.io.PrintWriter;
-import java.util.HashMap;
public class SystemUIService extends Service {
- private static final String TAG = "SystemUIService";
-
- /**
- * The classes of the stuff to start.
- */
- private final Class<?>[] SERVICES = new Class[] {
- com.android.systemui.recent.Recents.class,
- com.android.systemui.statusbar.SystemBars.class,
- com.android.systemui.usb.StorageNotification.class,
- com.android.systemui.power.PowerUI.class,
- com.android.systemui.media.RingtonePlayer.class,
- com.android.systemui.settings.SettingsUI.class,
- };
-
- /**
- * Hold a reference on the stuff we start.
- */
- private final SystemUI[] mServices = new SystemUI[SERVICES.length];
@Override
public void onCreate() {
- HashMap<Class<?>, Object> components = new HashMap<Class<?>, Object>();
- final int N = SERVICES.length;
- for (int i=0; i<N; i++) {
- Class<?> cl = SERVICES[i];
- Log.d(TAG, "loading: " + cl);
- try {
- mServices[i] = (SystemUI)cl.newInstance();
- } catch (IllegalAccessException ex) {
- throw new RuntimeException(ex);
- } catch (InstantiationException ex) {
- throw new RuntimeException(ex);
- }
- mServices[i].mContext = this;
- mServices[i].mComponents = components;
- Log.d(TAG, "running: " + mServices[i]);
- mServices[i].start();
- }
- }
-
- @Override
- public void onConfigurationChanged(Configuration newConfig) {
- for (SystemUI ui: mServices) {
- ui.onConfigurationChanged(newConfig);
- }
+ super.onCreate();
+ ((SystemUIApplication) getApplication()).startServicesIfNeeded();
}
- /**
- * Nobody binds to us.
- */
@Override
public IBinder onBind(Intent intent) {
return null;
@@ -84,14 +38,15 @@ public class SystemUIService extends Service {
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ SystemUI[] services = ((SystemUIApplication) getApplication()).getServices();
if (args == null || args.length == 0) {
- for (SystemUI ui: mServices) {
+ for (SystemUI ui: services) {
pw.println("dumping service: " + ui.getClass().getName());
ui.dump(fd, pw, args);
}
} else {
String svc = args[0];
- for (SystemUI ui: mServices) {
+ for (SystemUI ui: services) {
String name = ui.getClass().getName();
if (name.endsWith(svc)) {
ui.dump(fd, pw, args);
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
index 36b2446..41c0e78 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardService.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2014 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.
@@ -11,18 +11,13 @@
* 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.
+ * limitations under the License
*/
-package com.android.keyguard;
-
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
+package com.android.systemui.keyguard;
import android.app.Service;
import android.content.Intent;
-import static android.content.pm.PackageManager.PERMISSION_GRANTED;
-
import android.os.Binder;
import android.os.Bundle;
import android.os.Debug;
@@ -30,23 +25,25 @@ import android.os.IBinder;
import android.util.Log;
import android.view.MotionEvent;
-import com.android.internal.policy.IKeyguardService;
import com.android.internal.policy.IKeyguardExitCallback;
+import com.android.internal.policy.IKeyguardService;
+import com.android.internal.policy.IKeyguardServiceConstants;
import com.android.internal.policy.IKeyguardShowCallback;
-import com.android.internal.widget.LockPatternUtils;
+import com.android.systemui.SystemUIApplication;
+
+import static android.content.pm.PackageManager.PERMISSION_GRANTED;
public class KeyguardService extends Service {
static final String TAG = "KeyguardService";
static final String PERMISSION = android.Manifest.permission.CONTROL_KEYGUARD;
+
private KeyguardViewMediator mKeyguardViewMediator;
@Override
public void onCreate() {
- if (mKeyguardViewMediator == null) {
- mKeyguardViewMediator = new KeyguardViewMediator(
- KeyguardService.this, new LockPatternUtils(KeyguardService.this));
- }
- Log.v(TAG, "onCreate()");
+ ((SystemUIApplication) getApplication()).startServicesIfNeeded();
+ mKeyguardViewMediator =
+ ((SystemUIApplication) getApplication()).getComponent(KeyguardViewMediator.class);
}
@Override
@@ -54,11 +51,6 @@ public class KeyguardService extends Service {
return mBinder;
}
- @Override
- protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- // TODO
- }
-
void checkPermission() {
if (getBaseContext().checkCallingOrSelfPermission(PERMISSION) != PERMISSION_GRANTED) {
Log.w(TAG, "Caller needs permission '" + PERMISSION + "' to call " + Debug.getCaller());
@@ -68,84 +60,148 @@ public class KeyguardService extends Service {
}
private final IKeyguardService.Stub mBinder = new IKeyguardService.Stub() {
+
+ private boolean mIsOccluded;
+
+ @Override
public boolean isShowing() {
return mKeyguardViewMediator.isShowing();
}
+
+ @Override
public boolean isSecure() {
return mKeyguardViewMediator.isSecure();
}
- public boolean isShowingAndNotHidden() {
- return mKeyguardViewMediator.isShowingAndNotHidden();
+
+ @Override
+ public boolean isShowingAndNotOccluded() {
+ return mKeyguardViewMediator.isShowingAndNotOccluded();
}
+
+ @Override
public boolean isInputRestricted() {
return mKeyguardViewMediator.isInputRestricted();
}
+
+ @Override
public void verifyUnlock(IKeyguardExitCallback callback) {
+ checkPermission();
mKeyguardViewMediator.verifyUnlock(callback);
}
+
+ @Override
public void keyguardDone(boolean authenticated, boolean wakeup) {
checkPermission();
mKeyguardViewMediator.keyguardDone(authenticated, wakeup);
}
- public void setHidden(boolean isHidden) {
+
+ @Override
+ public int setOccluded(boolean isOccluded) {
checkPermission();
- mKeyguardViewMediator.setHidden(isHidden);
+ synchronized (this) {
+ int result;
+ if (isOccluded && mKeyguardViewMediator.isShowing()
+ && !mIsOccluded) {
+ result = IKeyguardServiceConstants
+ .KEYGUARD_SERVICE_SET_OCCLUDED_RESULT_UNSET_FLAGS;
+ } else if (!isOccluded && mKeyguardViewMediator.isShowing()
+ && mIsOccluded) {
+ result = IKeyguardServiceConstants
+ .KEYGUARD_SERVICE_SET_OCCLUDED_RESULT_SET_FLAGS;
+ } else {
+ result = IKeyguardServiceConstants.KEYGUARD_SERVICE_SET_OCCLUDED_RESULT_NONE;
+ }
+ if (mIsOccluded != isOccluded) {
+ mKeyguardViewMediator.setOccluded(isOccluded);
+
+ // Cache the value so we always have a fresh view in whether Keyguard is occluded.
+ // If we would just call mKeyguardViewMediator.isOccluded(), this might be stale
+ // because that value gets updated in another thread.
+ mIsOccluded = isOccluded;
+ }
+ return result;
+ }
}
+
+ @Override
public void dismiss() {
+ checkPermission();
mKeyguardViewMediator.dismiss();
}
+
+ @Override
public void onDreamingStarted() {
checkPermission();
mKeyguardViewMediator.onDreamingStarted();
}
+
+ @Override
public void onDreamingStopped() {
checkPermission();
mKeyguardViewMediator.onDreamingStopped();
}
+
+ @Override
public void onScreenTurnedOff(int reason) {
checkPermission();
mKeyguardViewMediator.onScreenTurnedOff(reason);
}
+
+ @Override
public void onScreenTurnedOn(IKeyguardShowCallback callback) {
checkPermission();
mKeyguardViewMediator.onScreenTurnedOn(callback);
}
+
+ @Override
public void setKeyguardEnabled(boolean enabled) {
checkPermission();
mKeyguardViewMediator.setKeyguardEnabled(enabled);
}
+
+ @Override
public boolean isDismissable() {
return mKeyguardViewMediator.isDismissable();
}
+
+ @Override
public void onSystemReady() {
checkPermission();
mKeyguardViewMediator.onSystemReady();
}
+
+ @Override
public void doKeyguardTimeout(Bundle options) {
checkPermission();
mKeyguardViewMediator.doKeyguardTimeout(options);
}
+
+ @Override
public void setCurrentUser(int userId) {
checkPermission();
mKeyguardViewMediator.setCurrentUser(userId);
}
+
+ @Override
public void showAssistant() {
checkPermission();
- mKeyguardViewMediator.showAssistant();
}
+
+ @Override
public void dispatch(MotionEvent event) {
checkPermission();
- mKeyguardViewMediator.dispatch(event);
}
+
+ @Override
public void launchCamera() {
checkPermission();
- mKeyguardViewMediator.launchCamera();
}
+
+ @Override
public void onBootCompleted() {
checkPermission();
mKeyguardViewMediator.onBootCompleted();
}
};
-
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 354d13f..bb39d36 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 The Android Open Source Project
+ * Copyright (C) 2014 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.
@@ -11,15 +11,10 @@
* 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.
+ * limitations under the License
*/
-package com.android.keyguard;
-
-import com.android.internal.policy.IKeyguardExitCallback;
-import com.android.internal.policy.IKeyguardShowCallback;
-import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
-import static com.android.keyguard.analytics.KeyguardAnalytics.SessionTypeAdapter;
+package com.android.systemui.keyguard;
import android.app.Activity;
import android.app.ActivityManagerNative;
@@ -50,17 +45,31 @@ import android.telephony.TelephonyManager;
import android.util.EventLog;
import android.util.Log;
import android.util.Slog;
-import android.view.MotionEvent;
+import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.WindowManagerPolicy;
+import com.android.internal.policy.IKeyguardExitCallback;
+import com.android.internal.policy.IKeyguardShowCallback;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.widget.LockPatternUtils;
-import com.android.keyguard.analytics.Session;
+import com.android.keyguard.KeyguardDisplayManager;
+import com.android.keyguard.KeyguardUpdateMonitor;
+import com.android.keyguard.KeyguardUpdateMonitorCallback;
+import com.android.keyguard.MultiUserAvatarCache;
+import com.android.keyguard.ViewMediatorCallback;
import com.android.keyguard.analytics.KeyguardAnalytics;
+import com.android.keyguard.analytics.Session;
+import com.android.systemui.SystemUI;
+import com.android.systemui.statusbar.phone.PhoneStatusBar;
+import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
+import com.android.systemui.statusbar.phone.StatusBarWindowManager;
import java.io.File;
+import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
+import static com.android.keyguard.analytics.KeyguardAnalytics.SessionTypeAdapter;
+
/**
* Mediates requests related to the keyguard. This includes queries about the
@@ -95,15 +104,15 @@ import java.io.File;
* false, this will override all other conditions for turning on the keyguard.
*
* Threading and synchronization:
- * This class is created by the initialization routine of the {@link WindowManagerPolicy},
+ * This class is created by the initialization routine of the {@link android.view.WindowManagerPolicy},
* and runs on its thread. The keyguard UI is created from that thread in the
* constructor of this class. The apis may be called from other threads, including the
* {@link com.android.server.input.InputManagerService}'s and {@link android.view.WindowManager}'s.
* Therefore, methods on this class are synchronized, and any action that is pointed
- * directly to the keyguard UI is posted to a {@link Handler} to ensure it is taken on the UI
+ * directly to the keyguard UI is posted to a {@link android.os.Handler} to ensure it is taken on the UI
* thread of the keyguard.
*/
-public class KeyguardViewMediator {
+public class KeyguardViewMediator extends SystemUI {
private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000;
final static boolean DEBUG = false;
private static final boolean ENABLE_ANALYTICS = Build.IS_DEBUGGABLE;
@@ -124,17 +133,14 @@ public class KeyguardViewMediator {
private static final int KEYGUARD_DONE = 9;
private static final int KEYGUARD_DONE_DRAWING = 10;
private static final int KEYGUARD_DONE_AUTHENTICATING = 11;
- private static final int SET_HIDDEN = 12;
+ private static final int SET_OCCLUDED = 12;
private static final int KEYGUARD_TIMEOUT = 13;
- private static final int SHOW_ASSISTANT = 14;
- private static final int DISPATCH_EVENT = 15;
- private static final int LAUNCH_CAMERA = 16;
private static final int DISMISS = 17;
/**
* The default amount of time we stay awake (used for all key input)
*/
- protected static final int AWAKE_INTERVAL_DEFAULT_MS = 10000;
+ public static final int AWAKE_INTERVAL_DEFAULT_MS = 10000;
/**
* How long to wait after the screen turns off due to timeout before
@@ -158,13 +164,13 @@ public class KeyguardViewMediator {
/**
* Allow the user to expand the status bar when a SECURE keyguard is engaged
- * and {@link Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS} is set
+ * and {@link android.provider.Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS} is set
* (private notifications will be masked).
*/
private static final boolean ENABLE_SECURE_STATUS_BAR_EXPAND = true;
/**
- * Default value of {@link Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS}.
+ * Default value of {@link android.provider.Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS}.
*/
private static final boolean ALLOW_NOTIFICATIONS_DEFAULT = false;
@@ -176,7 +182,6 @@ public class KeyguardViewMediator {
/** The stream type that the lock sounds are tied to. */
private int mMasterStreamType;
- private Context mContext;
private AlarmManager mAlarmManager;
private AudioManager mAudioManager;
private StatusBarManager mStatusBarManager;
@@ -204,9 +209,9 @@ public class KeyguardViewMediator {
*/
private PowerManager.WakeLock mShowKeyguardWakeLock;
- private KeyguardViewManager mKeyguardViewManager;
+ private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
- private final KeyguardAnalytics mKeyguardAnalytics;
+ private KeyguardAnalytics mKeyguardAnalytics;
// these are protected by synchronized (this)
@@ -227,7 +232,7 @@ public class KeyguardViewMediator {
private boolean mShowing;
// true if the keyguard is hidden by another window
- private boolean mHidden = false;
+ private boolean mOccluded = false;
/**
* Helps remember whether the screen has turned on since the last time
@@ -272,79 +277,20 @@ public class KeyguardViewMediator {
private int mLockSoundStreamId;
/**
- * Tracks value of {@link Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS}.
+ * Tracks value of {@link android.provider.Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS}.
*/
private boolean mAllowNotificationsWhenSecure;
/**
* The volume applied to the lock/unlock sounds.
*/
- private final float mLockSoundVolume;
+ private float mLockSoundVolume;
/**
* For managing external displays
*/
private KeyguardDisplayManager mKeyguardDisplayManager;
- /**
- * Cache of avatar drawables, for use by KeyguardMultiUserAvatar.
- */
- private static MultiUserAvatarCache sMultiUserAvatarCache = new MultiUserAvatarCache();
-
- /**
- * The callback used by the keyguard view to tell the {@link KeyguardViewMediator}
- * various things.
- */
- public interface ViewMediatorCallback {
- /**
- * Reports user activity and requests that the screen stay on.
- */
- void userActivity();
-
- /**
- * Reports user activity and requests that the screen stay on for at least
- * the specified amount of time.
- * @param millis The amount of time in millis. This value is currently ignored.
- */
- void userActivity(long millis);
-
- /**
- * Report that the keyguard is done.
- * @param authenticated Whether the user securely got past the keyguard.
- * the only reason for this to be false is if the keyguard was instructed
- * to appear temporarily to verify the user is supposed to get past the
- * keyguard, and the user fails to do so.
- */
- void keyguardDone(boolean authenticated);
-
- /**
- * Report that the keyguard is done drawing.
- */
- void keyguardDoneDrawing();
-
- /**
- * Tell ViewMediator that the current view needs IME input
- * @param needsInput
- */
- void setNeedsInput(boolean needsInput);
-
- /**
- * Tell view mediator that the keyguard view's desired user activity timeout
- * has changed and needs to be reapplied to the window.
- */
- void onUserActivityTimeoutChanged();
-
- /**
- * Report that the keyguard is dismissable, pending the next keyguardDone call.
- */
- void keyguardDonePending();
-
- /**
- * Report when keyguard is actually gone
- */
- void keyguardGone();
- }
-
KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() {
@Override
@@ -354,7 +300,7 @@ public class KeyguardViewMediator {
// ActivityManagerService) will not reconstruct the keyguard if it is already showing.
synchronized (KeyguardViewMediator.this) {
mSwitchingUser = true;
- resetStateLocked(null);
+ resetStateLocked();
adjustStatusBarLocked();
// When we switch users we want to bring the new user to the biometric unlock even
// if the current user has gone to the backup.
@@ -370,16 +316,16 @@ public class KeyguardViewMediator {
@Override
public void onUserRemoved(int userId) {
mLockPatternUtils.removeUser(userId);
- sMultiUserAvatarCache.clear(userId);
+ MultiUserAvatarCache.getInstance().clear(userId);
}
@Override
public void onUserInfoChanged(int userId) {
- sMultiUserAvatarCache.clear(userId);
+ MultiUserAvatarCache.getInstance().clear(userId);
}
@Override
- void onPhoneStateChanged(int phoneState) {
+ public void onPhoneStateChanged(int phoneState) {
synchronized (KeyguardViewMediator.this) {
if (TelephonyManager.CALL_STATE_IDLE == phoneState // call ending
&& !mScreenOn // screen off
@@ -394,7 +340,7 @@ public class KeyguardViewMediator {
doKeyguardLocked(null);
}
}
- };
+ }
@Override
public void onClockVisibilityChanged() {
@@ -423,7 +369,7 @@ public class KeyguardViewMediator {
+ "device isn't provisioned yet.");
doKeyguardLocked(null);
} else {
- resetStateLocked(null);
+ resetStateLocked();
}
}
}
@@ -436,7 +382,7 @@ public class KeyguardViewMediator {
+ "showing; need to show keyguard so user can enter sim pin");
doKeyguardLocked(null);
} else {
- resetStateLocked(null);
+ resetStateLocked();
}
}
break;
@@ -449,14 +395,14 @@ public class KeyguardViewMediator {
} else {
if (DEBUG) Log.d(TAG, "PERM_DISABLED, resetStateLocked to"
+ "show permanently disabled message in lockscreen.");
- resetStateLocked(null);
+ resetStateLocked();
}
}
break;
case READY:
synchronized (this) {
if (isShowing()) {
- resetStateLocked(null);
+ resetStateLocked();
}
}
break;
@@ -466,6 +412,7 @@ public class KeyguardViewMediator {
};
ViewMediatorCallback mViewMediatorCallback = new ViewMediatorCallback() {
+
public void userActivity() {
KeyguardViewMediator.this.userActivity();
}
@@ -484,12 +431,12 @@ public class KeyguardViewMediator {
@Override
public void setNeedsInput(boolean needsInput) {
- mKeyguardViewManager.setNeedsInput(needsInput);
+ mStatusBarKeyguardViewManager.setNeedsInput(needsInput);
}
@Override
public void onUserActivityTimeoutChanged() {
- mKeyguardViewManager.updateUserActivityTimeout();
+ mStatusBarKeyguardViewManager.updateUserActivityTimeout();
}
@Override
@@ -513,40 +460,34 @@ public class KeyguardViewMediator {
mPM.userActivity(SystemClock.uptimeMillis(), false);
}
- /**
- * Construct a KeyguardViewMediator
- * @param context
- * @param lockPatternUtils optional mock interface for LockPatternUtils
- */
- public KeyguardViewMediator(Context context, LockPatternUtils lockPatternUtils) {
- mContext = context;
- mPM = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+ private void setup() {
+ mPM = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
mShowKeyguardWakeLock = mPM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "show keyguard");
mShowKeyguardWakeLock.setReferenceCounted(false);
mContext.registerReceiver(mBroadcastReceiver, new IntentFilter(DELAYED_KEYGUARD_ACTION));
- mKeyguardDisplayManager = new KeyguardDisplayManager(context);
+ mKeyguardDisplayManager = new KeyguardDisplayManager(mContext);
- mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
+ mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
- mUpdateMonitor = KeyguardUpdateMonitor.getInstance(context);
+ mUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
- mLockPatternUtils = lockPatternUtils != null
- ? lockPatternUtils : new LockPatternUtils(mContext);
+ mLockPatternUtils = new LockPatternUtils(mContext);
mLockPatternUtils.setCurrentUser(UserHandle.USER_OWNER);
// Assume keyguard is showing (unless it's disabled) until we know for sure...
mShowing = (mUpdateMonitor.isDeviceProvisioned() || mLockPatternUtils.isSecure())
&& !mLockPatternUtils.isLockScreenDisabled();
- WindowManager wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
+ mStatusBarKeyguardViewManager = new StatusBarKeyguardViewManager(mContext,
+ mViewMediatorCallback, mLockPatternUtils);
final ContentResolver cr = mContext.getContentResolver();
if (ENABLE_ANALYTICS && !LockPatternUtils.isSafeModeEnabled() &&
Settings.Secure.getInt(cr, KEYGUARD_ANALYTICS_SETTING, 0) == 1) {
- mKeyguardAnalytics = new KeyguardAnalytics(context, new SessionTypeAdapter() {
+ mKeyguardAnalytics = new KeyguardAnalytics(mContext, new SessionTypeAdapter() {
@Override
public int getSessionType() {
@@ -559,9 +500,6 @@ public class KeyguardViewMediator {
} else {
mKeyguardAnalytics = null;
}
- mKeyguardViewManager = new KeyguardViewManager(context, wm, mViewMediatorCallback,
- mLockPatternUtils,
- mKeyguardAnalytics != null ? mKeyguardAnalytics.getCallback() : null);
mScreenOn = mPM.isScreenOn();
@@ -580,11 +518,17 @@ public class KeyguardViewMediator {
if (soundPath == null || mUnlockSoundId == 0) {
Log.w(TAG, "failed to load unlock sound from " + soundPath);
}
- int lockSoundDefaultAttenuation = context.getResources().getInteger(
+ int lockSoundDefaultAttenuation = mContext.getResources().getInteger(
com.android.internal.R.integer.config_lockSoundVolumeDb);
mLockSoundVolume = (float)Math.pow(10, (float)lockSoundDefaultAttenuation/20);
}
+ @Override
+ public void start() {
+ setup();
+ putComponent(KeyguardViewMediator.class, this);
+ }
+
/**
* Let us know that the system is ready after startup.
*/
@@ -621,9 +565,9 @@ public class KeyguardViewMediator {
/**
* Called to let us know the screen was turned off.
- * @param why either {@link WindowManagerPolicy#OFF_BECAUSE_OF_USER},
- * {@link WindowManagerPolicy#OFF_BECAUSE_OF_TIMEOUT} or
- * {@link WindowManagerPolicy#OFF_BECAUSE_OF_PROX_SENSOR}.
+ * @param why either {@link android.view.WindowManagerPolicy#OFF_BECAUSE_OF_USER},
+ * {@link android.view.WindowManagerPolicy#OFF_BECAUSE_OF_TIMEOUT} or
+ * {@link android.view.WindowManagerPolicy#OFF_BECAUSE_OF_PROX_SENSOR}.
*/
public void onScreenTurnedOff(int why) {
synchronized (this) {
@@ -651,7 +595,7 @@ public class KeyguardViewMediator {
}
} else if (mShowing) {
notifyScreenOffLocked();
- resetStateLocked(null);
+ resetStateLocked();
} else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT
|| (why == WindowManagerPolicy.OFF_BECAUSE_OF_USER && !lockImmediately)) {
doKeyguardLaterLocked();
@@ -768,7 +712,7 @@ public class KeyguardViewMediator {
}
/**
- * Same semantics as {@link WindowManagerPolicy#enableKeyguard}; provide
+ * Same semantics as {@link android.view.WindowManagerPolicy#enableKeyguard}; provide
* a way for external stuff to override normal keyguard behavior. For instance
* the phone app disables the keyguard when it receives incoming calls.
*/
@@ -805,7 +749,7 @@ public class KeyguardViewMediator {
Slog.w(TAG, "Failed to call onKeyguardExitResult(false)", e);
}
mExitSecureCallback = null;
- resetStateLocked(null);
+ resetStateLocked();
} else {
showLocked(null);
@@ -873,36 +817,41 @@ public class KeyguardViewMediator {
return mShowing;
}
+ public boolean isOccluded() {
+ return mOccluded;
+ }
+
/**
* Is the keyguard currently showing and not being force hidden?
*/
- public boolean isShowingAndNotHidden() {
- return mShowing && !mHidden;
+ public boolean isShowingAndNotOccluded() {
+ return mShowing && !mOccluded;
}
/**
- * Notify us when the keyguard is hidden by another window
+ * Notify us when the keyguard is occluded by another window
*/
- public void setHidden(boolean isHidden) {
- if (DEBUG) Log.d(TAG, "setHidden " + isHidden);
- mUpdateMonitor.sendKeyguardVisibilityChanged(!isHidden);
- mHandler.removeMessages(SET_HIDDEN);
- Message msg = mHandler.obtainMessage(SET_HIDDEN, (isHidden ? 1 : 0), 0);
+ public void setOccluded(boolean isOccluded) {
+ if (DEBUG) Log.d(TAG, "setOccluded " + isOccluded);
+ mUpdateMonitor.sendKeyguardVisibilityChanged(!isOccluded);
+ mHandler.removeMessages(SET_OCCLUDED);
+ Message msg = mHandler.obtainMessage(SET_OCCLUDED, (isOccluded ? 1 : 0), 0);
mHandler.sendMessage(msg);
}
/**
- * Handles SET_HIDDEN message sent by setHidden()
+ * Handles SET_OCCLUDED message sent by setOccluded()
*/
- private void handleSetHidden(boolean isHidden) {
+ private void handleSetOccluded(boolean isOccluded) {
synchronized (KeyguardViewMediator.this) {
- if (mHidden != isHidden) {
- mHidden = isHidden;
+ if (mOccluded != isOccluded) {
+ mOccluded = isOccluded;
+ mStatusBarKeyguardViewManager.setOccluded(isOccluded);
updateActivityLockScreenState();
adjustStatusBarLocked();
}
if (ENABLE_ANALYTICS && mKeyguardAnalytics != null) {
- mKeyguardAnalytics.getCallback().onSetHidden(isHidden);
+ mKeyguardAnalytics.getCallback().onSetOccluded(isOccluded);
}
}
}
@@ -954,7 +903,7 @@ public class KeyguardViewMediator {
ALLOW_NOTIFICATIONS_DEFAULT ? 1 : 0);
// if the keyguard is already showing, don't bother
- if (mKeyguardViewManager.isShowing()) {
+ if (mStatusBarKeyguardViewManager.isShowing()) {
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because it is already showing");
return;
}
@@ -996,8 +945,8 @@ public class KeyguardViewMediator {
* Dismiss the keyguard through the security layers.
*/
public void handleDismiss() {
- if (mShowing && !mHidden) {
- mKeyguardViewManager.dismiss();
+ if (mShowing && !mOccluded) {
+ mStatusBarKeyguardViewManager.dismiss();
}
}
@@ -1007,12 +956,11 @@ public class KeyguardViewMediator {
/**
* Send message to keyguard telling it to reset its state.
- * @param options options about how to show the keyguard
- * @see #handleReset()
+ * @see #handleReset
*/
- private void resetStateLocked(Bundle options) {
+ private void resetStateLocked() {
if (DEBUG) Log.e(TAG, "resetStateLocked");
- Message msg = mHandler.obtainMessage(RESET, options);
+ Message msg = mHandler.obtainMessage(RESET);
mHandler.sendMessage(msg);
}
@@ -1038,7 +986,7 @@ public class KeyguardViewMediator {
/**
* Send a message to keyguard telling it the screen just turned on.
- * @see #onScreenTurnedOn()
+ * @see #onScreenTurnedOn
* @see #handleNotifyScreenOn
*/
private void notifyScreenOnLocked(IKeyguardShowCallback result) {
@@ -1049,7 +997,7 @@ public class KeyguardViewMediator {
/**
* Send message to keyguard telling it to show itself
- * @see #handleShow()
+ * @see #handleShow
*/
private void showLocked(Bundle options) {
if (DEBUG) Log.d(TAG, "showLocked");
@@ -1130,7 +1078,7 @@ public class KeyguardViewMediator {
handleHide();
break;
case RESET:
- handleReset((Bundle) msg.obj);
+ handleReset();
break;
case VERIFY_UNLOCK:
handleVerifyUnlock();
@@ -1150,23 +1098,14 @@ public class KeyguardViewMediator {
case KEYGUARD_DONE_AUTHENTICATING:
keyguardDone(true, true);
break;
- case SET_HIDDEN:
- handleSetHidden(msg.arg1 != 0);
+ case SET_OCCLUDED:
+ handleSetOccluded(msg.arg1 != 0);
break;
case KEYGUARD_TIMEOUT:
synchronized (KeyguardViewMediator.this) {
doKeyguardLocked((Bundle) msg.obj);
}
break;
- case SHOW_ASSISTANT:
- handleShowAssistant();
- break;
- case DISPATCH_EVENT:
- handleDispatchEvent((MotionEvent) msg.obj);
- break;
- case LAUNCH_CAMERA:
- handleLaunchCamera();
- break;
case DISMISS:
handleDismiss();
break;
@@ -1206,21 +1145,13 @@ public class KeyguardViewMediator {
sendUserPresentBroadcast();
}
- protected void handleLaunchCamera() {
- mKeyguardViewManager.launchCamera();
- }
-
- protected void handleDispatchEvent(MotionEvent event) {
- mKeyguardViewManager.dispatch(event);
- }
-
private void sendUserPresentBroadcast() {
final UserHandle currentUser = new UserHandle(mLockPatternUtils.getCurrentUser());
mContext.sendBroadcastAsUser(USER_PRESENT_INTENT, currentUser);
}
/**
- * @see #keyguardDoneDrawing
+ * @see #keyguardDone
* @see #KEYGUARD_DONE_DRAWING
*/
private void handleKeyguardDoneDrawing() {
@@ -1269,7 +1200,7 @@ public class KeyguardViewMediator {
private void updateActivityLockScreenState() {
try {
- ActivityManagerNative.getDefault().setLockScreenShown(mShowing && !mHidden);
+ ActivityManagerNative.getDefault().setLockScreenShown(mShowing && !mOccluded);
} catch (RemoteException e) {
}
}
@@ -1287,16 +1218,12 @@ public class KeyguardViewMediator {
if (DEBUG) Log.d(TAG, "handleShow");
}
- mKeyguardViewManager.show(options);
+ mStatusBarKeyguardViewManager.show(options);
mShowing = true;
mKeyguardDonePending = false;
updateActivityLockScreenState();
adjustStatusBarLocked();
userActivity();
- try {
- ActivityManagerNative.getDefault().closeSystemDialogs("lock");
- } catch (RemoteException e) {
- }
// Do this at the end to not slow down display of the keyguard.
playSounds(true);
@@ -1320,7 +1247,7 @@ public class KeyguardViewMediator {
playSounds(false);
}
- mKeyguardViewManager.hide();
+ mStatusBarKeyguardViewManager.hide();
mShowing = false;
mKeyguardDonePending = false;
updateActivityLockScreenState();
@@ -1360,7 +1287,7 @@ public class KeyguardViewMediator {
}
if (DEBUG) {
- Log.d(TAG, "adjustStatusBarLocked: mShowing=" + mShowing + " mHidden=" + mHidden
+ Log.d(TAG, "adjustStatusBarLocked: mShowing=" + mShowing + " mOccluded=" + mOccluded
+ " isSecure=" + isSecure() + " --> flags=0x" + Integer.toHexString(flags));
}
@@ -1371,17 +1298,13 @@ public class KeyguardViewMediator {
}
/**
- * Handle message sent by {@link #resetStateLocked(Bundle)}
+ * Handle message sent by {@link #resetStateLocked}
* @see #RESET
*/
- private void handleReset(Bundle options) {
- if (options == null) {
- options = new Bundle();
- }
- options.putBoolean(KeyguardViewManager.IS_SWITCHING_USER, mSwitchingUser);
+ private void handleReset() {
synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleReset");
- mKeyguardViewManager.reset(options);
+ mStatusBarKeyguardViewManager.reset();
}
}
@@ -1392,7 +1315,7 @@ public class KeyguardViewMediator {
private void handleVerifyUnlock() {
synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleVerifyUnlock");
- mKeyguardViewManager.verifyUnlock();
+ mStatusBarKeyguardViewManager.verifyUnlock();
mShowing = true;
updateActivityLockScreenState();
}
@@ -1405,18 +1328,18 @@ public class KeyguardViewMediator {
private void handleNotifyScreenOff() {
synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleNotifyScreenOff");
- mKeyguardViewManager.onScreenTurnedOff();
+ mStatusBarKeyguardViewManager.onScreenTurnedOff();
}
}
/**
- * Handle message sent by {@link #notifyScreenOnLocked()}
+ * Handle message sent by {@link #notifyScreenOnLocked}
* @see #NOTIFY_SCREEN_ON
*/
private void handleNotifyScreenOn(IKeyguardShowCallback callback) {
synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleNotifyScreenOn");
- mKeyguardViewManager.onScreenTurnedOn(callback);
+ mStatusBarKeyguardViewManager.onScreenTurnedOn(callback);
}
}
@@ -1424,35 +1347,23 @@ public class KeyguardViewMediator {
return mKeyguardDonePending || !isSecure();
}
- public void showAssistant() {
- Message msg = mHandler.obtainMessage(SHOW_ASSISTANT);
- mHandler.sendMessage(msg);
- }
-
- public void handleShowAssistant() {
- mKeyguardViewManager.showAssistant();
- }
-
private boolean isAssistantAvailable() {
return mSearchManager != null
&& mSearchManager.getAssistIntent(mContext, false, UserHandle.USER_CURRENT) != null;
}
- public static MultiUserAvatarCache getAvatarCache() {
- return sMultiUserAvatarCache;
- }
-
- public void dispatch(MotionEvent event) {
- Message msg = mHandler.obtainMessage(DISPATCH_EVENT, event);
- mHandler.sendMessage(msg);
+ public void onBootCompleted() {
+ mUpdateMonitor.dispatchBootCompleted();
}
- public void launchCamera() {
- Message msg = mHandler.obtainMessage(LAUNCH_CAMERA);
- mHandler.sendMessage(msg);
+ public StatusBarKeyguardViewManager registerStatusBar(PhoneStatusBar phoneStatusBar,
+ ViewGroup container, StatusBarWindowManager statusBarWindowManager) {
+ mStatusBarKeyguardViewManager.registerStatusBar(phoneStatusBar, container,
+ statusBarWindowManager);
+ return mStatusBarKeyguardViewManager;
}
- public void onBootCompleted() {
- mUpdateMonitor.dispatchBootCompleted();
+ public ViewMediatorCallback getViewMediatorCallback() {
+ return mViewMediatorCallback;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/settings/UserSwitcherHostView.java b/packages/SystemUI/src/com/android/systemui/settings/UserSwitcherHostView.java
new file mode 100644
index 0000000..87ebcc1
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/settings/UserSwitcherHostView.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2014 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
+ */
+
+package com.android.systemui.settings;
+
+import com.android.systemui.R;
+
+import android.app.ActivityManagerNative;
+import android.content.Context;
+import android.content.pm.UserInfo;
+import android.os.RemoteException;
+import android.os.UserManager;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManagerGlobal;
+import android.widget.AdapterView;
+import android.widget.BaseAdapter;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+
+/**
+ * A quick and dirty view to show a user switcher.
+ */
+public class UserSwitcherHostView extends FrameLayout implements ListView.OnItemClickListener {
+
+ private static final String TAG = "UserSwitcherDialog";
+
+ private ArrayList<UserInfo> mUserInfo = new ArrayList<UserInfo>();
+ private Adapter mAdapter = new Adapter();
+ private UserManager mUserManager;
+ private Runnable mFinishRunnable;
+ private ListView mListView;
+
+ public UserSwitcherHostView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+
+ if (isInEditMode()) {
+ return;
+ }
+ mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
+ }
+
+ public UserSwitcherHostView(Context context, AttributeSet attrs) {
+ this(context, attrs, com.android.internal.R.attr.listViewStyle);
+ }
+
+ public UserSwitcherHostView(Context context) {
+ this(context, null);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mListView = (ListView) findViewById(android.R.id.list);
+ mListView.setAdapter(mAdapter);
+ mListView.setOnItemClickListener(this);
+ }
+
+ @Override
+ public void onItemClick(AdapterView<?> l, View v, int position, long id) {
+ int userId = mAdapter.getItem(position).id;
+ try {
+ WindowManagerGlobal.getWindowManagerService().lockNow(null);
+ ActivityManagerNative.getDefault().switchUser(userId);
+ finish();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Couldn't switch user.", e);
+ }
+ }
+
+ private void finish() {
+ if (mFinishRunnable != null) {
+ mFinishRunnable.run();
+ }
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_UP) {
+ finish();
+ }
+ return true;
+ }
+
+ @Override
+ protected void onVisibilityChanged(View changedView, int visibility) {
+ super.onVisibilityChanged(changedView, visibility);
+ // A gross hack to get rid of the switcher when the shade is collapsed.
+ if (visibility != VISIBLE) {
+ finish();
+ }
+ }
+
+ public void setFinishRunnable(Runnable finishRunnable) {
+ mFinishRunnable = finishRunnable;
+ }
+
+ public void refreshUsers() {
+ mUserInfo.clear();
+ mUserInfo.addAll(mUserManager.getUsers(true));
+ mAdapter.notifyDataSetChanged();
+ }
+
+ private class Adapter extends BaseAdapter {
+
+ @Override
+ public int getCount() {
+ return mUserInfo.size();
+ }
+
+ @Override
+ public UserInfo getItem(int position) {
+ return mUserInfo.get(position);
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return getItem(position).serialNumber;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ if (convertView == null || (!(convertView.getTag() instanceof ViewHolder))) {
+ convertView = createView(parent);
+ }
+ ViewHolder h = (ViewHolder) convertView.getTag();
+ bindView(h, getItem(position));
+ return convertView;
+ }
+
+ private View createView(ViewGroup parent) {
+ View v = LayoutInflater.from(getContext()).inflate(
+ R.layout.user_switcher_item, parent, false);
+ ViewHolder h = new ViewHolder();
+ h.name = (TextView) v.findViewById(R.id.user_name);
+ h.picture = (ImageView) v.findViewById(R.id.user_picture);
+ v.setTag(h);
+ return v;
+ }
+
+ private void bindView(ViewHolder h, UserInfo item) {
+ h.name.setText(item.name);
+ h.picture.setImageBitmap(mUserManager.getUserIcon(item.id));
+ }
+
+ class ViewHolder {
+ TextView name;
+ ImageView picture;
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 2f135ec..e51b914 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -168,9 +168,9 @@ public abstract class BaseStatusBar extends SystemUI implements
protected int mZenMode;
- public IStatusBarService getStatusBarService() {
- return mBarService;
- }
+ protected boolean mOnKeyguard;
+ protected View mKeyguardIconOverflowContainer;
+ protected NotificationOverflowIconsView mOverflowIconsView;
public boolean isDeviceProvisioned() {
return mDeviceProvisioned;
@@ -435,8 +435,6 @@ public abstract class BaseStatusBar extends SystemUI implements
}
if (version > 0 && version < Build.VERSION_CODES.GINGERBREAD) {
content.setBackgroundResource(R.drawable.notification_row_legacy_bg);
- } else {
- content.setBackgroundResource(com.android.internal.R.drawable.notification_bg);
}
}
}
@@ -1004,7 +1002,7 @@ public abstract class BaseStatusBar extends SystemUI implements
// Remove the expanded view.
ViewGroup rowParent = (ViewGroup)entry.row.getParent();
if (rowParent != null) rowParent.removeView(entry.row);
- updateExpansionStates();
+ updateRowStates();
updateNotificationIcons();
return entry.notification;
@@ -1047,7 +1045,7 @@ public abstract class BaseStatusBar extends SystemUI implements
if (DEBUG) {
Log.d(TAG, "addNotificationViews: added at " + pos);
}
- updateExpansionStates();
+ updateRowStates();
updateNotificationIcons();
}
@@ -1055,28 +1053,53 @@ public abstract class BaseStatusBar extends SystemUI implements
addNotificationViews(createNotificationViews(key, notification));
}
- protected void updateExpansionStates() {
+ /**
+ * @return The number of notifications we show on Keyguard.
+ */
+ protected abstract int getMaxKeyguardNotifications();
- // TODO: Handle user expansion better
- int N = mNotificationData.size();
- for (int i = 0; i < N; i++) {
+ /**
+ * Updates expanded, dimmed and locked states of notification rows.
+ */
+ protected void updateRowStates() {
+ int maxKeyguardNotifications = getMaxKeyguardNotifications();
+ mOverflowIconsView.removeAllViews();
+ int n = mNotificationData.size();
+ int visibleNotifications = 0;
+ for (int i = n-1; i >= 0; i--) {
NotificationData.Entry entry = mNotificationData.get(i);
- if (!entry.row.isUserLocked()) {
- if (i == (N-1)) {
- if (DEBUG) Log.d(TAG, "expanding top notification at " + i);
- entry.row.setSystemExpanded(true);
- } else {
- if (!entry.row.isUserExpanded()) {
- if (DEBUG) Log.d(TAG, "collapsing notification at " + i);
- entry.row.setSystemExpanded(false);
- } else {
- if (DEBUG) Log.d(TAG, "ignoring user-modified notification at " + i);
- }
+ if (mOnKeyguard) {
+ entry.row.setSystemExpanded(false);
+ } else {
+ if (!entry.row.isUserLocked()) {
+ boolean top = (i == n-1);
+ entry.row.setSystemExpanded(top || entry.row.isUserExpanded());
+ }
+ }
+ entry.row.setDimmed(mOnKeyguard);
+ entry.row.setLocked(mOnKeyguard);
+ boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification);
+ if (mOnKeyguard && (visibleNotifications >= maxKeyguardNotifications
+ || !showOnKeyguard)) {
+ entry.row.setVisibility(View.GONE);
+ if (showOnKeyguard) {
+ mOverflowIconsView.addNotification(entry);
}
} else {
- if (DEBUG) Log.d(TAG, "ignoring notification being held by user at " + i);
+ entry.row.setVisibility(View.VISIBLE);
+ visibleNotifications++;
}
}
+
+ if (mOnKeyguard && mOverflowIconsView.getChildCount() > 0) {
+ mKeyguardIconOverflowContainer.setVisibility(View.VISIBLE);
+ } else {
+ mKeyguardIconOverflowContainer.setVisibility(View.GONE);
+ }
+ }
+
+ private boolean shouldShowOnKeyguard(StatusBarNotification sbn) {
+ return sbn.getNotification().priority >= Notification.PRIORITY_LOW;
}
protected void setZenMode(int mode) {
@@ -1208,7 +1231,7 @@ public abstract class BaseStatusBar extends SystemUI implements
handleNotificationError(key, notification, "Couldn't update icon: " + ic);
return;
}
- updateExpansionStates();
+ updateRowStates();
}
catch (RuntimeException e) {
// It failed to add cleanly. Log, and remove the view from the panel.
@@ -1315,7 +1338,7 @@ public abstract class BaseStatusBar extends SystemUI implements
boolean interrupt = (isFullscreen || (isHighPriority && (isNoisy || hasTicker)))
&& isAllowed
&& mPowerManager.isScreenOn()
- && !keyguard.isShowingAndNotHidden()
+ && !keyguard.isShowingAndNotOccluded()
&& !keyguard.isInputRestricted();
try {
interrupt = interrupt && !mDreamManager.isDreaming();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index 39333d7..bbbe8fa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -21,6 +21,7 @@ import android.os.IBinder;
import android.os.Message;
import android.service.notification.StatusBarNotification;
+import com.android.internal.policy.IKeyguardShowCallback;
import com.android.internal.statusbar.IStatusBar;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarIconList;
@@ -98,6 +99,7 @@ public class CommandQueue extends IStatusBar.Stub {
public void hideSearchPanel();
public void cancelPreloadRecentApps();
public void setWindowState(int window, int state);
+
}
public CommandQueue(Callbacks callbacks, StatusBarIconList list) {
@@ -232,6 +234,7 @@ public class CommandQueue extends IStatusBar.Stub {
}
}
+
private final class H extends Handler {
public void handleMessage(Message msg) {
final int what = msg.what & MSG_MASK;
@@ -295,7 +298,7 @@ public class CommandQueue extends IStatusBar.Stub {
mCallbacks.topAppWindowChanged(msg.arg1 != 0);
break;
case MSG_SHOW_IME_BUTTON:
- mCallbacks.setImeWindowStatus((IBinder)msg.obj, msg.arg1, msg.arg2);
+ mCallbacks.setImeWindowStatus((IBinder) msg.obj, msg.arg1, msg.arg2);
break;
case MSG_SET_HARD_KEYBOARD_STATUS:
mCallbacks.setHardKeyboardStatus(msg.arg1 != 0, msg.arg2 != 0);
@@ -312,6 +315,7 @@ public class CommandQueue extends IStatusBar.Stub {
case MSG_SET_WINDOW_STATE:
mCallbacks.setWindowState(msg.arg1, msg.arg2);
break;
+
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index 2daf619..7bacc13 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -40,6 +40,8 @@ public class ExpandableNotificationRow extends FrameLayout {
/** Are we showing the "public" version */
private boolean mShowingPublic;
+ private LatestItemView mLatestItemView;
+
/**
* Is this notification expanded by the system. The expansion state can be overridden by the
* user expansion.
@@ -59,8 +61,10 @@ public class ExpandableNotificationRow extends FrameLayout {
super.onFinishInflate();
mPublicLayout = (SizeAdaptiveLayout) findViewById(R.id.expandedPublic);
mPrivateLayout = (SizeAdaptiveLayout) findViewById(R.id.expanded);
+ mLatestItemView = (LatestItemView) findViewById(R.id.container);
}
+
public void setHeightRange(int rowMinHeight, int rowMaxHeight) {
mRowMinHeight = rowMinHeight;
mRowMaxHeight = rowMaxHeight;
@@ -152,8 +156,6 @@ public class ExpandableNotificationRow extends FrameLayout {
return mShowingPublic ? mRowMinHeight : getMaxExpandHeight();
}
-
-
private void updateMaxExpandHeight() {
ViewGroup.LayoutParams lp = getLayoutParams();
int oldHeight = lp.height;
@@ -195,6 +197,13 @@ public class ExpandableNotificationRow extends FrameLayout {
mPrivateLayout.setVisibility(show ? View.GONE : View.VISIBLE);
}
+ /**
+ * Sets the notification as dimmed, meaning that it will appear in a more gray variant.
+ */
+ public void setDimmed(boolean dimmed) {
+ mLatestItemView.setDimmed(dimmed);
+ }
+
public int getMaxExpandHeight() {
if (mMaxHeightNeedsUpdate) {
updateMaxExpandHeight();
@@ -202,4 +211,12 @@ public class ExpandableNotificationRow extends FrameLayout {
}
return mMaxExpandHeight;
}
+
+ /**
+ * Sets the notification as locked. In the locked state, the first tap will produce a quantum
+ * ripple to make the notification brighter and only the second tap will cause a click.
+ */
+ public void setLocked(boolean locked) {
+ mLatestItemView.setLocked(locked);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LatestItemView.java b/packages/SystemUI/src/com/android/systemui/statusbar/LatestItemView.java
index 6419777..ad9028d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/LatestItemView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/LatestItemView.java
@@ -17,16 +17,44 @@
package com.android.systemui.statusbar;
import android.content.Context;
+import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
+import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;
import android.widget.FrameLayout;
public class LatestItemView extends FrameLayout {
+
+ private static final long DOUBLETAP_TIMEOUT_MS = 1000;
+
+ private boolean mDimmed;
+ private boolean mLocked;
+
+ /**
+ * Flag to indicate that the notification has been touched once and the second touch will
+ * click it.
+ */
+ private boolean mActivated;
+
+ private float mDownX;
+ private float mDownY;
+ private final float mTouchSlop;
+ private boolean mHotspotActive;
+
public LatestItemView(Context context, AttributeSet attrs) {
super(context, attrs);
+ mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
}
+ private final Runnable mTapTimeoutRunnable = new Runnable() {
+ @Override
+ public void run() {
+ makeInactive();
+ }
+ };
+
@Override
public void setOnClickListener(OnClickListener l) {
super.setOnClickListener(l);
@@ -45,4 +73,94 @@ public class LatestItemView extends FrameLayout {
}
return false;
}
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (mLocked) {
+ return handleTouchEventLocked(event);
+ } else {
+ return super.onTouchEvent(event);
+ }
+ }
+
+ private boolean handleTouchEventLocked(MotionEvent event) {
+ int action = event.getActionMasked();
+ Drawable background = getBackground();
+ switch (action) {
+ case MotionEvent.ACTION_DOWN:
+ mDownX = event.getX();
+ mDownY = event.getY();
+ if (!mActivated) {
+ background.setHotspot(0, event.getX(), event.getY());
+ mHotspotActive = true;
+ }
+ break;
+ case MotionEvent.ACTION_MOVE:
+ if (!isWithinTouchSlop(event)) {
+ makeInactive();
+ return false;
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ if (isWithinTouchSlop(event)) {
+ if (!mActivated) {
+ mActivated = true;
+ postDelayed(mTapTimeoutRunnable, DOUBLETAP_TIMEOUT_MS);
+ } else {
+ performClick();
+ makeInactive();
+ }
+ } else {
+ makeInactive();
+ }
+ break;
+ case MotionEvent.ACTION_CANCEL:
+ makeInactive();
+ break;
+ default:
+ break;
+ }
+ return true;
+ }
+
+ /**
+ * Cancels the hotspot and makes the notification inactive.
+ */
+ private void makeInactive() {
+ if (mHotspotActive) {
+ // Make sure that we clear the hotspot from the center.
+ getBackground().setHotspot(0, getWidth()/2, getHeight()/2);
+ getBackground().removeHotspot(0);
+ mHotspotActive = false;
+ }
+ mActivated = false;
+ removeCallbacks(mTapTimeoutRunnable);
+ }
+
+ private boolean isWithinTouchSlop(MotionEvent event) {
+ return Math.abs(event.getX() - mDownX) < mTouchSlop
+ && Math.abs(event.getY() - mDownY) < mTouchSlop;
+ }
+
+ /**
+ * Sets the notification as dimmed, meaning that it will appear in a more gray variant.
+ */
+ public void setDimmed(boolean dimmed) {
+ if (mDimmed != dimmed) {
+ mDimmed = dimmed;
+ if (dimmed) {
+ setBackgroundResource(com.android.internal.R.drawable.notification_quantum_bg_dim);
+ } else {
+ setBackgroundResource(com.android.internal.R.drawable.notification_quantum_bg);
+ }
+ }
+ }
+
+ /**
+ * Sets the notification as locked. In the locked state, the first tap will produce a quantum
+ * ripple to make the notification brighter and only the second tap will cause a click.
+ */
+ public void setLocked(boolean locked) {
+ mLocked = locked;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java
new file mode 100644
index 0000000..ce31894
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2014 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
+ */
+
+package com.android.systemui.statusbar;
+
+import android.app.Notification;
+import android.content.Context;
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.android.internal.statusbar.StatusBarIcon;
+import com.android.systemui.R;
+import com.android.systemui.statusbar.phone.IconMerger;
+
+/**
+ * A view to display all the overflowing icons on Keyguard.
+ */
+public class NotificationOverflowIconsView extends IconMerger {
+
+ private TextView mMoreText;
+ private int mTintColor;
+
+ public NotificationOverflowIconsView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mTintColor = getResources().getColor(R.color.keyguard_overflow_content_color);
+ }
+
+ public void setMoreText(TextView moreText) {
+ mMoreText = moreText;
+ }
+
+ public void addNotification(NotificationData.Entry notification) {
+ StatusBarIconView v = new StatusBarIconView(getContext(), "",
+ notification.notification.getNotification());
+ v.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
+ v.setColorFilter(mTintColor, PorterDuff.Mode.MULTIPLY);
+ addView(v);
+ v.set(notification.icon.getStatusBarIcon());
+ updateMoreText();
+ }
+
+ private void updateMoreText() {
+ mMoreText.setText(getResources().getQuantityString(
+ R.plurals.keyguard_more_overflow_text, getChildCount(), getChildCount()));
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
new file mode 100644
index 0000000..7cbde36
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2014 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
+ */
+
+package com.android.systemui.statusbar.phone;
+
+import android.content.Context;
+import android.os.RemoteException;
+import android.util.Slog;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.android.internal.policy.IKeyguardShowCallback;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.keyguard.KeyguardHostView;
+import com.android.keyguard.KeyguardViewBase;
+import com.android.keyguard.R;
+import com.android.keyguard.ViewMediatorCallback;
+import com.android.systemui.keyguard.KeyguardViewMediator;
+
+/**
+ * A class which manages the bouncer on the lockscreen.
+ */
+public class KeyguardBouncer {
+
+ private Context mContext;
+ private ViewMediatorCallback mCallback;
+ private LockPatternUtils mLockPatternUtils;
+ private ViewGroup mContainer;
+ private StatusBarWindowManager mWindowManager;
+ private KeyguardViewBase mKeyguardView;
+ private ViewGroup mRoot;
+
+ public KeyguardBouncer(Context context, ViewMediatorCallback callback,
+ LockPatternUtils lockPatternUtils, StatusBarWindowManager windowManager,
+ ViewGroup container) {
+ mContext = context;
+ mCallback = callback;
+ mLockPatternUtils = lockPatternUtils;
+ mContainer = container;
+ mWindowManager = windowManager;
+ }
+
+ public void prepare() {
+ ensureView();
+ }
+
+ public void show() {
+ ensureView();
+
+ // Try to dismiss the Keyguard. If no security pattern is set, this will dismiss the whole
+ // Keyguard. If we need to authenticate, show the bouncer.
+ if (!mKeyguardView.dismiss()) {
+ mRoot.setVisibility(View.VISIBLE);
+ mKeyguardView.requestFocus();
+ }
+ }
+
+ public void hide() {
+ if (mKeyguardView != null) {
+ mKeyguardView.cleanUp();
+ }
+ removeView();
+ }
+
+ /**
+ * Reset the state of the view.
+ */
+ public void reset() {
+ inflateView();
+ }
+
+ public void onScreenTurnedOff() {
+ if (mKeyguardView != null) {
+ mKeyguardView.onScreenTurnedOff();
+ }
+ }
+
+ public void onScreenTurnedOn() {
+ if (mKeyguardView != null) {
+ mKeyguardView.onScreenTurnedOn();
+ }
+ }
+
+ public long getUserActivityTimeout() {
+ if (mKeyguardView != null) {
+ long timeout = mKeyguardView.getUserActivityTimeout();
+ if (timeout >= 0) {
+ return timeout;
+ }
+ }
+ return KeyguardViewMediator.AWAKE_INTERVAL_DEFAULT_MS;
+ }
+
+ public boolean isShowing() {
+ return mRoot != null && mRoot.getVisibility() == View.VISIBLE;
+ }
+
+ private void ensureView() {
+ if (mRoot == null) {
+ inflateView();
+ }
+ }
+
+ private void inflateView() {
+ removeView();
+ mRoot = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.keyguard_bouncer, null);
+ mKeyguardView = (KeyguardViewBase) mRoot.findViewById(R.id.keyguard_host_view);
+ mKeyguardView.setLockPatternUtils(mLockPatternUtils);
+ mKeyguardView.setViewMediatorCallback(mCallback);
+ mContainer.addView(mRoot, mContainer.getChildCount());
+ mRoot.setVisibility(View.INVISIBLE);
+ mRoot.setSystemUiVisibility(View.STATUS_BAR_DISABLE_HOME);
+ }
+
+ private void removeView() {
+ if (mRoot != null && mRoot.getParent() == mContainer) {
+ mContainer.removeView(mRoot);
+ mRoot = null;
+ }
+ }
+
+ public boolean onBackPressed() {
+ return mKeyguardView != null && mKeyguardView.handleBackKey();
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java
index 1ea920d..754075a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java
@@ -39,8 +39,8 @@ import java.util.List;
*/
public class KeyguardTouchDelegate {
// TODO: propagate changes to these to {@link KeyguardServiceDelegate}
- static final String KEYGUARD_PACKAGE = "com.android.keyguard";
- static final String KEYGUARD_CLASS = "com.android.keyguard.KeyguardService";
+ static final String KEYGUARD_PACKAGE = "com.android.systemui";
+ static final String KEYGUARD_CLASS = "com.android.systemui.keyguard.KeyguardService";
private static KeyguardTouchDelegate sInstance;
private static final List<OnKeyguardConnectionListener> sConnectionListeners =
@@ -140,16 +140,16 @@ public class KeyguardTouchDelegate {
return false;
}
- public boolean isShowingAndNotHidden() {
+ public boolean isShowingAndNotOccluded() {
final IKeyguardService service = mService;
if (service != null) {
try {
- return service.isShowingAndNotHidden();
+ return service.isShowingAndNotOccluded();
} catch (RemoteException e) {
Slog.w(TAG , "Remote Exception", e);
}
} else {
- Slog.w(TAG, "isShowingAndNotHidden(): NO SERVICE!");
+ Slog.w(TAG, "isShowingAndNotOccluded(): NO SERVICE!");
}
return false;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
index a74230b..d26b32f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
@@ -117,7 +117,7 @@ public final class NavigationBarTransitions extends BarTransitions {
@Override
public void setContentVisible(boolean visible) {
final float alpha = visible ? 1 : 0;
- fadeContent(mView.getCameraButton(), alpha);
+ fadeContent(mView.getBackButton(), alpha);
fadeContent(mView.getSearchLight(), alpha);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index d9e0903..db26a42 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -34,17 +34,23 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;
+import android.os.PowerManager;
import android.os.RemoteException;
+import android.os.UserHandle;
+import android.provider.MediaStore;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Display;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
+import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -92,12 +98,16 @@ public class NavigationBarView extends LinearLayout {
final static boolean WORKAROUND_INVALID_LAYOUT = true;
final static int MSG_CHECK_INVALID_LAYOUT = 8686;
+ private final float mCameraDragDistance;
+
// used to disable the camera icon in navbar when disabled by DPM
private boolean mCameraDisabledByDpm;
// performs manual animation in sync with layout transitions
private final NavTransitionListener mTransitionListener = new NavTransitionListener();
+ private final PowerManager mPowerManager;
+
private class NavTransitionListener implements TransitionListener {
private boolean mBackTransitioning;
private boolean mHomeAppearing;
@@ -155,22 +165,73 @@ public class NavigationBarView extends LinearLayout {
}
};
+ private final int mScaledTouchSlop;
+
private final OnTouchListener mCameraTouchListener = new OnTouchListener() {
+ private float mStartX;
+ private boolean mTouchSlopReached;
+ private boolean mSkipCancelAnimation;
+
@Override
- public boolean onTouch(View cameraButtonView, MotionEvent event) {
+ public boolean onTouch(final View cameraButtonView, MotionEvent event) {
+ float realX = event.getRawX();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
// disable search gesture while interacting with camera
mDelegateHelper.setDisabled(true);
mBarTransitions.setContentVisible(false);
+ mStartX = realX;
+ mTouchSlopReached = false;
+ mSkipCancelAnimation = false;
+ break;
+ case MotionEvent.ACTION_MOVE:
+ if (realX > mStartX) {
+ realX = mStartX;
+ }
+ if (realX < mStartX - mCameraDragDistance) {
+ ((KeyButtonView) cameraButtonView).setPressed(true);
+ mPowerManager.userActivity(event.getEventTime(), false);
+ } else {
+ ((KeyButtonView) cameraButtonView).setPressed(false);
+ }
+ if (realX < mStartX - mScaledTouchSlop) {
+ mTouchSlopReached = true;
+ }
+ cameraButtonView.setTranslationX(Math.max(realX - mStartX,
+ -mCameraDragDistance));
break;
case MotionEvent.ACTION_UP:
+ if (realX < mStartX - mCameraDragDistance) {
+ mContext.startActivityAsUser(
+ new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE),
+ UserHandle.CURRENT);
+ }
+ if (realX < mStartX - mScaledTouchSlop) {
+ mTouchSlopReached = true;
+ }
+ if (!mTouchSlopReached) {
+ mSkipCancelAnimation = true;
+ cameraButtonView.animate().translationX(-mCameraDragDistance / 2).
+ setInterpolator(new DecelerateInterpolator()).withEndAction(
+ new Runnable() {
+ @Override
+ public void run() {
+ cameraButtonView.animate().translationX(0).
+ setInterpolator(new AccelerateInterpolator());
+ }
+ });
+ }
case MotionEvent.ACTION_CANCEL:
+ ((KeyButtonView) cameraButtonView).setPressed(false);
mDelegateHelper.setDisabled(false);
mBarTransitions.setContentVisible(true);
+ if (!mSkipCancelAnimation) {
+ cameraButtonView.animate().translationX(0)
+ .setInterpolator(new AccelerateInterpolator(2f));
+ }
break;
}
- return KeyguardTouchDelegate.getInstance(getContext()).dispatch(event);
+ return true;
}
};
@@ -235,6 +296,9 @@ public class NavigationBarView extends LinearLayout {
KeyguardTouchDelegate.addListener(mKeyguardConnectionListener);
mCameraDisabledByDpm = isCameraDisabledByDpm();
watchForDevicePolicyChanges();
+ mCameraDragDistance = res.getDimension(R.dimen.camera_drag_distance);
+ mScaledTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
+ mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
}
private void watchForDevicePolicyChanges() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
index a3e35d1..324d6f3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
@@ -151,7 +151,8 @@ public class PanelBar extends FrameLayout {
if (DEBUG) LOG("panelExpansionChanged: start state=%d panel=%s", mState, panel.getName());
mPanelExpandedFractionSum = 0f;
for (PanelView pv : mPanels) {
- final boolean visible = pv.getVisibility() == View.VISIBLE;
+ boolean visible = pv.getExpandedHeight() > 0;
+ pv.setVisibility(visible ? View.VISIBLE : View.GONE);
// adjust any other panels that may be partially visible
if (pv.getExpandedHeight() > 0f) {
if (mState == STATE_CLOSED) {
@@ -166,11 +167,6 @@ public class PanelBar extends FrameLayout {
if (thisFrac == 1f) fullyOpenedPanel = panel;
}
}
- if (pv.getExpandedHeight() > 0f) {
- if (!visible) pv.setVisibility(View.VISIBLE);
- } else {
- if (visible) pv.setVisibility(View.GONE);
- }
}
mPanelExpandedFractionSum /= mPanels.size();
if (fullyOpenedPanel != null && !mTracking) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 6922ca5..10a9b64 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -651,6 +651,12 @@ public class PanelView extends FrameLayout {
int newHeight = getMeasuredHeight();
if (newHeight != mMaxPanelHeight) {
mMaxPanelHeight = newHeight;
+ // If the user isn't actively poking us, let's rubberband to the content
+ if (!mTracking && !mRubberbanding && !mTimeAnimator.isStarted()
+ && mExpandedHeight > 0 && mExpandedHeight != mMaxPanelHeight
+ && mMaxPanelHeight > 0) {
+ mExpandedHeight = mMaxPanelHeight;
+ }
}
heightMeasureSpec = MeasureSpec.makeMeasureSpec(
getDesiredMeasureHeight(), MeasureSpec.AT_MOST);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 841f3ca..ec9f3ab 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -16,14 +16,16 @@
package com.android.systemui.statusbar.phone;
+
import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT;
import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN;
import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
import static android.app.StatusBarManager.windowStateToString;
+import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT;
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_OPAQUE;
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_SEMI_TRANSPARENT;
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_TRANSLUCENT;
-import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT;
+import static com.android.systemui.statusbar.stack.NotificationStackScrollLayout.OnChildLocationsChangedListener;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -66,6 +68,7 @@ import android.util.EventLog;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
+import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
@@ -84,15 +87,19 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.internal.statusbar.StatusBarIcon;
+import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.DemoMode;
import com.android.systemui.EventLogTags;
import com.android.systemui.R;
+import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.InterceptedNotifications;
+import com.android.systemui.statusbar.LatestItemView;
import com.android.systemui.statusbar.NotificationData;
import com.android.systemui.statusbar.NotificationData.Entry;
+import com.android.systemui.statusbar.NotificationOverflowIconsView;
import com.android.systemui.statusbar.SignalClusterView;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.policy.BatteryController;
@@ -174,6 +181,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
StatusBarWindowView mStatusBarWindow;
PhoneStatusBarView mStatusBarView;
private int mStatusBarWindowState = WINDOW_STATE_SHOWING;
+ private StatusBarWindowManager mStatusBarWindowManager;
int mPixelFormat;
Object mQueueLock = new Object();
@@ -212,9 +220,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
// top bar
View mNotificationPanelHeader;
+ View mKeyguardStatusView;
+ int mKeyguardMaxNotificationCount;
View mDateTimeView;
View mClearButton;
ImageView mSettingsButton, mNotificationButton;
+ View mKeyguardSettingsFlipButton;
// carrier/wifi label
private TextView mCarrierLabel;
@@ -337,6 +348,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
private int mNavigationBarMode;
private Boolean mScreenOn;
+ private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
+ private ViewMediatorCallback mKeyguardViewMediatorCallback;
+
private final Runnable mAutohide = new Runnable() {
@Override
public void run() {
@@ -349,6 +363,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
private Runnable mOnFlipRunnable;
private InterceptedNotifications mIntercepted;
+ private final OnChildLocationsChangedListener mOnChildLocationsChangedListener =
+ new OnChildLocationsChangedListener() {
+ @Override
+ public void onChildLocationsChanged(NotificationStackScrollLayout stackScrollLayout) {
+ userActivity();
+ }
+ };
+
public void setOnFlipRunnable(Runnable onFlipRunnable) {
mOnFlipRunnable = onFlipRunnable;
}
@@ -388,6 +410,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
Settings.Global.getUriFor(SETTING_HEADS_UP_TICKER), true,
mHeadsUpObserver);
}
+ startKeyguard();
}
// ================================================================================
@@ -494,10 +517,21 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
mStackScroller = (NotificationStackScrollLayout) mStatusBarWindow.findViewById(
R.id.notification_stack_scroller);
mStackScroller.setLongPressListener(getNotificationLongClicker());
+ mStackScroller.setChildLocationsChangedListener(mOnChildLocationsChangedListener);
+
+ mKeyguardIconOverflowContainer = LayoutInflater.from(mContext).inflate(
+ R.layout.status_bar_notification_keyguard_overflow, mStackScroller, false);
+ ((LatestItemView) mKeyguardIconOverflowContainer.findViewById(R.id.container)).setLocked(true);
+ mOverflowIconsView = (NotificationOverflowIconsView) mKeyguardIconOverflowContainer.findViewById(
+ R.id.overflow_icons_view);
+ mOverflowIconsView.setMoreText(
+ (TextView) mKeyguardIconOverflowContainer.findViewById(R.id.more_text));
+ mStackScroller.addView(mKeyguardIconOverflowContainer);
mExpandedContents = mStackScroller;
mNotificationPanelHeader = mStatusBarWindow.findViewById(R.id.header);
+ mKeyguardStatusView = mStatusBarWindow.findViewById(R.id.keyguard_status_view);
mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button);
mClearButton.setOnClickListener(mClearButtonListener);
@@ -687,6 +721,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
return mStatusBarView;
}
+ private void startKeyguard() {
+ KeyguardViewMediator keyguardViewMediator = getComponent(KeyguardViewMediator.class);
+ mStatusBarKeyguardViewManager = keyguardViewMediator.registerStatusBar(this,
+ mStatusBarWindow, mStatusBarWindowManager);
+ mKeyguardViewMediatorCallback = keyguardViewMediator.getViewMediatorCallback();
+ }
+
@Override
protected void onShowSearchPanel() {
if (mNavigationBarView != null) {
@@ -764,10 +805,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}
}
- protected int getStatusBarGravity() {
- return Gravity.TOP | Gravity.FILL_HORIZONTAL;
- }
-
public int getStatusBarHeight() {
if (mNaturalBarHeight < 0) {
final Resources res = mContext.getResources();
@@ -1024,7 +1061,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}
if (CLOSE_PANEL_WHEN_EMPTIED && mNotificationData.size() == 0
- && !mNotificationPanel.isTracking()) {
+ && !mNotificationPanel.isTracking() && !mOnKeyguard) {
animateCollapsePanels();
}
}
@@ -1093,7 +1130,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
ArrayList<View> toRemove = new ArrayList<View>();
for (int i=0; i< mStackScroller.getChildCount(); i++) {
View child = mStackScroller.getChildAt(i);
- if (!toShow.contains(child)) {
+ if (!toShow.contains(child) && child != mKeyguardIconOverflowContainer) {
toRemove.add(child);
}
}
@@ -1493,26 +1530,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
// Expand the window to encompass the full screen in anticipation of the drag.
// This is only possible to do atomically because the status bar is at the top of the screen!
- WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams();
- lp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
- lp.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
- lp.height = ViewGroup.LayoutParams.MATCH_PARENT;
- mWindowManager.updateViewLayout(mStatusBarWindow, lp);
+ mStatusBarWindowManager.setStatusBarExpanded(true);
visibilityChanged(true);
setInteracting(StatusBarManager.WINDOW_STATUS_BAR, true);
}
- private void releaseFocus() {
- if (mStatusBarWindow == null) return;
- WindowManager.LayoutParams lp =
- (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams();
- lp.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
- lp.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
- mWindowManager.updateViewLayout(mStatusBarWindow, lp);
- }
-
public void animateCollapsePanels() {
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
}
@@ -1524,9 +1548,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
+ " flags=" + flags);
}
- // release focus immediately to kick off focus change transition
- releaseFocus();
-
if ((flags & CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL) == 0) {
mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL);
mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);
@@ -1538,6 +1559,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}
if (mStatusBarWindow != null) {
+
+ // release focus immediately to kick off focus change transition
+ mStatusBarWindowManager.setStatusBarFocusable(false);
+
mStatusBarWindow.cancelExpandHelper();
mStatusBarView.collapseAllPanels(true);
}
@@ -1796,11 +1821,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
visibilityChanged(false);
// Shrink the window to the size of the status bar only
- WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams();
- lp.height = getStatusBarHeight();
- lp.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
- lp.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
- mWindowManager.updateViewLayout(mStatusBarWindow, lp);
+ mStatusBarWindowManager.setStatusBarExpanded(false);
if ((mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS) == 0) {
setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in);
@@ -1815,6 +1836,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}
setInteracting(StatusBarManager.WINDOW_STATUS_BAR, false);
+
+ showBouncer();
}
public boolean interceptTouchEvent(MotionEvent event) {
@@ -2303,30 +2326,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}
private void addStatusBarWindow() {
- // Put up the view
- final int height = getStatusBarHeight();
-
- // Now that the status bar window encompasses the sliding panel and its
- // translucent backdrop, the entire thing is made TRANSLUCENT and is
- // hardware-accelerated.
- final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- height,
- WindowManager.LayoutParams.TYPE_STATUS_BAR,
- WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
- | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
- | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
- | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
- PixelFormat.TRANSLUCENT);
-
- lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
-
- lp.gravity = getStatusBarGravity();
- lp.setTitle("StatusBar");
- lp.packageName = mContext.getPackageName();
-
makeStatusBarView();
- mWindowManager.addView(mStatusBarWindow, lp);
+ mStatusBarWindowManager = new StatusBarWindowManager(mContext);
+ mStatusBarWindowManager.add(mStatusBarWindow, getStatusBarHeight());
}
void setNotificationIconVisibility(boolean visible, int anim) {
@@ -2464,8 +2466,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}
else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
mScreenOn = false;
- // no waiting!
- makeExpandedInvisible();
notifyNavigationBarScreenOn(false);
notifyHeadsUpScreenOn(false);
finishBarAnimations();
@@ -2644,6 +2644,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
mRowMinHeight = res.getDimensionPixelSize(R.dimen.notification_row_min_height);
mRowMaxHeight = res.getDimensionPixelSize(R.dimen.notification_row_max_height);
+ mKeyguardMaxNotificationCount = res.getInteger(R.integer.keyguard_max_notification_count);
+
if (false) Log.v(TAG, "updateResources");
}
@@ -2815,4 +2817,120 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
((DemoMode)v).dispatchDemoCommand(command, args);
}
}
+
+ public boolean isOnKeyguard() {
+ return mOnKeyguard;
+ }
+
+ public void showKeyguard() {
+ mOnKeyguard = true;
+ instantExpandNotificationsPanel();
+ if (isFlippedToSettings()) {
+ flipToNotifications();
+ }
+ mStatusBarWindow.setSystemUiVisibility(View.STATUS_BAR_DISABLE_HOME);
+ mKeyguardStatusView.setVisibility(View.VISIBLE);
+ mNotificationPanelHeader.setVisibility(View.GONE);
+ if (mKeyguardSettingsFlipButton == null) {
+ ViewStub flipStub = (ViewStub) mStatusBarWindow.findViewById(R.id.keyguard_flip_stub);
+ mKeyguardSettingsFlipButton = flipStub.inflate();
+ installSettingsButton(mKeyguardSettingsFlipButton);
+ }
+ mKeyguardSettingsFlipButton.setVisibility(View.VISIBLE);
+ mKeyguardSettingsFlipButton.findViewById(R.id.settings_button).setVisibility(View.VISIBLE);
+ mKeyguardSettingsFlipButton.findViewById(R.id.notification_button)
+ .setVisibility(View.INVISIBLE);
+ updateRowStates();
+ }
+
+ public void hideKeyguard() {
+ mOnKeyguard = false;
+ mStatusBarWindow.setSystemUiVisibility(0);
+ mKeyguardStatusView.setVisibility(View.GONE);
+ mNotificationPanelHeader.setVisibility(View.VISIBLE);
+ mKeyguardSettingsFlipButton.setVisibility(View.GONE);
+ updateRowStates();
+ }
+
+ public void userActivity() {
+ if (mOnKeyguard) {
+ mKeyguardViewMediatorCallback.userActivity();
+ }
+ }
+
+ public boolean onBackPressed() {
+ if (mOnKeyguard) {
+ return mStatusBarKeyguardViewManager.onBackPressed();
+ } else {
+ animateCollapsePanels();
+ return true;
+ }
+ }
+
+ private void showBouncer() {
+ if (mOnKeyguard) {
+ mStatusBarKeyguardViewManager.dismiss();
+ }
+ }
+
+ private void instantExpandNotificationsPanel() {
+ mExpandedVisible = true;
+ mNotificationPanel.setExpandedFraction(1);
+ }
+
+ @Override
+ protected int getMaxKeyguardNotifications() {
+ return mKeyguardMaxNotificationCount;
+ }
+
+ /**
+ * @return a ViewGroup that spans the entire panel which contains the quick settings
+ */
+ public ViewGroup getQuickSettingsOverlayParent() {
+ if (mHasSettingsPanel) {
+ if (mHasFlipSettings) {
+ return mNotificationPanel;
+ } else {
+ return mSettingsPanel;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ private void installSettingsButton(View parent) {
+ final ImageView settingsButton =
+ (ImageView) mStatusBarWindow.findViewById(R.id.settings_button);
+ final ImageView notificationButton =
+ (ImageView) mStatusBarWindow.findViewById(R.id.notification_button);
+ if (settingsButton != null) {
+ settingsButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ animateExpandSettingsPanel();
+ v.setVisibility(View.INVISIBLE);
+ notificationButton.setVisibility(View.VISIBLE);
+ }
+ });
+ settingsButton.setVisibility(View.VISIBLE);
+ if (mHasSettingsPanel) {
+ // the settings panel is hiding behind this button
+ settingsButton.setImageResource(R.drawable.ic_notify_quicksettings);
+ } else {
+ // no settings panel, go straight to settings
+ settingsButton.setImageResource(R.drawable.ic_notify_settings);
+ }
+ }
+ if (notificationButton != null) {
+ notificationButton.setVisibility(View.INVISIBLE);
+ notificationButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ flipToNotifications();
+ v.setVisibility(View.INVISIBLE);
+ settingsButton.setVisibility(View.VISIBLE);
+ }
+ });
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index d9e3fdf..583fc3e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -37,6 +37,7 @@ public class PhoneStatusBarView extends PanelBar {
PhoneStatusBar mBar;
int mScrimColor;
+ int mScrimColorKeyguard;
float mSettingsPanelDragzoneFrac;
float mSettingsPanelDragzoneMin;
@@ -52,6 +53,7 @@ public class PhoneStatusBarView extends PanelBar {
Resources res = getContext().getResources();
mScrimColor = res.getColor(R.color.notification_panel_scrim_color);
+ mScrimColorKeyguard = res.getColor(R.color.notification_panel_scrim_color_keyguard);
mSettingsPanelDragzoneMin = res.getDimension(R.dimen.settings_panel_dragzone_min);
try {
mSettingsPanelDragzoneFrac = res.getFraction(R.dimen.settings_panel_dragzone_fraction, 1, 1);
@@ -217,6 +219,7 @@ public class PhoneStatusBarView extends PanelBar {
if (panel == mFadingPanel && mScrimColor != 0 && ActivityManager.isHighEndGfx()
&& mBar.mStatusBarWindow != null) {
if (mShouldFade) {
+ int scrimColor = mBar.isOnKeyguard() ? mScrimColorKeyguard : mScrimColor;
frac = mPanelExpandedFractionSum; // don't judge me
// let's start this 20% of the way down the screen
frac = frac * 1.2f - 0.2f;
@@ -226,7 +229,7 @@ public class PhoneStatusBarView extends PanelBar {
// woo, special effects
final float k = (float)(1f-0.5f*(1f-Math.cos(3.14159f * Math.pow(1f-frac, 2f))));
// attenuate background color alpha by k
- final int color = (int) ((mScrimColor >>> 24) * k) << 24 | (mScrimColor & 0xFFFFFF);
+ final int color = (int) ((scrimColor >>> 24) * k) << 24 | (scrimColor & 0xFFFFFF);
mBar.mStatusBarWindow.setBackgroundColor(color);
}
}
@@ -249,5 +252,6 @@ public class PhoneStatusBarView extends PanelBar {
mBar.animateHeadsUp(mNotificationPanel == panel, mPanelExpandedFractionSum);
mBar.updateCarrierLabelVisibility(false);
+ mBar.userActivity();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
index d67f7cd..b3fba76 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
@@ -71,6 +71,7 @@ import android.widget.TextView;
import com.android.internal.app.MediaRouteDialogPresenter;
import com.android.systemui.R;
+import com.android.systemui.settings.UserSwitcherHostView;
import com.android.systemui.statusbar.phone.QuickSettingsModel.ActivityState;
import com.android.systemui.statusbar.phone.QuickSettingsModel.BluetoothState;
import com.android.systemui.statusbar.phone.QuickSettingsModel.RSSIState;
@@ -310,30 +311,28 @@ class QuickSettings {
collapsePanels();
}
- private void addUserTiles(ViewGroup parent, LayoutInflater inflater) {
+ private void addUserTiles(final ViewGroup parent, final LayoutInflater inflater) {
QuickSettingsTileView userTile = (QuickSettingsTileView)
inflater.inflate(R.layout.quick_settings_tile, parent, false);
userTile.setContent(R.layout.quick_settings_tile_user, inflater);
userTile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- collapsePanels();
final UserManager um = UserManager.get(mContext);
if (um.isUserSwitcherEnabled()) {
- // Since keyguard and systemui were merged into the same process to save
- // memory, they share the same Looper and graphics context. As a result,
- // there's no way to allow concurrent animation while keyguard inflates.
- // The workaround is to add a slight delay to allow the animation to finish.
- mHandler.postDelayed(new Runnable() {
+ final ViewGroup switcherParent = getService().getQuickSettingsOverlayParent();
+ final UserSwitcherHostView switcher = (UserSwitcherHostView) inflater.inflate(
+ R.layout.user_switcher_host, switcherParent, false);
+ switcher.setFinishRunnable(new Runnable() {
+ @Override
public void run() {
- try {
- WindowManagerGlobal.getWindowManagerService().lockNow(null);
- } catch (RemoteException e) {
- Log.e(TAG, "Couldn't show user switcher", e);
- }
+ switcherParent.removeView(switcher);
}
- }, 400); // TODO: ideally this would be tied to the collapse of the panel
+ });
+ switcher.refreshUsers();
+ switcherParent.addView(switcher);
} else {
+ collapsePanels();
Intent intent = ContactsContract.QuickContact.composeQuickContactsIntent(
mContext, v, ContactsContract.Profile.CONTENT_URI,
ContactsContract.QuickContact.MODE_LARGE, null);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
new file mode 100644
index 0000000..b8592c3
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2014 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
+ */
+
+package com.android.systemui.statusbar.phone;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.util.Log;
+import android.util.Slog;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
+
+import com.android.internal.policy.IKeyguardShowCallback;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.keyguard.KeyguardHostView;
+import com.android.keyguard.KeyguardSimpleHostView;
+import com.android.keyguard.R;
+import com.android.keyguard.ViewMediatorCallback;
+import com.android.systemui.keyguard.KeyguardViewMediator;
+
+/**
+ * Manages creating, showing, hiding and resetting the keyguard within the status bar. Calls back
+ * via {@link ViewMediatorCallback} to poke the wake lock and report that the keyguard is done,
+ * which is in turn, reported to this class by the current
+ * {@link com.android.keyguard.KeyguardViewBase}.
+ */
+public class StatusBarKeyguardViewManager {
+ private static String TAG = "StatusBarKeyguardViewManager";
+
+ private final Context mContext;
+
+ private LockPatternUtils mLockPatternUtils;
+ private ViewMediatorCallback mViewMediatorCallback;
+ private PhoneStatusBar mPhoneStatusBar;
+
+ private ViewGroup mContainer;
+ private StatusBarWindowManager mStatusBarWindowManager;
+
+ private boolean mScreenOn = false;
+ private KeyguardBouncer mBouncer;
+ private boolean mShowing;
+
+ public StatusBarKeyguardViewManager(Context context, ViewMediatorCallback callback,
+ LockPatternUtils lockPatternUtils) {
+ mContext = context;
+ mViewMediatorCallback = callback;
+ mLockPatternUtils = lockPatternUtils;
+ }
+
+ public void registerStatusBar(PhoneStatusBar phoneStatusBar,
+ ViewGroup container, StatusBarWindowManager statusBarWindowManager) {
+ mPhoneStatusBar = phoneStatusBar;
+ mContainer = container;
+ mStatusBarWindowManager = statusBarWindowManager;
+ mBouncer = new KeyguardBouncer(mContext, mViewMediatorCallback, mLockPatternUtils,
+ mStatusBarWindowManager, container);
+ }
+
+ /**
+ * Show the keyguard. Will handle creating and attaching to the view manager
+ * lazily.
+ */
+ public void show(Bundle options) {
+ mShowing = true;
+ mStatusBarWindowManager.setKeyguardShowing(true);
+ mPhoneStatusBar.showKeyguard();
+ mBouncer.prepare();
+ updateBackButtonState();
+ }
+
+ public void showBouncer() {
+ mBouncer.show();
+ updateBackButtonState();
+ }
+
+ /**
+ * Reset the state of the view.
+ */
+ public void reset() {
+ mBouncer.reset();
+ mPhoneStatusBar.showKeyguard();
+ updateBackButtonState();
+ }
+
+ public void onScreenTurnedOff() {
+ mScreenOn = false;
+ mBouncer.onScreenTurnedOff();
+ }
+
+ public void onScreenTurnedOn(final IKeyguardShowCallback callback) {
+ mScreenOn = true;
+ mBouncer.onScreenTurnedOn();
+ if (callback != null) {
+ callbackAfterDraw(callback);
+ }
+ }
+
+ private void callbackAfterDraw(final IKeyguardShowCallback callback) {
+ mContainer.post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ callback.onShown(mContainer.getWindowToken());
+ } catch (RemoteException e) {
+ Slog.w(TAG, "Exception calling onShown():", e);
+ }
+ }
+ });
+ }
+
+ public void verifyUnlock() {
+ dismiss();
+ }
+
+ public void setNeedsInput(boolean needsInput) {
+ mStatusBarWindowManager.setKeyguardNeedsInput(needsInput);
+ }
+
+ public void updateUserActivityTimeout() {
+ mStatusBarWindowManager.setKeyguardUserActivityTimeout(mBouncer.getUserActivityTimeout());
+ }
+
+ public void setOccluded(boolean occluded) {
+ mStatusBarWindowManager.setKeyguardOccluded(occluded);
+ }
+
+ /**
+ * Hides the keyguard view
+ */
+ public void hide() {
+ mShowing = false;
+ mPhoneStatusBar.hideKeyguard();
+ mStatusBarWindowManager.setKeyguardShowing(false);
+ mBouncer.hide();
+ mViewMediatorCallback.keyguardGone();
+ }
+
+ /**
+ * Dismisses the keyguard by going to the next screen or making it gone.
+ */
+ public void dismiss() {
+ if (mScreenOn) {
+ showBouncer();
+ }
+ }
+
+ /**
+ * @return Whether the keyguard is showing
+ */
+ public boolean isShowing() {
+ return mShowing;
+ }
+
+ /**
+ * Notifies this manager that the back button has been pressed.
+ *
+ * @return whether the back press has been handled
+ */
+ public boolean onBackPressed() {
+ if (mBouncer.isShowing()) {
+ mBouncer.hide();
+ mPhoneStatusBar.showKeyguard();
+ updateBackButtonState();
+ return true;
+ }
+ return false;
+ }
+
+ private void updateBackButtonState() {
+ int vis = mContainer.getSystemUiVisibility();
+ if (mBouncer.isShowing()) {
+ mContainer.setSystemUiVisibility(vis & ~View.STATUS_BAR_DISABLE_BACK);
+ } else {
+ mContainer.setSystemUiVisibility(vis | View.STATUS_BAR_DISABLE_BACK);
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
new file mode 100644
index 0000000..6153cde
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright (C) 2014 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
+ */
+
+package com.android.systemui.statusbar.phone;
+
+import android.app.ActionBar;
+import android.content.Context;
+import android.content.pm.ActivityInfo;
+import android.content.res.Resources;
+import android.graphics.PixelFormat;
+import android.os.SystemProperties;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+
+import com.android.keyguard.R;
+
+/**
+ * Encapsulates all logic for the status bar window state management.
+ */
+public class StatusBarWindowManager {
+
+ private final Context mContext;
+ private final WindowManager mWindowManager;
+ private View mStatusBarView;
+ private WindowManager.LayoutParams mLp;
+ private int mBarHeight;
+ private final boolean mKeyguardScreenRotation;
+
+ private final State mCurrentState = new State();
+
+ public StatusBarWindowManager(Context context) {
+ mContext = context;
+ mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+ mKeyguardScreenRotation = shouldEnableKeyguardScreenRotation();
+ }
+
+ private boolean shouldEnableKeyguardScreenRotation() {
+ Resources res = mContext.getResources();
+ return SystemProperties.getBoolean("lockscreen.rot_override", false)
+ || res.getBoolean(R.bool.config_enableLockScreenRotation);
+ }
+
+ /**
+ * Adds the status bar view to the window manager.
+ *
+ * @param statusBarView The view to add.
+ * @param barHeight The height of the status bar in collapsed state.
+ */
+ public void add(View statusBarView, int barHeight) {
+
+ // Now that the status bar window encompasses the sliding panel and its
+ // translucent backdrop, the entire thing is made TRANSLUCENT and is
+ // hardware-accelerated.
+ mLp = new WindowManager.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ barHeight,
+ WindowManager.LayoutParams.TYPE_STATUS_BAR,
+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+ | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
+ | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
+ | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
+ | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
+ PixelFormat.TRANSLUCENT);
+
+ mLp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
+ mLp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL;
+ mLp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
+ mLp.setTitle("StatusBar");
+ mLp.packageName = mContext.getPackageName();
+ mStatusBarView = statusBarView;
+ mBarHeight = barHeight;
+ mWindowManager.addView(mStatusBarView, mLp);
+ }
+
+ private void applyKeyguardFlags(State state) {
+ if (state.keyguardShowing) {
+ mLp.flags |= WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
+ mLp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
+ } else {
+ mLp.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
+ mLp.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
+ }
+ }
+
+ private void adjustScreenOrientation(State state) {
+ if (!state.isKeyguardShowingAndNotOccluded() || mKeyguardScreenRotation) {
+ mLp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
+ } else {
+ mLp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
+ }
+ }
+
+ private void applyFocusableFlag(State state) {
+ if (state.isKeyguardShowingAndNotOccluded() && state.keyguardNeedsInput) {
+ mLp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
+ mLp.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+ } else if (state.isKeyguardShowingAndNotOccluded() || state.statusBarFocusable) {
+ mLp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
+ mLp.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+ } else {
+ mLp.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
+ mLp.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+ }
+ }
+
+ private void applyHeight(State state) {
+ boolean expanded = state.isKeyguardShowingAndNotOccluded() || state.statusBarExpanded;
+ if (expanded) {
+ mLp.height = ViewGroup.LayoutParams.MATCH_PARENT;
+ } else {
+ mLp.height = mBarHeight;
+ }
+ }
+
+ private void applyUserActivityTimeout(State state) {
+ if (state.isKeyguardShowingAndNotOccluded()) {
+ mLp.userActivityTimeout = state.keyguardUserActivityTimeout;
+ } else {
+ mLp.userActivityTimeout = -1;
+ }
+ }
+
+ private void applyInputFeatures(State state) {
+ if (state.isKeyguardShowingAndNotOccluded()) {
+ mLp.inputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
+ } else {
+ mLp.inputFeatures &= ~WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
+ }
+ }
+
+ private void apply(State state) {
+ applyKeyguardFlags(state);
+ applyFocusableFlag(state);
+ adjustScreenOrientation(state);
+ applyHeight(state);
+ applyUserActivityTimeout(state);
+ applyInputFeatures(state);
+ mWindowManager.updateViewLayout(mStatusBarView, mLp);
+ }
+
+ public void setKeyguardShowing(boolean showing) {
+ mCurrentState.keyguardShowing = showing;
+ apply(mCurrentState);
+ }
+
+ public void setKeyguardOccluded(boolean occluded) {
+ mCurrentState.keyguardOccluded = occluded;
+ apply(mCurrentState);
+ }
+
+ public void setKeyguardNeedsInput(boolean needsInput) {
+ mCurrentState.keyguardNeedsInput = needsInput;
+ apply(mCurrentState);
+ }
+
+ public void setStatusBarExpanded(boolean expanded) {
+ mCurrentState.statusBarExpanded = expanded;
+ mCurrentState.statusBarFocusable = expanded;
+ apply(mCurrentState);
+ }
+
+ public void setStatusBarFocusable(boolean focusable) {
+ mCurrentState.statusBarFocusable = focusable;
+ apply(mCurrentState);
+ }
+
+ public void setKeyguardUserActivityTimeout(long timeout) {
+ mCurrentState.keyguardUserActivityTimeout = timeout;
+ apply(mCurrentState);
+ }
+
+ private static class State {
+ boolean keyguardShowing;
+ boolean keyguardOccluded;
+ boolean keyguardNeedsInput;
+ boolean statusBarExpanded;
+ boolean statusBarFocusable;
+ long keyguardUserActivityTimeout;
+
+ private boolean isKeyguardShowingAndNotOccluded() {
+ return keyguardShowing && !keyguardOccluded;
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index a7121c4..dd89f47 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -79,7 +79,7 @@ public class StatusBarWindowView extends FrameLayout
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (!down) {
- mService.animateCollapsePanels();
+ mService.onBackPressed();
}
return true;
}
@@ -90,7 +90,8 @@ public class StatusBarWindowView extends FrameLayout
public boolean onInterceptTouchEvent(MotionEvent ev) {
boolean intercept = false;
if (mNotificationPanel.isFullyExpanded()
- && mStackScrollLayout.getVisibility() == View.VISIBLE) {
+ && mStackScrollLayout.getVisibility() == View.VISIBLE
+ && !mService.isOnKeyguard()) {
intercept = mExpandHelper.onInterceptTouchEvent(ev);
}
if (!intercept) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index f31896a..9800bc9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -656,9 +656,11 @@ public class NotificationStackScrollLayout extends ViewGroup
int height = 0;
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
- height += child.getHeight();
- if (i < getChildCount()-1) {
- height += mPaddingBetweenElements;
+ if (child.getVisibility() != View.GONE) {
+ height += child.getHeight();
+ if (i < getChildCount()-1) {
+ height += mPaddingBetweenElements;
+ }
}
}
mContentHeight = height;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
index 5506a55..431f6fe 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
@@ -23,6 +23,8 @@ import android.view.ViewGroup;
import com.android.systemui.R;
import com.android.systemui.statusbar.ExpandableNotificationRow;
+import java.util.ArrayList;
+
/**
* The Algorithm of the {@link com.android.systemui.statusbar.stack
* .NotificationStackScrollLayout} which can be queried for {@link com.android.systemui.statusbar
@@ -98,6 +100,7 @@ public class StackScrollAlgorithm {
algorithmState.lastTopStackIndex = 0;
algorithmState.scrollY = resultState.getScrollY();
algorithmState.itemsInBottomStack = 0.0f;
+ updateVisibleChildren(resultState, algorithmState);
// Phase 1:
findNumberOfItemsInTopStackAndUpdateState(resultState, algorithmState);
@@ -113,6 +116,23 @@ public class StackScrollAlgorithm {
}
/**
+ * Update the visible children on the state.
+ */
+ private void updateVisibleChildren(StackScrollState resultState,
+ StackScrollAlgorithmState state) {
+ ViewGroup hostView = resultState.getHostView();
+ int childCount = hostView.getChildCount();
+ state.visibleChildren.clear();
+ state.visibleChildren.ensureCapacity(childCount);
+ for (int i = 0; i < childCount; i++) {
+ View v = hostView.getChildAt(i);
+ if (v.getVisibility() != View.GONE) {
+ state.visibleChildren.add(v);
+ }
+ }
+ }
+
+ /**
* Determine the positions for the views. This is the main part of the algorithm.
*
* @param resultState The result state to update if a change to the properties of a child occurs
@@ -135,11 +155,10 @@ public class StackScrollAlgorithm {
// How far in is the element currently transitioning into the bottom stack.
float yPositionInScrollView = 0.0f;
- ViewGroup hostView = resultState.getHostView();
- int childCount = hostView.getChildCount();
+ int childCount = algorithmState.visibleChildren.size();
int numberOfElementsCompletelyIn = (int) algorithmState.itemsInTopStack;
for (int i = 0; i < childCount; i++) {
- View child = hostView.getChildAt(i);
+ View child = algorithmState.visibleChildren.get(i);
StackScrollState.ViewState childViewState = resultState.getViewStateForView(child);
childViewState.yTranslation = currentYPosition;
childViewState.location = StackScrollState.ViewState.LOCATION_UNKNOWN;
@@ -317,12 +336,11 @@ public class StackScrollAlgorithm {
// The y Position if the element would be in a regular scrollView
float yPositionInScrollView = 0.0f;
- ViewGroup hostView = resultState.getHostView();
- int childCount = hostView.getChildCount();
+ int childCount = algorithmState.visibleChildren.size();
// find the number of elements in the top stack.
for (int i = 0; i < childCount; i++) {
- View child = hostView.getChildAt(i);
+ View child = algorithmState.visibleChildren.get(i);
StackScrollState.ViewState childViewState = resultState.getViewStateForView(child);
int childHeight = child.getHeight();
float yPositionInScrollViewAfterElement = yPositionInScrollView
@@ -397,10 +415,9 @@ public class StackScrollAlgorithm {
*/
private void updateZValuesForState(StackScrollState resultState,
StackScrollAlgorithmState algorithmState) {
- ViewGroup hostView = resultState.getHostView();
- int childCount = hostView.getChildCount();
+ int childCount = algorithmState.visibleChildren.size();
for (int i = 0; i < childCount; i++) {
- View child = hostView.getChildAt(i);
+ View child = algorithmState.visibleChildren.get(i);
StackScrollState.ViewState childViewState = resultState.getViewStateForView(child);
if (i < algorithmState.itemsInTopStack) {
float stackIndex = algorithmState.itemsInTopStack - i;
@@ -434,8 +451,8 @@ public class StackScrollAlgorithm {
}
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView) {
- if (hostView.getChildCount() > 0) {
- mFirstChildWhileExpanding = hostView.getChildAt(0);
+ mFirstChildWhileExpanding = findFirstVisibleChild(hostView);
+ if (mFirstChildWhileExpanding != null) {
if (mExpandedOnStart) {
// We are collapsing the shade, so the first child can get as most as high as the
@@ -447,11 +464,21 @@ public class StackScrollAlgorithm {
mFirstChildMaxHeight = getMaxAllowedChildHeight(mFirstChildWhileExpanding);
}
} else {
- mFirstChildWhileExpanding = null;
mFirstChildMaxHeight = 0;
}
}
+ private View findFirstVisibleChild(ViewGroup container) {
+ int childCount = container.getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ View child = container.getChildAt(i);
+ if (child.getVisibility() != View.GONE) {
+ return child;
+ }
+ }
+ return null;
+ }
+
public void onExpansionStopped() {
mIsExpansionChanging = false;
mFirstChildWhileExpanding = null;
@@ -501,6 +528,11 @@ public class StackScrollAlgorithm {
* how far in is the element currently transitioning into the bottom stack
*/
public float partialInBottom;
+
+ /**
+ * The children from the host view which are not gone.
+ */
+ public final ArrayList<View> visibleChildren = new ArrayList<View>();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java
index 67a1735..06a08f3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java
@@ -63,7 +63,8 @@ public class StackScrollState {
}
// initialize with the default values of the view
viewState.height = child.getHeight();
- viewState.alpha = 1.0f;
+ viewState.alpha = 1;
+ viewState.gone = child.getVisibility() == View.GONE;
}
}
@@ -116,7 +117,7 @@ public class StackScrollState {
// apply visibility
int oldVisibility = child.getVisibility();
int newVisibility = becomesInvisible ? View.INVISIBLE : View.VISIBLE;
- if (newVisibility != oldVisibility) {
+ if (newVisibility != oldVisibility && !state.gone) {
child.setVisibility(newVisibility);
}
@@ -164,6 +165,7 @@ public class StackScrollState {
float yTranslation;
float zTranslation;
int height;
+ boolean gone;
/**
* The location this view is currently rendered at.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
index dd13e31..d615542 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
@@ -22,6 +22,7 @@ import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
+import com.android.internal.policy.IKeyguardShowCallback;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.systemui.statusbar.BaseStatusBar;
@@ -93,10 +94,6 @@ public class TvStatusBar extends BaseStatusBar {
}
@Override
- protected void createAndAddWindows() {
- }
-
- @Override
protected WindowManager.LayoutParams getSearchLayoutParams(
LayoutParams layoutParams) {
return null;
@@ -141,10 +138,19 @@ public class TvStatusBar extends BaseStatusBar {
}
@Override
+ protected int getMaxKeyguardNotifications() {
+ return 0;
+ }
+
+ @Override
public void animateExpandSettingsPanel() {
}
@Override
+ protected void createAndAddWindows() {
+ }
+
+ @Override
protected void refreshLayout(int layoutDirection) {
}