Skip to content

Commit ab04ea2

Browse files
committed
[WIP] Enable workarounds by default
Workarounds were disabled by default, and enabled only on some device or in specific conditions. But it seems they are needed for more and more devices, so enable them by default. They could be disabled for specific devices if necessary. --- Cases where workarounds caused issues: - <#940>: To be tested - <#3805 (comment)>: To be tested - <#4015 (comment)>: This is not a problem anymore since commit b8c5853.
1 parent 071d459 commit ab04ea2

File tree

1 file changed

+3
-49
lines changed

1 file changed

+3
-49
lines changed

server/src/main/java/com/genymobile/scrcpy/Workarounds.java

+3-49
Original file line numberDiff line numberDiff line change
@@ -52,63 +52,17 @@ private Workarounds() {
5252
}
5353

5454
public static void apply(boolean audio, boolean camera) {
55-
boolean mustFillConfigurationController = false;
56-
boolean mustFillAppInfo = false;
57-
boolean mustFillAppContext = false;
58-
59-
if (Build.BRAND.equalsIgnoreCase("meizu")) {
60-
// Workarounds must be applied for Meizu phones:
61-
// - <https://github.com/Genymobile/scrcpy/issues/240>
62-
// - <https://github.com/Genymobile/scrcpy/issues/365>
63-
// - <https://github.com/Genymobile/scrcpy/issues/2656>
64-
//
65-
// But only apply when strictly necessary, since workarounds can cause other issues:
66-
// - <https://github.com/Genymobile/scrcpy/issues/940>
67-
// - <https://github.com/Genymobile/scrcpy/issues/994>
68-
mustFillAppInfo = true;
69-
} else if (Build.BRAND.equalsIgnoreCase("honor") || Build.MANUFACTURER.equalsIgnoreCase("skyworth")) {
70-
// More workarounds must be applied for Honor devices:
71-
// - <https://github.com/Genymobile/scrcpy/issues/4015>
72-
// and Skyworth devices:
73-
// - <https://github.com/Genymobile/scrcpy/issues/4922>
74-
//
75-
// The system context must not be set for all devices, because it would cause other problems:
76-
// - <https://github.com/Genymobile/scrcpy/issues/4015#issuecomment-1595382142>
77-
// - <https://github.com/Genymobile/scrcpy/issues/3805#issuecomment-1596148031>
78-
mustFillAppInfo = true;
79-
mustFillAppContext = true;
80-
}
81-
82-
if (audio && Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
83-
// Before Android 11, audio is not supported.
84-
// Since Android 12, we can properly set a context on the AudioRecord.
85-
// Only on Android 11 we must fill the application context for the AudioRecord to work.
86-
mustFillAppContext = true;
87-
}
88-
89-
if (camera) {
90-
mustFillAppInfo = true;
91-
mustFillAppContext = true;
92-
}
93-
9455
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
9556
// On some Samsung devices, DisplayManagerGlobal.getDisplayInfoLocked() calls ActivityThread.currentActivityThread().getConfiguration(),
9657
// which requires a non-null ConfigurationController.
9758
// ConfigurationController was introduced in Android 12, so do not attempt to set it on lower versions.
9859
// <https://github.com/Genymobile/scrcpy/issues/4467>
99-
mustFillConfigurationController = true;
100-
}
101-
102-
if (mustFillConfigurationController) {
10360
// Must be call before fillAppContext() because it is necessary to get a valid system context
10461
fillConfigurationController();
10562
}
106-
if (mustFillAppInfo) {
107-
fillAppInfo();
108-
}
109-
if (mustFillAppContext) {
110-
fillAppContext();
111-
}
63+
64+
fillAppInfo();
65+
fillAppContext();
11266
}
11367

11468
@SuppressWarnings("deprecation")

0 commit comments

Comments
 (0)