Sign up Log in
n/ai · 12d ago · 2k views
u/ypyik0669Diamond3 YEARS
n/aiu/ypyik0669 3 YEARS · 12d ago

How the $0 Gemini Ultra deal works under the hood

The current Google AI Ultra subscription lineup has two tiers:

  • Ultra 5x: includes a 20TB storage quota, regular monthly fee is $99.99;
  • Ultra 20x: includes a 30TB storage quota, regular monthly fee is $199.99.

From normal client interaction, whether you go to the subscription page via web or the Google One mobile app, the frontend UI doesn’t expose any free trial entry—the interface only offers a single upgrade button, which directly opens a full $199.99 charge confirmation popup. But looking at the underlying protocol and billing logic, you can see that the $0 free trial plans for both tiers are actually configured in the data delivered by Google Play Billing (BillingClient)—they’re just hidden or bypassed in the client display layer.

By interacting directly with the billing API, we eventually pulled up the $0 trial flow for both subscription tiers in a test environment (the 5x tier period is 12 months, the 20x tier period is 1 month). This article is a complete technical retrospective of the whole call chain, the parameter discovery process, and the key issues encountered during runtime debugging.

Test environment isolation and approach

Considering the high monthly amount for the higher tier ($199.99), to avoid accidental charges from automated debugging or parameter construction mistakes, the test environment had two layers of isolation:

  1. Runtime isolation: all operations were performed inside the MuMu emulator on macOS, away from a physical device;
  2. Payment risk-control fallback: the payment card bound to the test account only had $3 available balance, so even if the script accidentally triggered full-price billing, the card issuer would decline it for insufficient funds.

The core verification idea was pretty direct: the Google One client already has complete Google Play in-app purchase signature verification and launch permissions. Rather than reverse-engineering the complex obfuscated business logic, it’s better to attach directly to the host process, reuse its context to instantiate and call BillingClient, and enumerate from the Play server all offers attached to the target subscription product.

The basic debug channel used the emulator’s built-in adb to connect to the local 127.0.0.1:16384 instance, and mapped the frida-server listening port to the host:

bash


ADB="/Applications/MuMuPlayer.app/Contents/MacOS/MuMuEmulator.app/Contents/MacOS/tools/adb"

"$ADB" connect 127.0.0.1:16384

"$ADB" -s 127.0.0.1:16384 forward tcp:27042 tcp:27042

Early on, we evaluated a persistent injection approach based on a Magisk module, but found that MuMu’s built-in su binary is deeply customized, and a standard Magisk environment couldn’t mount or patch it. Since this analysis only involved session-level dynamic API calls, we ultimately used Frida (version 17.26.4) to attach directly to the running Google One main process (com.google.android.apps.subscriptions.red).

Injecting BillingClient across class loaders

The first obstacle after attaching to the target process was missing class dependencies: Google One’s APK itself doesn’t statically package the standard BillingClient SDK; its subscription billing capability is supplied dynamically at runtime by external Play services components.

To call the standard billing API directly from a Frida script, we needed to precompile or extract a helper package containing the complete Play Billing library (named module.apk), push it to the device temp directory /data/local/tmp/module.apk. Then, inside the target process, use DexClassLoader to load it into memory, and set the host ClassLoader as the parent loader to bridge context references:

javascript


var DexClassLoader = Java.use("dalvik.system.DexClassLoader");

var dexLoader = DexClassLoader.$new(

"/data/local/tmp/module.apk",

    context.getCodeCacheDir().getAbsolutePath(),

null,

    context.getClassLoader()

);

Java.classFactory.loader = dexLoader;

Once the library was ready, the standard business call chain had four steps:

  1. Call startConnection() to establish an async binding with the Play Billing service;
  2. Pass in the target product ID and execute queryProductDetailsAsync to pull full product metadata;
  3. Iterate through the getSubscriptionOfferDetails() list in the returned result, find the record containing a free trial phase with the longest period, and extract the corresponding offerToken;
  4. Construct billing parameters and call launchBillingFlow() to bring up the Google Play system-level payment confirmation panel.

Runtime debugging and troubleshooting notes

From the theoretical call chain to a script that ran stably, we hit several typical issues at the execution level caused by framework versions, type mapping, and Android’s threading model:

1. Frida CLI flag change

In version 17.26.4, Frida officially removed the old commonly used --no-pause startup flag. Carrying that parameter out of habit from older commands causes the process attach stage to throw and exit; remove the redundant flag and injection works normally.

2. JNI long type bridging trap in the JS engine

When parsing the Pricing Phase and filtering free items, the underlying return type of getPriceAmountMicros() is Java’s native long. After Frida’s Java bridge converts it to the JavaScript runtime, the value is wrapped as a specific object instance instead of a native number. If you directly use strict equality (micros === 0) to filter, the condition will always be false, causing every entry whose log plainly says “free” to be missed. You need to use loose equality or explicit string serialization for the check:

javascript


if (micros == 0 || String(micros) === "0") {

// Hit the $0 free billing phase

}

3. Multi-ClassLoader context switching conflicts

After pointing Java.classFactory.loader to the custom dexLoader, although it can resolve the BillingClient-related classes in the external module.apk fine, when trying to get system framework classes like android.os.Handler and android.os.Looper, improper loader delegation can easily trigger ClassNotFoundException. The safe approach is to temporarily reset the loader to the default context before resolving system classes, then switch back to the custom loader after instantiation:

javascript


Java.classFactory.loader = null;

var launchHandler = Handler.$new(Looper.getMainLooper());

Java.classFactory.loader = dexLoader;

4. UI thread constraints and Activity lifecycle management

launchBillingFlow() involves bringing up a system-level interaction window, and strictly requires execution in the main thread (UI Thread) context. Early on, calling it directly from the async worker callback of queryProductDetailsAsync caused a rendering exception and made the whole emulator go black. The solution was to wrap parameter assembly and the launch action in a Runnable, and post it back to the main thread via Handler.post(...) bound to MainLooper.

At the same time, the host Activity instance passed to launchBillingFlow() cannot be statically cached during script initialization. Page navigation or configuration changes can invalidate the old instance at any time, so when the async callback actually fires, you must dynamically reflect over the ActivityThread.currentActivityThread().mActivities map and filter in real time for an active foreground Activity reference (neither isFinishing() nor isDestroyed()) to ensure the window token is valid.

5. Coordinate calibration for automated view clicks

During semi-automated debugging, the script needed to help trigger the upgrade entry on the UI. Initially we relied on manually estimated absolute pixel coordinates and ran three simulated clicks in a row, all of which were off; one accidentally hit the “annual payment” toggle tab and shifted the whole page state. Later we used uiautomator dump to export the current view hierarchy XML, precisely parsed the target widget’s bounds rectangle, and calculated the center coordinates, completely eliminating misclicks.

Ultra 5x verification and tracking down the 20x product identifier

1. Ultra 5x tier baseline test

First, we verified the Ultra 5x tier with the known product ID g1.play.20tb. After calling queryProductDetailsAsync, the server delivered 5 available configurations at once:

  • 4 promotional trial plans: eft-1month, eft-3month, eft-6month, eft-12month (first billing cycle is $0, renews at $99.99/month after the trial ends);
  • 1 standard subscription plan: a base monthly item with no free period.

The script selected the longest eft-12month, extracted the offerToken, and launched the billing panel. After confirming the first billing phase (Phase[0]) amount was $0, we submitted it and successfully activated a 12-month Ultra 5x subscription.

2. Static analysis blocked when locating the 20x SKU

When moving to the Ultra 20x tier, the main bottleneck was the lack of a corresponding product ID. Regular static search tried two paths, neither of which produced a valid result:

First, extract the local SQLite cache database StoragePlansDataCache.db from the app’s private directory, export the dump text, and filter by prefix:

bash


"$ADB" shell "su -c 'cat /data/data/com.google.android.apps.subscriptions.red/databases/StoragePlansDataCache.db'" > /tmp/plans.db

sqlite3 /tmp/plans.db ".dump" | strings | grep "g1\\."

The database tables only contained regular mid/low tiers and regional promo identifiers, such as g1.100gb (100GB), g1.200gb (200GB), g1.helium (400GB), g1.2tb (2TB), g1.2tb.ai (5TB), and regionally discounted suffixes like g1.100gb.3months_ip_85p.acq—no record of the 30TB tier.

Second, we used jadx to decompile and search the host APK. Code review showed the client only hardcodes basic plans like g1.100gb in the fallback defaults of Phenotype config flags (for example, the Flag numbered 45684818 in yfd.java). The actual SKU for higher-tier subscriptions relies entirely on server-side dynamic delivery through the Phenotype framework; there are no plaintext constants in the DEX bytecode. Also note a toolchain detail: when jadx handles top-level obfuscated classes without a package name, it automatically prepends a virtual package prefix p000. (shown as p000.wso). When writing Frida Hook scripts, you must strip that pseudo-prefix and pass the bare class name wso; otherwise you’ll also get a class-not-found exception at runtime.

Dynamic instrumentation and dictionary enumeration to recover the hidden SKU

Since static resources left no clues, the analysis focus shifted to runtime data flow capture. By mounting lightweight hooks on the generic key-value container write methods (JSONObject.put and Bundle.putString) inside the process, logging the call stack and arguments for calls whose key name matched productId, skuId, or product_id, we then manually clicked the 20x tier upgrade button in the client UI.

At the moment of the click, the console successfully captured the identifier the client actually requested: g1.ai.pro.

However, after plugging g1.ai.pro into the BillingClient query script, the API returned only a single $199.99 full-price standard subscription item, with no trial Offer attached.

Given the external knowledge that 20x trial instances exist, we can infer that the SKU bound to the client frontend button and the SKU actually carrying the promo activity are not the same item. Comparing the known naming samples (trial g1.play.20tb, regular tier g1.2tb.ai, and frontend-captured g1.ai.pro), an obvious root-word combination pattern emerges. So the test switched to a brand-new emulator instance and logged in with a clean account that had no subscription history, generated a dictionary of twenty-plus candidate IDs based on root-word permutations, and passed them all at once to queryProductDetailsAsync for batch probing (the Play billing API automatically ignores nonexistent invalid IDs and returns metadata only for valid entries).

The batch enumeration ultimately hit three valid product IDs, all under the 30TB (Ultra 20x) spec. The attribute comparison is as follows:

Product ID Regular monthly fee Trial configuration delivered Attribute notes
g1.ai.pro $199.99 No trial item The production SKU bound by default to the client frontend “upgrade” button
g1.30tb $149.99 No trial item Another 30TB pure storage/subscription spec under an independent pricing system
g1.play.ai.pro $199.99 Includes 4 trial Offers The target SKU carrying the promo strategy, tagged eft,genaipro,play,promotional

The data comparison clearly explains why the frontend can’t trigger the trial: Google maintains three independent SKUs in parallel for the same 30TB level, and the client UI routing is hardcoded to g1.ai.pro, which has no promo configuration. The one actually carrying the free trial policy is g1.play.ai.pro, which embeds the .play. namespace. Also, the two tiers have split naming conventions for internal promo IDs (offerId): the 5x tier uses full word spellings (eft-1month to eft-12month), while the 20x tier abbreviates them to eft-1mo, eft-3mo, eft-6mo, and eft-12mo.

From the current samples (g1.play.20tb and g1.play.ai.pro), SKUs with the .play. infix often correspond to the Play channel-exclusive promo configuration pool. Although two samples aren’t enough to establish a global rule, it’s enough as a priority probing direction when digging into similar new subscription tiers later.

This also explains why the previous test account couldn’t observe the 20x trial item in the local cache or API: that account was already within an active Ultra 5x subscription period, and when calculating eligibility, the server directly trims the trial Offer list for accounts that already hold a subscription.

Eligibility risk-control checks and testing with a new account

After obtaining the target identifier g1.play.ai.pro, the first brand-new test account triggered a server risk-control block when launching verification: passing the 12-month eft-12mo directly errored as not meeting the conditions; downgrading to the 1-month eft-1mo, the Google Play billing panel did pop up, but the top showed a clear blocking message:

You’re not eligible for the free trial, but you can still subscribe

At that point the dialog only offered a “Got it” confirmation at the bottom, and the billing amount fell back to the full price of $199.99. To avoid unexpected pre-authorization or risk-control records, the test stopped here and closed the panel.

After checking the account environment differences, we switched to a second brand-new test account that had completed the prerequisite setup, and reran with exactly the same script logic and eft-1mo parameter. This time the request passed the server eligibility check, the Play billing window correctly rendered the first-period $0 free trial bill details, and after manual confirmation the Ultra 20x subscription was successfully activated.

Combining multiple controlled experiments, we can identify two hard prerequisites for the Google Play server to allow Ultra 20x free trial eligibility:

  1. Valid payment method bound: the account must have a usable payment channel pre-bound before initiating the billing request; new accounts missing a payment method are directly downgraded to the full-price prompt popup at the launch stage;
  2. No conflicting subscription state: the account must not currently hold an active Google One subscription under the same system; existing subscription status directly removes access to the new trial at the API query or billing verification stage.

One more debugging detail: during testing, we wrote a separate helper script to call BillingClient’s purchase history/current purchase query API after activation to verify subscription status in code, but after the script output the Connected ready log, the async callback never fired a return. So the final activation confirmation was still based on the $0 phase display in the official Play billing panel and the status change in the account subscription center.

Follow-up handling notes

The activated Ultra 20x trial period is 1 month; after it expires, the system will automatically initiate renewal billing at the standard rate of $199.99/month. Although the $3 balance left on the test card is enough to trigger payment failure protection on the billing date, to avoid Google payment profile freezing or account risk-control downgrade due to repeated failed charges, after testing you need to manually go to the subscription management page and cancel renewal before the period ends.

Translated by AI from 简体中文

11
2
Log into join the discussion.

2 replies

Sort order
  1. gugugaga Gold 3 YEARS 12d ago

    They won't take it back later, right? Same fate as that two-year bug last time.

    Translated by AI from 简体中文

    1
  2. James 💯 Legend MANAGER 12d ago

    This is a solid in-depth technical write-up.

    Translated by AI from 简体中文

    1