Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

refactor(addons): leave schedule and pickers in PR; link Shizuku fork from showcase

TeenKoded70425c76dfb
diff --git a/SHOWCASE.md b/SHOWCASE.md
index 9965d7af4..0c9c7aa3d 100644
--- a/SHOWCASE.md
+++ b/SHOWCASE.md
@@ -191,6 +191,7 @@ Small apps and scripts that run next to the launcher (or any launcher) and do on
| Project | What it is | Built on | By |
|---|---|---|---|
+| [TV schedule + Shizuku standby](https://github.com/TeenKode/cleanyourtv/tree/feature/tv-schedule-shizuku-full) | Extended Sleep Timer with D-pad weekly wake/sleep schedules, exclusion dates and optional Shizuku ADB-shell power control; companion Open on wake observes an optional CVTE standby flag to reopen a chosen app when Android emits no SCREEN_ON. Build from source; the add-ons require no network access. Shizuku must be started again after a full TV reboot; validate power behavior on your firmware | DEXP 43UCY1 (CVTE / YaOS, Android 11) | [TeenKode](https://github.com/TeenKode) |
| [DVD Video screensaver for Android TV](https://github.com/TheWombRaider/dvd-tv) ([screenshot](https://github.com/TheWombRaider/dvd-tv/blob/main/docs/preview.jpg)) | The bouncing DVD VIDEO logo as an offline native screensaver and launcher preview, measured against reference video; no internet, audio or analytics | TCL Smart TV Pro (G08), Google TV 14; preview tested | [TheWombRaider](https://github.com/TheWombRaider) |
| [AirPlay receiver installer](https://github.com/nguyenduchoai/tv-vibehack/tree/feat/airplay-receiver) | A script that builds and installs an open-source AirPlay receiver next to the launcher, for iPhone mirroring | Xiaomi MiTV-AESP0, Android TV 9 | [nguyenduchoai](https://github.com/nguyenduchoai) |
| [Cast Fix](https://github.com/thayford/castfix) | Keeps casting from phones working on a Chromecast with Google TV after setupwraith is disabled for the launcher ([#361](https://github.com/Gathin23/cleanyourtv/issues/361)): at every boot it pairs with the TV's own Wireless debugging, lets the Cast receiver load its credentials from the setup wizard, then switches the wizard off again. No internet access | Chromecast with Google TV HD, Google TV 14 | [thayford](https://github.com/thayford) |
@@ -281,6 +282,7 @@ By the TV each project was built and tested on. Most of them run on other Androi
- **Bettdow:** [Glass home with this week's trending series](https://github.com/viniciustheodoro/newdesignforyourTV)
- **Changhong:** [Glance line and crimson glass on a Changhong](https://github.com/bayhaqy/cleanyourtv/blob/main/my-tv/README.md)
- **Chromecast with Google TV:** [Cast Fix](https://github.com/thayford/castfix), [Chromecast glass fork](https://github.com/NewPlayer0213/cleanyourtv/blob/showcase/FORK.md), [Chromecast Home: Up next and Now playing controls](https://github.com/DKRC/cleanyourtv/blob/chromecast-home/FORK.md), [Weather Clock](https://github.com/matyivagyok/weatherclock-tv)
+- **DEXP:** [TV schedule + Shizuku standby](https://github.com/TeenKode/cleanyourtv/tree/feature/tv-schedule-shizuku-full)
- **Durabrand:** [CleanYourTV Editorial](https://github.com/kevscec/cleanyourtv/blob/durabrand-editorial/FORK.md)
- **Formovie:** [CleanTV by VGS](https://github.com/vgscity/vgs-cleantv), [Homelab companion](https://github.com/epochcoder/cleanyourtv/tree/main/companion)
- **FPT Play:** [TV Remote](https://github.com/HoangTran0410/tv-remote)
diff --git a/addons/README.md b/addons/README.md
index 2c052829e..068aa9a1f 100644
--- a/addons/README.md
+++ b/addons/README.md
@@ -22,7 +22,7 @@ the core bigger or change how it behaves. You install an add-on only if you want
| [TV Static](tv-static/) | An off-the-air moment each time the screen turns on: the picture opens from a bright line, snow and hiss, colour bars or an old "no signal" screen for 3 to 10 s, then fades into what was on screen; the card sets style, sound and length | [@luyzfernando08](https://github.com/luyzfernando08) | Xiaomi Mi Box S (Android TV 9), Philco by Skyworth (Android TV 14) | foreground service (screen-on watcher), start at boot, display over other apps | <img src="tv-static/screenshot.jpg" width="240" alt="TV Static on a TV"> |
| [Open on wake](wake-app/) | Opens the app you choose each time the screen turns on, optionally at a link (a video, a channel); the card shows the app as a picture and sets the wait | [@luyzfernando08](https://github.com/luyzfernando08) | Xiaomi Mi Box S (Android TV 9), Philco by Skyworth (Android TV 14) | foreground service (screen-on watcher), start at boot, display over other apps | <img src="wake-app/screenshot.jpg" width="240" alt="Open on wake on a TV"> |
| [Brightness](brightness/) | Dims the picture below the TV's own minimum over every app (and the picture settings on Realtek TVs), with a warm night mode on a schedule and a one-press normal screen | [@maxhayim](https://github.com/maxhayim) | MOKA R8G (Android 14) | overlay, foreground service, start at boot | <img src="brightness/screenshot.jpg" width="240" alt="Brightness on a TV"> |
-| [Sleep Timer](sleep-timer/) | A sleep timer: 15 to 120 minutes, a one-minute countdown over what is playing with "15 more minutes", then standby; over HDMI-CEC the TV turns off with the box | [@luyzfernando08](https://github.com/luyzfernando08) | Xiaomi Mi Box S (Android TV 9) | accessibility (lock-screen action only) or optional Shizuku access, display over other apps, exact alarms, wake lock, start at boot | <img src="sleep-timer/screenshot.jpg" width="240" alt="Sleep Timer on a TV"> |
+| [Sleep Timer](sleep-timer/) | A sleep timer: 15 to 120 minutes, a one-minute countdown over what is playing with "15 more minutes", then standby; over HDMI-CEC the TV turns off with the box | [@luyzfernando08](https://github.com/luyzfernando08) | Xiaomi Mi Box S (Android TV 9) | accessibility (lock-screen action only), display over other apps, exact alarms, wake lock, start at boot | <img src="sleep-timer/screenshot.jpg" width="240" alt="Sleep Timer on a TV"> |
| [Scoreboard](scoreboard/) | Streaming app usage leaderboard tracking launches and watch time with D-pad click-to-launch | [@EricWoodford](https://github.com/EricWoodford) | TiVo Stream 4K (Android TV 12) | `PACKAGE_USAGE_STATS` (granted via ADB) | <img src="scoreboard/screenshot.jpg" width="240" alt="Scoreboard on a TV"> |
| [Quiet Hours](quiet-hours/) | A volume cap for the night (or all day): the volume is brought back down to the cap whenever it goes above, a muted TV is left alone, headphones can stay uncapped | [@maxhayim](https://github.com/maxhayim) | MOKA R8G (Android 14) | foreground service, start at boot | <img src="quiet-hours/screenshot.jpg" width="240" alt="Quiet Hours on a TV"> |
| [Remote Access](remote-access/) | Whether the TV is open to remote control: network debugging (ADB) and its port, the TV's address, Tailscale, and a button that switches network debugging off | [@maxhayim](https://github.com/maxhayim) | MOKA R8G (Android 14) | network state; `WRITE_SECURE_SETTINGS` granted by ADB, only for the off button | <img src="remote-access/screenshot.jpg" width="240" alt="Remote Access on a TV"> |
diff --git a/addons/sleep-timer/README.md b/addons/sleep-timer/README.md
index 6d6e89261..48fd5a1d0 100644
--- a/addons/sleep-timer/README.md
+++ b/addons/sleep-timer/README.md
@@ -31,47 +31,14 @@ ranges suppress scheduled wake events only, leaving sleep events and manual remo
Sleep events enter standby immediately at the selected time, without the timer countdown.
Wake requires power and Android standby; it cannot start an unplugged or fully powered-off TV.
-**Scheduled wake is firmware-dependent:** it needs a working Shizuku power path or firmware that
-allows Android alarms to wake the screen. Some devices defer alarms entirely during standby;
-Shizuku alone cannot run a wake event whose alarm has not been delivered. Sleep may still work
-when scheduled wake does not, so test both actions on the actual TV in its intended standby mode.
+**Scheduled wake depends on firmware:** an Android wake lock can request screen wake only when
+the TV delivers the scheduled alarm. Deep standby may delay alarms or prevent screen wake, even
+with exact-alarm access. Test sleep and wake separately on the target device.
Schedules are restored after boot, app updates and clock/time-zone changes. A late event is ignored
when more than ten minutes late. Without exact-alarm access Android may delay an event.
## How it turns the TV off
-When Shizuku is connected, the timer uses a small Shizuku user service running as the ADB shell
-(UID 2000) for scheduled wake, sleep and the countdown. It accepts only a wake/sleep choice, not
-arbitrary commands, and refuses root mode. Each power RPC carries a nine-second deadline based on
-Android's elapsed-realtime clock. The Shizuku user service rejects expired calls (including calls
-queued behind another power request) and rechecks the deadline before each shell command. This
-prevents a delayed or expired request from starting a new power command; a system command already
-started before the deadline cannot be canceled or rolled back. The user service protocol version
-is bumped to 2 so Shizuku replaces the old daemon after updating the APK.
-
-On CVTE firmware with native fake standby already enabled,
-it reads the current standby state before sending the power key, so repeated sleep or wake requests
-do not toggle the TV back. This preserves the firmware's network-connected screen-off mode. Other
-devices use Android's explicit wake/sleep keys; validate their effect on the actual device.
-
-### Optional Shizuku connection
-
-Some firmware continually removes third-party accessibility services. Install the official
-[Shizuku](https://shizuku.rikka.app/guide/setup/) manager and start it with ADB, following the command
-shown in that version of the manager. Open Sleep Timer, select the Shizuku row and allow access.
-The row then confirms the connection. Accessibility is unnecessary while that connection is ready;
-the existing accessibility method remains available otherwise. The SDK is pinned to 13.1.5.
-
-Shizuku access is optional and grants the app shell-level capability; only approve a build whose
-source you trust. This implementation exposes only fixed power operations. Turning off access in
-Shizuku restores the original accessibility/wake-lock paths. No root or `WRITE_SECURE_SETTINGS`
-grant to Sleep Timer is needed.
-
-ADB-started Shizuku must be started again after a full TV reboot. Its saved app authorization does
-not start the server. Ordinary screen-off in network-connected standby keeps it running. The timer
-shows when Shizuku needs starting; saved weekly events alone cannot restart it. This add-on does not
-enable debugging or native fake standby and does not modify the firmware's accessibility policy.
-
An ordinary app cannot put Android to sleep: there is no permission for it. A device admin's `lockNow()` is
ignored on boxes without the device-admin feature (a Xiaomi Mi Box S is one). What works is the accessibility
"lock screen" global action, which since Android 9 sends the device to sleep, so the app has an accessibility
@@ -109,16 +76,13 @@ it without waiting, the first lines of `build-and-install.sh` have an adb comman
app open its warning from the background when it holds this. The app draws no overlay window.
- **Wake lock** (`WAKE_LOCK`): briefly wakes the screen for a scheduled wake event; no continuously held lock.
- **Start at boot** (`RECEIVE_BOOT_COMPLETED`): restores the saved alarms after restart.
-- **Shizuku access** (`moe.shizuku.manager.permission.API_V23`): optional, approved in Shizuku for the
- fixed power commands above. Its provider is protected by `INTERACT_ACROSS_USERS_FULL`; the timer
- does not request that system permission itself.
- **Exact alarms** (`SCHEDULE_EXACT_ALARM`), granted with `appops` where it exists (Android 12+), so the
timer fires on the minute; without it the alarm may come a few minutes late.
- **Auto-start** (`AUTO_START` or `APP_AUTO_START`, TCL only), granted with `appops` and saved with
`appops write-settings`: TCL's TclAppBoot otherwise refuses to bind `SleepService` while the app is not
running, so the timer ends without putting the TV to standby. Other TVs do not have the op and ignore it.
-- No network or storage permission. Alarms drive the timer; Shizuku mode also keeps a small shell user
- service available between calls. The add-on does not run an app foreground service or poll settings.
+- No network or storage permission. Alarms drive the timer; the add-on does not run an app
+ foreground service or poll settings.
- **`AlarmReceiver`** is exported only to callers holding `WRITE_SECURE_SETTINGS`, which the adb shell has and
ordinary apps cannot get, for the test action above. **`TimerActivity`** (exported) is the tile and the card; `QuickActivity` and `BedtimeActivity` (exported) answer a remote button.
@@ -143,18 +107,6 @@ javac -d work/schedule-check addons/sleep-timer/app/src/main/java/io/github/luyz
java -cp work/schedule-check io.github.luyzfernando08.sleeptimer.ScheduleCheck
```
-## Power deadline regression checks
-
-The power-request deadline logic can be checked on a JVM without Android dependencies:
-
-```sh
-mkdir -p work/power-deadline-check
-javac -d work/power-deadline-check addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/PowerDeadline.java addons/sleep-timer/tests/PowerDeadlineCheck.java
-java -cp work/power-deadline-check io.github.luyzfernando08.sleeptimer.PowerDeadlineCheck
-```
-
-These checks validate expiration and boundary handling, not real Binder timing or physical TV behavior.
-
## Tested on
Xiaomi Mi Box S (MIBOX4, Android TV 9) with the reference launcher 2.6: the card, the picker, the warning at
@@ -163,43 +115,5 @@ one minute, standby on the second, and the TV turned off with it over HDMI-CEC.
The add-on author also tested this PR on Xiaomi Mi Box S (MIBOX4, Android 9, launcher 3.3): the
Schedule screen, event dialog, weekday list and Portuguese strings worked with a D-pad; the one-off
countdown still put the box to sleep through accessibility, and Open on wake installed and started.
-Without Shizuku, a scheduled one-off wake alarm was deferred in standby and fired 272 ms after the
-remote woke the box. The Shizuku path, exclusion periods and reboot were not tested on this box.
-
-DEXP 43UCY1 (Android 11, firmware RP1A.200720.011 dev-keys): Shizuku 13.6.0 started as ADB shell,
-native CVTE fake standby already enabled. Two one-off sleep/wake cycles changed the native standby
-state, kept ADB reachable and reopened Fully Kiosk through the separately configured Wake App add-on.
-The second sleep started a previously killed app process. Accessibility remained disabled for this
-add-on; Shizuku authorization survived an APK update. Full-reboot server restart remains manual.
-
-### DEXP/CVTE findings and rollback
-
-On this tested firmware, `com.yandex.tv.services.platform` continually rewrites the enabled
-accessibility-service list. A direct settings write, including a temporary self-restoration test,
-did not persist. The OEM accessibility confirmation activity reported that it was unsupported in
-this firmware variant. The temporary broad permission and repair code were removed. Do not disable
-the platform service: it also provides essential TV functions. No verified firmware patch was found
-during the investigation; this add-on changes no system APK and needs no root.
-
-Native CVTE fake standby turns off the backlight and mutes audio while Android remains awake.
-The user confirmed the screen and backlight were off; the indicator differs from deep standby.
-This keeps networking available but does not provide deep standby's power savings. The firmware
-owns `IS_FAKE_STANDBY_STATUS` and `persist.fake.standby`; do not write either state value manually.
-The power backend only uses fake standby when `fake_standby_switch` is already `true`; enabling
-this vendor feature is not part of the add-on installer or the repository's debloating procedure.
-
-For the tested TV the original `fake_standby_switch` value was absent. To undo that local
-experiment, first wake the TV with its physical remote, then use an authorized ADB session:
-
-```sh
-python tools/tv.py 'settings delete global fake_standby_switch'
-```
-
-This restores the original value on that device, not a universal default for other firmware.
-If a different value was backed up, restore that value instead. A temporary Wi-Fi optimization
-setting did not preserve the network in deep standby and was reverted.
-
-Fake standby does not emit Android `SCREEN_ON`; use the existing [Wake App add-on](../wake-app/#screen-only-standby)
-with its optional vendor-flag observer to reopen the chosen app. Its physical remote test passed;
-the two Shizuku alarm cycles were also verified from native state, ADB reachability and activity logs.
-These tests cover one device and short standby intervals, not a long-term reliability or energy claim.
+On that box, a scheduled one-off wake alarm was deferred in standby and fired 272 ms after the
+remote woke the box. Exclusion periods and reboot were not tested on this box.
diff --git a/addons/sleep-timer/app/build.gradle b/addons/sleep-timer/app/build.gradle
index f70a51e2c..5637e6336 100644
--- a/addons/sleep-timer/app/build.gradle
+++ b/addons/sleep-timer/app/build.gradle
@@ -14,12 +14,10 @@ android {
versionName '1.0'
}
- buildFeatures { aidl true }
-
buildTypes {
release {
minifyEnabled true
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
// Sideloaded over ADB, never published.
signingConfig signingConfigs.debug
}
@@ -30,8 +28,3 @@ android {
targetCompatibility JavaVersion.VERSION_17
}
}
-
-dependencies {
- implementation 'dev.rikka.shizuku:api:13.1.5'
- implementation 'dev.rikka.shizuku:provider:13.1.5'
-}
diff --git a/addons/sleep-timer/app/proguard-rules.pro b/addons/sleep-timer/app/proguard-rules.pro
deleted file mode 100644
index 799dad98c..000000000
--- a/addons/sleep-timer/app/proguard-rules.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-# Instantiated in the shell process by Shizuku, rather than by Android's manifest.
--keep class io.github.luyzfernando08.sleeptimer.PowerUserService { public <init>(); }
diff --git a/addons/sleep-timer/app/src/main/AndroidManifest.xml b/addons/sleep-timer/app/src/main/AndroidManifest.xml
index 9fd2638f3..e180826e4 100644
--- a/addons/sleep-timer/app/src/main/AndroidManifest.xml
+++ b/addons/sleep-timer/app/src/main/AndroidManifest.xml
@@ -13,8 +13,6 @@
<uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
- <queries><package android:name="moe.shizuku.privileged.api" /></queries>
-
<application
android:allowBackup="false"
android:banner="@drawable/banner"
@@ -30,11 +28,6 @@
<action android:name="android.app.action.SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED" />
</intent-filter>
</receiver>
- <provider android:name="rikka.shizuku.ShizukuProvider"
- android:authorities="${applicationId}.shizuku" android:multiprocess="false"
- android:enabled="true" android:exported="true"
- android:permission="android.permission.INTERACT_ACROSS_USERS_FULL" />
- <meta-data android:name="moe.shizuku.client.V3_SUPPORT" android:value="true" />
<!-- The quick bar, for a remote button: map it in the launcher's app_keys as
hold:<keycode>:io.github.luyzfernando08.sleeptimer/.QuickActivity. The tile and the card open the picker. -->
<activity
diff --git a/addons/sleep-timer/app/src/main/aidl/io/github/luyzfernando08/sleeptimer/IPowerControl.aidl b/addons/sleep-timer/app/src/main/aidl/io/github/luyzfernando08/sleeptimer/IPowerControl.aidl
deleted file mode 100644
index 3dec4f768..000000000
--- a/addons/sleep-timer/app/src/main/aidl/io/github/luyzfernando08/sleeptimer/IPowerControl.aidl
+++ /dev/null
@@ -1,6 +0,0 @@
-package io.github.luyzfernando08.sleeptimer;
-interface IPowerControl {
- boolean setAwake(boolean awake, long deadlineElapsedMs) = 0;
- int uid() = 1;
- void destroy() = 16777114;
-}
diff --git a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/AlarmReceiver.java b/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/AlarmReceiver.java
index b113e08d5..1d9f3c4b2 100644
--- a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/AlarmReceiver.java
+++ b/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/AlarmReceiver.java
@@ -32,7 +32,7 @@ public class AlarmReceiver extends BroadcastReceiver {
context.startActivity(new Intent(context, WarningActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
} else if (Timer.ACTION_SLEEP.equals(intent.getAction()) && System.currentTimeMillis() >= end) {
- Timer.sleepNow(context,goAsync()::finish);
+ Timer.sleepNow(context);
}
}
}
diff --git a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/PowerDeadline.java b/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/PowerDeadline.java
deleted file mode 100644
index 337714c60..000000000
--- a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/PowerDeadline.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package io.github.luyzfernando08.sleeptimer;
-
-/** A client and its Shizuku user service share Android's elapsed-realtime clock. */
-final class PowerDeadline {
- static final long TIMEOUT_MS = 9_000L;
-
- private PowerDeadline() { }
-
- /** Refuse expired or implausibly distant deadlines, including arithmetic overflow. */
- static boolean active(long deadlineElapsedMs, long nowElapsedMs) {
- // elapsedRealtime is nonnegative. Compare before subtraction to reject wraparound.
- if (nowElapsedMs < 0 || deadlineElapsedMs <= nowElapsedMs) return false;
- return deadlineElapsedMs - nowElapsedMs <= TIMEOUT_MS;
- }
-}
diff --git a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/PowerUserService.java b/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/PowerUserService.java
deleted file mode 100644
index a5d36a950..000000000
--- a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/PowerUserService.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package io.github.luyzfernando08.sleeptimer;
-
-import android.os.Process;
-import android.os.SystemClock;
-import java.io.*;
-import java.util.concurrent.TimeUnit;
-
-/** Runs as ADB shell in Shizuku. Only fixed power commands are exposed, never arbitrary shell input. */
-public final class PowerUserService extends IPowerControl.Stub {
- public PowerUserService() { }
- @Override public int uid() { return Process.myUid(); }
- @Override public void destroy() { System.exit(0); }
- private boolean active(long deadlineElapsedMs) {
- return PowerDeadline.active(deadlineElapsedMs, SystemClock.elapsedRealtime());
- }
- private String command(long deadlineElapsedMs, String... args) throws Exception {
- // Recheck immediately before spawning each shell command, not only at RPC entry.
- if (!active(deadlineElapsedMs)) throw new IOException("Power request expired");
- java.lang.Process process=new ProcessBuilder(args).redirectErrorStream(true).start();
- if(!process.waitFor(3,TimeUnit.SECONDS)){process.destroy();throw new IOException("Power command timed out");}
- String line;
- try(BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream()))){line=reader.readLine();}
- if(process.exitValue()!=0)throw new IOException("Power command failed");
- return line==null?"":line.trim();
- }
- @Override public synchronized boolean setAwake(boolean awake, long deadlineElapsedMs) {
- // The request may have expired while waiting for another synchronized power RPC.
- if(uid()!=2000 || !active(deadlineElapsedMs))return false; // ADB shell only, never root.
- try {
- boolean nativeStandby="true".equals(command(deadlineElapsedMs,"/system/bin/settings","get","global","fake_standby_switch"));
- if(nativeStandby) {
- String state=command(deadlineElapsedMs,"/system/bin/settings","get","global","IS_FAKE_STANDBY_STATUS");
- if(!"0".equals(state)&&!"1".equals(state))return false;
- if(("0".equals(state))==awake)return true;
- command(deadlineElapsedMs,"/system/bin/input","keyevent","26");
- Thread.sleep(600);
- String after=command(deadlineElapsedMs,"/system/bin/settings","get","global","IS_FAKE_STANDBY_STATUS");
- return (awake?"0":"1").equals(after);
- }
- command(deadlineElapsedMs,"/system/bin/input","keyevent",awake?"224":"223");
- return true;
- } catch(Exception e) {android.util.Log.e("SleepPower","Power command failed",e);return false;}
- }
-}
diff --git a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/Schedule.java b/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/Schedule.java
index a38811852..6fdc39edc 100644
--- a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/Schedule.java
+++ b/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/Schedule.java
@@ -79,7 +79,6 @@ final class Schedule {
static void wakeScreen(Context c) {wakeScreen(c,()->{});}
@SuppressWarnings("deprecation")
static void wakeScreen(Context c,Runnable finished) {
- if(ShizukuPower.ready()){ShizukuPower.setAwake(c,true,finished);return;}
PowerManager pm=c.getSystemService(PowerManager.class);
PowerManager.WakeLock lock=pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ACQUIRE_CAUSES_WAKEUP,"sleeptimer:schedule");
lock.acquire(3000);
@@ -101,7 +100,7 @@ final class Schedule {
Runnable done=()->{reschedule(c);finished.run();};
if(on(c)&&at>0&&now>=at&&now-at<10*60_000L) {
if(wake&&!ScheduleRules.paused(LocalDate.now(),pauses(c))){wakeScreen(c,done);return;}
- if(!wake&&c.getSystemService(PowerManager.class).isInteractive()){Timer.sleepNow(c,done);return;}
+ if(!wake&&c.getSystemService(PowerManager.class).isInteractive()){Timer.sleepNow(c);done.run();return;}
}
done.run();
}
diff --git a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/ShizukuPower.java b/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/ShizukuPower.java
deleted file mode 100644
index 78e3a6c1a..000000000
--- a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/ShizukuPower.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package io.github.luyzfernando08.sleeptimer;
-
-import android.content.*;
-import android.content.pm.PackageManager;
-import android.os.*;
-import java.util.concurrent.atomic.AtomicBoolean;
-import rikka.shizuku.Shizuku;
-
-/** A fresh asynchronous binding also works when AlarmReceiver starts a previously killed app process. */
-final class ShizukuPower {
- private ShizukuPower() { }
- static boolean running() {
- try{return Shizuku.pingBinder()&&Shizuku.getUid()==2000;}catch(RuntimeException e){return false;}
- }
- static boolean ready() {
- try{return running()&&Shizuku.checkSelfPermission()==PackageManager.PERMISSION_GRANTED;}catch(RuntimeException e){return false;}
- }
- static void connect(android.app.Activity activity) {
- if(running()) {if(!ready())Shizuku.requestPermission(71);return;}
- Intent manager=activity.getPackageManager().getLaunchIntentForPackage("moe.shizuku.privileged.api");
- if(manager!=null)activity.startActivity(manager);
- }
- static void setAwake(Context context,boolean awake,Runnable finished) {
- if(!ready()){android.util.Log.w("SleepPower","Shizuku is not ready");finished.run();return;}
- Handler handler=new Handler(Looper.getMainLooper());
- long deadlineElapsedMs=SystemClock.elapsedRealtime()+PowerDeadline.TIMEOUT_MS;
- Shizuku.UserServiceArgs args=new Shizuku.UserServiceArgs(new ComponentName(context,PowerUserService.class))
- .tag("sleep-timer-power").processNameSuffix("power").daemon(true).version(2);
- AtomicBoolean completed=new AtomicBoolean();
- final ServiceConnection[] holder=new ServiceConnection[1];
- Runnable complete=()->{
- if(!completed.compareAndSet(false,true))return;
- try{Shizuku.unbindUserService(args,holder[0],false);}catch(RuntimeException ignored){ }
- finished.run();
- };
- Runnable timeout=()->{android.util.Log.w("SleepPower","Shizuku power request timed out");complete.run();};
- holder[0]=new ServiceConnection(){
- @Override public void onServiceConnected(ComponentName name,IBinder binder){
- if(completed.get())return;
- new Thread(()->{
- try {
- if(completed.get())return;
- IPowerControl power=IPowerControl.Stub.asInterface(binder);
- boolean ok=power.uid()==2000&&!completed.get()&&power.setAwake(awake,deadlineElapsedMs);
- android.util.Log.i("SleepPower","awake="+awake+" success="+ok);
- }catch(RemoteException|RuntimeException e){android.util.Log.e("SleepPower","Shizuku power failed",e);}
- handler.post(()->{handler.removeCallbacks(timeout);complete.run();});
- },"tv-power").start();
- }
- @Override public void onServiceDisconnected(ComponentName name){handler.removeCallbacks(timeout);complete.run();}
- };
- handler.postDelayed(timeout,PowerDeadline.TIMEOUT_MS);
- try{Shizuku.bindUserService(args,holder[0]);}catch(RuntimeException e){handler.removeCallbacks(timeout);complete.run();}
- }
-}
diff --git a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/Timer.java b/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/Timer.java
index ad5f98719..e8bc4a829 100644
--- a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/Timer.java
+++ b/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/Timer.java
@@ -49,19 +49,14 @@ final class Timer {
am.cancel(pending(ctx, ACTION_SLEEP));
}
- /** Ends the timer and requests sleep. False when neither power backend is available. */
+ /** Ends the timer and puts the TV to sleep. False when the accessibility service is off. */
static boolean sleepNow(Context ctx) {
- return sleepNow(ctx,()->{});
- }
-
- static boolean sleepNow(Context ctx,Runnable finished) {
cancel(ctx);
- if(ShizukuPower.ready()) {ShizukuPower.setAwake(ctx,false,finished);return true;}
- boolean slept=SleepService.sleep();finished.run();return slept;
+ return SleepService.sleep();
}
static boolean canSleep() {
- return ShizukuPower.ready() || SleepService.running();
+ return SleepService.running();
}
private static void schedule(Context ctx, String action, long at) {
diff --git a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/TimerActivity.java b/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/TimerActivity.java
index 1ade88cac..88a443fe8 100644
--- a/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/TimerActivity.java
+++ b/addons/sleep-timer/app/src/main/java/io/github/luyzfernando08/sleeptimer/TimerActivity.java
@@ -11,17 +11,11 @@ import android.widget.TextView;
/** The card: pick when the TV goes to sleep, or cancel the timer. Choosing closes the screen. */
public class TimerActivity extends Activity {
- private TextView state, first, cancel, shizuku;
- private final rikka.shizuku.Shizuku.OnRequestPermissionResultListener permissionListener=(code,result)->refresh();
- private final rikka.shizuku.Shizuku.OnBinderReceivedListener binderListener=()->runOnUiThread(this::refresh);
- private final rikka.shizuku.Shizuku.OnBinderDeadListener deadListener=()->runOnUiThread(this::refresh);
+ private TextView state, first, cancel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- rikka.shizuku.Shizuku.addRequestPermissionResultListener(permissionListener);
- rikka.shizuku.Shizuku.addBinderReceivedListener(binderListener);
- rikka.shizuku.Shizuku.addBinderDeadListener(deadListener);
LinearLayout root = new LinearLayout(this);
root.setOrientation(LinearLayout.VERTICAL);
root.setGravity(Gravity.CENTER_HORIZONTAL);
@@ -71,9 +65,7 @@ public class TimerActivity extends Activity {
schedule.setText(R.string.schedule_row);
schedule.setOnClickListener(v -> startActivity(new Intent(this, ScheduleActivity.class)));
- shizuku=Ui.row(root,798);
- shizuku.setOnClickListener(v->ShizukuPower.connect(this));
- for(TextView row:new TextView[]{cancel,schedule,shizuku})row.getLayoutParams().width=-1;
+ for(TextView row:new TextView[]{cancel,schedule})row.getLayoutParams().width=-1;
android.widget.ScrollView scroll=new android.widget.ScrollView(this);
scroll.setFillViewport(true);
scroll.addView(root,new android.widget.ScrollView.LayoutParams(-1,-2));
@@ -89,8 +81,7 @@ public class TimerActivity extends Activity {
}
private void refresh() {
- if(state==null||shizuku==null)return;
- shizuku.setText(ShizukuPower.ready()?R.string.shizuku_ready:ShizukuPower.running()?R.string.shizuku_allow:R.string.shizuku_start);
+ if(state==null)return;
long end = Timer.end(this);
if (!Timer.canSleep()) state.setText(R.string.no_service);
else if (end == 0) state.setText(R.string.state_off);
@@ -98,10 +89,4 @@ public class TimerActivity extends Activity {
String bed = Schedule.describe(this);
if (!bed.isEmpty()) setTitle(getString(R.string.app_name) + " · " + bed);
}
- @Override protected void onDestroy() {
- rikka.shizuku.Shizuku.removeRequestPermissionResultListener(permissionListener);
- rikka.shizuku.Shizuku.removeBinderReceivedListener(binderListener);
- rikka.shizuku.Shizuku.removeBinderDeadListener(deadListener);
- super.onDestroy();
- }
}
diff --git a/addons/sleep-timer/app/src/main/res/values-it/shizuku.xml b/addons/sleep-timer/app/src/main/res/values-it/shizuku.xml
deleted file mode 100644
index ba890e4aa..000000000
--- a/addons/sleep-timer/app/src/main/res/values-it/shizuku.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
- <string name="shizuku_ready">Shizuku connesso · controllo alimentazione via ADB</string>
- <string name="shizuku_allow">Consenti il controllo tramite Shizuku</string>
- <string name="shizuku_start">Avvia Shizuku · riavvialo dopo il riavvio della TV</string>
-</resources>
diff --git a/addons/sleep-timer/app/src/main/res/values-pt/shizuku.xml b/addons/sleep-timer/app/src/main/res/values-pt/shizuku.xml
deleted file mode 100644
index 8774e897e..000000000
--- a/addons/sleep-timer/app/src/main/res/values-pt/shizuku.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
- <string name="shizuku_ready">Shizuku conectado · controle de energia via ADB</string>
- <string name="shizuku_allow">Permitir controle de energia pelo Shizuku</string>
- <string name="shizuku_start">Iniciar o Shizuku · inicie de novo depois de reiniciar a TV</string>
-</resources>
diff --git a/addons/sleep-timer/app/src/main/res/values-ru/shizuku.xml b/addons/sleep-timer/app/src/main/res/values-ru/shizuku.xml
deleted file mode 100644
index fd8915fa2..000000000
--- a/addons/sleep-timer/app/src/main/res/values-ru/shizuku.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
- <string name="shizuku_ready">Shizuku подключён · управление питанием через ADB</string>
- <string name="shizuku_allow">Разрешить управление питанием через Shizuku</string>
- <string name="shizuku_start">Запустить Shizuku · после перезагрузки ТВ нужен повторный запуск</string>
-</resources>
diff --git a/addons/sleep-timer/app/src/main/res/values-zh-rTW/shizuku.xml b/addons/sleep-timer/app/src/main/res/values-zh-rTW/shizuku.xml
deleted file mode 100644
index 19b68996f..000000000
--- a/addons/sleep-timer/app/src/main/res/values-zh-rTW/shizuku.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
- <string name="shizuku_ready">Shizuku 已連線 · 透過 ADB 控制電源</string>
- <string name="shizuku_allow">允許透過 Shizuku 控制電源</string>
- <string name="shizuku_start">啟動 Shizuku · 電視重新啟動後需再次啟動</string>
-</resources>
diff --git a/addons/sleep-timer/app/src/main/res/values/shizuku.xml b/addons/sleep-timer/app/src/main/res/values/shizuku.xml
deleted file mode 100644
index ca6e8c0e4..000000000
--- a/addons/sleep-timer/app/src/main/res/values/shizuku.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
- <string name="shizuku_ready">Shizuku connected · power control via ADB</string>
- <string name="shizuku_allow">Allow power control through Shizuku</string>
- <string name="shizuku_start">Start Shizuku · restart it after a TV reboot</string>
-</resources>
diff --git a/addons/sleep-timer/tests/PowerDeadlineCheck.java b/addons/sleep-timer/tests/PowerDeadlineCheck.java
deleted file mode 100644
index 4899ca6b2..000000000
--- a/addons/sleep-timer/tests/PowerDeadlineCheck.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package io.github.luyzfernando08.sleeptimer;
-
-/** Run without Android or Shizuku: java -cp work/power-deadline-check ...PowerDeadlineCheck */
-public final class PowerDeadlineCheck {
- private static int checks;
-
- private static void check(boolean condition, String name) {
- checks++;
- if (!condition) throw new AssertionError(name);
- }
-
- public static void main(String[] args) {
- long issued = 1_000_000L;
- long deadline = issued + PowerDeadline.TIMEOUT_MS;
- check(PowerDeadline.active(deadline, issued), "valid request at start");
- check(PowerDeadline.active(deadline, deadline - 1), "valid one millisecond before expiry");
- check(!PowerDeadline.active(deadline, deadline), "reject on deadline");
- check(!PowerDeadline.active(deadline, deadline + 1), "reject late delivery");
- check(!PowerDeadline.active(deadline, deadline + 60_000), "reject stale queued delivery");
- check(!PowerDeadline.active(issued + PowerDeadline.TIMEOUT_MS + 1, issued),
- "reject requests exceeding the 9s bound");
- check(!PowerDeadline.active(0, issued), "reject missing deadline");
- check(!PowerDeadline.active(Long.MAX_VALUE, 0), "reject unbounded deadline");
- check(!PowerDeadline.active(Long.MIN_VALUE, 1), "reject negative overflow");
- check(!PowerDeadline.active(Long.MAX_VALUE, Long.MIN_VALUE),
- "reject wrapped subtraction");
- check(PowerDeadline.active(deadline, issued + 500), "valid during preparation");
- check(!PowerDeadline.active(deadline, issued + 9_100),
- "reject if settings reads consume the remaining deadline");
- System.out.println("Power deadline checks passed: " + checks);
- }
-}
diff --git a/addons/wake-app/README.md b/addons/wake-app/README.md
index 1aee5a095..d6d8b0e81 100644
--- a/addons/wake-app/README.md
+++ b/addons/wake-app/README.md
@@ -92,29 +92,3 @@ Then press Home and answer **Show card** if you want the card; Keep hidden leave
channel.
- Philco Smart TV by Skyworth (sunnyvale, MediaTek, Android TV 14), launcher 3.1: opening tinyCam by itself on
waking from standby, and not opening it with the overlay grant revoked (see Permissions). Not tried on a TCL set.
-
-## Screen-only standby
-
-Some TVs turn off the backlight without sending Android SCREEN_ON. The existing shell-protected
-WatchService accepts `--es standby_setting <global setting name>` to observe a vendor flag: 1 is
-standby, 0 is awake. Empty removes the observer. The setting is saved across service restarts.
-The normal app picker, On/Off switch and delay apply to both wake sources. No new permission,
-network access or polling is used.
-
-On DEXP 43UCY1 with CVTE/Yandex firmware, use `--es standby_setting IS_FAKE_STANDBY_STATUS`
-with native `fake_standby_switch=true`. Launch waits at least 800 ms for the native black-screen
-activity to finish its delayed Back key.
-
-Configure an installed Wake App through an authorized ADB session, replacing the target package:
-
-```sh
-python tools/tv.py 'am start-foreground-service -n io.github.luyzfernando08.wakeapp/.WatchService --es app de.ozerov.fully --es standby_setting IS_FAKE_STANDBY_STATUS'
-```
-
-The observer is off by default. To remove it, pass an empty `standby_setting` extra to the same
-service; ordinary `SCREEN_ON` handling remains available. It observes the flag but never enables
-native standby or writes its state. The app picker still controls which app opens.
-
-Verified on DEXP 43UCY1, Android 11, firmware RP1A.200720.011 dev-keys: the real remote turned the
-screen off and on and Fully Kiosk reopened. Two one-off [Sleep Timer](../sleep-timer/#optional-shizuku-connection)
-Shizuku sleep/wake cycles also reopened it. No new permission, dependency or launcher change is required.
diff --git a/addons/wake-app/app/src/main/java/io/github/luyzfernando08/wakeapp/Prefs.java b/addons/wake-app/app/src/main/java/io/github/luyzfernando08/wakeapp/Prefs.java
index 96c0ee692..a4e4d050e 100644
--- a/addons/wake-app/app/src/main/java/io/github/luyzfernando08/wakeapp/Prefs.java
+++ b/addons/wake-app/app/src/main/java/io/github/luyzfernando08/wakeapp/Prefs.java
@@ -14,14 +14,6 @@ final class Prefs {
return ctx.getSharedPreferences("settings", Context.MODE_PRIVATE);
}
- static String standbySetting(Context ctx) {
- return prefs(ctx).getString("standby_setting", "");
- }
-
- static void setStandbySetting(Context ctx, String key) {
- prefs(ctx).edit().putString("standby_setting", key == null ? "" : key).apply();
- }
-
static boolean enabled(Context ctx) {
return prefs(ctx).getBoolean("enabled", true);
}
diff --git a/addons/wake-app/app/src/main/java/io/github/luyzfernando08/wakeapp/WatchService.java b/addons/wake-app/app/src/main/java/io/github/luyzfernando08/wakeapp/WatchService.java
index ad71be105..9ad07cc0f 100644
--- a/addons/wake-app/app/src/main/java/io/github/luyzfernando08/wakeapp/WatchService.java
+++ b/addons/wake-app/app/src/main/java/io/github/luyzfernando08/wakeapp/WatchService.java
@@ -30,26 +30,6 @@ public class WatchService extends Service {
private final Handler handler = new Handler(Looper.getMainLooper());
private long lastOpen;
- private android.database.ContentObserver standbyObserver;
- private int standbyState;
-
- /** Optional vendor standby flag, configured by the shell: no polling and no vendor API calls. */
- private void watchStandby() {
- if (standbyObserver != null) getContentResolver().unregisterContentObserver(standbyObserver);
- standbyObserver = null;
- String key = Prefs.standbySetting(this);
- if (key.isEmpty()) return;
- standbyState = android.provider.Settings.Global.getInt(getContentResolver(), key, -1);
- standbyObserver = new android.database.ContentObserver(handler) {
- @Override public void onChange(boolean selfChange) {
- int state = android.provider.Settings.Global.getInt(getContentResolver(), key, -1);
- if (state == 1) handler.removeCallbacks(open);
- if (standbyState == 1 && state == 0) schedule(800);
- standbyState = state;
- }
- };
- getContentResolver().registerContentObserver(android.provider.Settings.Global.getUriFor(key), false, standbyObserver);
- }
private final Runnable open = new Runnable() {
@Override
@@ -91,13 +71,11 @@ public class WatchService extends Service {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null) {
- if (intent.hasExtra("standby_setting")) Prefs.setStandbySetting(this, intent.getStringExtra("standby_setting"));
if (intent.hasExtra("app")) Prefs.setApp(this, intent.getStringExtra("app"));
if (intent.hasExtra("link")) Prefs.setLink(this, intent.getStringExtra("link"));
if (intent.getBooleanExtra("test", false)) Launch.open(this);
else if (intent.getBooleanExtra(EXTRA_BOOT, false)) schedule(BOOT_EXTRA_MS);
}
- watchStandby();
return START_STICKY;
}
@@ -111,7 +89,6 @@ public class WatchService extends Service {
public void onDestroy() {
handler.removeCallbacks(open);
unregisterReceiver(screen);
- if (standbyObserver != null) getContentResolver().unregisterContentObserver(standbyObserver);
super.onDestroy();
}