Several small fixes

This commit is contained in:
topjohnwu
2017-11-21 02:11:20 +08:00
parent f4e7baf31e
commit b1ad691464
29 changed files with 27 additions and 43 deletions

View File

@@ -49,7 +49,7 @@ public class FlashActivity extends Activity {
@OnClick(R.id.reboot)
void reboot() {
Shell.su_raw("reboot");
Shell.su_raw("/system/bin/reboot");
}
@OnClick(R.id.save_logs)

View File

@@ -230,20 +230,20 @@ public class MagiskFragment extends Fragment
if (mm.remoteMagiskVersionCode < 0) {
color = colorNeutral;
image = R.drawable.ic_help;
magiskUpdateText.setText(R.string.cannot_check_updates);
magiskUpdateText.setText(R.string.invalid_update_channel);
installButton.setVisibility(View.GONE);
} else {
color = colorOK;
image = R.drawable.ic_check_circle;
magiskUpdateText.setText(getString(R.string.install_magisk_title, "v" + mm.remoteMagiskVersionString));
}
installButton.setVisibility(View.VISIBLE);
if (mm.remoteManagerVersionCode > BuildConfig.VERSION_CODE) {
installText.setText(getString(R.string.update, getString(R.string.app_name)));
} else if (mm.magiskVersionCode > 0 && mm.remoteMagiskVersionCode > mm.magiskVersionCode) {
installText.setText(getString(R.string.update, getString(R.string.magisk)));
} else {
installText.setText(R.string.install);
installButton.setVisibility(View.VISIBLE);
if (mm.remoteManagerVersionCode > BuildConfig.VERSION_CODE) {
installText.setText(getString(R.string.update, getString(R.string.app_name)));
} else if (mm.magiskVersionCode > 0 && mm.remoteMagiskVersionCode > mm.magiskVersionCode) {
installText.setText(getString(R.string.update, getString(R.string.magisk)));
} else {
installText.setText(R.string.install);
}
}
if (!shownDialog && (mm.remoteMagiskVersionCode > mm.magiskVersionCode

View File

@@ -85,12 +85,16 @@ public class SuDatabaseHelper extends SQLiteOpenHelper {
// Check if we are linked globally
List<String> ret = Shell.sh("ls -l " + suDbFile);
if (Utils.isValidShellResponse(ret)) {
int links = Integer.parseInt(ret.get(0).trim().split("\\s+")[1]);
if (links < 2) {
mm.suDB.close();
suDbFile.delete();
new File(suDbFile + "-journal").delete();
mm.suDB = new SuDatabaseHelper();
try {
int links = Integer.parseInt(ret.get(0).trim().split("\\s+")[1]);
if (links < 2) {
mm.suDB.close();
suDbFile.delete();
new File(suDbFile + "-journal").delete();
mm.suDB = new SuDatabaseHelper();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -9,6 +9,6 @@ import com.topjohnwu.magisk.utils.Shell;
public class RebootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Shell.su_raw("reboot");
Shell.su_raw("/system/bin/reboot");
}
}