Method, apparatus, and program product for controlling screen display state
By receiving the start command from the control tool during the testing of electronic devices, the device screen is turned off, which solves the problem of battery swelling caused by prolonged screen keeping, and achieves extended battery life and power saving.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- DOUYIN VISION CO LTD
- Filing Date
- 2021-12-10
- Publication Date
- 2026-07-03
AI Technical Summary
In the prior art, electronic devices used for program testing tend to consume power when the screen is on for extended periods, leading to overheating and lithium battery ion crystallization that can puncture the thin film, causing battery bulging and shortening the device's lifespan.
By receiving test commands and control tool activation commands, parameters are used to control electronic devices to be in a screen-off state, avoiding prolonged screen-on time, thereby reducing battery consumption and heat generation.
Without affecting the target program testing process, reduce the probability of battery swelling in electronic devices, extend battery life, and save power.
Smart Images

Figure CN116257197B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of electronic device control, and more particularly to a method, device, and program product for controlling the state of a screen display. Background Technology
[0002] Currently, in order to test programs more accurately, physical machines are usually used for testing. For example, physical machines can be controlled through the cloud to test programs using physical machines.
[0003] Typically, a large number of physical machines are used for testing. Therefore, these machines can be centrally deployed in a server rack for centralized management. The cloud provides uninterrupted remote debugging and automated testing services, requiring the physical machines to be constantly operational.
[0004] When providing remote debugging and automated testing services from the cloud, each test can last up to ten hours, requiring the physical device to run continuously for ten hours. During this process, the physical device needs to keep its screen on, which consumes power and causes it to overheat. Prolonged charging and discharging of the battery can also lead to ion crystallization in the lithium battery, eventually puncturing the battery's membrane and causing it to bulge. Summary of the Invention
[0005] This disclosure provides a method, device, and program product for controlling the screen display status, in order to solve the problem of battery swelling in electronic devices used for testing programs in the prior art.
[0006] In a first aspect, embodiments of this disclosure provide a method for controlling the state of a screen display, applied to an electronic device, wherein the electronic device is equipped with a control tool; the method includes:
[0007] Receive test instructions and run the target program according to the test instructions;
[0008] When testing the target program, a startup command from the control tool is also received, the startup command including parameters for controlling the screen display state;
[0009] The electronic device is controlled to be in a screen-off state according to the parameters. Secondly, embodiments of this disclosure provide a screen display state control device applied to an electronic device, wherein the electronic device is equipped with a control tool; the device includes:
[0010] The receiving unit is used to receive test commands;
[0011] The execution unit is used to run the target program according to the test instructions;
[0012] The receiving unit is also used to receive the start command of the control tool when testing the target program;
[0013] The control unit is used to control the electronic device to be in a screen-off state according to the parameters.
[0014] Thirdly, embodiments of this disclosure provide an electronic device, including: at least one processor and a memory;
[0015] The memory stores computer-executed instructions;
[0016] The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the screen display state control method as described in the first aspect and various possible designs of the first aspect.
[0017] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the screen display state control method described in the first aspect and various possible designs of the first aspect.
[0018] Fifthly, embodiments of this disclosure provide a computer program product, including a computer program that, when executed by a processor, implements the screen display state control method described in the first aspect and various possible designs of the first aspect.
[0019] The screen display state control method, device, and program product provided in this embodiment are applied to electronic devices, which are equipped with control tools. The method includes: receiving a test command; testing a target program according to the test command; and receiving a start command from the control tool while testing the target program, the start command including parameters for controlling the screen display state; and controlling the electronic device to be in a screen-off state according to the parameters. In the solution provided in this disclosure, the electronic device can control itself to be in a screen-off state according to the parameters used to control the screen display state. Controlling the screen-off state through these parameters does not affect the normal operation of the target program, and therefore does not affect the testing process of the target program. This implementation allows the electronic device to test the target program in a black-screen state, thereby reducing the probability of battery swelling in the electronic device. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 The machine shown is an exemplary embodiment of this disclosure;
[0022] Figure 2 This is a flowchart illustrating a screen display state control method as an exemplary embodiment of the present disclosure;
[0023] Figure 3 This is a flowchart illustrating a method for controlling the screen display state, as shown in another exemplary embodiment of this disclosure.
[0024] Figure 4 This is a flowchart illustrating a method for controlling the screen display state, which is yet another exemplary embodiment of the present disclosure.
[0025] Figure 5 This is a flowchart illustrating a screen display state control method as an exemplary embodiment of the present disclosure;
[0026] Figure 6 A schematic diagram of the structure of a control device for screen display status, illustrating an exemplary embodiment of the present disclosure;
[0027] Figure 7 A schematic diagram of the structure of a control device for screen display state, illustrating another exemplary embodiment of the present disclosure;
[0028] Figure 8 This is a schematic diagram of the structure of an electronic device shown in an exemplary embodiment of the present disclosure. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0030] Figure 1 The cabinet 11 shown in this exemplary embodiment of the present disclosure contains multiple devices 12, such as mobile phones. Each mobile phone can be controlled via the cloud to test programs.
[0031] When testing cloud-controlled devices, each device needs to be constantly operational, requiring its screen to remain on. Prolonged screen illumination consumes power, causes overheating, and prolonged charging and discharging can lead to ion crystallization in the lithium battery, eventually puncturing the battery membrane and causing bulging. This reduces battery life and shortens the overall lifespan of the electronic equipment used for testing.
[0032] In this process, turning off the screen on a terminal device is triggered by either a screen timeout or by pressing the power button while the screen is on. This process simultaneously turns off the screen and initiates the activity's pause process, causing the application running on the terminal device to terminate. However, when testing an application, it must be running; therefore, the device screen needs to be kept on.
[0033] To address the aforementioned technical issues, the solution provided in this disclosure acquires parameters during the testing of the target program on the electronic device, thereby enabling the electronic device to control the screen to turn off based on these parameters, thus reducing battery consumption of the electronic device.
[0034] Figure 2 This is a flowchart illustrating a method for controlling the screen display state, as shown in an exemplary embodiment of the present disclosure.
[0035] The screen display status control method disclosed herein is applied to an electronic device equipped with a control tool. This control tool can be pre-installed in the electronic device, allowing the screen to be turned off.
[0036] like Figure 2 As shown, the screen display state control method provided in this disclosure includes:
[0037] Step 201: Receive the test instruction and run the target program according to the test instruction.
[0038] The solution provided in this disclosure can be executed by an electronic device with computing capabilities, which is used to test the program. For example, instructions can be sent to the electronic device via the cloud, thereby enabling the device to test the target program. The electronic device could be, for example, a smartphone.
[0039] Specifically, test commands can be sent to electronic devices via the cloud, enabling the electronic devices to run the target programs installed on them according to the test commands.
[0040] Furthermore, electronic devices can be controlled via the cloud to download and install target programs. For example, an installation command can be sent to the electronic device via the cloud, which may include the identifier of the target program to be installed, or the installation package of the target program.
[0041] In practical applications, the cloud can also send test commands to electronic devices. These commands can include the identifier of the target program to be tested. Upon receiving the test command, the electronic device can run the target program accordingly. For example, the electronic device can parse the program identifier included in the test command and then run the target program corresponding to that identifier.
[0042] Step 202: When testing the target program, a startup command from the control tool is also received, which includes parameters for controlling the screen display state.
[0043] When an electronic device runs a target program, the cloud can also send a startup command to the electronic device, which is used to activate the control tools set in the electronic device.
[0044] In one alternative implementation, after the cloud sends a test command to the electronic device, the electronic device can run the target program based on the test command, and after running the target program, it can send feedback to the cloud that the target program has been run. The cloud then sends a start command to the electronic device, thereby starting the control tool in the electronic device.
[0045] Specifically, the startup command includes parameters for controlling the screen display state, and the electronic device can obtain these parameters from the startup command.
[0046] For example, the startup command could be:
[0047] adb shell CLASSPATH= / data / local / tmp / bytest-tool.apk exec app_process / data / local / tmp com.bytest.tools.Tools background.
[0048] The parameter used to control the screen display state is "background". After receiving this start command, the electronic device can run the control tool "Tools". In this implementation, the "background" parameter can be sent to the electronic device via cloud-based parameter download.
[0049] In another implementation, parameters for controlling the screen display state of the electronic device can be preset in the electronic device. These parameters can be acquired when the electronic device performs program testing. For example, after receiving a test command, the electronic device can run the target program. Subsequently, it can acquire the preset parameters for controlling the screen display state and control the screen state according to these preset parameters. The preset parameter could be, for example, the background.
[0050] In practical applications, to turn off the screen of an electronic device, you need to press the power button on the screen, or the electronic device's system will execute the screen-off action after the screen has been on for a timeout.
[0051] The power button is a physical button. When this button is pressed, an event is written to / dev / input / Eventx. The Android system retrieves the message from EventHub at the hardware Linux level for processing. After layers of calls, it finally reaches the interceptKeyBeforeQueueing() function of PhoneWindowManager to perform specific business processing. In the end, it calls the updatePowerStateLocked() method in phoneWindowManager.java.
[0052] When the `updatePowerStateLocked()` method in `phoneWindowManager.java` is called, message processing follows, which simultaneously turns off the device screen and initiates the activity's pause process. Ultimately, all calls will reach the most important one:
[0053] SurfaceControl.setDisplayPowerMode(token,mode);
[0054] This triggers the screen of an electronic device to turn off.
[0055] Based on this, it can be determined that the final call to the `SurfaceControl.setDisplayPowerModer` method sets the Surface model of the electronic device to `POWER_MODE_OFF`, which turns off the screen and puts the electronic device in a screen-off state. Therefore, the solution provided in this disclosure can directly call this method and set the Surface model to `POWER_MODE_OFF`. Thus, without initiating the pause process of the activity, the target program on the electronic device will not be triggered to stop running. Therefore, the screen of the electronic device can be turned off while the target program is still running normally.
[0056] Based on this, in the solution provided in this disclosure, the parameter used to control the screen display state of the electronic device can instruct the electronic device to set the Surface model to POWER_MODE_OFF.
[0057] Step 203: Control the electronic device to be in a screen-off state according to the parameters.
[0058] When testing a target program, the electronic device can set the Surface model to POWER_MODE_OFF according to the parameters, thereby enabling the electronic device to control the screen to turn off without stopping the target program.
[0059] Specifically, by setting the Surface model to POWER_MODE_OFF, electronic devices can call SurfaceControl.setDisplayPowerMode(0), thereby controlling the hardware to stop rasterizing the screen surface and keep the screen in a black state. At the same time, the target program currently running on the electronic device is still in the foreground, so the test can continue to be carried out under the black screen, which can save power, extend battery life, and reduce the probability of battery swelling in electronic devices.
[0060] The screen display state control method disclosed herein is applied to an electronic device, which is equipped with a control tool. The method includes: receiving a test command; testing a target program according to the test command; and, while testing the target program, also receiving a start command from the control tool, the start command including parameters for controlling the screen display state; and controlling the electronic device to be in a screen-off state according to the parameters. In this control method, the electronic device can be controlled to be in a screen-off state according to the parameters used to control the screen display state. Controlling the screen-off state through these parameters does not affect the normal operation of the target program, and therefore does not affect the testing process of the target program. This implementation allows the electronic device to test the target program in a black-screen state, thereby reducing the probability of battery swelling in the electronic device.
[0061] Figure 3 This is a flowchart illustrating a method for controlling the screen display state, as shown in another exemplary embodiment of this disclosure.
[0062] like Figure 3 As shown, the screen display state control method provided in this disclosure includes:
[0063] Step 301: Receive test instructions and run the target program according to the test instructions.
[0064] The implementation of step 301 is similar to that of step 201, and will not be described again.
[0065] Step 302: When testing the target program, a start command from the control tool is also received, which includes parameters for controlling the screen display state.
[0066] This involves sending parameters from the cloud to the electronic device via command line to control the screen display status. For example, tools can be set within the electronic device to control the screen's on / off state based on these parameters; for instance, the electronic device can set the Surface model to POWER_MODE_OFF based on these parameters.
[0067] Specifically, this parameter could be, for example, "background," and the command line could be, for example, "CLASSPATH= / data / local / tmp / bytest-tool.apk exec app_process / data / local / tmpcom.bytest.tools.Tools background." The cloud can send this command line to the electronic device, thereby enabling the electronic device to obtain the parameter "background."
[0068] Step 303: Determine the mode variable based on the parameters. The mode variable is used to characterize the mode of the screen of the electronic device.
[0069] Furthermore, the electronic device can determine a mode variable based on the acquired parameters used to control the screen display state of the electronic device. This mode variable is used to characterize the screen mode of the electronic device.
[0070] In one alternative implementation, mode variables can be set in a control tool, and the electronic device can determine the mode variables corresponding to the parameters based on the content in the control tool.
[0071] In practical applications, the parameters are used to control the screen from turning off. Based on the parameters, the mode variables are determined, including: based on the parameters used to control the screen from turning off, the mode variables are determined to be variables used to characterize the background operation of the target program.
[0072] For example, when the parameter used to control screen off is background, the electronic device can determine that the corresponding mode variable is POWER_MODE_OFF.
[0073] Optionally, the mode variable corresponding to the parameter can be determined based on the following code block: when the parameter is background, the mode variable is POWER_MODE_OFF; when the parameter is frontground, the mode variable is POWER_MODE_NORMAL.
[0074] private final String RUNBACKGROUND="background";
[0075] private final String FRONTGROUND="frontground";
[0076] case RUNBACKGROUND:
[0077] setScreenMode(Device.POWER_MODE_OFF); / / When the object is RUNBACKGROUND, set the mode variable to POWER_MODE_OFF.
[0078] break;
[0079] case FRONTGROUND:
[0080] The `setScreenMode(Device.POWER_MODE_NORMAL)` method sets the mode variable to `POWER_MODE_NORMAL` when the object is `FRONTGROUND`.
[0081] break.
[0082] Step 304: Reflect the method for setting the screen state in the native system of the electronic device, and use the method obtained by reflection to process the mode variable in order to control the electronic device to be in a screen-off state.
[0083] Furthermore, during runtime, for any given class, all its attributes and methods can be known, and for any given object, any of its methods can be invoked. This ability to dynamically obtain information and dynamically invoke object methods is called the reflection mechanism in the Java language.
[0084] In practical applications, after the electronic device determines the mode variable, it can reflect the methods for setting the screen state in the native system of the electronic device. Specifically, the following code block can be used to reflect the methods for setting the screen state in the native system:
[0085] private static Method getSetDisplayPowerModeMethod()throws
[0086] NoSuchMethodException{
[0087] if(setDisplayPowerModeMethod==null){
[0088] setDisplayPowerModeMethod=CLASS.getMethod("setDisplayPowerMode",
[0089] IBinder.class, int.class); / / Reflects the method named "setDisplayPowerMode".
[0090] }
[0091] return setDisplayPowerModeMethod;
[0092] }
[0093] Specifically, the electronic device can call the method obtained through reflection and use the mode variable as the input variable of the reflection method, thereby controlling the electronic device to be in a screen-off state.
[0094] Specifically, you can initialize a setting instance of the reflection setting method, which is used to reflect the methods for setting the screen state in the native system of the electronic device. This can be considered as getSetDisplayPowerModeMethod() in the code block above.
[0095] Furthermore, you can initialize a setting instance of getSetDisplayPowerModeMethod(), and then call the reflection setting method based on the initialized setting instance and mode variable to control the electronic device to be in a screen-off state.
[0096] Specifically, the setup instance can be started based on the mode variable, and then the reflection setup method can be called. When the reflection setup method is run, the mode variable can be used as a variable to call the native system's method for setting the screen state. Then, the mode variable can be processed through this method to control the electronic device to be in a screen-off state.
[0097] In practical applications, the pattern variables can be processed using methods obtained through reflection based on the following code block:
[0098] Method method = getSetDisplayPowerModeMethod(); / / Initialize instance method
[0099] method.invoke(null, displayToken, mode); / / Invoke the instance method
[0100] Here, mode is a pattern variable.
[0101] Figure 4 This is a flowchart illustrating a method for controlling the screen display state, which is another exemplary embodiment of this disclosure.
[0102] like Figure 4 As shown, the screen display state control method provided in this disclosure includes:
[0103] Step 401: Receive test instructions and run the target program according to the test instructions.
[0104] Step 402: When testing the target program, a startup command from the control tool is also received, which includes parameters for controlling the screen display state.
[0105] The implementation methods of steps 401 and 402 are similar to those of steps 201 and 202, and will not be described again.
[0106] Step 403: Obtain cross-process communication parameters.
[0107] Among them, in the method provided by the present disclosure, after the electronic device obtains the parameters for controlling the screen display state of the electronic device, it can also obtain the inter-process communication parameters, so that it can combine the inter-process communication parameters and the parameters for controlling the screen display state of the electronic device to control the electronic device to be in the screen-off state.
[0108] Specifically, the electronic device can obtain the inter-process communication parameters through the reflection acquisition method, where the reflection acquisition method is used to reflect the method for obtaining the inter-process communication parameters in the native system of the electronic device.
[0109] Furthermore, the native system of the electronic device includes a method for obtaining the inter-process communication parameters. The electronic device can use this method through reflection to obtain the inter-process communication parameters.
[0110] In practical applications, the inter-process communication parameters can be obtained through the following code:
[0111] public static IBinder getBuiltInDisplay(){
[0112] try{
[0113] Method method=getGetBuiltInDisplayMethod(); / / Initialize the instance method
[0114] if(Build.VERSION.SDK_INT < Build.VERSION_CODES.Q){
[0115] return(IBinder)method.invoke(null,0); / / When Build.VERSION.SDK_INT < Build.VERSION_CODES.Q, start the instance method according to null and 0
[0116] }
[0117] return(IBinder)method.invoke(null); / / Otherwise, start the instance method according to null
[0118] }catch(InvocationTargetException|IllegalAccessException|
[0119] NoSuchMethodException e){
[0120] Ln.e("Could not invoke method",e);
[0121] return null;
[0122] }
[0123] }
[0124] This involves initializing an instance of the reflection-based method, then starting that instance, and finally executing the reflection-based method.
[0125] Specifically, an electronic device can initialize a method instance (method) for a reflection-based method and initiate the method instance (method.invoke(null)) to call the reflection-based method.
[0126] Furthermore, the results returned by reflection methods can be converted into preset types to obtain cross-process communication parameters. For example, the results obtained from starting an instance can be converted into the IBinder type to obtain cross-process communication parameters.
[0127] Step 404: Based on the cross-process communication parameters and the parameters used to control the screen display status of the electronic device, control the electronic device to be in a screen-off state.
[0128] In practical applications, electronic devices can control the screen-off state based on the obtained cross-process communication parameters and the parameters used to control the screen display state of the electronic device.
[0129] Specifically, the electronic device can determine the mode variable based on the parameters. The mode variable is used to characterize the mode of the screen of the electronic device.
[0130] Subsequently, the electronic device can also reflect the methods for setting the screen state in the native system of the electronic device, and initialize the setting instance of the reflection setting method. The reflection setting method is used to reflect the methods for setting the screen state in the native system of the electronic device. Based on the initialized setting instance, mode variables, and inter-process communication parameters, the reflection setting method is called to control the electronic device to be in a screen-off state.
[0131] Specifically, when starting and setting up the instance, cross-process communication parameters and mode variables can be passed as input parameters to the instance runtime. For example, this can be achieved using the following code, where `displayToken` is the cross-process communication parameter and `mode` is the mode variable:
[0132] public static boolean setDisplayPowerMode(IBinder displayToken,intmode)
[0133] {
[0134] try{
[0135] Method method = getSetDisplayPowerModeMethod(); / / Initialize the method instance method.invoke(null, displayToken, mode); / / Launch the method instance based on displayToken and mode.
[0136] return true;
[0137] }catch(InvocationTargetException|IllegalAccessException|
[0138] NoSuchMethodException e){
[0139] Ln.e("Could not invoke method",e);
[0140] return false;
[0141] }
[0142] }
[0143] In one optional implementation, an entry method can be set. When the electronic device receives a startup command, it can determine the corresponding mode variable based on the parameters in the startup command, and then call the entry method. The entry method then calls the reflection acquisition method and the reflection setting method respectively, and finally, based on the determined mode variable and the acquired cross-process communication parameters, controls the electronic device to enter a screen-off state.
[0144] Figure 5 This is a flowchart illustrating a method for controlling the screen display state, as shown in an exemplary embodiment of the present disclosure.
[0145] like Figure 5 As shown, the cloud 51 can send command lines to the electronic device 52, thereby triggering the control methods for the electronic device's screen display status. For example, the cloud can send the command "adb?shell?CLASSPATH= / data / local / tmp / bytest-tool.apk?exec?app_process?" to the electronic device.
[0146] / data / local / tmp?com.bytest.tools.Tools?background".
[0147] Subsequently, the electronic device 52 can determine the mode variable `mode` based on the `background` parameter included in the command line, and can also obtain the cross-process communication parameter `displayToken`. The electronic device can also initialize and start a settings instance method. When starting the settings instance method, `mode` and `displayToken` can be used as input parameters. In turn, `mode` and `displayToken` can be used as input parameters for methods that set the screen state in the native system, thereby controlling the electronic device to be in a screen-off state.
[0148] Figure 6 This is a schematic diagram of the structure of a control device for screen display status, illustrating an exemplary embodiment of the present disclosure.
[0149] like Figure 6 As shown, the screen display status control device 600 provided in this disclosure is applied to an electronic device, which is equipped with a control tool; the device 600 includes:
[0150] The receiving unit 610 is used to receive test commands;
[0151] The execution unit 620 is used to run the target program according to the test instructions;
[0152] The receiving unit 610 is also used to receive the start command of the control tool when testing the target program;
[0153] The control unit 630 is used to control the electronic device to be in a screen-off state according to the parameters.
[0154] The screen display status control device and the disclosed control device Figure 2 The embodiments shown are similar and will not be described again.
[0155] Figure 7 This is a schematic diagram of the structure of a control device for screen display status, illustrating another exemplary embodiment of the present disclosure.
[0156] like Figure 7 As shown, in one optional embodiment of the screen display status control device 700 provided in this disclosure, the control unit 630 includes:
[0157] The mode determination module 631 is used to determine a mode variable based on the parameters, wherein the mode variable is used to characterize the mode of the screen of the electronic device;
[0158] The control module 632 is used to reflect the method of setting the screen state in the native system of the electronic device, and to process the mode variable using the method obtained by reflection, so as to control the electronic device to be in a screen-off state.
[0159] In one optional implementation, the control module 632 is specifically used for:
[0160] An example of initializing the reflection setting method, wherein the reflection setting method is used to reflect the method of setting the screen state in the native system of the electronic device;
[0161] Based on the initialized setting instance and the mode variable, the reflection setting method is invoked to control the electronic device to be in a screen-off state.
[0162] In one optional implementation, the parameters are parameters used to control the screen to turn off, and the mode determination module 631 is specifically used for:
[0163] Based on the parameters used to control screen off, the mode variable is determined to be a variable used to characterize the background operation of the target program.
[0164] In an optional embodiment, the device further includes a communication parameter acquisition unit 640 for acquiring cross-process communication parameters;
[0165] Accordingly, the control unit 630 is specifically used for:
[0166] Based on the inter-process communication parameters and the parameters used to control the screen display state of the electronic device, the electronic device is controlled to be in a screen-off state.
[0167] In one optional implementation, the communication parameter acquisition unit 640 is specifically used for:
[0168] Cross-process communication parameters are obtained by reflection, wherein the reflection method is used to reflect the method of obtaining cross-process communication parameters in the native system of the electronic device.
[0169] In one optional implementation, the communication parameter acquisition unit 640 includes:
[0170] The reflection acquisition module 641 is used to initialize the acquisition instance of the reflection acquisition method and start the acquisition instance to call the reflection acquisition method;
[0171] The conversion module 642 is used to convert the result returned by the reflection acquisition method into a preset type to obtain the cross-process communication parameters.
[0172] The screen display status control device and the disclosed control device Figure 3 , Figure 4 The embodiments shown are similar and will not be described again.
[0173] The device provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.
[0174] refer to Figure 8 The diagram illustrates a structural schematic of an electronic device 800 suitable for implementing embodiments of the present disclosure. The electronic device 800 can be a terminal device or a server. The terminal device can include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, personal digital assistants (PDAs), portable Android devices (PADs), portable media players (PMPs), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 8 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0175] like Figure 8 As shown, the electronic device 800 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 into a random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the electronic device 800. The processing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0176] Typically, the following devices can be connected to I / O interface 805: input devices 806 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 807 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 808 including, for example, magnetic tapes, hard disks, etc.; and communication devices 809. Communication device 809 allows electronic device 800 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 8 An electronic device 800 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0177] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 809, or installed from a storage device 808, or installed from a ROM 802. When the computer program is executed by a processing device 801, it performs the functions defined in the methods of embodiments of this disclosure.
[0178] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0179] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0180] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.
[0181] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0182] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0183] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a unit does not necessarily limit the unit itself; for example, the first acquisition unit can also be described as "a unit that acquires at least two Internet Protocol addresses".
[0184] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0185] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0186] In a first aspect, according to one or more embodiments of the present disclosure, a method for controlling the state of a screen display is provided, applied to an electronic device, wherein the electronic device is provided with a control tool;
[0187] The method includes:
[0188] Receive test instructions and run the target program according to the test instructions;
[0189] When testing the target program, a startup command from the control tool is also received, the startup command including parameters for controlling the screen display state;
[0190] Controlling the electronic device to a screen-off state according to the parameters. According to one or more embodiments of this disclosure, controlling the electronic device to a screen-off state according to the parameters includes:
[0191] A mode variable is determined based on the parameters, and the mode variable is used to characterize the screen mode of the electronic device;
[0192] The method of setting the screen state in the native system of the electronic device is reflected, and the mode variable is processed using the method obtained by reflection to control the electronic device to be in a screen-off state.
[0193] According to one or more embodiments of this disclosure, processing the pattern variable using the reflection method to control the electronic device to be in a screen-off state includes:
[0194] An example of initializing the reflection setting method, wherein the reflection setting method is used to reflect the method of setting the screen state in the native system of the electronic device;
[0195] Based on the initialized setting instance and the mode variable, the reflection setting method is invoked to control the electronic device to be in a screen-off state.
[0196] According to one or more embodiments of this disclosure, the parameter is a parameter for controlling screen off, and the step of determining the mode variable based on the parameter includes:
[0197] Based on the parameters used to control screen off, the mode variable is determined to be a variable used to characterize the background operation of the target program.
[0198] According to one or more embodiments of this disclosure, it further includes: obtaining cross-process communication parameters;
[0199] Accordingly, controlling the electronic device to be in a screen-off state based on the parameters includes:
[0200] Based on the inter-process communication parameters and the parameters used to control the screen display state of the electronic device, the electronic device is controlled to be in a screen-off state.
[0201] According to one or more embodiments of this disclosure, obtaining cross-process communication parameters includes:
[0202] Cross-process communication parameters are obtained by reflection, wherein the reflection method is used to reflect the method of obtaining cross-process communication parameters in the native system of the electronic device.
[0203] According to one or more embodiments of this disclosure, the method of obtaining inter-process communication parameters via reflection includes:
[0204] Initialize the acquisition instance of the reflection acquisition method and start the acquisition instance to call the reflection acquisition method;
[0205] The result returned by the reflection acquisition method is converted into a preset type to obtain the cross-process communication parameters.
[0206] Secondly, according to one or more embodiments of the present disclosure, a control device for screen display status is provided, applied to an electronic device, wherein the electronic device is provided with a control tool;
[0207] The device includes:
[0208] The receiving unit is used to receive test commands;
[0209] The execution unit is used to run the target program according to the test instructions;
[0210] The receiving unit is also used to receive the start command of the control tool when testing the target program;
[0211] The control unit is used to control the electronic device to be in a screen-off state according to the parameters.
[0212] In one optional implementation, the control unit includes:
[0213] A mode determination module is used to determine mode variables based on the parameters, wherein the mode variables are used to characterize the mode of the screen of the electronic device;
[0214] The control module is used to reflect the method for setting the screen state in the native system of the electronic device, and to process the mode variable using the method obtained by reflection, so as to control the electronic device to be in a screen-off state.
[0215] In one optional implementation, the control module is specifically used for:
[0216] An example of initializing the reflection setting method, wherein the reflection setting method is used to reflect the method of setting the screen state in the native system of the electronic device;
[0217] Based on the initialized setting instance and the mode variable, the reflection setting method is invoked to control the electronic device to be in a screen-off state.
[0218] In one optional implementation, the parameters are parameters used to control screen off, and the mode determination module is specifically used for:
[0219] Based on the parameters used to control screen off, the mode variable is determined to be a variable used to characterize the background operation of the target program.
[0220] In one optional embodiment, the device further includes a communication parameter acquisition unit for acquiring cross-process communication parameters;
[0221] Accordingly, the control unit is specifically used for:
[0222] Based on the inter-process communication parameters and the parameters used to control the screen display state of the electronic device, the electronic device is controlled to be in a screen-off state.
[0223] In one optional implementation, the communication parameter acquisition unit is specifically used for:
[0224] Cross-process communication parameters are obtained by reflection, wherein the reflection method is used to reflect the method of obtaining cross-process communication parameters in the native system of the electronic device.
[0225] In one optional implementation, the communication parameter acquisition unit includes:
[0226] The reflection acquisition module is used to initialize the acquisition instance of the reflection acquisition method and start the acquisition instance to call the reflection acquisition method;
[0227] The conversion module is used to convert the result returned by the reflection acquisition method into a preset type to obtain the cross-process communication parameters.
[0228] Thirdly, according to one or more embodiments of the present disclosure, an electronic device is provided, comprising: at least one processor and a memory;
[0229] The memory stores computer-executed instructions;
[0230] The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the screen display state control method as described in the first aspect and various possible designs of the first aspect.
[0231] Fourthly, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein computer-executable instructions are stored therein, and when a processor executes the computer-executable instructions, the screen display state control method described in the first aspect and various possible designs of the first aspect is implemented.
[0232] Fifthly, embodiments of this disclosure provide a computer program product, including a computer program that, when executed by a processor, implements the screen display state control method described in the first aspect and various possible designs of the first aspect.
[0233] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0234] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0235] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A method for controlling the state of a screen display, characterized in that, Applied to an electronic device, wherein the electronic device is equipped with a control tool; the method includes: Receive test instructions and run the target program according to the test instructions; When testing the target program, a startup command from the control tool is also received, the startup command including parameters for controlling the screen display state; Get cross-process communication parameters; Based on the inter-process communication parameters and the parameters used to control the screen display state, the electronic device is controlled to be in a screen-off state, and the target program runs normally.
2. The method according to claim 1, characterized in that, in, Controlling the electronic device to a screen-off state according to parameters used to control the screen display state includes: A mode variable is determined based on parameters used to control the screen display state, the mode variable being used to characterize the screen mode of the electronic device; The method of setting the screen state in the native system of the electronic device is reflected, and the mode variable is processed using the method obtained by reflection to control the electronic device to be in a screen-off state.
3. The method according to claim 2, characterized in that, The method of processing the pattern variables using reflection to control the electronic device to be in a screen-off state includes: An example of initializing the reflection setting method, wherein the reflection setting method is used to reflect the method of setting the screen state in the native system of the electronic device; Based on the initialized setting instance and the mode variable, the reflection setting method is invoked to control the electronic device to be in a screen-off state.
4. The method according to claim 2, characterized in that, When the parameter used to control the screen display state is the same parameter used to control the screen off, determining the mode variable based on the parameter used to control the screen display state includes: Based on the parameters used to control screen off, the mode variable is determined to be a variable used to characterize the background operation of the target program.
5. The method according to claim 1, characterized in that, The acquisition of cross-process communication parameters includes: Cross-process communication parameters are obtained by reflection, wherein the reflection method is used to reflect the method of obtaining cross-process communication parameters in the native system of the electronic device.
6. The method according to claim 5, characterized in that, The method of obtaining cross-process communication parameters through reflection includes: Initialize the acquisition instance of the reflection acquisition method and start the acquisition instance to call the reflection acquisition method; The result returned by the reflection acquisition method is converted into a preset type to obtain the cross-process communication parameters.
7. A control device for screen display status, characterized in that, Applied to electronic devices, wherein the electronic devices are equipped with control tools; the device includes: The receiving unit is used to receive test commands; The execution unit is used to run the target program according to the test instructions; The receiving unit is also used to receive the start command of the control tool when testing the target program; The communication parameter acquisition unit is used to acquire cross-process communication parameters; The control unit is used to control the electronic device to be in a screen-off state and the target program to run normally, based on the cross-process communication parameters and the parameters used to control the screen display state.
8. An electronic device, characterized in that, include: At least one processor and memory; The memory stores computer-executed instructions; The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the screen display state control method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by the processor, implement the screen display state control method as described in any one of claims 1 to 6.
10. A computer program product comprising a computer program that, when executed by a processor, implements a method for controlling the screen display state according to any one of claims 1-6.