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

Commit 05931a3

Browse files
authored
Merge pull request #192 from Androidacy/master
Reworks Androidacy support
2 parents 248865d + e1ce5f6 commit 05931a3

File tree

37 files changed

+496
-276
lines changed

37 files changed

+496
-276
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
## Fox Module contest
44

5-
[NoStorageRestrict](https://github.com/Magisk-Modules-Alt-Repo/NoStorageRestrict)
6-
by [@DanGLES3](https://github.com/DanGLES3) won via vote in community telegram server.
5+
[NoStorageRestrict](https://github.com/Magisk-Modules-Alt-Repo/NoStorageRestrict) by [@DanGLES3](https://github.com/DanGLES3) won via vote in community telegram server.
76

87
Module description: Removes the restriction when selecting folders (Downloads/Android) through the file manager on Android 11 and higher
98

@@ -19,12 +18,11 @@ Main activity:
1918

2019
## What is this?
2120

22-
The official Magisk is dropping support to download online modules...
23-
So I made my own app to do that! :3
21+
The official Magisk has dropped support to download online modules, so I made Fox's Magisk Module Manager to help you download and install Magisk modules.
2422

2523
**This app is not officially supported by Magisk or its developers**
2624

27-
**The modules shown in this app are not affiliated with this app**
25+
**The modules shown in this app are not affiliated with this app or Magisk**
2826
(Please contact repo owners instead)
2927

3028
## Requirements

app/build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ android {
3434
"default" {
3535
dimension "type"
3636
buildConfigField "boolean", "ENABLE_AUTO_UPDATER", "true"
37+
buildConfigField "boolean", "DEFAULT_ENABLE_CRASH_REPORTING", "true"
3738
buildConfigField(
3839
"java.util.List<String>",
3940
"ENABLED_REPOS",
@@ -50,6 +51,9 @@ android {
5051
// with our keys, so the APK wouldn't install anyways).
5152
buildConfigField "boolean", "ENABLE_AUTO_UPDATER", "false"
5253

54+
// Disable crash reporting for F-Droid flavor by default
55+
buildConfigField "boolean", "DEFAULT_ENABLE_CRASH_REPORTING", "false"
56+
5357
// Repo with ads or tracking feature are disabled by default for the
5458
// F-Droid flavor.
5559
buildConfigField(
@@ -79,6 +83,8 @@ configurations {
7983
}
8084

8185
dependencies {
86+
// Error reporting
87+
implementation 'io.sentry:sentry-android:6.4.0'
8288
// UI
8389
implementation 'androidx.appcompat:appcompat:1.5.0'
8490
implementation 'androidx.emoji2:emoji2:1.2.0'
@@ -87,7 +93,7 @@ dependencies {
8793
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
8894
implementation 'androidx.recyclerview:recyclerview:1.2.1'
8995
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
90-
implementation 'androidx.webkit:webkit:1.4.0'
96+
implementation 'androidx.webkit:webkit:1.5.0'
9197
implementation 'com.google.android.material:material:1.6.1'
9298
implementation "com.mikepenz:aboutlibraries:${latestAboutLibsRelease}"
9399
implementation "dev.rikka.rikkax.layoutinflater:layoutinflater:1.2.0"

app/src/main/AndroidManifest.xml

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
tools:ignore="QueryAllPackagesPermission">
66

77
<!-- Wifi is not the only way to get an internet connection -->
8-
<uses-feature android:name="android.hardware.wifi" android:required="false" />
8+
<uses-feature
9+
android:name="android.hardware.wifi"
10+
android:required="false" />
911

1012
<!-- Retrieve online modules -->
1113
<uses-permission android:name="android.permission.INTERNET" />
@@ -16,89 +18,107 @@
1618
<!-- Open config apps for applications -->
1719
<uses-permission-sdk-23 android:name="android.permission.QUERY_ALL_PACKAGES" />
1820
<!-- Supposed to fix bugs with old firmware, only requested on pre Marshmallow -->
19-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
21+
<uses-permission
22+
android:name="android.permission.READ_EXTERNAL_STORAGE"
2023
android:maxSdkVersion="22" />
2124
<!-- Post background notifications -->
2225
<uses-permission-sdk-23 android:name="android.permission.POST_NOTIFICATIONS" />
2326

2427
<application
2528
android:name=".MainApplication"
2629
android:allowBackup="true"
30+
android:dataExtractionRules="@xml/data_extraction_rules"
31+
android:fullBackupContent="@xml/full_backup_content"
2732
android:icon="@mipmap/ic_launcher"
28-
android:roundIcon="@mipmap/ic_launcher"
2933
android:label="@string/app_name"
34+
android:networkSecurityConfig="@xml/network_security_config"
35+
android:roundIcon="@mipmap/ic_launcher"
3036
android:supportsRtl="@bool/lang_support_rtl"
3137
android:testOnly="false"
3238
android:theme="@style/Theme.MagiskModuleManager"
33-
android:fullBackupContent="@xml/full_backup_content"
34-
android:dataExtractionRules="@xml/data_extraction_rules"
35-
android:networkSecurityConfig="@xml/network_security_config"
3639
android:usesCleartextTraffic="false"
37-
tools:targetApi="s"
40+
tools:ignore="ManifestResource"
3841
tools:replace="android:supportsRtl"
39-
tools:ignore="ManifestResource">
40-
<receiver android:name="com.fox2code.mmm.background.BackgroundBootListener"
42+
tools:targetApi="s">
43+
<receiver
44+
android:name="com.fox2code.mmm.background.BackgroundBootListener"
4145
android:exported="true">
4246
<intent-filter>
4347
<action android:name="android.intent.action.BOOT_COMPLETED" />
4448
</intent-filter>
4549
</receiver>
50+
4651
<activity
4752
android:name=".settings.SettingsActivity"
48-
android:parentActivityName=".MainActivity"
4953
android:exported="true"
50-
android:label="@string/title_activity_settings">
54+
android:label="@string/title_activity_settings"
55+
android:parentActivityName=".MainActivity">
5156
<intent-filter>
5257
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
5358
</intent-filter>
5459
</activity>
5560
<activity
5661
android:name=".MainActivity"
5762
android:exported="true"
58-
android:launchMode="singleTask"
59-
android:label="@string/app_name_short">
63+
android:label="@string/app_name_short"
64+
android:launchMode="singleTask">
6065
<intent-filter>
6166
<action android:name="android.intent.action.MAIN" />
6267
<category android:name="android.intent.category.LAUNCHER" />
6368
</intent-filter>
6469
</activity>
6570
<activity
6671
android:name=".installer.InstallerActivity"
67-
android:parentActivityName=".MainActivity"
6872
android:exported="false"
69-
android:screenOrientation="portrait"
7073
android:launchMode="singleTop"
74+
android:parentActivityName=".MainActivity"
75+
android:screenOrientation="portrait"
7176
tools:ignore="LockedOrientationActivity">
7277
<intent-filter>
7378
<action android:name="${applicationId}.intent.action.INSTALL_MODULE_INTERNAL" />
7479
</intent-filter>
7580
</activity>
7681
<activity
7782
android:name=".markdown.MarkdownActivity"
78-
android:parentActivityName=".MainActivity"
7983
android:exported="false"
80-
android:theme="@style/Theme.MagiskModuleManager">
81-
</activity>
84+
android:parentActivityName=".MainActivity"
85+
android:theme="@style/Theme.MagiskModuleManager"></activity>
8286
<activity
8387
android:name=".androidacy.AndroidacyActivity"
84-
android:parentActivityName=".MainActivity"
8588
android:exported="false"
89+
android:parentActivityName=".MainActivity"
8690
android:theme="@style/Theme.MagiskModuleManager">
8791
<intent-filter>
8892
<action android:name="${applicationId}.intent.action.OPEN_ANDROIDACY_INTERNAL" />
8993
</intent-filter>
9094
</activity>
91-
<activity android:name="com.mikepenz.aboutlibraries.ui.LibsActivity"
92-
tools:node="remove"/>
95+
<activity
96+
android:name="com.mikepenz.aboutlibraries.ui.LibsActivity"
97+
tools:node="remove" />
98+
9399
<provider
94100
android:name="androidx.startup.InitializationProvider"
95101
android:authorities="${applicationId}.androidx-startup"
96102
android:exported="false"
97103
tools:node="merge">
98-
<meta-data android:name="androidx.emoji2.text.EmojiCompatInitializer"
104+
<meta-data
105+
android:name="androidx.emoji2.text.EmojiCompatInitializer"
99106
tools:node="remove" />
100-
<meta-data android:name="androidx.work.WorkManagerInitializer"
107+
<meta-data
108+
android:name="androidx.work.WorkManagerInitializer"
101109
tools:node="remove" />
102110
</provider>
111+
<meta-data
112+
android:name="io.sentry.dsn"
113+
android:value="https://ba5cb5ef513b423cbd54a2a8457113b1@sentry.androidacy.com/7" />
114+
<!-- Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
115+
We recommend adjusting this value in production. -->
116+
<meta-data
117+
android:name="io.sentry.traces.sample-rate"
118+
android:value="1.0" />
119+
<!-- Enable user interaction tracing to capture transactions for various UI events (such as clicks or scrolls). -->
120+
<meta-data
121+
android:name="io.sentry.traces.user-interaction.enable"
122+
android:value="true" />
103123
</application>
104124
</manifest>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
import eightbitlab.com.blurview.BlurView;
3939
import eightbitlab.com.blurview.RenderScriptBlur;
40+
import io.sentry.android.core.SentryAndroid;
4041

4142
public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRefreshListener,
4243
SearchView.OnQueryTextListener, SearchView.OnCloseListener,

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

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import com.fox2code.rosettax.LanguageSwitcher;
2828
import com.topjohnwu.superuser.Shell;
2929

30+
import java.io.IOException;
31+
import java.io.Writer;
3032
import java.text.SimpleDateFormat;
3133
import java.util.Date;
3234
import java.util.Locale;
@@ -42,13 +44,17 @@
4244
import io.noties.markwon.syntax.SyntaxHighlightPlugin;
4345
import io.noties.prism4j.Prism4j;
4446
import io.noties.prism4j.annotations.PrismBundle;
47+
import io.sentry.JsonObjectWriter;
48+
import io.sentry.NoOpLogger;
49+
import io.sentry.android.core.SentryAndroid;
4550

4651
@PrismBundle(
4752
includeAll = true,
4853
grammarLocatorClassName = ".Prism4jGrammarLocator"
4954
)
5055
public class MainApplication extends FoxApplication
5156
implements androidx.work.Configuration.Provider {
57+
private static final String TAG = "MainApplication";
5258
private static final String timeFormatString = "dd MMM yyyy"; // Example: 13 july 2001
5359
private static Locale timeFormatLocale =
5460
Resources.getSystem().getConfiguration().locale;
@@ -168,6 +174,11 @@ public static void setHasGottenRootAccess(boolean bool) {
168174
getSharedPreferences().edit().putBoolean("has_root_access", bool).apply();
169175
}
170176

177+
public static boolean isCrashReportingEnabled() {
178+
return getSharedPreferences().getBoolean(
179+
"crash_reporting", BuildConfig.DEFAULT_ENABLE_CRASH_REPORTING);
180+
}
181+
171182
public static SharedPreferences getBootSharedPreferences() {
172183
return bootSharedPreferences;
173184
}
@@ -341,6 +352,57 @@ public void onCreate() {
341352
Log.d("MainApplication", "Emoji compat loaded!");
342353
}, "Emoji compat init.").start();
343354
}
355+
SentryAndroid.init(this, options -> {
356+
// Note: Sentry library only take a screenshot of Fox Magisk Module Manager.
357+
// The screen shot doesn't and cannot contain other applications (if in multi windows)
358+
// status bar and notifications (even if notification shade is pulled down)
359+
360+
// In the possibility you find this library sending anything listed above,
361+
// it's a serious bug and a security issue you should report to Google
362+
// Google bug bounties on Android are huge, so you can also get rich by doing that.
363+
options.setAttachScreenshot(true);
364+
// Add a callback that will be used before the event is sent to Sentry.
365+
// With this callback, you can modify the event or, when returning null, also discard the event.
366+
options.setBeforeSend((event, hint) -> {
367+
if (BuildConfig.DEBUG) { // Debug sentry events for debug.
368+
StringBuilder stringBuilder = new StringBuilder("Sentry report debug: ");
369+
try {
370+
event.serialize(new JsonObjectWriter(new Writer() {
371+
@Override
372+
public void write(char[] cbuf) {
373+
stringBuilder.append(cbuf);
374+
}
375+
376+
@Override
377+
public void write(char[] chars, int i, int i1) {
378+
stringBuilder.append(chars, i, i1);
379+
}
380+
381+
@Override
382+
public void write(String str, int off, int len) {
383+
stringBuilder.append(str, off, len);
384+
}
385+
386+
@Override
387+
public void flush() {}
388+
389+
@Override
390+
public void close() {}
391+
}, 4), NoOpLogger.getInstance());
392+
} catch (IOException ignored) {}
393+
Log.i(TAG, stringBuilder.toString());
394+
}
395+
// Check saved preferences to see if the user has opted out of crash reporting.
396+
// If the user has opted out, return null.
397+
if (isCrashReportingEnabled()) {
398+
Log.i(TAG, "Relayed sentry report according to user preference");
399+
return event;
400+
} else {
401+
Log.i(TAG, "Blocked sentry report according to user preference");
402+
return null;
403+
}
404+
});
405+
});
344406
}
345407

346408
@Override

0 commit comments

Comments
 (0)