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

Commit b5d578fb authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "AccessibilityNodeInfo bounds inconsistent with compatibility mode."

parents 03289747 7961be75
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.ContentObserver;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Binder;
import android.os.Handler;
@@ -814,6 +815,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub

        final AtomicInteger mInteractionIdCounter = new AtomicInteger();

        final Rect mTempBounds = new Rect();

        // the events pending events to be dispatched to this service
        final SparseArray<AccessibilityEvent> mPendingEvents =
            new SparseArray<AccessibilityEvent>();
@@ -932,9 +935,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                AccessibilityNodeInfo info = mCallback.getFindAccessibilityNodeInfoResultAndClear(
                        interactionId);
                if (info != null) {
                    applyCompatibilityScaleIfNeeded(info);
                    info.setConnection(this);
                }
                    info.setSealed(true);
                }
                return info;
            } catch (RemoteException re) {
                if (DEBUG) {
@@ -979,6 +983,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                    final int infoCount = infos.size();
                    for (int i = 0; i < infoCount; i++) {
                        AccessibilityNodeInfo info = infos.get(i);
                        applyCompatibilityScaleIfNeeded(info);
                        info.setConnection(this);
                        info.setSealed(true);
                    }
@@ -1019,6 +1024,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                AccessibilityNodeInfo info =
                     mCallback.getFindAccessibilityNodeInfoResultAndClear(interactionId);
                if (info != null) {
                    applyCompatibilityScaleIfNeeded(info);
                    info.setConnection(this);
                    info.setSealed(true);
                }
@@ -1093,6 +1099,24 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            }
            return mWindowIdToInteractionConnectionMap.get(windowId);
        }

        private void applyCompatibilityScaleIfNeeded(AccessibilityNodeInfo info) {
            IBinder windowToken = mWindowIdToWindowTokenMap.get(info.getWindowId());
            final float scale = mWindowManagerService.getWindowCompatibilityScale(windowToken);

            if (Float.compare(scale, 1.0f) == 0) {
                return;
            }

            Rect bounds = mTempBounds;
            info.getBoundsInParent(bounds);
            bounds.scale(scale);
            info.setBoundsInParent(bounds);

            info.getBoundsInScreen(bounds);
            bounds.scale(scale);
            info.setBoundsInScreen(bounds);
        }
    }

    final class SecurityPolicy {
+7 −0
Original line number Diff line number Diff line
@@ -2776,6 +2776,13 @@ public class WindowManagerService extends IWindowManager.Stub
        Binder.restoreCallingIdentity(origId);
    }

    public float getWindowCompatibilityScale(IBinder windowToken) {
        synchronized (mWindowMap) {
            WindowState windowState = mWindowMap.get(windowToken);
            return (windowState != null) ? windowState.mGlobalScale : 1.0f;
        }
    }

    private AttributeCache.Entry getCachedAnimations(WindowManager.LayoutParams lp) {
        if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: layout params pkg="
                + (lp != null ? lp.packageName : null)