Showing preview only (949K chars total). Download the full file or copy to clipboard to get everything.
Repository: TeamVanced/VancedManager
Branch: compose
Commit: 1c219ea3e0d0
Files: 202
Total size: 883.7 KB
Directory structure:
gitextract_f45693ij/
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug-issue-template.md
│ │ ├── config.yml
│ │ └── feature-request-template.md
│ └── workflows/
│ ├── debug.yml
│ └── lint.yml
├── .gitignore
├── LICENSE
├── README.md
├── READMEME.md
├── app/
│ ├── .gitignore
│ ├── build.gradle.kts
│ ├── google-services.json
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── vanced/
│ │ └── manager/
│ │ ├── ManagerApplication.kt
│ │ ├── di/
│ │ │ ├── APIModule.kt
│ │ │ ├── CustomTabsModule.kt
│ │ │ ├── DatasourceModule.kt
│ │ │ ├── DownloaderModule.kt
│ │ │ ├── InstallerModuke.kt
│ │ │ ├── ManagerModule.kt
│ │ │ ├── NetworkModule.kt
│ │ │ ├── RepositoryModule.kt
│ │ │ ├── ServiceModule.kt
│ │ │ └── ViewModelModule.kt
│ │ ├── domain/
│ │ │ └── model/
│ │ │ ├── App.kt
│ │ │ └── InstallationOption.kt
│ │ ├── downloader/
│ │ │ ├── api/
│ │ │ │ ├── MicrogAPI.kt
│ │ │ │ ├── MusicAPI.kt
│ │ │ │ └── VancedAPI.kt
│ │ │ ├── base/
│ │ │ │ └── AppDownloader.kt
│ │ │ ├── impl/
│ │ │ │ ├── MicrogDownloader.kt
│ │ │ │ ├── MusicDownloader.kt
│ │ │ │ └── VancedDownloader.kt
│ │ │ └── util/
│ │ │ └── DownloadPath.kt
│ │ ├── installer/
│ │ │ ├── base/
│ │ │ │ └── AppInstaller.kt
│ │ │ ├── impl/
│ │ │ │ ├── MicrogInstaller.kt
│ │ │ │ ├── MusicInstaller.kt
│ │ │ │ └── VancedInstaller.kt
│ │ │ ├── service/
│ │ │ │ ├── AppInstallService.kt
│ │ │ │ └── AppUninstallService.kt
│ │ │ └── util/
│ │ │ ├── PM.kt
│ │ │ ├── PMRoot.kt
│ │ │ ├── PMRootResult.kt
│ │ │ ├── Patcher.kt
│ │ │ └── RootPatchHelper.kt
│ │ ├── io/
│ │ │ ├── ManagerSuFile.kt
│ │ │ └── SUIOException.kt
│ │ ├── network/
│ │ │ ├── GithubService.kt
│ │ │ ├── dto/
│ │ │ │ └── GithubDto.kt
│ │ │ └── util/
│ │ │ └── Constants.kt
│ │ ├── preferences/
│ │ │ ├── ManagerPreference.kt
│ │ │ └── holder/
│ │ │ ├── PreferenceDefaultValueHolder.kt
│ │ │ ├── PreferenceHolder.kt
│ │ │ └── PreferenceKeyHolder.kt
│ │ ├── repository/
│ │ │ ├── AppRepository.kt
│ │ │ ├── PreferenceRepository.kt
│ │ │ ├── manager/
│ │ │ │ └── PackageManager.kt
│ │ │ └── source/
│ │ │ └── PreferenceDatasource.kt
│ │ ├── ui/
│ │ │ ├── MainActivity.kt
│ │ │ ├── SplashScreenActivity.kt
│ │ │ ├── component/
│ │ │ │ ├── ManagerButton.kt
│ │ │ │ ├── ManagerCard.kt
│ │ │ │ ├── ManagerDialog.kt
│ │ │ │ ├── ManagerDropdownMenu.kt
│ │ │ │ ├── ManagerLazyDsl.kt
│ │ │ │ ├── ManagerListItem.kt
│ │ │ │ ├── ManagerNavigator.kt
│ │ │ │ ├── ManagerPreference.kt
│ │ │ │ ├── ManagerProgressIndicator.kt
│ │ │ │ ├── ManagerScaffold.kt
│ │ │ │ ├── ManagerSwipeRefresh.kt
│ │ │ │ ├── ManagerText.kt
│ │ │ │ └── ManagerTopAppBar.kt
│ │ │ ├── resource/
│ │ │ │ └── ManagerString.kt
│ │ │ ├── screen/
│ │ │ │ ├── AboutScreen.kt
│ │ │ │ ├── ConfigurationScreen.kt
│ │ │ │ ├── HomeScreen.kt
│ │ │ │ ├── InstallScreen.kt
│ │ │ │ └── SettingsScreen.kt
│ │ │ ├── theme/
│ │ │ │ ├── Color.kt
│ │ │ │ ├── Shape.kt
│ │ │ │ ├── Theme.kt
│ │ │ │ └── Type.kt
│ │ │ ├── util/
│ │ │ │ ├── Color.kt
│ │ │ │ ├── Const.kt
│ │ │ │ └── Screen.kt
│ │ │ ├── viewmodel/
│ │ │ │ ├── ConfigurationViewModel.kt
│ │ │ │ ├── InstallViewModel.kt
│ │ │ │ ├── MainViewModel.kt
│ │ │ │ └── SettingsViewModel.kt
│ │ │ └── widget/
│ │ │ ├── AppCard.kt
│ │ │ └── LinkCard.kt
│ │ └── util/
│ │ ├── AppHelper.kt
│ │ ├── Arch.kt
│ │ ├── Coroutines.kt
│ │ ├── IO.kt
│ │ ├── Safety.kt
│ │ └── SuShell.kt
│ └── res/
│ ├── animator/
│ │ ├── fragment_enter.xml
│ │ ├── fragment_enter_pop.xml
│ │ ├── fragment_exit.xml
│ │ └── fragment_exit_pop.xml
│ ├── drawable/
│ │ ├── ic_adguard.xml
│ │ ├── ic_android_black_24dp.xml
│ │ ├── ic_app_icon_placeholder.xml
│ │ ├── ic_brave.xml
│ │ ├── ic_brave_light.xml
│ │ ├── ic_discord.xml
│ │ ├── ic_github.xml
│ │ ├── ic_instagram.xml
│ │ ├── ic_launch_text.xml
│ │ ├── ic_magisk.xml
│ │ ├── ic_manager.xml
│ │ ├── ic_manager_monet_icon.xml
│ │ ├── ic_microg.xml
│ │ ├── ic_music.xml
│ │ ├── ic_reddit.xml
│ │ ├── ic_round_assignment_24.xml
│ │ ├── ic_round_close_24.xml
│ │ ├── ic_round_done_24.xml
│ │ ├── ic_splash.xml
│ │ ├── ic_telegram.xml
│ │ ├── ic_twitter.xml
│ │ ├── ic_vanced.xml
│ │ ├── ic_website.xml
│ │ └── ic_youtube.xml
│ ├── drawable-anydpi-v24/
│ │ └── ic_stat_name.xml
│ ├── drawable-v24/
│ │ └── ic_launcher_foreground.xml
│ ├── mipmap-anydpi-v26/
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ ├── values/
│ │ ├── arrays.xml
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── resources.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ ├── values-af-rZA/
│ │ └── strings.xml
│ ├── values-ar-rSA/
│ │ └── strings.xml
│ ├── values-az-rAZ/
│ │ └── strings.xml
│ ├── values-bg-rBG/
│ │ └── strings.xml
│ ├── values-bn-rBD/
│ │ └── strings.xml
│ ├── values-bn-rIN/
│ │ └── strings.xml
│ ├── values-ca-rES/
│ │ └── strings.xml
│ ├── values-ckb-rIR/
│ │ └── strings.xml
│ ├── values-cs-rCZ/
│ │ └── strings.xml
│ ├── values-da-rDK/
│ │ └── strings.xml
│ ├── values-de-rDE/
│ │ └── strings.xml
│ ├── values-el-rGR/
│ │ └── strings.xml
│ ├── values-es-rES/
│ │ └── strings.xml
│ ├── values-et-rEE/
│ │ └── strings.xml
│ ├── values-fi-rFI/
│ │ └── strings.xml
│ ├── values-fil-rPH/
│ │ └── strings.xml
│ ├── values-fr-rFR/
│ │ └── strings.xml
│ ├── values-hi-rIN/
│ │ └── strings.xml
│ ├── values-hr-rHR/
│ │ └── strings.xml
│ ├── values-hu-rHU/
│ │ └── strings.xml
│ ├── values-in-rID/
│ │ └── strings.xml
│ ├── values-it-rIT/
│ │ └── strings.xml
│ ├── values-iw-rIL/
│ │ └── strings.xml
│ ├── values-ja-rJP/
│ │ └── strings.xml
│ ├── values-ka-rGE/
│ │ └── strings.xml
│ ├── values-kmr-rTR/
│ │ └── strings.xml
│ ├── values-ko-rKR/
│ │ └── strings.xml
│ ├── values-ku-rTR/
│ │ └── strings.xml
│ ├── values-lt-rLT/
│ │ └── strings.xml
│ ├── values-ml-rIN/
│ │ └── strings.xml
│ ├── values-mr-rIN/
│ │ └── strings.xml
│ ├── values-night/
│ │ └── colors.xml
│ ├── values-nl-rNL/
│ │ └── strings.xml
│ ├── values-no-rNO/
│ │ └── strings.xml
│ ├── values-pa-rIN/
│ │ └── strings.xml
│ ├── values-pa-rPK/
│ │ └── strings.xml
│ ├── values-pl-rPL/
│ │ └── strings.xml
│ ├── values-ps-rAF/
│ │ └── strings.xml
│ ├── values-pt-rBR/
│ │ └── strings.xml
│ ├── values-pt-rPT/
│ │ └── strings.xml
│ ├── values-ro-rRO/
│ │ └── strings.xml
│ ├── values-ru-rRU/
│ │ └── strings.xml
│ ├── values-si-rLK/
│ │ └── strings.xml
│ ├── values-sk-rSK/
│ │ └── strings.xml
│ ├── values-so-rSO/
│ │ └── strings.xml
│ ├── values-sr-rSP/
│ │ └── strings.xml
│ ├── values-sv-rSE/
│ │ └── strings.xml
│ ├── values-ta-rIN/
│ │ └── strings.xml
│ ├── values-th-rTH/
│ │ └── strings.xml
│ ├── values-tr-rTR/
│ │ └── strings.xml
│ ├── values-uk-rUA/
│ │ └── strings.xml
│ ├── values-vi-rVN/
│ │ └── strings.xml
│ ├── values-zh-rCN/
│ │ └── strings.xml
│ ├── values-zh-rTW/
│ │ └── strings.xml
│ └── xml/
│ └── file_provider.xml
├── build.gradle.kts
├── crowdin.yml
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle.kts
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/bug-issue-template.md
================================================
---
name: Bug issue template
about: Vanced Manager Bug template
title: ''
labels: ''
assignees: ''
---
**Please only open the issue if the following is true**
- This is an issue in the Vanced Manager and ONLY Vanced Manager (NOT Youtube Vanced/Music/microG)
**Phone Specifications:**
- Brand:
- Operating System:
- Android Version:
- Vanced Manager Version:
**Please describe the problem you are having in as much detail as possible:**
**Steps to reproduce:**
**Further details:**
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
================================================
FILE: .github/ISSUE_TEMPLATE/feature-request-template.md
================================================
---
name: Feature Request Template
about: Vanced Manager Feature Request Template
title: ''
labels: 'enhancement'
assignees: ''
---
**Please only open the issue if the following is true**
- This is an issue in the Vanced Manager and ONLY Vanced Manager (NOT Youtube Vanced/Music/microG)
**Suggestion:**
**Why is this suggestion relevant?**
**Further details:**
================================================
FILE: .github/workflows/debug.yml
================================================
name: Debug APK Builder
on:
push:
branches:
- dev
paths-ignore:
- '**.md'
pull_request:
branches:
- dev
paths-ignore:
- '**.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant rights
run: chmod +x ./gradlew
- name: Build project with Gradle
run: ./gradlew build
- name: Build Debug APK with Gradle
run: ./gradlew assembleDebug
- name: Upload Debug
uses: actions/upload-artifact@v2
with:
name: 'Manager'
path: app/build/outputs/apk/debug/app-debug.apk
================================================
FILE: .github/workflows/lint.yml
================================================
name: Code Linter
on:
push:
branches:
- dev
jobs:
qodana:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/work/_temp/_github_home/cache
key: ${{ runner.os }}-qodana-${{ github.ref }}
restore-keys: |
${{ runner.os }}-qodana-${{ github.ref }}
${{ runner.os }}-qodana-
- uses: docker://jetbrains/qodana-jvm-android
with:
args: --cache-dir=/github/home/cache --results-dir=/github/workspace/qodana --save-report --report-dir=/github/workspace/qodana/report
- uses: actions/upload-artifact@v2
with:
path: qodana
================================================
FILE: .gitignore
================================================
.gradle/
.idea/
build/
local.properties
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
================================================
FILE: README.md
================================================
# Vanced Manager
[](https://github.com/YTVanced/VancedManager/releases/latest) [](https://github.com/YTVanced/VancedManager/releases/latest)
# **Now discontinued https://twitter.com/YTVanced/status/1503052250268286980**
Hi, when we released Vanced 15.05.54, people were upset because it used the .apks format, which was way harder to install than a traditional .apk file. Even though we wrote clear instructions on how to install the new Vanced build, people still couldn't figure it out.
Then we thought, "why don't we make a manager for vanced, which will download, update and uninstall Vanced and MicroG, have an easy and understandable UI and be less than 10mb?" and that's how Vanced Manager was born.
After 3 months of development, we are finally ready to introduce Vanced Manager to the masses. Vanced manager can easily install and uninstall vanced and microg, has various settings for customisation and better experience. The Manager comes with an easy-to-use interface
##### Background download/installation feature is no longer supported due to problems with some ROMs, please do NOT report issues regarding background activity.
## Contributions
Pull requests should be made to the Dev branch as that is the working branch, master is for release code.
For anyone who wants to provide translations please submit them to https://crowdin.com/project/vanced-manager as we also use it for Vanced. Any issues with translations should be posted there too.
## Building
<div>
[](https://github.com/YTVanced/VancedManager/actions/workflows/debug.yml)
</div>
### Using Android Studio
Clone the repo, open it in Android Studio and build the app.
### Using command line
#### On Windows:
```powershell
.\gradlew.bat assembleDebug
```
#### On Linux/macOS:
```bash
chmod +x gradlew
./gradlew assembleDebug
```
================================================
FILE: READMEME.md
================================================

# Prelude
Hi, my name is Steve Cock, I'm the main developer for the upcoming Vanced Manager. When xfileFIN first published Vanced 15.05.54, people were upset because new Vanced used split apk files. The reason for that was pretty simple:
1) YouTube itself does that
2) Split apk files reduce the size of the downloaded file itself
No one really thought there would be problems with this format, because installation was pretty simple, at least that's what xfile thought...
## Problems with .apks format
Main problems with new format were either with device CPU architecture or MemeUI shit with MiUI optimisations. We wrote instructions for VancedHelper but no one used it for troubleshooting. Then some users complained about new format and refused to upgrade to newest version (We don't give a fuck about that) because "I dOn'T WaNT To HaVe OnE MoRE apP To insTalL VanCeD" so we decided to make an installer for Vanced
# Vanced Manager
Ladies and gentlemen, I'm very proud to introduce the new **Vancad Banger 2.0.0.0.0.0.0.0.0.0.0.0.0™** (typo intended)
Vanced Manager is an universal utility for installing/updating Vanced and MicroG. It will push notifications once the update is ready (Now that's what I call pwetty epic).
Vanced Manager comes with a slick UI ~~that was stolen from the new Magisk Manager (I'm very sorry John but I looked at your code for about 100 times). Actually, while UI may look very similar to new Magisk Manager's UI, It's still very different (that's a blatant lie, I know).~~ <- diz shit completely invalid now so suck my balls
Main Menu screenshot taken from tablet

Isn't this lovely and beautiful?
## Manager (clap) Reviews (clap)
- 1337Potato: shit
- Response: Yes
===================
- Noobbot: The app is not useful because I have YT Premium. Thank you bye
- Response: I hope you get sucked by a di-
===================
- Vortextriangle: The app is so useful that I uninstalled it after installing Vanced
- Response: yo that's finna woke
## How does it suck?™
Vanced Manager sucks 100% of your CPU to mine Bitcoins, this is a new technique called CryptocurrencySucker2077. Basically we load up your shit MediaTek MT 8163 with processes that help us mine cryptocurrency, this is how Vanced Team makes money (excluding BAT and AdGuard referrals)
## Credits
### Vanced Manager developers
- X1nto (UI, UX, Downloader, Installer, Signature Checker, PussiSlayer69, Collector of 400 BAT, A great liar)
- Koopah (Unix lord, Unmounter of /system, Code criticizer)
### The Vanced Team
- xfileFIN

- KevinX8

- Zanezam

- Laura Almeida

================================================
FILE: app/.gitignore
================================================
/build
/release
================================================
FILE: app/build.gradle.kts
================================================
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
plugins {
id("com.android.application")
kotlin("android")
id("kotlin-parcelize")
kotlin("plugin.serialization")
}
val composeVersion = "1.1.1"
android {
compileSdk = 31
defaultConfig {
minSdk = 21
targetSdk = 31
applicationId = "com.vanced.manager"
versionCode = 3000
versionName = "3.0.0 (Re@Composed)"
vectorDrawables.useSupportLibrary = true
buildConfigField("String[]", "MANAGER_LANGUAGES", "{$languages}")
}
lint {
disable += "MissingTranslation"
disable += "ExtraTranslation"
}
buildTypes {
getByName("release") {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
buildFeatures {
compose = true
}
packagingOptions {
resources.excludes.add("META-INF/DEPENDENCIES")
resources.excludes.add("META-INF/*.kotlin_module")
}
// To inline the bytecode built with JVM target 1.8 into
// bytecode that is being built with JVM target 1.6. (e.g. navArgs)
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
composeOptions {
kotlinCompilerExtensionVersion = composeVersion
}
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "11"
optIn("androidx.compose.material3.ExperimentalMaterial3Api")
optIn("androidx.compose.animation.ExperimentalAnimationApi")
optIn("androidx.compose.foundation.ExperimentalFoundationApi")
}
}
fun KotlinJvmOptions.optIn(library: String) {
freeCompilerArgs = freeCompilerArgs +
"-opt-in=$library"
}
val languages: String get() {
val langs = arrayListOf("en", "bn_BD", "bn_IN", "pa_IN", "pa_PK", "pt_BR", "pt_PT", "zh_CN", "zh_TW")
val exceptions = arrayOf("bn", "pa", "pt", "zh")
File("$projectDir/src/main/res").listFiles()?.filter {
val name = it.name
name.startsWith("values") && !name.contains("v23") && !name.contains("night")
}?.forEach { dir ->
val dirname = dir.name.substringAfter("-").substringBefore("-")
if (!exceptions.contains(dirname)) {
langs.add(dirname)
}
}
return langs.joinToString(", ") { "\"$it\"" }
}
dependencies {
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2")
// AndroidX
implementation("androidx.core:core-ktx:1.7.0")
implementation("androidx.appcompat:appcompat:1.4.1")
implementation("androidx.browser:browser:1.4.0")
implementation("androidx.preference:preference-ktx:1.2.0")
implementation("androidx.activity:activity-compose:1.4.0")
val lifecycleVersion = "2.4.1"
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion")
// Compose
implementation("androidx.compose.compiler:compiler:$composeVersion")
implementation("androidx.compose.foundation:foundation:$composeVersion")
implementation("androidx.compose.material:material-icons-core:$composeVersion")
implementation("androidx.compose.material:material-icons-extended:$composeVersion")
implementation("androidx.compose.material:material:$composeVersion")
implementation("androidx.compose.material3:material3:1.0.0-alpha06")
implementation("androidx.compose.runtime:runtime-livedata:$composeVersion")
implementation("androidx.compose.ui:ui-tooling:$composeVersion")
implementation("androidx.compose.ui:ui-util:$composeVersion")
implementation("androidx.compose.ui:ui:$composeVersion")
// Google
implementation("com.google.android.material:material:1.5.0")
val accompanistVersion = "0.22.1-rc"
implementation("com.google.accompanist:accompanist-navigation-animation:$accompanistVersion")
implementation("com.google.accompanist:accompanist-placeholder-material:$accompanistVersion")
implementation("com.google.accompanist:accompanist-swiperefresh:$accompanistVersion")
implementation("com.google.accompanist:accompanist-systemuicontroller:$accompanistVersion")
// Other
implementation("com.github.zsoltk:compose-router:0.28.0")
implementation("io.coil-kt:coil-compose:1.4.0")
implementation("com.github.skydoves:orchestra-colorpicker:1.1.0")
val libsuVersion = "3.2.1"
implementation("com.github.topjohnwu.libsu:core:$libsuVersion")
implementation("com.github.topjohnwu.libsu:io:$libsuVersion")
implementation("com.github.topjohnwu.libsu:busybox:$libsuVersion")
val koinVersion = "3.1.3"
implementation("io.insert-koin:koin-android:$koinVersion")
implementation("io.insert-koin:koin-androidx-compose:$koinVersion")
val retrofitVersion = "2.9.0"
implementation("com.squareup.retrofit2:retrofit:$retrofitVersion")
implementation("com.squareup.retrofit2:converter-gson:$retrofitVersion")
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
}
================================================
FILE: app/google-services.json
================================================
{
"project_info": {
"project_number": "840099702732",
"firebase_url": "https://vanced-manager-official.firebaseio.com",
"project_id": "vanced-manager-official",
"storage_bucket": "vanced-manager-official.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:840099702732:android:ca65567b49f622bc359f69",
"android_client_info": {
"package_name": "com.vanced.manager"
}
},
"oauth_client": [
{
"client_id": "840099702732-4fjjofq6on2bpd7jb6f96bk0mkrjkkf6.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAPI1RUaoCHmmWz9-TLvTKYPYs0ZVKkS2U"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "840099702732-4fjjofq6on2bpd7jb6f96bk0mkrjkkf6.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
================================================
FILE: app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.kts.kts.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-keep class com.vanced.manager.network.dto.GithubReleaseDto {
*;
}
-keep class com.vanced.manager.network.dto.GithubReleaseAssetDto {
*;
}
# Uncomment this to preserve the line number information for
# debugging stack traces.
-keepattributes SourceFile, LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
================================================
FILE: app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vanced.manager">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<queries>
<package android:name="com.vanced.android.youtube" />
<package android:name="com.google.android.youtube" />
<package android:name="com.vanced.android.apps.youtube.music" />
<package android:name="com.google.android.apps.youtube.music" />
<package android:name="com.mgoogle.android.gms" />
<package android:name="com.vanced.faq" />
<package android:name="com.android.vending" />
</queries>
<application
android:name=".ManagerApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true">
<activity
android:name=".ui.SplashScreenActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.MainActivity"
android:theme="@style/Theme.MaterialComponents.NoActionBar"
android:label="@string/app_name"/>
<service android:name="com.vanced.manager.installer.service.AppInstallService" />
<service android:name="com.vanced.manager.installer.service.AppUninstallService" />
</application>
</manifest>
================================================
FILE: app/src/main/java/com/vanced/manager/ManagerApplication.kt
================================================
package com.vanced.manager
import android.app.Application
import com.vanced.manager.di.*
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin
class ManagerApplication : Application() {
override fun onCreate() {
super.onCreate()
startKoin {
androidContext(this@ManagerApplication)
modules(
apiModule,
customTabsModule,
datasourceModule,
downloaderModule,
installerModule,
managerModule,
networkModule,
repositoryModule,
serviceModule,
viewModelModule,
)
}
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/di/APIModule.kt
================================================
package com.vanced.manager.di
import com.vanced.manager.downloader.api.MicrogAPI
import com.vanced.manager.downloader.api.MusicAPI
import com.vanced.manager.downloader.api.VancedAPI
import com.vanced.manager.network.util.BASE
import okhttp3.OkHttpClient
import org.koin.dsl.module
import retrofit2.Retrofit
import retrofit2.create
//TODO Add mirror support
val apiModule = module {
fun provideVancedAPI(
okHttpClient: OkHttpClient
): VancedAPI {
return Retrofit.Builder()
.baseUrl(BASE)
.client(okHttpClient)
.build()
.create()
}
fun provideMusicAPI(
okHttpClient: OkHttpClient
): MusicAPI {
return Retrofit.Builder()
.baseUrl(BASE)
.client(okHttpClient)
.build()
.create()
}
fun provideMicrogAPI(
okHttpClient: OkHttpClient
): MicrogAPI {
return Retrofit.Builder()
.baseUrl("https://github.com/YTVanced/VancedMicroG/")
.client(okHttpClient)
.build()
.create(MicrogAPI::class.java)
}
single { provideVancedAPI(get()) }
single { provideMusicAPI(get()) }
single { provideMicrogAPI(get()) }
}
================================================
FILE: app/src/main/java/com/vanced/manager/di/CustomTabsModule.kt
================================================
package com.vanced.manager.di
import androidx.browser.customtabs.CustomTabsIntent
import org.koin.dsl.module
val customTabsModule = module {
fun provideChromeCustomTabs(): CustomTabsIntent {
return CustomTabsIntent.Builder()
.build()
}
single { provideChromeCustomTabs() }
}
================================================
FILE: app/src/main/java/com/vanced/manager/di/DatasourceModule.kt
================================================
package com.vanced.manager.di
import android.content.Context
import com.vanced.manager.repository.source.PreferenceDatasource
import com.vanced.manager.repository.source.PreferenceDatasourceImpl
import org.koin.android.ext.koin.androidContext
import org.koin.dsl.module
val datasourceModule = module {
fun providePreferenceDatasource(
context: Context
): PreferenceDatasource {
return PreferenceDatasourceImpl(
sharedPreferences = context.getSharedPreferences(
"manager_settings",
Context.MODE_PRIVATE
)
)
}
single { providePreferenceDatasource(androidContext()) }
}
================================================
FILE: app/src/main/java/com/vanced/manager/di/DownloaderModule.kt
================================================
package com.vanced.manager.di
import android.content.Context
import com.vanced.manager.downloader.api.MicrogAPI
import com.vanced.manager.downloader.api.MusicAPI
import com.vanced.manager.downloader.api.VancedAPI
import com.vanced.manager.downloader.impl.MicrogDownloader
import com.vanced.manager.downloader.impl.MusicDownloader
import com.vanced.manager.downloader.impl.VancedDownloader
import org.koin.android.ext.koin.androidContext
import org.koin.dsl.module
val downloaderModule = module {
fun provideVancedDownloader(
vancedAPI: VancedAPI,
context: Context,
): VancedDownloader {
return VancedDownloader(
vancedAPI = vancedAPI,
context = context
)
}
fun provideMusicDownloader(
musicAPI: MusicAPI,
context: Context,
): MusicDownloader {
return MusicDownloader(
musicAPI = musicAPI,
context = context
)
}
fun provideMicrogDownloader(
microgAPI: MicrogAPI,
context: Context,
): MicrogDownloader {
return MicrogDownloader(
microgAPI = microgAPI,
context = context
)
}
single { provideVancedDownloader(get(), androidContext()) }
single { provideMusicDownloader(get(), androidContext()) }
single { provideMicrogDownloader(get(), androidContext()) }
}
================================================
FILE: app/src/main/java/com/vanced/manager/di/InstallerModuke.kt
================================================
package com.vanced.manager.di
import android.content.Context
import com.vanced.manager.installer.impl.MicrogInstaller
import com.vanced.manager.installer.impl.MusicInstaller
import com.vanced.manager.installer.impl.VancedInstaller
import com.vanced.manager.repository.manager.NonrootPackageManager
import com.vanced.manager.repository.manager.RootPackageManager
import org.koin.android.ext.koin.androidContext
import org.koin.dsl.module
val installerModule = module {
fun provideVancedInstaller(
context: Context,
nonrootPackageManager: NonrootPackageManager,
rootPackageManager: RootPackageManager
): VancedInstaller {
return VancedInstaller(
context = context,
nonrootPackageManager = nonrootPackageManager,
rootPackageManager = rootPackageManager
)
}
fun provideMusicInstaller(
context: Context,
nonrootPackageManager: NonrootPackageManager,
rootPackageManager: RootPackageManager
): MusicInstaller {
return MusicInstaller(
context = context,
nonrootPackageManager = nonrootPackageManager,
rootPackageManager = rootPackageManager
)
}
fun provideMicrogInstaller(
context: Context,
nonrootPackageManager: NonrootPackageManager,
): MicrogInstaller {
return MicrogInstaller(
context = context,
nonrootPackageManager = nonrootPackageManager
)
}
single { provideVancedInstaller(androidContext(), get(), get()) }
single { provideMusicInstaller(androidContext(), get(), get()) }
single { provideMicrogInstaller(androidContext(), get()) }
}
================================================
FILE: app/src/main/java/com/vanced/manager/di/ManagerModule.kt
================================================
package com.vanced.manager.di
import android.content.Context
import com.vanced.manager.repository.manager.NonrootPackageManager
import com.vanced.manager.repository.manager.RootPackageManager
import org.koin.android.ext.koin.androidContext
import org.koin.dsl.module
val managerModule = module {
fun provideNonrootPackageManager(
context: Context
): NonrootPackageManager {
return NonrootPackageManager(
context = context
)
}
fun provideRootPackageManager(): RootPackageManager {
return RootPackageManager()
}
single { provideNonrootPackageManager(androidContext()) }
single { provideRootPackageManager() }
}
================================================
FILE: app/src/main/java/com/vanced/manager/di/NetworkModule.kt
================================================
package com.vanced.manager.di
import okhttp3.OkHttpClient
import org.koin.dsl.module
val networkModule = module {
fun provideOkHttpClient(): OkHttpClient {
return OkHttpClient.Builder()
.build()
}
single { provideOkHttpClient() }
}
================================================
FILE: app/src/main/java/com/vanced/manager/di/RepositoryModule.kt
================================================
package com.vanced.manager.di
import com.vanced.manager.network.GithubService
import com.vanced.manager.repository.AppRepository
import com.vanced.manager.repository.AppRepositoryImpl
import com.vanced.manager.repository.PreferenceRepository
import com.vanced.manager.repository.PreferenceRepositoryImpl
import com.vanced.manager.repository.manager.NonrootPackageManager
import com.vanced.manager.repository.manager.RootPackageManager
import com.vanced.manager.repository.source.PreferenceDatasource
import org.koin.dsl.module
val repositoryModule = module {
fun provideGithubRepository(
githubService: GithubService,
nonrootPackageManager: NonrootPackageManager,
rootPackageManager: RootPackageManager,
): AppRepository {
return AppRepositoryImpl(
githubService = githubService,
nonrootPackageManager = nonrootPackageManager,
rootPackageManager = rootPackageManager
)
}
fun providePreferenceRepository(
preferenceDatasource: PreferenceDatasource
): PreferenceRepository {
return PreferenceRepositoryImpl(
preferenceDatasource = preferenceDatasource
)
}
single { provideGithubRepository(get(), get(), get()) }
single { providePreferenceRepository(get()) }
}
================================================
FILE: app/src/main/java/com/vanced/manager/di/ServiceModule.kt
================================================
package com.vanced.manager.di
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import com.vanced.manager.network.GithubService
import com.vanced.manager.network.util.GITHUB_API_BASE
import kotlinx.serialization.json.Json
import okhttp3.MediaType
import okhttp3.OkHttpClient
import org.koin.dsl.module
import retrofit2.Retrofit
import retrofit2.create
private val json = Json {
ignoreUnknownKeys = true
}
val serviceModule = module {
fun provideGithubService(
okHttpClient: OkHttpClient
): GithubService {
return Retrofit.Builder()
.baseUrl(GITHUB_API_BASE)
.addConverterFactory(json.asConverterFactory(MediaType.get("application/json")))
.client(okHttpClient)
.build()
.create()
}
single { provideGithubService(get()) }
}
================================================
FILE: app/src/main/java/com/vanced/manager/di/ViewModelModule.kt
================================================
package com.vanced.manager.di
import android.app.Application
import com.vanced.manager.downloader.impl.MicrogDownloader
import com.vanced.manager.downloader.impl.MusicDownloader
import com.vanced.manager.downloader.impl.VancedDownloader
import com.vanced.manager.installer.impl.MicrogInstaller
import com.vanced.manager.installer.impl.MusicInstaller
import com.vanced.manager.installer.impl.VancedInstaller
import com.vanced.manager.repository.AppRepository
import com.vanced.manager.repository.PreferenceRepository
import com.vanced.manager.ui.viewmodel.ConfigurationViewModel
import com.vanced.manager.ui.viewmodel.InstallViewModel
import com.vanced.manager.ui.viewmodel.MainViewModel
import com.vanced.manager.ui.viewmodel.SettingsViewModel
import org.koin.android.ext.koin.androidApplication
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.module
val viewModelModule = module {
fun provideMainViewModel(
appRepository: AppRepository,
preferenceRepository: PreferenceRepository,
app: Application,
): MainViewModel {
return MainViewModel(
appRepository = appRepository,
preferenceRepository = preferenceRepository,
app = app
)
}
fun provideInstallViewModel(
vancedDownloader: VancedDownloader,
musicDownloader: MusicDownloader,
microgDownloader: MicrogDownloader,
vancedInstaller: VancedInstaller,
musicInstaller: MusicInstaller,
microgInstaller: MicrogInstaller,
): InstallViewModel {
return InstallViewModel(
vancedDownloader = vancedDownloader,
musicDownloader = musicDownloader,
microgDownloader = microgDownloader,
vancedInstaller = vancedInstaller,
musicInstaller = musicInstaller,
microgInstaller = microgInstaller
)
}
fun provideConfigurationViewModel(): ConfigurationViewModel {
return ConfigurationViewModel()
}
fun provideSettingsViewModel(
preferenceRepository: PreferenceRepository
): SettingsViewModel {
return SettingsViewModel(
preferenceRepository = preferenceRepository
)
}
viewModel { provideMainViewModel(get(), get(), androidApplication()) }
viewModel { provideInstallViewModel(get(), get(), get(), get(), get(), get()) }
viewModel { provideConfigurationViewModel() }
viewModel { provideSettingsViewModel(get()) }
}
================================================
FILE: app/src/main/java/com/vanced/manager/domain/model/App.kt
================================================
package com.vanced.manager.domain.model
import androidx.annotation.DrawableRes
import com.vanced.manager.R
data class App(
val name: String,
@DrawableRes val iconResId: Int,
val changelog: String,
val remoteVersionCode: Int,
val remoteVersionName: String,
val installedVersionCode: Int?,
val installedVersionName: String?,
val packageName: String,
val launchActivity: String,
val state: AppState,
val app: AppType
)
object AppData {
const val NAME_VANCED_YOUTUBE = "YouTube Vanced"
const val NAME_VANCED_YOUTUBE_MUSIC = "YouTube Vanced Music"
const val NAME_VANCED_MICROG = "Vanced microG"
const val NAME_VANCED_MANAGER = "Vanced Manager"
const val ICON_VANCED_YOUTUBE = R.drawable.ic_vanced
const val ICON_VANCED_YOUTUBE_MUSIC = R.drawable.ic_music
const val ICON_VANCED_MICROG = R.drawable.ic_microg
const val ICON_VANCED_MANAGER = R.drawable.ic_manager
const val PACKAGE_VANCED_YOUTUBE = "com.vanced.android.youtube"
const val PACKAGE_VANCED_YOUTUBE_MUSIC = "com.vanced.android.youtube.apps.music"
const val PACKAGE_VANCED_MICROG = "com.mgoogle.android.gms"
const val PACKAGE_VANCED_MANAGER = "com.vanced.manager"
const val PACKAGE_ROOT_VANCED_YOUTUBE = "com.google.android.youtube"
const val PACKAGE_ROOT_VANCED_YOUTUBE_MUSIC = "com.google.android.youtube.apps.music"
const val LAUNCH_ACTIVITY_VANCED_YOUTUBE = "com.google.android.youtube.HomeActivity"
const val LAUNCH_ACTIVITY_VANCED_YOUTUBE_MUSIC =
"com.google.android.apps.youtube.music.activities.MusicActivity"
const val LAUNCH_ACTIVITY_VANCED_MICROG = "org.microg.gms.ui.SettingsActivity"
const val LAUNCH_ACTIVITY_VANCED_MANAGER = ""
}
enum class AppType {
VANCED_YOUTUBE,
VANCED_YOUTUBE_MUSIC,
VANCED_MICROG,
VANCED_MANAGER,
}
enum class AppState {
NOT_INSTALLED,
INSTALLED,
NEEDS_UPDATE
}
================================================
FILE: app/src/main/java/com/vanced/manager/domain/model/InstallationOption.kt
================================================
package com.vanced.manager.domain.model
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
sealed interface InstallationOption : Parcelable {
val titleId: Int
val items: List<InstallationOptionItem>
@Parcelize
data class MultiSelect(
override val titleId: Int,
override val items: List<InstallationOptionItem>,
val getOption: () -> Set<String>,
val addOption: (String) -> Unit,
val removeOption: (String) -> Unit
) : InstallationOption
@Parcelize
data class SingleSelect(
override val titleId: Int,
override val items: List<InstallationOptionItem>,
val getOption: () -> String,
val setOption: (String) -> Unit,
) : InstallationOption
}
@Parcelize
data class InstallationOptionItem(
val key: String,
val displayText: (key: String) -> String,
) : Parcelable
================================================
FILE: app/src/main/java/com/vanced/manager/downloader/api/MicrogAPI.kt
================================================
package com.vanced.manager.downloader.api
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.Streaming
interface MicrogAPI {
@GET("releases/latest/download/microg.apk")
@Streaming
fun getFile(): Call<ResponseBody>
}
================================================
FILE: app/src/main/java/com/vanced/manager/downloader/api/MusicAPI.kt
================================================
package com.vanced.manager.downloader.api
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Streaming
interface MusicAPI {
@GET("music/v{version}/{variant}.apk")
@Streaming
fun getFiles(
@Path("version") version: String,
@Path("variant") variant: String,
): Call<ResponseBody>
}
================================================
FILE: app/src/main/java/com/vanced/manager/downloader/api/VancedAPI.kt
================================================
package com.vanced.manager.downloader.api
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Streaming
interface VancedAPI {
@GET("apks/v{version}/{variant}/{type}/{apkName}")
@Streaming
fun getFiles(
@Path("version") version: String,
@Path("variant") variant: String,
@Path("type") type: String,
@Path("apkName") apkName: String,
): Call<ResponseBody>
}
================================================
FILE: app/src/main/java/com/vanced/manager/downloader/base/AppDownloader.kt
================================================
package com.vanced.manager.downloader.base
import com.vanced.manager.util.writeFile
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.awaitResponse
abstract class AppDownloader {
data class DownloadFile(
val fileName: String,
val call: Call<ResponseBody>,
)
sealed class DownloadStatus {
object Success : DownloadStatus()
data class Error(val error: String, val fileName: String) : DownloadStatus()
val isSuccess
get() = this is Success
val isError
get() = this is Error
}
abstract suspend fun download(
appVersions: List<String>?,
onProgress: (Float) -> Unit,
onFile: (String) -> Unit
): DownloadStatus
abstract suspend fun downloadRoot(
appVersions: List<String>?,
onProgress: (Float) -> Unit,
onFile: (String) -> Unit
): DownloadStatus
abstract fun getSavedFilePath(): String
suspend inline fun downloadFiles(
files: Array<DownloadFile>,
onProgress: (Float) -> Unit,
onFile: (String) -> Unit
): DownloadStatus {
for (file in files) {
try {
onFile(file.fileName)
val response = file.call.awaitResponse()
if (response.isSuccessful) {
response.body()?.writeFile(getSavedFilePath() + "/${file.fileName}", onProgress)
continue
}
val error = response.errorBody()?.toString()
if (error != null) {
return DownloadStatus.Error(error, file.fileName)
}
} catch (e: Exception) {
return DownloadStatus.Error(e.stackTraceToString(), file.fileName)
}
}
return DownloadStatus.Success
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/downloader/impl/MicrogDownloader.kt
================================================
package com.vanced.manager.downloader.impl
import android.content.Context
import com.vanced.manager.downloader.api.MicrogAPI
import com.vanced.manager.downloader.base.AppDownloader
import com.vanced.manager.downloader.util.getMicrogPath
import java.io.File
class MicrogDownloader(
private val microgAPI: MicrogAPI,
private val context: Context,
) : AppDownloader() {
override suspend fun download(
appVersions: List<String>?,
onProgress: (Float) -> Unit,
onFile: (String) -> Unit
): DownloadStatus {
val downloadStatus = downloadFiles(
files = arrayOf(
DownloadFile(
call = microgAPI.getFile(),
fileName = "microg.apk"
)
),
onProgress = onProgress,
onFile = onFile
)
if (downloadStatus.isError)
return downloadStatus
return DownloadStatus.Success
}
override suspend fun downloadRoot(
appVersions: List<String>?,
onProgress: (Float) -> Unit,
onFile: (String) -> Unit
): DownloadStatus {
throw IllegalAccessException("Vanced microG does not have a root downloader")
}
override fun getSavedFilePath(): String {
val directory = File(getMicrogPath(context))
if (!directory.exists())
directory.mkdirs()
return directory.path
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/downloader/impl/MusicDownloader.kt
================================================
package com.vanced.manager.downloader.impl
import android.content.Context
import com.vanced.manager.downloader.api.MusicAPI
import com.vanced.manager.downloader.base.AppDownloader
import com.vanced.manager.downloader.util.getVancedYoutubeMusicPath
import com.vanced.manager.preferences.holder.managerVariantPref
import com.vanced.manager.preferences.holder.musicVersionPref
import com.vanced.manager.util.getLatestOrProvidedAppVersion
import java.io.File
class MusicDownloader(
private val musicAPI: MusicAPI,
private val context: Context,
) : AppDownloader() {
private lateinit var absoluteVersion: String
override suspend fun download(
appVersions: List<String>?,
onProgress: (Float) -> Unit,
onFile: (String) -> Unit
): DownloadStatus {
absoluteVersion = getLatestOrProvidedAppVersion(musicVersionPref, appVersions)
val downloadStatus = downloadFiles(
files = arrayOf(
DownloadFile(
call = musicAPI.getFiles(
version = absoluteVersion,
variant = managerVariantPref,
),
fileName = "music.apk"
)
),
onProgress = onProgress,
onFile = onFile
)
if (downloadStatus.isError)
return downloadStatus
return DownloadStatus.Success
}
override suspend fun downloadRoot(
appVersions: List<String>?,
onProgress: (Float) -> Unit,
onFile: (String) -> Unit
): DownloadStatus {
return DownloadStatus.Success
}
override fun getSavedFilePath(): String {
val directory =
File(getVancedYoutubeMusicPath(absoluteVersion, managerVariantPref, context))
if (!directory.exists())
directory.mkdirs()
return directory.path
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/downloader/impl/VancedDownloader.kt
================================================
package com.vanced.manager.downloader.impl
import android.content.Context
import com.vanced.manager.downloader.api.VancedAPI
import com.vanced.manager.downloader.base.AppDownloader
import com.vanced.manager.downloader.util.getVancedYoutubePath
import com.vanced.manager.preferences.holder.managerVariantPref
import com.vanced.manager.preferences.holder.vancedLanguagesPref
import com.vanced.manager.preferences.holder.vancedThemePref
import com.vanced.manager.preferences.holder.vancedVersionPref
import com.vanced.manager.util.arch
import com.vanced.manager.util.getLatestOrProvidedAppVersion
import java.io.File
class VancedDownloader(
private val vancedAPI: VancedAPI,
private val context: Context,
) : AppDownloader() {
private lateinit var absoluteVersion: String
override suspend fun download(
appVersions: List<String>?,
onProgress: (Float) -> Unit,
onFile: (String) -> Unit
): DownloadStatus {
absoluteVersion = getLatestOrProvidedAppVersion(vancedVersionPref, appVersions)
val files = arrayOf(
getFile(
type = "Theme",
apkName = "$vancedThemePref.apk",
),
getFile(
type = "Arch",
apkName = "split_config.$arch.apk",
)
) + vancedLanguagesPref.map { language ->
getFile(
type = "Language",
apkName = "split_config.$language.apk",
)
}
val downloadStatus = downloadFiles(
files = files,
onProgress = onProgress,
onFile = onFile,
)
if (downloadStatus.isError)
return downloadStatus
return DownloadStatus.Success
}
override suspend fun downloadRoot(
appVersions: List<String>?,
onProgress: (Float) -> Unit,
onFile: (String) -> Unit
): DownloadStatus {
return DownloadStatus.Success
}
override fun getSavedFilePath(): String {
val directory = File(getVancedYoutubePath(absoluteVersion, managerVariantPref, context))
if (!directory.exists())
directory.mkdirs()
return directory.path
}
private fun getFile(
type: String,
apkName: String,
) = DownloadFile(
call = vancedAPI.getFiles(
version = absoluteVersion,
variant = managerVariantPref,
type = type,
apkName = apkName
),
fileName = apkName
)
}
================================================
FILE: app/src/main/java/com/vanced/manager/downloader/util/DownloadPath.kt
================================================
package com.vanced.manager.downloader.util
import android.content.Context
fun getVancedYoutubePath(
version: String,
variant: String,
context: Context
) = context.getExternalFilesDirPath("vanced_youtube") + "/$version/$variant"
fun getVancedYoutubeMusicPath(
version: String,
variant: String,
context: Context
) = context.getExternalFilesDirPath("vanced_music") + "/$version/$variant"
fun getMicrogPath(
context: Context
) = context.getExternalFilesDirPath("microg")
fun getStockYoutubePath(
version: String,
context: Context
) = context.getExternalFilesDirPath("stock_youtube") + "/$version"
fun getStockYoutubeMusicPath(
version: String,
context: Context
) = context.getExternalFilesDirPath("stock_youtube_music") + "/$version"
private fun Context.getExternalFilesDirPath(
type: String
): String {
val filesDir = getExternalFilesDir(type)!! //fuck null safety, amirite?
if (!filesDir.exists())
filesDir.mkdirs()
return filesDir.path
}
================================================
FILE: app/src/main/java/com/vanced/manager/installer/base/AppInstaller.kt
================================================
package com.vanced.manager.installer.base
import com.vanced.manager.repository.manager.PackageManagerResult
abstract class AppInstaller {
abstract suspend fun install(appVersions: List<String>?)
abstract suspend fun installRoot(appVersions: List<String>?): PackageManagerResult<Nothing>
}
================================================
FILE: app/src/main/java/com/vanced/manager/installer/impl/MicrogInstaller.kt
================================================
package com.vanced.manager.installer.impl
import android.content.Context
import com.vanced.manager.downloader.util.getMicrogPath
import com.vanced.manager.installer.base.AppInstaller
import com.vanced.manager.repository.manager.NonrootPackageManager
import com.vanced.manager.repository.manager.PackageManagerResult
import java.io.File
class MicrogInstaller(
private val context: Context,
private val nonrootPackageManager: NonrootPackageManager,
) : AppInstaller() {
override suspend fun install(appVersions: List<String>?) {
val musicApk = File(getMicrogPath(context), "microg.apk")
nonrootPackageManager.installApp(musicApk)
}
override suspend fun installRoot(appVersions: List<String>?): PackageManagerResult<Nothing> {
throw IllegalAccessException("Vanced microG does not have a root installer")
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/installer/impl/MusicInstaller.kt
================================================
package com.vanced.manager.installer.impl
import android.content.Context
import com.vanced.manager.domain.model.AppData
import com.vanced.manager.downloader.util.getStockYoutubeMusicPath
import com.vanced.manager.downloader.util.getVancedYoutubeMusicPath
import com.vanced.manager.installer.base.AppInstaller
import com.vanced.manager.installer.util.RootPatchHelper
import com.vanced.manager.preferences.holder.managerVariantPref
import com.vanced.manager.preferences.holder.musicVersionPref
import com.vanced.manager.preferences.holder.vancedVersionPref
import com.vanced.manager.repository.manager.NonrootPackageManager
import com.vanced.manager.repository.manager.PackageManagerResult
import com.vanced.manager.repository.manager.RootPackageManager
import com.vanced.manager.util.getLatestOrProvidedAppVersion
import java.io.File
class MusicInstaller(
private val context: Context,
private val rootPackageManager: RootPackageManager,
private val nonrootPackageManager: NonrootPackageManager,
) : AppInstaller() {
override suspend fun install(appVersions: List<String>?) {
val absoluteVersion = getLatestOrProvidedAppVersion(musicVersionPref, appVersions)
val musicApk = File(
getVancedYoutubeMusicPath(
absoluteVersion,
managerVariantPref,
context
) + "/music.apk"
)
nonrootPackageManager.installApp(musicApk)
}
override suspend fun installRoot(appVersions: List<String>?): PackageManagerResult<Nothing> {
val absoluteVersion = getLatestOrProvidedAppVersion(vancedVersionPref, appVersions)
val stock = File(getStockYoutubeMusicPath(absoluteVersion, context), "base.apk")
val vanced = File(getVancedYoutubeMusicPath(absoluteVersion, "root", context), "base.apk")
val prepareStock = RootPatchHelper.prepareStock(
stockPackage = AppData.PACKAGE_ROOT_VANCED_YOUTUBE_MUSIC,
stockVersion = absoluteVersion
) {
rootPackageManager.installApp(stock)
}
if (prepareStock.isError)
return prepareStock
val patchStock = RootPatchHelper.patchStock(
patchPath = vanced.absolutePath,
stockPackage = AppData.PACKAGE_ROOT_VANCED_YOUTUBE_MUSIC,
app = APP_KEY
)
if (patchStock.isError)
return patchStock
return PackageManagerResult.Success(null)
}
companion object {
const val APP_KEY = "youtube_music_vanced"
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/installer/impl/VancedInstaller.kt
================================================
package com.vanced.manager.installer.impl
import android.content.Context
import com.vanced.manager.domain.model.AppData
import com.vanced.manager.downloader.util.getStockYoutubePath
import com.vanced.manager.downloader.util.getVancedYoutubePath
import com.vanced.manager.installer.base.AppInstaller
import com.vanced.manager.installer.util.RootPatchHelper
import com.vanced.manager.preferences.holder.vancedVersionPref
import com.vanced.manager.repository.manager.NonrootPackageManager
import com.vanced.manager.repository.manager.PackageManagerResult
import com.vanced.manager.repository.manager.RootPackageManager
import com.vanced.manager.util.getLatestOrProvidedAppVersion
import java.io.File
class VancedInstaller(
private val context: Context,
private val rootPackageManager: RootPackageManager,
private val nonrootPackageManager: NonrootPackageManager,
) : AppInstaller() {
override suspend fun install(appVersions: List<String>?) {
val absoluteVersion = getLatestOrProvidedAppVersion(vancedVersionPref, appVersions)
val apks = File(getVancedYoutubePath(absoluteVersion, "nonroot", context))
.listFiles()
nonrootPackageManager.installSplitApp(apks!!)
}
override suspend fun installRoot(appVersions: List<String>?): PackageManagerResult<Nothing> {
val absoluteVersion = getLatestOrProvidedAppVersion(vancedVersionPref, appVersions)
val stockApks = File(getStockYoutubePath(absoluteVersion, context))
.listFiles()
val vancedBaseApk = getVancedYoutubePath(absoluteVersion, "root", context) + "/base.apk"
val prepareStock = RootPatchHelper.prepareStock(
stockPackage = AppData.PACKAGE_ROOT_VANCED_YOUTUBE,
stockVersion = absoluteVersion,
) {
rootPackageManager.installSplitApp(stockApks!!)
}
if (prepareStock.isError)
return prepareStock
val patchStock = RootPatchHelper.patchStock(
patchPath = vancedBaseApk,
stockPackage = AppData.PACKAGE_ROOT_VANCED_YOUTUBE,
app = APP_KEY
)
if (patchStock.isError)
return patchStock
return PackageManagerResult.Success(null)
}
companion object {
const val APP_KEY = "youtube_vanced"
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/installer/service/AppInstallService.kt
================================================
package com.vanced.manager.installer.service
import android.app.Service
import android.content.Intent
import android.content.pm.PackageInstaller
import android.os.IBinder
class AppInstallService : Service() {
override fun onStartCommand(
intent: Intent,
flags: Int,
startId: Int
): Int {
val extraStatus = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)
val extraStatusMessage = intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE)
when (extraStatus) {
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
startActivity(
intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT).apply {
this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
)
}
else -> {
sendBroadcast(Intent().apply {
action = APP_INSTALL_ACTION
putExtra(EXTRA_INSTALL_STATUS, extraStatus)
putExtra(EXTRA_INSTALL_STATUS_MESSAGE, extraStatusMessage)
})
}
}
stopSelf()
return START_NOT_STICKY
}
override fun onBind(intent: Intent?): IBinder? = null
companion object {
const val APP_INSTALL_ACTION = "APP_INSTALL_ACTION"
const val EXTRA_INSTALL_STATUS = "EXTRA_INSTALL_STATUS"
const val EXTRA_INSTALL_STATUS_MESSAGE = "EXTRA_INSTALL_STATUS_MESSAGE"
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/installer/service/AppUninstallService.kt
================================================
package com.vanced.manager.installer.service
import android.app.Service
import android.content.Intent
import android.content.pm.PackageInstaller
import android.os.IBinder
class AppUninstallService : Service() {
override fun onStartCommand(
intent: Intent,
flags: Int,
startId: Int
): Int {
when (intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) {
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
startActivity(
intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT).apply {
this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
)
}
else -> {
sendBroadcast(Intent().apply {
action = APP_UNINSTALL_ACTION
})
}
}
stopSelf()
return START_NOT_STICKY
}
override fun onBind(intent: Intent?): IBinder? = null
companion object {
const val APP_UNINSTALL_ACTION = "APP_UNINSTALL_ACTION"
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/installer/util/PM.kt
================================================
package com.vanced.manager.installer.util
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.PackageInstaller
import android.content.pm.PackageManager
import android.os.Build
import com.vanced.manager.installer.service.AppInstallService
import com.vanced.manager.installer.service.AppUninstallService
import java.io.File
private const val byteArraySize = 1024 * 1024 // Because 1,048,576 is not readable
object PM {
fun installApp(apk: File, context: Context) {
val packageInstaller = context.packageManager.packageInstaller
val session =
packageInstaller.openSession(packageInstaller.createSession(sessionParams))
session.writeApk(apk)
session.commit(context.installIntentSender)
session.close()
}
fun installSplitApp(apks: Array<File>, context: Context) {
val packageInstaller = context.packageManager.packageInstaller
val session =
packageInstaller.openSession(packageInstaller.createSession(sessionParams))
for (apk in apks) {
session.writeApk(apk)
}
session.commit(context.installIntentSender)
session.close()
}
fun uninstallPackage(pkg: String, context: Context) {
val packageInstaller = context.packageManager.packageInstaller
packageInstaller.uninstall(pkg, context.uninstallIntentSender)
}
}
private fun PackageInstaller.Session.writeApk(apk: File) {
apk.inputStream().use { inputStream ->
openWrite(apk.name, 0, apk.length()).use { outputStream ->
inputStream.copyTo(outputStream, byteArraySize)
fsync(outputStream)
}
}
}
private val intentFlags
get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
PendingIntent.FLAG_MUTABLE
else
0
private val sessionParams
get() = PackageInstaller.SessionParams(
PackageInstaller.SessionParams.MODE_FULL_INSTALL
).apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setInstallReason(PackageManager.INSTALL_REASON_USER)
}
}
private val Context.installIntentSender
get() = PendingIntent.getService(
this,
0,
Intent(this, AppInstallService::class.java),
intentFlags
).intentSender
private val Context.uninstallIntentSender
get() = PendingIntent.getService(
this,
0,
Intent(this, AppUninstallService::class.java),
intentFlags
).intentSender
================================================
FILE: app/src/main/java/com/vanced/manager/installer/util/PMRoot.kt
================================================
package com.vanced.manager.installer.util
import com.topjohnwu.superuser.Shell
import com.topjohnwu.superuser.io.SuFile
import com.topjohnwu.superuser.io.SuFileOutputStream
import com.vanced.manager.repository.manager.PackageManagerResult
import com.vanced.manager.repository.manager.PackageManagerError
import com.vanced.manager.repository.manager.getEnumForInstallFailed
import com.vanced.manager.util.errString
import com.vanced.manager.util.outString
import java.io.File
import java.io.IOException
object PMRoot {
fun installApp(apkPath: String): PackageManagerResult<Nothing> {
val apk = File(apkPath)
val tmpApk = copyApkToTemp(apk).getOrElse { exception ->
return PackageManagerResult.Error(
PackageManagerError.SESSION_FAILED_COPY,
exception.stackTraceToString()
)
}
val install = Shell.su("pm", "install", "-r", tmpApk.absolutePath).exec()
tmpApk.delete()
if (!install.isSuccess) {
val errString = install.errString
return PackageManagerResult.Error(getEnumForInstallFailed(errString), errString)
}
return PackageManagerResult.Success(null)
}
fun installSplitApp(apkPaths: List<String>): PackageManagerResult<Nothing> {
val installCreate = Shell.su("pm", "install-create", "-r").exec()
if (!installCreate.isSuccess)
return PackageManagerResult.Error(PackageManagerError.SESSION_FAILED_CREATE, installCreate.errString)
val sessionId = installCreate.outString
if (sessionId.toIntOrNull() == null)
return PackageManagerResult.Error(PackageManagerError.SESSION_INVALID_ID, installCreate.errString)
for (apkPath in apkPaths) {
val apk = File(apkPath)
val tmpApk = copyApkToTemp(apk).getOrElse { exception ->
return PackageManagerResult.Error(
PackageManagerError.SESSION_FAILED_COPY,
exception.stackTraceToString()
)
}
val installWrite =
Shell.su("pm", "install-write", sessionId, tmpApk.name, tmpApk.absolutePath)
.exec()
tmpApk.delete()
if (!installWrite.isSuccess)
return PackageManagerResult.Error(PackageManagerError.SESSION_FAILED_WRITE, installWrite.errString)
}
val installCommit = Shell.su("pm", "install-commit", sessionId).exec()
if (!installCommit.isSuccess) {
val errString = installCommit.errString
return PackageManagerResult.Error(getEnumForInstallFailed(errString), errString)
}
return PackageManagerResult.Success(null)
}
fun uninstallApp(pkg: String): PackageManagerResult<Nothing> {
val uninstall = Shell.su("pm", "uninstall", pkg).exec()
if (!uninstall.isSuccess)
return PackageManagerResult.Error(PackageManagerError.UNINSTALL_FAILED, uninstall.errString)
return PackageManagerResult.Success(null)
}
fun setInstallerPackage(targetPkg: String, installerPkg: String): PackageManagerResult<Nothing> {
val setInstaller = Shell.su("pm", "set-installer", targetPkg, installerPkg)
.exec()
if (!setInstaller.isSuccess)
return PackageManagerResult.Error(
PackageManagerError.SET_FAILED_INSTALLER,
setInstaller.errString
)
return PackageManagerResult.Success(null)
}
fun forceStopApp(pkg: String): PackageManagerResult<Nothing> {
val stopApp = Shell.su("am", "force-stop", pkg).exec()
if (!stopApp.isSuccess)
return PackageManagerResult.Error(PackageManagerError.APP_FAILED_FORCE_STOP, stopApp.errString)
return PackageManagerResult.Success(null)
}
fun getPackageVersionName(pkg: String): PackageManagerResult<String> {
val keyword = "versionName="
val dumpsys = Shell.su("dumpsys", "package", pkg, "|", "grep", keyword).exec()
if (!dumpsys.isSuccess)
return PackageManagerResult.Error(
PackageManagerError.GET_FAILED_PACKAGE_VERSION_NAME,
dumpsys.errString
)
return PackageManagerResult.Success(dumpsys.outString.removePrefix(keyword))
}
fun getPackageVersionCode(pkg: String): PackageManagerResult<Long> {
val keyword = "versionCode="
val dumpsys = Shell.su("dumpsys", "package", pkg, "|", "grep", keyword).exec()
if (!dumpsys.isSuccess)
return PackageManagerResult.Error(
PackageManagerError.GET_FAILED_PACKAGE_VERSION_CODE,
dumpsys.errString
)
return PackageManagerResult.Success(
dumpsys.outString.removePrefix(keyword).substringAfter("minSdk")
.toLong()
)
}
fun getPackageDir(pkg: String): PackageManagerResult<String> {
val keyword = "path: "
val dumpsys = Shell.su("dumpsys", "package", pkg, "|", "grep", keyword).exec()
if (!dumpsys.isSuccess)
return PackageManagerResult.Error(PackageManagerError.GET_FAILED_PACKAGE_DIR, dumpsys.errString)
return PackageManagerResult.Success(dumpsys.outString.removePrefix(keyword))
}
}
private fun copyApkToTemp(apk: File): Result<SuFile> {
val tmpPath = "/data/local/tmp/${apk.name}"
val tmpApk = SuFile(tmpPath).apply {
createNewFile()
}
try {
SuFileOutputStream.open(tmpApk).use {
it.write(apk.readBytes())
it.flush()
}
} catch (e: IOException) {
return Result.failure(e)
}
return Result.success(tmpApk)
}
================================================
FILE: app/src/main/java/com/vanced/manager/installer/util/PMRootResult.kt
================================================
package com.vanced.manager.installer.util
enum class PMRootStatus {
ACTION_FAILED_SET_INSTALLER,
ACTION_FAILED_GET_PACKAGE_DIR,
ACTION_FAILED_GET_PACKAGE_VERSION_NAME,
ACTION_FAILED_GET_PACKAGE_VERSION_CODE,
ACTION_FAILED_FORCE_STOP_APP,
INSTALL_SUCCESSFUL,
INSTALL_FAILED_ABORTED,
INSTALL_FAILED_ALREADY_EXISTS,
INSTALL_FAILED_CPU_ABI_INCOMPATIBLE,
INSTALL_FAILED_INSUFFICIENT_STORAGE,
INSTALL_FAILED_INVALID_APK,
INSTALL_FAILED_VERSION_DOWNGRADE,
INSTALL_FAILED_PARSE_NO_CERTIFICATES,
INSTALL_FAILED_UNKNOWN,
LINK_FAILED_UNMOUNT,
LINK_FAILED_MOUNT,
PATCH_FAILED_COPY,
PATCH_FAILED_CHMOD,
PATCH_FAILED_CHOWN,
PATCH_FAILED_CHCON,
PATCH_FAILED_DESTROY,
SESSION_FAILED_CREATE,
SESSION_FAILED_WRITE,
SESSION_FAILED_COPY,
SESSION_INVALID_ID,
SCRIPT_FAILED_SETUP_POST_FS,
SCRIPT_FAILED_SETUP_SERVICE_D,
SCRIPT_FAILED_DESTROY_POST_FS,
SCRIPT_FAILED_DESTROY_SERVICE_D,
UNINSTALL_SUCCESSFUL,
UNINSTALL_FAILED,
}
sealed class PMRootResult<out V> {
data class Success<out V>(val value: V? = null) : PMRootResult<V>()
data class Error(val error: PMRootStatus, val message: String) : PMRootResult<Nothing>()
val isError
get() = this is Error
val isSuccess
get() = this is Success
}
inline fun <R, T : R> PMRootResult<T>.getOrElse(onError: (PMRootResult.Error) -> R): R? {
return when (this) {
is PMRootResult.Error -> onError(this)
is PMRootResult.Success -> return this.value
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/installer/util/Patcher.kt
================================================
package com.vanced.manager.installer.util
import com.topjohnwu.superuser.Shell
import com.topjohnwu.superuser.io.SuFile
import com.topjohnwu.superuser.io.SuFileOutputStream
import com.vanced.manager.io.ManagerSuFile
import com.vanced.manager.io.SUIOException
import com.vanced.manager.repository.manager.PackageManagerResult
import com.vanced.manager.repository.manager.PackageManagerError
import com.vanced.manager.util.errString
import java.io.File
import java.io.IOException
object Patcher {
fun setupScript(
app: String,
stockPackage: String,
stockPath: String,
): PackageManagerResult<Nothing> {
val postFsDataScriptPath = getAppPostFsScriptPath(app)
val serviceDScriptPath = getAppServiceDScriptPath(app)
val postFsDataScript = getPostFsDataScript(stockPackage)
val serviceDScript = getServiceDScript(getAppPatchPath(app), stockPath)
val copyServiceDScript = copyScriptToDestination(postFsDataScript, postFsDataScriptPath)
if (copyServiceDScript.isFailure)
return PackageManagerResult.Error(
PackageManagerError.SCRIPT_FAILED_SETUP_POST_FS,
copyServiceDScript.exceptionOrNull()!!.stackTraceToString()
)
val copyPostFsDataScript = copyScriptToDestination(serviceDScript, serviceDScriptPath)
if (copyPostFsDataScript.isFailure)
return PackageManagerResult.Error(
PackageManagerError.SCRIPT_FAILED_SETUP_SERVICE_D,
copyPostFsDataScript.exceptionOrNull()!!.stackTraceToString()
)
return PackageManagerResult.Success(null)
}
fun movePatchToDataAdb(patchPath: String, app: String): PackageManagerResult<Nothing> {
val newPatchPath = getAppPatchPath(app)
val patchApk = File(patchPath)
val newPatchApk = SuFile(newPatchPath).apply {
if (exists())
delete()
createNewFile()
}
try {
patchApk.copyTo(newPatchApk)
} catch (e: IOException) {
return PackageManagerResult.Error(PackageManagerError.PATCH_FAILED_COPY, e.stackTraceToString())
}
val chmod = Shell.su("chmod", "644", newPatchPath).exec()
if (!chmod.isSuccess)
return PackageManagerResult.Error(PackageManagerError.PATCH_FAILED_CHMOD, chmod.errString)
val chown = Shell.su("chown", "system:system", newPatchPath).exec()
if (!chmod.isSuccess)
return PackageManagerResult.Error(PackageManagerError.PATCH_FAILED_CHOWN, chown.errString)
return PackageManagerResult.Success(null)
}
fun chconPatch(app: String): PackageManagerResult<Nothing> {
val chcon = Shell.su("chcon u:object_r:apk_data_file:s0 ${getAppPatchPath(app)}").exec()
if (!chcon.isSuccess)
return PackageManagerResult.Error(PackageManagerError.PATCH_FAILED_CHCON, chcon.errString)
return PackageManagerResult.Success(null)
}
fun linkPatch(app: String, stockPackage: String, stockPath: String): PackageManagerResult<Nothing> {
val umount =
Shell.su("""for i in ${'$'}(ls /data/app/ | grep $stockPackage | tr " "); do umount -l "/data/app/${"$"}i/base.apk"; done """)
.exec()
if (!umount.isSuccess)
return PackageManagerResult.Error(PackageManagerError.LINK_FAILED_UNMOUNT, umount.errString)
val mount =
Shell.su("su", "-mm", "-c", """"mount -o bind ${getAppPatchPath(app)} $stockPath"""")
.exec()
if (!mount.isSuccess)
return PackageManagerResult.Error(PackageManagerError.LINK_FAILED_MOUNT, mount.errString)
return PackageManagerResult.Success(null)
}
fun destroyPatch(app: String) =
cleanPatchFiles(
postFsPath = getAppPostFsScriptPath(app),
serviceDPath = getAppServiceDScriptPath(app),
patchPath = getAppPatchPath(app)
)
//TODO
fun destroyOldPatch(app: String) =
cleanPatchFiles(
postFsPath = "",
serviceDPath = "",
patchPath = ""
)
}
private fun getAppPatchPath(app: String) = "${getAppPatchFolderPath(app)}/base.apk"
private fun getAppPatchFolderPath(app: String) = "/data/adb/vanced_manager/$app"
private fun getAppPostFsScriptPath(app: String) = "/data/adb/post-fs-data.d/$app.sh"
private fun getAppServiceDScriptPath(app: String) = "/data/adb/service.d/$app.sh"
//TODO support dynamic sleep timer
private fun getServiceDScript(patchPath: String, stockPath: String) =
"""
#!/system/bin/sh
while [ "${'$'}(getprop sys.boot_completed | tr -d '\r')" != "1" ]; do sleep 1; done
sleep 1
chcon u:object_r:apk_data_file:s0 $patchPath
mount -o bind $patchPath $stockPath
""".trimIndent()
private fun getPostFsDataScript(stockPackage: String) =
"""
#!/system/bin/sh
while read line; do echo \${'$'}{line} | grep $stockPackage | awk '{print \${'$'}2}' | xargs umount -l; done< /proc/mounts
""".trimIndent()
private fun cleanPatchFiles(
postFsPath: String,
serviceDPath: String,
patchPath: String,
): PackageManagerResult<Nothing> {
val files = mapOf(
postFsPath to PackageManagerError.SCRIPT_FAILED_DESTROY_POST_FS,
serviceDPath to PackageManagerError.SCRIPT_FAILED_DESTROY_SERVICE_D,
patchPath to PackageManagerError.PATCH_FAILED_DESTROY,
)
for ((filePath, errorStatusType) in files) {
try {
with(ManagerSuFile(filePath)) {
if (exists()) delete()
}
} catch (e: SUIOException) {
return PackageManagerResult.Error(errorStatusType, e.stackTraceToString())
}
}
return PackageManagerResult.Success(null)
}
private fun copyScriptToDestination(
script: String,
destination: String,
): Result<Nothing?> {
val scriptFile = SuFile(destination)
.apply {
if (!exists()) createNewFile()
}
try {
SuFileOutputStream.open(scriptFile).use {
it.write(script.toByteArray())
it.flush()
}
val chmod = Shell.su("chmod", "744", scriptFile.absolutePath).exec()
if (!chmod.isSuccess) {
return Result.failure(Exception(chmod.errString))
}
} catch (e: IOException) {
return Result.failure(e)
}
return Result.success(null)
}
================================================
FILE: app/src/main/java/com/vanced/manager/installer/util/RootPatchHelper.kt
================================================
package com.vanced.manager.installer.util
import com.vanced.manager.repository.manager.PackageManagerResult
import com.vanced.manager.repository.manager.getOrElse
object RootPatchHelper {
fun cleanPatches(app: String): PackageManagerResult<Nothing> {
val cleanOldPatches = Patcher.destroyOldPatch(app)
if (cleanOldPatches.isError)
return cleanOldPatches
val cleanPatches = Patcher.destroyPatch(app)
if (cleanOldPatches.isError)
return cleanPatches
return PackageManagerResult.Success(null)
}
inline fun prepareStock(
stockPackage: String,
stockVersion: String,
install: () -> PackageManagerResult<Nothing>
): PackageManagerResult<Nothing> {
val stockYoutubeVersion = PMRoot.getPackageVersionName(stockPackage)
.getOrElse { null }
if (stockYoutubeVersion != stockVersion) {
val uninstallStock = PMRoot.uninstallApp(stockPackage)
if (uninstallStock.isError)
return uninstallStock
val installStock = install()
if (installStock.isError)
return installStock
}
return PackageManagerResult.Success(null)
}
fun patchStock(
patchPath: String,
stockPackage: String,
app: String
): PackageManagerResult<Nothing> {
val movePatch = Patcher.movePatchToDataAdb(patchPath, app)
if (movePatch.isError)
return movePatch
val chconPatch = Patcher.chconPatch(app)
if (chconPatch.isError)
return chconPatch
val stockPackageDir = PMRoot.getPackageDir(stockPackage)
.getOrElse { error -> return error }!!
val setupScript = Patcher.setupScript(app, stockPackage, stockPackageDir)
if (setupScript is PackageManagerResult.Error)
return setupScript
val linkPatch = Patcher.linkPatch(app, stockPackage, stockPackageDir)
if (linkPatch is PackageManagerResult.Error)
return linkPatch
return PackageManagerResult.Success(null)
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/io/ManagerSuFile.kt
================================================
package com.vanced.manager.io
import com.topjohnwu.superuser.Shell
import com.topjohnwu.superuser.io.SuFile
import com.vanced.manager.util.errString
import com.vanced.manager.util.outString
import java.io.File
class ManagerSuFile : SuFile {
sealed class SuFileResult {
data class Success(val output: String) : SuFileResult()
data class Error(val error: String) : SuFileResult()
}
constructor(pathName: String) : super(pathName)
constructor(parent: String, child: String) : super(parent, child)
constructor(parent: File, child: String) : super(parent, child)
private fun cmd(input: String): SuFileResult {
val cmd = Shell.su(input.replace("@@", escapedPath)).exec()
if (!cmd.isSuccess)
return SuFileResult.Error(cmd.errString)
return SuFileResult.Success(cmd.outString)
}
override fun delete(): Boolean {
val result = cmd("rm -f @@ || rmdir -f @@")
if (result is SuFileResult.Error)
throw SUIOException(result.error)
return true
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/io/SUIOException.kt
================================================
package com.vanced.manager.io
import java.io.IOException
class SUIOException : IOException {
constructor(message: String) : super(message)
constructor(message: String, cause: Throwable) : super(message, cause)
constructor(cause: Throwable) : super(cause)
}
================================================
FILE: app/src/main/java/com/vanced/manager/network/GithubService.kt
================================================
package com.vanced.manager.network
import com.vanced.manager.network.dto.GithubReleaseDto
import retrofit2.http.GET
private const val REPOS_VANCED = "repos/YTVanced"
interface GithubService {
@GET("$REPOS_VANCED/Vanced/releases/latest")
suspend fun getVancedYoutubeRelease(): GithubReleaseDto
@GET("$REPOS_VANCED/VancedMusic/releases/latest")
suspend fun getVancedYoutubeMusicRelease(): GithubReleaseDto
@GET("$REPOS_VANCED/VancedMicrog/releases/latest")
suspend fun getVancedMicrogRelease(): GithubReleaseDto
@GET("$REPOS_VANCED/VancedManager/releases/latest")
suspend fun getVancedManagerRelease(): GithubReleaseDto
}
================================================
FILE: app/src/main/java/com/vanced/manager/network/dto/GithubDto.kt
================================================
package com.vanced.manager.network.dto
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class GithubReleaseDto(
@SerialName("tag_name")
val tagName: String,
@SerialName("body")
val body: String,
@SerialName("assets")
val assets: List<GithubReleaseAssetDto>
)
@Serializable
data class GithubReleaseAssetDto(
@SerialName("name")
val name: String,
@SerialName("browser_download_url")
val browserDownloadUrl: String
)
================================================
FILE: app/src/main/java/com/vanced/manager/network/util/Constants.kt
================================================
package com.vanced.manager.network.util
const val BASE = "https://api.vancedapp.com/api/v1/"
const val GITHUB_API_BASE = "https://api.github.com/"
const val VANCED_NAME = "YouTube Vanced"
const val MUSIC_NAME = "YouTube Vanced Music"
const val MICROG_NAME = "Vanced microG"
const val URL_SPONSOR_BRAVE = "https://vancedapp.com/brave"
const val URL_SPONSOR_ADGUARD = "https://adguard.com/?aid=31141&source=manager"
const val URL_MEDIA_INSTAGRAM = "https://instagram.com/vanced.youtube"
const val URL_MEDIA_YOUTUBE = "https://youtube.com/c/YouTubeVanced"
const val URL_MEDIA_GITHUB = "https://github.com/YTVanced/VancedManager"
const val URL_MEDIA_WEBSITE = "https://vancedapp.com"
const val URL_MEDIA_TELEGRAM = "https://t.me/joinchat/AAAAAEHf-pi4jH1SDlAL4w"
const val URL_MEDIA_TWITTER = "https://twitter.com/YTVanced"
const val URL_MEDIA_DISCORD = "https://discord.gg/WCGNdRruzb"
const val URL_MEDIA_REDDIT = "https://www.reddit.com/r/Vanced/"
================================================
FILE: app/src/main/java/com/vanced/manager/preferences/ManagerPreference.kt
================================================
package com.vanced.manager.preferences
import android.content.SharedPreferences
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.core.content.edit
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
import kotlin.reflect.KProperty
fun managerStringPreference(
key: String,
defaultValue: String = ""
) = ManagerPreference(
key = key,
defaultValue = defaultValue,
getter = SharedPreferences::getString,
setter = SharedPreferences.Editor::putString
)
fun managerStringSetPreference(
key: String,
defaultValue: Set<String> = setOf()
) = ManagerPreference(
key = key,
defaultValue = defaultValue,
getter = SharedPreferences::getStringSet,
setter = SharedPreferences.Editor::putStringSet
)
fun managerBooleanPreference(
key: String,
defaultValue: Boolean = false
) = ManagerPreference(
key = key,
defaultValue = defaultValue,
getter = SharedPreferences::getBoolean,
setter = SharedPreferences.Editor::putBoolean
)
fun managerIntPreference(
key: String,
defaultValue: Int = 0
) = ManagerPreference(
key = key,
defaultValue = defaultValue,
getter = SharedPreferences::getInt,
setter = SharedPreferences.Editor::putInt
)
fun managerLongPreference(
key: String,
defaultValue: Long = 0
) = ManagerPreference(
key = key,
defaultValue = defaultValue,
getter = SharedPreferences::getLong,
setter = SharedPreferences.Editor::putLong
)
class ManagerPreference<T>(
private val key: String,
private val defaultValue: T,
private val getter: SharedPreferences.(key: String, defaultValue: T) -> T?,
private val setter: SharedPreferences.Editor.(key: String, newValue: T) -> Unit
) : KoinComponent {
private val sharedPreferences: SharedPreferences by inject()
var value by mutableStateOf(sharedPreferences.getter(key, defaultValue) ?: defaultValue)
private set
operator fun getValue(
thisRef: Any?,
property: KProperty<*>
) = value
operator fun setValue(
thisRef: Any?,
property: KProperty<*>,
newValue: T
) {
value = newValue
sharedPreferences.edit {
setter(key, newValue)
}
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/preferences/holder/PreferenceDefaultValueHolder.kt
================================================
package com.vanced.manager.preferences.holder
const val MANAGER_VARIANT_DEFAULT_VALUE = "nonroot"
const val MANAGER_THEME_DEFAULT_VALUE = "System Default"
const val VANCED_THEME_DEFAULT_VALUE = "dark"
val VANCED_LANGUAGE_DEFAULT_VALUE = setOf("en")
const val APP_VERSION_DEFAULT_VALUE = "latest"
const val APP_ENABLED_DEFAULT_VALUE = true
================================================
FILE: app/src/main/java/com/vanced/manager/preferences/holder/PreferenceHolder.kt
================================================
package com.vanced.manager.preferences.holder
import com.vanced.manager.preferences.managerStringPreference
import com.vanced.manager.preferences.managerStringSetPreference
var managerVariantPref by managerStringPreference(
MANAGER_VARIANT_KEY,
MANAGER_VARIANT_DEFAULT_VALUE
)
var vancedThemePref by managerStringPreference(APP_VANCED_THEME_KEY, VANCED_THEME_DEFAULT_VALUE)
var vancedVersionPref by managerStringPreference(APP_VANCED_VERSION_KEY, APP_VERSION_DEFAULT_VALUE)
var vancedLanguagesPref by managerStringSetPreference(
APP_VANCED_LANGUAGE_KEY,
VANCED_LANGUAGE_DEFAULT_VALUE
)
var musicVersionPref by managerStringPreference(APP_MUSIC_VERSION_KEY, APP_VERSION_DEFAULT_VALUE)
================================================
FILE: app/src/main/java/com/vanced/manager/preferences/holder/PreferenceKeyHolder.kt
================================================
package com.vanced.manager.preferences.holder
const val USE_CUSTOM_TABS_KEY = "use_custom_tabs"
const val MANAGER_VARIANT_KEY = "manager_variant"
const val MANAGER_THEME_KEY = "manager_theme"
const val MANAGER_ACCENT_COLOR_KEY = "manager_accent_color"
const val APP_VANCED_THEME_KEY = "app_vanced_theme"
const val APP_VANCED_VERSION_KEY = "app_vanced_version"
const val APP_VANCED_LANGUAGE_KEY = "app_vanced_language"
const val APP_MUSIC_VERSION_KEY = "app_music_version"
const val VANCED_ENABLED_KEY = "manager_vanced_enabled"
const val MUSIC_ENABLED_KEY = "manager_music_enabled"
================================================
FILE: app/src/main/java/com/vanced/manager/repository/AppRepository.kt
================================================
package com.vanced.manager.repository
import com.vanced.manager.domain.model.App
import com.vanced.manager.domain.model.AppData
import com.vanced.manager.domain.model.AppState
import com.vanced.manager.domain.model.AppType
import com.vanced.manager.network.GithubService
import com.vanced.manager.network.dto.GithubReleaseDto
import com.vanced.manager.repository.manager.NonrootPackageManager
import com.vanced.manager.repository.manager.PackageManager
import com.vanced.manager.repository.manager.RootPackageManager
interface AppRepository {
suspend fun getVancedYoutubeNonroot(): App
suspend fun getVancedYoutubeRoot(): App
suspend fun getVancedYoutubeMusicNonroot(): App
suspend fun getVancedYoutubeMusicRoot(): App
suspend fun getVancedMicrog(): App
suspend fun getVancedManager(): App
}
class AppRepositoryImpl(
private val githubService: GithubService,
private val nonrootPackageManager: NonrootPackageManager,
private val rootPackageManager: RootPackageManager,
) : AppRepository {
override suspend fun getVancedYoutubeNonroot(): App {
val githubRelease = githubService.getVancedYoutubeRelease()
val remoteVersionCode = githubRelease.getVersionCode()
val remoteVersionName = githubRelease.getVersionName()
val installedVersionCode =
nonrootPackageManager.getVersionCode(AppData.PACKAGE_VANCED_YOUTUBE).getValueOrNull()
val installedVersionName =
nonrootPackageManager.getVersionName(AppData.PACKAGE_VANCED_YOUTUBE).getValueOrNull()
return App(
name = AppData.NAME_VANCED_YOUTUBE,
iconResId = AppData.ICON_VANCED_YOUTUBE,
changelog = githubRelease.body,
remoteVersionCode = remoteVersionCode,
remoteVersionName = remoteVersionName,
installedVersionCode = installedVersionCode,
installedVersionName = installedVersionName,
packageName = AppData.PACKAGE_VANCED_YOUTUBE,
launchActivity = AppData.LAUNCH_ACTIVITY_VANCED_YOUTUBE,
state = getNoonrotAppState(installedVersionCode, remoteVersionCode),
app = AppType.VANCED_YOUTUBE,
)
}
override suspend fun getVancedYoutubeRoot(): App {
val githubRelease = githubService.getVancedYoutubeRelease()
val remoteVersionCode = githubRelease.getVersionCode()
val remoteVersionName = githubRelease.getVersionName()
val installedVersionCode =
rootPackageManager.getVersionCode(AppData.PACKAGE_ROOT_VANCED_YOUTUBE).getValueOrNull()
val installedVersionName =
rootPackageManager.getVersionName(AppData.PACKAGE_ROOT_VANCED_YOUTUBE).getValueOrNull()
return App(
name = AppData.NAME_VANCED_YOUTUBE,
iconResId = AppData.ICON_VANCED_YOUTUBE,
changelog = githubRelease.body,
remoteVersionCode = remoteVersionCode,
remoteVersionName = remoteVersionName,
installedVersionCode = installedVersionCode,
installedVersionName = installedVersionName,
packageName = AppData.PACKAGE_VANCED_YOUTUBE,
launchActivity = AppData.LAUNCH_ACTIVITY_VANCED_YOUTUBE,
state = getNoonrotAppState(installedVersionCode, remoteVersionCode),
app = AppType.VANCED_YOUTUBE,
)
}
override suspend fun getVancedYoutubeMusicNonroot(): App {
val githubRelease = githubService.getVancedYoutubeMusicRelease()
val remoteVersionCode = githubRelease.getVersionCode()
val remoteVersionName = githubRelease.getVersionName()
val installedVersionCode =
nonrootPackageManager.getVersionCode(AppData.PACKAGE_VANCED_YOUTUBE_MUSIC).getValueOrNull()
val installedVersionName =
nonrootPackageManager.getVersionName(AppData.PACKAGE_VANCED_YOUTUBE_MUSIC).getValueOrNull()
return App(
name = AppData.NAME_VANCED_YOUTUBE_MUSIC,
iconResId = AppData.ICON_VANCED_YOUTUBE_MUSIC,
changelog = githubRelease.body,
remoteVersionCode = remoteVersionCode,
remoteVersionName = remoteVersionName,
installedVersionCode = installedVersionCode,
installedVersionName = installedVersionName,
packageName = AppData.PACKAGE_VANCED_YOUTUBE_MUSIC,
launchActivity = AppData.LAUNCH_ACTIVITY_VANCED_YOUTUBE_MUSIC,
state = getNoonrotAppState(installedVersionCode, remoteVersionCode),
app = AppType.VANCED_YOUTUBE_MUSIC,
)
}
override suspend fun getVancedYoutubeMusicRoot(): App {
val githubRelease = githubService.getVancedYoutubeMusicRelease()
val remoteVersionCode = githubRelease.getVersionCode()
val remoteVersionName = githubRelease.getVersionName()
val installedVersionCode =
rootPackageManager.getVersionCode(AppData.PACKAGE_ROOT_VANCED_YOUTUBE_MUSIC).getValueOrNull()
val installedVersionName =
rootPackageManager.getVersionName(AppData.PACKAGE_ROOT_VANCED_YOUTUBE_MUSIC).getValueOrNull()
return App(
name = AppData.NAME_VANCED_YOUTUBE_MUSIC,
iconResId = AppData.ICON_VANCED_YOUTUBE_MUSIC,
changelog = githubRelease.body,
remoteVersionCode = remoteVersionCode,
remoteVersionName = remoteVersionName,
installedVersionCode = installedVersionCode,
installedVersionName = installedVersionName,
packageName = AppData.PACKAGE_VANCED_YOUTUBE_MUSIC,
launchActivity = AppData.LAUNCH_ACTIVITY_VANCED_YOUTUBE_MUSIC,
state = getNoonrotAppState(installedVersionCode, remoteVersionCode),
app = AppType.VANCED_YOUTUBE_MUSIC,
)
}
override suspend fun getVancedMicrog(): App {
val githubRelease = githubService.getVancedMicrogRelease()
val remoteVersionCode = githubRelease.getVersionCode()
val remoteVersionName = githubRelease.getVersionName()
val installedVersionCode =
nonrootPackageManager.getVersionCode(AppData.PACKAGE_VANCED_MICROG).getValueOrNull()
val installedVersionName =
nonrootPackageManager.getVersionName(AppData.PACKAGE_VANCED_MICROG).getValueOrNull()
return App(
name = AppData.NAME_VANCED_MICROG,
iconResId = AppData.ICON_VANCED_MICROG,
changelog = githubRelease.body,
remoteVersionCode = remoteVersionCode,
remoteVersionName = remoteVersionName,
installedVersionCode = installedVersionCode,
installedVersionName = installedVersionName,
packageName = AppData.PACKAGE_VANCED_MICROG,
launchActivity = AppData.LAUNCH_ACTIVITY_VANCED_MICROG,
state = getNoonrotAppState(installedVersionCode, remoteVersionCode),
app = AppType.VANCED_MICROG,
)
}
override suspend fun getVancedManager(): App {
val githubRelease = githubService.getVancedManagerRelease()
val remoteVersionCode = githubRelease.getVersionCode()
val remoteVersionName = githubRelease.getVersionName()
val installedVersionCode =
nonrootPackageManager.getVersionCode(AppData.PACKAGE_VANCED_MANAGER).getValueOrNull()
val installedVersionName =
nonrootPackageManager.getVersionName(AppData.PACKAGE_VANCED_MANAGER).getValueOrNull()
return App(
name = AppData.NAME_VANCED_MANAGER,
iconResId = AppData.ICON_VANCED_MANAGER,
changelog = githubRelease.body,
remoteVersionCode = remoteVersionCode,
remoteVersionName = remoteVersionName,
installedVersionCode = installedVersionCode,
installedVersionName = installedVersionName,
packageName = AppData.PACKAGE_VANCED_MANAGER,
launchActivity = AppData.LAUNCH_ACTIVITY_VANCED_MANAGER,
state = getNoonrotAppState(installedVersionCode, remoteVersionCode),
app = AppType.VANCED_MANAGER,
)
}
private fun getNoonrotAppState(
installedVersionCode: Int?,
remoteVersionCode: Int
): AppState {
return when {
installedVersionCode == null -> AppState.NOT_INSTALLED
installedVersionCode < remoteVersionCode -> AppState.NEEDS_UPDATE
installedVersionCode >= remoteVersionCode -> AppState.INSTALLED
else -> AppState.NOT_INSTALLED
}
}
private fun GithubReleaseDto.getVersionCode() = tagName.substringAfter("-").toInt()
private fun GithubReleaseDto.getVersionName() = tagName.substringBefore("-")
}
================================================
FILE: app/src/main/java/com/vanced/manager/repository/PreferenceRepository.kt
================================================
package com.vanced.manager.repository
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.Composable
import com.vanced.manager.repository.source.PreferenceData
import com.vanced.manager.repository.source.PreferenceDatasource
interface PreferenceRepository {
var managerUseCustomTabs: Boolean
var managerMode: ManagerMode
var managerTheme: ManagerTheme
}
class PreferenceRepositoryImpl(
private val preferenceDatasource: PreferenceDatasource
) : PreferenceRepository {
override var managerUseCustomTabs: Boolean
get() = preferenceDatasource.managerUseCustomTabs
set(value) {
preferenceDatasource.managerUseCustomTabs = value
}
override var managerMode: ManagerMode
get() = ManagerMode.fromValue(preferenceDatasource.managerMode)
set(value) {
preferenceDatasource.managerMode = value.value
}
override var managerTheme: ManagerTheme
get() = ManagerTheme.fromValue(preferenceDatasource.managerTheme)
set(value) {
preferenceDatasource.managerTheme = value.value
}
}
enum class ManagerTheme(val value: String) {
LIGHT(PreferenceData.MANAGER_THEME_VALUE_LIGHT),
DARK(PreferenceData.MANAGER_THEME_VALUE_DARK),
SYSTEM_DEFAULT(PreferenceData.MANAGER_THEME_VALUE_SYSTEM_DEFAULT);
@Composable
fun isDark() = when (this) {
LIGHT -> false
DARK -> true
SYSTEM_DEFAULT -> isSystemInDarkTheme()
}
companion object {
fun fromValue(value: String?): ManagerTheme {
return values().find {
it.value == value
} ?: SYSTEM_DEFAULT
}
}
}
enum class ManagerMode(val value: String) {
ROOT(PreferenceData.MANAGER_MODE_VALUE_ROOT),
NONROOT(PreferenceData.MANAGER_MODE_VALUE_NONROOT);
val isRoot get() = this == ROOT
val isNonroot get() = this == NONROOT
companion object {
fun fromValue(value: String?): ManagerMode {
return when (value) {
"root" -> ROOT
else -> NONROOT
}
}
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/repository/manager/PackageManager.kt
================================================
package com.vanced.manager.repository.manager
import android.annotation.SuppressLint
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.PackageInstaller
import android.os.Build
import com.topjohnwu.superuser.Shell
import com.topjohnwu.superuser.io.SuFile
import com.topjohnwu.superuser.io.SuFileInputStream
import com.topjohnwu.superuser.io.SuFileOutputStream
import com.vanced.manager.installer.service.AppInstallService
import com.vanced.manager.installer.service.AppUninstallService
import com.vanced.manager.util.*
import java.io.File
import java.io.FileNotFoundException
import java.io.IOException
import kotlin.jvm.Throws
interface PackageManager {
suspend fun getVersionCode(packageName: String): PackageManagerResult<Int>
suspend fun getVersionName(packageName: String): PackageManagerResult<String>
suspend fun getInstallationDir(packageName: String): PackageManagerResult<String>
suspend fun setInstaller(targetPackage: String, installerPackage: String): PackageManagerResult<Nothing>
suspend fun forceStop(packageName: String): PackageManagerResult<Nothing>
suspend fun installApp(apk: File): PackageManagerResult<Nothing>
suspend fun installSplitApp(apks: Array<File>): PackageManagerResult<Nothing>
suspend fun uninstallApp(packageName: String): PackageManagerResult<Nothing>
}
class NonrootPackageManager(
private val context: Context
) : PackageManager {
@SuppressLint("WrongConstant")
@Suppress("DEPRECATION")
override suspend fun getVersionCode(packageName: String): PackageManagerResult<Int> {
return try {
val packageInfo = context.packageManager.getPackageInfo(packageName, FLAG_NOTHING)
val versionCode = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
packageInfo.longVersionCode.and(VERSION_IGNORE_MAJOR).toInt()
} else {
packageInfo.versionCode
}
PackageManagerResult.Success(versionCode)
} catch (e: android.content.pm.PackageManager.NameNotFoundException) {
PackageManagerResult.Error(
error = PackageManagerError.GET_FAILED_PACKAGE_VERSION_CODE,
message = e.stackTraceToString()
)
}
}
@SuppressLint("WrongConstant")
override suspend fun getVersionName(packageName: String): PackageManagerResult<String> {
return try {
val versionName = context.packageManager
.getPackageInfo(packageName, FLAG_NOTHING)
.versionName
PackageManagerResult.Success(versionName)
} catch (e: android.content.pm.PackageManager.NameNotFoundException) {
PackageManagerResult.Error(
error = PackageManagerError.GET_FAILED_PACKAGE_VERSION_NAME,
message = e.stackTraceToString()
)
}
}
@SuppressLint("WrongConstant")
override suspend fun getInstallationDir(packageName: String): PackageManagerResult<String> {
return try {
val installationDir = context.packageManager
.getPackageInfo(packageName, FLAG_NOTHING)
.applicationInfo
.sourceDir
PackageManagerResult.Success(installationDir)
} catch (e: android.content.pm.PackageManager.NameNotFoundException) {
PackageManagerResult.Error(
error = PackageManagerError.GET_FAILED_PACKAGE_DIR,
message = e.stackTraceToString()
)
}
}
override suspend fun setInstaller(
targetPackage: String,
installerPackage: String
): PackageManagerResult<Nothing> {
return PackageManagerResult.Error(
error = PackageManagerError.SET_FAILED_INSTALLER,
message = "Unsupported"
)
}
override suspend fun forceStop(packageName: String): PackageManagerResult<Nothing> {
return PackageManagerResult.Error(
error = PackageManagerError.APP_FAILED_FORCE_STOP,
message = "Unsupported"
)
}
override suspend fun installApp(apk: File): PackageManagerResult<Nothing> {
return createInstallationSession {
writeApkToSession(apk)
}
}
override suspend fun installSplitApp(apks: Array<File>): PackageManagerResult<Nothing> {
return createInstallationSession {
for (apk in apks) {
writeApkToSession(apk)
}
}
}
override suspend fun uninstallApp(packageName: String): PackageManagerResult<Nothing> {
val packageInstaller = context.packageManager.packageInstaller
val pendingIntent = PendingIntent.getService(
context,
0,
Intent(context, AppUninstallService::class.java),
intentFlags
).intentSender
packageInstaller.uninstall(packageName, pendingIntent)
return PackageManagerResult.Success(null)
}
private inline fun createInstallationSession(
block: PackageInstaller.Session.() -> Unit
): PackageManagerResult<Nothing> {
val packageInstaller = context.packageManager.packageInstaller
val sessionParams = PackageInstaller.SessionParams(
PackageInstaller.SessionParams.MODE_FULL_INSTALL
).apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setInstallReason(android.content.pm.PackageManager.INSTALL_REASON_USER)
}
}
val pendingIntent = PendingIntent.getService(
context,
0,
Intent(context, AppInstallService::class.java),
intentFlags
).intentSender
val sessionId = tripleUnionTryCatch<IOException, SecurityException, IllegalArgumentException, Int>(
onCatch = {
return PackageManagerResult.Error(
error = PackageManagerError.SESSION_FAILED_CREATE,
message = it.stackTraceToString()
)
}
) {
packageInstaller.createSession(sessionParams)
}
val session = doubleUnionTryCatch<IOException, SecurityException, PackageInstaller.Session>(
onCatch = {
return PackageManagerResult.Error(
error = PackageManagerError.SESSION_FAILED_CREATE,
message = it.stackTraceToString()
)
}
) {
packageInstaller.openSession(sessionId)
}
try {
session.use {
it.block()
it.commit(pendingIntent)
}
} catch (e: IOException) {
return PackageManagerResult.Error(
error = PackageManagerError.SESSION_FAILED_WRITE,
message = e.stackTraceToString()
)
} catch (e: SecurityException) {
return PackageManagerResult.Error(
error = PackageManagerError.SESSION_FAILED_COMMIT,
message = e.stackTraceToString()
)
}
return PackageManagerResult.Success(null)
}
private fun PackageInstaller.Session.writeApkToSession(apk: File) {
apk.inputStream().use { inputStream ->
openWrite(apk.name, 0, apk.length()).use { outputStream ->
inputStream.copyTo(outputStream, byteArraySize)
fsync(outputStream)
}
}
}
private val intentFlags: Int
get() {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
PendingIntent.FLAG_MUTABLE
else
0
}
private companion object {
const val byteArraySize = 1024 * 1024
const val FLAG_NOTHING = 0
const val VERSION_IGNORE_MAJOR = 0xFFFFFFFF
}
}
class RootPackageManager : PackageManager {
override suspend fun getVersionCode(packageName: String): PackageManagerResult<Int> {
return try {
val keyword = "versionCode="
val dumpsys = Shell.su("dumpsys", "package", packageName, "|", "grep", keyword).awaitOutputOrThrow()
val versionCode = dumpsys.removePrefix(keyword).substringAfter("minSdk").toInt()
PackageManagerResult.Success(versionCode)
} catch (e: SuException) {
PackageManagerResult.Error(
error = PackageManagerError.GET_FAILED_PACKAGE_VERSION_CODE,
message = e.stderrOut
)
} catch (e: java.lang.NumberFormatException) {
PackageManagerResult.Error(
error = PackageManagerError.GET_FAILED_PACKAGE_VERSION_CODE,
message = e.stackTraceToString()
)
}
}
override suspend fun getVersionName(packageName: String): PackageManagerResult<String> {
return try {
val keyword = "versionName="
val dumpsys = Shell.su("dumpsys", "package", packageName, "|", "grep", keyword).awaitOutputOrThrow()
val versionName = dumpsys.removePrefix(keyword)
PackageManagerResult.Success(versionName)
} catch (e: SuException) {
PackageManagerResult.Error(
error = PackageManagerError.GET_FAILED_PACKAGE_VERSION_NAME,
message = e.stderrOut
)
}
}
override suspend fun getInstallationDir(packageName: String): PackageManagerResult<String> {
return try {
val keyword = "path: "
val dumpsys = Shell.su("dumpsys", "package", packageName, "|", "grep", keyword).awaitOutputOrThrow()
val installationDir = dumpsys.removePrefix(keyword)
PackageManagerResult.Success(installationDir)
} catch (e: SuException) {
PackageManagerResult.Error(
error = PackageManagerError.GET_FAILED_PACKAGE_DIR,
message = e.stderrOut
)
}
}
override suspend fun setInstaller(
targetPackage: String,
installerPackage: String
): PackageManagerResult<Nothing> {
return try {
Shell.su("pm", "set-installer", targetPackage, installerPackage).awaitOutputOrThrow()
PackageManagerResult.Success(null)
} catch (e: SuException) {
PackageManagerResult.Error(
error = PackageManagerError.SET_FAILED_INSTALLER,
message = e.stderrOut
)
}
}
override suspend fun forceStop(packageName: String): PackageManagerResult<Nothing> {
return try {
Shell.su("am", "force-stop", packageName).awaitOutputOrThrow()
PackageManagerResult.Success(null)
} catch (e: SuException) {
PackageManagerResult.Error(
error = PackageManagerError.APP_FAILED_FORCE_STOP,
message = e.stderrOut
)
}
}
override suspend fun installApp(apk: File): PackageManagerResult<Nothing> {
var tempApk: File? = null
return try {
tempApk = copyApkToTemp(apk)
Shell.su("pm", "install", "-r", tempApk.absolutePath).awaitOutputOrThrow()
PackageManagerResult.Success(null)
} catch (e: IOException) {
PackageManagerResult.Error(
error = PackageManagerError.SESSION_FAILED_COPY,
message = e.stackTraceToString()
)
} catch (e: SuException) {
PackageManagerResult.Error(
error = getEnumForInstallFailed(e.stderrOut),
message = e.stderrOut
)
} finally {
tempApk?.delete()
}
}
override suspend fun installSplitApp(apks: Array<File>): PackageManagerResult<Nothing> {
val sessionId = try {
val installCreate = Shell.su("pm", "install-create", "-r").awaitOutputOrThrow()
installCreate.toInt()
} catch (e: SuException) {
return PackageManagerResult.Error(
error = PackageManagerError.SESSION_FAILED_CREATE,
message = e.stderrOut
)
} catch (e: NumberFormatException) {
return PackageManagerResult.Error(
error = PackageManagerError.SESSION_INVALID_ID,
message = e.stackTraceToString()
)
}
for (apk in apks) {
var tempApk: File? = null
try {
tempApk = copyApkToTemp(apk)
Shell.su("pm", "install-write", sessionId.toString(), tempApk.name, tempApk.absolutePath).awaitOutputOrThrow()
} catch (e: SuException) {
return PackageManagerResult.Error(
error = PackageManagerError.SESSION_FAILED_WRITE,
message = e.stderrOut
)
} catch (e: IOException) {
return PackageManagerResult.Error(
error = PackageManagerError.SESSION_FAILED_COPY,
message = e.stackTraceToString()
)
} finally {
tempApk?.delete()
}
}
return try {
Shell.su("pm", "install-commit", sessionId.toString()).awaitOutputOrThrow()
PackageManagerResult.Success(null)
} catch (e: SuException) {
PackageManagerResult.Error(
error = getEnumForInstallFailed(e.stderrOut),
message = e.stderrOut
)
}
}
override suspend fun uninstallApp(packageName: String): PackageManagerResult<Nothing> {
return try {
Shell.su("pm", "uninstall", packageName).awaitOutputOrThrow()
PackageManagerResult.Success(null)
} catch (e: SuException) {
PackageManagerResult.Error(
error = PackageManagerError.UNINSTALL_FAILED,
message = e.stderrOut
)
}
}
@Throws(
IOException::class,
FileNotFoundException::class
)
private fun copyApkToTemp(apk: File): SuFile {
val tmpPath = "/data/local/tmp/${apk.name}"
val tmpApk = SuFile(tmpPath).apply {
createNewFile()
}
SuFileInputStream.open(tmpApk).use { inputStream ->
SuFileOutputStream.open(tmpApk).use { outputStream ->
inputStream.copyTo(outputStream)
outputStream.flush()
}
}
return tmpApk
}
}
enum class PackageManagerError {
SET_FAILED_INSTALLER,
GET_FAILED_PACKAGE_DIR,
GET_FAILED_PACKAGE_VERSION_NAME,
GET_FAILED_PACKAGE_VERSION_CODE,
APP_FAILED_FORCE_STOP,
SESSION_FAILED_CREATE,
SESSION_FAILED_COMMIT,
SESSION_FAILED_WRITE,
SESSION_FAILED_COPY,
SESSION_FAILED_OPEN,
SESSION_INVALID_ID,
INSTALL_FAILED_ABORTED,
INSTALL_FAILED_ALREADY_EXISTS,
INSTALL_FAILED_CPU_ABI_INCOMPATIBLE,
INSTALL_FAILED_INSUFFICIENT_STORAGE,
INSTALL_FAILED_INVALID_APK,
INSTALL_FAILED_VERSION_DOWNGRADE,
INSTALL_FAILED_PARSE_NO_CERTIFICATES,
INSTALL_FAILED_UNKNOWN,
UNINSTALL_FAILED,
LINK_FAILED_UNMOUNT,
LINK_FAILED_MOUNT,
PATCH_FAILED_COPY,
PATCH_FAILED_CHMOD,
PATCH_FAILED_CHOWN,
PATCH_FAILED_CHCON,
PATCH_FAILED_DESTROY,
SCRIPT_FAILED_SETUP_POST_FS,
SCRIPT_FAILED_SETUP_SERVICE_D,
SCRIPT_FAILED_DESTROY_POST_FS,
SCRIPT_FAILED_DESTROY_SERVICE_D,
}
fun getEnumForInstallFailed(outString: String): PackageManagerError {
return when {
outString.contains("INSTALL_FAILED_ABORTED") -> PackageManagerError.INSTALL_FAILED_ABORTED
outString.contains("INSTALL_FAILED_ALREADY_EXISTS") -> PackageManagerError.INSTALL_FAILED_ALREADY_EXISTS
outString.contains("INSTALL_FAILED_CPU_ABI_INCOMPATIBLE") -> PackageManagerError.INSTALL_FAILED_CPU_ABI_INCOMPATIBLE
outString.contains("INSTALL_FAILED_INSUFFICIENT_STORAGE") -> PackageManagerError.INSTALL_FAILED_INSUFFICIENT_STORAGE
outString.contains("INSTALL_FAILED_INVALID_APK") -> PackageManagerError.INSTALL_FAILED_INVALID_APK
outString.contains("INSTALL_FAILED_VERSION_DOWNGRADE") -> PackageManagerError.INSTALL_FAILED_VERSION_DOWNGRADE
outString.contains("INSTALL_PARSE_FAILED_NO_CERTIFICATES") -> PackageManagerError.INSTALL_FAILED_PARSE_NO_CERTIFICATES
else -> PackageManagerError.INSTALL_FAILED_UNKNOWN
}
}
sealed class PackageManagerResult<out V> {
data class Success<out V>(val value: V?) : PackageManagerResult<V>()
data class Error(val error: PackageManagerError, val message: String) : PackageManagerResult<Nothing>()
fun getValueOrNull(): V? = getOrElse { null }
val isError
get() = this is Error
val isSuccess
get() = this is Success
}
inline fun <R, T : R> PackageManagerResult<T>.getOrElse(
onError: (PackageManagerResult.Error) -> R?
): R? {
return when (this) {
is PackageManagerResult.Success -> this.value
is PackageManagerResult.Error -> onError(this)
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/repository/source/PreferenceDatasource.kt
================================================
package com.vanced.manager.repository.source
import android.content.SharedPreferences
interface PreferenceDatasource {
var managerUseCustomTabs: Boolean
var managerMode: String
var managerTheme: String
}
class PreferenceDatasourceImpl(
private val sharedPreferences: SharedPreferences
) : PreferenceDatasource {
override var managerUseCustomTabs: Boolean
get() = getBoolean(
PreferenceData.MANAGER_USE_CUSTOM_TABS_KEY,
PreferenceData.MANAGER_USE_CUSTOM_TABS_DEFAULT_VALUE
)
set(value) {
putBoolean(PreferenceData.MANAGER_USE_CUSTOM_TABS_KEY, value)
}
override var managerMode: String
get() = getString(
PreferenceData.MANAGER_MODE_KEY,
PreferenceData.MANAGER_MODE_DEFAULT_VALUE
)
set(value) {
putString(PreferenceData.MANAGER_MODE_KEY, value)
}
override var managerTheme: String
get() = getString(
PreferenceData.MANAGER_THEME_KEY,
PreferenceData.MANAGER_THEME_DEFAULT_VALUE
)
set(value) {
putString(PreferenceData.MANAGER_THEME_KEY, value)
}
private fun getString(key: String, defaultValue: String): String {
return sharedPreferences.getString(key, defaultValue) ?: defaultValue
}
private fun getBoolean(key: String, defaultValue: Boolean): Boolean {
return sharedPreferences.getBoolean(key, defaultValue)
}
private fun putString(key: String, value: String) {
sharedPreferences.edit().putString(key, value).apply()
}
private fun putBoolean(key: String, value: Boolean) {
sharedPreferences.edit().putBoolean(key, value).apply()
}
}
object PreferenceData {
const val MANAGER_USE_CUSTOM_TABS_KEY = "manager_behaviour_use_custom_tabs"
const val MANAGER_USE_CUSTOM_TABS_DEFAULT_VALUE = true
const val MANAGER_MODE_KEY = "manager_behaviour_mode"
const val MANAGER_MODE_VALUE_ROOT = "root"
const val MANAGER_MODE_VALUE_NONROOT = "nonroot"
const val MANAGER_MODE_DEFAULT_VALUE = MANAGER_MODE_VALUE_NONROOT
const val MANAGER_THEME_KEY = "manager_appearance_theme"
const val MANAGER_THEME_VALUE_LIGHT = "light"
const val MANAGER_THEME_VALUE_DARK = "dark"
const val MANAGER_THEME_VALUE_SYSTEM_DEFAULT = "system_default"
const val MANAGER_THEME_DEFAULT_VALUE = MANAGER_THEME_VALUE_SYSTEM_DEFAULT
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/MainActivity.kt
================================================
package com.vanced.manager.ui
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.SideEffect
import com.github.zsoltk.compose.backpress.BackPressHandler
import com.github.zsoltk.compose.backpress.LocalBackPressHandler
import com.github.zsoltk.compose.router.Router
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import com.vanced.manager.installer.service.AppInstallService
import com.vanced.manager.installer.service.AppUninstallService
import com.vanced.manager.ui.screen.*
import com.vanced.manager.ui.theme.ManagerTheme
import com.vanced.manager.ui.util.Screen
import com.vanced.manager.ui.util.animated
import com.vanced.manager.ui.viewmodel.InstallViewModel
import com.vanced.manager.ui.viewmodel.MainViewModel
import org.koin.androidx.viewmodel.ext.android.viewModel
class MainActivity : ComponentActivity() {
private val installViewModel: InstallViewModel by viewModel()
private val mainViewModel: MainViewModel by viewModel()
private val backPressHandler = BackPressHandler()
private val installBroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
when (intent?.action) {
AppInstallService.APP_INSTALL_ACTION -> {
installViewModel.postInstallStatus(
pmStatus = intent.getIntExtra(AppInstallService.EXTRA_INSTALL_STATUS, -999),
extra = intent.getStringExtra(AppInstallService.EXTRA_INSTALL_STATUS_MESSAGE)!!,
)
mainViewModel.fetch()
}
AppUninstallService.APP_UNINSTALL_ACTION -> {
mainViewModel.fetch()
}
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mainViewModel.fetch()
setContent {
val isDark = mainViewModel.appTheme.isDark()
ManagerTheme(darkMode = isDark) {
val surfaceColor = MaterialTheme.colorScheme.surface.animated
val systemUiController = rememberSystemUiController()
SideEffect {
systemUiController.setSystemBarsColor(
color = surfaceColor,
darkIcons = !isDark
)
}
CompositionLocalProvider(
LocalBackPressHandler provides backPressHandler
) {
Router<Screen>("VancedManager", Screen.Home) { backStack ->
when (val screen = backStack.last()) {
is Screen.Home -> {
HomeScreen(
managerState = mainViewModel.appState,
onRefresh = {
mainViewModel.fetch()
},
onToolbarScreenSelected = {
backStack.push(it)
},
onAppDownloadClick = { app ->
/*if (installationOptions != null) {
backStack.push(
Screen.Configuration(
appName,
appVersions,
installationOptions
)
)
} else {
backStack.push(Screen.Install(appName, appVersions))
}*/
},
onAppLaunchClick = { app ->
mainViewModel.launchApp(app.packageName, app.launchActivity)
},
onAppUninstallClick = { app ->
mainViewModel.uninstallApp(app.packageName)
}
)
}
is Screen.Settings -> {
SettingsScreen(
onToolbarBackButtonClick = {
backStack.pop()
},
onThemeChange = {
mainViewModel.appTheme = it
}
)
}
is Screen.About -> {
AboutScreen(
onToolbarBackButtonClick = {
backStack.pop()
}
)
}
is Screen.Logs -> {
}
is Screen.Configuration -> {
ConfigurationScreen(
installationOptions = screen.appInstallationOptions,
onToolbarBackButtonClick = {
backStack.pop()
},
onFinishClick = {
backStack.push(
Screen.Install(
screen.appName,
screen.appVersions
)
)
}
)
}
is Screen.Install -> {
InstallScreen(
appName = screen.appName,
appVersions = screen.appVersions,
viewModel = installViewModel,
onFinishClick = {
installViewModel.clear()
backStack.newRoot(Screen.Home)
}
)
}
}
}
}
}
}
}
override fun onBackPressed() {
if (!backPressHandler.handle())
super.onBackPressed()
}
override fun onStart() {
super.onStart()
registerReceiver(
installBroadcastReceiver,
IntentFilter().apply {
addAction(AppInstallService.APP_INSTALL_ACTION)
addAction(AppUninstallService.APP_UNINSTALL_ACTION)
}
)
}
override fun onStop() {
super.onStop()
unregisterReceiver(installBroadcastReceiver)
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/SplashScreenActivity.kt
================================================
package com.vanced.manager.ui
import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import com.topjohnwu.superuser.BusyBoxInstaller
import com.topjohnwu.superuser.Shell
import com.vanced.manager.BuildConfig
class SplashScreenActivity : ComponentActivity() {
init {
Shell.enableVerboseLogging = BuildConfig.DEBUG
Shell.setDefaultBuilder(
Shell.Builder
.create()
.setInitializers(BusyBoxInstaller::class.java)
)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Shell.getShell {
startActivity(
Intent(this, MainActivity::class.java)
)
finish()
}
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerButton.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.dp
@Composable
fun ManagerButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
elevation: ButtonElevation? = ButtonDefaults.buttonElevation(),
shape: Shape = RoundedCornerShape(20.0.dp),
border: BorderStroke? = null,
colors: ButtonColors = ButtonDefaults.buttonColors(),
contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
content: @Composable RowScope.() -> Unit
) {
Button(
onClick,
modifier,
enabled,
interactionSource,
elevation,
shape,
border,
colors,
contentPadding,
content
)
}
@Composable
fun ManagerElevatedButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
elevation: ButtonElevation? = ButtonDefaults.elevatedButtonElevation(),
shape: Shape = RoundedCornerShape(20.0.dp),
border: BorderStroke? = null,
colors: ButtonColors = ButtonDefaults.elevatedButtonColors(),
contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
content: @Composable RowScope.() -> Unit
) {
ElevatedButton(
onClick,
modifier,
enabled,
interactionSource,
elevation,
shape,
border,
colors,
contentPadding,
content
)
}
@Composable
fun ManagerFilledTonalButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
elevation: ButtonElevation? = ButtonDefaults.filledTonalButtonElevation(),
shape: Shape = RoundedCornerShape(20.0.dp),
border: BorderStroke? = null,
colors: ButtonColors = ButtonDefaults.filledTonalButtonColors(),
contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
content: @Composable RowScope.() -> Unit
) {
FilledTonalButton(
onClick,
modifier,
enabled,
interactionSource,
elevation,
shape,
border,
colors,
contentPadding,
content
)
}
@Composable
fun ManagerOutlinedButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
elevation: ButtonElevation? = null,
shape: Shape = RoundedCornerShape(20.0.dp),
border: BorderStroke? = ButtonDefaults.outlinedButtonBorder,
colors: ButtonColors = ButtonDefaults.outlinedButtonColors(),
contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
content: @Composable RowScope.() -> Unit
) {
Button(
onClick,
modifier,
enabled,
interactionSource,
elevation,
shape,
border,
colors,
contentPadding,
content
)
}
@Composable
fun ManagerTextButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
elevation: ButtonElevation? = null,
shape: Shape = RoundedCornerShape(20.0.dp),
border: BorderStroke? = null,
colors: ButtonColors = ButtonDefaults.textButtonColors(),
contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
content: @Composable RowScope.() -> Unit
) {
TextButton(
onClick,
modifier,
enabled,
interactionSource,
elevation,
shape,
border,
colors,
contentPadding,
content
)
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerCard.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import com.vanced.manager.ui.theme.MediumShape
import com.vanced.manager.ui.util.animated
@Composable
fun ManagerCard(
modifier: Modifier = Modifier,
onClick: (() -> Unit)? = null,
shape: Shape = MediumShape,
containerColor: Color = MaterialTheme.colorScheme.surface,
contentColor: Color = contentColorFor(containerColor),
elevation: CardElevation = CardDefaults.cardElevation(),
content: @Composable ColumnScope.() -> Unit,
) {
if (onClick != null) {
val interactionSource = remember { MutableInteractionSource() }
Card(
modifier = modifier
.clickable(
interactionSource = interactionSource,
indication = null,
onClick = onClick
),
interactionSource = interactionSource,
shape = shape,
containerColor = containerColor.animated,
contentColor = contentColor.animated,
elevation = elevation,
content = content
)
} else {
Card(
modifier = modifier,
shape = shape,
containerColor = containerColor.animated,
contentColor = contentColor.animated,
elevation = elevation,
content = content
)
}
}
@Composable
fun ManagerElevatedCard(
modifier: Modifier = Modifier,
onClick: (() -> Unit)? = null,
shape: Shape = MediumShape,
containerColor: Color = MaterialTheme.colorScheme.surface,
contentColor: Color = contentColorFor(containerColor),
elevation: CardElevation = CardDefaults.elevatedCardElevation(),
content: @Composable ColumnScope.() -> Unit,
) {
if (onClick != null) {
val interactionSource = remember { MutableInteractionSource() }
ElevatedCard(
modifier = modifier
.clickable(
interactionSource = interactionSource,
indication = null,
onClick = onClick
),
interactionSource = interactionSource,
shape = shape,
containerColor = containerColor.animated,
contentColor = contentColor.animated,
elevation = elevation,
content = content
)
} else {
ElevatedCard(
modifier = modifier,
shape = shape,
containerColor = containerColor.animated,
contentColor = contentColor.animated,
elevation = elevation,
content = content
)
}
}
@Composable
fun ManagerOutlinedCard(
modifier: Modifier = Modifier,
onClick: (() -> Unit)? = null,
shape: Shape = MediumShape,
containerColor: Color = MaterialTheme.colorScheme.surface,
contentColor: Color = contentColorFor(containerColor),
elevation: CardElevation = CardDefaults.outlinedCardElevation(),
content: @Composable ColumnScope.() -> Unit,
) {
if (onClick != null) {
val interactionSource = remember { MutableInteractionSource() }
OutlinedCard(
modifier = modifier
.clickable(
interactionSource = interactionSource,
indication = null,
onClick = onClick
),
interactionSource = interactionSource,
shape = shape,
containerColor = containerColor.animated,
contentColor = contentColor.animated,
elevation = elevation,
content = content
)
} else {
OutlinedCard(
modifier = modifier,
shape = shape,
containerColor = containerColor.animated,
contentColor = contentColor.animated,
elevation = elevation,
content = content
)
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerDialog.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.material3.AlertDialog
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.vanced.manager.ui.theme.LargeShape
@Composable
fun ManagerDialog(
title: String,
onDismissRequest: () -> Unit,
confirmButton: @Composable () -> Unit,
modifier: Modifier = Modifier,
dismissButton: @Composable (() -> Unit)? = null,
icon: @Composable (() -> Unit)? = null,
content: @Composable () -> Unit,
) {
AlertDialog(
modifier = modifier,
title = {
ManagerText(
text = title,
textAlign = TextAlign.Center
)
},
text = content,
onDismissRequest = onDismissRequest,
confirmButton = confirmButton,
dismissButton = dismissButton,
icon = icon,
shape = LargeShape,
tonalElevation = 2.dp,
)
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerDropdownMenu.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.core.MutableTransitionState
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.tween
import androidx.compose.animation.core.updateTransition
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.width
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.OutlinedCard
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.scale
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.*
import androidx.compose.ui.window.Popup
import androidx.compose.ui.window.PopupPositionProvider
import androidx.compose.ui.window.PopupProperties
import com.vanced.manager.ui.theme.SmallShape
private const val TransitionDuration = 200
@ExperimentalAnimationApi
@Composable
fun ManagerDropdownMenu(
expanded: Boolean,
onDismissRequest: () -> Unit,
content: @Composable ColumnScope.() -> Unit,
) {
val expandedStates = remember { MutableTransitionState(false) }
expandedStates.targetState = expanded
val transition = updateTransition(expandedStates, "ManagerDropDownMenu")
val alphaAndScale by transition.animateFloat(
transitionSpec = { tween(durationMillis = TransitionDuration) },
label = "AlphaAndScale"
) {
if (it) 1f else 0f
}
if (expandedStates.currentState || expandedStates.targetState) {
val density = LocalDensity.current
val popupPositionProvider = ManagerDropdownMenuPopupPositionProvider(density)
Popup(
popupPositionProvider = popupPositionProvider,
onDismissRequest = onDismissRequest,
properties = PopupProperties(focusable = true)
) {
OutlinedCard(
modifier = Modifier
.width(IntrinsicSize.Max)
.alpha(alphaAndScale)
.scale(alphaAndScale),
elevation = CardDefaults.elevatedCardElevation()
) {
Column(content = content)
}
}
}
}
@Composable
fun ManagerDropdownMenuItem(
title: String,
onClick: () -> Unit
) {
DropdownMenuItem(
onClick = onClick,
modifier = Modifier.clip(SmallShape),
text = {
ManagerText(text = title)
}
)
}
//Kanged from Menu.kt
private data class ManagerDropdownMenuPopupPositionProvider(
val density: Density
) : PopupPositionProvider {
override fun calculatePosition(
anchorBounds: IntRect,
windowSize: IntSize,
layoutDirection: LayoutDirection,
popupContentSize: IntSize
): IntOffset {
val verticalMargin = with(density) { 48.dp.roundToPx() }
//Compute horizontal position.
val toRight = anchorBounds.left
val toLeft = anchorBounds.right - popupContentSize.width
val toDisplayRight = windowSize.width - popupContentSize.width
val toDisplayLeft = 0
val x = if (layoutDirection == LayoutDirection.Ltr) {
sequenceOf(toRight, toLeft, toDisplayRight)
} else {
sequenceOf(toLeft, toRight, toDisplayLeft)
}.firstOrNull {
it >= 0 && it + popupContentSize.width <= windowSize.width
} ?: toLeft
// Compute vertical position.
val toBottom = maxOf(anchorBounds.bottom, verticalMargin)
val toTop = anchorBounds.top - popupContentSize.height
val toCenter = anchorBounds.top - popupContentSize.height / 2
val toDisplayBottom = windowSize.height - popupContentSize.height - verticalMargin
val y = sequenceOf(toBottom, toTop, toCenter, toDisplayBottom).firstOrNull {
it >= verticalMargin && it + popupContentSize.height <= windowSize.height - verticalMargin
} ?: toTop
return IntOffset(x, y)
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerLazyDsl.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.foundation.gestures.FlingBehavior
import androidx.compose.foundation.gestures.ScrollableDefaults
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.*
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.vanced.manager.ui.util.EdgeToEdgeContentPadding
@Composable
fun ManagerLazyColumn(
modifier: Modifier = Modifier,
state: LazyListState = rememberLazyListState(),
contentPadding: PaddingValues = PaddingValues(
start = EdgeToEdgeContentPadding,
end = EdgeToEdgeContentPadding,
bottom = 8.dp
),
reverseLayout: Boolean = false,
verticalArrangement: Arrangement.Vertical =
Arrangement.spacedBy(8.dp, if (!reverseLayout) Alignment.Top else Alignment.Bottom),
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
content: LazyListScope.() -> Unit
) {
LazyColumn(
modifier = modifier,
state = state,
contentPadding = contentPadding,
reverseLayout = reverseLayout,
verticalArrangement = verticalArrangement,
horizontalAlignment = horizontalAlignment,
flingBehavior = flingBehavior,
content = content
)
}
@Composable
fun ManagerLazyRow(
modifier: Modifier = Modifier,
state: LazyListState = rememberLazyListState(),
contentPadding: PaddingValues = PaddingValues(
start = EdgeToEdgeContentPadding,
end = EdgeToEdgeContentPadding,
),
reverseLayout: Boolean = false,
horizontalArrangement: Arrangement.Horizontal =
Arrangement.spacedBy(8.dp, if (!reverseLayout) Alignment.Start else Alignment.End),
verticalAlignment: Alignment.Vertical = Alignment.Top,
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
content: LazyListScope.() -> Unit
) {
LazyRow(
modifier = modifier,
state = state,
contentPadding = contentPadding,
reverseLayout = reverseLayout,
horizontalArrangement = horizontalArrangement,
verticalAlignment = verticalAlignment,
flingBehavior = flingBehavior,
content = content
)
}
inline fun LazyListScope.managerCategory(
crossinline categoryName: @Composable () -> String,
content: LazyListScope.() -> Unit
) {
item {
ManagerText(
modifier = Modifier
.padding(
start = 8.dp,
top = 4.dp
),
text = categoryName(),
textStyle = MaterialTheme.typography.headlineSmall,
)
}
content()
}
inline fun <K, V> LazyListScope.items(
items: Map<K, V>,
noinline key: ((key: K, value: V) -> Any)? = null,
crossinline itemContent: @Composable LazyItemScope.(key: K, value: V) -> Unit
) = items(
count = items.size,
key = if (key != null) { index ->
key(items.keys.elementAt(index), items.values.elementAt(index))
} else null
) { index ->
itemContent(items.keys.elementAt(index), items.values.elementAt(index))
}
inline fun <K, V> LazyListScope.itemsIndexed(
items: Map<K, V>,
noinline key: ((index: Int, key: K, value: V) -> Any)? = null,
crossinline itemContent: @Composable LazyItemScope.(index: Int, key: K, value: V) -> Unit
) = items(
count = items.size,
key = if (key != null) { index ->
key(index, items.keys.elementAt(index), items.values.elementAt(index))
} else null
) { index ->
itemContent(index, items.keys.elementAt(index), items.values.elementAt(index))
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerListItem.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.foundation.layout.*
import androidx.compose.material.ContentAlpha
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.vanced.manager.ui.util.DefaultContentPaddingHorizontal
import com.vanced.manager.ui.util.DefaultContentPaddingVertical
@Composable
fun ManagerListItem(
modifier: Modifier = Modifier,
title: @Composable () -> Unit,
description: @Composable (() -> Unit)? = null,
icon: @Composable (() -> Unit)? = null,
trailing: @Composable (() -> Unit)? = null
) {
Row(
modifier = modifier,
horizontalArrangement = Arrangement.spacedBy(DefaultContentPaddingHorizontal)
) {
if (icon != null) {
Box(
modifier = Modifier.align(Alignment.CenterVertically)
) {
icon()
}
}
Column(
modifier = Modifier
.weight(1f)
.padding(
vertical =
if (description != null) DefaultContentPaddingVertical - 4.dp else DefaultContentPaddingVertical,
)
.align(Alignment.CenterVertically)
) {
CompositionLocalProvider(
LocalTextStyle provides MaterialTheme.typography.titleSmall
) {
title()
}
if (description != null) {
CompositionLocalProvider(
LocalContentAlpha provides ContentAlpha.medium,
LocalTextStyle provides MaterialTheme.typography.bodySmall
) {
description()
}
}
}
if (trailing != null) {
Box(
modifier = Modifier.align(Alignment.CenterVertically),
contentAlignment = Alignment.Center,
) {
trailing()
}
}
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerNavigator.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedContentScope
import androidx.compose.animation.with
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveableStateHolder
import androidx.compose.runtime.snapshots.SnapshotStateList
import com.vanced.manager.ui.util.Screen
@Composable
fun <T> rememberManagerNavigationController(
initialScreen: T
) = remember {
ManagerNavigationControllerImpl(initialScreen)
}
interface ManagerNavigationController<T> {
val screens: SnapshotStateList<T>
fun push(item: T)
fun pop(): Boolean
}
class ManagerNavigationControllerImpl<T>(
initialScreen: T
) : ManagerNavigationController<T> {
override val screens: SnapshotStateList<T> =
mutableStateListOf(initialScreen)
override fun push(item: T) {
screens.add(item)
}
override fun pop(): Boolean {
if (screens.size > 1) {
screens.removeLast()
return true
}
return false
}
}
@Composable
fun <T : Screen> ManagerNavigator(
navigationController: ManagerNavigationController<T>,
content: @Composable (targetContent: T) -> Unit
) {
val saveableStateHolder = rememberSaveableStateHolder()
val screens = remember { navigationController.screens }
//TODO Animation is not working for some weird reasons
AnimatedContent(
transitionSpec = {
if (targetState.size > initialState.size) {
slideIntoContainer(AnimatedContentScope.SlideDirection.Start) with
slideOutOfContainer(AnimatedContentScope.SlideDirection.End)
} else {
slideIntoContainer(AnimatedContentScope.SlideDirection.End) with
slideOutOfContainer(AnimatedContentScope.SlideDirection.Start)
}
},
targetState = screens
) { targetContents ->
val targetContent = targetContents.last()
saveableStateHolder.SaveableStateProvider(key = targetContent.route) {
content(targetContent)
}
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerPreference.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.Checkbox
import androidx.compose.material.Switch
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.RadioButton
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
import com.vanced.manager.R
import com.vanced.manager.ui.resource.managerString
import com.vanced.manager.ui.theme.LargeShape
import com.vanced.manager.ui.theme.SmallShape
import com.vanced.manager.ui.util.DefaultContentPaddingHorizontal
@JvmInline
value class EntryText(val text: String)
@JvmInline
value class EntryValue(val value: String)
@Composable
fun ManagerPreference(
preferenceTitle: String,
preferenceDescription: String? = null,
trailing: @Composable () -> Unit = {},
onClick: () -> Unit
) {
ManagerElevatedCard(
shape = LargeShape,
onClick = onClick
) {
ManagerListItem(
modifier = Modifier
.padding(horizontal = DefaultContentPaddingHorizontal),
title = {
ManagerText(text = preferenceTitle)
},
description = if (preferenceDescription != null) {
{
ManagerText(text = preferenceDescription)
}
} else null,
trailing = trailing,
)
}
}
@Composable
fun ManagerSwitchPreference(
preferenceTitle: String,
preferenceDescription: String? = null,
isChecked: Boolean,
onCheckedChange: (isChecked: Boolean) -> Unit
) {
ManagerPreference(
preferenceTitle = preferenceTitle,
preferenceDescription = preferenceDescription,
onClick = {
onCheckedChange(!isChecked)
},
trailing = {
Switch(
checked = isChecked,
onCheckedChange = null
)
}
)
}
@Composable
fun ManagerDialogPreference(
preferenceTitle: String,
preferenceDescription: String? = null,
showDialog: Boolean,
onClick: () -> Unit,
onDismissRequest: () -> Unit,
confirmButton: @Composable () -> Unit,
dismissButton: @Composable () -> Unit = {},
trailing: @Composable () -> Unit = {},
content: @Composable () -> Unit
) {
ManagerPreference(
preferenceTitle = preferenceTitle,
preferenceDescription = preferenceDescription,
trailing = trailing,
onClick = onClick
)
if (showDialog) {
ManagerDialog(
title = preferenceTitle,
onDismissRequest = onDismissRequest,
confirmButton = confirmButton,
dismissButton = dismissButton,
content = content
)
}
}
@Composable
fun ManagerSingleSelectDialogPreference(
preferenceTitle: String,
preferenceDescription: String,
showDialog: Boolean,
selected: EntryValue,
entries: Map<EntryText, EntryValue>,
trailing: @Composable () -> Unit = {},
onClick: () -> Unit,
onDismissRequest: () -> Unit,
onEntrySelect: (EntryValue) -> Unit,
onSave: () -> Unit,
) {
ManagerDialogPreference(
preferenceTitle = preferenceTitle,
preferenceDescription = preferenceDescription,
trailing = trailing,
confirmButton = {
TextButton(onClick = onSave) {
ManagerText(managerString(R.string.dialog_button_save))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
ManagerText(managerString(R.string.dialog_button_cancel))
}
},
onDismissRequest = onDismissRequest,
showDialog = showDialog,
onClick = onClick
) {
LazyColumn(
modifier = Modifier.heightIn(max = 400.dp)
) {
items(entries) { entryText, entryValue ->
ListDialogRadiobuttonItem(
modifier = Modifier.fillMaxWidth(),
text = entryText.text,
selected = selected == entryValue,
onClick = {
onEntrySelect(entryValue)
}
)
}
}
}
}
@Composable
fun ManagerMultiSelectDialogPreference(
preferenceTitle: String,
preferenceDescription: String,
showDialog: Boolean,
selected: List<EntryValue>,
entries: Map<EntryText, EntryValue>,
trailing: @Composable () -> Unit = {},
onClick: () -> Unit,
onDismissRequest: () -> Unit,
onEntriesSelect: (List<EntryValue>) -> Unit,
onSave: () -> Unit,
) {
ManagerDialogPreference(
preferenceTitle = preferenceTitle,
preferenceDescription = preferenceDescription,
trailing = trailing,
confirmButton = {
TextButton(onClick = onSave) {
ManagerText(managerString(R.string.dialog_button_save))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
ManagerText(managerString(R.string.dialog_button_cancel))
}
},
onDismissRequest = onDismissRequest,
showDialog = showDialog,
onClick = onClick
) {
LazyColumn(
modifier = Modifier.heightIn(max = 400.dp)
) {
items(entries) { entryText, entryValue ->
ListDialogCheckboxItem(
text = entryText.text,
checked = selected.contains(entryValue),
onCheckedChange = { isChecked ->
val mutableSelected = selected.toMutableList()
when (isChecked) {
true -> mutableSelected.add(entryValue)
false -> mutableSelected.remove(entryValue)
}
onEntriesSelect(mutableSelected)
}
)
}
}
}
}
@Composable
private fun ListDialogRadiobuttonItem(
text: String,
selected: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
ListDialogItem(
modifier = modifier,
text = text,
onClick = onClick,
trailing = {
RadioButton(
selected = selected,
onClick = null
)
}
)
}
@Composable
private fun ListDialogCheckboxItem(
text: String,
checked: Boolean,
onCheckedChange: (Boolean) -> Unit,
modifier: Modifier = Modifier
) {
ListDialogItem(
modifier = modifier,
text = text,
onClick = {
onCheckedChange(!checked)
},
trailing = {
Checkbox(
checked = checked,
onCheckedChange = null
)
}
)
}
@Composable
private fun ListDialogItem(
text: String,
onClick: () -> Unit,
trailing: @Composable () -> Unit,
modifier: Modifier = Modifier
) {
Row(
modifier = modifier
.clip(SmallShape)
.clickable(onClick = onClick)
.padding(8.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically
) {
ManagerText(
modifier = Modifier.weight(1f),
text = text,
textStyle = MaterialTheme.typography.titleSmall
)
trailing()
}
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerProgressIndicator.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.material.ProgressIndicatorDefaults
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import com.vanced.manager.ui.util.animated
@Composable
fun ManagerProgressIndicator(
modifier: Modifier = Modifier,
color: Color = MaterialTheme.colorScheme.primary,
trackColor: Color = MaterialTheme.colorScheme.surfaceVariant,
) {
LinearProgressIndicator(
modifier = modifier,
color = color.animated,
trackColor = trackColor.animated
)
}
@Composable
fun ManagerProgressIndicator(
progress: Float,
modifier: Modifier = Modifier,
color: Color = MaterialTheme.colorScheme.primary,
trackColor: Color = MaterialTheme.colorScheme.surfaceVariant,
) {
val animatedProgress by animateFloatAsState(
targetValue = progress,
animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec
)
LinearProgressIndicator(
progress = animatedProgress,
modifier = modifier,
color = color.animated,
trackColor = trackColor.animated
)
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerScaffold.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.material3.FabPosition
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.contentColorFor
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import com.vanced.manager.ui.util.animated
@Composable
fun ManagerScaffold(
modifier: Modifier = Modifier,
topBar: @Composable () -> Unit = {},
bottomBar: @Composable () -> Unit = {},
snackbarHost: @Composable () -> Unit = {},
floatingActionButton: @Composable () -> Unit = {},
floatingActionButtonPosition: FabPosition = FabPosition.End,
containerColor: Color = MaterialTheme.colorScheme.background,
contentColor: Color = contentColorFor(containerColor),
content: @Composable (PaddingValues) -> Unit
) {
// //M3 Scaffold doesn't support tonal elevation for Surface
// val absoluteTonalElevation = LocalAbsoluteTonalElevation.current + 1.dp
// CompositionLocalProvider(
// LocalAbsoluteTonalElevation provides absoluteTonalElevation
// ) {
Scaffold(
modifier = modifier,
topBar = topBar,
bottomBar = bottomBar,
snackbarHost = snackbarHost,
floatingActionButton = floatingActionButton,
floatingActionButtonPosition = floatingActionButtonPosition,
containerColor = containerColor.animated,
contentColor = contentColor.animated,
content = content
)
// }
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerSwipeRefresh.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.google.accompanist.swiperefresh.SwipeRefresh
import com.google.accompanist.swiperefresh.SwipeRefreshIndicator
import com.google.accompanist.swiperefresh.SwipeRefreshState
@Composable
fun ManagerSwipeRefresh(
swipeRefreshState: SwipeRefreshState,
onRefresh: () -> Unit,
modifier: Modifier = Modifier,
swipeEnabled: Boolean = true,
refreshTriggerDistance: Dp = 80.dp,
indicatorAlignment: Alignment = Alignment.TopCenter,
indicatorPadding: PaddingValues = PaddingValues(0.dp),
clipIndicatorToPadding: Boolean = true,
content: @Composable () -> Unit,
) {
SwipeRefresh(
modifier = modifier,
state = swipeRefreshState,
onRefresh = onRefresh,
indicator = { state, trigger ->
SwipeRefreshIndicator(
state = state,
refreshTriggerDistance = trigger,
scale = true,
contentColor = MaterialTheme.colorScheme.primary,
backgroundColor = MaterialTheme.colorScheme.surface
)
},
swipeEnabled = swipeEnabled,
refreshTriggerDistance = refreshTriggerDistance,
indicatorAlignment = indicatorAlignment,
indicatorPadding = indicatorPadding,
clipIndicatorToPadding = clipIndicatorToPadding,
content = content
)
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerText.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextAlign
@Composable
fun ManagerText(
text: String,
modifier: Modifier = Modifier,
color: Color = Color.Unspecified,
textStyle: TextStyle = LocalTextStyle.current,
textAlign: TextAlign? = null,
) {
Text(
modifier = modifier,
text = text,
color = color,
style = textStyle,
textAlign = textAlign
)
}
@Composable
fun ManagerText(
text: AnnotatedString,
modifier: Modifier = Modifier,
color: Color = Color.Unspecified,
textStyle: TextStyle = LocalTextStyle.current,
textAlign: TextAlign? = null,
) {
Text(
modifier = modifier,
text = text,
color = color,
style = textStyle,
textAlign = textAlign
)
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/component/ManagerTopAppBar.kt
================================================
package com.vanced.manager.ui.component
import androidx.compose.foundation.layout.RowScope
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@Composable
fun ManagerSmallTopAppBar(
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
navigationIcon: @Composable () -> Unit = {},
actions: @Composable RowScope.() -> Unit = {},
colors: TopAppBarColors = TopAppBarDefaults.smallTopAppBarColors(),
scrollBehavior: TopAppBarScrollBehavior? = null
) {
SmallTopAppBar(
modifier = modifier,
title = title,
actions = actions,
navigationIcon = navigationIcon,
colors = colors,
scrollBehavior = scrollBehavior
)
}
@Composable
fun ManagerCenterAlignedTopAppBar(
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
navigationIcon: @Composable () -> Unit = {},
actions: @Composable RowScope.() -> Unit = {},
colors: TopAppBarColors = TopAppBarDefaults.smallTopAppBarColors(),
scrollBehavior: TopAppBarScrollBehavior? = null
) {
CenterAlignedTopAppBar(
modifier = modifier,
title = title,
actions = actions,
navigationIcon = navigationIcon,
colors = colors,
scrollBehavior = scrollBehavior
)
}
================================================
FILE: app/src/main/java/com/vanced/manager/ui/resource/ManagerString.kt
================================================
package com.vanced.manager.ui.resource
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.vanced.manager.R
@Composable
fun managerString(
@StringRes stringId: Int?
) = stringResource(id = stringId ?: R.string.dummy_placeholder_text)
@Composable
fun managerString(
@StringRes stringId: Int?,
vararg formatArgs: Any
) = stringResource(id = stringId ?: R.string.dummy_placeholder_text, *formatArgs)
================================================
FILE: app/src/main/java/com/vanced/manager/ui/screen/AboutScreen.kt
================================================
package com.vanced.manager.ui.screen
import androidx.annotation.DrawableRes
import androidx.annotation.Strin
gitextract_f45693ij/ ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug-issue-template.md │ │ ├── config.yml │ │ └── feature-request-template.md │ └── workflows/ │ ├── debug.yml │ └── lint.yml ├── .gitignore ├── LICENSE ├── README.md ├── READMEME.md ├── app/ │ ├── .gitignore │ ├── build.gradle.kts │ ├── google-services.json │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── vanced/ │ │ └── manager/ │ │ ├── ManagerApplication.kt │ │ ├── di/ │ │ │ ├── APIModule.kt │ │ │ ├── CustomTabsModule.kt │ │ │ ├── DatasourceModule.kt │ │ │ ├── DownloaderModule.kt │ │ │ ├── InstallerModuke.kt │ │ │ ├── ManagerModule.kt │ │ │ ├── NetworkModule.kt │ │ │ ├── RepositoryModule.kt │ │ │ ├── ServiceModule.kt │ │ │ └── ViewModelModule.kt │ │ ├── domain/ │ │ │ └── model/ │ │ │ ├── App.kt │ │ │ └── InstallationOption.kt │ │ ├── downloader/ │ │ │ ├── api/ │ │ │ │ ├── MicrogAPI.kt │ │ │ │ ├── MusicAPI.kt │ │ │ │ └── VancedAPI.kt │ │ │ ├── base/ │ │ │ │ └── AppDownloader.kt │ │ │ ├── impl/ │ │ │ │ ├── MicrogDownloader.kt │ │ │ │ ├── MusicDownloader.kt │ │ │ │ └── VancedDownloader.kt │ │ │ └── util/ │ │ │ └── DownloadPath.kt │ │ ├── installer/ │ │ │ ├── base/ │ │ │ │ └── AppInstaller.kt │ │ │ ├── impl/ │ │ │ │ ├── MicrogInstaller.kt │ │ │ │ ├── MusicInstaller.kt │ │ │ │ └── VancedInstaller.kt │ │ │ ├── service/ │ │ │ │ ├── AppInstallService.kt │ │ │ │ └── AppUninstallService.kt │ │ │ └── util/ │ │ │ ├── PM.kt │ │ │ ├── PMRoot.kt │ │ │ ├── PMRootResult.kt │ │ │ ├── Patcher.kt │ │ │ └── RootPatchHelper.kt │ │ ├── io/ │ │ │ ├── ManagerSuFile.kt │ │ │ └── SUIOException.kt │ │ ├── network/ │ │ │ ├── GithubService.kt │ │ │ ├── dto/ │ │ │ │ └── GithubDto.kt │ │ │ └── util/ │ │ │ └── Constants.kt │ │ ├── preferences/ │ │ │ ├── ManagerPreference.kt │ │ │ └── holder/ │ │ │ ├── PreferenceDefaultValueHolder.kt │ │ │ ├── PreferenceHolder.kt │ │ │ └── PreferenceKeyHolder.kt │ │ ├── repository/ │ │ │ ├── AppRepository.kt │ │ │ ├── PreferenceRepository.kt │ │ │ ├── manager/ │ │ │ │ └── PackageManager.kt │ │ │ └── source/ │ │ │ └── PreferenceDatasource.kt │ │ ├── ui/ │ │ │ ├── MainActivity.kt │ │ │ ├── SplashScreenActivity.kt │ │ │ ├── component/ │ │ │ │ ├── ManagerButton.kt │ │ │ │ ├── ManagerCard.kt │ │ │ │ ├── ManagerDialog.kt │ │ │ │ ├── ManagerDropdownMenu.kt │ │ │ │ ├── ManagerLazyDsl.kt │ │ │ │ ├── ManagerListItem.kt │ │ │ │ ├── ManagerNavigator.kt │ │ │ │ ├── ManagerPreference.kt │ │ │ │ ├── ManagerProgressIndicator.kt │ │ │ │ ├── ManagerScaffold.kt │ │ │ │ ├── ManagerSwipeRefresh.kt │ │ │ │ ├── ManagerText.kt │ │ │ │ └── ManagerTopAppBar.kt │ │ │ ├── resource/ │ │ │ │ └── ManagerString.kt │ │ │ ├── screen/ │ │ │ │ ├── AboutScreen.kt │ │ │ │ ├── ConfigurationScreen.kt │ │ │ │ ├── HomeScreen.kt │ │ │ │ ├── InstallScreen.kt │ │ │ │ └── SettingsScreen.kt │ │ │ ├── theme/ │ │ │ │ ├── Color.kt │ │ │ │ ├── Shape.kt │ │ │ │ ├── Theme.kt │ │ │ │ └── Type.kt │ │ │ ├── util/ │ │ │ │ ├── Color.kt │ │ │ │ ├── Const.kt │ │ │ │ └── Screen.kt │ │ │ ├── viewmodel/ │ │ │ │ ├── ConfigurationViewModel.kt │ │ │ │ ├── InstallViewModel.kt │ │ │ │ ├── MainViewModel.kt │ │ │ │ └── SettingsViewModel.kt │ │ │ └── widget/ │ │ │ ├── AppCard.kt │ │ │ └── LinkCard.kt │ │ └── util/ │ │ ├── AppHelper.kt │ │ ├── Arch.kt │ │ ├── Coroutines.kt │ │ ├── IO.kt │ │ ├── Safety.kt │ │ └── SuShell.kt │ └── res/ │ ├── animator/ │ │ ├── fragment_enter.xml │ │ ├── fragment_enter_pop.xml │ │ ├── fragment_exit.xml │ │ └── fragment_exit_pop.xml │ ├── drawable/ │ │ ├── ic_adguard.xml │ │ ├── ic_android_black_24dp.xml │ │ ├── ic_app_icon_placeholder.xml │ │ ├── ic_brave.xml │ │ ├── ic_brave_light.xml │ │ ├── ic_discord.xml │ │ ├── ic_github.xml │ │ ├── ic_instagram.xml │ │ ├── ic_launch_text.xml │ │ ├── ic_magisk.xml │ │ ├── ic_manager.xml │ │ ├── ic_manager_monet_icon.xml │ │ ├── ic_microg.xml │ │ ├── ic_music.xml │ │ ├── ic_reddit.xml │ │ ├── ic_round_assignment_24.xml │ │ ├── ic_round_close_24.xml │ │ ├── ic_round_done_24.xml │ │ ├── ic_splash.xml │ │ ├── ic_telegram.xml │ │ ├── ic_twitter.xml │ │ ├── ic_vanced.xml │ │ ├── ic_website.xml │ │ └── ic_youtube.xml │ ├── drawable-anydpi-v24/ │ │ └── ic_stat_name.xml │ ├── drawable-v24/ │ │ └── ic_launcher_foreground.xml │ ├── mipmap-anydpi-v26/ │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ ├── values/ │ │ ├── arrays.xml │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── ic_launcher_background.xml │ │ ├── resources.xml │ │ ├── strings.xml │ │ └── themes.xml │ ├── values-af-rZA/ │ │ └── strings.xml │ ├── values-ar-rSA/ │ │ └── strings.xml │ ├── values-az-rAZ/ │ │ └── strings.xml │ ├── values-bg-rBG/ │ │ └── strings.xml │ ├── values-bn-rBD/ │ │ └── strings.xml │ ├── values-bn-rIN/ │ │ └── strings.xml │ ├── values-ca-rES/ │ │ └── strings.xml │ ├── values-ckb-rIR/ │ │ └── strings.xml │ ├── values-cs-rCZ/ │ │ └── strings.xml │ ├── values-da-rDK/ │ │ └── strings.xml │ ├── values-de-rDE/ │ │ └── strings.xml │ ├── values-el-rGR/ │ │ └── strings.xml │ ├── values-es-rES/ │ │ └── strings.xml │ ├── values-et-rEE/ │ │ └── strings.xml │ ├── values-fi-rFI/ │ │ └── strings.xml │ ├── values-fil-rPH/ │ │ └── strings.xml │ ├── values-fr-rFR/ │ │ └── strings.xml │ ├── values-hi-rIN/ │ │ └── strings.xml │ ├── values-hr-rHR/ │ │ └── strings.xml │ ├── values-hu-rHU/ │ │ └── strings.xml │ ├── values-in-rID/ │ │ └── strings.xml │ ├── values-it-rIT/ │ │ └── strings.xml │ ├── values-iw-rIL/ │ │ └── strings.xml │ ├── values-ja-rJP/ │ │ └── strings.xml │ ├── values-ka-rGE/ │ │ └── strings.xml │ ├── values-kmr-rTR/ │ │ └── strings.xml │ ├── values-ko-rKR/ │ │ └── strings.xml │ ├── values-ku-rTR/ │ │ └── strings.xml │ ├── values-lt-rLT/ │ │ └── strings.xml │ ├── values-ml-rIN/ │ │ └── strings.xml │ ├── values-mr-rIN/ │ │ └── strings.xml │ ├── values-night/ │ │ └── colors.xml │ ├── values-nl-rNL/ │ │ └── strings.xml │ ├── values-no-rNO/ │ │ └── strings.xml │ ├── values-pa-rIN/ │ │ └── strings.xml │ ├── values-pa-rPK/ │ │ └── strings.xml │ ├── values-pl-rPL/ │ │ └── strings.xml │ ├── values-ps-rAF/ │ │ └── strings.xml │ ├── values-pt-rBR/ │ │ └── strings.xml │ ├── values-pt-rPT/ │ │ └── strings.xml │ ├── values-ro-rRO/ │ │ └── strings.xml │ ├── values-ru-rRU/ │ │ └── strings.xml │ ├── values-si-rLK/ │ │ └── strings.xml │ ├── values-sk-rSK/ │ │ └── strings.xml │ ├── values-so-rSO/ │ │ └── strings.xml │ ├── values-sr-rSP/ │ │ └── strings.xml │ ├── values-sv-rSE/ │ │ └── strings.xml │ ├── values-ta-rIN/ │ │ └── strings.xml │ ├── values-th-rTH/ │ │ └── strings.xml │ ├── values-tr-rTR/ │ │ └── strings.xml │ ├── values-uk-rUA/ │ │ └── strings.xml │ ├── values-vi-rVN/ │ │ └── strings.xml │ ├── values-zh-rCN/ │ │ └── strings.xml │ ├── values-zh-rTW/ │ │ └── strings.xml │ └── xml/ │ └── file_provider.xml ├── build.gradle.kts ├── crowdin.yml ├── gradle/ │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts
Condensed preview — 202 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (951K chars).
[
{
"path": ".github/ISSUE_TEMPLATE/bug-issue-template.md",
"chars": 489,
"preview": "---\nname: Bug issue template\nabout: Vanced Manager Bug template\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Please only o"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 27,
"preview": "blank_issues_enabled: false"
},
{
"path": ".github/ISSUE_TEMPLATE/feature-request-template.md",
"chars": 366,
"preview": "---\nname: Feature Request Template\nabout: Vanced Manager Feature Request Template\ntitle: ''\nlabels: 'enhancement'\nassign"
},
{
"path": ".github/workflows/debug.yml",
"chars": 746,
"preview": "name: Debug APK Builder\n\non:\n push:\n branches:\n - dev\n paths-ignore:\n - '**.md'\n pull_request:\n bra"
},
{
"path": ".github/workflows/lint.yml",
"chars": 702,
"preview": "name: Code Linter\n\non:\n push:\n branches:\n - dev\n\njobs:\n qodana:\n runs-on: ubuntu-latest\n steps:\n - "
},
{
"path": ".gitignore",
"chars": 40,
"preview": ".gradle/\n.idea/\nbuild/\nlocal.properties\n"
},
{
"path": "LICENSE",
"chars": 35149,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
},
{
"path": "README.md",
"chars": 2150,
"preview": "# Vanced Manager\n["
},
{
"path": "app/.gitignore",
"chars": 15,
"preview": "/build\n/release"
},
{
"path": "app/build.gradle.kts",
"chars": 5477,
"preview": "import org.jetbrains.kotlin.gradle.tasks.KotlinCompile\nimport org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions\n\nplugins "
},
{
"path": "app/google-services.json",
"chars": 1082,
"preview": "{\n \"project_info\": {\n \"project_number\": \"840099702732\",\n \"firebase_url\": \"https://vanced-manager-official.firebas"
},
{
"path": "app/proguard-rules.pro",
"chars": 918,
"preview": "# Add project specific ProGuard rules here.\n# You can control the set of applied configuration files using the\n# proguar"
},
{
"path": "app/src/main/AndroidManifest.xml",
"chars": 1931,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package="
},
{
"path": "app/src/main/java/com/vanced/manager/ManagerApplication.kt",
"chars": 726,
"preview": "package com.vanced.manager\n\nimport android.app.Application\nimport com.vanced.manager.di.*\nimport org.koin.android.ext.ko"
},
{
"path": "app/src/main/java/com/vanced/manager/di/APIModule.kt",
"chars": 1235,
"preview": "package com.vanced.manager.di\n\nimport com.vanced.manager.downloader.api.MicrogAPI\nimport com.vanced.manager.downloader.a"
},
{
"path": "app/src/main/java/com/vanced/manager/di/CustomTabsModule.kt",
"chars": 310,
"preview": "package com.vanced.manager.di\n\nimport androidx.browser.customtabs.CustomTabsIntent\nimport org.koin.dsl.module\n\nval custo"
},
{
"path": "app/src/main/java/com/vanced/manager/di/DatasourceModule.kt",
"chars": 666,
"preview": "package com.vanced.manager.di\n\nimport android.content.Context\nimport com.vanced.manager.repository.source.PreferenceData"
},
{
"path": "app/src/main/java/com/vanced/manager/di/DownloaderModule.kt",
"chars": 1374,
"preview": "package com.vanced.manager.di\n\nimport android.content.Context\nimport com.vanced.manager.downloader.api.MicrogAPI\nimport "
},
{
"path": "app/src/main/java/com/vanced/manager/di/InstallerModuke.kt",
"chars": 1696,
"preview": "package com.vanced.manager.di\n\nimport android.content.Context\nimport com.vanced.manager.installer.impl.MicrogInstaller\ni"
},
{
"path": "app/src/main/java/com/vanced/manager/di/ManagerModule.kt",
"chars": 685,
"preview": "package com.vanced.manager.di\n\nimport android.content.Context\nimport com.vanced.manager.repository.manager.NonrootPackag"
},
{
"path": "app/src/main/java/com/vanced/manager/di/NetworkModule.kt",
"chars": 267,
"preview": "package com.vanced.manager.di\n\nimport okhttp3.OkHttpClient\nimport org.koin.dsl.module\n\nval networkModule = module {\n\n "
},
{
"path": "app/src/main/java/com/vanced/manager/di/RepositoryModule.kt",
"chars": 1306,
"preview": "package com.vanced.manager.di\n\nimport com.vanced.manager.network.GithubService\nimport com.vanced.manager.repository.AppR"
},
{
"path": "app/src/main/java/com/vanced/manager/di/ServiceModule.kt",
"chars": 857,
"preview": "package com.vanced.manager.di\n\nimport com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory\nimpor"
},
{
"path": "app/src/main/java/com/vanced/manager/di/ViewModelModule.kt",
"chars": 2484,
"preview": "package com.vanced.manager.di\n\nimport android.app.Application\nimport com.vanced.manager.downloader.impl.MicrogDownloader"
},
{
"path": "app/src/main/java/com/vanced/manager/domain/model/App.kt",
"chars": 1916,
"preview": "package com.vanced.manager.domain.model\n\nimport androidx.annotation.DrawableRes\nimport com.vanced.manager.R\n\ndata class "
},
{
"path": "app/src/main/java/com/vanced/manager/domain/model/InstallationOption.kt",
"chars": 887,
"preview": "package com.vanced.manager.domain.model\n\nimport android.os.Parcelable\nimport kotlinx.parcelize.Parcelize\n\nsealed interfa"
},
{
"path": "app/src/main/java/com/vanced/manager/downloader/api/MicrogAPI.kt",
"chars": 278,
"preview": "package com.vanced.manager.downloader.api\n\nimport okhttp3.ResponseBody\nimport retrofit2.Call\nimport retrofit2.http.GET\ni"
},
{
"path": "app/src/main/java/com/vanced/manager/downloader/api/MusicAPI.kt",
"chars": 389,
"preview": "package com.vanced.manager.downloader.api\n\nimport okhttp3.ResponseBody\nimport retrofit2.Call\nimport retrofit2.http.GET\ni"
},
{
"path": "app/src/main/java/com/vanced/manager/downloader/api/VancedAPI.kt",
"chars": 480,
"preview": "package com.vanced.manager.downloader.api\n\nimport okhttp3.ResponseBody\nimport retrofit2.Call\nimport retrofit2.http.GET\ni"
},
{
"path": "app/src/main/java/com/vanced/manager/downloader/base/AppDownloader.kt",
"chars": 1845,
"preview": "package com.vanced.manager.downloader.base\n\nimport com.vanced.manager.util.writeFile\nimport okhttp3.ResponseBody\nimport "
},
{
"path": "app/src/main/java/com/vanced/manager/downloader/impl/MicrogDownloader.kt",
"chars": 1427,
"preview": "package com.vanced.manager.downloader.impl\n\nimport android.content.Context\nimport com.vanced.manager.downloader.api.Micr"
},
{
"path": "app/src/main/java/com/vanced/manager/downloader/impl/MusicDownloader.kt",
"chars": 1898,
"preview": "package com.vanced.manager.downloader.impl\n\nimport android.content.Context\nimport com.vanced.manager.downloader.api.Musi"
},
{
"path": "app/src/main/java/com/vanced/manager/downloader/impl/VancedDownloader.kt",
"chars": 2525,
"preview": "package com.vanced.manager.downloader.impl\n\nimport android.content.Context\nimport com.vanced.manager.downloader.api.Vanc"
},
{
"path": "app/src/main/java/com/vanced/manager/downloader/util/DownloadPath.kt",
"chars": 1013,
"preview": "package com.vanced.manager.downloader.util\n\nimport android.content.Context\n\nfun getVancedYoutubePath(\n version: Strin"
},
{
"path": "app/src/main/java/com/vanced/manager/installer/base/AppInstaller.kt",
"chars": 301,
"preview": "package com.vanced.manager.installer.base\n\nimport com.vanced.manager.repository.manager.PackageManagerResult\n\nabstract c"
},
{
"path": "app/src/main/java/com/vanced/manager/installer/impl/MicrogInstaller.kt",
"chars": 858,
"preview": "package com.vanced.manager.installer.impl\n\nimport android.content.Context\nimport com.vanced.manager.downloader.util.getM"
},
{
"path": "app/src/main/java/com/vanced/manager/installer/impl/MusicInstaller.kt",
"chars": 2539,
"preview": "package com.vanced.manager.installer.impl\n\nimport android.content.Context\nimport com.vanced.manager.domain.model.AppData"
},
{
"path": "app/src/main/java/com/vanced/manager/installer/impl/VancedInstaller.kt",
"chars": 2313,
"preview": "package com.vanced.manager.installer.impl\n\nimport android.content.Context\nimport com.vanced.manager.domain.model.AppData"
},
{
"path": "app/src/main/java/com/vanced/manager/installer/service/AppInstallService.kt",
"chars": 1483,
"preview": "package com.vanced.manager.installer.service\n\nimport android.app.Service\nimport android.content.Intent\nimport android.co"
},
{
"path": "app/src/main/java/com/vanced/manager/installer/service/AppUninstallService.kt",
"chars": 1071,
"preview": "package com.vanced.manager.installer.service\n\nimport android.app.Service\nimport android.content.Intent\nimport android.co"
},
{
"path": "app/src/main/java/com/vanced/manager/installer/util/PM.kt",
"chars": 2543,
"preview": "package com.vanced.manager.installer.util\n\nimport android.app.PendingIntent\nimport android.content.Context\nimport androi"
},
{
"path": "app/src/main/java/com/vanced/manager/installer/util/PMRoot.kt",
"chars": 5745,
"preview": "package com.vanced.manager.installer.util\n\nimport com.topjohnwu.superuser.Shell\nimport com.topjohnwu.superuser.io.SuFile"
},
{
"path": "app/src/main/java/com/vanced/manager/installer/util/PMRootResult.kt",
"chars": 1559,
"preview": "package com.vanced.manager.installer.util\n\nenum class PMRootStatus {\n ACTION_FAILED_SET_INSTALLER,\n ACTION_FAILED_"
},
{
"path": "app/src/main/java/com/vanced/manager/installer/util/Patcher.kt",
"chars": 6452,
"preview": "package com.vanced.manager.installer.util\n\nimport com.topjohnwu.superuser.Shell\nimport com.topjohnwu.superuser.io.SuFile"
},
{
"path": "app/src/main/java/com/vanced/manager/installer/util/RootPatchHelper.kt",
"chars": 2121,
"preview": "package com.vanced.manager.installer.util\n\nimport com.vanced.manager.repository.manager.PackageManagerResult\nimport com."
},
{
"path": "app/src/main/java/com/vanced/manager/io/ManagerSuFile.kt",
"chars": 1063,
"preview": "package com.vanced.manager.io\n\nimport com.topjohnwu.superuser.Shell\nimport com.topjohnwu.superuser.io.SuFile\nimport com."
},
{
"path": "app/src/main/java/com/vanced/manager/io/SUIOException.kt",
"chars": 270,
"preview": "package com.vanced.manager.io\n\nimport java.io.IOException\n\nclass SUIOException : IOException {\n constructor(message: "
},
{
"path": "app/src/main/java/com/vanced/manager/network/GithubService.kt",
"chars": 659,
"preview": "package com.vanced.manager.network\n\nimport com.vanced.manager.network.dto.GithubReleaseDto\nimport retrofit2.http.GET\n\npr"
},
{
"path": "app/src/main/java/com/vanced/manager/network/dto/GithubDto.kt",
"chars": 511,
"preview": "package com.vanced.manager.network.dto\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializabl"
},
{
"path": "app/src/main/java/com/vanced/manager/network/util/Constants.kt",
"chars": 949,
"preview": "package com.vanced.manager.network.util\n\nconst val BASE = \"https://api.vancedapp.com/api/v1/\"\n\nconst val GITHUB_API_BASE"
},
{
"path": "app/src/main/java/com/vanced/manager/preferences/ManagerPreference.kt",
"chars": 2345,
"preview": "package com.vanced.manager.preferences\n\nimport android.content.SharedPreferences\nimport androidx.compose.runtime.getValu"
},
{
"path": "app/src/main/java/com/vanced/manager/preferences/holder/PreferenceDefaultValueHolder.kt",
"chars": 343,
"preview": "package com.vanced.manager.preferences.holder\n\nconst val MANAGER_VARIANT_DEFAULT_VALUE = \"nonroot\"\n\nconst val MANAGER_TH"
},
{
"path": "app/src/main/java/com/vanced/manager/preferences/holder/PreferenceHolder.kt",
"chars": 703,
"preview": "package com.vanced.manager.preferences.holder\n\nimport com.vanced.manager.preferences.managerStringPreference\nimport com."
},
{
"path": "app/src/main/java/com/vanced/manager/preferences/holder/PreferenceKeyHolder.kt",
"chars": 586,
"preview": "package com.vanced.manager.preferences.holder\n\nconst val USE_CUSTOM_TABS_KEY = \"use_custom_tabs\"\nconst val MANAGER_VARIA"
},
{
"path": "app/src/main/java/com/vanced/manager/repository/AppRepository.kt",
"chars": 8709,
"preview": "package com.vanced.manager.repository\n\nimport com.vanced.manager.domain.model.App\nimport com.vanced.manager.domain.model"
},
{
"path": "app/src/main/java/com/vanced/manager/repository/PreferenceRepository.kt",
"chars": 2143,
"preview": "package com.vanced.manager.repository\n\nimport androidx.compose.foundation.isSystemInDarkTheme\nimport androidx.compose.ru"
},
{
"path": "app/src/main/java/com/vanced/manager/repository/manager/PackageManager.kt",
"chars": 17165,
"preview": "package com.vanced.manager.repository.manager\n\nimport android.annotation.SuppressLint\nimport android.app.PendingIntent\ni"
},
{
"path": "app/src/main/java/com/vanced/manager/repository/source/PreferenceDatasource.kt",
"chars": 2443,
"preview": "package com.vanced.manager.repository.source\n\nimport android.content.SharedPreferences\n\ninterface PreferenceDatasource {"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/MainActivity.kt",
"chars": 7691,
"preview": "package com.vanced.manager.ui\n\nimport android.content.BroadcastReceiver\nimport android.content.Context\nimport android.co"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/SplashScreenActivity.kt",
"chars": 797,
"preview": "package com.vanced.manager.ui\n\nimport android.content.Intent\nimport android.os.Bundle\nimport androidx.activity.Component"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerButton.kt",
"chars": 4344,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.foundation.BorderStroke\nimport androidx.compose.foundat"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerCard.kt",
"chars": 4286,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.foundation.clickable\nimport androidx.compose.foundation"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerDialog.kt",
"chars": 1019,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.material3.AlertDialog\nimport androidx.compose.runtime.C"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerDropdownMenu.kt",
"chars": 4339,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.animation.ExperimentalAnimationApi\nimport androidx.comp"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerLazyDsl.kt",
"chars": 3910,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.foundation.gestures.FlingBehavior\nimport androidx.compo"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerListItem.kt",
"chars": 2248,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.foundation.layout.*\nimport androidx.compose.material.Co"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerNavigator.kt",
"chars": 2257,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.animation.AnimatedContent\nimport androidx.compose.anima"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerPreference.kt",
"chars": 7705,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.foundation.clickable\nimport androidx.compose.foundation"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerProgressIndicator.kt",
"chars": 1369,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.animation.core.animateFloatAsState\nimport androidx.comp"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerScaffold.kt",
"chars": 1596,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.foundation.layout.PaddingValues\nimport androidx.compose"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerSwipeRefresh.kt",
"chars": 1666,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.foundation.layout.PaddingValues\nimport androidx.compose"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerText.kt",
"chars": 1112,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.material3.LocalTextStyle\nimport androidx.compose.materi"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/component/ManagerTopAppBar.kt",
"chars": 1324,
"preview": "package com.vanced.manager.ui.component\n\nimport androidx.compose.foundation.layout.RowScope\nimport androidx.compose.mate"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/resource/ManagerString.kt",
"chars": 496,
"preview": "package com.vanced.manager.ui.resource\n\nimport androidx.annotation.StringRes\nimport androidx.compose.runtime.Composable\n"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/screen/AboutScreen.kt",
"chars": 7781,
"preview": "package com.vanced.manager.ui.screen\n\nimport androidx.annotation.DrawableRes\nimport androidx.annotation.StringRes\nimport"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/screen/ConfigurationScreen.kt",
"chars": 8833,
"preview": "package com.vanced.manager.ui.screen\n\nimport androidx.compose.animation.*\nimport androidx.compose.animation.core.tween\ni"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/screen/HomeScreen.kt",
"chars": 10251,
"preview": "package com.vanced.manager.ui.screen\n\nimport androidx.annotation.DrawableRes\nimport androidx.compose.animation.*\nimport "
},
{
"path": "app/src/main/java/com/vanced/manager/ui/screen/InstallScreen.kt",
"chars": 6960,
"preview": "package com.vanced.manager.ui.screen\n\nimport androidx.compose.animation.AnimatedVisibility\nimport androidx.compose.anima"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/screen/SettingsScreen.kt",
"chars": 6481,
"preview": "package com.vanced.manager.ui.screen\n\nimport androidx.compose.foundation.layout.fillMaxSize\nimport androidx.compose.foun"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/theme/Color.kt",
"chars": 2968,
"preview": "package com.vanced.manager.ui.theme\n\nimport androidx.compose.ui.graphics.Color\n\nval primaryColor = Color(defAccentColor)"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/theme/Shape.kt",
"chars": 298,
"preview": "package com.vanced.manager.ui.theme\n\nimport androidx.compose.foundation.shape.RoundedCornerShape\nimport androidx.compose"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/theme/Theme.kt",
"chars": 4149,
"preview": "package com.vanced.manager.ui.theme\n\nimport android.os.Build\nimport androidx.compose.foundation.gestures.LocalOverScroll"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/theme/Type.kt",
"chars": 3774,
"preview": "package com.vanced.manager.ui.theme\n\nimport androidx.compose.material3.Typography\nimport androidx.compose.ui.text.TextSt"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/util/Color.kt",
"chars": 327,
"preview": "package com.vanced.manager.ui.util\n\nimport androidx.compose.animation.animateColorAsState\nimport androidx.compose.animat"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/util/Const.kt",
"chars": 194,
"preview": "package com.vanced.manager.ui.util\n\nimport androidx.compose.ui.unit.dp\n\nval DefaultContentPaddingHorizontal = 16.dp\nval "
},
{
"path": "app/src/main/java/com/vanced/manager/ui/util/Screen.kt",
"chars": 1138,
"preview": "package com.vanced.manager.ui.util\n\nimport androidx.annotation.StringRes\nimport com.vanced.manager.R\nimport com.vanced.m"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/viewmodel/ConfigurationViewModel.kt",
"chars": 461,
"preview": "package com.vanced.manager.ui.viewmodel\n\nimport androidx.compose.runtime.getValue\nimport androidx.compose.runtime.mutabl"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/viewmodel/InstallViewModel.kt",
"chars": 5263,
"preview": "package com.vanced.manager.ui.viewmodel\n\nimport android.content.pm.PackageInstaller\nimport androidx.compose.runtime.getV"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/viewmodel/MainViewModel.kt",
"chars": 3585,
"preview": "package com.vanced.manager.ui.viewmodel\n\nimport android.app.Application\nimport android.content.ComponentName\nimport andr"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/viewmodel/SettingsViewModel.kt",
"chars": 1517,
"preview": "package com.vanced.manager.ui.viewmodel\n\nimport androidx.compose.runtime.getValue\nimport androidx.compose.runtime.mutabl"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/widget/AppCard.kt",
"chars": 9219,
"preview": "package com.vanced.manager.ui.widget\n\nimport androidx.compose.foundation.Image\nimport androidx.compose.foundation.layout"
},
{
"path": "app/src/main/java/com/vanced/manager/ui/widget/LinkCard.kt",
"chars": 2022,
"preview": "package com.vanced.manager.ui.widget\n\nimport android.net.Uri\nimport androidx.browser.customtabs.CustomTabsIntent\nimport "
},
{
"path": "app/src/main/java/com/vanced/manager/util/AppHelper.kt",
"chars": 279,
"preview": "package com.vanced.manager.util\n\nfun getLatestOrProvidedAppVersion(\n version: String,\n appVersions: List<String>?\n"
},
{
"path": "app/src/main/java/com/vanced/manager/util/Arch.kt",
"chars": 241,
"preview": "package com.vanced.manager.util\n\nimport android.os.Build\n\nval arch\n get() = when {\n Build.SUPPORTED_ABIS.conta"
},
{
"path": "app/src/main/java/com/vanced/manager/util/Coroutines.kt",
"chars": 402,
"preview": "package com.vanced.manager.util\n\nimport kotlinx.coroutines.CoroutineScope\nimport kotlinx.coroutines.launch\nimport java.u"
},
{
"path": "app/src/main/java/com/vanced/manager/util/IO.kt",
"chars": 926,
"preview": "package com.vanced.manager.util\n\nimport okhttp3.ResponseBody\nimport java.io.FileOutputStream\nimport java.io.InputStream\n"
},
{
"path": "app/src/main/java/com/vanced/manager/util/Safety.kt",
"chars": 739,
"preview": "package com.vanced.manager.util\n\n//Dear reader, welcome to HELL.\n//We don't kink-shame here.\n\ninline fun <reified E1 : E"
},
{
"path": "app/src/main/java/com/vanced/manager/util/SuShell.kt",
"chars": 1000,
"preview": "package com.vanced.manager.util\n\nimport com.topjohnwu.superuser.Shell\nimport kotlin.coroutines.resume\nimport kotlin.coro"
},
{
"path": "app/src/main/res/animator/fragment_enter.xml",
"chars": 813,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:order"
},
{
"path": "app/src/main/res/animator/fragment_enter_pop.xml",
"chars": 813,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:order"
},
{
"path": "app/src/main/res/animator/fragment_exit.xml",
"chars": 813,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:order"
},
{
"path": "app/src/main/res/animator/fragment_exit_pop.xml",
"chars": 813,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:order"
},
{
"path": "app/src/main/res/drawable/ic_adguard.xml",
"chars": 551,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_android_black_24dp.xml",
"chars": 595,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\""
},
{
"path": "app/src/main/res/drawable/ic_app_icon_placeholder.xml",
"chars": 319,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android"
},
{
"path": "app/src/main/res/drawable/ic_brave.xml",
"chars": 2828,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_brave_light.xml",
"chars": 2178,
"preview": "<vector android:height=\"41dp\" android:viewportHeight=\"35\"\n android:viewportWidth=\"35\" android:width=\"41dp\" xmlns:andr"
},
{
"path": "app/src/main/res/drawable/ic_discord.xml",
"chars": 1768,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_github.xml",
"chars": 1108,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_instagram.xml",
"chars": 2336,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_launch_text.xml",
"chars": 10366,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:aapt=\"http://schemas.android.com/aapt\"\n "
},
{
"path": "app/src/main/res/drawable/ic_magisk.xml",
"chars": 2998,
"preview": "<vector android:height=\"24dp\" android:viewportHeight=\"24\"\n android:viewportWidth=\"24\" android:width=\"24dp\" xmlns:andr"
},
{
"path": "app/src/main/res/drawable/ic_manager.xml",
"chars": 4999,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:aapt=\"http://schemas.android.com/aapt\"\n "
},
{
"path": "app/src/main/res/drawable/ic_manager_monet_icon.xml",
"chars": 6080,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_microg.xml",
"chars": 4407,
"preview": "<vector android:height=\"64.15012dp\" android:viewportHeight=\"1837.5\"\n android:viewportWidth=\"1833.2\" android:width=\"64"
},
{
"path": "app/src/main/res/drawable/ic_music.xml",
"chars": 4671,
"preview": "<vector android:height=\"64.15012dp\" android:viewportHeight=\"1837.5\"\n android:viewportWidth=\"1833.2\" android:width=\"64"
},
{
"path": "app/src/main/res/drawable/ic_reddit.xml",
"chars": 1534,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_round_assignment_24.xml",
"chars": 798,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_round_close_24.xml",
"chars": 666,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_round_done_24.xml",
"chars": 530,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_splash.xml",
"chars": 285,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list\n xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n "
},
{
"path": "app/src/main/res/drawable/ic_telegram.xml",
"chars": 1044,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_twitter.xml",
"chars": 813,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_vanced.xml",
"chars": 5379,
"preview": "<vector android:height=\"64.15012dp\" android:viewportHeight=\"1837.5\"\n android:viewportWidth=\"1833.2\" android:width=\"64"
},
{
"path": "app/src/main/res/drawable/ic_website.xml",
"chars": 2174,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable/ic_youtube.xml",
"chars": 633,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"24dp\"\n android:height=\"24dp\"\n "
},
{
"path": "app/src/main/res/drawable-anydpi-v24/ic_stat_name.xml",
"chars": 5350,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:aapt=\"http://schemas.android.com/aapt\"\n "
},
{
"path": "app/src/main/res/drawable-v24/ic_launcher_foreground.xml",
"chars": 5381,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:aapt=\"http://schemas.android.com/aapt\"\n "
},
{
"path": "app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml",
"chars": 337,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <b"
},
{
"path": "app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml",
"chars": 337,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <b"
},
{
"path": "app/src/main/res/values/arrays.xml",
"chars": 64,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n</resources>"
},
{
"path": "app/src/main/res/values/attrs.xml",
"chars": 1721,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n <attr name=\"colorDisabled\" format=\"color\" />\n <attr name=\"col"
},
{
"path": "app/src/main/res/values/colors.xml",
"chars": 460,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n <color name=\"Vanced\">#673AB7</color>\n <color name=\"Brave\">#FB"
},
{
"path": "app/src/main/res/values/dimens.xml",
"chars": 149,
"preview": "<resources>\n <!-- Default screen margins, per the Android Design guidelines. -->\n\n <dimen name=\"top_header_margin\""
},
{
"path": "app/src/main/res/values/ic_launcher_background.xml",
"chars": 120,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"ic_launcher_background\">#171719</color>\n</resources>"
},
{
"path": "app/src/main/res/values/resources.xml",
"chars": 384,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n <string name=\"app_name\" translatable=\"false\">Vanced Manager</str"
},
{
"path": "app/src/main/res/values/strings.xml",
"chars": 10958,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<resources>\n\n <!-- Dummy -->\n <string name=\"dummy_placehold"
},
{
"path": "app/src/main/res/values/themes.xml",
"chars": 371,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n <style name=\"SplashTheme\" parent=\"Theme.MaterialComponents.DayNi"
},
{
"path": "app/src/main/res/values-af-rZA/strings.xml",
"chars": 10030,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-ar-rSA/strings.xml",
"chars": 9669,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-az-rAZ/strings.xml",
"chars": 10215,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-bg-rBG/strings.xml",
"chars": 10408,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-bn-rBD/strings.xml",
"chars": 10193,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-bn-rIN/strings.xml",
"chars": 10492,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-ca-rES/strings.xml",
"chars": 10601,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-ckb-rIR/strings.xml",
"chars": 10308,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-cs-rCZ/strings.xml",
"chars": 10509,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-da-rDK/strings.xml",
"chars": 10084,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-de-rDE/strings.xml",
"chars": 10952,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-el-rGR/strings.xml",
"chars": 11350,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-es-rES/strings.xml",
"chars": 10817,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-et-rEE/strings.xml",
"chars": 10151,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-fi-rFI/strings.xml",
"chars": 10333,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-fil-rPH/strings.xml",
"chars": 10348,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-fr-rFR/strings.xml",
"chars": 11085,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-hi-rIN/strings.xml",
"chars": 10201,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-hr-rHR/strings.xml",
"chars": 10413,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-hu-rHU/strings.xml",
"chars": 10470,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-in-rID/strings.xml",
"chars": 10331,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-it-rIT/strings.xml",
"chars": 10663,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-iw-rIL/strings.xml",
"chars": 9487,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-ja-rJP/strings.xml",
"chars": 8644,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-ka-rGE/strings.xml",
"chars": 10113,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-kmr-rTR/strings.xml",
"chars": 10347,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-ko-rKR/strings.xml",
"chars": 8533,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-ku-rTR/strings.xml",
"chars": 10330,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-lt-rLT/strings.xml",
"chars": 10005,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-ml-rIN/strings.xml",
"chars": 11088,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-mr-rIN/strings.xml",
"chars": 10027,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-night/colors.xml",
"chars": 171,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n <!--Splash screen color for dark/night theme-->\n <color name="
},
{
"path": "app/src/main/res/values-nl-rNL/strings.xml",
"chars": 10441,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-no-rNO/strings.xml",
"chars": 10026,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-pa-rIN/strings.xml",
"chars": 10027,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-pa-rPK/strings.xml",
"chars": 10005,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-pl-rPL/strings.xml",
"chars": 10545,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-ps-rAF/strings.xml",
"chars": 10005,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-pt-rBR/strings.xml",
"chars": 10575,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-pt-rPT/strings.xml",
"chars": 10632,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-ro-rRO/strings.xml",
"chars": 10637,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-ru-rRU/strings.xml",
"chars": 10464,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-si-rLK/strings.xml",
"chars": 10031,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-sk-rSK/strings.xml",
"chars": 10507,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-so-rSO/strings.xml",
"chars": 10540,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-sr-rSP/strings.xml",
"chars": 10489,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-sv-rSE/strings.xml",
"chars": 10178,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-ta-rIN/strings.xml",
"chars": 10936,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-th-rTH/strings.xml",
"chars": 9862,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-tr-rTR/strings.xml",
"chars": 10434,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-uk-rUA/strings.xml",
"chars": 10319,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-vi-rVN/strings.xml",
"chars": 9976,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-zh-rCN/strings.xml",
"chars": 7787,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/values-zh-rTW/strings.xml",
"chars": 7789,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<resources>\n <!-- Global Strings -->\n <string name=\"dialog_"
},
{
"path": "app/src/main/res/xml/file_provider.xml",
"chars": 123,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<paths>\n\n <external-files-path\n name=\"files\"\n path=\".\" />\n\n</pat"
},
{
"path": "build.gradle.kts",
"chars": 517,
"preview": "buildscript {\n repositories {\n google()\n mavenCentral()\n }\n\n val kotlinVersion = \"1.6.10\"\n dep"
},
{
"path": "crowdin.yml",
"chars": 125,
"preview": "files:\n - source: /app/src/main/res/values/strings.xml\n translation: /app/src/main/res/values-%android_code%/strings"
},
{
"path": "gradle/wrapper/gradle-wrapper.properties",
"chars": 200,
"preview": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributi"
},
{
"path": "gradle.properties",
"chars": 797,
"preview": "## For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/buil"
},
{
"path": "gradlew",
"chars": 5766,
"preview": "#!/usr/bin/env sh\n\n#\n# Copyright 2015 the original author or authors.\n#\n# Licensed under the Apache License, Version 2.0"
},
{
"path": "gradlew.bat",
"chars": 2674,
"preview": "@rem\n@rem Copyright 2015 the original author or authors.\n@rem\n@rem Licensed under the Apache License, Version 2.0 (the \""
}
]
// ... and 2 more files (download for full content)
About this extraction
This page contains the full source code of the TeamVanced/VancedManager GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 202 files (883.7 KB), approximately 253.0k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.