feat(Instagram): Add Rename package patch#1259
Closed
Manishrdy wants to merge 1 commit into
Closed
Conversation
Renames the patched app's package and label so it installs alongside the
original Instagram instead of replacing it.
Architecture:
- User-facing bytecodePatch carries the packageName and appLabel options
and rewrites com.instagram.* string literals in dex (skipping known
Java class names collected from dex type descriptors, so reflection
via Class.forName still resolves).
- Internal resourcePatch runs in finalize{} and rewrites the manifest:
word-boundary com.instagram references in identifier attributes
(authorities, permissions, intent actions, etc.), launcher
activity-alias labels, and the value of the string resource the
application label already references. Class-reference attributes
(<application android:name>, <activity android:name>, ...) are left
alone — the Java classes stay at their original com.instagram.* paths
in dex.
Requires the user's package to have at least 3 segments. The patch
derives a namespace prefix by stripping the last segment
(com.pikogram.android -> com.pikogram) and applies it to every
word-boundary com.instagram reference, so sibling sub-namespaces like
com.instagram.fileprovider, com.instagram.barcelona.*, and
com.instagram.contentprovider.* also move under the clone's prefix
(unblocking side-by-side install with the Play Store Instagram).
Tested on com.instagram.android v426.0.0.37.68 on Galaxy S25 Ultra:
manifests rename cleanly (77 references), 9,400+ dex string literals
rewritten while 2,440 reflection class refs spared, app launches past
WaitingForStringsActivity, reaches sign-in, and installs alongside the
official Play Store Instagram with no manifest conflicts.
Collaborator
|
Author
|
Thanks for the review. I’ll create a PR against the dev branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new Instagram patch — Rename package — that renames the patched app's
package and visible label so it can be installed alongside the original
Play Store Instagram instead of replacing it.
Why
Currently the only way to use a patched Instagram is to uninstall the
official one. Many users would prefer to keep both — official IG for
"normal" use, patched for the customisations they want.
How it works
bytecodePatchcarries two options:packageName(default
com.pikogram.android) andappLabel(defaultPikogram).It rewrites
com.instagram.*string literals in dex but skips knownJava class names (collected dynamically from each dex's type
descriptors), so reflection via
Class.forNamestill resolves.resourcePatchruns infinalize{}and edits themanifest: rewrites word-boundary
com.instagramreferences inidentifier attributes (authorities, permissions, intent actions,
launcher activity-alias labels) and overrides the string resource the
application label already references. Class-reference attributes
(
<application android:name>,<activity android:name>, …) are leftalone so the dex class lookup still works.
stripping the last segment, so sibling sub-namespaces
(
com.instagram.fileprovider,com.instagram.barcelona.*,com.instagram.contentprovider.*, etc.) also move under the clone —this is what unblocks side-by-side install with Play Store IG.
enforced).
Testing
Tested on
com.instagram.androidv426.0.0.37.68 on a Galaxy S25 Ultra:WaitingForStringsActivity, reaches the sign-inscreen, login works.
prefix, so the official Play Store Instagram installs alongside
without conflicts.
chosen label.
Known caveats
Family Center, deeplinks targeting
com.instagram.android) maydegrade silently — not crashes.
but the signing cert is the patcher's.