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

Commit 1c1254a4 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Merge cherrypicks of [12644580, 12644273, 12644947, 12644726, 12645141,...

Merge cherrypicks of [12644580, 12644273, 12644947, 12644726, 12645141, 12644434, 12644435, 12644436, 12644997, 12644501, 12644948, 12644998, 12644949, 12644950, 12644951, 12644952, 12644953, 12644954, 12644955, 12644502, 12645163, 12645164, 12644550, 12644551, 12644437, 12644956, 12644957, 12644958, 12644959, 12645165, 12644438, 12644439, 12644440, 12644441] into rvc-release

Change-Id: Iecb9e41fd19a37406460e643275b7229aab58afe
parents 9819f577 1f0f8417
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1134,15 +1134,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
        if (invokeCallback) {
            control.cancel();
        }
        boolean stateChanged = false;
        for (int i = mRunningAnimations.size() - 1; i >= 0; i--) {
            RunningAnimation runningAnimation = mRunningAnimations.get(i);
            if (runningAnimation.runner == control) {
                mRunningAnimations.remove(i);
                ArraySet<Integer> types = toInternalType(control.getTypes());
                for (int j = types.size() - 1; j >= 0; j--) {
                    if (getSourceConsumer(types.valueAt(j)).notifyAnimationFinished()) {
                        mHost.notifyInsetsChanged();
                    }
                    stateChanged |= getSourceConsumer(types.valueAt(j)).notifyAnimationFinished();
                }
                if (invokeCallback && runningAnimation.startDispatched) {
                    dispatchAnimationEnd(runningAnimation.runner.getAnimation());
@@ -1150,6 +1149,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
                break;
            }
        }
        if (stateChanged) {
            mHost.notifyInsetsChanged();
            updateRequestedState();
        }
    }

    private void applyLocalVisibilityOverride() {
+1 −0
Original line number Diff line number Diff line
@@ -2774,6 +2774,7 @@
        <item>power</item>
        <item>restart</item>
        <item>logout</item>
        <item>screenshot</item>
        <item>bugreport</item>
    </string-array>

+15 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
import static android.view.InsetsState.ITYPE_STATUS_BAR;
import static android.view.ViewRootImpl.NEW_INSETS_MODE_FULL;
import static android.view.WindowInsets.Type.ime;
import static android.view.WindowInsets.Type.navigationBars;
import static android.view.WindowInsets.Type.statusBars;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;

@@ -742,6 +743,20 @@ public class InsetsControllerTest {
            mController.onControlsChanged(createSingletonControl(ITYPE_IME));
            assertEquals(newState.getSource(ITYPE_IME),
                    mTestHost.getModifiedState().peekSource(ITYPE_IME));

            // The modified frames cannot be updated if there is an animation.
            mController.onControlsChanged(createSingletonControl(ITYPE_NAVIGATION_BAR));
            mController.hide(navigationBars());
            newState = new InsetsState(mController.getState(), true /* copySource */);
            newState.getSource(ITYPE_NAVIGATION_BAR).getFrame().top--;
            mController.onStateChanged(newState);
            assertNotEquals(newState.getSource(ITYPE_NAVIGATION_BAR),
                    mTestHost.getModifiedState().peekSource(ITYPE_NAVIGATION_BAR));

            // The modified frames can be updated while the animation is done.
            mController.cancelExistingAnimations();
            assertEquals(newState.getSource(ITYPE_NAVIGATION_BAR),
                    mTestHost.getModifiedState().peekSource(ITYPE_NAVIGATION_BAR));
        });
    }

+21 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_GLOBAL_ACTIONS;
import static android.view.WindowManager.TAKE_SCREENSHOT_FULLSCREEN;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;

import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_NOT_REQUIRED;
@@ -547,7 +548,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
        if (!mDeviceProvisioned && !action.showBeforeProvisioning()) {
            return false;
        }
        return true;
        return action.shouldShow();
    }

    /**
@@ -962,6 +963,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,

    @VisibleForTesting
    class ScreenshotAction extends SinglePressAction implements LongPressAction {
        final String KEY_SYSTEM_NAV_2BUTTONS = "system_nav_2buttons";

        public ScreenshotAction() {
            super(R.drawable.ic_screenshot, R.string.global_action_screenshot);
        }
@@ -993,6 +996,19 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
            return false;
        }

        @Override
        public boolean shouldShow() {
          // Include screenshot in power menu for legacy nav because it is not accessible
          // through Recents in that mode
            return is2ButtonNavigationEnabled();
        }

        boolean is2ButtonNavigationEnabled() {
            return NAV_BAR_MODE_2BUTTON == mContext.getResources().getInteger(
                    com.android.internal.R.integer.config_navBarInteractionMode);
        }


        @Override
        public boolean onLongPress() {
            if (FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SCREENRECORD_LONG_PRESS)) {
@@ -1616,6 +1632,10 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
         * @return
         */
        CharSequence getMessage();

        default boolean shouldShow() {
            return true;
        }
    }

    /**
+23 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import android.testing.TestableLooper;
import android.util.FeatureFlagUtils;
import android.view.IWindowManager;
import android.view.View;
import android.view.WindowManagerPolicyConstants;
import android.widget.FrameLayout;

import androidx.test.filters.SmallTest;
@@ -241,6 +242,28 @@ public class GlobalActionsDialogTest extends SysuiTestCase {
        verifyLogPosted(GlobalActionsDialog.GlobalActionsEvent.GA_SCREENSHOT_LONG_PRESS);
    }

    @Test
    public void testShouldShowScreenshot() {
        mContext.getOrCreateTestableResources().addOverride(
                com.android.internal.R.integer.config_navBarInteractionMode,
                WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON);

        GlobalActionsDialog.ScreenshotAction screenshotAction =
                mGlobalActionsDialog.makeScreenshotActionForTesting();
        assertThat(screenshotAction.shouldShow()).isTrue();
    }

    @Test
    public void testShouldNotShowScreenshot() {
        mContext.getOrCreateTestableResources().addOverride(
                com.android.internal.R.integer.config_navBarInteractionMode,
                WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON);

        GlobalActionsDialog.ScreenshotAction screenshotAction =
                mGlobalActionsDialog.makeScreenshotActionForTesting();
        assertThat(screenshotAction.shouldShow()).isFalse();
    }

    private void verifyLogPosted(GlobalActionsDialog.GlobalActionsEvent event) {
        mTestableLooper.processAllMessages();
        verify(mUiEventLogger, times(1))
Loading