diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-08-21 01:12:37 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2014-08-25 17:21:05 +0200 |
commit | e070018b3e26371e1260229060d022808e43837e (patch) | |
tree | ccd13518265328a710036121fc805825a7d08438 | |
parent | fb28c0e129896b17e4906b873bf44eb103ac2a8d (diff) | |
download | frameworks_base-e070018b3e26371e1260229060d022808e43837e.zip frameworks_base-e070018b3e26371e1260229060d022808e43837e.tar.gz frameworks_base-e070018b3e26371e1260229060d022808e43837e.tar.bz2 |
Fix password unlock method
- Update layouts/assets to material
- Fix that the virtual keyboard didn't always come up
- Fix window layout of status bar window, so it's above the IME when
on Keyguard
Bug: 16957208
Change-Id: I1785af9ac73103abe6cd9968ed27582fbfc9a1d9
14 files changed, 112 insertions, 62 deletions
diff --git a/core/res/res/drawable-xxhdpi/ic_lockscreen_ime.png b/core/res/res/drawable-xxhdpi/ic_lockscreen_ime.png Binary files differdeleted file mode 100644 index cb5d2fa..0000000 --- a/core/res/res/drawable-xxhdpi/ic_lockscreen_ime.png +++ /dev/null diff --git a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_ime.png b/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_ime.png Binary files differdeleted file mode 100644 index 29a7989..0000000 --- a/packages/Keyguard/res/drawable-hdpi/ic_lockscreen_ime.png +++ /dev/null diff --git a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_ime.png b/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_ime.png Binary files differdeleted file mode 100644 index b27e059..0000000 --- a/packages/Keyguard/res/drawable-mdpi/ic_lockscreen_ime.png +++ /dev/null diff --git a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_ime.png b/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_ime.png Binary files differdeleted file mode 100644 index a40ddeb..0000000 --- a/packages/Keyguard/res/drawable-xhdpi/ic_lockscreen_ime.png +++ /dev/null diff --git a/packages/Keyguard/res/drawable/ic_lockscreen_ime.xml b/packages/Keyguard/res/drawable/ic_lockscreen_ime.xml new file mode 100644 index 0000000..49be7dc --- /dev/null +++ b/packages/Keyguard/res/drawable/ic_lockscreen_ime.xml @@ -0,0 +1,24 @@ +<!-- + ~ 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" + android:width="24.0dp" + android:height="24.0dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:pathData="M20.000000,5.000000L4.000000,5.000000C2.900000,5.000000 2.000000,5.900000 2.000000,7.000000l0.000000,10.000000c0.000000,1.100000 0.900000,2.000000 2.000000,2.000000l16.000000,0.000000c1.100000,0.000000 2.000000,-0.900000 2.000000,-2.000000L22.000000,7.000000C22.000000,5.900000 21.100000,5.000000 20.000000,5.000000zM11.000000,8.000000l2.000000,0.000000l0.000000,2.000000l-2.000000,0.000000L11.000000,8.000000zM11.000000,11.000000l2.000000,0.000000l0.000000,2.000000l-2.000000,0.000000L11.000000,11.000000zM8.000000,8.000000l2.000000,0.000000l0.000000,2.000000L8.000000,10.000000L8.000000,8.000000zM8.000000,11.000000l2.000000,0.000000l0.000000,2.000000L8.000000,13.000000L8.000000,11.000000zM7.000000,13.000000L5.000000,13.000000l0.000000,-2.000000l2.000000,0.000000L7.000000,13.000000zM7.000000,10.000000L5.000000,10.000000L5.000000,8.000000l2.000000,0.000000L7.000000,10.000000zM16.000000,17.000000L8.000000,17.000000l0.000000,-2.000000l8.000000,0.000000L16.000000,17.000000zM16.000000,13.000000l-2.000000,0.000000l0.000000,-2.000000l2.000000,0.000000L16.000000,13.000000zM16.000000,10.000000l-2.000000,0.000000L14.000000,8.000000l2.000000,0.000000L16.000000,10.000000zM19.000000,13.000000l-2.000000,0.000000l0.000000,-2.000000l2.000000,0.000000L19.000000,13.000000zM19.000000,10.000000l-2.000000,0.000000L17.000000,8.000000l2.000000,0.000000L19.000000,10.000000z" + android:fillColor="#FFFFFFFF"/> +</vector> diff --git a/packages/Keyguard/res/layout/keyguard_bouncer.xml b/packages/Keyguard/res/layout/keyguard_bouncer.xml index c85f04c..3c1f65e 100644 --- a/packages/Keyguard/res/layout/keyguard_bouncer.xml +++ b/packages/Keyguard/res/layout/keyguard_bouncer.xml @@ -17,7 +17,8 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@android:color/transparent" > + android:background="@android:color/transparent" + android:fitsSystemWindows="true"> <include style="@style/BouncerSecurityContainer" diff --git a/packages/Keyguard/res/layout/keyguard_password_view.xml b/packages/Keyguard/res/layout/keyguard_password_view.xml index ed3f0e0..9e886f2 100644 --- a/packages/Keyguard/res/layout/keyguard_password_view.xml +++ b/packages/Keyguard/res/layout/keyguard_password_view.xml @@ -32,7 +32,7 @@ <Space android:layout_width="match_parent" android:layout_height="0dp" - android:layout_weight="1" + android:layout_weight="7" /> <include layout="@layout/keyguard_message_area" @@ -40,64 +40,51 @@ android:layout_height="wrap_content" /> <!-- Password entry field --> - <!-- Note: the entire container is styled to look like the edit field, - since the backspace/IME switcher looks better inside --> <FrameLayout android:id="@+id/keyguard_bouncer_frame" android:background="@drawable/kg_bouncer_bg_white" android:layout_height="wrap_content" - android:layout_width="match_parent" + android:layout_width="280dp" + android:layout_gravity="center_horizontal" + android:theme="@style/PasswordTheme" > - <LinearLayout - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:orientation="horizontal" - android:background="#70000000" - android:layout_marginTop="8dp" - android:layout_marginBottom="8dp" - > - - <EditText android:id="@+id/passwordEntry" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:gravity="center_horizontal" - android:layout_gravity="center_vertical" - android:layout_marginStart="@dimen/keyguard_lockscreen_pin_margin_left" - android:singleLine="true" - android:textStyle="normal" - android:inputType="textPassword" - android:textSize="36sp" - android:background="@null" - android:textAppearance="?android:attr/textAppearanceMedium" - android:textColor="#ffffffff" - android:imeOptions="flagForceAscii|actionDone" - /> - <ImageView android:id="@+id/switch_ime_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ic_lockscreen_ime" - android:clickable="true" - android:padding="8dip" - android:layout_gravity="center" - android:background="?android:attr/selectableItemBackground" - android:visibility="gone" - /> + <EditText android:id="@+id/passwordEntry" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:singleLine="true" + android:textStyle="normal" + android:inputType="textPassword" + android:textSize="16sp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:imeOptions="flagForceAscii|actionDone" + /> - </LinearLayout> + <ImageView android:id="@+id/switch_ime_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:src="@drawable/ic_lockscreen_ime" + android:clickable="true" + android:padding="8dip" + android:layout_gravity="end|center_vertical" + android:background="?android:attr/selectableItemBackground" + android:visibility="gone" + /> </FrameLayout> <Space android:layout_width="match_parent" android:layout_height="0dp" - android:layout_weight="1" + android:layout_weight="2" /> <include layout="@layout/keyguard_eca" android:id="@+id/keyguard_selector_fade_container" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginBottom="12dp" android:orientation="vertical" android:layout_gravity="bottom|center_horizontal" android:gravity="center_horizontal" /> diff --git a/packages/Keyguard/res/layout/keyguard_pattern_view.xml b/packages/Keyguard/res/layout/keyguard_pattern_view.xml index 3d7820f..a126465 100644 --- a/packages/Keyguard/res/layout/keyguard_pattern_view.xml +++ b/packages/Keyguard/res/layout/keyguard_pattern_view.xml @@ -40,7 +40,7 @@ android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="vertical" - android:layout_gravity="center"> + android:layout_gravity="center_horizontal|bottom"> <include layout="@layout/keyguard_message_area" android:layout_width="match_parent" diff --git a/packages/Keyguard/res/values-sw720dp/dimens.xml b/packages/Keyguard/res/values-sw720dp/dimens.xml index 3e89a84..86d155e 100644 --- a/packages/Keyguard/res/values-sw720dp/dimens.xml +++ b/packages/Keyguard/res/values-sw720dp/dimens.xml @@ -21,9 +21,6 @@ <!-- Size of the clock font in keyguard's status view --> <dimen name="kg_status_clock_font_size">140dp</dimen> - <!-- Size of the generic status lines keyguard's status view --> - <dimen name="kg_status_line_font_size">19sp</dimen> - <!-- Top margin for the clock view --> <dimen name="kg_clock_top_margin">0dp</dimen> diff --git a/packages/Keyguard/res/values/dimens.xml b/packages/Keyguard/res/values/dimens.xml index bfc0531..fb7480c 100644 --- a/packages/Keyguard/res/values/dimens.xml +++ b/packages/Keyguard/res/values/dimens.xml @@ -71,7 +71,7 @@ <dimen name="kg_status_clock_font_size">75dp</dimen> <!-- Size of the generic status lines keyguard's status view --> - <dimen name="kg_status_line_font_size">12dp</dimen> + <dimen name="kg_status_line_font_size">14sp</dimen> <!-- Size of margin on the right of keyguard's status view --> <dimen name="kg_status_line_font_right_margin">16dp</dimen> @@ -120,7 +120,7 @@ <dimen name="keyguard_security_height">400dp</dimen> <!-- Max Height of the sliding KeyguardSecurityContainer (includes 2x keyguard_security_view_margin) --> - <dimen name="keyguard_security_max_height">460dp</dimen> + <dimen name="keyguard_security_max_height">450dp</dimen> <!-- Margin around the various security views --> <dimen name="keyguard_security_view_margin">8dp</dimen> diff --git a/packages/Keyguard/res/values/styles.xml b/packages/Keyguard/res/values/styles.xml index cdd6489..7d161af 100644 --- a/packages/Keyguard/res/values/styles.xml +++ b/packages/Keyguard/res/values/styles.xml @@ -68,8 +68,11 @@ </style> <style name="BouncerSecurityContainer"> - <item name="android:layout_marginBottom">32dp</item> <item name="android:layout_gravity">center_horizontal|bottom</item> </style> + <style name="PasswordTheme" parent="@android:style/Theme.DeviceDefault"> + <item name="android:colorControlNormal">#80ffffff</item> + <item name="android:colorControlActivated">#80ffffff</item> + </style> </resources> diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java index 5f5d25c..e6c9e6c 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java @@ -25,6 +25,8 @@ import android.text.method.TextKeyListener; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.View; +import android.view.animation.AnimationUtils; +import android.view.animation.Interpolator; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; @@ -42,9 +44,12 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView implements KeyguardSecurityView, OnEditorActionListener, TextWatcher { private final boolean mShowImeAtScreenOn; + private final int mDisappearYTranslation; InputMethodManager mImm; private TextView mPasswordEntry; + private Interpolator mLinearOutSlowInInterpolator; + private Interpolator mFastOutLinearInInterpolator; public KeyguardPasswordView(Context context) { this(context, null); @@ -54,6 +59,12 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView super(context, attrs); mShowImeAtScreenOn = context.getResources(). getBoolean(R.bool.kg_show_ime_at_screen_on); + mDisappearYTranslation = getResources().getDimensionPixelSize( + R.dimen.disappear_y_translation); + mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator( + context, android.R.interpolator.linear_out_slow_in); + mFastOutLinearInInterpolator = AnimationUtils.loadInterpolator( + context, android.R.interpolator.fast_out_linear_in); } protected void resetState() { @@ -72,12 +83,19 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView } @Override - public void onResume(int reason) { + public void onResume(final int reason) { super.onResume(reason); - mPasswordEntry.requestFocus(); - if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) { - mImm.showSoftInput(mPasswordEntry, InputMethodManager.SHOW_IMPLICIT); - } + + // Wait a bit to focus the field so the focusable flag on the window is already set then. + post(new Runnable() { + @Override + public void run() { + mPasswordEntry.requestFocus(); + if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) { + mImm.showSoftInput(mPasswordEntry, InputMethodManager.SHOW_IMPLICIT); + } + } + }); } @Override @@ -239,14 +257,24 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView @Override public void startAppearAnimation() { - // TODO: Fancy animation. - setAlpha(0); - animate().alpha(1).withLayer().setDuration(200); + setAlpha(0f); + setTranslationY(0f); + animate() + .alpha(1) + .withLayer() + .setDuration(300) + .setInterpolator(mLinearOutSlowInInterpolator); } @Override public boolean startDisappearAnimation(Runnable finishRunnable) { - return false; + animate() + .alpha(0f) + .translationY(mDisappearYTranslation) + .setInterpolator(mFastOutLinearInInterpolator) + .setDuration(100) + .withEndAction(finishRunnable); + return true; } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java index 57b7401..e7b0c4c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java @@ -22,6 +22,7 @@ import android.graphics.Rect; import android.util.AttributeSet; import android.view.View; import android.view.ViewStub; +import android.view.WindowInsets; import android.widget.FrameLayout; import com.android.systemui.R; @@ -54,10 +55,9 @@ public class NotificationsQuickSettingsContainer extends FrameLayout } @Override - protected boolean fitSystemWindows(Rect insets) { - setPadding(0, 0, 0, insets.bottom); - insets.bottom = 0; - return true; + public WindowInsets onApplyWindowInsets(WindowInsets insets) { + setPadding(0, 0, 0, insets.getSystemWindowInsetBottom()); + return insets; } @Override diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 3f7c72e..4f6c15e 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -3283,6 +3283,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { // IM dock windows always go to the bottom of the screen. attrs.gravity = Gravity.BOTTOM; mDockLayer = win.getSurfaceLayer(); + } else if (win == mStatusBar && (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) { + pf.left = df.left = of.left = mUnrestrictedScreenLeft; + pf.top = df.top = of.top = mUnrestrictedScreenTop; + pf.right = df.right = of.right = mUnrestrictedScreenWidth + mUnrestrictedScreenLeft; + pf.bottom = df.bottom = of.bottom = mUnrestrictedScreenHeight + mUnrestrictedScreenTop; + cf.left = vf.left = mStableLeft; + cf.top = vf.top = mStableTop; + cf.right = vf.right = mStableRight; + vf.bottom = mStableBottom; + cf.bottom = mContentBottom; } else { // Default policy decor for the default display |