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

Commit e91de718 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I1c8b5638,Id9b2c57a

* changes:
  Make equality check more robust for a11y button
  Ensure nav bar contrast under magnification
parents 0b48b075 6343b32a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.IntSupplier;
@@ -2055,7 +2056,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
        }

        ComponentName componentName = ComponentName.unflattenFromString(componentId);
        if (componentName.equals(userState.mServiceAssignedToAccessibilityButton)) {
        if (Objects.equals(componentName, userState.mServiceAssignedToAccessibilityButton)) {
            return false;
        }
        userState.mServiceAssignedToAccessibilityButton = componentName;
+16 −1
Original line number Diff line number Diff line
@@ -785,6 +785,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    private int mCurrentUserId;

    /* Whether accessibility is magnifying the screen */
    private boolean mScreenMagnificationActive;

    // Maps global key codes to the components that will handle them.
    private GlobalKeyManager mGlobalKeyManager;

@@ -8164,7 +8167,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
     */
    private int configureNavBarOpacity(int visibility, boolean dockedStackVisible,
            boolean freeformStackVisible, boolean isDockedDividerResizing) {
        if (mNavBarOpacityMode == NAV_BAR_OPAQUE_WHEN_FREEFORM_OR_DOCKED) {
        if (mScreenMagnificationActive) {
            // When the screen is magnified, the nav bar should be opaque since its background
            // can vary as the user pans and zooms
            visibility = setNavBarOpaqueFlag(visibility);
        } else if (mNavBarOpacityMode == NAV_BAR_OPAQUE_WHEN_FREEFORM_OR_DOCKED) {
            if (dockedStackVisible || freeformStackVisible || isDockedDividerResizing) {
                visibility = setNavBarOpaqueFlag(visibility);
            }
@@ -8318,6 +8325,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        return false;
    }

    @Override
    public void onScreenMagnificationStateChanged(boolean active) {
        synchronized (mWindowManagerFuncs.getWindowManagerLock()) {
            mScreenMagnificationActive = active;
            updateSystemUiVisibilityLw();
        }
    }

    @Override
    public void writeToProto(ProtoOutputStream proto, long fieldId) {
        final long token = proto.start(fieldId);
+7 −0
Original line number Diff line number Diff line
@@ -1699,6 +1699,13 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
     */
    boolean canDismissBootAnimation();

    /**
     * Called when the magnification state changes.
     *
     * @param active Whether magnification is active (that is, we are zoomed in).
     */
    void onScreenMagnificationStateChanged(boolean active);

    /**
     * Convert the user rotation mode to a human readable format.
     */
+7 −0
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@ final class AccessibilityController {

    private WindowsForAccessibilityObserver mWindowsForAccessibilityObserver;

    private boolean mScreenMagnificationActive;

    public void setMagnificationCallbacksLocked(MagnificationCallbacks callbacks) {
        if (callbacks != null) {
            if (mDisplayMagnifier != null) {
@@ -136,6 +138,11 @@ final class AccessibilityController {
        if (mWindowsForAccessibilityObserver != null) {
            mWindowsForAccessibilityObserver.scheduleComputeChangedWindowsLocked();
        }
        boolean nowActive = !spec.isNop();
        if (nowActive != mScreenMagnificationActive) {
            mScreenMagnificationActive = nowActive;
            mService.mPolicy.onScreenMagnificationStateChanged(nowActive);
        }
    }

    public void getMagnificationRegionLocked(Region outMagnificationRegion) {
+4 −0
Original line number Diff line number Diff line
@@ -644,4 +644,8 @@ class TestWindowManagerPolicy implements WindowManagerPolicy {
    public boolean canDismissBootAnimation() {
        return true;
    }

    @Override
    public void onScreenMagnificationStateChanged(boolean active) {
    }
}