Source:
<code>public DesiredCapabilities getCapabilities(DesiredCapabilities capabilities) { <START> DesiredCapabilities tempCapabilities = capabilities; <END> MobileTestSession mobileSession = Grid.getMobileTestSession(); tempCapabilities = SelendroidCapabilities.android(); if ((new File(mobileSession.getAppLocation()).exists()) && ((new File(mobileSession.getAppLocation() + File.separator + mobileSession.getAppName())).exists())) { tempCapabilities.setBrowserName(SELENDROID); } else { tempCapabilities.setBrowserName(ANDROID); } tempCapabilities.setCapability(MOBILE_NODE_TYPE, mobileSession.getMobileNodeType().getAsString()); tempCapabilities.setCapability(SelendroidCapabilities.AUT, mobileSession.getAppName()); tempCapabilities.setCapability(SelendroidCapabilities.LOCALE, mobileSession.getAppLocale()); if (StringUtils.isNotBlank(mobileSession.getDeviceType())) { tempCapabilities.setCapability(SelendroidCapabilities.MODEL, mobileSession.getDeviceType()); } if (StringUtils.isNotBlank(mobileSession.getPlatformVersion())) { tempCapabilities.setCapability(SelendroidCapabilities.PLATFORM_VERSION, mobileSession.getPlatformVersion()); } if (StringUtils.isNotBlank(mobileSession.getdeviceSerial())) { tempCapabilities.setCapability(SelendroidCapabilities.SERIAL, mobileSession.getdeviceSerial()); } return tempCapabilities; }</code><technical_language>_Object reference_ capabilities is copied. capabilities tempCapabilities, refer object. Thus, this change is fixing Avoid reassigning parameters 'capabilities' condition. In this case, approach java DesiredCapabilties newCapabilities = SelendroidCapabilities.android(); // Note: SelendroidCapabilities.android() returns a new DesiredCapabilties object. So,now original capabilities _Object reference_ values lost. newCapabilities.merge(capabilities); // I suspect fact merge pre-existing values is a bug today. IOSDriverCapabilitiesBuilder -- calls merge(), for example // rest of changes</technical_language>

Target:
public DesiredCapabilities getCapabilities(DesiredCapabilities capabilities) { MobileTestSession mobileSession = Grid.getMobileTestSession(); DesiredCapabilities tempCapabilities = SelendroidCapabilities.android(); if ((new File(mobileSession.getAppLocation()).exists()) && ((new File(mobileSession.getAppLocation() + File.separator + mobileSession.getAppName())).exists())) { tempCapabilities.setBrowserName(SELENDROID); } else { tempCapabilities.setBrowserName(ANDROID); } tempCapabilities.setCapability(MOBILE_NODE_TYPE, mobileSession.getMobileNodeType().getAsString()); tempCapabilities.setCapability(SelendroidCapabilities.AUT, mobileSession.getAppName()); tempCapabilities.setCapability(SelendroidCapabilities.LOCALE, mobileSession.getAppLocale()); if (StringUtils.isNotBlank(mobileSession.getDeviceType())) { tempCapabilities.setCapability(SelendroidCapabilities.MODEL, mobileSession.getDeviceType()); } if (StringUtils.isNotBlank(mobileSession.getPlatformVersion())) { tempCapabilities.setCapability(SelendroidCapabilities.PLATFORM_VERSION, mobileSession.getPlatformVersion()); } if (StringUtils.isNotBlank(mobileSession.getdeviceSerial())) { tempCapabilities.setCapability(SelendroidCapabilities.SERIAL, mobileSession.getdeviceSerial()); } return tempCapabilities; }