Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b09dd31 authored by Jim Miller's avatar Jim Miller
Browse files

Better flow for SIM PIN/ SIM PUK screens in keyguard.

We now fade between security screens when not coming from selection view.
In the case of SIM PIN/PUK screens, this means we show the user's security
screen without going back to the selector view.

This change also adds a fade animation for when we go between security screens
without going back to the selector view.

This also fixes a bug where we were invoking two checks for the SIM
state - one for ACTION_DOWN and another for ACTION_UP.

Change-Id: I260f9a2e0316cbf26ec7621f774bfdf9956ca488
parent d2a8df95
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 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.
-->

<alpha xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@interpolator/decelerate_quad"
    android:fromAlpha="0.0" android:toAlpha="1.0"
    android:duration="@integer/kg_security_fade_duration" />

+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 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.
-->
<alpha xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@interpolator/accelerate_quad"
    android:fromAlpha="1.0"
    android:toAlpha="0.0"
    android:duration="@integer/kg_security_fade_duration"
/>
+1 −0
Original line number Diff line number Diff line
@@ -18,4 +18,5 @@
-->
<resources>
    <integer name="kg_security_flip_duration">150</integer>
    <integer name="kg_security_fade_duration">150</integer>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -1211,6 +1211,8 @@
  <java-symbol type="anim" name="dock_right_exit" />
  <java-symbol type="anim" name="keyguard_security_animate_in" />
  <java-symbol type="anim" name="keyguard_security_animate_out" />
  <java-symbol type="anim" name="keyguard_security_fade_in" />
  <java-symbol type="anim" name="keyguard_security_fade_out" />
  <java-symbol type="array" name="config_keyboardTapVibePattern" />
  <java-symbol type="array" name="config_longPressVibePattern" />
  <java-symbol type="array" name="config_safeModeDisabledVibePattern" />
+35 −10
Original line number Diff line number Diff line
@@ -130,10 +130,6 @@ public class KeyguardHostView extends KeyguardViewBase {

        // View Flipper
        mViewFlipper = (ViewFlipper) findViewById(R.id.view_flipper);
        mViewFlipper.setInAnimation(AnimationUtils.loadAnimation(mContext,
                R.anim.keyguard_security_animate_in));
        mViewFlipper.setOutAnimation(AnimationUtils.loadAnimation(mContext,
                R.anim.keyguard_security_animate_out));

        // Initialize all security views
        for (int i = 0; i < mViewIds.length; i++) {
@@ -381,12 +377,29 @@ public class KeyguardHostView extends KeyguardViewBase {
                showSecurityScreen(realSecurityId); // switch to the "real" security view
            }
        } else if (authenticated) {
            if (mCurrentSecurityId == SECURITY_PATTERN_ID
                || mCurrentSecurityId == SECURITY_PASSWORD_ID
                || mCurrentSecurityId == SECURITY_ACCOUNT_ID
                || mCurrentSecurityId == SECURITY_BIOMETRIC_ID) {
            switch (mCurrentSecurityId) {
                case SECURITY_PATTERN_ID:
                case SECURITY_PASSWORD_ID:
                case SECURITY_ACCOUNT_ID:
                case SECURITY_BIOMETRIC_ID:
                    finish = true;
                    break;

                case SECURITY_SIM_PIN_ID:
                case SECURITY_SIM_PUK_ID:
                    // Shortcut for SIM PIN/PUK to go to directly to user's security screen or home
                    SecurityMode securityMode = mSecurityModel.getSecurityMode();
                    if (securityMode != SecurityMode.None) {
                        showSecurityScreen(getSecurityViewIdForMode(securityMode));
                    } else {
                        finish = true;
                    }
                    break;

                default:
                    showSecurityScreen(SECURITY_SELECTOR_ID);
                    break;
            }
        } else {
            // Not authenticated but we were asked to dismiss so go back to selector screen.
            showSecurityScreen(SECURITY_SELECTOR_ID);
@@ -480,10 +493,20 @@ public class KeyguardHostView extends KeyguardViewBase {
        newView.onResume();

        mViewMediatorCallback.setNeedsInput(newView.needsInput());
        mCurrentSecurityId = securityViewId;

        // Find and show this child.
        final int childCount = mViewFlipper.getChildCount();

        // If we're go to/from the selector view, do flip animation, otherwise use fade animation.
        final boolean doFlip = mCurrentSecurityId == SECURITY_SELECTOR_ID
                || securityViewId == SECURITY_SELECTOR_ID;
        final int inAnimation = doFlip ? R.anim.keyguard_security_animate_in
                : R.anim.keyguard_security_fade_in;
        final int outAnimation = doFlip ? R.anim.keyguard_security_animate_out
                : R.anim.keyguard_security_fade_out;

        mViewFlipper.setInAnimation(AnimationUtils.loadAnimation(mContext, inAnimation));
        mViewFlipper.setOutAnimation(AnimationUtils.loadAnimation(mContext, outAnimation));
        for (int i = 0; i < childCount; i++) {
            if (securityViewId == mViewFlipper.getChildAt(i).getId()) {
                mViewFlipper.setDisplayedChild(i);
@@ -495,6 +518,8 @@ public class KeyguardHostView extends KeyguardViewBase {
        if (securityViewId == SECURITY_SELECTOR_ID) {
            setOnDismissRunnable(null);
        }

        mCurrentSecurityId = securityViewId;
    }

    @Override
Loading