private synchronized String getUuId(String name) { if (uuids.get(name) != null) return uuids.get(name); SharedPreferences sp = getSharedPreferences("uuids2", Context.MODE_PRIVATE); if (!sp.contains(name)) { String uuid = UUID.randomUUID().toString(); Editor e = sp.edit(); e.putString(name, Encryptor.encrypt(uuid, getKey(name))); e.commit(); } return Encryptor.decrypt(sp.getString(name, null), getKey(name)); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.getClass()) .append(": {\n") .append(" accountType: ") .append(getAccountType()) .append("\n") .append(" userAgent: ") .append(getUserAgent()) .append("\n") .append(" mainActivityClass: ") .append(getMainActivityClass()) .append("\n") .append(" isFileSystemEncrypted: ") .append(Encryptor.isFileSystemEncrypted()) .append("\n"); if (null != passcodeManager) { // passcodeManager may be null at startup if the app is running in debug mode sb.append(" hasStoredPasscode: ") .append(passcodeManager.hasStoredPasscode(this)) .append("\n"); } sb.append("}\n"); return sb.toString(); }
@Override public void onCreate() { super.onCreate(); // Initialize encryption module Encryptor.init(this); // Initialize the http client String extendedUserAgent = getUserAgent() + " Native"; HttpAccess.init(this, extendedUserAgent); // Ensure we have a CookieSyncManager CookieSyncManager.createInstance(this); // Done APP = this; EventsObservable.get().notifyEvent(EventType.AppCreateComplete); }
@Override public String getKey(String name) { return Encryptor.hash( name + "12s9adpahk;n12-97sdainkasd=012", name + "12kl0dsakj4-cxh1qewkjasdol8"); }