Skip to content
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

feat: Add Change version code patch #3338

Merged
merged 6 commits into from
Jun 15, 2024

Conversation

1fexd
Copy link
Contributor

@1fexd 1fexd commented Jun 13, 2024

Adds a patch that sets an app's versionCode to 1, allowing apps to be downgraded since the versionCode is now constant

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Jun 13, 2024

What if an app is already installed but was not patched with this, can a downgraded version be installed with this?

If the version number needs to be the same or greater to to update, should this use max integer so it's always the same or 'newer' than whatever is already installed? If this is the case and this is done, the downside is this patch is always needed to upgrade any existing installation.

@oSumAtrIX
Copy link
Member

I think the idea with this patch is always to use this patch when patching apps, so you can install any previously patched app as well.

@1fexd
Copy link
Contributor Author

1fexd commented Jun 13, 2024

What if an app is already installed but was not patched with this, can a downgraded version be installed with this?

No

If the version number needs to be the same or greater to to update, should this use max integer so it's always the same or 'newer' than whatever is already installed? If this is the case and this is done, the downside is this patch is always needed to upgrade any existing installation.

You could do either the min or the max version code, where using the min one allows returning to the "real" version code, while the max would allow switching to this patch from an existing installation (already installed apps have to be signed with the ReVanced keys for both methods)

@1fexd
Copy link
Contributor Author

1fexd commented Jun 13, 2024

I think the idea with this patch is always to use this patch when patching apps, so you can install any previously patched app as well.

Exactly

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.

The patch should be renamed to what it precisely does. In this case it changes the version code so the patch should be called "Change version code" similar to how the package name patch is called "Change package name". While the main side effect is to "Add app downgrading" in reality what the patch does is "Change version code"

@LisoUseInAIKyrios
Copy link
Contributor

You could do either the min or the max version code, where using the min one allows returning to the "real" version code, while the max would allow switching to this patch from an existing installation (already installed apps have to be signed with the ReVanced keys for both methods)

It seems using max integer version would be more immediate for what the goal is (downgrade an existing installation), since it can patch and downgrade in one go regardless how the existing app was previously patched and installed (only requirement is the user patched themselves and has the same signing key).

Using version 1 does not allow downgrading an existing installation that did not originally include this patch, meaning for that install it's impossible to downgrade unless uninstalled first (and then this patch is not required).

Maybe the version number can be exposed as a patch option, but that might be way more complicated than needed.

@LisoUseInAIKyrios
Copy link
Contributor

I am not sure, but I think if the version code is max integer, that will effectively turn off Google play store updates since the existing installation will always show as 'newer' than whatever the play store has.

@1fexd
Copy link
Contributor Author

1fexd commented Jun 13, 2024

You could do either the min or the max version code, where using the min one allows returning to the "real" version code, while the max would allow switching to this patch from an existing installation (already installed apps have to be signed with the ReVanced keys for both methods)

It seems using max integer version would be more immediate for what the goal is (downgrade an existing installation), since it can patch and downgrade in one go regardless how the existing app was previously patched and installed (only requirement is the user patched themselves and has the same signing key).

Using version 1 does not allow downgrading an existing installation that did not originally include this patch, meaning for that install it's impossible to downgrade unless uninstalled first (and then this patch is not required).

Maybe the version number can be exposed as a patch option, but that might be way more complicated than needed.

Done, defaults to the Google Play maxium (https://developer.android.com/studio/publish/versioning)

@oSumAtrIX
Copy link
Member

I don't think restricting to Google Play's maximum makes sense. In terms of Android, the integer max value can be used, so why not here?

@1fexd
Copy link
Contributor Author

1fexd commented Jun 13, 2024

Done

@oSumAtrIX oSumAtrIX changed the title feat: Add app downgrading feat: Add Change version code patch Jun 13, 2024
@1fexd
Copy link
Contributor Author

1fexd commented Jun 14, 2024

Anything else left to do here @oSumAtrIX?

@ILoveOpenSourceApplications
Copy link
Contributor

ILoveOpenSourceApplications commented Jun 15, 2024

Can Change version code be understandable to everyone, as in what it does? What about Change app version, which I believe most will be able to understand much easily.

@LisoUseInAIKyrios
Copy link
Contributor

'App version' usually refers to the user facing version the app presents itself as, such as 19.11.39, while the version code is the internal (not publicly facing) version used to compare against other releases.

@LisoUseInAIKyrios LisoUseInAIKyrios merged commit 685ef39 into ReVanced:dev Jun 15, 2024
2 checks passed
revanced-bot pushed a commit that referenced this pull request Jun 15, 2024
# [4.10.0-dev.7](v4.10.0-dev.6...v4.10.0-dev.7) (2024-06-15)

### Features

* Add `Change version code` patch ([#3338](#3338)) ([685ef39](685ef39))
@cyberboh
Copy link

This patch seems does not support widely
I tested with Instagram 332.0.0.38.90 error while compiling.
The log, maybe does not supported by current AAPT

INFO: Compiling modified resources
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values-h640dp\layouts.xml:3: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values-h640dp\layouts.xml: error: file failed to compile.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values-land\layouts.xml:3: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values-land\layouts.xml:4: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values-land\layouts.xml:5: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values-land\layouts.xml:6: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values-land\layouts.xml:7: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values-land\layouts.xml: error: file failed to compile.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values-sw600dp\layouts.xml:3: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values-sw600dp\layouts.xml:4: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values-sw600dp\layouts.xml: error: file failed to compile.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values\layouts.xml:3: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values\layouts.xml:4: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values\layouts.xml:5: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values\layouts.xml:6: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values\layouts.xml:7: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values\layouts.xml:8: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values\layouts.xml:9: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values\layouts.xml:10: error: invalid value for type 'layout'. Expected a reference.
WARNING: E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res\values\layouts.xml:11: error: invalid value for type 'layout'. Expected a reference.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\User\AppData\Local\Temp\brut_util_Jar_128283882703127182132429529068672218130.tmp, compile, --dir, E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res, --legacy, -o, E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\build\resources.zip]
        at brut.androlib.AaptInvoker.invokeAapt2(AaptInvoker.java:123)
        at brut.androlib.AaptInvoker.invokeAapt(AaptInvoker.java:394)
        at app.revanced.patcher.data.ResourceContext.get(ResourceContext.kt:134)
        at app.revanced.patcher.Patcher.get(Patcher.kt:268)
        at app.revanced.cli.command.PatchCommand.run(PatchCommand.kt:312)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
        at picocli.CommandLine.execute(CommandLine.java:2170)
        at app.revanced.cli.command.MainCommandKt.main(MainCommand.kt:12)
Caused by: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\User\AppData\Local\Temp\brut_util_Jar_128283882703127182132429529068672218130.tmp, compile, --dir, E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\res, --legacy, -o, E:\ANDROID\APPS\ReVanced\Patched\Install\Instagram_332.0.0.38.90-arm64-v8a_360-480_dpi_ReVanced-temporary-files\patcher\apk\build\resources.zip]
        at brut.util.OS.exec(OS.java:104)
        at brut.androlib.AaptInvoker.invokeAapt2(AaptInvoker.java:119)
        ... 13 more

@1fexd
Copy link
Contributor Author

1fexd commented Jun 16, 2024

That's probably an Instagram issue as they do a lot of weird stuff with their apks to try to make reverse engineering harder

@oSumAtrIX
Copy link
Member

This is not an issue with the patch but resource decompilation/AAPT.

@cyberboh
Copy link

Sigh , AAPT again, hopefully it solved in near future.

revanced-bot pushed a commit that referenced this pull request Jun 23, 2024
# [4.10.0](v4.9.0...v4.10.0) (2024-06-23)

### Bug Fixes

* Correct invalid string name ([b84494f](b84494f))
* **YouTube - Client spoof:** Correctly play more livestreams using Android VR ([#3316](#3316)) ([c05264a](c05264a))
* **YouTube - Hide description components:** Replace `Hide game section` and `Hide music section` with `Hide attributes section` ([#3327](#3327)) ([0198a43](0198a43))
* **YouTube Music:** Rename `Minimized playback` to `Remove background playback restrictions` ([#3315](#3315)) ([3c31e55](3c31e55))
* **YouTube:** Rename `Minimized playback` to `Remove background playback restrictions` ([#3314](#3314)) ([37d415b](37d415b))

### Features

* Add `Change version code` patch ([#3338](#3338)) ([685ef39](685ef39))
* **Boost For Reddit:** Add `Fix /s/ links` patch ([#3154](#3154)) ([5fa9fd2](5fa9fd2))
* **Boost for Reddit:** Add `Fix audio missing in video downloads` patch ([#3287](#3287)) ([a9258d4](a9258d4))
* **YouTube - Comments:** Add `Hide 'Create a Short' button` option ([#3333](#3333)) ([be9e244](be9e244))
* **YouTube - Comments:** Add `Hide Thanks button` and `Hide 'Comments by members' header` options ([#3317](#3317)) ([9c4c4f0](9c4c4f0))
* **YouTube - Miniplayer:** Rename `Tablet mini player` and allow selecting the style of the in-app miniplayer ([#3302](#3302)) ([5511736](5511736))
E85Addict pushed a commit to E85Addict/revanced-patches that referenced this pull request Jun 23, 2024
# [4.10.0](v4.9.0...v4.10.0) (2024-06-23)

### Bug Fixes

* Correct invalid string name ([b84494f](b84494f))
* **YouTube - Client spoof:** Correctly play more livestreams using Android VR ([ReVanced#3316](https://github.com/E85Addict/revanced-patches/issues/3316)) ([c05264a](c05264a))
* **YouTube - Hide description components:** Replace `Hide game section` and `Hide music section` with `Hide attributes section` ([ReVanced#3327](https://github.com/E85Addict/revanced-patches/issues/3327)) ([0198a43](0198a43))
* **YouTube Music:** Rename `Minimized playback` to `Remove background playback restrictions` ([ReVanced#3315](https://github.com/E85Addict/revanced-patches/issues/3315)) ([3c31e55](3c31e55))
* **YouTube:** Rename `Minimized playback` to `Remove background playback restrictions` ([ReVanced#3314](https://github.com/E85Addict/revanced-patches/issues/3314)) ([37d415b](37d415b))

### Features

* Add `Change version code` patch ([ReVanced#3338](https://github.com/E85Addict/revanced-patches/issues/3338)) ([685ef39](685ef39))
* **Boost For Reddit:** Add `Fix /s/ links` patch ([ReVanced#3154](https://github.com/E85Addict/revanced-patches/issues/3154)) ([5fa9fd2](5fa9fd2))
* **Boost for Reddit:** Add `Fix audio missing in video downloads` patch ([ReVanced#3287](https://github.com/E85Addict/revanced-patches/issues/3287)) ([a9258d4](a9258d4))
* **YouTube - Comments:** Add `Hide 'Create a Short' button` option ([ReVanced#3333](https://github.com/E85Addict/revanced-patches/issues/3333)) ([be9e244](be9e244))
* **YouTube - Comments:** Add `Hide Thanks button` and `Hide 'Comments by members' header` options ([ReVanced#3317](https://github.com/E85Addict/revanced-patches/issues/3317)) ([9c4c4f0](9c4c4f0))
* **YouTube - Miniplayer:** Rename `Tablet mini player` and allow selecting the style of the in-app miniplayer ([ReVanced#3302](https://github.com/E85Addict/revanced-patches/issues/3302)) ([5511736](5511736))

### Performance Improvements

* Personal Logo && Add upstream sync ([5a86c70](5a86c70))
E85Addict pushed a commit to E85Addict/revanced-patches that referenced this pull request Jul 7, 2024
# [4.10.0](v4.9.0...v4.10.0) (2024-07-07)

### Bug Fixes

* Correct invalid string name ([b84494f](b84494f))
* **YouTube - Client spoof:** Correctly play more livestreams using Android VR ([ReVanced#3316](https://github.com/E85Addict/revanced-patches/issues/3316)) ([c05264a](c05264a))
* **YouTube - Hide description components:** Replace `Hide game section` and `Hide music section` with `Hide attributes section` ([ReVanced#3327](https://github.com/E85Addict/revanced-patches/issues/3327)) ([0198a43](0198a43))
* **YouTube Music:** Rename `Minimized playback` to `Remove background playback restrictions` ([ReVanced#3315](https://github.com/E85Addict/revanced-patches/issues/3315)) ([3c31e55](3c31e55))
* **YouTube:** Rename `Minimized playback` to `Remove background playback restrictions` ([ReVanced#3314](https://github.com/E85Addict/revanced-patches/issues/3314)) ([37d415b](37d415b))

### Features

* Add `Change version code` patch ([ReVanced#3338](https://github.com/E85Addict/revanced-patches/issues/3338)) ([685ef39](685ef39))
* **Boost For Reddit:** Add `Fix /s/ links` patch ([ReVanced#3154](https://github.com/E85Addict/revanced-patches/issues/3154)) ([5fa9fd2](5fa9fd2))
* **Boost for Reddit:** Add `Fix audio missing in video downloads` patch ([ReVanced#3287](https://github.com/E85Addict/revanced-patches/issues/3287)) ([a9258d4](a9258d4))
* **YouTube - Comments:** Add `Hide 'Create a Short' button` option ([ReVanced#3333](https://github.com/E85Addict/revanced-patches/issues/3333)) ([be9e244](be9e244))
* **YouTube - Comments:** Add `Hide Thanks button` and `Hide 'Comments by members' header` options ([ReVanced#3317](https://github.com/E85Addict/revanced-patches/issues/3317)) ([9c4c4f0](9c4c4f0))
* **YouTube - Miniplayer:** Rename `Tablet mini player` and allow selecting the style of the in-app miniplayer ([ReVanced#3302](https://github.com/E85Addict/revanced-patches/issues/3302)) ([5511736](5511736))

### Performance Improvements

* Personal Logo && Add upstream sync ([fc5b72d](fc5b72d))
E85Addict pushed a commit to E85Addict/revanced-patches that referenced this pull request Jul 11, 2024
# [4.10.0](v4.9.0...v4.10.0) (2024-07-11)

### Bug Fixes

* Correct invalid string name ([b84494f](b84494f))
* **YouTube - Client spoof:** Correctly play more livestreams using Android VR ([ReVanced#3316](https://github.com/E85Addict/revanced-patches/issues/3316)) ([c05264a](c05264a))
* **YouTube - Hide description components:** Replace `Hide game section` and `Hide music section` with `Hide attributes section` ([ReVanced#3327](https://github.com/E85Addict/revanced-patches/issues/3327)) ([0198a43](0198a43))
* **YouTube Music:** Rename `Minimized playback` to `Remove background playback restrictions` ([ReVanced#3315](https://github.com/E85Addict/revanced-patches/issues/3315)) ([3c31e55](3c31e55))
* **YouTube:** Rename `Minimized playback` to `Remove background playback restrictions` ([ReVanced#3314](https://github.com/E85Addict/revanced-patches/issues/3314)) ([37d415b](37d415b))

### Features

* Add `Change version code` patch ([ReVanced#3338](https://github.com/E85Addict/revanced-patches/issues/3338)) ([685ef39](685ef39))
* **Boost For Reddit:** Add `Fix /s/ links` patch ([ReVanced#3154](https://github.com/E85Addict/revanced-patches/issues/3154)) ([5fa9fd2](5fa9fd2))
* **Boost for Reddit:** Add `Fix audio missing in video downloads` patch ([ReVanced#3287](https://github.com/E85Addict/revanced-patches/issues/3287)) ([a9258d4](a9258d4))
* **YouTube - Comments:** Add `Hide 'Create a Short' button` option ([ReVanced#3333](https://github.com/E85Addict/revanced-patches/issues/3333)) ([be9e244](be9e244))
* **YouTube - Comments:** Add `Hide Thanks button` and `Hide 'Comments by members' header` options ([ReVanced#3317](https://github.com/E85Addict/revanced-patches/issues/3317)) ([9c4c4f0](9c4c4f0))
* **YouTube - Miniplayer:** Rename `Tablet mini player` and allow selecting the style of the in-app miniplayer ([ReVanced#3302](https://github.com/E85Addict/revanced-patches/issues/3302)) ([5511736](5511736))

### Performance Improvements

* Personal Logo && Add upstream sync ([05677c9](05677c9))
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.

5 participants