Sensing data processing method and electronic equipment
By combining the screen display status to process the sensing data of the proximity sensor, the problem of confusion in sensing data in multi-screen mobile phones is solved, accurate control under the corresponding screen status is achieved, and user experience is improved.
Patent Information
- Application Number
- CN202410522670.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-04-28
AI Technical Summary
In multi-screen phones, when using one of the screens, the sensing data of the proximity sensor is prone to confusion, resulting in confusion in control, and it is difficult to accurately judge whether the object is close or far away, affecting the user experience.
By combining the screen display status of the electronic device, the sensing data of the corresponding proximity sensor is obtained and used, and the virtual proximity driver and data fusion module are used to report and process the sensing data of the proximity sensor to ensure that the application can accurately obtain and use the different screen display statuses. Use correct induction data.
It effectively avoids confusion of proximity sensor sensing data, ensures that corresponding preset devices (such as screens, speakers and handsets) can perform operations accurately under different screen states, and improves user experience and device control accuracy.
Smart Images

Figure CN119276975A_ABST
Abstract
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] In order to meet users' needs for smartphones in different scenarios, multi-screen phones have begun to appear on the market. Taking a dual-screen phone as an example, this type of phone can have multiple forms, such as folded state and unfolded state. In the unfolded state, the phone usually displays on the inner screen; in the folded state, the phone can display on the outer screen.
[0003] The mobile phone can be equipped with a proximity sensor to detect the distance between an object and the sensor. In some scenarios, the mobile phone can decide to turn the screen on or off based on the sensing data of the proximity sensor. For example, in the anti-false touch scenario, if an object is detected approaching the mobile phone screen, the mobile phone screen can be turned off to avoid false triggering.
[0004] In a mobile phone with multiple screens, in order to detect whether an object is approaching each screen separately, a proximity sensor needs to be set for each screen. However, when a user only uses one of the screens of the mobile phone, the sensing data of the proximity sensor is easily confused. Summary of the invention
[0005] The embodiments of the present application provide a method for processing sensing data and an electronic device, which are used to avoid confusion of sensing data of a proximity sensor when a multi-screen mobile phone uses one of the 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 correspondingly, and the second screen being provided with a second proximity sensor correspondingly. The method comprises:
[0008] When the electronic device is in the display state of the first screen, the sensing data of the first proximity sensor is obtained, and the first preset device is controlled to perform an operation according to the sensing data of the first proximity sensor. When the electronic device is in the display state of the second screen, the sensing data of the second proximity sensor is obtained, and the second preset device is controlled to perform an operation according to the sensing data of the second proximity sensor. In this way, the sensing data of the corresponding proximity sensor is obtained and used in combination with the screen display state of the electronic device, so as to avoid confusion. Among them, the first preset device includes at least one of the following: the first screen, the speaker corresponding to the first screen, and the earpiece corresponding to the first screen. The second preset device includes at least one of the following: the second screen, the speaker corresponding to the second screen, and the 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 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; the first earpiece is different from the second earpiece. 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; the first speaker and the second speaker are different.
[0012] In a possible implementation of the first aspect, the electronic device controls a corresponding preset device to perform an operation according to the sensing data of the proximity sensor, which may specifically include: when the electronic device detects that the sensing data of the proximity sensor indicates that an object is approaching or moving away from the proximity sensor, the electronic device controls the preset device corresponding to the proximity sensor to perform an operation. That is, when the sensing data of the proximity sensor indicates that the distance between the object and the proximity sensor has changed, the corresponding preset device is controlled to perform an operation.
[0013] In a possible implementation of the first aspect, when the electronic device detects that the sensing data of the proximity sensor indicates that an object is approaching the proximity sensor, the electronic device can specifically control the preset device corresponding to the proximity sensor to perform one or more of the following operations: control the screen corresponding to the proximity sensor to turn on or off, respond to touch signals, or not respond to touch signals, etc. Since the sensing data of the proximity sensor is obtained and used in combination with the screen display state of the electronic device, the electronic device can accurately control the preset device to perform operations according to the sensing data of the corresponding proximity sensor in different screen display states.
[0014] 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. The application can obtain the sensing data of the two proximity sensors reported by the driver layer in any screen display state. Then, the application obtains and combines the screen display state to determine which proximity sensor's sensing data is used 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 selects the sensing data of one of the proximity sensors according to the screen display state, and reports it to the application. That is to say, 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. The application registers the first listener for the virtual proximity driver, so 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 the switching of the screen display state, 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, so 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 a possible implementation of the first aspect, in the above method, in the display state of the first screen, the application receives the sensing data of the first proximity sensor reported by the virtual proximity sensor based on the first listener, and the sensing data of the second proximity sensor. In the display state of the second screen, the application receives the sensing data of the first proximity sensor reported by the virtual proximity sensor based on the first listener, and the sensing data of the second proximity sensor. That is to say, the virtual proximity driver will report the sensing data of the two proximity sensors to the application regardless of the screen display state. Afterwards, the application can determine which proximity sensor sensing data to control the corresponding preset device to perform an operation based on the screen display state. Specifically, the above-mentioned control of the first preset device to perform an operation based on the sensing data of the first proximity sensor includes: the application switches to use the sensing data of the first proximity sensor obtained based on the first listener in response to the electronic device switching to the display state of the first screen, and controls the first preset device to perform an operation. Correspondingly, the control of the second preset device to perform an operation based on the sensing data of the second proximity sensor includes: the application switches to use 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, and controls the second preset device to perform an operation. 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 to 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 to say, 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 of proximity sensor is higher than that of the second type of proximity sensor. In the above method, for a proximity sensor with lower power consumption, regardless of the screen display state, the virtual proximity driver can immediately register a listener for the proximity sensor of the second type when the application registers the first listener to the virtual proximity driver. For a proximity sensor with higher power consumption, the virtual proximity driver can register a listener for it when the screen corresponding to the proximity sensor of this type is switched to display. That is, the virtual proximity driver can register a listener for the proximity sensor of the first type when detecting that the electronic device switches to the display state of the target screen; wherein the target screen is the screen corresponding to the proximity sensor of the first type. If the screen corresponding to the proximity sensor with higher power consumption is not used, the virtual proximity driver will not register a listener for the proximity sensor. In this way, the work of the proximity sensor with higher power consumption can be reduced while ensuring that the application can obtain accurate sensing data, thereby reducing the power consumption of the electronic device.
[0021] In a 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 the display state of the target screen, the method further includes: the virtual proximity driver cancels the listener registered for the first type of proximity sensor in response to the electronic device switching from the display state of the target screen to the display state of other screens. This reduces the operation of the proximity sensor with higher power consumption and reduces the power consumption of the electronic device.
[0022] In a possible implementation manner 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 manner 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 according to 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 driver of the first proximity sensor and the second proximity sensor itself. 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 a possible implementation of the first aspect, the electronic device further includes an Nth screen in addition to the first screen and the second screen, and an Nth proximity sensor corresponding to the Nth screen. In this solution, the electronic device obtains sensing data of the Nth proximity sensor when the Nth screen is displayed, and controls the Nth preset device corresponding to the Nth screen to perform an operation according to the sensing data of the Nth proximity sensor. Wherein N is an integer greater than 2. That is, the above method can also be applied to electronic devices with 3 or more screens.
[0027] In a possible implementation of the first aspect, an electronic device is installed with an application, and the method includes: the application registers a fourth listener for the first proximity sensor, and registers a fifth listener for the second proximity sensor. Among them, 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 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. 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 a 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 the display state of the first screen, the application registers a fourth listener for the first proximity sensor, obtains the 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 addition, 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 the 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. That is, when the electronic device switches the screen display state, the application will also switch the proximity sensor of the registered listener. In this way, when the application uses one of the screens for display, it only registers the listener for the proximity sensor corresponding to the screen, and can only obtain the sensing data of the proximity sensor. When the electronic device switches to other screens for display, the application can also switch to other proximity sensor registered listeners. Thereby, while ensuring that the application can obtain the sensing data of multiple proximity sensors, it ensures that the sensing data of the proximity sensors obtained by the application will not be confused.
[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 the application also 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 the application also 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 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. When 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 driver type of the proximity sensor set by the operating system of the electronic device. In this way, it can be ensured that the application can obtain the sensing data of the two proximity sensors.
[0031] In the case where the operating system only allows one driving type of the proximity sensor, the driving type of the device driver corresponding to one of the proximity sensors can be defined as a preset driving type, while the driving type of the device driver corresponding to the other proximity sensor can be defined as other driving types. In this solution, the operating system and the application agree that the preset driving type and other driving types are both driving types of the proximity sensor. In this way, it is still possible to ensure that the application can obtain the sensing data of the two 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, and the driver layer includes: 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 acquires 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 acquires the sensing data of the second proximity sensor from the second device driver based on the seventh listener; then, the application acquires 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 acquire the sensing data of the two 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, and the driver layer includes: 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 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 the two proximity sensors.
[0034] In a possible implementation of the first aspect, in the above-mentioned solution where the application registers a listener for one of the proximity sensors, and the device driver corresponding to the proximity sensor registers a listener for the other proximity sensor, the device driver with which the application registers a listener can decide to report the sensing data of one of the proximity sensors to the application in combination with the screen display state. Alternatively, the application can decide to control the corresponding preset device to perform an operation based on the sensing data of one of the proximity sensors in combination with the screen display state. In this way, the sensing data used by the application can be ensured to be not confused while ensuring that the application can obtain the sensing data of the two proximity sensors.
[0035] In a possible implementation manner 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 screen is used to display an interface of the electronic device; the proximity sensor is used to detect the distance between an object and the proximity sensor. The memory is used to store computer-executable instructions, and when the electronic device is running, the processor executes the computer-executable instructions stored in the memory, so that the electronic device executes the method for processing sensing data as described in any one of the first aspects above.
[0037] In a third aspect, the present application provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer can execute the method for processing sensing data of any one of the first aspects above.
[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 any one of the sensing data processing methods of the first aspect.
[0039] In a fifth aspect, a device (for example, the device may be a chip system) is provided, the device including 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 may be composed of a chip, or may 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 folding mobile phone provided in an embodiment of the present application;
[0044] Figure 3B A schematic diagram of a dual-screen folding 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] Fig. 9 A flowchart of the steps of executing a data fusion module provided in an embodiment of the present application;
[0051] Fig.10 A timing diagram of a method for processing sensing data provided in an embodiment of the present application;
[0052] Fig.11 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0053] Fig.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 can detect distance using optical principles, known as optical proximity sensors. Proximity sensors can also detect distance using ultrasonic principles, known as ultrasonic proximity sensors.
[0055] The optical proximity sensor can detect the change in light caused by an object approaching the sensor, thereby realizing the detection of the object approaching the sensor. The proximity state detected by the optical proximity sensor indicates the intensity state 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 close to the optical proximity sensor, that is, the position of the optical proximity sensor (such as the top of the screen) is not blocked by the object. When the light detected by the optical proximity sensor is weak, it means that an object is close to the optical proximity sensor, that is, the position of the optical proximity sensor is blocked by the object. Therefore, the intensity of the light detected by the sensor changes from strong to weak, corresponding to the object at the position of the optical proximity sensor from far away to close. Correspondingly, the light detected by the sensor changes from weak to strong, corresponding to the object at the position of the optical proximity sensor from close to far away.
[0056] Ultrasonic proximity sensors measure distance by transmitting and receiving ultrasonic waves. Specifically, the ultrasonic transmitter transmits ultrasonic waves in a certain direction and starts timing at the time of transmission. When the ultrasonic wave encounters an obstacle during propagation in the air, it is immediately reflected back. The ultrasonic receiver stops timing immediately after receiving the reflected wave. Based on the time difference between the receiver and the transmitter and the known propagation speed of ultrasonic waves in the 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 indicates the time from when the ultrasonic proximity sensor emits an ultrasonic wave to when it receives an ultrasonic wave. When the time detected by the sensor is longer, it means that the distance between the object and the ultrasonic proximity sensor is farther, that is, the location of the ultrasonic proximity sensor (such as the top of the screen) is not blocked by an object. When the time detected by the sensor is shorter, it means that the distance between the object and the ultrasonic proximity sensor is closer, that is, the location of the ultrasonic proximity sensor is blocked by an object. Therefore, the time detected by the sensor changes from longer to shorter, corresponding to the object at the location of the ultrasonic proximity sensor changing from far away to close. Correspondingly, the time detected by the sensor changes from shorter to longer, corresponding to the object at the location of the ultrasonic proximity sensor changing from close to far 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-mis-touch technology is a technology used to avoid unnecessary touch operations. It aims to reduce the occurrence of accidental touches and provide a better user experience. Proximity sensor is a common anti-mis-touch detection device. Specifically, after entering the anti-mis-touch scenario, when the proximity sensor detects that an object is approaching the sensor, the screen can be controlled not to respond to the touch signal to avoid mis-touch. When it is detected that there is no object approaching the sensor, the screen can be controlled to respond normally to the touch signal.
[0060] Proximity sensors 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 light up 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 light up 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] Taking the screen-off display scenario as an example, after entering the screen-off display scenario, when the proximity sensor detects that an object is approaching the sensor, the electronic device controls the screen not to display. When the proximity sensor detects that no object is approaching the sensor, the electronic device can control the screen to display the screen-off interface; the screen-off interface can display information such as time and memo.
[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 a proximity sensor at the top of the screen. In the anti-mistouch 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 a bright state; Figure 2 As shown in a of FIG. 1 , 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 screen-off 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 FIG. 1 shows some examples of a dual-screen folding mobile phone (mobile phone 20) in an unfolded state, using a first screen 21 (inner screen). A first proximity sensor may be provided corresponding to the first screen 21, such as Figure 3A As shown in the figure, the proximity sensor 22. Figure 3A In the folded state of the mobile phone 20 shown in FIG. 2 b, 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 also has a dual screen. 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 a 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 may also be in other forms, such as an outward-folding mobile phone.
[0067] The dual-screen folding phone supports the proximity detection function in both the inner screen display state and the outer screen display state. The sensing data detected by the proximity sensor can be reported normally in the inner screen display state or the outer screen display state to ensure that the application can obtain the sensing data of multiple proximity sensors. In order to distinguish the sensing data of different sensors, the sensing data of the proximity sensor can be recorded as proximity sensing data.
[0068] When a dual-screen foldable phone is in the unfolded state or folded state, the screen that the user mainly uses is usually different. In the accidental touch prevention scenario, the screen currently in use is different, and the screen that needs to control whether to respond to the touch signal is also different accordingly. Figure 3A Take the mobile phone 20 shown as an example. In the unfolded state, the user uses the first screen 21. At this time, the mobile phone 20 should control whether the first screen 21 responds to the touch signal. Specifically, the mobile phone 20 can control whether the first screen 21 responds to the touch signal based on the sensing data of the first proximity sensor 22. In the folded state, the user uses the second screen 23. At this time, the mobile phone 20 should control whether the second screen 24 responds to the touch signal. Specifically, the mobile phone 20 can control whether the second screen 24 responds to the touch signal based on the sensing data of the second proximity sensor 24.
[0069] However, in the unfolded and folded states, both proximity sensors may be in working state. At this time, if the mobile phone obtains the sensing data of the two proximity sensors, it needs to control whether the corresponding screen responds to the touch signal according to the sensing data of one of the proximity sensors, which is prone to the problem of proximity sensing data confusion.
[0070] In the above scenarios where proximity sensing data is required, some scenarios require controlling the audio playback channel (speaker playback or receiver playback) based on the proximity sensor sensing data. Some multi-screen mobile phones only include one speaker and one receiver. In this case, in both the inner screen display state and the outer screen display state, the electronic device controls the speaker and / or receiver based on the proximity sensor sensing data.
[0071] In addition, some multi-screen mobile phones include multiple speakers and receivers; for example, the inner screen of a dual-screen folding mobile phone corresponds to speaker 1 and receiver 1, and the outer screen corresponds to speaker 2 and receiver 2. In this embodiment, when the inner screen is displayed, the electronic device controls speaker 1 and / or receiver 1 to perform operations according to 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 receiver 2 to perform operations according to 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 receiver 1 corresponding to the inner screen, that is, the proximity sensing data is confused.
[0072] Figure 4 The hardware and software 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 initiated by the application to register the listener for the proximity sensor, 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; for example, when the device driver adds a listener record of the application, when the device driver detects sensing data of the proximity sensor or detects a change in the sensing data, the sensing data can be reported to the hardware abstraction layer through the listener record, and the sensing data is transparently transmitted 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, when device driver 1 detects a change in the sensing data of proximity sensor 1, it will report 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 the sensing data changes 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] Combined with the above description, it can be known that common scenarios that require the use of proximity sensing data include call scenarios, scenarios for playing voice messages, scenarios for displaying the screen off, and scenarios for displaying by raising your hand. In these scenarios, the devices involved in which operations may need to be performed include screens, speakers, and handsets. Therefore, the electronic device controls the electronic device to perform operations based on the proximity sensing data, which may specifically refer to the electronic device controlling the preset device of the electronic device to perform operations based on the proximity sensing data; the preset device may include a screen, a speaker, and a handset. Specifically, the electronic device obtains the sensing data of the proximity sensor corresponding to the first screen in the display state of the first screen, and controls the first preset device to perform corresponding operations based on the proximity sensing data. Correspondingly, in the display state of the second screen, the electronic device obtains the sensing data of the proximity sensor corresponding to the second screen, and controls the second preset device to perform corresponding operations based on the proximity sensing data. Among them, the operation that needs to be performed by controlling the preset device can be recorded 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 handset 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 handset corresponding to the second screen.
[0076] Furthermore, the process of the above-mentioned electronic device acquiring different proximity sensing data in different screen display states can be implemented in the driver layer. That is, the screen display state is acquired 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 sensing data changes 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, no matter what screen display state the electronic device is in 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 in combination with 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 one module. For example, the data fusion module is integrated with the device driver of proximity sensor 1. Moreover, 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 not only listen to the sensing data of proximity sensor 1, but also listen to the sensing data of proximity sensor 2. If the 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 for 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 the sensing data of the two proximity sensors through the data fusion module. In this way, when an abnormality occurs in one of the proximity sensors or the device driver, the other proximity sensors can still report the sensing data to the application through the data fusion module. Thereby ensuring the normal use of other proximity sensors. In this embodiment, the data fusion module can be named 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 foldable mobile phone with dual screens shown in the figure is described as an example in which each screen of the foldable mobile phone is provided with a proximity sensor. The mobile phone includes screen 1 and screen 2, screen 1 corresponds to proximity sensor 1; screen 2 corresponds to proximity sensor 2. Screen 1 can be recorded as the first screen, screen 2 can be recorded as the second screen; proximity sensor 1 can be recorded as the first proximity sensor, and proximity sensor 2 can be recorded as the second proximity sensor.
[0082] S301. Start the application.
[0083] The application here is 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 chat application, an off-screen display application, and a hand-raising display application, etc.; 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 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 Description of the process shown. 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 state of the mobile phone may include screen 1 display state and screen 2 display state. Among them, screen 1 display state means that the mobile phone is using screen 1 for display; screen 2 display state means that the mobile phone is using screen 2 for display.
[0090] In some embodiments, the mobile phone can obtain the screen display status of the current mobile phone from the framework layer. In the embodiment of the 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 screen display status of the current 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 needed 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, the sensing data of the proximity sensor 1 is obtained.
[0092] S304b. When the mobile phone is in the screen 2 display state, the sensing data of the proximity sensor 2 is obtained.
[0093] As can be seen from the above description, when the mobile phone application obtains the sensing data, it needs to obtain it through the device driver corresponding to the proximity sensor. In the above S304a and S304b, it can specifically include: obtaining the sensing data of the proximity sensor 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) may report the change of the sensing data to the application when detecting the change of the sensing data. The change of the sensing data of the proximity sensor indicates the change of the distance between the object and the proximity sensor. Exemplarily, the change of the sensing data of the proximity sensor may specifically include: from close to far away, or from far 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, and the larger the number, the farther (or closer) the object is from the proximity sensor, etc. The change of 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 succession.
[0097] S305a. According to the sensing data of the proximity sensor 1, control the preset device 1 to perform an operation.
[0098] In combination with the above description of the scenario of using proximity sensing data, it can be known that it is usually necessary to control the corresponding device to perform an operation only when it is determined based on the proximity sensing data that the distance between the object and the sensor changes. Therefore, the above S305a may specifically include: when the sensing data of the proximity sensor 1 changes, control the preset device 1 to perform an operation. The operation that the mobile phone needs to perform by controlling the preset device 1 is usually pre-set, so it can be recorded as a preset operation.
[0099] As can be seen from the above description, the preset device may include one or more of a screen, a speaker, and an earpiece. Preset device 1 may include at least one of the following: screen 1, and a speaker and an earpiece corresponding to screen 1. Preset device 1 may be recorded as a first preset device. For example, screen 1 is the inner screen of a mobile phone, and preset device 1 may include the inner screen, and speaker 1 and earpiece 1 used when the mobile phone uses the inner screen. Correspondingly, screen 1 is the outer screen of a mobile phone, and preset device 1 may include the outer screen, and speaker 2 and earpiece 2 used when the mobile phone uses the outer screen.
[0100] Exemplarily, in scenarios such as preventing accidental touches, the preset device 1 may include a screen 1. The above S305a may specifically include: when detecting a change in the sensing data of the proximity sensor 1 from being far away to being close, the screen 1 may be controlled to perform the following preset operation: not responding to a touch signal. When detecting a change in the sensing data of the proximity sensor 1 from being close to being far away, the screen 1 may be controlled to perform the following preset operation: responding to a touch signal. Thus, the effect of preventing accidental touches is achieved.
[0101] In scenarios such as making a call or playing a voice message, the preset device 1 may include a screen 1. The above S305a may also include: when the sensing data of the proximity sensor 1 is detected to change from being far away to being close, the screen 1 may be controlled to perform the following preset operation: turning off the screen. When the sensing data of the proximity sensor 1 is detected to change from being close to being far away, the screen 1 may be controlled 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. The above S305a may include: when detecting that the sensing data of the proximity sensor 1 changes from being far away to being close, controlling the speaker 1 to stop playing, and / or controlling the earpiece 1 to start playing. When detecting that the sensing data of the proximity sensor 1 changes from being close to being far away, controlling the speaker 1 to start playing, and / or controlling the 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 receiver 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 receiver 1 to the speaker 1.
[0104] In scenarios such as screen-off display, the preset device 1 may include screen 1. The above S305a may include: when the sensing data of the proximity sensor 1 is detected to change from far away to close, the screen 1 may be controlled to perform the following preset operation: not displaying the screen-off interface. When the sensing data of the proximity sensor 1 is detected to change from close to far away, the screen 1 may be controlled to perform the following preset operation: displaying the screen-off interface.
[0105] It can be understood that the mobile phone controlling the preset devices to perform preset operations in the above-mentioned 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. According to the sensing data of the proximity sensor 2, control the preset device 2 to perform an operation.
[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 recorded 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 when using 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 some other embodiments, 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.
[0111] In other embodiments, the electronic device can use the same speaker and different receivers 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 receiver, the second screen corresponds to the second receiver; the first receiver is different from the second receiver. Alternatively, the electronic device can use different speakers and the same receiver when using the first screen and the second screen, that is, the receiver corresponding to the first screen and the receiver corresponding to the second screen are the same; the first screen corresponds to the first speaker, the second screen corresponds to the second speaker; the first speaker is different from the second speaker.
[0112] The specific implementation of the above S305b can refer to the description of S305a, which will not be repeated here.
[0113] In the method for processing sensing data provided in the embodiment of the present application, the application combines the current screen display state of the mobile phone to obtain the sensing data of the proximity sensor corresponding to the screen being used. When the mobile phone is in the screen 1 display state, the sensing data of the proximity sensor 1 corresponding to the screen 1 is obtained. When the mobile phone is in the screen 2 display state, the sensing data of the proximity sensor 2 corresponding to the screen 2 is obtained. In this way, the sensing data of 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 the sensing data and control the corresponding device to perform operations according to the sensing data.
[0114] Before using a sensor, an application installed in 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 drive type of the device driver corresponding to one proximity sensor can be defined as the above-mentioned preset drive type. The drive type of the device driver corresponding to the other proximity sensor can only be defined as other drive types, such as type_proximity_1. TMIf the device driver of the defined type_proximity type completes the registration of the listener, then only the device driver corresponding to one of the proximity sensors can complete the registration of the listener. The other type of proximity sensor cannot be registered as a listener by the application because the driver type is defined as other driver types. As a result, only the sensing data of one proximity sensor can be obtained and used by the application, while the sensing data of the other proximity sensor cannot be obtained and used normally. In this way, it is impossible to ensure that the sensing data of the proximity sensors corresponding to the two screens are reported normally.
[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 the sensing data of proximity sensor 1 when the mobile phone is in the screen 1 display state, and only needs to obtain the sensing data of proximity sensor 2 when the mobile phone is in the screen 2 display state. If the application monitors the sensing data of two proximity sensors at the same time, it is necessary to add the scene judgment of the screen display state in the application. That is, the above S303 is specifically executed by the application. Exemplarily, the application monitors the sensing data of two proximity sensors and obtains the screen display state of the current mobile phone. The application determines which proximity sensor sensing data needs to be used in combination with the screen display state of the mobile phone. Specifically, when the application determines that the current mobile phone is in the screen 1 display state, the subsequent steps are performed according to the sensing data of proximity sensor 1 obtained. When the application determines that the current mobile phone is in the screen 2 display state, the subsequent steps are performed according to the sensing data of proximity sensor 2 obtained. In this way, it can be ensured that the mobile phone can accurately control the preset device corresponding to the corresponding screen to perform operations according to the sensing data of the corresponding proximity sensor in different screen display states. So that the proximity sensing data will not be confused.
[0117] In some embodiments, after entering a scene 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. Further, in this embodiment, in response to the mobile 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 mobile 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 mobile phone to perform an operation; when the screen display state switching is detected, the application can switch to using another proximity sensing data to control the mobile phone to perform an operation. In this way, the application determines which sensing data to use to control the mobile phone to perform an operation in combination with the screen display state to avoid data confusion.
[0118] In other embodiments, the application may also register a fourth listener for the proximity sensor 1 corresponding to the 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 the 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 the screen in 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, and the proximity sensor that is not registered with the listener may not work, and does not need to report the 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 acquired 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. Thereby ensuring that the application can also obtain the sensing data of each proximity sensor.
[0120] Furthermore, in an embodiment where a data fusion module is added and its driving type is defined as type_proximity, the driving type of device driver 1 and / or device driver 2 may be defined as other driving types, such as the driving type of device driver 1 is defined as type_proximity_1, and the driving type of device driver 2 is defined as type_proximity_2. In this way, when the application registers a listener for the proximity sensor, it will not register the listener for device driver 1 and device driver 2, but only register the listener for the data fusion module whose driving type is defined as type_proximity. In this way, it can be ensured that the sensing data obtained by the application is normal, and the proximity sensing data will not be repeatedly obtained, thereby avoiding the problem of data confusion.
[0121] In the above Figure 5 In the example shown, the application only obtains the sensing data of proximity sensor 1 when the screen 1 of the mobile phone is displayed, and only obtains the sensing data of proximity sensor 2 when the screen 2 of the mobile phone is displayed. In order to ensure this execution logic, the data fusion module can be combined with the screen display state of the mobile phone to determine which proximity sensor sensing data needs to be reported to the application. Exemplarily, the data fusion module obtains the sensing data of the two proximity sensors, and when the data fusion module determines that the current mobile phone is in the screen 1 display state, only the sensing data of proximity sensor 1 is reported to the upper-layer application. When the data fusion module determines that the current mobile phone is in the screen 2 display state, only the sensing data of proximity sensor 2 is reported to the upper-layer application. In this embodiment, the above S303 is specifically executed in the data fusion module. When the mobile phone is in the screen 1 display state, the data fusion module reports the sensing data of proximity sensor 1 to the application. The above S304b specifically corresponds to: when the mobile phone is in the screen 2 display state, the virtual proximity driver reports the sensing data of proximity sensor 2 to the application. In this way, it can be ensured that the application can obtain accurate sensing data when the screen display status of different mobile phones is different, and control the preset device corresponding to the corresponding screen to perform operations. In addition, the above data fusion module judges the display status of the mobile phone screen, which can avoid the application's scene judgment of the screen display status and reduce the processing complexity of the application.
[0122] In some embodiments, the data fusion module can be integrated with the device driver corresponding to one of the proximity sensors. Taking the data fusion module and the device driver 1 corresponding to the proximity sensor 1 as an example, the drive type of the device driver 1 is defined as the preset drive type of the mobile phone system, such as type_proximity. Correspondingly, the drive type of the device driver 2 corresponding to the proximity sensor 2 is defined as other drive types, such as type_proximity_1. In this embodiment, the application registers a listener (such as the sixth listener) for the device driver 1, and the device driver 1 registers a listener (such as the seventh listener) for the device driver 2. In this way, the device driver 1 can not only monitor the sensing data of the proximity sensor 1, but also monitor the sensing data of the proximity sensor 2. The application can obtain the sensing data of the two proximity sensors from the device driver 1 through the listener. Alternatively, taking the data fusion module and the device driver 2 corresponding to the proximity sensor 1 as an example, the drive type of the device driver 2 is defined as the preset drive type of the mobile phone system, such as type_proximity. Correspondingly, the drive type of the device driver 1 corresponding to the proximity sensor 1 is defined as other drive types, such as type_proximity_1. In this embodiment, the application registers a listener (such as the eighth listener) with the device driver 2, and the device driver 1 registers a listener (such as the ninth listener) with the device driver 2. In this way, the device driver 2 can not only monitor the sensing data of the proximity sensor 2, but also monitor the sensing data of the proximity sensor 1. The application can obtain the sensing data of the two proximity sensors from the device driver 2 through the listener. In this way, it can be ensured that the application can obtain the sensing data of 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 showing that in some embodiments, the data fusion module is set independently of two device drivers. In this embodiment, the data fusion module is recorded as a virtual proximity driver. In this embodiment, the driver type of the virtual proximity driver is defined as type_proximity, the driver type of device driver 1 is defined as type_proximity_1 (which can be recorded as the second driver type), and the driver type of device driver 2 is defined as type_proximity_2 (which can be recorded as the third driver type). The application registers a listener (such as the first listener) for the virtual proximity driver, and the virtual proximity driver registers listeners (such as the second listener and the third listener) for device driver 1 and device driver 2 respectively. In this way, when device driver 1 detects the sensing data of proximity sensor 1, it will notify the virtual proximity driver; similarly, when device driver 2 detects the sensing data of proximity sensor 2, it will notify the virtual proximity driver. The virtual proximity driver combines the current screen display state of the mobile phone, fuses the two sensing data, and then reports the fused sensing data to the application. The virtual proximity driver registers a listener for device driver 1, that is, the virtual proximity driver registers a listener for 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 disposed on the intelligent sensor hub side of the driving layer.
[0125] Figure 8 FIG. 1 is a diagram of the software and hardware framework of a mobile phone. In this embodiment, the application is a call application as an example for explanation, and the data fusion module is independent of the device driver settings of the two proximity sensors (hereinafter, the data fusion module is recorded as a virtual proximity driver). When the call application is started, a registration instruction for registering the proximity sensor is sent to the sensor service. The sensor service sends the registration instruction to the subsystem framework through the proximity sensor HAL (prox HAL) in the sensor HIDL module of the hardware abstraction layer. The subsystem framework sends the registration instruction to the sensor driver through the qua lcomm messaging interface (QMI) communication module, the sensor client manager and the event distribution management module in sequence. Specifically, the event distribution management module finds the driver defined as type_proximity, that is, the above-mentioned virtual proximity driver, according to the registration instruction; then registers a listener for the virtual proximity driver for the call application. At the same time, the virtual proximity driver registers listeners for the device driver 1 corresponding to the proximity sensor 1 and the device driver 2 corresponding to the proximity sensor 2. Device driver 1 starts proximity sensor 1, and device driver 2 starts proximity sensor 2.
[0126] In the technical solution provided in the embodiment of the present application, a virtual proximity driver is added that is independent of the device driver of the two proximity sensors, and the virtual proximity driver is defined as type_proximity, so that no improvement is required for the application layer, the framework layer, and the hardware abstraction layer, and the application can accurately obtain the sensing data of the proximity sensor corresponding to the screen used in different screen display states. That is, the above method has no perception of the upper framework layer and the application layer, and does not need to adjust the logic of the listener originally used by the application to use the sensing data. It has a certain degree of decoupling and the solution is highly compatible.
[0127] As can be seen from the above description, in order to ensure that the application only obtains the sensing data of proximity sensor 1 when screen 1 is displayed, and only obtains the sensing data of proximity sensor 2 when screen 2 is displayed, the virtual proximity driver needs to determine the sensing data that needs to be reported to the application in combination with 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] In addition, in the embodiment of adding a data fusion module, the scene judgment of the screen display state can also be executed in the application. That is, a new data fusion module is added in the driver layer, and the drive type of the data fusion module is defined as a preset drive type. In this way, when the application registers a listener for the proximity sensor, the listener is only registered for the data fusion module. For the application, there is no need to change, nor is there any need to modify the definition of the drive type of the proximity sensor in the mobile phone operating system; the solution has decoupling and high compatibility. And in this embodiment, the data fusion module will report the sensing data of all proximity sensors to the application regardless of the current screen display state of the mobile phone. Afterwards, the application decides to use one of the proximity sensing data 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 of one of the proximity sensors, or can be set independently of the device driver of each proximity sensor. That is to say, in this embodiment, the above S303 is still executed by the application.
[0129] Next, the timing of the data fusion module registering a listener for the device driver of the proximity sensor 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, when the virtual proximity driver receives the registration instruction for registering a listener for the proximity sensor issued by the application, no matter whether the mobile phone is currently in the screen 1 display state or the screen 2 display state, it will simultaneously register the listeners for the two device drivers. That is, in response to the application registering the listener for the virtual proximity driver, the virtual proximity driver registers the listener for the device driver 1 and the listener for the device driver 2. Afterwards, in the screen 1 display state, the virtual proximity driver can receive the sensing data of the two proximity sensors reported by the device driver 1 and the device driver 2 respectively. However, since the application only needs to obtain the sensing data of the proximity sensor 1 in the screen 1 display state, the virtual proximity driver only reports the sensing data of the proximity sensor 1 to the application in the screen 1 display state. In the screen 2 display state, the virtual proximity driver can also receive the sensing data of the two proximity sensors reported by the device driver 1 and the device driver 2 respectively. Since the application only needs to obtain the sensing data of the proximity sensor 2 in the screen 2 display state, the virtual proximity driver only reports the sensing data of the proximity sensor 2 to the application in the screen 2 display state. Among them, 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 in response to the mobile phone switching from the display state of screen 1 to the display state of screen 2. Correspondingly, 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 in response to the mobile phone switching from the display state of screen 2 to the display state of screen 1.
[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 the listener for the proximity sensor issued by the application, the listener is registered for the device drivers corresponding to the two proximity sensors. In this way, after receiving the sensing data reported by the device driver, it can be immediately combined with the screen display state of the current mobile phone to decide whether to report the sensing data. For example, after the virtual proximity driver receives the sensing data of proximity sensor 2 reported by device driver 2, if the screen display state of the current mobile phone is obtained as screen 1 display state, the sensing data of the proximity sensor 2 is not reported. When the virtual proximity driver receives the sensing data of proximity sensor 1 reported by device driver 1, if the screen display state of the current mobile phone is obtained as screen 1 display state, the sensing data of the proximity sensor 1 is reported. Thereby, it can be ensured that the application receives the changes in the proximity sensing data as soon as possible, and responds to the screen accordingly, thereby improving the timeliness of the application's response to changes in the 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 the 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 the 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 sends a listener cancellation instruction to the device driver, and the device driver deletes the listener record of the virtual proximity driver in response to the listener cancellation instruction. After the device driver cancels the listener of the virtual proximity driver to the device driver, when the device driver detects changes in the sensing data of the proximity sensor, it will no longer report the changes in the sensing data of the proximity sensor to the virtual proximity driver.
[0135] In the technical solution proposed in the embodiment of the present application, when the mobile phone switches to a certain screen display state, the virtual proximity driver registers a listener for the device driver of the proximity sensor corresponding to the screen. When the mobile phone switches to other screen display states, the listener registered for the device driver of the proximity sensor corresponding to the screen is cancelled. In this way, when the virtual proximity driver is in the screen display state of one of the mobile phones, it will only receive the sensing data of the proximity sensor corresponding to the screen display state. Specifically, when the mobile phone is in the screen 1 display state, the virtual proximity driver only registers the device driver 1 of the proximity sensor 1. Similarly, when the mobile phone is in the screen 2 display state, the virtual proximity driver only registers the device driver 2 of the proximity sensor 2. Thus, it is also possible to realize that the virtual proximity driver only reports the sensing data of the proximity sensor 1 to the application in the screen 1 display state, and reports the sensing data of the proximity sensor 2 to the application in the screen 2 display state. In addition, since the device driver 2 does not need to report the sensing data of the proximity sensor 2 in the screen 1 display state; the device driver 1 does not need to report the sensing data of the proximity sensor 1 in the screen 2 display state, the number of reports of the device driver can be reduced, thereby reducing unnecessary power consumption of the mobile phone.
[0136] In some embodiments, after the virtual proximity driver sends a registration instruction of the listener to the device driver, the device driver responds to the registration instruction of the listener and registers the listener for the virtual proximity driver, and can also start the corresponding proximity sensor. After the virtual proximity driver sends a cancel instruction of the listener to the device driver, if no other module listens to the proximity sensor, the device driver responds to the cancel instruction of the listener to not only cancel the listener registered by the virtual proximity driver, but also turn off the corresponding proximity sensor. In this way, in the case where the virtual proximity driver does not register the listener for the device driver, the corresponding proximity sensor can be temporarily stopped. Since the virtual proximity driver does not register the listener for the device driver, the application does not need to obtain the sensing data of the proximity sensor (such as when the screen 1 is displayed, the application does not need to obtain the sensing data of the proximity sensor 2). Therefore, the temporary cessation of the proximity sensor will not affect the operation performed by the mobile phone according to 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 the proximity sensor that is 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 have different power consumption when working. In other embodiments, the above method can be used only for proximity sensors with higher power consumption. For example, the power consumption of the first type of proximity sensor m is higher than that of the 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 not 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 belongs to the proximity sensor m with higher power consumption, 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 issued by 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 issued by the application. Taking the proximity sensor 2 in the above embodiment as an example, and the optical proximity sensor belongs to the proximity sensor n with lower power consumption, after the virtual proximity driver responds to the registration instruction for registering the listener for the proximity sensor issued by 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] Further, when the application cancels the listener registered for the proximity sensor, the virtual proximity driver will cancel the listener registered for the device driver of proximity sensor 1 and / or proximity sensor 2. Exemplarily, after receiving the cancel instruction of the listener sent by the application, the virtual proximity driver cancels the listener registered for the virtual proximity driver by the application, and cancels the listener registered for the device driver of proximity sensor 1 and / or proximity sensor 2 by the virtual proximity driver.
[0141] In the above-mentioned embodiments, the implementation method of registering a listener for the device driver of the proximity sensor in combination with the screen usage status can be applied to the embodiments in which the application performs scene judgment of the screen display status and decides which proximity sensing data to use. In other embodiments, the implementation method of registering a listener for the device driver of the proximity sensor in combination with the screen usage status can also be applied to the embodiments in which the data fusion module performs scene judgment of the screen display status and decides 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 sensors, 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 the use of 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 using an ultrasonic proximity sensor for the inner screen of a dual-screen folding mobile phone and an optical proximity sensor for the outer screen. Fig. 9 The execution flow of 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 issued by the application to register a listener for the proximity sensor. In response to the registration instruction, the virtual proximity driver registers a listener for the device driver 2 of the optical proximity sensor. The virtual proximity driver determines whether it is in the inner screen display state. If it is currently in the inner screen display state, the listener is registered for the device driver 1 of the ultrasonic proximity sensor. After that, the virtual proximity driver receives the sensing data of the ultrasonic proximity sensor reported by the device driver 1, and reports the sensing data of the ultrasonic proximity sensor to the application. In addition, the virtual proximity driver will continue to determine whether to switch from the inner screen display state to the outer screen display state. After the virtual proximity driver detects the switch from the inner screen display state to the outer screen display state, the virtual proximity driver cancels the listener registered for the device driver 1 of the ultrasonic proximity sensor. After canceling the registration of the listener for the device driver 1, if the sensing data of the optical proximity sensor reported by the device driver 2 is received, the sensing data of the optical proximity sensor is reported 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 the listener for the device driver 2 of the optical proximity sensor, the virtual proximity driver may also first determine whether it is in the external screen display state. If it is determined that it is currently in the external screen display state, the virtual proximity driver performs the operation of reporting the sensing data of the optical proximity sensor to the application. If it is determined that it is not currently in the external screen display state, then determine whether it is in the internal screen display state. Alternatively, in other embodiments, the virtual proximity driver may also simultaneously determine whether it is in the internal screen display state and whether it is in the external screen display state. Afterwards, determine which proximity sensor's sensing data needs to be reported to the application based on the two judgment results.
[0147] In the technical solution provided in the embodiment of the present application, after the virtual proximity driver registers the listener for the proximity sensor in the application, the virtual proximity driver registers the listener for the device driver 2 of the optical proximity sensor. If it is detected that the mobile phone switches to the inner screen display state, the virtual proximity driver will also register the listener for the device driver 1 of the ultrasonic proximity sensor. Moreover, during the inner screen display state, the virtual proximity driver only reports the sensing data of the ultrasonic proximity sensor to the application, and does not report the sensing data of the optical proximity sensor to the application. If it is detected that the mobile phone switches from the inner screen display state to the outer screen display state later, the virtual proximity driver will cancel the listener registered for the device driver 1 of the ultrasonic proximity sensor of the inner screen. And during the outer screen display state, the virtual proximity driver only reports the sensing data of the optical proximity sensor to the application. In this way, it can be ensured that the virtual proximity driver only reports the sensing data of the optical proximity sensor corresponding to the outer screen to the application in the outer screen display state, and only reports the sensing data of the ultrasonic proximity sensor corresponding to the inner screen to the application in the inner screen display state.
[0148] Fig.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 the device driver 1, and the outer screen of the mobile phone corresponds to the optical proximity sensor and the device driver 2 as an example for explanation.
[0149] S0. The application sends a registration instruction to the sensor service to register a proximity sensor listener.
[0150] From 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 command 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 responds to the registration instruction and registers a listener for the application to the virtual proximity driver. It is understandable 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 of the application. Afterwards, the virtual proximity driver needs to report corresponding sensing data to the application according to 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 query request for the screen display state to the screen display decision module. In response to the query request, the screen display decision module may send the screen display state to the virtual proximity driver. Afterwards, the virtual proximity driver may determine that the screen display state has switched based on the current and previous screen display states. Among them, the virtual proximity driver may send a query request for the screen display state 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 of the ultrasonic proximity sensor.
[0165] S8. Device driver 1 reports ultrasonic sensing data to the virtual proximity driver.
[0166] During the external screen display state, the virtual proximity driver can still receive the screen display state message sent by the screen display decision module. Therefore, it is possible that the screen display state has changed after the virtual proximity driver receives the sensing data from the ultrasonic proximity sensor. Therefore, before reporting this sensing data to the upper layer application, the virtual proximity driver can also determine whether it is currently in the external screen display state, that is, 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-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 a 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. The 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 the 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, then 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, execute S20-S22.
[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 a process in which the application cancels the listener registered for the proximity sensor.
[0190] S23. The application sends a cancel instruction for the listener of the proximity sensor 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 making or receiving a call, playing a voice message, turning off the screen, 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 drive 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 the device driver 1 and / or the device driver 2.
[0198] In some embodiments, the mobile phone may execute S26 first and then execute S27. In other embodiments, the mobile phone may execute S27 first and then execute S26. Alternatively, the mobile phone may execute S26 and S27 simultaneously. In the embodiments of the present application, the execution order of S26 and S27 is not limited.
[0199] It can be understood that the above S23-S27 can be executed at any time after S3. S23-S27 occurs after S4 and before S6, or S23-S27 occurs after S15, and the virtual proximity driver only cancels the listener registered for device driver 2. S23-S27 occurs after S6 and before S15, and 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 by taking 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 including three or more screens. Among them, each screen is correspondingly provided with a proximity sensor.
[0201] like Fig.11 The figure shows 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 screen 893, and a subscriber identification module (SIM) card interface 894. Among them, the sensor module 880 may include a pressure sensor 880A, a touch sensor 880B, and a proximity sensor 880C.
[0202] It is to be understood that the structure illustrated in the embodiment 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 in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0203] The processor 810 may include one or more processing units, for example, the processor 810 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. For example, the processor 810 is used to execute the processing method of the sensing data in the embodiment 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] The processor 810 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 810 is a cache memory. The memory may store instructions or data that the processor 810 has just used or cyclically used. If the processor 810 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 810, and thus improves the efficiency of the system.
[0206] The USB interface 830 is an interface that complies with USB standard specifications, and may specifically 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 transmit data between the electronic device 800 and a peripheral device.
[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 through the external memory interface 820 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.
[0208] The internal memory 821 can be used to store computer executable program codes, and the executable program codes include 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 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.).
[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 used 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 through 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 supplies power to the processor 810, the internal memory 821, the external memory, the display screen 893, the camera 892, and the wireless communication module 860.
[0212] In some other embodiments, the power management module 841 may also be disposed in the processor 810. In some other embodiments, the power management module 841 and the charging management module 840 may also be disposed 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, a modem processor and a 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 the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0215] The mobile communication module 850 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to 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), etc. The mobile communication module 850 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 850 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.
[0216] The wireless communication module 860 can provide wireless communication solutions including wireless local area networks (WLAN) (such as Wi-Fi), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are 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, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 810. The wireless communication module 860 can also receive the signal to be sent from the processor 810, modulate the frequency of 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 playing 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 signals for output, 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 a receiver 870B.
[0220] The speaker 870A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or conduct a video conference through the speaker 870A. The electronic device can include 1 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 the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 880A can be set 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 parallel plate including at least two conductive materials. 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 acts on 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] The touch sensor 880B is also called a "touch panel". The touch sensor 880B can be arranged on the display screen 893, and the touch sensor 880B and the display screen 893 form a touch screen, also called a "touch screen". The touch sensor 880B is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 893. In other embodiments, the touch sensor 880B can also be arranged on the surface of the electronic device 800, which is different from the position of the display screen 893.
[0224] The proximity sensor 880C is used to detect the distance between the 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] The key 890 includes a power key, a volume key, etc. The key 890 may be a mechanical key or a touch key. The electronic device 800 may receive key input and generate key signal input related to user settings and function control of the 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] The electronic device 800 implements the display function through a GPU, a display screen 893, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 893 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 810 may include one or more GPUs, which execute program instructions to generate or change 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] The SIM card interface 894 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device 800 by inserting the SIM card interface 894 or removing the SIM card interface 894. The electronic device 800 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
[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 executed by the mobile phone in the above method embodiment. The structure of the electronic device can refer to Fig.11The structure of the electronic device 800 is shown.
[0233] The present application also provides a chip system, such as Fig.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 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 each function or step 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. The computer may be an electronic device, such as a mobile phone.
[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 the present 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 only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, 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] The units described as separate components may or may not be physically separated, and the 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 different 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, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of 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, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0241] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope 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 comprising a first screen and a second screen, the first screen being provided with a first proximity sensor correspondingly, and the second screen being provided with a second proximity sensor correspondingly; the method comprising: When the electronic device is in a display state of the first screen, sensing data of the first proximity sensor is acquired, and a first preset device is controlled to perform an operation according to the sensing data of the first proximity sensor; the first preset device includes at least one of the following: the first screen, a speaker corresponding to the first screen, and a receiver corresponding to the first screen; When the electronic device is in a display state of the second screen, sensing data of the second proximity sensor is acquired, and a second preset device is controlled to perform an operation according to the sensing data of 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 a handset 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; 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 comprises any of the following: The first item, The application acquires the 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 the display state of the first screen; The application acquires 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 the virtual proximity driver reports the sensing data of the second proximity sensor to the application based on the first listener; The second item, When the first screen is displayed, the application receives the sensing data of the first proximity sensor reported by the first listener and the sensing data of the second proximity sensor by the virtual proximity sensor; when the second screen is displayed, the application receives the sensing data of the first proximity sensor reported by the first listener and the sensing data of the second proximity sensor by the virtual proximity sensor; The controlling the first preset device to perform an operation according to the sensing data of the first proximity sensor comprises: 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 acquired based on the first listener; The controlling the second preset device to perform an operation according to 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 proximity sensor of the first type is higher than the power consumption of the proximity sensor of the second type; 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 a target screen, the method further includes: The virtual proximity driver cancels the listener registered for 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 is installed with an application, 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 acquired by 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 acquired by 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 the electronic device includes a driver layer, and 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; the method includes any one of the following: The first item, The method further includes: the application registering a sixth listener for the first proximity sensor; the first device driver registering a seventh listener for the second proximity sensor in response to the application registering the sixth listener for the first proximity sensor; The acquiring 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 comprises: the first device driver acquiring the sensing data of the second proximity sensor from the second device driver based on the seventh listener; 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: the application registering an eighth listener for the second proximity sensor; the second device driver registering a ninth listener for the first proximity sensor in response to the application registering the eighth listener for the second proximity sensor; The acquiring the sensing data of the second proximity sensor comprises: the application acquiring the sensing data of the second proximity sensor based on the eighth listener; The acquiring the sensing data of the first proximity sensor includes: the second device driver acquiring the sensing data of the first proximity sensor from the first device driver based on the ninth listener; and the application acquiring 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 arranged with 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 method comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
Terminal and protection sleeve
CN105744014A
Mobile terminal and control method thereof
CN108390972A
Electronic equipment, screen control method, control device and storage medium
CN111103965A
Application interface display method, electronic equipment and storage medium
CN116048436A
System and Method for Display Power Management for Dual Screen Display Device
US20150116364A1