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

Commit 9515687b authored by Prince's avatar Prince Committed by Prince Donkor
Browse files

Removing all complication for home control panel

Test: Device Tested
Fixes: 311738588
Flag: ACONFIG FLAG_HOME_PANEL_DREAM DEVELOPMENT
Change-Id: I8332c23de250fb177255e6256884188c0b48d8dc
parent 8bc28f86
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -76,6 +76,9 @@ import org.mockito.MockitoAnnotations;
public class DreamOverlayServiceTest extends SysuiTestCase {
    private static final ComponentName LOW_LIGHT_COMPONENT = new ComponentName("package",
            "lowlight");

    private static final ComponentName HOME_CONTROL_PANEL_DREAM_COMPONENT =
            new ComponentName("package", "homeControlPanel");
    private static final String DREAM_COMPONENT = "package/dream";
    private static final String WINDOW_NAME = "test";
    private final FakeSystemClock mFakeSystemClock = new FakeSystemClock();
@@ -194,6 +197,7 @@ public class DreamOverlayServiceTest extends SysuiTestCase {
                mUiEventLogger,
                mTouchInsetManager,
                LOW_LIGHT_COMPONENT,
                HOME_CONTROL_PANEL_DREAM_COMPONENT,
                mDreamOverlayCallbackController,
                WINDOW_NAME);
    }
@@ -316,6 +320,19 @@ public class DreamOverlayServiceTest extends SysuiTestCase {
        verify(mStateController).setLowLightActive(true);
    }

    @Test
    public void testHomeControlPanelSetsByStartDream() throws RemoteException {
        final IDreamOverlayClient client = getClient();

        // Inform the overlay service of dream starting.
        client.startDream(mWindowParams, mDreamOverlayCallback,
                HOME_CONTROL_PANEL_DREAM_COMPONENT.flattenToString(),
                false /*shouldShowComplication*/);
        mMainExecutor.runAllReady();
        assertThat(mService.getDreamComponent()).isEqualTo(HOME_CONTROL_PANEL_DREAM_COMPONENT);
        verify(mStateController).setHomeControlPanelActive(true);
    }

    @Test
    public void testOnEndDream() throws RemoteException {
        final IDreamOverlayClient client = getClient();
+17 −0
Original line number Diff line number Diff line
@@ -240,6 +240,23 @@ public class DreamOverlayStateControllerTest extends SysuiTestCase {
                .isTrue();
    }

    @Test
    public void testComplicationsNotShownForHomeControlPanelDream() {
        final Complication complication = Mockito.mock(Complication.class);
        final DreamOverlayStateController stateController = getDreamOverlayStateController(true);

        // Add a complication and verify it's returned in getComplications.
        stateController.addComplication(complication);
        mExecutor.runAllReady();
        assertThat(stateController.getComplications().contains(complication))
                .isTrue();

        stateController.setHomeControlPanelActive(true);
        mExecutor.runAllReady();

        assertThat(stateController.getComplications()).isEmpty();
    }

    @Test
    public void testComplicationsNotShownForLowLight() {
        final Complication complication = Mockito.mock(Complication.class);
+5 −0
Original line number Diff line number Diff line
@@ -980,6 +980,11 @@
    -->
    <integer name="config_sfpsSensorWidth">200</integer>

    <!-- Component name for Home Panel Dream -->
    <string name="config_homePanelDreamComponent" translatable="false">
        @null
    </string>

    <!--
    They are service names that, if enabled, will cause the magnification settings button
    to never hide after timeout.
+10 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.dreams;

import static com.android.systemui.dreams.dagger.DreamModule.DREAM_OVERLAY_WINDOW_TITLE;
import static com.android.systemui.dreams.dagger.DreamModule.DREAM_TOUCH_INSET_MANAGER;
import static com.android.systemui.dreams.dagger.DreamModule.HOME_CONTROL_PANEL_DREAM_COMPONENT;

import android.content.ComponentName;
import android.content.Context;
@@ -76,6 +77,8 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
    private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
    @Nullable
    private final ComponentName mLowLightDreamComponent;
    @Nullable
    private final ComponentName mHomeControlPanelDreamComponent;
    private final UiEventLogger mUiEventLogger;
    private final WindowManager mWindowManager;
    private final String mWindowTitle;
@@ -165,6 +168,8 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
            @Named(DREAM_TOUCH_INSET_MANAGER) TouchInsetManager touchInsetManager,
            @Nullable @Named(LowLightDreamModule.LOW_LIGHT_DREAM_COMPONENT)
                    ComponentName lowLightDreamComponent,
            @Nullable @Named(HOME_CONTROL_PANEL_DREAM_COMPONENT)
                    ComponentName homeControlPanelDreamComponent,
            DreamOverlayCallbackController dreamOverlayCallbackController,
            @Named(DREAM_OVERLAY_WINDOW_TITLE) String windowTitle) {
        super(executor);
@@ -173,6 +178,7 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
        mWindowManager = windowManager;
        mKeyguardUpdateMonitor = keyguardUpdateMonitor;
        mLowLightDreamComponent = lowLightDreamComponent;
        mHomeControlPanelDreamComponent = homeControlPanelDreamComponent;
        mKeyguardUpdateMonitor.registerCallback(mKeyguardCallback);
        mStateController = stateController;
        mUiEventLogger = uiEventLogger;
@@ -249,6 +255,10 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
        final ComponentName dreamComponent = getDreamComponent();
        mStateController.setLowLightActive(
                dreamComponent != null && dreamComponent.equals(mLowLightDreamComponent));

        mStateController.setHomeControlPanelActive(
                dreamComponent != null && dreamComponent.equals(mHomeControlPanelDreamComponent));

        mUiEventLogger.log(DreamOverlayEvent.DREAM_OVERLAY_COMPLETE_START);

        mDreamOverlayCallbackController.onStartDream();
+10 −2
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public class DreamOverlayStateController implements
    public static final int STATE_DREAM_EXIT_ANIMATIONS_RUNNING = 1 << 3;
    public static final int STATE_HAS_ASSISTANT_ATTENTION = 1 << 4;
    public static final int STATE_DREAM_OVERLAY_STATUS_BAR_VISIBLE = 1 << 5;

    private static final int STATE_HOME_CONTROL_ACTIVE = 1 << 6;
    private static final int OP_CLEAR_STATE = 1;
    private static final int OP_SET_STATE = 2;

@@ -186,7 +186,7 @@ public class DreamOverlayStateController implements
     * Returns collection of present {@link Complication}.
     */
    public Collection<Complication> getComplications(boolean filterByAvailability) {
        if (isLowLightActive()) {
        if (isLowLightActive() || containsState(STATE_HOME_CONTROL_ACTIVE)) {
            // Don't show complications on low light.
            return Collections.emptyList();
        }
@@ -350,6 +350,14 @@ public class DreamOverlayStateController implements
        modifyState(active ? OP_SET_STATE : OP_CLEAR_STATE, STATE_LOW_LIGHT_ACTIVE);
    }

    /**
     * Sets whether home control panel is active.
     * @param active {@code true} if home control panel is active, {@code false} otherwise.
     */
    public void setHomeControlPanelActive(boolean active) {
        modifyState(active ? OP_SET_STATE : OP_CLEAR_STATE, STATE_HOME_CONTROL_ACTIVE);
    }

    /**
     * Sets whether dream content and dream overlay entry animations are finished.
     * @param finished {@code true} if entry animations are finished, {@code false} otherwise.
Loading