灵犀直播 v1.0.127版本的 MD5 值为:a63989b077d9456fb57c6835ee2849a1
以下内容为反编译后的 BootService.java 源代码,内容仅作参考
package com.starry.base.boot;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.SystemClock;
import c.i.a.y.c;
import c.i.a.y.d0;
import java.util.concurrent.atomic.AtomicBoolean;
public class BootService extends Service {
private static final int MAX_RETRY_COUNT = 10;
private static final String TAG = "BootService";
private int mRetryCount = 0;
private static final String[] DNS_ARRAY = {"180.76.76.76:80", "119.29.29.29:80", "182.254.116.116:80", "8.8.8.8:53"};
private static AtomicBoolean sIsLaunched = new AtomicBoolean(false);
private static AtomicBoolean sIsNetworkChecking = new AtomicBoolean(false);
public static int access$108(BootService bootService) {
int i = bootService.mRetryCount;
bootService.mRetryCount = i + 1;
return i;
}
public void checkNetworkToBoot() {
if (this.mRetryCount <= 10 && SystemClock.uptimeMillis() <= BootReceiver.MAX_RETRY_TIME) {
if (sIsNetworkChecking.compareAndSet(false, true)) {
d0.i(DNS_ARRAY, new d0.b() {
@Override
public void onNetworkError() {
BootService.sIsNetworkChecking.set(false);
BootService.access$108(BootService.this);
SystemClock.sleep(3000L);
BootService.this.checkNetworkToBoot();
}
@Override
public void onNetworkSuccess() {
BootService.sIsNetworkChecking.set(false);
BootService.access$108(BootService.this);
if (BootService.sIsLaunched.compareAndSet(false, true) || !c.c()) {
BootReceiver.launchActivity(BootService.this.getApplicationContext(), "net success");
}
}
});
return;
}
return;
}
BootReceiver.launchActivity(getApplicationContext(), "time out");
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int i, int i2) {
boolean h = d0.h(getApplicationContext());
boolean z = sIsLaunched.get();
boolean c2 = c.c();
if (h) {
if (z && c2) {
return 2;
}
checkNetworkToBoot();
return 2;
}
return 2;
}
}