mirror of
https://github.com/YTVanced/VancedMicroG
synced 2024-12-04 00:37:27 +00:00
parent
85e06675f3
commit
f20d966f1b
2 changed files with 10 additions and 3 deletions
|
@ -20,6 +20,7 @@ apply plugin: 'kotlin-android-extensions'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':play-services-api')
|
implementation project(':play-services-api')
|
||||||
|
implementation project(':play-services-base-core')
|
||||||
implementation("com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.1") {
|
implementation("com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.1") {
|
||||||
exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-accounts'
|
exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-accounts'
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ import android.content.Context
|
||||||
import android.content.pm.ApplicationInfo
|
import android.content.pm.ApplicationInfo
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.mapbox.mapboxsdk.LibraryLoader
|
import com.mapbox.mapboxsdk.LibraryLoader
|
||||||
|
import org.microg.gms.common.Constants
|
||||||
|
import org.microg.gms.common.PackageUtils
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.util.zip.ZipFile
|
import java.util.zip.ZipFile
|
||||||
|
|
||||||
|
@ -36,9 +38,12 @@ class MultiArchLoader(private val mapContext: Context, private val appContext: C
|
||||||
if (primaryCpuAbi != null) {
|
if (primaryCpuAbi != null) {
|
||||||
val path = "lib/$primaryCpuAbi/lib$name.so"
|
val path = "lib/$primaryCpuAbi/lib$name.so"
|
||||||
val cacheFile = File("${appContext.cacheDir.absolutePath}/.gmscore/$path")
|
val cacheFile = File("${appContext.cacheDir.absolutePath}/.gmscore/$path")
|
||||||
cacheFile.parentFile.mkdirs()
|
cacheFile.parentFile?.mkdirs()
|
||||||
|
val cacheFileStamp = File("${appContext.cacheDir.absolutePath}/.gmscore/$path.stamp")
|
||||||
|
val cacheVersion = kotlin.runCatching { cacheFileStamp.readText().toInt() }.getOrNull()
|
||||||
|
val mapVersion = PackageUtils.versionCode(mapContext, Constants.GMS_PACKAGE_NAME)
|
||||||
val apkFile = File(mapContext.packageCodePath)
|
val apkFile = File(mapContext.packageCodePath)
|
||||||
if (!cacheFile.exists() || cacheFile.lastModified() < apkFile.lastModified()) {
|
if (!cacheFile.exists() || cacheVersion == null || cacheVersion != mapVersion) {
|
||||||
val zipFile = ZipFile(apkFile)
|
val zipFile = ZipFile(apkFile)
|
||||||
val entry = zipFile.getEntry(path)
|
val entry = zipFile.getEntry(path)
|
||||||
if (entry != null) {
|
if (entry != null) {
|
||||||
|
@ -46,6 +51,7 @@ class MultiArchLoader(private val mapContext: Context, private val appContext: C
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "Can't load native library: $path does not exist in $apkFile")
|
Log.d(TAG, "Can't load native library: $path does not exist in $apkFile")
|
||||||
}
|
}
|
||||||
|
cacheFileStamp.writeText(mapVersion.toString())
|
||||||
}
|
}
|
||||||
Log.d(TAG, "Loading $name from ${cacheFile.getPath()}")
|
Log.d(TAG, "Loading $name from ${cacheFile.getPath()}")
|
||||||
System.load(cacheFile.absolutePath)
|
System.load(cacheFile.absolutePath)
|
||||||
|
@ -75,4 +81,4 @@ class MultiArchLoader(private val mapContext: Context, private val appContext: C
|
||||||
private val TAG = "GmsMultiArchLoader"
|
private val TAG = "GmsMultiArchLoader"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue