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

Commit cf942fca authored by Bharat Singh's avatar Bharat Singh Committed by Android (Google) Code Review
Browse files

Merge "[SysUI][Floaty] Use bug-fix flag for assistant invocation effect" into main

parents 95e615d2 82734df7
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ class SqueezeEffectRepositoryTest : SysuiTestCase() {
        MockitoAnnotations.initMocks(this)
    }

    @DisableFlags(Flags.FLAG_ENABLE_LPP_SQUEEZE_EFFECT)
    @DisableFlags(Flags.FLAG_ENABLE_LPP_ASSIST_INVOCATION_EFFECT)
    @Test
    fun testSqueezeEffectDisabled_WhenFlagDisabled() =
        kosmos.runTest {
@@ -71,7 +71,7 @@ class SqueezeEffectRepositoryTest : SysuiTestCase() {
            assertThat(isSqueezeEffectEnabled).isFalse()
        }

    @EnableFlags(Flags.FLAG_ENABLE_LPP_SQUEEZE_EFFECT)
    @EnableFlags(Flags.FLAG_ENABLE_LPP_ASSIST_INVOCATION_EFFECT)
    @Test
    fun testSqueezeEffectDisabled_WhenFlagEnabled_GlobalSettingsDisabled() =
        kosmos.runTest {
@@ -82,7 +82,7 @@ class SqueezeEffectRepositoryTest : SysuiTestCase() {
            assertThat(isSqueezeEffectEnabled).isFalse()
        }

    @EnableFlags(Flags.FLAG_ENABLE_LPP_SQUEEZE_EFFECT)
    @EnableFlags(Flags.FLAG_ENABLE_LPP_ASSIST_INVOCATION_EFFECT)
    @Test
    fun testSqueezeEffectEnabled_WhenFlagEnabled_GlobalSettingEnabled() =
        kosmos.runTest {
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ class SqueezeEffectRepositoryImpl @Inject constructor(
    }.flowOn(bgCoroutineContext)

    private val squeezeEffectEnabled
        get() = Flags.enableLppSqueezeEffect() && globalSettings.getInt(
        get() = Flags.enableLppAssistInvocationEffect() && globalSettings.getInt(
            POWER_BUTTON_LONG_PRESS, R.integer.config_longPressOnPowerBehavior
        ) == 5 // 5 corresponds to launch assistant in config_longPressOnPowerBehavior

+2 −2
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ import static com.android.server.wm.WindowManagerPolicyProto.ROTATION;
import static com.android.server.wm.WindowManagerPolicyProto.ROTATION_MODE;
import static com.android.server.wm.WindowManagerPolicyProto.SCREEN_ON_FULLY;
import static com.android.server.wm.WindowManagerPolicyProto.WINDOW_MANAGER_DRAW_COMPLETE;
import static com.android.systemui.shared.Flags.enableLppSqueezeEffect;
import static com.android.systemui.shared.Flags.enableLppAssistInvocationEffect;

import android.accessibilityservice.AccessibilityService;
import android.annotation.Nullable;
@@ -1505,7 +1505,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {

        // Sending a synthetic KeyEvent to StatusBar service with flag FLAG_LONG_PRESS set, when
        // power button is long pressed
        if (enableLppSqueezeEffect()) {
        if (enableLppAssistInvocationEffect()) {
            // Long press is detected in a callback, so there's no explicit hardware KeyEvent
            // available here. Instead, we create a synthetic power key event that has properties
            // similar to the original one.
+2 −2
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ public class PowerKeyGestureTests extends ShortcutKeyTestBase {
        mPhoneWindowManager.assertNoPowerSleep();
    }

    @EnableFlags(Flags.FLAG_ENABLE_LPP_SQUEEZE_EFFECT)
    @EnableFlags(Flags.FLAG_ENABLE_LPP_ASSIST_INVOCATION_EFFECT)
    @Test
    public void testPowerLongPress_flagEnabled_shouldSendSyntheticKeyEvent()
            throws RemoteException {
@@ -189,7 +189,7 @@ public class PowerKeyGestureTests extends ShortcutKeyTestBase {
        verifier.assertReceivedKey(allOf(withKeyCode(KEYCODE_POWER), withKeyAction(ACTION_UP)));
    }

    @DisableFlags(Flags.FLAG_ENABLE_LPP_SQUEEZE_EFFECT)
    @DisableFlags(Flags.FLAG_ENABLE_LPP_ASSIST_INVOCATION_EFFECT)
    @Test
    public void testPowerLongPress_flagDisabled_shouldNotSendSyntheticKeyEvent()
            throws RemoteException {