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

Commit 67826416 authored by The Android Open Source Project's avatar The Android Open Source Project
Browse files

auto import from //branches/cupcake/...@130745

parent f7bff512
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -28,8 +28,10 @@ import android.content.ServiceConnection;
import android.graphics.Rect;
import android.os.IBinder;
import android.os.RemoteException;
import android.text.Editable;
import android.text.InputFilter;
import android.text.LoginFilter;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -47,7 +49,7 @@ import android.widget.TextView;
 * IAccountsService.
 */
public class AccountUnlockScreen extends RelativeLayout implements KeyguardScreen,
        View.OnClickListener, ServiceConnection {
        View.OnClickListener, ServiceConnection, TextWatcher {


    private static final String LOCK_PATTERN_PACKAGE = "com.android.settings";
@@ -87,8 +89,10 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree

        mLogin = (EditText) findViewById(R.id.login);
        mLogin.setFilters(new InputFilter[] { new LoginFilter.UsernameFilterGeneric() } );
        mLogin.addTextChangedListener(this);

        mPassword = (EditText) findViewById(R.id.password);
        mPassword.addTextChangedListener(this);

        mOk = (Button) findViewById(R.id.ok);
        mOk.setOnClickListener(this);
@@ -105,6 +109,16 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
        }
    }

    public void afterTextChanged(Editable s) {
    }

    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }

    public void onTextChanged(CharSequence s, int start, int before, int count) {
        mCallback.pokeWakelock();
    }

    @Override
    protected boolean onRequestFocusInDescendants(int direction,
            Rect previouslyFocusedRect) {
@@ -112,6 +126,11 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
        return mLogin.requestFocus(direction, previouslyFocusedRect);
    }

    /** {@inheritDoc} */
    public boolean needsInput() {
        return true;
    }
    
    /** {@inheritDoc} */
    public void onPause() {

@@ -132,6 +151,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree

    /** {@inheritDoc} */
    public void onClick(View v) {
        mCallback.pokeWakelock();
        if (v == mOk) {
            if (checkPassword()) {
                // clear out forgotten password
+6 −1
Original line number Diff line number Diff line
@@ -22,6 +22,12 @@ package com.android.internal.policy.impl;
 */
public interface KeyguardScreen {

    /**
     * Return true if your view needs input, so should allow the soft
     * keyboard to be displayed.
     */
    boolean needsInput();
    
    /**
     * This screen is no longer in front of the user.
     */
@@ -36,5 +42,4 @@ public interface KeyguardScreen {
     * This view is going away; a hook to do cleanup.
     */
    void cleanUp();

}
+2 −2
Original line number Diff line number Diff line
@@ -375,12 +375,12 @@ public class KeyguardUpdateMonitor {
    }

    /**
     * Is the keyboard currently open?
     * Is the (hard) keyboard currently open?
     */
    boolean queryKeyboardOpen() {
        final Configuration configuration = mContext.getResources().getConfiguration();

        return configuration.keyboardHidden == Configuration.KEYBOARDHIDDEN_NO;
        return configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO;
    }

    /**
+31 −5
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.internal.policy.impl;
import com.android.internal.R;

import android.content.Context;
import android.content.pm.ActivityInfo;
import android.graphics.PixelFormat;
import android.graphics.Canvas;
import android.util.Log;
@@ -34,7 +35,7 @@ import android.widget.FrameLayout;
 * the wake lock and report that the keyguard is done, which is in turn,
 * reported to this class by the current {@link KeyguardViewBase}.
 */
public class KeyguardViewManager {
public class KeyguardViewManager implements KeyguardWindowController {
    private final static boolean DEBUG = false;
    private static String TAG = "KeyguardViewManager";

@@ -45,6 +46,9 @@ public class KeyguardViewManager {

    private final KeyguardUpdateMonitor mUpdateMonitor;

    private WindowManager.LayoutParams mWindowLayoutParams;
    private boolean mNeedsInput = false;
    
    private FrameLayout mKeyguardHost;
    private KeyguardViewBase mKeyguardView;

@@ -97,19 +101,27 @@ public class KeyguardViewManager {

            final int stretch = ViewGroup.LayoutParams.FILL_PARENT;
            int flags = WindowManager.LayoutParams.FLAG_DITHER
                    | WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
                    | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
                    /*| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
                    | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR*/
                    | WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
            if (!mNeedsInput) {
                flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
            }
            WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
                    stretch, stretch, WindowManager.LayoutParams.TYPE_KEYGUARD,
                    flags, PixelFormat.OPAQUE);
            lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
            lp.windowAnimations = com.android.internal.R.style.Animation_LockScreen;
            lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
            lp.setTitle("Keyguard");
            mWindowLayoutParams = lp;

            mViewManager.addView(mKeyguardHost, lp);
        }

        if (mKeyguardView == null) {
            if (DEBUG) Log.d(TAG, "keyguard view is null, creating it...");
            mKeyguardView = mKeyguardViewProperties.createKeyguardView(mContext, mUpdateMonitor);
            mKeyguardView = mKeyguardViewProperties.createKeyguardView(mContext, mUpdateMonitor, this);
            mKeyguardView.setId(R.id.lock_screen);
            mKeyguardView.setCallback(mCallback);

@@ -128,6 +140,20 @@ public class KeyguardViewManager {
        mKeyguardView.requestFocus();
    }

    public void setNeedsInput(boolean needsInput) {
        mNeedsInput = needsInput;
        if (mWindowLayoutParams != null) {
            if (needsInput) {
                mWindowLayoutParams.flags &=
                    ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
            } else {
                mWindowLayoutParams.flags |=
                    WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
            }
            mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
        }
    }
    
    /**
     * Reset the state of the view.
     */
@@ -183,7 +209,7 @@ public class KeyguardViewManager {
    public synchronized void hide() {
        if (DEBUG) Log.d(TAG, "hide()");
        if (mKeyguardHost != null) {
            mKeyguardHost.setVisibility(View.INVISIBLE);
            mKeyguardHost.setVisibility(View.GONE);
            if (mKeyguardView != null) {
                mKeyguardHost.removeView(mKeyguardView);
                mKeyguardView.cleanUp();
+4 −1
Original line number Diff line number Diff line
@@ -29,9 +29,12 @@ public interface KeyguardViewProperties {
     * Create a keyguard view.
     * @param context the context to use when creating the view.
     * @param updateMonitor configuration may be based on this.
     * @param controller for talking back with the containing window.
     * @return the view.
     */
    KeyguardViewBase createKeyguardView(Context context, KeyguardUpdateMonitor updateMonitor);
    KeyguardViewBase createKeyguardView(Context context,
            KeyguardUpdateMonitor updateMonitor,
            KeyguardWindowController controller);

    /**
     * Would the keyguard be secure right now?
Loading