Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit 18d07d8

Browse files
Rework a few things
Current known bug: disabling repo on setup hides it from SettingsActivity Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent 16731ac commit 18d07d8

24 files changed

+134
-111
lines changed

app/src/main/java/com/fox2code/mmm/AppUpdateManager.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ public boolean checkUpdate(boolean force) {
111111
this.latestPreRelease = "";
112112
this.preReleaseNewer = false;
113113
}
114-
if (BuildConfig.DEBUG) Log.d(TAG, "Latest release: " + latestRelease);
115-
if (BuildConfig.DEBUG) Log.d(TAG, "Latest pre-release: " + latestPreRelease);
116-
if (BuildConfig.DEBUG) Log.d(TAG, "Latest pre-release newer: " + preReleaseNewer);
114+
if (BuildConfig.DEBUG) Log.i(TAG, "Latest release: " + latestRelease);
115+
if (BuildConfig.DEBUG) Log.i(TAG, "Latest pre-release: " + latestPreRelease);
116+
if (BuildConfig.DEBUG) Log.i(TAG, "Latest pre-release newer: " + preReleaseNewer);
117117
this.lastChecked = System.currentTimeMillis();
118118
this.lastCheckSuccess = true;
119119
} catch (Exception ioe) {
@@ -125,27 +125,34 @@ public boolean checkUpdate(boolean force) {
125125
}
126126

127127
public void checkUpdateCompat() {
128+
if (BuildConfig.DEBUG) Log.i(TAG, "Checking compatibility flags");
128129
if (this.compatFile.exists()) {
129130
long lastUpdate = this.compatFile.lastModified();
130131
if (lastUpdate <= System.currentTimeMillis() && lastUpdate + 600_000L > System.currentTimeMillis()) {
131132
return; // Skip update
132133
}
133134
}
134135
try {
136+
if (BuildConfig.DEBUG) Log.i(TAG, "Downloading compatibility flags");
135137
JSONObject object = new JSONObject(new String(Http.doHttpGet(COMPAT_API_URL, false), StandardCharsets.UTF_8));
136138
if (object.isNull("body")) {
139+
if (BuildConfig.DEBUG) Log.i(TAG, "Compatibility flags not found");
137140
compatDataId.clear();
138141
Files.write(compatFile, new byte[0]);
139142
return;
140143
}
144+
if (BuildConfig.DEBUG) Log.i(TAG, "Parsing compatibility flags");
141145
byte[] rawData = object.getString("body").getBytes(StandardCharsets.UTF_8);
142146
this.parseCompatibilityFlags(new ByteArrayInputStream(rawData));
143147
Files.write(compatFile, rawData);
144148
if (!BuildConfig.ENABLE_AUTO_UPDATER) this.lastCheckSuccess = true;
149+
if (BuildConfig.DEBUG) Log.i(TAG, "Compatibility flags update finishing");
150+
return;
145151
} catch (Exception e) {
146152
if (!BuildConfig.ENABLE_AUTO_UPDATER) this.lastCheckSuccess = false;
147153
Log.e("AppUpdateManager", "Failed to update compat list", e);
148154
}
155+
if (BuildConfig.DEBUG) Log.i(TAG, "Compatibility flags updated");
149156
}
150157

151158
public boolean peekShouldUpdate() {

app/src/main/java/com/fox2code/mmm/MainActivity.java

Lines changed: 46 additions & 35 deletions
Large diffs are not rendered by default.

app/src/main/java/com/fox2code/mmm/MainApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,9 @@ public void onCreate() {
306306
fontRequestEmojiCompatConfig.setMetadataLoadStrategy(EmojiCompat.LOAD_STRATEGY_MANUAL);
307307
EmojiCompat emojiCompat = EmojiCompat.init(fontRequestEmojiCompatConfig);
308308
new Thread(() -> {
309-
Log.d("MainApplication", "Loading emoji compat...");
309+
Log.i("MainApplication", "Loading emoji compat...");
310310
emojiCompat.load();
311-
Log.d("MainApplication", "Emoji compat loaded!");
311+
Log.i("MainApplication", "Emoji compat loaded!");
312312
}, "Emoji compat init.").start();
313313
}
314314
SentryMain.initialize(this);

app/src/main/java/com/fox2code/mmm/NotificationType.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ interface NotificationTypeCst {
2626
}
2727

2828
public enum NotificationType implements NotificationTypeCst {
29+
DEBUG(R.string.debug_build, R.drawable.ic_baseline_bug_report_24) {
30+
@Override
31+
public boolean shouldRemove() {
32+
return BuildConfig.DEBUG;
33+
}
34+
},
2935
SHOWCASE_MODE(R.string.showcase_mode, R.drawable.ic_baseline_lock_24,
3036
R.attr.colorPrimary, R.attr.colorOnPrimary) {
3137
@Override

app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
254254
Log.e(TAG, consoleMessage.message());
255255
break;
256256
case DEBUG:
257-
Log.d(TAG, consoleMessage.message());
257+
Log.i(TAG, consoleMessage.message());
258258
break;
259259
}
260260
}
@@ -377,12 +377,12 @@ private boolean isDownloadUrl(String url) {
377377
private boolean megaIntercept(String pageUrl, String fileUrl) {
378378
if (pageUrl == null || fileUrl == null) return false;
379379
if (this.isFileUrl(fileUrl)) {
380-
Log.d(TAG, "megaIntercept(" + AndroidacyUtil.hideToken(pageUrl) + ", " + AndroidacyUtil.hideToken(fileUrl) + ")");
380+
Log.i(TAG, "megaIntercept(" + AndroidacyUtil.hideToken(pageUrl) + ", " + AndroidacyUtil.hideToken(fileUrl) + ")");
381381
} else return false;
382382
final AndroidacyWebAPI androidacyWebAPI = this.androidacyWebAPI;
383383
String moduleId = AndroidacyUtil.getModuleId(fileUrl);
384384
if (moduleId == null) {
385-
Log.d(TAG, "No module id?");
385+
Log.i(TAG, "No module id?");
386386
// Re-open the page
387387
this.webView.loadUrl(pageUrl + "&force_refresh=" + System.currentTimeMillis());
388388
}

app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyRepoData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ protected boolean prepare() throws NoSuchAlgorithmException {
251251
@Override
252252
protected List<RepoModule> populate(JSONObject jsonObject) throws JSONException, NoSuchAlgorithmException {
253253
if (BuildConfig.DEBUG) {
254-
Log.d(TAG, "AndroidacyRepoData populate start");
254+
Log.i(TAG, "AndroidacyRepoData populate start");
255255
}
256256
if (!jsonObject.getString("status").equals("success"))
257257
throw new JSONException("Response is not a success!");
@@ -330,7 +330,7 @@ protected List<RepoModule> populate(JSONObject jsonObject) throws JSONException,
330330
String config = jsonObject.optString("config", "");
331331
moduleInfo.config = config.isEmpty() ? null : config;
332332
PropUtils.applyFallbacks(moduleInfo); // Apply fallbacks
333-
// Log.d(TAG,
333+
// Log.i(TAG,
334334
// "Module " + moduleInfo.name + " " + moduleInfo.id + " " + moduleInfo
335335
// .version + " " + moduleInfo.versionCode);
336336
}

app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyWebAPI.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void forceQuitRaw(String error) {
6363

6464
void openNativeModuleDialogRaw(String moduleUrl, String moduleId, String installTitle,
6565
String checksum, boolean canInstall) {
66-
if (BuildConfig.DEBUG) Log.d(TAG, "ModuleDialog, downloadUrl: " + AndroidacyUtil.hideToken(moduleUrl) +
66+
if (BuildConfig.DEBUG) Log.i(TAG, "ModuleDialog, downloadUrl: " + AndroidacyUtil.hideToken(moduleUrl) +
6767
", moduleId: " + moduleId + ", installTitle: " + installTitle +
6868
", checksum: " + checksum + ", canInstall: " + canInstall);
6969
this.downloadMode = false;
@@ -145,7 +145,7 @@ void openNativeModuleDialogRaw(String moduleUrl, String moduleId, String install
145145

146146
void notifyCompatModeRaw(int value) {
147147
if (this.consumedAction) return;
148-
if (BuildConfig.DEBUG) Log.d(TAG, "Androidacy Compat mode: " + value);
148+
if (BuildConfig.DEBUG) Log.i(TAG, "Androidacy Compat mode: " + value);
149149
this.notifiedCompatMode = value;
150150
if (value < 0) {
151151
value = 0;
@@ -180,7 +180,7 @@ public void openUrl(String url) {
180180
if (this.consumedAction) return;
181181
this.consumedAction = true;
182182
this.downloadMode = false;
183-
if (BuildConfig.DEBUG) Log.d(TAG, "Received openUrl request: " + url);
183+
if (BuildConfig.DEBUG) Log.i(TAG, "Received openUrl request: " + url);
184184
if (Uri.parse(url).getScheme().equals("https")) {
185185
IntentHelper.openUrl(this.activity, url);
186186
}
@@ -194,7 +194,7 @@ public void openCustomTab(String url) {
194194
if (this.consumedAction) return;
195195
this.consumedAction = true;
196196
this.downloadMode = false;
197-
if (BuildConfig.DEBUG) Log.d(TAG, "Received openCustomTab request: " + url);
197+
if (BuildConfig.DEBUG) Log.i(TAG, "Received openCustomTab request: " + url);
198198
if (Uri.parse(url).getScheme().equals("https")) {
199199
IntentHelper.openCustomTab(this.activity, url);
200200
}
@@ -238,7 +238,7 @@ public void install(String moduleUrl, String installTitle, String checksum) {
238238
}
239239
this.consumedAction = true;
240240
this.downloadMode = false;
241-
if (BuildConfig.DEBUG) Log.d(TAG, "Received install request: " +
241+
if (BuildConfig.DEBUG) Log.i(TAG, "Received install request: " +
242242
moduleUrl + " " + installTitle + " " + checksum);
243243
if (!AndroidacyUtil.isAndroidacyLink(moduleUrl)) {
244244
this.forceQuitRaw("Non Androidacy module link used on Androidacy");

app/src/main/java/com/fox2code/mmm/installer/InstallerActivity.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ protected void onCreate(Bundle savedInstanceState) {
179179
if (this.canceled) return;
180180
androidacyBlame = urlMode && AndroidacyUtil.isAndroidacyFileUrl(target);
181181
if (checksum != null && !checksum.isEmpty()) {
182-
Log.d(TAG, "Checking for checksum: " + checksum);
182+
Log.i(TAG, "Checking for checksum: " + checksum);
183183
this.runOnUiThread(() -> this.installerTerminal.addLine("- Checking file integrity"));
184184
if (!Hashes.checkSumMatch(rawModule, checksum)) {
185185
this.setInstallStateFinished(false,
@@ -304,7 +304,7 @@ private void doInstall(File file, boolean noExtensions, boolean rootless) {
304304
}
305305
}
306306
} catch (Exception e) {
307-
Log.d(TAG, "Failed ot extract install script via java code", e);
307+
Log.i(TAG, "Failed ot extract install script via java code", e);
308308
}
309309
installerMonitor = new InstallerMonitor(installScript);
310310
installJob = Shell.cmd("export MMM_EXT_SUPPORT=1",
@@ -541,7 +541,7 @@ private InstallerController(LinearProgressIndicator progressIndicator,
541541
@Override
542542
public void onAddElement(String s) {
543543
if (!this.enabled) return;
544-
Log.d(TAG, "MSG: " + s);
544+
Log.i(TAG, "MSG: " + s);
545545
if ("#!useExt".equals(s.trim()) && !this.noExtension) {
546546
this.useExt = true;
547547
return;
@@ -694,7 +694,7 @@ public InstallerMonitor(File installScript) {
694694

695695
@Override
696696
public void onAddElement(String s) {
697-
Log.d(TAG, "Monitor: " + s);
697+
Log.i(TAG, "Monitor: " + s);
698698
this.lastCommand = s;
699699
}
700700

app/src/main/java/com/fox2code/mmm/installer/InstallerInitializer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ private static String tryGetMagiskPath(boolean forceCheck) {
138138
return null;
139139
}
140140
MAGISK_PATH = output.size() < 3 ? "" : output.get(2);
141-
Log.d(TAG, "Magisk runtime path: " + MAGISK_PATH);
141+
Log.i(TAG, "Magisk runtime path: " + MAGISK_PATH);
142142
MAGISK_VERSION_CODE = Integer.parseInt(output.get(1));
143-
Log.d(TAG, "Magisk version code: " + MAGISK_VERSION_CODE);
143+
Log.i(TAG, "Magisk version code: " + MAGISK_VERSION_CODE);
144144
if (MAGISK_VERSION_CODE >= Constants.MAGISK_VER_CODE_FLAT_MODULES &&
145145
MAGISK_VERSION_CODE < Constants.MAGISK_VER_CODE_PATH_SUPPORT &&
146146
(MAGISK_PATH.isEmpty() || !new File(MAGISK_PATH).exists())) {

app/src/main/java/com/fox2code/mmm/manager/ModuleManager.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ protected void scanInternal(@NonNull UpdateListener updateListener) {
7070
if (!FORCE_NEED_FALLBACK && needFallback) {
7171
Log.e(TAG, "Failed to detect modules folder, using fallback instead.");
7272
}
73-
if (BuildConfig.DEBUG) Log.d("NoodleDebug", "Scan");
73+
if (BuildConfig.DEBUG) Log.i("NoodleDebug", "Scan");
7474
if (modules != null) {
7575
for (String module : modules) {
7676
if (!new SuFile("/data/adb/modules/" + module).isDirectory())
7777
continue; // Ignore non directory files inside modules folder
78-
if (BuildConfig.DEBUG) Log.d("NoodleDebug", module);
78+
if (BuildConfig.DEBUG) Log.i("NoodleDebug", module);
7979
LocalModuleInfo moduleInfo = moduleInfos.get(module);
8080
if (moduleInfo == null) {
8181
moduleInfo = new LocalModuleInfo(module);
@@ -113,18 +113,18 @@ protected void scanInternal(@NonNull UpdateListener updateListener) {
113113
PropUtils.readProperties(moduleInfo,
114114
"/data/adb/modules/" + module + "/module.prop", true);
115115
} catch (Exception e) {
116-
if (BuildConfig.DEBUG) Log.d(TAG, "Failed to parse metadata!", e);
116+
if (BuildConfig.DEBUG) Log.i(TAG, "Failed to parse metadata!", e);
117117
moduleInfo.flags |= FLAG_MM_INVALID;
118118
}
119119
}
120120
}
121-
if (BuildConfig.DEBUG) Log.d("NoodleDebug", "Scan update");
121+
if (BuildConfig.DEBUG) Log.i("NoodleDebug", "Scan update");
122122
String[] modules_update = new SuFile("/data/adb/modules_update").list();
123123
if (modules_update != null) {
124124
for (String module : modules_update) {
125125
if (!new SuFile("/data/adb/modules_update/" + module).isDirectory())
126126
continue; // Ignore non directory files inside modules folder
127-
if (BuildConfig.DEBUG) Log.d("NoodleDebug", module);
127+
if (BuildConfig.DEBUG) Log.i("NoodleDebug", module);
128128
LocalModuleInfo moduleInfo = moduleInfos.get(module);
129129
if (moduleInfo == null) {
130130
moduleInfo = new LocalModuleInfo(module);
@@ -136,18 +136,18 @@ protected void scanInternal(@NonNull UpdateListener updateListener) {
136136
PropUtils.readProperties(moduleInfo,
137137
"/data/adb/modules_update/" + module + "/module.prop", true);
138138
} catch (Exception e) {
139-
if (BuildConfig.DEBUG) Log.d(TAG, "Failed to parse metadata!", e);
139+
if (BuildConfig.DEBUG) Log.i(TAG, "Failed to parse metadata!", e);
140140
moduleInfo.flags |= FLAG_MM_INVALID;
141141
}
142142
}
143143
}
144-
if (BuildConfig.DEBUG) Log.d("NoodleDebug", "Finalize scan");
144+
if (BuildConfig.DEBUG) Log.i("NoodleDebug", "Finalize scan");
145145
this.updatableModuleCount = 0;
146146
Iterator<LocalModuleInfo> moduleInfoIterator =
147147
this.moduleInfos.values().iterator();
148148
while (moduleInfoIterator.hasNext()) {
149149
LocalModuleInfo moduleInfo = moduleInfoIterator.next();
150-
if (BuildConfig.DEBUG) Log.d("NoodleDebug", moduleInfo.id);
150+
if (BuildConfig.DEBUG) Log.i("NoodleDebug", moduleInfo.id);
151151
if ((moduleInfo.flags & FLAG_MM_UNPROCESSED) != 0) {
152152
moduleInfoIterator.remove();
153153
continue; // Don't process fallbacks if unreferenced

0 commit comments

Comments
 (0)