Bug 1105590 - Wait for distribution intent to arrive. r=mfinkle

This commit is contained in:
Richard Newman 2014-11-28 12:30:38 -08:00
parent 2bbd5309a6
commit 2514ee07ae

View File

@ -104,6 +104,8 @@ public class Distribution {
// Corresponds to the high value in Histograms.json.
private static final long MAX_DOWNLOAD_TIME_MSEC = 40000; // 40 seconds.
// Wait just a little while for the system to send a referrer intent after install.
private static final long DELAY_WAIT_FOR_REFERRER_MSEC = 400;
/**
@ -385,7 +387,16 @@ public class Distribution {
*/
private boolean checkIntentDistribution() {
if (referrer == null) {
return false;
// Wait a predetermined time and try again.
// Just block the thread, because it's the simplest solution.
try {
Thread.sleep(DELAY_WAIT_FOR_REFERRER_MSEC);
} catch (InterruptedException e) {
// Good enough.
}
if (referrer == null) {
return false;
}
}
URI uri = getReferredDistribution(referrer);