Skip to content

About

An Android background virtual-display keep-alive tool powered by Root + LSPosed.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

VirtualStage

English | 简体中文
Architecture · Building · Changelog

Download installation packages from GitHub Releases (update checks are backed by xposed_update.json).

Release License: GPL v3 Android LibXposed API

VirtualStage (io.github.linoleic.virtualstage) is an Android background virtual-display keep-alive tool powered by Root + LSPosed (Modern Xposed API / LibXposed). Without hooking target apps, the module injects into System Framework (system) to move running tasks onto isolated virtual displays while allowing the main screen to lock normally, turn off only the physical display panel, stream 60fps live previews, and inject multi-touch and Back events.

Prerequisites: Requires Root (KernelSU / Magisk / APatch) and LSPosed (LibXposed API 101–102), scoped only to System Framework (system). No Shizuku fallback is provided.


Features

  • True Lock-Screen Keep-Alive (Primary Mode): Keeps isolated virtual displays awake and rendering while Display 0 sleeps behind Keyguard, with automatic Doze and background network exemptions. Supports auto-staging whitelisted foreground apps on power button press and autoStageOnLeave.
  • Relaunch Guard & Native Resolution Preservation: Suppresses destructive Activity recreation during VirtualDisplay staging and return so games do not crash or restart. Virtual displays default to matching the main screen's native resolution and DPI (preventing mid-battle resolution loss), with 3 presets and custom width/height/DPI (including a 50% main-screen shortcut).
  • 60fps Live Preview & Remote Touch: Displays live thumbnails on console cards and opens an interactive 60fps hardware H.264 preview dialog (with automatic JPEG fallback). High-resolution virtual displays use zero-copy GPU downscaling to avoid cropping, with dynamic orientation sync, multi-touch passthrough, and a virtual Back key.
  • Seamless Task Return & Quick Tiles: Opening a staged app from Recents or the launcher automatically reparents it back to Display 0 and reaps idle virtual displays. Includes Quick Stage and Screen Blackout Quick Settings tiles plus boot recovery.
  • Physical Display Blackout (Compatibility Mode): Cuts physical panel power without entering deep sleep, backed by safety timeout, low-battery restore, and a 5-second test action.
  • HyperOS Anti-Freeze & Diagnostic Export: Exempts staged/whitelisted apps from HyperOS/MIUI background freeze and process killers (automatically skipped on AOSP), and provides one-tap diagnostic report copy/export/share.

Requirements & Compatibility

Requirement Details
Root KernelSU / Magisk / APatch (launches background daemon and provides global config fallback)
Xposed Framework LSPosed or another framework implementing LibXposed API 101+
Module Scope System Framework (system / system_server) only — no target app hooks
Android Version Android 11 (minSdk 30) or later
Rootless / Shizuku ❌ Not supported
Verified Environments Status
Android 17 / Pixel (AOSP) Verified lock-screen keep-alive, AppCompatRecreateOnConfigChangePolicy relaunch guard, 60fps H.264 preview, touch/Back injection, and Recents task return
Android 16 / HyperOS 3 (Tablet) Verified HyperOS anti-freeze, ActivityRecord relaunch guard, native-sized VirtualDisplay, GPU-scaled H.264 preview & touch, and Recents task return
Android 11–15 / Other OEM ROMs ⚠️ Not broadly verified (proprietary freezer, power-group, or windowing policies may differ)
Android 7–10 ❌ Not supported (minSdk 30)

Installation & Getting Started

  1. Install the APK: Download VirtualStage-<VersionCode>-<VersionName>.apk from Releases.
  2. Enable in LSPosed: Open LSPosed Manager → Modules → VirtualStage, enable the module, and check System Framework (system) (pre-declared in embedded scope.list).
  3. Reboot: Reboot your device so system_server loads the module.
  4. Verify Status: Open VirtualStage, grant Root permission, and confirm the Console card reports Ready. Any missing requirement appears as a specific status pill and in the top-right diagnostics sheet.
Switching from Debug to Release builds
  1. Uninstall the old debug-signed APK (your whitelist and rules in Settings.Global are preserved).
  2. Install the release-signed APK.
  3. Re-enable VirtualStage in LSPosed Manager with System Framework checked, reboot once, and grant Root access when opening the app.
Uninstalling / Cleaning Up
  1. Return all staged apps to the main screen inside VirtualStage so no VirtualDisplay remains active.
  2. Disable VirtualStage in LSPosed Manager.
  3. Uninstall the APK and reboot.

Usage

VirtualStage provides three main tabs (Console, Whitelist, and Settings), adapting between a bottom navigation bar on phones and a navigation rail with dual-column layouts on tablets:

1. Console

  • Status & Service Controls: Keeps the status card minimal when healthy, surfacing specific pills only when Root, System Hook, Background Service, Lock Guards, or Battery thresholds require attention.
  • Staged in Background: Lists active VirtualDisplay tasks with live thumbnails. Tap a card or Preview to interact via touch, rotate, pause/resume, press Back, or Return to the main screen.
  • Active Apps on Main Screen: Lists eligible foreground tasks on Display 0 for one-tap manual staging.
  • Diagnostics & Advanced Controls: Pre-create or clear idle displays, run a 5s screen-off test, and view/export diagnostic reports.

2. Whitelist

  • Search installed apps by label or package name, filter by All / Selected / System & Hidden, and clear selections in bulk.
  • Whitelisted apps participate in power-key auto-stage & lock, autoStageOnLeave, and HyperOS anti-freeze exemptions.

3. Settings

  • Lock Screen & Background Keep-Alive: Configure locked rendering, power-key auto-stage & lock, and autoStageOnLeave.
  • Screen-Off Only (Compatibility Mode): Active when power-key auto-stage & lock is disabled, with blackout timeout and low-battery restore guards.
  • Virtual Display Size & Density: Defaults to Match Main Screen, with 3 presets and custom width/height/DPI (plus a 50% main-screen shortcut).
  • Appearance & About: System/Light/Dark theme, Material You dynamic color, English/简体中文 language switcher, rule reset, and version/license info.

FAQ & Troubleshooting

Status shows "System Hook Not Loaded" or "System module mismatch"
  • System Hook Not Loaded: Confirm VirtualStage is enabled in LSPosed Manager with System Framework (system) checked, then reboot.
  • System module mismatch: After updating the APK, system_server cannot hot-reload framework hooks; reboot once to sync. Changes restricted to the UI or daemon auto-restart the idle StageDaemon without a reboot.
A game crashes on stage/return or looks blurry after returning to Display 0
  • Crash / Relaunch: TaskRelaunchGuardHooks suppresses destructive Activity recreation on Android 16 and Android 17. If a specific app still misbehaves, export a diagnostic report from the Console status button.
  • Blurry after return: Some Unity games do not rebuild offscreen render buffers mid-battle after shrinking to a smaller display. Keep Settings → Virtual Display Size & Density on Match Main Screen (default) to preserve native rendering resolution.
Preview shows black frames on certain screens
  • Windows flagged with FLAG_SECURE (payment, password, or DRM-protected surfaces) are blocked from capture and encoding by SurfaceFlinger. Regular apps and games are unaffected.
No zoom transition animation when returning from Recents
  • Reparenting a staged task from a secondary VirtualDisplay back to Display 0 when launched from Recents or the launcher currently skips the system's default task-zoom transition animation.

License & Documentation

About

An Android background virtual-display keep-alive tool powered by Root + LSPosed.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages