Commit Graph

36 Commits

Author SHA1 Message Date
RikkaW
fc76673802 Black splash screen background for dark theme 2020-09-21 03:15:59 -07:00
topjohnwu
cba26eedb5 Move several stuffs out of shared 2020-03-30 04:25:42 -07:00
Viktor De Pasquale
9952387356 Updated layouts to fit new widget that should visually represent a switch
The switch is not actually a switch, but a representation of internal state, the layouts continue to accept touch events as beforehand.
2020-02-11 10:42:05 -08:00
Viktor De Pasquale
d7653e6e42 Cleaned up unused resources 2020-02-11 10:42:05 -08:00
topjohnwu
5ffb9eaa5b Support loading Magisk Manager from stub on 9.0+
In the effort of preventing apps from crawling APK contents across the
whole installed app list to detect Magisk Manager, the solution here
is to NOT install the actual APK into the system, but instead
dynamically load the full app at runtime by a stub app. The full APK
will be stored in the application's private internal data where
non-root processes cannot read or scan.

The basis of this implementation is the class "AppComponentFactory"
that is introduced in API 28. If assigned, the system framework will
delegate app component instantiation to our custom implementation,
which allows us to do all sorts of crazy stuffs, in our case dynamically
load classes and create objects that does not exist in our APK.

There are a few challenges to achieve our goal though. First, Java
ClassLoaders follow the "delegation pattern", which means class loading
resolution will first be delegated to the parent loader before we get
a chance to do anything. This includes DexClassLoader, which is what
we will be using to load DEX files at runtime. This is a problem
because our stub app and full app share quite a lot of class names.
A custom ClassLoader, DynamicClassLoader, is created to overcome this
issue: it will always load classes in its current dex path before
delegating it to the parent.

Second, all app components (with the exception of runtime
BroadcastReceivers) are required to be declared in AndroidManifest.xml.
The full Magisk Manager has quite a lot of components (including
those from WorkManager and Room). The solution is to copy the complete
AndroidManifest.xml from the full app to the stub, and our
AppComponentFactory is responsible to construct the proper objects or
return dummy implementations in case the full APK isn't downloaded yet.

Third, other than classes, all resources required to run the full app
are also not bundled with the stub APK. We have to call an internal API
`AssetManager.addAssetPath(String)` to add our downloaded full APK into
AssetManager in order to access resources within our full app. That
internal API has existed forever, and is whitelisted from restricted
API access on modern Android versions, so it is pretty safe to use.

Fourth, on the subject of resources, some resources are not just being
used by our app at runtime. Resources such as the app icon, app label,
launch theme, basically everything referred in AndroidManifest.xml,
are used by the system to display the app properly. The system get these
resources via resource IDs and direct loading from the installed APK.
This subset of resources would have to be copied into the stub to make
the app work properly.

Fifth, resource IDs are used all over the place in XMLs and Java code.
The resource IDs in the stub and full app cannot missmatch, or
somewhere, either it be the system or AssetManager, will refer to the
incorrect resource. The full app will have to include all resources in
the stub, and all of them have to be assigned to the exact same IDs in
both APKs. To achieve this, we use AAPT2's "--emit-ids" option to dump
the resource ID mapping when building the stub, and "--stable-ids" when
building the full APK to make sure all overlapping resources in full
and stub are always assigned to the same ID.

Finally, both stub and full app have to work properly independently.
On 9.0+, the stub will have to first launch an Activity to download
the full APK before it can relaunch into the full app. On pre-9.0, the
stub should behave as it always did: download and prompt installation
to upgrade itself to full Magisk Manager. In the full app, the goal
is to introduce minimal intrusion to the code base to make sure this
whole thing is maintainable in the future. Fortunately, the solution
ends up pretty slick: all ContextWrappers in the app will be injected
with custom Contexts. The custom Contexts will return our patched
Resources object and the ClassLoader that loads itself, which will be
DynamicClassLoader in the case of running as a delegate app.
By directly patching the base Context of ContextWrappers (which covers
tons of app components) and in the Koin DI, the effect propagates deep
into every aspect of the code, making this change basically fully
transparent to almost every piece of code in full Magisk Manager.

After this commit, the stub app is able to properly download and launch
the full app, with most basic functionalities working just fine.
Do not expect Magisk Manager upgrades and hiding (repackaging) to
work properly, and some other minor issues might pop up.
This feature is still in the early WIP stages.
2019-10-14 03:49:17 -04:00
topjohnwu
15312e4709 Remove unused resources 2019-09-09 17:57:25 -04:00
Viktor De Pasquale
9bb4dfad13 Added back version checking (and version boxes) after transitioning homepage to MVVM
Fixed several errors caused along the way
2019-04-14 11:00:29 +02:00
Viktor De Pasquale
f309522268 Added (backported) values and styles for views 2019-04-12 22:06:57 +02:00
topjohnwu
ceb21ced2b Small changes 2019-04-04 02:30:03 -04:00
topjohnwu
bd81923f2f Revert "Make dark theme cards slightly darker"
This reverts commit 675d6d8328.
2018-10-28 14:59:45 -04:00
Nicholas
675d6d8328 Make dark theme cards slightly darker
Use #323232 instead of #424242

Of course this is just a suggestion, use other codes if you wish. I just find the current color a bit too light for a dark theme.
2018-10-26 17:09:56 -04:00
daveyannihilation
fc791b4371 Fix Dark theme to display cards as slightly lighter than background as per Material Design standards. Also redirect colors to app as opposed to calling on framework 2018-10-20 21:13:13 -04:00
topjohnwu
f8076825cb Move Magisk Manager files into subfolder 2018-07-18 17:47:53 +08:00
topjohnwu
863b13a694 Massive project restructure 2017-12-04 14:21:55 +08:00
topjohnwu
1cd2c5e653 Add changelogs 2017-12-03 04:18:22 +08:00
daveyannihilation
f60fd42ac0 Expose Flashing colours for themes 2017-11-17 02:03:35 +08:00
topjohnwu
738f943a68 Several UI tweaks 2017-05-26 18:20:53 +08:00
topjohnwu
a3f0ef8e77 Many improvements and bug fixes
Close #114
2017-02-21 03:38:37 +08:00
topjohnwu
8eba05ed4a Potentially fix Samsung crash and change colors 2017-02-20 20:11:07 +08:00
topjohnwu
df7a5bf149 Redo styling 2017-02-14 16:35:03 +08:00
topjohnwu
0bd0eb9e59 Magisk Manager is now a SU client
1. Add request popup
2. Add su request notifications
3. Add su database helpers
2017-01-24 14:19:28 +08:00
dvdandroid
d788bd8323 UI Fixes
+ Adjusted dark theme colors
+ Moved setting to an activity
+ Code format
+ Changed some icons
+ Minor fixes
2016-10-01 01:02:24 +08:00
topjohnwu
e4cba70008 Ready for release 2016-09-29 23:24:31 +08:00
d8ahazard
835ef01a70 Prettify theme, add relaunch to settings on change 2016-09-27 15:58:21 +08:00
d8ahazard
6692b618ea More fun with themes 2016-09-26 09:21:48 +08:00
d8ahazard
2052149dc1 Moar work on dark theme 2016-09-26 02:28:12 +08:00
d8ahazard
c56dd4172e Apparently, I thought a theme was a good idea... 2016-09-25 00:16:28 -05:00
d8ahazard
b3ba79a3ba Add Swipe-to-refresh for Modules, Code Cleanup, Stylizations
Moar updates.  Modules now swipe to refresh and indicate properly-ish.
Cleanup minor code stuff.  Colorize icons to match, set global color
variable so it can be changed...
2016-09-12 23:05:04 -05:00
dvdandroid
ab318ef99e Updated UI
Added "Root" section
2016-08-26 12:45:35 +02:00
dvdandroid
dabb222511 [WIP] Update checker
TODO: change download file path to internal storage
2016-08-25 14:59:07 +02:00
topjohnwu
dc06a132bc Finalize 2.0 version 2016-08-25 18:08:07 +08:00
dvdandroid
0f103d5853 UI improvements, cleanup 2016-08-23 12:39:36 +02:00
dvdandroid
56f10e238b UI improvements 2016-08-23 11:39:18 +02:00
dvdandroid
3ad06c406c [WIP] Use checkbox and delete button instead of a popup menu 2016-08-23 05:42:46 +08:00
dvdandroid
f5e53cd60f Start materializing module fragment 2016-08-23 05:42:44 +08:00
topjohnwu
4752b0772f Initial Commit 2016-08-06 00:58:05 +08:00