use of com.android.settingslib.applications.DefaultAppInfo in project android_packages_apps_Settings by omnirom.
the class DefaultAutofillPicker method getCandidates.
@Override
protected List<DefaultAppInfo> getCandidates() {
final List<DefaultAppInfo> candidates = new ArrayList<>();
final List<ResolveInfo> resolveInfos = mPm.queryIntentServicesAsUser(AUTOFILL_PROBE, PackageManager.GET_META_DATA, mUserId);
final Context context = getContext();
for (ResolveInfo info : resolveInfos) {
final String permission = info.serviceInfo.permission;
if (Manifest.permission.BIND_AUTOFILL_SERVICE.equals(permission)) {
candidates.add(new DefaultAppInfo(context, mPm, mUserId, new ComponentName(info.serviceInfo.packageName, info.serviceInfo.name)));
}
if (Manifest.permission.BIND_AUTOFILL.equals(permission)) {
// Let it go for now...
Log.w(TAG, "AutofillService from '" + info.serviceInfo.packageName + "' uses unsupported permission " + Manifest.permission.BIND_AUTOFILL + ". It works for now, but might not be supported on future releases");
candidates.add(new DefaultAppInfo(context, mPm, mUserId, new ComponentName(info.serviceInfo.packageName, info.serviceInfo.name)));
}
}
return candidates;
}
use of com.android.settingslib.applications.DefaultAppInfo in project android_packages_apps_Settings by omnirom.
the class WebViewAppPickerTest method testEnabledPackageShowsEmptySummary.
@Test
public void testEnabledPackageShowsEmptySummary() {
DefaultAppInfo webviewAppInfo = mPicker.createDefaultAppInfo(mContext, mContext.getPackageManager(), createApplicationInfo(PACKAGE_NAME), null);
RadioButtonPreference preference = mock(RadioButtonPreference.class);
mPicker.bindPreference(preference, PACKAGE_NAME, webviewAppInfo, null);
mPicker.bindPreferenceExtra(preference, PACKAGE_NAME, webviewAppInfo, null, null);
verify(preference, never()).setSummary(any());
}
use of com.android.settingslib.applications.DefaultAppInfo in project android_packages_apps_Settings by omnirom.
the class WebViewAppPickerTest method testEnabledPackageShownAsEnabled.
@Test
public void testEnabledPackageShownAsEnabled() {
String disabledReason = "";
DefaultAppInfo webviewAppInfo = mPicker.createDefaultAppInfo(mContext, mContext.getPackageManager(), createApplicationInfo(PACKAGE_NAME), disabledReason);
RadioButtonPreference preference = mock(RadioButtonPreference.class);
mPicker.bindPreference(preference, PACKAGE_NAME, webviewAppInfo, null);
mPicker.bindPreferenceExtra(preference, PACKAGE_NAME, webviewAppInfo, null, null);
verify(preference, times(1)).setEnabled(eq(true));
verify(preference, never()).setEnabled(eq(false));
}
Aggregations