Skip to content

Commit 3f38a8d

Browse files
prepare work for 2.3.0
- initial work on UNTESTED ksu support - prepare for play release - don't try to get magisk path if no root - remove debug logging entirely on release builds - if we set an if condition to a constant falsey value, r8 is nice enough to remove it for us - more that i really don't care to document Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent 33383f2 commit 3f38a8d

38 files changed

Lines changed: 382 additions & 278 deletions

app/build.gradle.kts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ android {
3434
val timestamp = System.currentTimeMillis()
3535

3636
namespace = "com.fox2code.mmm"
37-
compileSdk = 33
37+
compileSdk = 34
3838
ndkVersion = "25.2.9519653"
3939
signingConfigs {
4040
create("release") {
@@ -52,9 +52,9 @@ android {
5252
defaultConfig {
5353
applicationId = "com.fox2code.mmm"
5454
minSdk = 24
55-
targetSdk = 33
56-
versionCode = 81
57-
versionName = "2.2.3"
55+
targetSdk = 34
56+
versionCode = 82
57+
versionName = "2.3.0"
5858
vectorDrawables {
5959
useSupportLibrary = true
6060
}
@@ -460,11 +460,11 @@ dependencies {
460460
// UI
461461
implementation("androidx.appcompat:appcompat:1.6.1")
462462
implementation("androidx.activity:activity-ktx:1.7.2")
463-
implementation("androidx.emoji2:emoji2:1.3.0")
464-
implementation("androidx.emoji2:emoji2-views-helper:1.3.0")
465-
implementation("androidx.preference:preference-ktx:1.2.0")
463+
implementation("androidx.emoji2:emoji2:1.4.0")
464+
implementation("androidx.emoji2:emoji2-views-helper:1.4.0")
465+
implementation("androidx.preference:preference-ktx:1.2.1")
466466
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
467-
implementation("androidx.recyclerview:recyclerview:1.3.0")
467+
implementation("androidx.recyclerview:recyclerview:1.3.1")
468468
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
469469
implementation("androidx.webkit:webkit:1.7.0")
470470
implementation("com.google.android.material:material:1.9.0")
@@ -498,12 +498,12 @@ dependencies {
498498
implementation("com.github.Fox2Code:AndroidANSI:1.2.1")
499499

500500
// sentry
501-
implementation("io.sentry:sentry-android:6.25.2")
502-
implementation("io.sentry:sentry-android-timber:6.25.2")
503-
implementation("io.sentry:sentry-android-fragment:6.25.2")
504-
implementation("io.sentry:sentry-android-okhttp:6.25.2")
505-
implementation("io.sentry:sentry-kotlin-extensions:6.25.2")
506-
implementation("io.sentry:sentry-android-ndk:6.25.2")
501+
implementation("io.sentry:sentry-android:6.28.0")
502+
implementation("io.sentry:sentry-android-timber:6.28.0")
503+
implementation("io.sentry:sentry-android-fragment:6.28.0")
504+
implementation("io.sentry:sentry-android-okhttp:6.28.0")
505+
implementation("io.sentry:sentry-kotlin-extensions:6.28.0")
506+
implementation("io.sentry:sentry-android-ndk:6.28.0")
507507

508508
// Markdown
509509
// TODO: switch to an updated implementation
@@ -543,7 +543,7 @@ dependencies {
543543
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3")
544544

545545
// yes
546-
implementation("com.github.fingerprintjs:fingerprint-android:2.0.0")
546+
implementation("com.github.fingerprintjs:fingerprint-android:2.0.2")
547547

548548
// room
549549
implementation("androidx.room:room-runtime:2.5.2")

app/src/main/kotlin/com/fox2code/mmm/AppUpdateManager.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class AppUpdateManager private constructor() {
4444
lastChecked < System.currentTimeMillis() - 60000L
4545
) return force && peekShouldUpdate()
4646
synchronized(updateLock) {
47-
Timber.d("Checking for app updates")
47+
if (BuildConfig.DEBUG) Timber.d("Checking for app updates")
4848
if (lastChecked != this.lastChecked) return peekShouldUpdate()
4949
// make a request to https://production-api.androidacy.com/amm/updates/check with appVersionCode and token/device_id/client_id
5050
var token = AndroidacyRepoData.token
@@ -59,7 +59,7 @@ class AppUpdateManager private constructor() {
5959
val response = doHttpGet(url, false)
6060
// convert response to string
6161
val responseString = String(response, Charsets.UTF_8)
62-
Timber.d("Response: $responseString")
62+
if (BuildConfig.DEBUG) Timber.d("Response: $responseString")
6363
// json response has a boolean shouldUpdate and an int latestVersion
6464
JSONObject(responseString).let {
6565
if (it.getBoolean("shouldUpdate")) {
@@ -105,7 +105,7 @@ class AppUpdateManager private constructor() {
105105
@Throws(IOException::class)
106106
private fun parseCompatibilityFlags(inputStream: InputStream) {
107107
compatDataId.clear()
108-
Timber.d("Not implemented")
108+
if (BuildConfig.DEBUG) Timber.d("Not implemented")
109109
}
110110

111111
fun getCompatibilityFlags(moduleId: String): Int {

app/src/main/kotlin/com/fox2code/mmm/CrashHandler.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CrashHandler : FoxActivity() {
2828
override fun onCreate(savedInstanceState: Bundle?) {
2929
Timber.i("CrashHandler.onCreate(%s)", savedInstanceState)
3030
// log intent with extras
31-
Timber.d("CrashHandler.onCreate: intent=%s", intent)
31+
if (BuildConfig.DEBUG) Timber.d("CrashHandler.onCreate: intent=%s", intent)
3232
super.onCreate(savedInstanceState)
3333
setContentView(R.layout.activity_crash_handler)
3434
// set crash_details MaterialTextView to the exception passed in the intent or unknown if null
@@ -58,7 +58,7 @@ class CrashHandler : FoxActivity() {
5858
if (lastEventId?.matches("^0+$".toRegex()) == true) {
5959
lastEventId = ""
6060
}
61-
Timber.d(
61+
if (BuildConfig.DEBUG) Timber.d(
6262
"CrashHandler.onCreate: lastEventId=%s, crashReportingEnabled=%s",
6363
lastEventId,
6464
crashReportingEnabled
@@ -71,7 +71,7 @@ class CrashHandler : FoxActivity() {
7171
val submit = findViewById<View>(R.id.feedback_submit)
7272
if (lastEventId.isNullOrEmpty() && crashReportingEnabled) {
7373
// if lastEventId is null, hide the feedback button
74-
Timber.d("CrashHandler.onCreate: lastEventId is null but crash reporting is enabled. This may indicate a bug in the crash reporting system.")
74+
if (BuildConfig.DEBUG) Timber.d("CrashHandler.onCreate: lastEventId is null but crash reporting is enabled. This may indicate a bug in the crash reporting system.")
7575
submit.visibility = View.GONE
7676
findViewById<MaterialTextView>(R.id.feedback_text).setText(R.string.no_sentry_id)
7777
} else {

app/src/main/kotlin/com/fox2code/mmm/MainActivity.kt

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class MainActivity : FoxActivity(), OnRefreshListener, SearchView.OnQueryTextLis
139139
if (ts.time > buildTime.time) {
140140
val pm = packageManager
141141
val intent = Intent(this, ExpiredActivity::class.java)
142-
@Suppress("DEPRECATION") val resolveInfo = pm.queryIntentActivities(intent, 0)
142+
val resolveInfo = pm.queryIntentActivities(intent, 0)
143143
if (resolveInfo.size > 0) {
144144
startActivity(intent)
145145
finish()
@@ -231,11 +231,8 @@ class MainActivity : FoxActivity(), OnRefreshListener, SearchView.OnQueryTextLis
231231
.create()
232232
rebootDialog.show()
233233
}
234+
// get background color and elevation of reboot fab
234235
val searchCard = searchCard!!
235-
// copy reboot fab style to search card
236-
searchCard.elevation = rebootFab.elevation
237-
searchCard.translationY = rebootFab.translationY
238-
searchCard.foreground = rebootFab.foreground
239236
moduleList.addOnScrollListener(object : RecyclerView.OnScrollListener() {
240237
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
241238
if (newState != RecyclerView.SCROLL_STATE_IDLE) searchView.clearFocus()
@@ -307,8 +304,6 @@ class MainActivity : FoxActivity(), OnRefreshListener, SearchView.OnQueryTextLis
307304
TrackHelper.track().event("view_list", "settings")
308305
.with(MainApplication.INSTANCE!!.tracker)
309306
startActivity(Intent(this@MainActivity, SettingsActivity::class.java))
310-
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
311-
finish()
312307
}
313308

314309
R.id.online_menu_item -> {
@@ -388,9 +383,17 @@ class MainActivity : FoxActivity(), OnRefreshListener, SearchView.OnQueryTextLis
388383
tryGetMagiskPathAsync(object : InstallerInitializer.Callback {
389384
override fun onPathReceived(path: String?) {
390385
Timber.i("Got magisk path: %s", path)
391-
if (peekMagiskVersion() < Constants.MAGISK_VER_CODE_INSTALL_COMMAND) moduleViewListBuilder.addNotification(
392-
NotificationType.MAGISK_OUTDATED
393-
)
386+
if (peekMagiskVersion() < Constants.MAGISK_VER_CODE_INSTALL_COMMAND) {
387+
if (!InstallerInitializer.isKsu) {
388+
moduleViewListBuilder.addNotification(
389+
NotificationType.MAGISK_OUTDATED
390+
)
391+
} else {
392+
moduleViewListBuilder.addNotification(
393+
NotificationType.KSU_EXPERIMENTAL
394+
)
395+
}
396+
}
394397
if (!MainApplication.isShowcaseMode) moduleViewListBuilder.addNotification(
395398
NotificationType.INSTALL_FROM_STORAGE
396399
)
@@ -409,7 +412,7 @@ class MainActivity : FoxActivity(), OnRefreshListener, SearchView.OnQueryTextLis
409412

410413
fun commonNext() {
411414
if (BuildConfig.DEBUG) {
412-
Timber.d("Common next")
415+
if (BuildConfig.DEBUG) Timber.d("Common next")
413416
moduleViewListBuilder.addNotification(NotificationType.DEBUG)
414417
}
415418
NotificationType.NO_INTERNET.autoAdd(moduleViewListBuilderOnline)
@@ -426,7 +429,7 @@ class MainActivity : FoxActivity(), OnRefreshListener, SearchView.OnQueryTextLis
426429
updateScreenInsets() // Fix an edge case
427430
val context: Context = this@MainActivity
428431
if (runtimeUtils!!.waitInitialSetupFinished(context, this@MainActivity)) {
429-
Timber.d("waiting...")
432+
if (BuildConfig.DEBUG) Timber.d("waiting...")
430433
return
431434
}
432435
swipeRefreshBlocker = System.currentTimeMillis() + 5000L
@@ -869,7 +872,7 @@ class MainActivity : FoxActivity(), OnRefreshListener, SearchView.OnQueryTextLis
869872
// wait for up to 10 seconds for AndroidacyRepoData to be initialized
870873
var i: Int
871874
if (AndroidacyRepoData.instance.isEnabled && AndroidacyRepoData.instance.memberLevel == null) {
872-
Timber.d("Member level is null, waiting for it to be initialized")
875+
if (BuildConfig.DEBUG) Timber.d("Member level is null, waiting for it to be initialized")
873876
i = 0
874877
while (AndroidacyRepoData.instance.memberLevel == null && i < 20) {
875878
i++

app/src/main/kotlin/com/fox2code/mmm/MainApplication.kt

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -264,24 +264,24 @@ class MainApplication : FoxApplication(), Configuration.Provider {
264264
fileUtils.ensureCacheDirs()
265265
fileUtils.ensureURLHandler(this)
266266
}
267-
Timber.d("Initializing AMM")
268-
Timber.d("Started from background: %s", !isInForeground)
269-
Timber.d("AMM is running in debug mode")
267+
if (BuildConfig.DEBUG) Timber.d("Initializing AMM")
268+
if (BuildConfig.DEBUG) Timber.d("Started from background: %s", !isInForeground)
269+
if (BuildConfig.DEBUG) Timber.d("AMM is running in debug mode")
270270
// analytics
271-
Timber.d("Initializing matomo")
271+
if (BuildConfig.DEBUG) Timber.d("Initializing matomo")
272272
getTracker()
273273
if (!isMatomoAllowed()) {
274-
Timber.d("Matomo is not allowed")
274+
if (BuildConfig.DEBUG) Timber.d("Matomo is not allowed")
275275
tracker!!.isOptOut = true
276276
} else {
277277
tracker!!.isOptOut = false
278278
}
279279
if (getSharedPreferences("matomo")!!.getBoolean("install_tracked", false)) {
280280
TrackHelper.track().download().with(INSTANCE!!.getTracker())
281-
Timber.d("Sent install event to matomo")
281+
if (BuildConfig.DEBUG) Timber.d("Sent install event to matomo")
282282
getSharedPreferences("matomo")!!.edit().putBoolean("install_tracked", true).apply()
283283
} else {
284-
Timber.d("Matomo already has install")
284+
if (BuildConfig.DEBUG) Timber.d("Matomo already has install")
285285
}
286286
try {
287287
@Suppress("DEPRECATION") @SuppressLint("PackageManagerGetSignatures") val s =
@@ -413,12 +413,12 @@ class MainApplication : FoxApplication(), Configuration.Provider {
413413
val activityManager = this.getSystemService(ACTIVITY_SERVICE) as ActivityManager
414414
val appProcesses = activityManager.runningAppProcesses
415415
if (appProcesses == null) {
416-
Timber.d("appProcesses is null")
416+
if (BuildConfig.DEBUG) Timber.d("appProcesses is null")
417417
return false
418418
}
419419
val packageName = this.packageName
420420
for (appProcess in appProcesses) {
421-
Timber.d(
421+
if (BuildConfig.DEBUG) Timber.d(
422422
"Process: %s, Importance: %d", appProcess.processName, appProcess.importance
423423
)
424424
if (appProcess.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND && appProcess.processName == packageName) {
@@ -503,6 +503,14 @@ class MainApplication : FoxApplication(), Configuration.Provider {
503503
init {
504504
Shell.setDefaultBuilder(Shell.Builder.create()
505505
.setFlags(Shell.FLAG_REDIRECT_STDERR or Shell.FLAG_MOUNT_MASTER).setTimeout(15))
506+
// set verbose logging for debug builds
507+
if (BuildConfig.DEBUG) {
508+
Shell.enableVerboseLogging = true
509+
}
510+
// prewarm shell
511+
Shell.getShell {
512+
// do nothing
513+
}
506514
val random = Random()
507515
do {
508516
secret = random.nextLong()

0 commit comments

Comments
 (0)