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

Commit 8e826465 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Hide default apps only when there are no qualifying apps."

parents f4d111ac 71c79c19
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -417,8 +417,11 @@
    <!-- Label when there is no default apps [CHAR LIMIT=30] -->
    <string name="no_default_apps">No default apps</string>

    <!-- Label when there are no apps for a default app [CHAR LIMIT=30] -->
    <string name="no_apps_for_default_app">No apps</string>
    <!-- Summary of a default app when there is no app set [CHAR LIMIT=60] -->
    <string name="default_app_none">None</string>

    <!-- Label when there are no apps available for a default app [CHAR LIMIT=30] -->
    <string name="default_app_no_apps">No apps</string>

    <!-- TODO: STOPSHIP: Migrate all default app titles from packages/apps/Settings/res/values/strings.xml . -->

+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ public class DefaultAppFragment extends SettingsFragment
    @Override
    @StringRes
    protected int getEmptyTextResource() {
        return R.string.no_apps_for_default_app;
        return R.string.default_app_no_apps;
    }

    private void onRoleInfoChanged(@NonNull RoleInfo roleInfo) {
+10 −10
Original line number Diff line number Diff line
@@ -100,12 +100,6 @@ public class DefaultAppListFragment extends SettingsFragment
        for (int roleItemsIndex = 0; roleItemsIndex < roleItemsSize; roleItemsIndex++) {
            RoleItem roleItem = roleItems.get(roleItemsIndex);

            List<ApplicationInfo> holderApplicationInfos = roleItem.getHolderApplicationInfos();
            if (holderApplicationInfos.isEmpty()) {
                // TODO: Handle Assistant which is visible even without holder.
                continue;
            }

            Role role = roleItem.getRole();
            Preference preference = oldPreferences.get(role.getName());
            if (preference == null) {
@@ -117,10 +111,16 @@ public class DefaultAppListFragment extends SettingsFragment
                preference.setOnPreferenceClickListener(this);
            }

            List<ApplicationInfo> holderApplicationInfos = roleItem.getHolderApplicationInfos();
            if (holderApplicationInfos.isEmpty()) {
                preference.setIcon(null);
                preference.setSummary(R.string.default_app_none);
            } else {
                ApplicationInfo holderApplicationInfo = holderApplicationInfos.get(0);
                preference.setIcon(IconDrawableFactory.getBadgedIcon(context, holderApplicationInfo,
                        UserHandle.getUserHandleForUid(holderApplicationInfo.uid)));
                preference.setSummary(Utils.getAppLabel(holderApplicationInfo, context));
            }

            // TODO: Ordering?
            preferenceScreen.addPreference(preference);
+4 −0
Original line number Diff line number Diff line
@@ -89,6 +89,10 @@ public class RoleListLiveData extends AsyncTaskLiveData<List<RoleItem>>
                continue;
            }

            if (role.getQualifyingPackages(mContext).isEmpty()) {
                continue;
            }

            List<ApplicationInfo> holderApplicationInfos = new ArrayList<>();
            List<String> holderPackageNames = roleManager.getRoleHolders(role.getName());
            int holderPackageNamesSize = holderPackageNames.size();