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

Commit d572a03a authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Christopher Tate
Browse files

Use a generic icon for Home

It's only a *foolish* consistency that is the hobgoblin of
little minds.

Bug 10849877

Change-Id: Ice60cbb13a754edc104ae8630cb3d8dfe637d1af
parent 88cf7709
Loading
Loading
Loading
Loading
−216 B (1.13 KiB)
Loading image diff...
+62 B (850 B)
Loading image diff...
−384 B (1.47 KiB)
Loading image diff...
+1.93 KiB
Loading image diff...
+2 −37
Original line number Diff line number Diff line
@@ -667,50 +667,15 @@ public class Settings extends PreferenceActivity
        return headerIndex;
    }

    private boolean isSystemApp(ResolveInfo ri) {
        return ((ri.activityInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0);
    }

    private boolean updateHomeSettingHeaders(Header header) {
        final PackageManager pm = getPackageManager();
        final ArrayList<ResolveInfo> homeApps = new ArrayList<ResolveInfo>();
        try {
            ComponentName currentHome = pm.getHomeActivities(homeApps);
            final ArrayList<ResolveInfo> homeApps = new ArrayList<ResolveInfo>();
            getPackageManager().getHomeActivities(homeApps);
            if (homeApps.size() < 2) {
                // When there's only one available home app, omit this settings
                // category entirely at the top level UI.
                return false;
            }
            ResolveInfo iconSource = null;
            if (currentHome == null) {
                // no current default, so find the system home app and use that
                for (int which = 0; which < homeApps.size(); which++) {
                    ResolveInfo ri = homeApps.get(which);
                    if (isSystemApp(ri)) {
                        iconSource = ri;
                        break;
                    }
                }
            } else {
                // find the current-home entry in the returned set
                for (int which = 0; which < homeApps.size(); which++) {
                    ResolveInfo ri = homeApps.get(which);
                    ComponentName riName = new ComponentName(ri.activityInfo.packageName,
                            ri.activityInfo.name);
                    if (riName.equals(currentHome)) {
                        iconSource = ri;
                        break;
                    }
                }
            }
            if (iconSource != null) {
                if (header.extras == null) {
                    header.extras = new Bundle();
                }
                header.extras.putParcelable(HomeSettings.CURRENT_HOME, iconSource.activityInfo);
            } else {
                Log.v(LOG_TAG, "No home app icon found");
            }
        } catch (Exception e) {
            // Can't look up the home activity; bail on configuring the icon
            Log.w(LOG_TAG, "Problem looking up home activity!", e);