A dual-path conditional branch event routing method based on RTC state awareness
Patent Information
- Application Number
- CN202611191526.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-07
- Publication Date
- 2026-09-15
Smart Images

Figure CN122764705A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of information processing technology, specifically relating to a dual-path conditional branch event routing method based on RTC state awareness. Background Technology
[0002] Commercial navigation engines hardcode the display and behavior of all UI (User Interface) elements in their native C++ rendering layer. The Java layer cannot control the visibility of native buttons, click event routing, or custom response logic. Enterprises cannot redefine specific buttons in the navigation interface as entry points for enterprise services, such as making customer service calls; they cannot customize their branding (modify the product names and logos displayed by the navigation engine); and they cannot remove unnecessary function entry points.
[0003] The core map rendering and UI components of commercial navigation applications are driven by a native C / C++ engine via JNI (Java Native Interface). The native engine directly manipulates a special view component with an independent drawing surface and view click listeners for GPU (Graphics Processing Unit) accelerated rendering, with the Java layer acting only as a thin wrapper providing lifecycle management. When a user clicks a UI button rendered by the native engine (such as the "Feedback" button), the native engine calls the Java layer's event notification method via JNI, instead of using Android's standard view click listener callback. This architectural design leads to the following technical challenges:
[0004] (1) Complete interception of dual-path event notifications: Through reverse engineering of the GFrame engine, i.e., decompiling libcmb_Common.so using IDA Pro, the inventors of this invention discovered that the native engine has two independent Java layer notification paths when triggering UI events: Path A is implemented by statically calling the view components related to the management navigation interface; Path B is implemented by calling the callback method of the interface instance of the problem feedback and conflict handling interface. The existing technical solution only discovers and intercepts Path A, while Path B still executes the original logic, resulting in incomplete interception of button events. That is, after the user clicks the button, although Path A is intercepted and a custom dialog box pops up, Path B still executes the original "set feedback preferences → page jump" logic, causing interface abnormalities.
[0005] (2) Resource conflict between RTC (Real-Time Communication) call state and UI overlay: When the system is in RTC audio and video call state, the RTC engine holds the audio focus of the audio manager (AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE, which briefly monopolizes the audio focus) and the SurfaceView layer of video rendering. If a custom dialog box pops up at this time (using the TYPE_APPLICATION_OVERLAY window type, i.e., the application overlay window), it will cause a Z-order (stack order) layer conflict with the RTC video rendering window, which may lead to the following failures: (a) The dialog box covers the RTC video preview screen, affecting the administrator's observation of the driver's status; (b) The dialog box acquiring the audio focus causes the audio acquisition / playback of the RTC engine to be interrupted; (c) On some Android devices, the window layer conflict will trigger the WindowManager's ANR (Application Not Responding) detection, causing the application to be forcibly terminated by the system.
[0006] (3) Access permission verification across DEX (Data Execution Prevention) packages: Since the code of the original navigation application is located in the primary DEX executable file (classes.dex), while the extended code of this invention is located in the secondary DEX files (classes2.dex, classes3.dex), they belong to different DEX files. When the extended code (such as the status field FeedbackDialogRunnable, which indicates whether the user is "in an RTC call room", located in the smali / package path of the feedback dialog running task class) needs to access RTC status fields (such as the feedback pop-up thread task rtcInRoom, located in the login and status monitoring interface component Login12024Activity in the Smali assembly code directory smali_classes2 / package path of the DEX file), the Android ART runtime's AccessibilityVerifier will check the access modifier of the field. If the RTC status field is declared as private or package-private, cross-package access will result in a runtime exception. Summary of the Invention
[0007] To address the shortcomings of existing technologies, this application proposes a dual-path conditional branch event routing method based on RTC state awareness. It achieves complete interception of dual-path event notifications from the native C++ engine and dynamically switches the interception strategy according to the RTC call status: a custom dialog box pops up when not in a call, and the pop-up is skipped during a call to avoid resource conflicts. It also solves the cross-DEX package access permission issue.
[0008] In a first aspect, the present invention provides a dual-path conditional branch event routing method based on RTC state awareness, comprising:
[0009] Retrieve button click events in commercial navigation;
[0010] Analyze the button click event to obtain the JNI call chain of the button click event;
[0011] Based on the JNI call chain, the Java layer notification path is obtained, which includes: static method path and interface method path;
[0012] Intercepting button click events for static method paths includes: obtaining the layer pop-up configuration object, and determining whether to intercept the button click event based on the flag for enabling and displaying the feedback button in the layer pop-up configuration object;
[0013] Intercepting button click events for the interface method path includes: intercepting button click events based on the conditional branch of the RTC call status in the layer pop-up configuration information of the interface method path.
[0014] The analysis of the button click event, obtaining the JNI call chain of the button click event, includes:
[0015] The button click event was analyzed using reverse engineering of the GFrame engine core library to locate the JNI call chain of the button click event in the native code.
[0016] The conditional branch based on RTC call status intercepts button click events, including:
[0017] If the device is not currently in an RTC call, the layer pop-up configuration object is returned in the layer pop-up configuration information. The layer pop-up configuration object includes: setting "Enable and display feedback button" to "True", causing the native engine to route the event to the Java callback function; setting "Do not display red dot prompt" to "No"; setting "Disable or not need pop-up window" to "False", so that the interceptor in the Java callback function pops up a custom dialog box; the interceptor in the Java callback function pops up a custom dialog box on the main thread through the message queue of the associated thread.
[0018] If the device is currently in an RTC call, the layer pop-up configuration information will return "No results found". Upon receiving "No results found", the native engine skips the layer pop-up configuration information processing branch, and button click events are intercepted.
[0019] A dual-path conditional branch event routing method based on RTC state awareness further includes:
[0020] Set up safety mechanisms in Java callback function interceptors, including: debouncing timestamps and preventing static reference stacking.
[0021] The debounce timestamp includes: setting a first static field to record the debounce timestamp of the last pop-up custom dialog box; based on the debounce timestamp, if the pop-up time of the current custom dialog box is less than the pop-up time of the last pop-up, then the pop-up request of the current custom dialog box is ignored.
[0022] The static reference anti-stacking mechanism includes: setting a second static field to retain a reference to the currently active custom dialog box; between the creation of a new custom dialog box, if the second static field is not empty and the currently active custom dialog box is still displayed, then the old custom dialog box is closed first, and then a new custom dialog box is created and the second static field is updated.
[0023] A dual-path conditional branch event routing method based on RTC state awareness further includes:
[0024] The code for an RTC-state-aware dual-path conditional branch event routing method is placed in an auxiliary file of a secondary DEX file. By using Java reflection, the corresponding field objects are dynamically obtained and access restrictions are removed when the code for the RTC-state-aware dual-path conditional branch event routing method is executed.
[0025] The method of dynamically obtaining corresponding field objects and removing access restrictions when running code for a two-path conditional branch event routing method based on RTC state awareness using Java reflection includes:
[0026] A target class for a dual-path conditional branch event routing method based on RTC state awareness is dynamically loaded. The target class includes a corresponding class for RTC call state.
[0027] Get the field object of the target class;
[0028] Set the accessibility of the target class's field object to "true";
[0029] Dynamically retrieve the boolean value of a field object of the target class.
[0030] Thirdly, this application proposes an electronic device, including: one or more processors, and a memory for storing instructions, which, when executed by the one or more processors, cause the one or more processors to execute the aforementioned RTC state-aware dual-path conditional branch event routing method.
[0031] Fourthly, this application proposes a computer-readable storage medium storing executable instructions that, when executed, cause a processor to perform the aforementioned RTC state-aware dual-path conditional branch event routing method.
[0032] Beneficial effects:
[0033] This application proposes a dual-path conditional branch event routing method based on RTC state awareness. It discovers and simultaneously intercepts two event notification mechanisms: the static method path and the interface method path of the native engine. An RTC call state conditional branch is introduced into the event query methods of both paths. When not in a call, valid event information is returned, routing the event to a custom Java layer handler. During a call, a null value is returned, causing the native engine to skip event processing, avoiding resource conflicts with the RTC engine. Existing solutions for modifying the UI behavior of the native engine typically employ a "full interception" strategy (unconditionally blocking all events), without considering the impact of the application's current running state on the interception strategy. This invention introduces the concept of "state-aware conditional branch routing" for the first time, dynamically selecting the interception strategy based on the RTC call state, achieving more refined and secure event management. This invention solves the problems that enterprises cannot redefine specific buttons in the navigation interface as enterprise service entry points, cannot customize brands, and cannot trim unnecessary function entry points. Attached Figure Description
[0034] Figure 1 A flowchart of a dual-path conditional branch event routing method based on RTC state awareness according to an embodiment of the present invention;
[0035] Figure 2 A schematic diagram of a dual-path conditional branch event routing method based on RTC state awareness according to an embodiment of the present invention. Detailed Implementation
[0036] The specific implementation methods of this application will be further described in detail below with reference to the accompanying drawings and embodiments.
[0037] This invention proposes a dual-path conditional branch event routing method based on RTC state awareness. This method securely intercepts UI events within a compiled native C++ rendering engine and dynamically switches the interception logic based on the RTC call state. This method is the first to discover and completely intercept the dual-path event notification mechanism of the GFrame (Go Frame, Go language framework) engine, and introduces call state conditional branches to avoid resource conflicts with the RTC engine.
[0038] Example 1:
[0039] This embodiment provides a dual-path conditional branch event routing method based on RTC state awareness, such as... Figure 1 , Figure 2 As shown, it includes:
[0040] Step S1: Obtain button click events in the commercial navigation;
[0041] Step S2: Analyze the button click event to obtain the JNI call chain of the button click event, including:
[0042] The button click event was analyzed using reverse engineering from the GFrame engine core library to locate the JNI (Java Native Interface) call chain of the button click event in the native code.
[0043] Step S3: Obtain the Java layer notification path based on the JNI call chain. The Java layer notification path includes: static method path and interface method path.
[0044] In this embodiment, through reverse engineering analysis of the GFrame engine core library libcmb_Common.so (using IDA Pro 7.7 + Hex-Rays Decompiler), the JNI call chain of UI button click events in the native code was located. Analysis confirmed the existence of two independent Java layer notification paths:
[0045] Path A (static method path): The native code (code written in assembly language) calls the static method "problem feedback and conflict user event notification" in the bridge class under the map navigation view package through the JNI function "call static method with no return value" (i.e., CallStaticVoidMethod). Specifically:
[0046] That is, the static method com.amap.api.navi.view.IssueClusionNative.issueClusionUserEventNotify(int eventType).
[0047] Path B (Interface Method Path): The native code uses the JNI function "Call Instance Method with No Return Value" to call a member method in the "Issue Feedback and Conflict Resolution Interface Instance (sIssueClusionInterface)". Specifically:
[0048] The `CallVoidMethod` calls the `a(int eventType)` method of the `sIssueClusionInterface` field (an interface of type `zo$b`). The `a(I)V` method in the implementation class of this interface also executes the logic of "getting PopupInfo → setting feedback preferences → triggering page redirection".
[0049] The existing technical solution only intercepts path A and modifies the Smali assembly code corresponding to the static method, specifically by adding a `return-void` directive at the method entry point of `issueClusionUserEventNotify`. However, path B still executes the original logic completely. This results in a "double response" exception when the user clicks the button: path A is intercepted and no action is taken, but path B still triggers a page redirect, ultimately causing the interface to redirect to the original feedback page (instead of the expected custom dialog box) after the button is clicked.
[0050] Step S4: Intercept button click events for static method paths, including: obtaining the layer pop-up configuration object, and determining whether to intercept button click events based on the flag for enabling and displaying feedback buttons in the layer pop-up configuration object;
[0051] In this embodiment, button click events are intercepted for static method paths. In the original implementation of the Java layer, issueClusionPopInfo() is called to obtain the layer pop-up configuration object (i.e., the PopupInfo object). Based on the flag of enabling and displaying the feedback button (i.e., isShowFeedbackBtn) in the layer pop-up configuration information (i.e., PopupInfo), it is determined whether to set feedback preferences and jump to the feedback page, that is, to intercept the button click events.
[0052] Step S5: Intercept button click events for the interface method path, including: intercepting button click events based on the conditional branch of the RTC call status in the layer pop-up configuration information of the interface method path.
[0053] The conditional branch based on RTC call status intercepts button click events, including:
[0054] If the device is not currently in an RTC call, the layer pop-up configuration object is returned in the layer pop-up configuration information. The layer pop-up configuration object includes: setting "Enable and display feedback button" to "True", causing the native engine to route the event to the Java callback function; setting "Do not display red dot prompt" to "No"; setting "Disable or not need pop-up window" to "False", so that the interceptor in the Java callback function pops up a custom dialog box; the interceptor in the Java callback function pops up a custom dialog box on the main thread through the message queue of the associated thread.
[0055] If the device is currently in an RTC call, the layer pop-up configuration information will return "No results found". Upon receiving "No results found", the native engine skips the layer pop-up configuration information processing branch, and button click events are intercepted.
[0056] In this embodiment, the present invention introduces an RTC call status conditional branch in the PopupInfo query method for both paths:
[0057] Branch A (Event routing when the device is not currently in an RTC call, i.e., when it is not in a call state): When the rtcInRoom and rtcProcessing fields of Login12024Activity are both false (i.e., the device is not currently in an RTC call), the PopupInfo (i.e., layer pop-up configuration information) query method returns a carefully constructed PopupInfo object (i.e., layer pop-up configuration object): isShowFeedbackBtn (enable and display feedback button) is set to true (cause the native engine to route the event to the Java callback function instead of handling it directly in the native layer), isShowRedDot (whether to display red dot prompts) is set to false (do not display red dot prompts to avoid visual interference), and isNeedPopup (disable or do not need pop-ups) is set to false (do not trigger native pop-ups, and the Java layer interceptor will pop up a custom dialog box). When the interceptor (FeedbackDialogRunnable) in the Java callback function receives the callback, it pops up a custom AlertDialog on the main thread via the message queue Handler.post(Runnable) to display the company's customer service phone number and a one-click dial button.
[0058] Branch B (Safe bypass when the device is currently in an RTC call, i.e., during a call): When rtcInRoom or rtcProcessing is true, the PopupInfo query method returns null (i.e., no result was found). The native engine skips the PopupInfo processing branch upon receiving null, and the button click event is silently consumed. This design avoids the following conflicts: (a) Z-order hierarchy conflict between the TYPE_APPLICATION_OVERLAY (system-level application floating window type) floating window and the RTC video SurfaceView; (b) AlertDialog gaining focus causing the RTC engine's AudioManager focus to be preempted; (c) Thread contention between dialog creation / destruction operations and the RTC engine's media thread.
[0059] A dual-path conditional branch event routing method based on RTC state awareness further includes:
[0060] Set up safety mechanisms in Java callback function interceptors, including: debouncing timestamps and preventing static reference stacking.
[0061] The debounce timestamp includes: setting a first static field to record the debounce timestamp of the last pop-up custom dialog box; based on the debounce timestamp, if the pop-up time of the current custom dialog box is less than the pop-up time of the last pop-up, then the pop-up request of the current custom dialog box is ignored.
[0062] The static reference anti-stacking mechanism includes: setting a second static field to retain a reference to the currently active custom dialog box; between the creation of a new custom dialog box, if the second static field is not empty and the currently active custom dialog box is still displayed, then the old custom dialog box is closed first, and then a new custom dialog box is created and the second static field is updated.
[0063] In this embodiment, a debouncing and anti-stacking mechanism is set up for cross-path sharing. Two safety mechanisms are implemented in the interceptor (i.e., FeedbackDialogRunnable) of the Java callback function: (a) 5-second debouncing timestamp: The first static field lastDialogTime records the timestamp of the last dialog box pop-up (i.e., System.currentTimeMillis), and the two paths share the same timestamp. When a new pop-up request arrives, if it is less than 5000 milliseconds since the last pop-up, the request is ignored. This avoids the dialog box from popping up repeatedly due to the two paths triggering callbacks in a very short time interval. (b) Static reference anti-stacking: The second static field sCurrentDialog holds a reference to the currently active AlertDialog. Before a new dialog box is created, if sCurrentDialog is not null and is still displayed (isShowing() returns true), sCurrentDialog.dismiss() is called first to close the old dialog box, and then a new dialog box is created and the reference of the second static field sCurrentDialog is updated.
[0064] A dual-path conditional branch event routing method based on RTC state awareness further includes:
[0065] The code for an RTC-state-aware dual-path conditional branch event routing method is placed in an auxiliary file of a secondary DEX file. By using Java reflection, the corresponding field objects are dynamically obtained and access restrictions are removed when the code for the RTC-state-aware dual-path conditional branch event routing method is executed.
[0066] The method of dynamically obtaining corresponding field objects and removing access restrictions when running code for a two-path conditional branch event routing method based on RTC state awareness using Java reflection includes:
[0067] A target class for a dual-path conditional branch event routing method based on RTC state awareness is dynamically loaded. The target class includes a corresponding class for RTC call state.
[0068] In this embodiment, Class.forName is used to dynamically load the target class of a dual-path conditional branch event routing method based on RTC state awareness;
[0069] Get the field object of the target class;
[0070] In this embodiment, getDeclaredField("rtcInRoom") is called to obtain the field object of the target class;
[0071] Set the accessibility of the target class's field object to "true";
[0072] In this embodiment, calling setAccessible(true) bypasses the accessibilityVerifier, which is a runtime permission check of Android ART (Android Runtime).
[0073] Dynamically retrieve the boolean value of a field object of the target class.
[0074] In this embodiment, the boolean value is dynamically obtained by calling field.get(activityInstance).
[0075] Example 2:
[0076] This embodiment proposes an electronic device, including: one or more processors, and a memory, wherein the memory is used to store instructions, and when the instructions are executed by the one or more processors, the one or more processors execute the aforementioned RTC state-aware dual-path conditional branch event routing method.
[0077] The electronic device may be a mobile phone, computer, or tablet computer, etc., and includes a memory and a processor. The memory stores a computer program, which, when executed by the processor, implements a dual-path conditional branch event routing method based on RTC state awareness as described in the embodiments. It is understood that the electronic device may also include input / output (I / O) interfaces and communication components.
[0078] The processor is used to execute all or part of the steps in the RTC-state-aware dual-path conditional branch event routing method described in the above embodiments. The memory is used to store various types of data, which may include, for example, instructions for any application or method in the electronic device, as well as application-related data.
[0079] The processor can be implemented as an Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), controller, microcontroller, microprocessor, or other electronic components, and is used to execute the RTC state-aware dual-path conditional branch event routing method described in the above embodiments.
[0080] Example 3:
[0081] This embodiment proposes a computer-readable storage medium that stores executable instructions. When these instructions are executed, if they are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
[0082] The computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the RTC state-aware dual-path conditional branch event routing method described in various embodiments of this application.
[0083] The aforementioned storage media include: flash memory, hard disks, multimedia cards, card-type memory (e.g., SD (Secure Digital Memory Card) or DX (Memory Data Register, MDR) memory), random access memory (RAM), static random-access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, disks, optical discs, servers, APP (Application) application stores, and other media capable of storing program verification codes. These media store computer programs, which, when executed by a processor, can implement the various steps of the aforementioned RTC-based state-aware dual-path conditional branch event routing method.
[0084] Example 4:
[0085] This embodiment proposes a computer program product, including a computer program or instructions, which, when executed by a processor, implements the aforementioned RTC state-aware dual-path conditional branch event routing method.
[0086] Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a computer program product.
[0087] The various embodiments in this application are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
[0088] The scope of protection of this application is not limited to the embodiments described above. Obviously, those skilled in the art can make various modifications and variations to this disclosure without departing from the scope and spirit of this disclosure. If such modifications and variations fall within the scope of equivalent technology of this disclosure, then the intent of this disclosure also includes such modifications and variations.
Claims
1. A dual-path conditional branch event routing method based on RTC state awareness, characterized in that, include: Retrieve button click events in commercial navigation; Analyze the button click event to obtain the JNI call chain of the button click event; Based on the JNI call chain, the Java layer notification path is obtained, which includes: static method path and interface method path; Intercepting button click events for static method paths includes: obtaining the layer pop-up configuration object, and determining whether to intercept the button click event based on the flag for enabling and displaying the feedback button in the layer pop-up configuration object; Intercepting button click events for the interface method path includes: intercepting button click events based on the conditional branch of the RTC call status in the layer pop-up configuration information of the interface method path.
2. The dual-path conditional branch event routing method based on RTC state awareness according to claim 1, characterized in that, The analysis of the button click event, obtaining the JNI call chain of the button click event, includes: The button click event was analyzed using reverse engineering of the GFrame engine core library to locate the JNI call chain of the button click event in the native code.
3. The dual-path conditional branch event routing method based on RTC state awareness according to claim 1, characterized in that, The conditional branch based on RTC call status intercepts button click events, including: If the device is not currently in an RTC call, the layer pop-up configuration object is returned in the layer pop-up configuration information. The layer pop-up configuration object includes: setting "Enable and display feedback button" to "True", so that the native engine routes the event to the Java callback function; setting "Do not display red dot prompt" to "No"; setting "Disable or do not need pop-up window" to "False", so that the interceptor in the Java callback function pops up a custom dialog box; the interceptor in the Java callback function pops up a custom dialog box on the main thread through the message queue of the associated thread. If the device is currently in an RTC call, the layer pop-up configuration information will return "No results found"; after the native engine receives "No results found", it will skip the layer pop-up configuration information processing branch and the button click event will be intercepted.
4. The dual-path conditional branch event routing method based on RTC state awareness according to claim 1, characterized in that, Also includes: Set up safety mechanisms in Java callback function interceptors, including: debouncing timestamps and preventing static reference stacking.
5. The dual-path conditional branch event routing method based on RTC state awareness according to claim 4, wherein, The debounce timestamp includes: setting a first static field to record the debounce timestamp of the last pop-up custom dialog box; based on the debounce timestamp, if the pop-up time of the current custom dialog box is less than the pop-up time of the last pop-up, then the pop-up request of the current custom dialog box is ignored.
6. The dual-path conditional branch event routing method based on RTC state awareness according to claim 4, wherein, The static reference anti-stacking mechanism includes: setting a second static field to retain a reference to the currently active custom dialog box; between the creation of a new custom dialog box, if the second static field is not empty and the currently active custom dialog box is still displayed, then the old custom dialog box is closed first, and then a new custom dialog box is created and the second static field is updated.
7. The dual-path conditional branch event routing method based on RTC state awareness according to claim 1, characterized in that, Also includes: The code for an RTC-state-aware dual-path conditional branch event routing method is placed in an auxiliary file of a secondary DEX file. By using Java reflection, the corresponding field objects are dynamically obtained and access restrictions are removed when the code for the RTC-state-aware dual-path conditional branch event routing method is executed.
8. The dual-path conditional branch event routing method based on RTC state awareness according to claim 7, characterized in that, The method of dynamically obtaining corresponding field objects and removing access restrictions when running code for a two-path conditional branch event routing method based on RTC state awareness using Java reflection includes: A target class for a dual-path conditional branch event routing method based on RTC state awareness is dynamically loaded. The target class includes a corresponding class for RTC call state. Get the field object of the target class; Set the accessibility of the target class's field object to "true"; Dynamically retrieve the boolean value of a field object of the target class.
9. An electronic device, characterized in that, include: One or more processors, and a memory for storing instructions that, when executed by the one or more processors, cause the one or more processors to perform the RTC state-aware dual-path conditional branch event routing method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, It stores executable instructions that, when executed, cause the processor to perform the RTC state-aware dual-path conditional branch event routing method according to any one of claims 1 to 8.