diff options
Diffstat (limited to 'packages/Keyguard/src/com/android/keyguard')
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java | 17 | ||||
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java (renamed from packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java) | 61 | ||||
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java | 8 | ||||
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java | 27 | ||||
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java | 34 | ||||
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java | 14 | ||||
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java | 24 | ||||
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewHelper.java | 94 | ||||
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java | 84 | ||||
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java | 6 |
10 files changed, 38 insertions, 331 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java index a411df3..b03176c 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java @@ -37,7 +37,6 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout protected LockPatternUtils mLockPatternUtils; protected SecurityMessageDisplay mSecurityMessageDisplay; protected View mEcaView; - private Drawable mBouncerFrame; protected boolean mEnableHaptics; // To avoid accidental lockout due to events while the device in in the pocket, ignore @@ -86,10 +85,6 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout mLockPatternUtils = new LockPatternUtils(mContext); mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this); mEcaView = findViewById(R.id.keyguard_selector_fade_container); - View bouncerFrameView = findViewById(R.id.keyguard_bouncer_frame); - if (bouncerFrameView != null) { - mBouncerFrame = bouncerFrameView.getBackground(); - } } /* @@ -183,18 +178,6 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout } @Override - public void showBouncer(int duration) { - KeyguardSecurityViewHelper. - showBouncer(mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration); - } - - @Override - public void hideBouncer(int duration) { - KeyguardSecurityViewHelper. - hideBouncer(mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration); - } - - @Override public boolean startDisappearAnimation(Runnable finishRunnable) { return false; } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java index b303dca..7fa5055 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java @@ -46,7 +46,7 @@ import java.io.File; * Handles intercepting of media keys that still work when the keyguard is * showing. */ -public abstract class KeyguardViewBase extends FrameLayout implements SecurityCallback { +public class KeyguardHostView extends FrameLayout implements SecurityCallback { public interface OnDismissAction { /** @@ -61,6 +61,27 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa protected LockPatternUtils mLockPatternUtils; private OnDismissAction mDismissAction; + private final KeyguardUpdateMonitorCallback mUpdateCallback = + new KeyguardUpdateMonitorCallback() { + + @Override + public void onUserSwitchComplete(int userId) { + getSecurityContainer().showPrimarySecurityScreen(false /* turning off */); + } + + @Override + public void onTrustInitiatedByUser(int userId) { + if (userId != mLockPatternUtils.getCurrentUser()) return; + if (!isAttachedToWindow()) return; + + if (isVisibleToUser()) { + dismiss(false /* authenticated */); + } else { + mViewMediatorCallback.playTrustedSound(); + } + } + }; + // Whether the volume keys should be handled by keyguard. If true, then // they will be handled here for specific media types such as music, otherwise // the audio service will bring up the volume dialog. @@ -70,12 +91,13 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa private KeyguardSecurityContainer mSecurityContainer; - public KeyguardViewBase(Context context) { + public KeyguardHostView(Context context) { this(context, null); } - public KeyguardViewBase(Context context, AttributeSet attrs) { + public KeyguardHostView(Context context, AttributeSet attrs) { super(context, attrs); + KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateCallback); } @Override @@ -123,14 +145,6 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa return dismiss(false); } - protected void showBouncer(boolean show) { - CharSequence what = getContext().getResources().getText( - show ? R.string.keyguard_accessibility_show_bouncer - : R.string.keyguard_accessibility_hide_bouncer); - announceForAccessibility(what); - announceCurrentSecurityMethod(); - } - public boolean handleBackKey() { if (mSecurityContainer.getCurrentSecuritySelection() != SecurityMode.None) { mSecurityContainer.dismiss(false); @@ -139,10 +153,6 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa return false; } - protected void announceCurrentSecurityMethod() { - mSecurityContainer.announceCurrentSecurityMethod(); - } - protected KeyguardSecurityContainer getSecurityContainer() { return mSecurityContainer; } @@ -191,12 +201,6 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa } } - protected void onUserActivityTimeoutChanged() { - if (mViewMediatorCallback != null) { - mViewMediatorCallback.onUserActivityTimeoutChanged(); - } - } - /** * Called when the Keyguard is not actively shown anymore on the screen. */ @@ -262,13 +266,9 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa /** * Called before this view is being removed. */ - abstract public void cleanUp(); - - /** - * Gets the desired user activity timeout in milliseconds, or -1 if the - * default should be used. - */ - abstract public long getUserActivityTimeout(); + public void cleanUp() { + getSecurityContainer().onPause(); + } @Override public boolean dispatchKeyEvent(KeyEvent event) { @@ -424,10 +424,5 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa return mSecurityContainer.getCurrentSecurityMode(); } - protected abstract void onUserSwitching(boolean switching); - - protected abstract void onCreateOptions(Bundle options); - - protected abstract void onExternalMotionEvent(MotionEvent event); } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java index d2291d7..d0be855 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java @@ -29,7 +29,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { private final AppearAnimationUtils mAppearAnimationUtils; private final DisappearAnimationUtils mDisappearAnimationUtils; - private ViewGroup mKeyguardBouncerFrame; + private ViewGroup mContainer; private ViewGroup mRow0; private ViewGroup mRow1; private ViewGroup mRow2; @@ -67,7 +67,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { protected void onFinishInflate() { super.onFinishInflate(); - mKeyguardBouncerFrame = (ViewGroup) findViewById(R.id.keyguard_bouncer_frame); + mContainer = (ViewGroup) findViewById(R.id.container); mRow0 = (ViewGroup) findViewById(R.id.row0); mRow1 = (ViewGroup) findViewById(R.id.row1); mRow2 = (ViewGroup) findViewById(R.id.row2); @@ -146,8 +146,8 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { } private void enableClipping(boolean enable) { - mKeyguardBouncerFrame.setClipToPadding(enable); - mKeyguardBouncerFrame.setClipChildren(enable); + mContainer.setClipToPadding(enable); + mContainer.setClipChildren(enable); mRow1.setClipToPadding(enable); mRow2.setClipToPadding(enable); mRow3.setClipToPadding(enable); diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java index a98c9d0..62f1b69 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java @@ -20,7 +20,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Rect; -import android.graphics.drawable.Drawable; import android.os.CountDownTimer; import android.os.SystemClock; import android.text.TextUtils; @@ -81,8 +80,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit private Rect mTempRect = new Rect(); private SecurityMessageDisplay mSecurityMessageDisplay; private View mEcaView; - private Drawable mBouncerFrame; - private ViewGroup mKeyguardBouncerFrame; + private ViewGroup mContainer; private KeyguardMessageArea mHelpMessage; private int mDisappearYTranslation; @@ -140,12 +138,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this); mEcaView = findViewById(R.id.keyguard_selector_fade_container); - View bouncerFrameView = findViewById(R.id.keyguard_bouncer_frame); - if (bouncerFrameView != null) { - mBouncerFrame = bouncerFrameView.getBackground(); - } - - mKeyguardBouncerFrame = (ViewGroup) findViewById(R.id.keyguard_bouncer_frame); + mContainer = (ViewGroup) findViewById(R.id.container); mHelpMessage = (KeyguardMessageArea) findViewById(R.id.keyguard_message_area); } @@ -284,18 +277,6 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit } @Override - public void showBouncer(int duration) { - KeyguardSecurityViewHelper. - showBouncer(mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration); - } - - @Override - public void hideBouncer(int duration) { - KeyguardSecurityViewHelper. - hideBouncer(mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration); - } - - @Override public void startAppearAnimation() { enableClipping(false); setAlpha(1f); @@ -355,8 +336,8 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit private void enableClipping(boolean enable) { setClipChildren(enable); - mKeyguardBouncerFrame.setClipToPadding(enable); - mKeyguardBouncerFrame.setClipChildren(enable); + mContainer.setClipToPadding(enable); + mContainer.setClipChildren(enable); } @Override diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java index 50a6adf..4f5638b 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -20,7 +20,6 @@ import android.app.AlertDialog; import android.app.admin.DevicePolicyManager; import android.content.Context; import android.os.UserHandle; -import android.os.UserManager; import android.util.AttributeSet; import android.util.Log; import android.util.Slog; @@ -46,7 +45,6 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe private KeyguardSecurityViewFlipper mSecurityViewFlipper; private boolean mIsVerifyUnlockOnly; private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid; - private boolean mIsBouncing; private SecurityCallback mSecurityCallback; private final KeyguardUpdateMonitor mUpdateMonitor; @@ -106,13 +104,6 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe return false; } - void updateSecurityViews(boolean isBouncing) { - int children = mSecurityViewFlipper.getChildCount(); - for (int i = 0; i < children; i++) { - updateSecurityView(mSecurityViewFlipper.getChildAt(i), isBouncing); - } - } - public void announceCurrentSecurityMethod() { View v = (View) getSecurityView(mCurrentSecuritySelection); if (v != null) { @@ -136,24 +127,18 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe if (DEBUG) Log.v(TAG, "inflating id = " + layoutId); View v = inflater.inflate(layoutId, mSecurityViewFlipper, false); mSecurityViewFlipper.addView(v); - updateSecurityView(v, mIsBouncing); + updateSecurityView(v); view = (KeyguardSecurityView)v; } return view; } - private void updateSecurityView(View view, boolean isBouncing) { - mIsBouncing = isBouncing; + private void updateSecurityView(View view) { if (view instanceof KeyguardSecurityView) { KeyguardSecurityView ksv = (KeyguardSecurityView) view; ksv.setKeyguardCallback(mCallback); ksv.setLockPatternUtils(mLockPatternUtils); - if (isBouncing) { - ksv.showBouncer(0); - } else { - ksv.hideBouncer(0); - } } else { Log.w(TAG, "View " + view + " is not a KeyguardSecurityView"); } @@ -342,7 +327,6 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe /** * Shows the next security screen if there is one. * @param authenticated true if the user entered the correct authentication - * @param authenticated * @return true if keyguard is done */ boolean showNextSecurityScreenOrFinish(boolean authenticated) { @@ -440,20 +424,6 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe return null; } - public void showBouncer(int duration) { - KeyguardSecurityViewFlipper flipper = getFlipper(); - if (flipper != null) { - flipper.showBouncer(duration); - } - } - - public void hideBouncer(int duration) { - KeyguardSecurityViewFlipper flipper = getFlipper(); - if (flipper != null) { - flipper.hideBouncer(duration); - } - } - private KeyguardSecurityCallback mCallback = new KeyguardSecurityCallback() { public void userActivity() { diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java index 78fcb9f..5b50236 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java @@ -72,20 +72,6 @@ public interface KeyguardSecurityView { void showUsabilityHint(); /** - * Place the security view into bouncer mode. - * Animate transisiton if duration is non-zero. - * @param duration millisends for the transisiton animation. - */ - void showBouncer(int duration); - - /** - * Place the security view into non-bouncer mode. - * Animate transisiton if duration is non-zero. - * @param duration millisends for the transisiton animation. - */ - void hideBouncer(int duration); - - /** * Starts the animation which should run when the security view appears. */ void startAppearAnimation(); diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java index ea5c304..b5eda90 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java @@ -135,30 +135,6 @@ public class KeyguardSecurityViewFlipper extends ViewFlipper implements Keyguard } @Override - public void showBouncer(int duration) { - KeyguardSecurityView active = getSecurityView(); - for (int i = 0; i < getChildCount(); i++) { - View child = getChildAt(i); - if (child instanceof KeyguardSecurityView) { - KeyguardSecurityView ksv = (KeyguardSecurityView) child; - ksv.showBouncer(ksv == active ? duration : 0); - } - } - } - - @Override - public void hideBouncer(int duration) { - KeyguardSecurityView active = getSecurityView(); - for (int i = 0; i < getChildCount(); i++) { - View child = getChildAt(i); - if (child instanceof KeyguardSecurityView) { - KeyguardSecurityView ksv = (KeyguardSecurityView) child; - ksv.hideBouncer(ksv == active ? duration : 0); - } - } - } - - @Override public void startAppearAnimation() { KeyguardSecurityView ksv = getSecurityView(); if (ksv != null) { diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewHelper.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewHelper.java deleted file mode 100644 index 67a6f52..0000000 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewHelper.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -package com.android.keyguard; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.ObjectAnimator; -import android.graphics.drawable.Drawable; -import android.view.View; - -/** - * Some common functions that are useful for KeyguardSecurityViews. - */ -public class KeyguardSecurityViewHelper { - - public static void showBouncer(SecurityMessageDisplay securityMessageDisplay, - final View ecaView, Drawable bouncerFrame, int duration) { - if (securityMessageDisplay != null) { - securityMessageDisplay.showBouncer(duration); - } - if (ecaView != null) { - if (duration > 0) { - Animator anim = ObjectAnimator.ofFloat(ecaView, "alpha", 0f); - anim.setDuration(duration); - anim.addListener(new AnimatorListenerAdapter() { - private boolean mCanceled; - @Override - public void onAnimationCancel(Animator animation) { - // Fail safe and show the emergency button in onAnimationEnd() - mCanceled = true; - ecaView.setAlpha(1f); - } - @Override - public void onAnimationEnd(Animator animation) { - ecaView.setVisibility(mCanceled ? View.VISIBLE : View.INVISIBLE); - } - }); - anim.start(); - } else { - ecaView.setAlpha(0f); - ecaView.setVisibility(View.INVISIBLE); - } - } - if (bouncerFrame != null) { - if (duration > 0) { - Animator anim = ObjectAnimator.ofInt(bouncerFrame, "alpha", 0, 255); - anim.setDuration(duration); - anim.start(); - } else { - bouncerFrame.setAlpha(255); - } - } - } - - public static void hideBouncer(SecurityMessageDisplay securityMessageDisplay, - View ecaView, Drawable bouncerFrame, int duration) { - if (securityMessageDisplay != null) { - securityMessageDisplay.hideBouncer(duration); - } - if (ecaView != null) { - ecaView.setVisibility(View.VISIBLE); - if (duration > 0) { - Animator anim = ObjectAnimator.ofFloat(ecaView, "alpha", 1f); - anim.setDuration(duration); - anim.start(); - } else { - ecaView.setAlpha(1f); - } - } - if (bouncerFrame != null) { - if (duration > 0) { - Animator anim = ObjectAnimator.ofInt(bouncerFrame, "alpha", 255, 0); - anim.setDuration(duration); - anim.start(); - } else { - bouncerFrame.setAlpha(0); - } - } - } -} diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java deleted file mode 100644 index 828c921..0000000 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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; - -import android.content.Context; -import android.os.Bundle; -import android.util.AttributeSet; -import android.view.MotionEvent; - -public class KeyguardSimpleHostView extends KeyguardViewBase { - - public KeyguardSimpleHostView(Context context, AttributeSet attrs) { - super(context, attrs); - KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateCallback); - } - - @Override - protected void showBouncer(boolean show) { - super.showBouncer(show); - if (show) { - getSecurityContainer().showBouncer(250); - } else { - getSecurityContainer().hideBouncer(250); - } - } - - @Override - public void cleanUp() { - getSecurityContainer().onPause(); - } - - @Override - public long getUserActivityTimeout() { - return -1; // not used - } - - @Override - protected void onUserSwitching(boolean switching) { - // TODO Auto-generated method stub - } - - @Override - protected void onCreateOptions(Bundle options) { - // TODO Auto-generated method stub - } - - @Override - protected void onExternalMotionEvent(MotionEvent event) { - // TODO Auto-generated method stub - } - - private KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() { - @Override - public void onUserSwitchComplete(int userId) { - getSecurityContainer().showPrimarySecurityScreen(false /* turning off */); - } - - @Override - public void onTrustInitiatedByUser(int userId) { - if (userId != mLockPatternUtils.getCurrentUser()) return; - if (!isAttachedToWindow()) return; - - if (isVisibleToUser()) { - dismiss(false /* authenticated */); - } else { - mViewMediatorCallback.playTrustedSound(); - } - } - }; -} diff --git a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java index ab69a0c..f327078 100644 --- a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java +++ b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java @@ -47,12 +47,6 @@ public interface ViewMediatorCallback { 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(); |