WiFi scanning method and device of electronic equipment and electronic equipment

By setting an application whitelist in electronic devices and processing WiFi scanning events according to application level and permissions, virtual scanning results are generated, solving the problem of peer-to-peer communication interruption caused by WiFi scanning and achieving communication stability and continuity.

CN120957205APending Publication Date: 2025-11-14HISENSE VISUAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510969001.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-14
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

When electronic devices scan for WiFi, data transmission in point-to-point communication channels is interrupted, affecting the stability of communication between devices.

Method used

Configure an application whitelist in electronic devices to determine whether to respond to WiFi scanning events based on the application's level and permissions, and generate virtual scan results to ensure the continuity of data transmission on the point-to-point channel.

Benefits of technology

By generating virtual scan results, the impact of WiFi scanning on point-to-point channel data transmission is avoided, ensuring the stability and continuity of communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120957205A_ABST
    Figure CN120957205A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of equipment communication, and provides a WiFi scanning method and device for electronic equipment and the electronic equipment, and the method comprises the steps: when the electronic equipment needs to carry out WiFi scanning, firstly obtaining the current communication state of a point-to-point channel in the electronic equipment, and if the electronic equipment is carrying out data transmission in the point-to-point channel at the moment, carrying out WiFi scanning; the application initiating the WiFi scanning event is not in the application white list, and the WiFi scanning event is not responded, that is, WiFi scanning is not carried out firstly; in order to return the event processing result to the application, a virtual scanning result can be generated and returned to the application initiating the WiFi scanning event, which represents that the WiFi scanning event has been successfully completed. According to the method provided by the invention, the continuity of data transmission on the P2P channel can be ensured to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of device communication technology, and in particular relates to a WiFi scanning method, apparatus and electronic device for electronic devices. Background Technology

[0002] As electronic devices become more functional, they can support peer-to-peer (P2P) communication and Wi-Fi communication. Peer-to-peer (P2P) communication is a decentralized network communication model in which individual nodes (peers) communicate directly with each other and share resources without relying on a central access point. For example, it allows electronic devices to communicate with other devices without the need for a router.

[0003] In order to connect to WiFi, electronic devices need to perform WiFi scanning. At this time, if the electronic device connects with other devices via P2P and transmits data, the electronic device will switch from the P2P channel to other channels to perform WiFi scanning. Data transmission on the P2P channel will be suspended, causing data transmission failure on the P2P channel. Summary of the Invention

[0004] This application provides a WiFi scanning method, apparatus, and electronic device for electronic devices, which can solve the problem of P2P channel data transmission failure caused by WiFi scanning.

[0005] In a first aspect, embodiments of this application provide a WiFi scanning method for an electronic device, applied to an electronic device that supports peer-to-peer communication and WiFi communication, the method further comprising:

[0006] When an application in the electronic device initiates a WiFi scanning event, the current communication status of the point-to-point channel is obtained, wherein the point-to-point channel is the channel used by the electronic device to communicate with other devices in a point-to-point manner;

[0007] If the current communication state is a data transmission state and the application is not in the stored application whitelist, the application will not respond to the WiFi scanning event and will generate a virtual scan result. The virtual scan result indicates that the WiFi scan was successfully completed.

[0008] Return the virtual scan results to the application.

[0009] In this application, when an electronic device needs to perform a WiFi scan, the current communication status of the point-to-point channel in the electronic device is first obtained to determine whether the electronic device is currently transmitting data through the point-to-point channel. If the electronic device is currently transmitting data through the point-to-point channel, and the application initiating the WiFi scan event is not in the application whitelist, it indicates that the application initiating the WiFi scan event has a low priority. In this case, to ensure that the point-to-point channel can continue to transmit data, the WiFi scan event is not responded to, that is, WiFi scanning is not performed initially. To return the event processing result to the application, a virtual scan result can be generated and returned to the application that initiated the WiFi scan event to inform the application that the WiFi scan event has been successfully completed. The method of this application can, to a certain extent, guarantee the continuity of data transmission on the P2P channel.

[0010] In one possible implementation of the first aspect, after obtaining the current communication state of the point-to-point channel, the method further includes:

[0011] If the current communication state is a data transmission state and the application is in the stored application whitelist, respond to the WiFi scanning event to obtain the actual scanning result;

[0012] Return the actual scan results to the application.

[0013] In this application, if the current communication state is data transmission state and the application is stored in the application whitelist, it means that the application has a relatively high level. In order not to affect the operation of the application, it is necessary to respond to the WiFi scanning event immediately so that the application can work normally.

[0014] In one possible implementation of the first aspect, after obtaining the current communication state of the point-to-point channel, the method further includes:

[0015] If the current communication state is a non-data transmission state, respond to the WiFi scanning event to obtain the actual scanning result;

[0016] Return the actual scan results to the application.

[0017] In one possible implementation of the first aspect, when an application in the electronic device initiates a WiFi scanning event, obtaining the current communication state of the point-to-point channel includes:

[0018] When an application in the electronic device initiates a WiFi scanning event, the packet name of the application is obtained;

[0019] Query the application's preset permissions based on the application's package name;

[0020] If the application's preset permissions include network configuration permissions, obtain the current communication status of the point-to-point channel.

[0021] In this application, the permissions of the application that initiates the WiFi scanning event are verified before processing the WiFi scanning event. This ensures the legitimacy of the WiFi scanning event being processed and avoids system damage caused by processing illegitimate WiFi scanning events.

[0022] In one possible implementation of the first aspect, if the application's preset permissions include network configuration permissions, obtaining the current communication status of the point-to-point channel includes:

[0023] If the application's preset permissions include network configuration permissions, determine whether the electronic device's WiFi function is in a faulty state;

[0024] If it is determined that the WiFi function of the electronic device is in a non-faulty state, obtain the current communication status of the point-to-point channel.

[0025] In this application, the WiFi function of the electronic device is tested to determine whether the WiFi function of the electronic device is in a faulty state; in order to ensure that the WiFi function of the electronic device can be used during WiFi scanning. If the WiFi function is unavailable, even if WiFi scanning is performed, the electronic device cannot use WiFi. At this time, WiFi scanning is a useless operation and increases the workload of the electronic device.

[0026] In one possible implementation of the first aspect, the method further includes:

[0027] After the electronic device starts up, it reads the application whitelist from the non-memory database of the electronic device;

[0028] The read application whitelist is stored in the memory database of the electronic device;

[0029] Accordingly, when an application in the electronic device initiates a WiFi scanning event, the application whitelist is read from the memory database.

[0030] In this application, the application whitelist stored in the non-memory database is stored in the memory database. When in use, the application whitelist is read from the memory database, which can improve the reading speed of the application whitelist and improve the overall response speed of the electronic device.

[0031] In one possible implementation of the first aspect, the electronic device is equipped with an Android system, and the system layer of the Android system provides WiFi service.

[0032] Obtain the current communication status of the point-to-point channel, including:

[0033] After the WiFi service receives the WiFi scanning event initiated by the application, it calls the WiFi service to obtain the current communication status of the point-to-point channel;

[0034] If the current communication state is a data transmission state and the application is not in the stored application whitelist, the application will not respond to the WiFi scanning event and will generate a virtual scan result, including:

[0035] If the current communication state is a data transmission state and the application is not in the stored application whitelist, the WiFi service is invoked without responding to the WiFi scanning event, and a virtual scan result is generated.

[0036] Returning the virtual scan results to the application includes:

[0037] The WiFi service is invoked to return the virtual scan results to the application.

[0038] Secondly, embodiments of this application provide an electronic device that supports point-to-point communication and WiFi communication. The electronic device includes:

[0039] The status acquisition module is used to acquire the current communication status of the point-to-point channel when an application in the electronic device initiates a WiFi scanning event, wherein the point-to-point channel is the channel used by the electronic device to communicate with other devices in a point-to-point manner;

[0040] The virtual result generation module is used to generate a virtual scan result when the current communication state is data transmission state and the application is not in the stored application whitelist, without responding to the WiFi scanning event. The virtual scan result indicates that the WiFi scan was successfully completed.

[0041] The result sending module is used to return the virtual scan results to the application.

[0042] Thirdly, embodiments of this application provide a terminal device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the WiFi scanning method of the electronic device described in any one of the first aspects.

[0043] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the WiFi scanning method of the electronic device described in any one of the first aspects.

[0044] Fifthly, embodiments of this application provide a computer program product that, when run on a terminal device, causes the terminal device to execute the WiFi scanning method of the electronic device described in any of the first aspects. Attached Figure Description

[0045] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0046] Figure 1 This is a schematic diagram comparing the time taken during WiFi scanning according to an embodiment of this application;

[0047] Figure 2 This is a schematic diagram of the transmission of WiFi scanning signals in a system architecture according to an embodiment of this application;

[0048] Figure 3 This is a schematic diagram of signal transmission during a WiFi scanning process provided in an embodiment of this application;

[0049] Figure 4 This is a schematic flowchart of a WiFi scanning method for an electronic device provided in an embodiment of this application;

[0050] Figure 5 This is a flowchart illustrating a WiFi scanning method for an electronic device according to another embodiment of this application;

[0051] Figure 6 This is a flowchart illustrating a method for determining the communication status of a point-to-point channel according to an embodiment of this application.

[0052] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0053] Figure 8 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation

[0054] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0055] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0056] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.

[0057] To meet user needs, electronic devices are becoming increasingly feature-rich. These devices can operate in two modes simultaneously: standard Wi-Fi mode (connected to a router) and peer-to-peer (P2P) direct connection. P2P direct connection refers to the direct transmission of information between devices without going through a router.

[0058] When an electronic device has both normal WiFi mode and P2P mode, if the electronic device is connected to other devices via P2P and is transmitting data through the P2P channel, and the electronic device is scanning for WiFi, it will stop transmitting data through the P2P channel to scan for WiFi on other channels. In this case, because data transmission through the P2P channel is suspended, other devices connected to the electronic device cannot communicate with it, affecting the normal operation of other electronic devices.

[0059] For example, when a TV and a wireless speaker use a P2P connection, the TV will send information to the wireless speaker at a certain frequency to determine the current location of the wireless speaker, so as to determine the connection mode when the TV sends data to the wireless speaker, such as left channel connection or right channel connection; or, when the TV is playing a video, the TV can send an audio signal to the wireless speaker, and the TV's sound will be played out through the wireless speaker.

[0060] When the TV needs to perform WiFi scanning at a certain frequency, the TV will stop sending data to the wireless speaker through the P2P channel. If this is during the wireless speaker's position calibration phase, the wireless speaker's position calibration will fail; if this is during the audio signal transmission phase, the speaker's sound will stutter.

[0061] Reference Figure 1 As shown, the TV operates on the P2P channel for a duration of T1. When WiFi scanning is required, the TV driver switches from the P2P channel to the WLAN channel, with a switching duration of T2. After switching to the WLAN channel, WiFi scanning begins, and the WLAN channel operation time is T3. After the WiFi scan ends, the TV driver switches from the WLAN channel back to the P2P channel, with a switching duration of T2. After switching to the P2P channel, the TV operates on the P2P channel for a duration of T1.

[0062] Depend on Figure 1 It can be seen that when the channel is switched and the WLAN channel is working, the P2P channel is not working, which affects the data transmission between the TV and the wireless speaker.

[0063] To address the aforementioned issues, this application pre-sets an application whitelist, storing higher-level applications in the whitelist. When an electronic device communicates with other devices via a P2P channel, if the WiFi scan is initiated by an application in the whitelist, the original WiFi scan procedure is executed; if the WiFi scan is not initiated by an application in the whitelist, the WiFi scan procedure is not executed, but a virtual scan result is generated to indicate that the WiFi scan was successfully completed. This application does not process WiFi scans initiated by lower-level applications, thus ensuring the stability of communication between the electronic device and other devices via the P2P channel.

[0064] Before introducing the specific implementation method of this application, we will first introduce the execution process of WiFi scanning.

[0065] Reference Figure 2 As shown, an electronic device may include an application layer, a system layer, a kernel layer, a driver layer, and a hardware layer.

[0066] The application layer directly faces the user and includes all the applications that users use daily and the pre-installed system applications, such as TV applications.

[0067] The system layer is the core support of the Android system, providing underlying functions and services for upper-layer applications. It mainly includes native system services, libraries, and the system runtime environment. Specifically, the system layer can include clients, servers, and processes that communicate with the kernel. The client stores various management functions, such as WiFi Manager. The server implements core network services, handles low-level communication, and stores various services, such as WiFi Service. The process that communicates with the kernel bridges the system layer and the kernel layer, handling hardware-related operations. For example, Hardware: a hardware abstraction module used to standardize hardware interfaces; WiFi Cond: monitors WiFi status (such as signal strength, connection failures) and triggers policy adjustments (such as automatic reconnection).

[0068] The kernel layer is used to manage the network protocol stack and device nodes. For example, Netlink is the communication interface between the kernel and user space.

[0069] The driver layer directly controls hardware devices; for example, WiFi ko is a WiFi driver chip.

[0070] The hardware layer consists of physical device entities.

[0071] When performing a WiFi scan, the application at the application layer (such as the homepage or settings) initiates a WiFi scan event and sends the WiFi scan event to the WiFi Manager at the system layer. The WiFi Manager at the system layer sends the WiFi scan event to the WiFi Service, and the WiFi Service calls WiFi Cond. WiFi Cond communicates with the kernel through Netlink, and finally, Netlink in the kernel layer notifies the WiFi ko at the driver layer to perform a WiFi scan.

[0072] Please refer to the following. Figure 3 As shown, the execution process of WiFi scanning will be further explained.

[0073] After the application triggers a WiFi scan, it sends a WiFi scan command to the WiFi Manager.

[0074] After receiving the WiFi scan command, WiFi Manager sends the WiFi scan command to the scan request proxy through WiFi servicelmpl.

[0075] After receiving the WiFi scanning command, the scan request proxy calls the interface of the WiFi scanner and sends the WiFi scanning command to the WiFi scanning service implementation (WiFi scanningservicelmpl).

[0076] After receiving the WiFi scanning command, WiFi scanning servicelmpl sends the WiFi scanning command to the concurrent WiFi implementation (WiFi Cond Scannerlmpl).

[0077] WiFi Cond Scannerlmpl sends WiFi scanning commands to the underlying WiFi (WiFi Native) layer.

[0078] WiFi Native calls WiFi cond through WiFi cond Control. WiFi cond then notifies Netlink in the kernel layer. Netlink sends WiFi scanning commands to WiFi ko in the driver layer to perform WiFi scanning.

[0079] After receiving the scan results, the kernel layer sends them to WiFi cond. WiFi cond then calls back to WiFi Native, which notifies WiFi CondScannerImpl to update its stored scan results via WiFi Monitor, ensuring that WiFi Cond ScannerImpl stores the scan results from the last WiFi scan. WiFi Cond ScannerImpl then sends the latest scan results to WiFi ScanningServiceImpl. WiFi Scanning ServiceImpl sends the scan results to WiFi Scanner. WiFiScanner notifies Scan Request Proxy to update the scan results required by the application. After receiving the broadcast indicating that the WiFi scan is complete, the application can retrieve the WiFi scan results (such as the most recent scan results) through the get Scan Results interface.

[0080] The above describes the process of an electronic device scanning for WiFi. See below for further details. Figure 4 The overall process of this application will be explained.

[0081] The WiFi scanning whitelist control module in the electronic device receives an application whitelist sent by the server, or receives an application whitelist sent by the application.

[0082] The WiFi scanning whitelist control module sends the application whitelist to the setting provider database (configuration management database). Upon receiving the application whitelist, the setting provider database stores it. The setting provider database is a non-in-memory database, meaning it does not reside in memory.

[0083] After the electronic device boots up (also known as after the system boots up within the electronic device, for example, after the Android system boots up), the electronic device (or system) reads the application whitelist from the setting provider database and stores the application whitelist in a local database (in-memory database). Additionally, the electronic device can monitor the setting provider database in real time so that if the application whitelist in the setting provider database is updated, the updated application whitelist can be stored in the local database.

[0084] When an application in an electronic device triggers a WiFi scan event, it reads an application whitelist from a local database. Then, based on the read application whitelist, it determines whether to respond to the WiFi scan event and generates the corresponding scan results.

[0085] The WiFi scanning method for electronic devices according to embodiments of this application will be described in detail below.

[0086] Figure 5 A schematic flowchart of the WiFi scanning method for electronic devices provided in this application is shown, with reference to... Figure 5 The method is described in detail below:

[0087] S101, when an application in the electronic device initiates a WiFi scanning event, the current communication status of the point-to-point channel is obtained, wherein the point-to-point channel is the channel used by the electronic device to communicate with other devices in a point-to-point manner.

[0088] In this implementation, the application that initiates the WiFi scanning event can be any application in the electronic device that has this function.

[0089] When an electronic device has a point-to-point connection with other devices, data is transmitted between them through a point-to-point channel. During this data transmission, the current communication state of the point-to-point channel is in data transmission mode. When no data transmission occurs between the electronic device and other devices, the current communication state of the point-to-point channel is in non-data transmission mode.

[0090] By detecting the current communication status of the point-to-point channel, it can be determined whether point-to-point data transmission exists between electronic devices and other devices.

[0091] S102, if the current communication state is a data transmission state and the application is not in the stored application whitelist, the application does not respond to the WiFi scanning event, generates a virtual scanning result, and the virtual scanning result indicates that the WiFi scan was successfully completed.

[0092] In this implementation, if the current communication state is data transmission state, it can be determined that there is point-to-point data transmission between the electronic device and other devices. At this time, if WiFi scanning is performed directly, it will affect the point-to-point data transmission and affect the use of other devices.

[0093] To determine whether to respond to a WiFi scan event, you can check the application whitelist to see if the application initiating the event is on it. If the application is on the whitelist, it means the application has high privileges, and the WiFi scan event initiated by this application is an urgent event that requires immediate response. If the application is not on the whitelist, it means the application has low privileges, and the WiFi scan event initiated by this application is not an urgent event. Therefore, you can choose not to respond to the WiFi scan event to minimize the impact on peer-to-peer communication caused by the WiFi scan.

[0094] In order to return a successful WiFi scan result to the application when the device does not respond to a WiFi scan event, the device can generate a virtual scan result. That is, instead of performing a WiFi scan, it directly generates a result indicating that the WiFi scan has been successfully completed, so as to indicate that the current WiFi scan has been successfully completed.

[0095] S103, return the virtual scan result to the application.

[0096] It should be noted that the implementation process of steps S101 to S103 above can be carried out on the server side of the system layer; specifically, it can be implemented in the WiFi service on the server side.

[0097] Specifically, after the WiFi service receives a WiFi scanning event initiated by the application, it calls the WiFi service to obtain the current communication status of the point-to-point channel; if the current communication status is a data transmission status and the application is not in the stored application whitelist, it calls the WiFi service not to respond to the WiFi scanning event and generates a virtual scan result; it then calls the WiFi service to return the virtual scan result to the application.

[0098] In this application, when an electronic device needs to perform a WiFi scan, the current communication status of the point-to-point channel in the electronic device is first obtained to determine whether the electronic device is currently transmitting data through the point-to-point channel. If the electronic device is currently transmitting data through the point-to-point channel, and the application that initiated the WiFi scan event is not in the application whitelist, it indicates that the application initiating the WiFi scan event has a low priority. In this case, to ensure that the point-to-point channel can continue to transmit data, the WiFi scan event is not responded to, that is, WiFi scanning is not performed initially. To return the event processing result to the application, a virtual scan result can be generated and returned to the application that initiated the WiFi scan event, indicating that the WiFi scan event has been successfully completed. The method of this application can, to a certain extent, guarantee the continuity of data transmission on the P2P channel.

[0099] The above describes the process of not responding to WiFi scanning events. The following describes the process of responding to WiFi scanning events.

[0100] Scenario 1: After obtaining the current communication status of the point-to-point channel, if the current communication status is data transmission status and the application is in the stored application whitelist, respond to the WiFi scanning event, obtain the actual scanning result, and return the actual scanning result to the application.

[0101] In this implementation, if there is point-to-point data communication between the electronic device and other devices at the current moment, and an application in the application whitelist initiates a WiFi scanning event, then the WiFi scanning event initiated by the application should be responded to first. For the specific WiFi scanning process, please refer to the above description. Figure 2 and Figure 3 The description will not be repeated here.

[0102] Scenario 2: If the current communication state is not a data transmission state, respond to the WiFi scanning event, obtain the actual scanning result, and return the actual scanning result to the application.

[0103] In this implementation, if there is no point-to-point data transmission between the electronic device and other devices, performing a WiFi scan will not affect the point-to-point data transmission. Therefore, a WiFi scan can be performed directly to obtain the scan results.

[0104] In addition, after an application initiates a WiFi scanning event, in order to determine whether the application has the permission to scan for WiFi, it is necessary to verify the application's permissions to ensure the legitimacy of the WiFi scanning event.

[0105] Specifically, such as Figure 6 As shown, the implementation process of step S101 above may specifically include:

[0106] S1011, when an application in the electronic device initiates a WiFi scanning event, obtain the packet name of the application.

[0107] In this implementation, the package name of each application is pre-set. The package name of an application is used as an identifier to identify the application.

[0108] S1012, query the preset permissions of the application based on the application's package name.

[0109] In this implementation, the functional permissions of each application are pre-set. After obtaining the package name of the application, the functions that the application can perform are determined based on the package name.

[0110] Alternatively, a pre-defined list of application package names that can initiate WiFi scanning events can be set up. After determining the application package name, the list can be checked to see if the application package name exists in the pre-defined list.

[0111] S1013, if the preset permissions of the application include network configuration permissions, obtain the current communication status of the point-to-point channel.

[0112] In this implementation, if the application that initiates the WiFi scanning event has network configuration permissions, it means that the WiFi scanning event is legitimate and can be processed.

[0113] If the application that initiated the WiFi scan event does not have network configuration permissions, the WiFi scan event is invalid. In this case, the WiFi scan event can be ignored, and the event processing failure result should be returned to the application.

[0114] In this application, the permissions of the application that initiates the WiFi scanning event are verified before processing the WiFi scanning event. This ensures the legitimacy of the WiFi scanning event being processed and avoids system damage caused by processing illegitimate WiFi scanning events.

[0115] Furthermore, if it is determined that the application initiating the WiFi scanning event has network configuration permissions, the WiFi function of the electronic device can be detected to determine whether the WiFi function of the electronic device is in a fault state; if it is determined that the WiFi function of the electronic device is in a non-fault state, the current communication status of the point-to-point channel can be obtained, and the above steps S102 to S103 can continue to be executed.

[0116] If it is determined that the WiFi function of the electronic device is malfunctioning, then WiFi is unavailable. Even if a WiFi scan is performed, a connection cannot be established. Therefore, the WiFi scan event does not need to be processed to reduce data processing load. In this case, a result indicating event processing failure can be returned to the application.

[0117] In another possible implementation, the above method may also include:

[0118] S11: When an application in an electronic device initiates a WiFi scanning event, obtain the application's package name and application whitelist.

[0119] S12, determine the default permissions of the application based on the application's package name.

[0120] S13, if the preset permissions include network configuration permissions, determine whether the WiFi function of the electronic device is in a faulty state.

[0121] S14. If it is determined that the WiFi function of the electronic device is in a non-faulty state, obtain the current communication status of the point-to-point channel.

[0122] S15, if the current communication state is data transmission state, determine whether the application is in the application whitelist.

[0123] S16. If it is determined that the application is not in the application whitelist, do not respond to the WiFi scanning event, generate a virtual scan result, and return the virtual scan result to the application.

[0124] S17: If it is determined that the application is in the application whitelist, respond to the WiFi scanning event and obtain the actual scanning result; return the actual scanning result to the application.

[0125] S18, if the current communication state is a non-data transmission state, respond to the WiFi scanning event, obtain the actual scanning result, and return the actual scanning result to the application.

[0126] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0127] Corresponding to the WiFi scanning method for electronic devices described in the above embodiments, Figure 7 A block diagram of an electronic device provided in an embodiment of this application is shown. For ease of explanation, only the parts related to the embodiments of this application are shown.

[0128] Reference Figure 7 The electronic device 200 may include: a status acquisition module 210, a virtual result generation module 220, and a result sending module 230.

[0129] The status acquisition module 210 is used to acquire the current communication status of the point-to-point channel when an application in the electronic device initiates a WiFi scanning event. The point-to-point channel is the channel used by the electronic device to communicate with other devices in a point-to-point manner.

[0130] The virtual result generation module 220 is used to generate a virtual scan result when the current communication state is a data transmission state and the application is not in the stored application whitelist, without responding to the WiFi scanning event. The virtual scan result indicates that the WiFi scan was successfully completed.

[0131] The result sending module 230 is used to return the virtual scan result to the application.

[0132] In one possible implementation, the status acquisition module 210 also includes:

[0133] The scanning execution module is used to respond to the WiFi scanning event and obtain the actual scanning result if the current communication state is a data transmission state and the application is in the stored application whitelist;

[0134] Correspondingly, the result sending module 230 is also used to return the actual scan result to the application.

[0135] In one possible implementation, the scan execution module is further configured to: if the current communication state is a non-data transmission state, respond to the WiFi scan event and obtain the actual scan result;

[0136] Correspondingly, the result sending module 230 is also used to return the actual scan result to the application.

[0137] In one possible implementation, the state acquisition module 210 can specifically be used for:

[0138] When an application in the electronic device initiates a WiFi scanning event, the packet name of the application is obtained;

[0139] Query the application's preset permissions based on the application's package name;

[0140] If the application's preset permissions include network configuration permissions, obtain the current communication status of the point-to-point channel.

[0141] In one possible implementation, the state acquisition module 210 can specifically be used for:

[0142] If the application's preset permissions include network configuration permissions, determine whether the electronic device's WiFi function is in a faulty state;

[0143] If it is determined that the WiFi function of the electronic device is in a non-faulty state, obtain the current communication status of the point-to-point channel.

[0144] In one possible implementation, the state acquisition module 210 can specifically be used for:

[0145] After the electronic device starts up, it reads the application whitelist from the non-memory database of the electronic device;

[0146] The read application whitelist is stored in the memory database of the electronic device;

[0147] When an application in the electronic device initiates a WiFi scanning event, the application whitelist is read from the memory database.

[0148] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0149] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0150] This application also provides an electronic device, see [link to relevant documentation] Figure 8 The electronic device 400 may include: at least one processor 410, a memory 420, and a computer program stored in the memory 420 and executable on the at least one processor 410. When the processor 410 executes the computer program, it implements the steps in any of the above-described method embodiments, for example... Figure 5 Steps S101 to S103 in the illustrated embodiment. Alternatively, when the processor 410 executes the computer program, it implements the functions of each module / unit in the above-described device embodiments, for example... Figure 7 The functions of the status acquisition module 210 to the result sending module 230 are shown.

[0151] For example, a computer program may be divided into one or more modules / units, one or more of which are stored in memory 420 and executed by processor 410 to complete this application. The one or more modules / units may be a series of computer program segments capable of performing a specific function, which describe the execution process of the computer program in electronic device 400.

[0152] Those skilled in the art will understand that Figure 7 This is merely an example of an electronic device and does not constitute a limitation on the electronic device. It may include more or fewer components than shown, or combinations of certain components, or different components, such as input / output devices, network access devices, buses, etc.

[0153] The processor 410 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0154] The memory 420 can be an internal storage unit of the electronic device or an external storage device, such as a plug-in hard drive, a smart media card (SMC), a secure digital card (SD), or a flash card. The memory 420 is used to store the computer program and other programs and data required by the electronic device. The memory 420 can also be used to temporarily store data that has been output or will be output.

[0155] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0156] The WiFi scanning method for electronic devices provided in this application can be applied to electronic devices such as computers, tablets, laptops, netbooks, and personal digital assistants (PDAs). This application does not impose any restrictions on the specific type of electronic device.

[0157] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0158] Those skilled in the art will recognize that the units and algorithm steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0159] In the embodiments provided in this application, it should be understood that the disclosed electronic devices, apparatuses, and methods can be implemented in other ways. For example, the electronic device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units through some interfaces, and may be electrical, mechanical, or other forms.

[0160] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0161] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0162] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by one or more processors, it can implement the steps of the various method embodiments described above.

[0163] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by one or more processors, it can implement the steps of the various method embodiments described above.

[0164] Similarly, as a computer program product, when the computer program product is run on an electronic device, it causes the electronic device to execute the steps in the above-described method embodiments.

[0165] The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0166] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A WiFi scanning method for an electronic device, characterized in that, Applied to an electronic device that supports peer-to-peer communication and WiFi communication, the method includes: When an application in the electronic device initiates a WiFi scanning event, the current communication status of the point-to-point channel is obtained, wherein the point-to-point channel is the channel used by the electronic device to communicate with other devices in a point-to-point manner; If the current communication state is a data transmission state and the application is not in the stored application whitelist, the application will not respond to the WiFi scanning event and will generate a virtual scan result. The virtual scan result indicates that the WiFi scan was successfully completed. Return the virtual scan results to the application.

2. The WiFi scanning method for an electronic device as described in claim 1, characterized in that, After obtaining the current communication status of the point-to-point channel, the method further includes: If the current communication state is a data transmission state and the application is in the stored application whitelist, respond to the WiFi scanning event to obtain the actual scanning result; Return the actual scan results to the application.

3. The WiFi scanning method for an electronic device as described in claim 1, characterized in that, After obtaining the current communication status of the point-to-point channel, the method further includes: If the current communication state is a non-data transmission state, respond to the WiFi scanning event to obtain the actual scanning result; Return the actual scan results to the application.

4. The WiFi scanning method for an electronic device as described in claim 1, characterized in that, When an application in the electronic device initiates a WiFi scanning event, the current communication status of the point-to-point channel is obtained, including: When an application in the electronic device initiates a WiFi scanning event, the packet name of the application is obtained; Query the application's preset permissions based on the application's package name; If the application's preset permissions include network configuration permissions, obtain the current communication status of the point-to-point channel.

5. The WiFi scanning method for an electronic device as described in claim 4, characterized in that, If the application's preset permissions include network configuration permissions, obtaining the current communication status of the point-to-point channel includes: If the application's preset permissions include network configuration permissions, determine whether the electronic device's WiFi function is in a faulty state; If it is determined that the WiFi function of the electronic device is in a non-faulty state, obtain the current communication status of the point-to-point channel.

6. The WiFi scanning method for an electronic device as described in any one of claims 1 to 5, characterized in that, The method further includes: After the electronic device starts up, it reads the application whitelist from the non-memory database of the electronic device; The read application whitelist is stored in the memory database of the electronic device; Accordingly, when an application in the electronic device initiates a WiFi scanning event, the application whitelist is read from the memory database.

7. The WiFi scanning method for an electronic device as described in any one of claims 1 to 5, characterized in that, The electronic device is equipped with an Android system, and the system layer of the Android system provides WiFi service. The process of obtaining the current communication status of the point-to-point channel includes: After the WiFi service receives the WiFi scanning event initiated by the application, it calls the WiFi service to obtain the current communication status of the point-to-point channel; If the current communication state is a data transmission state and the application is not in the stored application whitelist, the application will not respond to the WiFi scanning event and will generate a virtual scan result, including: If the current communication state is a data transmission state and the application is not in the stored application whitelist, the WiFi service is invoked without responding to the WiFi scanning event, and a virtual scan result is generated. Returning the virtual scan results to the application includes: The WiFi service is invoked to return the virtual scan results to the application.

8. An electronic device, characterized in that, The electronic device supports peer-to-peer communication and WiFi communication, and the electronic device includes: The status acquisition module is used to acquire the current communication status of the point-to-point channel when an application in the electronic device initiates a WiFi scanning event, wherein the point-to-point channel is the channel used by the electronic device to communicate with other devices in a point-to-point manner; The virtual result generation module is used to generate a virtual scan result when the current communication state is data transmission state and the application is not in the stored application whitelist, without responding to the WiFi scanning event. The virtual scan result indicates that the WiFi scan was successfully completed. The result sending module is used to return the virtual scan results to the application.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the WiFi scanning method of the electronic device as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the WiFi scanning method for the electronic device as described in any one of claims 1 to 7.