@Override
 public void run() {
   mMessage = null;
   mShowingMessage = false;
   if (mShowingBouncer) {
     hideMessage(FADE_DURATION, true);
   } else {
     update();
   }
 }
 public void securityMessageChanged() {
   setAlpha(1f);
   mShowingMessage = true;
   update();
   mHandler.removeCallbacks(mClearMessageRunnable);
   if (mTimeout > 0) {
     mHandler.postDelayed(mClearMessageRunnable, mTimeout);
   }
   announceForAccessibility(getText());
 }
 @Override
 public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) {
   mShowingBatteryInfo = status.isPluggedIn() || status.isBatteryLow();
   mCharging =
       status.status == BatteryManager.BATTERY_STATUS_CHARGING
           || status.status == BatteryManager.BATTERY_STATUS_FULL;
   mBatteryLevel = status.level;
   mBatteryCharged = status.isCharged();
   mBatteryIsLow = status.isBatteryLow();
   update();
 }
 private void hideMessage(int duration, boolean thenUpdate) {
   if (duration > 0) {
     Animator anim = ObjectAnimator.ofFloat(this, "alpha", 0f);
     anim.setDuration(duration);
     if (thenUpdate) {
       anim.addListener(
           new AnimatorListenerAdapter() {
             @Override
             public void onAnimationEnd(Animator animation) {
               update();
             }
           });
     }
     anim.start();
   } else {
     setAlpha(0f);
     if (thenUpdate) {
       update();
     }
   }
 }
  public KeyguardMessageArea(Context context, AttributeSet attrs) {
    super(context, attrs);

    // This is required to ensure marquee works
    setSelected(true);

    // Registering this callback immediately updates the battery state, among other things.
    mUpdateMonitor = KeyguardUpdateMonitor.getInstance(getContext());
    mUpdateMonitor.registerCallback(mInfoCallback);
    mHandler = new Handler(Looper.myLooper());

    mSeparator = getResources().getString(R.string.kg_text_message_separator);
    mLockAlwaysBattery =
        Settings.System.getInt(
                getContext().getContentResolver(), Settings.System.LOCKSCREEN_BATTERY, 0)
            == 1;
    setTextColor(
        Settings.System.getInt(
            getContext().getContentResolver(),
            Settings.System.LOCKSCREEN_CUSTOM_TEXT_COLOR,
            0xFFFFFFFF));
    update();
  }