diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-12-22 20:56:50 +0100 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2015-01-07 15:20:37 +0100 |
commit | 6b88cdfba770efc5722338c240ccaada13d7b0d4 (patch) | |
tree | c98de02c0c0ac710351dce64822b13bd9c0dba34 | |
parent | a9ef7929b87dc92cb9d4ed65abbaf4752886e613 (diff) | |
download | frameworks_base-6b88cdfba770efc5722338c240ccaada13d7b0d4.zip frameworks_base-6b88cdfba770efc5722338c240ccaada13d7b0d4.tar.gz frameworks_base-6b88cdfba770efc5722338c240ccaada13d7b0d4.tar.bz2 |
Remove dead code #8: Remove old keyguard "bouncer"
Also squashes KeyguardViewBase and KeyguardSimpleHostView into
KeyguardHostView, uses a constant for the user activity timeout
(custom value no longer used).
Change-Id: I919b7d3de1dd1590b20e0f14f0e193ee2b3dc21e
24 files changed, 54 insertions, 390 deletions
diff --git a/packages/Keyguard/res/layout/keyguard_bouncer.xml b/packages/Keyguard/res/layout/keyguard_bouncer.xml index 296efb3..8c80e78 100644 --- a/packages/Keyguard/res/layout/keyguard_bouncer.xml +++ b/packages/Keyguard/res/layout/keyguard_bouncer.xml @@ -24,7 +24,7 @@ <include style="@style/BouncerSecurityContainer" - layout="@layout/keyguard_simple_host_view" + layout="@layout/keyguard_host_view" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </FrameLayout> diff --git a/packages/Keyguard/res/layout/keyguard_simple_host_view.xml b/packages/Keyguard/res/layout/keyguard_host_view.xml index 28ce265..3635aff 100644 --- a/packages/Keyguard/res/layout/keyguard_simple_host_view.xml +++ b/packages/Keyguard/res/layout/keyguard_host_view.xml @@ -19,7 +19,7 @@ <!-- This is the host view that generally contains two sub views: the widget view and the security view. --> -<com.android.keyguard.KeyguardSimpleHostView +<com.android.keyguard.KeyguardHostView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/res-auto" android:id="@+id/keyguard_host_view" @@ -48,5 +48,5 @@ </com.android.keyguard.KeyguardSecurityViewFlipper> </com.android.keyguard.KeyguardSecurityContainer> -</com.android.keyguard.KeyguardSimpleHostView> +</com.android.keyguard.KeyguardHostView> diff --git a/packages/Keyguard/res/layout/keyguard_password_view.xml b/packages/Keyguard/res/layout/keyguard_password_view.xml index b7d5d30..cff2fc7 100644 --- a/packages/Keyguard/res/layout/keyguard_password_view.xml +++ b/packages/Keyguard/res/layout/keyguard_password_view.xml @@ -41,7 +41,6 @@ <!-- Password entry field --> <FrameLayout - android:id="@+id/keyguard_bouncer_frame" android:layout_height="wrap_content" android:layout_width="280dp" android:layout_gravity="center_horizontal" diff --git a/packages/Keyguard/res/layout/keyguard_pattern_view.xml b/packages/Keyguard/res/layout/keyguard_pattern_view.xml index 1fb0420..6148065 100644 --- a/packages/Keyguard/res/layout/keyguard_pattern_view.xml +++ b/packages/Keyguard/res/layout/keyguard_pattern_view.xml @@ -41,6 +41,7 @@ android:clipToPadding="false"> <LinearLayout + android:id="@+id/container" android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="vertical" @@ -53,18 +54,10 @@ android:layout_height="wrap_content" /> - <FrameLayout - android:id="@+id/keyguard_bouncer_frame" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:clipChildren="false" - android:clipToPadding="false" - > <com.android.internal.widget.LockPatternView android:id="@+id/lockPatternView" android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_height="0dp" android:layout_weight="1" android:layout_marginEnd="8dip" android:layout_marginBottom="4dip" @@ -74,7 +67,7 @@ android:contentDescription="@string/keyguard_accessibility_pattern_area" android:clipChildren="false" android:clipToPadding="false" /> - </FrameLayout> + <include layout="@layout/keyguard_eca" android:id="@+id/keyguard_selector_fade_container" android:layout_width="match_parent" diff --git a/packages/Keyguard/res/layout/keyguard_pin_view.xml b/packages/Keyguard/res/layout/keyguard_pin_view.xml index 2e7464b..d3fb982 100644 --- a/packages/Keyguard/res/layout/keyguard_pin_view.xml +++ b/packages/Keyguard/res/layout/keyguard_pin_view.xml @@ -33,7 +33,7 @@ android:layout_height="wrap_content" /> <LinearLayout - android:id="@+id/keyguard_bouncer_frame" + android:id="@+id/container" android:layout_width="match_parent" android:layout_height="0dp" android:orientation="vertical" diff --git a/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml b/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml index 929fa09..b0a93e6 100644 --- a/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml +++ b/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml @@ -39,7 +39,6 @@ android:layout_height="wrap_content" /> <LinearLayout - android:id="@+id/keyguard_bouncer_frame" android:layout_width="match_parent" android:layout_height="0dp" android:orientation="vertical" diff --git a/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml b/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml index 0cf802d..cf41bd3 100644 --- a/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml +++ b/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml @@ -40,7 +40,6 @@ android:layout_height="wrap_content" /> <LinearLayout - android:id="@+id/keyguard_bouncer_frame" android:layout_width="match_parent" android:layout_height="0dp" android:orientation="vertical" diff --git a/packages/Keyguard/res/values/strings.xml b/packages/Keyguard/res/values/strings.xml index 25fd10e..8b18b2e 100644 --- a/packages/Keyguard/res/values/strings.xml +++ b/packages/Keyguard/res/values/strings.xml @@ -113,14 +113,6 @@ <!-- Accessibility description of the SIM PUK password view. [CHAR_LIMIT=none] --> <string name="keyguard_accessibility_sim_puk_area">SIM PUK area</string> - <!-- Accessibility description for when the device prompts the user to dismiss keyguard - in order to complete an action. This will be followed by a message about the current - security option (e.g. "Pattern unlock."). [CHAR LIMIT=NONE] --> - <string name="keyguard_accessibility_show_bouncer">Unlock to continue</string> - - <!-- Accessibility description for when the bouncer prompt is dismissed. [CHAR LIMIT=NONE] --> - <string name="keyguard_accessibility_hide_bouncer">Launch canceled</string> - <!-- Accessibility description for the text view that indicates when the next alarm is set (not shown on screen). [CHAR_LIMIT=none] --> <string name="keyguard_accessibility_next_alarm">Next alarm set for <xliff:g id="alarm" example="Fri 8:30 AM">%1$s</xliff:g></string> 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(); diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 3f75503..f9e0219 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -474,11 +474,6 @@ public class KeyguardViewMediator extends SystemUI { } @Override - public void onUserActivityTimeoutChanged() { - mStatusBarKeyguardViewManager.updateUserActivityTimeout(); - } - - @Override public void keyguardDonePending() { mKeyguardDonePending = true; mHideAnimationRun = true; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index f1538a5..21d70ba 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -103,7 +103,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; -import static com.android.keyguard.KeyguardViewBase.OnDismissAction; +import static com.android.keyguard.KeyguardHostView.OnDismissAction; public abstract class BaseStatusBar extends SystemUI implements CommandQueue.Callbacks, ActivatableNotificationView.OnActivatedListener, 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 c17ae67..34400c4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -24,12 +24,11 @@ import android.view.View; import android.view.ViewGroup; import com.android.internal.widget.LockPatternUtils; -import com.android.keyguard.KeyguardViewBase; +import com.android.keyguard.KeyguardHostView; import com.android.keyguard.R; import com.android.keyguard.ViewMediatorCallback; -import com.android.systemui.keyguard.KeyguardViewMediator; -import static com.android.keyguard.KeyguardViewBase.OnDismissAction; +import static com.android.keyguard.KeyguardHostView.OnDismissAction; import static com.android.keyguard.KeyguardSecurityModel.SecurityMode; /** @@ -42,7 +41,7 @@ public class KeyguardBouncer { private LockPatternUtils mLockPatternUtils; private ViewGroup mContainer; private StatusBarWindowManager mWindowManager; - private KeyguardViewBase mKeyguardView; + private KeyguardHostView mKeyguardView; private ViewGroup mRoot; private boolean mShowingSoon; private Choreographer mChoreographer = Choreographer.getInstance(); @@ -138,16 +137,6 @@ public class KeyguardBouncer { } } - public long getUserActivityTimeout() { - if (mKeyguardView != null) { - long timeout = mKeyguardView.getUserActivityTimeout(); - if (timeout >= 0) { - return timeout; - } - } - return KeyguardViewMediator.AWAKE_INTERVAL_DEFAULT_MS; - } - public boolean isShowing() { return mShowingSoon || (mRoot != null && mRoot.getVisibility() == View.VISIBLE); } @@ -169,7 +158,7 @@ public class KeyguardBouncer { private void inflateView() { removeView(); mRoot = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.keyguard_bouncer, null); - mKeyguardView = (KeyguardViewBase) mRoot.findViewById(R.id.keyguard_host_view); + mKeyguardView = (KeyguardHostView) mRoot.findViewById(R.id.keyguard_host_view); mKeyguardView.setLockPatternUtils(mLockPatternUtils); mKeyguardView.setViewMediatorCallback(mCallback); mContainer.addView(mRoot, mContainer.getChildCount()); 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 da63009..5bff79a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -117,7 +117,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import com.android.internal.statusbar.StatusBarIcon; -import com.android.keyguard.KeyguardViewBase.OnDismissAction; +import com.android.keyguard.KeyguardHostView.OnDismissAction; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.BatteryMeterView; import com.android.systemui.DemoMode; 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 449564c..3155efb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -32,7 +32,7 @@ import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.ViewMediatorCallback; -import static com.android.keyguard.KeyguardViewBase.OnDismissAction; +import static com.android.keyguard.KeyguardHostView.OnDismissAction; /** * Manages creating, showing, hiding and resetting the keyguard within the status bar. Calls back @@ -187,10 +187,6 @@ public class StatusBarKeyguardViewManager { mStatusBarWindowManager.setKeyguardNeedsInput(needsInput); } - public void updateUserActivityTimeout() { - mStatusBarWindowManager.setKeyguardUserActivityTimeout(mBouncer.getUserActivityTimeout()); - } - public void setOccluded(boolean occluded) { if (occluded && !mOccluded && mShowing) { if (mPhoneStatusBar.isInLaunchTransition()) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java index 0dbdca1..eba7d9f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java @@ -27,6 +27,7 @@ import android.view.ViewGroup; import android.view.WindowManager; import com.android.keyguard.R; +import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.statusbar.BaseStatusBar; import com.android.systemui.statusbar.StatusBarState; @@ -144,7 +145,7 @@ public class StatusBarWindowManager { if (state.isKeyguardShowingAndNotOccluded() && state.statusBarState == StatusBarState.KEYGUARD && !state.qsExpanded) { - mLpChanged.userActivityTimeout = state.keyguardUserActivityTimeout; + mLpChanged.userActivityTimeout = KeyguardViewMediator.AWAKE_INTERVAL_DEFAULT_MS; } else { mLpChanged.userActivityTimeout = -1; } @@ -201,11 +202,6 @@ public class StatusBarWindowManager { apply(mCurrentState); } - public void setKeyguardUserActivityTimeout(long timeout) { - mCurrentState.keyguardUserActivityTimeout = timeout; - apply(mCurrentState); - } - public void setBouncerShowing(boolean showing) { mCurrentState.bouncerShowing = showing; apply(mCurrentState); @@ -235,7 +231,6 @@ public class StatusBarWindowManager { boolean keyguardNeedsInput; boolean statusBarExpanded; boolean statusBarFocusable; - long keyguardUserActivityTimeout; boolean bouncerShowing; boolean keyguardFadingAway; boolean qsExpanded; |