Method for processing sensing data and electronic device

By combining the screen display status to acquire and use proximity sensor sensing data of multi-screen phones, the induction data confusion problem is solved, and the accurate control of the screen and audio equipment is achieved, which improves the user experience and reduces power consumption.

CN119276975BActive Publication Date: 2025-08-26HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410522670.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-28
Publication Date
2025-08-26
Estimated Expiration
2044-04-28

AI Technical Summary

Technical Problem

In multi-screen phones, the induction data of the proximity sensor is prone to confusion, resulting in the inability to accurately control the operation of the screen and audio equipment.

Method used

By combining the screen display status of the electronic device, the inductive data of the corresponding proximity sensor is obtained and used, and the virtual proximity driver and monitor mechanism are adopted to ensure that the application acquires accurate inductive data in different screen states, and to control the corresponding preset devices to perform operations.

Benefits of technology

Avoid confusion of proximity sensor sensing data, ensure operational accuracy of screen and audio equipment, reduce power consumption, and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119276975B_ABST
    Figure CN119276975B_ABST
Patent Text Reader

Abstract

The present application proposes a method for processing sensing data and an electronic device, which relates to the field of terminal technology and is used to avoid confusion of sensing data of a proximity sensor when one of the screens is used in a multi-screen mobile phone. The method is applied to an electronic device, which includes a first screen and a corresponding first proximity sensor, and a second screen and a corresponding second proximity sensor. The method includes: in the display state of the first screen, acquiring sensing data of the first proximity sensor, and controlling a first preset device to perform an operation according to the sensing data of the first proximity sensor; the first preset device includes: the first screen, a speaker corresponding to the first screen, and at least one of an earpiece. In the display state of the second screen, acquiring and controlling a second preset device to perform an operation according to the sensing data of the second proximity sensor; the second preset device includes the second screen, a speaker corresponding to the second screen, and at least one of an earpiece.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of terminal technology, and more particularly to a method for processing sensing data and an electronic device. Background Art

[0002] To meet users' demands for smartphones in various scenarios, multi-screen phones are beginning to appear on the market. For example, dual-screen phones can have various configurations, such as folded and unfolded. In the unfolded state, the phone typically displays on the inner screen; in the folded state, the phone can display on the outer screen.

[0003] Mobile phones can be equipped with proximity sensors to detect the distance between an object and the sensor. In some scenarios, the phone can use the proximity sensor's data to turn the screen on and off. For example, in a false-touch prevention scenario, if an object is detected approaching the phone screen, the screen can be turned off to prevent false triggering.

[0004] In a multi-screen phone, a proximity sensor is required for each screen to detect whether an object is approaching. However, when a user only uses one screen of the phone, the proximity sensor's sensing data is easily confused. Summary of the Invention

[0005] Embodiments of the present application provide a method for processing sensing data and an electronic device for avoiding confusion of sensing data from a proximity sensor when a multi-screen mobile phone uses one of its screens.

[0006] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0007] In a first aspect, a method for processing sensing data is provided, the method being applied to an electronic device, the electronic device comprising a first screen and a second screen, the first screen being provided with a first proximity sensor, and the second screen being provided with a second proximity sensor. The method comprises:

[0008] When the electronic device is in the display state of the first screen, it obtains the sensing data of the first proximity sensor and controls the first preset device to perform an operation based on the sensing data of the first proximity sensor. When the electronic device is in the display state of the second screen, it obtains the sensing data of the second proximity sensor and controls the second preset device to perform an operation based on the sensing data of the second proximity sensor. In this way, by combining the screen display state of the electronic device to obtain and use the sensing data of the corresponding proximity sensor, confusion can be avoided. The first preset device includes at least one of the following: the first screen, a speaker corresponding to the first screen, and an earpiece corresponding to the first screen. The second preset device includes at least one of the following: the second screen, a speaker corresponding to the second screen, and an earpiece corresponding to the second screen.

[0009] In a possible implementation of the first aspect, the electronic device may use the same speaker and earpiece when using the first screen and the second screen, that is, the speaker corresponding to the first screen and the speaker corresponding to the second screen are the same, and the earpiece corresponding to the first screen and the earpiece corresponding to the second screen are the same.

[0010] In a possible implementation of the first aspect, the electronic device may use different speakers and receivers when using the first screen and the second screen, that is, the first screen corresponds to the first speaker and the first receiver, and the second screen corresponds to the second speaker and the second receiver; the first speaker and the second speaker are different, and the first receiver and the second receiver are different.

[0011] In a possible implementation of the first aspect, the electronic device may use the same speaker and different earpieces when using a first screen and a second screen, i.e., the speaker corresponding to the first screen and the speaker corresponding to the second screen are the same; the first screen corresponds to a first earpiece, the second screen corresponds to a second earpiece, and the first earpiece and the second earpiece are different. Alternatively, the electronic device may use different speakers and the same earpiece when using the first screen and the second screen, i.e., the earpiece corresponding to the first screen and the earpiece corresponding to the second screen are the same; the first screen corresponds to a first speaker, the second screen corresponds to a second speaker, and the first speaker and the second speaker are different.

[0012] In one possible implementation of the first aspect, the electronic device controlling a corresponding preset device to perform an operation based on sensing data from a proximity sensor may specifically include: upon detecting that the sensing data from the proximity sensor indicates an object approaching or moving away from the proximity sensor, the electronic device controlling the corresponding preset device to perform the operation. Specifically, upon detecting that the sensing data from the proximity sensor indicates a change in the distance between the object and the proximity sensor, the electronic device controlling the corresponding preset device to perform the operation.

[0013] In one possible implementation of the first aspect, when the electronic device detects that sensing data from a proximity sensor indicates an object approaching the proximity sensor, the electronic device may specifically control a preset device corresponding to the proximity sensor to perform one or more of the following operations: controlling the screen corresponding to the proximity sensor to turn on or off, respond to touch signals, or not respond to touch signals. Because the proximity sensor sensing data is acquired and used in conjunction with the electronic device's screen display state, the electronic device can accurately control the preset device to perform operations based on the sensing data from the corresponding proximity sensor under different screen display states.

[0014] In one possible implementation of the first aspect, an electronic device is installed with an application, and the electronic device includes a driver layer. In the above method, the driver layer reports sensing data from a first proximity sensor and a second proximity sensor to the application. The application can obtain the sensing data from both proximity sensors reported by the driver layer in any screen display state. The application then obtains and combines the sensing data from the screen display state to determine which proximity sensor's sensing data to use to control the corresponding preset device to perform an operation.

[0015] In a possible implementation of the first aspect, an electronic device is installed with an application, and the electronic device includes a driver layer. In the above method, the driver layer reports the sensing data of the first proximity sensor and the second proximity sensor to the application. Specifically, the driver layer obtains the screen display state of the electronic device and, based on the screen display state, selects the sensing data of one of the proximity sensors and reports it to the application. That is, in one of the screen display states, the application can only obtain the sensing data of the proximity sensor corresponding to the screen display state. In this way, it can be ensured that the application can accurately obtain the sensing data of the corresponding proximity sensor in any screen display state, and the data will not be confused.

[0016] In a possible implementation of the first aspect, an electronic device is installed with an application, the electronic device includes a driver layer, and the driver layer includes a virtual proximity driver. The above method also includes: the application registers a first listener for the virtual proximity driver, and the virtual proximity driver registers a second listener for the first proximity sensor, and the virtual proximity driver registers a third listener for the second proximity sensor. In this way, the virtual proximity driver can obtain the sensing data of the first proximity sensor based on the second listener. The virtual proximity driver can obtain the sensing data of the second proximity sensor based on the third listener. Since the application registers the first listener for the virtual proximity driver, the application can obtain the sensing data of the two proximity sensors reported by the virtual proximity driver based on the first listener. In this way, it is ensured that the application can obtain the sensing data of the two proximity sensors.

[0017] In a possible implementation of the first aspect, in the above method, the application obtains the sensing data of the first proximity sensor based on the first listener, which may specifically include: the virtual proximity driver responds to the electronic device switching to the display state of the first screen, and reports the sensing data of the first proximity sensor to the application based on the first listener. Correspondingly, the application obtains the sensing data of the second proximity sensor based on the first listener, including: the virtual proximity driver responds to the electronic device switching to the display state of the second screen, and reports the sensing data of the second proximity sensor to the application based on the first listener. That is, when the virtual proximity driver detects that the screen display state has switched, the sensing data of the proximity sensor reported to the application is changed. The virtual proximity driver determines the sensing data of the proximity sensor to be reported according to the screen display state. For the application, no changes need to be made, and the sensing data of the corresponding proximity sensor can be obtained in different screen display states, and the data will not be confused.

[0018] In one possible implementation of the first aspect, in the above method, when the first screen is displayed, the application receives sensing data from the first proximity sensor and sensing data from the second proximity sensor based on the first listener reported by the virtual proximity sensor. When the second screen is displayed, the application receives sensing data from the first proximity sensor and sensing data from the second proximity sensor based on the first listener reported by the virtual proximity sensor. That is, regardless of the screen display state, the virtual proximity driver reports sensing data from both proximity sensors to the application. The application can then determine, based on the screen display state, which proximity sensor's sensing data to use to control the corresponding preset device to perform an operation. Specifically, controlling the first preset device to perform an operation based on the sensing data from the first proximity sensor includes: in response to the electronic device switching to the display state of the first screen, the application switches to controlling the first preset device to perform an operation based on the sensing data from the first proximity sensor obtained based on the first listener. Correspondingly, controlling the second preset device to perform an operation based on the sensing data from the second proximity sensor includes: in response to the electronic device switching to the display state of the second screen, the application switches to controlling the second preset device to perform an operation based on the sensing data from the second proximity sensor obtained based on the first listener. In this way, in any of the screen display states, although the application can obtain the sensing data of the two proximity sensors, the application selects one of the sensing data based on the specific screen display state and controls the corresponding preset device to perform operations. The application can also control the accuracy of the screen according to the sensing data of the proximity sensor and avoid data confusion.

[0019] In a possible implementation of the first aspect, the virtual proximity driver registers a second listener for the first proximity sensor, including: the virtual proximity driver registers the first listener with the virtual proximity driver in response to the application, and registers the second listener with the first proximity sensor. Correspondingly, the virtual proximity driver registers a third listener for the second proximity sensor, including: the virtual proximity driver registers the first listener with the virtual proximity driver in response to the application, and registers the third listener with the second proximity sensor. That is, when the application registers the listener with the virtual proximity driver, the virtual proximity driver will register the listeners for the two proximity sensors respectively. In this way, the virtual proximity driver can promptly detect changes in the sensing data of any proximity sensor.

[0020] In a possible implementation of the first aspect, the types of proximity sensors include a first type and a second type; the power consumption of the first type proximity sensor is higher than that of the second type proximity sensor. In the above method, for proximity sensors with lower power consumption, regardless of the screen display state, the virtual proximity driver can immediately register a listener for the second type proximity sensor when the application registers the first listener with the virtual proximity driver. For proximity sensors with higher power consumption, the virtual proximity driver can register a listener for them when the display switches to the screen corresponding to this type of proximity sensor. That is, the virtual proximity driver can register a listener for the first type proximity sensor upon detecting that the electronic device has switched to the display state of a target screen; wherein the target screen is the screen corresponding to the first type proximity sensor. If the screen corresponding to the higher power proximity sensor is not in use, the virtual proximity driver will not register a listener for the proximity sensor. In this way, the operation of the higher power proximity sensor can be reduced while ensuring that the application can obtain accurate sensing data, thereby reducing the power consumption of the electronic device.

[0021] In one possible implementation of the first aspect, after the virtual proximity driver registers a listener for the first type of proximity sensor in response to the electronic device switching to a display state of a target screen, the method further includes: in response to the electronic device switching from the display state of the target screen to a display state of another screen, the virtual proximity driver cancels the listener registered for the first type of proximity sensor. This reduces the operation of the higher-power proximity sensor and lowers the power consumption of the electronic device.

[0022] In a possible implementation of the first aspect, the first type of proximity sensor includes an ultrasonic proximity sensor; and the second type of proximity sensor includes an optical proximity sensor.

[0023] In a possible implementation of the first aspect, the first proximity sensor and the second proximity sensor may both be proximity sensors of the first type, or the first proximity sensor and the second proximity sensor may both be proximity sensors of the second type.

[0024] In a possible implementation of the first aspect, the first proximity sensor may be the first type of proximity sensor, and the second proximity sensor may be the second type of proximity sensor. Alternatively, the first proximity sensor may be the second type of proximity sensor, and the second proximity sensor may be the first type of proximity sensor.

[0025] In a possible implementation of the first aspect, when the application registers a listener for the proximity sensor, it searches for the device driver to be registered based on the driver type. In the above method, the driver type of the virtual proximity driver is defined as the first driver type; the driver type of the first device driver corresponding to the first proximity sensor is defined as the second driver type; and the second device driver corresponding to the second proximity sensor is defined as the third driver type. Among them, the first driver type is the driver type of the proximity sensor set by the operating system of the electronic device; and the second driver type and the third driver type are not the driver types of the proximity sensor set by the operating system of the electronic device. In this way, it is ensured that the application only registers a listener for the virtual proximity driver, and does not register a listener for the device drivers of the first proximity sensor and the second proximity sensor themselves. However, since the virtual proximity driver registers listeners for the two proximity sensors respectively, the application can still obtain the sensing data of the two proximity sensors through the virtual proximity driver; at the same time, it can also avoid the application from repeatedly obtaining sensing data.

[0026] In one possible implementation of the first aspect, the electronic device further includes an Nth screen in addition to the first and second screens, and an Nth proximity sensor corresponding to the Nth screen. In this solution, when the Nth screen is displayed, the electronic device obtains sensing data from the Nth proximity sensor and controls an Nth preset device corresponding to the Nth screen to perform an operation based on the sensing data from the Nth proximity sensor. N is an integer greater than 2. This means that the above method can also be applied to electronic devices with three or more screens.

[0027] In a possible implementation of the first aspect, an electronic device is installed with an application, and the above method includes: the application registers a fourth listener for the first proximity sensor, and registers a fifth listener for the second proximity sensor. The application can obtain the sensing data of the first proximity sensor based on the fourth listener; the application can obtain the sensing data of the second proximity sensor based on the fifth listener. Specifically, in response to the electronic device switching to the display state of the first screen, the application switches to using the sensing data of the first proximity sensor obtained based on the fourth listener, and controls the first preset device to perform an operation. In response to the electronic device switching to the display state of the second screen, the application switches to using the sensing data of the second proximity sensor obtained based on the fifth listener, and controls the second preset device to perform an operation. In this solution, the application registers listeners for the two proximity sensors respectively, and then the application selects to use one of the sensing data in combination with the screen display state to control the corresponding preset device to perform an operation. There will be no confusion in the sensing data used by the application.

[0028] In one possible implementation of the first aspect, an electronic device is installed with an application, and the method includes: in response to the electronic device switching to a display state of a first screen, the application registers a fourth listener with a first proximity sensor, obtains sensing data from the first proximity sensor based on the fourth listener, and controls a first preset device to perform an operation based on the sensing data from the first proximity sensor. Furthermore, in response to the electronic device switching to a display state of a second screen, the application registers a fifth listener with a second proximity sensor, obtains sensing data from the second proximity sensor based on the fifth listener, and controls a second preset device to perform an operation based on the sensing data from the second proximity sensor. In other words, when the electronic device switches screen display states, the application also switches the proximity sensor with which the listener is registered. Thus, when the application is using one screen for display, it only registers a listener with the proximity sensor corresponding to that screen and can only obtain sensing data from that proximity sensor. When the electronic device switches to a different screen for display, the application can also switch to the registered listener for the other proximity sensor. This ensures that the application can obtain sensing data from multiple proximity sensors while preventing confusion between the proximity sensor data obtained by the application.

[0029] In a possible implementation of the first aspect, in response to the electronic device switching to the display state of the first screen, the application registers the fourth listener for the first proximity sensor and cancels the fifth listener registered for the second proximity sensor. Correspondingly, in response to the electronic device switching to the display state of the second screen, the application registers the fifth listener for the second proximity sensor and cancels the fourth listener registered for the first proximity sensor. In this way, when a screen is not in use, its corresponding proximity sensor does not need to detect and report sensing data, which can reduce unnecessary power consumption of the electronic device.

[0030] In one possible implementation of the first aspect, when an application registers a listener for a proximity sensor, it searches for a device driver to be registered based on the driver type. If the operating system allows two or more driver types for the proximity sensor, the driver types of the first device driver corresponding to the first proximity sensor and the second device driver corresponding to the second proximity sensor can both be defined as preset driver types; the preset driver type is the proximity sensor driver type set by the operating system of the electronic device. This ensures that the application can obtain sensing data from both proximity sensors.

[0031] If the operating system only allows one proximity sensor drive type, the device driver corresponding to one proximity sensor can be defined as a preset drive type, while the device driver corresponding to the other proximity sensor can be defined as another drive type. In this solution, the operating system and the application agree that both the preset drive type and the other drive type belong to the proximity sensor drive type. This ensures that the application can still obtain sensing data from both proximity sensors.

[0032] In a possible implementation of the first aspect, an electronic device is installed with an application, and the electronic device includes a driver layer, the driver layer including: a first device driver corresponding to a first proximity sensor, and a second device driver corresponding to a second proximity sensor; the above method also includes: the application registers a sixth listener for the first proximity sensor; the first device driver registers a seventh listener for the second proximity sensor in response to the application registering the sixth listener for the first proximity sensor. In this way, the above acquisition of the sensing data of the first proximity sensor may specifically include: the application directly obtains the sensing data of the first proximity sensor based on the sixth listener through the first device driver. And the above acquisition of the sensing data of the second proximity sensor may specifically include: the first device driver obtains the sensing data of the second proximity sensor from the second device driver based on the seventh listener; then, the application obtains the sensing data of the second proximity sensor reported by the first device driver based on the sixth listener. In this way, it can be ensured that the application can obtain the sensing data of both proximity sensors.

[0033] In a possible implementation of the first aspect, an electronic device is installed with an application, and the electronic device includes a driver layer, the driver layer including: a first device driver corresponding to a first proximity sensor, and a second device driver corresponding to a second proximity sensor; the above method further includes: the application registers an eighth listener for the second proximity sensor; the second device driver registers a ninth listener for the first proximity sensor in response to the application registering the eighth listener for the second proximity sensor. In this way, the above acquisition of the sensing data of the second proximity sensor may specifically include: the application directly acquires the sensing data of the second proximity sensor based on the eighth listener. The above acquisition of the sensing data of the first proximity sensor may specifically include: the second device driver acquires the sensing data of the first proximity sensor from the first device driver based on the ninth listener; the application acquires the sensing data of the first proximity sensor reported by the second device driver based on the eighth listener. In this way, it can be ensured that the application can acquire the sensing data of both proximity sensors.

[0034] In one possible implementation of the first aspect, in the scenario described above where the application registers a listener for one proximity sensor, and the device driver corresponding to that proximity sensor registers a listener for the other proximity sensor, the device driver for which the application has registered a listener can, based on the screen display state, decide to report the sensing data from one of the proximity sensors to the application. Alternatively, the application can, based on the screen display state, decide to control the corresponding preset device to perform an operation based on the sensing data from one of the proximity sensors. This ensures that the application can obtain sensing data from both proximity sensors, and prevents confusion in the sensing data used by the application.

[0035] In a possible implementation of the first aspect, the first proximity sensor and the second proximity sensor are of different types, or the first proximity sensor and the second proximity sensor are of the same type.

[0036] In a second aspect, the present application further provides an electronic device. The electronic device may include: at least two screens, at least two proximity sensors, a processor, and a memory. The screens are used to display the electronic device interface; the proximity sensors are used to detect the distance between an object and the proximity sensors. The memory is used to store computer-executable instructions. When the electronic device is in operation, the processor executes the computer-executable instructions stored in the memory to cause the electronic device to perform the sensing data processing method described in any one of the first aspects above.

[0037] In a third aspect, the present application provides a computer-readable storage medium having instructions stored therein, which, when executed on a computer, enables the computer to execute the method for processing sensing data of any one of the above-mentioned first aspects.

[0038] In a fourth aspect, a computer program product comprising instructions is provided, which, when executed on an electronic device, enables the electronic device to execute the method for processing sensing data according to any one of the first aspects.

[0039] In a fifth aspect, a device (for example, a chip system) is provided, which includes a processor for supporting an electronic device to implement the functions involved in the first aspect above. In one possible design, the device also includes a memory for storing program instructions and data necessary for the electronic device. When the device is a chip system, it can be composed of a chip or include a chip and other discrete devices.

[0040] Among them, the technical effects brought about by any design method in the second to fifth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A schematic diagram of the position of a proximity sensor of an electronic device provided in an embodiment of the present application;

[0042] Figure 2 A schematic diagram of a scenario of using a mobile phone provided in an embodiment of the present application;

[0043] Figure 3A A schematic diagram of a dual-screen foldable mobile phone provided in an embodiment of the present application;

[0044] Figure 3B A schematic diagram of a dual-screen foldable mobile phone provided in an embodiment of the present application;

[0045] Figure 4 A diagram of the software and hardware architecture of an electronic device provided in an embodiment of the present application;

[0046] Figure 5 A flowchart of a method for processing sensing data provided in an embodiment of the present application;

[0047] Figure 6 A framework diagram of an application registering a proximity sensor provided in an embodiment of the present application;

[0048] Figure 7 A schematic diagram of the relationship between a data fusion module and a device driver provided in an embodiment of the present application;

[0049] Figure 8 A diagram of the software and hardware architecture of an electronic device provided in an embodiment of the present application;

[0050] Figure 9 A flowchart of the steps of executing a data fusion module provided in an embodiment of the present application;

[0051] Figure 10 A timing diagram of a method for processing sensing data provided in an embodiment of the present application;

[0052] Figure 11 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0053] Figure 12 A framework diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] Proximity sensors are used to detect the distance between an object and the sensor. A common type of proximity sensor uses optics to detect distance, known as an optical proximity sensor. Alternatively, a proximity sensor uses ultrasound to detect distance, known as an ultrasonic proximity sensor.

[0055] The optical proximity sensor can detect changes in light caused by an object approaching the sensor, thereby detecting the proximity of an object to the sensor. The proximity state detected by the optical proximity sensor indicates the intensity of the light detected by the optical proximity sensor. When the light detected by the optical proximity sensor is strong, it means that no object is approaching the optical proximity sensor, that is, the location of the optical proximity sensor (such as the top of the screen) is not blocked by an object. When the light detected by the optical proximity sensor is weak, it means that an object is approaching the optical proximity sensor, that is, the location of the optical proximity sensor is blocked by an object. Therefore, the intensity of the light detected by the sensor changes from strong to weak, corresponding to the object at the location of the optical proximity sensor changing from far away to close. Correspondingly, the light detected by the sensor changes from weak to strong, corresponding to the object at the location of the optical proximity sensor changing from close to far away.

[0056] Ultrasonic proximity sensors measure distance by transmitting and receiving ultrasonic waves. Specifically, an ultrasonic transmitter sends ultrasonic waves in a specific direction, and a timer begins at the moment of transmission. When the ultrasonic wave propagates through the air and encounters an obstacle, it is immediately reflected back. The ultrasonic receiver stops timing upon receiving the reflected wave. Based on the time difference between the receiver and the transmitter and the known propagation speed of ultrasonic waves in air, the distance from the transmitter to the obstacle—that is, the distance between the object and the ultrasonic proximity sensor—can be calculated.

[0057] The proximity state detected by the ultrasonic proximity sensor represents the time it takes for the ultrasonic proximity sensor to emit and receive ultrasonic waves. A longer detection time indicates that the object is farther away from the ultrasonic proximity sensor, meaning the sensor's location (such as the top of the screen) is not obstructed by an object. A shorter detection time indicates that the object is closer, meaning the sensor's location is obstructed by an object. Therefore, as the sensor's detection time changes from longer to shorter, the object at the ultrasonic proximity sensor's location moves from farther away to closer. Correspondingly, as the sensor's detection time changes from shorter to longer, the object at the ultrasonic proximity sensor's location moves from closer to farther away.

[0058] It should be noted that the proximity state detected by the proximity sensor may also be named by other names in other embodiments, such as detection data, detection information or sensing data of the proximity sensor.

[0059] Anti-mistouch technology is used to prevent unnecessary touch operations. It aims to reduce the occurrence of accidental touches, thereby providing a better user experience. A proximity sensor is a common anti-mistouch detection device. Specifically, when an object approaches the sensor after entering an anti-mistouch scenario, the screen can be controlled to not respond to touch signals to prevent accidental touches. Otherwise, the screen can be controlled to respond normally to touch signals when no object is near the sensor.

[0060] The proximity sensor can also be used in call scenarios, voice message playback scenarios, screen-off display scenarios, and hand-raising display scenarios. Taking the call scenario as an example, during the process of making or receiving a call, when the proximity sensor detects that an object (such as the user's head) is close to the sensor, the electronic device controls the screen to turn off. When the proximity sensor detects that there is no object close to the sensor, the electronic device can control the screen to turn on to display the call interface. The voice message playback scenario is similar to the call scenario. During the voice message playback process, if the proximity sensor detects that an object is close to the sensor, the electronic device can control the screen to turn off; in addition, the electronic device can also control the voice message to be played in receiver mode. When the proximity sensor detects that there is no object close to the sensor, the electronic device can control the screen to turn on to display the voice message interface; at the same time, the electronic device can also control the voice message to be played in speaker mode.

[0061] For example, in the screen-off display scenario, if the proximity sensor detects an object approaching the sensor, the electronic device controls the screen to be off. However, if the proximity sensor detects no object approaching the sensor, the electronic device can control the screen to display the screen-off interface, which can display information such as the time and memos.

[0062] It should be noted that the above scenarios are all examples.

[0063] For example, Figure 1 , a single-screen mobile phone 10 can set the proximity sensor at the top of the screen. In the anti-false touch scenario, when it is detected that there is no object approaching the top of the screen, that is, the top of the screen is not blocked, the mobile phone 10 responds normally to the user's touch signal on the screen. In some examples, when there is no object approaching the top of the screen (that is, the top of the screen is blocked), the mobile phone can control the screen to be in the bright screen state; Figure 2 As shown in a, the user is holding the mobile phone and browsing the mobile phone screen. When an object approaches the proximity sensor, the mobile phone 10 does not respond to the user's touch signal on the screen. In some examples, the mobile phone screen can be in a blackout state; Figure 2 As shown in b, the user places the mobile phone next to the ear to make a call, etc.

[0064] Common multi-screen mobile phones include dual-screen mobile phones, and dual-screen mobile phones are mostly foldable phones. Figure 3A Figure a shows some examples of dual-screen foldable mobile phones (mobile phone 20) in the unfolded state, using the first screen 21 (inner screen). A first proximity sensor can be set corresponding to the first screen 21, such as Figure 3A As shown in the proximity sensor 22. Figure 3A In the folded state of the mobile phone 20 shown in FIG. 2 , the second screen 23 (external screen) is usually used. A second proximity sensor can be set corresponding to the second screen 23, such as Figure 3A A proximity sensor 24 is shown.

[0065] like Figure 3B The foldable mobile phone 25 is also shown as a dual-screen one. Figure 3B As shown in a, the mobile phone 25 uses the first screen 26 in the unfolded state, and the first screen 26 is correspondingly provided with a first proximity sensor 27. Figure 3B As shown in b, the mobile phone 25 uses a second screen 28 in the folded state, and the second screen 28 corresponds to the second proximity sensor 29.

[0066] It should be noted that Figure 3A and Figure 3B The figure only shows an example of a folding form of an inward-folding mobile phone in a folding mobile phone; in other embodiments, the folding mobile phone can also be in other forms, such as an outward-folding mobile phone.

[0067] Dual-screen foldable phones support proximity detection in both the inner and outer screen modes. Proximity sensor data is reported normally in both the inner and outer screen modes, ensuring that applications can access data from multiple proximity sensors. To distinguish data from different sensors, proximity sensor data can be recorded as proximity sensing data.

[0068] In a dual-screen foldable phone, the screens that users primarily use are usually different when they are unfolded and folded. In the anti-accidental touch scenario, the screens currently in use are different, and the screens that need to be controlled to respond to touch signals are also different accordingly. Figure 3A Taking the illustrated mobile phone 20 as an example, in the unfolded state, the user is using the first screen 21. At this point, the mobile phone 20 should control whether the first screen 21 responds to touch signals. Specifically, the mobile phone 20 can control whether the first screen 21 responds to touch signals based on the sensing data from the first proximity sensor 22. In the folded state, the user is using the second screen 23. At this point, the mobile phone 20 should control whether the second screen 24 responds to touch signals. Specifically, the mobile phone 20 can control whether the second screen 24 responds to touch signals based on the sensing data from the second proximity sensor 24.

[0069] However, in both the unfolded and folded states, both proximity sensors may be active. In this case, if the phone receives sensing data from both proximity sensors, it needs to control whether the corresponding screen responds to touch signals based on the sensing data from one proximity sensor, which can easily cause proximity sensing data confusion.

[0070] In some of the scenarios described above where proximity sensor data is needed, the audio playback channel (speaker or receiver) needs to be controlled based on the proximity sensor data. Some multi-screen phones only include one speaker and one receiver. In this case, the electronic device controls the speaker and / or receiver based on the proximity sensor data, regardless of whether the inner or outer screen is displayed.

[0071] In addition, some multi-screen mobile phones include multiple speakers and earpieces; for example, the inner screen of a dual-screen folding mobile phone corresponds to speaker 1 and earpiece 1, and the outer screen corresponds to speaker 2 and earpiece 2. In this embodiment, when the inner screen is displayed, the electronic device will control speaker 1 and / or earpiece 1 to perform operations based on the sensing data of the proximity sensor corresponding to the inner screen. When the outer screen is displayed, it is necessary to control speaker 2 and / or earpiece 2 to perform operations based on the sensing data of the proximity sensor corresponding to the outer screen. It is also easy for the mobile phone to use the sensing data of the proximity sensor corresponding to the outer screen to control speaker 1 and / or earpiece 1 corresponding to the inner screen, that is, the proximity sensing data is confused.

[0072] Figure 4 The software and hardware architecture of a dual-screen electronic device in some embodiments is shown. When an application obtains sensing data using a proximity sensor, the application registers a listener with the proximity sensor. After the framework layer receives the registration instruction for registering a listener for the proximity sensor initiated by the application, it sends the registration instruction to the hardware abstraction layer. The framework layer then sends the registration instruction to the device driver of the sensor control center. The device driver responds to the registration instruction and registers a listener for the application; if the device driver adds a listener record for the application, then when the device driver detects sensing data from the proximity sensor or detects a change in sensing data, it can report this sensing data to the hardware abstraction layer through the listener record, and transmit the sensing data to the application through the framework layer. At the same time, the device driver also controls the corresponding control proximity sensor to start. Thus, the application obtains the sensing data of the proximity sensor reported by the device driver.

[0073] Since a dual-screen folding electronic device (such as a folding mobile phone) includes two proximity sensors, the sensor control center includes two device drivers: device driver 1 and device driver 2, which correspond to the two proximity sensors (proximity sensor 1 and proximity sensor 2) respectively. Regardless of whether the mobile phone is in the inner screen display state or the outer screen display state, the two proximity sensors are in working state. In the related art, device driver 1 detects a change in the sensing data of proximity sensor 1, and reports this state change to the application through the sensor module of the hardware abstraction layer and the sensor service of the framework layer. Similar to device driver 1, device driver 2 will also report this data change to the application when it detects a change in the sensing data of proximity sensor 2. In this case, the application will receive changes in the sensing data of the two proximity sensors, which is prone to confusion, resulting in errors in the control of the mobile phone.

[0074] Based on this, the present application proposes a method for processing sensing data, which is applied to an electronic device with more than two screens and more than two proximity sensors. Exemplarily, the electronic device can obtain the sensing data of the corresponding proximity sensor in combination with the current screen display state. When the electronic device is using the first screen for display, the sensing data of the proximity sensor corresponding to the first screen can be obtained. When the electronic device is using the second screen for display, the sensing data of the proximity sensor corresponding to the second screen can be obtained. Afterwards, the electronic device can control the relevant components of the electronic device to perform operations based on the obtained proximity sensing data. In this way, obtaining and using the sensing data of the corresponding proximity sensor in combination with the screen display state of the electronic device can avoid confusion.

[0075] As can be seen from the above description, common scenarios requiring proximity sensing data include making calls, playing voice messages, displaying the screen off, and raising your hand to display. In these scenarios, the devices that may require operations include screens, speakers, and receivers. Therefore, the electronic device controlling the electronic device to perform an operation based on proximity sensing data can specifically refer to the electronic device controlling preset devices of the electronic device to perform an operation based on the proximity sensing data. Preset devices may include screens, speakers, and receivers. Specifically, when the first screen is displayed, the electronic device obtains sensing data from the proximity sensor corresponding to the first screen and, based on this proximity sensing data, controls the first preset device to perform a corresponding operation. Correspondingly, when the second screen is displayed, the electronic device obtains sensing data from the proximity sensor corresponding to the second screen and, based on this proximity sensing data, controls the second preset device to perform a corresponding operation. The specific operation required to control the preset device to perform can be referred to as a preset operation. The first preset device may include at least one of the following: the first screen, the speaker corresponding to the first screen, and the receiver corresponding to the first screen. The second preset device may include at least one of the following: the second screen, the speaker corresponding to the second screen, and the receiver corresponding to the second screen.

[0076] Furthermore, the process of the above-mentioned electronic device obtaining different proximity sensing data in different screen display states can be implemented in the driver layer. That is, the screen display state is obtained in the driver layer, and the sensing data of the corresponding proximity sensor is reported to the upper-layer application in combination with the screen display state of the electronic device. In some embodiments, a data fusion module is added to the driver layer to uniformly monitor the sensing data of each proximity sensor. When reporting proximity sensing data to the upper-layer application, the data fusion module reports it in combination with the screen display state of the current electronic device. Exemplarily, when the data fusion module detects that the screen used by the current electronic device is an external screen, it only reports the changes in the sensing data of the proximity sensor on the side where the external screen is located. If the screen used by the current electronic device is an internal screen, the data fusion module only reports to the application the changes in the sensing data of the proximity sensor on the side where the internal screen is located.

[0077] In other embodiments, the process of the electronic device acquiring different proximity sensing data in different screen display states can be performed by the upper-layer application to perform scene judgment of the screen display state. Specifically, when the driver layer reports the proximity sensing data to the upper-layer application, regardless of the screen display state of the electronic device at the time, the sensing data of different proximity sensors will be reported to the application. Afterwards, the application will decide to select one of the proximity sensing data to control the electronic device to perform an operation based on the screen display state of the electronic device. That is, in this embodiment, the application acquires the screen display state and makes a decision based on the screen display state.

[0078] In some embodiments, the data fusion module can be integrated with one of the device drivers in a single module. For example, the data fusion module is integrated with the device driver of proximity sensor 1. Furthermore, the device driver of proximity sensor 1 also registers a listener with the device driver of proximity sensor 2. Thus, the device driver of proximity sensor 1 can monitor not only the sensing data of proximity sensor 1, but also the sensing data of proximity sensor 2. If an application registers a listener with the device driver of proximity sensor 1, the application can obtain the sensing data of proximity sensor 1 and proximity sensor 2 reported by the device driver of proximity sensor 1. In other examples, the data fusion module can also be integrated with the device driver of proximity sensor 2.

[0079] In other embodiments, the data fusion module can be independent of the device driver settings corresponding to each proximity sensor. In this embodiment, the application registers a listener with the data fusion module, and the data fusion module registers listeners for proximity sensor 1 and proximity sensor 2, ensuring that the application can obtain sensing data from both proximity sensors through the data fusion module. In this way, if an abnormality occurs in one proximity sensor or device driver, the other proximity sensors can still report sensing data to the application through the data fusion module, thereby ensuring the normal operation of the other proximity sensors. In this embodiment, the data fusion module can be named a virtual proximity driver.

[0080] Next, the sensing data processing method proposed in the embodiment of the present application is described in detail with reference to the accompanying drawings.

[0081] Figure 5 The flow chart of the method for processing sensing data in some embodiments is shown. In this embodiment, the above method is applied to Figure 3A The dual-screen foldable phone shown in the figure has a proximity sensor installed on each screen. The phone includes screen 1 and screen 2. Screen 1 corresponds to proximity sensor 1, and screen 2 corresponds to proximity sensor 2. Screen 1 can be referred to as the first screen, and screen 2 can be referred to as the second screen. Proximity sensor 1 can be referred to as the first proximity sensor, and proximity sensor 2 can be referred to as the second proximity sensor.

[0082] S301. Start the application.

[0083] The application here refers to an application that needs to use proximity sensing data to perform operations. For example, the application may include a call application, a voice chat application, an instant messaging application, an always-on display application, and a hand-raise display application; or the application may also be a system application of the electronic device, such as a settings application.

[0084] S302 . The application registers listeners for proximity sensor 1 and proximity sensor 2 .

[0085] In some embodiments, S302 can be executed when the application is started. In other embodiments, S302 can also be executed when the application is started and a preset scene (such as the scene using proximity sensing data) is entered. Taking the call scene as an example, the above S302 can be executed in response to entering a call (such as answering or making a call). Taking the screen-off display scene as an example, the above S302 can be executed in response to entering the screen-off display (such as a period of time after the screen is locked). Taking the anti-mistouch scene as an example, the above S302 can be executed specifically when entering the anti-mistouch scene.

[0086] For the specific implementation process of registering a listener for the proximity sensor, please refer to the above Figure 4 After the application registers listeners for proximity sensor 1 and proximity sensor 2, the application can obtain the sensing data of proximity sensor 1 and proximity sensor 2 based on the registered listeners.

[0087] The specific implementation process of the above S302 will be described in detail in the following embodiments.

[0088] S303. Get the current screen display status of the mobile phone.

[0089] In the embodiment of the present application, the screen display status of the mobile phone may include screen 1 display status and screen 2 display status. Among them, screen 1 display status indicates that the mobile phone is using screen 1 for display; screen 2 display status indicates that the mobile phone is using screen 2 for display.

[0090] In some embodiments, the mobile phone can obtain the current screen display status of the mobile phone from the framework layer. In the embodiment of a dual-screen folding mobile phone, the framework layer can decide which screen the current mobile phone needs to display on based on whether the mobile phone is folded, the folding angle, the foreground application, and the sensing data of each sensor (such as an accelerometer, a touch sensor, etc.). In this embodiment, after the framework layer decides on the screen to be displayed, it can feed back this result to other modules, such as the application, the device driver corresponding to the proximity sensor, or the data fusion module. Thus, the mobile phone can obtain the current screen display status of the mobile phone from the framework layer. In some embodiments, the module in the framework layer for determining the currently used screen can be recorded as a screen display decision module. It should be noted that the specific implementation of the screen display decision module deciding the screen currently to be used can refer to the description in the relevant technology, and will not be repeated in the embodiments of this application.

[0091] S304a. When the mobile phone is in the screen 1 display state, obtain sensing data of the proximity sensor 1.

[0092] S304b. When the mobile phone is in the screen 2 display state, obtain sensing data of the proximity sensor 2.

[0093] As can be seen from the above description, when a mobile phone application acquires sensing data, it must obtain it through the device driver corresponding to the proximity sensor. S304a and S304b described above may specifically include: acquiring the proximity sensor sensing data through the device driver. Proximity sensor 1 corresponds to device driver 1, and proximity sensor 2 corresponds to device driver 2.

[0094] In some embodiments, the device driver (including device driver 1 and device driver 2) can report the change in sensing data to the application upon detecting a change in sensing data. A change in sensing data from the proximity sensor indicates a change in the distance between the object and the proximity sensor. For example, a change in sensing data from the proximity sensor can include a change from close to distant, or from distant to close.

[0095] The sensing data can also be divided into multiple different levels. For example, different numbers are used to represent different sensing data levels: numbers 1-5 represent 5 different sensing data levels respectively. The larger the number, the farther (or closer) the object is from the proximity sensor, etc. The change in sensing data can be set according to actual conditions. The sensing data can be considered to have changed when one of the following conditions is met: the level change is greater than a certain value, or the level change crosses a preset level (such as from small to large across level 3, or from large to small across level 3). It can be understood that the above-mentioned changes in sensing data are only examples. In other embodiments, changes in sensing data can also be represented in other ways.

[0096] In other embodiments, the device driver may also report the current sensing data to the application at intervals. In this embodiment, the application may determine whether the sensing data has changed based on the sensing data received multiple times in a row.

[0097] S305a. Control the preset device 1 to perform an operation according to the sensing data of the proximity sensor 1.

[0098] As can be seen from the above description of scenarios using proximity sensing data, controlling the corresponding device to perform an operation is typically only necessary when a change in the distance between an object and the sensor is determined based on the proximity sensing data. Therefore, S305a described above may specifically include: controlling the preset device 1 to perform an operation when the sensing data from proximity sensor 1 changes. The operation that the mobile phone controls to perform when the preset device 1 is typically pre-set and can therefore be recorded as a preset operation.

[0099] As can be seen from the above description, the preset device can include one or more of a screen, a speaker, and an earpiece. Preset device 1 can include at least one of the following: screen 1, and a speaker and earpiece corresponding to screen 1. Preset device 1 can be recorded as the first preset device. For example, screen 1 is the inner screen of a mobile phone, and preset device 1 can include the inner screen, as well as speaker 1 and earpiece 1 used when the mobile phone uses the inner screen. Correspondingly, if screen 1 is the outer screen of a mobile phone, then preset device 1 can include the outer screen, as well as speaker 2 and earpiece 2 used when the mobile phone uses the outer screen.

[0100] For example, in scenarios such as accidental touch prevention, the preset device 1 may include screen 1. Specifically, S305a may include: upon detecting a change in sensing data from proximity sensor 1 from distant to close, controlling screen 1 to perform the following preset operation: not responding to the touch signal; upon detecting a change in sensing data from proximity sensor 1 from close to distant, controlling screen 1 to perform the following preset operation: responding to the touch signal. This achieves accidental touch prevention.

[0101] In scenarios such as making a call or playing a voice message, the preset device 1 may include screen 1. S305a may further include: upon detecting a change in sensing data from proximity sensor 1 from being far away to being close, controlling screen 1 to perform the following preset operation: turning off the screen. Upon detecting a change in sensing data from being close to being far away, controlling screen 1 to perform the following preset operation: turning on the screen.

[0102] In scenarios such as making a call or playing a voice message, the preset device 1 may include a speaker 1 and / or an earpiece 1. S305a may include: upon detecting a change in sensing data from proximity sensor 1 from being far away to being close, controlling speaker 1 to stop playing, and / or controlling earpiece 1 to start playing. Upon detecting a change in sensing data from proximity sensor 1 from being close to being far away, controlling speaker 1 to start playing, and / or controlling earpiece 1 to stop playing.

[0103] Still taking the scenario of making a call or playing a voice message as an example, in other embodiments, the above S305a may include: when detecting that the sensing data of the proximity sensor 1 changes from far away to close, controlling the voice playback to switch from the speaker 1 to the earpiece 1. When detecting that the sensing data of the proximity sensor 1 changes from close to far away, controlling the voice playback to switch from the earpiece 1 to the speaker 1.

[0104] In scenarios such as the screen-off display, the preset device 1 may include screen 1. S305a described above may include: upon detecting a change in sensing data from proximity sensor 1 from distant to approaching, controlling screen 1 to perform the following preset operation: not displaying the screen-off interface. Upon detecting a change in sensing data from proximity sensor 1 from approaching to distant, controlling screen 1 to perform the following preset operation: displaying the screen-off interface.

[0105] It is understandable that the mobile phone controlling the preset devices to perform preset operations in the above different scenarios is only an example. In other scenarios, when the mobile phone detects changes in the sensing data of the proximity sensor 1, it can also control other devices to perform other preset operations.

[0106] S305b. Control the preset device 2 to perform an operation according to the sensing data of the proximity sensor 2.

[0107] In some embodiments, the above S305b may specifically include: when the sensing data of the proximity sensor 2 changes, controlling the preset device 2 to perform an operation.

[0108] In some embodiments, the preset device 2 may include at least one of the following: a screen 2, and a speaker and an earpiece corresponding to the screen 2. The preset device 2 may be referred to as a second preset device.

[0109] In some embodiments, the electronic device can use the same speaker and earpiece when using the first screen and the second screen, that is, the speaker corresponding to the first screen and the speaker corresponding to the second screen are the same, and the earpiece corresponding to the first screen and the earpiece corresponding to the second screen are the same.

[0110] In other embodiments, the electronic device may use different speakers and receivers when using the first screen and the second screen, i.e., the first screen corresponds to a first speaker and a first receiver, and the second screen corresponds to a second speaker and a second receiver. The first speaker and the second speaker are different, and the first receiver and the second receiver are different.

[0111] In other embodiments, the electronic device may use the same speaker and different earpieces when using the first screen and the second screen, that is, the speaker corresponding to the first screen and the speaker corresponding to the second screen are the same; the first screen corresponds to the first earpiece, the second screen corresponds to the second earpiece; and the first earpiece and the second earpiece are different. Alternatively, the electronic device may use different speakers and the same earpiece when using the first screen and the second screen, that is, the earpiece corresponding to the first screen and the earpiece corresponding to the second screen are the same; the first screen corresponds to the first speaker, the second screen corresponds to the second speaker; and the first speaker and the second speaker are different.

[0112] The specific implementation of the above S305b can refer to the description of S305a, which is not repeated here.

[0113] In the sensing data processing method provided in the embodiments of the present application, the application combines the current screen display state of the mobile phone to obtain sensing data from the proximity sensor corresponding to the screen being used. When the mobile phone is in the screen 1 display state, the sensing data from proximity sensor 1 corresponding to screen 1 is obtained. When the mobile phone is in the screen 2 display state, the sensing data from proximity sensor 2 corresponding to screen 2 is obtained. In this way, the sensing data from the two proximity sensors will not be confused, ensuring that the sensing data obtained by the mobile phone is accurate. The mobile phone can accurately obtain sensing data and control the corresponding device to perform operations based on the sensing data.

[0114] Before using a sensor, an application installed on a mobile phone needs to register a listener for the sensor. Only then can the application obtain the sensor's sensing data and status change information through the listener. In some mobile phone operating systems, corresponding preset driver types are defined for various sensors. TM Taking the system as an example, the preset drive type of the proximity sensor is type_proximity. Specifically, the above-mentioned definition of the sensor type specifically refers to defining the drive type of the device driver corresponding to the sensor as a preset drive type. When the application registers the listener, it will look for the device driver of the preset drive type and register the listener for it. In other words, the sensing data of the proximity sensor needs to be transmitted to the application, then the drive type of the device driver corresponding to the proximity sensor needs to be defined as the above-mentioned preset drive type (such as type_proximity) before the application can register the listener. After that, the application can obtain the sensing data of the corresponding proximity sensor through the device driver. In some embodiments, the preset drive type can be recorded as the first drive type.

[0115] In the related art, in a mobile phone with two proximity sensors, due to the limitation of the operating system, only the driver type of the device driver corresponding to one proximity sensor can be defined as the above-mentioned preset driver type. The driver type of the device driver corresponding to the other proximity sensor can only be defined as other driver types, such as type_proximity_1. When the application enters a scene that requires the use of proximity sensing data, it can be controlled by the Android TMIf a listener is registered with the device driver for the defined type_proximity, only the device driver for one proximity sensor can be registered. However, the other proximity sensor, because its driver type is defined as another type, cannot be registered with the application. Consequently, only one proximity sensor's data can be retrieved and used by the application, while the other proximity sensor's data cannot be properly retrieved and used. This prevents the application from properly reporting data from the proximity sensors corresponding to both screens.

[0116] In some embodiments, the application or framework layer can monitor two proximity sensors simultaneously after agreement. Figure 6 As shown, the application can register listeners for both type_proximity and type_proximity_1 device drivers. Figure 5 In the example shown, the application only needs to obtain data from proximity sensor 1 when the phone is displaying screen 1, and only needs to obtain data from proximity sensor 2 when the phone is displaying screen 2. If the application monitors data from both proximity sensors simultaneously, it is necessary to add scenario-based screen display state determination within the application. That is, S303 is specifically performed by the application. For example, the application monitors data from both proximity sensors and obtains the current screen display state of the phone. The application then determines which proximity sensor data to use based on the phone's screen display state. Specifically, if the application determines that the phone is currently displaying screen 1, it executes subsequent steps based on the acquired data from proximity sensor 1. If the application determines that the phone is currently displaying screen 2, it executes subsequent steps based on the acquired data from proximity sensor 2. This ensures that, in different screen display states, the phone can accurately control the corresponding preset device to perform operations based on the corresponding proximity sensor data. This prevents confusion in proximity sensor data.

[0117] In some embodiments, after entering a scenario where proximity sensing data is required, the application will register a fourth listener for proximity sensor 1 and a fifth listener for proximity sensor 2, regardless of the current screen display state. Furthermore, in this embodiment, in response to the phone switching to the screen 1 display state, the application switches to using the sensing data of proximity sensor 1 obtained based on the fourth listener to control the preset device corresponding to screen 1 to perform an operation. In response to the phone switching to the screen 2 display state, the application can switch to using the sensing data of proximity sensor 2 obtained based on the fifth listener to control the preset device corresponding to screen 2 to perform an operation. In other words, the application registers listeners for both proximity sensors, and in one of the screen display states, the application uses the corresponding proximity sensing data to control the phone to perform an operation; when a screen display state switch is detected, the application can switch to using the other proximity sensing data to control the phone to perform an operation. In this way, the application determines which sensing data to use to control the phone to perform an operation based on the screen display state, avoiding data confusion.

[0118] In other embodiments, the application may also register a fourth listener for the proximity sensor 1 corresponding to screen 1 in response to the mobile phone switching to the screen 1 display state. Similarly, the application may register a fifth listener for the proximity sensor 2 corresponding to screen 2 in response to the mobile phone switching to the screen 2 display state. Furthermore, after switching to the screen 1 display state, the application may also cancel the listener registered for the proximity sensor 2. After switching to the screen 2 display state, the application may also cancel the listener registered for the proximity sensor 1. In this way, the application can only obtain the sensing data of the proximity sensor corresponding to one of the screen display states, so that data confusion will not occur. In addition, the application only registers the listener when the proximity sensor is needed. The proximity sensor that is not registered as a listener may not work and does not need to report sensing data to the application, thereby reducing unnecessary power consumption.

[0119] In addition to executing the scene judgment of the screen display status in the application, the mobile phone can also set the scene judgment of the screen display status to be executed at the driver layer. In some embodiments, in order to ensure that the sensing data of the two proximity sensors can be obtained and used by the application, a data fusion module can also be added to the driver layer, and the drive type of the data fusion module is defined as a preset drive type: type_proximity. In this way, when the application needs to use the proximity sensing data, it can register a listener for the data fusion module whose drive type is defined as type_proximity. At the same time, the data fusion module can monitor the sensing data of each proximity sensor at the same time. In this way, the data fusion module can obtain the sensing data of each proximity sensor, and the data fusion module can report the received proximity sensing data to the application. This ensures that the application can also obtain the sensing data of each proximity sensor.

[0120] Furthermore, in an embodiment that adds a data fusion module and defines its driver type as type_proximity, the driver type of device driver 1 and / or device driver 2 can be defined as another driver type, such as type_proximity_1 for device driver 1 and type_proximity_2 for device driver 2. This way, when an application registers a listener for the proximity sensor, it will not register listeners for device driver 1 or device driver 2, but only for the data fusion module whose driver type is defined as type_proximity. This ensures that the sensing data obtained by the application is correct, avoids duplicate proximity sensing data, and prevents data confusion.

[0121] In the above Figure 5 In the example shown, the application only obtains data from proximity sensor 1 when the phone's screen 1 is displayed, and only obtains data from proximity sensor 2 when the phone's screen 2 is displayed. To ensure this execution logic, the data fusion module can determine which proximity sensor's data to report to the application based on the phone's screen display state. For example, the data fusion module obtains data from both proximity sensors. When the data fusion module determines that the phone is currently displaying screen 1, it only reports data from proximity sensor 1 to the upper-layer application. When the data fusion module determines that the phone is currently displaying screen 2, it only reports data from proximity sensor 2 to the upper-layer application. In this embodiment, S303 is specifically executed in the data fusion module. S304a describes the process of reporting proximity sensor 1 data to the application when the phone is currently displaying screen 1. S304b specifically corresponds to the process of the virtual proximity driver reporting proximity sensor 2 data to the application when the phone is currently displaying screen 2. This ensures that the application can obtain accurate sensing data regardless of the screen display state of different mobile phones and control the preset components corresponding to the corresponding screen to perform operations. In addition, the data fusion module determines the mobile phone screen display state, which can avoid the application's scene judgment of the screen display state, reducing the application's processing complexity.

[0122] In some embodiments, the data fusion module can be integrated with the device driver corresponding to one of the proximity sensors. For example, if the data fusion module is integrated with device driver 1 corresponding to proximity sensor 1, the driver type of device driver 1 is defined as the default driver type of the mobile phone system, such as type_proximity. Accordingly, the driver type of device driver 2 corresponding to proximity sensor 2 is defined as another driver type, such as type_proximity_1. In this embodiment, the application registers a listener (such as the sixth listener) with device driver 1, and device driver 1 registers a listener (such as the seventh listener) with device driver 2. This allows device driver 1 to monitor not only the sensing data from proximity sensor 1 but also the sensing data from proximity sensor 2. The application can then obtain sensing data from both proximity sensors from device driver 1 through the listener. Alternatively, for example, if the data fusion module is integrated with device driver 2 corresponding to proximity sensor 1, the driver type of device driver 2 is defined as the default driver type of the mobile phone system, such as type_proximity. Accordingly, the driver type of device driver 1 corresponding to proximity sensor 1 is defined as another driver type, such as type_proximity_1. In this embodiment, the application registers a listener (e.g., the eighth listener) with device driver 2, and device driver 1 registers a listener (e.g., the ninth listener) with device driver 2. This allows device driver 2 to monitor not only the sensing data from proximity sensor 2 but also the sensing data from proximity sensor 1. The application can then obtain sensing data from both proximity sensors from device driver 2 through the listener. This ensures that the application can obtain sensing data from each proximity sensor.

[0123] In other embodiments, the data fusion module may be independent of the device driver settings of the two proximity sensors. Figure 7A schematic diagram illustrates, in some embodiments, a data fusion module independent of two device drivers. In this embodiment, the data fusion module is designated a virtual proximity driver. In this embodiment, the virtual proximity driver's driver type is defined as type_proximity, device driver 1's driver type is defined as type_proximity_1 (which can be designated as the second driver type), and device driver 2's driver type is defined as type_proximity_2 (which can be designated as the third driver type). The application registers a listener (e.g., the first listener) with the virtual proximity driver, and the virtual proximity driver registers listeners (e.g., the second listener and the third listener) with device driver 1 and device driver 2, respectively. Thus, when device driver 1 detects data from proximity sensor 1, it notifies the virtual proximity driver. Similarly, when device driver 2 detects data from proximity sensor 2, it notifies the virtual proximity driver. The virtual proximity driver then fuses the two sensor data based on the current phone's screen display state and reports the fused data to the application. The virtual proximity driver registers a listener with device driver 1, meaning that the virtual proximity driver registers a listener with proximity sensor 1. The virtual proximity driver registers a listener with the device driver 2 , that is, the virtual proximity driver registers a listener with the proximity sensor 2 .

[0124] In some embodiments, the data fusion module may be provided on the intelligent sensor hub side of the driver layer.

[0125] Figure 8 The following diagram shows the software and hardware framework of a mobile phone. This embodiment uses a call application as an example, and the data fusion module is independent of the device drivers for the two proximity sensors (hereinafter referred to as the virtual proximity driver). When the call application starts, it sends a registration instruction to the sensor service to register the proximity sensor. The sensor service sends this registration instruction to the subsystem framework via the proximity sensor HAL (prox HAL) in the sensor HIDL module of the hardware abstraction layer. The subsystem framework then sends the registration instruction to the sensor driver via the Quadcomm Messaging Interface (QMI) communication module, the sensor client manager, and the event distribution management module. Specifically, based on the registration instruction, the event distribution management module locates a driver defined as type_proximity, namely the virtual proximity driver mentioned above. It then registers a listener for the call application with the virtual proximity driver. Simultaneously, the virtual proximity driver registers listeners with device driver 1 corresponding to proximity sensor 1 and device driver 2 corresponding to proximity sensor 2. Device driver 1 activates proximity sensor 1, and device driver 2 activates proximity sensor 2.

[0126] In the technical solution provided in the embodiments of this application, a virtual proximity driver is added that is independent of the device driver of the two proximity sensors and is defined as type_proximity. This allows the application to accurately obtain the sensing data of the proximity sensor corresponding to the screen being used under different screen display states without any modification to the application layer, framework layer, and hardware abstraction layer. In other words, the above method is unaware of the upper framework layer and the application layer, and does not require adjustments to the logic of the listener originally used by the application to use the sensing data. This provides a certain degree of decoupling and a high degree of solution compatibility.

[0127] As can be seen from the above description, to ensure that the application only obtains the sensing data from proximity sensor 1 when screen 1 is displayed, and only obtains the sensing data from proximity sensor 2 when screen 2 is displayed, the virtual proximity driver needs to determine the sensing data to be reported to the application based on the screen display state. Therefore, in this embodiment, the virtual proximity driver needs to obtain the screen display state. In some embodiments, the virtual proximity driver can obtain the screen display state from the screen display decision module of the framework layer.

[0128] Furthermore, in embodiments that add a data fusion module, scenario determination based on the screen display state can also be performed within the application. Specifically, a data fusion module is added to the driver layer, and its driver type is defined as a preset driver type. This way, when an application registers a listener for a proximity sensor, it only registers the listener for the data fusion module. This requires no modifications to the application, nor does it require changes to the phone operating system's definition of the proximity sensor driver type; this solution is decoupled and highly compatible. Furthermore, in this embodiment, the data fusion module reports all proximity sensor data to the application, regardless of the current screen display state of the phone. The application then determines which proximity sensor data to use for decision-making based on the screen display state. It should be noted that the data fusion module in this embodiment can be integrated with the device driver for one of the proximity sensors, or it can be independent of the device driver for each proximity sensor. In other words, in this embodiment, step S303 is still performed by the application.

[0129] Next, the timing of the data fusion module registering a listener for the proximity sensor device driver is described. In the following embodiments, the data fusion module is independent of the device driver settings of the two proximity sensors, that is, the data fusion module is a virtual proximity driver.

[0130] In some embodiments, upon receiving a registration instruction from an application to register a listener for a proximity sensor, the virtual proximity driver simultaneously registers listeners with both device drivers, regardless of whether the phone is currently displaying screen 1 or screen 2. That is, in response to the application registering a listener for the virtual proximity driver, the virtual proximity driver registers a listener with device driver 1 and a listener with device driver 2. Subsequently, when screen 1 is displayed, the virtual proximity driver can receive sensing data from both proximity sensors, reported by device driver 1 and device driver 2. However, since the application only needs to obtain sensing data from proximity sensor 1 when screen 1 is displayed, the virtual proximity driver only reports sensing data from proximity sensor 1 to the application when screen 1 is displayed. When screen 2 is displayed, the virtual proximity driver can also receive sensing data from both proximity sensors, reported by device driver 1 and device driver 2. Since the application only needs to obtain sensing data from proximity sensor 2 when screen 2 is displayed, the virtual proximity driver only reports sensing data from proximity sensor 2 to the application when screen 2 is displayed. Among them, in response to the phone switching from screen 1 display state to screen 2 display state, the virtual proximity driver switches from reporting the sensing data of proximity sensor 1 to the application to reporting the sensing data of proximity sensor 2 to the application. Correspondingly, in response to the phone switching from screen 2 display state to screen 1 display state, the virtual proximity driver switches from reporting the sensing data of proximity sensor 2 to the application to reporting the sensing data of proximity sensor 1 to the application.

[0131] Among them, the specific implementation process of the virtual proximity driver registering a listener for the device driver may include: the virtual proximity driver sends a registration instruction of the listener to the device driver, and the device driver adds a listener record of the virtual proximity driver in response to the registration instruction of the listener. The specific process of the virtual proximity driver reporting proximity sensing data to the application includes: the virtual proximity driver sends proximity sensing data to the event distribution management module by calling back the listener registered by the call application. The event distribution management module sends the proximity sensing data to the sensor client manager, and then passes it to the QMI communication module. Then, the QMI communication module reports this proximity sensing data to the hardware abstraction layer, and transmits the proximity sensing data to the call application through the framework layer. Thereby, the call application can obtain the reported proximity sensing data through the callback process of the above-mentioned listener, and use the proximity sensing data to control the corresponding preset device to perform operations.

[0132] In the technical solution proposed in the embodiment of the present application, when the virtual proximity driver receives the registration instruction for registering a listener for the proximity sensor issued by the application, it registers the listener for the device drivers corresponding to both proximity sensors. In this way, after receiving the sensing data reported by the device driver, it can immediately determine whether to report this sensing data based on the current screen display status of the mobile phone. For example, after the virtual proximity driver receives the sensing data of proximity sensor 2 reported by device driver 2, if it obtains that the screen display status of the current mobile phone is screen 1 display status, it will not report the sensing data of proximity sensor 2. When the virtual proximity driver receives the sensing data of proximity sensor 1 reported by device driver 1, if it obtains that the screen display status of the current mobile phone is screen 1 display status, it will report the sensing data of proximity sensor 1. This ensures that the application receives changes in proximity sensing data as quickly as possible and responds to the screen accordingly, thereby improving the timeliness of the application's response to changes in proximity sensing data.

[0133] Since the proximity sensors required by the application are different in different screen display states, in order to reduce power consumption, the virtual proximity driver can also register a listener with the device driver of the corresponding proximity sensor when it is needed. In some embodiments, when the mobile phone is in the screen 1 display state, the virtual proximity driver only registers a listener with the device driver 1 of the proximity sensor 1. When the mobile phone is in the screen 2 display state, the virtual proximity driver only registers a listener with the device driver 2 of the proximity sensor 2. Specifically, after receiving the message that the mobile phone switches from the screen 1 display state to the screen 2 display state, the virtual proximity driver cancels the listener registered with the device driver 1 of the proximity sensor 1, and registers a listener with the device driver 2 of the proximity sensor 2. Similarly, after receiving the message that the mobile phone switches from the screen 2 display state to the screen 1 display state, the virtual proximity driver cancels the listener registered with the device driver 2 of the proximity sensor 2, and registers a listener with the device driver 1 of the proximity sensor 1.

[0134] The specific implementation process of the virtual proximity driver canceling the listener registered with the device driver may include: the virtual proximity driver sending a listener cancellation instruction to the device driver, and the device driver deleting the listener record of the virtual proximity driver in response to the listener cancellation instruction. After the device driver cancels the virtual proximity driver's listener for the device driver, the device driver will no longer report the proximity sensor sensing data changes to the virtual proximity driver when detecting changes in the proximity sensor sensing data.

[0135] In the technical solution proposed in the embodiments of this application, when the phone switches to a certain screen display state, the virtual proximity driver registers a listener with the device driver for the proximity sensor corresponding to that screen. When the phone switches to another screen display state, the listener registration for the device driver for the proximity sensor corresponding to that screen is canceled. This way, when the virtual proximity driver is in one of the phone's screen display states, it only receives sensing data from the proximity sensor corresponding to that screen display state. Specifically, when the phone is in screen 1 display state, the virtual proximity driver only registers device driver 1 for proximity sensor 1. Similarly, when the phone is in screen 2 display state, the virtual proximity driver only registers device driver 2 for proximity sensor 2. Consequently, the virtual proximity driver only reports sensing data from proximity sensor 1 to applications when screen 1 is displayed, and reports sensing data from proximity sensor 2 to applications when screen 2 is displayed. Furthermore, since device driver 2 does not need to report sensing data from proximity sensor 2 when screen 1 is displayed, and device driver 1 does not need to report sensing data from proximity sensor 1 when screen 2 is displayed, the number of device driver reports can be reduced, thereby reducing unnecessary power consumption of the phone.

[0136] In some embodiments, after the virtual proximity driver sends a listener registration instruction to the device driver, the device driver responds to the listener registration instruction to register the listener for the virtual proximity driver and also starts the corresponding proximity sensor. After the virtual proximity driver sends a listener cancellation instruction to the device driver, if no other module listens to the proximity sensor, the device driver responds to the listener cancellation instruction to not only cancel the listener registered by the virtual proximity driver, but also turn off the corresponding proximity sensor. In this way, when the virtual proximity driver does not register a listener for the device driver, the corresponding proximity sensor can temporarily stop working. Since the virtual proximity driver does not register a listener for the device driver, the application does not need to obtain the sensing data of the proximity sensor (such as when screen 1 is displayed, the application does not need to obtain the sensing data of proximity sensor 2). Therefore, the temporary cessation of the proximity sensor will not affect the operation of the mobile phone based on the sensing data of the proximity sensor. In other words, while ensuring the normal operation of the mobile phone, the power consumption caused by the operation of proximity sensors that are not needed can be reduced.

[0137] In some embodiments, all proximity sensors can be executed in the above manner, that is, when the mobile phone switches to the screen a display state, the virtual proximity driver registers a listener with the device driver of the proximity sensor corresponding to the screen a; when the mobile phone switches to other screen display states, the virtual proximity driver cancels the listener registered with the device driver of the proximity sensor corresponding to the screen a.

[0138] Furthermore, different types of proximity sensors consume different amounts of power when in operation. In other embodiments, the above-described method may be applied only to proximity sensors with higher power consumption. For example, the power consumption of a first type of proximity sensor m is higher than that of a second type of proximity sensor n. In this embodiment, for the proximity sensor m with higher power consumption, when the mobile phone switches to the screen display state corresponding to the proximity sensor m, the virtual proximity driver registers a listener with the device driver of the proximity sensor m; when the screen display state corresponding to the proximity sensor m is no longer needed, the virtual proximity driver cancels the listener registered with the device driver of the proximity sensor m. Taking the proximity sensor 1 in the above embodiment as an ultrasonic proximity sensor, and the ultrasonic proximity sensor being a proximity sensor with higher power consumption as an example, when the mobile phone is in the screen 1 display state, the virtual proximity driver registers a listener with the device driver 1 of the ultrasonic proximity sensor. When the mobile phone is in the screen 2 display state, the virtual proximity driver cancels the registration of the listener with the device driver 1 of the ultrasonic proximity sensor.

[0139] As for the proximity sensor n with lower power consumption, no matter which screen the mobile phone is using, as long as the virtual proximity driver receives the registration instruction for registering the listener for the proximity sensor from the application, the virtual proximity driver can register the listener for the device driver of the proximity sensor n. That is, the virtual proximity driver registers the listener for the device driver of the proximity sensor n in response to receiving the registration instruction for registering the listener for the proximity sensor from the application. Taking the above embodiment in which proximity sensor 2 is an optical proximity sensor, and the optical proximity sensor belongs to the proximity sensor n with lower power consumption as an example, after the virtual proximity driver responds to the registration instruction for registering the listener for the proximity sensor from the application, the virtual proximity driver registers the listener for the device driver 2 of the optical proximity sensor. Regardless of whether the current mobile phone is in the screen 1 display state or the screen 2 display state, the virtual proximity driver will not cancel the listener registered for the device driver 2 of the optical proximity sensor.

[0140] Furthermore, if the application cancels the listener registered with the proximity sensor, the virtual proximity driver will cancel the listener registered with the device driver of proximity sensor 1 and / or proximity sensor 2. Exemplarily, upon receiving the listener cancellation instruction issued by the application, the virtual proximity driver cancels the listener registered with the application and cancels the listener registered with the device driver of proximity sensor 1 and / or proximity sensor 2.

[0141] In the above-mentioned embodiment, the implementation method of registering a listener with the proximity sensor device driver in conjunction with the screen usage status can be applied to embodiments in which the application performs scenario determination of the screen display status and determines which proximity sensing data to use. In other embodiments, the above-mentioned implementation method of registering a listener with the proximity sensor device driver in conjunction with the screen usage status can also be applied to embodiments in which the data fusion module performs scenario determination of the screen display status and determines which proximity sensing data to report to the application.

[0142] In some embodiments, multiple screens of a mobile phone (such as the inner screen and outer screen of a dual-screen folding mobile phone) can be provided with the same type of proximity sensor, or different types of proximity sensors can be provided. Exemplarily, the inner screen of the dual-screen folding mobile phone (which can be the above-mentioned screen 1) corresponds to using a first type of proximity sensor (such as an ultrasonic proximity sensor), and the outer screen (which can be the above-mentioned screen 2) uses a second type of proximity sensor (such as an optical proximity sensor). In other embodiments, both the inner screen and the outer screen of the dual-screen mobile phone use ultrasonic proximity sensors. In other embodiments, both the inner screen and the outer screen of the dual-screen mobile phone use optical proximity sensors. Alternatively, in other embodiments, the mobile phone can also use other types of proximity sensors, which are not limited in the embodiments of the present application.

[0143] The following is an example of a dual-screen folding mobile phone using an ultrasonic proximity sensor for the inner screen and an optical proximity sensor for the outer screen. Figure 9 The flowchart of executing virtual proximity driving in the process of acquiring sensing data by an application in some embodiments is shown.

[0144] The virtual proximity driver receives a registration instruction from the application to register a listener for the proximity sensor. In response to the registration instruction, the virtual proximity driver registers a listener with device driver 2 for the optical proximity sensor. The virtual proximity driver determines whether the device is currently displaying the inner screen. If so, it registers a listener with device driver 1 for the ultrasonic proximity sensor. Subsequently, upon receiving sensing data from the ultrasonic proximity sensor reported by device driver 1, the virtual proximity driver reports this data to the application. Furthermore, the virtual proximity driver continuously determines whether the device has switched from the inner screen display state to the outer screen display state. After detecting a switch from the inner screen display state to the outer screen display state, the virtual proximity driver cancels the listener registration with device driver 1 for the ultrasonic proximity sensor. After canceling the listener registration with device driver 1, if the virtual proximity driver receives sensing data from the optical proximity sensor reported by device driver 2, the virtual proximity driver reports this data to the application.

[0145] If the current state is not the inner screen display state, it can be determined whether the current state is the outer screen display state. If the current state is the outer screen display state, the virtual proximity driver receives the sensing data of the optical proximity sensor reported by the device driver 2 and reports the sensing data of the optical proximity sensor to the application.

[0146] It should be noted that in the above embodiment, after registering a listener with the device driver 2 of the optical proximity sensor, the virtual proximity driver may first determine whether the device is in the external screen display state. If it is determined that the device is currently in the external screen display state, the virtual proximity driver performs an operation to report the sensing data of the optical proximity sensor to the application. If it is determined that the device is not currently in the external screen display state, the virtual proximity driver then determines whether the device is in the internal screen display state. Alternatively, in other embodiments, the virtual proximity driver may also simultaneously determine whether the device is in the internal screen display state and whether the device is in the external screen display state. Subsequently, based on the two judgment results, the virtual proximity driver determines which proximity sensor sensing data needs to be reported to the application.

[0147] In the technical solution provided in the embodiments of the present application, after the application registers a listener for the proximity sensor, the virtual proximity driver registers a listener with the device driver 2 for the optical proximity sensor. If it detects that the phone has switched to the inner screen display state, the virtual proximity driver also registers a listener with the device driver 1 for the ultrasonic proximity sensor. Furthermore, while the inner screen is displayed, the virtual proximity driver only reports sensing data from the ultrasonic proximity sensor to the application, and does not report sensing data from the optical proximity sensor. If it subsequently detects that the phone has switched from the inner screen display state to the outer screen display state, the virtual proximity driver cancels the listener registered with the device driver 1 for the inner screen ultrasonic proximity sensor. Furthermore, while the outer screen is displayed, the virtual proximity driver only reports sensing data from the optical proximity sensor to the application. This ensures that the virtual proximity driver only reports sensing data from the optical proximity sensor corresponding to the outer screen to the application when the outer screen is displayed, and only reports sensing data from the ultrasonic proximity sensor corresponding to the inner screen when the inner screen is displayed.

[0148] Figure 10 The timing diagram of the application acquiring the sensing data of the proximity sensor is shown. In this embodiment, the inner screen of the mobile phone corresponds to the ultrasonic proximity sensor and device driver 1, and the outer screen of the mobile phone corresponds to the optical proximity sensor and device driver 2 as an example for description.

[0149] S0. The application sends a registration instruction to the sensor service to register a listener for the proximity sensor.

[0150] In combination with the description of the above embodiments, it can be seen that the application can send the registration instruction when it is started, or the application can send the registration instruction to the sensor service of the framework layer when entering a preset scene (such as making or receiving a call, playing a voice message, displaying the screen off, etc.).

[0151] S1. The sensor service sends a registration instruction to the sensor module.

[0152] S2. The sensor module sends a registration instruction to the driver layer.

[0153] S3. The virtual proximity driver registers a listener for the application to the virtual proximity driver.

[0154] In some embodiments, the virtual proximity driver registers a listener for the application with the virtual proximity driver in response to the registration instruction. It is understood that before this, the virtual proximity driver can initialize and create resources in response to the registration instruction, and then perform the operation of registering the listener for the application.

[0155] In some embodiments, S3 may specifically include the virtual proximity driver adding a listener record to the application. Thereafter, the virtual proximity driver needs to report corresponding sensing data to the application based on the listener record.

[0156] S4. The virtual proximity driver registers a listener with the device driver 2 of the optical proximity sensor.

[0157] It is understandable that after S4, the device driver 2 will report the sensing data of the optical proximity sensor to the virtual proximity driver. However, the virtual proximity driver needs to determine whether to report the sensing data of the optical proximity sensor in combination with the current screen display state of the mobile phone.

[0158] S5. The screen display decision module sends a message to the virtual proximity driver to switch to the inner screen display.

[0159] Correspondingly, the virtual proximity driver receives a message for switching to the inner screen display sent by the screen display decision module.

[0160] In some embodiments, the above S5 may specifically be that the screen display decision module actively sends a message for switching the screen display state to the virtual proximity driver when the screen display state of the mobile phone is switched.

[0161] In other embodiments, the virtual proximity driver may also send a screen display status query request to the screen display decision module. In response to the query request, the screen display decision module may send the screen display status to the virtual proximity driver. The virtual proximity driver may then determine whether the screen display status has switched based on the current and previous screen display states. The virtual proximity driver may send a screen display status query request to the screen display decision module at regular intervals.

[0162] After determining that the mobile phone switches to the inner screen display (ie, the inner screen display state described above), the virtual proximity driving may execute S6-S13.

[0163] S6. The virtual proximity driver registers a listener with the device driver 1 of the ultrasonic proximity sensor.

[0164] S7. Device driver 1 detects sensing data from the ultrasonic proximity sensor.

[0165] S8. Device driver 1 reports ultrasonic sensing data to the virtual proximity driver.

[0166] While the external screen is in display mode, the virtual proximity driver can still receive screen display status messages from the screen display decision module. Therefore, it's possible that the screen display state has changed after the virtual proximity driver receives sensing data from the ultrasonic proximity sensor. Therefore, before reporting this sensing data to upper-layer applications, the virtual proximity driver can also determine whether the external screen is currently in display mode (i.e., S9).

[0167] S9. The virtual proximity driver determines whether the external screen is in display status.

[0168] If the determination result of S9 indicates that the current state is not the external screen display state, S10 is executed.

[0169] S10. The virtual proximity driver does not report sensing data.

[0170] If the determination result of S9 indicates that the current state is the external screen display state, then S11 to S13 are executed.

[0171] S11. The virtual proximity driver reports ultrasonic sensing data to the sensor module.

[0172] It should be noted that the ultrasonic sensing data in S11 specifically refers to sensing data of the ultrasonic sensor.

[0173] S12. The sensor module reports the ultrasonic sensing data to the sensor service.

[0174] S13. The sensor service reports the ultrasonic sensing data to the application.

[0175] Afterwards, if the virtual proximity driver receives a message to switch to the external screen display from the screen display decision module of the framework layer, the virtual proximity driver will cancel the listener registered for the optical proximity sensor.

[0176] S14. The screen display decision module sends a message to the virtual proximity driver to switch to the external screen display.

[0177] Correspondingly, the virtual proximity driver receives the message sent by the framework layer to switch to the external screen display.

[0178] S15. The virtual proximity driver cancels the listener registered with the device driver 1 of the ultrasonic proximity sensor.

[0179] S16. The device driver 2 detects the sensing data of the optical proximity sensor.

[0180] S17. Device driver 2 reports the optical sensing data to the virtual proximity driver.

[0181] It should be noted that the optical sensing data in S17 specifically refers to sensing data of the optical sensor.

[0182] S18. The virtual proximity driver determines whether the external screen is in display status.

[0183] If the judgment result of S18 determines that the current state is not the external screen display state, S19 is executed.

[0184] S19. The virtual proximity driver does not report sensing data.

[0185] If the judgment result of S18 determines that the current mobile phone is in the external screen display state, S20-S22 are executed.

[0186] S20. The virtual proximity driver reports the optical sensing data to the sensor module.

[0187] S21. The sensor module reports the optical sensing data to the sensor service.

[0188] S22. The sensor service reports the optical sensing data to the application.

[0189] Next, S23 - S27 are used to illustrate the process of the application canceling the listener registered for the proximity sensor.

[0190] S23. The application sends a cancellation instruction for the proximity sensor listener to the sensor service.

[0191] The cancel instruction of this listener is used to cancel the listener registered by the application for the proximity sensor.

[0192] In some embodiments, the application may issue the cancel instruction when exiting, or the application may issue the cancel instruction when exiting a preset scenario (such as answering a call, playing a voice message, and keeping the screen off, etc.).

[0193] S24. The sensor service sends a cancel instruction to the sensor module.

[0194] S25. The sensor module sends a cancel instruction to the driver layer.

[0195] S26. The virtual proximity driver cancels the listener registered by the application to the virtual proximity driver.

[0196] In some embodiments, S26 may specifically include: deleting a listener record applied in the virtual proximity driver.

[0197] S27 . The virtual proximity driver cancels the listener registered with device driver 1 and / or device driver 2 .

[0198] In some embodiments, the mobile phone may execute S26 first and then S27. In other embodiments, the mobile phone may execute S27 first and then S26. Alternatively, the mobile phone may execute S26 and S27 simultaneously. In the embodiments of the present application, the order of executing S26 and S27 is not limited.

[0199] It is understood that S23-S27 can be executed at any time after S3. If S23-S27 occur after S4 and before S6, or if S23-S27 occur after S15, the virtual proximity driver only cancels the listener registered for device driver 2. If S23-S27 occur after S6 and before S15, the virtual proximity driver cancels the listeners registered for device driver 1 and device driver 2.

[0200] It should be noted that the above embodiments are all described using a dual-screen mobile phone as an example. In other embodiments, the above method can also be applied to electronic devices such as mobile phones with three or more screens, wherein each screen is provided with a proximity sensor.

[0201] like Figure 11 FIG2 is a schematic diagram of the structure of an electronic device 800 provided in an embodiment of the present application. The electronic device 800 may include a processor 810, an external memory interface 820, an internal memory 821, a universal serial bus (USB) interface 830, a charging management module 840, a power management module 841, a battery 842, an antenna 1, an antenna 2, a mobile communication module 850, a wireless communication module 860, an audio module 870, a speaker 870A, an earpiece 870B, a sensor module 880, a button 890, a motor 891, a camera 892, a display 893, and a subscriber identification module (SIM) card interface 894. The sensor module 880 may include a pressure sensor 880A, a touch sensor 880B, and a proximity sensor 880C.

[0202] It should be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 800. In other embodiments of the present application, the electronic device 800 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0203] The processor 810 may include one or more processing units, for example, the processor 810 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors. For example, the processor 810 is used to execute the method for processing sensing data in the embodiments of the present application.

[0204] The controller may be the nerve center and command center of the electronic device 800. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0205] Processor 810 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 810 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 810. If processor 810 needs to use the same instruction or data again, it can directly retrieve it from the memory. This avoids duplicate accesses, reduces processor 810 latency, and thus improves system efficiency.

[0206] The USB interface 830 is an interface that complies with USB standards, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 830 may be used to connect a charger to charge the electronic device 800, and may also be used to transfer data between the electronic device 800 and peripheral devices.

[0207] The external memory interface 820 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 800. The external memory card communicates with the processor 810 via the external memory interface 820 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0208] The internal memory 821 can be used to store computer executable program code, which includes instructions. The processor 810 executes various functional applications and data processing of the electronic device 800 by running the instructions stored in the internal memory 821. The internal memory 821 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system and an application required for at least one function (such as a sound playback function, an image playback function, etc.).

[0209] In addition, the internal memory 821 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0210] The charging management module 840 is configured to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 840 may receive charging input from the wired charger via the USB interface 830.

[0211] The power management module 841 is used to connect the battery 842, the charging management module 840, and the processor 810. The power management module 841 receives input from the battery 842 and / or the charging management module 840 and provides power to the processor 810, the internal memory 821, the external memory, the display 893, the camera 892, and the wireless communication module 860.

[0212] In some other embodiments, the power management module 841 may also be provided in the processor 810. In some other embodiments, the power management module 841 and the charging management module 840 may also be provided in the same device.

[0213] The wireless communication function of the electronic device 800 can be implemented through antenna 1, antenna 2, mobile communication module 850, wireless communication module 860, modem processor and baseband processor.

[0214] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 800 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0215] The mobile communication module 850 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for the electronic device 800. The mobile communication module 850 may include at least one filter, a switch, a power amplifier, a low-noise amplifier (LNA), and the like. The mobile communication module 850 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 850 can also amplify the signals modulated by the modem processor and convert them into electromagnetic waves for radiation via the antenna 1.

[0216] The wireless communication module 860 can provide wireless communication solutions including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. applied to the electronic device 800. The wireless communication module 860 can be one or more devices integrating at least one communication processing module. The wireless communication module 860 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 810. The wireless communication module 860 can also receive the signal to be sent from the processor 810, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0217] In some embodiments, antenna 1 of electronic device 800 is coupled to mobile communication module 850 , and antenna 2 is coupled to wireless communication module 860 , so that electronic device 800 can communicate with the network and other devices through wireless communication technology.

[0218] The electronic device 800 can implement audio functions such as music playback and recording through the audio module 870 and the application processor.

[0219] The audio module 870 is used to convert digital audio signals into analog audio signal outputs, and is also used to convert analog audio inputs into digital audio signals. The audio module 870 can also be used to encode and decode audio signals. In some embodiments, the audio module 870 can be arranged in the processor 810, or some functional modules of the audio module 870 can be arranged in the processor 810. The audio module 870 can include a speaker 870A and an earpiece 870B.

[0220] Speaker 870A, also known as a "horn," is used to convert audio electrical signals into sound signals. Electronic device 100 can listen to music or conduct video conferencing through speaker 870A. An electronic device may include one or N speakers 870A.

[0221] The earpiece 870B is also used to convert the audio electrical signal into a sound signal. The electronic device may include one or N earpieces 870 .

[0222] The pressure sensor 880A is used to sense pressure signals and convert them into electrical signals. In some embodiments, the pressure sensor 880A can be provided on the display screen 893. There are many types of pressure sensors 880A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a device comprising at least two parallel plates having a conductive material. When a force acts on the pressure sensor 880A, the capacitance between the electrodes changes. The electronic device 800 determines the intensity of the pressure based on the change in capacitance. When a touch operation is applied to the display screen 893, the electronic device 800 detects the intensity of the touch operation based on the pressure sensor 880A. The electronic device 800 can also calculate the position of the touch based on the detection signal of the pressure sensor 880A.

[0223] Touch sensor 880B, also known as a "touch panel," can be disposed on display screen 893. The touch sensor 880B and display screen 893 form a touch screen, also known as a "touch screen." Touch sensor 880B is configured to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to an application processor to determine the type of touch event. Visual output related to the touch operations can be provided via display screen 893. In other embodiments, touch sensor 880B can also be disposed on the surface of electronic device 800, at a location different from that of display screen 893.

[0224] The proximity sensor 880C is used to detect the distance between an object and the proximity sensor. In the embodiment of the present application, the electronic device 800 may include 2 or N proximity sensors 880C.

[0225] Keys 890 include a power button, a volume button, and the like. Keys 890 may be mechanical keys or touch-sensitive keys. Electronic device 800 may receive key inputs and generate key signal inputs related to user settings and function control of electronic device 800.

[0226] Motor 891 can generate vibration prompts. Motor 891 can be used for incoming call vibration prompts and can also be used for touch vibration feedback.

[0227] The camera 892 is used to capture still images or videos. In some embodiments, the electronic device 800 may include 1 or N cameras 892, where N is a positive integer greater than 1.

[0228] Electronic device 800 implements display functionality through a GPU, display screen 893, and an application processor. The GPU is a microprocessor for image processing that connects display screen 893 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 810 may include one or more GPUs that execute program instructions to generate or modify display information.

[0229] The display screen 893 is used to display images, videos, etc. In some embodiments, the electronic device 800 may include 2 or N display screens 893, where N is a positive integer greater than 2. In the embodiment of the present application, one display screen 893 corresponds to at least one proximity sensor 880C.

[0230] SIM card interface 894 is used to connect a SIM card. A SIM card can be connected to and disconnected from electronic device 800 by inserting or removing it from SIM card interface 894. Electronic device 800 may support one or N SIM card interfaces, where N is a positive integer greater than one.

[0231] The sensing data processing methods in the following embodiments can all be implemented in the electronic device 800 having the above hardware structure.

[0232] Some other embodiments of the present application provide an electronic device (such as a mobile phone). The electronic device may include: the electronic device may include: at least two screens, at least two proximity sensors, one or more processors and a memory. The screen is used to display the interface of the electronic device; the proximity sensor is used to detect the distance between the object and the proximity sensor. The screens are respectively used to display the interface of the electronic device. The proximity sensor is used to detect the distance between the object and the proximity sensor. One proximity sensor is set for each screen. The memory is coupled to the processor. The memory is also used to store computer program code, which includes computer instructions. When the processor executes the computer instructions, the electronic device can execute the various functions or steps performed by the mobile phone in the above method embodiment. The structure of the electronic device can refer to Figure 11The structure of the electronic device 800 is shown.

[0233] The present application also provides a chip system. Figure 12 As shown, the chip system 90 includes at least one processor 901 and at least one interface circuit 902. The processor 901 and the interface circuit 902 can be interconnected via lines. For example, the interface circuit 902 can be used to receive signals from other devices (such as a computer memory). For another example, the interface circuit 902 can be used to send signals to other devices (such as the processor 901). Exemplarily, the interface circuit 902 can read instructions stored in the memory and send the instructions to the processor 901. When the instruction is executed by the processor 901, the computer can execute the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiments of the present application.

[0234] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device (such as a mobile phone), the electronic device executes the various functions or steps executed by the mobile phone in the above-mentioned method embodiment.

[0235] The present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the functions or steps executed by the mobile phone in the above method embodiment.

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

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

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

[0239] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

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

[0241] The above content is only a specific embodiment of this application, but the scope of protection of this application is not limited to this. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A method for processing sensing data, characterized in that: The method is applied to an electronic device, the electronic device including a first screen and a second screen, the first screen correspondingly provided with a first proximity sensor, and the second screen correspondingly provided with a second proximity sensor; the method comprising: When the electronic device is in a display state of the first screen, acquiring sensing data from the first proximity sensor, and controlling a first preset device to perform an operation based on the sensing data from the first proximity sensor; the first preset device including at least one of the following: the first screen, a speaker corresponding to the first screen, and an earpiece corresponding to the first screen; When the electronic device is in a display state of the second screen, sensing data from the second proximity sensor is obtained, and a second preset device is controlled to perform an operation based on the sensing data from the second proximity sensor; the second preset device includes at least one of the following: the second screen, a speaker corresponding to the second screen, and an earpiece corresponding to the second screen.

2. The method according to claim 1, characterized in that The electronic device is installed with an application, the electronic device includes a driver layer, and the driver layer includes a virtual proximity driver; the method further includes: The application registers a first listener with the virtual proximity driver, the virtual proximity driver registers a second listener with the first proximity sensor, and the virtual proximity driver registers a third listener with the second proximity sensor; The virtual proximity driver obtains sensing data of the first proximity sensor based on the second listener; the virtual proximity driver obtains sensing data of the second proximity sensor based on the third listener; and the application obtains sensing data of the first proximity sensor and sensing data of the second proximity sensor based on the first listener.

3. The method according to claim 2, characterized in that The method includes any of the following: The first item, The application obtains sensing data of the first proximity sensor based on the first listener, including: the virtual proximity driver reports the sensing data of the first proximity sensor to the application based on the first listener in response to the electronic device switching to a display state of the first screen; The application obtains sensing data of the second proximity sensor based on the first listener, including: the virtual proximity driver reports the sensing data of the second proximity sensor to the application based on the first listener in response to the electronic device switching to a display state of the second screen; The second item, When the first screen is displayed, the application receives the sensing data of the first proximity sensor and the sensing data of the second proximity sensor reported by the virtual proximity sensor based on the first listener; when the second screen is displayed, the application receives the sensing data of the first proximity sensor and the sensing data of the second proximity sensor reported by the virtual proximity sensor based on the first listener; The controlling the first preset device to perform an operation based on the sensing data of the first proximity sensor includes: in response to the electronic device switching to the display state of the first screen, the application controls the first preset device to perform an operation using the sensing data of the first proximity sensor obtained based on the first listener; The controlling the second preset device to perform an operation based on the sensing data of the second proximity sensor includes: the application controls the second preset device to perform an operation using the sensing data of the second proximity sensor obtained based on the first listener in response to the electronic device switching to the display state of the second screen.

4. The method according to claim 2 or 3, characterized in that The virtual proximity driver registering a second listener with the first proximity sensor includes: the virtual proximity driver registering the first listener with the virtual proximity driver in response to the application, and registering the second listener with the first proximity sensor; The virtual proximity driver registering a third listener with the second proximity sensor includes: the virtual proximity driver registering a first listener with the virtual proximity driver in response to the application, and registering the second listener with the second proximity sensor.

5. The method according to claim 2 or 3, characterized in that The type of the proximity sensor includes a first type and a second type; the power consumption of the first type proximity sensor is higher than the power consumption of the second type proximity sensor; The method comprises: The virtual proximity driver registers a listener for the second type of proximity sensor in response to the application registering the first listener with the virtual proximity driver; The virtual proximity driver registers a listener for the first type of proximity sensor in response to the electronic device switching to a display state of a target screen; the target screen is a screen corresponding to the first type of proximity sensor.

6. The method according to claim 5, characterized in that After the virtual proximity driver registers a listener for the first type of proximity sensor in response to the electronic device switching to a display state of the target screen, the method further includes: The virtual proximity driver cancels the listener registered with the first type of proximity sensor in response to the electronic device switching from a display state of the target screen to a display state of another screen.

7. The method according to claim 5 or 6, characterized in that The first type of proximity sensor includes an ultrasonic proximity sensor; the second type of proximity sensor includes an optical proximity sensor.

8. The method according to any one of claims 2 to 7, characterized in that The virtual proximity drive is defined as a first drive type; the first device drive corresponding to the first proximity sensor is defined as a second drive type; The second device driver corresponding to the second proximity sensor is defined as a third driver type; Wherein, the first driving type is the driving type of the proximity sensor set by the operating system of the electronic device; Neither the second driving type nor the third driving type is a driving type of the proximity sensor set by the operating system of the electronic device.

9. The method according to claim 1, characterized in that The electronic device has an application installed thereon, and the method includes any one of the following: The first item, The application registers a fourth listener for the first proximity sensor and a fifth listener for the second proximity sensor; the application obtains sensing data of the first proximity sensor based on the fourth listener; The application obtains sensing data of the second proximity sensor based on the fifth listener; In response to the electronic device switching to the display state of the first screen, the application switches to using the sensing data of the first proximity sensor obtained based on the fourth listener to control the first preset device to perform an operation; In response to the electronic device switching to the display state of the second screen, the application switches to using the sensing data of the second proximity sensor obtained based on the fifth listener to control the second preset device to perform an operation; The second item, In response to the electronic device switching to the display state of the first screen, the application registers a fourth listener for the first proximity sensor, obtains sensing data of the first proximity sensor based on the fourth listener, and controls the first preset device to perform an operation according to the sensing data of the first proximity sensor; In response to the electronic device switching to the display state of the second screen, the application registers a fifth listener for the second proximity sensor, obtains sensing data of the second proximity sensor based on the fifth listener, and controls the second preset device to perform an operation according to the sensing data of the second proximity sensor.

10. The method according to claim 1, characterized in that The electronic device is installed with an application, and includes a driver layer, wherein the driver layer includes: a first device driver corresponding to the first proximity sensor, and a second device driver corresponding to the second proximity sensor; and the method includes any one of the following: The first item, The method further includes: the application registering a sixth listener with the first proximity sensor; the first device driver registering a seventh listener with the second proximity sensor in response to the application registering the sixth listener with the first proximity sensor; The acquiring of the sensing data of the first proximity sensor includes: the application is driven by the first device to acquire the sensing data of the first proximity sensor based on the sixth listener; The acquiring of the sensing data of the second proximity sensor includes: the first device driver acquiring the sensing data of the second proximity sensor from the second device driver based on the seventh listener; and the application acquiring the sensing data of the second proximity sensor reported by the first device driver based on the sixth listener. The second item, The method further includes: registering, by the application, an eighth listener for the second proximity sensor; and driving, by the second device, registering, in response to the application registering the eighth listener for the second proximity sensor, a ninth listener for the first proximity sensor. The acquiring the sensing data of the second proximity sensor includes: the application acquiring the sensing data of the second proximity sensor based on the eighth listener; The obtaining of the sensing data of the first proximity sensor includes: the second device driver obtaining the sensing data of the first proximity sensor from the first device driver based on the ninth listener; and the application obtaining the sensing data of the first proximity sensor reported by the second device driver based on the eighth listener.

11. The method according to any one of claims 1 to 10, characterized in that The first proximity sensor and the second proximity sensor are of different types, or the first proximity sensor and the second proximity sensor are of the same type.

12. An electronic device, characterized in that: The electronic device comprises: at least two screens, at least two proximity sensors, a processor, a memory, and a computer program stored in the memory; the screens, the proximity sensors, and the memory are respectively coupled to the processor; one screen is correspondingly provided to one proximity sensor; The screen is used to display the interface of the electronic device; the proximity sensor is used to detect the distance between an object and the proximity sensor; when the electronic device is running, the processor executes the computer program to implement the method as described in any one of claims 1-11.

13. A computer-readable storage medium, characterized in that A computer program is stored, and when the computer program is executed by a processor of an electronic device, the method according to any one of claims 1 to 11 is implemented.

14. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Terminal and protection sleeve

    CN105744014A

  • Method for preventing inadvertent touch and electronic device

    WO2022022609A1