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

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

Remove doze low light clock.

Bug: 241567067
Fix: 241567067
Test: manually on device
Change-Id: I1fefc24ea73d2a21a31b6e7d4c217a5fbb53a543
parent bde7caf8
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FlagsModule;
import com.android.systemui.fragments.FragmentService;
import com.android.systemui.log.dagger.LogModule;
import com.android.systemui.lowlightclock.LowLightClockController;
import com.android.systemui.media.dagger.MediaProjectionModule;
import com.android.systemui.model.SysUiState;
import com.android.systemui.navigationbar.NavigationBarComponent;
@@ -94,7 +93,6 @@ import com.android.systemui.util.time.SystemClockImpl;
import com.android.systemui.wallet.dagger.WalletModule;
import com.android.systemui.wmshell.BubblesManager;
import com.android.wm.shell.bubbles.Bubbles;
import com.android.wm.shell.dagger.DynamicOverride;

import java.util.Optional;
import java.util.concurrent.Executor;
@@ -246,21 +244,6 @@ public abstract class SystemUIModule {
                sysuiMainExecutor));
    }

    @BindsOptionalOf
    @DynamicOverride
    abstract LowLightClockController optionalLowLightClockController();

    @SysUISingleton
    @Provides
    static Optional<LowLightClockController> provideLowLightClockController(
            @DynamicOverride Optional<LowLightClockController> optionalController) {
        if (optionalController.isPresent() && optionalController.get().isLowLightClockEnabled()) {
            return optionalController;
        } else {
            return Optional.empty();
        }
    }

    @Binds
    abstract FgsManagerController bindFgsManagerController(FgsManagerControllerImpl impl);
}
+0 −48
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.lowlightclock;

import android.view.ViewGroup;

/**
 * A controller responsible for attaching and showing an optional low-light clock while dozing.
 */
public interface LowLightClockController {
    /**
     * Returns {@code true} if the low-light clock is enabled.
     */
    boolean isLowLightClockEnabled();

    /**
     * Attach the low light-clock to the given parent {@link ViewGroup}.
     * @param parent The parent {@link ViewGroup} to which the low-light clock view should be
     *               attached.
     */
    void attachLowLightClockView(ViewGroup parent);

    /**
     * Show or hide the low-light clock.
     * @param show Whether to show the low-light clock.
     * @return {@code true} if the low-light clock was shown.
     */
    boolean showLowLightClock(boolean show);

    /**
     * An opportunity to perform burn-in prevention.
     */
    void dozeTimeTick();
}
+0 −22
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import com.android.systemui.R;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.dock.DockManager;
import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
import com.android.systemui.lowlightclock.LowLightClockController;
import com.android.systemui.statusbar.DragDownHelper;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.NotificationShadeDepthController;
@@ -51,7 +50,6 @@ import com.android.systemui.statusbar.phone.panelstate.PanelExpansionStateManage
import com.android.systemui.statusbar.window.StatusBarWindowStateController;

import java.io.PrintWriter;
import java.util.Optional;

import javax.inject.Inject;

@@ -88,7 +86,6 @@ public class NotificationShadeWindowViewController {
    private final DockManager mDockManager;
    private final NotificationPanelViewController mNotificationPanelViewController;
    private final PanelExpansionStateManager mPanelExpansionStateManager;
    private final Optional<LowLightClockController> mLowLightClockController;

    private boolean mIsTrackingBarGesture = false;

@@ -106,7 +103,6 @@ public class NotificationShadeWindowViewController {
            StatusBarKeyguardViewManager statusBarKeyguardViewManager,
            StatusBarWindowStateController statusBarWindowStateController,
            LockIconViewController lockIconViewController,
            Optional<LowLightClockController> lowLightClockController,
            CentralSurfaces centralSurfaces,
            NotificationShadeWindowController controller,
            KeyguardUnlockAnimationController keyguardUnlockAnimationController,
@@ -125,7 +121,6 @@ public class NotificationShadeWindowViewController {
        mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
        mStatusBarWindowStateController = statusBarWindowStateController;
        mLockIconViewController = lockIconViewController;
        mLowLightClockController = lowLightClockController;
        mService = centralSurfaces;
        mNotificationShadeWindowController = controller;
        mKeyguardUnlockAnimationController = keyguardUnlockAnimationController;
@@ -148,8 +143,6 @@ public class NotificationShadeWindowViewController {
        mStackScrollLayout = mView.findViewById(R.id.notification_stack_scroller);
        mGestureDetector = new GestureDetector(mView.getContext(), mPulsingGestureListener);

        mLowLightClockController.ifPresent(controller -> controller.attachLowLightClockView(mView));

        mView.setInteractionEventHandler(new NotificationShadeWindowView.InteractionEventHandler() {
            @Override
            public Boolean handleDispatchTouchEvent(MotionEvent ev) {
@@ -434,21 +427,6 @@ public class NotificationShadeWindowViewController {
        mStatusBarViewController = statusBarViewController;
    }

    /**
     * Tell the controller that dozing has begun or ended.
     * @param dozing True if dozing has begun.
     */
    public void setDozing(boolean dozing) {
        mLowLightClockController.ifPresent(controller -> controller.showLowLightClock(dozing));
    }

    /**
     * Tell the controller to perform burn-in prevention.
     */
    public void dozeTimeTick() {
        mLowLightClockController.ifPresent(LowLightClockController::dozeTimeTick);
    }

    @VisibleForTesting
    void setDragDownHelper(DragDownHelper dragDownHelper) {
        mDragDownHelper = dragDownHelper;
+0 −2
Original line number Diff line number Diff line
@@ -226,7 +226,6 @@ public final class DozeServiceHost implements DozeHost {
        }

        mStatusBarStateController.setIsDozing(dozing);
        mNotificationShadeWindowViewController.setDozing(dozing);
        if (mFoldAodAnimationController != null) {
            mFoldAodAnimationController.setIsDozing(dozing);
        }
@@ -310,7 +309,6 @@ public final class DozeServiceHost implements DozeHost {
    public void dozeTimeTick() {
        mNotificationPanel.dozeTimeTick();
        mAuthController.dozeTimeTick();
        mNotificationShadeWindowViewController.dozeTimeTick();
        if (mAmbientIndicationContainer instanceof DozeReceiver) {
            ((DozeReceiver) mAmbientIndicationContainer).dozeTimeTick();
        }
+0 −31
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import com.android.systemui.SysuiTestCase
import com.android.systemui.classifier.FalsingCollectorFake
import com.android.systemui.dock.DockManager
import com.android.systemui.keyguard.KeyguardUnlockAnimationController
import com.android.systemui.lowlightclock.LowLightClockController
import com.android.systemui.shade.NotificationShadeWindowView.InteractionEventHandler
import com.android.systemui.statusbar.LockscreenShadeTransitionController
import com.android.systemui.statusbar.NotificationShadeDepthController
@@ -39,12 +38,10 @@ import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager
import com.android.systemui.statusbar.phone.panelstate.PanelExpansionStateManager
import com.android.systemui.statusbar.window.StatusBarWindowStateController
import com.google.common.truth.Truth.assertThat
import java.util.Optional
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentCaptor
import org.mockito.ArgumentMatchers
import org.mockito.Mock
import org.mockito.Mockito.anyFloat
import org.mockito.Mockito.never
@@ -87,8 +84,6 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
    @Mock
    private lateinit var phoneStatusBarViewController: PhoneStatusBarViewController
    @Mock
    private lateinit var lowLightClockController: LowLightClockController
    @Mock
    private lateinit var pulsingGestureListener: PulsingGestureListener

    private lateinit var interactionEventHandlerCaptor: ArgumentCaptor<InteractionEventHandler>
@@ -114,7 +109,6 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
            statusBarKeyguardViewManager,
            statusBarWindowStateController,
            lockIconViewController,
            Optional.of(lowLightClockController),
            centralSurfaces,
            notificationShadeWindowController,
            keyguardUnlockAnimationController,
@@ -252,31 +246,6 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
        verify(phoneStatusBarViewController).sendTouchToView(nextEvent)
        assertThat(returnVal).isTrue()
    }

    @Test
    fun testLowLightClockAttachedWhenExpandedStatusBarSetup() {
        verify(lowLightClockController).attachLowLightClockView(ArgumentMatchers.any())
    }

    @Test
    fun testLowLightClockShownWhenDozing() {
        underTest.setDozing(true)
        verify(lowLightClockController).showLowLightClock(true)
    }

    @Test
    fun testLowLightClockDozeTimeTickCalled() {
        underTest.dozeTimeTick()
        verify(lowLightClockController).dozeTimeTick()
    }

    @Test
    fun testLowLightClockHiddenWhenNotDozing() {
        underTest.setDozing(true)
        verify(lowLightClockController).showLowLightClock(true)
        underTest.setDozing(false)
        verify(lowLightClockController).showLowLightClock(false)
    }
}

private val downEv = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0)
Loading