use of android.os.AsyncTask in project android_packages_apps_Settings by crdroidandroid.
the class CryptKeeper method setupUi.
/**
* Initializes the UI based on the current state of encryption.
* This is idempotent - calling repeatedly will simply re-initialize the UI.
*/
private void setupUi() {
if (mEncryptionGoneBad || isDebugView(FORCE_VIEW_ERROR)) {
setContentView(R.layout.crypt_keeper_progress);
showFactoryReset(mCorrupt);
return;
}
final String progress = SystemProperties.get("vold.encrypt_progress");
if (!"".equals(progress) || isDebugView(FORCE_VIEW_PROGRESS)) {
setContentView(R.layout.crypt_keeper_progress);
encryptionProgressInit();
} else if (mValidationComplete || isDebugView(FORCE_VIEW_PASSWORD)) {
new AsyncTask<Void, Void, Void>() {
int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
String owner_info;
boolean pattern_visible;
boolean password_visible;
@Override
public Void doInBackground(Void... v) {
try {
final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType();
owner_info = service.getField(StorageManager.OWNER_INFO_KEY);
pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY)));
password_visible = !("0".equals(service.getField(StorageManager.PASSWORD_VISIBLE_KEY)));
} catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e);
}
return null;
}
@Override
public void onPostExecute(java.lang.Void v) {
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, password_visible ? 1 : 0);
if (passwordType == StorageManager.CRYPT_TYPE_PIN) {
setContentView(R.layout.crypt_keeper_pin_entry);
mStatusString = R.string.enter_pin;
} else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
setContentView(R.layout.crypt_keeper_pattern_entry);
setBackFunctionality(false);
mStatusString = R.string.enter_pattern;
} else {
setContentView(R.layout.crypt_keeper_password_entry);
mStatusString = R.string.enter_password;
}
mStatusText.setText(mStatusString);
final TextView ownerInfo = (TextView) findViewById(R.id.owner_info);
ownerInfo.setText(owner_info);
// Required for marquee'ing to work
ownerInfo.setSelected(true);
passwordEntryInit();
findViewById(android.R.id.content).setSystemUiVisibility(View.STATUS_BAR_DISABLE_BACK);
if (mLockPatternView != null) {
mLockPatternView.setInStealthMode(!pattern_visible);
}
if (mCooldown) {
// in case we are cooling down and coming back from emergency dialler
setBackFunctionality(false);
cooldown();
}
}
}.execute();
} else if (!mValidationRequested) {
// We're supposed to be encrypted, but no validation has been done.
new ValidationTask().execute((Void[]) null);
mValidationRequested = true;
}
}
use of android.os.AsyncTask in project android_packages_apps_Settings by crdroidandroid.
the class NotificationSoundPreference method updateRingtoneName.
private void updateRingtoneName(final Uri uri) {
AsyncTask ringtoneNameTask = new AsyncTask<Object, Void, CharSequence>() {
@Override
protected CharSequence doInBackground(Object... params) {
if (uri == null) {
return getContext().getString(com.android.internal.R.string.ringtone_silent);
} else if (RingtoneManager.isDefault(uri)) {
return getContext().getString(R.string.notification_sound_default);
} else if (ContentResolver.SCHEME_ANDROID_RESOURCE.equals(uri.getScheme())) {
return getContext().getString(R.string.notification_unknown_sound_title);
} else {
return Ringtone.getTitle(getContext(), uri, false, /* followSettingsUri */
true);
}
}
@Override
protected void onPostExecute(CharSequence name) {
setSummary(name);
}
};
ringtoneNameTask.execute();
}
use of android.os.AsyncTask in project android_packages_apps_Settings by crdroidandroid.
the class DefaultNotificationTonePreference method updateRingtoneName.
private void updateRingtoneName(final Uri uri) {
AsyncTask ringtoneNameTask = new AsyncTask<Object, Void, CharSequence>() {
@Override
protected CharSequence doInBackground(Object... params) {
return Ringtone.getTitle(mUserContext, uri, false, /* followSettingsUri */
true);
}
@Override
protected void onPostExecute(CharSequence name) {
setSummary(name);
}
};
ringtoneNameTask.execute();
}
use of android.os.AsyncTask in project android_packages_apps_Settings by SudaMod.
the class DefaultNotificationTonePreference method updateRingtoneName.
private void updateRingtoneName(final Uri uri) {
AsyncTask ringtoneNameTask = new AsyncTask<Object, Void, CharSequence>() {
@Override
protected CharSequence doInBackground(Object... params) {
return Ringtone.getTitle(mUserContext, uri, false, /* followSettingsUri */
true);
}
@Override
protected void onPostExecute(CharSequence name) {
setSummary(name);
}
};
ringtoneNameTask.execute();
}
use of android.os.AsyncTask in project android_packages_apps_Settings by SudaMod.
the class CryptKeeper method setupUi.
/**
* Initializes the UI based on the current state of encryption.
* This is idempotent - calling repeatedly will simply re-initialize the UI.
*/
private void setupUi() {
if (mEncryptionGoneBad || isDebugView(FORCE_VIEW_ERROR)) {
setContentView(R.layout.crypt_keeper_progress);
showFactoryReset(mCorrupt);
return;
}
final String progress = SystemProperties.get("vold.encrypt_progress");
if (!"".equals(progress) || isDebugView(FORCE_VIEW_PROGRESS)) {
setContentView(R.layout.crypt_keeper_progress);
encryptionProgressInit();
} else if (mValidationComplete || isDebugView(FORCE_VIEW_PASSWORD)) {
new AsyncTask<Void, Void, Void>() {
int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
String owner_info;
boolean pattern_visible;
boolean password_visible;
@Override
public Void doInBackground(Void... v) {
try {
final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType();
owner_info = service.getField(StorageManager.OWNER_INFO_KEY);
pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY)));
password_visible = !("0".equals(service.getField(StorageManager.PASSWORD_VISIBLE_KEY)));
} catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e);
}
return null;
}
@Override
public void onPostExecute(java.lang.Void v) {
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, password_visible ? 1 : 0);
if (passwordType == StorageManager.CRYPT_TYPE_PIN) {
setContentView(R.layout.crypt_keeper_pin_entry);
mStatusString = R.string.enter_pin;
} else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
setContentView(R.layout.crypt_keeper_pattern_entry);
setBackFunctionality(false);
mStatusString = R.string.enter_pattern;
} else {
setContentView(R.layout.crypt_keeper_password_entry);
mStatusString = R.string.enter_password;
}
mStatusText.setText(mStatusString);
final TextView ownerInfo = (TextView) findViewById(R.id.owner_info);
ownerInfo.setText(owner_info);
// Required for marquee'ing to work
ownerInfo.setSelected(true);
passwordEntryInit();
findViewById(android.R.id.content).setSystemUiVisibility(View.STATUS_BAR_DISABLE_BACK);
if (mLockPatternView != null) {
mLockPatternView.setInStealthMode(!pattern_visible);
}
if (mCooldown) {
// in case we are cooling down and coming back from emergency dialler
setBackFunctionality(false);
cooldown();
}
}
}.execute();
} else if (!mValidationRequested) {
// We're supposed to be encrypted, but no validation has been done.
new ValidationTask().execute((Void[]) null);
mValidationRequested = true;
}
}
Aggregations