Skip to content

feat: Add Set target SDK version 34 patch (Disable edge-to-edge display) #4780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

LisoUseInAIKyrios
Copy link
Contributor

@LisoUseInAIKyrios LisoUseInAIKyrios commented Apr 13, 2025

Forces off Android 15 edge to edge display by changing the target SDK version to Android 14.

Effectively, this will restore opaque nav/status bars.

Before: Photo Math (bottom nav bar is transparent)
photo_math

@LisoUseInAIKyrios LisoUseInAIKyrios force-pushed the feat/disable_edge_to_edge branch from 642b111 to 0e20724 Compare April 13, 2025 13:34
@LisoUseInAIKyrios LisoUseInAIKyrios force-pushed the feat/disable_edge_to_edge branch from 0e20724 to 08f2cdd Compare April 13, 2025 13:36
Copy link
Member

@oSumAtrIX oSumAtrIX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no way to control the behaviour directly without downgrading the SDK version?

@LisoUseInAIKyrios
Copy link
Contributor Author

LisoUseInAIKyrios commented Apr 13, 2025

Is there no way to control the behaviour directly without downgrading the SDK version?

It appears the theme file can set windowOptOutEdgeToEdgeEnforcement to true, but that requires knowing what theme file is used and there may be many of them. Google is said to deprecate that override value in the future.

Setting the target SDK automatically opts out of the behavior.

@oSumAtrIX
Copy link
Member

In this case, iterate through all the themes XML files and set windowOptOutEdgeToEdgeEnforcement to true instead of downgrading the SDK. If there is a non deprecated way of disabling edge to edge, you can do that instead.

@LisoUseInAIKyrios
Copy link
Contributor Author

https://developer.android.com/about/versions/16/behavior-changes-16#edge-to-edge

It seems opting out is only for Android 15. Android 16 ignores the flag.

So, changing the target sdk appears to be the only way for Android 16+

@oSumAtrIX oSumAtrIX changed the title feat: Add universal Disable edge-to-edge display patch feat: Add Disable edge-to-edge display patch Apr 13, 2025
Copy link
Member

@oSumAtrIX oSumAtrIX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch should be turned into a changeTargetSdkPatch as it is mainly doing that. A patch option can control the SDK version and could use the compileSdk version by default.

@LisoUseInAIKyrios
Copy link
Contributor Author

A generic patch doesn't appear to have any use case except for this specific situation (edge-to-edge display).

Using an older target sdk may cause unknown and undesirable backwards compatibility behavior.

Users already get confused enough and apply universal patches without understanding what they are doing: "I applied remove screenshot patch and the app is crashing" (the unpatched app doesn't even restrict screenshot usage).

If other purposes for changing the target sdk is found then the patch can be made generic. But for now I think it's much simpler to keep the patch focused on this one specific change.

@oSumAtrIX
Copy link
Member

oSumAtrIX commented Apr 13, 2025

Users getting confused by universal patches is not a concern patches is supposed to fix by labeling patches something they arent really doing. The business logic of the patch implies a different name than currently given. It is a patch that changes the target SDK and as such should be named like that. Naming it like something else on the other hand is where issues start to happen. The patch is not just disabling edge to edge display, it is downgrading the SDK, so "unknown and undesired backwards compatibility behaviour" still applies regardless. If the patch is named according to what it does, this side effect would be expected behaviour as the patch did what it was named after, which is changing the target SDK. The user confusion with universal patches is not this repositories or patches concern and should not be a supporting argument to name the patch after something else than it really does.

@LisoUseInAIKyrios
Copy link
Contributor Author

The patch explains what it does (changes target sdk), but if it's generic that means the user now needs to know that using sdk 34 turns off edge to edge display.

And if there's no other use case except this, then why give the user an option (target sdk) when there is literally only one value that is useful?

Making the patch a generic Change target sdk is making it unnecessarily complex with no added value.

@oSumAtrIX
Copy link
Member

oSumAtrIX commented Apr 13, 2025

The patch explains what it does (changes target sdk), but if it's generic that means the user now needs to know that using sdk 34 turns off edge to edge display.

Thats what the description or even patch option values are for. You can add SDK 34 as a value and mention that it disables edge to edge display.

And if there's no other use case except this, then why give the user an option (target sdk) when there is literally only one value that is useful?

There may be other use cases, I don't know what new Android SDK versions add but let alone for scalability and future possible usecases, this change would be useful.

Making the patch a generic Change target sdk is making it unnecessarily complex with no added value.

The patch is already a "generic change target SDK" patch, just that it now should provide an option to change to any SDK and not an arbitrary value like 34 which makes the primary and only business logic the patch has, dynamic and scalable. The name "Disable edge-to-edge display" is not the actual name of the patch according to the core business logic. If there was some Android API to disable edge-to-edge display, and the patch would use that to disable this feature, then the name would be appropriate.

@LisoUseInAIKyrios
Copy link
Contributor Author

I'm searching now, and I can't find another other compatibility behavior that could be desirable to revert.

And some of the backwards compatibility would be bad to revert.

Such as changing to sdk 33 that reverts 34's behavior of allowing a an app to run in the background less time before it's paused/hibernated. Revering that behavior will cause the app to use more battery (if the user wants to allow more background time, the app should instead be whitelisted for battery usage).

Another is Android 33 has lower range for accessibility text size (34 is up to 200%, 33 is up to 130%)

Yet another is early versions of Android sdk turns off various hardware acceleration functionality.

I don't think letting the user pick a version is a good idea. If we cannot find a single use case outside of forcing sdk 34, then there is no reason to let them.

If we find another use case, then sure change this to a generic patch. But until then let's not make this complicated.

@MarcaDian
Copy link
Contributor

MarcaDian commented Apr 13, 2025

I wonder if downgrading the target SDK version fixes these dark mode bugs? I think it's related to the update to Android 15.

Or these bugs caused by not using the androidx library?

Screenshot_2025-04-13-17-51-22-307_app.revanced.android.youtube-edit.jpg

Screenshot_2025-04-13-17-51-18-145_app.revanced.android.youtube.jpg

Screenshot_2025-04-13-17-51-43-334_com.github.android.jpg

@LisoUseInAIKyrios
Copy link
Contributor Author

@MarcaDian what's wrong with the third photo?

@oSumAtrIX
Copy link
Member

I don't think letting the user pick a version is a good idea. If we cannot find a single use case outside of forcing sdk 34, then there is no reason to let them.

The user can choose a higher SDK value. There is no reason to cripple the patch in its core logic.
But even then, making the patch less flexible by not adding the option, the patch is still named incorrectly. If you hardcode the arbitrary SDK version 34 the patch remains a "Set target SDK version 34" patch and not a "Disable edge-to-edge display" patch, because it sets the SDK version to 34.

@MarcaDian
Copy link
Contributor

In the third screenshot, the GitHub mobile client, I just wanted to show that this bug is not only in the settings of the revanced, but also in third-party programs.
At the same time, everything is fine in the settings of the YouTube client.

@LisoUseInAIKyrios
Copy link
Contributor Author

Setting the sdk higher than unpatched has a high likelihood the app won't work correctly (or even launch at all), because nearly every new sdk has new requirements such as declaring exports/permissions and some classes will throw exceptions if not used in the 'new' way.

Forcing to 35 or above will break nearly all old apps because edge-to-edge is then forced on but the UI isn't updated to handle edge to edge.

If the patch name must be explicitly based on what it does, it can be Change target SDK and the description explains it changes to sdk 34 that forces off edge-to-edge display. If even a single other sdk target can be found that is useful to force, then the forced sdk target can be an option.

@oSumAtrIX
Copy link
Member

oSumAtrIX commented Apr 13, 2025

"Change target SDK" would call for the option. If the patch is restricted to SDK 34, it is noteworthy for the name to be "Set target SDK version 34" with a description motivating this arbitrary SDK version.

@LisoUseInAIKyrios LisoUseInAIKyrios changed the title feat: Add Disable edge-to-edge display patch feat: Add Set target SDK version 34 patch (Disable edge-to-edge display) Apr 13, 2025
@oSumAtrIX oSumAtrIX changed the title feat: Add Set target SDK version 34 patch (Disable edge-to-edge display) feat: Add Set target SDK version 34 patch (Disables edge-to-edge display) Apr 13, 2025
@LisoUseInAIKyrios LisoUseInAIKyrios changed the title feat: Add Set target SDK version 34 patch (Disables edge-to-edge display) feat: Add Set target SDK version 34 patch (Disable edge-to-edge display) Apr 13, 2025
@LisoUseInAIKyrios LisoUseInAIKyrios merged commit dcf6178 into ReVanced:dev Apr 13, 2025
1 check passed
@LisoUseInAIKyrios LisoUseInAIKyrios deleted the feat/disable_edge_to_edge branch April 13, 2025 16:23
github-actions bot pushed a commit that referenced this pull request Apr 13, 2025
# [5.20.0-dev.1](v5.19.1...v5.20.0-dev.1) (2025-04-13)

### Features

* Add `Set target SDK version 34` patch (Disable edge-to-edge display) ([#4780](#4780)) ([dcf6178](dcf6178))
github-actions bot pushed a commit that referenced this pull request Apr 15, 2025
# [5.20.0](v5.19.1...v5.20.0) (2025-04-15)

### Bug Fixes

* **Duolingo - Hide ads:**  Support lastest app release ([#4790](#4790)) ([215fccb](215fccb))
* **Spotify - Unlock Spotify Premium:** Remove premium restriction for 'Spotify Connect' ([#4782](#4782)) ([50f5b1a](50f5b1a))
* **Spotify:** Fix login by replacing `Spoof signature` patch with new `Spoof package info` patch ([#4794](#4794)) ([d639151](d639151))
* **YouTube - Remove background playback restrictions:** Restore PiP button functionality after screen is unlocked ([6837348](6837348))

### Features

* Add `Set target SDK version 34` patch (Disable edge-to-edge display) ([#4780](#4780)) ([dcf6178](dcf6178))
* **Spotify - Custom theme:** Add option to use unmodified player background gradient ([#4741](#4741)) ([0ee3693](0ee3693))
* **YouTube - Swipe controls:** Add option to change volume swipe sensitivity (step size) ([#4557](#4557)) ([8957325](8957325))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants