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

Commit 0760ced3 authored by Chris Antol's avatar Chris Antol
Browse files

Support Alert data in Tile metadata

Bug: 403326850
Test: local debug code
Flag: com.android.settings.flags.homepage_tile_alert
Change-Id: Ia1b96c663852220c074c91e7e0942edff4f070cf
parent bf44395f
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -47,6 +47,7 @@ public abstract class EntriesProvider extends ContentProvider {
    public static final String METHOD_GET_DYNAMIC_SUMMARY = "getDynamicSummary";
    public static final String METHOD_GET_DYNAMIC_SUMMARY = "getDynamicSummary";
    public static final String METHOD_IS_CHECKED = "isChecked";
    public static final String METHOD_IS_CHECKED = "isChecked";
    public static final String METHOD_ON_CHECKED_CHANGED = "onCheckedChanged";
    public static final String METHOD_ON_CHECKED_CHANGED = "onCheckedChanged";
    public static final String METHOD_GET_ALERT = "getAlert";


    /**
    /**
     * @deprecated use {@link #METHOD_GET_ENTRY_DATA} instead.
     * @deprecated use {@link #METHOD_GET_ENTRY_DATA} instead.
@@ -58,6 +59,7 @@ public abstract class EntriesProvider extends ContentProvider {
    public static final String EXTRA_SWITCH_CHECKED_STATE = "checked_state";
    public static final String EXTRA_SWITCH_CHECKED_STATE = "checked_state";
    public static final String EXTRA_SWITCH_SET_CHECKED_ERROR = "set_checked_error";
    public static final String EXTRA_SWITCH_SET_CHECKED_ERROR = "set_checked_error";
    public static final String EXTRA_SWITCH_SET_CHECKED_ERROR_MESSAGE = "set_checked_error_message";
    public static final String EXTRA_SWITCH_SET_CHECKED_ERROR_MESSAGE = "set_checked_error_message";
    public static final String EXTRA_ALERT_VALUE = "alert_value";


    /**
    /**
     * @deprecated use {@link #EXTRA_ENTRY_DATA} instead.
     * @deprecated use {@link #EXTRA_ENTRY_DATA} instead.
+23 −0
Original line number Original line Diff line number Diff line
@@ -219,6 +219,14 @@ public class TileUtils {
    public static final String META_DATA_PREFERENCE_PENDING_INTENT =
    public static final String META_DATA_PREFERENCE_PENDING_INTENT =
            "com.android.settings.pending_intent";
            "com.android.settings.pending_intent";


    /**
     * Name of the meta-data item that should be set in the AndroidManifest.xml to specify the
     * content provider providing the alert count that should be displayed for the preference.
     *
     * <p>Value provided will only render if greater than zero.
     */
    public static final String META_DATA_PREFERENCE_ALERT_URI = "com.android.settings.alert_uri";

    /**
    /**
     * Value for {@link #META_DATA_KEY_PROFILE}. When the device has a managed profile, the app will
     * Value for {@link #META_DATA_KEY_PROFILE}. When the device has a managed profile, the app will
     * always be run in the primary profile.
     * always be run in the primary profile.
@@ -580,6 +588,21 @@ public class TileUtils {
        return (bundle != null) ? bundle.getBoolean(key) : false;
        return (bundle != null) ? bundle.getBoolean(key) : false;
    }
    }


    /**
     * Gets the integer associated with the input key from the content provider.
     *
     * @param context context
     * @param uri URI for the content provider
     * @param providerMap Maps URI authorities to providers
     * @param key Key mapping to the text in bundle returned by the content provider
     * @return Integer associated with the key, if returned by the content provider
     */
    public static int getIntFromUri(@NonNull Context context, @NonNull Uri uri,
            @NonNull Map<String, IContentProvider> providerMap, @NonNull String key) {
        final Bundle bundle = getBundleFromUri(context, uri, providerMap, null /* bundle */);
        return (bundle != null) ? bundle.getInt(key) : 0;
    }

    /**
    /**
     * Puts boolean associated with the input key to the content provider.
     * Puts boolean associated with the input key to the content provider.
     *
     *