// Run after each indicator change.
  private void apply() {
    if (mWifiGroup == null) return;

    if (mWifiVisible) {
      mWifiGroup.setVisibility(View.VISIBLE);
      mWifi.setImageResource(mWifiStrengthId);
      mWifiActivity.setImageResource(mWifiActivityId);
      mWifiGroup.setContentDescription(mWifiDescription);
    } else {
      mWifiGroup.setVisibility(View.GONE);
    }

    if (DEBUG)
      Slog.d(
          TAG,
          String.format(
              "wifi: %s sig=%d act=%d",
              (mWifiVisible ? "VISIBLE" : "GONE"), mWifiStrengthId, mWifiActivityId));

    if (mMobileVisible && !mIsAirplaneMode) {
      mMobileGroup.setVisibility(View.VISIBLE);
      mMobile.setImageResource(mMobileStrengthId);
      mMobileActivity.setImageResource(mMobileActivityId);
      mMobileType.setImageResource(mMobileTypeId);
      mMobileGroup.setContentDescription(mMobileTypeDescription + " " + mMobileDescription);
    } else {
      mMobileGroup.setVisibility(View.GONE);
    }

    if (mIsAirplaneMode) {
      mAirplane.setVisibility(View.VISIBLE);
      mAirplane.setImageResource(mAirplaneIconId);
    } else {
      mAirplane.setVisibility(View.GONE);
    }

    if (mMobileVisible && mWifiVisible && mIsAirplaneMode) {
      mSpacer.setVisibility(View.INVISIBLE);
    } else {
      mSpacer.setVisibility(View.GONE);
    }

    if (DEBUG)
      Slog.d(
          TAG,
          String.format(
              "mobile: %s sig=%d act=%d typ=%d",
              (mMobileVisible ? "VISIBLE" : "GONE"),
              mMobileStrengthId,
              mMobileActivityId,
              mMobileTypeId));

    mMobileType.setVisibility(!mWifiVisible ? View.VISIBLE : View.GONE);

    updateSettings();
  }
 private void updateMobile() {
   mMobile.setImageResource(mMobileStrengthId);
   mMobileType.setImageResource(mMobileTypeId);
   mMobileActivity.setImageResource(mMobileActivityId);
   mNoSimSlot.setImageResource(mNoSimIconId);
   mMobileGroup.setContentDescription(mMobileTypeDescription + " " + mMobileDescription);
 }
    public boolean apply(boolean isSecondaryIcon) {
      if (mMobileVisible && !mIsAirplaneMode) {
        mMobile.setImageResource(mMobileStrengthId);
        Drawable mobileDrawable = mMobile.getDrawable();
        if (mobileDrawable instanceof Animatable) {
          Animatable ad = (Animatable) mobileDrawable;
          if (!ad.isRunning()) {
            ad.start();
          }
        }

        mMobileDark.setImageResource(mMobileStrengthId);
        Drawable mobileDarkDrawable = mMobileDark.getDrawable();
        if (mobileDarkDrawable instanceof Animatable) {
          Animatable ad = (Animatable) mobileDarkDrawable;
          if (!ad.isRunning()) {
            ad.start();
          }
        }

        mMobileType.setImageResource(mMobileTypeId);
        mMobileGroup.setContentDescription(mMobileTypeDescription + " " + mMobileDescription);
        mMobileGroup.setVisibility(View.VISIBLE);
      } else {
        mMobileGroup.setVisibility(View.GONE);
      }

      // When this isn't next to wifi, give it some extra padding between the signals.
      mMobileGroup.setPaddingRelative(isSecondaryIcon ? mSecondaryTelephonyPadding : 0, 0, 0, 0);
      mMobile.setPaddingRelative(mIsMobileTypeIconWide ? mWideTypeIconStartPadding : 0, 0, 0, 0);
      mMobileDark.setPaddingRelative(
          mIsMobileTypeIconWide ? mWideTypeIconStartPadding : 0, 0, 0, 0);

      if (DEBUG)
        Log.d(
            TAG,
            String.format(
                "mobile: %s sig=%d dark=%d typ=%d",
                (mMobileVisible ? "VISIBLE" : "GONE"),
                mMobileStrengthId,
                mMobileDarkStrengthId,
                mMobileTypeId));

      mMobileType.setVisibility(mMobileTypeId != 0 ? View.VISIBLE : View.GONE);

      return mMobileVisible;
    }
  // Run after each indicator change.
  private void apply() {
    if (mWifiGroup == null) return;

    mVpn.setVisibility(mVpnVisible ? View.VISIBLE : View.GONE);
    if (DEBUG) Log.d(TAG, String.format("vpn: %s", mVpnVisible ? "VISIBLE" : "GONE"));

    if (mEthernetVisible) {
      mEthernet.setImageResource(mEthernetIconId);
      mEthernetDark.setImageResource(mEthernetIconId);
      mEthernetGroup.setContentDescription(mEthernetDescription);
      mEthernetGroup.setVisibility(View.VISIBLE);
    } else {
      mEthernetGroup.setVisibility(View.GONE);
    }

    if (DEBUG) Log.d(TAG, String.format("ethernet: %s", (mEthernetVisible ? "VISIBLE" : "GONE")));

    if (mWifiVisible) {
      mWifi.setImageResource(mWifiStrengthId);
      mWifiDark.setImageResource(mWifiStrengthId);
      mWifiGroup.setContentDescription(mWifiDescription);
      mWifiGroup.setVisibility(View.VISIBLE);
    } else {
      mWifiGroup.setVisibility(View.GONE);
    }

    if (DEBUG)
      Log.d(
          TAG,
          String.format("wifi: %s sig=%d", (mWifiVisible ? "VISIBLE" : "GONE"), mWifiStrengthId));

    boolean anyMobileVisible = false;
    int firstMobileTypeId = 0;
    for (PhoneState state : mPhoneStates) {
      if (state.apply(anyMobileVisible)) {
        if (!anyMobileVisible) {
          firstMobileTypeId = state.mMobileTypeId;
          anyMobileVisible = true;
        }
      }
    }

    if (mIsAirplaneMode) {
      mAirplane.setImageResource(mAirplaneIconId);
      mAirplane.setContentDescription(
          mAirplaneContentDescription != 0
              ? mContext.getString(mAirplaneContentDescription)
              : null);
      mAirplane.setVisibility(View.VISIBLE);
    } else {
      mAirplane.setVisibility(View.GONE);
    }

    if (mIsAirplaneMode && mWifiVisible) {
      mWifiAirplaneSpacer.setVisibility(View.VISIBLE);
    } else {
      mWifiAirplaneSpacer.setVisibility(View.GONE);
    }

    if (((anyMobileVisible && firstMobileTypeId != 0) || mNoSimsVisible) && mWifiVisible) {
      mWifiSignalSpacer.setVisibility(View.VISIBLE);
    } else {
      mWifiSignalSpacer.setVisibility(View.GONE);
    }

    mNoSims.setVisibility(mNoSimsVisible ? View.VISIBLE : View.GONE);
    mNoSimsDark.setVisibility(mNoSimsVisible ? View.VISIBLE : View.GONE);

    boolean anythingVisible =
        mNoSimsVisible
            || mWifiVisible
            || mIsAirplaneMode
            || anyMobileVisible
            || mVpnVisible
            || mEthernetVisible;
    setPaddingRelative(0, 0, anythingVisible ? mEndPadding : mEndPaddingNothingVisible, 0);
  }
  // Run after each indicator change.
  private void apply() {
    if (mWifiGroup == null) return;

    mVpn.setVisibility(mVpnVisible ? View.VISIBLE : View.GONE);
    if (DEBUG) Log.d(TAG, String.format("vpn: %s", mVpnVisible ? "VISIBLE" : "GONE"));
    if (mWifiVisible) {
      mWifi.setImageResource(mWifiStrengthId);
      mWifiActivity.setImageResource(mWifiActivityId);
      mWifiGroup.setContentDescription(mWifiDescription);
      mWifiGroup.setVisibility(View.VISIBLE);
    } else {
      mWifiGroup.setVisibility(View.GONE);
    }

    if (DEBUG)
      Log.d(
          TAG,
          String.format(
              "wifi: %s sig=%d act=%d",
              (mWifiVisible ? "VISIBLE" : "GONE"), mWifiStrengthId, mWifiActivityId));

    if (mMobileVisible && !mIsAirplaneMode) {
      updateMobile();
      updateCdma();
      updateData();
      updateDataVoice();
      mMobileGroup.setVisibility(View.VISIBLE);
    } else {
      mMobileGroup.setVisibility(View.GONE);
      mMobileCdmaGroup.setVisibility(View.GONE);
      mMobileCdma1xOnly.setVisibility(View.GONE);
      mDataGroup.setVisibility(View.GONE);
    }

    if (mIsAirplaneMode) {
      mAirplane.setImageResource(mAirplaneIconId);
      mAirplane.setVisibility(View.VISIBLE);
    } else {
      mAirplane.setVisibility(View.GONE);
    }

    if (mWifiVisible && ((mIsAirplaneMode) || (mNoSimIconId != 0))) {
      mWifiAirplaneSpacer.setVisibility(View.VISIBLE);
    } else {
      mWifiAirplaneSpacer.setVisibility(View.GONE);
    }

    if (mRoaming && mMobileVisible && mWifiVisible) {
      mWifiSignalSpacer.setVisibility(View.VISIBLE);
    } else {
      mWifiSignalSpacer.setVisibility(View.GONE);
    }

    mMobile.setPaddingRelative(mIsMobileTypeIconWide ? mWideTypeIconStartPadding : 0, 0, 0, 0);

    if (DEBUG)
      Log.d(
          TAG,
          String.format(
              "mobile: %s sig=%d act=%d typ=%d",
              (mMobileVisible ? "VISIBLE" : "GONE"),
              mMobileStrengthId,
              mMobileActivityId,
              mMobileTypeId));

    if (mStyle == STATUS_BAR_STYLE_ANDROID_DEFAULT) {
      mMobileType.setVisibility((mRoaming || mMobileTypeId != 0) ? View.VISIBLE : View.GONE);
    } else {
      mMobileType.setVisibility(View.GONE);
    }

    if (mStyle != STATUS_BAR_STYLE_ANDROID_DEFAULT) {
      if (mNoSimIconId != 0) {
        mNoSimSlot.setVisibility(View.VISIBLE);
        mMobile.setVisibility(View.GONE);
      } else {
        mNoSimSlot.setVisibility(View.GONE);
        mMobile.setVisibility(View.VISIBLE);
      }
    }
  }