Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
os
GmsCore
Commits
f20d966f
Verified
Commit
f20d966f
authored
Dec 21, 2020
by
Marvin W.
🐿
Browse files
Mapbox: Add version stamp file to cached native library
Fixes #1321
parent
85e06675
Changes
2
Hide whitespace changes
Inline
Side-by-side
play-services-maps-core-mapbox/build.gradle
View file @
f20d966f
...
...
@@ -20,6 +20,7 @@ apply plugin: 'kotlin-android-extensions'
dependencies
{
implementation
project
(
':play-services-api'
)
implementation
project
(
':play-services-base-core'
)
implementation
(
"com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.1"
)
{
exclude
group:
'com.mapbox.mapboxsdk'
,
module:
'mapbox-android-accounts'
}
...
...
play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt
View file @
f20d966f
...
...
@@ -21,6 +21,8 @@ import android.content.Context
import
android.content.pm.ApplicationInfo
import
android.util.Log
import
com.mapbox.mapboxsdk.LibraryLoader
import
org.microg.gms.common.Constants
import
org.microg.gms.common.PackageUtils
import
java.io.*
import
java.util.zip.ZipFile
...
...
@@ -36,9 +38,12 @@ class MultiArchLoader(private val mapContext: Context, private val appContext: C
if
(
primaryCpuAbi
!=
null
)
{
val
path
=
"lib/$primaryCpuAbi/lib$name.so"
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
)
if
(!
cacheFile
.
exists
()
||
cache
File
.
lastModified
()
<
apkFile
.
lastModified
()
)
{
if
(!
cacheFile
.
exists
()
||
cache
Version
==
null
||
cacheVersion
!=
mapVersion
)
{
val
zipFile
=
ZipFile
(
apkFile
)
val
entry
=
zipFile
.
getEntry
(
path
)
if
(
entry
!=
null
)
{
...
...
@@ -46,6 +51,7 @@ class MultiArchLoader(private val mapContext: Context, private val appContext: C
}
else
{
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()}"
)
System
.
load
(
cacheFile
.
absolutePath
)
...
...
@@ -75,4 +81,4 @@ class MultiArchLoader(private val mapContext: Context, private val appContext: C
private
val
TAG
=
"GmsMultiArchLoader"
}
}
\ No newline at end of file
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment