summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2011-07-18 13:09:59 -0700
committerJim Miller <jaggies@google.com>2011-07-28 17:54:06 -0700
commit6b05d58018c2806459c121e507c005639b74aee9 (patch)
tree11e6bf1529f9df0d908c394c7ee258a93ac30cdc
parent0a779813e1d0c7a8e896f2d22869d226166c34e8 (diff)
downloadframeworks_base-6b05d58018c2806459c121e507c005639b74aee9.zip
frameworks_base-6b05d58018c2806459c121e507c005639b74aee9.tar.gz
frameworks_base-6b05d58018c2806459c121e507c005639b74aee9.tar.bz2
Fix 5044158: Initial pass: add music transport controls to LockScreen
Refactored all lockscreen notifications to go through new KeyguardStatusViewManager. This is required to intercept messages originally intended for separate TextViews that are now shown in a single view when showing the transport control view. Refactor EmergencyCallButton to be handled by common code in KeyguardStatusViewManager. First pass at LockScreenWidgetCallback for LockScreen "widgets" to send events back to LockScreen. First pass at LockScreenWidgetInterface, which will be required of Views that want to be rendered on LockScreen. Added place-holder TransportControlView until the real one is ready and integrated it into GridLayouts. Ensured emergencyCallButton is in all views, even if not shown since some devices may lock the user out if certain criteria isn't met (missing SIM, etc). Refactored layouts and removed keyguard_screen_status*.xml since layouts are all over the map and no longer make good use of a shared layout for this. Minor tweak to MultiWaveView to fix layout issues when placed in GridLayout where the measurement was being calculated improperly. Moved EmergencyCallButton to bottom of view where we can. Removed unused Alpha keyboards from tablet password unlock layouts. Removed unused views (status2, emergencyCallText screenLocked) from layouts and made common views have common names. Fixed bug with MultiWave layout in landscape where array was shown in wrong orientation. Separated clock colors for phones/tablets since they're now different. Converted remaining phone layouts to use GridLayout. Start routing audiomanager events to lockscreen views. Move emergency call button handling to KeyguardStatusViewManager. Change-Id: I480b0346cfe19aad316fea0c0aaabf8862693636
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java30
-rw-r--r--core/java/com/android/internal/widget/LockScreenWidgetCallback.java36
-rw-r--r--core/java/com/android/internal/widget/LockScreenWidgetInterface.java23
-rw-r--r--core/java/com/android/internal/widget/TransportControlView.java103
-rw-r--r--core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java32
-rw-r--r--core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml10
-rw-r--r--core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml10
-rw-r--r--core/res/res/layout-sw600dp/keyguard_screen_status_land.xml13
-rw-r--r--core/res/res/layout-sw600dp/keyguard_screen_status_port.xml13
-rw-r--r--core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml23
-rw-r--r--core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml14
-rw-r--r--core/res/res/layout/keyguard_screen_password_landscape.xml60
-rw-r--r--core/res/res/layout/keyguard_screen_password_portrait.xml137
-rw-r--r--core/res/res/layout/keyguard_screen_status_land.xml120
-rw-r--r--core/res/res/layout/keyguard_screen_status_port.xml120
-rw-r--r--core/res/res/layout/keyguard_screen_tab_unlock.xml139
-rw-r--r--core/res/res/layout/keyguard_screen_tab_unlock_land.xml96
-rw-r--r--core/res/res/layout/keyguard_screen_unlock_landscape.xml18
-rw-r--r--core/res/res/layout/keyguard_screen_unlock_portrait.xml24
-rw-r--r--core/res/res/layout/keyguard_transport_control.xml53
-rw-r--r--core/res/res/values-land/arrays.xml4
-rw-r--r--core/res/res/values-sw600dp/colors.xml28
-rw-r--r--core/res/res/values/colors.xml14
-rw-r--r--policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java45
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java630
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java26
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewManager.java5
-rw-r--r--policy/src/com/android/internal/policy/impl/LockScreen.java410
-rw-r--r--policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java140
-rw-r--r--policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java90
-rw-r--r--policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java46
-rw-r--r--policy/src/com/android/internal/policy/impl/SimUnlockScreen.java37
-rw-r--r--policy/src/com/android/internal/policy/impl/StatusView.java233
33 files changed, 1262 insertions, 1520 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index bbddf29..e4322c6 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -892,18 +892,6 @@ public class LockPatternUtils {
}
/**
- * Sets the visibility of emergency call prompt based on emergency capable
- * @param emergencyText the emergency call text to be updated
- */
- public void updateEmergencyCallText(TextView emergencyText) {
- if (isEmergencyCallCapable()) {
- emergencyText.setVisibility(View.VISIBLE);
- } else {
- emergencyText.setVisibility(View.GONE);
- }
- }
-
- /**
* Resumes a call in progress. Typically launched from the EmergencyCall button
* on various lockscreens.
*
@@ -920,4 +908,22 @@ public class LockPatternUtils {
}
return false;
}
+
+ /**
+ * Performs concentenation of PLMN/SPN
+ * @param plmn
+ * @param spn
+ * @return
+ */
+ public static CharSequence getCarrierString(CharSequence plmn, CharSequence spn) {
+ if (plmn != null && spn == null) {
+ return plmn;
+ } else if (plmn != null && spn != null) {
+ return plmn + "|" + spn;
+ } else if (plmn == null && spn != null) {
+ return spn;
+ } else {
+ return "";
+ }
+ }
}
diff --git a/core/java/com/android/internal/widget/LockScreenWidgetCallback.java b/core/java/com/android/internal/widget/LockScreenWidgetCallback.java
new file mode 100644
index 0000000..d6403e9
--- /dev/null
+++ b/core/java/com/android/internal/widget/LockScreenWidgetCallback.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2011 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.internal.widget;
+
+import android.view.View;
+
+/**
+ * An interface used by LockScreenWidgets to send messages to lock screen.
+ */
+public interface LockScreenWidgetCallback {
+ // Sends a message to lock screen requesting the given view be shown. May be ignored, depending
+ // on lock screen state. View must be the top-level lock screen widget or it will be ignored.
+ public void requestShow(View self);
+
+ // Sends a message to lock screen requesting the view to be hidden.
+ public void requestHide(View self);
+
+ // Sends a message to lock screen that user has interacted with widget. This should be used
+ // exclusively in response to user activity, i.e. user hits a button in the view.
+ public void userActivity(View self);
+
+}
diff --git a/core/java/com/android/internal/widget/LockScreenWidgetInterface.java b/core/java/com/android/internal/widget/LockScreenWidgetInterface.java
new file mode 100644
index 0000000..6dfcc75
--- /dev/null
+++ b/core/java/com/android/internal/widget/LockScreenWidgetInterface.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2011 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.internal.widget;
+
+public interface LockScreenWidgetInterface {
+
+ public void setCallback(LockScreenWidgetCallback callback);
+
+}
diff --git a/core/java/com/android/internal/widget/TransportControlView.java b/core/java/com/android/internal/widget/TransportControlView.java
new file mode 100644
index 0000000..3961de3
--- /dev/null
+++ b/core/java/com/android/internal/widget/TransportControlView.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2011 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.internal.widget;
+
+import com.android.internal.R;
+
+import android.content.Context;
+import android.media.AudioManager;
+import android.os.Handler;
+import android.os.Message;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.LinearLayout;
+
+/**
+ * A special widget for displaying audio playback ("transport controls") in LockScreen.
+ *
+ */
+public class TransportControlView extends LinearLayout implements LockScreenWidgetInterface,
+ OnClickListener {
+ private static final String TAG = "TransportControlView";
+ static final int sViewIds[] = { R.id.control_prev, R.id.control_pauseplay, R.id.control_next };
+ protected static final int AUDIO_FOCUS_CHANGED = 100;
+ private LockScreenWidgetCallback mCallback;
+
+ private Handler mHandler = new Handler() {
+ public void handleMessage(Message msg) {
+ switch (msg.what){
+ case AUDIO_FOCUS_CHANGED:
+ handleAudioFocusChange(msg.arg1);
+ }
+ }
+ };
+
+ AudioManager.OnAudioFocusChangeListener mAudioFocusChangeListener =
+ new AudioManager.OnAudioFocusChangeListener() {
+ public void onAudioFocusChange(final int focusChange) {
+ mHandler.obtainMessage(AUDIO_FOCUS_CHANGED, focusChange, 0).sendToTarget();
+ }
+ };
+
+ public TransportControlView(Context context) {
+ this(context, null);
+ }
+
+ public TransportControlView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ protected void handleAudioFocusChange(int focusChange) {
+ // TODO
+ }
+
+ public void setCallback(LockScreenWidgetCallback callback) {
+ mCallback = callback;
+ }
+
+ @Override
+ public void onFinishInflate() {
+ for (int i = 0; i < sViewIds.length; i++) {
+ View view = findViewById(sViewIds[i]);
+ if (view != null) {
+ view.setOnClickListener(this);
+ }
+ }
+ }
+
+ public void onClick(View v) {
+ switch (v.getId()) {
+ case R.id.control_prev:
+ // TODO
+ break;
+
+ case R.id.control_pauseplay:
+ // TODO
+ break;
+
+ case R.id.control_next:
+ // TODO
+ break;
+ }
+ // Have any button click extend lockscreen's timeout.
+ if (mCallback != null) {
+ mCallback.userActivity(this);
+ }
+ }
+
+}
diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
index 94990b6..0510023 100644
--- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
@@ -36,6 +36,7 @@ import android.util.Log;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
+import android.view.View.MeasureSpec;
import com.android.internal.R;
@@ -195,14 +196,41 @@ public class MultiWaveView extends View {
protected int getSuggestedMinimumWidth() {
// View should be large enough to contain the background + target drawable on either edge
return mOuterRing.getWidth()
- + (mTargetDrawables.size() > 0 ? (mTargetDrawables.get(0).getWidth()) : 0);
+ + (mTargetDrawables.size() > 0 ? (mTargetDrawables.get(0).getWidth()/2) : 0);
}
@Override
protected int getSuggestedMinimumHeight() {
// View should be large enough to contain the unlock ring + target drawable on either edge
return mOuterRing.getHeight()
- + (mTargetDrawables.size() > 0 ? (mTargetDrawables.get(0).getHeight()) : 0);
+ + (mTargetDrawables.size() > 0 ? (mTargetDrawables.get(0).getHeight()/2) : 0);
+ }
+
+ private int resolveMeasured(int measureSpec, int desired)
+ {
+ int result = 0;
+ int specSize = MeasureSpec.getSize(measureSpec);
+ switch (MeasureSpec.getMode(measureSpec)) {
+ case MeasureSpec.UNSPECIFIED:
+ result = desired;
+ break;
+ case MeasureSpec.AT_MOST:
+ result = Math.min(specSize, desired);
+ break;
+ case MeasureSpec.EXACTLY:
+ default:
+ result = specSize;
+ }
+ return result;
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ final int minimumWidth = getSuggestedMinimumWidth();
+ final int minimumHeight = getSuggestedMinimumHeight();
+ int viewWidth = resolveMeasured(widthMeasureSpec, minimumWidth);
+ int viewHeight = resolveMeasured(heightMeasureSpec, minimumHeight);
+ setMeasuredDimension(viewWidth, viewHeight);
}
private void switchToState(int state, float x, float y) {
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml b/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml
index 6579e76..99ab8a3 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml
@@ -83,16 +83,6 @@
android:layout_weight="1"
/>
- <!-- Alphanumeric keyboard -->
- <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboardAlpha"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/password_keyboard_background_holo"
- android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
- android:keyTextSize="28dip"
- android:visibility="gone"
- />
-
<!-- emergency call button NOT CURRENTLY USED -->
<Button
android:id="@+id/emergencyCallButton"
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml b/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
index c63b0ff..64c002f 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
@@ -75,16 +75,6 @@
android:layout_marginBottom="80dip"
/>
- <!-- Alphanumeric keyboard -->
- <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboardAlpha"
- android:layout_width="match_parent"
- android:layout_height="230dip"
- android:background="@drawable/password_keyboard_background_holo"
- android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
- android:keyTextSize="28dip"
- android:visibility="gone"
- />
-
<!-- emergency call button -->
<Button
android:id="@+id/emergencyCallButton"
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_status_land.xml b/core/res/res/layout-sw600dp/keyguard_screen_status_land.xml
index 302ee01..f3850d5 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_status_land.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_status_land.xml
@@ -114,19 +114,6 @@
</LinearLayout>
- <!-- Status2 is generally charge status -->
- <TextView
- android:id="@+id/status2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="17sp"
- android:layout_marginTop="10dip"
- android:drawablePadding="4dip"
- android:visibility="gone"
- />
-
<!-- Status1 is generally battery status and informational messages -->
<TextView
android:id="@+id/status1"
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_status_port.xml b/core/res/res/layout-sw600dp/keyguard_screen_status_port.xml
index 53fe902..f4c99f1 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_status_port.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_status_port.xml
@@ -113,19 +113,6 @@
</LinearLayout>
- <!-- used for status such as the next alarm, and charging status. -->
- <TextView
- android:id="@+id/status2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="17sp"
- android:layout_marginTop="10dip"
- android:drawablePadding="4dip"
- android:visibility="gone"
- />
-
<TextView
android:id="@+id/status1"
android:layout_width="wrap_content"
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml
index 543747f..d32cd0c 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml
@@ -45,13 +45,12 @@
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
- android:orientation="vertical"
- >
+ android:orientation="vertical">
+
<TextView
android:id="@+id/screenLocked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_below="@id/status2"
android:layout_marginLeft="24dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginTop="12dip"
@@ -65,23 +64,7 @@
android:layout_gravity="center"
/>
- <!-- "emergency calls only" shown when sim is missing or PUKd -->
- <TextView
- android:id="@+id/emergencyCallText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/carrier"
- android:layout_alignParentRight="true"
- android:layout_marginTop="0dip"
- android:layout_marginRight="8dip"
- android:text="@string/emergency_calls_only"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="@color/white"
- android:visibility="gone"
- />
-
- <!-- emergency call button shown when sim is PUKd and tab_selector is
- hidden -->
+ <!-- emergency call button shown when sim is PUKd and tab_selector is hidden -->
<Button
android:id="@+id/emergencyCallButton"
android:layout_width="wrap_content"
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml
index 37bb522..07b4837 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml
@@ -61,19 +61,6 @@
android:layout_alignParentTop="true"
android:drawablePadding="4dip"/>
- <!-- "emergency calls only" shown when sim is missing or PUKd -->
- <TextView
- android:id="@+id/emergencyCallText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_alignParentRight="true"
- android:layout_marginTop="12dip"
- android:text="@string/emergency_calls_only"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@color/white"/>
-
-
<com.android.internal.widget.WaveView
android:id="@+id/unlock_widget"
android:layout_width="wrap_content"
@@ -82,7 +69,6 @@
android:layout_marginRight="0dip"
android:layout_weight="1.0"/>
-
<!-- emergency call button shown when sim is PUKd and tab_selector is hidden -->
<Button
android:id="@+id/emergencyCallButton"
diff --git a/core/res/res/layout/keyguard_screen_password_landscape.xml b/core/res/res/layout/keyguard_screen_password_landscape.xml
index e867fe0..960907d 100644
--- a/core/res/res/layout/keyguard_screen_password_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_password_landscape.xml
@@ -24,7 +24,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:rowCount="10"
+ android:rowCount="7"
android:id="@+id/root"
android:clipChildren="false">
@@ -95,33 +95,7 @@
android:layout_gravity="right"
/>
- <TextView
- android:id="@+id/status2"
- android:layout_marginTop="4dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:drawablePadding="4dip"
- android:layout_gravity="right"
- />
-
- <TextView
- android:id="@+id/screenLocked"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:gravity="center"
- android:layout_marginTop="4dip"
- android:drawablePadding="4dip"
- android:layout_gravity="right"
- />
-
- <Space
- android:layout_rowFlexibility="canStretch"
- android:layout_columnFlexibility="canStretch"
- />
+ <Space android:layout_gravity="fill" />
<TextView
android:id="@+id/carrier"
@@ -133,19 +107,6 @@
android:textColor="?android:attr/textColorSecondary"
/>
- <!-- "emergency calls only" shown when sim is missing or PUKd -->
- <TextView
- android:id="@+id/emergencyCallText"
- android:layout_marginTop="20dip"
- android:layout_gravity="right"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:text="@string/emergency_calls_only"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:textColor="?android:attr/textColorSecondary"
- />
-
<Button
android:id="@+id/emergencyCallButton"
android:layout_gravity="right"
@@ -157,13 +118,13 @@
/>
<!-- Column 1 -->
- <Space android:layout_width="32dip" android:layout_rowSpan="10" />
+ <Space android:layout_width="32dip" android:layout_rowSpan="7" />
<!-- Column 2 - password entry field and PIN keyboard -->
<LinearLayout
android:orientation="vertical"
android:layout_gravity="center|fill"
- android:layout_rowSpan="10">
+ android:layout_rowSpan="7">
<EditText android:id="@+id/passwordEntry"
android:layout_height="wrap_content"
@@ -177,6 +138,7 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@drawable/lockscreen_password_field_dark"
android:textColor="?android:attr/textColorPrimary"
+ android:imeOptions="flagNoFullscreen"
/>
<!-- Numeric keyboard -->
@@ -187,9 +149,19 @@
android:background="#40000000"
android:layout_marginTop="5dip"
android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
- android:visibility="visible"
+ android:visibility="gone"
/>
</LinearLayout>
+ <!-- Music transport control -->
+ <include android:id="@+id/transport"
+ layout="@layout/keyguard_transport_control"
+ android:layout_row="0"
+ android:layout_column="0"
+ android:layout_rowSpan="5"
+ android:layout_columnSpan="1"
+ android:layout_gravity="fill"
+ />
+
</GridLayout>
diff --git a/core/res/res/layout/keyguard_screen_password_portrait.xml b/core/res/res/layout/keyguard_screen_password_portrait.xml
index 6953ac8..7a51035 100644
--- a/core/res/res/layout/keyguard_screen_password_portrait.xml
+++ b/core/res/res/layout/keyguard_screen_password_portrait.xml
@@ -16,38 +16,85 @@
** limitations under the License.
*/
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<GridLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical">
+ android:gravity="center_horizontal">
- <!-- top: status -->
- <RelativeLayout
- android:layout_width="match_parent"
+ <com.android.internal.widget.DigitalClock android:id="@+id/time"
+ android:layout_marginBottom="18dip"
+ android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
+ android:layout_gravity="right">
+
+ <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
+ top of the other. Hence the redundant layout... -->
+ <TextView android:id="@+id/timeDisplayBackground"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginRight="16dip">
- <include layout="@layout/keyguard_screen_status_port"
+ android:singleLine="true"
+ android:ellipsize="none"
+ android:textSize="@dimen/keyguard_lockscreen_clock_font_size"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_marginBottom="6dip"
+ android:textColor="@*android:color/lockscreen_clock_background"
+ />
+
+ <TextView android:id="@+id/timeDisplayForeground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_alignParentRight="true"/>
- </RelativeLayout>
+ android:singleLine="true"
+ android:ellipsize="none"
+ android:textSize="@dimen/keyguard_lockscreen_clock_font_size"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_marginBottom="6dip"
+ android:textColor="@color/lockscreen_clock_foreground"
+ />
- <!-- emergency call button -->
- <Button
- android:id="@+id/emergencyCallButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="4dip"
- android:layout_marginRight="16dip"
+ </com.android.internal.widget.DigitalClock>
+
+ <LinearLayout
+ android:orientation="horizontal"
android:layout_gravity="right"
- android:drawableLeft="@drawable/lockscreen_emergency_button"
- android:drawablePadding="8dip"
- android:text="@string/lockscreen_emergency_call"
- style="?android:attr/buttonBarButtonStyle"
- />
+ android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin">
- <!-- bottom: password -->
+ <TextView
+ android:id="@+id/date"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
+ />
+
+ <TextView
+ android:id="@+id/alarm_status"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="16dip"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
+ android:drawablePadding="4dip"
+ />
+
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/status1"
+ android:layout_gravity="right"
+ android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
+ android:drawablePadding="4dip"
+ />
+
+ <Space android:layout_height="100dip"/>
<!-- Password entry field -->
<EditText android:id="@+id/passwordEntry"
@@ -64,27 +111,14 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffffff"/>
- <View
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- />
+ <Space android:layout_gravity="fill" />
<!-- Numeric keyboard -->
<com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
android:layout_width="match_parent"
android:layout_height="260dip"
android:background="#40000000"
- android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
- />
-
- <!-- Alphanumeric keyboard -->
- <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboardAlpha"
- android:layout_width="match_parent"
- android:layout_height="400dip"
- android:background="@drawable/password_keyboard_background_holo"
- android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
- android:keyTextSize="22dip"
+ android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
android:visibility="gone"
/>
@@ -93,7 +127,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
- android:layout_marginBottom="8dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
android:drawablePadding="4dip"
@@ -101,4 +134,28 @@
android:ellipsize="marquee"
/>
-</LinearLayout>
+ <Button
+ android:id="@+id/emergencyCallButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="4dip"
+ android:layout_marginRight="16dip"
+ android:layout_gravity="center_horizontal"
+ android:drawableLeft="@*android:drawable/lockscreen_emergency_button"
+ style="?android:attr/buttonBarButtonStyle"
+ android:drawablePadding="4dip"
+ android:text="@*android:string/lockscreen_emergency_call"
+ android:visibility="gone"
+ />
+
+ <!-- Music transport control -->
+ <include android:id="@+id/transport"
+ layout="@layout/keyguard_transport_control"
+ android:layout_row="0"
+ android:layout_column="0"
+ android:layout_rowSpan="4"
+ android:layout_columnSpan="1"
+ android:layout_gravity="fill"
+ />
+
+</GridLayout>
diff --git a/core/res/res/layout/keyguard_screen_status_land.xml b/core/res/res/layout/keyguard_screen_status_land.xml
deleted file mode 100644
index 021faa3..0000000
--- a/core/res/res/layout/keyguard_screen_status_land.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2010, 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.
-*/
--->
-
-<!-- Status to show on the left side of lock screen -->
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="left"
- >
-
- <com.android.internal.widget.DigitalClock android:id="@+id/time"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- android:layout_marginTop="8dip"
- android:layout_marginBottom="8dip">
-
- <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
- top of the other. Hence the redundant layout... -->
- <TextView android:id="@+id/timeDisplayBackground"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="none"
- android:textSize="@dimen/keyguard_lockscreen_clock_font_size"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@color/lockscreen_clock_background"
- android:layout_marginBottom="6dip"
- />
-
- <TextView android:id="@+id/timeDisplayForeground"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="none"
- android:textSize="@dimen/keyguard_lockscreen_clock_font_size"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@color/lockscreen_clock_foreground"
- android:layout_alignLeft="@id/timeDisplayBackground"
- android:layout_alignTop="@id/timeDisplayBackground"
- android:layout_marginBottom="6dip"
- />
-
- </com.android.internal.widget.DigitalClock>
-
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/time"
- android:layout_marginTop="10dip">
-
- <TextView
- android:id="@+id/date"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"/>
-
- <TextView
- android:id="@+id/alarm_status"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="30dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"/>
-
- </LinearLayout>
-
- <!-- Status2 is generally charge status -->
- <TextView
- android:id="@+id/status2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:layout_marginTop="10dip"
- android:drawablePadding="4dip"
- android:visibility="gone"
- />
-
- <!-- Status1 is generally battery status and informational messages -->
- <TextView
- android:id="@+id/status1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dip"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- />
-
-</LinearLayout>
diff --git a/core/res/res/layout/keyguard_screen_status_port.xml b/core/res/res/layout/keyguard_screen_status_port.xml
deleted file mode 100644
index f84e61c..0000000
--- a/core/res/res/layout/keyguard_screen_status_port.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2010, 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.
-*/
--->
-
-<!-- Status to show on the left side of lock screen -->
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="left">
-
- <com.android.internal.widget.DigitalClock android:id="@+id/time"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dip">
-
- <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
- top of the other. Hence the redundant layout... -->
- <TextView android:id="@+id/timeDisplayBackground"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="none"
- android:textSize="@dimen/keyguard_lockscreen_clock_font_size"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@color/lockscreen_clock_background"
- android:layout_marginBottom="6dip"
- />
-
- <TextView android:id="@+id/timeDisplayForeground"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="none"
- android:textSize="@dimen/keyguard_lockscreen_clock_font_size"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@color/lockscreen_clock_foreground"
- android:layout_marginBottom="6dip"
- android:layout_alignLeft="@id/timeDisplayBackground"
- android:layout_alignTop="@id/timeDisplayBackground"
- />
-
- </com.android.internal.widget.DigitalClock>
-
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/time"
- android:layout_marginTop="16dip"
- android:layout_gravity="right">
-
- <TextView
- android:id="@+id/date"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"/>
-
- <TextView
- android:id="@+id/alarm_status"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="16dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:drawablePadding="4dip"/>
-
- </LinearLayout>
-
- <TextView
- android:id="@+id/status1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right"
- android:layout_marginTop="4dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:textAppearance="?android:attr/textAppearanceMedium"
- />
-
- <!-- used for status such as the next alarm, and charging status. -->
- <TextView
- android:id="@+id/status2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right"
- android:layout_alignParentTop="true"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:layout_marginTop="4dip"
- android:drawablePadding="4dip"
- android:visibility="gone"
- />
-
-
-</LinearLayout>
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock.xml b/core/res/res/layout/keyguard_screen_tab_unlock.xml
index 1e2abf9..05c768d 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock.xml
@@ -21,21 +21,17 @@
state of the device, as well as instructions on how to get past it
depending on the state of the device. It is the same for landscape
and portrait.-->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<GridLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:gravity="center_horizontal"
- android:id="@+id/root"
- android:clipChildren="false">
+ android:gravity="center_horizontal">
- <!-- time and date -->
<com.android.internal.widget.DigitalClock android:id="@+id/time"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:layout_marginRight="16dip"
- android:layout_marginTop="48dip"
- android:layout_marginLeft="20dip">
+ android:layout_marginBottom="18dip"
+ android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
+ android:layout_gravity="right">
<!-- Because we can't have multi-tone fonts, we render two TextViews, one on
top of the other. Hence the redundant layout... -->
@@ -65,16 +61,10 @@
</com.android.internal.widget.DigitalClock>
- <LinearLayout android:id="@+id/date_alarm_status_container"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/time"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
- android:layout_marginTop="16dip"
- android:layout_alignParentRight="true"
- android:gravity="right"
- android:orientation="horizontal">
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_gravity="right"
+ android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin">
<TextView
android:id="@+id/date"
@@ -90,25 +80,20 @@
android:id="@+id/alarm_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginLeft="16dip"
android:singleLine="true"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
android:drawablePadding="4dip"
- android:layout_marginLeft="16dip"
/>
</LinearLayout>
<TextView
android:id="@+id/status1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/date_alarm_status_container"
- android:layout_marginTop="4dip"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
- android:layout_alignParentRight="true"
+ android:layout_gravity="right"
+ android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
android:singleLine="true"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceMedium"
@@ -116,39 +101,7 @@
android:drawablePadding="4dip"
/>
- <TextView
- android:id="@+id/status2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/status1"
- android:layout_marginTop="4dip"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
- android:layout_alignParentRight="true"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:drawablePadding="4dip"
- android:visibility="gone"
- />
-
- <TextView
- android:id="@+id/screenLocked"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/status2"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
- android:layout_alignParentRight="true"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:layout_marginTop="12dip"
- android:drawablePadding="4dip"
- android:visibility="gone"
- />
+ <Space android:layout_gravity="fill" />
<!-- emergency call button shown when sim is PUKd and tab_selector is hidden -->
<Button
@@ -157,26 +110,23 @@
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:layout_marginRight="16dip"
- android:drawableLeft="@drawable/lockscreen_emergency_button"
- android:layout_alignParentRight="true"
- android:layout_below="@id/screenLocked"
+ android:layout_gravity="right"
+ android:drawableLeft="@*android:drawable/lockscreen_emergency_button"
style="?android:attr/buttonBarButtonStyle"
android:drawablePadding="4dip"
- android:text="@string/lockscreen_emergency_call"
- android:visibility="visible"
+ android:text="@*android:string/lockscreen_emergency_call"
+ android:visibility="gone"
/>
<RelativeLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:gravity="center_horizontal">
+ android:layout_height="292dip">
<com.android.internal.widget.multiwaveview.MultiWaveView
android:id="@+id/unlock_widget"
android:orientation="horizontal"
android:layout_width="match_parent"
- android:layout_height="300dip"
+ android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:targetDrawables="@array/lockscreen_targets_when_silent"
@@ -206,24 +156,39 @@
android:textColor="?android:attr/textColorSecondary"
/>
- <!-- "emergency calls only" shown when sim is missing or PUKd -->
- <TextView
- android:id="@+id/emergencyCallText"
- android:layout_width="fill_parent"
+ </RelativeLayout>
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ style="?android:attr/buttonBarStyle"
+ android:gravity="center"
+ android:weightSum="2">
+
+ <Button android:id="@+id/emergencyCallButton"
+ android:layout_gravity="center_horizontal"
+ android:layout_width="0dip"
android:layout_height="wrap_content"
- android:layout_above="@id/carrier"
- android:gravity="center_horizontal"
- android:layout_marginTop="0dip"
- android:layout_marginRight="8dip"
- android:text="@string/emergency_calls_only"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_weight="1"
+ style="?android:attr/buttonBarButtonStyle"
android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:textColor="?android:attr/textColorSecondary"
- />
+ android:text="@*android:string/lockscreen_emergency_call"
+ android:drawableLeft="@*android:drawable/lockscreen_emergency_button"
+ android:drawablePadding="0dip"
+ android:visibility="gone"
+ />
- </RelativeLayout>
+ </LinearLayout>
+
+ <!-- Music transport control -->
+ <include android:id="@+id/transport"
+ layout="@layout/keyguard_transport_control"
+ android:layout_row="0"
+ android:layout_column="0"
+ android:layout_rowSpan="4"
+ android:layout_columnSpan="1"
+ android:layout_gravity="fill"
+ />
-</RelativeLayout>
+</GridLayout>
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
index 7aab04e..6440726 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
@@ -24,13 +24,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:rowCount="8"
+ android:rowCount="7"
android:id="@+id/root"
android:clipChildren="false">
<!-- Column 0 -->
<com.android.internal.widget.DigitalClock android:id="@+id/time"
- android:layout_marginTop="8dip"
+ android:layout_marginTop="80dip"
android:layout_marginBottom="8dip"
android:layout_gravity="right">
@@ -95,89 +95,41 @@
android:layout_gravity="right"
/>
- <TextView
- android:id="@+id/status2"
- android:layout_marginTop="4dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:drawablePadding="4dip"
- android:layout_gravity="right"
- />
+ <Space android:layout_gravity="fill" />
<TextView
- android:id="@+id/screenLocked"
+ android:id="@+id/carrier"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right"
android:singleLine="true"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:gravity="center"
- android:layout_marginTop="4dip"
- android:drawablePadding="4dip"
- android:layout_gravity="right"
- />
-
- <Space
- android:layout_rowFlexibility="canStretch"
- android:layout_columnFlexibility="canStretch"
+ android:textColor="?android:attr/textColorSecondary"
/>
- <LinearLayout android:orientation="vertical"
+ <Button
+ android:id="@+id/emergencyCallButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_gravity="right"
- android:gravity="fill_horizontal">
-
- <TextView
- android:id="@+id/carrier"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:layout_gravity="right"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:textColor="?android:attr/textColorSecondary"
- />
-
- <!-- "emergency calls only" shown when sim is missing or PUKd -->
- <TextView
- android:id="@+id/emergencyCallText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_marginTop="20dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:text="@string/emergency_calls_only"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:textColor="?android:attr/textColorSecondary"
- android:layout_gravity="right"
- />
-
- <Button
- android:id="@+id/emergencyCallButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:drawableLeft="@drawable/lockscreen_emergency_button"
- android:text="@string/lockscreen_emergency_call"
- style="?android:attr/buttonBarButtonStyle"
- android:drawablePadding="8dip"
- android:visibility="visible"
- android:layout_gravity="right"
+ android:drawableLeft="@*android:drawable/lockscreen_emergency_button"
+ android:text="@*android:string/lockscreen_emergency_call"
+ style="?android:attr/buttonBarButtonStyle"
+ android:drawablePadding="8dip"
+ android:visibility="gone"
/>
- </LinearLayout>
<!-- Column 1 -->
- <Space android:layout_width="32dip" android:layout_rowSpan="8" />
+ <Space android:layout_width="64dip" android:layout_rowSpan="7" />
<!-- Column 2 -->
<com.android.internal.widget.multiwaveview.MultiWaveView
android:id="@+id/unlock_widget"
android:layout_width="200dip"
android:layout_height="match_parent"
- android:layout_rowSpan="8"
+ android:layout_rowSpan="7"
android:targetDrawables="@array/lockscreen_targets_when_silent"
android:handleDrawable="@drawable/ic_lockscreen_handle"
@@ -192,4 +144,14 @@
android:verticalOffset="0dip"
/>
+ <!-- Music transport control -->
+ <include android:id="@+id/transport"
+ layout="@layout/keyguard_transport_control"
+ android:layout_row="0"
+ android:layout_column="0"
+ android:layout_rowSpan="5"
+ android:layout_columnSpan="1"
+ android:layout_gravity="fill"
+ />
+
</GridLayout>
diff --git a/core/res/res/layout/keyguard_screen_unlock_landscape.xml b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
index 8f083a0..c425b73 100644
--- a/core/res/res/layout/keyguard_screen_unlock_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
@@ -90,11 +90,7 @@
android:layout_gravity="right"
/>
- <!-- TODO: remove hard coded height since layout_rowWeight doesn't seem to be working -->
- <Space
- android:layout_rowFlexibility="canStretch"
- android:layout_columnFlexibility="canStretch"
- />
+ <Space android:layout_gravity="fill" />
<TextView android:id="@+id/carrier"
android:layout_gravity="right"
@@ -135,6 +131,7 @@
</LinearLayout>
<!-- Column 1: lock pattern -->
+
<com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -144,4 +141,15 @@
android:layout_marginLeft="8dip"
android:layout_rowSpan="7"/>
+
+ <!-- Music transport control -->
+ <include android:id="@+id/transport"
+ layout="@layout/keyguard_transport_control"
+ android:layout_row="0"
+ android:layout_column="0"
+ android:layout_rowSpan="5"
+ android:layout_columnSpan="1"
+ android:layout_gravity="fill"
+ />
+
</GridLayout>
diff --git a/core/res/res/layout/keyguard_screen_unlock_portrait.xml b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
index 35fd473..433dda7 100644
--- a/core/res/res/layout/keyguard_screen_unlock_portrait.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
@@ -27,7 +27,6 @@
android:layout_height="match_parent"
android:gravity="center_horizontal">
-
<com.android.internal.widget.DigitalClock android:id="@+id/time"
android:layout_marginBottom="18dip"
android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
@@ -100,17 +99,7 @@
android:drawablePadding="4dip"
/>
- <TextView
- android:id="@+id/status2"
- android:layout_gravity="right"
- android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
- android:drawablePadding="4dip"
- android:visibility="gone"
- />
+ <Space android:layout_gravity="fill" />
<!-- We need MATCH_PARENT here only to force the size of the parent to be passed to
the pattern view for it to compute its size. This is an unusual case, caused by
@@ -125,7 +114,6 @@
android:layout_marginBottom="4dip"
android:layout_marginLeft="8dip"
android:layout_gravity="center|bottom"
- android:layout_rowFlexibility="canStretch"
/>
<TextView
@@ -171,4 +159,14 @@
</LinearLayout>
+ <!-- Music transport control -->
+ <include android:id="@+id/transport"
+ layout="@layout/keyguard_transport_control"
+ android:layout_row="0"
+ android:layout_column="0"
+ android:layout_rowSpan="4"
+ android:layout_columnSpan="1"
+ android:layout_gravity="fill"
+ />
+
</GridLayout>
diff --git a/core/res/res/layout/keyguard_transport_control.xml b/core/res/res/layout/keyguard_transport_control.xml
new file mode 100644
index 0000000..6308b02
--- /dev/null
+++ b/core/res/res/layout/keyguard_transport_control.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+**
+** Copyright 2008, 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.
+*/
+-->
+
+<com.android.internal.widget.TransportControlView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:gravity="bottom"
+ android:orientation="horizontal"
+ android:background="#a0808080"
+ android:visibility="gone">
+
+ <Button android:id="@+id/control_prev"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="#80ff0000"
+ />
+
+ <Space android:layout_width="0dip"
+ android:layout_height="0dip"
+ android:layout_weight="1"/>
+
+ <Button android:id="@+id/control_pauseplay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="#8000ff00"
+ />
+
+ <Space android:layout_width="0dip"
+ android:layout_height="0dip"
+ android:layout_weight="1"/>
+
+ <Button android:id="@+id/control_next"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="#800000ff"
+ />
+
+</com.android.internal.widget.TransportControlView>
diff --git a/core/res/res/values-land/arrays.xml b/core/res/res/values-land/arrays.xml
index 85130ba..92d5a87 100644
--- a/core/res/res/values-land/arrays.xml
+++ b/core/res/res/values-land/arrays.xml
@@ -20,14 +20,14 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Resources for MultiWaveView in LockScreen -->
- <array name="ic_lockscreen_targets_when_silent">
+ <array name="lockscreen_targets_when_silent">
<item>@null</item>"
<item>@drawable/ic_lockscreen_unlock</item>
<item>@null</item>
<item>@drawable/ic_lockscreen_soundon</item>
</array>
- <array name="ic_lockscreen_targets_when_soundon">
+ <array name="lockscreen_targets_when_soundon">
<item>@null</item>"
<item>@drawable/ic_lockscreen_unlock</item>
<item>@null</item>
diff --git a/core/res/res/values-sw600dp/colors.xml b/core/res/res/values-sw600dp/colors.xml
new file mode 100644
index 0000000..6b5a55a
--- /dev/null
+++ b/core/res/res/values-sw600dp/colors.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/colors.xml
+**
+** Copyright 2006, 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.
+*/
+-->
+<resources>
+ <!-- keyguard clock -->
+ <color name="lockscreen_clock_background">#b3ffffff</color>
+ <color name="lockscreen_clock_foreground">#7affffff</color>
+ <color name="lockscreen_clock_am_pm">#ff9a9a9a</color>
+ <color name="lockscreen_owner_info">#ff9a9a9a</color>
+
+</resources>
+
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 631d8c6..aee7ea4 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -18,8 +18,8 @@
*/
-->
<resources>
- <drawable name="screen_background_light">#ffffffff</drawable>
- <drawable name="screen_background_dark">#ff000000</drawable>
+ <drawable name="screen_background_light">#ffffffff</drawable>
+ <drawable name="screen_background_dark">#ff000000</drawable>
<drawable name="status_bar_closed_default_background">#ff000000</drawable>
<drawable name="status_bar_opened_default_background">#ff000000</drawable>
<drawable name="search_bar_default_color">#ff000000</drawable>
@@ -75,7 +75,7 @@
<drawable name="dialog_holo_dark_frame">@drawable/dialog_full_holo_dark</drawable>
<drawable name="dialog_holo_light_frame">@drawable/dialog_full_holo_light</drawable>
-
+
<drawable name="input_method_fullscreen_background">#fff9f9f9</drawable>
<drawable name="input_method_fullscreen_background_holo">@drawable/screen_background_holo_dark</drawable>
@@ -109,14 +109,14 @@
<color name="keyguard_text_color_decline">#fe0a5a</color>
<!-- keyguard clock -->
- <color name="lockscreen_clock_background">#b3ffffff</color>
- <color name="lockscreen_clock_foreground">#7affffff</color>
+ <color name="lockscreen_clock_background">#e5ffffff</color>
+ <color name="lockscreen_clock_foreground">#e5ffffff</color>
<color name="lockscreen_clock_am_pm">#ff9a9a9a</color>
<color name="lockscreen_owner_info">#ff9a9a9a</color>
<!-- For holo theme -->
- <drawable name="screen_background_holo_light">#fff3f3f3</drawable>
- <drawable name="screen_background_holo_dark">#ff000000</drawable>
+ <drawable name="screen_background_holo_light">#fff3f3f3</drawable>
+ <drawable name="screen_background_holo_dark">#ff000000</drawable>
<color name="background_holo_dark">#ff000000</color>
<color name="background_holo_light">#fff3f3f3</color>
<color name="bright_foreground_holo_dark">@android:color/background_holo_light</color>
diff --git a/policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java b/policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java
index de4ea75..044cf4a 100644
--- a/policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java
@@ -52,10 +52,9 @@ import java.io.IOException;
* account's login/password to unlock the phone (and reset their lock pattern).
*/
public class AccountUnlockScreen extends RelativeLayout implements KeyguardScreen,
- KeyguardUpdateMonitor.InfoCallback,View.OnClickListener, TextWatcher {
+ View.OnClickListener, TextWatcher {
private static final String LOCK_PATTERN_PACKAGE = "com.android.settings";
- private static final String LOCK_PATTERN_CLASS =
- "com.android.settings.ChooseLockPattern";
+ private static final String LOCK_PATTERN_CLASS = LOCK_PATTERN_PACKAGE + ".ChooseLockPattern";
/**
* The amount of millis to stay awake once this screen detects activity
@@ -71,19 +70,19 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
private EditText mLogin;
private EditText mPassword;
private Button mOk;
- private Button mEmergencyCall;
/**
* Shown while making asynchronous check of password.
*/
private ProgressDialog mCheckingDialog;
+ private KeyguardStatusViewManager mKeyguardStatusViewManager;
/**
* AccountUnlockScreen constructor.
* @param configuration
* @param updateMonitor
*/
- public AccountUnlockScreen(Context context,Configuration configuration,
+ public AccountUnlockScreen(Context context, Configuration configuration,
KeyguardUpdateMonitor updateMonitor, KeyguardScreenCallback callback,
LockPatternUtils lockPatternUtils) {
super(context);
@@ -110,12 +109,10 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
mOk = (Button) findViewById(R.id.ok);
mOk.setOnClickListener(this);
- mEmergencyCall = (Button) findViewById(R.id.emergencyCallButton);
- mEmergencyCall.setOnClickListener(this);
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCall);
-
mUpdateMonitor = updateMonitor;
- mUpdateMonitor.registerInfoCallback(this);
+
+ mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, updateMonitor,
+ lockPatternUtils, callback);
}
public void afterTextChanged(Editable s) {
@@ -142,7 +139,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
/** {@inheritDoc} */
public void onPause() {
-
+ mKeyguardStatusViewManager.onPause();
}
/** {@inheritDoc} */
@@ -151,7 +148,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
mLogin.setText("");
mPassword.setText("");
mLogin.requestFocus();
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCall);
+ mKeyguardStatusViewManager.onResume();
}
/** {@inheritDoc} */
@@ -171,10 +168,6 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
if (v == mOk) {
asyncCheckPassword();
}
-
- if (v == mEmergencyCall) {
- mCallback.takeEmergencyCallAction();
- }
}
private void postOnCheckPasswordResult(final boolean success) {
@@ -327,24 +320,4 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
}
return mCheckingDialog;
}
-
- public void onPhoneStateChanged(String newState) {
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCall);
- }
-
- public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) {
-
- }
-
- public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
-
- }
-
- public void onRingerModeChanged(int state) {
-
- }
-
- public void onTimeChanged() {
-
- }
}
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
new file mode 100644
index 0000000..7a14480
--- /dev/null
+++ b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
@@ -0,0 +1,630 @@
+/*
+ * Copyright (C) 2011 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.internal.policy.impl;
+
+import com.android.internal.R;
+import com.android.internal.telephony.IccCard;
+import com.android.internal.telephony.IccCard.State;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.SimStateCallback;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+import libcore.util.MutableInt;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.provider.Settings;
+import android.text.TextUtils;
+import android.text.format.DateFormat;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+/***
+ * Manages a number of views inside of LockScreen layouts. See below for a list of widgets
+ *
+ */
+class KeyguardStatusViewManager implements OnClickListener {
+ private static final boolean DEBUG = true;
+ private static final String TAG = "KeyguardStatusView";
+
+ public static final int LOCK_ICON = 0; // R.drawable.ic_lock_idle_lock;
+ public static final int ALARM_ICON = R.drawable.ic_lock_idle_alarm;
+ public static final int CHARGING_ICON = 0; //R.drawable.ic_lock_idle_charging;
+ public static final int BATTERY_LOW_ICON = 0; //R.drawable.ic_lock_idle_low_battery;
+ private static final long INSTRUCTION_RESET_DELAY = 2000; // time until instruction text resets
+
+ private static final int SHOW_WIDGET = 8;
+ private static final int HIDE_WIDGET = 9;
+ private static final int INSTRUCTION_TEXT = 10;
+ private static final int CARRIER_TEXT = 11;
+ private static final int CARRIER_HELP_TEXT = 12;
+ private static final int HELP_MESSAGE_TEXT = 13;
+ private static final int OWNER_INFO = 14;
+
+ private StatusMode mStatus;
+ private String mDateFormatString;
+ private TransientTextManager mTransientTextManager;
+
+ // Views that this class controls.
+ // NOTE: These may be null in some LockScreen screens and should protect from NPE
+ private TextView mCarrierView;
+ private TextView mDateView;
+ private TextView mStatus1View;
+ private TextView mOwnerInfoView;
+ private TextView mAlarmStatusView;
+ private View mTransportView;
+
+ // Top-level container view for above views
+ private View mContainer;
+
+ // are we showing battery information?
+ private boolean mShowingBatteryInfo = false;
+
+ // last known plugged in state
+ private boolean mPluggedIn = false;
+
+ // last known battery level
+ private int mBatteryLevel = 100;
+
+ private LockPatternUtils mLockPatternUtils;
+ private KeyguardUpdateMonitor mUpdateMonitor;
+ private Button mEmergencyCallButton;
+ private boolean mShouldEnableUnlock;
+
+ // Shadowed text values
+ private CharSequence mCarrierText;
+ private CharSequence mCarrierHelpText;
+ private String mHelpMessageText;
+ private String mInstructionText;
+ private CharSequence mOwnerInfoText;
+ private boolean mShowingStatus;
+ private KeyguardScreenCallback mCallback;
+ private boolean mHideEmergencyCallButton = false;
+
+ private class TransientTextManager {
+ private TextView mTextView;
+ private class Data {
+ final int icon;
+ final CharSequence text;
+ Data(CharSequence t, int i) {
+ text = t;
+ icon = i;
+ }
+ };
+ private ArrayList<Data> mMessages = new ArrayList<Data>(5);
+
+ TransientTextManager(TextView textView) {
+ mTextView = textView;
+ }
+
+ /* Show given message with icon for up to duration ms. Newer messages override older ones.
+ * The most recent message with the longest duration is shown as messages expire until
+ * nothing is left, in which case the text/icon is defined by a call to
+ * getAltTextMessage() */
+ void post(final CharSequence message, final int icon, long duration) {
+ if (mTextView == null) {
+ return;
+ }
+ mTextView.setText(message);
+ mTextView.setCompoundDrawablesWithIntrinsicBounds(icon, 0, 0, 0);
+ final Data data = new Data(message, icon);
+ mContainer.postDelayed(new Runnable() {
+ public void run() {
+ mMessages.remove(data);
+ int last = mMessages.size() - 1;
+ final CharSequence lastText;
+ final int lastIcon;
+ if (last > 0) {
+ final Data oldData = mMessages.get(last);
+ lastText = oldData.text;
+ lastIcon = oldData.icon;
+ } else {
+ final MutableInt tmpIcon = new MutableInt(0);
+ lastText = getAltTextMessage(tmpIcon);
+ lastIcon = tmpIcon.value;
+ }
+ mTextView.setText(lastText);
+ mTextView.setCompoundDrawablesWithIntrinsicBounds(lastIcon, 0, 0, 0);
+ }
+ }, duration);
+ }
+ };
+
+ public KeyguardStatusViewManager(View view, KeyguardUpdateMonitor updateMonitor,
+ LockPatternUtils lockPatternUtils, KeyguardScreenCallback callback) {
+ mContainer = view;
+ mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year);
+ mLockPatternUtils = lockPatternUtils;
+ mUpdateMonitor = updateMonitor;
+ mCallback = callback;
+
+ mCarrierView = (TextView) findViewById(R.id.carrier);
+ mDateView = (TextView) findViewById(R.id.date);
+ mStatus1View = (TextView) findViewById(R.id.status1);
+ mAlarmStatusView = (TextView) findViewById(R.id.alarm_status);
+ mOwnerInfoView = (TextView) findViewById(R.id.propertyOf);
+ mTransportView = findViewById(R.id.transport);
+ mEmergencyCallButton = (Button) findViewById(R.id.emergencyCallButton);
+ if (mEmergencyCallButton != null) {
+ mEmergencyCallButton.setText(R.string.lockscreen_emergency_call);
+ mEmergencyCallButton.setOnClickListener(this);
+ mEmergencyCallButton.setFocusable(false); // touch only!
+ }
+
+ mTransientTextManager = new TransientTextManager(mCarrierView);
+
+ updateEmergencyCallButtonState();
+
+ resetStatusInfo();
+ refreshDate();
+ updateOwnerInfo();
+
+ // Required to get Marquee to work.
+ final View scrollableViews[] = { mCarrierView, mDateView, mStatus1View, mOwnerInfoView,
+ mAlarmStatusView };
+ for (View v : scrollableViews) {
+ if (v != null) {
+ v.setSelected(true);
+ }
+ }
+
+ // until we get an update...
+ setCarrierText(LockPatternUtils.getCarrierString(
+ mUpdateMonitor.getTelephonyPlmn(), mUpdateMonitor.getTelephonySpn()));
+ }
+
+ public void enterWidgetMode() {
+ if (mTransportView != null) {
+ mTransportView.setVisibility(View.VISIBLE);
+ update(SHOW_WIDGET, null);
+ }
+ }
+
+ public void leaveWidgetMode() {
+ if (mTransportView != null) {
+ mTransportView.setVisibility(View.GONE);
+ update(HIDE_WIDGET, null);
+ }
+ }
+
+ private boolean inWidgetMode() {
+ return mTransportView != null && mTransportView.getVisibility() == View.VISIBLE;
+ }
+
+ void setInstructionText(String string) {
+ mInstructionText = string;
+ update(INSTRUCTION_TEXT, string);
+ }
+
+ void setCarrierText(CharSequence string) {
+ mCarrierText = string;
+ update(CARRIER_TEXT, string);
+ }
+
+ void setOwnerInfo(CharSequence string) {
+ mOwnerInfoText = string;
+ update(OWNER_INFO, string);
+ }
+
+ /**
+ * Sets the carrier help text message, if view is present. Carrier help text messages are
+ * typically for help dealing with SIMS and connectivity.
+ *
+ * @param resId resource id of the message
+ */
+ public void setCarrierHelpText(int resId) {
+ mCarrierHelpText = getContext().getText(resId);
+ update(CARRIER_HELP_TEXT, mCarrierHelpText);
+ }
+
+ /**
+ * Unlock help message. This is typically for help with unlock widgets, e.g. "wrong password"
+ * or "try again."
+ *
+ * @param textResId
+ * @param lockIcon
+ */
+ public void setHelpMessage(int textResId, int lockIcon) {
+ mHelpMessageText = getContext().getString(textResId);
+ update(HELP_MESSAGE_TEXT, mHelpMessageText);
+ }
+
+ private void update(int what, CharSequence string) {
+ if (inWidgetMode()) {
+ if (DEBUG) Log.v(TAG, "inWidgetMode() is true");
+ // Use Transient text for messages shown while widget is shown.
+ switch (what) {
+ case INSTRUCTION_TEXT:
+ case CARRIER_HELP_TEXT:
+ case HELP_MESSAGE_TEXT:
+ mTransientTextManager.post(string, 0, INSTRUCTION_RESET_DELAY);
+ break;
+
+ case OWNER_INFO:
+ case CARRIER_TEXT:
+ default:
+ Log.w(TAG, "Not showing message id " + what + ", str=" + string);
+ }
+ } else {
+ updateStatusLines(mShowingStatus);
+ }
+ }
+
+ public void onPause() {
+ mUpdateMonitor.removeCallback(mInfoCallback);
+ mUpdateMonitor.removeCallback(mSimStateCallback);
+ }
+
+ /** {@inheritDoc} */
+ public void onResume() {
+ mUpdateMonitor.registerInfoCallback(mInfoCallback);
+ mUpdateMonitor.registerSimStateCallback(mSimStateCallback);
+ updateEmergencyCallButtonState();
+ resetStatusInfo();
+ }
+
+ void resetStatusInfo() {
+ mInstructionText = null;
+ mShowingBatteryInfo = mUpdateMonitor.shouldShowBatteryInfo();
+ mPluggedIn = mUpdateMonitor.isDevicePluggedIn();
+ mBatteryLevel = mUpdateMonitor.getBatteryLevel();
+ updateStatusLines(true);
+ }
+
+ /**
+ * Update the status lines based on these rules:
+ * AlarmStatus: Alarm state always gets it's own line.
+ * Status1 is shared between help, battery status and generic unlock instructions,
+ * prioritized in that order.
+ * @param showStatusLines status lines are shown if true
+ */
+ void updateStatusLines(boolean showStatusLines) {
+ if (DEBUG) Log.v(TAG, "updateStatusLines(" + showStatusLines + ")");
+ mShowingStatus = showStatusLines;
+ updateAlarmInfo();
+ updateOwnerInfo();
+ updateStatus1();
+ updateCarrierText();
+ }
+
+ private void updateAlarmInfo() {
+ if (mAlarmStatusView != null) {
+ String nextAlarm = mLockPatternUtils.getNextAlarm();
+ boolean showAlarm = mShowingStatus && !TextUtils.isEmpty(nextAlarm);
+ mAlarmStatusView.setText(nextAlarm);
+ mAlarmStatusView.setCompoundDrawablesWithIntrinsicBounds(ALARM_ICON, 0, 0, 0);
+ mAlarmStatusView.setVisibility(showAlarm ? View.VISIBLE : View.GONE);
+ }
+ }
+
+ private void updateOwnerInfo() {
+ final ContentResolver res = getContext().getContentResolver();
+ final boolean ownerInfoEnabled = Settings.Secure.getInt(res,
+ Settings.Secure.LOCK_SCREEN_OWNER_INFO_ENABLED, 1) != 0;
+ mOwnerInfoText = ownerInfoEnabled ?
+ Settings.Secure.getString(res, Settings.Secure.LOCK_SCREEN_OWNER_INFO) : null;
+ if (mOwnerInfoView != null) {
+ mOwnerInfoView.setText(mOwnerInfoText);
+ mOwnerInfoView.setVisibility(TextUtils.isEmpty(mOwnerInfoText) ? View.GONE:View.VISIBLE);
+ }
+ }
+
+ private void updateStatus1() {
+ if (mStatus1View != null) {
+ MutableInt icon = new MutableInt(0);
+ CharSequence string = getPriorityTextMessage(icon);
+ mStatus1View.setText(string);
+ mStatus1View.setCompoundDrawablesWithIntrinsicBounds(icon.value, 0, 0, 0);
+ mStatus1View.setVisibility(mShowingStatus ? View.VISIBLE : View.INVISIBLE);
+ }
+ }
+
+ private void updateCarrierText() {
+ if (!inWidgetMode() && mCarrierView != null) {
+ mCarrierView.setText(mCarrierText);
+ }
+ }
+
+ private CharSequence getAltTextMessage(MutableInt icon) {
+ // If we have replaced the status area with a single widget, then this code
+ // prioritizes what to show in that space when all transient messages are gone.
+ CharSequence string = null;
+ if (mShowingBatteryInfo) {
+ // Battery status
+ if (mPluggedIn) {
+ // Charging or charged
+ if (mUpdateMonitor.isDeviceCharged()) {
+ string = getContext().getString(R.string.lockscreen_charged);
+ } else {
+ string = getContext().getString(R.string.lockscreen_plugged_in, mBatteryLevel);
+ }
+ icon.value = CHARGING_ICON;
+ } else if (mBatteryLevel < KeyguardUpdateMonitor.LOW_BATTERY_THRESHOLD) {
+ // Battery is low
+ string = getContext().getString(R.string.lockscreen_low_battery);
+ icon.value = BATTERY_LOW_ICON;
+ }
+ } else {
+ string = mCarrierText;
+ }
+ return string;
+ }
+
+ private CharSequence getPriorityTextMessage(MutableInt icon) {
+ CharSequence string = null;
+ if (!TextUtils.isEmpty(mInstructionText)) {
+ // Instructions only
+ string = mInstructionText;
+ icon.value = LOCK_ICON;
+ } else if (mShowingBatteryInfo) {
+ // Battery status
+ if (mPluggedIn) {
+ // Charging or charged
+ if (mUpdateMonitor.isDeviceCharged()) {
+ string = getContext().getString(R.string.lockscreen_charged);
+ } else {
+ string = getContext().getString(R.string.lockscreen_plugged_in, mBatteryLevel);
+ }
+ icon.value = CHARGING_ICON;
+ } else if (mBatteryLevel < KeyguardUpdateMonitor.LOW_BATTERY_THRESHOLD) {
+ // Battery is low
+ string = getContext().getString(R.string.lockscreen_low_battery);
+ icon.value = BATTERY_LOW_ICON;
+ }
+ } else if (!inWidgetMode() && mOwnerInfoView == null && mOwnerInfoText != null) {
+ // OwnerInfo shows in status if we don't have a dedicated widget
+ string = mOwnerInfoText;
+ }
+ return string;
+ }
+
+ void refreshDate() {
+ if (mDateView != null) {
+ mDateView.setText(DateFormat.format(mDateFormatString, new Date()));
+ }
+ }
+
+ boolean shouldEnableUnlock() {
+ return mShouldEnableUnlock;
+ }
+
+ /**
+ * Determine the current status of the lock screen given the sim state and other stuff.
+ */
+ public StatusMode getStatusForIccState(IccCard.State simState) {
+ boolean missingAndNotProvisioned = (!mUpdateMonitor.isDeviceProvisioned()
+ && (simState == IccCard.State.ABSENT || simState == IccCard.State.PERM_DISABLED));
+
+ // Assume we're NETWORK_LOCKED if not provisioned
+ simState = missingAndNotProvisioned ? State.NETWORK_LOCKED : simState;
+ switch (simState) {
+ case ABSENT:
+ return StatusMode.SimMissing;
+ case NETWORK_LOCKED:
+ return StatusMode.SimMissingLocked;
+ case NOT_READY:
+ return StatusMode.SimMissing;
+ case PIN_REQUIRED:
+ return StatusMode.SimLocked;
+ case PUK_REQUIRED:
+ return StatusMode.SimPukLocked;
+ case READY:
+ return StatusMode.Normal;
+ case PERM_DISABLED:
+ return StatusMode.SimPermDisabled;
+ case UNKNOWN:
+ return StatusMode.SimMissing;
+ }
+ return StatusMode.SimMissing;
+ }
+
+ private Context getContext() {
+ return mContainer.getContext();
+ }
+
+ /**
+ * Update carrier text, carrier help and emergency button to match the current status based
+ * on SIM state.
+ *
+ * @param simState
+ */
+ private void updateWithSimStatus(State simState) {
+ // The emergency call button no longer appears on this screen.
+ if (DEBUG) Log.d(TAG, "updateLayout: status=" + mStatus);
+
+ CharSequence carrierText = null;
+ int carrierHelpTextId = 0;
+ mShouldEnableUnlock = true;
+ mStatus = getStatusForIccState(simState);
+
+ switch (mStatus) {
+ case Normal:
+ carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(),
+ mUpdateMonitor.getTelephonySpn());
+ break;
+
+ case NetworkLocked:
+ carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(),
+ getContext().getText(R.string.lockscreen_network_locked_message));
+ carrierHelpTextId = R.string.lockscreen_instructions_when_pattern_disabled;
+ break;
+
+ case SimMissing:
+ carrierText = getContext().getText(R.string.lockscreen_missing_sim_message_short);
+ carrierHelpTextId = R.string.lockscreen_missing_sim_instructions_long;
+ break;
+
+ case SimPermDisabled:
+ carrierText = getContext().getText(R.string.lockscreen_missing_sim_message_short);
+ carrierHelpTextId = R.string.lockscreen_permanent_disabled_sim_instructions;
+ break;
+
+ case SimMissingLocked:
+ carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(),
+ getContext().getText(R.string.lockscreen_missing_sim_message_short));
+ carrierHelpTextId = R.string.lockscreen_missing_sim_instructions;
+ mShouldEnableUnlock = false;
+ break;
+
+ case SimLocked:
+ carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(),
+ getContext().getText(R.string.lockscreen_sim_locked_message));
+ break;
+
+ case SimPukLocked:
+ carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(),
+ getContext().getText(R.string.lockscreen_sim_puk_locked_message));
+ if (!mLockPatternUtils.isPukUnlockScreenEnable()) {
+ mShouldEnableUnlock = false;
+ }
+ break;
+ }
+
+ setCarrierText(carrierText);
+ setCarrierHelpText(carrierHelpTextId);
+ updateEmergencyCallButtonState();
+ }
+
+ private View findViewById(int id) {
+ return mContainer.findViewById(id);
+ }
+
+ /**
+ * The status of this lock screen. Primarily used for widgets on LockScreen.
+ */
+ enum StatusMode {
+ /**
+ * Normal case (sim card present, it's not locked)
+ */
+ Normal(true),
+
+ /**
+ * The sim card is 'network locked'.
+ */
+ NetworkLocked(true),
+
+ /**
+ * The sim card is missing.
+ */
+ SimMissing(false),
+
+ /**
+ * The sim card is missing, and this is the device isn't provisioned, so we don't let
+ * them get past the screen.
+ */
+ SimMissingLocked(false),
+
+ /**
+ * The sim card is PUK locked, meaning they've entered the wrong sim unlock code too many
+ * times.
+ */
+ SimPukLocked(false),
+
+ /**
+ * The sim card is locked.
+ */
+ SimLocked(true),
+
+ /**
+ * The sim card is permanently disabled due to puk unlock failure
+ */
+ SimPermDisabled(false);
+
+ private final boolean mShowStatusLines;
+
+ StatusMode(boolean mShowStatusLines) {
+ this.mShowStatusLines = mShowStatusLines;
+ }
+
+ /**
+ * @return Whether the status lines (battery level and / or next alarm) are shown while
+ * in this state. Mostly dictated by whether this is room for them.
+ */
+ public boolean shouldShowStatusLines() {
+ return mShowStatusLines;
+ }
+ }
+
+ private void updateEmergencyCallButtonState() {
+ if (mEmergencyCallButton != null) {
+ mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
+ if (mHideEmergencyCallButton) {
+ mEmergencyCallButton.setVisibility(View.GONE);
+ }
+ }
+ }
+
+ private KeyguardUpdateMonitor.InfoCallback mInfoCallback
+ = new KeyguardUpdateMonitor.InfoCallback() {
+
+ public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn,
+ int batteryLevel) {
+ mShowingBatteryInfo = showBatteryInfo;
+ mPluggedIn = pluggedIn;
+ mBatteryLevel = batteryLevel;
+ updateStatusLines(true);
+ }
+
+ public void onTimeChanged() {
+ refreshDate();
+ }
+
+ public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
+ setCarrierText(LockPatternUtils.getCarrierString(plmn, spn));
+ }
+
+ public void onRingerModeChanged(int state) {
+
+ }
+
+ public void onPhoneStateChanged(String newState) {
+ updateEmergencyCallButtonState();
+ }
+
+ public void onTransportControlStateChanged(int state) {
+ // TODO: define what state means
+ if (state == 0) {
+ leaveWidgetMode();
+ } else {
+ enterWidgetMode();
+ }
+ }
+ };
+
+ private SimStateCallback mSimStateCallback = new SimStateCallback() {
+
+ public void onSimStateChanged(State simState) {
+ updateWithSimStatus(simState);
+ }
+ };
+
+ public void onClick(View v) {
+ if (v == mEmergencyCallButton) {
+ mCallback.takeEmergencyCallAction();
+ }
+ }
+
+ public void hideEmergencyCallButton() {
+ mHideEmergencyCallButton = true;
+ }
+
+}
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index f385a23..7faf1a4 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -95,6 +95,7 @@ public class KeyguardUpdateMonitor {
private static final int MSG_SIM_STATE_CHANGE = 304;
private static final int MSG_RINGER_MODE_CHANGED = 305;
private static final int MSG_PHONE_STATE_CHANGED = 306;
+ private static final int MSG_TRANSPORT_CONTROL_STATE_CHANGED = 307;
/**
@@ -172,6 +173,9 @@ public class KeyguardUpdateMonitor {
case MSG_PHONE_STATE_CHANGED:
handlePhoneStateChanged((String)msg.obj);
break;
+ case MSG_TRANSPORT_CONTROL_STATE_CHANGED:
+ handleTransportControlStateChanged(msg.arg1);
+ break;
}
}
};
@@ -261,10 +265,23 @@ public class KeyguardUpdateMonitor {
String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
mHandler.sendMessage(mHandler.obtainMessage(MSG_PHONE_STATE_CHANGED, state));
}
+ // TODO
+ else if ("android.media.TRANSPORT_CONTROL_CHANGED".equals(action)) {
+ int state = intent.getIntExtra("state", 0);
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_TRANSPORT_CONTROL_STATE_CHANGED,
+ state));
+ }
}
}, filter);
}
+ protected void handleTransportControlStateChanged(int state) {
+ if (DEBUG) Log.d(TAG, "handleTransportControlStateChanged()");
+ for (int i = 0; i < mInfoCallbacks.size(); i++) {
+ mInfoCallbacks.get(i).onTransportControlStateChanged(state);
+ }
+ }
+
protected void handlePhoneStateChanged(String newState) {
if (DEBUG) Log.d(TAG, "handlePhoneStateChanged(" + newState + ")");
for (int i = 0; i < mInfoCallbacks.size(); i++) {
@@ -449,6 +466,12 @@ public class KeyguardUpdateMonitor {
* {@link TelephonyManager#EXTRA_STATE_OFFHOOK
*/
void onPhoneStateChanged(String newState);
+
+ /**
+ * Called when AudioService informs us of a change to the transport control client.
+ *
+ */
+ void onTransportControlStateChanged(int state);
}
/**
@@ -467,7 +490,8 @@ public class KeyguardUpdateMonitor {
if (!mInfoCallbacks.contains(callback)) {
mInfoCallbacks.add(callback);
} else {
- Log.e(TAG, "Object tried to add another INFO callback", new Exception("Whoops"));
+ if (DEBUG) Log.e(TAG, "Object tried to add another INFO callback",
+ new Exception("Whoops"));
}
}
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
index 7983278..e5a7d64 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
@@ -61,7 +61,8 @@ public class KeyguardViewManager implements KeyguardWindowController {
* @param callback Used to notify of changes.
*/
public KeyguardViewManager(Context context, ViewManager viewManager,
- KeyguardViewCallback callback, KeyguardViewProperties keyguardViewProperties, KeyguardUpdateMonitor updateMonitor) {
+ KeyguardViewCallback callback, KeyguardViewProperties keyguardViewProperties,
+ KeyguardUpdateMonitor updateMonitor) {
mContext = context;
mViewManager = viewManager;
mCallback = callback;
@@ -116,7 +117,7 @@ public class KeyguardViewManager implements KeyguardWindowController {
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
stretch, stretch, WindowManager.LayoutParams.TYPE_KEYGUARD,
flags, PixelFormat.TRANSLUCENT);
- lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
+ lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
lp.windowAnimations = com.android.internal.R.style.Animation_LockScreen;
lp.setTitle("Keyguard");
diff --git a/policy/src/com/android/internal/policy/impl/LockScreen.java b/policy/src/com/android/internal/policy/impl/LockScreen.java
index 1c4084c..4a14dd9 100644
--- a/policy/src/com/android/internal/policy/impl/LockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/LockScreen.java
@@ -17,32 +17,24 @@
package com.android.internal.policy.impl;
import com.android.internal.R;
-import com.android.internal.telephony.IccCard;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.SlidingTab;
import com.android.internal.widget.WaveView;
-import com.android.internal.widget.WaveView.OnTriggerListener;
import com.android.internal.widget.multiwaveview.MultiWaveView;
import android.app.ActivityManager;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.content.res.ColorStateList;
-import android.text.format.DateFormat;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
-import android.graphics.drawable.Drawable;
import android.util.Log;
import android.media.AudioManager;
-import android.os.SystemClock;
-import android.os.SystemProperties;
import android.provider.Settings;
-import java.util.Date;
import java.io.File;
/**
@@ -50,104 +42,30 @@ import java.io.File;
* information about the device depending on its state, and how to get
* past it, as applicable.
*/
-class LockScreen extends LinearLayout implements KeyguardScreen,
- KeyguardUpdateMonitor.InfoCallback,
- KeyguardUpdateMonitor.SimStateCallback {
+class LockScreen extends LinearLayout implements KeyguardScreen {
private static final boolean DBG = false;
private static final String TAG = "LockScreen";
private static final String ENABLE_MENU_KEY_FILE = "/data/local/enable_menu_key";
-
- private Status mStatus = Status.Normal;
+ private static final int WAIT_FOR_ANIMATION_TIMEOUT = 0;
+ private static final int STAY_ON_WHILE_GRABBED_TIMEOUT = 30000;
private LockPatternUtils mLockPatternUtils;
private KeyguardUpdateMonitor mUpdateMonitor;
private KeyguardScreenCallback mCallback;
- private TextView mScreenLocked;
- private TextView mEmergencyCallText;
- private Button mEmergencyCallButton;
-
// current configuration state of keyboard and display
private int mKeyboardHidden;
private int mCreationOrientation;
- // are we showing battery information?
- private boolean mShowingBatteryInfo = false;
-
- // last known plugged in state
- private boolean mPluggedIn = false;
-
- // last known battery level
- private int mBatteryLevel = 100;
-
private boolean mSilentMode;
private AudioManager mAudioManager;
- private String mDateFormatString;
- private java.text.DateFormat mTimeFormat;
private boolean mEnableMenuKeyInLockScreen;
- private StatusView mStatusView;
+ private KeyguardStatusViewManager mStatusViewManager;
private UnlockWidgetCommonMethods mUnlockWidgetMethods;
private View mUnlockWidget;
-
- /**
- * The status of this lock screen.
- */
- enum Status {
- /**
- * Normal case (sim card present, it's not locked)
- */
- Normal(true),
-
- /**
- * The sim card is 'network locked'.
- */
- NetworkLocked(true),
-
- /**
- * The sim card is missing.
- */
- SimMissing(false),
-
- /**
- * The sim card is missing, and this is the device isn't provisioned, so we don't let
- * them get past the screen.
- */
- SimMissingLocked(false),
-
- /**
- * The sim card is PUK locked, meaning they've entered the wrong sim unlock code too many
- * times.
- */
- SimPukLocked(false),
-
- /**
- * The sim card is locked.
- */
- SimLocked(true),
-
- /**
- * The sim card is permanently disabled due to puk unlock failure
- */
- SimPermDisabled(false);
-
- private final boolean mShowStatusLines;
-
- Status(boolean mShowStatusLines) {
- this.mShowStatusLines = mShowStatusLines;
- }
-
- /**
- * @return Whether the status lines (battery level and / or next alarm) are shown while
- * in this state. Mostly dictated by whether this is room for them.
- */
- public boolean showStatusLines() {
- return mShowStatusLines;
- }
- }
-
private interface UnlockWidgetCommonMethods {
// Update resources based on phone state
public void updateResources();
@@ -191,7 +109,6 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
mCallback.goToUnlockScreen();
} else if (whichHandle == SlidingTab.OnTriggerListener.RIGHT_HANDLE) {
toggleRingMode();
- doSilenceRingToast();
mCallback.pokeWakelock();
}
}
@@ -223,9 +140,6 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
}
}
- private static final int WAIT_FOR_ANIMATION_TIMEOUT = 0;
- private static final int STAY_ON_WHILE_GRABBED_TIMEOUT = 30000;
-
class WaveViewMethods implements WaveView.OnTriggerListener, UnlockWidgetCommonMethods {
private final WaveView mWaveView;
@@ -290,7 +204,6 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
mCallback.goToUnlockScreen();
} else if (target == 2) {
toggleRingMode();
- doSilenceRingToast();
mUnlockWidgetMethods.updateResources();
mCallback.pokeWakelock();
}
@@ -327,27 +240,12 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
}, WAIT_FOR_ANIMATION_TIMEOUT);
}
- private void doSilenceRingToast() {
- String message = mSilentMode ?
- getContext().getString(R.string.global_action_silent_mode_on_status) :
- getContext().getString(R.string.global_action_silent_mode_off_status);
-
- final int toastIcon = mSilentMode
- ? R.drawable.ic_lock_ringer_off
- : R.drawable.ic_lock_ringer_on;
-
- final int toastColor = mSilentMode
- ? getContext().getResources().getColor(R.color.keyguard_text_color_soundoff)
- : getContext().getResources().getColor(R.color.keyguard_text_color_soundon);
- toastMessage(mScreenLocked, message, toastColor, toastIcon);
- }
-
private void toggleRingMode() {
// toggle silent mode
mSilentMode = !mSilentMode;
if (mSilentMode) {
final boolean vibe = (Settings.System.getInt(
- getContext().getContentResolver(),
+ mContext.getContentResolver(),
Settings.System.VIBRATE_IN_SILENT, 1) == 1);
mAudioManager.setRingerMode(vibe
@@ -409,29 +307,17 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
inflater.inflate(R.layout.keyguard_screen_tab_unlock_land, this, true);
}
- mStatusView = new StatusView(this, mUpdateMonitor, mLockPatternUtils);
-
- mScreenLocked = (TextView) findViewById(R.id.screenLocked);
+ mStatusViewManager = new KeyguardStatusViewManager(this, mUpdateMonitor, mLockPatternUtils,
+ mCallback);
- mEmergencyCallText = (TextView) findViewById(R.id.emergencyCallText);
- mEmergencyCallButton = (Button) findViewById(R.id.emergencyCallButton);
- mEmergencyCallButton.setText(R.string.lockscreen_emergency_call);
-
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
- mEmergencyCallButton.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- mCallback.takeEmergencyCallAction();
- }
- });
+ // LockScreen doesn't show the emergency call button by default
+ mStatusViewManager.hideEmergencyCallButton();
setFocusable(true);
setFocusableInTouchMode(true);
setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
- mUpdateMonitor.registerInfoCallback(this);
- mUpdateMonitor.registerSimStateCallback(this);
-
- mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
+ mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mSilentMode = isSilentMode();
mUnlockWidget = findViewById(R.id.unlock_widget);
@@ -466,28 +352,12 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
if (DBG) Log.v(TAG, "*** LockScreen accel is "
+ (mUnlockWidget.isHardwareAccelerated() ? "on":"off"));
-
- resetStatusInfo(updateMonitor);
}
private boolean isSilentMode() {
return mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL;
}
- private void resetStatusInfo(KeyguardUpdateMonitor updateMonitor) {
- mShowingBatteryInfo = updateMonitor.shouldShowBatteryInfo();
- mPluggedIn = updateMonitor.isDevicePluggedIn();
- mBatteryLevel = updateMonitor.getBatteryLevel();
-
- mStatus = getCurrentStatus(updateMonitor.getSimState());
- updateLayout(mStatus);
-
- mTimeFormat = DateFormat.getTimeFormat(getContext());
- mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year);
- refreshTimeAndDateDisplay();
- updateStatusLines();
- }
-
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && mEnableMenuKeyInLockScreen) {
@@ -496,263 +366,6 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
return false;
}
- /**
- * Displays a message in a text view and then restores the previous text.
- * @param textView The text view.
- * @param text The text.
- * @param color The color to apply to the text, or 0 if the existing color should be used.
- * @param iconResourceId The left hand icon.
- */
- private void toastMessage(final TextView textView, final String text, final int color, final int iconResourceId) {
- if (mPendingR1 != null) {
- textView.removeCallbacks(mPendingR1);
- mPendingR1 = null;
- }
- if (mPendingR2 != null) {
- mPendingR2.run(); // fire immediately, restoring non-toasted appearance
- textView.removeCallbacks(mPendingR2);
- mPendingR2 = null;
- }
-
- final String oldText = textView.getText().toString();
- final ColorStateList oldColors = textView.getTextColors();
-
- mPendingR1 = new Runnable() {
- public void run() {
- textView.setText(text);
- if (color != 0) {
- textView.setTextColor(color);
- }
- textView.setCompoundDrawablesWithIntrinsicBounds(iconResourceId, 0, 0, 0);
- }
- };
-
- textView.postDelayed(mPendingR1, 0);
- mPendingR2 = new Runnable() {
- public void run() {
- textView.setText(oldText);
- textView.setTextColor(oldColors);
- textView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
- }
- };
- textView.postDelayed(mPendingR2, 3500);
- }
- private Runnable mPendingR1;
- private Runnable mPendingR2;
-
- /** {@inheritDoc} */
- public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn,
- int batteryLevel) {
- if (DBG) Log.d(TAG, "onRefreshBatteryInfo(" + showBatteryInfo + ", " + pluggedIn + ")");
-
- mStatusView.onRefreshBatteryInfo(showBatteryInfo, pluggedIn, batteryLevel);
-
- mShowingBatteryInfo = showBatteryInfo;
- mPluggedIn = pluggedIn;
- mBatteryLevel = batteryLevel;
-
- updateStatusLines();
- }
-
- /** {@inheritDoc} */
- public void onTimeChanged() {
- refreshTimeAndDateDisplay();
- }
-
- private void refreshTimeAndDateDisplay() {
- mStatusView.refreshTimeAndDateDisplay();
- }
-
- private void updateStatusLines() {
- mStatusView.updateStatusLines(mStatus.showStatusLines());
- }
-
- /** {@inheritDoc} */
- public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
- if (DBG) Log.d(TAG, "onRefreshCarrierInfo(" + plmn + ", " + spn + ")");
- updateLayout(mStatus);
- }
-
- /**
- * Determine the current status of the lock screen given the sim state and other stuff.
- */
- private Status getCurrentStatus(IccCard.State simState) {
- boolean missingAndNotProvisioned = (!mUpdateMonitor.isDeviceProvisioned()
- && (simState == IccCard.State.ABSENT
- || simState == IccCard.State.PERM_DISABLED));
-
- if (missingAndNotProvisioned) {
- return Status.SimMissingLocked;
- }
-
- switch (simState) {
- case ABSENT:
- return Status.SimMissing;
- case NETWORK_LOCKED:
- return Status.SimMissingLocked;
- case NOT_READY:
- return Status.SimMissing;
- case PIN_REQUIRED:
- return Status.SimLocked;
- case PUK_REQUIRED:
- return Status.SimPukLocked;
- case READY:
- return Status.Normal;
- case PERM_DISABLED:
- return Status.SimPermDisabled;
- case UNKNOWN:
- return Status.SimMissing;
- }
- return Status.SimMissing;
- }
-
- /**
- * Enables unlocking of this screen. Typically just shows the unlock widget.
- */
- private void enableUnlock() {
- mUnlockWidgetMethods.getView().setVisibility(View.VISIBLE);
- }
-
- /**
- * Disable unlocking of this screen. Typically just hides the unlock widget.
- */
- private void disableUnlock() {
- mUnlockWidgetMethods.getView().setVisibility(View.GONE);
- }
-
- /**
- * Update the layout to match the current status.
- */
- private void updateLayout(Status status) {
- // The emergency call button no longer appears on this screen.
- if (DBG) Log.d(TAG, "updateLayout: status=" + status);
-
- mEmergencyCallButton.setVisibility(View.GONE); // in almost all cases
-
- switch (status) {
- case Normal:
- // text
- mStatusView.setCarrierText(
- getCarrierString(
- mUpdateMonitor.getTelephonyPlmn(),
- mUpdateMonitor.getTelephonySpn()));
-
- // Empty now, but used for sliding tab feedback
- mScreenLocked.setText("");
-
- // layout
- mScreenLocked.setVisibility(View.INVISIBLE);
- mEmergencyCallText.setVisibility(View.GONE);
- enableUnlock();
- break;
-
- case NetworkLocked:
- // The carrier string shows both sim card status (i.e. No Sim Card) and
- // carrier's name and/or "Emergency Calls Only" status
- mStatusView.setCarrierText(
- getCarrierString(
- mUpdateMonitor.getTelephonyPlmn(),
- getContext().getText(R.string.lockscreen_network_locked_message)));
- mScreenLocked.setText(R.string.lockscreen_instructions_when_pattern_disabled);
-
- // layout
- mScreenLocked.setVisibility(View.VISIBLE);
- mEmergencyCallText.setVisibility(View.GONE);
- enableUnlock();
- break;
-
- case SimMissing:
- // text
- mStatusView.setCarrierText(R.string.lockscreen_missing_sim_message_short);
- mScreenLocked.setText(R.string.lockscreen_missing_sim_instructions_long);
-
- // layout
- mScreenLocked.setVisibility(View.VISIBLE);
- mLockPatternUtils.updateEmergencyCallText(mEmergencyCallText);
- enableUnlock(); // do not need to show the e-call button; user may unlock
- break;
-
- case SimPermDisabled:
- // text
- mStatusView.setCarrierText(R.string.lockscreen_missing_sim_message_short);
- mScreenLocked.setText(
- R.string.lockscreen_permanent_disabled_sim_instructions);
-
- // layout
- mScreenLocked.setVisibility(View.VISIBLE);
- mLockPatternUtils.updateEmergencyCallText(mEmergencyCallText);
- enableUnlock(); // do not need to show the e-call button; user may unlock
- break;
-
- case SimMissingLocked:
- // text
- mStatusView.setCarrierText(
- getCarrierString(
- mUpdateMonitor.getTelephonyPlmn(),
- getContext().getText(R.string.lockscreen_missing_sim_message_short)));
- mScreenLocked.setText(R.string.lockscreen_missing_sim_instructions);
-
- // layout
- mScreenLocked.setVisibility(View.VISIBLE);
- mLockPatternUtils.updateEmergencyCallText(mEmergencyCallText);
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
- disableUnlock();
- break;
-
- case SimLocked:
- // text
- mStatusView.setCarrierText(
- getCarrierString(
- mUpdateMonitor.getTelephonyPlmn(),
- getContext().getText(R.string.lockscreen_sim_locked_message)));
-
- // layout
- mScreenLocked.setVisibility(View.INVISIBLE);
- mEmergencyCallText.setVisibility(View.GONE);
- enableUnlock();
- break;
-
- case SimPukLocked:
- // text
- mStatusView.setCarrierText(
- getCarrierString(
- mUpdateMonitor.getTelephonyPlmn(),
- getContext().getText(R.string.lockscreen_sim_puk_locked_message)));
- mScreenLocked.setText(R.string.lockscreen_sim_puk_locked_instructions);
-
- // layout
- mLockPatternUtils.updateEmergencyCallText(mEmergencyCallText);
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
- if (mLockPatternUtils.isPukUnlockScreenEnable()) {
- mScreenLocked.setVisibility(View.INVISIBLE);
- enableUnlock();
- } else {
- mScreenLocked.setVisibility(View.VISIBLE);
- disableUnlock();
- }
- break;
- }
- }
-
- static CharSequence getCarrierString(CharSequence telephonyPlmn, CharSequence telephonySpn) {
- if (telephonyPlmn != null && telephonySpn == null) {
- return telephonyPlmn;
- } else if (telephonyPlmn != null && telephonySpn != null) {
- return telephonyPlmn + "|" + telephonySpn;
- } else if (telephonyPlmn == null && telephonySpn != null) {
- return telephonySpn;
- } else {
- return "";
- }
- }
-
- public void onSimStateChanged(IccCard.State simState) {
- if (DBG) Log.d(TAG, "onSimStateChanged(" + simState + ")");
- mStatus = getCurrentStatus(simState);
- updateLayout(mStatus);
- updateStatusLines();
- }
-
void updateConfiguration() {
Configuration newConfig = getResources().getConfiguration();
if (newConfig.orientation != mCreationOrientation) {
@@ -796,12 +409,13 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
/** {@inheritDoc} */
public void onPause() {
+ mStatusViewManager.onPause();
mUnlockWidgetMethods.reset(false);
}
/** {@inheritDoc} */
public void onResume() {
- resetStatusInfo(mUpdateMonitor);
+ mStatusViewManager.onResume();
mUnlockWidgetMethods.ping();
}
diff --git a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
index e177565..7c1f93a 100644
--- a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
@@ -21,7 +21,6 @@ import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Rect;
-import com.android.internal.policy.impl.PatternUnlockScreen.FooterMode;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.PasswordEntryKeyboardView;
@@ -38,6 +37,7 @@ import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
@@ -53,7 +53,7 @@ import com.android.internal.widget.PasswordEntryKeyboardHelper;
* an unlock password
*/
public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen,
- View.OnClickListener, KeyguardUpdateMonitor.InfoCallback, OnEditorActionListener {
+ OnEditorActionListener {
private static final String TAG = "PasswordUnlockScreen";
private final KeyguardUpdateMonitor mUpdateMonitor;
@@ -62,19 +62,16 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
private boolean mIsAlpha;
private EditText mPasswordEntry;
- private Button mEmergencyCallButton;
private LockPatternUtils mLockPatternUtils;
private PasswordEntryKeyboardView mKeyboardView;
- private PasswordEntryKeyboardView mKeyboardViewAlpha;
private PasswordEntryKeyboardHelper mKeyboardHelper;
- private PasswordEntryKeyboardHelper mKeyboardHelperAlpha;
private int mCreationOrientation;
private int mCreationHardKeyboardHidden;
private CountDownTimer mCountdownTimer;
- private StatusView mStatusView;
- private final boolean mUseSystemIME = true; // TODO: Make configurable
+ private KeyguardStatusViewManager mStatusViewManager;
+ private boolean mUseSystemIME = true; // TODO: Make configurable
private boolean mResuming; // used to prevent poking the wakelock during onResume()
// To avoid accidental lockout due to events while the device in in the pocket, ignore
@@ -99,48 +96,28 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
layoutInflater.inflate(R.layout.keyguard_screen_password_landscape, this, true);
}
- mStatusView = new StatusView(this, mUpdateMonitor, mLockPatternUtils);
+ mStatusViewManager = new KeyguardStatusViewManager(this, mUpdateMonitor, mLockPatternUtils,
+ mCallback);
final int quality = lockPatternUtils.getKeyguardStoredPasswordQuality();
mIsAlpha = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == quality
|| DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC == quality
|| DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == quality;
- // TODO: re-enable on phones with keyboards
- final boolean isPhysicalKbShowing = false;
mKeyboardView = (PasswordEntryKeyboardView) findViewById(R.id.keyboard);
- mKeyboardViewAlpha = (PasswordEntryKeyboardView) findViewById(R.id.keyboardAlpha);
mPasswordEntry = (EditText) findViewById(R.id.passwordEntry);
mPasswordEntry.setOnEditorActionListener(this);
- mPasswordEntry.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- if (mIsAlpha && !isPhysicalKbShowing && !mUseSystemIME) {
- // Toggle visibility of alpha keyboard
- final boolean visible = mKeyboardViewAlpha.getVisibility() == View.VISIBLE;
- mKeyboardViewAlpha.setVisibility(visible ? View.GONE : View.VISIBLE);
- }
- mCallback.pokeWakelock();
- }
- });
-
- mEmergencyCallButton = (Button) findViewById(R.id.emergencyCallButton);
- mEmergencyCallButton.setOnClickListener(this);
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
mKeyboardHelper = new PasswordEntryKeyboardHelper(context, mKeyboardView, this, false);
- //mCreationHardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO;
- if (mKeyboardViewAlpha == null || !mIsAlpha) {
- mKeyboardHelper.setKeyboardMode(mIsAlpha ?
- PasswordEntryKeyboardHelper.KEYBOARD_MODE_ALPHA
- : PasswordEntryKeyboardHelper.KEYBOARD_MODE_NUMERIC);
- mKeyboardView.setVisibility(isPhysicalKbShowing ? View.INVISIBLE : View.VISIBLE);
+ if (mIsAlpha) {
+ // We always use the system IME for alpha keyboard, so hide lockscreen's soft keyboard
+ mKeyboardHelper.setKeyboardMode(PasswordEntryKeyboardHelper.KEYBOARD_MODE_ALPHA);
+ mKeyboardView.setVisibility(View.GONE);
} else {
- mKeyboardHelperAlpha = new PasswordEntryKeyboardHelper(context, mKeyboardViewAlpha,
- this, false);
+ // Use lockscreen's numeric keyboard if the physical keyboard isn't showing
mKeyboardHelper.setKeyboardMode(PasswordEntryKeyboardHelper.KEYBOARD_MODE_NUMERIC);
- mKeyboardHelperAlpha.setKeyboardMode(PasswordEntryKeyboardHelper.KEYBOARD_MODE_ALPHA);
- mKeyboardView.setVisibility(View.GONE);
- mPasswordEntry.setWidth(mKeyboardViewAlpha.getLayoutParams().width);
+ mKeyboardView.setVisibility(mCreationHardKeyboardHidden
+ == Configuration.HARDKEYBOARDHIDDEN_NO ? View.INVISIBLE : View.VISIBLE);
}
mPasswordEntry.requestFocus();
@@ -150,34 +127,25 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
mPasswordEntry.setKeyListener(TextKeyListener.getInstance());
mPasswordEntry.setInputType(InputType.TYPE_CLASS_TEXT
| InputType.TYPE_TEXT_VARIATION_PASSWORD);
- // mStatusView.setHelpMessage(R.string.keyguard_password_enter_password_code,
- // StatusView.LOCK_ICON);
+ //mStatusViewManager.setHelpMessage(R.string.keyguard_password_enter_password_code,
+ //KeyguardStatusViewManager.LOCK_ICON);
} else {
mPasswordEntry.setKeyListener(DigitsKeyListener.getInstance());
mPasswordEntry.setInputType(InputType.TYPE_CLASS_NUMBER
| InputType.TYPE_NUMBER_VARIATION_PASSWORD);
- //mStatusView.setHelpMessage(R.string.keyguard_password_enter_pin_code,
- // StatusView.LOCK_ICON);
+ //mStatusViewManager.setHelpMessage(R.string.keyguard_password_enter_pin_code,
+ //KeyguardStatusViewManager.LOCK_ICON);
}
mKeyboardHelper.setVibratePattern(mLockPatternUtils.isTactileFeedbackEnabled() ?
com.android.internal.R.array.config_virtualKeyVibePattern : 0);
- if (mKeyboardHelperAlpha != null) {
- mKeyboardHelperAlpha.setVibratePattern(mLockPatternUtils.isTactileFeedbackEnabled() ?
- com.android.internal.R.array.config_virtualKeyVibePattern : 0);
- }
-
- // until we get an update...
- mStatusView.setCarrierText(LockScreen.getCarrierString(
- mUpdateMonitor.getTelephonyPlmn(),
- mUpdateMonitor.getTelephonySpn()));
- mUpdateMonitor.registerInfoCallback(this);
- //mUpdateMonitor.registerSimStateCallback(this);
-
- resetStatusInfo();
-
- // Poke the wakelock any time the text is modified
+ // Poke the wakelock any time the text is selected or modified
+ mPasswordEntry.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ mCallback.pokeWakelock();
+ }
+ });
mPasswordEntry.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@@ -206,20 +174,18 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
/** {@inheritDoc} */
public void onPause() {
-
+ mStatusViewManager.onPause();
}
/** {@inheritDoc} */
public void onResume() {
mResuming = true;
// reset status
- mStatusView.resetStatusInfo(mUpdateMonitor, mLockPatternUtils);
+ mStatusViewManager.onResume();
// start fresh
mPasswordEntry.setText("");
- resetStatusInfo();
mPasswordEntry.requestFocus();
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
// if the user is currently locked out, enforce it.
long deadline = mLockPatternUtils.getLockoutAttemptDeadline();
@@ -234,19 +200,12 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
mUpdateMonitor.removeCallback(this);
}
- public void onClick(View v) {
- if (v == mEmergencyCallButton) {
- mCallback.takeEmergencyCallAction();
- }
- mCallback.pokeWakelock();
- }
-
private void verifyPasswordAndUnlock() {
String entry = mPasswordEntry.getText().toString();
if (mLockPatternUtils.checkPassword(entry)) {
mCallback.keyguardDone(true);
mCallback.reportSuccessfulUnlockAttempt();
- mStatusView.setInstructionText(null);
+ mStatusViewManager.setInstructionText(null);
KeyStore.getInstance().password(entry);
} else if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT ) {
// to avoid accidental lockout, only count attempts that are long enough to be a
@@ -257,9 +216,11 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
handleAttemptLockout(deadline);
}
- mStatusView.setInstructionText(R.string.lockscreen_password_wrong);
+ mStatusViewManager.setInstructionText(
+ mContext.getString(R.string.lockscreen_password_wrong));
} else if (entry.length() > 0) {
- mStatusView.setInstructionText(R.string.lockscreen_password_wrong);
+ mStatusViewManager.setInstructionText(
+ mContext.getString(R.string.lockscreen_password_wrong));
}
mPasswordEntry.setText("");
}
@@ -277,19 +238,19 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
String instructions = getContext().getString(
R.string.lockscreen_too_many_failed_attempts_countdown,
secondsRemaining);
- mStatusView.setInstructionText(instructions);
+ mStatusViewManager.setInstructionText(instructions);
}
@Override
public void onFinish() {
mPasswordEntry.setEnabled(true);
mKeyboardView.setEnabled(true);
- resetStatusInfo();
+ mStatusViewManager.resetStatusInfo();
+ mCountdownTimer = null;
}
}.start();
}
-
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
mCallback.pokeWakelock();
@@ -329,39 +290,4 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
}
return false;
}
-
- // ---------- InfoCallback
-
- /** {@inheritDoc} */
- public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) {
- mStatusView.onRefreshBatteryInfo(showBatteryInfo, pluggedIn, batteryLevel);
- }
-
- /** {@inheritDoc} */
- public void onTimeChanged() {
- mStatusView.onTimeChanged();
- }
-
- /** {@inheritDoc} */
- public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
- mStatusView.onRefreshCarrierInfo(plmn, spn);
- }
-
- /** {@inheritDoc} */
- public void onRingerModeChanged(int state) {
- // not currently used
- }
-
- // ---------- SimStateCallback
-
- /** {@inheritDoc} */
- public void onPhoneStateChanged(String newState) {
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
- }
-
- private void resetStatusInfo() {
- mStatusView.setInstructionText(null);
- mStatusView.updateStatusLines(true);
- }
-
}
diff --git a/policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java b/policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java
index 6573286..a3db1c3 100644
--- a/policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java
@@ -23,13 +23,10 @@ import android.os.SystemClock;
import android.security.KeyStore;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
import android.view.MotionEvent;
import android.widget.Button;
import android.util.Log;
import com.android.internal.R;
-import com.android.internal.telephony.IccCard;
import com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternView;
@@ -42,8 +39,7 @@ import java.util.List;
* the user how to unlock their device, or make an emergency call.
*/
class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
- implements KeyguardScreen, KeyguardUpdateMonitor.InfoCallback,
- KeyguardUpdateMonitor.SimStateCallback {
+ implements KeyguardScreen {
private static final boolean DEBUG = false;
private static final String TAG = "UnlockScreen";
@@ -73,7 +69,7 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
*/
private boolean mEnableFallback;
- private StatusView mStatusView;
+ private KeyguardStatusViewManager mKeyguardStatusViewManager;
private LockPatternView mLockPatternView;
/**
@@ -93,12 +89,6 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
}
};
- private final OnClickListener mEmergencyClick = new OnClickListener() {
- public void onClick(View v) {
- mCallback.takeEmergencyCallAction();
- }
- };
-
private final OnClickListener mForgotPatternClick = new OnClickListener() {
public void onClick(View v) {
mCallback.forgotPattern(true);
@@ -106,7 +96,6 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
};
private Button mForgotPatternButton;
- private Button mEmergencyButton;
private int mCreationOrientation;
enum FooterMode {
@@ -181,19 +170,11 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
inflater.inflate(R.layout.keyguard_screen_unlock_landscape, this, true);
}
- mStatusView = new StatusView(this, mUpdateMonitor, mLockPatternUtils);
- // This shows up when no other information is required on status1
- //mStatusView.setHelpMessage(R.string.lockscreen_pattern_instructions,StatusView.LOCK_ICON);
+ mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, mUpdateMonitor,
+ mLockPatternUtils, mCallback);
mLockPatternView = (LockPatternView) findViewById(R.id.lockPattern);
- // emergency call buttons
- mEmergencyButton = (Button) findViewById(R.id.emergencyCallButton);
- mEmergencyButton.setFocusable(false); // touch only!
- mEmergencyButton.setOnClickListener(mEmergencyClick);
-
- refreshEmergencyButtonText();
-
mForgotPatternButton = (Button) findViewById(R.id.forgotPatternButton);
mForgotPatternButton.setText(R.string.lockscreen_forgot_pattern_button_text);
mForgotPatternButton.setOnClickListener(mForgotPatternClick);
@@ -215,20 +196,10 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
// assume normal footer mode for now
updateFooter(FooterMode.Normal);
- mUpdateMonitor.registerInfoCallback(this);
- mUpdateMonitor.registerSimStateCallback(this);
setFocusableInTouchMode(true);
-
- // until we get an update...
- mStatusView.setCarrierText(LockScreen.getCarrierString(
- mUpdateMonitor.getTelephonyPlmn(),
- mUpdateMonitor.getTelephonySpn()));
-
}
- private void refreshEmergencyButtonText() {
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyButton);
- }
+
public void setEnableFallback(boolean state) {
if (DEBUG) Log.d(TAG, "setEnableFallback(" + state + ")");
@@ -249,34 +220,6 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
return result;
}
- // ---------- InfoCallback
-
- /** {@inheritDoc} */
- public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) {
- mStatusView.onRefreshBatteryInfo(showBatteryInfo, pluggedIn, batteryLevel);
- }
-
- /** {@inheritDoc} */
- public void onTimeChanged() {
- mStatusView.onTimeChanged();
- }
-
- /** {@inheritDoc} */
- public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
- mStatusView.onRefreshCarrierInfo(plmn, spn);
- }
-
- /** {@inheritDoc} */
- public void onRingerModeChanged(int state) {
- // not currently used
- }
-
- // ---------- SimStateCallback
-
- /** {@inheritDoc} */
- public void onSimStateChanged(IccCard.State simState) {
- }
-
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
@@ -319,12 +262,13 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
mCountdownTimer.cancel();
mCountdownTimer = null;
}
+ mKeyguardStatusViewManager.onPause();
}
/** {@inheritDoc} */
public void onResume() {
// reset status
- mStatusView.resetStatusInfo(mUpdateMonitor, mLockPatternUtils);
+ mKeyguardStatusViewManager.onResume();
// reset lock pattern
mLockPatternView.enableInput();
@@ -354,7 +298,6 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
updateFooter(FooterMode.Normal);
}
- refreshEmergencyButtonText();
}
/** {@inheritDoc} */
@@ -401,8 +344,8 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
if (mLockPatternUtils.checkPattern(pattern)) {
mLockPatternView
.setDisplayMode(LockPatternView.DisplayMode.Correct);
- mStatusView.setInstructions("");
- mStatusView.updateStatusLines(true);
+ mKeyguardStatusViewManager.setInstructionText("");
+ mKeyguardStatusViewManager.updateStatusLines(true);
mCallback.keyguardDone(true);
mCallback.reportSuccessfulUnlockAttempt();
KeyStore.getInstance().password(LockPatternUtils.patternToString(pattern));
@@ -423,9 +366,9 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
handleAttemptLockout(deadline);
} else {
// TODO mUnlockIcon.setVisibility(View.VISIBLE);
- mStatusView.setInstructions(
+ mKeyguardStatusViewManager.setInstructionText(
getContext().getString(R.string.lockscreen_pattern_wrong));
- mStatusView.updateStatusLines(true);
+ mKeyguardStatusViewManager.updateStatusLines(true);
mLockPatternView.postDelayed(
mCancelPatternRunnable,
PATTERN_CLEAR_TIMEOUT_MS);
@@ -449,18 +392,18 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
@Override
public void onTick(long millisUntilFinished) {
int secondsRemaining = (int) (millisUntilFinished / 1000);
- mStatusView.setInstructions(getContext().getString(
+ mKeyguardStatusViewManager.setInstructionText(getContext().getString(
R.string.lockscreen_too_many_failed_attempts_countdown,
secondsRemaining));
- mStatusView.updateStatusLines(true);
+ mKeyguardStatusViewManager.updateStatusLines(true);
}
@Override
public void onFinish() {
mLockPatternView.setEnabled(true);
- mStatusView.setInstructions(getContext().getString(
+ mKeyguardStatusViewManager.setInstructionText(getContext().getString(
R.string.lockscreen_pattern_instructions));
- mStatusView.updateStatusLines(true);
+ mKeyguardStatusViewManager.updateStatusLines(true);
// TODO mUnlockIcon.setVisibility(View.VISIBLE);
mFailedPatternAttemptsSinceLastTimeout = 0;
if (mEnableFallback) {
@@ -472,7 +415,4 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
}.start();
}
- public void onPhoneStateChanged(String newState) {
- refreshEmergencyButtonText();
- }
}
diff --git a/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java b/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java
index 7e8d547..f968bee 100644
--- a/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java
@@ -24,11 +24,9 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import com.android.internal.telephony.ITelephony;
-import com.android.internal.telephony.IccCard;
import com.android.internal.widget.LockPatternUtils;
import android.text.Editable;
-import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
@@ -42,7 +40,7 @@ import com.android.internal.R;
* Displays a dialer like interface to unlock the SIM PUK.
*/
public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
- View.OnClickListener, KeyguardUpdateMonitor.InfoCallback {
+ View.OnClickListener {
private static final int DIGIT_PRESS_WAKE_MILLIS = 5000;
@@ -56,7 +54,6 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
private TextView mFocusedEntry;
private TextView mOkButton;
- private Button mEmergencyCallButton;
private View mDelPukButton;
private View mDelPinButton;
@@ -69,6 +66,8 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
private int mKeyboardHidden;
+ private KeyguardStatusViewManager mKeyguardStatusViewManager;
+
private static final char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
public SimPukUnlockScreen(Context context, Configuration configuration,
@@ -108,8 +107,6 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
mDelPinButton = findViewById(R.id.pinDel);
mDelPinButton.setOnClickListener(this);
-
- mEmergencyCallButton = (Button) findViewById(R.id.emergencyCallButton);
mOkButton = (TextView) findViewById(R.id.ok);
mHeaderText.setText(R.string.keyguard_password_enter_puk_code);
@@ -119,12 +116,8 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
requestFocus(mPukText);
- if (mLockPatternUtils.isEmergencyCallCapable()) {
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
- mEmergencyCallButton.setOnClickListener(this);
- } else {
- mEmergencyCallButton.setVisibility(View.GONE);
- }
+ mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, updateMonitor,
+ lockpatternutils, callback);
setFocusableInTouchMode(true);
}
@@ -141,7 +134,7 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
/** {@inheritDoc} */
public void onPause() {
-
+ mKeyguardStatusViewManager.onPause();
}
/** {@inheritDoc} */
@@ -151,9 +144,7 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
requestFocus(mPukText);
mPinText.setText("");
- if (mLockPatternUtils.isEmergencyCallCapable()) {
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
- }
+ mKeyguardStatusViewManager.onResume();
}
/** {@inheritDoc} */
@@ -221,8 +212,6 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
} else if (v == mPinText) {
requestFocus(mPinText);
mCallback.pokeWakelock();
- } else if (v == mEmergencyCallButton) {
- mCallback.takeEmergencyCallAction();
} else if (v == mOkButton) {
checkPuk();
}
@@ -446,25 +435,4 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen,
}
}
- public void onPhoneStateChanged(String newState) {
- if (mLockPatternUtils.isEmergencyCallCapable()) {
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
- }
- }
-
- public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) {
-
- }
-
- public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
-
- }
-
- public void onRingerModeChanged(int state) {
-
- }
-
- public void onTimeChanged() {
-
- }
}
diff --git a/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java b/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java
index ec917f0..8bac969 100644
--- a/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java
@@ -39,8 +39,7 @@ import com.android.internal.R;
/**
* Displays a dialer like interface to unlock the SIM PIN.
*/
-public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, View.OnClickListener,
- KeyguardUpdateMonitor.InfoCallback {
+public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, View.OnClickListener {
private static final int DIGIT_PRESS_WAKE_MILLIS = 5000;
@@ -51,7 +50,6 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
private TextView mPinText;
private TextView mOkButton;
- private Button mEmergencyCallButton;
private View mBackSpaceButton;
@@ -66,6 +64,8 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
private int mKeyboardHidden;
+ private KeyguardStatusViewManager mKeyguardStatusViewManager;
+
private static final char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
public SimUnlockScreen(Context context, Configuration configuration,
@@ -99,9 +99,8 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
mOkButton.setOnClickListener(this);
- mEmergencyCallButton = (Button) findViewById(R.id.emergencyCallButton);
- mEmergencyCallButton.setOnClickListener(this);
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
+ mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, updateMonitor,
+ lockpatternutils, callback);
setFocusableInTouchMode(true);
}
@@ -113,7 +112,7 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
/** {@inheritDoc} */
public void onPause() {
-
+ mKeyguardStatusViewManager.onPause();
}
/** {@inheritDoc} */
@@ -126,7 +125,7 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
mPinText.setText("");
mEnteredDigits = 0;
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
+ mKeyguardStatusViewManager.onResume();
}
/** {@inheritDoc} */
@@ -183,8 +182,6 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
mEnteredDigits--;
}
mCallback.pokeWakelock();
- } else if (v == mEmergencyCallButton) {
- mCallback.takeEmergencyCallAction();
} else if (v == mOkButton) {
checkPin();
}
@@ -401,24 +398,4 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
return digit;
}
}
-
- public void onPhoneStateChanged(String newState) {
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
- }
-
- public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) {
-
- }
-
- public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
-
- }
-
- public void onRingerModeChanged(int state) {
-
- }
-
- public void onTimeChanged() {
-
- }
}
diff --git a/policy/src/com/android/internal/policy/impl/StatusView.java b/policy/src/com/android/internal/policy/impl/StatusView.java
deleted file mode 100644
index 79f81ff..0000000
--- a/policy/src/com/android/internal/policy/impl/StatusView.java
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2010 Google Inc. All Rights Reserved.
-
-package com.android.internal.policy.impl;
-
-import com.android.internal.R;
-import com.android.internal.widget.LockPatternUtils;
-import com.google.android.util.AbstractMessageParser.Resources;
-
-import java.util.Date;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.text.format.DateFormat;
-import android.util.Log;
-import android.view.View;
-import android.widget.TextView;
-
-class StatusView {
- public static final int LOCK_ICON = 0; // R.drawable.ic_lock_idle_lock;
- public static final int ALARM_ICON = R.drawable.ic_lock_idle_alarm;
- public static final int CHARGING_ICON = 0; //R.drawable.ic_lock_idle_charging;
- public static final int BATTERY_LOW_ICON = 0; //R.drawable.ic_lock_idle_low_battery;
-
- private String mDateFormatString;
-
- private TextView mCarrier;
- private TextView mDate;
-
- // are we showing battery information?
- private boolean mShowingBatteryInfo = false;
-
- // last known plugged in state
- private boolean mPluggedIn = false;
-
- // last known battery level
- private int mBatteryLevel = 100;
-
- private String mInstructions = null;
- private TextView mStatus1;
- private TextView mOwnerInfo;
-
- private boolean mHasCarrier;
- private boolean mHasDate;
-
- private View mView;
-
- private TextView mAlarmStatus;
- private LockPatternUtils mLockPatternUtils;
- private int mHelpMessageId;
- private int mHelpIconId;
- private KeyguardUpdateMonitor mUpdateMonitor;
-
- private View findViewById(int id) {
- return mView.findViewById(id);
- }
-
- private Context getContext() {
- return mView.getContext();
- }
-
- void setInstructions(String instructions) {
- mInstructions = instructions;
- }
-
- void setCarrierText(CharSequence carrierText) {
- if (mCarrier != null) {
- mCarrier.setText(carrierText);
- }
- }
-
- void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) {
- mShowingBatteryInfo = showBatteryInfo;
- mPluggedIn = pluggedIn;
- mBatteryLevel = batteryLevel;
- updateStatusLines(true);
- }
-
- void onTimeChanged() {
- refreshTimeAndDateDisplay();
- }
-
- public void onRingerModeChanged(int state) {
- }
-
- void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
- setCarrierText(LockScreen.getCarrierString(plmn, spn));
- }
-
- public StatusView(View view, KeyguardUpdateMonitor updateMonitor,
- LockPatternUtils lockPatternUtils) {
- mView = view;
- mCarrier = (TextView) findViewById(R.id.carrier);
- mHasCarrier = (mCarrier != null);
- mDate = (TextView) findViewById(R.id.date);
- mHasDate = (mDate != null);
- mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year);
- mLockPatternUtils = lockPatternUtils;
- mUpdateMonitor = updateMonitor;
-
- refreshTimeAndDateDisplay();
-
- mStatus1 = (TextView) findViewById(R.id.status1);
- mAlarmStatus = (TextView) findViewById(R.id.alarm_status);
- mAlarmStatus.setCompoundDrawablesWithIntrinsicBounds(ALARM_ICON, 0, 0, 0);
- mOwnerInfo = (TextView) findViewById(R.id.propertyOf);
-
- resetStatusInfo(updateMonitor, lockPatternUtils);
-
- // Required to get Marquee to work.
- if (mHasCarrier) {
- mCarrier.setSelected(true);
- mCarrier.setTextColor(0xffffffff);
- }
- }
-
- void resetStatusInfo(KeyguardUpdateMonitor updateMonitor, LockPatternUtils lockPatternUtils) {
- mInstructions = null;
- mShowingBatteryInfo = updateMonitor.shouldShowBatteryInfo();
- mPluggedIn = updateMonitor.isDevicePluggedIn();
- mBatteryLevel = updateMonitor.getBatteryLevel();
- updateStatusLines(true);
- }
-
- void setInstructionText(int stringId) {
- mStatus1.setText(stringId);
- mStatus1.setCompoundDrawablesWithIntrinsicBounds(LOCK_ICON, 0, 0, 0);
- mStatus1.setVisibility(stringId != 0 ? View.VISIBLE : View.INVISIBLE);
- }
-
- void setInstructionText(String string) {
- mStatus1.setText(string);
- mStatus1.setCompoundDrawablesWithIntrinsicBounds(LOCK_ICON, 0, 0, 0);
- mStatus1.setVisibility(TextUtils.isEmpty(string) ? View.INVISIBLE : View.VISIBLE);
- }
-
- void setCarrierText(int stringId) {
- mCarrier.setText(stringId);
- }
- void setCarrierText(String string) {
- mCarrier.setText(string);
- }
-
- /**
- * Update the status lines based on these rules:
- * AlarmStatus: Alarm state always gets it's own line.
- * Status1 is shared between help, battery status and generic unlock instructions,
- * prioritized in that order.
- * @param showStatusLines status lines are shown if true
- */
- void updateStatusLines(boolean showStatusLines) {
- if (!showStatusLines) {
- mStatus1.setVisibility(showStatusLines ? View.VISIBLE : View.INVISIBLE);
- mAlarmStatus.setVisibility(showStatusLines ? View.VISIBLE : View.GONE);
- return;
- }
-
- // Update owner info
- final ContentResolver res = getContext().getContentResolver();
- final boolean ownerInfoEnabled = Settings.Secure.getInt(res,
- Settings.Secure.LOCK_SCREEN_OWNER_INFO_ENABLED, 1) != 0;
- String ownerInfo = null;
- if (ownerInfoEnabled) {
- ownerInfo = Settings.Secure.getString(res, Settings.Secure.LOCK_SCREEN_OWNER_INFO);
- if (mOwnerInfo != null) {
- mOwnerInfo.setText(ownerInfo);
- mOwnerInfo.setVisibility(ownerInfoEnabled && !TextUtils.isEmpty(ownerInfo) ?
- View.VISIBLE : View.INVISIBLE);
- }
- }
-
- // Update Alarm status
- String nextAlarm = mLockPatternUtils.getNextAlarm();
- if (!TextUtils.isEmpty(nextAlarm)) {
- mAlarmStatus.setText(nextAlarm);
- mAlarmStatus.setVisibility(View.VISIBLE);
- } else {
- mAlarmStatus.setVisibility(View.GONE);
- }
-
- // Update Status1
- if (!TextUtils.isEmpty(mInstructions)) {
- // Instructions only
- mStatus1.setText(mInstructions);
- mStatus1.setCompoundDrawablesWithIntrinsicBounds(LOCK_ICON, 0, 0, 0);
- mStatus1.setVisibility(View.VISIBLE);
- } else if (mShowingBatteryInfo) {
- // Battery status
- if (mPluggedIn) {
- // Charging or charged
- if (mUpdateMonitor.isDeviceCharged()) {
- mStatus1.setText(getContext().getString(R.string.lockscreen_charged));
- } else {
- mStatus1.setText(getContext().getString(R.string.lockscreen_plugged_in,
- mBatteryLevel));
- }
- mStatus1.setCompoundDrawablesWithIntrinsicBounds(CHARGING_ICON, 0, 0, 0);
- mStatus1.setVisibility(View.VISIBLE);
- } else if (mBatteryLevel < KeyguardUpdateMonitor.LOW_BATTERY_THRESHOLD) {
- // Battery is low
- mStatus1.setText(getContext().getString(R.string.lockscreen_low_battery));
- mStatus1.setCompoundDrawablesWithIntrinsicBounds(BATTERY_LOW_ICON, 0, 0, 0);
- mStatus1.setVisibility(View.VISIBLE);
- } else {
- mStatus1.setVisibility(View.INVISIBLE);
- }
- } else if (mHelpMessageId != 0) {
- mStatus1.setText(mHelpMessageId);
- mStatus1.setCompoundDrawablesWithIntrinsicBounds(mHelpIconId, 0,0, 0);
- mStatus1.setVisibility(View.VISIBLE);
- } else if (ownerInfoEnabled && mOwnerInfo == null && ownerInfo != null) {
- mStatus1.setText(ownerInfo);
- mStatus1.setCompoundDrawablesWithIntrinsicBounds(0, 0,0, 0);
- mStatus1.setVisibility(View.VISIBLE);
- } else {
- mStatus1.setVisibility(View.INVISIBLE);
- }
- }
-
- void setHelpMessage(int messageId, int iconId) {
- mHelpMessageId = messageId;
- mHelpIconId = iconId;
- }
-
- void refreshTimeAndDateDisplay() {
- if (mHasDate) {
- mDate.setText(DateFormat.format(mDateFormatString, new Date()));
- }
- }
-
-}