Commit Graph

3503 Commits

Author SHA1 Message Date
Viktor De Pasquale 96ef9cdbee Fixed insets not being implicitly asked for by the framework resulting in no coverage for other than main fragments 2019-10-18 16:39:08 +02:00
Viktor De Pasquale 28fcbbcf7b Added basic preferences to settings 2019-10-17 19:26:35 +02:00
Viktor De Pasquale 0f4326151f Added titles 2019-10-17 19:26:25 +02:00
Viktor De Pasquale e0e27774ad Added remaining stubs for the redesign 2019-10-17 18:57:00 +02:00
Viktor De Pasquale 1223b48b2c Fixed dialog automatically dismissing itself 2019-10-17 15:52:52 +02:00
Viktor De Pasquale d8338f0b48 Fixed event duplication 2019-10-17 15:47:11 +02:00
Viktor De Pasquale 38019f7f42 Added env check to homepage 2019-10-17 15:37:10 +02:00
Viktor De Pasquale 23978ef4d2 Updated bottom padding for home fragment 2019-10-16 19:04:37 +02:00
Viktor De Pasquale 3b4cb23112 Fixed error in navigation implementation 2019-10-16 18:53:38 +02:00
Viktor De Pasquale 974cb1167f Added post-merge fixes 2019-10-16 17:53:35 +02:00
Viktor De Pasquale 6ccbc272c6 Merge remote-tracking branch 'john/master' into feature/redesign
# Conflicts:
#	app/build.gradle
#	app/src/main/AndroidManifest.xml
#	app/src/main/java/com/topjohnwu/magisk/model/events/ViewEvents.kt
#	app/src/main/java/com/topjohnwu/magisk/model/navigation/MagiskNavigationEvent.kt
#	app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt
#	app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.kt
#	app/src/main/java/com/topjohnwu/magisk/view/MagiskDialog.kt
#	app/src/main/res/layout/dialog_magisk_base.xml
2019-10-16 17:33:54 +02:00
Viktor De Pasquale 0eb28c3265 Added navigation delegation to bypass default one
By making a delegate like such we protect ourselves against intrusions in views' logic
2019-10-16 17:27:11 +02:00
Viktor De Pasquale 2daa131fb2 Added layout behavior to dismiss toolbars when scrolling 2019-10-16 16:08:07 +02:00
Viktor De Pasquale 51247d36c5 Added disabled state for sections where unrooted user shouldn't have access 2019-10-16 15:47:41 +02:00
Omar Kharrab 7342fc2307 Update Arabic translation 2019-10-15 02:57:43 -04:00
topjohnwu 9867a3bd60 Pedantic boot_img_hdr multi-version support 2019-10-15 01:46:29 -04: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
Viktor De Pasquale 37fa227fb5 Added refreshing upon connection restore 2019-10-12 16:30:18 +02:00
Viktor De Pasquale 9dd272b357 Fixed main cards collapsing on themselves 2019-10-12 16:22:12 +02:00
Viktor De Pasquale 277298feae Updated night style for elevated cards 2019-10-12 16:11:05 +02:00
Viktor De Pasquale ff24bc0b68 Updated card design on homepage 2019-10-12 16:10:44 +02:00
topjohnwu b05b688267 Fix issues in stub APK 2019-10-12 03:58:45 -04:00
Simon Shi f3d7f85063 Fix incorrect link path for /sbin/.core 2019-10-12 01:00:15 -04:00
topjohnwu de969a9dab Downgrade recyclerview 2019-10-12 00:53:04 -04:00
topjohnwu 59fd38bbf8 Add v7.3.5 changelog manager-v7.3.5 v20.0 2019-10-11 16:12:32 -04:00
topjohnwu 06dc6df270 Allow dalvik runtime to load snet 2019-10-11 03:58:04 -04:00
topjohnwu ff8460b361 Update dependencies 2019-10-11 03:29:55 -04:00
topjohnwu 674d272eaa Support pre-5.0 without GMS
Fix #1912
2019-10-11 01:46:15 -04:00
topjohnwu c3e00c279d Legacy adb shell does not have uname 2019-10-11 01:45:06 -04:00
dark-basic 175d920c94 Update strings.xml
I'M BACK.
New translations were added.
2019-10-10 17:17:09 -04:00
Viktor De Pasquale 700c51f95c Added animated home icons 2019-10-10 22:00:39 +02:00
topjohnwu 04920883ea Change code for handling tar files 2019-10-10 15:07:45 -04:00
Viktor De Pasquale 659914afbe Updated navigation icons 2019-10-10 19:08:15 +02:00
Viktor De Pasquale ee06aed94b Updated toolbar and bottom bar design implementation
TBD:
Both toolbars should move away from the screen when scrolling
2019-10-10 17:34:06 +02:00
Viktor De Pasquale af1f5d5ab2 Fixed showing magisk version when not installed 2019-10-10 16:51:20 +02:00
topjohnwu 5e44b0b9d5 Use raw literals for scripts 2019-10-09 17:38:45 -04:00
topjohnwu 23c1a1dab8 Some code reorganizing 2019-10-09 16:01:21 -04:00
topjohnwu f5d054b93c Add support for PXA DTBs 2019-10-08 23:49:21 -04:00
topjohnwu d25ae5e0a9 Add __attribute__((packed)) just in case 2019-10-08 16:55:25 -04:00
topjohnwu c42a51dcbb Add support to patch DTBH DTBs
Apparently, Qualcomm is not the only on creating weird DTB formats,
Samsung also have their own DTBH format for Exynos platforms.

Close #1902
2019-10-08 16:43:27 -04:00
topjohnwu da3fd92b31 Prevent unsigned overflow
Close #1898
2019-10-08 15:55:27 -04:00
topjohnwu 4a45ba3c14 Update magisk_files commit hashes 2019-10-08 14:53:04 -04:00
Viktor De Pasquale 4292ddd0ae Added custom install dialogs 2019-10-08 20:29:55 +02:00
Viktor De Pasquale 4a68fd65b6 Updated UI so magisk cannot be updated unless latest manager is installed 2019-10-08 18:51:31 +02:00
Viktor De Pasquale 0e33632e79 Added package name when it differs from the default one 2019-10-08 18:30:23 +02:00
Viktor De Pasquale a9b20dae33 Fixed showing update information 2019-10-08 18:29:58 +02:00
Madis dbc8bed234 Estonian update 2019-10-07 23:04:19 -04:00
Gaurav f8b4190a11 Fix Typos 2019-10-07 23:03:09 -04:00
Mevlüt TOPÇU 479972e3ae Update Turkish language
Hi

Merge please

Thank's
2019-10-07 23:02:29 -04:00
Viktor De Pasquale 3ea28b0afb Fixed permission event not being executed 2019-10-07 22:58:14 -04:00