Skip to content

Repository files navigation

Thor Extension API

Contract interfaces for building extensions for the Thor Android app manager.

This SDK is published from its own repository at https://github.com/trinadhthatakula/Thor-extension-api, separate from the Thor app itself.

Add the dependency

dependencies {
    // Thor loads extensions into its own process and provides these classes at runtime,
    // so depend on the API as compileOnly — do NOT bundle it into your extension APK.
    compileOnly("com.trinadhthatakula:thor-extension-api:3.0.0")
}

Declare your extension

An extension is a normal Android APK with no launcher activity. Its package name must start with com.valhalla.thor.ext. and its manifest points Thor at your implementation class:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application android:hasCode="true">
        <meta-data
            android:name="thor.extension.class"
            android:value="com.valhalla.thor.ext.sample.SampleDebloatExtension" />
        <meta-data
            android:name="thor.extension.api.version"
            android:value="2" />
    </application>
</manifest>

Minimal example

package com.valhalla.thor.ext.sample

import com.valhalla.thor.extension.api.DebloatExtension
import com.valhalla.thor.extension.api.ExtensionDebloatItem

class SampleDebloatExtension : DebloatExtension {
    override val name = "Sample Debloat List"
    override val description = "Example manufacturer debloat list"
    override val version = "1.0.0"
    override val author = "you"
    override val targetManufacturer = "Generic"

    override fun getDebloatItems(): List<ExtensionDebloatItem> = listOf(
        ExtensionDebloatItem(
            packageName = "com.example.bloat",
            recommendation = "recommended",
            description = "Removable sample bloatware"
        )
    )
}

Configuration UI (optional)

If your extension needs a settings screen, render it yourself in your own process — declare an exported Activity with an intent-filter for ThorExtensionContract.ACTION_CONFIGURE ("com.valhalla.thor.extension.action.CONFIGURE"), and Thor launches it when the user taps Configure in the Extension Manager:

<activity android:name=".ConfigActivity" android:exported="true"
    android:theme="@android:style/Theme.Translucent.NoTitleBar">
    <intent-filter>
        <action android:name="com.valhalla.thor.extension.action.CONFIGURE" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

Thor attaches its current theme as optional intent extras (ThorExtensionContract.EXTRA_THEME_MODE / EXTRA_DYNAMIC_COLOR / EXTRA_AMOLED) so your UI can match. Because your Activity runs in your own process, bundle your own Compose/UI — nothing crosses into Thor's (minified) process.

Breaking change in 3.0.0: the old in-host render members — @Composable AutomationExtension.ConfigurationScreen(...), onBackPressed(), and the @Composable AppIcon() helper — were removed. Extensions on 3.0.0 must use the launch-based config Activity above and supply their own icon loading. The runtime ABI integer thor.extension.api.version is now 2.

Current limitation: signature trust

On release builds, Thor currently loads only extensions signed with Thor's own signing key. Third-party extensions signed with your own key load on debug / self-built Thor today; loading third-party-signed extensions on the official release build is a planned future change.

About

Thor Extensions API

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages