fix local modules not showing up

can't get items from a list if you never add them

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/89/head
androidacy-user 2 years ago
parent b51678a552
commit 89e2d8014b

@ -42,7 +42,7 @@ android {
minSdk = 24
targetSdk = 33
versionCode = 76
versionName = "2.1.2"
versionName = "2.2.0"
vectorDrawables {
useSupportLibrary = true
}
@ -556,7 +556,7 @@ android {
buildConfig = true
}
//noinspection GrDeprecatedAPIUsage
buildToolsVersion = "33.0.2"
buildToolsVersion = "34.0.0"
@Suppress("DEPRECATION") packagingOptions {
jniLibs {
useLegacyPackaging = true

@ -69,6 +69,7 @@ class ModuleManager private constructor() : SyncManager() {
).allowMainThreadQueries().build()
for (module in modules) {
if (!SuFile("/data/adb/modules/$module").isDirectory) continue // Ignore non directory files inside modules folder
Timber.d("Found module %s", module)
var moduleInfo = moduleInfos[module]
// next, merge the module info with a record from ModuleListCache room db if it exists
// initialize modulelistcache db
@ -132,6 +133,7 @@ class ModuleManager private constructor() : SyncManager() {
if (BuildConfig.DEBUG) Timber.d(e)
moduleInfo.flags = moduleInfo.flags or FLAG_MM_INVALID
}
moduleInfos[module] = moduleInfo
// append moduleID:moduleName to the list
modulesList.append(moduleInfo.id).append(":").append(moduleInfo.versionCode)
.append(",")
@ -205,10 +207,12 @@ class ModuleManager private constructor() : SyncManager() {
var modules: HashMap<String, LocalModuleInfo> = HashMap()
get() {
Timber.d("getModules")
afterScan()
return field
return moduleInfos
}
set(value) {
Timber.d("setModules")
field = value
moduleInfos = value
}
@ -221,6 +225,7 @@ class ModuleManager private constructor() : SyncManager() {
@Suppress("unused")
fun setEnabledState(moduleInfo: ModuleInfo, checked: Boolean): Boolean {
Timber.d("setEnabledState(%s, %s)", moduleInfo.id, checked)
if (moduleInfo.hasFlag(ModuleInfo.FLAG_MODULE_UPDATING) && !checked) return false
val disable = SuFile("/data/adb/modules/" + moduleInfo.id + "/disable")
if (checked) {

@ -77,7 +77,7 @@ class ModuleHolder : Comparable<ModuleHolder?> {
val mainModuleName: String?
get() {
val moduleInfo = mainModuleInfo
if (moduleInfo.name == null) throw Error("Error for " + type.name + " id " + moduleId)
if (moduleInfo.name == null) throw Error("Error for ${type.name} id $moduleId")
return moduleInfo.name
}
val mainModuleNameLowercase: String
@ -111,8 +111,7 @@ class ModuleHolder : Comparable<ModuleHolder?> {
Type.SEPARATOR
} else if (notificationType != null) {
Type.NOTIFICATION
} else if (moduleInfo == null) {
Timber.i("Module %s is null and probably is a remote module", moduleId)
} else if (moduleInfo == null && repoModule != null) {
Type.INSTALLABLE
} else if (moduleInfo!!.versionCode < moduleInfo!!.updateVersionCode || repoModule != null && moduleInfo!!.versionCode < repoModule!!.moduleInfo.versionCode) {
Timber.i("Module %s is updateable", moduleId)

@ -45,12 +45,15 @@ class ModuleViewListBuilder(private val activity: Activity) {
}
fun appendInstalledModules() {
Timber.i("appendInstalledModules() called")
synchronized(updateLock) {
for (moduleHolder in mappedModuleHolders.values) {
Timber.i("zeroing module %s", moduleHolder.moduleInfo?.id)
moduleHolder.moduleInfo = null
}
val moduleManager = instance
moduleManager?.runAfterScan {
Timber.i("A0: runAfterScan %s", moduleManager.modules.size)
Timber.i("A1: %s", moduleManager.modules.size)
for (moduleInfo in moduleManager.modules.values) {
// add the local module to the list in MainActivity

@ -18,7 +18,7 @@ buildscript {
set("sentryVersion", "6.18.1")
}
dependencies {
classpath("com.android.tools.build:gradle:8.0.2")
classpath("com.android.tools.build:gradle:8.1.0-rc01")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22")
classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:10.6.2")

@ -18,5 +18,5 @@ android.useAndroidX=true
org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn
org.gradle.jvmargs=-Xmx1536M -Dkotlin.daemon.jvm.options\="-Xmx1536M" -Dfile.encoding\=UTF-8 -XX\:+UseParallelGC -XX\:ReservedCodeCacheSize\=768m
org.gradle.jvmargs=-Xmx1536M -Dorg.gradle.android.cache-fix.ignoreVersionCheck=true -Dkotlin.daemon.jvm.options\="-Xmx1536M" -Dfile.encoding\=UTF-8 -XX\:+UseParallelGC -XX\:ReservedCodeCacheSize\=768m
org.gradle.parallel=true

Loading…
Cancel
Save