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 <https://github.com/Genymobile/scrcpy/issues/240> (again) Fixes #2656 <https://github.com/Genymobile/scrcpy/issues/2656>
This commit is contained in:
parent
31131039bb
commit
8df42cec82
1 changed files with 5 additions and 9 deletions
|
@ -56,17 +56,13 @@ public class ScreenEncoder implements Device.RotationListener {
|
||||||
|
|
||||||
public void streamScreen(Device device, FileDescriptor fd) throws IOException {
|
public void streamScreen(Device device, FileDescriptor fd) throws IOException {
|
||||||
Workarounds.prepareMainLooper();
|
Workarounds.prepareMainLooper();
|
||||||
|
if (Build.BRAND.equalsIgnoreCase("meizu")) {
|
||||||
try {
|
// <https://github.com/Genymobile/scrcpy/issues/240>
|
||||||
internalStreamScreen(device, fd);
|
// <https://github.com/Genymobile/scrcpy/issues/2656>
|
||||||
} catch (NullPointerException e) {
|
|
||||||
// Retry with workarounds enabled:
|
|
||||||
// <https://github.com/Genymobile/scrcpy/issues/365>
|
|
||||||
// <https://github.com/Genymobile/scrcpy/issues/940>
|
|
||||||
Ln.d("Applying workarounds to avoid NullPointerException");
|
|
||||||
Workarounds.fillAppInfo();
|
Workarounds.fillAppInfo();
|
||||||
internalStreamScreen(device, fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internalStreamScreen(device, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void internalStreamScreen(Device device, FileDescriptor fd) throws IOException {
|
private void internalStreamScreen(Device device, FileDescriptor fd) throws IOException {
|
||||||
|
|
Loading…
Reference in a new issue