Method and terminal for loading contact information
By using the load mark bit (-1) during terminal startup, it means that the loading operation is not successful, and re-execute the loading operation under subsequent conditions, the problem of preset contact information loading during terminal startup is solved, ensuring that the contact application is The preset contact information can be displayed correctly.
Patent Information
- Application Number
- CN202410688959.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2044-05-30
AI Technical Summary
In the prior art, when the terminal performs a preset contact information loading operation during startup, it may cause the loading failure, causing the loading mark bit to be wrongly updated to a successful state, thereby making the preset contact information unable to be displayed in the contact application.
During terminal startup, the load mark bit (-1) is used to indicate that the load operation is not successful, and the mark bit is updated to 1 only when the load operation is successful. If loading fails, keep the mark bit -1 and re-execute the load operation until successful if the foreground runs the contact application or inserts the phone card.
Ensure that the value of the load mark bit correctly reflects whether the contact database contains preset contact information, improves the success rate of writing preset contact information from the contact profile to the contact database, and ensures that the contact application can be displayed correctly. Preset contact information.
Smart Images

Figure CN118474073B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a method and a terminal for loading contact information. Background Art
[0002] Adding preset contact information to the contact application by default in the terminal is a way to improve the user experience. Here, the preset contact information includes the hotline number frequently used by the user. Dial the hotline number in the preset contact information to provide the user with some commercial services, emergency services, etc. For example, alarm, fire protection, connection to communication operators, etc.
[0003] How to add preset contact information in the terminal for users to use is worth discussing. Summary of the invention
[0004] The present application provides a method and a terminal for loading contact information, which are used to add preset contact information to a contact application.
[0005] In a first aspect, the present application provides a method for loading contact information, which is applied to a terminal, comprising: during the startup of the terminal, when a loading mark bit is a first value, performing a preset contact information loading operation; wherein the loading operation includes: writing the preset contact information from a contact configuration file into a contact database of a contact application; when the loading fails, maintaining the loading mark bit at the first value; when the loading is successful, updating the loading mark bit from the first value to a second value; the contact configuration file is not recorded in an installation package of the contact application but the contact application is allowed to access it; the loading mark bit is a first value used to indicate that the contact database does not include the preset contact information in the contact configuration file; the loading mark bit is a second value used to indicate that the contact database includes the preset contact information; after the startup is completed, detecting an operation of running the contact application in the foreground, and displaying the contact information in the contact database in the contact application; when the loading mark bit is the second value, the contact information displayed in the contact application includes the preset contact information.
[0006] In the above embodiment, the loading flag bit being the first value can be understood as the loading flag bit involved in the embodiment being -1, and the loading flag bit being the second value can be understood as the loading flag bit involved in the embodiment being 1. The contact configuration file is independent of the contact application, can support different contact applications or other applications other than contacts to access, and writes the preset contact information into the contact database, increasing the scalability of the contact configuration file. This means that the preset contact information in the contact configuration file does not belong to a specific contact application, and is data that supports being shared by multiple applications (including multiple different contact applications). Moreover, setting the preset contact information into the contact configuration file facilitates customization of the preset contact information. The terminal determines whether to modify the loading flag bit based on the loading result, so that the value of the loading flag bit can correctly reflect whether the preset contact information is included in the contact database.
[0007] In combination with the first aspect, in some embodiments, after detecting the operation of running the contact application in the foreground, before displaying the contact information in the contact database in the contact application, the method also includes: when the loading mark bit is the first value, performing the preset contact information loading operation again.
[0008] In the above embodiment, when the loading mark bit is the first value, it means that the loading operation performed during the startup process of the aforementioned terminal has failed, and the preset contact information has not been written into the contact database. Since there is a possibility of the loading operation failing during the startup process, it is set here that when the operation of running the contact application in the foreground is detected, the loading mark bit can be detected as the first value, so that the loading operation can be performed again, so that the preset contact information can be tried again to be displayed from the contact database to the contact application. The probability of writing the preset contact information from the contact configuration file to the contact database is improved. The reason why the loading operation is performed again when the contact application is running in the foreground is because the contact process can be pulled up when the contact application is running in the foreground, and the contact process is used to perform the loading operation.
[0009] In combination with the first aspect, in some embodiments, when the loading flag bit is a first value, before the loading, the method further includes: determining that the contact information in the contact database includes custom contact information.
[0010] In the above embodiment, the terminal can display the preset contact information only after creating a custom contact in the contact application, so as to prevent the user from being confused when the content (preset contact information) appears before the contact application is used.
[0011] In combination with the first aspect, in some embodiments, after the startup is completed, the method further includes: detecting an operation of inserting a phone card; and when determining that the loading mark bit is the first value, executing the preset contact information loading operation again.
[0012] In the above embodiment, when the loading flag is the first value, it means that the loading operation performed during the startup process of the terminal has failed, and the preset contact information has not been written into the contact database. Since there is a possibility of the loading operation failing during the startup process, it is set here that when the operation of inserting a phone card is detected, the loading flag can be detected as the first value, so that the loading operation is performed again, which increases the probability of writing the preset contact information from the contact configuration file into the contact data. The reason why the loading operation is performed again when the phone card is inserted is that the contact process can be pulled up when the phone card is inserted, and the contact process is used to perform the loading operation.
[0013] In combination with the first aspect, in some embodiments, during the startup of the terminal, the method further includes: the terminal runs the contact application in the background, and performs the loading operation through the contact process of the contact application.
[0014] In combination with the first aspect, in some embodiments, the reasons for the loading failure include: the contact process accesses the contact database N times, and the contact database is not unlocked; the i-th access to the contact database and the (i+1)-th access to the contact database are separated by a first preset time, and the value range of i is 1 to N-1.
[0015] In the above embodiment, the contact database is locked when the terminal is started. N accesses to the contact database are set, and a preset time is set between two adjacent accesses, so that the contact database can be unlocked successfully, thereby increasing the probability of writing the preset contact information into the contact database.
[0016] In combination with the first aspect, in some embodiments, when the loading mark bit is a first value, before executing the preset contact information loading operation, the method also includes: obtaining a contact profile based on an identifier of the contact profile; the identifier of the contact profile is associated with a device model of the terminal; and the device model indicates the contact profile that the contact application of the terminal is allowed to access.
[0017] In combination with the first aspect, in some embodiments, when the contact profiles allowed to be accessed by the contact application of the terminal include at least one contact profile pre-made with the card, before performing the preset contact information loading operation, the method also includes: determining that a phone card has been inserted into the terminal; obtaining an identifier of a first contact profile from the at least one contact profile pre-made with the card, the first contact profile including the communications operator that issued the phone card; and using the preset contact information in the first contact profile as the preset contact information written into the contact database.
[0018] In the above embodiment, the contact profiles allowed to be accessed by the contact application include at least one contact profile pre-made with the card. In some areas, there may be more than one type of phone card, but the contact profile pre-made with the card may include the service phone number of the communication operator in the area where the terminal is issued. Different types of phone cards require different contact profiles for the terminal, so it is necessary to select the contact configuration information adapted to the inserted phone card after inserting the phone, so that the preset contact information displayed in the final contact application can include the service phone number of the communication operator that issued the inserted phone.
[0019] In combination with the first aspect, in some embodiments, the method further includes: during the startup process, determining that the terminal is not inserted with a phone card issued by a communication operator, and not performing the loading operation.
[0020] In the above embodiment, the contact profiles allowed to be accessed by the contact application include at least one contact profile pre-made with the card. If the phone card is not inserted, the loading operation is not performed. Otherwise, the communication operator may be displayed in the contact page, which confuses the user.
[0021] In combination with the first aspect, in some embodiments, the terminal is a terminal having a single phone card slot.
[0022] In the above embodiment, the value of the loading flag reflects whether the preset contact information has been written into the contact database. Therefore, if the terminal has at least two card slots, when phone card 1 is inserted, the preset contact information in the contact profile adapted by phone card 1 may be written into the contact database, and the loading flag is modified to 1. In this way, when phone card 2 is inserted (the communication operator that issues phone card 2 is different from the communication operator that issues phone card 1), the loading flag is 1, and the loading operation cannot be performed again, and the preset contacts in the contact profile adapted by phone card 2 cannot be written into the contact database. This makes the user wonder why there is only one communication operator of the phone card (phone card 1) in the contact page even though two cards issued by different communication operators have been inserted.
[0023] In combination with the first aspect, in some embodiments, after the loading flag is updated from the first value to the second value, the method further includes: in response to an operation of resetting the terminal, updating the loading flag from the second value to the first value.
[0024] In the above embodiment, resetting the terminal will delete the data in the terminal, including the contact information in the contact database. Therefore, the loading flag needs to be updated to the second value so that the preset contact information can be rewritten from the contact configuration file to the contact database the next time the terminal is restarted or after restarting.
[0025] In a second aspect, an embodiment of the present application provides a terminal, comprising: one or more processors and a memory; 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 to execute the method implemented in the first aspect.
[0026] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions, which, when executed on a terminal, causes the terminal to execute the method implemented in the first aspect.
[0027] In a fourth aspect, an embodiment of the present application provides a chip system, which is applied to a terminal. The chip system includes one or more processors, and the processor is used to call computer instructions so that the terminal executes the method implemented in the first aspect.
[0028] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a terminal, enables the terminal to execute the method implemented in the first aspect.
[0029] It is understandable that the terminal provided in the second aspect, the computer storage medium provided in the third aspect, the chip system provided in the fourth aspect, and the computer program product provided in the fifth aspect are all used to execute the method provided in the embodiment of the present application. Therefore, other beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 An exemplary flow chart of writing preset contact information from a contact configuration file into a contact database in the aforementioned manner is shown;
[0031] Figure 2A as well as Figure 2B An exemplary scenario in which the terminal does not display preset contact information in the contact application is shown;
[0032] Figure 3An exemplary scenario in which the terminal displays preset contact information in the contact application is illustrated;
[0033] Figure 4 An exemplary scenario in which the terminal displays preset contact information in the contact application is illustrated;
[0034] Figure 5 An exemplary process of modifying the loading flag bit based on the loading result to add the preset contact information to the contact application is shown;
[0035] Figure 6 An exemplary flow chart of a terminal performing a loading operation is shown in FIG.
[0036] Figure 7 An exemplary process of modifying the loading flag bit based on the loading result to add the preset contact information to the contact application is shown;
[0037] Figure 8 It is a schematic diagram of the structure of the terminal provided in the embodiment of the present application. DETAILED DESCRIPTION
[0038] In one method, in order to add preset contact information to a contact application, a contact configuration file is used to record the preset contact information. Then, during the startup of the terminal, the terminal performs a preset contact information loading operation. The preset contact information in the configuration file is written into the contact database of the contact application through the loading operation. If the loading is successful, the terminal can display the preset contact information in the contact database in the contact page (also called the address book page) of the contact application. Among them, the contact database of the contact application is used to record contact information. The contact information includes: preset contact information and user-defined custom contact information. When displaying the contact page, the terminal can obtain the contact information in the contact database and display it in the contact page.
[0039] It should be noted here that the contact configuration file is not recorded in the installation package of the contact application, but the contact application is allowed to access it. In this way, the contact configuration file is independent of the contact application, can support different contact applications to access it, and write the preset contact information into the contact database. This means that the preset contact information in the contact configuration file does not belong to a specific contact application, and is data that supports being shared by multiple applications (including multiple different contact applications). In addition, setting the preset contact information in the configuration file facilitates customization of the preset contact information. The terminal may include multiple contact configuration files, which facilitates the terminal to select the required contact configuration file. The preset contact information in the required contact configuration file is then written into the contact database of the contact application for use by the contact application. The types of the multiple contact configuration files may include at least one of: a contact configuration file pre-made with the card, a contact configuration file pre-made with the region, and the like.
[0040] In some possible cases, the contact configuration file pre-made with the card may include the service telephone number (a kind of preset contact information) of the communication operator in the area where the terminal is issued. The preset contact information in the contact configuration file pre-made with the region may include the hotline of the area where the terminal is issued. The contact configuration file pre-made with the card and the contact configuration file pre-made with the region may be the same or different, and the embodiment of the present application does not limit this.
[0041] As mentioned above, the terminal selects the required contact configuration file, including: the terminal obtains the identifier of the contact configuration file required by the terminal based on the device model of the terminal. Subsequently, the terminal finds the contact configuration file based on the identifier of the contact configuration file, and obtains (reads and parses) the content in the contact configuration file. The device model of the terminal is associated with the identifier of the contact configuration file required by the terminal, and it can also be understood that the device model of the terminal indicates the contact configuration files that the contact application of the terminal is allowed to access. The developers have set up appropriate contact configuration files for terminals of different device models before the terminals leave the factory, and associated the identifier of the contact configuration files that the contact application of the terminal is allowed to access with the device model of the terminal. For example, for terminals issued to area A, its device model is associated with the identifier of the contact configuration file A pre-made with the area, and the contact configuration file A may include the hotline of area A.
[0042] Before executing the preset contact information loading operation, the aforementioned terminal needs to determine that the loading flag is -1. When starting the loading operation, the loading flag is updated from -1 to 1. In this way, determining that the loading flag is -1 means that the terminal has not yet executed the preset contact information loading operation, and the preset contact information loading operation needs to be executed to write the preset contact information in the contact configuration file into the contact database of the contact application. If the loading flag is 1, it means that the terminal has already executed the preset contact information loading operation, and the terminal does not execute the preset contact information loading operation.
[0043] Figure 1 An exemplary flow chart of writing preset contact information from a contact configuration file into a contact database in the aforementioned manner is shown.
[0044] For a description of this process, please refer to the following steps S11 and S12.
[0045] S11. During the terminal startup process, when the loading mark bit is -1, the preset contact information loading operation is performed, and the loading operation includes: obtaining a contact configuration file, updating the loading mark bit to 1, and writing the preset contact information in the contact configuration file into the contact database of the contact application.
[0046] Here, after starting the loading operation, the terminal updates the loading flag bit to 1 regardless of whether the writing operation is successful. The writing operation refers to writing the preset contact information in the contact configuration file into the contact database of the contact application. That is, the terminal defaults that the loading operation will succeed. In fact, there is a possibility that the loading operation fails (loading failure).
[0047] Among them, the reasons for the loading failure include: the write operation failed. The write operation occurs during the terminal startup process. In the initial stage of startup, the terminal needs to perform various initialization operations so that the terminal can be used normally after restarting. The content initialized here includes initializing the contact database of the contact application. During the initialization of the contact database, in order to determine the data integrity and security of the contact database, the terminal will lock the contact database so that the contact database cannot be accessed. The contact database will be unlocked only after the initialization of the contact database is completed. When performing a write operation, the terminal will set to access the contact database N times (for example, usually 6 times). In the scenario of accessing the contact database N times, if the contact database is not unlocked, the preset contact information cannot be written into the contact database, and the write operation fails. There is a preset time interval (for example, 3s) between the i-th access to the contact database and the i+1-th access to the contact database. In some possible implementations, the terminal performs a write operation through a contact process of a contact application. The reason why the contact database is not unlocked when the contact process accesses the contact database is not only because the initialization is not completed, but also includes: the terminal has completed the initialization of the contact database and unlocked the contact database, but other processes other than the contact process are accessing the contact database. In order to correctly allocate the right to use the contact database, the contact database is locked again until the other process completes the access and unlocks it. Therefore, the contact process cannot access the contact database. Here, the other process can be a process such as a text message process that also needs to use the contact database.
[0048] It should also be noted that the terminal startup in step S11 is usually the first startup of the terminal after leaving the factory, or the first startup of the terminal after being reset.
[0049] S12. After the startup is completed, the operation of running the contact application in the foreground is detected, the loading flag is determined to be 1, and the contact information in the contact database is displayed in the contact application.
[0050] The terminal determines that the loading flag is 1, and does not perform the preset contact information loading operation, and displays the contact information in the contact database in the contact application, for example, in the contact page of the contact application.
[0051] However, at this time, the contact information displayed by the terminal in the contact application may not include the preset contact information. Because in the aforementioned step S11, although the loading flag bit is updated from -1 to 1, there is a possibility that the write operation fails. The loading flag bit is also updated to 1 when the write operation fails, which misleads the terminal. When the terminal determines that the loading flag bit is 1, it mistakenly determines that the contact database already includes the preset contact information, which is not actually included. The terminal will not perform the loading operation when the loading flag bit is 1, which results in the preset contact information not being displayed in the contact application.
[0052] In addition, the value of the loading flag bit will be reset from 1 to -1 only under certain circumstances, such as terminal reset (restoring factory settings). This means that if certain circumstances do not occur, the terminal will not be able to display the preset contact information in the Contacts application. Figure 2A and Figure 2B An exemplary scenario in which a terminal cannot display preset contact information in a contact application is described in detail.
[0053] like Figure 2A As shown in (1), interface 11 is an exemplary interface involved in the terminal startup process. At this time, the terminal cannot be used by the user. During the startup process, the terminal performs the loading operation involved in the aforementioned step S11, and updates the loading flag bit from -1 to 1. However, the terminal fails to perform the write operation, and the preset contact information in the contact configuration file is not written into the contact database of the contact application. The following error will appear Figure 2A Middle (2)- Figure 2A (4) and Figure 2B The scenes involved.
[0054] After the startup is complete, the terminal can display the following Figure 2A The interface 12 shown in (2) is an exemplary desktop of the terminal. The interface 12 may include an icon 121 of a contact application.
[0055] Subsequently, the terminal executes the aforementioned step S12, including: in response to an operation on the icon 121 of the contact application (an operation of running the contact application in the foreground), determining that the loading flag bit is 1, and no longer performing the loading operation, the terminal may display the following: Figure 2A The interface 13 shown in (3) includes an exemplary contact page (also referred to as a contact book page) provided by the contact application. At this time, the contact page does not include contact information.
[0056] In response to the operation of creating a new custom contact in the contact page shown in interface 13, after the creation is completed, the terminal may display the following Figure 2AThe interface 14 shown in (4) is an exemplary contact page including custom contact information. However, the contact page displayed in the interface 14 still does not include the preset contact information.
[0057] Then, close the Contacts app, such as Figure 2B As shown in (1), the terminal returns to interface 12 (exemplary desktop). The terminal executes the aforementioned step S12 again, including: in response to the operation on the icon 121 of the contact application, determining that the loading flag is 1, no longer performing the loading operation, and the terminal runs the contact application in the foreground, and the terminal displays the following Figure 2B In the interface 14 shown in (2), only the custom contact information is displayed in the interface 14, and the preset contact information is still not displayed.
[0058] In order to solve the problem in the above-mentioned method, the problem includes: after starting the loading operation, when the write operation fails, the terminal also updates the loading mark bit to 1, which causes the terminal to mistakenly judge that the contact database already includes the preset contact information, but the contact page cannot display the preset contact information. A method for loading contact information is proposed, in which the contact configuration file is also used to record the preset contact information. Then, during the terminal startup process, when the loading mark bit is -1, the terminal performs the preset contact information loading operation. Different from the above-mentioned method, the loading operation in the method for loading contact information includes: obtaining (reading and parsing) the contact configuration file, writing the preset contact information in the contact configuration file into the contact database of the contact application, and only when the loading is successful, the loading mark bit is updated from -1 to 1. Otherwise, when the loading fails, the loading mark bit is kept at -1. The reasons for the loading failure here include the aforementioned write operation failure. For the relevant content of the write operation failure, reference can be made to the description of the write operation failure in the above-mentioned step S11. It will not be repeated here. For the detailed content of the loading operation in the method for loading contact information, reference can be made to the following description of step S101, which will not be repeated here.
[0059] Here, after determining whether the loading is successful, the value of the loading flag is determined based on the loading result, so that the loading flag can correctly indicate whether the contact database includes the preset contact information. Here, the loading flag is -1 to indicate that the contact database does not include the preset contact information in the contact configuration file. The loading flag is 1 to indicate that the contact database includes the preset contact information in the contact configuration file.
[0060] If loading fails during the terminal startup process, the loading flag remains at -1. This means that later, when the operation of running the contact application in the foreground is detected, the terminal can determine that the loading flag is -1, and then perform the preset contact information loading operation again. The probability of successfully writing the preset contacts in the contact profile to the contact database (of the contact application) is increased. At this time, the terminal can display the contact information in the contact database in the contact application. The exemplary scenarios involved in this process refer to the following Figure 3 .
[0061] like Figure 3 As shown in (1), interface 11 is an exemplary interface involved in the terminal startup process. At this time, the terminal cannot be used by the user. During the terminal startup process, the terminal executes the loading operation in the method for loading contact information. If the loading is successful, the loading flag bit is updated from -1 to 1. If the loading fails, the loading flag bit is kept at -1. Here, the loading failure is taken as an example for explanation.
[0062] It should be noted that, unless otherwise specified, the loading operation mentioned below refers to the loading operation in the method for loading contact information, which is different from the loading operation in the aforementioned step S11.
[0063] After the startup is complete, the terminal can display the following Figure 3 The interface 12 shown in (2) is an exemplary desktop of the terminal. The interface 12 may include an icon 121 of a contact application.
[0064] Subsequently, in response to the operation on the icon 121 of the contact application, the terminal determines that the loading flag is -1 and performs the loading operation again. Here, the loading success is used as an example for explanation. The terminal may display the following information: Figure 3 Interface 31 shown in (3) includes an exemplary contact page (also referred to as an address book page) provided by the contact application. At this time, the contact page includes preset contact information. It should be noted that if the loading operation fails again, the terminal may not display interface 31, but instead display a contact interface that does not include the preset contact information. However, the loading mark bit is still -1 at this time, and the terminal may perform the loading operation again the next time it detects an operation of running the contact application in the foreground. And so on, until the loading mark bit is 1, the terminal successfully writes the preset contact information into the contact database of the contact application, thereby realizing the display of the contact page based on the preset contact information in the contact database, so that the preset contact information is displayed in the contact page.
[0065] In some possible cases, when it is determined that the loading flag is -1, before executing the loading operation, the terminal also determines that the contact database of the contact application is not empty. It should be noted here that determining whether the contact database of the contact application is empty can be completed through a query operation. When the number of contact information in the contact database is 0, it is determined that the contact database is empty. The query operation can be performed when the contact database is locked or when the contact database is unlocked. That is, whether the contact database is locked does not affect the execution of the query operation, because the query operation does not modify the content in the database, but whether the contact database is locked will affect the execution of the aforementioned write operation.
[0066] When the loading flag is determined to be -1, if the contact database is empty, the loading operation is not performed and the loading flag is kept at -1. If the contact database is not empty, it means that the terminal has not used the contact application to create a new custom contact. After the terminal uses the contact application to create a new custom contact, the custom contact information can be recorded in the contact database.
[0067] Then, the contact application is closed. Subsequently, the terminal detects the operation of running the contact application in the foreground, determines that the loading flag is -1, and determines that the contact database of the contact application is not empty, then performs the loading operation, and writes the preset contact information in the contact configuration file to the contact database. In response to the operation of running the contact application in the foreground, both the custom contact information and the preset contact information in the contact database are displayed in the contact application. The exemplary scenarios involved in this process refer to the following Figure 4 .
[0068] like Figure 4 As shown in (1), interface 13 is an exemplary contact page displayed when the contact database is empty. At this time, the contact page does not include contact information. In response to the operation of creating a new custom contact in the contact page shown in interface 13, after the creation is completed, the terminal can display the following Figure 4 The interface 14 shown in (2) is an exemplary contact page including custom contact information. However, the contact page displayed in the interface 14 does not include preset contact information, because before this, the contact data is empty, the terminal has not performed the loading operation, and the loading flag is -1.
[0069] Then, close the Contacts app, such as Figure 4As shown in (3), the interface 12 (exemplary desktop) is returned. Subsequently, an operation on the icon 121 of the contact application is detected (an operation of running the contact application in the foreground), and it is determined that the contact database of the contact application is not empty, then a loading operation is performed to write the preset contact information in the contact configuration file into the contact database. In response to the operation of running the contact application in the foreground, both the custom contact information and the preset contact information in the contact database are displayed in the contact application (such as Figure 4 In the interface 41) shown in (4).
[0070] Figure 5 The above-mentioned exemplary process of modifying the loading flag based on the loading result to add the preset contact information to the contact application is shown.
[0071] The contents involved in this process can refer to the following description of steps S101 to S104.
[0072] S101. During the terminal startup process, when the loading mark bit is -1, the preset contact information loading operation is performed, including: writing the preset contact information in the contact configuration file into the contact database of the contact application, when the loading is successful, the loading mark bit is updated from -1 to 1, and when the loading fails, the loading mark bit is kept at -1.
[0073] The case where the loading is successful includes: the terminal writes the preset contact information in the contact configuration file into the contact database.
[0074] The case where the loading fails includes: the terminal fails to write the preset contact information in the contact configuration file into the contact database, for example, the contact database involved in the above is not unlocked.
[0075] Figure 6 An exemplary flow chart of the terminal performing a loading operation is shown in FIG.
[0076] For the relevant contents involved in the terminal performing the loading operation, reference may be made to the following description of steps S201 to S208.
[0077] S201. The contact process performs a preset contact information loading operation through a contact information loading method.
[0078] The process involved in performing the loading operation may be a contact process in the contact application. Regardless of whether the contact application is running in the background or in the foreground, it supports launching the contact process to perform the aforementioned loading operation. It can also be understood that during the terminal startup process, the contact application is in the background running state, and the contact process in the contact application can be launched to perform the aforementioned loading operation.
[0079] The following steps S202 to S207 are exemplary processes involved in executing the contact information loading method.
[0080] S202. Calling a contact information writing method to write preset contact information into a contact database.
[0081] The contact information loading method calls the contact information writing method to write the preset contact information into the contact database. When calling, the parameters passed to the contact information writing method include: the initial value of the write result: false. The value of the write result is false, indicating that the preset contact information has not been written into the contact database. If the write is successful later, the value of the write result is updated from false to true.
[0082] S203. The default write result is false, and the initial value of i is 1.
[0083] i is used to record the number of attempts to access the contact database. i can be a parameter recorded in the contact information writing method. Each time the terminal accesses the contact database for a write operation, the value of i is +1. The maximum value of i is N times, where N can be 6 times, or other times such as 4 times. The value of N is related to the processing power of the terminal. The stronger the processing power of the terminal, the smaller N. Because the stronger the processing power, the faster the terminal startup process will end, so too many attempts will affect the subsequent startup process of the terminal and affect the user experience. When i is N, if the write has not been successful, the write result returned is false. This also means that the load has failed.
[0084] Regarding the process of writing contact information (taking 6 times as an example), reference may be made to the following steps S204 to S206 .
[0085] S204. Execute the database writing method, i=i+1, and check whether the writing is successful.
[0086] The contact information writing method calls a database writing method (eg, applyBatch() function) to execute an operation of writing preset contact information into the contact database.
[0087] When the writing is successful, the database writing method executes the following step S205b to modify the writing result to true.
[0088] In the case of a write failure, the database write method executes i=i+1, and then executes the following step S205a.
[0089] S205a.i is greater than 6.
[0090] i is greater than 6, indicating that the number of times the contact data is accessed in this loading operation has reached the upper limit. The write result is kept as false, and the following step S206 is executed.
[0091] If i is less than or equal to 6, it means that the contact database can still be accessed. Repeat step S204. If the writing is successful, the downloading step S205b is executed.
[0092] S205b. Modify the write result to true.
[0093] S206. The database writing method returns the writing result to the contact information loading method.
[0094] S207. Through the contact information loading method, if the writing result is true, the loading mark bit is changed from -1 to 1; if the writing result is false, the loading mark bit is kept at -1.
[0095] If the write result is true, the contact process changes the loading flag from -1 to 1 through the contact information loading method. If the write result is false, the loading flag remains at -1.
[0096] S208. End the contact information loading method.
[0097] After step S101 is completed, the terminal may still not record the preset contact information in the configuration file into the contact database. Therefore, in addition to performing the aforementioned loading operation when the terminal is started, after startup, the loading operation can be performed again when the loading flag is -1. Scenarios in which the loading operation can be performed after startup include: when the contact application is running in the foreground and / or a phone card is inserted. Because the terminal can pull up the contact process in both scenarios, the loading operation can be performed through the contact process in both scenarios. In this way, the possibility of a successful loading operation can be increased.
[0098] The following steps S102 and S103 describe the relevant contents involved in the loading operation when the terminal runs the contact application in the foreground.
[0099] S102. After the startup is completed, the operation of running the contact application in the foreground is detected, and the loading flag is obtained.
[0100] S103. When the loading flag is 1, the contact information in the contact database is displayed in the contact application; when the loading flag is -1, the preset contact information loading operation is performed again, and then the contact information in the contact database is displayed in the contact application.
[0101] When the loading flag is 1, the terminal does not perform the loading operation. At this time, when the contact information in the contact database is displayed in the contact application, the contact application may include preset contact information. The exemplary scenario involved in this process can refer to the previous Figure 3 and Figure 4 .
[0102] The loading flag is -1, and the terminal performs the loading operation again. After the loading operation is completed, the contact information in the contact database is displayed in the contact application. At this time, if the loading operation fails again, the contact information in the contact database is displayed in the contact application, and the contact application does not include the preset contact information.
[0103] For the relevant contents of executing the loading operation, please refer to the description of executing the loading operation in the aforementioned step S101, which will not be repeated here.
[0104] The following step S104 describes the relevant contents involved in the loading operation performed by the terminal when the phone card is inserted.
[0105] S104. After the startup is completed, the operation of inserting the phone card is detected, and when the loading flag is -1, the preset contact information loading operation is executed again.
[0106] When step S102 and step S103 have been executed, step S104 is optional.
[0107] Here, if the loading operation is successfully executed again, then subsequently, the operation of running the contact application in the foreground is detected, and when the contact page is displayed, the contact page includes the preset contact information.
[0108] If the loading operation fails again, the terminal will perform the loading operation again when it detects that the contact application is running in the foreground. The cycle continues until the terminal loads successfully.
[0109] In some possible cases, before the terminal performs the preset contact information loading operation in step S101, step S103 and step S104, it is necessary to determine that the contact database is not empty, that is, to determine that the contact information in the contact database includes custom contact information.
[0110] In this way, the terminal can display the preset contact information only after creating a custom contact in the contact application, so as to prevent the user from being confused when the content (preset contact information) appears before the contact application is used.
[0111] It should be noted that there is no particular order in which the steps S102 and S104 are executed, and the same effect can be achieved regardless of which one is executed first.
[0112] It should also be noted that, in some possible cases, the determination of whether the loading flag is 1 in the aforementioned steps S101 to S104, the determination of whether to perform the loading operation based on the value of the loading flag, and the execution of the loading operation can all be performed by the contact process in the contact application. After the loading is successful, the contact database of the contact application can include the preset contact information. After the contact application is subsequently run in the foreground, the operation of displaying the preset contact in the contact application can be implemented by other processes in the contact application except the contact process, or by the contact process, which is not limited in the embodiments of the present application.
[0113] In addition, the loading operation also includes: after determining that the loading flag bit is -1 and before performing the write operation, obtaining (reading and parsing) the contact configuration file. The process of obtaining the contact configuration file includes: the contact process reads the contact configuration file based on the identifier of the contact configuration file, and after reading the configuration file, parses the configuration file. The identifier of the contact configuration file can be determined by the operating system process and provided to the contact process. The operating system process transmits the identifier of the contact configuration file to the contact process and triggers the contact process to perform the loading operation.
[0114] The identifier of the contact configuration file may be a path of the contact configuration file.
[0115] In the case that only one contact configuration file is recorded in the terminal, the operating system process transmits the path of the contact configuration file to the contact process.
[0116] When at least two configuration files are recorded in the terminal, the operating system process selects the identifier of the associated contact configuration file based on the device model of the terminal. It can be understood that the device model indicates the contact configuration files that the contact application of the terminal is allowed to access.
[0117] It should be noted that if the device model of the terminal is associated with multiple identifiers of contact profiles 1. The operating system process can select one of the identifiers of the contact profile 1 from the multiple identifiers of the contact profiles 1 based on other decision factors. The other decision factors are usually related to the content in the contact profile 1. For example, when the contact profile 1 is a contact profile pre-made with the card, since the contact profile pre-made with the card may include the service phone number of the communication operator in the area where the terminal is issued. Then the other decision factor may be the type of phone card inserted in the terminal. The phone card type indicates the communication operator that issued the phone card. The operating system process can select the identifier of the contact profile 11 from multiple contact profiles 1 pre-made with the card. The contact profile 11 includes the communication operator that issued the phone card inserted in the terminal.
[0118] It should also be noted that the type of the contact configuration file may include at least one of the following contact configuration files: a contact configuration file pre-made with the card, a contact configuration file pre-made with the region, etc. For the relevant contents of the contact configuration file pre-made with the card and the contact configuration file pre-made with the region, reference can be made to the aforementioned description of the relevant contents, which will not be repeated here.
[0119] It should also be noted that the contact information loading method mentioned above can be collectively referred to as loadContacts(). The names of the methods (interfaces) called by the contact information loading method in step S101, step S103 and step S104 can be different or the same, and this embodiment of the application does not limit this. The contact information writing method mentioned above can be opersizeOrProductCustFeatureEnable().
[0120] Figure 7 The above-mentioned exemplary process of modifying the loading flag based on the loading result to add the preset contact information to the contact application is shown.
[0121] Figure 7 The process shown is applicable to the scenario where the contact profiles that the contact application allows to access include multiple contact profiles pre-made with the card, and the terminal is not inserted with a phone card when starting. For a description of this process, please refer to the following steps S301 to S303.
[0122] S301. During the terminal startup process, it is detected that no phone card is inserted into the terminal, and the contact configuration file adapted to the phone card cannot be determined, and the loading operation is not performed.
[0123] Based on the foregoing information on determining the identifier of the preset configuration file based on the type of inserted phone card, if the terminal does not have a phone card inserted, a contact configuration file adapted to the phone card is determined, and the loading operation cannot be performed.
[0124] S302. After the startup is completed, the operation of inserting a phone card is detected. When the loading flag is -1, the preset contact information loading operation is performed again, including: obtaining a contact configuration file adapted to the phone card, writing the preset contact information in the contact configuration file into the contact database of the contact application, and when the loading is successful, updating the loading flag from -1 to 1, and when the loading fails, keeping the loading flag at -1.
[0125] The process of obtaining the contact configuration file adapted for the phone card includes: reading the contact configuration file based on the identifier of the contact configuration file (adapted for the phone card), and parsing the configuration file after reading the configuration file.
[0126] S303. After the startup is completed, the operation of the foreground contact application is detected and the loading flag is obtained.
[0127] S304. If the loading flag is 1, the contact information in the contact database is displayed in the contact application; if the loading flag is -1, the preset contact information loading operation is performed again, and then the contact information in the contact database is displayed in the contact application.
[0128] The step S303 and step S304 are respectively the same as the aforementioned step S102 and step S103, and reference may be made to the aforementioned description of step S102 and step S103, which will not be repeated here.
[0129] In some possible cases, before the terminal performs the preset contact information loading operation in step S302 and step S304, it is necessary to determine that the contact database is not empty, that is, to determine that the contact information in the contact database includes custom contact information.
[0130] In some possible cases, the process involved in the aforementioned steps S301-S304 is applicable to a terminal with a single phone card slot. Because the value of the loading flag reflects whether the preset contact information has been loaded into the contact database. Therefore, if the terminal has at least two card slots, it may cause the preset contact information in the contact profile adapted by phone card 1 to be loaded into the contact database when phone card 1 is inserted, and the loading flag is modified to 1. In this way, when phone card 2 is inserted (the communication operator that issues phone card 2 is different from the communication operator that issues phone card 1), the loading flag is 1, and the loading operation cannot be performed again, and the preset contacts in the contact profile adapted by phone card 2 cannot be written into the contact database. Let the user wonder why two cards issued by different communication operators are inserted, but there is only one communication operator of the phone card (phone card 1) in the contact page.
[0131] In some possible cases, the contact profile that the contact application allows access to includes a scenario in which multiple contact profiles are pre-made with the card. In addition to the above steps S301-S304, the method for loading preset contacts also includes: when the operation of pulling out the phone card is detected, the preset contacts in the contact database are deleted. And the loading flag bit is updated from 1 to -1. When the phone card is reinserted, the loading operation can be re-executed. In this way, when the reinserted phone card is inconsistent with the previously pulled out phone card, it can also be guaranteed that the loading operation is re-executed after the phone card is reinserted. In the re-execution of the loading operation, the preset configuration file adapted to the reinserted phone card is loaded into the contact database, so that the contact page can display the communication operator that issued the reinserted phone card.
[0132] It should be noted that there is no particular order in which the steps S302 and S303 are executed, and the same effect can be achieved regardless of which one is executed first.
[0133] It should also be noted that, in some possible cases, the determination of whether the loading flag is 1 in the aforementioned step S302 and step S304, the determination of whether to perform the loading operation based on the value of the loading flag, and the execution of the loading operation can all be performed by the contact process in the contact application. After the loading is successful, the contact database of the contact application can include the preset contact information. After the contact application is subsequently run in the foreground, the operation of displaying the preset contact in the contact application can be implemented by other processes in the contact application except the contact process, or by the contact process, which is not limited in the embodiments of the present application.
[0134] At this time, the process of obtaining the contact configuration file adapted to the phone card includes: the contact process reads the contact configuration file based on the identifier of the contact configuration file (adapted to the phone card), and after reading the configuration file, parses the configuration file. The identifier of the contact configuration file (adapted to the phone card) can be determined by the operating system process and provided to the contact process. The operating system process transmits the identifier of the contact configuration file (adapted to the phone card) to the contact process and triggers the contact process to perform a loading operation. The description of this process can refer to the aforementioned related content, which will not be repeated here.
[0135] The following first introduces an exemplary terminal provided in an embodiment of the present application.
[0136] Figure 8 It is a schematic diagram of the structure of the terminal provided in the embodiment of the present application.
[0137] The following embodiment is specifically described by taking a terminal as an example. It should be understood that a terminal may have more than Figure 8 More or fewer components may be shown, two or more components may be combined, or there may be a different configuration of components. Figure 8 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
[0138] The terminal may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194 and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0139] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (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.
[0140] The SIM card interface 195 is used to connect a SIM card (the aforementioned telephone card). The SIM card can be connected to and separated from the terminal by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The terminal can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The terminal interacts with the network through the SIM card to implement functions such as calls and data communications.
[0141] In the embodiment of the present application, the processor 110 can call the computer instructions stored in the internal memory 121 to enable the terminal to execute the method in the embodiment of the present application.
[0142] The present application also provides a chip system, which includes at least one processor, and is used to implement the functions involved in the method executed by the terminal in any of the above embodiments.
[0143] In one possible design, the chip system also includes a memory, which is used to store program instructions and data, and the memory is located inside or outside the processor.
[0144] The chip system may be composed of the chip, or may include the chip and other discrete devices.
[0145] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.
[0146] Optionally, the memory in the chip system may be one or more. The memory may be integrated with the processor or may be separated from the processor, which is not limited in the embodiment of the present application.
[0147] Exemplarily, the memory can be a non-transitory processor, such as a read-only memory ROM, which can be integrated with the processor on the same chip or can be set separately on different chips. The embodiments of the present application do not specifically limit the type of memory and the setting method of the memory and the processor.
[0148] The present application also provides a computer program product, which includes: a computer program (also referred to as code, or instruction), which enables a computer to execute the method executed by a terminal in any of the above embodiments when the computer program is executed.
[0149] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program (also referred to as code or instruction). When the computer program is executed, the computer executes the method executed by the terminal in any of the above embodiments.
[0150] As described above, the above embodiments 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, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0151] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.
[0152] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.
[0153] The terms "first" and "second" are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate 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, "plurality" means two or more.
[0154] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0155] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
Claims
1. A method for loading contact information, characterized in that: Applied to terminals, including: During the startup of the terminal, when the loading flag bit is a first value, performing a preset contact information loading operation; Wherein, the loading operation includes: writing the preset contact information from the contact configuration file into the contact database of the contact application; in case of the loading failure, keeping the loading flag as the first value; in case of the loading success, updating the loading flag from the first value to a second value; the contact configuration file is not recorded in the installation package of the contact application but the contact application is allowed to access; the loading flag is a first value used to indicate that the contact database does not include the preset contact information in the contact configuration file; the loading flag is a second value used to indicate that the contact database includes the preset contact information; After the startup is completed, an operation of running the contact application in the foreground is detected, and the contact information in the contact database is displayed in the contact application; when the loading flag is the second value, the contact information displayed in the contact application includes the preset contact information; In the case where the contact configuration files allowed to be accessed by the contact application include at least one contact configuration file pre-made with the card, before performing the preset contact information loading operation, the method further includes: Determining that a phone card has been inserted into the terminal; Acquire an identifier of a first contact profile from the at least one contact profile pre-made with the card, the first contact profile including a communication operator that issued the phone card; The preset contact information in the first contact configuration file is used as the preset contact information written into the contact database.
2. The method according to claim 1, characterized in that After detecting the operation of running the contact application in the foreground, before displaying the contact information in the contact database in the contact application, the method further includes: When the loading flag bit is the first value, the preset contact information loading operation is performed again.
3. The method according to claim 1 or 2, characterized in that: When the loading flag bit is the first value, before the loading, the method further includes: determining that the contact information in the contact database includes custom contact information.
4. The method according to any one of claims 1 to 3, characterized in that After the startup is completed, the method further includes: Detecting the operation of inserting a phone card; When it is determined that the loading flag bit is the first value, a preset contact information loading operation is performed.
5. The method according to any one of claims 1 to 4, characterized in that During the terminal startup process, the method further includes: the terminal runs the contact application in the background, and performs the loading operation through the contact process of the contact application.
6. The method according to claim 5, characterized in that The reasons for the loading failure include: The contact process accesses the contact database N times, and the contact database is not unlocked; the i-th access to the contact database is separated from the (i+1)-th access to the contact database by a first preset time, and the value range of i is 1 to N-1.
7. The method according to any one of claims 1 to 6, characterized in that When the loading flag bit is the first value, before performing the preset contact information loading operation, the method further includes: The contact configuration file is obtained based on an identifier of the contact configuration file; the identifier of the contact configuration file is associated with a device model of the terminal; and the device model indicates a contact configuration file that a contact application of the terminal is allowed to access.
8. The method according to any one of claims 1 to 7, characterized in that The method further includes: during the startup process, determining that the terminal is not inserted with a telephone card issued by a communication operator, and not performing the loading operation.
9. The method according to any one of claims 1 to 8, characterized in that The terminal is a terminal with a single phone card slot.
10. The method according to any one of claims 1 to 9, characterized in that After updating the load flag bit from the first value to the second value, the method further includes: In response to an operation of resetting the terminal, the loading flag bit is updated from the second value to the first value.
11. A terminal, characterized in that: include: One or more processors and a memory; 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 to execute the method as described in any one of claims 1-10.
12. A computer-readable storage medium comprising computer instructions, characterized in that: When the computer instructions are executed on a terminal, the terminal is caused to execute the method according to any one of claims 1 to 10.
13. A chip system, the chip system is applied to a terminal, characterized in that: The chip system includes one or more processors, and the processor is used to call computer instructions so that the terminal executes the method as described in any one of claims 1-10.
14. A computer-readable storage medium comprising instructions, characterized in that: When the instruction is executed on a terminal, the terminal is caused to execute the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
SIM card contact person storage method and system and intelligent terminal
CN111262988A
Information processing method and device, equipment and storage medium
CN116088747A