am 71836f4c: Remove scroll barrier constant. Bug #2553595

Merge commit '71836f4cb6389042d839d2a26582f796c6e97c26' into kraken

* commit '71836f4cb6389042d839d2a26582f796c6e97c26':
  Remove scroll barrier constant.
diff --git a/policy/com/android/internal/policy/impl/LockScreen.java b/policy/com/android/internal/policy/impl/LockScreen.java
index 381b913..baed9eb 100644
--- a/policy/com/android/internal/policy/impl/LockScreen.java
+++ b/policy/com/android/internal/policy/impl/LockScreen.java
@@ -66,7 +66,7 @@
     private TextView mStatus1;
     private TextView mStatus2;
     private TextView mScreenLocked;
-    private TextView mEmergencyCallText;
+    private Button mEmergencyCallButton;
 
     // current configuration state of keyboard and display
     private int mKeyboardHidden;
@@ -203,12 +203,18 @@
         mStatus1 = (TextView) findViewById(R.id.status1);
         mStatus2 = (TextView) findViewById(R.id.status2);
 
+        mEmergencyCallButton = (Button) findViewById(R.id.emergencyCallButton);
+        mEmergencyCallButton.setText(R.string.lockscreen_emergency_call);
+        mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
         mScreenLocked = (TextView) findViewById(R.id.screenLocked);
         mSelector = (SlidingTab) findViewById(R.id.tab_selector);
         mSelector.setHoldAfterTrigger(true, false);
         mSelector.setLeftHintText(R.string.lockscreen_unlock_label);
-
-        mEmergencyCallText = (TextView) findViewById(R.id.emergencyCallText);
+        mEmergencyCallButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                mCallback.takeEmergencyCallAction();
+            }
+        });
 
         setFocusable(true);
         setFocusableInTouchMode(true);
@@ -263,6 +269,7 @@
 
         refreshBatteryStringAndIcon();
         refreshAlarmDisplay();
+        mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
 
         mTimeFormat = DateFormat.getTimeFormat(getContext());
         mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year);
@@ -333,6 +340,8 @@
      * @param iconResourceId The left hand icon.
      */
     private void toastMessage(final TextView textView, final String text, final int color, final int iconResourceId) {
+        if (DBG) android.util.Log.d("LockScreen", "toastMessage(text=" + text +", color=" + color + ")");
+
         if (mPendingR1 != null) {
             textView.removeCallbacks(mPendingR1);
             mPendingR1 = null;
@@ -490,8 +499,9 @@
      * 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);
+        // The emergency call button appears where the carrier would
+        // ordinarily be shown, so if one is VISIBLE the other must be
+        // INVISIBLE.
         switch (status) {
             case Normal:
                 // text
@@ -499,13 +509,12 @@
                         getCarrierString(
                                 mUpdateMonitor.getTelephonyPlmn(),
                                 mUpdateMonitor.getTelephonySpn()));
-                // unnecessary clutter
-                //mScreenLocked.setText(R.string.lockscreen_screen_locked);
+//                mScreenLocked.setText(R.string.lockscreen_screen_locked);
 
                 // layout
-                mScreenLocked.setVisibility(View.INVISIBLE);
+                mScreenLocked.setVisibility(View.VISIBLE);
                 mSelector.setVisibility(View.VISIBLE);
-                mEmergencyCallText.setVisibility(View.GONE);
+                mEmergencyCallButton.setVisibility(View.GONE);
                 break;
             case NetworkLocked:
                 // The carrier string shows both sim card status (i.e. No Sim Card) and
@@ -519,30 +528,35 @@
                 // layout
                 mScreenLocked.setVisibility(View.VISIBLE);
                 mSelector.setVisibility(View.VISIBLE);
-                mEmergencyCallText.setVisibility(View.GONE);
+                mEmergencyCallButton.setVisibility(View.GONE);
                 break;
             case SimMissing:
                 // text
-                mCarrier.setText(R.string.lockscreen_missing_sim_message_short);
-                mScreenLocked.setText(R.string.lockscreen_missing_sim_instructions);
+                mCarrier.setText("");
+                mScreenLocked.setText(
+                        getCarrierString(
+                                mUpdateMonitor.getTelephonyPlmn(),
+                                getContext().getText(R.string.lockscreen_missing_sim_message_short)));
+                // previously shown here: lockscreen_instructions_when_pattern_disabled
 
                 // layout
                 mScreenLocked.setVisibility(View.VISIBLE);
                 mSelector.setVisibility(View.VISIBLE);
-                mEmergencyCallText.setVisibility(View.VISIBLE);
+                mEmergencyCallButton.setVisibility(View.VISIBLE);
                 break;
             case SimMissingLocked:
                 // text
-                mCarrier.setText(
+                mCarrier.setText("");
+                mScreenLocked.setText(
                         getCarrierString(
                                 mUpdateMonitor.getTelephonyPlmn(),
                                 getContext().getText(R.string.lockscreen_missing_sim_message_short)));
-                mScreenLocked.setText(R.string.lockscreen_missing_sim_instructions);
+                // previously shown here: lockscreen_missing_sim_instructions
 
                 // layout
                 mScreenLocked.setVisibility(View.VISIBLE);
                 mSelector.setVisibility(View.GONE);
-                mEmergencyCallText.setVisibility(View.VISIBLE);
+                mEmergencyCallButton.setVisibility(View.VISIBLE);
                 break;
             case SimLocked:
                 // text
@@ -554,20 +568,21 @@
                 // layout
                 mScreenLocked.setVisibility(View.INVISIBLE);
                 mSelector.setVisibility(View.VISIBLE);
-                mEmergencyCallText.setVisibility(View.GONE);
+                mEmergencyCallButton.setVisibility(View.GONE);
                 break;
             case SimPukLocked:
                 // text
-                mCarrier.setText(
+                mCarrier.setText("");
+                mScreenLocked.setText(
                         getCarrierString(
                                 mUpdateMonitor.getTelephonyPlmn(),
                                 getContext().getText(R.string.lockscreen_sim_puk_locked_message)));
-                mScreenLocked.setText(R.string.lockscreen_sim_puk_locked_instructions);
+                // previously shown here: lockscreen_sim_puk_locked_instructions);
 
                 // layout
                 mScreenLocked.setVisibility(View.VISIBLE);
                 mSelector.setVisibility(View.GONE);
-                mEmergencyCallText.setVisibility(View.VISIBLE);
+                mEmergencyCallButton.setVisibility(View.VISIBLE);
                 break;
         }
     }
@@ -640,6 +655,7 @@
     /** {@inheritDoc} */
     public void onResume() {
         resetStatusInfo(mUpdateMonitor);
+        mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
     }
 
     /** {@inheritDoc} */
@@ -657,5 +673,6 @@
     }
 
     public void onPhoneStateChanged(String newState) {
+        mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
     }
 }