Skip to content

TripleU613/TripleRotate

Repository files navigation

TripleRotate - System Privileged Rotation Control

A lightweight system-privileged Android app that provides advanced screen rotation control through a Quick Settings tile.

Features

  • Quick Settings Tile: Access rotation controls directly from the notification shade
  • 4 Rotation Options via overlay dialog:
    • 0° (Portrait)
    • 90° (Landscape)
    • 180° (Reverse Portrait)
    • 270° (Reverse Landscape)
    • Auto-Rotate toggle
  • System Privileged App: Runs with system permissions, no root required after installation
  • No UI: Service-only app with no launcher icon
  • Overlay Dialog: Clean overlay dialog when tile is tapped showing all rotation options
  • Minified & Optimized: ProGuard enabled with multidex support

Requirements

  • Android 11+ (API 30+)
  • Root access (for installation only)
  • ADB (Android Debug Bridge)

Build Instructions

1. Build the Release APK

# Windows
gradlew.bat assembleRelease

# Linux/Mac
./gradlew assembleRelease

The APK will be generated at: app/release/app-release.apk

2. Install as System Privileged App

Windows:

install_triplerotate_system.bat

Linux/Mac:

chmod +x install_triplerotate_system.sh
./install_triplerotate_system.sh

Manual Installation

If the automated scripts don't work, you can install manually:

  1. Push files to device:
adb push app/release/app-release.apk /sdcard/TripleRotate.apk
adb push system-integration/permissions/com.tripleu.triplerotate.xml /sdcard/
adb push system-integration/sysconfig/triplerotate-sysconfig.xml /sdcard/
  1. Install with root:
adb shell
su
mount -o remount,rw /

# Create directory and copy APK
mkdir -p /system/priv-app/TripleRotate
cp /sdcard/TripleRotate.apk /system/priv-app/TripleRotate/
chmod 644 /system/priv-app/TripleRotate/TripleRotate.apk
chown root:root /system/priv-app/TripleRotate/TripleRotate.apk

# Copy permission files
cp /sdcard/com.tripleu.triplerotate.xml /system/etc/permissions/
chmod 644 /system/etc/permissions/com.tripleu.triplerotate.xml

cp /sdcard/triplerotate-sysconfig.xml /system/etc/sysconfig/
chmod 644 /system/etc/sysconfig/triplerotate-sysconfig.xml

# Set SELinux contexts
chcon u:object_r:system_file:s0 /system/priv-app/TripleRotate/TripleRotate.apk
chcon u:object_r:system_file:s0 /system/etc/permissions/com.tripleu.triplerotate.xml
chcon u:object_r:system_file:s0 /system/etc/sysconfig/triplerotate-sysconfig.xml

mount -o remount,ro /
reboot

Usage

After installation and reboot:

  1. Pull down the notification shade
  2. Tap the edit button (pencil icon) to customize Quick Settings
  3. Find "Screen Rotation" tile and drag it to your active tiles
  4. Tap the tile to open rotation options dialog
  5. Select desired rotation: 0°, 90°, 180°, 270°, or Auto-Rotate

The tile shows the current state:

  • Auto: Auto-rotation is enabled
  • 0°/90°/180°/270°: Fixed rotation angle

Uninstall

To remove the app:

# Windows
uninstall_triplerotate_system.bat

# Linux/Mac
./uninstall_triplerotate_system.sh

System Integration

The app installs to /system/priv-app/ with:

  • APK Location: /system/priv-app/TripleRotate/TripleRotate.apk
  • Permissions: /system/etc/permissions/com.tripleu.triplerotate.xml
  • Sysconfig: /system/etc/sysconfig/triplerotate-sysconfig.xml

Granted System Permissions

  • WRITE_SECURE_SETTINGS - Modify secure system settings
  • WRITE_SETTINGS - Modify system settings
  • SYSTEM_ALERT_WINDOW - Display overlay windows
  • INTERNAL_SYSTEM_WINDOW - Internal system window access
  • STATUS_BAR_SERVICE - Status bar service access
  • EXPAND_STATUS_BAR - Expand/collapse status bar

Technical Details

  • Package: com.tripleu.triplerotate
  • Min SDK: 30 (Android 11)
  • Target SDK: 35 (Android 15)
  • Build Features:
    • Multidex enabled
    • ProGuard minification
    • Resource shrinking
    • No Compose UI (service only)
    • No launcher activity

Troubleshooting

  1. Tile not appearing: Make sure to reboot after installation
  2. Permission denied: Ensure you have root access and mount system as read-write
  3. Build errors: Clean and rebuild: ./gradlew clean assembleRelease
  4. SELinux issues: Check SELinux is set to permissive or contexts are correct
  5. Overlay not showing: Grant SYSTEM_ALERT_WINDOW permission if needed

Development

The app consists of:

  • RotationTileService.kt - Main tile service handling rotation control
  • System integration configs in system-integration/ folder
  • Minimal resources (only icons, no layouts or activities)

License

System privileged app for internal use.