Mobile Development 16 min read

Enhancing Hotfixes for QiYiGuo TV Using Robust and Plugin Mechanisms

To improve QiYiGuo TV’s rapid issue resolution, the team adopted Robust as the core hot‑fix engine and extended it with KRobust to handle reflection, Kotlin methods, enum‑switch mapping, and native‑library swaps, while building an automated deployment platform that now achieves over 95% fix rate and reduces average repair time from three days to under 24 hours across hundreds of channel APKs.

iQIYI Technical Product Team
iQIYI Technical Product Team
iQIYI Technical Product Team
Enhancing Hotfixes for QiYiGuo TV Using Robust and Plugin Mechanisms

QiYiGuo TV is one of the most actively used TV applications, offering rich content playback services. Over the years its functionality has grown, making each release require functional testing, adaptation testing, and gray‑scale online testing, yet online issues still occur and must be fixed quickly, especially for elderly and child users.

The existing plugin mechanism can update the main business but has several limitations: the plugin package is large, TV manufacturers and app stores enforce strict quality checks causing slow rollout, the plugin update only takes effect on the next app start, and the hook‑based approach is invasive and requires extensive adaptation.

We surveyed four mainstream hot‑fix solutions:

1) Hooking native code (e.g., AndFix) – works at runtime but needs adaptation for Dalvik/ART and different CPU architectures.

2) Dex replacement (e.g., Qzone, Tinker) – inserts a patched dex before the original dex; requires a restart to take effect.

3) Instrumentation (e.g., Robust) – inserts a static ChangeQuickRedirect field into each class and redirects method calls to a patch at runtime.

4) JVMTI agents (e.g., iQIYI Jvmfix) – native JVM interface, supported only on Android 8.x and above.

Because of TV‑specific constraints, we selected Robust as the core hot‑fix solution, then extended it to mitigate its drawbacks (dex size increase, limited Kotlin support, no native‑code fixing).

Improvements made to Robust (KRobust)

1. Reflection handling : Robust normally converts method/field accesses to reflection, which can break when loading native libraries (e.g., System.loadLibrary("sodemo") ) because the reflected call loses the proper ClassLoader. By adding java.lang.System to the list in robust.xml , native libraries load correctly.

2. Kotlin support : Kotlin‑generated methods are often public static , so Robust does not reflect them, leading to mismatches when the patch expects a reflected call. We discovered that Kotlin code compiles with public static modifiers, whereas Java does not, explaining the discrepancy.

3. Enum switch mapping : In Kotlin, the generated $EnumSwitchMapping$0 variable was not replaced during the smali‑level regex substitution because the dollar sign is a special regex character. Escaping it (e.g., ->\$EnumSwitchMapping\$0 ) resolves the issue.

4. Native‑code hot‑fix : Although Robust does not directly support native code, we introduced a dynamic‑library‑swap strategy. By inserting the patched .so path at the front of the nativeLibraryPathElements array, the system loads the patched library first.

Patch architecture

The generated patch package contains several classes:

PatchedClassInfo : maps obfuscated class names to their patch controllers.

xxPatchControl : the dispatcher that forwards calls to the actual patch methods.

xxPatch : the concrete patch class where the original method body is copied and all calls/field accesses are transformed to reflection, handling ProGuard obfuscation and inlining.

xxInLinePatch : handles code that disappeared due to inlining.

XXPatchRobustAssist : solves super‑call issues.

Add (annotation): marks classes that should be bundled into the patch.

Developers can also manually write a xxPatch class following the same structure, reducing reliance on the fully automated build when edge cases arise.

Automated deployment

Given the large number of partner TV manufacturers and the need to ship hundreds of APKs, we built an automated deployment platform that integrates the upgrade backend with the packaging system. The platform supports one‑click deployment and gray‑scale rollout, allowing even non‑technical staff to trigger hot‑fixes.

Results and future work

KRobust has been deployed on QiYiGuo TV, achieving a >95% online‑issue fix rate, 99.8% patch download success, 99.97% installation and loading success, and reducing the average fix time from three days to under 24 hours while supporting 300+ channel APKs. Future plans include automatic diff‑based patch generation to further lower the cost of creating patches.

AndroiddeploymentKotlinNative CodehotfixRobust
iQIYI Technical Product Team
Written by

iQIYI Technical Product Team

The technical product team of iQIYI

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.