use of com.android.settingslib.applications.DefaultAppInfo in project android_packages_apps_Settings by omnirom.
the class WebViewAppPickerTest method testDisabledPackageShownAsDisabled.
@Test
public void testDisabledPackageShownAsDisabled() {
DefaultAppInfo webviewAppInfo = mPicker.createDefaultAppInfo(mContext, mContext.getPackageManager(), createApplicationInfo(PACKAGE_NAME), "disabled");
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(false));
verify(preference, never()).setEnabled(eq(true));
}
use of com.android.settingslib.applications.DefaultAppInfo in project android_packages_apps_Settings by omnirom.
the class WebViewAppPickerTest method testDisabledPackageShowsDisabledReasonSummary.
@Test
public void testDisabledPackageShowsDisabledReasonSummary() {
String disabledReason = "disabled";
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)).setSummary(eq(disabledReason));
// Ensure we haven't called setSummary several times.
verify(preference, times(1)).setSummary(any());
}
use of com.android.settingslib.applications.DefaultAppInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WebViewAppPickerTest method testWebViewVersionAddedAfterLabel.
/**
* Ensure that the version name of a WebView package is displayed after its name in the
* preference title.
*/
@Test
public void testWebViewVersionAddedAfterLabel() {
final DefaultAppInfo webviewAppInfo = mPicker.createDefaultAppInfo(mContext, mContext.getPackageManager(), createApplicationInfo(PACKAGE_NAME), "");
final RadioButtonPreference mockPreference = mock(RadioButtonPreference.class);
mPicker.bindPreference(mockPreference, PACKAGE_NAME, webviewAppInfo, null);
mPicker.bindPreferenceExtra(mockPreference, PACKAGE_NAME, webviewAppInfo, null, null);
verify(mockPreference).setTitle(eq(PACKAGE_NAME + " " + PACKAGE_VERSION));
verify(mockPreference).setTitle(any());
}
use of com.android.settingslib.applications.DefaultAppInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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));
}
use of com.android.settingslib.applications.DefaultAppInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DefaultAppPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
final DefaultAppInfo app = getDefaultAppInfo();
CharSequence defaultAppLabel = getDefaultAppLabel();
if (preference instanceof TwoTargetPreference) {
// For use small icon because we are displaying an app preference.
// We only need to do this for TwoTargetPreference because the other prefs are
// already using AppPreference so their icon is already normalized.
((TwoTargetPreference) preference).setIconSize(ICON_SIZE_MEDIUM);
}
if (!TextUtils.isEmpty(defaultAppLabel)) {
preference.setSummary(defaultAppLabel);
Utils.setSafeIcon(preference, getDefaultAppIcon());
} else {
Log.d(TAG, "No default app");
preference.setSummary(R.string.app_list_preference_none);
preference.setIcon(null);
}
mayUpdateGearIcon(app, preference);
}
Aggregations