Contact search method, terminal device and storage medium
By using data files, view files and data in resident memory in the terminal device, the offset is determined based on the target phone number and the contact information is read from the data file, which solves the problem of low search efficiency in devices with limited memory. Implemented an efficient contact lookup method.
Patent Information
- Application Number
- CN202310881004.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2023-07-12
- Filing Date
- 2023-07-17
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2043-07-17
AI Technical Summary
In terminal devices, especially embedded micro devices such as sports watches and bracelets, the memory is limited and cannot support loading all contact information into the memory for search. This results in a large memory overhead when there are many contacts in the address book, which affects Search efficiency.
By setting the data file, view file and data in the resident memory in the terminal device, determine the target partition based on the target phone number and the data in the resident memory, use the offset to read the contact information from the data file, and reduce the file size Reduce the cost of reading and writing memory to improve search efficiency.
It achieves efficient search for contacts with a small memory overhead, is suitable for embedded devices with limited memory, and improves search efficiency and performance.
Smart Images

Figure CN117135253B_ABST
Abstract
Description
[0001] This application claims priority to a Chinese patent application filed with the State Intellectual Property Office on July 12, 2023, with application number 202310862426.7 and application name “A contact search method, terminal device and storage medium”, the entire contents of which are incorporated by reference in this application. Technical Field
[0002] The embodiments of the present application relate to the technical field of data search, and in particular to a contact search method, a terminal device, and a storage medium. Background Art
[0003] When searching for a contact in the address book of a terminal device, the information of all contacts in the address book is usually read into the memory, and then the search is performed in the memory. When there are many contacts in the address book (for example, more than 2k), the memory overhead of this method is large.
[0004] Embedded micro-terminal devices such as sports watches and bracelets have limited memory and do not support the operation of loading all contact information into memory for search. Summary of the invention
[0005] The embodiments of the present application provide a contact search method, a terminal device, and a storage medium, which can perform contact search with a small memory overhead.
[0006] In a first aspect, a contact search method is provided, the method being used in a terminal device, the terminal device being provided with a data file, a view file and data in a resident memory; the data file storing contact information in the order of the names of the contacts in the address book; the view file storing the contact's phone number and the offset of the storage location of each contact in the data file in the order of the phone number of the contacts in the address book in partitions; the data in the resident memory including the phone number and the offset corresponding to the first data of each partition of the view file, and the phone number and the offset corresponding to the last data in the partition; the method comprising: when a preset event is triggered, obtaining a target phone number carried by the preset event; determining a target partition according to the target phone number and the data in the resident memory; the value of the target phone number being within a value range determined by the phone number corresponding to the first data of the target partition and the phone number corresponding to the last data of the target partition; determining the offset of the target phone number when the phone number stored in the target partition includes the target phone number; and reading contact information of the contact corresponding to the target phone number from the data file according to the offset.
[0007] When searching for contacts in this embodiment, a data file, a view file, and data in a resident memory are set in the terminal device, less data is loaded into the memory, a target partition is determined according to the target phone number and the data in the resident memory, when the target partition includes the target phone number, an offset of the target phone number is determined, and contact information of the contact corresponding to the target phone number is read from the data file according to the offset. When searching for contacts using this method, the file reading and writing memory overhead is small and the search efficiency is high.
[0008] In combination with the first aspect, in certain implementations of the first aspect, after reading the contact information of the contact corresponding to the target phone number from the data file according to the offset, the method also includes: displaying the contact information of the contact corresponding to the target phone number in the display interface of the terminal device.
[0009] In combination with the first aspect, in certain implementations of the first aspect, when the target telephone number is included in the telephone numbers stored in the target partition, determining the offset of the target telephone number includes, when the target telephone number is a telephone number corresponding to an endpoint of one of the multiple partitions in the resident memory, reading the offset corresponding to the target telephone number from data in the resident memory.
[0010] In combination with the first aspect, in certain implementations of the first aspect, when the target telephone number is included in the telephone numbers stored in the target partition, determining the offset of the target telephone number includes loading the data in the target partition in the view file into the memory to determine whether the target telephone number is recorded in the target partition; and when it is determined that the target number is recorded in the target partition, reading the offset corresponding to the target number.
[0011] In combination with the first aspect, in some implementation methods of the first aspect, it also includes: after the terminal device establishes a connection with the bound mobile phone through the target application, according to the pre-defined contact data structure, the contact information in the address book of the mobile phone is synchronized to the data file in the order of the contact names.
[0012] In combination with the first aspect, in some implementations of the first aspect, it also includes: generating the view file including multiple partitions according to the data file.
[0013] In combination with the first aspect, in certain implementations of the first aspect, generating the view file including multiple partitions based on the data file includes: dividing the contact information in the data file into multiple partitions according to the number of contacts included in a preset partition, the information of each contact in any of the partitions including: the contact's phone number and the offset of the contact's storage location in the data file; sorting the phone numbers in each partition according to the order of the phone numbers; sorting the sorted partitions between partitions according to a preset sorting method, obtaining a phone number sequence arranged in the order of the phone numbers corresponding to the address book and the offset corresponding to each phone number, and saving them in the view file.
[0014] In combination with the first aspect, in certain implementations of the first aspect, it also includes: determining the data in the resident memory based on the view file; the data in the resident memory sequentially saves the information of the first contact and the last contact in each partition in the order of the partitions of the view file, and the contact information in the data in the resident memory includes: the contact's phone number and the offset of the contact's storage location in the data file.
[0015] In a second aspect, a terminal device is provided, comprising: one or more processors, a memory and a display screen; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the terminal device to execute the contact search method described in the first aspect or any possible implementation of the first aspect.
[0016] In a third aspect, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the processor executes the image processing method described in the first aspect or any possible implementation of the first aspect.
[0017] It can be understood that the technical solutions provided in the above-mentioned second to fifth aspects can respectively correspond to any solution provided in the first aspect and its possible implementation, and the beneficial effects that can be achieved are similar, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1A This is a schematic diagram of an application scenario using the contact person search method of the present application;
[0019] Figure 1B This is a schematic diagram of communication between a watch and a mobile phone in one embodiment of the present application;
[0020] Figure 1CIt is a schematic diagram of synchronizing the address book between a watch and a mobile phone in one embodiment of the present application;
[0021] Figure 1D is a schematic diagram of contact information in a mobile phone address book in one embodiment of the present application;
[0022] Figure 1E This is a flow chart of adding a contact to a mobile phone address book in one embodiment of the present application;
[0023] Figure 2 is a flowchart of a contact search method provided by an embodiment of the present application;
[0024] Figure 3A is a schematic diagram of a process for sorting data in a data view in an embodiment of the present application;
[0025] Figure 3B It is a schematic diagram of sorting any two partition data in an embodiment of the present application;
[0026] Figure 3C It is a schematic diagram of sorting any two partition data in an embodiment of the present application;
[0027] Figure 3D It is a schematic diagram of sorting any two partition data in an embodiment of the present application;
[0028] Figure 4A is a schematic diagram of a data file on the watch side in one embodiment of the present application;
[0029] Figure 4B is a schematic diagram of a data file on the watch side in one embodiment of the present application;
[0030] Figure 4C It is a schematic diagram of the structure of a view file in one embodiment of the present application;
[0031] Figure 4D It is a schematic diagram of the initial state, allocated storage space and offset of a data file in an embodiment of the present application;
[0032] Figure 4E This is a schematic diagram of sorting contacts in a data file by phone number in one embodiment of the present application;
[0033] Figure 4F It is a schematic diagram of partitioning data in a data file in an embodiment of the present application;
[0034] Figure 4G It is a schematic diagram of the structure of a view file in one embodiment of the present application;
[0035] Figure 4H The partition data in the view file in one embodiment of the present application is a schematic diagram;
[0036] Figure 5 This is a schematic diagram of the structure of resident memory data in one embodiment of the present application;
[0037] Figure 6 This is a schematic diagram of the hardware structure of a terminal device in an embodiment of the present application;
[0038] Figure 7 It is a schematic diagram of a software system of a terminal device in one embodiment of the present application. DETAILED DESCRIPTION
[0039] In an embodiment of the present application, a terminal device is provided with a data file, a view file and data in a resident memory; the data file stores contact information in the order of the names of the contacts in the address book; the view file stores the contact phone numbers and the offset of the storage location of each contact in the data file in the order of the phone numbers of the contacts in the address book; the data in the resident memory includes the phone number and offset corresponding to the first data of each partition of the view file, and the phone number and offset corresponding to the last data in the partition; when searching for contacts, the following steps are included: when a preset event is triggered, a target phone number carried by the preset event is obtained; wherein the preset event may be an event such as answering a call or making a call. The target partition is determined according to the target phone number and the data in the resident memory; the value of the target phone number is within the value range determined by the phone number corresponding to the first data of the target partition and the phone number corresponding to the last data of the target partition; when the target phone number is included in the phone numbers stored in the target partition, the offset of the target phone number is determined; and the contact information of the contact corresponding to the target phone number is read from the data file according to the offset.
[0040] For example, if there are 100 contact data, the phone numbers are 123450001 to 123450100 (it should be noted that in the embodiment of the present application, the numbers used in the examples are only used to illustrate the technical solution, not the actual phone numbers, and the numbers used in the examples do not constitute a limitation to the present application). If the number 123450066 is the phone number of the contact "Zhang San", its offset stored in the data file is 1000.
[0041] In the data file, they are stored in order by name field; in the view file, they are stored in ascending order by number.
[0042] Assuming that the maximum number of single partitions in the view file is 20, the total number of partitions is 5, and the number 123450066 is in the 4th partition. The key value of the first data in the first partition is 123450001, and the key value of the last data is 123450020; the key value of the first data in the second partition is 123450021, and the key value of the last data is 123450040; the key value of the first data in the third partition is 123450041, and the key value of the last data is 123450060; the key value of the first data in the fourth partition is 123450061, and the key value of the last data is 123450080; the key value of the first data in the fifth partition is 123450081, and the key value of the last data is 123450100; Find the phone number 12 When searching for the contact corresponding to 3450066, 123450066 is compared with the key value of the first partition. If 123450066 is greater than the last data key 123450020 of the first partition, it is compared with the key value of the second partition. If 123450066 is greater than the last data key 123450040 of the second partition, it is compared with the key value of the third partition. If 123450066 is greater than the last data key 123450060 of the third partition, it is compared with the key value of the fourth partition. 123450066 is between the first data key 123450061 and the last data key 123450080 of the fourth partition. All 20 data of the fourth partition are read from the file, and then the offset 1000 corresponding to the data 123450066 can be found by using the binary search method. Finally, a contact information is read from the data file offset 1000, and the relevant information of the contact "Zhang San" corresponding to the number 123450066 can be obtained.
[0043] In the embodiment of the present application, the terminal device is described by taking a watch as an example. FIG. 1 is a schematic diagram of a scenario using the contact search method provided by the present application. Figure 1AAs shown, the user on the left uses a mobile phone (number 135****129) to call the user with phone number 135****137. The watch receives the call information. The watch searches for contacts in the watch according to the phone number carried by the caller (for example, the phone number is 135****129). After finding the contact, the contact's avatar name (a0017) and phone number 135****129 are displayed in the real interface. It should be noted that there are two ways for the watch to receive a call. If the watch is installed with an embedded SIM card (Embedded-SIM, eSIM) and has been activated, the watch can directly receive the call. If the watch establishes a connection with the bound mobile phone through Bluetooth or other means, the watch can receive the call synchronously after the bound mobile phone receives the call.
[0044] The contact information in the watch can be obtained through the mobile phone bound to it, such as Figure 1B As shown in FIG. 1 , the watch can obtain contact information in the mobile phone through communication methods such as Bluetooth and the like with the mobile phone that has established a connection with it. Figure 1C As shown in the figure, on the mobile phone side, the address book is arranged in alphabetical order by contact name. On the watch side, data files, view files and resident memory data are set. Figure 1D As shown in the figure, the phone's address book stores 16 contact information, each of which includes three fields: name, phone number, and avatar. As you can understand, when a new contact is added to the phone, it will be updated to the address book in the order of name, such as Figure 1E As shown, three contacts are added to the mobile phone side through step 101, step 102 and step 103, and then the added contacts are sorted and added to the address book through step 104. It can be understood that one contact can be added and the information of the new contact can be added to the address book, or several contacts can be added and the new contacts can be sorted and added to the address book, which is feasible and is not limited here.
[0045] When a preset event is triggered, the target phone number carried by the preset event can be obtained, where the preset event can be receiving an incoming call or making a call. It is understandable that some watches can receive calls and make calls, while some watches can only answer calls. It should be noted that the preset event is not limited to receiving calls or making calls, but can also be other events carrying a target phone number, which is not limited here.
[0046] like Figure 2 As shown, in one embodiment, when searching for a contact, the following steps are included:
[0047] 201. Get the phone number n to be searched.
[0048] 202. Set i=1.
[0049] 203. Determine whether i is less than or equal to the total number of partitions of the view file.
[0050] If yes, then step 204 is executed; if no, then the search fails.
[0051] 204. Determine whether n is greater than or equal to the first data in the i-th partition data.
[0052] If yes, then step 205 is executed; if no, then the search fails.
[0053] 205. Determine whether n is less than or equal to the last data in the i-th partition data.
[0054] If yes, execute step 207; if no, execute step 206.
[0055] 206.i=i+1.
[0056] 207. Read all data in the i-th partition into memory.
[0057] 208. Determine whether n is found in the i-th partition.
[0058] If yes, the search is successful; if no, the search fails.
[0059] It should be noted that the view file is generated by the data file, and the view file includes multiple partitions. Specifically, the data file generates the view file including multiple partitions, including: dividing the contact information in the data file into multiple partitions according to the number of contacts included in the preset partitions, and the information of each contact in any partition includes: the contact's phone number and the offset of the contact's storage location in the data file; sorting the phone numbers in each partition according to the order of the phone numbers; sorting the sorted partitions between the partitions according to the preset sorting method, obtaining a phone number sequence arranged in the order of the phone numbers corresponding to the address book and the offset corresponding to each phone number, and saving them in the view file.
[0060] The data in the resident memory stores the information of the first contact and the last contact in each partition in the order of the partitions of the view file. The contact information in the data in the resident memory includes: the contact's phone number and the offset of the contact's storage location in the data file.
[0061] In one embodiment, the process of sorting the data in the data view is as follows: Figure 3A As shown, it includes step 301 and step 312. First, the data in each partition is sorted, and then the data between two partitions is sorted.
[0062] 301. Set i=1.
[0063] 302. Determine whether i is less than or equal to the total number of partitions.
[0064] If yes, execute step 303; if otherwise, i=1.
[0065] 303. Sort the data of the i-th partition.
[0066] 304.i=i+1.
[0067] 305.i=1.
[0068] 306 determines whether i is less than or equal to the total number of partitions - 1.
[0069] If yes, execute step 307; if no, end.
[0070] 307.j=i+1.
[0071] 308. Determine whether j is less than or equal to the total number of partitions.
[0072] If yes, execute step 309 ; if no, execute step 311 .
[0073] 309. Sort the data of the i-th partition and the data of the j-th partition.
[0074] 310.j=j+1.
[0075] 311. The data of the i-th partition is written to the file.
[0076] 312.i=i+1.
[0077] For example, if the data in each partition in the view file is already sorted, when the data of any two data partitions (for example, the data of the i-th partition and the data of the j-th partition) are sorted, Figure 3B As shown, first compare whether the last data in the i-th partition data is less than the first data in the j-th partition data, because 150 is not less than 109; then continue to compare whether the second-to-last data in the i-th partition data is greater than the second data in the j-th partition data, because 133 is not less than 116, then continue to compare whether the third-to-last data in the i-th partition data is greater than the third data in the j-th partition data, because 126 is not less than 118, then continue to compare whether the fourth-to-last data in the i-th partition data is greater than the fourth data in the j-th partition data, because 110 is not less than 119, no more comparison is performed. Figure 3C As shown, the last 3 data of the i-th partition data are exchanged with the first 3 data of the j-th partition data. Then, as Figure 3DAs shown, the i-th partition data is arranged in order from small to large, and the j-th partition data is arranged in order from small to large.
[0078] The technical solution of the embodiment of the present application is described in detail below with reference to examples.
[0079] After the watch establishes a connection with the preset APP on the mobile phone (such as the Honor Sports Health APP), the contact information synchronization is triggered. The data storage structure of the contact information on the watch side is pre-defined on the watch side. When synchronizing the contact information, the data in the storage structure defined by the watch is read from the mobile phone's address book. For example, if the data defined in the storage structure of the watch contact includes: name and phone number, the name and phone number of the contact are read sequentially from the mobile phone's address book. Even if there is a contact avatar in the mobile phone's address book, the contact avatar is not read during reading because the contact avatar is not included in the data structure defined on the watch side. The contact avatar is only read when the storage structure defined on the watch side includes the contact avatar. Assuming that the contact information on the mobile phone side is as follows: Figure 1D As shown in FIG. 1 , if the version number of the data structure of the contact storage defined on the watch side is V1, the data structure of the custom contact storage corresponding to version V1 includes: name and phone number. Then the data file on the watch side is as follows Figure 4A As shown. The data file includes a file header and information from data 1 to data N. The file header includes the total number of data included in the data file and the storage structure version. In this example, the total number of data is the number of contacts on the mobile phone side 16, and the storage structure version is V1. At this time, according to the contact information package name and phone number in the file, Figure 4A As shown. Figure 4B As shown, the data structure in this embodiment is version V2.0, and the data file of the contact in the data structure includes: name, telephone number and avatar.
[0080] like Figure 4CAs shown, the view file includes a file header and each partition data, wherein the file header includes the total number of partitions N, the maximum data volume of a single partition M, the first partition information, the second partition information and the Nth partition information (the information of the last partition). It should be noted that the maximum data volume of a single partition is sometimes relatively large, for example, M may be 50, etc., and is usually pre-set before the watch leaves the factory. For the convenience of description, in this embodiment, the maximum data volume M of a single partition is 4. The first partition information includes: the total number of data in the partition, the first data of the partition stored, and the last data of the partition, wherein the first data of the partition includes: the telephone number corresponding to the first data of the partition and the offset of the starting position of the first data of the partition in the data file. The last data of the partition includes: the telephone number corresponding to the last data of the partition and the offset of the starting position of the last data of the partition in the data file. Other partition information is similar and will not be repeated here. The first partition data includes: the first data, the second data and the Mth data, each data includes: the telephone number corresponding to the data and the offset of the starting position of the data in the data file. When the version number of the data structure stored in the contact defined on the watch side is V2, such as Figure 4D As shown, the header file of the data file includes the contact name, phone number and head portrait. It should be noted that, in this embodiment, assuming that the storage space allocated for the header file is 10, and the storage space allocated for each data is 50, then the offset of the first data relative to the starting position of the header file is 10, the offset of the second data relative to the starting position of the header file is 60, and the offset of other data relative to the starting position of the header file is shown in FIG. Figure 4D As shown in the figure, the order of contacts in the data file after sorting by telephone number is as follows Figure 4D As shown in the last column, the contacts in the view file are sorted by phone number. Figure 4D After sorting the contacts in by phone number, Figure 4E As shown, the view file may include multiple partitions, and each partition is preset with a maximum number of data to be included. In this embodiment, it is assumed that each partition includes 4 data. The partition sequence number of each data in the view file is shown in FIG. Figure 4F As shown in the previous description, the structure of the header file in the view file and the header file corresponding to the sample data can be found in Figure 4G Specifically, the structure of the view file and the data in the example are as follows Figure 4H shown.
[0081] In the embodiments of the present application, Figure 5As shown, the resident memory data includes: the total number of partitions N, the maximum number of single partitions M and information about each partition. The information about each partition includes: the total number of data in the partition, the first data in the partition and the last data in the partition. The first data in the partition includes: the phone number corresponding to the first data in the partition and the offset of the starting position of the first data in the partition in the data file; the last data in the partition includes: the phone number corresponding to the last data in the partition and the offset of the starting position of the last data in the partition in the data file. It can be seen that the resident memory data corresponds to the file header of the view file, and the resident memory data can be determined by the view file. For the resident memory data corresponding to the data in the previous example, see Figure 4G As shown. It should be noted that, if the target phone number is a phone number corresponding to an endpoint of one of the multiple partitions in the resident memory, the offset corresponding to the target phone number can be read from the data in the resident memory. In some embodiments, the data in the target partition in the view file can be loaded into the memory to determine whether the target phone number is recorded in the target partition; when it is determined that the target number is recorded in the target partition, the offset corresponding to the target number is read. For example, if the phone number is 135****223 and is located in the second partition data, the second partition data is loaded into the memory, and the phone number is determined to be 410 in the data file. The contact information corresponding to the target phone number 135****223 is read from the data file according to the offset: the name is a0019, the phone number is 135****223, and the corresponding avatar.
[0082] Figure 6 It is a structural schematic diagram of a terminal device 600 provided in an embodiment of the present application, which can specifically be a mobile phone, a smart screen, a tablet computer, a watch, a bracelet and other wearable terminal devices, a vehicle-mounted terminal device, an augmented reality (AR) device, a virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a projector, etc. The embodiment of the present application does not impose any restrictions on the specific type of the terminal device 600.
[0083] See also Figure 6The terminal device 600 may include a processor 610, an external memory interface 620, an internal memory 621, a universal serial bus (USB) interface 630, a charging management module 640, a power management module 641, a battery 642, an antenna 1, an antenna 2, a mobile communication module 650, a wireless communication module 660, an audio module 670, a speaker 670A, a receiver 670B, a microphone 670C, an earphone interface 670D, a sensor module 680, a button 690, a motor 691, an indicator 692, a camera 693, a screen 694, and a subscriber identification module (SIM) card interface 695, etc. Among them, the sensor module 680 may include a pressure sensor 680A, a gyroscope sensor 680B, an air pressure sensor 680C, a magnetic sensor 680D, an acceleration sensor 680E, a distance sensor 680F, a proximity light sensor 680G, a fingerprint sensor 680H, a temperature sensor 680J, a touch sensor 680K, an ambient light sensor 680L, a bone conduction sensor 680M, etc.
[0084] The processor 610 may include one or more processing units, for example, the processor 610 may include an AP, a CP, a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0085] The controller may be the nerve center and command center of the terminal device 600. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0086] The processor 610 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 610 is a cache memory. The memory may store instructions or data that the processor 610 has just used or circulated. If the processor 610 needs to use the instruction or data again, it may be directly called from the memory. Repeated access is avoided, the waiting time of the processor 610 is reduced, and the efficiency of the system is improved. The processor may also be provided with a low-power memory (e.g., Island low power consumption, etc.) to reduce power consumption.
[0087] The terminal device 600 implements the display function through a GPU, a screen 694, and an application processor. The GPU is a microprocessor for image processing, which connects the screen 694 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 610 may include one or more GPUs, which execute program instructions to generate or change display information.
[0088] The screen 694 is used to display images, videos, etc. The screen 694 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-OLED, a quantum dot light emitting diode (QLED), etc. In some embodiments, the terminal device 600 may include 1 or N screens 694, where N is an integer greater than 1.
[0089] The terminal device 600 can realize the shooting function through ISP, camera 693, video codec, GPU, screen 694 and application processor.
[0090] ISP is used to process the data fed back by camera 693. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 693.
[0091] The camera 693 is 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, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the terminal device 600 may include 1 or N cameras 693, where N is an integer greater than 1.
[0092] The external memory interface 620 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device 600. The external memory card communicates with the processor 610 through the external memory interface 620 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0093] The internal memory 621 can be used to store computer executable program codes, which include instructions. The processor 610 executes various functional applications and data processing of the terminal device 600 by running the instructions stored in the internal memory 621. The internal memory 621 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data (such as audio data, a phone book, etc.) created by the terminal device 600 during use. In addition, the internal memory 621 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, a universal flash storage (UFS), etc.
[0094] The acceleration sensor 680E can detect the magnitude of the acceleration of the terminal device 600 in all directions (generally three axes). When the terminal device 600 is stationary, the magnitude and direction of gravity can be detected. The acceleration sensor 680E can also be used to identify the posture of the terminal device 600, and is applied to horizontal and vertical screen switching, pedometer and other applications. Of course, the acceleration sensor 680E can also be combined with the gyroscope sensor 680B to identify the posture of the terminal device 600, and is applied to horizontal and vertical screen switching.
[0095] The gyroscope sensor 680B can be used to determine the motion posture of the terminal device 400. In some embodiments, the angular velocity of the terminal device 600 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 680B. The gyroscope sensor 680B can be used for anti-shake shooting. Exemplarily, when the shutter is pressed, the gyroscope sensor 680B detects the angle of the terminal device 600 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the terminal device 600 through reverse movement to achieve anti-shake. The gyroscope sensor 680B can also be used for horizontal and vertical screen switching, navigation, and somatosensory game scenes.
[0096] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal device 600. In other embodiments of the present application, the terminal device 600 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0097] The terminal device provided in the embodiment of the present application may be a user equipment (UE), such as a mobile terminal (such as a mobile phone), a tablet computer, or other device.
[0098] In addition, an operating system is run on the above components, such as the Android open source operating system and the liteos operating system developed by Google.
[0099] The software system of the terminal device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture, etc. In order to more clearly illustrate the touch operation recognition method provided in the embodiment of the present application, the embodiment of the present application takes the Android system with a layered architecture as an example to exemplify the software system of the terminal device.
[0100] Above Figure 6 This is just an example of the composition of a terminal device. Figure 7 , which is another example of the composition of a terminal device provided in an embodiment of the present application.
[0101] In this example, the software system of the terminal device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. Taking the system as an example, the software structure of the terminal device is illustrated.
[0102] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. The system is divided into five layers, from top to bottom: application layer, application framework layer, Android runtime (ART) and native C / C++ library, hardware abstraction layer (HAL) and kernel layer.
[0103] The application layer can include a series of application packages.
[0104] like Figure 7 As shown, the terminal device may include a hardware layer and a software layer, wherein the Android system of the layered architecture may include an application layer, an application framework layer, a system library layer and a kernel layer. In some optional embodiments, the system of the terminal device may also include a layer not mentioned in the above technical architecture, such as Android Runtime. The application layer may include a series of application packages, such as navigation applications, music applications, video applications, and knuckle tapping screen applications. The application package may include applications such as video, chat, and a system user interface (SystemUI), and the knuckle tapping screen application may be used for screenshots, screen recording, long screenshots, regional screenshots, etc. In this example, the application package also includes applications such as contact search.
[0105] Video, chat and other applications are used to provide corresponding services to users. For example, users use video applications to watch videos, use chat applications to chat with other users, use music applications to listen to music, and use video synthesis to generate memory videos using existing images and videos.
[0106] SystemUI is used to manage the human-computer interaction interface (user interface, UI) of the terminal device. In the embodiment of the present application, SystemUI is used to monitor the touch operation on the touch screen.
[0107] The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. The application framework layer can include window management service module (window manage service, WMS), display rotation module (also known as DisplayRotation), application management service module (activity manage service, AMS), input management module (also known as Input) and image processing module, etc.
[0108] WMS is used to manage window programs. The window manager can obtain the screen size, determine whether there is a status bar, cut out the image on the screen, capture the screen, etc. In the embodiment of the present application, WMS can create and manage the window corresponding to the application.
[0109] The display rotation module is used to control the screen rotation so that the screen presents a vertical or horizontal layout. For example, when it is determined that the screen needs to be rotated, Surfaceflinger is notified to switch the horizontal and vertical screens of the application interface.
[0110] AMS is used to start specific applications based on user operations. For example, when the image is synthesized, the image is triggered to be displayed on the main screen. After the image is displayed, the image that needs to be cut out is triggered to perform a cutout operation, and an application stack corresponding to the video application is created so that the video application can run normally.
[0111] The system library layer can include multiple functional modules, such as sensor module (also known as sensor) and SurfaceFlinger.
[0112] The sensor module is used to obtain data collected by the sensor, such as collecting the ambient light under the screen. Collect the gravity direction information of the terminal device. Alternatively, the sensor module can also adjust the brightness of the screen according to the ambient light, and determine the horizontal or vertical screen state information of the terminal device according to the gravity direction information of the terminal device. The horizontal or vertical screen state information is used to indicate whether the terminal device is in the horizontal or vertical screen state.
[0113] Surfaceflinger is a system service used for layer creation, control, and management.
[0114] In addition, the system library layer can also include: surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc. The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. 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. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.
[0115] The kernel layer is a layer between hardware and software. In the embodiment of the present application, the kernel layer at least includes a touch driver module and a display driver module.
[0116] The display driver module is used to display the synthesized image on the screen according to the image data provided by the modules of the application framework layer and the application program of the application layer. For example, the video application passes the image data of a frame of the video to the display driver module, and the display driver module displays the image of a frame in the video on the touch screen according to the image data. SystemUI passes the image data to the display driver module, and the display driver module displays the synthesized image on the screen.
[0117] The touch driver module is used to monitor the capacitance data of each area of the touch screen. When the user clicks or slides on the touch screen, the capacitance value of the clicked or slid area will change. The touch driver module can monitor the change of the capacitance value of each area on the touch screen and send a capacitance value change message to the input management module. The capacitance value data change message carries information such as the change amplitude of the capacitance value of each area of the touch screen and the time of change.
[0118] The input management module can determine the touch operation based on the reported capacitance value change message, and then send the identified touch operation to other modules. The touch operation here can include knuckle tapping, clicking, dragging, and specific gesture operations (such as swiping up, swiping sideways, etc.).
[0119] The hardware layer includes the screen and ambient light sensor, etc. The ambient light sensor is used to detect the ambient light information under the screen, etc. The application processor monitors the touch operation on the touch screen, the baseband processor monitors the acceleration data and stores the monitored acceleration data in the storage module, when the AP monitors the touch operation, the CP identifies whether the touch operation is a knuckle tapping action based on the acceleration data stored in the storage module; the CP sends the identification result to the AP.
[0120] The above technical architecture lists the modules and devices that may be involved in this application in the terminal device. In practical applications, the terminal device may include all or part of the modules and devices of the above technical architecture, as well as other modules and devices not mentioned in the above technical architecture. Of course, it may also include only the modules and devices of the above technical architecture, which is not limited in this embodiment.
[0121] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0122] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0123] The present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0124] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0125] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0126] In the embodiments provided in the present application, it should be understood that the disclosed methods and terminal devices can be implemented in other ways. For example, the device / network device embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, 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.
[0127] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0128] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0129] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0130] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0131] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A contact search method, characterized in that: The method is used for a terminal device, wherein the terminal device is provided with a data file, a view file and data in a resident memory; the data file stores contact information in the order of the names of the contacts in the address book; The contact information in the data file includes at least: name and telephone number; the view file stores the telephone numbers of the contacts and the offset of the storage position of each contact in the data file in the order of the telephone numbers of the contacts in the address book; the view file includes multiple partitions, and the view file is generated according to the data file; the data in the resident memory includes the telephone number corresponding to the first data in each partition of the view file and the offset of the starting position of the first data in the partition in the data file, and the telephone number corresponding to the last data in the partition and the offset of the starting position of the last data in the partition in the data file; the method includes: When a preset event is triggered, obtaining a target telephone number carried by the preset event; Determine the target partition according to the target phone number and the data in the resident memory; the value of the target phone number is within the value range determined by the phone number corresponding to the first data of the target partition and the phone number corresponding to the last data of the target partition; When the target telephone number is included in the telephone numbers stored in the target partition, determining an offset of the target telephone number in the view file; Reading contact information of a contact corresponding to the target phone number from the data file according to the offset of the target phone number; The step of generating the view file including multiple partitions according to the data file includes: According to the number of contacts included in the preset partitions, the contact information in the data file is divided into a plurality of partitions, wherein the information of each contact in any of the partitions includes: the contact's phone number and the offset of the contact's storage location in the data file; Sort the telephone numbers in each partition according to the order of the telephone numbers; The sorted partitions are sorted between the partitions according to a preset sorting method to obtain a telephone number sequence arranged in the order of telephone numbers corresponding to the address book and an offset corresponding to each telephone number, which are saved in the view file.
2. The method according to claim 1, characterized in that After reading the contact information of the contact corresponding to the target phone number from the data file according to the offset of the target phone number, the method further includes: The contact information of the contact corresponding to the target phone number is displayed on the display interface of the terminal device.
3. The method according to claim 1, characterized in that When the target telephone number is included in the telephone numbers stored in the target partition, determining the offset of the target telephone number includes: When the target telephone number is a telephone number corresponding to an endpoint of one of the multiple partitions in the resident memory, an offset corresponding to the target telephone number is read from data in the resident memory.
4. The method according to claim 1, characterized in that: When the target telephone number is included in the telephone numbers stored in the target partition, determining the offset of the target telephone number in the view file includes: Loading the data in the target partition in the view file into the memory, and determining whether the target telephone number is recorded in the target partition; When it is determined that the target telephone number is recorded in the target partition, the offset corresponding to the target telephone number is read.
5. The method according to any one of claims 1 to 4, characterized in that Also includes: After the terminal device and the bound mobile phone are connected through the target application, the contact information in the address book of the mobile phone is synchronized to the data file in the order of the contact names according to the predefined contact data structure.
6. The method according to any one of claims 1 to 4, characterized in that Also includes: Determine the data resident in the memory according to the view file; The data in the resident memory stores the information of the first contact and the last contact in each partition in the order of the partitions of the view file. The contact information in the data in the resident memory includes: the contact's phone number and the offset of the contact's storage location in the data file.
7. A terminal device, characterized in that: The terminal device comprises: one or more processors, memory, and display screens; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the terminal device to execute the contact search method according to any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the contact search method according to any one of claims 1 to 6.
