Autofill compat - Settings
Test: manully can change autofill serivces
Update settings due to API signature change.
Change-Id: Idaf00fdbe7cb07cb174f3bbd8edcfa95ac734764
diff --git a/src/com/android/settings/applications/defaultapps/DefaultAutofillPicker.java b/src/com/android/settings/applications/defaultapps/DefaultAutofillPicker.java
index 97f6d4b..d116f91 100644
--- a/src/com/android/settings/applications/defaultapps/DefaultAutofillPicker.java
+++ b/src/com/android/settings/applications/defaultapps/DefaultAutofillPicker.java
@@ -251,16 +251,16 @@
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 @@
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.
diff --git a/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceController.java b/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceController.java
index 508cc63..b159d1d 100644
--- a/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceController.java
+++ b/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceController.java
@@ -53,7 +53,7 @@
}
final DefaultAutofillPicker.AutofillSettingIntentProvider intentProvider =
new DefaultAutofillPicker.AutofillSettingIntentProvider(
- mPackageManager.getPackageManager(), info.getKey());
+ mContext, info.getKey());
return intentProvider.getIntent();
}
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceControllerTest.java
index bc72ee4..4e8a79e 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceControllerTest.java
@@ -104,10 +104,5 @@
final DefaultAppInfo info = mController.getDefaultAppInfo();
assertThat(info).isNotNull();
-
- mController.getSettingIntent(info);
-
- verify(mPackageManager.getPackageManager()).queryIntentServices(
- DefaultAutofillPicker.AUTOFILL_PROBE, PackageManager.GET_META_DATA);
}
}