am 12c03e33: am f66f3052: Merge "TIF: implement gatherTransparentRegion() and dispatchDraw() in TvView." into lmp-mr1-dev
* commit '12c03e3386db46f2452dd7642771adad1d03ce5c':
TIF: implement gatherTransparentRegion() and dispatchDraw() in TvView.
diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java
index f9d84c1..6fc1b82 100644
--- a/media/java/android/media/tv/TvView.java
+++ b/media/java/android/media/tv/TvView.java
@@ -18,7 +18,10 @@
import android.annotation.SystemApi;
import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.PorterDuff;
import android.graphics.Rect;
+import android.graphics.Region;
import android.media.tv.TvInputManager.Session;
import android.media.tv.TvInputManager.Session.FinishedInputEventCallback;
import android.media.tv.TvInputManager.SessionCallback;
@@ -593,6 +596,42 @@
}
@Override
+ public boolean gatherTransparentRegion(Region region) {
+ if (mWindowZOrder != ZORDER_ON_TOP) {
+ if (region != null) {
+ int width = getWidth();
+ int height = getHeight();
+ if (width > 0 && height > 0) {
+ int location[] = new int[2];
+ getLocationInWindow(location);
+ int left = location[0];
+ int top = location[1];
+ region.op(left, top, left + width, top + height, Region.Op.UNION);
+ }
+ }
+ }
+ return super.gatherTransparentRegion(region);
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ if (mWindowZOrder != ZORDER_ON_TOP) {
+ // Punch a hole so that the underlying overlay view and surface can be shown.
+ canvas.drawColor(0, PorterDuff.Mode.CLEAR);
+ }
+ super.draw(canvas);
+ }
+
+ @Override
+ protected void dispatchDraw(Canvas canvas) {
+ if (mWindowZOrder != ZORDER_ON_TOP) {
+ // Punch a hole so that the underlying overlay view and surface can be shown.
+ canvas.drawColor(0, PorterDuff.Mode.CLEAR);
+ }
+ super.dispatchDraw(canvas);
+ }
+
+ @Override
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
mSurfaceView.setVisibility(visibility);