Source:
<code>public int setDisplayNameUsingSrc(String displayName, int subId, int nameSource) { if (DBG) { logd("[setDisplayName]+ displayName:" + displayName + " subId:" + subId + " nameSource:" + nameSource); } enforceModifyPhoneState("setDisplayNameUsingSrc"); final long identity = Binder.clearCallingIdentity(); try { validateSubId(subId); List<SubscriptionInfo> allSubInfo = getSubInfo(null, null); if (allSubInfo == null || allSubInfo.isEmpty()) return 0; for (SubscriptionInfo subInfo : allSubInfo) { if (subInfo.getSubscriptionId() == subId && (getNameSourcePriority(subInfo.getNameSource()) > getNameSourcePriority(nameSource) || (displayName != null && displayName.equals(subInfo.getDisplayName())))) { return 0; } } String nameToSet; if (TextUtils.isEmpty(displayName)) { <START> logd("user input displayname <END> is null or null string."); nameToSet = mContext.getString(SubscriptionManager.DEFAULT_NAME_RES); if (SubscriptionManager.isValidSlotIndex(getSlotIndex(subId))) { nameToSet = "SIM " + Integer.toString(getSlotIndex(subId) + 1); } } else { nameToSet = displayName; } ContentValues value = new ContentValues(1); value.put(SubscriptionManager.DISPLAY_NAME, nameToSet); if (nameSource >= SubscriptionManager.NAME_SOURCE_DEFAULT_SOURCE) { if (DBG) logd("Set nameSource=" + nameSource); value.put(SubscriptionManager.NAME_SOURCE, nameSource); } if (DBG) logd("[setDisplayName]- mDisplayName:" + nameToSet + " set"); int result = updateDatabase(value, subId, true); refreshCachedActiveSubscriptionInfoList(); notifySubscriptionInfoChanged(); return result; } finally { Binder.restoreCallingIdentity(identity); } }</code><technical_language>This is necessarily user input. Move this if check below</technical_language>

Target:
public int setDisplayNameUsingSrc(String displayName, int subId, int nameSource) { if (DBG) { logd("[setDisplayName]+ displayName:" + displayName + " subId:" + subId + " nameSource:" + nameSource); } enforceModifyPhoneState("setDisplayNameUsingSrc"); final long identity = Binder.clearCallingIdentity(); try { validateSubId(subId); List<SubscriptionInfo> allSubInfo = getSubInfo(null, null); if (allSubInfo == null || allSubInfo.isEmpty()) return 0; for (SubscriptionInfo subInfo : allSubInfo) { if (subInfo.getSubscriptionId() == subId && (getNameSourcePriority(subInfo.getNameSource()) > getNameSourcePriority(nameSource) || (displayName != null && displayName.equals(subInfo.getDisplayName())))) { return 0; } } String nameToSet; if (displayName == null) { nameToSet = mContext.getString(SubscriptionManager.DEFAULT_NAME_RES); } else if (nameSource == SubscriptionManager.NAME_SOURCE_USER_INPUT && displayName.trim().length() == 0 && SubscriptionManager.isValidSlotIndex(getSlotIndex(subId))) { nameToSet = "SIM " + Integer.toString(getSlotIndex(subId) + 1); } else { nameToSet = displayName; } ContentValues value = new ContentValues(1); value.put(SubscriptionManager.DISPLAY_NAME, nameToSet); if (nameSource >= SubscriptionManager.NAME_SOURCE_DEFAULT_SOURCE) { if (DBG) logd("Set nameSource=" + nameSource); value.put(SubscriptionManager.NAME_SOURCE, nameSource); } if (DBG) logd("[setDisplayName]- mDisplayName:" + nameToSet + " set"); int result = updateDatabase(value, subId, true); refreshCachedActiveSubscriptionInfoList(); notifySubscriptionInfoChanged(); return result; } finally { Binder.restoreCallingIdentity(identity); } }