Program: 194354
Project: 194354
Buggy source:
@Override public void dispatchDemoCommand(String command,Bundle args){
  if (!mDemoMode && command.equals(COMMAND_ENTER)) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    unregisterListeners();
    mDemoMode=true;
    mDemoInetCondition=mInetCondition;
    mDemoWifiState=mWifiSignalController.getState();
  }
 else   if (mDemoMode && command.equals(COMMAND_EXIT)) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mDemoMode=false;
    updateMobileControllers();
    for (    MobileSignalController controller : mMobileSignalControllers.values()) {
      controller.resetLastState();
    }
    mWifiSignalController.resetLastState();
    mReceiverHandler.post(mRegisterListeners);
    notifyAllListeners();
  }
 else   if (mDemoMode && command.equals(COMMAND_NETWORK)) {
    String airplane=args.getString("String_Node_Str");
    if (airplane != null) {
      boolean show=airplane.equals("String_Node_Str");
      mCallbackHandler.setIsAirplaneMode(new IconState(show,TelephonyIcons.FLIGHT_MODE_ICON,R.string.accessibility_airplane_mode,mContext));
    }
    String fully=args.getString("String_Node_Str");
    if (fully != null) {
      mDemoInetCondition=Boolean.parseBoolean(fully);
      BitSet connected=new BitSet();
      if (mDemoInetCondition) {
        connected.set(mWifiSignalController.mTransportType);
      }
      mWifiSignalController.updateConnectivity(connected,connected);
      for (      MobileSignalController controller : mMobileSignalControllers.values()) {
        if (mDemoInetCondition) {
          connected.set(controller.mTransportType);
        }
        controller.updateConnectivity(connected,connected);
      }
    }
    String wifi=args.getString("String_Node_Str");
    if (wifi != null) {
      boolean show=wifi.equals("String_Node_Str");
      String level=args.getString("String_Node_Str");
      if (level != null) {
        mDemoWifiState.level=level.equals("String_Node_Str") ? -1 : Math.min(Integer.parseInt(level),WifiIcons.WIFI_LEVEL_COUNT - 1);
        mDemoWifiState.connected=mDemoWifiState.level >= 0;
      }
      mDemoWifiState.enabled=show;
      mWifiSignalController.notifyListeners();
    }
    String sims=args.getString("String_Node_Str");
    if (sims != null) {
      int num=MathUtils.constrain(Integer.parseInt(sims),1,8);
      List<SubscriptionInfo> subs=new ArrayList<>();
      if (num != mMobileSignalControllers.size()) {
        mMobileSignalControllers.clear();
        int start=mSubscriptionManager.getActiveSubscriptionInfoCountMax();
        for (int i=start; i < start + num; i++) {
          subs.add(addSignalController(i,i));
        }
      }
      mCallbackHandler.setSubs(subs);
    }
    String nosim=args.getString("String_Node_Str");
    if (nosim != null) {
      mHasNoSims=nosim.equals("String_Node_Str");
      mCallbackHandler.setNoSims(mHasNoSims);
    }
    String mobile=args.getString("String_Node_Str");
    if (mobile != null) {
      boolean show=mobile.equals("String_Node_Str");
      String datatype=args.getString("String_Node_Str");
      String slotString=args.getString("String_Node_Str");
      int slot=TextUtils.isEmpty(slotString) ? 0 : Integer.parseInt(slotString);
      slot=MathUtils.constrain(slot,0,8);
      List<SubscriptionInfo> subs=new ArrayList<>();
      while (mMobileSignalControllers.size() <= slot) {
        int nextSlot=mMobileSignalControllers.size();
        subs.add(addSignalController(nextSlot,nextSlot));
      }
      if (!subs.isEmpty()) {
        mCallbackHandler.setSubs(subs);
      }
      MobileSignalController controller=mMobileSignalControllers.values().toArray(new MobileSignalController[0])[slot];
      controller.getState().dataSim=datatype != null;
      if (datatype != null) {
        controller.getState().iconGroup=datatype.equals("String_Node_Str") ? TelephonyIcons.ONE_X : datatype.equals("String_Node_Str") ? TelephonyIcons.THREE_G : datatype.equals("String_Node_Str") ? TelephonyIcons.FOUR_G : datatype.equals("String_Node_Str") ? TelephonyIcons.E : datatype.equals("String_Node_Str") ? TelephonyIcons.G : datatype.equals("String_Node_Str") ? TelephonyIcons.H : datatype.equals("String_Node_Str") ? TelephonyIcons.LTE : datatype.equals("String_Node_Str") ? TelephonyIcons.ROAMING : TelephonyIcons.UNKNOWN;
      }
      int[][] icons=TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH;
      String level=args.getString("String_Node_Str");
      if (level != null) {
        controller.getState().level=level.equals("String_Node_Str") ? -1 : Math.min(Integer.parseInt(level),icons[0].length - 1);
        controller.getState().connected=controller.getState().level >= 0;
      }
      controller.getState().enabled=show;
      controller.notifyListeners();
    }
    String carrierNetworkChange=args.getString("String_Node_Str");
    if (carrierNetworkChange != null) {
      boolean show=carrierNetworkChange.equals("String_Node_Str");
      for (      MobileSignalController controller : mMobileSignalControllers.values()) {
        controller.setCarrierNetworkChangeMode(show);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void dispatchDemoCommand(String command,Bundle args){
  if (!mDemoMode && command.equals(COMMAND_ENTER)) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    unregisterListeners();
    mDemoMode=true;
    mDemoInetCondition=mInetCondition;
    mDemoWifiState=mWifiSignalController.getState();
  }
 else   if (mDemoMode && command.equals(COMMAND_EXIT)) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mDemoMode=false;
    updateMobileControllers();
    for (    MobileSignalController controller : mMobileSignalControllers.values()) {
      controller.resetLastState();
    }
    mWifiSignalController.resetLastState();
    mReceiverHandler.post(mRegisterListeners);
    notifyAllListeners();
  }
 else   if (mDemoMode && command.equals(COMMAND_NETWORK)) {
    String airplane=args.getString("String_Node_Str");
    if (airplane != null) {
      boolean show=airplane.equals("String_Node_Str");
      mCallbackHandler.setIsAirplaneMode(new IconState(show,TelephonyIcons.FLIGHT_MODE_ICON,R.string.accessibility_airplane_mode,mContext));
    }
    String fully=args.getString("String_Node_Str");
    if (fully != null) {
      mDemoInetCondition=Boolean.parseBoolean(fully);
      BitSet connected=new BitSet();
      if (mDemoInetCondition) {
        connected.set(mWifiSignalController.mTransportType);
      }
      mWifiSignalController.updateConnectivity(connected,connected);
      for (      MobileSignalController controller : mMobileSignalControllers.values()) {
        if (mDemoInetCondition) {
          connected.set(controller.mTransportType);
        }
        controller.updateConnectivity(connected,connected);
      }
    }
    String wifi=args.getString("String_Node_Str");
    if (wifi != null) {
      boolean show=wifi.equals("String_Node_Str");
      String level=args.getString("String_Node_Str");
      if (level != null) {
        mDemoWifiState.level=level.equals("String_Node_Str") ? -1 : Math.min(Integer.parseInt(level),WifiIcons.WIFI_LEVEL_COUNT - 1);
        mDemoWifiState.connected=mDemoWifiState.level >= 0;
      }
      mDemoWifiState.enabled=show;
      mWifiSignalController.notifyListeners();
    }
    String sims=args.getString("String_Node_Str");
    if (sims != null) {
      int num=MathUtils.constrain(Integer.parseInt(sims),1,8);
      List<SubscriptionInfo> subs=new ArrayList<>();
      if (num != mMobileSignalControllers.size()) {
        mMobileSignalControllers.clear();
        int start=mSubscriptionManager.getActiveSubscriptionInfoCountMax();
        for (int i=start; i < start + num; i++) {
          subs.add(addSignalController(i,i));
        }
        mCallbackHandler.setSubs(subs);
      }
    }
    String nosim=args.getString("String_Node_Str");
    if (nosim != null) {
      mHasNoSims=nosim.equals("String_Node_Str");
      mCallbackHandler.setNoSims(mHasNoSims);
    }
    String mobile=args.getString("String_Node_Str");
    if (mobile != null) {
      boolean show=mobile.equals("String_Node_Str");
      String datatype=args.getString("String_Node_Str");
      String slotString=args.getString("String_Node_Str");
      int slot=TextUtils.isEmpty(slotString) ? 0 : Integer.parseInt(slotString);
      slot=MathUtils.constrain(slot,0,8);
      List<SubscriptionInfo> subs=new ArrayList<>();
      while (mMobileSignalControllers.size() <= slot) {
        int nextSlot=mMobileSignalControllers.size();
        subs.add(addSignalController(nextSlot,nextSlot));
      }
      if (!subs.isEmpty()) {
        mCallbackHandler.setSubs(subs);
      }
      MobileSignalController controller=mMobileSignalControllers.values().toArray(new MobileSignalController[0])[slot];
      controller.getState().dataSim=datatype != null;
      if (datatype != null) {
        controller.getState().iconGroup=datatype.equals("String_Node_Str") ? TelephonyIcons.ONE_X : datatype.equals("String_Node_Str") ? TelephonyIcons.THREE_G : datatype.equals("String_Node_Str") ? TelephonyIcons.FOUR_G : datatype.equals("String_Node_Str") ? TelephonyIcons.E : datatype.equals("String_Node_Str") ? TelephonyIcons.G : datatype.equals("String_Node_Str") ? TelephonyIcons.H : datatype.equals("String_Node_Str") ? TelephonyIcons.LTE : datatype.equals("String_Node_Str") ? TelephonyIcons.ROAMING : TelephonyIcons.UNKNOWN;
      }
      int[][] icons=TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH;
      String level=args.getString("String_Node_Str");
      if (level != null) {
        controller.getState().level=level.equals("String_Node_Str") ? -1 : Math.min(Integer.parseInt(level),icons[0].length - 1);
        controller.getState().connected=controller.getState().level >= 0;
      }
      controller.getState().enabled=show;
      controller.notifyListeners();
    }
    String carrierNetworkChange=args.getString("String_Node_Str");
    if (carrierNetworkChange != null) {
      boolean show=carrierNetworkChange.equals("String_Node_Str");
      for (      MobileSignalController controller : mMobileSignalControllers.values()) {
        controller.setCarrierNetworkChangeMode(show);
      }
    }
  }
}