diff options
Diffstat (limited to 'packages/SystemUI')
38 files changed, 571 insertions, 165 deletions
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_lock_24dp.png b/packages/SystemUI/res/drawable-hdpi/ic_lock_24dp.png Binary files differdeleted file mode 100644 index c779437..0000000 --- a/packages/SystemUI/res/drawable-hdpi/ic_lock_24dp.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_default_user.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_default_user.png Binary files differdeleted file mode 100644 index 18257e0..0000000 --- a/packages/SystemUI/res/drawable-hdpi/ic_qs_default_user.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-mdpi/ic_lock_24dp.png b/packages/SystemUI/res/drawable-mdpi/ic_lock_24dp.png Binary files differdeleted file mode 100644 index 98ba690..0000000 --- a/packages/SystemUI/res/drawable-mdpi/ic_lock_24dp.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_default_user.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_default_user.png Binary files differdeleted file mode 100644 index a35c30d..0000000 --- a/packages/SystemUI/res/drawable-mdpi/ic_qs_default_user.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_lock_24dp.png b/packages/SystemUI/res/drawable-xhdpi/ic_lock_24dp.png Binary files differdeleted file mode 100644 index 61947ea..0000000 --- a/packages/SystemUI/res/drawable-xhdpi/ic_lock_24dp.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_lock_open_24dp.png b/packages/SystemUI/res/drawable-xhdpi/ic_lock_open_24dp.png Binary files differdeleted file mode 100644 index 467d558..0000000 --- a/packages/SystemUI/res/drawable-xhdpi/ic_lock_open_24dp.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_default_user.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_default_user.png Binary files differdeleted file mode 100644 index d14a67f..0000000 --- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_default_user.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_lock_24dp.png b/packages/SystemUI/res/drawable-xxhdpi/ic_lock_24dp.png Binary files differdeleted file mode 100644 index 0b563b1..0000000 --- a/packages/SystemUI/res/drawable-xxhdpi/ic_lock_24dp.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_default_user.png b/packages/SystemUI/res/drawable-xxhdpi/ic_qs_default_user.png Binary files differdeleted file mode 100644 index 07f16c3..0000000 --- a/packages/SystemUI/res/drawable-xxhdpi/ic_qs_default_user.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xxxhdpi/ic_lock_24dp.png b/packages/SystemUI/res/drawable-xxxhdpi/ic_lock_24dp.png Binary files differdeleted file mode 100644 index 3600ee6..0000000 --- a/packages/SystemUI/res/drawable-xxxhdpi/ic_lock_24dp.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xxxhdpi/ic_lock_open_24dp.png b/packages/SystemUI/res/drawable-xxxhdpi/ic_lock_open_24dp.png Binary files differdeleted file mode 100644 index e7d2a9a..0000000 --- a/packages/SystemUI/res/drawable-xxxhdpi/ic_lock_open_24dp.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable/ic_account_circle.xml b/packages/SystemUI/res/drawable/ic_account_circle.xml new file mode 100644 index 0000000..a7e8514 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_account_circle.xml @@ -0,0 +1,28 @@ +<!-- +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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" > + <size + android:width="24dp" + android:height="24dp"/> + + <viewport + android:viewportWidth="24.0" + android:viewportHeight="24.0"/> + + <path + android:fill="#FFFFFFFF" + android:pathData="M12.0,2.0C6.5,2.0 2.0,6.5 2.0,12.0s4.5,10.0 10.0,10.0c5.5,0.0 10.0,-4.5 10.0,-10.0S17.5,2.0 12.0,2.0zM12.0,5.0c1.7,0.0 3.0,1.3 3.0,3.0c0.0,1.7 -1.3,3.0 -3.0,3.0c-1.7,0.0 -3.0,-1.3 -3.0,-3.0C9.0,6.3 10.3,5.0 12.0,5.0zM12.0,19.2c-2.5,0.0 -4.7,-1.3 -6.0,-3.2c0.0,-2.0 4.0,-3.1 6.0,-3.1c2.0,0.0 6.0,1.1 6.0,3.1C16.7,17.9 14.5,19.2 12.0,19.2z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_lock_24dp.xml b/packages/SystemUI/res/drawable/ic_lock_24dp.xml new file mode 100644 index 0000000..b2e486c --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_lock_24dp.xml @@ -0,0 +1,28 @@ +<!-- +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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" > + <size + android:width="24.0dp" + android:height="24.0dp"/> + + <viewport + android:viewportWidth="24.0" + android:viewportHeight="24.0"/> + + <path + android:fill="@color/keyguard_affordance" + android:pathData="M18.0,8.0l-1.0,0.0L17.0,6.0c0.0,-2.8 -2.2,-5.0 -5.0,-5.0C9.2,1.0 7.0,3.2 7.0,6.0l0.0,2.0L6.0,8.0c-1.1,0.0 -2.0,0.9 -2.0,2.0l0.0,10.0c0.0,1.1 0.9,2.0 2.0,2.0l12.0,0.0c1.1,0.0 2.0,-0.9 2.0,-2.0L20.0,10.0C20.0,8.9 19.1,8.0 18.0,8.0zM12.0,17.0c-1.1,0.0 -2.0,-0.9 -2.0,-2.0s0.9,-2.0 2.0,-2.0c1.1,0.0 2.0,0.9 2.0,2.0S13.1,17.0 12.0,17.0zM15.1,8.0L8.9,8.0L8.9,6.0c0.0,-1.7 1.4,-3.1 3.1,-3.1c1.7,0.0 3.1,1.4 3.1,3.1L15.1,8.0z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_lock_open_24dp.xml b/packages/SystemUI/res/drawable/ic_lock_open_24dp.xml new file mode 100644 index 0000000..28b16dd --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_lock_open_24dp.xml @@ -0,0 +1,28 @@ +<!-- +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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" > + <size + android:width="24.0dp" + android:height="24.0dp"/> + + <viewport + android:viewportWidth="24.0" + android:viewportHeight="24.0"/> + + <path + android:fill="@color/keyguard_affordance" + android:pathData="M12.0,17.0c1.1,0.0 2.0,-0.9 2.0,-2.0s-0.9,-2.0 -2.0,-2.0c-1.1,0.0 -2.0,0.9 -2.0,2.0S10.9,17.0 12.0,17.0zM18.0,8.0l-1.0,0.0L17.0,6.0c0.0,-2.8 -2.2,-5.0 -5.0,-5.0C9.2,1.0 7.0,3.2 7.0,6.0l1.9,0.0c0.0,-1.7 1.4,-3.1 3.1,-3.1c1.7,0.0 3.1,1.4 3.1,3.1l0.0,2.0L6.0,8.0c-1.1,0.0 -2.0,0.9 -2.0,2.0l0.0,10.0c0.0,1.1 0.9,2.0 2.0,2.0l12.0,0.0c1.1,0.0 2.0,-0.9 2.0,-2.0L20.0,10.0C20.0,8.9 19.1,8.0 18.0,8.0zM18.0,20.0L6.0,20.0L6.0,10.0l12.0,0.0L18.0,20.0z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/notification_header_bg.xml b/packages/SystemUI/res/drawable/notification_header_bg.xml index 09d0d7d..5daec20 100644 --- a/packages/SystemUI/res/drawable/notification_header_bg.xml +++ b/packages/SystemUI/res/drawable/notification_header_bg.xml @@ -19,13 +19,11 @@ <item android:state_pressed="true"> <shape> <solid android:color="@color/background_color_1_press" /> - <corners android:radius="@*android:dimen/notification_quantum_rounded_rect_radius" /> </shape> </item> <item> <shape> <solid android:color="@color/background_color_1" /> - <corners android:radius="@*android:dimen/notification_quantum_rounded_rect_radius" /> </shape> </item> </selector>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/qs_panel_background.xml b/packages/SystemUI/res/drawable/qs_panel_background.xml index c324976..a1a5362 100644 --- a/packages/SystemUI/res/drawable/qs_panel_background.xml +++ b/packages/SystemUI/res/drawable/qs_panel_background.xml @@ -13,11 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. --> -<inset xmlns:android="http://schemas.android.com/apk/res/android" - android:insetLeft="@dimen/notification_side_padding" - android:insetRight="@dimen/notification_side_padding"> - <shape> - <solid android:color="@color/system_primary_color" /> - <corners android:radius="@*android:dimen/notification_quantum_rounded_rect_radius" /> - </shape> -</inset> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="@color/system_primary_color" /> + <corners + android:radius="@*android:dimen/notification_quantum_rounded_rect_radius"/> +</shape> diff --git a/packages/SystemUI/res/layout/keyguard_bottom_area.xml b/packages/SystemUI/res/layout/keyguard_bottom_area.xml index 73c8109..936f73b 100644 --- a/packages/SystemUI/res/layout/keyguard_bottom_area.xml +++ b/packages/SystemUI/res/layout/keyguard_bottom_area.xml @@ -51,7 +51,8 @@ android:layout_marginBottom="100dp" android:layout_gravity="bottom|center_horizontal" android:textStyle="italic" - android:textAppearance="?android:attr/textAppearanceMedium"/> + android:textColor="#ffffff" + android:textAppearance="?android:attr/textAppearanceSmall"/> <ImageView android:id="@+id/lock_icon" @@ -64,4 +65,4 @@ android:layerType="hardware" android:tint="#ffffffff"/> -</com.android.systemui.statusbar.phone.KeyguardBottomAreaView>
\ No newline at end of file +</com.android.systemui.statusbar.phone.KeyguardBottomAreaView> diff --git a/packages/SystemUI/res/layout/qs_panel.xml b/packages/SystemUI/res/layout/qs_panel.xml index 85de645..398787f 100644 --- a/packages/SystemUI/res/layout/qs_panel.xml +++ b/packages/SystemUI/res/layout/qs_panel.xml @@ -16,11 +16,10 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/quick_settings_container" - android:paddingLeft="@dimen/notification_side_padding" - android:paddingRight="@dimen/notification_side_padding" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/qs_panel_background" > + android:background="@drawable/qs_panel_background" + android:elevation="2dp"> <com.android.systemui.qs.QSPanel android:id="@+id/quick_settings_panel" android:background="#0000" diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index d683162..cde83bf 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -59,7 +59,6 @@ android:id="@+id/scroll_view" android:layout_width="match_parent" android:layout_height="match_parent" - android:visibility="invisible" android:scrollbars="none" android:overScrollMode="never" android:fillViewport="true"> @@ -71,7 +70,9 @@ layout="@layout/qs_panel" android:layout_marginTop="@dimen/status_bar_header_height_expanded" android:layout_width="match_parent" - android:layout_height="wrap_content"/> + android:layout_height="wrap_content" + android:layout_marginLeft="@dimen/notification_side_padding" + android:layout_marginRight="@dimen/notification_side_padding"/> <!-- A view to reserve space for the collapsed stack --> <View @@ -80,7 +81,6 @@ </LinearLayout> </com.android.systemui.statusbar.phone.ObservableScrollView> - <com.android.systemui.statusbar.stack.NotificationStackScrollLayout android:id="@+id/notification_stack_scroller" android:layout_width="match_parent" diff --git a/packages/SystemUI/res/layout/status_bar_expanded_header.xml b/packages/SystemUI/res/layout/status_bar_expanded_header.xml index 89fa988..dfc3b22 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded_header.xml @@ -25,7 +25,7 @@ android:paddingStart="@dimen/notification_side_padding" android:paddingEnd="@dimen/notification_side_padding" android:baselineAligned="false" - android:elevation="10dp" + android:elevation="4dp" > <View @@ -65,22 +65,13 @@ /> </RelativeLayout> - <com.android.keyguard.CarrierText - android:id="@+id/keyguard_carrier_text" - android:layout_width="wrap_content" - android:layout_height="@dimen/status_bar_header_height_keyguard" - android:layout_marginLeft="8dp" - android:gravity="center_vertical" - android:ellipsize="marquee" - android:textAppearance="?android:attr/textAppearanceMedium" /> - <com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@+id/multi_user_switch" android:layout_width="40dp" android:layout_height="@dimen/status_bar_header_height" android:layout_alignParentEnd="true" android:background="@null" android:scaleType="centerInside" - android:padding="6dp" + android:padding="8dp" /> <ImageButton android:id="@+id/settings_button" @@ -98,6 +89,17 @@ android:layout_marginEnd="4dp" /> + <com.android.keyguard.CarrierText + android:id="@+id/keyguard_carrier_text" + android:layout_width="match_parent" + android:layout_height="@dimen/status_bar_header_height_keyguard" + android:layout_marginLeft="8dp" + android:layout_toStartOf="@id/system_icons_container" + android:gravity="center_vertical" + android:ellipsize="marquee" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="#ffffff" /> + <include layout="@layout/quick_settings_brightness_dialog" android:id="@+id/brightness_container" diff --git a/packages/SystemUI/res/layout/super_status_bar.xml b/packages/SystemUI/res/layout/super_status_bar.xml index 26616cd..e84300d 100644 --- a/packages/SystemUI/res/layout/super_status_bar.xml +++ b/packages/SystemUI/res/layout/super_status_bar.xml @@ -26,6 +26,10 @@ android:fitsSystemWindows="true" android:descendantFocusability="afterDescendants"> + <View android:id="@+id/scrim_behind" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + <include layout="@layout/status_bar" android:layout_width="match_parent" android:layout_height="@dimen/status_bar_height" /> @@ -40,4 +44,8 @@ android:visibility="gone" /> </com.android.systemui.statusbar.phone.PanelHolder> + <View android:id="@+id/scrim_in_front" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + </com.android.systemui.statusbar.phone.StatusBarWindowView> diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index 22815f3..5750faa 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -57,6 +57,6 @@ <!-- The margin between the clock and the notifications on Keyguard. See keyguard_clock_height_fraction_* for the difference between min and max.--> - <dimen name="keyguard_clock_notifications_margin_min">32dp</dimen> - <dimen name="keyguard_clock_notifications_margin_max">32dp</dimen> + <dimen name="keyguard_clock_notifications_margin_min">36dp</dimen> + <dimen name="keyguard_clock_notifications_margin_max">36dp</dimen> </resources> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index e5ed3d6..4e37dbb 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -31,8 +31,6 @@ <drawable name="recents_callout_line">#99ffffff</drawable> <drawable name="notification_item_background_legacy_color">#ffaaaaaa</drawable> <drawable name="heads_up_notification_bg_pressed">#ff33B5E5</drawable> - <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> @@ -75,6 +73,8 @@ <!-- The recents task bar dark dismiss icon color to be drawn on top of light backgrounds. --> <color name="recents_task_bar_dark_dismiss_color">#ff333333</color> + <color name="keyguard_affordance">#ffffffff</color> + <!-- Our quantum color palette (deep teal) --> <color name="primary_color">#ff7fcac3</color> <color name="background_color_1">#ff384248</color> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index e9dcea2..bf0cb68 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -196,6 +196,9 @@ <dimen name="qs_dual_tile_height">109dp</dimen> <dimen name="qs_dual_tile_padding">12dp</dimen> + <!-- How far the expanded QS panel peeks from the header in collapsed state. --> + <dimen name="qs_peek_height">8dp</dimen> + <!-- used by DessertCase --> <dimen name="dessert_case_cell_size">192dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index e73e904..b2872fa 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -62,6 +62,7 @@ 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.ScrimController; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.phone.StatusBarWindowManager; @@ -1316,9 +1317,10 @@ public class KeyguardViewMediator extends SystemUI { } public StatusBarKeyguardViewManager registerStatusBar(PhoneStatusBar phoneStatusBar, - ViewGroup container, StatusBarWindowManager statusBarWindowManager) { + ViewGroup container, StatusBarWindowManager statusBarWindowManager, + ScrimController scrimController) { mStatusBarKeyguardViewManager.registerStatusBar(phoneStatusBar, container, - statusBarWindowManager); + statusBarWindowManager, scrimController); return mStatusBarKeyguardViewManager; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java index a2f8991..a84daef 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java @@ -103,7 +103,11 @@ public class SpeedBumpView extends ExpandableView implements View.OnClickListene @Override public int getIntrinsicHeight() { - return getActualHeight(); + if (mCurrentAnimator != null) { + // expand animation is running + return getActualHeight(); + } + return mIsExpanded ? getHeight() : mCollapsedHeight; } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 5e9ce21..714ad06 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -29,18 +29,11 @@ import android.os.UserHandle; import android.provider.MediaStore; import android.util.AttributeSet; import android.util.Log; -import android.view.MotionEvent; import android.view.View; -import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityManager; -import android.view.animation.AccelerateInterpolator; -import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; import android.widget.ImageView; -import com.android.internal.widget.LockPatternUtils; -import com.android.keyguard.KeyguardUpdateMonitor; -import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.R; /** @@ -48,7 +41,8 @@ import com.android.systemui.R; * text. */ public class KeyguardBottomAreaView extends FrameLayout - implements SwipeAffordanceView.AffordanceListener { + implements SwipeAffordanceView.AffordanceListener, + UnlockMethodCache.OnUnlockMethodChangedListener { final static String TAG = "PhoneStatusBar/KeyguardBottomAreaView"; @@ -60,9 +54,7 @@ public class KeyguardBottomAreaView extends FrameLayout private PowerManager mPowerManager; private ActivityStarter mActivityStarter; - - private LockPatternUtils mLockPatternUtils; - private KeyguardUpdateMonitor mKeyguardUpdateMonitor; + private UnlockMethodCache mUnlockMethodCache; public KeyguardBottomAreaView(Context context) { super(context); @@ -89,13 +81,12 @@ public class KeyguardBottomAreaView extends FrameLayout mLockIcon = (ImageView) findViewById(R.id.lock_icon); mCameraButton.setAffordanceListener(this); mPhoneButton.setAffordanceListener(this); - mLockPatternUtils = new LockPatternUtils(getContext()); - mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(getContext()); - KeyguardUpdateMonitor.getInstance(getContext()).registerCallback(mCallback); watchForDevicePolicyChanges(); watchForAccessibilityChanges(); updateCameraVisibility(); updatePhoneVisibility(); + mUnlockMethodCache = UnlockMethodCache.getInstance(getContext()); + mUnlockMethodCache.addListener(this); updateTrust(); mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); } @@ -211,28 +202,14 @@ public class KeyguardBottomAreaView extends FrameLayout if (getVisibility() != VISIBLE) { return; } - int user = mLockPatternUtils.getCurrentUser(); - boolean trust = !mLockPatternUtils.isSecure() || - mKeyguardUpdateMonitor.getUserHasTrust(user); - - int iconRes = trust ? R.drawable.ic_lock_open_24dp : R.drawable.ic_lock_24dp; + int iconRes = mUnlockMethodCache.isMethodInsecure() + ? R.drawable.ic_lock_open_24dp + : R.drawable.ic_lock_24dp; mLockIcon.setImageResource(iconRes); } - final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { - @Override - public void onScreenTurnedOn() { - updateTrust(); - } - - @Override - public void onUserSwitchComplete(int userId) { - updateTrust(); - } - - @Override - public void onTrustChanged(int userId) { - updateTrust(); - } - }; + @Override + public void onMethodSecureChanged(boolean methodSecure) { + updateTrust(); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 2fa2a00..2bb80bf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -54,10 +54,6 @@ public class KeyguardBouncer { mWindowManager = windowManager; } - public void prepare() { - ensureView(); - } - public void show() { ensureView(); @@ -75,11 +71,15 @@ public class KeyguardBouncer { show(); } - public void hide() { + public void hide(boolean destroyView) { if (mKeyguardView != null) { mKeyguardView.cleanUp(); } - removeView(); + if (destroyView) { + removeView(); + } else if (mRoot != null) { + mRoot.setVisibility(View.INVISIBLE); + } } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 2f2a5df..f5252a3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -21,9 +21,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; -import android.graphics.Path; import android.util.AttributeSet; -import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; @@ -32,7 +30,6 @@ import android.view.ViewTreeObserver; import android.view.accessibility.AccessibilityEvent; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; -import android.view.animation.PathInterpolator; import android.widget.LinearLayout; import com.android.systemui.R; @@ -50,6 +47,7 @@ public class NotificationPanelView extends PanelView implements PhoneStatusBar mStatusBar; private StatusBarHeaderView mHeader; private View mQsContainer; + private View mQsPanel; private View mKeyguardStatusView; private ObservableScrollView mScrollView; private View mStackScrollerContainer; @@ -68,6 +66,7 @@ public class NotificationPanelView extends PanelView implements */ private boolean mIntercepting; private boolean mQsExpanded; + private boolean mKeyguardShowing; private float mInitialHeightOnTouch; private float mInitialTouchX; private float mInitialTouchY; @@ -77,6 +76,7 @@ public class NotificationPanelView extends PanelView implements private int mQsMinExpansionHeight; private int mQsMaxExpansionHeight; private int mMinStackHeight; + private int mQsPeekHeight; private float mNotificationTranslation; private int mStackScrollerIntrinsicPadding; private boolean mQsExpansionEnabled = true; @@ -121,6 +121,7 @@ public class NotificationPanelView extends PanelView implements mKeyguardStatusView = findViewById(R.id.keyguard_status_view); mStackScrollerContainer = findViewById(R.id.notification_container_parent); mQsContainer = findViewById(R.id.quick_settings_container); + mQsPanel = findViewById(R.id.quick_settings_panel); mScrollView = (ObservableScrollView) findViewById(R.id.scroll_view); mScrollView.setListener(this); mNotificationStackScroller = (NotificationStackScrollLayout) @@ -139,22 +140,21 @@ public class NotificationPanelView extends PanelView implements mFlingAnimationUtils = new FlingAnimationUtils(getContext(), 0.4f); mStatusBarMinHeight = getResources().getDimensionPixelSize( com.android.internal.R.dimen.status_bar_height); + mQsPeekHeight = getResources().getDimensionPixelSize(R.dimen.qs_peek_height); mClockPositionAlgorithm.loadDimens(getResources()); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - if (!mQsExpanded) { - positionClockAndNotifications(); - mNotificationStackScroller.setStackHeight(getExpandedHeight()); - } // Calculate quick setting heights. - mQsMinExpansionHeight = mHeader.getCollapsedHeight(); + mQsMinExpansionHeight = mHeader.getCollapsedHeight() + mQsPeekHeight; mQsMaxExpansionHeight = mHeader.getExpandedHeight() + mQsContainer.getHeight(); - if (mQsExpansionHeight == 0) { - mQsExpansionHeight = mQsMinExpansionHeight; + if (!mQsExpanded) { + setQsExpansion(mQsMinExpansionHeight); + positionClockAndNotifications(); + mNotificationStackScroller.setStackHeight(getExpandedHeight()); } } @@ -165,7 +165,8 @@ public class NotificationPanelView extends PanelView implements private void positionClockAndNotifications() { boolean animateClock = mNotificationStackScroller.isAddOrRemoveAnimationPending(); if (mStatusBar.getBarState() != StatusBarState.KEYGUARD) { - mStackScrollerIntrinsicPadding = mHeader.getBottom() + mNotificationTopPadding; + mStackScrollerIntrinsicPadding = mHeader.getBottom() + mQsPeekHeight + + mNotificationTopPadding; mTopPaddingAdjustment = 0; } else { mClockPositionAlgorithm.setup( @@ -455,29 +456,38 @@ public class NotificationPanelView extends PanelView implements setQsExpansion(height); } - private void expandQs() { - mHeader.setExpanded(true); - mNotificationStackScroller.setEnabled(false); - mScrollView.setVisibility(View.VISIBLE); - mQsExpanded = true; + private void setQsExpanded(boolean expanded) { + boolean changed = mQsExpanded != expanded; + if (changed) { + mQsExpanded = expanded; + updateQsState(); + } } - private void collapseQs() { - mHeader.setExpanded(false); - mNotificationStackScroller.setEnabled(true); - mScrollView.setVisibility(View.INVISIBLE); - mQsExpanded = false; + public void setKeyguardShowing(boolean keyguardShowing) { + mKeyguardShowing = keyguardShowing; + updateQsState(); + } + + private void updateQsState() { + mHeader.setExpanded(mQsExpanded); + mNotificationStackScroller.setEnabled(!mQsExpanded); + mQsPanel.setVisibility(mQsExpanded ? View.VISIBLE : View.INVISIBLE); + mQsContainer.setVisibility(mKeyguardShowing && !mQsExpanded + ? View.INVISIBLE + : View.VISIBLE); + mScrollView.setTouchEnabled(mQsExpanded); } private void setQsExpansion(float height) { height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight); if (height > mQsMinExpansionHeight && !mQsExpanded) { - expandQs(); + setQsExpanded(true); } else if (height <= mQsMinExpansionHeight && mQsExpanded) { - collapseQs(); + setQsExpanded(false); } mQsExpansionHeight = height; - mHeader.setExpansion(height); + mHeader.setExpansion(height - mQsPeekHeight); setQsTranslation(height); setQsStackScrollerPadding(height); mStatusBar.userActivity(); @@ -646,6 +656,23 @@ public class NotificationPanelView extends PanelView implements } @Override + protected void onOverExpansionChanged(float overExpansion) { + float currentOverScroll = mNotificationStackScroller.getCurrentOverScrolledPixels(true); + mNotificationStackScroller.setOverScrolledPixels(currentOverScroll + overExpansion + - mOverExpansion, true /* onTop */, false /* animate */); + super.onOverExpansionChanged(overExpansion); + } + + @Override + protected void onTrackingStopped() { + super.onTrackingStopped(); + mOverExpansion = 0.0f; + mNotificationStackScroller.setOverScrolledPixels(0.0f, true /* onTop */, + true /* animate */); + } + + + @Override public void onHeightChanged(ExpandableView view) { requestPanelHeightUpdate(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ObservableScrollView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ObservableScrollView.java index c4e61d0..ea5b309 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ObservableScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ObservableScrollView.java @@ -30,6 +30,7 @@ public class ObservableScrollView extends ScrollView { private Listener mListener; private int mLastOverscrollAmount; private boolean mDispatchingTouchEvent; + private boolean mTouchEnabled = true; public ObservableScrollView(Context context, AttributeSet attrs) { super(context, attrs); @@ -39,6 +40,10 @@ public class ObservableScrollView extends ScrollView { mListener = listener; } + public void setTouchEnabled(boolean touchEnabled) { + mTouchEnabled = touchEnabled; + } + public boolean isScrolledToBottom() { return getScrollY() == getMaxScrollY(); } @@ -59,6 +64,9 @@ public class ObservableScrollView extends ScrollView { @Override public boolean dispatchTouchEvent(MotionEvent ev) { + if (!mTouchEnabled) { + return false; + } mDispatchingTouchEvent = true; boolean result = super.dispatchTouchEvent(ev); mDispatchingTouchEvent = false; 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 8631e3a..7c1f2cf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -38,6 +38,7 @@ import java.io.PrintWriter; public class PanelView extends FrameLayout { public static final boolean DEBUG = PanelBar.DEBUG; public static final String TAG = PanelView.class.getSimpleName(); + protected float mOverExpansion; private final void logf(String fmt, Object... args) { Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args)); @@ -403,6 +404,11 @@ public class PanelView extends FrameLayout { public void setExpandedHeightInternal(float h) { float fh = getMaxPanelHeight(); mExpandedHeight = Math.min(fh, h); + float overExpansion = h - fh; + overExpansion = Math.max(0, overExpansion); + if (overExpansion != mOverExpansion) { + onOverExpansionChanged(overExpansion); + } if (DEBUG) { logf("setExpansion: height=%.1f fh=%.1f tracking=%s", h, fh, mTracking ? "T" : "f"); @@ -412,6 +418,10 @@ public class PanelView extends FrameLayout { mExpandedFraction = Math.min(1f, (fh == 0) ? 0 : h / fh); } + protected void onOverExpansionChanged(float overExpansion) { + mOverExpansion = overExpansion; + } + protected void onHeightUpdated(float expandedHeight) { requestLayout(); } 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 4098500..b36c2ef 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -372,6 +372,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private ViewMediatorCallback mKeyguardViewMediatorCallback; + private ScrimController mScrimController; private final Runnable mAutohide = new Runnable() { @Override @@ -638,9 +639,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, SpeedBumpView speedBump = (SpeedBumpView) LayoutInflater.from(mContext).inflate( R.layout.status_bar_notification_speed_bump, mStackScroller, false); mStackScroller.setSpeedBumpView(speedBump); - mExpandedContents = mStackScroller; + mScrimController = new ScrimController(mStatusBarWindow.findViewById(R.id.scrim_behind), + mStatusBarWindow.findViewById(R.id.scrim_in_front)); + mStatusBarView.setScrimController(mScrimController); + mHeader = (StatusBarHeaderView) mStatusBarWindow.findViewById(R.id.header); mHeader.setActivityStarter(this); mKeyguardStatusView = mStatusBarWindow.findViewById(R.id.keyguard_status_view); @@ -775,7 +779,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, private void startKeyguard() { KeyguardViewMediator keyguardViewMediator = getComponent(KeyguardViewMediator.class); mStatusBarKeyguardViewManager = keyguardViewMediator.registerStatusBar(this, - mStatusBarWindow, mStatusBarWindowManager); + mStatusBarWindow, mStatusBarWindowManager, mScrimController); mKeyguardViewMediatorCallback = keyguardViewMediator.getViewMediatorCallback(); } @@ -1446,6 +1450,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, startActivityDismissingKeyguard(intent, false); } + public ScrimController getScrimController() { + return mScrimController; + } + /** * All changes to the status bar and notifications funnel through here and are batched. */ @@ -2770,9 +2778,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) { mKeyguardBottomArea.setVisibility(View.VISIBLE); mHeader.setKeyguardShowing(true); + mNotificationPanel.setKeyguardShowing(true); + mScrimController.setKeyguardShowing(true); } else { mKeyguardBottomArea.setVisibility(View.GONE); mHeader.setKeyguardShowing(false); + mNotificationPanel.setKeyguardShowing(false); + mScrimController.setKeyguardShowing(false); } updateStackScrollerState(); 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 084bfcf..5fdf5bf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java @@ -36,21 +36,16 @@ public class PhoneStatusBarView extends PanelBar { private static final boolean DEBUG_GESTURES = true; PhoneStatusBar mBar; - int mScrimColor; - int mScrimColorKeyguard; - PanelView mFadingPanel = null; PanelView mLastFullyOpenedPanel = null; PanelView mNotificationPanel; - private boolean mShouldFade; private final PhoneStatusBarTransitions mBarTransitions; + private ScrimController mScrimController; public PhoneStatusBarView(Context context, AttributeSet attrs) { super(context, attrs); Resources res = getContext().getResources(); - mScrimColor = res.getColor(R.color.notification_panel_scrim_color); - mScrimColorKeyguard = res.getColor(R.color.notification_panel_scrim_color_keyguard); mBarTransitions = new PhoneStatusBarTransitions(this); } @@ -62,6 +57,10 @@ public class PhoneStatusBarView extends PanelBar { mBar = bar; } + public void setScrimController(ScrimController scrimController) { + mScrimController = scrimController; + } + @Override public void onFinishInflate() { mBarTransitions.init(); @@ -110,27 +109,11 @@ public class PhoneStatusBarView extends PanelBar { } @Override - public void startOpeningPanel(PanelView panel) { - super.startOpeningPanel(panel); - // we only want to start fading if this is the "first" or "last" panel, - // which is kind of tricky to determine - mShouldFade = (mFadingPanel == null || mFadingPanel.isFullyExpanded()); - if (DEBUG) { - Log.v(TAG, "start opening: " + panel + " shouldfade=" + mShouldFade); - } - mFadingPanel = panel; - } - - @Override public void onAllPanelsCollapsed() { super.onAllPanelsCollapsed(); // give animations time to settle mBar.makeExpandedInvisibleSoon(); - mFadingPanel = null; mLastFullyOpenedPanel = null; - if (mScrimColor != 0 && ActivityManager.isHighEndGfx() && mBar.mStatusBarWindow != null) { - mBar.mStatusBarWindow.setBackgroundColor(0); - } } @Override @@ -139,9 +122,7 @@ public class PhoneStatusBarView extends PanelBar { if (openPanel != mLastFullyOpenedPanel) { openPanel.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); } - mFadingPanel = openPanel; mLastFullyOpenedPanel = openPanel; - mShouldFade = true; // now you own the fade, mister } @Override @@ -163,6 +144,7 @@ public class PhoneStatusBarView extends PanelBar { public void onTrackingStarted(PanelView panel) { super.onTrackingStarted(panel); mBar.onTrackingStarted(); + mScrimController.onTrackingStarted(); } @Override @@ -184,27 +166,7 @@ public class PhoneStatusBarView extends PanelBar { Log.v(TAG, "panelExpansionChanged: f=" + frac); } - if (panel == mFadingPanel && mScrimColor != 0 && ActivityManager.isHighEndGfx() - && mBar.mStatusBarWindow != null) { - if (mShouldFade) { - int scrimColor = (mBar.getBarState() == StatusBarState.KEYGUARD - || mBar.getBarState() == StatusBarState.SHADE_LOCKED) - ? 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; - if (frac <= 0) { - mBar.mStatusBarWindow.setBackgroundColor(0); - } else { - // 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) ((scrimColor >>> 24) * k) << 24 | (scrimColor & 0xFFFFFF); - mBar.mStatusBarWindow.setBackgroundColor(color); - } - } - } + mScrimController.setPanelExpansion(frac); // fade out the panel as it gets buried into the status bar to avoid overdrawing the // status bar on the last frame of a close animation diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java new file mode 100644 index 0000000..95255d5 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -0,0 +1,187 @@ +/* + * 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.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; +import android.content.res.Resources; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.view.View; +import android.view.ViewTreeObserver; +import android.view.animation.AccelerateInterpolator; +import android.view.animation.AnimationUtils; +import android.view.animation.DecelerateInterpolator; +import android.view.animation.Interpolator; +import android.view.animation.LinearInterpolator; + +/** + * Controls both the scrim behind the notifications and in front of the notifications (when a + * security method gets shown). + */ +public class ScrimController implements ViewTreeObserver.OnPreDrawListener { + + private static final float SCRIM_BEHIND_ALPHA = 0.62f; + private static final float SCRIM_BEHIND_ALPHA_KEYGUARD = 0.5f; + private static final float SCRIM_IN_FRONT_ALPHA = 0.75f; + private static final long ANIMATION_DURATION = 220; + + private final View mScrimBehind; + private final View mScrimInFront; + private final UnlockMethodCache mUnlockMethodCache; + + private boolean mKeyguardShowing; + private float mFraction; + + private boolean mDarkenWhileDragging; + private boolean mBouncerShowing; + private boolean mAnimateChange; + private boolean mUpdatePending; + + private final Interpolator mInterpolator = new DecelerateInterpolator(); + + public ScrimController(View scrimBehind, View scrimInFront) { + mScrimBehind = scrimBehind; + mScrimInFront = scrimInFront; + mUnlockMethodCache = UnlockMethodCache.getInstance(scrimBehind.getContext()); + } + + public void setKeyguardShowing(boolean showing) { + mKeyguardShowing = showing; + scheduleUpdate(); + } + + public void onTrackingStarted() { + mDarkenWhileDragging = !mUnlockMethodCache.isMethodInsecure(); + } + + public void setPanelExpansion(float fraction) { + mFraction = fraction; + scheduleUpdate(); + } + + public void setBouncerShowing(boolean showing) { + mBouncerShowing = showing; + mAnimateChange = true; + scheduleUpdate(); + } + + private void scheduleUpdate() { + if (mUpdatePending) return; + mScrimBehind.getViewTreeObserver().addOnPreDrawListener(this); + mUpdatePending = true; + } + + private void updateScrims() { + if (!mKeyguardShowing) { + updateScrimNormal(); + setScrimInFrontColor(0); + } else { + updateScrimKeyguard(); + } + mAnimateChange = false; + } + + private void updateScrimKeyguard() { + if (mBouncerShowing) { + setScrimInFrontColor(SCRIM_IN_FRONT_ALPHA); + setScrimBehindColor(0f); + } else if (mDarkenWhileDragging) { + float behindFraction = Math.max(0, Math.min(mFraction, 1)); + float fraction = 1 - behindFraction; + setScrimInFrontColor(fraction * SCRIM_IN_FRONT_ALPHA); + setScrimBehindColor(behindFraction * SCRIM_BEHIND_ALPHA_KEYGUARD); + } else { + setScrimInFrontColor(0f); + setScrimBehindColor(SCRIM_BEHIND_ALPHA_KEYGUARD); + } + } + + private void updateScrimNormal() { + float frac = mFraction; + // let's start this 20% of the way down the screen + frac = frac * 1.2f - 0.2f; + if (frac <= 0) { + setScrimBehindColor(0); + } else { + // woo, special effects + final float k = (float)(1f-0.5f*(1f-Math.cos(3.14159f * Math.pow(1f-frac, 2f)))); + setScrimBehindColor(k * SCRIM_BEHIND_ALPHA); + } + } + + private void setScrimBehindColor(float alpha) { + setScrimColor(mScrimBehind, alpha); + } + + private void setScrimInFrontColor(float alpha) { + setScrimColor(mScrimInFront, alpha); + if (alpha == 0f) { + mScrimInFront.setClickable(false); + } else { + + // Eat touch events. + mScrimInFront.setClickable(true); + } + } + + private void setScrimColor(View scrim, float alpha) { + int color = Color.argb((int) (alpha * 255), 0, 0, 0); + if (mAnimateChange) { + startScrimAnimation(scrim, color); + } else { + scrim.setBackgroundColor(color); + } + } + + private void startScrimAnimation(final View scrim, int targetColor) { + int current = getBackgroundAlpha(scrim); + int target = Color.alpha(targetColor); + if (current == targetColor) { + return; + } + ValueAnimator anim = ValueAnimator.ofInt(current, target); + anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + int value = (int) animation.getAnimatedValue(); + scrim.setBackgroundColor(Color.argb(value, 0, 0, 0)); + } + }); + anim.setInterpolator(mInterpolator); + anim.setDuration(ANIMATION_DURATION); + anim.start(); + } + + private int getBackgroundAlpha(View scrim) { + if (scrim.getBackground() instanceof ColorDrawable) { + ColorDrawable drawable = (ColorDrawable) scrim.getBackground(); + return Color.alpha(drawable.getColor()); + } else { + return 0; + } + } + + @Override + public boolean onPreDraw() { + mScrimBehind.getViewTreeObserver().removeOnPreDrawListener(this); + mUpdatePending = false; + updateScrims(); + return true; + } +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java index 389e725..3245f1a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java @@ -38,6 +38,11 @@ import com.android.systemui.statusbar.policy.UserInfoController; */ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickListener { + /** + * How much the header expansion gets rubberbanded while expanding the panel. + */ + private static final float EXPANSION_RUBBERBAND_FACTOR = 0.35f; + private boolean mExpanded; private boolean mKeyguardShowing; @@ -128,6 +133,8 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL updateVisibilities(); updateSystemIconsLayoutParams(); updateBrightnessControllerState(); + updateZTranslation(); + updateClickTargets(); if (mQSPanel != null) { mQSPanel.setExpanded(expanded); } @@ -202,18 +209,30 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL } } + private void updateClickTargets() { + mDateTime.setClickable(mExpanded); + mMultiUserSwitch.setClickable(mExpanded); + } + + private void updateZTranslation() { + + // If we are on the Keyguard, we need to set our z position to zero, so we don't get + // shadows. + if (mKeyguardShowing && !mExpanded) { + setZ(0); + } else { + setTranslationZ(0); + } + } + public void setExpansion(float height) { + height = (height - mCollapsedHeight) * EXPANSION_RUBBERBAND_FACTOR + mCollapsedHeight; if (height < mCollapsedHeight) { height = mCollapsedHeight; } if (height > mExpandedHeight) { height = mExpandedHeight; } - if (mExpanded) { - mBackground.setTranslationY(-(mExpandedHeight - height)); - } else { - mBackground.setTranslationY(0); - } setClipping(height); } @@ -247,14 +266,10 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL public void setKeyguardShowing(boolean keyguardShowing) { mKeyguardShowing = keyguardShowing; - if (keyguardShowing) { - setZ(0); - } else { - setTranslationZ(0); - } updateHeights(); updateWidth(); updateVisibilities(); + updateZTranslation(); } public void setUserInfoController(UserInfoController userInfoController) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 3849d8d..c3430c3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -45,6 +45,7 @@ public class StatusBarKeyguardViewManager { private LockPatternUtils mLockPatternUtils; private ViewMediatorCallback mViewMediatorCallback; private PhoneStatusBar mPhoneStatusBar; + private ScrimController mScrimController; private ViewGroup mContainer; private StatusBarWindowManager mStatusBarWindowManager; @@ -68,10 +69,12 @@ public class StatusBarKeyguardViewManager { } public void registerStatusBar(PhoneStatusBar phoneStatusBar, - ViewGroup container, StatusBarWindowManager statusBarWindowManager) { + ViewGroup container, StatusBarWindowManager statusBarWindowManager, + ScrimController scrimController) { mPhoneStatusBar = phoneStatusBar; mContainer = container; mStatusBarWindowManager = statusBarWindowManager; + mScrimController = scrimController; mBouncer = new KeyguardBouncer(mContext, mViewMediatorCallback, mLockPatternUtils, mStatusBarWindowManager, container); } @@ -98,8 +101,7 @@ public class StatusBarKeyguardViewManager { mBouncer.show(); } else { mPhoneStatusBar.showKeyguard(); - mBouncer.hide(); - mBouncer.prepare(); + mBouncer.hide(false /* destroyView */); } } @@ -124,7 +126,7 @@ public class StatusBarKeyguardViewManager { if (mShowing) { if (mOccluded) { mPhoneStatusBar.hideKeyguard(); - mBouncer.hide(); + mBouncer.hide(false /* destroyView */); } else { showBouncerOrKeyguard(); } @@ -184,7 +186,7 @@ public class StatusBarKeyguardViewManager { mShowing = false; mPhoneStatusBar.hideKeyguard(); mStatusBarWindowManager.setKeyguardShowing(false); - mBouncer.hide(); + mBouncer.hide(true /* destroyView */); mViewMediatorCallback.keyguardGone(); updateStates(); } @@ -216,7 +218,7 @@ public class StatusBarKeyguardViewManager { */ public boolean onBackPressed() { if (mBouncer.isShowing()) { - mBouncer.hide(); + mBouncer.hide(false /* destroyView */); mPhoneStatusBar.showKeyguard(); updateStates(); return true; @@ -253,6 +255,7 @@ public class StatusBarKeyguardViewManager { if (bouncerShowing != mLastBouncerShowing || mFirstUpdate) { mStatusBarWindowManager.setBouncerShowing(bouncerShowing); mPhoneStatusBar.setBouncerShowing(bouncerShowing); + mScrimController.setBouncerShowing(bouncerShowing); } KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java new file mode 100644 index 0000000..bfd657b --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java @@ -0,0 +1,107 @@ +/* + * 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 com.android.internal.widget.LockPatternUtils; +import com.android.keyguard.KeyguardUpdateMonitor; +import com.android.keyguard.KeyguardUpdateMonitorCallback; + +import java.util.ArrayList; + +/** + * Caches whether the current unlock method is insecure, taking trust into account. This information + * might be a little bit out of date and should not be used for actual security decisions; it should + * be only used for visual indications. + */ +public class UnlockMethodCache { + + private static UnlockMethodCache sInstance; + + private final LockPatternUtils mLockPatternUtils; + private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; + private final ArrayList<OnUnlockMethodChangedListener> mListeners = new ArrayList<>(); + private boolean mMethodInsecure; + + private UnlockMethodCache(Context ctx) { + mLockPatternUtils = new LockPatternUtils(ctx); + mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(ctx); + KeyguardUpdateMonitor.getInstance(ctx).registerCallback(mCallback); + updateMethodSecure(true /* updateAlways */); + } + + public static UnlockMethodCache getInstance(Context context) { + if (sInstance == null) { + sInstance = new UnlockMethodCache(context); + } + return sInstance; + } + + /** + * @return whether the current security method is secure, i. e. the bouncer will be shown + */ + public boolean isMethodInsecure() { + return mMethodInsecure; + } + + public void addListener(OnUnlockMethodChangedListener listener) { + mListeners.add(listener); + } + + public void removeListener(OnUnlockMethodChangedListener listener) { + mListeners.remove(listener); + } + + private void updateMethodSecure(boolean updateAlways) { + int user = mLockPatternUtils.getCurrentUser(); + boolean methodInsecure = !mLockPatternUtils.isSecure() || + mKeyguardUpdateMonitor.getUserHasTrust(user); + boolean changed = methodInsecure != mMethodInsecure; + if (changed || updateAlways) { + mMethodInsecure = methodInsecure; + notifyListeners(mMethodInsecure); + } + } + + private void notifyListeners(boolean secure) { + for (OnUnlockMethodChangedListener listener : mListeners) { + listener.onMethodSecureChanged(secure); + } + } + + private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { + @Override + public void onUserSwitchComplete(int userId) { + updateMethodSecure(false /* updateAlways */); + } + + @Override + public void onTrustChanged(int userId) { + updateMethodSecure(false /* updateAlways */); + } + + @Override + public void onScreenTurnedOn() { + updateMethodSecure(false /* updateAlways */); + } + }; + + public static interface OnUnlockMethodChangedListener { + void onMethodSecureChanged(boolean methodSecure); + } +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserInfoController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserInfoController.java index 173af40..3ce6905 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserInfoController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserInfoController.java @@ -166,7 +166,7 @@ public final class UserInfoController { if (rawAvatar != null) { avatar = new BitmapDrawable(mContext.getResources(), circularClip(rawAvatar)); } else { - avatar = mContext.getResources().getDrawable(R.drawable.ic_qs_default_user); + avatar = mContext.getResources().getDrawable(R.drawable.ic_account_circle); mUseDefaultAvatar = true; } |