Skip to content

Commit 345af96

Browse files
author
Jae Seo
committed
TIF: Enable hardware acceleration on overlay
Bug: 18162541 Change-Id: If57fb26ae88ca6ef701f01cce0e5dfd9c6eb1f0e
1 parent 4fc1b70 commit 345af96

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

media/java/android/media/tv/TvInputService.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import android.annotation.Nullable;
2121
import android.annotation.SuppressLint;
2222
import android.annotation.SystemApi;
23+
import android.app.ActivityManager;
2324
import android.app.Service;
2425
import android.content.Context;
2526
import android.content.Intent;
@@ -1200,12 +1201,15 @@ void createOverlayView(IBinder windowToken, Rect frame) {
12001201
// We make the overlay view non-focusable and non-touchable so that
12011202
// the application that owns the window token can decide whether to consume or
12021203
// dispatch the input events.
1203-
int flag = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
1204-
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
1205-
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
1204+
int flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
1205+
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
1206+
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
1207+
if (ActivityManager.isHighEndGfx()) {
1208+
flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
1209+
}
12061210
mWindowParams = new WindowManager.LayoutParams(
12071211
frame.right - frame.left, frame.bottom - frame.top,
1208-
frame.left, frame.top, type, flag, PixelFormat.TRANSPARENT);
1212+
frame.left, frame.top, type, flags, PixelFormat.TRANSPARENT);
12091213
mWindowParams.privateFlags |=
12101214
WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
12111215
mWindowParams.gravity = Gravity.START | Gravity.TOP;

0 commit comments

Comments
 (0)