ModuleDownloaderPreference: remove disable_kernel_module after downloading

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-03-10 09:03:06 -06:00 committed by Harsh Shandilya
parent d4875afe31
commit 7e029f1db0
2 changed files with 6 additions and 5 deletions

View File

@ -60,12 +60,12 @@ public class KernelModuleDisablerPreference extends Preference {
Thread.sleep(Math.max(0, 1000 * 5 - (SystemClock.elapsedRealtime() - start)));
} catch (final Exception ignored) {
}
final Intent i = getContext().getPackageManager().getLaunchIntentForPackage(getContext().getPackageName());
if (i == null)
final Intent restartIntent = getContext().getPackageManager().getLaunchIntentForPackage(getContext().getPackageName());
if (restartIntent == null)
return;
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Application.get().startActivity(i);
restartIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
restartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Application.get().startActivity(restartIntent);
System.exit(0);
});
}).join());

View File

@ -51,6 +51,7 @@ public class ModuleDownloaderPreference extends Preference {
setState(State.NOTFOUND);
else if (result == OsConstants.EXIT_SUCCESS) {
setState(State.SUCCESS);
Application.getSharedPreferences().edit().remove("disable_kernel_module").apply();
Application.getAsyncWorker().runAsync(() -> {
Thread.sleep(1000 * 5);
final Intent restartIntent = getContext().getPackageManager().getLaunchIntentForPackage(getContext().getPackageName());