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

Commit 31e1613e authored by d34d's avatar d34d
Browse files

Live lock screen support [1/2]

Change-Id: Iafb09bb77e10c89fb4b76cc807ca5bf86c8ba97b
parent 5a9d2019
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -630,6 +630,7 @@ public class ThemeUtils {
        components.add(ThemesColumns.MODIFIES_RINGTONES);
        components.add(ThemesColumns.MODIFIES_STATUS_BAR);
        components.add(ThemesColumns.MODIFIES_NAVIGATION_BAR);
        components.add(ThemesColumns.MODIFIES_LIVE_LOCK_SCREEN);
        return components;
    }

+8 −0
Original line number Diff line number Diff line
@@ -79,6 +79,10 @@ public final class ThemeChangeRequest implements Parcelable {
        return getThemePackageNameForComponent(MODIFIES_RINGTONES);
    }

    public String getLiveLockScreenThemePackageName() {
        return getThemePackageNameForComponent(MODIFIES_LIVE_LOCK_SCREEN);
    }

    public final Map<String, String> getThemeComponentsMap() {
        return Collections.unmodifiableMap(mThemeComponents);
    }
@@ -239,6 +243,10 @@ public final class ThemeChangeRequest implements Parcelable {
            return setComponent(MODIFIES_RINGTONES, pkgName);
        }

        public Builder setLiveLockScreen(String pkgName) {
            return setComponent(MODIFIES_LIVE_LOCK_SCREEN, pkgName);
        }

        public Builder setComponent(String component, String pkgName) {
            if (pkgName != null) {
                mThemeComponents.put(component, pkgName);
+17 −1
Original line number Diff line number Diff line
@@ -182,6 +182,13 @@ public class ThemesContract {
         */
        public static final String MODIFIES_NAVIGATION_BAR = "mods_navigation_bar";

        /**
         * 1 if theme has a live lock screen
         * <P>Type: INTEGER</P>
         * <P>Default: 0</P>
         */
        public static final String MODIFIES_LIVE_LOCK_SCREEN = "mods_live_lock_screen";

        /**
         * URI to the theme's wallpaper. We should support multiple wallpaper
         * but for now we will just have 1.
@@ -316,6 +323,7 @@ public class ThemesContract {
        public static final String KEY_RINGTONE = "mixnmatch_ringtone";
        public static final String KEY_OVERLAYS = "mixnmatch_overlays";
        public static final String KEY_NAVIGATION_BAR = "mixnmatch_navigation_bar";
        public static final String KEY_LIVE_LOCK_SCREEN = "mixnmatch_live_lock_screen";

        public static final String[] ROWS = { KEY_HOMESCREEN,
            KEY_LOCKSCREEN,
@@ -327,7 +335,8 @@ public class ThemesContract {
            KEY_RINGTONE,
            KEY_ALARM,
            KEY_OVERLAYS,
            KEY_NAVIGATION_BAR
            KEY_NAVIGATION_BAR,
            KEY_LIVE_LOCK_SCREEN
        };

        /**
@@ -361,6 +370,9 @@ public class ThemesContract {
            } else if (component.equals(MixnMatchColumns.KEY_NAVIGATION_BAR)) {
                throw new IllegalArgumentException(
                        "Navigation bar mixnmatch component does not have a related column");
            } else if (component.equals(MixnMatchColumns.KEY_LIVE_LOCK_SCREEN)) {
                throw new IllegalArgumentException(
                        "Live lock screen mixnmatch component does not have a related column");
            }
            return null;
        }
@@ -392,6 +404,8 @@ public class ThemesContract {
                return MixnMatchColumns.KEY_STATUS_BAR;
            } else if (component.equals(ThemesColumns.MODIFIES_NAVIGATION_BAR)) {
                return MixnMatchColumns.KEY_NAVIGATION_BAR;
            } else if (component.equals(ThemesColumns.MODIFIES_LIVE_LOCK_SCREEN)) {
                return MixnMatchColumns.KEY_LIVE_LOCK_SCREEN;
            }
            return null;
        }
@@ -423,6 +437,8 @@ public class ThemesContract {
                return ThemesColumns.MODIFIES_STATUS_BAR;
            } else if (mixnmatchKey.equals(MixnMatchColumns.KEY_NAVIGATION_BAR)) {
                return ThemesColumns.MODIFIES_NAVIGATION_BAR;
            } else if (mixnmatchKey.equals(MixnMatchColumns.KEY_LIVE_LOCK_SCREEN)) {
                return ThemesColumns.MODIFIES_LIVE_LOCK_SCREEN;
            }
            return null;
        }
+10 −1
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ import android.content.res.ThemeChangeRequest;
import android.content.res.ThemeConfig;
import android.content.res.IThemeChangeListener;
import android.content.res.IThemeService;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.media.RingtoneManager;
import android.os.Binder;
@@ -429,6 +428,11 @@ public class ThemeService extends IThemeService.Stub {
            incrementProgress(progressIncrement);
        }

        if (request.getLiveLockScreenThemePackageName() != null) {
            updateLiveLockScreen(request.getLiveLockScreenThemePackageName());
            incrementProgress(progressIncrement);
        }

        try {
            updateProvider(request, updateTime);
        } catch(IllegalArgumentException e) {
@@ -717,6 +721,11 @@ public class ThemeService extends IThemeService.Stub {
        return true;
    }

    private boolean updateLiveLockScreen(String pkgName) {
        // TODO: do something meaningful here once ready
        return true;
    }

    private boolean updateConfiguration(ThemeChangeRequest request,
            boolean removePerAppThemes) {
        final IActivityManager am = ActivityManagerNative.getDefault();