Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 2744a23

Browse files
bluemarvinkeianhzo
authored andcommitted
Prevent crash reporter from getting stuck in an infinte loop (#1566)
1 parent 4badb2e commit 2744a23

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

app/src/common/shared/org/mozilla/vrbrowser/crashreporting/CrashReporterService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public class CrashReporterService extends JobIntentService {
2929
// Threshold used to fix Infinite restart loop on startup crashes.
3030
// See https://github.com/MozillaReality/FirefoxReality/issues/651
3131
public static final long MAX_RESTART_COUNT = 2;
32+
private static final int MAX_PID_CHECK_COUNT = 5;
33+
34+
private int mPidCheckCount = 0;
3235

3336
@Override
3437
public int onStartCommand(Intent intent, int flags, int startId) {
@@ -71,14 +74,15 @@ protected void onHandleWork(@NonNull Intent intent) {
7174
}
7275
}
7376

74-
if (!otherProcessesFound) {
77+
if (!otherProcessesFound || (mPidCheckCount > MAX_PID_CHECK_COUNT)) {
7578
intent.setClass(CrashReporterService.this, VRBrowserActivity.class);
7679
intent.setPackage(BuildConfig.APPLICATION_ID);
7780
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
7881
startActivity(intent);
7982
break;
8083

8184
} else {
85+
mPidCheckCount++;
8286
try {
8387
Thread.sleep(PID_CHECK_INTERVAL);
8488
} catch (InterruptedException e) {

0 commit comments

Comments
 (0)