use of android.view.autofill.AutofillManager in project android_packages_apps_Settings by LineageOS.
the class AutofillPickerTrampolineActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// First check if the current user's service already belongs to the app...
final Intent intent = getIntent();
final String packageName = intent.getData().getSchemeSpecificPart();
final String currentService = DefaultAutofillPicker.getDefaultKey(this);
if (currentService != null && currentService.startsWith(packageName)) {
// ...and succeed right away if it does.
setResult(RESULT_OK);
finish();
return;
}
// Then check if the Autofill is available for the current user...
final AutofillManager afm = getSystemService(AutofillManager.class);
if (afm == null || !afm.hasAutofillFeature() || !afm.isAutofillSupported()) {
// ... and fail right away if it is not.
setResult(RESULT_CANCELED);
finish();
return;
}
// Otherwise, go ahead and show the real UI...
final Intent newIntent = new Intent(this, AutofillPickerActivity.class).setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT).setData(intent.getData());
startActivity(newIntent);
finish();
}
use of android.view.autofill.AutofillManager in project WordPress-Login-Flow-Android by wordpress-mobile.
the class LoginEmailFragment method showHintPickerDialogIfNeeded.
private void showHintPickerDialogIfNeeded() {
// If autofill is available and enabled, we favor the active autofill service over the hint picker dialog.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
final AutofillManager autofillManager = requireContext().getSystemService(AutofillManager.class);
if (autofillManager != null && autofillManager.isEnabled()) {
AppLog.d(T.NUX, LOG_TAG + ": Autofill framework is enabled. Disabling hint picker dialog.");
return;
}
}
AppLog.d(T.NUX, LOG_TAG + ": Autofill framework is unavailable or disabled. Showing hint picker dialog.");
showHintPickerDialog();
}
use of android.view.autofill.AutofillManager in project platform_packages_apps_Settings by BlissRoms.
the class AutofillPickerTrampolineActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// First check if the current user's service already belongs to the app...
final Intent intent = getIntent();
final String packageName = intent.getData().getSchemeSpecificPart();
final String currentService = DefaultAutofillPicker.getDefaultKey(this);
if (currentService != null && currentService.startsWith(packageName)) {
// ...and succeed right away if it does.
setResult(RESULT_OK);
finish();
return;
}
// Then check if the Autofill is available for the current user...
final AutofillManager afm = getSystemService(AutofillManager.class);
if (afm == null || !afm.hasAutofillFeature() || !afm.isAutofillSupported()) {
// ... and fail right away if it is not.
setResult(RESULT_CANCELED);
finish();
return;
}
// Otherwise, go ahead and show the real UI...
final Intent newIntent = new Intent(this, AutofillPickerActivity.class).setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT).setData(intent.getData());
startActivity(newIntent);
finish();
}
use of android.view.autofill.AutofillManager in project robolectric by robolectric.
the class ShadowApplicationTest method shouldProvideServicesIntroducedOreo.
@Test
@Config(minSdk = O)
public void shouldProvideServicesIntroducedOreo() throws Exception {
// Context.AUTOFILL_MANAGER_SERVICE is marked @hide and this is the documented way to obtain
// this service.
AutofillManager autofillManager = context.getSystemService(AutofillManager.class);
assertThat(autofillManager).isNotNull();
assertThat(context.getSystemService(Context.TEXT_CLASSIFICATION_SERVICE)).isInstanceOf(TextClassificationManager.class);
}
use of android.view.autofill.AutofillManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AutofillPreferenceCategory method isAutofillEnabled.
// PreferenceCategory.isEnabled() always return false, so we rather not change that logic
// decide whether the children should be shown using isAutofillEnabled() instead.
private boolean isAutofillEnabled() {
final AutofillManager afm = getContext().getSystemService(AutofillManager.class);
final boolean enabled = afm != null && afm.isEnabled();
Log.v(TAG, "isAutofillEnabled(): " + enabled);
return enabled;
}
Aggregations