Skip to content

Commit

Permalink
Target API 35
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed Aug 28, 2024
1 parent a8ded37 commit 712148e
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 10 deletions.
5 changes: 2 additions & 3 deletions buildSrc/src/main/kotlin/Helpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ val Project.currentFlavor get() = gradle.startParameter.taskRequests.toString().
fun Project.setupCommon() {
val javaVersion = JavaVersion.VERSION_11
android.apply {
compileSdkVersion(34)
compileSdkVersion(35)
defaultConfig {
minSdk = 23
targetSdk = 34
targetSdk = 35
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
Expand Down Expand Up @@ -63,7 +63,6 @@ fun Project.setupCore() {
warning += "RestrictedApi"
disable += "UseAppTint"
}
ndkVersion = "27.0.12077973"
buildFeatures.buildConfig = true
}
dependencies.add("coreLibraryDesugaring", "com.android.tools:desugar_jdk_libs:2.1.1")
Expand Down
3 changes: 3 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ android {
}

externalNativeBuild.ndkBuild.path("src/main/jni/Android.mk")
ndkVersion = "27.0.12077973"

sourceSets.getByName("androidTest") {
assets.setSrcDirs(assets.srcDirs + files("$projectDir/schemas"))
Expand Down Expand Up @@ -66,6 +67,8 @@ cargo {
throw GradleException("No any python version detected. You should install the python first to compile project.")
}
}
// https://developer.android.com/guide/practices/page-sizes#other-build-systems
spec.environment("RUST_ANDROID_GRADLE_CC_LINK_ARG", "-Wl,-z,max-page-size=16384,-soname,lib$libname.so")
spec.environment("RUST_ANDROID_GRADLE_LINKER_WRAPPER_PY", "$projectDir/$module/../linker-wrapper.py")
spec.environment("RUST_ANDROID_GRADLE_TARGET", "target/${toolchain.target}/$profile/lib$libname.so")
}
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/com/github/shadowsocks/Core.kt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ object Core {
// overhead of debug mode is minimal: https://github.com/Kotlin/kotlinx.coroutines/blob/f528898/docs/debugging.md#debug-mode
System.setProperty(DEBUG_PROPERTY_NAME, DEBUG_PROPERTY_VALUE_ON)
FirebaseApp.initializeApp(deviceStorage) // multiple processes needs manual set-up
FirebaseCrashlytics.getInstance().setCustomKey("build", Build.DISPLAY)
Timber.plant(object : Timber.DebugTree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
if (t == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ object PluginManager {
* public key yet since it will also automatically trust packages signed by the same signatures, e.g. debug keys.
*/
val trustedSignatures by lazy {
Core.packageInfo.signaturesCompat.toSet() +
(Core.packageInfo.signaturesCompat?.toSet() ?: emptySet()) +
Signature(Base64.decode( // @Mygod
"""
|MIIDWzCCAkOgAwIBAgIEUzfv8DANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ abstract class ResolvedPlugin(protected val resolveInfo: ResolveInfo) : Plugin()
override val defaultConfig by lazy { componentInfo.loadString(PluginContract.METADATA_KEY_DEFAULT_CONFIG) }
override val packageName: String get() = componentInfo.packageName
override val trusted by lazy {
Core.getPackageInfo(packageName).signaturesCompat.any(PluginManager.trustedSignatures::contains)
Core.getPackageInfo(packageName).signaturesCompat?.any(PluginManager.trustedSignatures::contains) == true
}
override val directBootAware get() = Build.VERSION.SDK_INT < 24 || componentInfo.directBootAware
}
2 changes: 1 addition & 1 deletion core/src/main/java/com/github/shadowsocks/utils/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fun Context.listenForPackageChanges(onetime: Boolean = true, callback: () -> Uni
}

val PackageInfo.signaturesCompat get() =
if (Build.VERSION.SDK_INT >= 28) signingInfo.apkContentsSigners else @Suppress("DEPRECATION") signatures
if (Build.VERSION.SDK_INT >= 28) signingInfo?.apkContentsSigners else @Suppress("DEPRECATION") signatures

/**
* Based on: https://stackoverflow.com/a/26348729/2245107
Expand Down
1 change: 1 addition & 0 deletions core/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
APP_STL := c++_static
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true
2 changes: 1 addition & 1 deletion mobile/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
android:exported="true"
android:label="@string/add_profile_methods_scan_qr_code"
android:parentActivityName=".MainActivity"
android:theme="@style/Theme.Shadowsocks.Immersive"
android:theme="@style/Theme.Shadowsocks.Immersive.Navigation"
android:launchMode="singleTask"
android:screenOrientation="locked"
android:excludeFromRecents="true"/>
Expand Down
4 changes: 2 additions & 2 deletions mobile/src/main/java/com/github/shadowsocks/AppManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class AppManager : AppCompatActivity() {
suspend fun reload() {
apps = getCachedApps(packageManager).map { (packageName, packageInfo) ->
coroutineContext[Job]!!.ensureActive()
ProxiedApp(packageManager, packageInfo.applicationInfo, packageName)
ProxiedApp(packageManager, packageInfo.applicationInfo!!, packageName)
}.sortedWith(compareBy({ !isProxiedApp(it) }, { it.name.toString() }))
}

Expand Down Expand Up @@ -207,7 +207,7 @@ class AppManager : AppCompatActivity() {
private fun initProxiedUids(str: String = DataStore.individual) {
proxiedUids.clear()
val apps = getCachedApps(packageManager)
for (line in str.lineSequence()) proxiedUids[(apps[line] ?: continue).applicationInfo.uid] = true
for (line in str.lineSequence()) proxiedUids[(apps[line] ?: continue).applicationInfo!!.uid] = true
}

private fun isProxiedApp(app: ProxiedApp) = proxiedUids[app.uid]
Expand Down
4 changes: 3 additions & 1 deletion plugin/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.Shadowsocks" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="android:navigationBarColor">@color/color_primary_dark</item>
<!-- https://github.com/google/play-services-plugins/issues/296 -->
<item name="android:windowOptOutEdgeToEdgeEnforcement" tools:targetApi="35">true</item>
<item name="actionBarStyle">@style/Widget.MaterialComponents.Light.ActionBar.Solid</item>
<item name="actionModeCloseDrawable">@drawable/ic_navigation_close</item>
<item name="colorAccent">@color/material_accent_200</item>
Expand Down

0 comments on commit 712148e

Please sign in to comment.