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

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

Merge "Add an API to get active icon for screen saver" into rvc-dev

parents 9fec6af8 57abc612
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -159,6 +159,25 @@ public class DreamBackend {
        return null;
    }

    /**
     * Gets an icon from active dream.
     */
    public Drawable getActiveIcon() {
        final ComponentName cn = getActiveDream();
        if (cn != null) {
            final PackageManager pm = mContext.getPackageManager();
            try {
                final ServiceInfo ri = pm.getServiceInfo(cn, 0);
                if (ri != null) {
                    return ri.loadIcon(pm);
                }
            } catch (PackageManager.NameNotFoundException exc) {
                return null;
            }
        }
        return null;
    }

    public @WhenToDream int getWhenToDreamSetting() {
        if (!isEnabled()) {
            return NEVER;