diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/build.gradle | 47 | ||||
| -rw-r--r-- | app/proguard-rules.pro | 2 | ||||
| -rw-r--r-- | app/src/main/assets/THIRD_PARTY_NOTICES | 59 |
3 files changed, 106 insertions, 2 deletions
diff --git a/app/build.gradle b/app/build.gradle index d0913be..476f3d8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,6 +2,8 @@ plugins { id 'com.android.application' } +import java.security.MessageDigest + android { namespace 'invalid.lena.scrcpy' compileSdk 35 @@ -95,6 +97,7 @@ android { 'META-INF/androidx/**', 'META-INF/kotlin-stdlib*', 'org/bouncycastle/pqc/crypto/picnic/**', + 'org/bouncycastle/pqc/legacy/picnic/**', 'org/bouncycastle/x509/CertPathReviewerMessages*.properties', 'kotlin/**', ] @@ -105,6 +108,10 @@ android { // classpath; let them return defaults instead of throwing. unitTests.returnDefaultValues = true } + + sourceSets { + main.assets.srcDir '../vendor/libadb-android/LICENSES' + } } dependencies { @@ -113,7 +120,7 @@ dependencies { // need it on the compile classpath too for Adb.java's ASN.1 // cert-builder. :adb keeps it 'implementation'-scoped upstream so // we declare it explicitly here rather than patch the vendor tree. - implementation 'org.bouncycastle:bcprov-jdk15to18:1.81' + implementation 'org.bouncycastle:bcprov-jdk15to18:1.84' // Bundled Conscrypt. libadb-android's TLS pairing exports keying // material via Conscrypt. Without a bundled copy it reflects into the @@ -128,3 +135,41 @@ dependencies { testImplementation 'junit:junit:4.13.2' testImplementation 'org.json:json:20240303' } + +def serverJar = file('src/main/assets/scrcpy-server.jar') +def serverSum = file('src/main/assets/scrcpy-server.sha256') +def serverVersion = file('src/main/assets/scrcpy-server.version') +def expectedServerSum = providers.gradleProperty('scrcpyServerSha256') + .orElse(providers.provider { serverSum.text.trim() }) + +tasks.register('verifyScrcpyServer') { + inputs.files(serverJar, serverSum, serverVersion) + inputs.property('expectedChecksum', expectedServerSum) + doLast { + if (!serverJar.isFile() || !serverSum.isFile() || !serverVersion.isFile()) { + throw new GradleException('scrcpy server assets are incomplete; run scripts/update-server') + } + def expected = expectedServerSum.get() + def version = serverVersion.text.trim() + if (!(expected ==~ /[0-9a-f]{64}/) || version.isEmpty()) { + throw new GradleException('scrcpy server checksum or version is invalid') + } + def digest = MessageDigest.getInstance('SHA-256') + serverJar.withInputStream { input -> + byte[] buffer = new byte[64 * 1024] + for (int n; (n = input.read(buffer)) >= 0; ) { + if (n > 0) digest.update(buffer, 0, n) + } + } + def actual = digest.digest().encodeHex().toString() + if (actual != expected) { + throw new GradleException("scrcpy server checksum mismatch: expected ${expected}, got ${actual}") + } + } +} + +tasks.configureEach { task -> + if (task.name.startsWith('merge') && task.name.endsWith('Assets')) { + task.dependsOn tasks.named('verifyScrcpyServer') + } +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index a2c74bf..5c99914 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -31,7 +31,7 @@ -keep class org.conscrypt.** { *; } -dontwarn org.conscrypt.** -dontwarn com.android.org.conscrypt.** -# Legacy Apache Harmony JSSE; unreachable on minSdk 35 but +# Legacy Apache Harmony JSSE; unreachable on minSdk 31 but # referenced in libadb's PRNGFixes. -dontwarn org.apache.harmony.** diff --git a/app/src/main/assets/THIRD_PARTY_NOTICES b/app/src/main/assets/THIRD_PARTY_NOTICES new file mode 100644 index 0000000..6dfcad2 --- /dev/null +++ b/app/src/main/assets/THIRD_PARTY_NOTICES @@ -0,0 +1,59 @@ +scrcpy-android third-party notices +================================== + +This application includes the following open-source components. Complete +corresponding source is available from the listed versioned source URLs. + +libadb-android 3.1.1 +-------------------- +Copyright 2021 Muntashir Al-Islam and contributors. +Licensed under GPL-3.0-or-later OR Apache-2.0; this application uses the +Apache-2.0 option. Portions retain BSD-3-Clause and MIT notices. +Source: https://github.com/MuntashirAkon/libadb-android/tree/3.1.1 + +SPAKE2-Java / spake2-android 2.2.1 +---------------------------------- +Copyright 2021 Muntashir Al-Islam and contributors. +Licensed under LGPL-3.0-only. The Android artifact contains spake2-c and +components under LGPL-3.0-or-later, LGPL-2.1-or-later, Apache-2.0, ISC, MIT, +and public-domain terms. +Source: https://github.com/MuntashirAkon/spake2-java/tree/2.2.1 +Native source: https://github.com/MuntashirAkon/spake2-c/tree/0d15933e5ba3e662cb01245a7ac0dc9fca3eac31 +License: https://www.gnu.org/licenses/lgpl-3.0.txt + +The application source and build scripts needed to replace this library with +a modified compatible version and rebuild the application are available at: +https://codeberg.org/0xlena/scrcpy-android + +Reverse engineering for debugging modifications to LGPL-covered components +is permitted. + +Bouncy Castle Provider 1.84 +--------------------------- +Copyright 2000-2023 The Legion of the Bouncy Castle Inc. +Licensed under the MIT license. +Source: https://github.com/bcgit/bc-java/tree/r1rv84 + +Conscrypt Android 2.5.2 +----------------------- +Copyright 2016 The Android Open Source Project. +Licensed under Apache-2.0. Contains modified portions of Netty and Apache +Harmony under Apache-2.0. +Source: https://github.com/google/conscrypt/tree/2.5.2 +Notice: https://github.com/google/conscrypt/blob/2.5.2/NOTICE + +AndroidX Annotation 1.9.1 +------------------------- +Copyright The Android Open Source Project. +Licensed under Apache-2.0. +Source: https://android.googlesource.com/platform/frameworks/support/ + +scrcpy server 4.0 +----------------- +Copyright 2018 Genymobile and 2018-2026 Romain Vimont. +Licensed under Apache-2.0. +Source: https://github.com/Genymobile/scrcpy/tree/v4.0 + +The Apache-2.0 terms used by this application and several components are in +the top-level LICENSE file in the source distribution: +https://codeberg.org/0xlena/scrcpy-android/src/branch/master/LICENSE |