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

Commit 9e10d800 authored by d34d's avatar d34d Committed by Gerrit Code Review
Browse files

Themes: Update ThemesContract with install state [1/3]

The ThemesProvider will now be tracking the state of themes as
they are installed, updated, and removed.  Apps that only care
about these three states, when it comes to themes, can simply
register a broadcast receiver to handle these new actions.

Change-Id: I3256f88f5cd6187ebbe9636c8d87b4509aceed61
parent 1a5ba284
Loading
Loading
Loading
Loading
+54 −0
Original line number Diff line number Diff line
@@ -243,6 +243,25 @@ public class ThemesContract {
         * <P>Default: 0</P>
         */
        public static final String TARGET_API = "target_api";

        /**
         * The install state of the theme.
         * Can be one of the following:
         * {@link InstallState#UNKNOWN}
         * {@link InstallState#INSTALLING}
         * {@link InstallState#UPDATING}
         * {@link InstallState#INSTALLED}
         * <P>Type: INTEGER</P>
         * <P>Default: 0</P>
         */
        public static final String INSTALL_STATE = "install_state";

        public static class InstallState {
            public static final int UNKNOWN = 0;
            public static final int INSTALLING = 1;
            public static final int UPDATING = 2;
            public static final int INSTALLED = 3;
        }
    }

    /**
@@ -562,4 +581,39 @@ public class ThemesContract {
         */
        public static final String LOCK_WALLPAPER_PREVIEW = "lock_wallpaper_preview";
    }

    public static class Intent {
        /**
         * Action sent from the provider when a theme has been fully installed.  Fully installed
         * means that the apk was installed by PackageManager and the theme resources were
         * processed and cached by {@link com.android.server.ThemeService}
         * Requires the {@link android.Manifest.permission#READ_THEMES} permission to receive
         * this broadcast.
         */
        public static final String ACTION_THEME_INSTALLED =
                "themescontract.intent.action.THEME_INSTALLED";

        /**
         * Action sent from the provider when a theme has been updated.
         * Requires the {@link android.Manifest.permission#READ_THEMES} permission to receive
         * this broadcast.
         */
        public static final String ACTION_THEME_UPDATED =
                "themescontract.intent.action.THEME_UPDATED";

        /**
         * Action sent from the provider when a theme has been removed.
         * Requires the {@link android.Manifest.permission#READ_THEMES} permission to receive
         * this broadcast.
         */
        public static final String ACTION_THEME_REMOVED =
                "themescontract.intent.action.THEME_REMOVED";

        /**
         * Uri scheme used to broadcast the theme's package name when broadcasting
         * {@link android.provider.ThemesContract.Intent#ACTION_THEME_INSTALLED} or
         * {@link android.provider.ThemesContract.Intent#ACTION_THEME_REMOVED}
         */
        public static final String URI_SCHEME_PACKAGE = "package";
    }
}