# Instagram (com.instagram.android) — Features Documentation

## 1. Core Features

Instagram is Meta's primary photo and video social sharing platform. Its core purpose is enabling users to capture, edit, and share visual media (photos, videos, Reels, Stories) with followers and the broader public, while also facilitating direct messaging, social interaction (likes, comments, saves), and commerce. The app is deeply integrated into the broader Meta ecosystem (Facebook, WhatsApp, Threads, Meta Pay, Meta AI, Horizon Worlds).

---

## 2. Feature Categories

### 2.1 Content Feed & Discovery
- **Home Feed** (`feed_timeline` route): Algorithmically ranked photo and video posts from followed accounts and recommendations
- **Reels Tab** (`clips_viewer_clips_tab`, `clips_viewer_homecoming_fyp`): Short-form vertical video feed with For You Page (FYP) discovery
- **Explore / Inspiration Hub** (`https://www.instagram.com/linking/inspiration_hub`): Content discovery surface for trending posts, Reels, and creator content
- **Media Playback**: Variable-speed playback (0.25x, 0.5x, 0.75x, Normal, 1.25x, 1.5x, 2x) via ExoPlayer integration
- **Post Types**: Photo, Video, Reels, Stories (as shown by "Post", "Reels", "Stories", "Media" UI labels)

### 2.2 Camera & Media Capture
- **Instagram Camera** (`MediaCaptureActivity`, "Instagram Camera" UI label): Full-featured in-app camera with multiple shooting modes
  - **Photo mode** ("PHOTO")
  - **Video mode** ("VIDEO")
  - **Boomerang** ("Boomerang") — looping video format
  - **Cinematic** ("Cinematic") — cinematic video mode
  - **Dual** ("Dual") — simultaneous front and rear camera capture
  - **Portrait** ("Portrait") — depth-effect portrait mode
  - **Slow motion** ("Slow motion") — high-frame-rate video
  - **Timer** ("Timer") — countdown timer for hands-free capture
- **Default Camera Mode Setting**: User-selectable default mode on camera launch ("Choose which camera mode to start with when launching the camera next time")
- **Lock Screen Camera**: Capture photos/videos from the device lock screen; media appears in-app and in device gallery ("When you take a photo or video with the lock screen camera, you'll see it here and in your phone's gallery.")
- **Camera Permissions Flow**: Dedicated rationale screens for camera and microphone access ("Allow Instagram to access your camera and microphone", "This lets you share photos, record videos and preview effects.")

### 2.3 Photo & Video Editing (Creation Pipeline)
Implemented via `CreationSession`, `MediaSession`, `PhotoSession`, `VideoSession`, `MediaCaptureActivity`, and the `FilterKit` system.

- **Photo Filters** (`FilterIds.java`): Extensive named filter library including:
  - Classic filters: Amaro, Lo-Fi, Inkwell, Nashville, Mayfair, Moon, Clarendon, Gingham, Lark, Juno, Ludwig, Crema, Aden, Perpetua, Juno, Reyes, Slumber
  - Creative filters: Boomerang, Cinematic, Grainy, Gritty, Halo, Handheld, Hyper, Lo-Res, Moire, Midnight, Emerald, Grayscale
  - Adjustment filters: Fade, Fade Cool, Fade Warm, Boost, Boost Cool, Boost Warm, Color Grading, Color Leak
  - Spark LUT filters (LUT_SPARK_1 through LUT_SPARK_15): 15 premium LUT-based filters
  - Wide Color LUT filters (COLOR_WIDE_LUT_1 through COLOR_WIDE_LUT_26): 26 wide-gamut color grading presets
  - Cinema filters: Cinema Blue, Cinema Red, Crystal Clear, Pastel Pink, Pastel Sky
  - Special event: Oscars 2026 filter set (OSCARS_2026_FRAME, OSCARS_2026_FILTER, OSCARS_2026_CIRCLE_INTRO, OSCARS_2026_PAN, OSCARS_2026_ZOOM, OSCARS_2026_FRAME_IN)
  - Filter intensity slider (0–100% via `PhotoFilter.A00()`/`A03()`)
- **Tilt Shift** (`TiltShiftFilter`): Lens blur/tilt-shift effect with adjustable focal point, blur radius, and shape (linear/radial)
- **Surface Crop / Aspect Ratio** (`SurfaceCropFilter`, `CropInfo`): Precise crop with rotation, scale, flip (X/Y), translation, and fit/fill mode; preserves original dimensions metadata
- **Color Filter Pipeline** (`ColorFilter`, `ValueMapFilterModel`): GPU-accelerated OpenGL ES color grading with transform matrix parameters (scale, rotation, translation, crop, aspect ratio, flipX, flipY, fit mode)
- **Media Edit Action Bar** (`MediaEditActionBar`): Unified editing toolbar during post-capture flow
- **Post-Capture Flow** (`post_capture`, `enter_postcap` navigation routes): Multi-step editing and sharing workflow after media capture
- **NCS Ad Creation Flow** (`creation_flow_is_ncs_ad`): Specialized creation pathway for ad content
- **Pending Media Store** (`PendingMediaStore`): Queues captured media for background processing and upload
- **Media Upload Metadata** (`MediaUploadMetadata`): Tracks upload state, dimensions, filters applied per item

### 2.4 Stories
- **Stories** ("Stories" UI label): Ephemeral 24-hour photo/video content
- **Stories from Facebook** (`https://www.facebook.com/stories/%s/%s`): Cross-platform story viewing
- **Interactive Stickers**:
  - **Quiz Sticker**: 4-option multiple-choice quiz (Options A, B, C, D with hint text "Option 1"–"Option 4")
  - **Reminder Sticker**: "Remind me" functionality for upcoming events (`UpcomingEvent` model)
  - **Media Stickers**: Overlay stickers with legibility gradient rendering (top and bottom gradient color arrays)
- **Notes Feature** (`notes_birthday_trigger_words`, `notes_birthday_blocked_words`): Smart Notes that detect birthday content (triggers: "happy birthday", "hbd", "🎂", "🎉", "🥳", etc.) and suppress grief-related content (blocked words: "rest in peace", "passed away", "💔", "⚰️", etc.)

### 2.5 Reels
- **Reels Creation**: Short-form video creation within the main creation pipeline
- **Reels Viewer** (`clips_viewer_clips_tab`, `clips_viewer_homecoming_fyp`): Full-screen immersive Reels feed
- **Reel Reshare**: Fully immersive reshare with top gradient overlay
- **FYP / Homecoming FYP** (`clips_viewer_homecoming_fyp`): Personalized Reels recommendation surface

### 2.6 Direct Messaging (Instagram Direct)
- **Direct Messaging** ("Direct", "Messages" UI labels; `direct_thread`, `direct_v2/` routes)
- **Group Chats** (`group_chat` route): Multi-participant conversations
- **Thread Management** (`main_chat_thread_id`, `sidechat_thread_id`, `main_chat_id`, `side_chat_id`)
- **Thread Types** (`main_chat_type`): Differentiated thread types (standard, group, AI)
- **Message Reactions**: "Like" and "Reply" actions on messages
- **Live Location Sharing** ("Sharing Live Location" UI label): Real-time GPS location sharing within DMs
- **Meta AI Side Chat** (`direct_v2/create_ig_meta_ai_side_chat/`): Dedicated AI assistant thread within Direct
- **Server Thread Creation** (`create_server_thread_start`, `navigation_to_thread_start`): Server-side thread bootstrapping

### 2.7 Meta AI Integration
- **Meta AI Chat** (`https://aistudio.instagram.com/ai/`): Direct link to AI Studio for AI creator personas
- **Meta AI Side Chat** in Direct Messages: Dedicated AI conversation thread (`has_initiated_chat_with_agent`)
- **AI Agent Interstitial** (`agent_interstitial`): Onboarding/interstitial screen for AI agent introduction
- **AI Activity Card** (`aiifu_netego_activity_card`): AI-surfaced activity notifications
- **Avatar Integration** (`avatar_image_url_string`, `theme_image_url_string`): AI agent avatar display
- **Meta AI Image Generation** (`meta_ai_image_memu_input_prompt_identifiers`): Image generation via prompts "me" and "imagine me" — personalized image generation using the user's likeness
- **Imagine Canvas** (`meta_ai_imagine_canvas_memu_input_prompt_identifiers`): Canvas-based AI image generation surface, also supporting "me"/"imagine me" prompts
- **MLDW Feature Group API** (`https://i.instagram.com/api/v1/mldw/mldw_get_feature_group`): Machine learning feature flag fetching for AI-powered recommendations

### 2.8 Social Interactions
- **Like** ("Like" UI label): Heart/like posts and messages; API endpoint `https://i.instagram.com/api/v1/media/\w+/like/`
- **Unlike**: API endpoint `https://i.instagram.com/api/v1/media/\w+/unlike/`
- **Comment** ("Add a comment for %1$s", "Start the conversation…", "What do you think of this?", "Join the conversation…"): Comment on posts; API `https://i.instagram.com/api/v1/media/\w+/comment/`
  - Comment sorting: "Top comments" or "Newest first"
- **Save / Unsave**: Save posts to collections; API `https://i.instagram.com/api/v1/media/\w+/save/` and `/unsave/`
- **Share** ("Share" UI label): Share posts to Stories, Direct, or external apps
- **Remind Me** ("Remind me"): Set reminders for upcoming events/live content

### 2.9 In-App Commerce & Payments (Meta Pay / Instagram Checkout)
Implemented via `com.instagram.fbpay`, `com.facebookpay.form`, and `PaymentMethodsActivity`.

- **Instagram Checkout** ("Checkout provided by Meta."): Full in-app purchase flow
- **Meta Pay Integration**: Payment processing backed by Meta Pay with Accounts Center sync
- **Add Card** ("Add card", "Add new card"): Credit/debit card entry with card number, MM/YY expiry, CVV, cardholder name
- **Card Scanning** via camera ("Then you'll be able to scan your card."): Camera-based card number recognition
- **Billing Address** ("Add billing address"): Full address form — Street address, Apt/ste, City, State (full 50 US states dropdown), Country
- **Autofill with Meta Pay** ("Autofill with saved info?", "Autofill with card from your ad account?"): Auto-populates payment and contact fields from Meta Pay stored data
- **Save & Autofill** ("Save and Autofill", "Update and Autofill", "Save securely"): Persists payment info to Meta Pay with sync across devices
- **CVV Security**: Encrypted device-local CVV storage ("Your CVV is encrypted and only available for autofill on this device.")
- **Autofill Settings** ("Control your autofill settings", "Turn on autofill"): Configurable in Browser Settings
- **Amazon Account Linking** ("Amazon account successfully linked", "We won't link your Amazon account."): Third-party commerce account linking for Amazon purchases
- **Facebook Basic Card** (`https://www.facebook.com/basiccard`): Facebook payment method integration
- **Payment Validation**: Real-time validation with messages: "Enter valid CVV", "Enter valid expiration", "Enter valid credit card number", "Incorrect CVV"
- **W3C Payment Methods** (`PaymentMethodsActivity`): W3C Payment Request API support in the in-app browser

### 2.10 In-App Browser (Browser Lite)
- **Built-in Browser**: Full WebView-based browser for in-app web content (`com.facebook.browser`)
- **Reader Mode** ("View in reader mode", "Exit reader mode", "Viewing in reader mode"): Distraction-free article reading
- **Page Translation** ("Translate to %1$s", "Web page translated", "Show original language", "%1$s to %2$s"): Auto-translate web pages to user's language
- **Link History** ("Link history. Double tap for a list of links to websites you previously visited."): Browsing history within the in-app browser
- **Browser Controls**: Minimize ("Minimize browser"), Close ("Close browser"), Copy link ("Link copied"), Share, Report website
- **Security Certificate Warning** ("There are problems with the security certificate for this site", "Security error")
- **External App Launch Prompt** ("The website you're viewing is attempting to open an external app. Would you like to continue?", "You're leaving our app")
- **Page Error States** ("Page isn't available right now", "Page can't be loaded", "This may be because of a technical error…")
- **Full Screen Mode** ("You're now viewing full screen. Swipe left or tap back button to exit.")
- **Camera/Microphone/Location Permissions** for web content ("%1$s wants to use your device's camera and microphone.", "%1$s wants to use your device's location.")
- **Dwell Time Tracking** (`BrowserLiteIntent.EXTRA_BROWSER_DWELL_TIME_MS`): Time-on-page analytics
- **Domain Blocklist** (`KEY_BLOCKLIST_DOMAIN`): Content filtering for in-app browser

### 2.11 Nametag
- **Nametag Profile Link** (`https://www.instagram.com/%s/?r=nametag`): Scannable nametag for profile discovery

### 2.12 Augmented Reality (AR)
- **AR Filters & Effects** (`https://www.instagram.com/ar/`): Spark AR-powered camera effects and face filters
- **Meta AI Glasses Integration** (`https://www.meta.com/ai-glasses/link/`, `https://www.meta.com/ai-glasses/shop-all/?auto_enable_vto=true`): Link and shop Meta AI smart glasses; virtual try-on (VTO) support

### 2.13 RTC / Video Calling
- **Video & Audio Calls** (`RtcCallActivity`, `RtcCallIntentHandlerActivity`): Real-time communication via WebRTC (`org.webrtc`) for Instagram Direct calls
- **Live Streaming**: Real-time media streaming (`com.facebook.mediastreaming`)

### 2.14 Cross-Platform & Meta Ecosystem
- **Threads Cross-Posting** ("Threads" UI label): Integration with Threads app
- **Edits App** ("Edits" UI label): Integration with Meta's standalone Edits video editing app
- **Facebook Story Sharing** (`https://www.facebook.com/stories/%s/%s`): Share Instagram content to Facebook Stories
- **Facebook Profile Linking** (`https://m.facebook.com/profile.php?id=%s`): Facebook profile cross-linking
- **Facebook Post Deep Links** (`https://www.facebook.com/%s/posts/%s`): Deep link to Facebook posts
- **WhatsApp Chat Links** (`https://chat.whatsapp.com`, `https://chat.whatsapp.com?source_surface=`): Share to WhatsApp; source surface attribution
- **WhatsApp Account Linking** (`com.whatsapp.accountlinking`): Link Instagram and WhatsApp accounts
- **Accounts Center** (Meta Accounts Center): Unified account management for Meta Pay info across Instagram, Facebook, WhatsApp
- **Meta Wearables** (`com.facebook.wearable`, `com.meta.wearable`, `com.oculus.wearableinputservice`): Integration with Meta wearable devices and Ray-Ban smart glasses (Hera protocol)

### 2.15 Horizon Worlds (Cloud Streaming / Meta Horizon)
- **Horizon Cross-Screen Launcher** (`HorizonCrossScreenLauncher`): Launch Meta Horizon Worlds experiences from within Instagram
- **Cloud Streaming** (`com.facebook.cloudstreaming`, `IGHorizon2DActivity`): Stream Horizon Worlds 2D experiences natively
- **Quickplay Info**: Check if cloud streaming is enabled and "onramps" are available
- **Loading Screen Messages**: 7 sets of themed loading screen text for Horizon worlds including game-specific sets (Kaiju event), world-specific references (Soapstone Comedy Club, Arena Clash, Rooftop 42, Questy's, Factory Defense, Meta Feud, Monster Tag, Regal Boxing, Out of Control, The Land Beyond, Retro Zombies)

### 2.16 Ads & Promotions
- **Quick Promotions** (`QuickPromotionIGInternalSettingsActivity`, `QuickPromotionDevToolV2Activity`): Promotional overlay system with internal dev tooling
- **Ads Feedback** (`AdsFeedbackActivity`): User feedback mechanism for ads
- **Promoted Post Creation** (`creation_flow_is_ncs_ad`): NCS (Non-Content Surface) ad creation flow
- **Ad Account Autofill** ("Autofill with card from your ad account?"): Pre-fill payment from ad account's saved card
- **Papaya API** (`https://i.instagram.com/api/v1/papaya/`): Internal ads/monetization API endpoint
- **Ads Preference Disclosure**: "Depending on your Ad preferences, we may use some of your autofill activity to improve ads."

### 2.17 Notification Settings
- **Notification Settings Handler** (`NotificationSettingsHandlerActivity`): Dedicated activity for managing push notification preferences

### 2.18 Account & URL Handling
- **Account Login URL Handler** (`AccountLoginUrlHandlerActivity`): Deep link handler for account login flows
- **Global URI Handler** (`GlobalUriHandlerActivity`): Central deep link routing for instagram.com and m.instagram.com URLs
- **Email Confirmation** (`https://confirm_email/?nonce=%s&encoded_email=%s`): Email verification deep link handling
- **Spotify OAuth** (`SpotifyWebAuthActivity`): Spotify account linking for music on Stories/Reels
- **Third-Party OAuth** (`FxThirdPartyOAuthBaseActivity`, `FxIgFetchWebAuthDataActivity`): Generic OAuth flow for third-party service linking (e.g., Amazon)

---

## 3. User-Facing Capabilities

| Capability | Description |
|---|---|
| Capture photo/video | In-app camera with 7 modes (Photo, Video, Boomerang, Cinematic, Dual, Portrait, Slow Motion, Timer) |
| Apply filters | 60+ named photo/video filters with intensity control |
| Crop & transform media | Precise crop, rotate, flip, scale with aspect ratio lock |
| Post to feed | Share photos/videos as posts with captions, tags, location |
| Post to Stories | 24-hour ephemeral content with interactive stickers |
| Post Reels | Short-form vertical video with music |
| Send Direct Messages | 1:1 and group chats with media, reactions, live location |
| Chat with Meta AI | AI assistant within Direct Messages |
| Generate AI images | "imagine me" personalized AI image generation |
| Like / Comment / Save | Core social engagement on any post |
| Browse Explore | Discover new content and creators |
| Watch Reels | Infinite scroll short-form video |
| Shop & Checkout | Browse products and complete purchases via Meta Pay |
| Make video calls | WebRTC-based video/audio calls in Direct |
| Launch Horizon Worlds | Stream Meta's social VR experiences via cloud |
| Use AR effects | Apply real-time AR camera filters |
| Share to WhatsApp/Facebook | Cross-post to other Meta platforms |
| Translate web pages | Auto-translate in the built-in browser |
| Link Spotify account | Add music to Stories via Spotify OAuth |
| Scan QR nametag | Discover profiles via scannable nametag |
| Share live location | Real-time GPS sharing in DMs |

---

## 4. Settings & Configuration

### Camera Settings
| Setting | UI Label | Description | Default |
|---|---|---|---|
| Default Camera Mode | "Default Camera Mode" | "Choose which camera mode to start with when launching the camera next time" | Not specified (user-set) |
| Video Recorder Type | "[Internal] Type of Video Recorder" | "Debug only option. Pick which recorder you want to use. Requires app restart" | MediaRecorder |

*Options for Default Camera Mode:* PHOTO, VIDEO, Boomerang, Cinematic, Dual, Portrait, Slow motion, Timer

*Options for Video Recorder:* CustomRecorder, MediaRecorder

### Autofill / Payment Settings
| Setting | UI Label | Description |
|---|---|---|
| Autofill toggle | "Turn on autofill" | Enable/disable Meta Pay autofill for payment and contact forms |
| CVV storage | "Save CVV for future use." | Encrypted on-device CVV storage for autofill |
| Billing address | "Billing address (optional)" | Store billing address with Meta Pay |
| Billing address same as shipping | "Billing address same as shipping" | Toggle to copy shipping address to billing |
| Manage saved info | "Manage your saved info" | Links to Accounts Center to manage Meta Pay stored data |
| Autofill activity for ads | (Disclosed in settings) | "Depending on your Ad preferences, we may use some of your autofill activity to improve ads" |

### Notification Settings
- Managed via `NotificationSettingsHandlerActivity`; specific toggles not enumerated in available source but activity is present as a dedicated handler

### Browser Settings
- Accessible via `browser-settings://` deep link
- Controls: Autofill on/off, stored CVV management, additional autofill settings

### Comments Sorting
| Option | UI Label |
|---|---|
| Top comments | "Top comments" |
| Newest first | "Newest first" |

---

## 5. Background Services

| Service | Key | Description |
|---|---|---|
| FCM Push Token Refresh | `fcm_refresh_push_token_job_service_id` | Periodically refreshes Firebase Cloud Messaging push token to maintain notification delivery |
| Push Registration | `register_push_periodic_job_service_id` | Periodic job to re-register push notification endpoint |
| PushLite Token Refresh | `jobscheduler_pushlist_refresh_token_job` | Secondary push token refresh via JobScheduler |
| Memory Dump Upload | `job_id_upload_task` | Background upload of memory diagnostic data for crash/performance analysis |
| Media Export/Upload | `export_notification_progress_horizontal` | Background media processing and upload with progress notification |
| Pending Media Processing | `PendingMediaStore` | Queues and manages media awaiting upload |
| Session Management | `UserSession` / `endSessionManager` | Manages user authentication session lifecycle with graceful teardown; notifies listeners on session end |
| Mobile Config | `MobileConfigUnsafeContext` | Fetches and applies remote feature flags (booleans, strings, doubles, longs) from Meta's MobileConfig system |
| GraphQL Subscriptions | `GraphQLSubscriptionID` (via `ValueMapFilterModel`) | Real-time subscription updates via GraphQL for live features |
| Traffic Management | `com.facebook.traffic` | Network traffic optimization and routing |

---

## 6. Third-Party Tool & SDK Integrations

### Meta / Facebook SDKs
| SDK | Package | Role |
|---|---|---|
| React Native | `com.facebook.react` | Significant portions of the UI rendered via React Native (1,002+ imports); `IgReactActivity` hosts RN screens |
| Pando | `com.facebook.pando` | Meta's serialization/schema framework (976 imports) |
| HyperThrift | `com.facebook.hyperthrift` | Efficient Thrift-based RPC serialization (970 imports) |
| JNI / Native | `com.facebook.jni`, `com.facebook.simplejni`, `com.facebook.djinni` | Native code bridge; Djinni for cross-language bindings |
| Tigon | `com.facebook.tigon` | Meta's HTTP networking middleware with priority, timeout, retry, and auth handler support (`TigonRequest`) |
| CameraCore / LiteCamera | `com.facebook.cameracore` | GPU-accelerated camera pipeline with OpenGL ES filter rendering, IGLU filter model system |
| Profilo | `com.facebook.profilo` | Performance profiling and tracing |
| Quicklog | `com.facebook.quicklog` | Performance event logging (`QuickPerformanceLogger`) |
| Systrace | `com.facebook.systrace` | Android systrace integration for performance tracing with native and file-based backends |
| MobileConfig | `com.facebook.mobileconfig` | Remote feature flag configuration system (boolean, double, long, string config values) |
| Rsys | `com.facebook.rsys` | Resource system |
| SmartCapture | `com.facebook.smartcapture` | Intelligent media capture optimization |
| GraphQL | `com.facebook.graphql` | GraphQL query execution for data fetching |
| Cloud Streaming / Horizon | `com.facebook.cloudstreaming` | Meta Horizon Worlds 2D streaming backend |
| Wearable / Hera | `com.facebook.wearable`, `com.meta.wearable` | Meta wearable device communication (Ray-Ban glasses, Hera protocol) |
| Oculus Wearable Input | `com.oculus.wearableinputservice` | Oculus/Meta XR device input handling |
| Meta AI | `com.meta.metaai` | Meta AI model inference integration |
| Meta FOA | `com.meta.foa` | Meta's First-Order Approximation / on-device ML |
| Catalyst | `com.facebook.catalyst` | React Native performance optimization |
| MSys | `com.facebook.msys` | Meta systems infrastructure |
| Traffic | `com.facebook.traffic` | Network traffic shaping and optimization |

### Google SDKs
| SDK | Role |
|---|---|
| Google Fonts (`com_google_android_gms_fonts_certs`) | Dynamic font downloading via Google Fonts Provider |
| Google Drive (`https://www.googleapis.com/auth/drive.appdata`) | Google Drive app data scope (used for backup/sync) |
| Google Guava (`com.google.common`) | Common utilities (collections, etc.) — 813 imports |
| Google Gson (`com.google.gson`) | JSON serialization |
| Firebase Cloud Messaging | Push notifications (FCM token management) |

### Third-Party Libraries
| Library | Role |
|---|---|
| Spotify | OAuth account linking (`SpotifyWebAuthActivity`) for music on Reels/Stories |
| Amazon | Account linking for in-app commerce (`Amazon account successfully linked`) |
| WhatsApp | Account linking (`com.whatsapp.accountlinking`) and chat link sharing |
| WebRTC (`org.webrtc`) | Real-time audio/video calling in Instagram Direct |
| ExoPlayer (`exo_controls_playback_speeds`) | Video playback with speed controls (0.25x–2x) |
| Jackson (`com.fasterxml.jackson`) | High-performance JSON parsing |
| Kotlinx Serialization (`kotlinx.serialization`) | Kotlin-native serialization |
| Kotlinx Coroutines (`kotlinx.coroutines`) | Async/concurrent operations |
| Jetpack DataStore | Persistent key-value and typed data storage (replacing SharedPreferences for newer features) |
| Jetpack Compose (`androidx.compose.runtime`) | Declarative UI for newer screens (e.g., `QuickPromotionDevToolV2Activity`) |
| AndroidX WorkManager (`androidx.work`) | Reliable background task execution |
| Redex | Facebook's Android bytecode optimizer (post-compilation dex optimization, 955 imports) |
| microg SafeParcel (`org.microg.safeparcel`) | Parcelable compatibility layer |

---

## 7. Key Workflows / User Journeys

### 7.1 Media Capture and Post Creation
1. User taps camera icon → `MediaCaptureActivity` launches with default camera mode (configurable)
2. User selects mode (Photo/Video/Boomerang/Cinematic/Dual/Portrait/Slow-Mo/Timer)
3. Camera pipeline initializes via `CameraCore`/`LiteCamera` with OpenGL ES rendering
4. User captures media → enters post-capture flow (`post_capture` → `enter_postcap`)
5. `CreationSession` initialized with `MediaSession` (photo or video), crop info, filter state
6. User applies filter from `FilterIds` library with intensity adjustment
7. Optional: apply Tilt Shift (`TiltShiftFilter`), color grading, crop/rotate (`SurfaceCropFilter`)
8. User adds caption, tags, location, music (`AudioMusicParams`, Spotify integration)
9. `PendingMediaStore` queues media → background upload with progress notification

### 7.2 Instagram Direct Messaging with Meta AI
1. User opens Direct → taps compose
2. Can start group chat (`group_chat`) or 1:1 thread (`direct_thread`)
3. Meta AI side chat created via `direct_v2/create_ig_meta_ai_side_chat/`
4. AI agent interstitial shown on first interaction (`agent_interstitial`, `has_initiated_chat_with_agent`)
5. User can share live location ("Sharing Live Location") within any thread
6. Messages support Like ("Like") and Reply ("Reply") reactions

### 7.3 In-App Commerce Checkout
1. User browses shoppable post → taps product
2. In-app browser or native checkout opens
3. Meta Pay checks for saved payment methods
4. If saved: "Autofill with saved info?" prompt — user confirms with CVV ("Enter the 3- or 4-digit security code on your %1$s • %2$s to autofill this form.")
5. If new card: User enters Card Number, MM/YY, CVV, billing address (with camera card scan option)
6. "Save and Autofill" or "Save securely" syncs card to Meta Pay / Accounts Center
7. Order confirmed → "Your account has been successfully linked." for third-party (Amazon) orders

### 7.4 Stories Creation with Interactive Stickers
1. User taps camera → swipes to Stories mode
2. Captures or selects media from gallery
3. Adds interactive stickers: Quiz (4 options A/B/C/D), Reminder, media stickers
4. Notes feature auto-detects birthday content and surfaces birthday-appropriate UI
5. Applies AR effects from Spark AR library
6. Shares to followers or Close Friends; optionally cross-posts to Facebook Stories

### 7.5 Horizon Worlds Cloud Streaming
1. User triggers Horizon entry point from Instagram
2. `HorizonCrossScreenLauncher` checks device capability (`canDeviceLaunchNative`)
3. `IGHorizon2DActivity` launches with cloud streaming backend
4. Loading screen displays rotating messages from 7 themed text sets
5. User's Meta avatar enters the virtual world
6. Session ends via `endClient()` returning to Instagram

### 7.6 Meta AI Image Generation
1. User opens Meta AI chat or AI image surface
2. Types prompt containing "me" or "imagine me" trigger phrases (`meta_ai_image_memu_input_prompt_identifiers`)
3. Personalized image generated using user's profile/likeness
4. Result displayed in Imagine Canvas (`meta_ai_imagine_canvas_memu_input_prompt_identifiers`)
5. User can save, share to Stories/Feed, or send via Direct

### 7.7 Third-Party Account Linking (Spotify / Amazon)
1. User initiates linking from settings or content surface
2. `SpotifyWebAuthActivity` / `FxThirdPartyOAuthBaseActivity` launches OAuth WebView
3. `FxIgFetchWebAuthDataActivity` captures auth token post-redirect
4. Success: "Your account has been successfully linked." / "Amazon account successfully linked"
5. Failure/cancel: "We won't link your Amazon account. You can still make a purchase."