From 3496c38e50cd2a674dcd63886557f2b41c66ac0d Mon Sep 17 00:00:00 2001 From: Conrad Chen Date: Mon, 17 Apr 2017 13:44:32 -0700 Subject: [PATCH] Fix overlay view not updated during scaling TvView Includes scaleX and scaleY into calculation of view frame. Test: build and verified by manually testing Bug: 37302836 Change-Id: I72458cf1d5b356f0fc93200a712ff6fb4ef0c2f9 --- media/java/android/media/tv/TvView.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java index e5af35711311c..9264fe473f62f 100644 --- a/media/java/android/media/tv/TvView.java +++ b/media/java/android/media/tv/TvView.java @@ -25,6 +25,7 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.PorterDuff; import android.graphics.Rect; +import android.graphics.RectF; import android.graphics.Region; import android.media.PlaybackParams; import android.media.tv.TvInputManager.Session; @@ -838,10 +839,12 @@ public class TvView extends ViewGroup { } private Rect getViewFrameOnScreen() { - int[] location = new int[2]; - getLocationOnScreen(location); - return new Rect(location[0], location[1], - location[0] + getWidth(), location[1] + getHeight()); + Rect frame = new Rect(); + getGlobalVisibleRect(frame); + RectF frameF = new RectF(frame); + getMatrix().mapRect(frameF); + frameF.round(frame); + return frame; } /**