How crimera/piko works
Purpose and Entry Points
Piko is a Morphe patch bundle for modifying Android X/Twitter and Instagram APKM packages. It is not a standalone app: Morphe Manager or CLI loads the built bundle, selects compatible patches, rewrites a target APKM, and installs the resulting app. Build/module entry points are settings.gradle.kts, build.gradle.kts, and patches/build.gradle.kts; published patch metadata is patches-bundle.json and patches-list.json.
Patch Authoring Layer
Kotlin patch definitions locate target-app bytecode/resources through fingerprints and inject hooks, code, or resources. Instagram and X are separate patch domains:
• patches/src/main/kotlin/app/crimera/patches/instagram/misc/extension/SharedExtensionPatch.kt
• patches/src/main/kotlin/app/crimera/patches/twitter/misc/extension/ExtensionPatch.kt
• patches/src/main/kotlin/app/crimera/patches/twitter/ads/timelineEntryHook/TimelineEntryHookPatch.kt
Feature patches commonly depend on foundational entity, settings, resource, or extension patches rather than directly communicating with one another.
Runtime Extension Injection
The patch layer embeds and invokes Android Java extension code inside the patched target process. App initialization hooks establish this boundary; injected code then interacts with target UI/model classes and Android APIs.
• Instagram bootstrap: patches/src/main/kotlin/app/crimera/patches/instagram/misc/extension/hooks/ApplicationInitHook.kt
• Instagram runtime: extensions/instagram/src/main/java/app/morphe/extension/instagram/patches/
• X runtime: extensions/twitter/src/main/java/app/morphe/extension/twitter/patches/
This is the critical compatibility boundary: Kotlin patches target version-specific, often obfuscated app bytecode, while Java extensions execute against the patched app at runtime.
Target-Specific Data and UI Hooks
Entity-generation patches expose otherwise internal Instagram/X objects to extension code; UI patches add settings, menus, buttons, timeline filtering, media actions, and privacy behavior. Examples:
• Instagram media/entity bridge: patches/src/main/kotlin/app/crimera/patches/instagram/entity/mediadata/MediaDataEntity.kt
• Instagram download runtime: extensions/instagram/src/main/java/app/morphe/extension/instagram/patches/download/DownloadUtils.java
• X tweet/entity bridge: patches/src/main/kotlin/app/crimera/patches/twitter/entity/TweetEntityPatch.kt
• X native download runtime: extensions/twitter/src/main/java/app/morphe/extension/twitter/patches/nativeFeatures/downloader/NativeDownloader.java
Typical flow: fingerprint target method → inject call/hook → extension receives target data → applies preferences/logic → alters UI, network-related behavior, or local media handling.
Settings, Resources, and Persistence
Settings patches inject entry points/resources into target apps; extension activities/fragments render controls and persist choices. Shared preferences and backup/restore are runtime-local to the patched application.
• Instagram settings injection: patches/src/main/kotlin/app/crimera/patches/instagram/misc/settings/SettingsPatch.kt
• X settings runtime: extensions/twitter/src/main/java/app/morphe/extension/twitter/settings/Settings.java
• Local preference abstraction: extensions/shared/library/src/main/java/app/morphe/extension/crimera/SharedPref.java
• Localized injected resources: patches/src/main/resources/addresources/values/twitter/strings.xml
Shared Library and Compile-Time Stubs
extensions/shared/library supplies reusable downloader, settings, crash, storage, and request functionality used by target extensions. Stub modules provide compile-time declarations for classes owned by Instagram/X/Material; they are compatibility scaffolding, not bundled replacements.
• Shared downloader: extensions/shared/library/src/main/java/app/morphe/extension/crimera/downloader/MediaDownloader.java
• HTTP abstraction: extensions/shared/library/src/main/java/app/morphe/extension/shared/requests/Requester.java
• X stubs: extensions/twitter/stub/src/main/java/
• Instagram stubs: extensions/instagram/stub/src/main/java/
Build, Distribution, and External Dependencies
The project is Gradle-based Kotlin/Java Android patch code, consumed by the Morphe patching runtime. GitHub Actions builds/releases artifacts; Crowdin workflows synchronize translations. External operational dependencies are Morphe (patch application), original APKM inputs (typically ApkMirror), target-app backends, optional translation providers in the X extension, and Piko-Shim for newer X compatibility.
• Release automation: .github/workflows/release.yml
• Translation configuration: crowdin.yml
• Version mapping references: docs/mappings/435.0.0.37.76.json
Main entry points: DownloadUtils.java Instagram extension runtime · TimelineEntry.java X extension runtime · TweetEntityPatch.kt Entity bridges · SharedExtensionPatch.kt Instagram patch definitions
Components 18
Build & Distribution
- Gradle build · Builds Kotlin patches and Java extension artifacts.
build.gradle.kts - Patches module
patches/build.gradle.kts - Patch bundle metadata
patches-bundle.json - Release workflow
.github/workflows/release.yml
Patch Authoring
- Instagram patch definitions · Fingerprints and rewrites Instagram bytecode/resources.
patches/src/main/kotlin/app/crimera/patches/instagram/misc/extension/SharedExtensionPatch.kt - X patch definitions · Fingerprints and rewrites X bytecode/resources.
patches/src/main/kotlin/app/crimera/patches/twitter/misc/extension/ExtensionPatch.kt - Entity bridges · Expose target app objects to extension code.
patches/src/main/kotlin/app/crimera/patches/twitter/entity/TweetEntityPatch.kt - Settings & resources injection · Adds settings entry points and localized target resources.
patches/src/main/kotlin/app/crimera/patches/instagram/misc/settings/SettingsPatch.kt - Instagram initialization hook · Establishes the patched-process extension boundary.
patches/src/main/kotlin/app/crimera/patches/instagram/misc/extension/hooks/ApplicationInitHook.kt
Injected Runtime
- Instagram extension runtime · Runs injected features inside Instagram.
extensions/instagram/src/main/java/app/morphe/extension/instagram/patches/download/DownloadUtils.java - X extension runtime · Runs injected features inside X.
extensions/twitter/src/main/java/app/morphe/extension/twitter/patches/TimelineEntry.java - Shared extension library · Provides preferences, downloads, storage, crash, and request support.
extensions/shared/library/src/main/java/app/morphe/extension/crimera/downloader/MediaDownloader.java - Runtime preferences · Stores settings and backup data in the patched app.
extensions/shared/library/src/main/java/app/morphe/extension/crimera/SharedPref.java - Target API stubs · Declarations for target-owned classes; not replacement runtime code.
extensions/twitter/stub/src/main/java/com/twitter/api/model/json/core/JsonApiTweet.java
External Systems
- Morphe Manager / CLI · Selects compatible patches and rewrites APKM inputs.
- Original Instagram / X APKM
- Patched installed app · Hosts injected extensions and retains local runtime state.
- Target backends & Android APIs · Runtime hooks can affect UI, network behavior, and media handling.
Connections 24
- Gradle build → Patches module: builds
- Patches module → Patch bundle metadata: publishes
- Release workflow → Patch bundle metadata: releases
- Instagram patch definitions → Patches module: included in
- X patch definitions → Patches module: included in
- Entity bridges → Instagram patch definitions: foundation for features
- Entity bridges → X patch definitions: foundation for features
- Settings & resources injection → Instagram patch definitions: supports features
- Settings & resources injection → X patch definitions: supports features
- Instagram initialization hook → Instagram extension runtime: initializes
- Instagram patch definitions → Instagram extension runtime: embeds and invokes
- X patch definitions → X extension runtime: embeds and invokes
- Entity bridges → Instagram extension runtime: passes target data
- Entity bridges → X extension runtime: passes target data
- Instagram extension runtime → Shared extension library: uses
- X extension runtime → Shared extension library: uses
- Instagram extension runtime → Runtime preferences: persists settings
- X extension runtime → Runtime preferences: persists settings
- Target API stubs → Instagram extension runtime: compiles against
- Target API stubs → X extension runtime: compiles against
- Patch bundle metadata → Morphe Manager / CLI: loaded by
- Original Instagram / X APKM → Morphe Manager / CLI: patch input
- Morphe Manager / CLI → Patched installed app: rewrites and installs
- Patched installed app → Target backends & Android APIs: interacts with