Showing preview only (1,026K chars total). Download the full file or copy to clipboard to get everything.
Repository: trinadhthatakula/Thor
Branch: master
Commit: 463cdc746d41
Files: 285
Total size: 933.3 KB
Directory structure:
gitextract_upudqvso/
├── .github/
│ ├── FUNDING.yml
│ ├── dependabot.yml
│ └── workflows/
│ ├── copilot-setup-steps.yml
│ ├── dev-check.yml
│ ├── manual-build.yml
│ ├── production-deploy.yml
│ ├── release-manager.yml
│ └── telegram-release.yml
├── .gitignore
├── .idea/
│ ├── .gitignore
│ ├── AndroidProjectSystem.xml
│ ├── codeStyles/
│ │ ├── Project.xml
│ │ └── codeStyleConfig.xml
│ ├── compiler.xml
│ ├── copilot.data.migration.agent.xml
│ ├── copilot.data.migration.ask.xml
│ ├── copilot.data.migration.ask2agent.xml
│ ├── copilot.data.migration.edit.xml
│ ├── deviceManager.xml
│ ├── dictionaries/
│ │ └── project.xml
│ ├── google-java-format.xml
│ ├── gradle.xml
│ ├── inspectionProfiles/
│ │ └── Project_Default.xml
│ ├── kotlinc.xml
│ ├── markdown.xml
│ ├── migrations.xml
│ ├── misc.xml
│ ├── runConfigurations/
│ │ └── Generate_Baseline_Profile_for_app.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
├── LICENSE
├── PROJECT_CONTEXT.md
├── README.md
├── app/
│ ├── .gitignore
│ ├── baselineprofile/
│ │ ├── .gitignore
│ │ ├── build.gradle.kts
│ │ └── src/
│ │ └── main/
│ │ ├── AndroidManifest.xml
│ │ └── java/
│ │ └── com/
│ │ └── valhalla/
│ │ └── thor/
│ │ └── baselineprofile/
│ │ ├── BaselineProfileGenerator.kt
│ │ └── StartupBenchmarks.kt
│ ├── build.gradle.kts
│ ├── proguard-rules-foss.pro
│ ├── proguard-rules.pro
│ ├── schemas/
│ │ └── com.valhalla.thor.data.source.local.room.AppDatabase/
│ │ ├── 1.json
│ │ └── 2.json
│ └── src/
│ ├── androidTest/
│ │ └── java/
│ │ └── com/
│ │ └── valhalla/
│ │ └── thor/
│ │ └── ExampleInstrumentedTest.kt
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── assets/
│ │ │ └── adi-registration.properties
│ │ ├── java/
│ │ │ ├── android/
│ │ │ │ └── content/
│ │ │ │ └── pm/
│ │ │ │ ├── IPackageInstaller.java
│ │ │ │ └── IPackageManager.java
│ │ │ └── com/
│ │ │ └── valhalla/
│ │ │ └── thor/
│ │ │ ├── HomeActivity.kt
│ │ │ ├── ThorApplication.kt
│ │ │ ├── core/
│ │ │ │ └── ThorShellConfig.kt
│ │ │ ├── data/
│ │ │ │ ├── Constants.kt
│ │ │ │ ├── gateway/
│ │ │ │ │ ├── DhizukuSystemGateway.kt
│ │ │ │ │ ├── RootSystemGateway.kt
│ │ │ │ │ └── ShizukuSystemGateway.kt
│ │ │ │ ├── receivers/
│ │ │ │ │ └── InstallReceiver.kt
│ │ │ │ ├── repository/
│ │ │ │ │ ├── AppAnalyzerImpl.kt
│ │ │ │ │ ├── AppRepositoryImpl.kt
│ │ │ │ │ ├── InstallerRepositoryImpl.kt
│ │ │ │ │ ├── PreferenceRepositoryImpl.kt
│ │ │ │ │ └── SystemRepositoryImpl.kt
│ │ │ │ ├── security/
│ │ │ │ │ └── BiometricHelper.kt
│ │ │ │ ├── source/
│ │ │ │ │ └── local/
│ │ │ │ │ ├── ShellDataSource.kt
│ │ │ │ │ ├── dhizuku/
│ │ │ │ │ │ ├── Dhizuku.kt
│ │ │ │ │ │ └── DhizukuReflector.kt
│ │ │ │ │ ├── room/
│ │ │ │ │ │ ├── AppDao.kt
│ │ │ │ │ │ ├── AppDatabase.kt
│ │ │ │ │ │ ├── AppEntity.kt
│ │ │ │ │ │ └── AppTypeConverters.kt
│ │ │ │ │ ├── root/
│ │ │ │ │ │ └── RootMain.kt
│ │ │ │ │ └── shizuku/
│ │ │ │ │ ├── PackageManagerExt.kt
│ │ │ │ │ ├── Packages.kt
│ │ │ │ │ ├── Shizuku.kt
│ │ │ │ │ ├── ShizukuPackageInstallerUtils.kt
│ │ │ │ │ ├── ShizukuReflector.kt
│ │ │ │ │ └── Targets.kt
│ │ │ │ └── util/
│ │ │ │ ├── ApksMetadataGenerator.kt
│ │ │ │ └── PackageVerifier.kt
│ │ │ ├── di/
│ │ │ │ └── Modules.kt
│ │ │ ├── domain/
│ │ │ │ ├── InstallState.kt
│ │ │ │ ├── InstallerEventBus.kt
│ │ │ │ ├── gateway/
│ │ │ │ │ └── SystemGateway.kt
│ │ │ │ ├── model/
│ │ │ │ │ ├── ApkDetails.kt
│ │ │ │ │ ├── AppClickAction.kt
│ │ │ │ │ ├── AppInfo.kt
│ │ │ │ │ ├── AppInstallable.kt
│ │ │ │ │ ├── AppListType.kt
│ │ │ │ │ ├── AppMetadata.kt
│ │ │ │ │ ├── FilterType.kt
│ │ │ │ │ ├── HistoryRecord.kt
│ │ │ │ │ ├── MultiAppAction.kt
│ │ │ │ │ ├── PrivilegeMode.kt
│ │ │ │ │ ├── SortBy.kt
│ │ │ │ │ ├── ThemeMode.kt
│ │ │ │ │ └── UserPreferences.kt
│ │ │ │ ├── repository/
│ │ │ │ │ ├── AppAnalyzer.kt
│ │ │ │ │ ├── AppRepository.kt
│ │ │ │ │ ├── InstallerRepository.kt
│ │ │ │ │ ├── PreferenceRepository.kt
│ │ │ │ │ └── SystemRepository.kt
│ │ │ │ └── usecase/
│ │ │ │ ├── GetAppDetailsUseCase.kt
│ │ │ │ ├── GetInstalledAppsUseCase.kt
│ │ │ │ ├── ManageAppUseCase.kt
│ │ │ │ └── ShareAppUseCase.kt
│ │ │ ├── presentation/
│ │ │ │ ├── appList/
│ │ │ │ │ ├── AppListScreen.kt
│ │ │ │ │ └── AppListViewModel.kt
│ │ │ │ ├── common/
│ │ │ │ │ ├── ShizukuPermissionHandler.kt
│ │ │ │ │ └── components/
│ │ │ │ │ └── ConnectedButtonGroup.kt
│ │ │ │ ├── freezer/
│ │ │ │ │ ├── FreezerScreen.kt
│ │ │ │ │ └── FreezerViewModel.kt
│ │ │ │ ├── home/
│ │ │ │ │ ├── AppDestinations.kt
│ │ │ │ │ ├── HomeScreen.kt
│ │ │ │ │ ├── HomeViewModel.kt
│ │ │ │ │ └── components/
│ │ │ │ │ ├── AnimatedCounter.kt
│ │ │ │ │ ├── AppDistributionChart.kt
│ │ │ │ │ ├── DashboardHeader.kt
│ │ │ │ │ ├── SocialLinksRow.kt
│ │ │ │ │ └── SummaryStatRow.kt
│ │ │ │ ├── installer/
│ │ │ │ │ ├── InstallerViewModel.kt
│ │ │ │ │ ├── PortableInstaller.kt
│ │ │ │ │ └── PortableInstallerActivity.kt
│ │ │ │ ├── main/
│ │ │ │ │ ├── MainScreen.kt
│ │ │ │ │ ├── MainViewModel.kt
│ │ │ │ │ └── ThorNavigationBar.kt
│ │ │ │ ├── security/
│ │ │ │ │ ├── AuthState.kt
│ │ │ │ │ ├── BiometricPromptHandler.kt
│ │ │ │ │ ├── BiometricScreen.kt
│ │ │ │ │ └── SecurityViewModel.kt
│ │ │ │ ├── settings/
│ │ │ │ │ ├── SettingsScreen.kt
│ │ │ │ │ └── SettingsViewModel.kt
│ │ │ │ ├── theme/
│ │ │ │ │ ├── Color.kt
│ │ │ │ │ ├── Motion.kt
│ │ │ │ │ ├── Theme.kt
│ │ │ │ │ └── Type.kt
│ │ │ │ ├── utils/
│ │ │ │ │ ├── AppIconLoader.kt
│ │ │ │ │ ├── CacheScanner.kt
│ │ │ │ │ └── UiUtils.kt
│ │ │ │ └── widgets/
│ │ │ │ ├── AffirmationDialog.kt
│ │ │ │ ├── AnimateLottieRaw.kt
│ │ │ │ ├── AppInfoDialog.kt
│ │ │ │ ├── AppList.kt
│ │ │ │ ├── MultiSelectToolBox.kt
│ │ │ │ ├── TermLogger.kt
│ │ │ │ └── TypeWriterText.kt
│ │ │ └── util/
│ │ │ ├── LocaleManager.kt
│ │ │ └── Logger.kt
│ │ └── res/
│ │ ├── drawable/
│ │ │ ├── android.xml
│ │ │ ├── apk_install.xml
│ │ │ ├── apps.xml
│ │ │ ├── arrow_downward.xml
│ │ │ ├── arrow_drop_down.xml
│ │ │ ├── arrow_upward.xml
│ │ │ ├── bolt.xml
│ │ │ ├── brand_github.xml
│ │ │ ├── brand_patreon.xml
│ │ │ ├── brand_telegram.xml
│ │ │ ├── cat.xml
│ │ │ ├── check_circle.xml
│ │ │ ├── clear_all.xml
│ │ │ ├── danger.xml
│ │ │ ├── delete.xml
│ │ │ ├── delete_forever.xml
│ │ │ ├── dhizuku.xml
│ │ │ ├── exit_to_app.xml
│ │ │ ├── filter_list.xml
│ │ │ ├── force_close.xml
│ │ │ ├── freeze_off.xml
│ │ │ ├── frozen.xml
│ │ │ ├── grid_view.xml
│ │ │ ├── home.xml
│ │ │ ├── home_outline.xml
│ │ │ ├── ic_launcher_background.xml
│ │ │ ├── ic_launcher_foreground.xml
│ │ │ ├── ios_share.xml
│ │ │ ├── key.xml
│ │ │ ├── key_outline.xml
│ │ │ ├── list.xml
│ │ │ ├── magisk_icon.xml
│ │ │ ├── open_in.xml
│ │ │ ├── open_in_new.xml
│ │ │ ├── privacy_tip.xml
│ │ │ ├── round_close.xml
│ │ │ ├── round_key.xml
│ │ │ ├── round_search.xml
│ │ │ ├── settings.xml
│ │ │ ├── settings_backup_restore.xml
│ │ │ ├── settings_outline.xml
│ │ │ ├── share.xml
│ │ │ ├── shield.xml
│ │ │ ├── shield_bad.xml
│ │ │ ├── shield_countdown.xml
│ │ │ ├── shield_encrypted.xml
│ │ │ ├── shield_maybe.xml
│ │ │ ├── shield_search.xml
│ │ │ ├── shield_verified.xml
│ │ │ ├── shield_with_heart.xml
│ │ │ ├── shizuku.xml
│ │ │ ├── shizuku_outline_icon.xml
│ │ │ ├── snowflake.xml
│ │ │ ├── sort.xml
│ │ │ ├── sort_by_alpha.xml
│ │ │ ├── storage.xml
│ │ │ ├── theme_panel.xml
│ │ │ ├── thor_animated.xml
│ │ │ ├── thor_drawn_foreground.xml
│ │ │ ├── thor_icon_foreground.xml
│ │ │ ├── thor_mono.xml
│ │ │ ├── unfreeze.xml
│ │ │ ├── view_stream.xml
│ │ │ └── warning.xml
│ │ ├── mipmap-anydpi-v26/
│ │ │ ├── thor_drawn.xml
│ │ │ └── thor_drawn_round.xml
│ │ ├── raw/
│ │ │ └── rearrange.json
│ │ ├── raw-night/
│ │ │ └── rearrange.json
│ │ ├── values/
│ │ │ ├── colors.xml
│ │ │ ├── font_certs.xml
│ │ │ ├── non-translatable.xml
│ │ │ ├── strings.xml
│ │ │ ├── themes.xml
│ │ │ ├── thor_drawn_background.xml
│ │ │ └── thor_icon_background.xml
│ │ ├── values-ar/
│ │ │ └── strings.xml
│ │ ├── values-es/
│ │ │ └── strings.xml
│ │ ├── values-fr/
│ │ │ └── strings.xml
│ │ ├── values-v31/
│ │ │ └── themes.xml
│ │ ├── values-zh-rCN/
│ │ │ └── strings.xml
│ │ └── xml/
│ │ ├── backup_rules.xml
│ │ ├── data_extraction_rules.xml
│ │ ├── locales_config.xml
│ │ └── provider_paths.xml
│ └── test/
│ └── java/
│ └── com/
│ └── valhalla/
│ └── thor/
│ └── ExampleUnitTest.kt
├── build.gradle.kts
├── bypass/
│ ├── .gitignore
│ ├── README.md
│ ├── build.gradle.kts
│ ├── consumer-rules.pro
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ └── java/
│ └── com/
│ └── valhalla/
│ └── bypass/
│ └── Bypass.kt
├── fastlane/
│ ├── Appfile
│ ├── Fastfile
│ └── metadata/
│ └── android/
│ └── en-US/
│ ├── changelogs/
│ │ └── 1600.txt
│ ├── full_description.txt
│ ├── short_description.txt
│ └── title.txt
├── gradle/
│ ├── gradle-daemon-jvm.properties
│ ├── libs.versions.toml
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── settings.gradle.kts
├── suCore/
│ ├── .gitignore
│ ├── README.md
│ ├── build.gradle.kts
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── aidl/
│ │ └── com/
│ │ └── valhalla/
│ │ └── superuser/
│ │ └── ipc/
│ │ └── IIPC.aidl
│ └── java/
│ └── com/
│ └── valhalla/
│ └── superuser/
│ ├── CallbackList.kt
│ ├── NoShellException.kt
│ ├── Shell.kt
│ ├── ShellUtils.kt
│ ├── internal/
│ │ ├── BuilderImpl.kt
│ │ ├── CoroutineStreamGobbler.kt
│ │ ├── JobTask.kt
│ │ ├── MainShell.kt
│ │ ├── PendingJob.kt
│ │ ├── ResultFuture.kt
│ │ ├── ResultHolder.kt
│ │ ├── ResultImpl.kt
│ │ ├── ShellImpl.kt
│ │ ├── ShellInputSource.kt
│ │ ├── ShellJob.kt
│ │ ├── StreamGobbler.kt
│ │ ├── UiThreadHandler.kt
│ │ └── Utils.kt
│ ├── ktx/
│ │ ├── ShellExtensions.kt
│ │ └── ShellRepository.kt
│ └── utils/
│ ├── Logger.kt
│ └── ShellUtils.kt
└── vm-runtime/
├── README.md
├── build.gradle.kts
└── src/
└── main/
└── java/
└── dalvik/
└── system/
└── VMRuntime.java
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/FUNDING.yml
================================================
github: trinadhthatakula
patreon: trinadh
ko_fi: trinadh
buy_me_a_coffee: trinadh
custom: [ "https://www.paypal.me/trinadhthatakula" ]
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"
target-branch: "dev"
groups:
maven:
patterns:
- "*"
================================================
FILE: .github/workflows/copilot-setup-steps.yml
================================================
name: "Copilot Setup Steps"
on:
workflow_dispatch:
push:
branches: [ "master" ]
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
copilot-setup-steps:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
cache: 'gradle'
# Optional: Verify installation and warm up the Gradle daemon
- name: Verify Java Version
run: java -version && ./gradlew --version
================================================
FILE: .github/workflows/dev-check.yml
================================================
name: Dev Build & Test
on:
push:
branches: [ "master" ]
workflow_dispatch:
jobs:
build-release-check:
runs-on: ubuntu-latest
permissions:
contents: write # Required for creating GitHub Releases
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
cache: 'gradle'
# Added Ruby for Fastlane in Dev
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Install Fastlane
run: gem install fastlane
# --- 1. SECRETS INJECTION ---
- name: Decode Keystore
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
run: echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > app/release.jks
# Added Play Store JSON for Dev (needed for Internal Track upload)
- name: Decode Google Play Service Account
env:
PLAY_STORE_JSON_KEY: ${{ secrets.PLAY_STORE_JSON_KEY }}
run: echo "$PLAY_STORE_JSON_KEY" > app/google-play-api.json
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# --- 2. BUILD & DEPLOY (FASTLANE) ---
# Replaced manual Gradle command with Fastlane lane
- name: Run Fastlane (Distribute Dev)
env:
JSON_KEY_FILE: ${{ github.workspace }}/app/google-play-api.json
SUPPLY_JSON_KEY: ${{ github.workspace }}/app/google-play-api.json
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_FILE_PATH: ${{ github.workspace }}/app/release.jks
run: fastlane android distribute_dev
# --- 3. TELEGRAM ---
- name: Send APK to Telegram
if: success()
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
run: |
# Fastlane 'copyStoreReleaseApk' task puts it here
APK_PATH=$(find app/build/distribution/store -name "*.apk" | head -n 1)
if [ ! -f "$APK_PATH" ]; then
echo "Error: APK not found in app/build/distribution/store/"
exit 1
fi
echo "Sending $APK_PATH to Telegram..."
CAPTION="🚀 *Thor (Valhalla) Dev Build*
branch: ${{ github.ref_name }}
author: ${{ github.actor }}
track: Internal Testing
status: Uploaded to Play Store & GitHub"
curl -s -F "chat_id=$TELEGRAM_CHAT_ID" \
-F "document=@$APK_PATH" \
-F "caption=$CAPTION" \
-F "parse_mode=Markdown" \
"https://api.telegram.org/bot$TELEGRAM_TOKEN/sendDocument" > /dev/null
# --- 4. GITHUB RELEASE (PRE-RELEASE) ---
- name: Read Version Info
id: get_version
run: |
VERSION_NAME=$(cat version_name.txt)
echo "version_name=$VERSION_NAME" >> "$GITHUB_OUTPUT"
- name: Create GitHub Pre-Release
uses: softprops/action-gh-release@v2
with:
# Unique tag for dev builds: v1.0.0-dev-45
tag_name: v${{ steps.get_version.outputs.version_name }}-dev-${{ github.run_number }}
name: Dev Build v${{ steps.get_version.outputs.version_name }} (${{ github.run_number }})
files: |
app/build/distribution/foss/foss-release.apk
app/build/distribution/store/store-release.apk
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# --- 5. CLEANUP ---
- name: Cleanup sensitive files
if: always()
run: |
rm -f app/release.jks
rm -f app/google-play-api.json
================================================
FILE: .github/workflows/manual-build.yml
================================================
name: Manual Build (No Upload)
on:
workflow_dispatch:
jobs:
build-only:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
cache: 'gradle'
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Install Fastlane
run: gem install fastlane
# --- SECRET DECODING (Required for Play Store Version Check & Signing) ---
- name: Decode Keystore
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
run: echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > app/release.jks
- name: Decode Google Play Service Account
env:
PLAY_STORE_JSON_KEY: ${{ secrets.PLAY_STORE_JSON_KEY }}
run: echo "$PLAY_STORE_JSON_KEY" > app/google-play-api.json
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# --- FASTLANE ---
- name: Run Fastlane (Build Candidates)
env:
JSON_KEY_FILE: ${{ github.workspace }}/app/google-play-api.json
SUPPLY_JSON_KEY: ${{ github.workspace }}/app/google-play-api.json
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_FILE_PATH: ${{ github.workspace }}/app/release.jks
run: fastlane android build_release_candidates
# --- ARTIFACT UPLOAD ---
- name: Read Version Info
id: version_info
run: |
echo "VERSION_NAME=$(cat version_name.txt)" >> $GITHUB_ENV
echo "VERSION_CODE=$(cat version_code.txt)" >> $GITHUB_ENV
- name: Upload APKs to GitHub Actions
uses: actions/upload-artifact@v4
with:
name: Thor-v${{ env.VERSION_NAME }}-Build-${{ env.VERSION_CODE }}
path: |
app/build/distribution/foss/foss-release.apk
app/build/distribution/store/store-release.apk
# --- SECURITY CLEANUP ---
- name: Cleanup sensitive files
if: always()
run: |
rm -f app/release.jks
rm -f app/google-play-api.json
================================================
FILE: .github/workflows/production-deploy.yml
================================================
name: 2. Production Build & Distribute
on:
push:
branches: [ "production" ]
workflow_dispatch:
jobs:
release-distribute:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
cache: 'gradle'
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Install Fastlane
run: gem install fastlane
# --- SECRET DECODING ---
- name: Decode Keystore
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
run: echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > app/release.jks
- name: Decode Google Play Service Account
env:
PLAY_STORE_JSON_KEY: ${{ secrets.PLAY_STORE_JSON_KEY }}
run: echo "$PLAY_STORE_JSON_KEY" > app/google-play-api.json
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# --- FASTLANE (CLOSED TESTING) ---
- name: Run Fastlane (Distribute Prod)
env:
JSON_KEY_FILE: ${{ github.workspace }}/app/google-play-api.json
SUPPLY_JSON_KEY: ${{ github.workspace }}/app/google-play-api.json
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_FILE_PATH: ${{ github.workspace }}/app/release.jks
# Updated to use the production lane (Closed Track)
run: fastlane android distribute_production
# --- SYNC & RELEASE ---
- name: Read Version Name
id: get_app_version
run: |
VERSION_NAME=$(cat version_name.txt)
echo "version_name=$VERSION_NAME" >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.get_app_version.outputs.version_name }}
name: Release v${{ steps.get_app_version.outputs.version_name }}
files: |
app/build/distribution/foss/foss-release.apk
app/build/distribution/store/store-release.apk
app/build/outputs/bundle/storeRelease/*.aab
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# --- SECURITY CLEANUP ---
- name: Cleanup sensitive files
if: always()
run: |
rm -f app/release.jks
rm -f app/google-play-api.json
================================================
FILE: .github/workflows/release-manager.yml
================================================
name: 1. Release Manager (Bump Version)
on:
workflow_dispatch:
inputs:
bump_type:
description: 'Version Bump Type (affects Version Name)'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
- none (code only)
jobs:
bump-and-push:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Use a PAT if you want this push to trigger the 'production-deploy' workflow automatically.
# If you use the default token, you must trigger production-deploy manually.
token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
ref: production
- name: Setup Java (for property parsing if needed, or simple bash)
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
- name: Bump Version in gradle.properties
run: |
PROPS_FILE="gradle.properties"
# 1. Read Current Values
CURRENT_CODE=$(grep "versionCode" $PROPS_FILE | cut -d'=' -f2)
CURRENT_NAME=$(grep "versionName" $PROPS_FILE | cut -d'=' -f2)
echo "Current Version: $CURRENT_NAME ($CURRENT_CODE)"
# 2. Increment Version Code (Always +1 for release)
NEW_CODE=$((CURRENT_CODE + 1))
# 3. Increment Version Name
# Split version name X.Y.Z
IFS='.' read -r -a parts <<< "$CURRENT_NAME"
major=${parts[0]}
minor=${parts[1]}
patch=${parts[2]}
case "${{ inputs.bump_type }}" in
major) major=$((major + 1)); minor=0; patch=0 ;;
minor) minor=$((minor + 1)); patch=0 ;;
patch) patch=$((patch + 1)) ;;
*) echo "Skipping name bump";;
esac
NEW_NAME="$major.$minor.$patch"
echo "New Version: $NEW_NAME ($NEW_CODE)"
# 4. Write back to file (Linux sed)
sed -i "s/versionCode=.*/versionCode=$NEW_CODE/" $PROPS_FILE
sed -i "s/versionName=.*/versionName=$NEW_NAME/" $PROPS_FILE
# 5. Output for next steps
echo "NEW_NAME=$NEW_NAME" >> $GITHUB_ENV
echo "NEW_CODE=$NEW_CODE" >> $GITHUB_ENV
- name: Commit and Push
run: |
git config --global user.name "GitHub Actions CI"
git config --global user.email "actions@github.com"
git add gradle.properties
git commit -m "chore(release): bump version to v${{ env.NEW_NAME }} ($NEW_CODE) [skip ci]"
# Tagging is optional here, usually better done after successful deploy
# git tag -a "v${{ env.NEW_NAME }}" -m "Release v${{ env.NEW_NAME }}"
git push origin production
================================================
FILE: .github/workflows/telegram-release.yml
================================================
name: Telegram Release
on:
workflow_dispatch:
inputs:
version_code:
description: 'Specific Version Code (Leave empty to use latest Store version)'
required: false
type: string
increment:
description: 'Increment Version? (Only used if Version Code is empty)'
required: true
type: boolean
default: false
jobs:
build-and-announce:
runs-on: ubuntu-latest
permissions:
contents: read # Required to check for releases
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
cache: 'gradle'
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Install Fastlane
run: gem install fastlane
# --- SECRET DECODING ---
- name: Decode Keystore
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
run: echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > app/release.jks
- name: Decode Google Play Service Account
env:
PLAY_STORE_JSON_KEY: ${{ secrets.PLAY_STORE_JSON_KEY }}
run: echo "$PLAY_STORE_JSON_KEY" > app/google-play-api.json
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# --- BUILD ARTIFACTS ---
# Updated to pass inputs to Fastlane
- name: Run Fastlane (Build Candidates)
env:
JSON_KEY_FILE: ${{ github.workspace }}/app/google-play-api.json
SUPPLY_JSON_KEY: ${{ github.workspace }}/app/google-play-api.json
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_FILE_PATH: ${{ github.workspace }}/app/release.jks
# Map inputs to Env Vars (cleaner than passing directly in run command string)
INPUT_VERSION_CODE: ${{ inputs.version_code }}
INPUT_INCREMENT: ${{ inputs.increment }}
run: |
# Pass arguments to the lane using key:value syntax
# If INPUT_VERSION_CODE is empty, Fastlane receives nil/empty string and logic handles it
fastlane android build_release_candidates \
version_code:"$INPUT_VERSION_CODE" \
increment:"$INPUT_INCREMENT"
# --- PREPARE ANNOUNCEMENT ---
- name: Read Version Info
id: version_info
run: |
echo "VERSION_NAME=$(cat version_name.txt)" >> $GITHUB_ENV
echo "VERSION_CODE=$(cat version_code.txt)" >> $GITHUB_ENV
- name: Check for GitHub Release
id: check_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="v${{ env.VERSION_NAME }}"
echo "Checking for release tag: $TAG"
# Check if release exists using GitHub CLI
if gh release view "$TAG" > /dev/null 2>&1; then
echo "Release found!"
echo "release_url=https://github.com/${{ github.repository }}/releases/tag/$TAG" >> $GITHUB_OUTPUT
echo "has_release=true" >> $GITHUB_OUTPUT
else
echo "No release found for $TAG"
echo "has_release=false" >> $GITHUB_OUTPUT
fi
- name: Publish to Telegram Channel
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_RELEASE_CHAT_ID }}
RELEASE_URL: ${{ steps.check_release.outputs.release_url }}
HAS_RELEASE: ${{ steps.check_release.outputs.has_release }}
run: |
STORE_APK="app/build/distribution/store/store-release.apk"
FOSS_APK="app/build/distribution/foss/foss-release.apk"
# 1. Construct the Caption
CAPTION="⚡️ *Thor v${{ env.VERSION_NAME }} Released!*
Build: ${{ env.VERSION_CODE }}
Branch: ${{ github.ref_name }}"
if [ "$HAS_RELEASE" = "true" ]; then
CAPTION="$CAPTION
🔗 [View on GitHub]($RELEASE_URL)"
fi
# 2. Send Store APK
echo "Sending Store APK..."
curl -s -F "chat_id=$TELEGRAM_CHAT_ID" \
-F "document=@$STORE_APK" \
-F "caption=$CAPTION" \
-F "parse_mode=Markdown" \
"https://api.telegram.org/bot$TELEGRAM_TOKEN/sendDocument" > /dev/null
# 3. Send FOSS APK (Reply to previous? No, just send as second message for now)
echo "Sending FOSS APK..."
curl -s -F "chat_id=$TELEGRAM_CHAT_ID" \
-F "document=@$FOSS_APK" \
-F "caption=🔓 *FOSS Version (No Google Services)*" \
-F "parse_mode=Markdown" \
"https://api.telegram.org/bot$TELEGRAM_TOKEN/sendDocument" > /dev/null
# --- SECURITY CLEANUP ---
- name: Cleanup sensitive files
if: always()
run: |
rm -f app/release.jks
rm -f app/google-play-api.json
================================================
FILE: .gitignore
================================================
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
/.idea/deploymentTargetDropDown.xml
/.idea/deploymentTargetSelector.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
/.idea/studiobot.xml
/.idea/appInsightsSettings.xml
/.agents
/*/build
/graphify-out
================================================
FILE: .idea/.gitignore
================================================
# Default ignored files
/shelf/
/workspace.xml
================================================
FILE: .idea/AndroidProjectSystem.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>
================================================
FILE: .idea/codeStyles/Project.xml
================================================
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="false" module="true" />
<package name="android" withSubpackages="true" static="true" />
<package name="androidx" withSubpackages="true" static="true" />
<package name="com" withSubpackages="true" static="true" />
<package name="junit" withSubpackages="true" static="true" />
<package name="net" withSubpackages="true" static="true" />
<package name="org" withSubpackages="true" static="true" />
<package name="java" withSubpackages="true" static="true" />
<package name="javax" withSubpackages="true" static="true" />
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="android" withSubpackages="true" static="false" />
<emptyLine />
<package name="androidx" withSubpackages="true" static="false" />
<emptyLine />
<package name="com" withSubpackages="true" static="false" />
<emptyLine />
<package name="junit" withSubpackages="true" static="false" />
<emptyLine />
<package name="net" withSubpackages="true" static="false" />
<emptyLine />
<package name="org" withSubpackages="true" static="false" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
<emptyLine />
</value>
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>
================================================
FILE: .idea/codeStyles/codeStyleConfig.xml
================================================
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
================================================
FILE: .idea/compiler.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="21" />
</component>
</project>
================================================
FILE: .idea/copilot.data.migration.agent.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AgentMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>
================================================
FILE: .idea/copilot.data.migration.ask.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AskMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>
================================================
FILE: .idea/copilot.data.migration.ask2agent.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Ask2AgentMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>
================================================
FILE: .idea/copilot.data.migration.edit.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EditMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>
================================================
FILE: .idea/deviceManager.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DeviceTable">
<option name="columnSorters">
<list>
<ColumnSorterState>
<option name="column" value="Name" />
<option name="order" value="ASCENDING" />
</ColumnSorterState>
</list>
</option>
</component>
</project>
================================================
FILE: .idea/dictionaries/project.xml
================================================
<component name="ProjectDictionaryState">
<dictionary name="project">
<words>
<w>Appfile</w>
<w>apkm</w>
<w>chown</w>
<w>dcim</w>
<w>fastlane</w>
<w>fira</w>
<w>hmmss</w>
<w>libsu</w>
<w>readlines</w>
<w>shellout</w>
<w>shizuku</w>
<w>xapk</w>
<w>zulu</w>
</words>
</dictionary>
</component>
================================================
FILE: .idea/google-java-format.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GoogleJavaFormatSettings">
<option name="enabled" value="false" />
</component>
</project>
================================================
FILE: .idea/gradle.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/bypass" />
<option value="$PROJECT_DIR$/suCore" />
<option value="$PROJECT_DIR$/vm-runtime" />
</set>
</option>
<option name="resolveExternalAnnotations" value="true" />
</GradleProjectSettings>
</option>
<option name="parallelModelFetch" value="true" />
</component>
</project>
================================================
FILE: .idea/inspectionProfiles/Project_Default.xml
================================================
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AssignedValueIsNeverRead" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ComposePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />
</inspection_tool>
<inspection_tool class="ComposePreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />
</inspection_tool>
<inspection_tool class="ComposePreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />
</inspection_tool>
<inspection_tool class="ComposePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />
</inspection_tool>
<inspection_tool class="GlancePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="GlancePreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="GlancePreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="GlancePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewApiLevelMustBeValid" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewDeviceShouldUseNewSpec" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewParameterProviderOnFirstParameter" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />
</inspection_tool>
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />
</inspection_tool>
</profile>
</component>
================================================
FILE: .idea/kotlinc.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Kotlin2JsCompilerArguments">
<option name="moduleKind" value="plain" />
</component>
<component name="Kotlin2JvmCompilerArguments">
<option name="jvmTarget" value="21" />
</component>
<component name="KotlinJpsPluginSettings">
<option name="externalSystemId" value="Gradle" />
<option name="version" value="2.3.20" />
</component>
</project>
================================================
FILE: .idea/markdown.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownSettings">
<option name="previewPanelProviderInfo">
<ProviderInfo name="Compose (experimental)" className="com.intellij.markdown.compose.preview.ComposePanelProvider" />
</option>
</component>
</project>
================================================
FILE: .idea/migrations.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>
================================================
FILE: .idea/misc.xml
================================================
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
================================================
FILE: .idea/runConfigurations/Generate_Baseline_Profile_for_app.xml
================================================
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate Baseline Profile for app" type="AndroidBaselineProfileRunConfigurationType" factoryName="Android Baseline Profile Configuration Factory">
<module name="Thor.app" />
<option name="generateAllVariants" value="false" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Hybrid>
<Java>
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Java>
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Java/Kotlin Method Sample (legacy)" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers>
<method v="2" />
</configuration>
</component>
================================================
FILE: .idea/runConfigurations.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
</set>
</option>
</component>
</project>
================================================
FILE: .idea/vcs.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
================================================
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: PROJECT_CONTEXT.md
================================================
# Thor App Manager - Project Context
Thor is a modern, lightweight, and privacy-focused Android App Manager. It is designed to be 100%
offline, free, and open-source (FOSS), providing advanced app management capabilities through
Shizuku, Dhizuku, and Root access.
## 🏗 Architecture
The project follows **Clean Architecture** principles combined with **MVVM (Model-View-ViewModel)**
for the presentation layer.
### Modules:
- **`app/`**: The core application module.
- **Presentation**: Built with **Jetpack Compose**. ViewModels manage state using `StateFlow`
and Koin for dependency injection.
- **Domain**: Pure Kotlin layer containing business logic, Use Cases, and repository interfaces.
Platform-agnostic where possible.
- **Data**: Implementation of repositories, interacting with Android's `PackageManager`,
`Shizuku`/`Dhizuku` APIs, and `DataStore` for persistence.
- **DI**: Dependency Injection using **Koin**, organized into `commonModule`, `installerModule`,
`preferenceModule`, `coreModule`, and `roomModule`.
- **`suCore/`**: A specialized module for root shell management. It's a Kotlin-refactored version of
the `libsu` core module by `topjohnwu`, optimized for modern Kotlin idioms and memory safety.
- **`bypass/`**: A core utility module for bypassing Android's hidden API restrictions using
`VMRuntime` exemptions and enhanced reflection.
- **`vm-runtime/`**: Compile-only **Java** stubs required for the `bypass` module to interface with
internal Android classes like `VMRuntime`. Intentionally a pure Java library (not Kotlin) to
ensure correct class shadowing behaviour at compile time.
## 🛠 Tech Stack
- **Language**: Kotlin (all modules except `vm-runtime`, which is pure Java for stub compatibility)
- **UI Framework**: Jetpack Compose with `MaterialExpressiveTheme` + `MotionScheme.expressive()`.
Static "Asgardian" color scheme by default; optional Material You dynamic color on Android 12+.
Navigation uses a custom `ThorNavigationBar` with spring animations + `HorizontalPager` for
swipe-between-screens.
- **Dependency Injection**: Koin
- **Asynchronous Programming**: Kotlin Coroutines & Flow
- **Image Loading**: Coil 3
- **Animation**: Lottie + Compose `AnimatedVisibility`/`AnimatedContent`
- **Persistence**:
- **Jetpack Room**: High-performance caching of `AppInfo` metadata, invalidated via
`lastUpdateTime`.
- **Jetpack DataStore**: User preferences including theme, AMOLED mode, biometric lock, and
preferred privilege mode.
- **Security**: Android Biometrics via `BiometricPrompt` API directly (no `androidx.biometric`
dependency). `HomeActivity` extends `ComponentActivity`.
- **Elevated Privileges**:
- **Root (su)**: Via `suCore` module (Kotlin-refactored fork of `libsu`).
- **Shizuku**: Shell-command-first (`am`, `pm`, `appops`) with reflection fallback via
`:bypass`.
- **Dhizuku**: Device Owner API with reflection fallback via `:bypass`.
- **Work Mode (`PrivilegeMode`)**: User-selectable privilege engine (ROOT / SHIZUKU / DHIZUKU)
with automatic fallback strategy (Root → Shizuku → Dhizuku).
- **Internal Bypass (`:bypass`)**: Custom Kotlin implementation using `VMRuntime` exemptions and
reflection, backed by Java stubs in `:vm-runtime`.
- **Build System**: Gradle Kotlin DSL with Version Catalog (`libs.versions.toml`). Exact tool and
library versions defined in `libs.versions.toml`; do not hardcode them in docs.
- **Distribution**: Two product flavors: `store` (Play Store compliant) and `foss` (fully
libre/open).
## ✨ Key Features
- **App Management**: Install, uninstall, freeze (disable/enable), suspend/unsuspend, and
background-restrict apps. Tracks `isSuspended` and `isDebuggable` flags directly on `AppInfo`.
- **Work Mode**: User-selectable privilege engine (`PrivilegeMode`: ROOT, SHIZUKU, DHIZUKU) stored
in `UserPreferences`. Falls back automatically if the preferred mode is unavailable.
- **Batch Operations**: Batch freeze/unfreeze, reinstall, uninstall, kill, suspend/unsuspend, and
clear data — all logged in real time through the terminal logger dialog.
- **App Suspension**: Uses `IPackageManager` reflection to suspend apps, showing a custom "Thor"
-branded system dialog. Supports Android 10 through 13+ with version-specific fallbacks.
- **Background Restriction**: Restricts an app's background activity via `setAppRestricted`.
- **Fix Store (Reinstall with Google)**: Reassigns installer to Play Store. Available in all
privilege modes (Root, Shizuku, Dhizuku).
- **Clear Data / Clear Cache**: Available in all privilege modes; `clearAppData` uses `pm clear`
with multi-user support.
- **Advanced Insights**: Installer source (resolved from package labels, not hardcoded), split APK
indicators, version codes, SDK targets, `isSuspended`, `isDebuggable`.
- **System App Support**: Uninstall or freeze system apps (requires any privilege mode).
- **Security**: Biometric/device-credential lock for app access. Per-session authentication state.
- **App Metadata Caching**: Room DB cache for `AppInfo`, invalidated via `lastUpdateTime`.
- **Preferences** (`UserPreferences`): theme, AMOLED, dynamic color, biometric lock, sort/filter
state, privilege mode, and language — all persisted via DataStore.
- **Customization**: Dark/Light/System + AMOLED themes. "Asgardian" static color scheme is the
default; Material You dynamic color opt-in. Preferred privilege mode persisted across sessions.
- **Search**: Live search by app name or package name in App List and Freezer screens.
- **Multi-language**: Supports English, Spanish, French, Arabic, and Chinese. Runtime locale
switching via `LocaleManager` (`util/LocaleManager.kt`); language preference stored in
`UserPreferences.language` (null = system default).
- **Privacy**: Fully offline, no ads, no trackers, FOSS (GPL-3.0).
## ⚠️ Limitations
- **Privilege Dependency**: Advanced features (freeze, suspend, system app removal) require at least
one of Root, Shizuku, or Dhizuku. Work Mode selection with automatic fallback mitigates partial
availability.
- **Suspension Compatibility**: `setAppSuspended` uses reflection against internal APIs; behaviour
may vary across Android 10–14+ due to API signature changes.
- **Offline Only**: No cloud backup or remote synchronization (by design, for privacy).
- **Android Constraints**: Subject to evolving Android security restrictions (hidden API policy,
target SDK requirements).
- **Feature Gap**: App data backup is not yet implemented.
## 🚀 Opportunities
- **Data Backup**: Implementing local app data backup and restoration.
- **Package Editing**: Direct editing of `packages.xml` for advanced users.
- **Batch Install**: Installing multiple APKs in one operation.
- **Automation**: Scheduled freezing/unfreezing or automated cleanup tasks.
- **Installer Integration**: Expanding support for third-party installers (e.g., F-Droid, Aurora
Store).
## 🛡 Threats
- **Play Store Policies**: As an "App Manager" with elevated privileges, it faces strict scrutiny
from Google Play.
- **Android OS Changes**: Future Android updates might further restrict Shizuku or root-level access
methods.
- **Competition**: Several established open-source app managers exist; maintaining a niche in "
lightweight & offline" is key.
================================================
FILE: README.md
================================================
<p align="center">
<img src="app/src/main/thor_drawn-playstore.png" alt="Thor Logo" height="192dp">
</p>
<h1 align="center">Thor App Manager</h1>
<p align="center">
<a href="https://play.google.com/store/apps/details?id=com.valhalla.thor" target="_blank">
<img src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png" alt="Get it on Google Play" height="60">
</a>
<a href="https://apt.izzysoft.de/fdroid/index/apk/com.valhalla.thor" target="_blank">
<img src="https://gitlab.com/IzzyOnDroid/repo/-/raw/master/assets/IzzyOnDroid.png" alt="Get it on IzzyOnDroid" height="60">
</a>
<a href="https://www.indusappstore.com/apps/productivity/thor/com.valhalla.thor/?page=details&id=com.valhalla.thor" target="_blank">
<img src=".github/assets/indus-badge.png" alt="Download on Indus Appstore" height="60">
</a>
</p>
<p align="center">
<a href="https://t.me/thorAppDev">Telegram Channel</a>
</p>
---
* Kotlin + Material 3 Design
* Jetpack Compose
* Room DB App Caching
* Custom Hidden API Bypass
* PlayStore Download Size (around 2.0 MB)
* Smallest APK size (less than 4 MB)
* FOSS - GPL-3.0
* Fully Offline
* No Ads/Trackers
## Working Features
- High-performance app list loading with Room DB metadata caching
- Fingerprint Lock
- Themes (dark, light, system) + AMOLED + Asgardian static theme
- App Installer (install with root, shizuku or normal)
- Root Support
- Shizuku Support
- Dhizuku Support
- Fully reproducible, copyleft libre software (GPLv3.0)
- Material 3 with optional dynamic colors (Material You)
- Work Mode selection — manually choose between Root, Shizuku, or Dhizuku as the active privilege
engine
- Displays App List while sorting them based on Installation source
- Search in App List and Freezer
- Multi-language support (English, Spanish, French, Arabic, Chinese) with in-app language switcher
- Launch App Activities
- Install/Uninstall/Freeze/Unfreeze Apk files
- Suspend/Unsuspend apps (shows custom Thor-branded system dialog)
- Background Restriction (restrict app background activity)
- Reinstall APKs/Fix Store installer record (available in all privilege modes)
- Share App Apk file
- Batch Reinstall/Uninstall/Freeze/Unfreeze/Kill/Suspend/Clear Data
- Split App Indicator
- AppState Indicator (frozen / suspended / hidden)
- Uninstall System Apps
- Freeze/UnFreeze System apps
- Sorting & filters
- Clear Data/Cache (available in all privilege modes)
## Upcoming Features
- BackUp App Data
- Editing Packages.xml
- Batch Install
- Many more
## 💖 Support Development
Thor is a labor of love, built to be **100% offline, ad-free, and tracker-free**. If this tool has
made your Android management easier, consider supporting its continued development. Your
contributions help keep the project alive and free for everyone.
| Platform | Link |
|---------------------|-------------------------------------------------------------|
| **Patreon** | [Support on Patreon](https://www.patreon.com/trinadh) |
| **Buy Me a Coffee** | [Buy me a coffee](https://www.buymeacoffee.com/trinadh) |
| **PayPal** | [Donate via PayPal](https://www.paypal.me/trinadhthatakula) |
## Credits
- Portions of this app use code from [`libsu`](https://github.com/topjohnwu/libsu)
by [topjohnwu](https://github.com/topjohnwu/), adapted and integrated as the [
`suCore`](https://github.com/trinadhthatakula/Thor/tree/master/suCore) module.
- Replaced [`AndroidHiddenApiBypass`](https://github.com/LSPosed/AndroidHiddenApiBypass) with an
internal Kotlin implementation in the [
`bypass`](https://github.com/trinadhthatakula/Thor/tree/master/bypass) module, backed by Java
stubs in the [`vm-runtime`](https://github.com/trinadhthatakula/Thor/tree/master/vm-runtime)
module for maximum compatibility when shadowing system classes.
### Modifications to libsu
- Fully converted the original Java-based `libsu` code to Kotlin for `suCore`
- Refer SuCore [README](https://github.com/trinadhthatakula/Thor/blob/master/suCore/README.md) for
more details
## License
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).
- `libsu` is licensed under the Apache License 2.0. All modifications and usage in this project
comply with the Apache-2.0 requirements.
- This project as a whole is distributed under the GNU General Public License v3.0 (GPL-3.0).
- See the [LICENSE](LICENSE) file for full license text.
================================================
FILE: app/.gitignore
================================================
/build
================================================
FILE: app/baselineprofile/.gitignore
================================================
/build
================================================
FILE: app/baselineprofile/build.gradle.kts
================================================
plugins {
alias(libs.plugins.android.test)
alias(libs.plugins.baselineprofile)
}
android {
namespace = "com.valhalla.thor.baselineprofile"
compileSdk {
version = release(36)
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
defaultConfig {
minSdk = 28
targetSdk = 36
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
targetProjectPath = ":app"
flavorDimensions += listOf("distribution")
productFlavors {
create("store") { dimension = "distribution" }
create("foss") { dimension = "distribution" }
}
}
// This is the configuration block for the Baseline Profile plugin.
// You can specify to run the generators on a managed devices or connected devices.
baselineProfile {
useConnectedDevices = true
}
dependencies {
implementation(libs.androidx.junit)
implementation(libs.androidx.espresso.core)
implementation(libs.androidx.uiautomator)
implementation(libs.androidx.benchmark.macro.junit4)
}
androidComponents {
onVariants { v ->
val artifactsLoader = v.artifacts.getBuiltArtifactsLoader()
v.instrumentationRunnerArguments.put(
"targetAppId",
v.testedApks.map { artifactsLoader.load(it)?.applicationId }
)
}
}
================================================
FILE: app/baselineprofile/src/main/AndroidManifest.xml
================================================
<manifest />
================================================
FILE: app/baselineprofile/src/main/java/com/valhalla/thor/baselineprofile/BaselineProfileGenerator.kt
================================================
package com.valhalla.thor.baselineprofile
import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
/**
* This test class generates a basic startup baseline profile for the target package.
*
* We recommend you start with this but add important user flows to the profile to improve their performance.
* Refer to the [baseline profile documentation](https://d.android.com/topic/performance/baselineprofiles)
* for more information.
*
* You can run the generator with the "Generate Baseline Profile" run configuration in Android Studio or
* the equivalent `generateBaselineProfile` gradle task:
* ```
* ./gradlew :app:generateReleaseBaselineProfile
* ```
* The run configuration runs the Gradle task and applies filtering to run only the generators.
*
* Check [documentation](https://d.android.com/topic/performance/benchmarking/macrobenchmark-instrumentation-args)
* for more information about available instrumentation arguments.
*
* After you run the generator, you can verify the improvements running the [StartupBenchmarks] benchmark.
*
* When using this class to generate a baseline profile, only API 33+ or rooted API 28+ are supported.
*
* The minimum required version of androidx.benchmark to generate a baseline profile is 1.2.0.
**/
@RunWith(AndroidJUnit4::class)
@LargeTest
class BaselineProfileGenerator {
@get:Rule
val rule = BaselineProfileRule()
@Test
fun generate() {
// The application id for the running build variant is read from the instrumentation arguments.
rule.collect(
packageName = InstrumentationRegistry.getArguments().getString("targetAppId")
?: throw Exception("targetAppId not passed as instrumentation runner arg"),
// See: https://d.android.com/topic/performance/baselineprofiles/dex-layout-optimizations
includeInStartupProfile = true
) {
// This block defines the app's critical user journey. Here we are interested in
// optimizing for app startup. But you can also navigate and scroll through your most important UI.
// Start default activity for your app
pressHome()
startActivityAndWait()
// TODO Write more interactions to optimize advanced journeys of your app.
// For example:
// 1. Wait until the content is asynchronously loaded
// 2. Scroll the feed content
// 3. Navigate to detail screen
// Check UiAutomator documentation for more information how to interact with the app.
// https://d.android.com/training/testing/other-components/ui-automator
}
}
}
================================================
FILE: app/baselineprofile/src/main/java/com/valhalla/thor/baselineprofile/StartupBenchmarks.kt
================================================
package com.valhalla.thor.baselineprofile
import androidx.benchmark.macro.BaselineProfileMode
import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.StartupMode
import androidx.benchmark.macro.StartupTimingMetric
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
/**
* This test class benchmarks the speed of app startup.
* Run this benchmark to verify how effective a Baseline Profile is.
* It does this by comparing [CompilationMode.None], which represents the app with no Baseline
* Profiles optimizations, and [CompilationMode.Partial], which uses Baseline Profiles.
*
* Run this benchmark to see startup measurements and captured system traces for verifying
* the effectiveness of your Baseline Profiles. You can run it directly from Android
* Studio as an instrumentation test, or run all benchmarks for a variant, for example benchmarkRelease,
* with this Gradle task:
* ```
* ./gradlew :app:baselineprofile:connectedBenchmarkReleaseAndroidTest
* ```
*
* You should run the benchmarks on a physical device, not an Android emulator, because the
* emulator doesn't represent real world performance and shares system resources with its host.
*
* For more information, see the [Macrobenchmark documentation](https://d.android.com/macrobenchmark#create-macrobenchmark)
* and the [instrumentation arguments documentation](https://d.android.com/topic/performance/benchmarking/macrobenchmark-instrumentation-args).
**/
@RunWith(AndroidJUnit4::class)
@LargeTest
class StartupBenchmarks {
@get:Rule
val rule = MacrobenchmarkRule()
@Test
fun startupCompilationNone() =
benchmark(CompilationMode.None())
@Test
fun startupCompilationBaselineProfiles() =
benchmark(CompilationMode.Partial(BaselineProfileMode.Require))
private fun benchmark(compilationMode: CompilationMode) {
// The application id for the running build variant is read from the instrumentation arguments.
rule.measureRepeated(
packageName = InstrumentationRegistry.getArguments().getString("targetAppId")
?: throw Exception("targetAppId not passed as instrumentation runner arg"),
metrics = listOf(StartupTimingMetric()),
compilationMode = compilationMode,
startupMode = StartupMode.COLD,
iterations = 10,
setupBlock = {
pressHome()
},
measureBlock = {
startActivityAndWait()
// TODO Add interactions to wait for when your app is fully drawn.
// The app is fully drawn when Activity.reportFullyDrawn is called.
// For Jetpack Compose, you can use ReportDrawn, ReportDrawnWhen and ReportDrawnAfter
// from the AndroidX Activity library.
// Check the UiAutomator documentation for more information on how to
// interact with the app.
// https://d.android.com/training/testing/other-components/ui-automator
}
)
}
}
================================================
FILE: app/build.gradle.kts
================================================
import com.android.build.api.artifact.SingleArtifact
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.io.FileInputStream
import java.util.Properties
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.room)
alias(libs.plugins.ksp)
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
freeCompilerArgs.add("-Xexplicit-backing-fields")
optIn.add("kotlin.RequiresOptIn")
optIn.add("kotlin.time.ExperimentalTime")
optIn.add("org.koin.core.annotation.KoinExperimentalAPI")
optIn.add("androidx.compose.material3.ExperimentalMaterial3ExpressiveApi")
optIn.add("androidx.compose.material3.ExperimentalMaterial3Api")
}
}
room {
schemaDirectory("$projectDir/schemas")
}
val keystorePropertiesFile: File = rootProject.file("jks.properties")
val keystoreProperties = Properties()
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
// --- VERSIONING HELPERS (Private & Modernized) ---
// 1. Resolve Code: Checks property 'versionCode' first, falls back to 'initialVersionCode'
private fun resolveVersionCode(): Int {
val initial = providers.gradleProperty("initialVersionCode")
.orNull
?.toIntOrNull()
?: throw GradleException("Required 'initialVersionCode' missing in gradle.properties")
val override = providers.gradleProperty("versionCode")
.orNull
?.toIntOrNull()
return override ?: initial
}
// 2. Calculate Name: The math logic (1712 -> 1.71.2)
private fun calculateVersionName(code: Int): String {
val major = code / 1000
val minor = (code % 1000) / 10
val patch = code % 10
return "$major.$minor.$patch"
}
// 3. Resolve Name: Checks property 'versionName' first, falls back to math
private fun resolveVersionName(code: Int): String {
return providers.gradleProperty("versionName").orNull
?: calculateVersionName(code)
}
android {
namespace = "com.valhalla.thor"
compileSdk = 37
defaultConfig {
applicationId = "com.valhalla.thor"
minSdk = 28
targetSdk = 37
// Calculate versions using the private helpers
val code = resolveVersionCode()
versionCode = code
versionName = resolveVersionName(code)
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
ndk {
debugSymbolLevel = "SYMBOL_TABLE"
}
}
signingConfigs {
create("release") {
if (keystorePropertiesFile.exists()) {
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = file(keystoreProperties["storeFile"] as String)
storePassword = keystoreProperties["storePassword"] as String
} else if (System.getenv("KEY_ALIAS") != null) {
// CI/CD Build (GitHub Actions)
keyAlias = System.getenv("KEY_ALIAS")
keyPassword = System.getenv("KEY_PASSWORD")
storePassword = System.getenv("KEYSTORE_PASSWORD")
storeFile = file(System.getenv("KEYSTORE_FILE_PATH") ?: "release.jks")
} else {
logger.warn("⚠️ keystore.properties not found or environment variables not set. Release build will not be signed properly.")
}
}
}
dependenciesInfo {
includeInApk = false
includeInBundle = true
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
}
debug {
isMinifyEnabled = false
applicationIdSuffix = ".debug"
}
}
flavorDimensions += "distribution"
productFlavors {
create("store") {
dimension = "distribution"
}
create("foss") {
dimension = "distribution"
versionNameSuffix = "-foss"
proguardFile("proguard-rules-foss.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
buildFeatures {
buildConfig = true
compose = true
aidl = true
}
packaging {
resources {
excludes += "/specs/**"
excludes += "**/*.dll"
excludes += "**/*.dylib"
excludes += "**/x64/**"
excludes += "**/x86_64/*.dll"
excludes += "**/META-INF/*.{kotlin_module,dot}"
excludes += "META-INF/services/javax.annotation.processing.Processor"
excludes += "META-INF/DEPENDENCIES"
excludes += "META-INF/LICENSE*"
excludes += "META-INF/NOTICE*"
}
}
}
androidComponents {
// 1. Existing FOSS Copy Task
onVariants(selector().withFlavor("distribution", "foss")) { variant ->
if (variant.buildType == "release") {
val apkDir = variant.artifacts.get(SingleArtifact.APK)
tasks.register<Copy>("copyFossReleaseApk") {
dependsOn("assembleFossRelease")
from(apkDir) { include("*.apk") }
into(layout.buildDirectory.dir("distribution/foss"))
rename(".*\\.apk", "foss-release.apk")
}
}
}
// 2. Store Copy Task
onVariants(selector().withFlavor("distribution", "store")) { variant ->
if (variant.buildType == "release") {
val apkDir = variant.artifacts.get(SingleArtifact.APK)
tasks.register<Copy>("copyStoreReleaseApk") {
dependsOn("assembleStoreRelease")
from(apkDir) { include("*.apk") }
into(layout.buildDirectory.dir("distribution/store"))
rename(".*\\.apk", "store-release.apk")
}
}
}
}
dependencies {
implementation(project(":suCore"))
implementation(project(":bypass"))
implementation(libs.androidx.datastore.preferences)
implementation(libs.androidx.splashscreen)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.biometric)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.accompanist.drawablepainter)
implementation(libs.kotlinx.serialization.json)
implementation(libs.lottie.compose)
implementation(libs.shizuku.api)
implementation(libs.shizuku.provider)
implementation(libs.dhizuku.api)
implementation(libs.bundles.coil)
implementation(libs.bundles.koin)
implementation(libs.room.runtime)
implementation(libs.room.ktx)
ksp(libs.room.compiler)
}
// These rely on the private functions above, which is allowed in the same file scope
val currentVersionCode = resolveVersionCode()
val currentVersionName = resolveVersionName(currentVersionCode)
tasks.register("printVersionName") {
val vName = currentVersionName
doLast {
println(vName)
}
}
================================================
FILE: app/proguard-rules-foss.pro
================================================
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# 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 *;
#}
# 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
# Ignore missing service definitions that are not relevant for Android runtime
-dontwarn javax.annotation.processing.Processor
-dontwarn javax.annotation.Nullable
-dontobfuscate
-keepattributes SourceFile,LineNumberTable
#-keep class com.valhalla.thor.** { *; }
================================================
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.
#
# 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 *;
#}
# 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
# Ignore missing service definitions that are not relevant for Android runtime
-dontwarn javax.annotation.processing.Processor
-dontwarn javax.annotation.Nullable
-dontwarn dalvik.system.VMRuntime
================================================
FILE: app/schemas/com.valhalla.thor.data.source.local.room.AppDatabase/1.json
================================================
{
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "0250ce576c64723c12faf13e9d8ccb18",
"entities": [
{
"tableName": "apps",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`packageName` TEXT NOT NULL, `appName` TEXT, `versionName` TEXT, `versionCode` INTEGER NOT NULL, `minSdk` INTEGER NOT NULL, `targetSdk` INTEGER NOT NULL, `isSystem` INTEGER NOT NULL, `installerPackageName` TEXT, `publicSourceDir` TEXT, `splitPublicSourceDirs` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `dataDir` TEXT, `nativeLibraryDir` TEXT, `deviceProtectedDataDir` TEXT, `sharedLibraryFiles` TEXT, `obbFilePath` TEXT, `sourceDir` TEXT, `sharedDataDir` TEXT NOT NULL, `lastUpdateTime` INTEGER NOT NULL, `firstInstallTime` INTEGER NOT NULL, `isDebuggable` INTEGER NOT NULL, PRIMARY KEY(`packageName`))",
"fields": [
{
"fieldPath": "packageName",
"columnName": "packageName",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appName",
"columnName": "appName",
"affinity": "TEXT"
},
{
"fieldPath": "versionName",
"columnName": "versionName",
"affinity": "TEXT"
},
{
"fieldPath": "versionCode",
"columnName": "versionCode",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "minSdk",
"columnName": "minSdk",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "targetSdk",
"columnName": "targetSdk",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isSystem",
"columnName": "isSystem",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "installerPackageName",
"columnName": "installerPackageName",
"affinity": "TEXT"
},
{
"fieldPath": "publicSourceDir",
"columnName": "publicSourceDir",
"affinity": "TEXT"
},
{
"fieldPath": "splitPublicSourceDirs",
"columnName": "splitPublicSourceDirs",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "enabled",
"columnName": "enabled",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dataDir",
"columnName": "dataDir",
"affinity": "TEXT"
},
{
"fieldPath": "nativeLibraryDir",
"columnName": "nativeLibraryDir",
"affinity": "TEXT"
},
{
"fieldPath": "deviceProtectedDataDir",
"columnName": "deviceProtectedDataDir",
"affinity": "TEXT"
},
{
"fieldPath": "sharedLibraryFiles",
"columnName": "sharedLibraryFiles",
"affinity": "TEXT"
},
{
"fieldPath": "obbFilePath",
"columnName": "obbFilePath",
"affinity": "TEXT"
},
{
"fieldPath": "sourceDir",
"columnName": "sourceDir",
"affinity": "TEXT"
},
{
"fieldPath": "sharedDataDir",
"columnName": "sharedDataDir",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lastUpdateTime",
"columnName": "lastUpdateTime",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "firstInstallTime",
"columnName": "firstInstallTime",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isDebuggable",
"columnName": "isDebuggable",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"packageName"
]
}
}
],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '0250ce576c64723c12faf13e9d8ccb18')"
]
}
}
================================================
FILE: app/schemas/com.valhalla.thor.data.source.local.room.AppDatabase/2.json
================================================
{
"formatVersion": 1,
"database": {
"version": 2,
"identityHash": "37ee5d25d4bab9e2695c36e7dc21a849",
"entities": [
{
"tableName": "apps",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`packageName` TEXT NOT NULL, `appName` TEXT, `versionName` TEXT, `versionCode` INTEGER NOT NULL, `minSdk` INTEGER NOT NULL, `targetSdk` INTEGER NOT NULL, `isSystem` INTEGER NOT NULL, `installerPackageName` TEXT, `publicSourceDir` TEXT, `splitPublicSourceDirs` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `dataDir` TEXT, `nativeLibraryDir` TEXT, `deviceProtectedDataDir` TEXT, `sharedLibraryFiles` TEXT, `obbFilePath` TEXT, `sourceDir` TEXT, `sharedDataDir` TEXT NOT NULL, `lastUpdateTime` INTEGER NOT NULL, `firstInstallTime` INTEGER NOT NULL, `isDebuggable` INTEGER NOT NULL, `isSuspended` INTEGER NOT NULL, PRIMARY KEY(`packageName`))",
"fields": [
{
"fieldPath": "packageName",
"columnName": "packageName",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "appName",
"columnName": "appName",
"affinity": "TEXT"
},
{
"fieldPath": "versionName",
"columnName": "versionName",
"affinity": "TEXT"
},
{
"fieldPath": "versionCode",
"columnName": "versionCode",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "minSdk",
"columnName": "minSdk",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "targetSdk",
"columnName": "targetSdk",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isSystem",
"columnName": "isSystem",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "installerPackageName",
"columnName": "installerPackageName",
"affinity": "TEXT"
},
{
"fieldPath": "publicSourceDir",
"columnName": "publicSourceDir",
"affinity": "TEXT"
},
{
"fieldPath": "splitPublicSourceDirs",
"columnName": "splitPublicSourceDirs",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "enabled",
"columnName": "enabled",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dataDir",
"columnName": "dataDir",
"affinity": "TEXT"
},
{
"fieldPath": "nativeLibraryDir",
"columnName": "nativeLibraryDir",
"affinity": "TEXT"
},
{
"fieldPath": "deviceProtectedDataDir",
"columnName": "deviceProtectedDataDir",
"affinity": "TEXT"
},
{
"fieldPath": "sharedLibraryFiles",
"columnName": "sharedLibraryFiles",
"affinity": "TEXT"
},
{
"fieldPath": "obbFilePath",
"columnName": "obbFilePath",
"affinity": "TEXT"
},
{
"fieldPath": "sourceDir",
"columnName": "sourceDir",
"affinity": "TEXT"
},
{
"fieldPath": "sharedDataDir",
"columnName": "sharedDataDir",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lastUpdateTime",
"columnName": "lastUpdateTime",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "firstInstallTime",
"columnName": "firstInstallTime",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isDebuggable",
"columnName": "isDebuggable",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isSuspended",
"columnName": "isSuspended",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"packageName"
]
}
}
],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '37ee5d25d4bab9e2695c36e7dc21a849')"
]
}
}
================================================
FILE: app/src/androidTest/java/com/valhalla/thor/ExampleInstrumentedTest.kt
================================================
package com.valhalla.thor
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.valhalla.thor", appContext.packageName)
}
}
================================================
FILE: app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-sdk tools:overrideLibrary="rikka.shizuku.api" />
<uses-permission
android:name="android.permission.REQUEST_INSTALL_PACKAGES"
tools:ignore="RequestInstallPackagesPolicy" />
<!-- Needed if targeting Android 11+ for certain file types, but we use strict Stream access -->
<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="PackageVisibilityPolicy,QueryAllPackagesPermission" />
<permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="ReservedSystemPermission" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="shizuku.permission.API_V23" />
<uses-permission android:name="com.rosan.dhizuku.permission.API" />
<application
android:name=".ThorApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:enableOnBackInvokedCallback="true"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/thor_drawn"
android:label="@string/app_name"
android:localeConfig="@xml/locales_config"
android:roundIcon="@mipmap/thor_drawn_round"
android:supportsRtl="true"
android:theme="@style/Theme.Thor.SplashScreen"
tools:targetApi="33">
<activity
android:name=".HomeActivity"
android:exported="true"
android:theme="@style/Theme.Thor.SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".presentation.installer.PortableInstallerActivity"
android:exported="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="content" />
<data android:scheme="file" />
<data android:mimeType="application/vnd.android.package-archive" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="content" />
<data android:scheme="file" />
<data android:mimeType="application/octet-stream" />
<data android:mimeType="application/zip" />
<data android:mimeType="application/x-zip-compressed" />
<data android:mimeType="application/x-apks" />
<data android:mimeType="application/x-xapk" />
<data android:mimeType="application/x-apkm" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="content" />
<data android:scheme="file" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.apk" />
<data android:pathPattern=".*\\.APK" />
<data android:pathPattern=".*\\.xapk" />
<data android:pathPattern=".*\\.XAPK" />
<data android:pathPattern=".*\\.apks" />
<data android:pathPattern=".*\\.APKS" />
<data android:pathPattern=".*\\.apkm" />
<data android:pathPattern=".*\\.APKM" />
</intent-filter>
</activity>
<receiver
android:name=".data.receivers.InstallReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.valhalla.thor.INSTALL_STATUS" />
</intent-filter>
</receiver>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<provider
android:name="rikka.shizuku.ShizukuProvider"
android:authorities="${applicationId}.shizuku"
android:enabled="true"
android:exported="true"
android:multiprocess="false"
android:permission="android.permission.INTERACT_ACROSS_USERS_FULL" />
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge" />
</application>
</manifest>
================================================
FILE: app/src/main/assets/adi-registration.properties
================================================
CIQKVO6RQ32OMAAAAAAAAAAAAA
================================================
FILE: app/src/main/java/android/content/pm/IPackageInstaller.java
================================================
package android.content.pm;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
/**
* Taken from <a href="https://github.com/RikkaApps/Shizuku-API/blob/master/demo-hidden-api-stub/src/main/java/android/content/pm/IPackageInstaller.java">Shizuku API Demo</a>
*
* @author RikkaW
*/
public interface IPackageInstaller extends IInterface {
abstract class Stub extends Binder implements IPackageInstaller {
public static IPackageInstaller asInterface(IBinder binder) {
throw new UnsupportedOperationException();
}
}
}
================================================
FILE: app/src/main/java/android/content/pm/IPackageManager.java
================================================
package android.content.pm;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.RemoteException;
/**
* Taken from <a href="https://github.com/RikkaApps/Shizuku-API/blob/master/demo-hidden-api-stub/src/main/java/android/content/pm/IPackageManager.java">Shizuku API Demo</a>
*
* @author RikkaW
*/
public interface IPackageManager extends IInterface {
IPackageInstaller getPackageInstaller()
throws RemoteException;
abstract class Stub extends Binder implements IPackageManager {
public static IPackageManager asInterface(IBinder obj) {
throw new UnsupportedOperationException();
}
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/HomeActivity.kt
================================================
package com.valhalla.thor
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.getValue
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.valhalla.thor.domain.model.ThemeMode
import com.valhalla.thor.domain.repository.SystemRepository
import com.valhalla.thor.presentation.common.ShizukuPermissionHandler
import com.valhalla.thor.presentation.home.HomeViewModel
import com.valhalla.thor.presentation.main.MainScreen
import com.valhalla.thor.presentation.security.AuthState
import com.valhalla.thor.presentation.security.BiometricScreen
import com.valhalla.thor.presentation.security.SecurityViewModel
import com.valhalla.thor.presentation.settings.SettingsViewModel
import com.valhalla.thor.presentation.theme.ThorTheme
import com.valhalla.thor.util.Logger
import kotlinx.coroutines.launch
import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.viewModel
class HomeActivity : ComponentActivity() {
private val systemRepository: SystemRepository by inject()
private val homeViewModel: HomeViewModel by viewModel()
private val securityViewModel: SecurityViewModel by viewModel()
private val settingsViewModel: SettingsViewModel by viewModel()
private val requestCode = 1001
private var hasRequestedShizuku = false
private val shizukuHandler = ShizukuPermissionHandler(
onPermissionGranted = {
Logger.d("HomeActivity", "Shizuku Ready")
homeViewModel.loadDashboardData()
},
onPermissionDenied = {
Logger.d("HomeActivity", "Shizuku Denied")
},
onBinderDead = {
Logger.w("HomeActivity", "Shizuku Binder Died")
}
)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
installSplashScreen()
enableEdgeToEdge()
shizukuHandler.register()
setContent {
val prefs by settingsViewModel.preferences.collectAsStateWithLifecycle()
val systemDark = isSystemInDarkTheme()
val darkTheme = when (prefs.themeMode) {
ThemeMode.LIGHT -> false
ThemeMode.DARK -> true
ThemeMode.SYSTEM -> systemDark
}
ThorTheme(
darkTheme = darkTheme,
dynamicColor = prefs.useDynamicColor,
amoledMode = prefs.useAmoled,
) {
val authState by securityViewModel.authState.collectAsStateWithLifecycle()
when (authState) {
AuthState.NotRequired,
AuthState.Unlocked -> {
MainScreen(
homeViewModel = homeViewModel,
onExit = { finish() }
)
}
AuthState.Locked,
is AuthState.Error -> {
BiometricScreen(
isError = authState is AuthState.Error,
errorMessage = (authState as? AuthState.Error)?.message ?: "",
onAuthenticated = { securityViewModel.onAuthenticated() },
onError = { message ->
Logger.e("HomeActivity", "Biometric error: $message")
securityViewModel.onAuthError(message)
},
onRetry = { securityViewModel.onRetry() },
onExit = { finish() }
)
}
}
}
}
}
override fun onResume() {
super.onResume()
lifecycleScope.launch {
if (!systemRepository.isRootAvailable() && !hasRequestedShizuku) {
hasRequestedShizuku = true
shizukuHandler.checkAndRequestPermission(requestCode)
}
}
}
override fun onDestroy() {
shizukuHandler.unregister()
super.onDestroy()
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/ThorApplication.kt
================================================
package com.valhalla.thor
import android.app.Application
import com.rosan.dhizuku.api.Dhizuku
import com.valhalla.bypass.Bypass
import com.valhalla.thor.core.ThorShellConfig
import com.valhalla.thor.di.commonModule
import com.valhalla.thor.di.coreModule
import com.valhalla.thor.di.installerModule
import com.valhalla.thor.di.preferenceModule
import com.valhalla.thor.di.presentationModule
import com.valhalla.thor.di.roomModule
import com.valhalla.thor.domain.repository.PreferenceRepository
import com.valhalla.thor.util.LocaleManager
import com.valhalla.thor.util.Logger
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.koin.android.ext.android.inject
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.androix.startup.KoinStartup
import org.koin.dsl.koinConfiguration
class ThorApplication : Application(), KoinStartup {
private val preferenceRepository: PreferenceRepository by inject()
private val localeManager: LocaleManager by inject()
override fun onKoinStartup() = koinConfiguration {
androidContext(this@ThorApplication)
androidLogger(Logger.koinLogLevel)
modules(
coreModule,
installerModule,
preferenceModule,
commonModule,
presentationModule,
roomModule
)
}
override fun onCreate() {
super.onCreate()
// Initialize Bypass with custom logging
Bypass.setLogger { message, throwable ->
Logger.e("Bypass", message, throwable)
}
Bypass.prepareThor()
ThorShellConfig.init()
try {
Dhizuku.init(this)
} catch (e: Exception) {
Logger.e("ThorApp", "Dhizuku init failed", e)
}
// Apply saved language on startup
MainScope().launch {
val prefs = preferenceRepository.userPreferences.first()
withContext(Dispatchers.Main) {
localeManager.applyLocale(prefs.language)
}
}
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/core/ThorShellConfig.kt
================================================
package com.valhalla.thor.core
import com.valhalla.superuser.Shell
import com.valhalla.thor.BuildConfig
import com.valhalla.thor.core.ThorShellConfig.init
/**
* Centralized configuration for the Root Shell.
* Call [init] in your Application.onCreate().
*/
object ThorShellConfig {
fun init() {
// Set logging based on build type
Shell.enableVerboseLogging = BuildConfig.DEBUG
// Configure the default builder.
// FLAG_MOUNT_MASTER: Essential for global namespace operations (mounting, etc.)
Shell.setDefaultBuilder(
Shell.Builder.create()
.setFlags(Shell.FLAG_MOUNT_MASTER)
// If you have specific initializers, add them here
// .setInitializers(MyInitializer::class.java)
)
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/data/Constants.kt
================================================
package com.valhalla.thor.data
const val ACTION_INSTALL_STATUS = "com.valhalla.thor.INSTALL_STATUS"
================================================
FILE: app/src/main/java/com/valhalla/thor/data/gateway/DhizukuSystemGateway.kt
================================================
package com.valhalla.thor.data.gateway
import com.valhalla.thor.data.source.local.dhizuku.DhizukuHelper
import com.valhalla.thor.data.source.local.dhizuku.DhizukuReflector
import com.valhalla.thor.domain.gateway.SystemGateway
class DhizukuSystemGateway(
private val reflector: DhizukuReflector
) : SystemGateway {
override suspend fun isRootAvailable() = false
override fun isShizukuAvailable(): Boolean = false
override fun isDhizukuAvailable(): Boolean {
return DhizukuHelper.isDhizukuAvailable()
}
override suspend fun forceStopApp(packageName: String): Result<Unit> {
return if (reflector.forceStop(packageName)) Result.success(Unit)
else Result.failure(Exception("Dhizuku: Force stop failed. Shell command and reflection both denied."))
}
override suspend fun clearCache(packageName: String): Result<Unit> {
return if (reflector.clearCache(packageName)) Result.success(Unit)
else Result.failure(Exception("Dhizuku: Clear cache failed. System reflection and shell rm -rf both failed."))
}
override suspend fun clearAppData(packageName: String): Result<Unit> {
return if (reflector.clearData(packageName)) Result.success(Unit)
else Result.failure(Exception("Dhizuku: Clear data failed. Shell pm clear and reflection both failed."))
}
override suspend fun setAppDisabled(packageName: String, isDisabled: Boolean): Result<Unit> {
return if (reflector.setAppEnabled(packageName, !isDisabled)) Result.success(Unit)
else Result.failure(Exception("Dhizuku: Set enabled state failed. Shell and reflection both failed."))
}
override suspend fun rebootDevice(reason: String): Result<Unit> {
return Result.failure(Exception("Dhizuku: Reboot not supported directly. Use Root mode instead."))
}
override suspend fun uninstallApp(packageName: String): Result<Unit> {
return if (reflector.uninstallApp(packageName)) {
Result.success(Unit)
} else {
Result.failure(Exception("Dhizuku: Uninstall failed."))
}
}
override suspend fun installApp(apkPath: String, canDowngrade: Boolean): Result<Unit> {
val result = DhizukuHelper.execute(
"pm install -r -g${if (canDowngrade) " -d" else ""} ${
com.valhalla.superuser.ShellUtils.escapedString(apkPath)
}"
)
return if (result.first == 0) {
Result.success(Unit)
} else {
Result.failure(Exception("Dhizuku: Install failed: ${result.second}"))
}
}
override suspend fun getAppCacheSize(packageName: String): Long {
return 0L
}
override suspend fun reinstallAppWithGoogle(packageName: String): Result<Unit> {
if (packageName == com.valhalla.thor.BuildConfig.APPLICATION_ID)
return Result.failure(Exception("Cannot reinstall Thor"))
return try {
// 1. Get the APK path(s)
val pathResult = DhizukuHelper.execute("pm path $packageName")
val paths = pathResult.second?.lines()
?.filter { it.isNotBlank() }
?.map { it.removePrefix("package:").trim() } ?: emptyList()
if (paths.isEmpty()) {
return Result.failure(Exception("Dhizuku: Could not find APK path for $packageName"))
}
val combinedPath = paths.joinToString(" ") { "\"$it\"" }
// 2. Get Current User ID
val userResult = DhizukuHelper.execute("am get-current-user")
val currentUser = userResult.second?.trim()
?: return Result.failure(Exception("Dhizuku: Could not determine current user"))
// 3. Execute the reinstallation command
val command =
"pm install -r -d -i \"com.android.vending\" --user $currentUser --install-reason 0 $combinedPath"
val result = DhizukuHelper.execute(command)
if (result.first == 0) Result.success(Unit)
else Result.failure(Exception("Dhizuku: Reinstall failed: ${result.second}"))
} catch (e: Exception) {
Result.failure(e)
}
}
override suspend fun setAppSuspended(packageName: String, isSuspended: Boolean): Result<Unit> {
return if (reflector.setAppSuspended(packageName, isSuspended)) Result.success(Unit)
else Result.failure(Exception("Dhizuku: Set suspended state failed."))
}
override suspend fun setAppRestricted(
packageName: String,
isRestricted: Boolean
): Result<Unit> {
return if (reflector.setAppRestricted(packageName, isRestricted)) Result.success(Unit)
else Result.failure(Exception("Dhizuku: Set restricted state failed."))
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/data/gateway/RootSystemGateway.kt
================================================
package com.valhalla.thor.data.gateway
import android.content.Context
import com.valhalla.superuser.ktx.ShellRepository
import com.valhalla.thor.BuildConfig
import com.valhalla.thor.domain.gateway.SystemGateway
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
/**
* Modern implementation of SystemGateway using the reactive ShellRepository.
* No more static blocking calls.
*/
class RootSystemGateway(
private val context: Context,
private val shellRepository: ShellRepository
) : SystemGateway {
// A root check is strictly asynchronous. Blocking the thread for this is unacceptable.
override suspend fun isRootAvailable(): Boolean {
return shellRepository.isRootGranted()
}
override fun isShizukuAvailable(): Boolean = false
override fun isDhizukuAvailable(): Boolean = false
override suspend fun forceStopApp(packageName: String): Result<Unit> {
return runCommand("am force-stop $packageName")
}
override suspend fun clearCache(packageName: String): Result<Unit> {
val command = "rm -rf /data/data/$packageName/cache /sdcard/Android/data/$packageName/cache"
return runCommand(command)
}
override suspend fun clearAppData(packageName: String): Result<Unit> {
return runCommand("pm clear $packageName")
}
override suspend fun setAppDisabled(packageName: String, isDisabled: Boolean): Result<Unit> {
val state = if (isDisabled) "disable" else "enable"
return runCommand("pm $state $packageName")
}
override suspend fun setAppSuspended(packageName: String, isSuspended: Boolean): Result<Unit> {
// Try one-shot root task first to show proper branding
if (isSuspended && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
val taskResult = runRootTask("suspend", packageName, isSuspended.toString())
if (taskResult.isSuccess) return Result.success(Unit)
}
val state = if (isSuspended) "suspend" else "unsuspend"
return runCommand("pm $state $packageName")
}
override suspend fun setAppRestricted(
packageName: String,
isRestricted: Boolean
): Result<Unit> {
val state = if (isRestricted) "ignore" else "allow"
return runCommand("appops set $packageName RUN_ANY_IN_BACKGROUND $state")
}
override suspend fun rebootDevice(reason: String): Result<Unit> {
// executeResult returns success if ANY of the commands succeed in the chain logic
return runCommand("svc power reboot $reason || reboot $reason")
}
override suspend fun uninstallApp(packageName: String): Result<Unit> {
return runCommand("pm uninstall --user 0 $packageName")
}
override suspend fun installApp(apkPath: String, canDowngrade: Boolean): Result<Unit> {
val command = "pm install -r -g${if (canDowngrade) " -d" else ""} ${
com.valhalla.superuser.ShellUtils.escapedString(apkPath)
}"
return runCommand(command)
}
override suspend fun getAppCacheSize(packageName: String): Long {
return try {
val result = shellRepository.runCommand("du -s /data/data/$packageName/cache")
val outputLine = result.getOrNull()?.firstOrNull() ?: return 0L
// Output format is usually "12345 /path/to/file"
// We parse this in Kotlin, not using brittle 'awk' or 'cut'
val sizeInBlocks =
outputLine.substringBefore('\t').substringBefore(' ').toLongOrNull() ?: 0L
// du usually returns 1k blocks
sizeInBlocks * 1024
} catch (_: Exception) {
0L
}
}
/**
* Modernized Reinstall Logic.
* Replaces the 'sed' and 'tr' pipes with proper Kotlin string manipulation.
*/
override suspend fun reinstallAppWithGoogle(packageName: String): Result<Unit> {
if (packageName == BuildConfig.APPLICATION_ID)
return Result.failure(Exception("Cannot reinstall Thor"))
return withContext(Dispatchers.IO) {
try {
// 1. Get the APK path(s)
val paths = getAppPaths(packageName)
if (paths.isEmpty()) {
return@withContext Result.failure(Exception("Could not find APK path for $packageName"))
}
val combinedPath = paths.joinToString(" ") { "\"$it\"" }
// 2. Get Current User ID
val userResult = shellRepository.runCommand("am get-current-user")
val currentUser = userResult.getOrNull()?.firstOrNull()?.trim()
?: return@withContext Result.failure(Exception("Could not determine current user"))
// 3. Execute the reinstallation command
val command =
"pm install -r -d -i \"com.android.vending\" --user $currentUser --install-reason 0 $combinedPath"
runCommand(command)
} catch (e: Exception) {
Result.failure(e)
}
}
}
/**
* Copies a file using Root privileges.
*/
suspend fun copyFile(source: String, destination: String) {
val command = "cp \"$source\" \"$destination\""
val result = runCommand(command)
if (result.isFailure) {
throw Exception("Root copy failed: $command")
}
}
/**
* Retrieves all APK paths (Base + Splits) for a package.
*/
suspend fun getAppPaths(packageName: String): List<String> {
val result = shellRepository.runCommand("pm path \"$packageName\"")
val lines = result.getOrNull() ?: emptyList()
return lines
.filter { it.isNotBlank() }
.map { it.removePrefix("package:").trim() }
}
/**
* Executes a Root command in a separate process using app_process.
*/
private suspend fun runRootTask(action: String, vararg args: String): Result<Unit> {
val apkPath = context.packageCodePath
val className = "com.valhalla.thor.data.source.local.root.RootMain"
val cmd = "export CLASSPATH=$apkPath && app_process /system/bin $className $action ${args.joinToString(" ")}"
return runCommand(cmd)
}
/**
* Helper to bridge ShellRepository's Result<List<String>> to Result<Unit>
*/
private suspend fun runCommand(cmd: String): Result<Unit> {
val result = shellRepository.runCommand(cmd)
return if (result.isSuccess) {
Result.success(Unit)
} else {
// Forward the exception from the repository or create a new one
Result.failure(result.exceptionOrNull() ?: Exception("Shell command failed: $cmd"))
}
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/data/gateway/ShizukuSystemGateway.kt
================================================
package com.valhalla.thor.data.gateway
import android.content.pm.PackageManager
import com.valhalla.thor.BuildConfig
import com.valhalla.thor.data.source.local.shizuku.ShizukuReflector
import com.valhalla.thor.domain.gateway.SystemGateway
import rikka.shizuku.Shizuku
import com.valhalla.thor.data.source.local.shizuku.Shizuku as ShizukuHelper
class ShizukuSystemGateway(
private val reflector: ShizukuReflector
) : SystemGateway {
override suspend fun isRootAvailable() = false
override fun isShizukuAvailable(): Boolean {
return try {
Shizuku.checkSelfPermission() == PackageManager.PERMISSION_GRANTED && Shizuku.pingBinder()
} catch (_: Exception) {
false
}
}
override fun isDhizukuAvailable(): Boolean = false
override suspend fun forceStopApp(packageName: String): Result<Unit> {
return runAction { reflector.forceStop(packageName) }
}
override suspend fun clearCache(packageName: String): Result<Unit> {
return runAction { reflector.clearCache(packageName) }
}
override suspend fun clearAppData(packageName: String): Result<Unit> {
return runAction { reflector.clearData(packageName) }
}
override suspend fun setAppDisabled(packageName: String, isDisabled: Boolean): Result<Unit> {
return runAction { reflector.setAppEnabled(packageName, !isDisabled) }
}
override suspend fun setAppSuspended(packageName: String, isSuspended: Boolean): Result<Unit> {
return runAction { reflector.setAppSuspended(packageName, isSuspended) }
}
override suspend fun setAppRestricted(
packageName: String,
isRestricted: Boolean
): Result<Unit> {
return runAction { reflector.setAppRestricted(packageName, isRestricted) }
}
override suspend fun rebootDevice(reason: String): Result<Unit> {
return Result.failure(Exception("Reboot requires Root. Shizuku cannot perform this action."))
}
override suspend fun uninstallApp(packageName: String): Result<Unit> {
return if (reflector.uninstallApp(packageName)) {
Result.success(Unit)
} else {
Result.failure(Exception("Uninstall failed"))
}
}
override suspend fun installApp(apkPath: String, canDowngrade: Boolean): Result<Unit> {
return if (reflector.installPackage(apkPath, canDowngrade)) {
Result.success(Unit)
} else {
Result.failure(Exception("Shizuku install failed. Ensure the file path is readable by Shell/ADB."))
}
}
override suspend fun getAppCacheSize(packageName: String): Long {
return 0L // Requires specialized logic
}
override suspend fun reinstallAppWithGoogle(packageName: String): Result<Unit> {
if (packageName == BuildConfig.APPLICATION_ID)
return Result.failure(Exception("Cannot reinstall Thor"))
return try {
// 1. Get the APK path(s)
val pathResult = ShizukuHelper.execute("pm path $packageName")
val paths = pathResult.second?.lines()
?.filter { it.isNotBlank() }
?.map { it.removePrefix("package:").trim() } ?: emptyList()
if (paths.isEmpty()) {
return Result.failure(Exception("Could not find APK path for $packageName"))
}
val combinedPath = paths.joinToString(" ") { "\"$it\"" }
// 2. Get Current User ID
val userResult = ShizukuHelper.execute("am get-current-user")
val currentUser = userResult.second?.trim()
?: return Result.failure(Exception("Could not determine current user"))
// 3. Execute the reinstallation command
val command =
"pm install -r -d -i \"com.android.vending\" --user $currentUser --install-reason 0 $combinedPath"
val result = ShizukuHelper.execute(command)
if (result.first == 0) Result.success(Unit)
else Result.failure(Exception("Shizuku reinstall failed: ${result.second}"))
} catch (e: Exception) {
Result.failure(e)
}
}
/**
* Standardizes error handling for reflection and shell actions.
*/
private inline fun runAction(action: () -> Boolean): Result<Unit> {
if (!isShizukuAvailable()) {
return Result.failure(Exception("Shizuku is not available or permission denied."))
}
return try {
if (action()) Result.success(Unit)
else Result.failure(Exception("Action failed. This may happen if reflection is blocked or shell lacks permissions."))
} catch (e: Exception) {
if (BuildConfig.DEBUG)
e.printStackTrace()
Result.failure(e)
}
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/data/receivers/InstallReceiver.kt
================================================
package com.valhalla.thor.data.receivers
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.pm.PackageInstaller
import android.os.Build
import com.valhalla.thor.data.ACTION_INSTALL_STATUS
import com.valhalla.thor.domain.InstallState
import com.valhalla.thor.domain.InstallerEventBus
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
/**
* Receives the async installation status result from the Android System.
* This receiver is not exported for security; it is triggered via a targeted PendingIntent.
*/
class InstallReceiver : BroadcastReceiver(), KoinComponent {
private val eventBus: InstallerEventBus by inject()
override fun onReceive(context: Context, intent: Intent) {
if (intent.action != ACTION_INSTALL_STATUS) return
val pendingResult = goAsync()
val status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -1)
CoroutineScope(Dispatchers.IO).launch {
try {
when (status) {
PackageInstaller.STATUS_SUCCESS -> {
eventBus.emit(InstallState.Success)
}
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
val confirmIntent: Intent? =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
intent.getParcelableExtra(
Intent.EXTRA_INTENT,
Intent::class.java
)
} else {
@Suppress("DEPRECATION")
intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)
}
if (confirmIntent != null) {
eventBus.emit(InstallState.UserConfirmationRequired(confirmIntent))
}
}
else -> {
val msg = intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE)
?: "Unknown Error"
eventBus.emit(InstallState.Error("Install Failed ($status): $msg"))
}
}
} finally {
pendingResult.finish()
}
}
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/data/repository/AppAnalyzerImpl.kt
================================================
package com.valhalla.thor.data.repository
import android.content.Context
import android.content.pm.PackageManager
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import android.net.Uri
import android.os.Build
import androidx.core.graphics.createBitmap
import com.valhalla.thor.domain.model.AppMetadata
import com.valhalla.thor.domain.repository.AppAnalyzer
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.io.File
import java.io.FileOutputStream
import java.util.zip.ZipInputStream
class AppAnalyzerImpl(private val context: Context) : AppAnalyzer {
override suspend fun analyze(uri: Uri): Result<AppMetadata> = withContext(Dispatchers.IO) {
val tempFile = File(context.cacheDir, "analysis_${System.currentTimeMillis()}.apk")
try {
val contentResolver = context.contentResolver
// Phase 1: Try to extract a nested APK (for XAPK/APKS)
var isNestedBundle = false
try {
contentResolver.openInputStream(uri)?.use { inputStream ->
ZipInputStream(inputStream).use { zipStream ->
var entry = zipStream.nextEntry
while (entry != null) {
val name = entry.name
if (name.endsWith(".apk", ignoreCase = true)) {
FileOutputStream(tempFile).use { fos ->
zipStream.copyTo(fos)
}
isNestedBundle = true
break
}
zipStream.closeEntry()
entry = zipStream.nextEntry
}
}
}
} catch (_: Exception) {
isNestedBundle = false
}
// Phase 2: Fallback (Standard APK)
if (!isNestedBundle) {
contentResolver.openInputStream(uri)?.use { input ->
FileOutputStream(tempFile).use { output ->
input.copyTo(output)
}
}
}
// Phase 3: Parsing
val pm = context.packageManager
val flags = PackageManager.GET_META_DATA or PackageManager.GET_PERMISSIONS
val archiveInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
pm.getPackageArchiveInfo(
tempFile.absolutePath,
PackageManager.PackageInfoFlags.of(flags.toLong())
)
} else {
@Suppress("DEPRECATION")
pm.getPackageArchiveInfo(tempFile.absolutePath, flags)
}
if (archiveInfo == null) {
return@withContext Result.failure(Exception("Failed to parse APK manifest. The file might be corrupted or encrypted."))
}
// Necessary to load resources properly from an external file
archiveInfo.applicationInfo?.sourceDir = tempFile.absolutePath
archiveInfo.applicationInfo?.publicSourceDir = tempFile.absolutePath
val label = archiveInfo.applicationInfo?.loadLabel(pm).toString()
val drawable = archiveInfo.applicationInfo?.loadIcon(pm)
val version = archiveInfo.versionName ?: "Unknown"
val versionCode = archiveInfo.longVersionCode
val pkgName = archiveInfo.packageName
val permissions = archiveInfo.requestedPermissions?.toList() ?: emptyList()
Result.success(
AppMetadata(
label = label,
packageName = pkgName,
version = version,
versionCode = versionCode,
icon = drawable?.toBitmap(),
permissions = permissions
)
)
} catch (e: Exception) {
Result.failure(e)
} finally {
if (tempFile.exists()) {
tempFile.delete()
}
}
}
private fun Drawable.toBitmap(): Bitmap {
if (this is BitmapDrawable) return this.bitmap
val bitmap = createBitmap(intrinsicWidth.coerceAtLeast(1), intrinsicHeight.coerceAtLeast(1))
val canvas = Canvas(bitmap)
setBounds(0, 0, canvas.width, canvas.height)
draw(canvas)
return bitmap
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/data/repository/AppRepositoryImpl.kt
================================================
package com.valhalla.thor.data.repository
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.pm.PackageManager
import android.os.Build
import com.valhalla.thor.BuildConfig
import com.valhalla.thor.data.source.local.room.AppDao
import com.valhalla.thor.data.source.local.room.AppEntity
import com.valhalla.thor.domain.model.AppInfo
import com.valhalla.thor.domain.repository.AppRepository
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class AppRepositoryImpl(
private val context: Context,
private val appDao: AppDao
) : AppRepository {
private val pm = context.packageManager
/**
* RUTHLESS OPTIMIZATION V2:
* We debounce the TRIGGER to prevent heavy package scanning during batch operations.
*/
override fun getAllApps(): Flow<List<AppInfo>> = callbackFlow {
val producer = this
// A conflated channel acts as a signal buffer.
// If 50 broadcasts come in, we only keep the latest "refresh needed" flag.
val triggerChannel = Channel<Unit>(Channel.CONFLATED)
// The Worker: Consumes triggers, waits for quiet, then fetches ONCE.
val worker = launch(Dispatchers.IO) {
// Initial load from cache and baseline for comparison
val cachedMap = try {
val entities = appDao.getAllApps()
if (entities.isNotEmpty()) {
producer.send(entities.map { it.toDomain() })
}
entities.associateBy { it.packageName }.toMutableMap()
} catch (e: Exception) {
if (BuildConfig.DEBUG) e.printStackTrace()
mutableMapOf<String, AppEntity>()
}
var lastLocale = context.resources.configuration.locales[0].toString()
// Signal the worker to refresh
triggerChannel.send(Unit)
for (signal in triggerChannel) {
// Drain any extra signals that arrived while we were waiting
while (triggerChannel.tryReceive().isSuccess) {
// Do nothing, just consume them so we don't loop immediately again
}
// Now Perform the Heavy Fetch ONE time
try {
val currentLocale = context.resources.configuration.locales[0].toString()
val forceRefresh = currentLocale != lastLocale
if (forceRefresh) {
lastLocale = currentLocale
}
val flags = PackageManager.MATCH_UNINSTALLED_PACKAGES.toLong()
val installedPackages =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
pm.getInstalledPackages(PackageManager.PackageInfoFlags.of(flags))
} else {
pm.getInstalledPackages(PackageManager.MATCH_UNINSTALLED_PACKAGES)
}
val currentList = ArrayList<AppInfo>(installedPackages.size)
val toUpdate = mutableListOf<AppEntity>()
for (packInfo in installedPackages) {
val appInfo = packInfo.applicationInfo ?: continue
val packageName = packInfo.packageName
val cachedEntry = cachedMap[packageName]
val isSuspended =
(appInfo.flags and android.content.pm.ApplicationInfo.FLAG_SUSPENDED) != 0
if (!forceRefresh &&
cachedEntry != null &&
cachedEntry.lastUpdateTime == packInfo.lastUpdateTime &&
cachedEntry.enabled == appInfo.enabled &&
cachedEntry.isSuspended == isSuspended
) {
currentList.add(cachedEntry.toDomain())
} else {
val mapped =
AppInfo.mapToAppInfo(packInfo, appInfo, pm, isLightweight = true)
currentList.add(mapped)
val entity = AppEntity.fromDomain(mapped)
toUpdate.add(entity)
cachedMap[packageName] = entity
}
}
// Handle uninstalled apps: Cleanup cache
val currentPackageNames = installedPackages.map { it.packageName }.toSet()
val toDelete = cachedMap.keys.filter { it !in currentPackageNames }
if (toUpdate.isNotEmpty() || toDelete.isNotEmpty()) {
appDao.syncCache(toUpdate, toDelete)
toDelete.forEach { cachedMap.remove(it) }
}
// Emit a single complete snapshot of all installed apps
producer.send(currentList.toList())
} catch (e: Exception) {
if (BuildConfig.DEBUG) e.printStackTrace()
}
}
}
// Receiver for Package-specific changes (requires "package" data scheme)
val packageReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
triggerChannel.trySend(Unit)
}
}
val packageFilter = IntentFilter().apply {
addAction(Intent.ACTION_PACKAGE_ADDED)
addAction(Intent.ACTION_PACKAGE_REMOVED)
addAction(Intent.ACTION_PACKAGE_FULLY_REMOVED)
addAction(Intent.ACTION_PACKAGE_REPLACED)
addAction(Intent.ACTION_PACKAGE_CHANGED)
addDataScheme("package")
}
// Receiver for General Package changes (No data scheme)
val generalReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
triggerChannel.trySend(Unit)
}
}
val generalFilter = IntentFilter().apply {
addAction(Intent.ACTION_PACKAGES_SUSPENDED)
addAction(Intent.ACTION_PACKAGES_UNSUSPENDED)
}
context.registerReceiver(packageReceiver, packageFilter)
context.registerReceiver(generalReceiver, generalFilter)
awaitClose {
context.unregisterReceiver(packageReceiver)
context.unregisterReceiver(generalReceiver)
worker.cancel()
}
}.flowOn(Dispatchers.IO)
override suspend fun getAppDetails(packageName: String): AppInfo? =
withContext(Dispatchers.IO) {
try {
val flags = (PackageManager.MATCH_UNINSTALLED_PACKAGES).toLong()
val packInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
pm.getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(flags))
} else {
pm.getPackageInfo(packageName, PackageManager.MATCH_UNINSTALLED_PACKAGES)
}
val appInfo = packInfo.applicationInfo ?: return@withContext null
AppInfo.mapToAppInfo(packInfo, appInfo, pm, isLightweight = false)
} catch (e: Exception) {
if (BuildConfig.DEBUG)
e.printStackTrace()
null
}
}
override suspend fun getApkDetails(apkPath: String): AppInfo? = withContext(Dispatchers.IO) {
val flags = PackageManager.GET_PERMISSIONS
val packInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
pm.getPackageArchiveInfo(apkPath, PackageManager.PackageInfoFlags.of(flags.toLong()))
} else {
@Suppress("DEPRECATION")
pm.getPackageArchiveInfo(apkPath, flags)
} ?: return@withContext null
val appInfo = packInfo.applicationInfo?.apply {
sourceDir = apkPath
publicSourceDir = apkPath
} ?: return@withContext null
AppInfo.mapToAppInfo(packInfo, appInfo, pm, isLightweight = false).apply {
this.appName = pm.getApplicationLabel(appInfo).toString()
}
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/data/repository/InstallerRepositoryImpl.kt
================================================
package com.valhalla.thor.data.repository
import android.annotation.SuppressLint
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.PackageInstaller
import android.database.Cursor
import android.net.Uri
import android.os.Build
import android.provider.OpenableColumns
import com.valhalla.bypass.Bypass
import com.valhalla.thor.data.ACTION_INSTALL_STATUS
import com.valhalla.thor.data.gateway.RootSystemGateway
import com.valhalla.thor.data.receivers.InstallReceiver
import com.valhalla.thor.data.source.local.shizuku.ShizukuPackageInstallerUtils
import com.valhalla.thor.data.source.local.shizuku.ShizukuReflector
import com.valhalla.thor.domain.InstallState
import com.valhalla.thor.domain.InstallerEventBus
import com.valhalla.thor.domain.repository.InstallMode
import com.valhalla.thor.domain.repository.InstallerRepository
import com.valhalla.thor.util.Logger
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
import java.io.FileOutputStream
import java.io.InputStream
import java.util.zip.ZipInputStream
class InstallerRepositoryImpl(
private val context: Context,
private val eventBus: InstallerEventBus,
private val rootGateway: RootSystemGateway,
private val shizukuReflector: ShizukuReflector
) : InstallerRepository {
private val defaultInstaller = context.packageManager.packageInstaller
override suspend fun installPackage(uri: Uri, mode: InstallMode, canDowngrade: Boolean) =
withContext(Dispatchers.IO) {
try {
when (mode) {
InstallMode.ROOT -> {
installWithRoot(uri, canDowngrade)
}
InstallMode.SHIZUKU -> {
val privilegedInstaller = try {
getShizukuPackageInstaller()
} catch (e: Throwable) {
if (e is CancellationException) throw e
Logger.e(
"InstallerRepo",
"Failed to get Shizuku installer, will use normal installer: ${e.message}"
)
null
}
if (privilegedInstaller != null) {
try {
// Try privileged path but suppress error emission so we can fall back silently
performPackageInstallerInstall(
uri,
privilegedInstaller,
canDowngrade,
emitErrors = false
)
} catch (e: Throwable) {
if (e is CancellationException) throw e
Logger.e(
"InstallerRepo",
"Shizuku privileged install failed, falling back to normal: ${e.message}"
)
performPackageInstallerInstall(
uri,
defaultInstaller,
canDowngrade,
emitErrors = true
)
}
} else {
// No privileged installer available, use normal installer and allow errors
performPackageInstallerInstall(
uri,
defaultInstaller,
canDowngrade,
emitErrors = true
)
}
}
InstallMode.DHIZUKU -> {
val privilegedInstaller = try {
getDhizukuPackageInstaller()
} catch (e: Throwable) {
if (e is CancellationException) throw e
Logger.e(
"InstallerRepo",
"Failed to get Dhizuku installer, will use normal installer: ${e.message}"
)
null
}
if (privilegedInstaller != null) {
try {
// Try privileged path but suppress error emission so we can fall back silently
performPackageInstallerInstall(
uri,
privilegedInstaller,
canDowngrade,
emitErrors = false
)
} catch (e: Throwable) {
if (e is CancellationException) throw e
Logger.e(
"InstallerRepo",
"Dhizuku privileged install failed, falling back to normal: ${e.message}"
)
performPackageInstallerInstall(
uri,
defaultInstaller,
canDowngrade,
emitErrors = true
)
}
} else {
// No privileged installer available, use normal installer and allow errors
performPackageInstallerInstall(
uri,
defaultInstaller,
canDowngrade,
emitErrors = true
)
}
}
InstallMode.NORMAL -> {
performPackageInstallerInstall(
uri,
defaultInstaller,
canDowngrade,
emitErrors = true
)
}
InstallMode.EXTERNAL -> {
installWithExternal(uri)
}
}
} catch (e: Exception) {
if (e is CancellationException) throw e
eventBus.emit(InstallState.Error(e.message ?: "Unknown error during installation"))
}
}
// Create a PackageInstaller using Dhizuku's binder wrapper but make the installer package
// be this app's package name so created sessions belong to the app UID (avoids UID mismatch).
private fun getDhizukuPackageInstaller(): PackageInstaller {
// Prefer using the existing Shizuku helper which returns a privileged IPackageInstaller.
// This avoids calling IPackageManager.getPackageInstaller() directly (which may not exist
// on some ROMs / API versions and caused NoSuchMethodError).
try {
val iPackageInstaller = ShizukuPackageInstallerUtils.getPrivilegedPackageInstaller()
val root = try {
rikka.shizuku.Shizuku.getUid() == 0
} catch (_: Exception) {
false
}
val userId = if (root) android.os.Process.myUserHandle().hashCode() else 0
val installerPackageName = context.packageName
return ShizukuPackageInstallerUtils.createPackageInstaller(
iPackageInstaller,
installerPackageName,
userId
)
} catch (e: Throwable) {
if (e is CancellationException) throw e
// Bubble up so caller falls back to normal installer; log for debugging.
Logger.e("InstallerRepo", "getDhizukuPackageInstaller failed: ${e.message}")
throw e
}
}
// Create a PackageInstaller using Shizuku's privileged installer helper (like ShizukuReflector)
// and make the installer package be this app's package name so sessions belong to app UID.
private fun getShizukuPackageInstaller(): PackageInstaller {
// Reuse ShizukuPackageInstallerUtils to get a privileged IPackageInstaller safely across API levels
val iPackageInstaller = ShizukuPackageInstallerUtils.getPrivilegedPackageInstaller()
val shizukuUid = try {
rikka.shizuku.Shizuku.getUid()
} catch (_: Exception) {
-1
}
val isRoot = shizukuUid == 0
val isShell = shizukuUid == 2000
// If Shizuku is running as root, set userId to current user; otherwise use 0
val userId = if (isRoot) android.os.Process.myUserHandle().hashCode() else 0
// For ADB-based Shizuku (shell), using "com.android.shell" often works better
// than the app's own package name to avoid permission/UID mismatch issues.
val installerPackageName = if (isShell) "com.android.shell" else context.packageName
return ShizukuPackageInstallerUtils.createPackageInstaller(
iPackageInstaller,
installerPackageName,
userId
)
}
private suspend fun installWithExternal(uri: Uri) {
withContext(Dispatchers.Main) {
try {
val intent = Intent(Intent.ACTION_VIEW).apply {
setDataAndType(uri, "application/vnd.android.package-archive")
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
val chooser = Intent.createChooser(intent, "Install with...")
chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(chooser)
// We consider this a success in terms of handing off the job
eventBus.emit(InstallState.Success)
} catch (e: Exception) {
if (e is CancellationException) throw e
eventBus.emit(InstallState.Error("Could not open external installer: ${e.message}"))
}
}
}
private suspend fun installWithRoot(uri: Uri, canDowngrade: Boolean) {
eventBus.emit(InstallState.Installing(0f))
val tempFile = File(context.cacheDir, "install_temp_${System.currentTimeMillis()}.apk")
try {
// Copy uri to temp file
context.contentResolver.openInputStream(uri)?.use { input ->
FileOutputStream(tempFile).use { output ->
input.copyTo(output)
}
} ?: run {
eventBus.emit(InstallState.Error("Failed to read input file"))
return
}
eventBus.emit(InstallState.Installing(0.5f))
// Execute root install
val result = rootGateway.installApp(tempFile.absolutePath, canDowngrade)
if (result.isSuccess) {
eventBus.emit(InstallState.Installing(1.0f))
eventBus.emit(InstallState.Success)
} else {
eventBus.emit(
InstallState.Error(
result.exceptionOrNull()?.message ?: "Root install failed"
)
)
}
} catch (e: Exception) {
if (e is CancellationException) throw e
eventBus.emit(InstallState.Error("Root install error: ${e.message}"))
} finally {
if (tempFile.exists()) {
tempFile.delete()
}
}
}
@SuppressLint("RequestInstallPackagesPolicy")
private suspend fun performPackageInstallerInstall(
uri: Uri,
packageInstaller: PackageInstaller,
canDowngrade: Boolean,
emitErrors: Boolean = true
) {
val totalBytes = getFileSize(uri)
var bytesProcessed = 0L
var lastProgressEmitted = 0
var filesWritten = false
eventBus.emit(InstallState.Parsing)
val params = PackageInstaller.SessionParams(
PackageInstaller.SessionParams.MODE_FULL_INSTALL
)
if (canDowngrade) {
try {
// Use reflection via Bypass as it might be unresolved in some SDK configurations
Bypass.invoke<Any?>(params::class.java, params, "setRequestDowngrade", true)
} catch (e: Exception) {
if (e is CancellationException) throw e
Logger.e("InstallerRepo", "Failed to setRequestDowngrade", e)
if (emitErrors) {
eventBus.emit(InstallState.Error("Failed to request downgrade: ${e.message}"))
return
} else throw Exception("Failed to request downgrade: ${e.message}")
}
}
val sessionId = try {
packageInstaller.createSession(params)
} catch (e: Exception) {
if (e is CancellationException) throw e
if (emitErrors) {
eventBus.emit(InstallState.Error("Failed to create session: ${e.message}"))
return
} else throw e
}
val session = try {
packageInstaller.openSession(sessionId)
} catch (e: Exception) {
if (e is CancellationException) throw e
if (emitErrors) {
eventBus.emit(InstallState.Error("Failed to open session: ${e.message}"))
return
} else throw e
}
// Helper to track progress across different streams
fun getTrackedStream(baseStream: InputStream): InputStream {
return object : InputStream() {
override fun read(): Int {
val b = baseStream.read()
if (b != -1) updateProgress(1)
return b
}
override fun read(b: ByteArray, off: Int, len: Int): Int {
val read = baseStream.read(b, off, len)
if (read != -1) updateProgress(read.toLong())
return read
}
override fun close() {
baseStream.close()
}
private fun updateProgress(readBytes: Long) {
bytesProcessed += readBytes
if (totalBytes > 0) {
val currentProgress =
((bytesProcessed.toDouble() / totalBytes) * 100).toInt()
if (currentProgress > lastProgressEmitted) {
lastProgressEmitted = currentProgress
CoroutineScope(Dispatchers.IO).launch {
eventBus.emit(InstallState.Installing(bytesProcessed.toFloat() / totalBytes))
}
}
}
}
}
}
try {
// ATTEMPT 1: Try as Bundle (XAPK/APKS/APKM)
val bundleStream: InputStream? = context.contentResolver.openInputStream(uri)
if (bundleStream != null) {
try {
ZipInputStream(bundleStream).use { zipStream ->
var entry = zipStream.nextEntry
while (entry != null) {
val name = entry.name
if (name.endsWith(".apk", ignoreCase = true)) {
filesWritten = true
val size = entry.size
if (size == -1L) {
// Unknown size in Zip: Buffer to temp
val tempFile = File(
context.cacheDir,
"temp_${System.currentTimeMillis()}_${File(name).name}"
)
FileOutputStream(tempFile).use { fos -> zipStream.copyTo(fos) }
val actualSize = tempFile.length()
val outStream = session.openWrite(name, 0, actualSize)
tempFile.inputStream().use { fis -> fis.copyTo(outStream) }
session.fsync(outStream)
outStream.close()
tempFile.delete()
} else {
// Known size: Stream directly
val outStream = session.openWrite(name, 0, size)
val buffer = ByteArray(65536)
var len: Int
while (zipStream.read(buffer).also { len = it } > 0) {
outStream.write(buffer, 0, len)
}
session.fsync(outStream)
outStream.close()
}
}
zipStream.closeEntry()
entry = zipStream.nextEntry
}
}
} catch (e: Exception) {
Logger.e("thor", "Not a valid bundle zip, trying fallback. Error: ${e.message}")
}
}
// ATTEMPT 2: Fallback to Monolithic APK
if (!filesWritten) {
Logger.d("thor", "Fallback: Treating stream as monolithic base.apk")
bytesProcessed = 0
lastProgressEmitted = 0
val rawStream = context.contentResolver.openInputStream(uri)
if (rawStream == null) {
session.abandon()
Logger.e("thor", "Could not open file stream.")
if (emitErrors) {
eventBus.emit(InstallState.Error("Could not open file stream."))
return
} else throw Exception("Could not open file stream.")
}
val trackedStream = getTrackedStream(rawStream)
trackedStream.use { input ->
val size = if (totalBytes > 0) totalBytes else -1L
val outStream = session.openWrite("base.apk", 0, size)
input.copyTo(outStream)
session.fsync(outStream)
outStream.close()
filesWritten = true
}
}
eventBus.emit(InstallState.Installing(1.0f))
val intent = Intent(context, InstallReceiver::class.java).apply {
action = ACTION_INSTALL_STATUS
setPackage(context.packageName)
}
val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
} else {
PendingIntent.FLAG_UPDATE_CURRENT
}
val pendingIntent = PendingIntent.getBroadcast(
context,
sessionId,
intent,
flags
)
session.commit(pendingIntent.intentSender)
session.close()
} catch (e: Exception) {
if (e is CancellationException) throw e
try {
session.abandon()
} catch (_: Exception) {
}
Logger.e("thorInstaller", "Install failed", e)
if (emitErrors) {
eventBus.emit(InstallState.Error(e.message ?: "Unknown installation error"))
} else throw e
}
}
private fun getFileSize(uri: Uri): Long {
var size = -1L
val cursor: Cursor? = context.contentResolver.query(uri, null, null, null, null)
cursor?.use {
if (it.moveToFirst()) {
val sizeIndex = it.getColumnIndex(OpenableColumns.SIZE)
if (sizeIndex != -1) {
size = it.getLong(sizeIndex)
}
}
}
return size
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/data/repository/PreferenceRepositoryImpl.kt
================================================
package com.valhalla.thor.data.repository
import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
import com.valhalla.thor.domain.model.FilterType
import com.valhalla.thor.domain.model.PrivilegeMode
import com.valhalla.thor.domain.model.SortBy
import com.valhalla.thor.domain.model.SortOrder
import com.valhalla.thor.domain.model.ThemeMode
import com.valhalla.thor.domain.model.UserPreferences
import com.valhalla.thor.domain.repository.PreferenceRepository
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "thor_preferences")
class PreferenceRepositoryImpl(
private val context: Context
) : PreferenceRepository {
private object Keys {
// App List
val SORT_BY = stringPreferencesKey("sort_by")
val SORT_ORDER = stringPreferencesKey("sort_order")
val FILTER_TYPE = stringPreferencesKey("filter_type")
val SELECTED_FILTER = stringPreferencesKey("selected_filter")
val SHOW_REINSTALL_ALL = booleanPreferencesKey("show_reinstall_all")
// Theme
val THEME_MODE = stringPreferencesKey("theme_mode")
val USE_DYNAMIC_COLOR = booleanPreferencesKey("use_dynamic_color")
val USE_AMOLED = booleanPreferencesKey("use_amoled")
// Security
val BIOMETRIC_LOCK = booleanPreferencesKey("biometric_lock")
// Work Mode
val PRIVILEGE_MODE = stringPreferencesKey("privilege_mode")
// Localization
val LANGUAGE = stringPreferencesKey("language")
}
override val userPreferences: Flow<UserPreferences> = context.dataStore.data
.map { prefs ->
val sortBy = prefs[Keys.SORT_BY]
?.let { runCatching { SortBy.valueOf(it) }.getOrNull() }
?: SortBy.NAME
val sortOrder = prefs[Keys.SORT_ORDER]
?.let { runCatching { SortOrder.valueOf(it) }.getOrNull() }
?: SortOrder.ASCENDING
val filterType = when (prefs[Keys.FILTER_TYPE]) {
"STATE" -> FilterType.State
else -> FilterType.Source
}
val themeMode = prefs[Keys.THEME_MODE]
?.let { runCatching { ThemeMode.valueOf(it) }.getOrNull() }
?: ThemeMode.SYSTEM
val privilegeMode = prefs[Keys.PRIVILEGE_MODE]
?.let { runCatching { PrivilegeMode.valueOf(it) }.getOrNull() }
UserPreferences(
appSortBy = sortBy,
appSortOrder = sortOrder,
appFilterType = filterType,
appSelectedFilter = prefs[Keys.SELECTED_FILTER] ?: "All",
showReinstallAllCard = prefs[Keys.SHOW_REINSTALL_ALL] ?: true,
themeMode = themeMode,
useDynamicColor = prefs[Keys.USE_DYNAMIC_COLOR] ?: false,
useAmoled = prefs[Keys.USE_AMOLED] ?: false,
biometricLockEnabled = prefs[Keys.BIOMETRIC_LOCK] ?: false,
preferredPrivilegeMode = privilegeMode,
language = prefs[Keys.LANGUAGE]
)
}
// --- App List ---
override suspend fun updateAppSort(sortBy: SortBy) {
context.dataStore.edit { it[Keys.SORT_BY] = sortBy.name }
}
override suspend fun updateAppSortOrder(sortOrder: SortOrder) {
context.dataStore.edit { it[Keys.SORT_ORDER] = sortOrder.name }
}
override suspend fun updateAppFilter(filterType: FilterType, selectedFilter: String) {
context.dataStore.edit {
it[Keys.FILTER_TYPE] = if (filterType is FilterType.State) "STATE" else "SOURCE"
it[Keys.SELECTED_FILTER] = selectedFilter
}
}
override suspend fun setReinstallAllCardVisibility(isVisible: Boolean) {
context.dataStore.edit { it[Keys.SHOW_REINSTALL_ALL] = isVisible }
}
// --- Theme ---
override suspend fun setThemeMode(themeMode: ThemeMode) {
context.dataStore.edit { it[Keys.THEME_MODE] = themeMode.name }
}
override suspend fun setDynamicColor(enabled: Boolean) {
context.dataStore.edit { it[Keys.USE_DYNAMIC_COLOR] = enabled }
}
override suspend fun setUseAmoled(enabled: Boolean) {
context.dataStore.edit { it[Keys.USE_AMOLED] = enabled }
}
// --- Security ---
override suspend fun setBiometricLock(enabled: Boolean) {
context.dataStore.edit { it[Keys.BIOMETRIC_LOCK] = enabled }
}
// --- Work Mode ---
override suspend fun setPrivilegeMode(mode: PrivilegeMode?) {
context.dataStore.edit {
if (mode == null) it.remove(Keys.PRIVILEGE_MODE)
else it[Keys.PRIVILEGE_MODE] = mode.name
}
}
override suspend fun setLanguage(language: String?) {
context.dataStore.edit {
if (language == null) it.remove(Keys.LANGUAGE)
else it[Keys.LANGUAGE] = language
}
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/data/repository/SystemRepositoryImpl.kt
================================================
package com.valhalla.thor.data.repository
import com.valhalla.thor.data.gateway.DhizukuSystemGateway
import com.valhalla.thor.data.gateway.RootSystemGateway
import com.valhalla.thor.data.gateway.ShizukuSystemGateway
import com.valhalla.thor.domain.gateway.SystemGateway
import com.valhalla.thor.domain.model.PrivilegeMode
import com.valhalla.thor.domain.repository.PreferenceRepository
import com.valhalla.thor.domain.repository.SystemRepository
import kotlinx.coroutines.flow.first
class SystemRepositoryImpl(
private val rootGateway: RootSystemGateway,
private val shizukuGateway: ShizukuSystemGateway,
private val dhizukuGateway: DhizukuSystemGateway,
private val preferenceRepository: PreferenceRepository
) : SystemRepository {
override suspend fun isRootAvailable(): Boolean {
return rootGateway.isRootAvailable()
}
override fun isShizukuAvailable(): Boolean = shizukuGateway.isShizukuAvailable()
override fun isDhizukuAvailable(): Boolean = dhizukuGateway.isDhizukuAvailable()
// Dynamic Resolution Strategy: Respect user preference if available, else auto-detect.
// Must be suspend because checking root and reading preferences are suspend operations.
private suspend fun getActiveGateway(): SystemGateway {
val prefs = preferenceRepository.userPreferences.first()
// 1. Try User Preference
prefs.preferredPrivilegeMode?.let { mode ->
when (mode) {
PrivilegeMode.ROOT -> if (rootGateway.isRootAvailable()) return rootGateway
PrivilegeMode.SHIZUKU -> if (shizukuGateway.isShizukuAvailable()) return shizukuGateway
PrivilegeMode.DHIZUKU -> if (dhizukuGateway.isDhizukuAvailable()) return dhizukuGateway
}
}
// 2. Fallback to Auto-Detection
return when {
rootGateway.isRootAvailable() -> rootGateway
shizukuGateway.isShizukuAvailable() -> shizukuGateway
dhizukuGateway.isDhizukuAvailable() -> dhizukuGateway
else -> throw IllegalStateException("No privileged gateway available (Root, Shizuku or Dhizuku required)")
}
}
override suspend fun forceStopApp(packageName: String): Result<Unit> =
getActiveGateway().forceStopApp(packageName)
override suspend fun clearCache(packageName: String): Result<Unit> =
getActiveGateway().clearCache(packageName)
override suspend fun clearAppData(packageName: String): Result<Unit> =
getActiveGateway().clearAppData(packageName)
override suspend fun setAppDisabled(packageName: String, isDisabled: Boolean): Result<Unit> =
getActiveGateway().setAppDisabled(packageName, isDisabled)
override suspend fun setAppSuspended(packageName: String, isSuspended: Boolean): Result<Unit> =
getActiveGateway().setAppSuspended(packageName, isSuspended)
override suspend fun setAppRestricted(
packageName: String,
isRestricted: Boolean
): Result<Unit> =
getActiveGateway().setAppRestricted(packageName, isRestricted)
override suspend fun uninstallApp(packageName: String): Result<Unit> =
getActiveGateway().uninstallApp(packageName)
override suspend fun rebootDevice(reason: String): Result<Unit> {
return if (rootGateway.isRootAvailable()) {
rootGateway.rebootDevice(reason)
} else {
Result.failure(Exception("Reboot requires Root access"))
}
}
override suspend fun aggressiveCleanup(packageName: String): Result<Unit> {
return try {
val gateway = getActiveGateway()
gateway.forceStopApp(packageName)
gateway.clearCache(packageName)
Result.success(Unit)
} catch (e: Exception) {
Result.failure(e)
}
}
override suspend fun reinstallAppWithGoogle(packageName: String): Result<Unit> =
getActiveGateway().reinstallAppWithGoogle(packageName)
override suspend fun copyFileWithRoot(
sourcePath: String,
destinationPath: String
): Result<Unit> {
return if (rootGateway.isRootAvailable()) {
try {
rootGateway.copyFile(sourcePath, destinationPath)
Result.success(Unit)
} catch (e: Exception) {
Result.failure(e)
}
} else {
Result.failure(Exception("Root required for privileged copy"))
}
}
override suspend fun getAppPaths(packageName: String): Result<List<String>> {
return try {
if (rootGateway.isRootAvailable()) {
val paths = rootGateway.getAppPaths(packageName)
if (paths.isNotEmpty()) Result.success(paths)
else Result.failure(Exception("No paths found"))
} else {
Result.failure(Exception("Root required to fetch split paths reliably"))
}
} catch (e: Exception) {
Result.failure(e)
}
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/data/security/BiometricHelper.kt
================================================
package com.valhalla.thor.data.security
import android.content.Context
import androidx.biometric.BiometricManager
import androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_STRONG
import androidx.biometric.BiometricManager.Authenticators.DEVICE_CREDENTIAL
/**
* Thin wrapper around [BiometricManager] that answers capability questions
* without touching any UI. Lives in the data layer — no Compose dependency.
*/
class BiometricHelper(private val context: Context) {
private val allowedAuthenticators = BIOMETRIC_STRONG or DEVICE_CREDENTIAL
/** Returns true if the device can authenticate via biometric or device credential. */
fun canAuthenticate(): Boolean {
return BiometricManager.from(context)
.canAuthenticate(allowedAuthenticators) == BiometricManager.BIOMETRIC_SUCCESS
}
/** Returns true if the device has biometric hardware, regardless of enrollment state. */
fun hasHardware(): Boolean {
val status = BiometricManager.from(context).canAuthenticate(allowedAuthenticators)
return status != BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE
}
}
================================================
FILE: app/src/main/java/com/valhalla/thor/data/source/local/ShellDataSource.kt
================================================
package com.valhalla.thor.data.source.local
import com.valhalla.superuser.Shell
import com.valhalla.thor.BuildConfig
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
/**
* A clean data source for executing shell commands.
* No logic, no formatting, just execution.
*/
class ShellDataSource {
init {
// Initialize LibSu configuration once, cleanly.
// In a real app, you might want to do this in your Application class,
// but it's safe to ensure it's set here.
Shell.enableVerboseLogging = BuildConfig.DEBUG
Shell.setDefaultBuilder(Shell.Builder.create().setFlags(Shell.FLAG_MOUNT_MASTER))
}
suspend fun isRootAvailable(): Boolean = withContext(Dispatchers.IO) {
// LibSu caches this, so it's safe to call.
Shell.isAppGrantedRoot == true || Shell.shell.isRoot
}
/**
* Executes a command with Root privileges.
* Returns true if exit code is 0 (Success).
*/
suspend fun executeRootCommand(command: String): Boolean = withContext(Dispatchers.IO) {
val
gitextract_upudqvso/
├── .github/
│ ├── FUNDING.yml
│ ├── dependabot.yml
│ └── workflows/
│ ├── copilot-setup-steps.yml
│ ├── dev-check.yml
│ ├── manual-build.yml
│ ├── production-deploy.yml
│ ├── release-manager.yml
│ └── telegram-release.yml
├── .gitignore
├── .idea/
│ ├── .gitignore
│ ├── AndroidProjectSystem.xml
│ ├── codeStyles/
│ │ ├── Project.xml
│ │ └── codeStyleConfig.xml
│ ├── compiler.xml
│ ├── copilot.data.migration.agent.xml
│ ├── copilot.data.migration.ask.xml
│ ├── copilot.data.migration.ask2agent.xml
│ ├── copilot.data.migration.edit.xml
│ ├── deviceManager.xml
│ ├── dictionaries/
│ │ └── project.xml
│ ├── google-java-format.xml
│ ├── gradle.xml
│ ├── inspectionProfiles/
│ │ └── Project_Default.xml
│ ├── kotlinc.xml
│ ├── markdown.xml
│ ├── migrations.xml
│ ├── misc.xml
│ ├── runConfigurations/
│ │ └── Generate_Baseline_Profile_for_app.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
├── LICENSE
├── PROJECT_CONTEXT.md
├── README.md
├── app/
│ ├── .gitignore
│ ├── baselineprofile/
│ │ ├── .gitignore
│ │ ├── build.gradle.kts
│ │ └── src/
│ │ └── main/
│ │ ├── AndroidManifest.xml
│ │ └── java/
│ │ └── com/
│ │ └── valhalla/
│ │ └── thor/
│ │ └── baselineprofile/
│ │ ├── BaselineProfileGenerator.kt
│ │ └── StartupBenchmarks.kt
│ ├── build.gradle.kts
│ ├── proguard-rules-foss.pro
│ ├── proguard-rules.pro
│ ├── schemas/
│ │ └── com.valhalla.thor.data.source.local.room.AppDatabase/
│ │ ├── 1.json
│ │ └── 2.json
│ └── src/
│ ├── androidTest/
│ │ └── java/
│ │ └── com/
│ │ └── valhalla/
│ │ └── thor/
│ │ └── ExampleInstrumentedTest.kt
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── assets/
│ │ │ └── adi-registration.properties
│ │ ├── java/
│ │ │ ├── android/
│ │ │ │ └── content/
│ │ │ │ └── pm/
│ │ │ │ ├── IPackageInstaller.java
│ │ │ │ └── IPackageManager.java
│ │ │ └── com/
│ │ │ └── valhalla/
│ │ │ └── thor/
│ │ │ ├── HomeActivity.kt
│ │ │ ├── ThorApplication.kt
│ │ │ ├── core/
│ │ │ │ └── ThorShellConfig.kt
│ │ │ ├── data/
│ │ │ │ ├── Constants.kt
│ │ │ │ ├── gateway/
│ │ │ │ │ ├── DhizukuSystemGateway.kt
│ │ │ │ │ ├── RootSystemGateway.kt
│ │ │ │ │ └── ShizukuSystemGateway.kt
│ │ │ │ ├── receivers/
│ │ │ │ │ └── InstallReceiver.kt
│ │ │ │ ├── repository/
│ │ │ │ │ ├── AppAnalyzerImpl.kt
│ │ │ │ │ ├── AppRepositoryImpl.kt
│ │ │ │ │ ├── InstallerRepositoryImpl.kt
│ │ │ │ │ ├── PreferenceRepositoryImpl.kt
│ │ │ │ │ └── SystemRepositoryImpl.kt
│ │ │ │ ├── security/
│ │ │ │ │ └── BiometricHelper.kt
│ │ │ │ ├── source/
│ │ │ │ │ └── local/
│ │ │ │ │ ├── ShellDataSource.kt
│ │ │ │ │ ├── dhizuku/
│ │ │ │ │ │ ├── Dhizuku.kt
│ │ │ │ │ │ └── DhizukuReflector.kt
│ │ │ │ │ ├── room/
│ │ │ │ │ │ ├── AppDao.kt
│ │ │ │ │ │ ├── AppDatabase.kt
│ │ │ │ │ │ ├── AppEntity.kt
│ │ │ │ │ │ └── AppTypeConverters.kt
│ │ │ │ │ ├── root/
│ │ │ │ │ │ └── RootMain.kt
│ │ │ │ │ └── shizuku/
│ │ │ │ │ ├── PackageManagerExt.kt
│ │ │ │ │ ├── Packages.kt
│ │ │ │ │ ├── Shizuku.kt
│ │ │ │ │ ├── ShizukuPackageInstallerUtils.kt
│ │ │ │ │ ├── ShizukuReflector.kt
│ │ │ │ │ └── Targets.kt
│ │ │ │ └── util/
│ │ │ │ ├── ApksMetadataGenerator.kt
│ │ │ │ └── PackageVerifier.kt
│ │ │ ├── di/
│ │ │ │ └── Modules.kt
│ │ │ ├── domain/
│ │ │ │ ├── InstallState.kt
│ │ │ │ ├── InstallerEventBus.kt
│ │ │ │ ├── gateway/
│ │ │ │ │ └── SystemGateway.kt
│ │ │ │ ├── model/
│ │ │ │ │ ├── ApkDetails.kt
│ │ │ │ │ ├── AppClickAction.kt
│ │ │ │ │ ├── AppInfo.kt
│ │ │ │ │ ├── AppInstallable.kt
│ │ │ │ │ ├── AppListType.kt
│ │ │ │ │ ├── AppMetadata.kt
│ │ │ │ │ ├── FilterType.kt
│ │ │ │ │ ├── HistoryRecord.kt
│ │ │ │ │ ├── MultiAppAction.kt
│ │ │ │ │ ├── PrivilegeMode.kt
│ │ │ │ │ ├── SortBy.kt
│ │ │ │ │ ├── ThemeMode.kt
│ │ │ │ │ └── UserPreferences.kt
│ │ │ │ ├── repository/
│ │ │ │ │ ├── AppAnalyzer.kt
│ │ │ │ │ ├── AppRepository.kt
│ │ │ │ │ ├── InstallerRepository.kt
│ │ │ │ │ ├── PreferenceRepository.kt
│ │ │ │ │ └── SystemRepository.kt
│ │ │ │ └── usecase/
│ │ │ │ ├── GetAppDetailsUseCase.kt
│ │ │ │ ├── GetInstalledAppsUseCase.kt
│ │ │ │ ├── ManageAppUseCase.kt
│ │ │ │ └── ShareAppUseCase.kt
│ │ │ ├── presentation/
│ │ │ │ ├── appList/
│ │ │ │ │ ├── AppListScreen.kt
│ │ │ │ │ └── AppListViewModel.kt
│ │ │ │ ├── common/
│ │ │ │ │ ├── ShizukuPermissionHandler.kt
│ │ │ │ │ └── components/
│ │ │ │ │ └── ConnectedButtonGroup.kt
│ │ │ │ ├── freezer/
│ │ │ │ │ ├── FreezerScreen.kt
│ │ │ │ │ └── FreezerViewModel.kt
│ │ │ │ ├── home/
│ │ │ │ │ ├── AppDestinations.kt
│ │ │ │ │ ├── HomeScreen.kt
│ │ │ │ │ ├── HomeViewModel.kt
│ │ │ │ │ └── components/
│ │ │ │ │ ├── AnimatedCounter.kt
│ │ │ │ │ ├── AppDistributionChart.kt
│ │ │ │ │ ├── DashboardHeader.kt
│ │ │ │ │ ├── SocialLinksRow.kt
│ │ │ │ │ └── SummaryStatRow.kt
│ │ │ │ ├── installer/
│ │ │ │ │ ├── InstallerViewModel.kt
│ │ │ │ │ ├── PortableInstaller.kt
│ │ │ │ │ └── PortableInstallerActivity.kt
│ │ │ │ ├── main/
│ │ │ │ │ ├── MainScreen.kt
│ │ │ │ │ ├── MainViewModel.kt
│ │ │ │ │ └── ThorNavigationBar.kt
│ │ │ │ ├── security/
│ │ │ │ │ ├── AuthState.kt
│ │ │ │ │ ├── BiometricPromptHandler.kt
│ │ │ │ │ ├── BiometricScreen.kt
│ │ │ │ │ └── SecurityViewModel.kt
│ │ │ │ ├── settings/
│ │ │ │ │ ├── SettingsScreen.kt
│ │ │ │ │ └── SettingsViewModel.kt
│ │ │ │ ├── theme/
│ │ │ │ │ ├── Color.kt
│ │ │ │ │ ├── Motion.kt
│ │ │ │ │ ├── Theme.kt
│ │ │ │ │ └── Type.kt
│ │ │ │ ├── utils/
│ │ │ │ │ ├── AppIconLoader.kt
│ │ │ │ │ ├── CacheScanner.kt
│ │ │ │ │ └── UiUtils.kt
│ │ │ │ └── widgets/
│ │ │ │ ├── AffirmationDialog.kt
│ │ │ │ ├── AnimateLottieRaw.kt
│ │ │ │ ├── AppInfoDialog.kt
│ │ │ │ ├── AppList.kt
│ │ │ │ ├── MultiSelectToolBox.kt
│ │ │ │ ├── TermLogger.kt
│ │ │ │ └── TypeWriterText.kt
│ │ │ └── util/
│ │ │ ├── LocaleManager.kt
│ │ │ └── Logger.kt
│ │ └── res/
│ │ ├── drawable/
│ │ │ ├── android.xml
│ │ │ ├── apk_install.xml
│ │ │ ├── apps.xml
│ │ │ ├── arrow_downward.xml
│ │ │ ├── arrow_drop_down.xml
│ │ │ ├── arrow_upward.xml
│ │ │ ├── bolt.xml
│ │ │ ├── brand_github.xml
│ │ │ ├── brand_patreon.xml
│ │ │ ├── brand_telegram.xml
│ │ │ ├── cat.xml
│ │ │ ├── check_circle.xml
│ │ │ ├── clear_all.xml
│ │ │ ├── danger.xml
│ │ │ ├── delete.xml
│ │ │ ├── delete_forever.xml
│ │ │ ├── dhizuku.xml
│ │ │ ├── exit_to_app.xml
│ │ │ ├── filter_list.xml
│ │ │ ├── force_close.xml
│ │ │ ├── freeze_off.xml
│ │ │ ├── frozen.xml
│ │ │ ├── grid_view.xml
│ │ │ ├── home.xml
│ │ │ ├── home_outline.xml
│ │ │ ├── ic_launcher_background.xml
│ │ │ ├── ic_launcher_foreground.xml
│ │ │ ├── ios_share.xml
│ │ │ ├── key.xml
│ │ │ ├── key_outline.xml
│ │ │ ├── list.xml
│ │ │ ├── magisk_icon.xml
│ │ │ ├── open_in.xml
│ │ │ ├── open_in_new.xml
│ │ │ ├── privacy_tip.xml
│ │ │ ├── round_close.xml
│ │ │ ├── round_key.xml
│ │ │ ├── round_search.xml
│ │ │ ├── settings.xml
│ │ │ ├── settings_backup_restore.xml
│ │ │ ├── settings_outline.xml
│ │ │ ├── share.xml
│ │ │ ├── shield.xml
│ │ │ ├── shield_bad.xml
│ │ │ ├── shield_countdown.xml
│ │ │ ├── shield_encrypted.xml
│ │ │ ├── shield_maybe.xml
│ │ │ ├── shield_search.xml
│ │ │ ├── shield_verified.xml
│ │ │ ├── shield_with_heart.xml
│ │ │ ├── shizuku.xml
│ │ │ ├── shizuku_outline_icon.xml
│ │ │ ├── snowflake.xml
│ │ │ ├── sort.xml
│ │ │ ├── sort_by_alpha.xml
│ │ │ ├── storage.xml
│ │ │ ├── theme_panel.xml
│ │ │ ├── thor_animated.xml
│ │ │ ├── thor_drawn_foreground.xml
│ │ │ ├── thor_icon_foreground.xml
│ │ │ ├── thor_mono.xml
│ │ │ ├── unfreeze.xml
│ │ │ ├── view_stream.xml
│ │ │ └── warning.xml
│ │ ├── mipmap-anydpi-v26/
│ │ │ ├── thor_drawn.xml
│ │ │ └── thor_drawn_round.xml
│ │ ├── raw/
│ │ │ └── rearrange.json
│ │ ├── raw-night/
│ │ │ └── rearrange.json
│ │ ├── values/
│ │ │ ├── colors.xml
│ │ │ ├── font_certs.xml
│ │ │ ├── non-translatable.xml
│ │ │ ├── strings.xml
│ │ │ ├── themes.xml
│ │ │ ├── thor_drawn_background.xml
│ │ │ └── thor_icon_background.xml
│ │ ├── values-ar/
│ │ │ └── strings.xml
│ │ ├── values-es/
│ │ │ └── strings.xml
│ │ ├── values-fr/
│ │ │ └── strings.xml
│ │ ├── values-v31/
│ │ │ └── themes.xml
│ │ ├── values-zh-rCN/
│ │ │ └── strings.xml
│ │ └── xml/
│ │ ├── backup_rules.xml
│ │ ├── data_extraction_rules.xml
│ │ ├── locales_config.xml
│ │ └── provider_paths.xml
│ └── test/
│ └── java/
│ └── com/
│ └── valhalla/
│ └── thor/
│ └── ExampleUnitTest.kt
├── build.gradle.kts
├── bypass/
│ ├── .gitignore
│ ├── README.md
│ ├── build.gradle.kts
│ ├── consumer-rules.pro
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ └── java/
│ └── com/
│ └── valhalla/
│ └── bypass/
│ └── Bypass.kt
├── fastlane/
│ ├── Appfile
│ ├── Fastfile
│ └── metadata/
│ └── android/
│ └── en-US/
│ ├── changelogs/
│ │ └── 1600.txt
│ ├── full_description.txt
│ ├── short_description.txt
│ └── title.txt
├── gradle/
│ ├── gradle-daemon-jvm.properties
│ ├── libs.versions.toml
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── settings.gradle.kts
├── suCore/
│ ├── .gitignore
│ ├── README.md
│ ├── build.gradle.kts
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── aidl/
│ │ └── com/
│ │ └── valhalla/
│ │ └── superuser/
│ │ └── ipc/
│ │ └── IIPC.aidl
│ └── java/
│ └── com/
│ └── valhalla/
│ └── superuser/
│ ├── CallbackList.kt
│ ├── NoShellException.kt
│ ├── Shell.kt
│ ├── ShellUtils.kt
│ ├── internal/
│ │ ├── BuilderImpl.kt
│ │ ├── CoroutineStreamGobbler.kt
│ │ ├── JobTask.kt
│ │ ├── MainShell.kt
│ │ ├── PendingJob.kt
│ │ ├── ResultFuture.kt
│ │ ├── ResultHolder.kt
│ │ ├── ResultImpl.kt
│ │ ├── ShellImpl.kt
│ │ ├── ShellInputSource.kt
│ │ ├── ShellJob.kt
│ │ ├── StreamGobbler.kt
│ │ ├── UiThreadHandler.kt
│ │ └── Utils.kt
│ ├── ktx/
│ │ ├── ShellExtensions.kt
│ │ └── ShellRepository.kt
│ └── utils/
│ ├── Logger.kt
│ └── ShellUtils.kt
└── vm-runtime/
├── README.md
├── build.gradle.kts
└── src/
└── main/
└── java/
└── dalvik/
└── system/
└── VMRuntime.java
SYMBOL INDEX (10 symbols across 3 files)
FILE: app/src/main/java/android/content/pm/IPackageInstaller.java
type IPackageInstaller (line 12) | public interface IPackageInstaller extends IInterface {
class Stub (line 14) | abstract class Stub extends Binder implements IPackageInstaller {
method asInterface (line 16) | public static IPackageInstaller asInterface(IBinder binder) {
FILE: app/src/main/java/android/content/pm/IPackageManager.java
type IPackageManager (line 14) | public interface IPackageManager extends IInterface {
method getPackageInstaller (line 16) | IPackageInstaller getPackageInstaller()
class Stub (line 19) | abstract class Stub extends Binder implements IPackageManager {
method asInterface (line 21) | public static IPackageManager asInterface(IBinder obj) {
FILE: vm-runtime/src/main/java/dalvik/system/VMRuntime.java
class VMRuntime (line 3) | public class VMRuntime {
method getRuntime (line 4) | public static VMRuntime getRuntime() {
method setHiddenApiExemptions (line 8) | public void setHiddenApiExemptions(String... signatures) {
Condensed preview — 285 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,020K chars).
[
{
"path": ".github/FUNDING.yml",
"chars": 135,
"preview": "github: trinadhthatakula\npatreon: trinadh\nko_fi: trinadh\nbuy_me_a_coffee: trinadh\ncustom: [ \"https://www.paypal.me/trina"
},
{
"path": ".github/dependabot.yml",
"chars": 193,
"preview": "version: 2\nupdates:\n - package-ecosystem: \"gradle\"\n directory: \"/\"\n schedule:\n interval: \"daily\"\n target-"
},
{
"path": ".github/workflows/copilot-setup-steps.yml",
"chars": 637,
"preview": "name: \"Copilot Setup Steps\"\n\non:\n workflow_dispatch:\n push:\n branches: [ \"master\" ]\n paths:\n - .github/work"
},
{
"path": ".github/workflows/dev-check.yml",
"chars": 3920,
"preview": "name: Dev Build & Test\n\non:\n push:\n branches: [ \"master\" ]\n workflow_dispatch:\n\njobs:\n build-release-check:\n ru"
},
{
"path": ".github/workflows/manual-build.yml",
"chars": 2363,
"preview": "name: Manual Build (No Upload)\n\non:\n workflow_dispatch:\n\njobs:\n build-only:\n runs-on: ubuntu-latest\n permissions"
},
{
"path": ".github/workflows/production-deploy.yml",
"chars": 2656,
"preview": "name: 2. Production Build & Distribute\n\non:\n push:\n branches: [ \"production\" ]\n workflow_dispatch:\n\njobs:\n release"
},
{
"path": ".github/workflows/release-manager.yml",
"chars": 2954,
"preview": "name: 1. Release Manager (Bump Version)\n\non:\n workflow_dispatch:\n inputs:\n bump_type:\n description: 'Ver"
},
{
"path": ".github/workflows/telegram-release.yml",
"chars": 5167,
"preview": "name: Telegram Release\n\non:\n workflow_dispatch:\n inputs:\n version_code:\n description: 'Specific Version "
},
{
"path": ".gitignore",
"chars": 380,
"preview": "*.iml\n.gradle\n/local.properties\n/.idea/caches\n/.idea/libraries\n/.idea/modules.xml\n/.idea/workspace.xml\n/.idea/navEditor."
},
{
"path": ".idea/.gitignore",
"chars": 47,
"preview": "# Default ignored files\n/shelf/\n/workspace.xml\n"
},
{
"path": ".idea/AndroidProjectSystem.xml",
"chars": 212,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"AndroidProjectSystem\">\n <option name="
},
{
"path": ".idea/codeStyles/Project.xml",
"chars": 5383,
"preview": "<component name=\"ProjectCodeStyleConfiguration\">\n <code_scheme name=\"Project\" version=\"173\">\n <JavaCodeStyleSettings"
},
{
"path": ".idea/codeStyles/codeStyleConfig.xml",
"chars": 142,
"preview": "<component name=\"ProjectCodeStyleConfiguration\">\n <state>\n <option name=\"USE_PER_PROJECT_SETTINGS\" value=\"true\" />\n "
},
{
"path": ".idea/compiler.xml",
"chars": 169,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"CompilerConfiguration\">\n <bytecodeTar"
},
{
"path": ".idea/copilot.data.migration.agent.xml",
"chars": 190,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"AgentMigrationStateService\">\n <option"
},
{
"path": ".idea/copilot.data.migration.ask.xml",
"chars": 188,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"AskMigrationStateService\">\n <option n"
},
{
"path": ".idea/copilot.data.migration.ask2agent.xml",
"chars": 194,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"Ask2AgentMigrationStateService\">\n <op"
},
{
"path": ".idea/copilot.data.migration.edit.xml",
"chars": 189,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"EditMigrationStateService\">\n <option "
},
{
"path": ".idea/deviceManager.xml",
"chars": 351,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"DeviceTable\">\n <option name=\"columnSo"
},
{
"path": ".idea/dictionaries/project.xml",
"chars": 381,
"preview": "<component name=\"ProjectDictionaryState\">\n <dictionary name=\"project\">\n <words>\n <w>Appfile</w>\n <w>apkm</"
},
{
"path": ".idea/google-java-format.xml",
"chars": 176,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"GoogleJavaFormatSettings\">\n <option n"
},
{
"path": ".idea/gradle.xml",
"chars": 902,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"GradleMigrationSettings\" migrationVersio"
},
{
"path": ".idea/inspectionProfiles/Project_Default.xml",
"chars": 3765,
"preview": "<component name=\"InspectionProjectProfileManager\">\n <profile version=\"1.0\">\n <option name=\"myName\" value=\"Project De"
},
{
"path": ".idea/kotlinc.xml",
"chars": 447,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"Kotlin2JsCompilerArguments\">\n <option"
},
{
"path": ".idea/markdown.xml",
"chars": 307,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"MarkdownSettings\">\n <option name=\"pre"
},
{
"path": ".idea/migrations.xml",
"chars": 254,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ProjectMigrations\">\n <option name=\"Mi"
},
{
"path": ".idea/misc.xml",
"chars": 409,
"preview": "<project version=\"4\">\n <component name=\"ExternalStorageConfigurationManager\" enabled=\"true\" />\n <component name=\"Proje"
},
{
"path": ".idea/runConfigurations/Generate_Baseline_Profile_for_app.xml",
"chars": 2753,
"preview": "<component name=\"ProjectRunConfigurationManager\">\n <configuration default=\"false\" name=\"Generate Baseline Profile for a"
},
{
"path": ".idea/runConfigurations.xml",
"chars": 964,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"RunConfigurationProducerService\">\n <o"
},
{
"path": ".idea/vcs.xml",
"chars": 167,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"VcsDirectoryMappings\">\n <mapping dire"
},
{
"path": "LICENSE",
"chars": 35149,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
},
{
"path": "PROJECT_CONTEXT.md",
"chars": 7364,
"preview": "# Thor App Manager - Project Context\n\nThor is a modern, lightweight, and privacy-focused Android App Manager. It is desi"
},
{
"path": "README.md",
"chars": 4532,
"preview": "<p align=\"center\">\n <img src=\"app/src/main/thor_drawn-playstore.png\" alt=\"Thor Logo\" height=\"192dp\">\n</p>\n\n<h1 align=\"c"
},
{
"path": "app/.gitignore",
"chars": 6,
"preview": "/build"
},
{
"path": "app/baselineprofile/.gitignore",
"chars": 6,
"preview": "/build"
},
{
"path": "app/baselineprofile/build.gradle.kts",
"chars": 1394,
"preview": "plugins {\n alias(libs.plugins.android.test)\n alias(libs.plugins.baselineprofile)\n}\n\nandroid {\n namespace = \"com"
},
{
"path": "app/baselineprofile/src/main/AndroidManifest.xml",
"chars": 12,
"preview": "<manifest />"
},
{
"path": "app/baselineprofile/src/main/java/com/valhalla/thor/baselineprofile/BaselineProfileGenerator.kt",
"chars": 2901,
"preview": "package com.valhalla.thor.baselineprofile\n\nimport androidx.benchmark.macro.junit4.BaselineProfileRule\nimport androidx.te"
},
{
"path": "app/baselineprofile/src/main/java/com/valhalla/thor/baselineprofile/StartupBenchmarks.kt",
"chars": 3298,
"preview": "package com.valhalla.thor.baselineprofile\n\nimport androidx.benchmark.macro.BaselineProfileMode\nimport androidx.benchmark"
},
{
"path": "app/build.gradle.kts",
"chars": 8138,
"preview": "import com.android.build.api.artifact.SingleArtifact\nimport org.jetbrains.kotlin.gradle.dsl.JvmTarget\nimport java.io.Fil"
},
{
"path": "app/proguard-rules-foss.pro",
"chars": 1016,
"preview": "# Add project specific ProGuard rules here.\n# You can control the set of applied configuration files using the\n# proguar"
},
{
"path": "app/proguard-rules.pro",
"chars": 948,
"preview": "# Add project specific ProGuard rules here.\n# You can control the set of applied configuration files using the\n# proguar"
},
{
"path": "app/schemas/com.valhalla.thor.data.source.local.room.AppDatabase/1.json",
"chars": 4550,
"preview": "{\n \"formatVersion\": 1,\n \"database\": {\n \"version\": 1,\n \"identityHash\": \"0250ce576c64723c12faf13e9d8ccb18\",\n \"e"
},
{
"path": "app/schemas/com.valhalla.thor.data.source.local.room.AppDatabase/2.json",
"chars": 4751,
"preview": "{\n \"formatVersion\": 1,\n \"database\": {\n \"version\": 2,\n \"identityHash\": \"37ee5d25d4bab9e2695c36e7dc21a849\",\n \"e"
},
{
"path": "app/src/androidTest/java/com/valhalla/thor/ExampleInstrumentedTest.kt",
"chars": 670,
"preview": "package com.valhalla.thor\n\nimport androidx.test.ext.junit.runners.AndroidJUnit4\nimport androidx.test.platform.app.Instru"
},
{
"path": "app/src/main/AndroidManifest.xml",
"chars": 5562,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:to"
},
{
"path": "app/src/main/assets/adi-registration.properties",
"chars": 26,
"preview": "CIQKVO6RQ32OMAAAAAAAAAAAAA"
},
{
"path": "app/src/main/java/android/content/pm/IPackageInstaller.java",
"chars": 589,
"preview": "package android.content.pm;\n\nimport android.os.Binder;\nimport android.os.IBinder;\nimport android.os.IInterface;\n\n/**\n * "
},
{
"path": "app/src/main/java/android/content/pm/IPackageManager.java",
"chars": 694,
"preview": "package android.content.pm;\n\nimport android.os.Binder;\nimport android.os.IBinder;\nimport android.os.IInterface;\nimport a"
},
{
"path": "app/src/main/java/com/valhalla/thor/HomeActivity.kt",
"chars": 4374,
"preview": "package com.valhalla.thor\n\nimport android.os.Bundle\nimport androidx.activity.ComponentActivity\nimport androidx.activity."
},
{
"path": "app/src/main/java/com/valhalla/thor/ThorApplication.kt",
"chars": 2201,
"preview": "package com.valhalla.thor\n\nimport android.app.Application\nimport com.rosan.dhizuku.api.Dhizuku\nimport com.valhalla.bypas"
},
{
"path": "app/src/main/java/com/valhalla/thor/core/ThorShellConfig.kt",
"chars": 793,
"preview": "package com.valhalla.thor.core\n\nimport com.valhalla.superuser.Shell\nimport com.valhalla.thor.BuildConfig\nimport com.valh"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/Constants.kt",
"chars": 100,
"preview": "package com.valhalla.thor.data\n\nconst val ACTION_INSTALL_STATUS = \"com.valhalla.thor.INSTALL_STATUS\""
},
{
"path": "app/src/main/java/com/valhalla/thor/data/gateway/DhizukuSystemGateway.kt",
"chars": 4777,
"preview": "package com.valhalla.thor.data.gateway\n\nimport com.valhalla.thor.data.source.local.dhizuku.DhizukuHelper\nimport com.valh"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/gateway/RootSystemGateway.kt",
"chars": 6784,
"preview": "package com.valhalla.thor.data.gateway\n\nimport android.content.Context\nimport com.valhalla.superuser.ktx.ShellRepository"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/gateway/ShizukuSystemGateway.kt",
"chars": 4819,
"preview": "package com.valhalla.thor.data.gateway\n\nimport android.content.pm.PackageManager\nimport com.valhalla.thor.BuildConfig\nim"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/receivers/InstallReceiver.kt",
"chars": 2547,
"preview": "package com.valhalla.thor.data.receivers\n\nimport android.content.BroadcastReceiver\nimport android.content.Context\nimport"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/repository/AppAnalyzerImpl.kt",
"chars": 4602,
"preview": "package com.valhalla.thor.data.repository\n\nimport android.content.Context\nimport android.content.pm.PackageManager\nimpor"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/repository/AppRepositoryImpl.kt",
"chars": 8592,
"preview": "package com.valhalla.thor.data.repository\n\nimport android.content.BroadcastReceiver\nimport android.content.Context\nimpor"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/repository/InstallerRepositoryImpl.kt",
"chars": 20759,
"preview": "package com.valhalla.thor.data.repository\n\nimport android.annotation.SuppressLint\nimport android.app.PendingIntent\nimpor"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/repository/PreferenceRepositoryImpl.kt",
"chars": 5275,
"preview": "package com.valhalla.thor.data.repository\n\nimport android.content.Context\nimport androidx.datastore.core.DataStore\nimpor"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/repository/SystemRepositoryImpl.kt",
"chars": 5018,
"preview": "package com.valhalla.thor.data.repository\n\nimport com.valhalla.thor.data.gateway.DhizukuSystemGateway\nimport com.valhall"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/security/BiometricHelper.kt",
"chars": 1129,
"preview": "package com.valhalla.thor.data.security\n\nimport android.content.Context\nimport androidx.biometric.BiometricManager\nimpor"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/ShellDataSource.kt",
"chars": 1684,
"preview": "package com.valhalla.thor.data.source.local\n\nimport com.valhalla.superuser.Shell\nimport com.valhalla.thor.BuildConfig\nim"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/dhizuku/Dhizuku.kt",
"chars": 12191,
"preview": "package com.valhalla.thor.data.source.local.dhizuku\n\nimport android.annotation.SuppressLint\nimport android.content.Conte"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/dhizuku/DhizukuReflector.kt",
"chars": 2156,
"preview": "package com.valhalla.thor.data.source.local.dhizuku\n\nimport android.content.Context\nimport com.valhalla.thor.BuildConfig"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/room/AppDao.kt",
"chars": 1027,
"preview": "package com.valhalla.thor.data.source.local.room\n\nimport androidx.room.Dao\nimport androidx.room.Insert\nimport androidx.r"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/room/AppDatabase.kt",
"chars": 350,
"preview": "package com.valhalla.thor.data.source.local.room\n\nimport androidx.room.Database\nimport androidx.room.RoomDatabase\nimport"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/room/AppEntity.kt",
"chars": 3226,
"preview": "package com.valhalla.thor.data.source.local.room\n\nimport androidx.room.Entity\nimport androidx.room.PrimaryKey\nimport com"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/room/AppTypeConverters.kt",
"chars": 424,
"preview": "package com.valhalla.thor.data.source.local.room\n\nimport androidx.room.TypeConverter\nimport kotlinx.serialization.json.J"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/root/RootMain.kt",
"chars": 5168,
"preview": "package com.valhalla.thor.data.source.local.root\n\nimport android.os.Build\nimport android.os.IBinder\nimport com.valhalla."
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/shizuku/PackageManagerExt.kt",
"chars": 2540,
"preview": "package com.valhalla.thor.data.source.local.shizuku\n\nimport android.content.pm.PackageInfo\nimport android.content.pm.Pac"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/shizuku/Packages.kt",
"chars": 4554,
"preview": "package com.valhalla.thor.data.source.local.shizuku\n\nimport android.app.ActivityManager\nimport android.app.AppOpsManager"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/shizuku/Shizuku.kt",
"chars": 12642,
"preview": "package com.valhalla.thor.data.source.local.shizuku\n\nimport android.content.Context\nimport android.os.IBinder\nimport and"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/shizuku/ShizukuPackageInstallerUtils.kt",
"chars": 2609,
"preview": "package com.valhalla.thor.data.source.local.shizuku\n\nimport android.content.pm.IPackageInstaller\nimport android.content."
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/shizuku/ShizukuReflector.kt",
"chars": 9641,
"preview": "@file:Suppress(\"unused\")\n\npackage com.valhalla.thor.data.source.local.shizuku\n\nimport android.annotation.SuppressLint\nim"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/source/local/shizuku/Targets.kt",
"chars": 905,
"preview": "package com.valhalla.thor.data.source.local.shizuku\n\nimport android.os.Build\nimport androidx.annotation.ChecksSdkIntAtLe"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/util/ApksMetadataGenerator.kt",
"chars": 1239,
"preview": "package com.valhalla.thor.data.util\n\nimport com.valhalla.thor.domain.model.AppInfo\nimport kotlinx.serialization.SerialNa"
},
{
"path": "app/src/main/java/com/valhalla/thor/data/util/PackageVerifier.kt",
"chars": 1244,
"preview": "package com.valhalla.thor.data.util\n\nimport android.content.pm.ApplicationInfo\nimport android.content.pm.PackageManager\n"
},
{
"path": "app/src/main/java/com/valhalla/thor/di/Modules.kt",
"chars": 4341,
"preview": "package com.valhalla.thor.di\n\nimport android.content.pm.PackageManager\nimport androidx.room.Room\nimport com.valhalla.sup"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/InstallState.kt",
"chars": 2039,
"preview": "package com.valhalla.thor.domain\n\nimport android.content.Intent\nimport com.valhalla.thor.domain.model.AppMetadata\n\n/**\n "
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/InstallerEventBus.kt",
"chars": 594,
"preview": "package com.valhalla.thor.domain\n\nimport kotlinx.coroutines.flow.MutableSharedFlow\nimport kotlinx.coroutines.flow.Shared"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/gateway/SystemGateway.kt",
"chars": 1212,
"preview": "package com.valhalla.thor.domain.gateway\n\n/**\n * The Contract: This defines every privileged action Thor can perform.\n *"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/ApkDetails.kt",
"chars": 332,
"preview": "package com.valhalla.thor.domain.model\n\nimport android.graphics.drawable.Drawable\n\ndata class ApkDetails(\n val appNam"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/AppClickAction.kt",
"chars": 941,
"preview": "package com.valhalla.thor.domain.model\n\nsealed interface AppClickAction {\n //data class Logcat(val appInfo: AppInfo):"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/AppInfo.kt",
"chars": 4397,
"preview": "package com.valhalla.thor.domain.model\n\nimport android.content.pm.ApplicationInfo\nimport android.content.pm.PackageInfo\n"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/AppInstallable.kt",
"chars": 147,
"preview": "package com.valhalla.thor.domain.model\n\ndata class AppInstallable(\n val name: String,\n val apkPath: String,\n va"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/AppListType.kt",
"chars": 83,
"preview": "package com.valhalla.thor.domain.model\n\nenum class AppListType {\n USER, SYSTEM\n}"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/AppMetadata.kt",
"chars": 272,
"preview": "package com.valhalla.thor.domain.model\n\nimport android.graphics.Bitmap\n\ndata class AppMetadata(\n val label: String,\n "
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/FilterType.kt",
"chars": 456,
"preview": "package com.valhalla.thor.domain.model\n\nsealed interface FilterType {\n data object Source : FilterType\n data objec"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/HistoryRecord.kt",
"chars": 424,
"preview": "package com.valhalla.thor.domain.model\n\nimport kotlinx.serialization.Serializable\n\n\n@Serializable\nenum class OperationTy"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/MultiAppAction.kt",
"chars": 762,
"preview": "package com.valhalla.thor.domain.model\n\nsealed interface MultiAppAction {\n data class ReInstall(val appList: List<App"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/PrivilegeMode.kt",
"chars": 104,
"preview": "package com.valhalla.thor.domain.model\n\nenum class PrivilegeMode {\n ROOT,\n SHIZUKU,\n DHIZUKU\n}\n"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/SortBy.kt",
"chars": 1536,
"preview": "package com.valhalla.thor.domain.model\n\nimport com.valhalla.thor.R\nimport kotlinx.serialization.Serializable\n\n@Serializa"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/ThemeMode.kt",
"chars": 220,
"preview": "package com.valhalla.thor.domain.model\n\nenum class ThemeMode {\n LIGHT,\n DARK,\n SYSTEM;\n\n fun label(): String"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/model/UserPreferences.kt",
"chars": 737,
"preview": "package com.valhalla.thor.domain.model\n\ndata class UserPreferences(\n // App List Sorting & Filtering\n val appSortB"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/repository/AppAnalyzer.kt",
"chars": 292,
"preview": "package com.valhalla.thor.domain.repository\n\nimport android.net.Uri\nimport com.valhalla.thor.domain.model.AppMetadata\n\ni"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/repository/AppRepository.kt",
"chars": 718,
"preview": "package com.valhalla.thor.domain.repository\n\nimport com.valhalla.thor.domain.model.AppInfo\nimport kotlinx.coroutines.flo"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/repository/InstallerRepository.kt",
"chars": 412,
"preview": "package com.valhalla.thor.domain.repository\n\nimport android.net.Uri\n\nenum class InstallMode {\n NORMAL,\n SHIZUKU,\n "
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/repository/PreferenceRepository.kt",
"chars": 1188,
"preview": "package com.valhalla.thor.domain.repository\n\nimport com.valhalla.thor.domain.model.FilterType\nimport com.valhalla.thor.d"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/repository/SystemRepository.kt",
"chars": 1145,
"preview": "package com.valhalla.thor.domain.repository\n\ninterface SystemRepository {\n\n suspend fun isRootAvailable(): Boolean\n "
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/usecase/GetAppDetailsUseCase.kt",
"chars": 623,
"preview": "package com.valhalla.thor.domain.usecase\n\nimport com.valhalla.thor.domain.model.AppInfo\nimport com.valhalla.thor.domain."
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/usecase/GetInstalledAppsUseCase.kt",
"chars": 683,
"preview": "package com.valhalla.thor.domain.usecase\n\nimport com.valhalla.thor.domain.model.AppInfo\nimport com.valhalla.thor.domain."
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/usecase/ManageAppUseCase.kt",
"chars": 1353,
"preview": "package com.valhalla.thor.domain.usecase\n\nclass ManageAppUseCase(\n private val systemRepository: com.valhalla.thor.do"
},
{
"path": "app/src/main/java/com/valhalla/thor/domain/usecase/ShareAppUseCase.kt",
"chars": 5162,
"preview": "package com.valhalla.thor.domain.usecase\n\nimport android.content.Context\nimport androidx.core.content.FileProvider\nimpor"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/appList/AppListScreen.kt",
"chars": 10968,
"preview": "package com.valhalla.thor.presentation.appList\n\nimport android.widget.Toast\nimport androidx.compose.foundation.Image\nimp"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/appList/AppListViewModel.kt",
"chars": 10450,
"preview": "package com.valhalla.thor.presentation.appList\n\nimport androidx.lifecycle.ViewModel\nimport androidx.lifecycle.viewModelS"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/common/ShizukuPermissionHandler.kt",
"chars": 2788,
"preview": "package com.valhalla.thor.presentation.common\n\nimport android.content.pm.PackageManager\nimport rikka.shizuku.Shizuku\n\n/*"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/common/components/ConnectedButtonGroup.kt",
"chars": 7266,
"preview": "package com.valhalla.thor.presentation.common.components\n\nimport androidx.compose.foundation.interaction.MutableInteract"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/freezer/FreezerScreen.kt",
"chars": 9682,
"preview": "package com.valhalla.thor.presentation.freezer\n\nimport android.widget.Toast\nimport androidx.compose.foundation.Image\nimp"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/freezer/FreezerViewModel.kt",
"chars": 9229,
"preview": "package com.valhalla.thor.presentation.freezer\n\nimport androidx.lifecycle.ViewModel\nimport androidx.lifecycle.viewModelS"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/home/AppDestinations.kt",
"chars": 667,
"preview": "package com.valhalla.thor.presentation.home\n\nimport com.valhalla.thor.R\nimport kotlinx.serialization.Serializable\n\n@Seri"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/home/HomeScreen.kt",
"chars": 13180,
"preview": "package com.valhalla.thor.presentation.home\n\nimport androidx.activity.compose.rememberLauncherForActivityResult\nimport a"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/home/HomeViewModel.kt",
"chars": 7122,
"preview": "package com.valhalla.thor.presentation.home\n\nimport androidx.lifecycle.ViewModel\nimport androidx.lifecycle.viewModelScop"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/home/components/AnimatedCounter.kt",
"chars": 1060,
"preview": "package com.valhalla.thor.presentation.home.components\n\nimport androidx.compose.animation.core.FastOutSlowInEasing\nimpor"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/home/components/AppDistributionChart.kt",
"chars": 6777,
"preview": "package com.valhalla.thor.presentation.home.components\n\nimport androidx.compose.animation.core.Spring\nimport androidx.co"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/home/components/DashboardHeader.kt",
"chars": 5579,
"preview": "package com.valhalla.thor.presentation.home.components\n\nimport androidx.compose.foundation.background\nimport androidx.co"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/home/components/SocialLinksRow.kt",
"chars": 1980,
"preview": "package com.valhalla.thor.presentation.home.components\n\nimport androidx.compose.foundation.layout.Arrangement\nimport and"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/home/components/SummaryStatRow.kt",
"chars": 3347,
"preview": "package com.valhalla.thor.presentation.home.components\n\nimport androidx.compose.foundation.background\nimport androidx.co"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/installer/InstallerViewModel.kt",
"chars": 5179,
"preview": "package com.valhalla.thor.presentation.installer\n\nimport android.content.pm.PackageManager\nimport android.net.Uri\nimport"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/installer/PortableInstaller.kt",
"chars": 22367,
"preview": "package com.valhalla.thor.presentation.installer\n\nimport android.content.BroadcastReceiver\nimport android.content.Contex"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/installer/PortableInstallerActivity.kt",
"chars": 662,
"preview": "package com.valhalla.thor.presentation.installer\n\nimport android.os.Bundle\nimport androidx.activity.ComponentActivity\nim"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/main/MainScreen.kt",
"chars": 9376,
"preview": "package com.valhalla.thor.presentation.main\n\nimport android.content.Intent\nimport android.provider.Settings\nimport andro"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/main/MainViewModel.kt",
"chars": 17224,
"preview": "package com.valhalla.thor.presentation.main\n\nimport android.content.pm.ApplicationInfo\nimport android.content.pm.Package"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/main/ThorNavigationBar.kt",
"chars": 6488,
"preview": "package com.valhalla.thor.presentation.main\n\nimport androidx.compose.animation.AnimatedVisibility\nimport androidx.compos"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/security/AuthState.kt",
"chars": 691,
"preview": "package com.valhalla.thor.presentation.security\n\n/**\n * Represents the authentication state gate for the app.\n * The UI "
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/security/BiometricPromptHandler.kt",
"chars": 2657,
"preview": "package com.valhalla.thor.presentation.security\n\nimport android.content.Context\nimport android.hardware.biometrics.Biome"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/security/BiometricScreen.kt",
"chars": 9961,
"preview": "package com.valhalla.thor.presentation.security\n\nimport androidx.compose.animation.core.RepeatMode\nimport androidx.compo"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/security/SecurityViewModel.kt",
"chars": 2435,
"preview": "package com.valhalla.thor.presentation.security\n\nimport androidx.lifecycle.ViewModel\nimport androidx.lifecycle.viewModel"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/settings/SettingsScreen.kt",
"chars": 23915,
"preview": "package com.valhalla.thor.presentation.settings\n\nimport android.content.Intent\nimport android.os.Build\nimport androidx.c"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/settings/SettingsViewModel.kt",
"chars": 3954,
"preview": "package com.valhalla.thor.presentation.settings\n\nimport androidx.lifecycle.ViewModel\nimport androidx.lifecycle.viewModel"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/theme/Color.kt",
"chars": 3337,
"preview": "package com.valhalla.thor.presentation.theme\n\nimport androidx.compose.ui.graphics.Color\n\nval greenLight = Color(0xff4c66"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/theme/Motion.kt",
"chars": 1707,
"preview": "package com.valhalla.thor.presentation.theme\n\nimport androidx.compose.animation.animateContentSize\nimport androidx.compo"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/theme/Theme.kt",
"chars": 5058,
"preview": "package com.valhalla.thor.presentation.theme\n\nimport android.os.Build\nimport androidx.activity.compose.LocalActivity\nimp"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/theme/Type.kt",
"chars": 4258,
"preview": "package com.valhalla.thor.presentation.theme\n\nimport androidx.compose.material3.Typography\nimport androidx.compose.ui.te"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/utils/AppIconLoader.kt",
"chars": 1980,
"preview": "package com.valhalla.thor.presentation.utils\n\nimport android.content.Context\nimport android.content.pm.PackageManager\nim"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/utils/CacheScanner.kt",
"chars": 3073,
"preview": "package com.valhalla.thor.presentation.utils\n\nimport com.valhalla.thor.domain.repository.SystemRepository\nimport kotlinx"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/utils/UiUtils.kt",
"chars": 475,
"preview": "package com.valhalla.thor.presentation.utils\n\nimport android.content.Context\nimport android.graphics.drawable.Drawable\ni"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/widgets/AffirmationDialog.kt",
"chars": 5867,
"preview": "package com.valhalla.thor.presentation.widgets\n\nimport androidx.compose.foundation.background\nimport androidx.compose.fo"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/widgets/AnimateLottieRaw.kt",
"chars": 1160,
"preview": "package com.valhalla.thor.presentation.widgets\n\nimport androidx.annotation.RawRes\nimport androidx.compose.runtime.Compos"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/widgets/AppInfoDialog.kt",
"chars": 15958,
"preview": "package com.valhalla.thor.presentation.widgets\n\nimport androidx.compose.foundation.Image\nimport androidx.compose.foundat"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/widgets/AppList.kt",
"chars": 36771,
"preview": "package com.valhalla.thor.presentation.widgets\n\nimport androidx.activity.compose.BackHandler\nimport androidx.compose.ani"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/widgets/MultiSelectToolBox.kt",
"chars": 6310,
"preview": "package com.valhalla.thor.presentation.widgets\n\nimport androidx.compose.foundation.background\nimport androidx.compose.fo"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/widgets/TermLogger.kt",
"chars": 6052,
"preview": "package com.valhalla.thor.presentation.widgets\n\nimport androidx.compose.foundation.background\nimport androidx.compose.fo"
},
{
"path": "app/src/main/java/com/valhalla/thor/presentation/widgets/TypeWriterText.kt",
"chars": 2979,
"preview": "package com.valhalla.thor.presentation.widgets\n\nimport androidx.compose.material3.MaterialTheme\nimport androidx.compose."
},
{
"path": "app/src/main/java/com/valhalla/thor/util/LocaleManager.kt",
"chars": 1856,
"preview": "package com.valhalla.thor.util\n\nimport android.app.LocaleManager as AndroidLocaleManager\nimport android.content.Context\n"
},
{
"path": "app/src/main/java/com/valhalla/thor/util/Logger.kt",
"chars": 1029,
"preview": "@file:Suppress(\"unused\")\n\npackage com.valhalla.thor.util\n\nimport android.util.Log\nimport com.valhalla.thor.BuildConfig\ni"
},
{
"path": "app/src/main/res/drawable/android.xml",
"chars": 891,
"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/apk_install.xml",
"chars": 1513,
"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/apps.xml",
"chars": 1705,
"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/arrow_downward.xml",
"chars": 661,
"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/arrow_drop_down.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/arrow_upward.xml",
"chars": 661,
"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/bolt.xml",
"chars": 584,
"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/brand_github.xml",
"chars": 1393,
"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/brand_patreon.xml",
"chars": 635,
"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/brand_telegram.xml",
"chars": 456,
"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/cat.xml",
"chars": 661,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"800dp\"\n android:height=\"800dp\"\n"
},
{
"path": "app/src/main/res/drawable/check_circle.xml",
"chars": 787,
"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/clear_all.xml",
"chars": 791,
"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/danger.xml",
"chars": 1485,
"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/delete.xml",
"chars": 1253,
"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/delete_forever.xml",
"chars": 1017,
"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/dhizuku.xml",
"chars": 3492,
"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/exit_to_app.xml",
"chars": 1202,
"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/filter_list.xml",
"chars": 835,
"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/force_close.xml",
"chars": 1206,
"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/freeze_off.xml",
"chars": 1383,
"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/frozen.xml",
"chars": 685,
"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/grid_view.xml",
"chars": 1068,
"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/home.xml",
"chars": 708,
"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/home_outline.xml",
"chars": 1118,
"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_launcher_background.xml",
"chars": 5606,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:wi"
},
{
"path": "app/src/main/res/drawable/ic_launcher_foreground.xml",
"chars": 1702,
"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/ios_share.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/key.xml",
"chars": 899,
"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/key_outline.xml",
"chars": 1334,
"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/list.xml",
"chars": 1326,
"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/magisk_icon.xml",
"chars": 3061,
"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/open_in.xml",
"chars": 1038,
"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/open_in_new.xml",
"chars": 1065,
"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/privacy_tip.xml",
"chars": 918,
"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/round_close.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/round_key.xml",
"chars": 689,
"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/round_search.xml",
"chars": 661,
"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/settings.xml",
"chars": 1274,
"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/settings_backup_restore.xml",
"chars": 1156,
"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/settings_outline.xml",
"chars": 2726,
"preview": "<!--\n ~ Copyright (C) 2026 The Android Open Source Project\n ~\n ~ Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "app/src/main/res/drawable/share.xml",
"chars": 862,
"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/shield.xml",
"chars": 596,
"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/shield_bad.xml",
"chars": 925,
"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/shield_countdown.xml",
"chars": 1282,
"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/shield_encrypted.xml",
"chars": 841,
"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/shield_maybe.xml",
"chars": 918,
"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/shield_search.xml",
"chars": 971,
"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/shield_verified.xml",
"chars": 803,
"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/shield_with_heart.xml",
"chars": 839,
"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/shizuku.xml",
"chars": 1620,
"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/shizuku_outline_icon.xml",
"chars": 1622,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:width=\"800dp\"\n android:height=\"800dp\"\n"
},
{
"path": "app/src/main/res/drawable/snowflake.xml",
"chars": 2543,
"preview": "<!--\n ~ Copyright (C) 2026 The Android Open Source Project\n ~\n ~ Licensed under the Apache License, Version 2.0 (the "
}
]
// ... and 85 more files (download for full content)
About this extraction
This page contains the full source code of the trinadhthatakula/Thor GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 285 files (933.3 KB), approximately 252.4k tokens, and a symbol index with 10 extracted functions, classes, methods, constants, and types. 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.