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

Commit e145e987 authored by Jason Chiu's avatar Jason Chiu
Browse files

Declare a metadata for setting the icon color scheme

Bug: 402607181
Test: manual
Flag: com.android.settingslib.widget.theme.flags.is_expressive_design_enabled
Change-Id: I56f1596c12264d49bde0f605125c6c0e8f2cc173
parent 42557184
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@ import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import java.util.ArrayList;
@@ -326,6 +328,15 @@ public abstract class Tile implements Parcelable {
        return false;
    }

    /** Returns the icon color scheme. */
    @Nullable
    public String getIconColorScheme(@NonNull Context context) {
        ensureMetadataNotStale(context);
        return mMetaData != null
                ? mMetaData.getString(TileUtils.META_DATA_PREFERENCE_ICON_COLOR_SCHEME, null)
                : null;
    }

    /** Whether the {@link Activity} should be launched in a separate task. */
    public boolean isNewTask() {
        if (mMetaData != null && mMetaData.containsKey(META_DATA_NEW_TASK)) {
+7 −0
Original line number Diff line number Diff line
@@ -134,6 +134,13 @@ public class TileUtils {
     */
    public static final String META_DATA_PREFERENCE_ICON = "com.android.settings.icon";

    /**
     * Name of the meta-data item that should be set in the AndroidManifest.xml to specify the icon
     * color scheme. Only available for preferences on the homepage.
     */
    public static final String META_DATA_PREFERENCE_ICON_COLOR_SCHEME =
            "com.android.settings.icon_color_scheme";

    /**
     * Name of the meta-data item that should be set in the AndroidManifest.xml
     * to specify the icon background color. The value may or may not be used by Settings app.