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

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

Merge "Remove automatic rule icons" into oc-dr1-dev

parents 98f83d61 1c3a291f
Loading
Loading
Loading
Loading
+0 −26
Original line number Diff line number Diff line
@@ -306,11 +306,8 @@ public class ZenModeSettings extends ZenModeSettingsBase {

            try {
                ApplicationInfo info = mPm.getApplicationInfo(rule.getOwner().getPackageName(), 0);
                LoadIconTask task = new LoadIconTask(this);
                task.execute(info);
                setSummary(computeRuleSummary(rule, isSystemRule, info.loadLabel(mPm)));
            } catch (PackageManager.NameNotFoundException e) {
                setIcon(R.drawable.ic_label);
                appExists = false;
                return;
            }
@@ -347,29 +344,6 @@ public class ZenModeSettings extends ZenModeSettingsBase {
        };
    }

    private class LoadIconTask extends AsyncTask<ApplicationInfo, Void, Drawable> {
        private final WeakReference<Preference> prefReference;

        public LoadIconTask(Preference pref) {
            prefReference = new WeakReference<>(pref);
        }

        @Override
        protected Drawable doInBackground(ApplicationInfo... params) {
            return params[0].loadIcon(mPm);
        }

        @Override
        protected void onPostExecute(Drawable icon) {
            if (icon != null) {
                final Preference pref = prefReference.get();
                if (pref != null) {
                    pref.setIcon(icon);
                }
            }
        }
    }

    public static class SummaryBuilder {

        private Context mContext;