Convert Figma logo to code with AI

phhusson logotreble_experimentations

Notes about tinkering with Android Project Treble

3,356
658
3,356
1,388

Top Related Projects

47,030

The Magic Mask for Android

8,140

Free implementation of Play Services

10,090

Using system APIs directly with adb/root privileges from normal apps through a Java process started with app_process.

Quick Overview

The "treble_experimentations" repository by phhusson is a collection of scripts, tools, and documentation for Project Treble experimentation on Android devices. It aims to facilitate the creation and testing of Generic System Images (GSIs) for various Android devices, enabling easier ROM development and device support across different manufacturers.

Pros

  • Enhances Android device compatibility and portability
  • Simplifies the process of creating and testing GSIs
  • Provides a comprehensive set of tools for Android developers and enthusiasts
  • Supports a wide range of devices from various manufacturers

Cons

  • Requires advanced technical knowledge of Android systems
  • May not work perfectly on all devices due to hardware differences
  • Potential for device instability or data loss if not used correctly
  • Limited documentation for some aspects of the project

Getting Started

To get started with the treble_experimentations project:

  1. Clone the repository:

    git clone https://github.com/phhusson/treble_experimentations.git
    
  2. Navigate to the project directory:

    cd treble_experimentations
    
  3. Explore the various scripts and tools available in the repository.

  4. Follow the instructions in the README and wiki for specific tasks, such as building GSIs or flashing custom ROMs.

Note: This project is not a traditional code library, so there are no specific code examples or quick start guide. Instead, it provides a collection of scripts and tools that users can leverage for Android development and experimentation.

Competitor Comparisons

47,030

The Magic Mask for Android

Pros of Magisk

  • More comprehensive root solution with modules ecosystem
  • Active development and frequent updates
  • Larger user base and community support

Cons of Magisk

  • Primarily focused on rooting and system modifications
  • May not be suitable for all devices or custom ROM scenarios
  • Potentially higher risk of security vulnerabilities due to root access

Code Comparison

Magisk (init.cpp):

static int magisk_proxy_main(int argc, char *argv[]) {
    setup_klog();
    LOGI(NAME_WITH_VER(Magisk) " init proxy started\n");
    rust::init_proxy_main();
    return 1;
}

Treble_experimentations (build-dakkar.sh):

if [ "$CLEAN" == "true" ]; then
    make clean
fi

. build/envsetup.sh
lunch "$LUNCH_CHOICE"
make $MAKEJ otapackage

While both projects aim to enhance Android functionality, Magisk focuses on providing root access and system-level modifications, whereas Treble_experimentations is geared towards custom ROM development and Project Treble compatibility. Magisk offers a more user-friendly approach for system modifications, while Treble_experimentations provides tools for ROM developers to create GSI (Generic System Image) builds.

8,140

Free implementation of Play Services

Pros of GmsCore

  • Provides a privacy-focused alternative to Google Play Services
  • Lightweight implementation of core Google services
  • Allows using Google-dependent apps without full Google ecosystem

Cons of GmsCore

  • May not support all Google Play Services features
  • Requires more setup and configuration than stock Android
  • Potential compatibility issues with some apps

Code Comparison

GmsCore:

public class GmsCore extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        // Initialize microG services
    }
}

Treble_experimentations:

#!/system/bin/sh
# Apply Treble-specific patches
mount -o rw,remount /system
# Apply system modifications

The code snippets highlight the different focus areas:

  • GmsCore centers on providing a Google services alternative
  • Treble_experimentations focuses on system-level modifications for Project Treble compatibility

GmsCore is a specialized project for replacing Google services, while Treble_experimentations is broader in scope, aiming to improve Android device compatibility and customization across various devices and ROMs.

10,090

Using system APIs directly with adb/root privileges from normal apps through a Java process started with app_process.

Pros of Shizuku

  • Focuses on providing a secure way to access system APIs on Android
  • Offers a more user-friendly approach for non-root users
  • Actively maintained with regular updates and improvements

Cons of Shizuku

  • Limited scope compared to Treble_experimentations' broader focus on custom ROMs
  • May require more setup for users unfamiliar with ADB commands
  • Less flexibility for system-wide modifications

Code Comparison

Shizuku (Java):

@RequiresPermission(INTERACT_ACROSS_USERS)
public static UserHandle getUserHandle(int userId) {
    return UserHandle.of(userId);
}

Treble_experimentations (Shell script):

if [ -f /vendor/build.prop ]; then
    VENDOR_FINGERPRINT="$(grep -F "ro.vendor.build.fingerprint" /vendor/build.prop | sed "s/.*=//")"
fi

While both projects deal with Android customization, Shizuku focuses on API access, using Java for its implementation. Treble_experimentations, on the other hand, utilizes shell scripts for system-level modifications and custom ROM development. The code snippets highlight these differences in approach and scope.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Community

How to build

  • clone this repository
  • call the build scripts from a separate directory

For example:

git clone https://github.com/phhusson/treble_experimentations
mkdir Lineage; cd Lineage
bash ../treble_experimentations/build-rom.sh android-8.1 lineage

More flexible build script

(this has been tested much less)

bash ../treble_experimentations/build-dakkar.sh rr
arm-aonly-gapps-su
arm64-ab-go-nosu

The script should provide a help message if you pass something it doesn't understand

Using Docker

clone this repository, then:

docker build -t treble docker/

docker container create --name treble treble

docker run -ti \
    -v $(pwd):/treble \
    -v $(pwd)/../treble_output:/treble_output \
    -w /treble_output \
    treble \
    /bin/bash /treble/build-dakkar.sh rr \
    arm-aonly-gapps-su \
    arm64-ab-go-nosu

Conventions for commit messages:

  • [UGLY] Please make this patch disappear as soon as possible
  • [master] tag means that the commit should be dropped in a future rebase
  • [device] tag means this change is device-specific workaround
  • ::device name:: will try to describe which devices are concerned by this change
  • [userfriendly] This commit is NOT used for hardware support, but to make the rom more user friendly