mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-18 21:16:48 -06:00
Add app lock for SDK < 18 with root (#35)
This commit is contained in:
parent
29d12b79ca
commit
6e334f2721
@ -4,10 +4,12 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
@ -86,6 +88,8 @@ public class LoginTask extends AsyncTask<Void, String, Integer> {
|
||||
return R.string.encrypt_failed_text;
|
||||
} catch (NotLoggedInErrorException | IOException e) {
|
||||
return R.string.login_denied_text;
|
||||
} catch (UnsupportedOperationException e) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
GradeJob gradeJob = new GradeJob();
|
||||
@ -135,6 +139,21 @@ public class LoginTask extends AsyncTask<Void, String, Integer> {
|
||||
showSoftKeyboard(symbolView);
|
||||
break;
|
||||
|
||||
// if rooted and SDK < 18
|
||||
case -1:
|
||||
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(activity.get())
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setTitle(R.string.alert_dialog_blocked_app)
|
||||
.setMessage(R.string.alert_dialog_blocked_app_message)
|
||||
.setPositiveButton(R.string.dialog_close, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
});
|
||||
alertDialog.show();
|
||||
break;
|
||||
|
||||
default:
|
||||
Snackbar.make(activity.get().findViewById(R.id.coordinatorLayout),
|
||||
messageID, Snackbar.LENGTH_LONG).show();
|
||||
|
@ -3,7 +3,6 @@ package io.github.wulkanowy.security;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import io.github.wulkanowy.utilities.RootUtilities;
|
||||
|
||||
@ -19,8 +18,7 @@ public class Safety extends Scrambler {
|
||||
if (!RootUtilities.isRooted()) {
|
||||
return new String(Base64.encode(plainText.getBytes(), Base64.DEFAULT));
|
||||
} else {
|
||||
Log.e(Scrambler.DEBUG_TAG, "Password store in this devices isn't safe because is rooted");
|
||||
throw new UnsupportedOperationException("Password store in this devices isn't safe because is rooted");
|
||||
throw new UnsupportedOperationException("Stored data in this devices isn't safe because android is rooted");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ public class VulcanSynchronization {
|
||||
}
|
||||
|
||||
public void firstLoginSignInStep(Context context, DaoSession daoSession)
|
||||
throws NotLoggedInErrorException, AccountPermissionException, IOException, CryptoException {
|
||||
throws NotLoggedInErrorException, AccountPermissionException, IOException, CryptoException,
|
||||
UnsupportedOperationException {
|
||||
if (firstAccountLogin != null && certificate != null) {
|
||||
loginSession = firstAccountLogin.login(context, daoSession, certificate);
|
||||
} else {
|
||||
|
@ -44,7 +44,8 @@ public class FirstAccountLogin {
|
||||
}
|
||||
|
||||
public LoginSession login(Context context, DaoSession daoSession, String certificate)
|
||||
throws NotLoggedInErrorException, AccountPermissionException, IOException, CryptoException {
|
||||
throws NotLoggedInErrorException, AccountPermissionException, IOException, CryptoException,
|
||||
UnsupportedOperationException {
|
||||
|
||||
long userId;
|
||||
|
||||
|
@ -39,10 +39,11 @@
|
||||
<string name="fragment_no_grades">Brak ocen</string>
|
||||
|
||||
<string name="noInternet_text">Brak połączenia z internetem</string>
|
||||
<string name="root_failed_text">To urządzenie posiada posiada podwyższone uprawnienia (root). Automatyczne logowanie zosatło wyłączone.</string>
|
||||
<string name="encrypt_failed_text">Szyfrowanie nie powiodło się. Automatyczne logowanie zostało wyłączone</string>
|
||||
<string name="version_text">Wersja %1$s</string>
|
||||
<string name="refresh_error_text">"Podczas odświeżania zawartości wystąpił błąd. "</string>
|
||||
<string name="alert_dialog_blocked_app">Blokada aplikacji</string>
|
||||
<string name="alert_dialog_blocked_app_message">W obawie o bezpieczeństwo przechowywanych danych osobistych na urządzeniu z podwyższonymi uprawnieniami (root), aplikacja Wulkanowy została zablokowana</string>
|
||||
|
||||
<string name="dialog_description_text">Opis</string>
|
||||
<string name="dialog_weight_text">Waga</string>
|
||||
|
@ -39,10 +39,11 @@
|
||||
<string name="fragment_no_grades">No grades</string>
|
||||
|
||||
<string name="noInternet_text">No internet connection</string>
|
||||
<string name="root_failed_text">This device is rooted. Automatic login has been disabled</string>
|
||||
<string name="encrypt_failed_text">Encryption failed. Automatic login has been disabled</string>
|
||||
<string name="version_text">Version %1$s</string>
|
||||
<string name="refresh_error_text">An error occurred while refreshing the content.</string>
|
||||
<string name="alert_dialog_blocked_app">Application lock</string>
|
||||
<string name="alert_dialog_blocked_app_message">For the sake of safety of personal data stored on a device with increased authorization (root), the Wulkanowy application has been blocked.</string>
|
||||
|
||||
<string name="dialog_description_text">Description</string>
|
||||
<string name="dialog_weight_text">Weight</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user