in sdk/appcenter-analytics/src/main/java/com/microsoft/appcenter/analytics/PropertyConfigurator.java [87:154]
public void onPreparingLog(@NonNull Log log, @NonNull String groupName) {
if (shouldOverridePartAProperties(log)) {
AppExtension app = ((CommonSchemaLog) log).getExt().getApp();
UserExtension user = ((CommonSchemaLog) log).getExt().getUser();
DeviceExtension device = ((CommonSchemaLog) log).getExt().getDevice();
/* Override app name if not null, else use the name of the nearest parent. */
if (mAppName != null) {
app.setName(mAppName);
} else {
for (AnalyticsTransmissionTarget target = mTransmissionTarget.mParentTarget; target != null; target = target.mParentTarget) {
String parentAppName = target.getPropertyConfigurator().getAppName();
if (parentAppName != null) {
app.setName(parentAppName);
break;
}
}
}
/* Override app version if not null, else use the version of the nearest parent. */
if (mAppVersion != null) {
app.setVer(mAppVersion);
} else {
for (AnalyticsTransmissionTarget target = mTransmissionTarget.mParentTarget; target != null; target = target.mParentTarget) {
String parentAppVersion = target.getPropertyConfigurator().getAppVersion();
if (parentAppVersion != null) {
app.setVer(parentAppVersion);
break;
}
}
}
/* Override app locale if not null, else use the locale of the nearest parent. */
if (mAppLocale != null) {
app.setLocale(mAppLocale);
} else {
for (AnalyticsTransmissionTarget target = mTransmissionTarget.mParentTarget; target != null; target = target.mParentTarget) {
String parentAppLocale = target.getPropertyConfigurator().getAppLocale();
if (parentAppLocale != null) {
app.setLocale(parentAppLocale);
break;
}
}
}
/* Override userId if not null, else use the userId of the nearest parent. */
if (mUserId != null) {
user.setLocalId(mUserId);
} else {
for (AnalyticsTransmissionTarget target = mTransmissionTarget.mParentTarget; target != null; target = target.mParentTarget) {
String parentUserId = target.getPropertyConfigurator().getUserId();
if (parentUserId != null) {
user.setLocalId(parentUserId);
break;
}
}
}
/* Fill out the device id if it has been collected. */
if (mDeviceIdEnabled) {
/* Get device identifier, Secure class already has an in memory cache. */
@SuppressLint("HardwareIds")
String androidId = Secure.getString(mTransmissionTarget.mContext.getContentResolver(), Secure.ANDROID_ID);
device.setLocalId(ANDROID_DEVICE_ID_PREFIX + androidId);
}
}
}