-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Kitkat #3341
base: master
Are you sure you want to change the base?
Support Kitkat #3341
Conversation
Since "adb forward" fallback has been implemented, it is easy to support API 19. Replace the incompatible calls related to MediaCodec to use minSdkVersion 19 instead of 21.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your work.
I guess you followed #98 discussions. After re-reading it, when I concluded:
The video encoder does not work below 5.0.
Maybe it was related to the smart watch from the issue (without an hardware encoder) and not to Android < 5 after all. So indeed, it might be possible to support Android 4.4.
TBH, I'm not sure it's worth it to add support for 4.4 in 2022. It adds complexity and maintenance (btw there is still probably the dalvik-cache
creation to handle). But if it works, maybe we could merge (anyway at least a separate up-to-date api19
branch could be useful)… I have no Android 4.4 device to test unfortunately. I will try to find one.
server/build.gradle
Outdated
@@ -21,6 +21,7 @@ android { | |||
dependencies { | |||
implementation fileTree(dir: 'libs', include: ['*.jar']) | |||
testImplementation 'junit:junit:4.13.1' | |||
compileOnly 'androidx.annotation:annotation:1.3.0' // 1.3.0 doesn't depend on Kotlin stdlib. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, the server should be buildable without any java/kotlin dependencies (and without gradle): build_without_gradle.sh
(Btw, I just removed the implementation fileTree
line above: 7f2f595)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, is it OK to download a prebuilt into a directory (e.g. prebuilt-compileOnly
) and also use everything in it as classpath for javac
? That should work both ways. I really want the IDE to help me not call API 19 stuff on API 21.
and without gradle
Any other reason than using build system within build system is weird? (And the flex of knowing how to manually produce an APK? 😁 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it OK to download a prebuilt into a directory
Nope. If it was a necessary dependency, we could discuss what to do, but here they are just annotations, it does not worth the dependency.
Any other reason than using build system within build system is weird?
It is used to build the official Debian package: https://salsa.debian.org/yangfl-guest/scrcpy/-/blob/ab5d09e733bb9635b4410693ceff95dbc859dd4c/debian/rules#L41
There were problems with gradle/kotlin (Debian provides its own packages for android tools), and it is not acceptable for Debian to download dependencies while building (there must be a separate package built from sources…).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only want @RequiresApi
, Android Studio will probably be happy if we just include this one class in the project. Then we don't need to manage a dependency.
server/src/main/java/com/genymobile/scrcpy/MediaCodecCompat.java
Outdated
Show resolved
Hide resolved
Don't manage an external dependency, we still need to be able to build without gradle.
I've made it so the AndroidX The same thing now applies to the
Removed unnecessary logic from Extracted |
This wraps up API 19 support. I think devices without an encoder, like the watch, should be handled separately, by querying |
This fixes javac call for Windows.
So that we don't shadow framework classes in our binary. Update buffer position in OsCompat.write (fixed in Lollipop MR1). Synthesize InterruptedIOException in Kitkat like in Lollipop. OsCompat never throws EINTR errno.
|
We need a path that is writable by shell on Android 4. Genymobile#98 (comment)
Why the video socket is using file descriptors, not standard Java streams? Is file descriptor faster than stream or something? |
|
I really need it. How can I download it? |
This is another attempt at suporting API 19. We're developing for a market that's often stuck 10 years ago and seeing this work felt amazing. Maybe label it as experimental.
What this consists of:
api19
branch on top ofmaster
.android.system.Os.write(FileDescriptor, ByteBuffer)
.MediaCodec.getOutputBuffer
API.ANDROID_HOME=/data/local/tmp
for server.What doesn't work:
Philips 10BDL3051T (no root). See android watch (Android 4) not showing up #98 (comment)What definitely works:
The performance isn't amazing but it works.