Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c21cfe9e authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Autofill compat - Settings

Test: manully can change autofill serivces

Update settings due to API signature change.

Change-Id: Idaf00fdbe7cb07cb174f3bbd8edcfa95ac734764
parent d1afc3e4
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -251,16 +251,16 @@ public class DefaultAutofillPicker extends DefaultAppPickerFragment {
    static final class AutofillSettingIntentProvider implements SettingIntentProvider {

        private final String mSelectedKey;
        private final PackageManager mPackageManager;
        private final Context mContext;

        public AutofillSettingIntentProvider(PackageManager packageManager, String key) {
        public AutofillSettingIntentProvider(Context context, String key) {
            mSelectedKey = key;
            mPackageManager = packageManager;
            mContext = context;
        }

        @Override
        public Intent getIntent() {
            final List<ResolveInfo> resolveInfos = mPackageManager.queryIntentServices(
            final List<ResolveInfo> resolveInfos = mContext.getPackageManager().queryIntentServices(
                    AUTOFILL_PROBE, PackageManager.GET_META_DATA);

            for (ResolveInfo resolveInfo : resolveInfos) {
@@ -270,7 +270,7 @@ public class DefaultAutofillPicker extends DefaultAppPickerFragment {
                if (TextUtils.equals(mSelectedKey, flattenKey)) {
                    final String settingsActivity;
                    try {
                        settingsActivity = new AutofillServiceInfo(mPackageManager, serviceInfo)
                        settingsActivity = new AutofillServiceInfo(mContext, serviceInfo)
                                .getSettingsActivity();
                    } catch (SecurityException e) {
                        // Service does not declare the proper permission, ignore it.
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ public class DefaultAutofillPreferenceController extends DefaultAppPreferenceCon
        }
        final DefaultAutofillPicker.AutofillSettingIntentProvider intentProvider =
                new DefaultAutofillPicker.AutofillSettingIntentProvider(
                        mPackageManager.getPackageManager(), info.getKey());
                        mContext, info.getKey());
        return intentProvider.getIntent();
    }

+0 −5
Original line number Diff line number Diff line
@@ -104,10 +104,5 @@ public class DefaultAutofillPreferenceControllerTest {
        final DefaultAppInfo info = mController.getDefaultAppInfo();

        assertThat(info).isNotNull();

        mController.getSettingIntent(info);

        verify(mPackageManager.getPackageManager()).queryIntentServices(
                DefaultAutofillPicker.AUTOFILL_PROBE, PackageManager.GET_META_DATA);
    }
}