JunZhang
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
23 additions and
0 deletions
-
app/src/main/java/com/cobo/cold/MainApplication.java
-
app/src/main/java/com/cobo/cold/Utilities.java
|
|
@ -23,6 +23,7 @@ import android.content.BroadcastReceiver; |
|
|
|
import android.content.Context; |
|
|
|
import android.content.Intent; |
|
|
|
import android.content.IntentFilter; |
|
|
|
import android.content.pm.PackageManager; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.text.TextUtils; |
|
|
|
|
|
|
@ -76,6 +77,17 @@ public class MainApplication extends Application { |
|
|
|
shouldLock = Utilities.hasVaultCreated(this); |
|
|
|
|
|
|
|
startAttackCheckingService(); |
|
|
|
resetInputMethodSettings(); |
|
|
|
} |
|
|
|
|
|
|
|
private void resetInputMethodSettings() { |
|
|
|
if (!Utilities.isInputSettingsCleared(this)) { |
|
|
|
new Thread(() -> { |
|
|
|
PackageManager pm = getPackageManager(); |
|
|
|
pm.clearApplicationUserData("com.google.android.inputmethod.pinyin", null); |
|
|
|
Utilities.setInputSettingsCleared(this); |
|
|
|
}).start(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void startAttackCheckingService() { |
|
|
|
|
|
@ -55,6 +55,7 @@ public class Utilities { |
|
|
|
public static final String PREFERENCE_KEY_RANDOM_SALT = "random_salt"; |
|
|
|
public static final String FINGERPRINT_PASSWORD = "fingerprint_password"; |
|
|
|
public static final String ATTACK_DETECTED = "attack_detected"; |
|
|
|
public static final String INPUT_SETTINGS_CLEARED = "input_settings_cleared"; |
|
|
|
|
|
|
|
public static void alert(AppCompatActivity activity, |
|
|
|
@Nullable String title, @NonNull String message, |
|
|
@ -226,4 +227,14 @@ public class Utilities { |
|
|
|
SharedPreferences sp = context.getSharedPreferences(PREFERENCE_SECRET, MODE_PRIVATE); |
|
|
|
return sp.getBoolean(ATTACK_DETECTED,false); |
|
|
|
} |
|
|
|
|
|
|
|
public static boolean isInputSettingsCleared(Context context) { |
|
|
|
SharedPreferences sp = context.getSharedPreferences(PREFERENCE_SECRET, MODE_PRIVATE); |
|
|
|
return sp.getBoolean(INPUT_SETTINGS_CLEARED,false); |
|
|
|
} |
|
|
|
|
|
|
|
public static void setInputSettingsCleared(Context context) { |
|
|
|
SharedPreferences sp = context.getSharedPreferences(PREFERENCE_SECRET, MODE_PRIVATE); |
|
|
|
sp.edit().putBoolean(INPUT_SETTINGS_CLEARED,true).apply(); |
|
|
|
} |
|
|
|
} |
|
|
|