Method and terminal device for retaining application data
By setting up diagnostic partitions at the kernel layer and calling the standard interface of the application framework layer, the problem that ordinary application APPs cannot retain user data when factory settings are restored or tool upgrades is solved, data security and unified adaptability are achieved, and user experience is improved.
Patent Information
- Application Number
- CN202210152224.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-18
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2042-02-18
AI Technical Summary
In the prior art, ordinary application APPs cannot retain user data during factory reset or tool upgrade, and the implementation methods of each manufacturer are not unified and maintenance is inconvenient.
The diagnostic partition is set up at the kernel layer. The application layer passes the data identifier of the application data to be processed to the application framework layer by calling the standard interface provided by the application framework layer, establishes a communication connection with the system library, calls dialogue services in the system library, and finds the data address corresponding to the data identifier in the diagnostic partition in the preset list for reading and writing operations.
It realizes that when restoring factory settings or upgrading non-full wipe tools, the diagnostic partition data will not be lost. Any application can read and write the diagnostic partition by calling the standard interface, solving the problem that different platforms or manufacturers cannot adapt uniformly and improving user experience.
Smart Images

Figure CN114528125B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent terminal technology, and in particular to a method and terminal device for retaining application data. Background Art
[0002] As Android devices become more popular, there are more and more special user scenarios, and user experience is becoming more and more important. In the design of application functions, some user data information needs to be retained during factory reset or tool upgrade. However, in the prior art, ordinary application APPs cannot use the function of retaining user data, and the function of retaining user data of various manufacturers is implemented in different ways, which is inconvenient to maintain and cannot be unified.
[0003] It can be seen that the related art has defects in user data management during reset, and it is necessary to provide a reliable method for retaining application data so that users can retain user data of common applications. Summary of the invention
[0004] The purpose of this application is to provide a method and terminal device for retaining application data, so as to solve the problem that the related technology cannot retain the user data of ordinary applications.
[0005] In a first aspect, the present application provides a method for retaining application data, wherein a diagnostic partition is provided at the kernel layer, and data of the diagnostic partition is not lost when restoring factory settings or upgrading a non-full wipe tool, the method comprising:
[0006] When the application layer performs read and write operations on application data, it calls the standard interface provided by the application framework layer to pass the data identifier of the application data to be processed to the application framework layer;
[0007] If the application framework layer detects the specified character from the data identifier, the application framework layer establishes a communication connection with the system library;
[0008] The application framework layer calls the dialogue service in the system library through the communication connection and sends the data identifier to the dialogue service;
[0009] The dialog service in the system library searches for a data address corresponding to the data identifier in the diagnostic partition in a preset list; and performs read and write operations on the application data to be processed at the data address.
[0010] In some embodiments, if the read / write operation is a write operation, calling the standard interface provided by the application framework layer to pass the data identifier of the application data to be processed to the application framework layer includes:
[0011] Calling a standard interface provided by the application framework layer to simultaneously pass the application data to be processed and the data identifier to the application framework layer;
[0012] The sending the data identifier to the dialogue service specifically includes:
[0013] The application data to be processed and the data representation are sent to the dialog service simultaneously.
[0014] In some embodiments, if the read / write operation is a read operation, the standard interface is a read interface for a read operation; if the read / write operation is a write operation, the standard interface is a write interface for a write operation.
[0015] In some embodiments, the read interface includes a native acquisition interface of the operating system and a preset extended read interface; the preset extended read interface is implemented by extending the native acquisition interface class of the operating system;
[0016] The native acquisition interface of the operating system is used to detect whether the data identifier contains the specified character, and if it contains the specified character, the data identifier is sent to the preset extended read interface for processing;
[0017] The preset extended read interface is used to establish communication with the dialog service.
[0018] In some embodiments, the write interface includes a native write interface of the operating system and a preset extended write interface; the preset extended write interface is implemented by extending the native write interface class of the operating system;
[0019] The native write interface of the operating system is used to detect whether the data identifier contains the specified character, and if it contains the specified character, the data identifier is sent to the preset extended write interface for processing;
[0020] The preset extended write interface is used to establish communication with the dialog service.
[0021] In some embodiments, the preset list includes a first sub-list and a second sub-list, the first sub-list is used to store the correspondence between data identifiers and data addresses of first-category applications, and the second sub-list is used to store the correspondence between data identifiers and data addresses of second-category applications.
[0022] In some embodiments, the method further comprises:
[0023] After the to-be-processed application is restored to factory settings or a non-full wipe tool is upgraded, the application layer generates the read operation request for the to-be-processed application data;
[0024] After obtaining the application data to be processed based on the read operation request, the application to be processed is run based on the application data to be processed.
[0025] In a second aspect, the present application further provides a terminal device, including:
[0026] Display, processor and memory;
[0027] The display is used to display information;
[0028] The memory is used to store the processor executable instructions;
[0029] The processor is configured to execute the instructions to implement any one of the methods provided in the first aspect of the present application.
[0030] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium. When the instructions in the computer-readable storage medium are executed by a processor of a terminal device, the terminal device is enabled to execute any method provided in the first aspect of the present application.
[0031] In a fourth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements any of the methods provided in the first aspect of the present application.
[0032] The technical solution provided by the embodiments of the present application brings at least the following beneficial effects:
[0033] By setting up a diagnostic partition at the kernel layer, the data in the diagnostic partition will not be lost when restoring the factory settings or upgrading with a non-full wipe tool. By calling the standard interface provided by this application at the application framework layer, any application can implement read and write operations on the diagnostic partition by calling the standard interface to maintain user data, thereby avoiding the problem of applications from different platforms or manufacturers being unable to adapt uniformly and improving the user experience.
[0034] It should be understood that the above general description and the following detailed description are only exemplary and explanatory and cannot limit the present application. Based on the common sense in the art, the above preferred conditions can be combined arbitrarily to obtain the preferred embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. Obviously, the drawings introduced below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0037] Figure 2 A schematic diagram of the software architecture of a terminal device provided in an embodiment of the present application;
[0038] Figure 3 A schematic diagram of a process for retaining application data provided in an embodiment of the present application;
[0039] Figure 4 A schematic diagram of a framework for retaining application data provided in an embodiment of the present application;
[0040] Figure 5 A schematic diagram of a process for obtaining data in a diagnostic partition by an application provided in an embodiment of the present application;
[0041] Figure 6 Another schematic diagram of a process of writing data in a diagnostic partition by an application provided in an embodiment of the present application;
[0042] Figure 7 A schematic diagram of a framework for an interface call for obtaining data in a diagnostic partition by an application according to an embodiment of the present application;
[0043] Figure 8 A schematic diagram of a framework for an interface call for an application to write data in a diagnostic partition provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Among them, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0045] Furthermore, in the description of the embodiments of the present application, unless otherwise specified, “ / ” means or. For example, A / B can mean A or B. The “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.
[0046] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more.
[0047] A method for retaining application data provided by the present application will be introduced below in conjunction with an embodiment.
[0048] The inventive concept of the present application can be summarized as follows: when the application layer performs read and write operations on application data, it calls the standard interface provided by the application framework layer to pass the data identifier of the application data to be processed to the application framework layer. If the application framework layer detects the specified character from the data identifier, the application framework layer establishes a communication connection with the system library, and the application framework layer calls the dialogue service in the system library through the communication connection, and sends the data identifier to the dialogue service; the dialogue service in the system library searches the preset list for the data address corresponding to the data identifier in the diagnostic partition, and performs read and write operations on the application data to be processed at the data address, wherein the kernel layer is provided with a diagnostic partition, and the data of the diagnostic partition will not be lost when restoring the factory settings or upgrading the non-full wipe tool. In summary, by providing a diagnostic partition in the kernel layer, the data of the diagnostic partition will not be lost when restoring the factory settings or upgrading the non-full wipe tool. By calling the standard interface provided by the present application in the application framework layer, any application can implement the read and write operations on the diagnostic partition by calling the standard interface, so as to realize the maintenance of user data, avoiding the problem that applications of different platforms or manufacturers cannot be uniformly adapted, and improving the user experience.
[0049] After introducing the main inventive ideas of the embodiments of the present application, the following briefly introduces the application scenarios to which the technical solutions of the embodiments of the present application can be applied. It should be noted that the application scenarios introduced below are only used to illustrate the embodiments of the present application and are not limited. In specific implementation, the technical solutions provided by the embodiments of the present application can be flexibly applied according to actual needs.
[0050] first, Figure 1 A schematic structural diagram of a terminal device 100 is shown.
[0051] The following embodiment is specifically described by taking the terminal device 100 as an example. It should be understood that: Figure 1 The terminal device 100 shown is only an example, and the terminal device 100 may have more Figure 1The more or less components shown in the figure can be combined with two or more components, or can have different component configurations. The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.
[0052] Figure 1 FIG. 1 is a block diagram showing a hardware configuration of a terminal device 100 according to an exemplary embodiment. Figure 1 As shown, the terminal device 100 includes: a radio frequency (RF) circuit 110, a memory 120, a display unit 130, a camera 140, a sensor 150, an audio circuit 160, a wireless fidelity (Wi-Fi) module 170, a processor 180, a Bluetooth module 181, and a power supply 190 and other components.
[0053] The RF circuit 110 can be used to receive and send signals during the process of sending and receiving information or making calls. It can receive downlink data from the base station and hand it over to the processor 180 for processing; it can send uplink data to the base station. Generally, the RF circuit includes but is not limited to antennas, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer and other devices.
[0054] The memory 120 can be used to store software programs and data. The processor 180 executes various functions and data processing of the terminal device 100 by running the software programs or data stored in the memory 120. The memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. The memory 120 stores an operating system that enables the terminal device 100 to run. In the present application, the memory 120 can store an operating system and various application programs, and can also store program codes for executing the method described in the embodiments of the present application.
[0055] The display unit 130 may be used to receive input digital or character information and generate signal input related to user settings and function control of the terminal device 100. Specifically, the display unit 130 may include a touch screen 131 disposed on the front of the terminal device 100, which may collect user touch operations on or near it, such as viewing application data.
[0056] The display unit 130 can also be used to display information input by the user or information provided to the user and a graphical user interface (GUI) of various menus of the terminal device 100. Specifically, the display unit 130 may include a display screen 132 disposed on the front of the terminal device 100. The display screen 132 may be configured in the form of a liquid crystal display, a light emitting diode, etc. The display unit 130 may be used to display the application data reading and writing process in the present application, etc.
[0057] The touch screen 131 may be covered on the display screen 132, or the touch screen 131 and the display screen 132 may be integrated to realize the input and output functions of the terminal device 100, and the integrated touch screen may be referred to as a touch display screen. In the present application, the display unit 130 may display the application and the corresponding operation steps.
[0058] The camera 140 can be used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then passed to the processor 180 for conversion into a digital image signal.
[0059] The terminal device 100 may further include at least one sensor 150, such as an acceleration sensor 151, a distance sensor 152, a fingerprint sensor 153, and a temperature sensor 154. The terminal device 100 may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, a light sensor, and a motion sensor.
[0060] The audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the terminal device 100. The audio circuit 160 can transmit the electrical signal converted from the received audio data to the speaker 161, which is converted into a sound signal for output. The terminal device 100 can also be configured with a volume button for adjusting the volume of the sound signal. On the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 160 and converted into audio data, and then outputs the audio data to the RF circuit 110 to send to, for example, another terminal device, or outputs the audio data to the memory 120 for further processing. In this application, the microphone 162 can obtain the user's voice.
[0061] Wi-Fi is a short-range wireless transmission technology. The terminal device 100 can help users send and receive emails, browse web pages, and access streaming media through the Wi-Fi module 170, which provides users with wireless broadband Internet access.
[0062] The processor 180 is the control center of the terminal device 100. It uses various interfaces and lines to connect various parts of the entire terminal device. It executes various functions of the terminal device 100 and processes data by running or executing software programs stored in the memory 120 and calling data stored in the memory 120. In some embodiments, the processor 180 may include one or more processing units; the processor 180 may also integrate an application processor and a baseband processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the baseband processor mainly processes wireless communications. It is understandable that the above-mentioned baseband processor may not be integrated into the processor 180. In this application, the processor 180 can run the operating system, application programs, user interface display and touch response, as well as the processing method described in the embodiment of the present application. In addition, the processor 180 is coupled to the display unit 130.
[0063] The Bluetooth module 181 is used to exchange information with other Bluetooth devices having Bluetooth modules through the Bluetooth protocol. For example, the terminal device 100 can establish a Bluetooth connection with a wearable terminal device (such as a smart watch) that also has a Bluetooth module through the Bluetooth module 181 to exchange data.
[0064] The terminal device 100 also includes a power supply 190 (such as a battery) for supplying power to various components. The power supply can be logically connected to the processor 180 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption. The terminal device 100 can also be configured with a power button for powering on and off the terminal device, as well as locking the screen and other functions.
[0065] Figure 2 It is a software structure block diagram of the terminal device 100 according to an embodiment of the present application.
[0066] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system can be divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
[0067] The application layer can include a series of application packages.
[0068] like Figure 2As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
[0069] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0070] like Figure 2 As shown, the application framework layer can be divided into the Java side and the native side. The Java side includes the window manager, content provider, view system, phone manager, resource manager, notification manager, application manager, etc. The installation management service (PackageManagerService, hereinafter referred to as PMS) is located in Figure 2 An application manager in the application framework layer (not shown in the figure).
[0071] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0072] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, short messages, etc.
[0073] The view system includes visual controls, such as controls for displaying text and controls for displaying images. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including an authorization prompt box can include a view for displaying text and a view for displaying images.
[0074] The phone manager is used to provide communication functions of the terminal device 100, such as management of call status (including connection, disconnection, etc.).
[0075] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, etc.
[0076] The notification manager enables applications to display notification information (such as message summaries and message contents) in a floating window. It can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in the status bar, a prompt sound is emitted, the terminal device vibrates, the indicator light flashes, etc.
[0077] The native-side services are located on the native side of the application framework layer, adjacent to the system library. installd is a service on the native side.
[0078] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0079] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0080] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0081] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0082] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0083] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0084] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0085] A 2D (animation mode) graphics engine is a drawing engine for 2D drawing.
[0086] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0087] The terminal device 100 in the embodiment of the present application may be a terminal device such as a mobile phone, a tablet computer, a wearable device, and a television, which can be installed with an Android system.
[0088] An embodiment of the present application provides a method for retaining application data. In the method, the present application sets a diagnostic partition in the kernel layer.
[0089] If the APP application and program data are stored in the data partition, the content of the data partition will be reset when the phone is reset. The diagnostic partition provided by this application does not belong to the data partition, so the data in the diagnostic partition will not be lost when restoring the factory settings or upgrading the non-full wipe tool. In addition, this application specifies the data search path for the diagnostic partition data, for example: the path is / dev / block / bootdevice / by-name / diag. By operating the diagnostic partition data according to this path, the user data can be read and written.
[0090] In order to facilitate the data access of applications, this application sets a preset list in the diagnostic partition. According to different application requirements, this type of list can set one or more sublists. For example, the preset list may include a first sublist and a second sublist. The first sublist is used to store the correspondence between the data identifier and the data address of the first type of application, and the second sublist is used to store the correspondence between the data identifier and the data address of the second type of application. For example, the industrial inspection APP is an application used for mobile phone function testing, mobile phone basic information storage, and viewing in factory production. Since the industrial inspection APP needs to store a lot of data, this application divides the partition storage area into two parts, one part is the part used by the industrial inspection APP alone, defined as the industrial inspection data List (Factory-List), and its starting position is specified as 0*1024, corresponding to the first sublist; the part used by other APPs is defined as the ordinary application data List (APP-List), and the starting position is specified as 512*1024, corresponding to the second sublist.
[0091] All data saved in the diagnostic partition takes up a maximum of 92 bytes. For example, the data corresponding to the 0th key value Key1 in the APP-List starts at 512*1024 in the diagnostic partition, and the maximum length is 92 bytes. Then the data corresponding to the next bit of Key1 starts at 512*1024+92 in the diagnostic partition, and the maximum length is also 92 bytes, and so on.
[0092] It should be noted that the industrial inspection APP is an application developed by this application, which is used for testing during factory production. This APP is used to view some equipment parameter information, so it is necessary to save and view some equipment parameter information for the industrial inspection APP to view. The industrial inspection APP will read and write the equipment parameter information of the diagnostic partition according to the method of retaining application data of this application.
[0093] In some embodiments, in order to avoid loss of common application user data, a flowchart of a method for retaining application data provided in an embodiment of the present application is as follows: Figure 3 As shown, including the following:
[0094] In step 301, when performing read and write operations on application data, the application layer calls the standard interface provided by the application framework layer to pass the data identifier of the application data to be processed to the application framework layer.
[0095] The framework of a method for retaining application data provided by an embodiment of the present application is as follows: Figure 4 As shown, the above read and write operations are divided into read operations and write operations, corresponding to Figure 4 The entire framework includes the following: When an application at the application layer performs read and write operations on application data, it calls the standard interface at the Framework layer (application framework layer) to establish communication with the dialogue service at the system layer, namely the Diagagentd service. Finally, the dialogue service sets or obtains data in the diagnostic partition to complete the read and write operations.
[0096] In some embodiments, if the read-write operation is a write operation, then in the process of passing the data identifier of the application data to be processed to the application framework layer, the present application will also call the standard interface provided by the application framework layer to pass the application data to be processed to the application framework layer.
[0097] It should be noted that the standard interfaces provided by the application framework layer called by the read and write operations are also different. If the read and write operation is a read operation, the standard interface is a read interface for the read operation, and if the read and write operation is a write operation, the standard interface is a write interface for the write operation.
[0098] Moreover, the read interface includes a native acquisition interface of the operating system and a preset extended read interface, and the preset extended read interface is implemented by extending the native acquisition interface class of the operating system.
[0099] For example, in the existing Android system, there is a Systemproperties.java class interface for obtaining and setting property values to save data. The standard interface provided by this application is implemented by extending the Systemproperties.java class. Among them, the standard interfaces provided by this application for applications include Systemproperties.getStable(String key,StringValue), which is used to obtain data, that is, corresponding to read operations; and the standard interface Systemproperties.setStable(String key,String Value), which is used to set data, that is, corresponding to write operations.
[0100] In actual calls, applications do not have to use the two standard interfaces getStable and setStable. They can also use the two Android native interfaces Systemproperties.get(String key,String Value) and Systemproperties.set(String key,String Value). This application processes these two interfaces according to the Key value naming rules. If it is found that the Key value starts with stable.sys, the getStable and setStable interfaces will be called respectively. The above interfaces are distinguished by specifying characters to facilitate flexible use by applications.
[0101] After the standard interface is called, in step 302, if the application framework layer detects the specified character from the data identifier, the application framework layer establishes a communication connection with the system library.
[0102] Among them, the native acquisition interface of the operating system is used to detect whether the data identifier contains the specified characters. If it contains the specified characters, the data identifier is sent to the preset extended read interface for processing. The preset extended read interface is used to establish communication with the dialogue service. For example, if it is found that the data identifier Key value starts with the specified characters stable.sys, the standard interfaces getStable and setStable will be called respectively to establish communication with the dialogue service. If the Key value only contains native attribute type values, such as: sys.usb.config attributes, etc., the standard interface will not be called.
[0103] In step 303, the application framework layer calls the dialogue service in the system library through the communication connection and sends the data identifier to the dialogue service.
[0104] In some embodiments, the dialogue service is the diagagentd service, which belongs to the system library layer and mainly performs read and write operations on the diagnostic partition. The application framework layer sends the data identifier to the dialogue service, that is, sends the Key value data to the diagagentd service. The diagagentd service will complete the read and write operations of the corresponding position data in the diagnostic partition according to the position of the Key value in the List.
[0105] It should be noted that the Key value is defined by the APP application itself. For example, if the application develops a function to save data even after resetting, the application will define the Key value in advance. The Key value is unique and different functions use different values. The application has generated the Key value when saving data, and the application then saves and queries user data based on this Key value. Moreover, the attribute value set when the application calls the standard interface must be consistent with the name of this Key value. For example, the above Key value naming principle is named according to the stable.sys. function name. Therefore, if the application finds that the data identification Key value starts with the specified characters stable.sys, that is, the attribute value set during the standard interface is consistent with the Key value name, the standard interface such as getStable or setStable will be called to perform read and write operations.
[0106] In step 304, the dialog service in the system library searches the preset list for a data address in the diagnostic partition corresponding to the data identifier, and performs read and write operations on the application data to be processed at the data address.
[0107] In some embodiments, the diagagentd service searches for a data address corresponding to the data identifier Key value in the diagnostic partition according to the above Key value, and performs read and write operations on the application data to be processed (i.e., user data) at the data address. In order to avoid missing some data, the diagagentd service searches two lists in the diagnostic partition, and after finding the application data to be processed, the diagagentd service performs read and write operations on the application data to be processed.
[0108] It should be added that after restoring the factory settings of the application to be processed or performing a non-full wipe tool upgrade, if the application layer generates a read operation request for the application data to be processed, after obtaining the application data to be processed based on the read operation request, the application to be processed is run based on the application data to be processed.
[0109] For example, the demonstration mode function is a function provided by the present application to sales staff for demonstration in stores. This function requires that as long as the demonstration mode switch is turned on, the device must remember the demonstration mode state, even if it is restored to factory settings, it will automatically enter the demonstration mode after booting up. If an application wants to read the relevant data of the application, the application layer generates a read operation request for the pending application data. After obtaining the pending application data based on the read operation request, the pending application is allowed to read based on the pending application data.
[0110] In some embodiments, the application obtains data in the diagnostic partition as follows: Figure 5 As shown, the following steps are included:
[0111] In step 501, the application framework layer obtains the data identifier and sends the data identifier to the dialogue service, and the dialogue service searches for the data address corresponding to the data identifier in the diagnostic partition in the preset list.
[0112] In step 502, it is determined whether the data address corresponding to the data identifier is in the second sublist. The second sublist is App-List. If the data address corresponding to the data identifier is in the second sublist, step 504 is executed. If the data address corresponding to the data identifier is not in the second sublist, step 503 is executed.
[0113] In step 503, it is determined whether the data address corresponding to the data identifier is in the first sublist. The first sublist is the Factory-List. If the data address corresponding to the data identifier is in the second sublist, step 504 is executed. If the data address corresponding to the data identifier is not in the second sublist, the data acquisition process ends.
[0114] In step 504, the path of the to-be-processed application data corresponding to the data identifier is obtained.
[0115] In step 505, based on the path of the application data to be processed corresponding to the data identifier, the application data to be processed is obtained at the data address corresponding to the data identifier.
[0116] In some other embodiments, the process of writing data (setting data) in the diagnostic partition is as follows: Figure 6 As shown, the following steps are included:
[0117] In step 601, the application framework layer obtains the data identifier and sends the data identifier to the dialogue service, and the dialogue service searches for the data address corresponding to the data identifier in the diagnostic partition in the preset list.
[0118] In step 602, it is determined whether the data address corresponding to the data identifier is in the second sublist. The second sublist is App-List. If the data address corresponding to the data identifier is in the second sublist, step 604 is executed. If the data address corresponding to the data identifier is not in the second sublist, step 603 is executed.
[0119] In step 603, it is determined whether the data address corresponding to the data identifier is in the first sublist. The first sublist is the Factory-List. If the data address corresponding to the data identifier is in the second sublist, step 604 is executed. If the data address corresponding to the data identifier is not in the second sublist, the data writing process is terminated.
[0120] In step 604, the path of the to-be-processed application data corresponding to the data identifier is obtained.
[0121] In step 605, the path of the to-be-processed application data corresponding to the data identifier writes the to-be-processed application data at the data address corresponding to the data identifier.
[0122] The difference between the operations of getting data and writing data is the call of the relevant interface. Getting data calls the getStable interface, and the framework of its interface call is as follows: Figure 7 As shown, writing data calls the setStable interface, and the framework of the interface call is as follows Figure 8 As shown in the figure, the process principles of getting data and writing data are the same. The Framework layer represents the application framework layer, the Diaggentd service represents the system layer, and the DiagAgentService represents the service that connects the application framework layer and the system layer. GetStable and SetStable are standard interfaces provided to APP in this solution. Figure 7 and Figure 8 This application accurately distinguishes the interface names and corresponding attributes. Therefore, ordinary applications can directly call the standard interface provided by this application without the need to adapt to the platform manufacturer to implement reading and writing operations on application data.
[0123] The embodiment of the present application truly realizes the ability to set up a diagnostic partition at the kernel layer so that the data in the diagnostic partition will not be lost when restoring factory settings or upgrading a non-full wipe tool. By calling the standard interface provided by the present application at the application framework layer, any application can implement read and write operations on the diagnostic partition by calling the standard interface, thereby maintaining user data, avoiding the problem of applications from different platforms or manufacturers being unable to adapt uniformly, and improving user experience.
[0124] In an exemplary embodiment, the present application further provides a computer-readable storage medium including instructions, such as a memory 120 including instructions, and the instructions can be executed by a processor 180 of a terminal device 100 to complete the above-mentioned method of retaining application data. Optionally, the computer-readable storage medium can be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0125] In an exemplary embodiment, a computer program product is also provided, including a computer program, and when the computer program is executed by the processor 180, the method for retaining application data as provided in the present application is implemented.
[0126] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0127] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0128] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps of the functions specified in one or more boxes. Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for retaining application data, characterized in that: The kernel layer is provided with a diagnostic partition, and the data of the diagnostic partition will not be lost when restoring the factory settings or upgrading with a non-full wipe tool. The method includes: When the application layer performs read and write operations on application data, it calls the standard interface provided by the application framework layer to pass the data identifier of the application data to be processed to the application framework layer; If the application framework layer detects the specified character from the data identifier, the application framework layer establishes a communication connection with the system library; The application framework layer calls the dialogue service in the system library through the communication connection and sends the data identifier to the dialogue service; The dialog service in the system library searches for a data address corresponding to the data identifier in the diagnostic partition in a preset list; and performs read and write operations on the application data to be processed at the data address.
2. The method according to claim 1, characterized in that If the read / write operation is a write operation, calling the standard interface provided by the application framework layer to pass the data identifier of the application data to be processed to the application framework layer includes: Calling a standard interface provided by the application framework layer to simultaneously pass the application data to be processed and the data identifier to the application framework layer; The sending the data identifier to the dialogue service specifically includes: The application data to be processed and the data identifier are sent to the dialogue service simultaneously.
3. The method according to claim 1, characterized in that If the read / write operation is a read operation, the standard interface is a read interface for the read operation; if the read / write operation is a write operation, the standard interface is a write interface for the write operation.
4. The method according to claim 3, characterized in that The read interface includes a native acquisition interface of the operating system and a preset extended read interface; the preset extended read interface is implemented by extending the native acquisition interface class of the operating system; The native acquisition interface of the operating system is used to detect whether the data identifier contains the specified character, and if it contains the specified character, the data identifier is sent to the preset extended read interface for processing; The preset extended read interface is used to establish communication with the dialog service.
5. The method according to claim 3, characterized in that: The write interface includes a native write interface of the operating system and a preset extended write interface; the preset extended write interface is implemented by extending the native write interface class of the operating system; The native write interface of the operating system is used to detect whether the data identifier contains the specified character, and if it contains the specified character, the data identifier is sent to the preset extended write interface for processing; The preset extended write interface is used to establish communication with the dialog service.
6. The method according to any one of claims 1 to 5, characterized in that: The preset list includes a first sublist and a second sublist, the first sublist is used to store the correspondence between data identifiers and data addresses of first-category applications, and the second sublist is used to store the correspondence between data identifiers and data addresses of second-category applications.
7. The method according to claim 1, characterized in that The method further comprises: After the to-be-processed application is restored to factory settings or a non-full wipe tool is upgraded, the application layer generates a read operation request for the to-be-processed application data; After obtaining the application data to be processed based on the read operation request, the application to be processed is run based on the application data to be processed.
8. A terminal device, characterized in that: include: Display, processor and memory; The display is used to display information; The memory is used to store the processor executable instructions; The processor is configured to execute the instructions to implement the method for retaining application data according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: include: When the instructions in the computer-readable storage medium are executed by a terminal device, the terminal device is enabled to execute the method for retaining application data according to any one of claims 1 to 7.
10. A computer program product, characterized in that include: Computer programs; When the computer program is executed by a processor, the method for retaining application data according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method for upgrading Android platform software with user data reserved
CN102830995A
Terminal device and method for recovering factory settings
CN106445745A