summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tracy Zhou <tracyzhou@google.com> 2020-04-03 20:43:51 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-04-03 20:43:51 +0000
commitf1a03e07cd65293435a576269f6c28a6c328276d (patch)
treebfc0bfb4b8dc2c42d286fac89411eaab4c2331da
parent8d0b0290e8d7927ce84ba737c218949767f463bb (diff)
parenta4b0b8d23c456c72782c23ad8148637a02f8187e (diff)
Merge "Get rid of usage of Context#getDisplayNoVerify() in SurfaceViewRequestReceiver" into rvc-dev
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestReceiver.java6
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestUtils.java16
2 files changed, 17 insertions, 5 deletions
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestReceiver.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestReceiver.java
index 29100ef8f70f..8bd7c790682d 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestReceiver.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestReceiver.java
@@ -18,6 +18,7 @@ package com.android.systemui.shared.system;
import android.content.Context;
import android.graphics.PixelFormat;
+import android.hardware.display.DisplayManager;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Size;
@@ -59,6 +60,7 @@ public class SurfaceViewRequestReceiver {
if (mSurfaceControlViewHost != null) {
mSurfaceControlViewHost.die();
}
+
SurfaceControl surfaceControl = SurfaceViewRequestUtils.getSurfaceControl(bundle);
if (surfaceControl != null) {
if (viewSize == null) {
@@ -70,8 +72,10 @@ public class SurfaceViewRequestReceiver {
WindowlessWindowManager windowlessWindowManager =
new WindowlessWindowManager(context.getResources().getConfiguration(),
surfaceControl, hostToken);
+ DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
mSurfaceControlViewHost = new SurfaceControlViewHost(context,
- context.getDisplayNoVerify(), windowlessWindowManager);
+ dm.getDisplay(SurfaceViewRequestUtils.getDisplayId(bundle)),
+ windowlessWindowManager);
WindowManager.LayoutParams layoutParams =
new WindowManager.LayoutParams(
viewSize.getWidth(),
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestUtils.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestUtils.java
index 4409276f8c27..6742a4dc06b7 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestUtils.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestUtils.java
@@ -26,30 +26,38 @@ import android.view.SurfaceView;
public class SurfaceViewRequestUtils {
private static final String KEY_HOST_TOKEN = "host_token";
private static final String KEY_SURFACE_CONTROL = "surface_control";
+ private static final String KEY_DISPLAY_ID = "display_id";
/** Creates a SurfaceView based bundle that stores the input host token and surface control. */
public static Bundle createSurfaceBundle(SurfaceView surfaceView) {
Bundle bundle = new Bundle();
bundle.putBinder(KEY_HOST_TOKEN, surfaceView.getHostToken());
bundle.putParcelable(KEY_SURFACE_CONTROL, surfaceView.getSurfaceControl());
+ bundle.putInt(KEY_DISPLAY_ID, surfaceView.getDisplay().getDisplayId());
return bundle;
}
/**
* Retrieves the SurfaceControl from a bundle created by
* {@link #createSurfaceBundle(SurfaceView)}.
- **/
+ */
public static SurfaceControl getSurfaceControl(Bundle bundle) {
return bundle.getParcelable(KEY_SURFACE_CONTROL);
}
/**
- * Retrieves the input token from a bundle created by
- * {@link #createSurfaceBundle(SurfaceView)}.
- **/
+ * Retrieves the input token from a bundle created by {@link #createSurfaceBundle(SurfaceView)}.
+ */
public static @Nullable IBinder getHostToken(Bundle bundle) {
return bundle.getBinder(KEY_HOST_TOKEN);
}
+ /**
+ * Retrieves the display id from a bundle created by {@link #createSurfaceBundle(SurfaceView)}.
+ */
+ public static int getDisplayId(Bundle bundle) {
+ return bundle.getInt(KEY_DISPLAY_ID);
+ }
+
private SurfaceViewRequestUtils() {}
}