Barrier-free service packaging method and device based on swan gap system

By pre-creating service classes and monitoring results, the Hongmeng Accessibility API is encapsulated, which solves the problem of low efficiency of Hongmeng system accessibility service encapsulation, realizes a simple and easy-to-operate process and efficient encapsulation, and adapts to different needs and environments.

CN118585183AInactive Publication Date: 2024-09-03HUNAN YUYI TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411059738.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-09-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing Hongmeng system's barrier-free service packaging efficiency is low, the operation is complex, and it is unable to effectively implement customized functions.

Method used

By obtaining pre-created service class information, initializing the demand listener, encapsulation processing is performed based on the API of Hongmeng Accessibility Service, including node method encapsulation, behavior action encapsulation and process encapsulation, and cross-device element content search is used to achieve encapsulation of the target service class.

Benefits of technology

It simplifies the operation process, improves the efficiency of barrier-free service encapsulation, realizes self-batch operation of equipment, and adapts to different needs and environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118585183A
    Figure CN118585183A
Patent Text Reader

Abstract

The embodiment of the invention provides a barrier-free service packaging method and device based on a swan-gap system, and relates to the technical field of barrier-free service packaging technologies based on the swan-gap system. The method comprises the following steps: acquiring pre-created service class information; performing initialization processing in the service class, and starting a demand monitor which is used for monitoring action changes of a system to determine demand information of a user; and according to the demand information and the service class information, carrying out packaging processing on the API of the gap barrier-free service to obtain a target service class. Through the method and the device, the problem of low barrier-free service packaging efficiency under the swan-gap system is solved, and the effect of improving the barrier-free service packaging efficiency under the swan-gap system is further achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the technical field of barrier-free service packaging based on the Hongmeng system, and specifically, to a barrier-free service packaging method and device based on the Hongmeng system. Background Art

[0002] Hongmeng Accessibility Development Service (Accessibility Kit) provides open capabilities for extended services. Based on this open capability, the three parties can develop extended services similar to screen reading software. This is crucial for users with disabilities, the elderly, or users who are temporarily unable to fully interact with the device. It is an important bridge for them to integrate into the digital society and enjoy the convenience of technology. Through the accessibility service function, this user group can communicate and interact with others more easily, helping to expand their social circle and enhance their social skills.

[0003] The current methods for providing accessibility services are very limited, and the operating procedures are relatively complicated, and some customized specific functions cannot be effectively implemented.

[0004] There is currently no better solution to the above problems. Summary of the invention

[0005] An embodiment of the present invention provides a barrier-free service encapsulation method based on the Hongmeng system, so as to at least solve the problem of low barrier-free encapsulation efficiency in related technologies.

[0006] According to an embodiment of the present invention, a barrier-free service encapsulation method based on the Hongmeng system is provided, comprising: Obtaining pre-created service class information, wherein the service class includes encapsulation logic and corresponding interface; Performing initialization processing in the service class and starting a demand listener, the demand listener is used to monitor system action changes to determine user demand information; According to the demand information and the service class information, the API of the HarmonyOS accessibility service is encapsulated to obtain the target service class, wherein the encapsulation is implemented based on a service connection established with the HarmonyOS accessibility service; the encapsulation includes at least node method encapsulation implemented based on cross-device element content search processing.

[0007] In an exemplary embodiment, the node method package includes a basic method package, and the basic method package includes at least any one of the following: Performing an element traversal search on the target device through a preset window root element method to obtain the first element matching the preset element id in the window interface corresponding to the user's demand information, and taking the first element as the first target node to be encapsulated, and encapsulating the first target node; Or, perform content traversal search on the target device through a preset window root element method to obtain the first element that matches the preset element content in the window interface corresponding to the user's demand information, and use the first element as the second target node to be encapsulated, and encapsulate the second target node; Or, the component type traversal search is performed on the target device through the preset window root element method to obtain the first element that matches the preset element component type in the window interface corresponding to the user's demand information, and the first element is used as the third target node to be encapsulated, and the third target node is encapsulated.

[0008] In an exemplary embodiment, the node method package further includes a derived method package obtained based on the basic method package, and the derived method package includes at least any one of the following: Perform conditional traversal search on the first target node, the second target node, or the third target node to obtain the first node in the first target node, the second target node, or the third target node that meets the preset matching condition or contains preset content or a preset content type, wherein the first node includes any one of the first target node, the second target node, and the third target node or a subordinate node of any one of the first target node, the second target node, and the third target node, and use the first node as the fourth target node and encapsulate the fourth target node; Or, obtaining a parent node, a child node, or a sibling node of any target node among the first target node, the second target node, or the third target node, and taking the parent node, the child node, or the sibling node as a fifth target node, and encapsulating the fifth target node; Or, obtaining a node in a node menu of a window interface corresponding to the user's demand information, whose position meets a preset position requirement, and taking the node as a sixth target node, and encapsulating the sixth target node, wherein the preset position requirement includes the rightmost or the bottommost; Or, obtain all nodes that meet the preset component type in the next-level nodes of the first target node or the second target node or the third target node, and use all the nodes that meet the preset component type as the seventh target node, and encapsulate the seventh target node.

[0009] In an exemplary embodiment, before obtaining the pre-created service class information, the method further includes: Analyze the functional structure of the target program to obtain the functional structure information and upper-level functional module information; Based on the functional structure information and the upper-layer functional module information, the functional module of the target program is segmented to obtain a plurality of small functional modules; The small functional module is repackaged to obtain a HAP package, wherein the target service class is run for the function of the HAP package.

[0010] In an exemplary embodiment, the packaging process further includes at least any one of the following: Behavior action encapsulation; or, process encapsulation; Or, page method encapsulation.

[0011] According to another embodiment of the present invention, a barrier-free service packaging device based on the Hongmeng system is provided, including: A service class information collection module, used to obtain pre-created service class information, wherein the service class includes encapsulation logic and corresponding interfaces; An action monitoring module, used to perform initialization processing in the service class and start a demand monitor, wherein the demand monitor is used to monitor the action changes of the system to determine the user's demand information; An encapsulation module is used to encapsulate the API of the HarmonyOS accessibility service according to the demand information and the service class information to obtain a target service class, wherein the encapsulation is implemented based on a service connection established with the HarmonyOS accessibility service; the encapsulation includes at least node method encapsulation implemented based on cross-device element content search processing.

[0012] In an exemplary embodiment, the node method package includes a basic method package, and the basic method package includes at least any one of the following: Performing an element traversal search on the target device through a preset window root element method to obtain the first element matching the preset element id in the window interface corresponding to the user's demand information, and taking the first element as the first target node to be encapsulated, and encapsulating the first target node; Or, perform content traversal search on the target device through a preset window root element method to obtain the first element that matches the preset element content in the window interface corresponding to the user's demand information, and use the first element as the second target node to be encapsulated, and encapsulate the second target node; Or, the component type traversal search is performed on the target device through the preset window root element method to obtain the first element that matches the preset element component type in the window interface corresponding to the user's demand information, and the first element is used as the third target node to be encapsulated, and the third target node is encapsulated.

[0013] In an exemplary embodiment, the node method package further includes a derived method package obtained based on the basic method package, and the derived method package includes at least any one of the following: Perform conditional traversal search on the first target node, the second target node, or the third target node to obtain the first node in the first target node, the second target node, or the third target node that meets the preset matching condition or contains preset content or a preset content type, wherein the first node includes any one of the first target node, the second target node, and the third target node or a subordinate node of any one of the first target node, the second target node, and the third target node, and use the first node as the fourth target node and encapsulate the fourth target node; Or, obtaining a parent node, a child node, or a sibling node of any target node among the first target node, the second target node, or the third target node, and taking the parent node, the child node, or the sibling node as a fifth target node, and encapsulating the fifth target node; Or, obtaining a node in a node menu of a window interface corresponding to the user's demand information, whose position meets a preset position requirement, and taking the node as a sixth target node, and encapsulating the sixth target node, wherein the preset position requirement includes the rightmost or the bottommost; Or, obtain all nodes that meet the preset component type in the next-level nodes of the first target node or the second target node or the third target node, and use all the nodes that meet the preset component type as the seventh target node, and encapsulate the seventh target node.

[0014] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps in the above method embodiment when running.

[0015] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in the above method embodiment.

[0016] Through the present invention, since the service class is created in advance and the accessibility API is encapsulated according to the monitoring results and the service class, the process is simple and easy to operate, and can be left to the device to perform batch operations, which greatly improves the encapsulation efficiency of the accessibility service of the Hongmeng system. Therefore, the problem of low encapsulation efficiency of the accessibility service of the Hongmeng system can be solved, thereby achieving the effect of improving the encapsulation efficiency of the accessibility service of the Hongmeng system. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 is a flowchart of a barrier-free service encapsulation method based on the Hongmeng system according to an embodiment of the present invention; Figure 2 This is a structural block diagram of an accessibility service encapsulation device based on the Hongmeng system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0019] In the following, the terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first", "second", etc. may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "plurality" means two or more.

[0020] In addition, in the present application, directional terms such as "up", "down", "left" and "right" may be defined including but not limited to the orientation relative to the schematic placement of the components in the drawings. It should be understood that these directional terms may be relative concepts, which are used for relative description and clarification, and may change accordingly according to the change in the orientation of the components in the drawings.

[0021] In this application, unless otherwise specified or limited, the term "connection" should be understood in a broad sense. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection or an indirect connection through an intermediate medium. In addition, the term "coupling" can be a way of achieving electrical connection for signal transmission.

[0022] As used herein, "about," "substantially," or "approximately" includes the stated value and an average value that is within an acceptable range of variation from the particular value as determined by one of ordinary skill in the art taking into account the measurements in question and the errors associated with the measurement of the particular quantity (i.e., the limitations of the measurement system).

[0023] In this embodiment, a barrier-free service packaging method based on the Hongmeng system is provided. Figure 1 is a flowchart of a barrier-free service encapsulation method based on the Hongmeng system according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps: Step S101, obtaining pre-created service class information, wherein the service class includes encapsulation logic and corresponding interface; In this embodiment, one or more service classes are created to encapsulate the logic of accessibility services based on the HarmonyOS system. These service classes can provide clear and easy-to-use interfaces to facilitate the control and use of accessibility services of the HarmonyOS system across devices.

[0024] The service class information includes the name of the service class (such as AccessibilityServiceManager - Accessibility Service Management Class, AccessibilityNodeProcessor - Accessibility Node Processor Class, EventDispatcher - Event Dispatcher Class, etc.), the logic of the service class, the interface information of the service class, etc.

[0025] Step S102, performing initialization processing in the service class and starting a demand listener, wherein the demand listener is used to monitor system action changes to determine user demand information; In this embodiment, the purpose of monitoring the system's action changes is to determine the changes in the system when implementing user needs, thereby providing an information basis for subsequent accurate packaging of related functions of the system and improving the efficiency of barrier-free service packaging.

[0026] Among them, during initialization, the basic configuration of the accessibility service can also be set. Starting the necessary listeners can be some actions performed by the user when operating the interface of a program, such as interface expansion and contraction, automatic touch, gesture sliding up and down, and other operations.

[0027] Step S103, encapsulating the API of the Harmony accessibility service according to the demand information and the service class information to obtain the target service class, wherein the encapsulation processing is implemented based on the service connection established with the Harmony accessibility service; the encapsulation processing at least includes node method encapsulation implemented based on cross-device element content search processing.

[0028] In this embodiment, packaging processing is performed through service connection, which is conducive to automatically implementing the packaging process by an external program, thereby reducing the workload of manual packaging and greatly improving packaging efficiency. At the same time, the packaging content can be adjusted by adjusting the external program to adapt to different packaging requirements and packaging environments.

[0029] Among them, the connection relationship established with the accessibility service can be an external APP or other programs that can perform encapsulation operations; specifically, the accessibility event type (EventType), window change type (WindowUpdateType), touch browsing event type (TouchGuideType), gesture event type (GestureType), page refresh type (PageUpdateType) and other information can be received through the onAccessibilityEvent callback function, and service encapsulation can be performed based on this; the encapsulation processing includes (but is not limited to) one or more encapsulation processes such as node method encapsulation, page method encapsulation, behavior action encapsulation, and process encapsulation.

[0030] Among them, the page method encapsulation includes judging whether it is on a certain page according to the specific node elements of the page. It can encapsulate the judgment of some common interfaces according to actual needs, for example: isTargetCurrentPager - determines whether it is on the current page based on the root layout description; reIsTargetCurrentPager-repeatedly determine whether it is on a certain page.

[0031] The behavior action encapsulation includes at least one of the following: getFirstClickableParent-Search up from the current node to get the first clickable node; clickFirstClickableParent - clicks the first clickable node; longClickFirstClickableParent - long click on the first clickable node; scroll2TopOrBottom-slides to the very top and bottom of the page; scrollAndIsBottom-Slide once and check if it is at the bottom; scrollAndIsTop - scroll once and check if it is at the top; setTextToEditText-Copy text to the edit box; doSomethingUntilSuccess - repeat something until a specified number of times or success; doClickDown - touch click; doFastClickDown - touch fast click; doLongClickDown - long click of a touch; doSwipeDown-gesture down; doSwipeUp-Swipe up gesture; doubleClickDown - double click on the touch; gestureTouch-provides path gesture operations; reProcessUntilOk - repeat the process; reGetNodeUntilOk - repeat the node search; And other packaging contents.

[0032] Process encapsulation includes encapsulation of commonly used processes. For example, when reading the screen, you need to repeatedly determine the page to find a specific node broadcast and slide the screen to the next page to find the node broadcast again. This entire process can be encapsulated and can be directly called when other usage scenarios require this process.

[0033] In the API encapsulation method, you also need to set up error handling logic to provide useful feedback when the call fails. Specifically, add a callback mechanism to the service method so that other parts of the application can receive and process the results.

[0034] It should be noted that compared with the prior art, this application can provide a unique API by pre-creating service class information to support its distributed architecture and collaboration between devices. For example, by setting up multiple interfaces to support richer inter-device communication and data synchronization functions. At the same time, this application focuses more on distributed scenarios and multi-device interactions, and provides some unique node operation methods, such as node search and operation across devices; in addition, this application has its own unique design in terms of security and privacy, and can adapt to the distributed architecture of the Hongmeng system; and after packaging is completed, the encapsulated auxiliary function services are fully tested, including functional testing, performance testing, compatibility testing, etc., and user feedback and test results are collected to fix problems and optimize.

[0035] Through the above steps, since the service class is created in advance and the accessibility API is encapsulated according to the monitoring results and the service class, the process is simple and easy to operate, and can be left to the device to operate in batches. This greatly improves the encapsulation efficiency of the accessibility service of the Hongmeng system, solves the problem of low encapsulation efficiency of the accessibility service of the Hongmeng system, and improves the encapsulation efficiency of the accessibility service of the Hongmeng system.

[0036] In addition, before encapsulation, you also need to configure the system's network connection method, specifically: 1.1 Terminal equipment preparation: Make sure that the terminal device has Hongmeng system installed and running. In the settings of the terminal device, turn on the Wi-Fi function and prepare to search for available wireless networks.

[0037] 1.2 Search and select network: The terminal device will automatically scan the available wireless networks around it and list all detected service set identifiers (SSIDs). The user selects the network to connect to from the list, and the SSID of the network is broadcast by the router.

[0038] 1.3 Enter password and verify: The user enters the password of the Wi-Fi network, and the terminal device sends the password to the router for verification. This step is usually performed through encryption protocols such as WPA / WPA2 to ensure the security of data transmission.

[0039] 1.4 Connection and configuration: Once the password verification is passed, the router will send a successful connection response to the terminal and assign the corresponding IP address. The terminal device automatically configures the network connection based on the assigned IP address and other network parameters to ensure that the device can access the Internet normally.

[0040] 1.5 Broadcast Service Set Identifier (SSID): The router will broadcast its SSID regularly so that surrounding terminal devices can discover and connect to the network. Hongmeng system discovers available Wi-Fi networks by listening to these broadcast information.

[0041] This method supports multiple device types, achieving seamless interconnection and collaborative work between devices; it uses encryption protocols such as WPA / WPA2 to ensure the security of data transmission.

[0042] The execution subject of the above steps may be a base station, a terminal, etc., but is not limited thereto.

[0043] In an optional embodiment, the node method encapsulation includes a basic method encapsulation, and the basic method encapsulation includes at least any one of the following: Step S1031, performing an element traversal search on the target device through a preset window root element method to obtain the first element matching the preset element id in the window interface corresponding to the user's demand information, and taking the first element as the first target node to be encapsulated, and encapsulating the first target node; Step S1032, or, performing content traversal search on the target device through a preset window root element method to obtain the first element matching the preset element content in the window interface corresponding to the user's demand information, and taking the first element as the second target node to be encapsulated, and encapsulating the second target node; Step S1033, or, perform component type traversal search on the target device through the preset window root element method to obtain the first element that matches the preset element component type in the window interface corresponding to the user's demand information, and use the first element as the third target node to be encapsulated, and encapsulate the third target node.

[0044] In this embodiment, the accessibility node element (AccessibilityElement) is the detailed information of the node (control) on the interface, including the element ID, content, description, application package name, component type to which the element belongs, whether it is clickable, the element's parent element, child elements and other information. At present, the methods provided by the prior art only include methods for obtaining the root element of the page (AccessibilityExtensionContext.getWindowRootElement) and obtaining the focus element (AccessibilityExtensionContext.getFocusElement), based on which further expansion can be performed to meet relevant needs; it should be noted that before encapsulation, the parent element, child element and other information of the barrier-free node element can be matched and detected, and subsequent processing can be performed when it is determined that the corresponding parent element, child element and other information are normal. Specifically, the information corresponding to the parent element, child element and other information of the barrier-free node element can be determined based on historical data, and then the current parent element, child element and the like are matched with the historical information. If they are the same, it is judged to be reasonable and subsequent processing is performed, otherwise an alarm is issued; it can also be that the parent element, child element and the like are encoded according to a preset encoding rule, and then an element matrix is ​​constructed according to the encoding result, and the correlation value of the element matrix is ​​calculated according to the Pearson correlation coefficient. If the correlation value is within a preset range, it is judged that the relevant element meets the requirements, otherwise an abnormal alarm is issued; detection can also be performed in other ways.

[0045] Specifically, any one of the following: a. getNodeById-Find the first element matching the id in the interface by id (componentId): Through the official window root element method, traverse and find the id of the child element, and the first element (that is, the first element mentioned above) that matches the target id (that is, the preset element id) is the target node; and the first element is used as the target node, rather than the first element or other elements as the target node because it is usually assumed that each control or element has a unique identifier (ID) during design. Therefore, when looking for an element with a specific ID, only one match is expected to be found. If there are multiple elements with the same ID, this may be a design flaw or error; at the same time, when developers use methods such as getNodeById, they mainly expect to get a certain result, and returning the first matching element can provide consistent and predictable behavior and simplify the development process; in addition, getElementById or similar methods are standard practices, and they usually return the first matching element, so the element is used as the target node, which helps maintain consistency between different applications and libraries.

[0046] b. getNodeByContents - find the first element in the interface that fully matches contents by content: Through the official window root element method, traverse and search for the contents of the child elements, and the first element that matches the target content (that is, the aforementioned preset element content) is the target node; c. getNodeByComponetType-Find the first element matching componentType in the interface by component type: Through the official window root element method, traverse and search for the componentType of the child elements. The first element that matches the target component type (that is, the aforementioned preset element component type) is the target node.

[0047] In an optional embodiment, the node method encapsulation further includes a derived method encapsulation obtained based on the basic method encapsulation, and the derived method encapsulation includes at least any one of the following: Step S1034, performing conditional traversal search on the first target node, the second target node, or the third target node to obtain the first node in the first target node, the second target node, or the third target node that meets the preset matching condition or contains preset content or a preset content type, wherein the first node includes any one of the first target node, the second target node, and the third target node or a subordinate node of any one of the first target node, the second target node, and the third target node, and taking the first node as the fourth target node, and encapsulating the fourth target node; Step S1035, or, obtaining a parent node, a child node, or a sibling node of any target node among the first target node, the second target node, or the third target node, and taking the parent node, the child node, or the sibling node as a fifth target node, and encapsulating the fifth target node; Step S1036, or, obtaining a node in the node menu of the window interface corresponding to the user's demand information, whose position meets the preset position requirement, and taking the node as the sixth target node, and encapsulating the sixth target node, wherein the preset position requirement includes the rightmost or the bottommost; Step S1037, or, obtain all nodes that meet the preset component type in the next-level nodes of the first target node or the second target node or the third target node, and use all nodes that meet the preset component type as the seventh target node, and encapsulate the seventh target node.

[0048] In this embodiment, the derived method encapsulation specifically includes: getAllNodeBy-finds all node elements that meet the requirements under the current page according to id / content / description / component type; getNodeByWithCallback - traverses and searches for the first node that meets the requirements under the current node element (including the current node), and can add a callback to include the matching condition (corresponding to the aforementioned step S1034); getNextNodeBy - traverses and searches for all nodes that meet the requirements at the next level under the current node element (including the current node) (corresponding to the aforementioned step S1034); getNodeByContain - traverses and searches for the first node containing a certain content / description under the current node element (including the current node) that meets the requirements (corresponding to the aforementioned step S1034); getParentNodeBy - find the parent node / child node / brother node of a node (corresponding to the aforementioned step S1035); getTargetNodeWithRow - Get the rightmost node in the list (corresponding to the aforementioned step S1036); getTargetNodeWithColumn-gets the bottom node in the list (corresponding to the above step S1036); getAllChildNodeByClassNameWithCallback - obtains all nodes in the next level that match the component type (corresponding to the aforementioned step S1034); checkBoundInScreen-determines whether the node is within the screen; getTextByNodeInfo-Get node content information based on the node.

[0049] In an optional embodiment, before obtaining the pre-created service class information, the method further includes: Step S10101, performing functional structure analysis on the target program to obtain functional structure information and upper-level functional module information; Step S10102, based on the functional structure information and the upper-layer functional module information, the functional module of the target program is segmented to obtain a plurality of small functional modules; Step S10103: repackaging the small functional module to obtain a HAP package, wherein the target service class is run for the function of the HAP package.

[0050] In this embodiment, before service packaging, the related programs can be divided first, and then the accessibility services can be divided based on the relationship between the related programs and the accessibility services. This ensures that the program size is not too large, ensures the normal deployment of the program, and facilitates resource sharing optimization, thereby improving the loading speed and operating efficiency of the program, thereby improving the user experience.

[0051] Specifically, the target application can be structurally analyzed first to clarify its upper-level functional division structure and upper-level functional modules; then the large functional module can be subdivided into multiple small functional modules, each of which independently completes one or a group of related functions; at the same time, the sharing mechanism of resource files can be optimized to reduce the storage of duplicate resources, thereby reducing the total volume of the HAP package (HarmonyOS Ability Package, an application package format in HarmonyOS; it is similar to APK (Android Package Kit) in the Android system, which is a file format for distributing and installing applications), and the code can be reconstructed and optimized to remove redundant code and unnecessary library dependencies and reduce the code volume; then the segmented functional modules can be repackaged into multiple HAP packages, which need to meet the specifications and requirements of the Harmony system to ensure that they can be installed and run normally on the device; after the HAP package is generated, strict verification and testing are required to ensure that the segmented application is consistent with the original application in terms of function and performance.

[0052] It should be noted that encapsulation on the basis of segmentation is conducive to each service class focusing on specific functions, which enhances the modularity and scalability of the code. In this way, when new functions need to be added or existing functions need to be modified, expansion and maintenance can be carried out more easily without large-scale reconstruction of the entire application, which greatly facilitates system function expansion and system maintenance. Compared with the existing technology of only single encapsulation or segmentation, it has obvious maintenance efficiency improvement and maintenance development cost reduction; in addition, after each service class is encapsulated, it can be packaged into the corresponding HAP package again to ensure that each HAP package contains specific service classes and related resources, which is convenient for independent deployment and operation.

[0053] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0054] In this embodiment, an accessibility service encapsulation device based on the Hongmeng system is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0055] Figure 2 is a structural block diagram of an accessibility service packaging device based on the Hongmeng system according to an embodiment of the present invention, such as Figure 2 As shown, the device comprises: The service class information collection module 21 is used to obtain pre-created service class information, wherein the service class includes encapsulation logic and corresponding interfaces; An action monitoring module 22, used to perform initialization processing in the service class and start a demand monitor, wherein the demand monitor is used to monitor the action changes of the system to determine the user's demand information; The encapsulation module 23 is used to encapsulate the API of the Harmony accessibility service according to the demand information and the service class information to obtain a target service class, wherein the encapsulation is implemented based on a service connection established with the Harmony accessibility service; the encapsulation includes at least node method encapsulation implemented based on cross-device element content search processing.

[0056] In an optional embodiment, the node method encapsulation includes a basic method encapsulation, and the basic method encapsulation includes at least any one of the following: Performing an element traversal search on the target device through a preset window root element method to obtain the first element matching the preset element id in the window interface corresponding to the user's demand information, and taking the first element as the first target node to be encapsulated, and encapsulating the first target node; Or, perform content traversal search on the target device through a preset window root element method to obtain the first element that matches the preset element content in the window interface corresponding to the user's demand information, and use the first element as the second target node to be encapsulated, and encapsulate the second target node; Or, the component type traversal search is performed on the target device through the preset window root element method to obtain the first element that matches the preset element component type in the window interface corresponding to the user's demand information, and the first element is used as the third target node to be encapsulated, and the third target node is encapsulated.

[0057] In an optional embodiment, the device further includes: the node method package further includes a derived method package obtained based on the basic method package, and the derived method package includes at least any one of the following: Perform conditional traversal search on the first target node, the second target node, or the third target node to obtain the first node in the first target node, the second target node, or the third target node that meets the preset matching condition or contains preset content or a preset content type, wherein the first node includes any one of the first target node, the second target node, and the third target node or a subordinate node of any one of the first target node, the second target node, and the third target node, and use the first node as the fourth target node and encapsulate the fourth target node; Or, obtaining a parent node, a child node, or a sibling node of any target node among the first target node, the second target node, or the third target node, and taking the parent node, the child node, or the sibling node as a fifth target node, and encapsulating the fifth target node; Or, obtaining a node in a node menu of a window interface corresponding to the user's demand information, whose position meets a preset position requirement, and taking the node as a sixth target node, and encapsulating the sixth target node, wherein the preset position requirement includes the rightmost or the bottommost; Or, obtain all nodes that meet the preset component type in the next-level nodes of the first target node or the second target node or the third target node, and use all the nodes that meet the preset component type as the seventh target node, and encapsulate the seventh target node.

[0058] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0059] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps in the above method embodiment when running.

[0060] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0061] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in the above method embodiment.

[0062] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0063] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0064] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0065] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0066] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0067] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0068] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A barrier-free service encapsulation method based on Hongmeng system, It is characterized in that include: Obtaining pre-created service class information, wherein the service class includes encapsulation logic and corresponding interface; Performing initialization processing in the service class and starting a demand listener, the demand listener is used to monitor system action changes to determine user demand information; According to the demand information and the service class information, encapsulate the API of the Hongmeng accessibility service to obtain a target service class, wherein the encapsulation process is implemented based on a service connection established with the Hongmeng accessibility service; the encapsulation process at least includes node method encapsulation implemented based on cross-device element content search processing; Among them, the node method encapsulation includes basic method encapsulation, and the basic method encapsulation includes: performing content traversal search on the target device through a preset window root element method to obtain the first element that matches the preset element content in the window interface corresponding to the user's demand information, and using the first element as the second target node to be encapsulated, and encapsulating the second target node.

2. The method according to claim 1, It is characterized in that The basic method package also includes at least one of the following: Or, perform an element traversal search on the target device through a preset window root element method to obtain the first element that matches the preset element id in the window interface corresponding to the user's demand information, and use the first element as the first target node to be encapsulated, and encapsulate the first target node; Or, the component type traversal search is performed on the target device through the preset window root element method to obtain the first element that matches the preset element component type in the window interface corresponding to the user's demand information, and the first element is used as the third target node to be encapsulated, and the third target node is encapsulated.

3. The method according to claim 2, It is characterized in that The node method package further includes a derived method package obtained based on the basic method package, and the derived method package includes at least one of the following: Perform conditional traversal search on the first target node, the second target node, or the third target node to obtain the first node in the first target node, the second target node, or the third target node that meets the preset matching condition or contains preset content or a preset content type, wherein the first node includes any one of the first target node, the second target node, and the third target node or a subordinate node of any one of the first target node, the second target node, and the third target node, and use the first node as the fourth target node and encapsulate the fourth target node; Or, obtaining a parent node, a child node, or a sibling node of any target node among the first target node, the second target node, or the third target node, and taking the parent node, the child node, or the sibling node as a fifth target node, and encapsulating the fifth target node; Or, obtaining a node in a node menu of a window interface corresponding to the user's demand information, whose position meets a preset position requirement, and taking the node as a sixth target node, and encapsulating the sixth target node, wherein the preset position requirement includes the rightmost or the bottommost; Or, obtain all nodes that meet the preset component type in the next-level nodes of the first target node or the second target node or the third target node, and use all the nodes that meet the preset component type as the seventh target node, and encapsulate the seventh target node.

4. The method according to claim 1, It is characterized in that Before obtaining the pre-created service class information, the method further includes: Analyze the functional structure of the target program to obtain the functional structure information and upper-level functional module information; Based on the functional structure information and the upper-layer functional module information, the functional module of the target program is segmented to obtain a plurality of small functional modules; The small functional module is repackaged to obtain a HAP package, wherein the target service class is run for the function of the HAP package.

5. The method according to claim 1, It is characterized in that The packaging process further includes at least one of the following: Behavior action encapsulation; or, process encapsulation; Or, page method encapsulation.

6. A barrier-free service packaging device based on Hongmeng system, It is characterized in that include: A service class information collection module, used to obtain pre-created service class information, wherein the service class includes encapsulation logic and corresponding interfaces; An action monitoring module, used to perform initialization processing in the service class and start a demand monitor, wherein the demand monitor is used to monitor the action changes of the system to determine the user's demand information; an encapsulation module, configured to encapsulate the API of the Hongmeng accessibility service according to the demand information and the service class information to obtain a target service class, wherein the encapsulation process is implemented based on a service connection established with the Hongmeng accessibility service; and the encapsulation process at least includes node method encapsulation implemented based on cross-device element content search processing; Among them, the node method encapsulation includes basic method encapsulation, and the basic method encapsulation includes: performing content traversal search on the target device through a preset window root element method to obtain the first element that matches the preset element content in the window interface corresponding to the user's demand information, and using the first element as the second target node to be encapsulated, and encapsulating the second target node.

7. The device according to claim 6, It is characterized in that The basic method package also includes at least one of the following: Or, perform an element traversal search on the target device through a preset window root element method to obtain the first element that matches the preset element id in the window interface corresponding to the user's demand information, and use the first element as the first target node to be encapsulated, and encapsulate the first target node; Or, the component type traversal search is performed on the target device through the preset window root element method to obtain the first element that matches the preset element component type in the window interface corresponding to the user's demand information, and the first element is used as the third target node to be encapsulated, and the third target node is encapsulated.

8. The device according to claim 7, It is characterized in that The device further includes: the node method package further includes a derived method package obtained based on the basic method package, and the derived method package includes at least any one of the following: Perform conditional traversal search on the first target node, the second target node, or the third target node to obtain the first node in the first target node, the second target node, or the third target node that meets the preset matching condition or contains preset content or a preset content type, wherein the first node includes any one of the first target node, the second target node, and the third target node or a subordinate node of any one of the first target node, the second target node, and the third target node, and use the first node as the fourth target node and encapsulate the fourth target node; Or, obtaining a parent node, a child node, or a sibling node of any target node among the first target node, the second target node, or the third target node, and taking the parent node, the child node, or the sibling node as a fifth target node, and encapsulating the fifth target node; Or, obtaining a node in a node menu of a window interface corresponding to the user's demand information, whose position meets a preset position requirement, and taking the node as a sixth target node, and encapsulating the sixth target node, wherein the preset position requirement includes the rightmost or the bottommost; Or, obtain all nodes that meet the preset component type in the next-level nodes of the first target node or the second target node or the third target node, and use all the nodes that meet the preset component type as the seventh target node, and encapsulate the seventh target node.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 5 when executed.

10. An electronic device comprising a memory and a processor, It is characterized in that A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 5.

Citation Information

Cited By

  • Electronic equipment control method and system

    CN119851668A