Skip creating external textures that exceeds size limit

Skia always accept an Android buffer and wraps it around with a texture
even if its size exceeds the limit GL exposes. Therefore let's skip
creating the texture in SurfaceFlinger and outputs an error log to
logcat.

I chose to do it in SurfaceFlinger rather than RenderEngine is because
the external texture mapping is designed to be asynchronous, so it'd be
better to keep that way. The limit is also exposed out of RenderEngine
so SurfaceFlinger can check it before creating external textures as
well.

Bug: 190399306
Test: The test mentioned in the bug fails instead of crashing
SurfaceFlinger.
Test: atest SurfaceFlinger_test
Test: atest libsurfaceflinger_unittest

Change-Id: I52d253ed5a10f0e4ade372048721913405ed668a
diff --git a/services/surfaceflinger/tests/unittests/CompositionTest.cpp b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
index 560f139..52a36a2 100644
--- a/services/surfaceflinger/tests/unittests/CompositionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
@@ -108,6 +108,8 @@
 
         mComposer = new Hwc2::mock::Composer();
         mFlinger.setupComposer(std::unique_ptr<Hwc2::Composer>(mComposer));
+
+        mFlinger.mutableMaxRenderTargetSize() = 16384;
     }
 
     ~CompositionTest() {
@@ -519,8 +521,6 @@
 
     static void setupLatchedBuffer(CompositionTest* test, sp<BufferQueueLayer> layer) {
         // TODO: Eliminate the complexity of actually creating a buffer
-        EXPECT_CALL(*test->mRenderEngine, getMaxTextureSize()).WillOnce(Return(16384));
-        EXPECT_CALL(*test->mRenderEngine, getMaxViewportDims()).WillOnce(Return(16384));
         status_t err =
                 layer->setDefaultBufferProperties(LayerProperties::WIDTH, LayerProperties::HEIGHT,
                                                   LayerProperties::FORMAT);