Commit b4b64c1
authored
Downgrade Support for installer, Dhizuku Mode for whole app and performance improvements (#125)
* Bump version to 1.71.3 and enable BuildConfig in suCore
* Update `versionCode` to 1713 and `versionName` to 1.71.3 in `gradle.properties`.
* Enable `buildConfig` in the `suCore` module's `buildFeatures`.
* Remove a commented-out Kotlin Android plugin alias from `suCore/build.gradle.kts`.
* Add Logger utility classes to suCore and app modules
* Add `Logger` object to `suCore` module providing debug-only logging for D, I, W, V, and E levels.
* Add `Logger` object to `app` module with debug-only logging and a `koinLogLevel` configuration for Koin initialization.
* Replace custom logging with specialized Logger utility and refactor shell utilities
* Replace `android.util.Log` calls with project-specific `Logger` utility across the application and `suCore` modules.
* Update `ThorApplication` to use `Logger.koinLogLevel` for Koin initialization.
* Refactor `ShellUtils.isValidOutput` to use Kotlin's `isNullOrEmpty()` extension.
* Simplify GCD calculation in `ShellUtils` using augmented assignment (`-=`).
* Remove redundant file-written check in `InstallerRepositoryImpl` and improve error logging for bundle installation.
* Fix typo in `MainViewModel` documentation ("Logger Dialog" to "Logger DiaLogger").
* Remove unused import in `CallbackList.kt`.
* Optimized imports
* partial code cleanup
* Update `InstallState.ReadyToInstall` with versioning and downgrade support
* Enhance `ReadyToInstall` data class to include `isDowngrade` and `oldVersion` properties.
* Add helper methods to `ReadyToInstall` for generating dynamic UI content:
* `getVersionInfo()`: Provides version comparison strings.
* `getActionButtonText()`: Returns appropriate labels for install, update, or downgrade actions.
* `getWarningMessage()` and `shouldShowWarning()`: Manage downgrade-specific warnings.
* `getActionWord()`: Provides context-specific verbs for the installation process.
* Allow app downgrades in SystemGateway
* Update `SystemGateway.installApp` to include an optional `canDowngrade` parameter, defaulting to `false`.
* Add support for package downgrades in `ShizukuReflector`
* Update `installPackage` in `ShizukuReflector.kt` to accept an optional `canDowngrade` parameter.
* Include the `-d` flag in the `pm install` command when `canDowngrade` is set to true.
* Add support for app downgrades in system gateways
* Update `RootSystemGateway` to include the `-d` flag in the `pm install` command when `canDowngrade` is true.
* Update `ShizukuSystemGateway` to pass the `canDowngrade` parameter to the package installer.
* Update the `installApp` interface signature to support the new `canDowngrade` boolean flag.
* Add support for package downgrades and extend application metadata
* Update `InstallerRepository` to allow optional package downgrading during installation.
* Add `versionCode` and `permissions` fields to the `AppMetadata` domain model.
* Enhance APK analysis and add support for downgrade installations
* **App Analysis**: Update `AppAnalyzerImpl` to extract `versionCode` and requested permissions.
* **Install Logic**: Add a `canDowngrade` parameter to installation methods.
* **Downgrade Support**: Implement downgrade requests using `HiddenApiBypass` to invoke `setRequestDowngrade` on `SessionParams`.
* **Root Installation**: Pass the downgrade flag to `RootSystemGateway`.
* **Compatibility**: Fix `PendingIntent` flag compatibility for Android versions below S (API 31).
* **Cleanup**: Remove redundant comments and improve code clarity in `AppAnalyzerImpl`.
* Update `PortableInstaller` and `InstallerViewModel` to support app downgrades and enhanced package metadata display.
* **Installer UI**:
* Display both `versionName` and `versionCode` in the package info header.
* Add a warning message when an operation is a downgrade or an update.
* Show the number of requested permissions and associated warnings.
* Refactor action buttons into a `Row` layout, keeping them aligned with permission info.
* Generalize "Install/Update" labels using new helper methods from the install state.
* **Installer Logic**:
* Enhance package analysis to detect downgrades by comparing `versionCode`.
* Track the previously installed version name for context.
* Add validation to prevent downgrades using `InstallMode.NORMAL` (restricted to Root or Shizuku).
* Pass the `canDowngrade` flag to the repository during the installation process.
* Refactor package installation logic and clean up codebase
* Add a conditional check to only show the package warning message in `PortableInstaller` if `shouldShowWarning()` is true.
* Simplify version code retrieval by using `longVersionCode` directly, removing legacy SDK version checks and deprecated `versionCode` usage in `InstallerViewModel` and `AppAnalyzerImpl`.
* Add `@Suppress("unused")` annotations to `getVersionInfo`, `setInstallMode`, and the `ShizukuReflector` file.
* Remove an unused `AppMetadata` import in `InstallerViewModel`.
* Add Dhizuku API dependency
* Add `dhizuku` version 2.5.4 to `gradle/libs.versions.toml`.
* Add `dhizuku-api` library definition to `gradle/libs.versions.toml`.
* Include `libs.dhizuku.api` as an implementation dependency in `app/build.gradle.kts`.
* dhizuku ICON
* Add Dhizuku support for system operations
* Implement `DhizukuHelper` to handle core Dhizuku API interactions, including service binding via `ShizukuBinderWrapper` and shell command execution.
* Add `DhizukuReflector` to provide a high-level interface for force-stopping apps, clearing cache, and managing app enabled/disabled states.
* Implement `DhizukuSystemGateway` to integrate Dhizuku as a `SystemGateway` provider, enabling app installation, uninstallation, and package management.
* Utilize `HiddenApiBypass` for accessing restricted system methods on Android P and above.
* Add Dhizuku support for privileged app operations
* Initialize Dhizuku API in `ThorApplication`.
* Add `DhizukuSystemGateway` and `DhizukuReflector` to support Dhizuku-based system actions.
* Update `SystemRepository` and `SystemGateway` interfaces to include Dhizuku availability checks and integration.
* Implement Dhizuku installation mode in `InstallerRepositoryImpl` using `DhizukuAPI` and binder wrapping.
* Update `InstallerViewModel` to detect Dhizuku availability and allow it as a privileged install mode (supporting downgrades).
* Add Dhizuku UI components, including icons and labels, to the `PortableInstaller` screen.
* Fix a compatibility issue in `InstallerViewModel` when retrieving version codes on devices below Android P.
* Register Dhizuku-related components in the Koin dependency injection `coreModule`.
* Add Dhizuku support for privileged app operations
* Initialize Dhizuku API in `ThorApplication`.
* Add `DhizukuSystemGateway` and `DhizukuReflector` to support Dhizuku-based system actions.
* Update `SystemRepository` and `SystemGateway` interfaces to include Dhizuku availability checks and integration.
* Implement Dhizuku installation mode in `InstallerRepositoryImpl` using `DhizukuAPI` and binder wrapping.
* Update `InstallerViewModel` to detect Dhizuku availability and allow it as a privileged install mode (supporting downgrades).
* Add Dhizuku UI components, including icons and labels, to the `PortableInstaller` screen.
* Fix a compatibility issue in `InstallerViewModel` when retrieving version codes on devices below Android P.
* Register Dhizuku-related components in the Koin dependency injection `coreModule`.
* Update app/src/main/java/com/valhalla/thor/data/source/local/dhizuku/Dhizuku.kt1 parent a1cb7c9 commit b4b64c1
File tree
54 files changed
+963
-350
lines changed- app
- src/main
- java/com/valhalla/thor
- data
- gateway
- receivers
- repository
- source/local
- dhizuku
- shizuku
- di
- domain
- gateway
- model
- repository
- presentation
- appList
- freezer
- home
- components
- installer
- utils
- widgets
- util
- res/drawable
- gradle
- suCore
- src/main/java/com/valhalla/superuser
- internal
- ktx
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
54 files changed
+963
-350
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
4 | | - | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
211 | 212 | | |
212 | 213 | | |
213 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
| 81 | + | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
32 | 40 | | |
33 | 41 | | |
34 | | - | |
| 42 | + | |
Lines changed: 70 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
48 | | - | |
49 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
47 | | - | |
48 | | - | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
75 | | - | |
| 77 | + | |
Lines changed: 15 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| 52 | + | |
47 | 53 | | |
48 | | - | |
| 54 | + | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
| |||
Lines changed: 12 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
38 | | - | |
39 | | - | |
40 | 37 | | |
41 | 38 | | |
42 | 39 | | |
| |||
49 | 46 | | |
50 | 47 | | |
51 | 48 | | |
52 | | - | |
53 | | - | |
| 49 | + | |
54 | 50 | | |
55 | 51 | | |
56 | 52 | | |
57 | 53 | | |
58 | | - | |
59 | 54 | | |
60 | 55 | | |
61 | 56 | | |
| |||
65 | 60 | | |
66 | 61 | | |
67 | 62 | | |
68 | | - | |
69 | 63 | | |
70 | | - | |
| 64 | + | |
71 | 65 | | |
72 | 66 | | |
73 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
74 | 71 | | |
75 | 72 | | |
76 | 73 | | |
| |||
87 | 84 | | |
88 | 85 | | |
89 | 86 | | |
| 87 | + | |
90 | 88 | | |
| 89 | + | |
91 | 90 | | |
92 | 91 | | |
93 | 92 | | |
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
97 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
104 | | - | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
0 commit comments