Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ShortsBlocker/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "com.shortsBlocker"
minSdk 21
targetSdk 34
versionCode 9
versionName "1.0.8"
versionCode 10
versionName "1.0.9"
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,17 @@ class ShortsAccessibilityService : AccessibilityService() {
// counters surfaced in the debug card.
private val SHORTS_FRAGMENTS = listOf("reel", "shorts")

// Player-container keywords. The strict class rule fires only when
// a class name contains a SHORTS_FRAGMENT *and* one of these in
// the same name — that distinguishes the player container from
// the tab button or other Shorts-aware UI on home screen.
private val PLAYER_CONTAINER_FRAGMENTS = listOf(
"player", "pager", "recycler", "container"
)
// Player keyword. The strict class rule fires only when a class
// name contains a SHORTS_FRAGMENT *and* this in the same name —
// narrows detection to the full-screen Shorts player, since
// every relevant YouTube class has "Player" in its name there.
//
// Earlier versions also matched "container" / "recycler" /
// "pager", but those words appear on the Shorts *shelf* embedded
// in the Subscriptions and "You" feeds, which caused those tabs
// to be back-pressed away as soon as they loaded. Restricting
// to "player" alone keeps shelves out of the trigger set.
private val PLAYER_CONTAINER_FRAGMENTS = listOf("player")

// Vertical scroller class signatures, corroborates the weak
// "shorts text" rule.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
No `android:packageNames` filter here on purpose: we filter in code by
"any package containing 'youtube'" so stock YouTube, Vanced, ReVanced
and the music app are all picked up.
Only `typeWindowStateChanged` is registered.

Event types intentionally limited to window-state and window-content
changes: typeViewScrolled / typeViewSelected fired on every minor UI
update inside YouTube and contributed to v1.0.6 firing back-presses
on the home screen.
YouTube fires `typeWindowContentChanged` at ~30 Hz during normal
scroll; even with a 250ms throttle in code, paying for the event
dispatch dropped the user-visible frame rate. State-changed events
fire only on real screen transitions (opening Shorts, switching
tabs, navigating to a video), which is exactly when we need to
re-evaluate whether the Shorts player is on screen. Steady-state
CPU during scroll drops to effectively zero.

No `android:packageNames` filter — we filter in code by "package
name contains 'youtube'" so stock, Vanced, ReVanced, music app
are all picked up.
-->
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="typeWindowStateChanged|typeWindowContentChanged"
android:accessibilityEventTypes="typeWindowStateChanged"
android:accessibilityFeedbackType="feedbackGeneric"
android:accessibilityFlags="flagDefault|flagIncludeNotImportantViews"
android:canRetrieveWindowContent="true"
Expand Down
Loading