Skip to content

Commit

Permalink
fix: apply shared prefs
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtr126 committed Sep 20, 2024
1 parent b92fa7b commit 6c397e4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions app/src/main/java/xtr/keymapper/activity/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
Expand Down Expand Up @@ -64,20 +63,20 @@ protected void onCreate(Bundle savedInstanceState) {
RemoteServiceHelper.useShizuku = keymapConfig.useShizuku;
Server.setupServer(this, mCallback);

if(!RemoteServiceHelper.useShizuku)
if(!RemoteServiceHelper.useShizuku) {
Shell.getShell(shell -> {
RemoteServiceHelper.getInstance(this, null);
if (Shizuku.pingBinder() || getPackageManager().getLaunchIntentForPackage("moe.shizuku.privileged.api") != null)
if (Shizuku.pingBinder() || getPackageManager().getLaunchIntentForPackage("moe.shizuku.privileged.api") != null) {
showAlertDialog(R.string.detected_shizuku, R.string.use_shizuku_for_activation, (dialog, which) -> {
keymapConfig.useShizuku = true;
RemoteServiceHelper.useShizuku = keymapConfig.useShizuku = true;
keymapConfig.applySharedPrefs();
alertShizukuNotAuthorized();
});
else
if (!RemoteServiceHelper.isRootService) {
} else if (!RemoteServiceHelper.isRootService) {
alertRootAccessNotFound();
}
});
else if (!(Shizuku.pingBinder() && Shizuku.checkSelfPermission() == PackageManager.PERMISSION_GRANTED)) {
} else if (!(Shizuku.pingBinder() && Shizuku.checkSelfPermission() == PackageManager.PERMISSION_GRANTED)) {
alertShizukuNotAuthorized();
}
setupButtons();
Expand Down

0 comments on commit 6c397e4

Please sign in to comment.