Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3896db14 authored by Jeff Tinker's avatar Jeff Tinker
Browse files

Revert "Modify SurfaceView to use SurfaceFlinger child surfaces."

This reverts commit 693f3432.

P0: When playing encrypted content the Fugu displays a blank screen.

Test: with topic "surfaceview-without-wm" reverted, encrypted playback
works on ToT oc-release. See repro steps in 35917840#12.

bug:35917840

Change-Id: I37fa1e427daff3a1c18ed1c92d035421d891f67c
parent 693f3432
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -95,11 +95,6 @@ public class SurfaceControl {
            IBinder displayToken, int mode);
    private static native void nativeDeferTransactionUntil(long nativeObject,
            IBinder handle, long frame);
    private static native void nativeDeferTransactionUntilSurface(long nativeObject,
            long surfaceObject, long frame);
    private static native void nativeReparentChildren(long nativeObject,
            IBinder handle);
    private static native void nativeSeverChildren(long nativeObject);
    private static native void nativeSetOverrideScalingMode(long nativeObject,
            int scalingMode);
    private static native IBinder nativeGetHandle(long nativeObject);
@@ -426,18 +421,6 @@ public class SurfaceControl {
        nativeDeferTransactionUntil(mNativeObject, handle, frame);
    }

    public void deferTransactionUntil(Surface barrier, long frame) {
        nativeDeferTransactionUntilSurface(mNativeObject, barrier.mNativeObject, frame);
    }

    public void reparentChildren(IBinder newParentHandle) {
        nativeReparentChildren(mNativeObject, newParentHandle);
    }

    public void detachChildren() {
        nativeSeverChildren(mNativeObject);
    }

    public void setOverrideScalingMode(int scalingMode) {
        checkNotReleased();
        nativeSetOverrideScalingMode(mNativeObject, scalingMode);
+0 −5
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ public final class SurfaceSession {
    private long mNativeClient; // SurfaceComposerClient*

    private static native long nativeCreate();
    private static native long nativeCreateScoped(long surfacePtr);
    private static native void nativeDestroy(long ptr);
    private static native void nativeKill(long ptr);

@@ -36,10 +35,6 @@ public final class SurfaceSession {
        mNativeClient = nativeCreate();
    }

    public SurfaceSession(Surface root) {
        mNativeClient = nativeCreateScoped(root.mNativeObject);
    }

    /* no user serviceable parts here ... */
    @Override
    protected void finalize() throws Throwable {
+267 −173

File changed.

Preview size limit exceeded, changes collapsed.

+1 −9
Original line number Diff line number Diff line
@@ -2632,14 +2632,6 @@ public final class ViewRootImpl implements ViewParent,
        }
    }

    private void onDrawFinished() {
        try {
            mWindowSession.finishDrawing(mWindow);
        } catch (RemoteException e) {
            // Have fun!
        }
    }

    private void performDraw() {
        if (mAttachInfo.mDisplayState == Display.STATE_OFF && !mReportNextDraw) {
            return;
@@ -2690,7 +2682,7 @@ public final class ViewRootImpl implements ViewParent,
            }

            if (mSurfaceHolder != null && mSurface.isValid()) {
                SurfaceCallbackHelper sch = new SurfaceCallbackHelper(this::onDrawFinished);
                SurfaceCallbackHelper sch = new SurfaceCallbackHelper(mWindowSession, mWindow);
                SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks();

                sch.dispatchSurfaceRedrawNeededAsync(mSurfaceHolder, callbacks);
+16 −5
Original line number Diff line number Diff line
@@ -17,11 +17,14 @@
package com.android.internal.view;

import android.os.RemoteException;
import android.view.IWindow;
import android.view.IWindowSession;
import android.view.Surface;
import android.view.SurfaceHolder;

public class SurfaceCallbackHelper {
    Runnable mRunnable;
    IWindowSession mSession;
    IWindow.Stub mWindow;

    int mFinishDrawingCollected = 0;
    int mFinishDrawingExpected = 0;
@@ -34,18 +37,26 @@ public class SurfaceCallbackHelper {
                    if (mFinishDrawingCollected < mFinishDrawingExpected) {
                        return;
                    }
                    mRunnable.run();
                    try {
                        mSession.finishDrawing(mWindow);
                    } catch (RemoteException e) {
                    }
                }
            }
    };

    public SurfaceCallbackHelper(Runnable callbacksCollected) {
        mRunnable = callbacksCollected;
    public SurfaceCallbackHelper(IWindowSession session,
            IWindow.Stub window) {
        mSession = session;
        mWindow = window;
    }

    public void dispatchSurfaceRedrawNeededAsync(SurfaceHolder holder, SurfaceHolder.Callback callbacks[]) {
        if (callbacks == null || callbacks.length == 0) {
            mRunnable.run();
            try {
                mSession.finishDrawing(mWindow);
            } catch (RemoteException e) {
            }
            return;
        }

Loading