From 8df42cec82cb5856e6c10a4089e6b2953310da6e Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 22 Sep 2021 15:33:17 +0200 Subject: [PATCH] Fix workarounds for Meizu Workarounds.fillAppInfo() is necessary for Meizu devices even before the first call to internalStreamScreen(), but it is harmful on other devices (#940). Therefore, simplify the workaround, by calling fillAppInfo() only if Build.BRAND equals "meizu" (case insensitive). Fixes #240 (again) Fixes #2656 --- .../java/com/genymobile/scrcpy/ScreenEncoder.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java index 2f7109c5..f98c53d0 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java @@ -56,17 +56,13 @@ public class ScreenEncoder implements Device.RotationListener { public void streamScreen(Device device, FileDescriptor fd) throws IOException { Workarounds.prepareMainLooper(); - - try { - internalStreamScreen(device, fd); - } catch (NullPointerException e) { - // Retry with workarounds enabled: - // - // - Ln.d("Applying workarounds to avoid NullPointerException"); + if (Build.BRAND.equalsIgnoreCase("meizu")) { + // + // Workarounds.fillAppInfo(); - internalStreamScreen(device, fd); } + + internalStreamScreen(device, fd); } private void internalStreamScreen(Device device, FileDescriptor fd) throws IOException {