Anonymous Inner Class Dispatch in Android App Bundle

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

During the process of bundling an Android App Bundle (AAB), anonymous inner classes generated after class merging and desugaring are uniformly bundled into the base code resource bundle, leading to unnecessary code files and incorrect sub-bundling, which results in an inefficient base code resource bundle.

Innovation Solution

A method and apparatus that parse file name identifying information of anonymous inner class files to determine their associated code resource bundles and dispatch them correctly, ensuring they are bundled into the appropriate resource modules, thereby optimizing the base code resource bundle.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of manufacture

If anonymous inner classes are uniformly bundled into the base code resource bundle, then the bundling process is simple, but the base code resource bundle contains unnecessary code files and sub-bundling is incorrect

Engineering Contradiction:
Improvebunding process simplicityVSAvoidsub-bundling accuracy
Core Design Contradiction:
Ease of manufactureVSManufacturing precision

Solution Approach 1:

The patent segments anonymous inner classes into different bundles based on their source module. By parsing the class file's package name and comparing it with the original module's package name, the system divides anonymous inner classes into base module classes (belonging to base code resource bundle) and adaptive function module classes (belonging to adaptive function resource bundle), thus achieving accurate sub-bundling.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary analysis of anonymous inner classes before final bundling. It parses the class file's package name, identifies the source module, and determines the correct target bundle in advance, so that when bundling occurs, the classes are already categorized and can be placed in the correct bundle without unnecessary code.

Inventive Principle:
Principle #10Preliminary action

2Device complexity

If anonymous inner classes are uniformly bundled into the base code resource bundle, then the processing method is straightforward, but the base code resource bundle size increases with unnecessary code

Engineering Contradiction:
Improveprocessing method complexityVSAvoidbase code resource bundle size
Core Design Contradiction:
Device complexityVSQuantity of substance

Solution Approach 1:

The patent segments anonymous inner classes based on their source module origin. By analyzing the package name in the class file and comparing it with the original module's package name, the system separates classes into base module and adaptive function module categories, placing them in appropriate bundles to reduce base code resource bundle size.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent extracts adaptive function module anonymous inner classes from the base code resource bundle. By identifying classes whose package names match adaptive function modules, the system removes these classes from the base bundle and places them in the adaptive function resource bundle, thereby reducing unnecessary code in the base bundle.

Inventive Principle:
Principle #2Taking out (Extraction)

3Productivity

If anonymous inner classes are uniformly bundled into the base code resource bundle, then no additional processing is needed, but code dispatching becomes inefficient

Engineering Contradiction:
Improvebunding efficiencyVSAvoidcode dispatching time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The patent performs preliminary categorization of anonymous inner classes by parsing their package names and identifying source modules before bundling. This advance classification ensures that classes are pre-organized into base module and adaptive function module groups, enabling efficient dispatching during runtime without requiring additional processing later.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent segments anonymous inner classes into distinct groups based on their source module origin. By creating separate categories for base module classes and adaptive function module classes during the bundling process, the system establishes an efficient dispatching structure that reduces code dispatching time during runtime.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS20240330016A1Class file processing method and apparatus, device, medium, and product
Publication Date: 2024.10.03 BEIJING ZITIAO NETWORK TECH CO LTD
  • US20240330016A1 patent drawing
  • US20240330016A1 patent drawing
  • US20240330016A1 patent drawing

AI summary

Embodiments of the present disclosure disclose a class file processing method and apparatus, a device, a medium, and a product. The method includes: obtaining respective anonymous inner class files generated after performing class file merging and compiling on respective class files in an AAR file of a target application program, and parsing file name identifying information of the respective anonymous inner class files; determining associated code resource bundles of the respective corresponding anonymous inner class files based on parsing results of the file name identifying information; and in response to that the associated code resource bundle of one anonymous inner class file is inconsistent with a code resource bundle where the one anonymous inner class file is currently located, dispatching the one anonymous inner class file into the corresponding associated code resource bundle.