Skip to content

Commit

Permalink
[Main] Check for ADB and root on resume
Browse files Browse the repository at this point in the history
Granting ADB permission requires that the checks should be done on resume.
  • Loading branch information
MuntashirAkon committed Jul 8, 2020
1 parent ef6cb29 commit b0c7386
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,22 +256,6 @@ protected void onCreate(Bundle savedInstanceState) {
});
handleSelection();

// Initialize app prefs
AppPref.getInstance(this);
// Check root
if (!Utils.isRootGiven(this)) {
AppPref.getInstance(this).setPref(AppPref.PREF_ROOT_MODE_ENABLED, false);
// Check for adb
new Thread(() -> {
try {
AdbShell.run("id");
AppPref.getInstance(this).setPref(AppPref.PREF_ADB_MODE_ENABLED, true);
} catch (IOException | InterruptedException | NoSuchAlgorithmException e) {
AppPref.getInstance(this).setPref(AppPref.PREF_ADB_MODE_ENABLED, false);
}
}).start();
} else AppPref.getInstance(this).setPref(AppPref.PREF_ADB_MODE_ENABLED, false);

mLoaderManager = LoaderManager.getInstance(this);
mLoaderManager.initLoader(0, null, this);
}
Expand Down Expand Up @@ -461,6 +445,19 @@ public void onRefresh() {
@Override
protected void onResume() {
super.onResume();
// Check root
if (!Utils.isRootGiven(this)) {
AppPref.getInstance(this).setPref(AppPref.PREF_ROOT_MODE_ENABLED, false);
// Check for adb
new Thread(() -> {
try {
AdbShell.run("id");
AppPref.getInstance(this).setPref(AppPref.PREF_ADB_MODE_ENABLED, true);
} catch (IOException | InterruptedException | NoSuchAlgorithmException e) {
AppPref.getInstance(this).setPref(AppPref.PREF_ADB_MODE_ENABLED, false);
}
}).start();
} else AppPref.getInstance(this).setPref(AppPref.PREF_ADB_MODE_ENABLED, false);
// Set filter
if (mAdapter != null && mConstraint != null && !mConstraint.equals("")) {
mAdapter.getFilter().filter(mConstraint);
Expand Down
4 changes: 2 additions & 2 deletions app/version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Wed Jul 08 13:20:42 BDT 2020
#Wed Jul 08 13:46:11 BDT 2020
VERSION_NAME=2.5.7
VERSION_CODE=263
VERSION_CODE=264

0 comments on commit b0c7386

Please sign in to comment.