SetupWizard: Give radio a 10 second chance to come up
Change-Id: Iadd817b200106783dd67edbc5ad03928ce2baa6b
This commit is contained in:
@@ -21,6 +21,7 @@ import android.app.Application;
|
||||
import android.app.StatusBarManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
|
||||
@@ -59,8 +60,21 @@ public class SetupWizardApp extends Application {
|
||||
public static final int REQUEST_CODE_SETUP_CYANOGEN= 3;
|
||||
public static final int REQUEST_CODE_SETUP_CAPTIVE_PORTAL= 4;
|
||||
|
||||
public static final int RADIO_READY_TIMEOUT = 10 * 1000;
|
||||
|
||||
private boolean mIsRadioReady = false;
|
||||
|
||||
private StatusBarManager mStatusBarManager;
|
||||
|
||||
private final Handler mHandler = new Handler();
|
||||
|
||||
private final Runnable mRadioTimeoutRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mIsRadioReady = true;
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
@@ -84,6 +98,18 @@ public class SetupWizardApp extends Application {
|
||||
// Continue with setup
|
||||
disableCaptivePortalDetection();
|
||||
}
|
||||
mHandler.postDelayed(mRadioTimeoutRunnable, SetupWizardApp.RADIO_READY_TIMEOUT);
|
||||
}
|
||||
|
||||
public boolean isRadioReady() {
|
||||
return mIsRadioReady;
|
||||
}
|
||||
|
||||
public void setRadioReady(boolean radioReady) {
|
||||
if (!mIsRadioReady && radioReady) {
|
||||
mHandler.removeCallbacks(mRadioTimeoutRunnable);
|
||||
}
|
||||
mIsRadioReady = radioReady;
|
||||
}
|
||||
|
||||
public void disableStatusBar() {
|
||||
|
||||
Reference in New Issue
Block a user