Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestReceiver.java +5 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -59,6 +60,7 @@ public class SurfaceViewRequestReceiver { if (mSurfaceControlViewHost != null) { mSurfaceControlViewHost.die(); } SurfaceControl surfaceControl = SurfaceViewRequestUtils.getSurfaceControl(bundle); if (surfaceControl != null) { if (viewSize == null) { Loading @@ -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(), Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestUtils.java +12 −4 Original line number Diff line number Diff line Loading @@ -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() {} } Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestReceiver.java +5 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -59,6 +60,7 @@ public class SurfaceViewRequestReceiver { if (mSurfaceControlViewHost != null) { mSurfaceControlViewHost.die(); } SurfaceControl surfaceControl = SurfaceViewRequestUtils.getSurfaceControl(bundle); if (surfaceControl != null) { if (viewSize == null) { Loading @@ -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(), Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceViewRequestUtils.java +12 −4 Original line number Diff line number Diff line Loading @@ -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() {} }