Fix for 2209086:  Initial pass at new SlidingTab widget and integration into LockScreen.

Tested:
    - unlock and mute/unmute

Not working:
	- highlighting on right tab.
diff --git a/policy/com/android/internal/policy/impl/LockScreen.java b/policy/com/android/internal/policy/impl/LockScreen.java
index dda5097..b4a318c 100644
--- a/policy/com/android/internal/policy/impl/LockScreen.java
+++ b/policy/com/android/internal/policy/impl/LockScreen.java
@@ -17,8 +17,9 @@
 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.RotarySelector;
+import com.android.internal.widget.SlidingTab;
 
 import android.content.Context;
 import android.content.res.Resources;
@@ -33,8 +34,6 @@
 import android.media.AudioManager;
 import android.os.SystemProperties;
 
-import com.android.internal.telephony.IccCard;
-
 import java.util.Date;
 import java.io.File;
 import java.text.SimpleDateFormat;
@@ -46,7 +45,7 @@
  */
 class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateMonitor.InfoCallback,
         KeyguardUpdateMonitor.SimStateCallback, KeyguardUpdateMonitor.ConfigurationChangeCallback,
-        RotarySelector.OnDialTriggerListener {
+        SlidingTab.OnTriggerListener {
 
     private static final boolean DBG = false;
     private static final String TAG = "LockScreen";
@@ -59,7 +58,7 @@
     private final KeyguardScreenCallback mCallback;
 
     private TextView mCarrier;
-    private RotarySelector mRotary;
+    private SlidingTab mSelector;
     private TextView mTime;
     private TextView mDate;
     private TextView mStatus1;
@@ -175,9 +174,9 @@
 
         final LayoutInflater inflater = LayoutInflater.from(context);
         if (mCreatedInPortrait) {
-            inflater.inflate(R.layout.keyguard_screen_rotary_unlock, this, true);
+            inflater.inflate(R.layout.keyguard_screen_tab_unlock, this, true);
         } else {
-            inflater.inflate(R.layout.keyguard_screen_rotary_unlock_land, this, true);
+            inflater.inflate(R.layout.keyguard_screen_tab_unlock_land, this, true);
         }
 
         mCarrier = (TextView) findViewById(R.id.carrier);
@@ -189,7 +188,9 @@
         mEmergencyCallButton = (Button) findViewById(R.id.emergencyCallButton);
         mEmergencyCallButton.setText(R.string.lockscreen_emergency_call);
         mScreenLocked = (TextView) findViewById(R.id.screenLocked);
-        mRotary = (RotarySelector) findViewById(R.id.rotary);
+        mSelector = (SlidingTab) findViewById(R.id.tab_selector);
+        mSelector.setLeftHintText(R.string.lockscreen_unlock_label);
+        mSelector.setRightHintText(R.string.lockscreen_mute_unmute_label);
         mEmergencyCallButton.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
                 mCallback.takeEmergencyCallAction();
@@ -207,15 +208,28 @@
         mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
         mSilentMode = mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT;
 
-        mRotary.setOnDialTriggerListener(this);
-        mRotary.setLeftHandleResource(R.drawable.ic_jog_dial_unlock);
-        mRotary.setRightHandleResource(mSilentMode ?
-                R.drawable.ic_jog_dial_sound_off :
-                R.drawable.ic_jog_dial_sound_on);
+        mSelector.setOnTriggerListener(this);
+        mSelector.setLeftTabResources(
+                R.drawable.ic_jog_dial_unlock,
+                R.drawable.jog_tab_target_green,
+                R.drawable.jog_tab_bar_left_unlock,
+                R.drawable.jog_tab_left_unlock);
+
+        updateRightTabResources();
 
         resetStatusInfo(updateMonitor);
     }
 
+    private void updateRightTabResources() {
+        mSelector.setRightTabResources(
+                mSilentMode ? R.drawable.ic_jog_dial_sound_off : R.drawable.ic_jog_dial_sound_on,
+                mSilentMode ? R.drawable.jog_tab_target_yellow : R.drawable.jog_tab_target_gray,
+                mSilentMode ? R.drawable.jog_tab_bar_right_sound_on
+                        : R.drawable.jog_tab_bar_right_sound_off,
+                mSilentMode ? R.drawable.jog_tab_right_sound_on
+                        : R.drawable.jog_tab_right_sound_off);
+    }
+
     private void resetStatusInfo(KeyguardUpdateMonitor updateMonitor) {
         mShowingBatteryInfo = updateMonitor.shouldShowBatteryInfo();
         mPluggedIn = updateMonitor.isDevicePluggedIn();
@@ -242,24 +256,23 @@
     }
 
     /** {@inheritDoc} */
-    public void onDialTrigger(View v, int whichHandle) {
-        if (whichHandle == RotarySelector.OnDialTriggerListener.LEFT_HANDLE) {
+    public void onTrigger(View v, int whichHandle) {
+        if (whichHandle == SlidingTab.OnTriggerListener.LEFT_HANDLE) {
             mCallback.goToUnlockScreen();
-        } else if (whichHandle == RotarySelector.OnDialTriggerListener.RIGHT_HANDLE) {
+        } else if (whichHandle == SlidingTab.OnTriggerListener.RIGHT_HANDLE) {
             // toggle silent mode
             mSilentMode = !mSilentMode;
             mAudioManager.setRingerMode(mSilentMode ? AudioManager.RINGER_MODE_SILENT
                         : AudioManager.RINGER_MODE_NORMAL);
-            final int handleIcon = mSilentMode ?
-                    R.drawable.ic_jog_dial_sound_off :
-                    R.drawable.ic_jog_dial_sound_on;
-            final int toastIcon = mSilentMode ?
-                    R.drawable.ic_lock_ringer_off :
-                    R.drawable.ic_lock_ringer_on;
-            mRotary.setRightHandleResource(handleIcon);
+
+            updateRightTabResources();
+
             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;
             toastMessage(mScreenLocked, message, toastIcon);
             mCallback.pokeWakelock();
         }
@@ -268,6 +281,7 @@
     /** {@inheritDoc} */
     public void onGrabbedStateChange(View v, int grabbedState) {
         // TODO: Update onscreen hint text based on the new state.
+        mCallback.pokeWakelock();
     }
 
     /**
@@ -468,7 +482,7 @@
 
                 // layout
                 mScreenLocked.setVisibility(View.VISIBLE);
-                mRotary.setVisibility(View.VISIBLE);
+                mSelector.setVisibility(View.VISIBLE);
                 mEmergencyCallButton.setVisibility(View.GONE);
                 break;
             case NetworkLocked:
@@ -478,7 +492,7 @@
 
                 // layout
                 mScreenLocked.setVisibility(View.VISIBLE);
-                mRotary.setVisibility(View.VISIBLE);
+                mSelector.setVisibility(View.VISIBLE);
                 mEmergencyCallButton.setVisibility(View.GONE);
                 break;
             case SimMissing:
@@ -488,7 +502,7 @@
 
                 // layout
                 mScreenLocked.setVisibility(View.INVISIBLE);
-                mRotary.setVisibility(View.VISIBLE);
+                mSelector.setVisibility(View.VISIBLE);
                 mEmergencyCallButton.setVisibility(View.VISIBLE);
                 putEmergencyBelow(R.id.divider);
                 break;
@@ -499,7 +513,7 @@
 
                 // layout
                 mScreenLocked.setVisibility(View.VISIBLE);
-                mRotary.setVisibility(View.GONE);
+                mSelector.setVisibility(View.GONE);
                 mEmergencyCallButton.setVisibility(View.VISIBLE);
                 putEmergencyBelow(R.id.screenLocked);
                 break;
@@ -509,7 +523,7 @@
 
                 // layout
                 mScreenLocked.setVisibility(View.INVISIBLE);
-                mRotary.setVisibility(View.VISIBLE);
+                mSelector.setVisibility(View.VISIBLE);
                 mEmergencyCallButton.setVisibility(View.GONE);
                 break;
             case SimPukLocked:
@@ -519,7 +533,7 @@
 
                 // layout
                 mScreenLocked.setVisibility(View.VISIBLE);
-                mRotary.setVisibility(View.GONE);
+                mSelector.setVisibility(View.GONE);
                 mEmergencyCallButton.setVisibility(View.VISIBLE);
                 putEmergencyBelow(R.id.screenLocked);
                 break;