use of com.android.settingslib.applications.DefaultAppInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DefaultAssistPreferenceControllerTest method getDefaultAppInfo_hasDefaultAssist_shouldReturnKey.
@Test
@Config(shadows = { ShadowSecureSettings.class })
public void getDefaultAppInfo_hasDefaultAssist_shouldReturnKey() {
final String flattenKey = "com.android.settings/assist";
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.ASSISTANT, flattenKey);
DefaultAppInfo appInfo = mController.getDefaultAppInfo();
assertThat(appInfo.getKey()).isEqualTo(flattenKey);
}
use of com.android.settingslib.applications.DefaultAppInfo in project android_packages_apps_Settings by omnirom.
the class DefaultAssistPreferenceControllerTest method getDefaultAppInfo_hasDefaultAssist_shouldReturnKey.
@Test
@Config(shadows = { ShadowSecureSettings.class })
public void getDefaultAppInfo_hasDefaultAssist_shouldReturnKey() {
final String flattenKey = "com.android.settings/assist";
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.ASSISTANT, flattenKey);
DefaultAppInfo appInfo = mController.getDefaultAppInfo();
assertThat(appInfo.getKey()).isEqualTo(flattenKey);
}
use of com.android.settingslib.applications.DefaultAppInfo in project android_packages_apps_Settings by omnirom.
the class DefaultAutofillPickerTest method getConfirmationMessage_shouldNotBeNull.
@Test
public void getConfirmationMessage_shouldNotBeNull() {
mPicker.onAttach((Context) mActivity);
final DefaultAppInfo info = mock(DefaultAppInfo.class);
when(info.loadLabel()).thenReturn("test_app_name");
assertThat(mPicker.getConfirmationMessage(info)).isNotNull();
}
use of com.android.settingslib.applications.DefaultAppInfo in project android_packages_apps_Settings by omnirom.
the class NotificationAssistantPicker method onServicesReloaded.
@Override
public void onServicesReloaded(List<ServiceInfo> services) {
List<CandidateInfo> list = new ArrayList<>();
services.sort(new PackageItemInfo.DisplayNameComparator(mPm));
for (ServiceInfo service : services) {
if (mContext.getPackageManager().checkPermission(android.Manifest.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE, service.packageName) == PackageManager.PERMISSION_GRANTED) {
final ComponentName cn = new ComponentName(service.packageName, service.name);
list.add(new DefaultAppInfo(mContext, mPm, mUserId, cn));
}
}
list.add(new CandidateNone(mContext));
mCandidateInfos = list;
}
use of com.android.settingslib.applications.DefaultAppInfo in project android_packages_apps_Settings by omnirom.
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)) {
if (showLabelAsTitle()) {
preference.setTitle(defaultAppLabel);
} else {
preference.setSummary(defaultAppLabel);
}
preference.setIcon(Utils.getSafeIcon(getDefaultAppIcon()));
} else {
Log.d(TAG, "No default app");
if (showLabelAsTitle()) {
preference.setTitle(R.string.app_list_preference_none);
} else {
preference.setSummary(R.string.app_list_preference_none);
}
preference.setIcon(null);
}
mayUpdateGearIcon(app, preference);
}
Aggregations