@@ -52,63 +52,17 @@ private Workarounds() {
52
52
}
53
53
54
54
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
-
94
55
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .S ) {
95
56
// On some Samsung devices, DisplayManagerGlobal.getDisplayInfoLocked() calls ActivityThread.currentActivityThread().getConfiguration(),
96
57
// which requires a non-null ConfigurationController.
97
58
// ConfigurationController was introduced in Android 12, so do not attempt to set it on lower versions.
98
59
// <https://github.com/Genymobile/scrcpy/issues/4467>
99
- mustFillConfigurationController = true ;
100
- }
101
-
102
- if (mustFillConfigurationController ) {
103
60
// Must be call before fillAppContext() because it is necessary to get a valid system context
104
61
fillConfigurationController ();
105
62
}
106
- if (mustFillAppInfo ) {
107
- fillAppInfo ();
108
- }
109
- if (mustFillAppContext ) {
110
- fillAppContext ();
111
- }
63
+
64
+ fillAppInfo ();
65
+ fillAppContext ();
112
66
}
113
67
114
68
@ SuppressWarnings ("deprecation" )
0 commit comments