Skip to content

feat(Instagram): Add Rename package patch#1259

Closed
Manishrdy wants to merge 1 commit into
crimera:mainfrom
Manishrdy:feat/rename-package-patch
Closed

feat(Instagram): Add Rename package patch#1259
Manishrdy wants to merge 1 commit into
crimera:mainfrom
Manishrdy:feat/rename-package-patch

Conversation

@Manishrdy

Copy link
Copy Markdown

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

  • User-facing bytecodePatch carries two options: packageName
    (default com.pikogram.android) and appLabel (default Pikogram).
    It rewrites com.instagram.* string literals in dex but skips known
    Java class names (collected dynamically from each dex's type
    descriptors), so reflection via Class.forName still resolves.
  • Internal resourcePatch runs in finalize{} and edits the
    manifest: rewrites word-boundary com.instagram references in
    identifier 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 left
    alone so the dex class lookup still works.
  • The new namespace prefix is derived from the user's package by
    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.
  • Requires the user's package to have at least 3 segments (validation
    enforced).

Testing

Tested on com.instagram.android v426.0.0.37.68 on a Galaxy S25 Ultra:

  • Patching completes without smali errors.
  • App launches past WaitingForStringsActivity, reaches the sign-in
    screen, login works.
  • Manifest claims new sibling-namespace authorities under the user's
    prefix, so the official Play Store Instagram installs alongside
    without conflicts.
  • Home-screen icon, install dialog, and App Info all show the user's
    chosen label.

Known caveats

  • No Play Store updates for the clone (expected for any rename).
  • A few Meta cross-product integrations (FCM push from Meta's servers,
    Family Center, deeplinks targeting com.instagram.android) may
    degrade silently — not crashes.
  • Play Protect may warn on install since the icon matches Instagram's
    but the signing cert is the patcher's.

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.
@swakwork

swakwork commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator
  1. Please create PR to dev branch
  2. I feel there exists a lot of AI slop. Please validate it once, by validate i don't mean where the app works or not, validate the code.
  3. I believe cloning might need some smali code changes as well, not just package name change, check that part once.
  4. Change unwanted or over explained comments into human readable comments.
  5. How different is it from the change package name patch that Morphe/other Morphe-aided patches provide.
  6. Do a regression testing once, especially the story part

@Manishrdy

Copy link
Copy Markdown
Author

Thanks for the review. I’ll create a PR against the dev branch.

@Manishrdy Manishrdy closed this Jun 5, 2026
@Manishrdy Manishrdy deleted the feat/rename-package-patch branch June 5, 2026 21:37
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.

2 participants