Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -822,33 +822,16 @@ public double getFragmentSamplingRate() {

/** Returns if _experiment_app_start_ttid should be captured. */
public boolean getIsExperimentTTIDEnabled() {
// Order of precedence is:
// 1. If the value exists in Android Manifest, return this value.
// 2. If the value exists through Firebase Remote Config, cache and return this value.
// 3. If the value exists in device cache, return this value.
// 4. Otherwise, return default value.
ExperimentTTID config = ExperimentTTID.getInstance();

// 1. Reads value in Android Manifest (it is set by developers during build time).
// Reads value in Android Manifest (it is set by developers during build time).
Optional<Boolean> metadataValue = getMetadataBoolean(config);
if (metadataValue.isAvailable()) {
return metadataValue.get();
}

// 2. Reads value from Firebase Remote Config, saves this value in cache layer if valid.
Optional<Boolean> rcValue = getRemoteConfigBoolean(config);
if (rcValue.isAvailable()) {
deviceCacheManager.setValue(config.getDeviceCacheFlag(), rcValue.get());
return rcValue.get();
}

// 3. Reads value from cache layer.
Optional<Boolean> deviceCacheValue = getDeviceCacheBoolean(config);
if (deviceCacheValue.isAvailable()) {
return deviceCacheValue.get();
}

// 4. Returns default value if there is no valid value from above approaches.
// Returns default value if there is no valid value from above approaches.
return config.getDefault();
}

Expand Down