Skip to content

Commit 89e2d80

Browse files
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>
1 parent b51678a commit 89e2d80

6 files changed

Lines changed: 15 additions & 8 deletions

File tree

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ android {
4242
minSdk = 24
4343
targetSdk = 33
4444
versionCode = 76
45-
versionName = "2.1.2"
45+
versionName = "2.2.0"
4646
vectorDrawables {
4747
useSupportLibrary = true
4848
}
@@ -556,7 +556,7 @@ android {
556556
buildConfig = true
557557
}
558558
//noinspection GrDeprecatedAPIUsage
559-
buildToolsVersion = "33.0.2"
559+
buildToolsVersion = "34.0.0"
560560
@Suppress("DEPRECATION") packagingOptions {
561561
jniLibs {
562562
useLegacyPackaging = true

app/src/main/kotlin/com/fox2code/mmm/manager/ModuleManager.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class ModuleManager private constructor() : SyncManager() {
6969
).allowMainThreadQueries().build()
7070
for (module in modules) {
7171
if (!SuFile("/data/adb/modules/$module").isDirectory) continue // Ignore non directory files inside modules folder
72+
Timber.d("Found module %s", module)
7273
var moduleInfo = moduleInfos[module]
7374
// next, merge the module info with a record from ModuleListCache room db if it exists
7475
// initialize modulelistcache db
@@ -132,6 +133,7 @@ class ModuleManager private constructor() : SyncManager() {
132133
if (BuildConfig.DEBUG) Timber.d(e)
133134
moduleInfo.flags = moduleInfo.flags or FLAG_MM_INVALID
134135
}
136+
moduleInfos[module] = moduleInfo
135137
// append moduleID:moduleName to the list
136138
modulesList.append(moduleInfo.id).append(":").append(moduleInfo.versionCode)
137139
.append(",")
@@ -205,10 +207,12 @@ class ModuleManager private constructor() : SyncManager() {
205207

206208
var modules: HashMap<String, LocalModuleInfo> = HashMap()
207209
get() {
210+
Timber.d("getModules")
208211
afterScan()
209-
return field
212+
return moduleInfos
210213
}
211214
set(value) {
215+
Timber.d("setModules")
212216
field = value
213217
moduleInfos = value
214218
}
@@ -221,6 +225,7 @@ class ModuleManager private constructor() : SyncManager() {
221225

222226
@Suppress("unused")
223227
fun setEnabledState(moduleInfo: ModuleInfo, checked: Boolean): Boolean {
228+
Timber.d("setEnabledState(%s, %s)", moduleInfo.id, checked)
224229
if (moduleInfo.hasFlag(ModuleInfo.FLAG_MODULE_UPDATING) && !checked) return false
225230
val disable = SuFile("/data/adb/modules/" + moduleInfo.id + "/disable")
226231
if (checked) {

app/src/main/kotlin/com/fox2code/mmm/module/ModuleHolder.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class ModuleHolder : Comparable<ModuleHolder?> {
7777
val mainModuleName: String?
7878
get() {
7979
val moduleInfo = mainModuleInfo
80-
if (moduleInfo.name == null) throw Error("Error for " + type.name + " id " + moduleId)
80+
if (moduleInfo.name == null) throw Error("Error for ${type.name} id $moduleId")
8181
return moduleInfo.name
8282
}
8383
val mainModuleNameLowercase: String
@@ -111,8 +111,7 @@ class ModuleHolder : Comparable<ModuleHolder?> {
111111
Type.SEPARATOR
112112
} else if (notificationType != null) {
113113
Type.NOTIFICATION
114-
} else if (moduleInfo == null) {
115-
Timber.i("Module %s is null and probably is a remote module", moduleId)
114+
} else if (moduleInfo == null && repoModule != null) {
116115
Type.INSTALLABLE
117116
} else if (moduleInfo!!.versionCode < moduleInfo!!.updateVersionCode || repoModule != null && moduleInfo!!.versionCode < repoModule!!.moduleInfo.versionCode) {
118117
Timber.i("Module %s is updateable", moduleId)

app/src/main/kotlin/com/fox2code/mmm/module/ModuleViewListBuilder.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,15 @@ class ModuleViewListBuilder(private val activity: Activity) {
4545
}
4646

4747
fun appendInstalledModules() {
48+
Timber.i("appendInstalledModules() called")
4849
synchronized(updateLock) {
4950
for (moduleHolder in mappedModuleHolders.values) {
51+
Timber.i("zeroing module %s", moduleHolder.moduleInfo?.id)
5052
moduleHolder.moduleInfo = null
5153
}
5254
val moduleManager = instance
5355
moduleManager?.runAfterScan {
56+
Timber.i("A0: runAfterScan %s", moduleManager.modules.size)
5457
Timber.i("A1: %s", moduleManager.modules.size)
5558
for (moduleInfo in moduleManager.modules.values) {
5659
// add the local module to the list in MainActivity

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ buildscript {
1818
set("sentryVersion", "6.18.1")
1919
}
2020
dependencies {
21-
classpath("com.android.tools.build:gradle:8.0.2")
21+
classpath("com.android.tools.build:gradle:8.1.0-rc01")
2222
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22")
2323
classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:10.6.2")
2424

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ android.useAndroidX=true
1818
org.gradle.caching=true
1919
org.gradle.configuration-cache=true
2020
org.gradle.configuration-cache.problems=warn
21-
org.gradle.jvmargs=-Xmx1536M -Dkotlin.daemon.jvm.options\="-Xmx1536M" -Dfile.encoding\=UTF-8 -XX\:+UseParallelGC -XX\:ReservedCodeCacheSize\=768m
21+
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
2222
org.gradle.parallel=true

0 commit comments

Comments
 (0)