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

Commit 856d4e1a authored by Romain Guy's avatar Romain Guy
Browse files

Disable hardware acceleration for apps in compatibility mode

Change-Id: I2d1c01a30c6fe6fff85c2a9bd6ee6de98e1ed422
parent 2c4d954e
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -425,20 +425,17 @@ public final class ViewRootImpl extends Handler implements ViewParent,
                    }
                }

                // If the application owns the surface, don't enable hardware acceleration
                if (mSurfaceHolder == null) {
                    enableHardwareAcceleration(attrs);
                }

                CompatibilityInfo compatibilityInfo = mCompatibilityInfo.get();
                mTranslator = compatibilityInfo.getTranslator();

                if (mTranslator != null) {
                    mSurface.setCompatibilityTranslator(mTranslator);
                // If the application owns the surface, don't enable hardware acceleration
                if (mSurfaceHolder == null) {
                    enableHardwareAcceleration(attrs);
                }

                boolean restore = false;
                if (mTranslator != null) {
                    mSurface.setCompatibilityTranslator(mTranslator);
                    restore = true;
                    attrs.backup();
                    mTranslator.translateWindowLayout(attrs);
@@ -590,6 +587,9 @@ public final class ViewRootImpl extends Handler implements ViewParent,
        mAttachInfo.mHardwareAccelerated = false;
        mAttachInfo.mHardwareAccelerationRequested = false;

        // Don't enable hardware acceleration when the application is in compatibility mode
        if (mTranslator != null) return;

        // Try to enable hardware acceleration if requested
        final boolean hardwareAccelerated = 
                (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0;