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

Commit e1cda116 authored by Beverly Tai's avatar Beverly Tai Committed by Automerger Merge Worker
Browse files

Merge "Add callback to DozeParameters on alwaysOn change" into sc-dev am: 95531c2b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14355350

Change-Id: Ic06e192e403fd7d8b31cbebf7c3afc3ca6fd36e0
parents e1b717d7 95531c2b
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ import com.android.systemui.tuner.TunerService;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Set;

import javax.inject.Inject;

@@ -62,6 +64,8 @@ public class DozeParameters implements TunerService.Tunable,
    private final BatteryController mBatteryController;
    private final FeatureFlags mFeatureFlags;

    private final Set<Callback> mCallbacks = new HashSet<>();

    private boolean mDozeAlwaysOn;
    private boolean mControlScreenOffAnimation;

@@ -250,9 +254,26 @@ public class DozeParameters implements TunerService.Tunable,
        return mResources.getBoolean(R.bool.doze_long_press_uses_prox);
    }

    /**
     * Callback to listen for DozeParameter changes.
     */
    public void addCallback(Callback callback) {
        mCallbacks.add(callback);
    }

    /**
     * Remove callback that listens for DozeParameter changes.
     */
    public void removeCallback(Callback callback) {
        mCallbacks.remove(callback);
    }

    @Override
    public void onTuningChanged(String key, String newValue) {
        mDozeAlwaysOn = mAmbientDisplayConfiguration.alwaysOnEnabled(UserHandle.USER_CURRENT);
        for (Callback callback : mCallbacks) {
            callback.onAlwaysOnChange();
        }
    }

    @Override
@@ -270,4 +291,11 @@ public class DozeParameters implements TunerService.Tunable,
        pw.print("getSelectivelyRegisterSensorsUsingProx(): ");
        pw.println(getSelectivelyRegisterSensorsUsingProx());
    }

    interface Callback {
        /**
         * Invoked when the value of getAlwaysOn may have changed.
         */
        void onAlwaysOnChange();
    }
}
+1 −11
Original line number Diff line number Diff line
@@ -241,7 +241,6 @@ import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.statusbar.policy.RemoteInputQuickSettingsDisabler;
import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.wmshell.BubblesManager;
import com.android.wm.shell.bubbles.Bubbles;
@@ -800,7 +799,6 @@ public class StatusBar extends SystemUI implements DemoMode,
            OngoingCallController ongoingCallController,
            SystemStatusAnimationScheduler animationScheduler,
            PrivacyDotViewController dotViewController,
            TunerService tunerService,
            FeatureFlags featureFlags,
            KeyguardUnlockAnimationController keyguardUnlockAnimationController) {
        super(context);
@@ -886,15 +884,6 @@ public class StatusBar extends SystemUI implements DemoMode,
        mDotViewController = dotViewController;
        mFeatureFlags = featureFlags;

        tunerService.addTunable(
                (key, newValue) -> {
                    if (key.equals(Settings.Secure.DOZE_ALWAYS_ON)) {
                        updateLightRevealScrimVisibility();
                    }
                },
                Settings.Secure.DOZE_ALWAYS_ON
        );

        mExpansionChangedListeners = new ArrayList<>();

        mBubbleExpandListener =
@@ -1038,6 +1027,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                mNotificationShadeWindowViewController,
                mNotificationPanelViewController,
                mAmbientIndicationContainer);
        mDozeParameters.addCallback(this::updateLightRevealScrimVisibility);

        mConfigurationController.addCallback(this);

+0 −3
Original line number Diff line number Diff line
@@ -103,7 +103,6 @@ import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.RemoteInputQuickSettingsDisabler;
import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.wmshell.BubblesManager;
import com.android.wm.shell.bubbles.Bubbles;
@@ -214,7 +213,6 @@ public interface StatusBarPhoneModule {
            OngoingCallController ongoingCallController,
            SystemStatusAnimationScheduler animationScheduler,
            PrivacyDotViewController dotViewController,
            TunerService tunerService,
            FeatureFlags featureFlags,
            KeyguardUnlockAnimationController keyguardUnlockAnimationController) {
        return new StatusBar(
@@ -301,7 +299,6 @@ public interface StatusBarPhoneModule {
                ongoingCallController,
                animationScheduler,
                dotViewController,
                tunerService,
                featureFlags,
                keyguardUnlockAnimationController);
    }
+0 −3
Original line number Diff line number Diff line
@@ -146,7 +146,6 @@ import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.RemoteInputQuickSettingsDisabler;
import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock;
import com.android.systemui.volume.VolumeComponent;
@@ -269,7 +268,6 @@ public class StatusBarTest extends SysuiTestCase {
    @Mock private OngoingCallController mOngoingCallController;
    @Mock private SystemStatusAnimationScheduler mAnimationScheduler;
    @Mock private PrivacyDotViewController mDotViewController;
    @Mock private TunerService mTunerService;
    @Mock private FeatureFlags mFeatureFlags;
    @Mock private IWallpaperManager mWallpaperManager;
    @Mock private KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
@@ -440,7 +438,6 @@ public class StatusBarTest extends SysuiTestCase {
                mOngoingCallController,
                mAnimationScheduler,
                mDotViewController,
                mTunerService,
                mFeatureFlags,
                mKeyguardUnlockAnimationController);
        when(mKeyguardViewMediator.registerStatusBar(any(StatusBar.class), any(ViewGroup.class),