@Override protected Action doInBackground(Void... arg) { wakeLock.acquire(); try { ChipsetDetection detection = ChipsetDetection.getDetection(); while (true) { boolean result = false; boolean fatal = currentAction.fatal; try { Log.v("BatPhone", "Performing action " + currentAction); switch (currentAction) { case Unpacking: app.installFilesIfRequired(); result = true; break; case AdhocWPA: if (false) { // Get wifi manager WifiManager wm = (WifiManager) ServalBatPhoneApplication.context.getSystemService(Context.WIFI_SERVICE); // enable wifi wm.setWifiEnabled(true); WifiConfiguration wc = new WifiConfiguration(); wc.SSID = "*supplicant-test"; int res = wm.addNetwork(wc); Log.d("BatPhone", "add Network returned " + res); boolean b = wm.enableNetwork(res, true); Log.d("WifiPreference", "enableNetwork returned " + b); } break; case RootCheck: result = ServalBatPhoneApplication.context.coretask.hasRootPermission(); break; case Supported: // Start out by only looking for non-experimental // chipsets detection.identifyChipset(); result = detection.detected_chipsets.size() > 0; break; case Experimental: if (!results[Action.Supported.ordinal()]) { detection.inventSupport(); // this will not select a chipset detection.detect(true); result = detection.detected_chipsets.size() > 0; } break; case CheckSupport: result = testSupport(); break; case Finished: break; } } catch (Exception e) { result = false; Log.e("BatPhone", e.toString(), e); app.displayToastMessage(e.getMessage()); fatal = true; } results[currentAction.ordinal()] = result; Log.v("BatPhone", "Result " + result); if (fatal && !result) { fatalError = true; return currentAction; } if (currentAction == Action.Finished) { ServalBatPhoneApplication.wifiSetup = true; return currentAction; } this.publishProgress(currentAction); currentAction = Action.values()[currentAction.ordinal() + 1]; } } finally { wakeLock.release(); dismissTryExperimentalChipsetDialog(); } }