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

Commit b6c84b2b authored by Darrell Shi's avatar Darrell Shi
Browse files

Add smartspace complication type.

This change fixes the issue where the smartspace complication is shown
for all dreams.

Bug: 241154896
Fix: 241154896
Test: atest ComplicationUtilsTest#testConvertComplicationType
Test: on device see that smartspace is only shown when appropriate
Change-Id: I6f191a06c9cdc6b9b4abf7cf970fb6a3991186f8
parent 165f7609
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1610,6 +1610,9 @@
    <string name="dream_complication_title_cast_info">Cast Info</string>
    <!-- Screensaver overlay which displays home controls. [CHAR LIMIT=20] -->
    <string name="dream_complication_title_home_controls">Home Controls</string>
    <!-- Screensaver overlay which displays smartspace. [CHAR LIMIT=20] -->
    <string name="dream_complication_title_smartspace">Smartspace</string>


    <!-- Title for a screen allowing the user to choose a profile picture. [CHAR LIMIT=NONE] -->
    <string name="avatar_picker_title">Choose a profile picture</string>
+6 −1
Original line number Diff line number Diff line
@@ -92,7 +92,8 @@ public class DreamBackend {
            COMPLICATION_TYPE_WEATHER,
            COMPLICATION_TYPE_AIR_QUALITY,
            COMPLICATION_TYPE_CAST_INFO,
            COMPLICATION_TYPE_HOME_CONTROLS
            COMPLICATION_TYPE_HOME_CONTROLS,
            COMPLICATION_TYPE_SMARTSPACE
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface ComplicationType {}
@@ -103,6 +104,7 @@ public class DreamBackend {
    public static final int COMPLICATION_TYPE_AIR_QUALITY = 4;
    public static final int COMPLICATION_TYPE_CAST_INFO = 5;
    public static final int COMPLICATION_TYPE_HOME_CONTROLS = 6;
    public static final int COMPLICATION_TYPE_SMARTSPACE = 7;

    private final Context mContext;
    private final IDreamManager mDreamManager;
@@ -351,6 +353,9 @@ public class DreamBackend {
            case COMPLICATION_TYPE_HOME_CONTROLS:
                res = R.string.dream_complication_title_home_controls;
                break;
            case COMPLICATION_TYPE_SMARTSPACE:
                res = R.string.dream_complication_title_smartspace;
                break;
            default:
                return null;
        }
+3 −1
Original line number Diff line number Diff line
@@ -163,7 +163,8 @@ public interface Complication {
            COMPLICATION_TYPE_WEATHER,
            COMPLICATION_TYPE_AIR_QUALITY,
            COMPLICATION_TYPE_CAST_INFO,
            COMPLICATION_TYPE_HOME_CONTROLS
            COMPLICATION_TYPE_HOME_CONTROLS,
            COMPLICATION_TYPE_SMARTSPACE
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface ComplicationType {}
@@ -175,6 +176,7 @@ public interface Complication {
    int COMPLICATION_TYPE_AIR_QUALITY = 1 << 3;
    int COMPLICATION_TYPE_CAST_INFO = 1 << 4;
    int COMPLICATION_TYPE_HOME_CONTROLS = 1 << 5;
    int COMPLICATION_TYPE_SMARTSPACE = 1 << 6;

    /**
     * The {@link Host} interface specifies a way a {@link Complication} to communicate with its
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static com.android.systemui.dreams.complication.Complication.COMPLICATION
import static com.android.systemui.dreams.complication.Complication.COMPLICATION_TYPE_DATE;
import static com.android.systemui.dreams.complication.Complication.COMPLICATION_TYPE_HOME_CONTROLS;
import static com.android.systemui.dreams.complication.Complication.COMPLICATION_TYPE_NONE;
import static com.android.systemui.dreams.complication.Complication.COMPLICATION_TYPE_SMARTSPACE;
import static com.android.systemui.dreams.complication.Complication.COMPLICATION_TYPE_TIME;
import static com.android.systemui.dreams.complication.Complication.COMPLICATION_TYPE_WEATHER;

@@ -51,6 +52,8 @@ public class ComplicationUtils {
                return COMPLICATION_TYPE_CAST_INFO;
            case DreamBackend.COMPLICATION_TYPE_HOME_CONTROLS:
                return COMPLICATION_TYPE_HOME_CONTROLS;
            case DreamBackend.COMPLICATION_TYPE_SMARTSPACE:
                return COMPLICATION_TYPE_SMARTSPACE;
            default:
                return COMPLICATION_TYPE_NONE;
        }
+5 −0
Original line number Diff line number Diff line
@@ -52,6 +52,11 @@ public class SmartSpaceComplication implements Complication {
        return mViewHolderProvider.get();
    }

    @Override
    public int getRequiredTypeAvailability() {
        return COMPLICATION_TYPE_SMARTSPACE;
    }

    /**
     * {@link CoreStartable} responsbile for registering {@link SmartSpaceComplication} with
     * SystemUI.
Loading