use of android.view.autofill.AutofillManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AutofillPickerTrampolineActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final AutofillManager afm = getSystemService(AutofillManager.class);
// First check if the Autofill is available for the current user...
if (afm == null || !afm.hasAutofillFeature() || !afm.isAutofillSupported()) {
// ... and fail right away if it is not.
setResult(RESULT_CANCELED);
finish();
return;
}
// Then check if the current user's service already belongs to the app...
final Intent intent = getIntent();
final String packageName = intent.getData().getSchemeSpecificPart();
final ComponentName currentService = afm.getAutofillServiceComponentName();
if (currentService != null && currentService.getPackageName().equals(packageName)) {
// ...and succeed right away if it does.
setResult(RESULT_OK);
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 android_packages_apps_Settings by omnirom.
the class AutofillPickerTrampolineActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final AutofillManager afm = getSystemService(AutofillManager.class);
// First check if the Autofill is available for the current user...
if (afm == null || !afm.hasAutofillFeature() || !afm.isAutofillSupported()) {
// ... and fail right away if it is not.
setResult(RESULT_CANCELED);
finish();
return;
}
// Then check if the current user's service already belongs to the app...
final Intent intent = getIntent();
final String packageName = intent.getData().getSchemeSpecificPart();
final ComponentName currentService = afm.getAutofillServiceComponentName();
if (currentService != null && currentService.getPackageName().equals(packageName)) {
// ...and succeed right away if it does.
setResult(RESULT_OK);
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();
}
Aggregations