diff --git a/core/java/com/android/internal/widget/PasswordEntryKeyboard.java b/core/java/com/android/internal/widget/PasswordEntryKeyboard.java
index 51f7f69a5f4b0..c90147236c42c 100644
--- a/core/java/com/android/internal/widget/PasswordEntryKeyboard.java
+++ b/core/java/com/android/internal/widget/PasswordEntryKeyboard.java
@@ -216,61 +216,6 @@ public class PasswordEntryKeyboard extends Keyboard {
}
}
- /**
- * Sets keyboard extension. Keyboard extension is shown when input is detected above keyboard
- * while keyboard has focus.
- *
- * @param resId
- */
- public void setExtension(int resId) {
- mExtensionResId = resId;
- }
-
- /**
- * Get current extesion resource id.
- *
- * @return resource id, 0 if not set.
- */
- public int getExtension() {
- return mExtensionResId;
- }
-
- private void updateSpaceBarForLocale() {
- if (mLocale != null) {
- // Create the graphic for spacebar
- Bitmap buffer = Bitmap.createBitmap(mSpaceKey.width, mSpaceIcon.getIntrinsicHeight(),
- Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(buffer);
- canvas.drawColor(0x00000000, PorterDuff.Mode.CLEAR);
- Paint paint = new Paint();
- paint.setAntiAlias(true);
- // TODO: Make the text size a customizable attribute
- paint.setTextSize(22);
- paint.setTextAlign(Align.CENTER);
- // Draw a drop shadow for the text
- paint.setShadowLayer(1f, 0, 0, 0xFF000000);
- paint.setColor(0x80C0C0C0);
- canvas.drawText(mLocale.getDisplayLanguage(mLocale),
- buffer.getWidth() / 2, - paint.ascent() + 2, paint);
- int x = (buffer.getWidth() - mSpaceIcon.getIntrinsicWidth()) / 2;
- int y = buffer.getHeight() - mSpaceIcon.getIntrinsicHeight();
- mSpaceIcon.setBounds(x, y,
- x + mSpaceIcon.getIntrinsicWidth(), y + mSpaceIcon.getIntrinsicHeight());
- mSpaceIcon.draw(canvas);
- mSpaceKey.icon = new BitmapDrawable(mRes, buffer);
- mSpaceKey.repeatable = false;
- } else {
- mSpaceKey.icon = mRes.getDrawable(R.drawable.sym_keyboard_space);
- mSpaceKey.repeatable = true;
- }
- }
-
- public void setLanguage(Locale locale) {
- if (mLocale != null && mLocale.equals(locale)) return;
- mLocale = locale;
- updateSpaceBarForLocale();
- }
-
static class LatinKey extends Keyboard.Key {
private boolean mShiftLockEnabled;
private boolean mEnabled = true;
diff --git a/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java b/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java
index b809afc867048..c2862b0cd1c80 100644
--- a/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java
+++ b/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java
@@ -22,15 +22,11 @@ import android.inputmethodservice.KeyboardView;
import android.inputmethodservice.KeyboardView.OnKeyboardActionListener;
import android.os.Handler;
import android.os.SystemClock;
-import android.text.Editable;
-import android.text.Selection;
-import android.util.Log;
+import android.provider.Settings;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewRoot;
-import android.view.inputmethod.InputConnection;
-import android.widget.EditText;
import com.android.internal.R;
public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener {
@@ -40,7 +36,6 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener {
private static final int KEYBOARD_STATE_NORMAL = 0;
private static final int KEYBOARD_STATE_SHIFTED = 1;
private static final int KEYBOARD_STATE_CAPSLOCK = 2;
- private static final String TAG = "PasswordEntryKeyboardHelper";
private int mKeyboardMode = KEYBOARD_MODE_ALPHA;
private int mKeyboardState = KEYBOARD_STATE_NORMAL;
private PasswordEntryKeyboard mQwertyKeyboard;
@@ -90,10 +85,15 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener {
case KEYBOARD_MODE_ALPHA:
mKeyboardView.setKeyboard(mQwertyKeyboard);
mKeyboardState = KEYBOARD_STATE_NORMAL;
+ final boolean visiblePassword = Settings.System.getInt(
+ mContext.getContentResolver(),
+ Settings.System.TEXT_SHOW_PASSWORD, 1) != 0;
+ mKeyboardView.setPreviewEnabled(visiblePassword);
break;
case KEYBOARD_MODE_NUMERIC:
mKeyboardView.setKeyboard(mNumericKeyboard);
mKeyboardState = KEYBOARD_STATE_NORMAL;
+ mKeyboardView.setPreviewEnabled(false); // never show popup for numeric keypad
break;
}
mKeyboardMode = mode;
@@ -122,7 +122,6 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener {
}
public void onKey(int primaryCode, int[] keyCodes) {
- Log.v(TAG, "Key code = " + Integer.toHexString(primaryCode));
if (primaryCode == Keyboard.KEYCODE_DELETE) {
handleBackspace();
} else if (primaryCode == Keyboard.KEYCODE_SHIFT) {
@@ -201,7 +200,7 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener {
}
public void onPress(int primaryCode) {
-
+ // TODO: vibration support.
}
public void onRelease(int primaryCode) {
diff --git a/core/java/com/android/internal/widget/PasswordEntryKeyboardView.java b/core/java/com/android/internal/widget/PasswordEntryKeyboardView.java
index 9b93fc230ee3e..3e6f6f311db44 100644
--- a/core/java/com/android/internal/widget/PasswordEntryKeyboardView.java
+++ b/core/java/com/android/internal/widget/PasswordEntryKeyboardView.java
@@ -17,27 +17,17 @@
package com.android.internal.widget;
import android.content.Context;
-import android.inputmethodservice.Keyboard;
import android.inputmethodservice.KeyboardView;
import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.widget.PopupWindow;
-import com.android.internal.R;
public class PasswordEntryKeyboardView extends KeyboardView {
- public static final int KEYCODE_OPTIONS = -100;
+ static final int KEYCODE_OPTIONS = -100;
static final int KEYCODE_SHIFT_LONGPRESS = -101;
static final int KEYCODE_VOICE = -102;
static final int KEYCODE_F1 = -103;
static final int KEYCODE_NEXT_LANGUAGE = -104;
- private boolean mExtensionVisible;
- private PasswordEntryKeyboardView mExtension;
- private PopupWindow mExtensionPopup;
- private boolean mFirstEvent;
-
public PasswordEntryKeyboardView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@@ -46,107 +36,4 @@ public class PasswordEntryKeyboardView extends KeyboardView {
super(context, attrs, defStyle);
}
- @Override
- public boolean onTouchEvent(MotionEvent me) {
- if (((PasswordEntryKeyboard) getKeyboard()).getExtension() == 0) {
- return super.onTouchEvent(me);
- }
- if (me.getY() < 0) {
- if (mExtensionVisible) {
- int action = me.getAction();
- if (mFirstEvent) action = MotionEvent.ACTION_DOWN;
- mFirstEvent = false;
- MotionEvent translated = MotionEvent.obtain(me.getEventTime(), me.getEventTime(),
- action,
- me.getX(), me.getY() + mExtension.getHeight(), me.getMetaState());
- boolean result = mExtension.onTouchEvent(translated);
- translated.recycle();
- if (me.getAction() == MotionEvent.ACTION_UP
- || me.getAction() == MotionEvent.ACTION_CANCEL) {
- closeExtension();
- }
- return result;
- } else {
- if (openExtension()) {
- MotionEvent cancel = MotionEvent.obtain(me.getDownTime(), me.getEventTime(),
- MotionEvent.ACTION_CANCEL, me.getX() - 100, me.getY() - 100, 0);
- super.onTouchEvent(cancel);
- cancel.recycle();
- if (mExtension.getHeight() > 0) {
- MotionEvent translated = MotionEvent.obtain(me.getEventTime(),
- me.getEventTime(),
- MotionEvent.ACTION_DOWN,
- me.getX(), me.getY() + mExtension.getHeight(),
- me.getMetaState());
- mExtension.onTouchEvent(translated);
- translated.recycle();
- } else {
- mFirstEvent = true;
- }
- }
- return true;
- }
- } else if (mExtensionVisible) {
- closeExtension();
- // Send a down event into the main keyboard first
- MotionEvent down = MotionEvent.obtain(me.getEventTime(), me.getEventTime(),
- MotionEvent.ACTION_DOWN, me.getX(), me.getY(), me.getMetaState());
- super.onTouchEvent(down);
- down.recycle();
- // Send the actual event
- return super.onTouchEvent(me);
- } else {
- return super.onTouchEvent(me);
- }
- }
-
- private boolean openExtension() {
- if (((PasswordEntryKeyboard) getKeyboard()).getExtension() == 0) return false;
- makePopupWindow();
- mExtensionVisible = true;
- return true;
- }
-
- private void makePopupWindow() {
- if (mExtensionPopup == null) {
- int[] windowLocation = new int[2];
- mExtensionPopup = new PopupWindow(getContext());
- mExtensionPopup.setBackgroundDrawable(null);
- LayoutInflater li = (LayoutInflater) getContext().getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
- mExtension = (PasswordEntryKeyboardView) li.inflate(
- R.layout.password_keyboard_input, null);
- mExtension.setOnKeyboardActionListener(getOnKeyboardActionListener());
- mExtension.setPopupParent(this);
- mExtension.setPopupOffset(0, -windowLocation[1]);
- Keyboard keyboard;
- mExtension.setKeyboard(keyboard = new PasswordEntryKeyboard(getContext(),
- ((PasswordEntryKeyboard) getKeyboard()).getExtension()));
- mExtensionPopup.setContentView(mExtension);
- mExtensionPopup.setWidth(getWidth());
- mExtensionPopup.setHeight(keyboard.getHeight());
- getLocationInWindow(windowLocation);
- // TODO: Fix the "- 30".
- mExtension.setPopupOffset(0, -windowLocation[1] - 30);
- mExtensionPopup.showAtLocation(this, 0, 0, -keyboard.getHeight()
- + windowLocation[1]);
- } else {
- mExtension.setVisibility(VISIBLE);
- }
- }
-
- @Override
- public void closing() {
- super.closing();
- if (mExtensionPopup != null && mExtensionPopup.isShowing()) {
- mExtensionPopup.dismiss();
- mExtensionPopup = null;
- }
- }
-
- private void closeExtension() {
- mExtension.setVisibility(INVISIBLE);
- mExtension.closing();
- mExtensionVisible = false;
- }
}
diff --git a/core/res/res/layout/keyguard_screen_password_landscape.xml b/core/res/res/layout/keyguard_screen_password_landscape.xml
index b089df687e4ed..ab675c7744a79 100644
--- a/core/res/res/layout/keyguard_screen_password_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_password_landscape.xml
@@ -37,7 +37,7 @@
android:layout_marginLeft="6dip"
android:layout_marginTop="10dip"
android:layout_marginBottom="10dip"
- android:gravity="center"
+ android:gravity="left"
android:ellipsize="marquee"
android:text="@android:string/keyguard_password_enter_password_code"
android:textAppearance="?android:attr/textAppearanceLarge"
@@ -53,7 +53,7 @@
android:inputType="textPassword"
android:gravity="center"
android:layout_gravity="center"
- android:textSize="32sp"
+ android:textSize="24sp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:background="@drawable/password_field_default"
android:textColor="#ffffffff"
diff --git a/core/res/res/layout/password_keyboard_input.xml b/core/res/res/layout/password_keyboard_input.xml
deleted file mode 100755
index e40b69ed2f23e..0000000000000
--- a/core/res/res/layout/password_keyboard_input.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
diff --git a/core/res/res/xml-land/password_kbd_qwerty.xml b/core/res/res/xml-land/password_kbd_qwerty.xml
index a3d4e887c9da7..8245cc136b8df 100755
--- a/core/res/res/xml-land/password_kbd_qwerty.xml
+++ b/core/res/res/xml-land/password_kbd_qwerty.xml
@@ -26,29 +26,28 @@
>
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -56,13 +55,13 @@
android:keyWidth="15%p" android:isModifier="true"
android:iconPreview="@drawable/sym_keyboard_feedback_shift"
android:isSticky="true" android:keyEdgeFlags="left"/>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ android:keyWidth="20%p"/>
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -56,13 +56,13 @@
android:keyWidth="15%p" android:isModifier="true"
android:iconPreview="@drawable/sym_keyboard_feedback_shift"
android:isSticky="true" android:keyEdgeFlags="left"/>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ android:keyWidth="20%p"/>
-
-
+
diff --git a/core/res/res/xml/password_kbd_extension.xml b/core/res/res/xml/password_kbd_extension.xml
index 354594e2e5499..28b7efea4282b 100755
--- a/core/res/res/xml/password_kbd_extension.xml
+++ b/core/res/res/xml/password_kbd_extension.xml
@@ -40,22 +40,15 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/core/res/res/xml/password_kbd_qwerty.xml b/core/res/res/xml/password_kbd_qwerty.xml
index d4a454b21a76d..5fa9b8ac2de95 100755
--- a/core/res/res/xml/password_kbd_qwerty.xml
+++ b/core/res/res/xml/password_kbd_qwerty.xml
@@ -26,42 +26,42 @@
>
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -69,13 +69,13 @@
android:keyWidth="15%p" android:isModifier="true"
android:iconPreview="@drawable/sym_keyboard_feedback_shift"
android:isSticky="true" android:keyEdgeFlags="left"/>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ android:keyWidth="20%p"/>
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -69,13 +69,13 @@
android:keyWidth="15%p" android:isModifier="true"
android:iconPreview="@drawable/sym_keyboard_feedback_shift"
android:isSticky="true" android:keyEdgeFlags="left"/>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ android:keyWidth="20%p"/>
-
+
diff --git a/core/res/res/xml/password_kbd_symbols.xml b/core/res/res/xml/password_kbd_symbols.xml
index c97e6aed6f18e..14a7ec8766e79 100755
--- a/core/res/res/xml/password_kbd_symbols.xml
+++ b/core/res/res/xml/password_kbd_symbols.xml
@@ -26,32 +26,32 @@
>
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
@@ -61,13 +61,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ android:iconPreview="@drawable/sym_keyboard_feedback_space"/>
+ android:iconPreview="@drawable/sym_keyboard_feedback_space"/>