Interface display method and electronic device
An interface display method and an electronic device are provided. The method includes: performing screen-on interception in response to a screen wakeup operation performed by a user on an electronic device, to prevent a screen from being lit up; drawing an interface adapted to a screen orientation; and after the interface is drawn, disabling screen-on interception, and displaying the interface based on the screen orientation. The electronic device may collect and report data in real time through a sensor, and calculate a current screen orientation in real time, so that the drawn interface adapts to the current screen orientation.
1 . An interface display method, comprising:
performing a screen-on interception in response to a screen wakeup operation performed by a user on an electronic device while a screen is in an off state, wherein performing the screen-on interception comprises preventing the screen from being lit up, and the screen is not lit up when the screen is in the off state;
drawing a to-be-displayed interface adapted to a screen orientation of the electronic device while performing the screen-on interception;
disabling the screen-on interception for the screen after drawing the to-be-displayed interface; and
displaying the to-be-displayed interface based on the screen orientation after disabling the screen-on interception.
2 . The method according to claim 1 , wherein the method further comprises:
before performing the screen-on interception in response to the screen wakeup operation performed by the user on the electronic device, entering screen-off when the screen orientation of the electronic device is a first orientation, wherein entering screen-off comprises placing the screen in the off state.
3 . The method according to claim 2 , wherein entering screen-off when the screen orientation of the electronic device is the first orientation comprises:
when the screen orientation of the electronic device is the first orientation,
detecting a screen-off operation performed by the user on the electronic device, and
entering screen-off in response to the screen-off operation performed by the user on the electronic device.
4 . The method according to claim 2 , wherein the method further comprises:
when the screen orientation of the electronic device switches to a second orientation, detecting the screen wakeup operation performed by the user on the electronic device.
5 . The method according to claim 4 , wherein the first orientation is a portrait orientation, and the second orientation is a landscape orientation.
6 . The method according to claim 1 , further comprising obtaining the screen orientation of the electronic device before drawing the to-be-displayed interface that adapts to the screen orientation.
7 . The method according to claim 6 , wherein obtaining the screen orientation of the electronic device comprises:
collecting data in real time through a sensor; and
calculating the screen orientation based on the collected data.
8 . The method according to claim 7 , wherein the sensor is a gravity sensor.
9 . The method according to claim 1 , wherein performing the screen-on interception on the screen comprises:
setting, to a first brightness value, backlight brightness of a backlight panel configured to provide a light source for the screen, so that the screen is dimmed.
10 . The method according to claim 9 , wherein disabling the screen-on interception for the screen comprises:
setting the backlight brightness of the backlight panel to a second brightness value, so that the screen is lit up, wherein the second brightness value is greater than the first brightness value.
11 . The method according to claim 1 , wherein:
drawing the to-be-displayed interface is performed by a drawing service at a framework layer; and
displaying the to-be-displayed interface is performed by a display service at a kernel layer.
12 . An electronic device, comprising:
a processor; and
a non-transitory computer readable medium which contains computer-executable instructions, wherein the processor is configured to execute the computer-executable instructions to enable the electronic device to perform operations comprising:
performing a screen-on interception in response to a screen wakeup operation performed by a user on the electronic device while a screen is in an off state, wherein performing the screen-on interception comprises preventing the screen from being lit up, and the screen is not lit up when the screen is in the off state,
drawing a to-be-displayed interface adapted to a screen orientation of the electronic device while performing the screen-on interception,
disabling the screen-on interception for the screen after drawing the to-be-displayed interface, and
displaying the to-be-displayed interface based on the screen orientation after disabling the screen-on interception.
13 . The electronic device according to claim 12 , wherein the computer-executable instructions further enable the electronic device to perform operations comprising:
before performing the screen-on interception in response to the screen wakeup operation performed by the user on the electronic device, entering screen-off when the screen orientation of the electronic device is a first orientation, wherein entering screen-off comprises placing the screen in the off state.
14 . The electronic device according to claim 13 , wherein entering screen-off when the screen orientation of the electronic device is the first orientation comprises:
when the screen orientation of the electronic device is the first orientation,
detecting a screen-off operation performed by the user on the electronic device, and
entering screen-off in response to the screen-off operation performed by the user on the electronic device.
15 . The electronic device according to claim 13 , wherein the computer-executable instructions further enable the electronic device to perform operations comprising:
when the screen orientation of the electronic device switches to a second orientation, detecting the screen wakeup operation performed by the user on the electronic device.
16 . The electronic device according to claim 12 , wherein the computer-executable instructions further enable the electronic device to perform operations comprising:
obtaining the screen orientation of the electronic device before drawing the to-be-displayed interface that adapts to the screen orientation.
17 . The electronic device according to claim 16 , wherein obtaining the screen orientation of the electronic device comprises:
collecting data in real time through a sensor; and
calculating the screen orientation based on the collected data.
18 . The electronic device according to claim 17 , wherein the sensor is a gravity sensor.
19 . The electronic device according to claim 12 , wherein performing the screen-on interception on the screen comprises:
setting, to a first brightness value, backlight brightness of a backlight panel configured to provide a light source for the screen, so that the screen is dimmed.
20 . The electronic device according to claim 19 , wherein disabling the screen-on interception for the screen comprises:
setting the backlight brightness of the backlight panel to a second brightness value, so that the screen is lit up, wherein the second brightness value is greater than the first brightness value.
21 . A non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, an electronic device is enabled to perform operations comprising:
performing a screen-on interception in response to a screen wakeup operation performed by a user on the electronic device while a screen is in an off state, wherein performing the screen-on interception comprises preventing the screen from being lit up, and the screen is not lit up when the screen is in the off state;
drawing a to-be-displayed interface adapted to a screen orientation while performing the screen-on interception;
disabling the screen-on interception for the screen after drawing the to-be-displayed interface; and
displaying the to-be-displayed interface based on the screen orientation after disabling the screen-on interception.