WO2022127211A1 - 震动方法、装置、电子设备和可读存储介质 - Google Patents

震动方法、装置、电子设备和可读存储介质 Download PDF

Info

Publication number
WO2022127211A1
WO2022127211A1 PCT/CN2021/117278 CN2021117278W WO2022127211A1 WO 2022127211 A1 WO2022127211 A1 WO 2022127211A1 CN 2021117278 W CN2021117278 W CN 2021117278W WO 2022127211 A1 WO2022127211 A1 WO 2022127211A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
motor
layer
vibration mode
vibration
Prior art date
Application number
PCT/CN2021/117278
Other languages
English (en)
French (fr)
Inventor
黄停
朱辰
王一品
初硕
Original Assignee
荣耀终端有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 荣耀终端有限公司 filed Critical 荣耀终端有限公司
Priority to EP21854861.8A priority Critical patent/EP4044569A4/en
Priority to US17/787,544 priority patent/US20230251714A1/en
Publication of WO2022127211A1 publication Critical patent/WO2022127211A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72448User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions
    • H04M1/72454User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions according to context-related or environment-related conditions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/016Input arrangements with force or tactile feedback as computer generated output to the user
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/03Arrangements for converting the position or the displacement of a member into a coded form
    • G06F3/033Pointing devices displaced or positioned by the user, e.g. mice, trackballs, pens or joysticks; Accessories therefor
    • G06F3/0346Pointing devices displaced or positioned by the user, e.g. mice, trackballs, pens or joysticks; Accessories therefor with detection of the device orientation or free movement in a 3D space, e.g. 3D mice, 6-DOF [six degrees of freedom] pointers using gyroscopes, accelerometers or tilt-sensors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/72427User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality for supporting games or graphical animations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M19/00Current supply arrangements for telephone systems
    • H04M19/02Current supply arrangements for telephone systems providing ringing current or supervisory tones, e.g. dialling tone or busy tone
    • H04M19/04Current supply arrangements for telephone systems providing ringing current or supervisory tones, e.g. dialling tone or busy tone the ringing-current being generated at the substations
    • H04M19/047Vibrating means for incoming calls

Definitions

  • the embodiments of the present application relate to vibration technology, and in particular, to a vibration method, apparatus, electronic device, and readable storage medium.
  • the electronic device can vibrate when a message or call is received, or it can vibrate in response to a specific scene of the game.
  • the reason why the electronic device vibrates is because the electronic device includes a motor, and the vibration of the motor makes the user feel the vibration of the electronic device.
  • a motor is set in the electronic device, and the motor vibrates in a fixed vibration mode, so that the vibration effect of the electronic device felt by the user in any scene is the same, and the user experience is poor.
  • Embodiments of the present application provide a vibration method, apparatus, electronic device, and readable storage medium.
  • the vibration mode of the motor can be adapted to change the screen orientation of the electronic device, thereby improving user experience.
  • an embodiment of the present application provides a vibration method, and the vibration method is applied to an electronic device, where the electronic device includes at least two motors.
  • the method may include: in response to a first operation, the electronic device enters a first application scene; in response to the electronic device entering the first application scene, and the screen orientation of the electronic device is the first screen orientation, the at least The two motors vibrate in a first vibration mode.
  • the screen orientation of the electronic device is switched from the first screen orientation to the second screen orientation, the at least two motors vibrate in a second vibration mode, the first vibration mode and the first vibration mode The two vibration modes are different.
  • the first operation and the second operation may be an operation of a user or an operation of an element of the electronic device.
  • the first application scenario may include at least one of the following scenarios: a scenario of an interface displayed by the electronic device, a scenario of vibrating with music, a scenario of playing audio, a scenario of user operations on an interface of the electronic device, or a scenario of the electronic device.
  • the external environment in which the device is located that is, in the embodiment of the present application, when the electronic device is in the first application scenario and the screen orientation of the electronic device is the first screen orientation, the at least two motors vibrate in the first vibration mode.
  • the at least two motors vibrate in a second vibration mode different from the first vibration mode.
  • the vibration mode of the motor can be changed according to the screen orientation of the electronic device, which can improve user experience.
  • the screen orientation of the electronic device in response to the second operation, is switched from the first screen orientation to the second screen orientation, and the interface displayed by the electronic device follows the screen orientation of the electronic device.
  • the direction of the screen is rotated, and the at least two motors vibrate in a second vibration mode.
  • the vibration mode of the motor can be changed according to the screen orientation of the electronic device, but also the interface displayed by the electronic device rotates following the screen orientation of the electronic device, thereby achieving the effect of adapting the user's vibration feeling according to the user's vision. , to improve the user experience.
  • the screen orientation of the electronic device in response to the second operation, is switched from the first screen orientation to the second screen orientation, and the audio channel played by the electronic device follows the The screen orientation of the electronic device changes.
  • the vibration mode of the motor can be changed according to the screen orientation of the electronic device, but the audio played by the electronic device can also be changed according to the rotation of the screen orientation of the electronic device, so as to adapt to the user's hearing according to the user's hearing.
  • the effect of vibration feeling improves the user experience.
  • the screen orientation of the electronic device in response to the second operation, is switched from the first screen orientation to the second screen orientation, and the interface displayed by the electronic device follows the screen orientation of the electronic device.
  • the screen orientation is rotated, the sound channel of the audio played by the electronic device changes with the screen orientation of the electronic device.
  • the vibration mode of the motor can be changed by adapting to the screen orientation of the electronic device, but also the audio played by the electronic device and the interface of the electronic device can also be changed following the rotation of the screen orientation of the electronic device, so as to achieve the desired effect according to the screen orientation of the electronic device.
  • the user's hearing and vision are adapted to the user's vibration experience to improve the user experience.
  • the screen orientation of the electronic device in response to the second operation, is switched from the first screen orientation to the second screen orientation, and the interface displayed by the electronic device does not follow the The screen direction of the electronic device rotates, and the at least two motors vibrate in the first vibration mode.
  • the screen orientation of the electronic device is changed, but the interface of the electronic device is not rotated.
  • the vibration mode of the motor is not changed, which can improve the user experience.
  • the at least two motors include a first motor and a second motor, and the at least two motors vibrate in a first vibration mode, including: the first motor vibrates in a first waveform, The second motor vibrates in a second waveform; the at least two motors vibrate in a second vibration mode, including: the first motor vibrates in a third waveform, and the second motor vibrates in a fourth waveform.
  • the difference between the first vibration mode and the second vibration mode may be expressed as: at least one of the third waveform and the fourth waveform is different from the first waveform, and/or the third waveform is different from the first waveform. At least one of the fourth waveforms is different from the second waveform.
  • the first parameter includes a first sub-parameter and a second sub-parameter
  • the second parameter includes a third sub-parameter and a fourth sub-parameter.
  • the electronic device can drive the first motor to vibrate with the first waveform with the first sub-parameter, and the electronic device can drive the second motor to vibrate with the second waveform with the second sub-parameter.
  • the electronic device can drive the first motor to vibrate with the third waveform with the third sub-parameter, and the electronic device can drive the second motor to vibrate with the fourth waveform with the fourth sub-parameter.
  • the screen orientation is switched, and the second vibration mode is different from the first vibration mode.
  • the first waveform and the fourth waveform are the same, and the second waveform is the same as the third waveform, which can bring the same vibration to the user when the electronic device is in the same interface feel.
  • the first waveform is used to represent that the vibration intensity of the first motor changes from strong to weak
  • the second waveform is used to represent that the vibration intensity of the second motor changes from weak to strong
  • the positions of the first motor and the second motor in the electronic device are different.
  • the setting position of the motor is different, and the vibration between the motors is coupled, which can make the user feel the vibration more clearly.
  • the electronic device may generate a first target configuration file, where the first target configuration file is used to indicate the first vibration mode.
  • the electronic device may generate a first parameter according to the first target configuration file, the first parameter is used to drive the first motor to vibrate with the first waveform, and the second motor to vibrate with the second waveform shock.
  • the electronic device generates a second target configuration file, and the second target configuration file is used to indicate the second vibration mode; the electronic device generates a second parameter according to the second configuration file, and the second parameter is used for The first motor is driven to vibrate with the third waveform, and the second motor is driven to vibrate with the fourth waveform.
  • the first target configuration file is different; and, the first application scenario and the first target configuration file are different;
  • the second target configuration files are different.
  • the electronic device may obtain first target configuration information according to the first application scenario, the first screen orientation, and a vibration mode mapping relationship, where the vibration mode mapping relationship is used to characterize the application of the electronic device.
  • the mapping relationship between the scene and the first configuration information, the first target configuration information is used to represent the first screen orientation; the first configuration file containing the first target configuration information is used as the first target configuration file .
  • the electronic device may acquire second target configuration information, where the second target configuration information is used to represent the second screen orientation; the first configuration file containing the second target configuration information is used as the first configuration file.
  • Two target profiles wherein, the electronic device may acquire the second target configuration information according to the first application scenario, the second screen orientation, and the vibration mode mapping relationship; or, the electronic device may, according to the second screen orientation, Modifying the first target configuration information to the second target configuration information.
  • the electronic device may include the first layer, the second layer, the third layer, the fourth layer and the fifth layer, and the following takes the first layer as the application layer and the second layer as the KIT Layer, the third layer is the application framework layer, the fourth layer is the hardware abstraction layer, and the fifth layer is the kernel layer as an example to illustrate the process of the electronic device driving at least two motor vibrations:
  • the first way the application layer obtains the first target configuration information according to the first application scenario, the first screen orientation, and the vibration mode mapping relationship; the application layer obtains the first target configuration information through the KIT layer , the application framework layer sends the first target configuration information to the hardware abstraction layer; the hardware abstraction layer takes the first configuration file containing the first target configuration information as the first target configuration file .
  • the first application scenarios are different, the identifiers of the target vibration modes are different, and the target vibration mode is the first vibration mode or the second vibration mode; and, the target vibration The identifiers of the modes are different, and the initial configuration information is different, and the initial configuration information is the first target configuration information to be determined.
  • the initial configuration information, the initial configuration information is: the first configuration information of the identification mapping of the target vibration mode in the vibration mode mapping relationship; the KIT layer sends the initial configuration to the application framework layer information; the application framework layer obtains the first target configuration information according to the first screen orientation and the initial configuration information; the application framework layer sends the first target configuration to the hardware abstraction layer information; the hardware abstraction layer takes the first configuration file containing the first target configuration information as the first target configuration file.
  • the application layer obtains the first target configuration information, or the application framework layer obtains the second target configuration information.
  • the application layer acquires the first target configuration information, or the application framework layer acquires the second target configuration information.
  • the first target configuration files are different, and the first parameters are different; and the second target configuration files are different, and the second parameters are different.
  • the hardware abstraction layer sends the first target configuration file to the kernel layer; the kernel layer generates the first parameter according to the first target configuration file; and, The hardware abstraction layer sends the second target configuration file to the kernel layer; the kernel layer generates the second parameter according to the first target configuration file.
  • the first parameter includes a first sub-parameter and a second sub-parameter
  • the second parameter includes a third sub-parameter and a fourth sub-parameter
  • the inner core layer drives the first motor to vibrate with the first waveform with the first sub-parameter
  • the inner core layer drives the second motor with the second sub-parameter to vibrate with the first waveform vibration with two waveforms
  • the method further includes: the inner core layer drives the first motor to vibrate with the third waveform using the third sub-parameter, and the inner core layer vibrates with the third sub-parameter.
  • Four sub-parameters drive the second motor to vibrate with the fourth waveform.
  • an embodiment of the present application provides a vibration device, including: a first motor module, a second motor module, a motor interface, a motor library module, and a motor drive.
  • the electronic device In response to the first operation, the electronic device enters a first application scene, and the electronic device includes at least two motors; in response to the electronic device entering the first application scene, the screen orientation of the electronic device is the first screen the at least two motors vibrate in the first vibration mode; in response to the second operation, the screen orientation of the electronic device is switched from the first screen orientation to the second screen orientation, the at least two motors vibrate in the first Two vibration modes vibrate, the first vibration mode is different from the second vibration mode.
  • the interface displayed by the electronic device rotates following the screen direction of the electronic device.
  • the channel of the audio played by the electronic device changes with the orientation of the screen of the electronic device.
  • the screen orientation of the electronic device in response to the second operation, is switched from the first screen orientation to the second screen orientation, and the interface displayed by the electronic device does not follow the The screen direction of the electronic device rotates, and the at least two motors vibrate in the first vibration mode.
  • the at least two motors include a first motor and a second motor.
  • the first motor vibrates with a first waveform
  • the second motor vibrates with a second waveform
  • the first motor vibrates with a third waveform
  • the second motor vibrates with a fourth waveform, wherein the third At least one of the waveform and the fourth waveform is different from the first waveform, and/or at least one of the third waveform and the fourth waveform is different from the second waveform.
  • the first waveform and the fourth waveform are the same, and the second waveform is the same as the third waveform.
  • the first waveform is used to represent that the vibration intensity of the first motor changes from strong to weak
  • the second waveform is used to represent that the vibration intensity of the second motor changes from weak to strong
  • the positions of the first motor and the second motor in the electronic device are different.
  • the motor is driven to generate a first parameter, the first parameter is used to drive the first motor to vibrate with the first waveform, and the second motor to vibrate with the first waveform.
  • the motor library module is configured to generate a first target configuration file, and the first target configuration file is used to indicate the first vibration mode; the motor library module is further configured to generate a first target configuration file. Two target configuration files, the second target configuration files are used to indicate the second vibration mode.
  • the first target configuration files are different; and, the first application scenario and the first target configuration file are different;
  • the second target configuration files are different.
  • the first motor module or the first motor module and the second motor module, are used to obtain the first motor module according to the first application scenario, the first screen orientation, and the vibration mode mapping relationship.
  • a target configuration information is used to represent the mapping relationship between the application scene of the electronic device and the first configuration information
  • the first target configuration information is used to represent the first screen orientation;
  • the motor library module which is used to use the first configuration file containing the first target configuration information as the first target configuration file.
  • the first motor module and/or the second motor module acquires second target configuration information, where the second target configuration information is used to represent the second screen orientation; the motor library module is used for The first configuration file containing the second target configuration information is used as the second target configuration file.
  • the first motor module is configured to acquire the second target configuration information according to the first application scenario, the second screen orientation, and the vibration mode mapping relationship;
  • the second motor module is configured to modify the first target configuration information to the second target configuration information according to the second screen orientation.
  • the first application scenario includes at least one of the following scenarios: a scenario of an interface displayed by the electronic device, a scenario of vibrating with music, a scenario of playing audio, a user's response to the electronic device The operation scene of the interface or the external environment in which the electronic device is located.
  • the electronic device includes a first layer, a second layer, a third layer and a fourth layer; the first motor module in the first layer is configured to be used according to the first application The scene, the first screen orientation, and the vibration mode mapping relationship, to obtain the first target configuration information; the first motor module in the first layer passes the motor interface in the second layer, the The second motor module in the third layer sends the first target configuration information to the motor library module in the fourth layer; the motor library module in the fourth layer will contain the first target configuration information The first configuration file is used as the first target configuration file.
  • the first application scenarios are different, the identifiers of the target vibration modes are different, and the target vibration mode is the first vibration mode or the second vibration mode; and, the target vibration The identifiers of the modes are different, and the initial configuration information is different, and the initial configuration information is the first target configuration information to be determined.
  • the first motor module in the first layer is configured to acquire the identifier of the target vibration mode according to the first application scenario and the vibration mode mapping relationship, and the vibration mode The mode mapping relationship is also used to represent the mapping relationship between the application scene of the electronic device and the identification of the vibration mode; the first motor module in the first layer sends the target vibration mode to the motor interface in the second layer
  • the motor interface in the second layer is used to obtain the initial configuration information according to the identification of the target vibration mode and the vibration mode mapping relationship, and the initial configuration information is: the vibration mode mapping The first configuration information of the identification mapping of the target vibration mode in the relationship;
  • the motor interface in the second layer sends the initial configuration information to the second motor module in the third layer;
  • the third layer in the The second motor module of the third layer is used to obtain the first target configuration information according to the first screen orientation and the initial configuration information;
  • the motor library module sends the first target configuration information; the motor library module in the fourth layer takes the first configuration file containing the first target configuration information as the first target configuration file.
  • the first target configuration files are different, and the first parameters are different; and the second target configuration files are different, and the second parameters are different.
  • the motor library module in the fourth layer sends the first target configuration file to the motor driver in the fifth layer; the motor driver in the fifth layer is based on the a first target configuration file, generating the first parameter; and the motor library module in the fourth layer sends the second target configuration file to the motor driver in the fifth layer; in the fifth layer The motor drive generates the second parameter according to the first target profile.
  • the first parameter includes a first sub-parameter and a second sub-parameter
  • the second parameter includes a third sub-parameter and a fourth sub-parameter
  • the motor drive in the fifth layer The first motor is driven with the first sub-parameter to vibrate with the first waveform
  • the motor in the fifth layer is driven with the second sub-parameter to drive the second motor to vibrate with the second waveform
  • the motor drive in the fifth layer drives the first motor to vibrate with the third waveform with the third subparameter
  • the motor drive in the fifth layer drives the fourth subparameter The second motor vibrates with the fourth waveform.
  • an embodiment of the present application provides an electronic device, where the electronic device includes: at least two motors.
  • the electronic device In response to the first operation, the electronic device enters a first application scene, the electronic device includes at least two motors; in response to the electronic device entering the first application scene, and the screen orientation of the electronic device is the first a screen orientation, the at least two motors vibrate in a first vibration mode; in response to a second operation, the screen orientation of the electronic device is switched from the first screen orientation to the second screen orientation; the at least two motors Vibrate in a second vibration mode, the first vibration mode is different from the second vibration mode.
  • the at least two motors are used to perform the vibration action in the above-mentioned first aspect or each possible implementation manner of the first aspect, and the electronic device is used to perform the above-mentioned first aspect or each of the first aspect.
  • an embodiment of the present application provides an electronic device, where the electronic device includes: a processor, a memory, and at least two motors.
  • the at least two motors are used to generate vibration in the first aspect and each possible implementation manner above, so as to make the electronic device vibrate;
  • the memory is used for storing computer executable program code, the program code includes instructions; when the processor When the instruction is executed, the instruction causes the electronic device to execute the method other than vibration in the first aspect or each possible implementation manner of the first aspect.
  • an embodiment of the present application provides a vibration device, including a unit, a module, or a circuit for executing the method provided by the first aspect or each possible implementation manner of the first aspect.
  • the vibration device may be an electronic device or a module applied to the electronic device, for example, a chip applied to the electronic device.
  • embodiments of the present application provide a computer program product containing instructions, which, when executed on a computer, cause the computer to execute the method in the first aspect or various possible implementations of the first aspect.
  • an embodiment of the present application provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes the first aspect or each of the first aspect. method in one possible implementation.
  • the present application provides a vibration method, apparatus, electronic device and readable storage medium.
  • the method includes: in response to a first operation, the electronic device enters a first application scenario, the electronic device includes at least two motors; in response to the electronic device entering the first application scenario
  • the screen orientation of the electronic device is the first screen orientation, and at least two motors vibrate in the first vibration mode; in response to the second operation, the screen orientation of the electronic device is switched from the first screen orientation to the second screen orientation, The at least two motors vibrate in a second vibration mode, and the first vibration mode is different from the second vibration mode.
  • the vibration mode of the motor can be changed according to the screen orientation of the electronic device, thereby achieving the effect of adapting the user's vibration experience according to the screen orientation, and improving the user experience.
  • FIG. 1 is a schematic structural diagram of an electronic device to which an embodiment of the application is applicable;
  • FIG. 2 is a block diagram of a software structure of an electronic device to which an embodiment of the application is applicable;
  • FIG. 3 is a block diagram of another software structure of the electronic device to which the embodiment of the application is applicable;
  • FIG. 4 is a schematic diagram of an arrangement of motors according to an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a screen orientation
  • Fig. 6 is a kind of schematic diagram of determining screen orientation
  • FIG. 7 is a schematic flowchart of an embodiment of a vibration method provided by an embodiment of the present application.
  • FIG. 9 is another schematic diagram of vibration provided by the embodiment of the present application.
  • FIG. 10 is another schematic diagram of vibration provided by the embodiment of the present application.
  • FIG. 11 is another schematic diagram of vibration provided by the embodiment of the application.
  • FIG. 13 is another schematic diagram of vibration provided by the embodiment of the present application.
  • FIG. 15 is another schematic diagram of vibration provided by the embodiment of the application.
  • FIG. 16 is another schematic diagram of vibration provided by the embodiment of the application.
  • Fig. 17 is a kind of test comparison schematic diagram provided by the embodiment of this application.
  • Fig. 18 is another kind of test comparison schematic diagram provided by the embodiment of this application.
  • FIG. 19 is a schematic diagram of another test comparison provided by the embodiment of the present application.
  • FIG. 1 is a schematic structural diagram of an electronic device to which an embodiment of the present application is applicable.
  • the electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, Battery 142, Antenna 1, Antenna 2, Mobile Communication Module 150, Wireless Communication Module 160, Audio Module 170, Speaker 170A, Receiver 170B, Microphone 170C, Headphone Jack 170D, Sensor 180, Key 190, Motor 191, Indicator 192, Camera 193, a display screen 194, and a subscriber identification module (subscriber identification module, SIM) card interface 195 and the like.
  • SIM subscriber identification module
  • the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 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), controller, video codec, digital signal processor (DSP), baseband processor, display process unit (DPU), and/or neural network processor (neural-network processing unit, NPU), etc. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • electronic device 100 may also include one or more processors 110 .
  • the processor may be the nerve center and command center of the electronic device 100 .
  • the processor can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is cache memory.
  • the memory may hold instructions or data used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. This avoids repeated accesses and reduces the latency of the processor 110, thereby increasing the efficiency of the electronic device 100.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transceiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones.
  • the interface connection relationship between the modules illustrated in the embodiments of the present application is a schematic illustration, and does not constitute a structural limitation of the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger may be a wireless charger or a wired charger.
  • the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
  • the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142 , the electronic device 100 can also be powered by the power management module 141 .
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160.
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, battery health status (leakage, impedance).
  • the power management module 141 may also be provided in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier, and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low frequency baseband signal is processed by the baseband processor and passed to the application processor.
  • the application processor outputs sound signals through audio devices (not limited to speaker 170A, receiver 170B, etc.), or displays images or videos through display screen 194.
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN), Bluetooth, global navigation satellite system (GNSS), frequency modulation (FM), NFC, Infrared technology (infrared, IR) and other wireless communication solutions.
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
  • the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include GSM, GPRS, CDMA, WCDMA, TD-SCDMA, LTE, GNSS, WLAN, NFC, FM, and/or IR technology, and the like.
  • the above-mentioned GNSS may include global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou satellite navigation system (bei dou navigation satellite system, BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
  • global positioning system global positioning system, GPS
  • global navigation satellite system global navigation satellite system
  • GLONASS global navigation satellite system
  • Beidou satellite navigation system bei dou navigation satellite system, BDS
  • quasi-zenith satellite system quadsi -zenith satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the electronic device 100 can implement a display function through a GPU, a display screen 194, an application processor, and the like.
  • Application processors may include NPUs, DPUs.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute instructions to generate or change display information.
  • the NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transfer mode between neurons in the human brain, it can quickly process the input information and can continuously learn by itself.
  • Applications such as intelligent cognition of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • the DPU is also called the Display Sub-System (DSS).
  • DSS Display Sub-System
  • the DPU is used to adjust the color of the display screen 194.
  • the DPU can adjust the color of the display screen through a 3D look up table (3D LUT).
  • the DPU can also perform processing such as scaling, noise reduction, contrast enhancement, backlight brightness management, hdr processing, and display parameter Gamma adjustment.
  • Display screen 194 is used to display images, videos, and the like.
  • Display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light).
  • LED diode AMOLED
  • flexible light-emitting diode flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on.
  • the electronic device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
  • the electronic device 100 may implement a shooting function through an ISP, one or more cameras 193, a video codec, a GPU, one or more display screens 194, an application processor, and the like.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100 .
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example, data files such as music, photos, videos, etc. are saved in an external memory card.
  • Internal memory 121 may be used to store one or more computer programs including instructions.
  • the processor 110 may execute the above-mentioned instructions stored in the internal memory 121, thereby causing the electronic device 100 to perform various functional applications, data processing, and the like.
  • the internal memory 121 may include a storage program area and a storage data area.
  • the stored program area may store an operating system; the stored program area may also store one or more application programs (such as gallery, contacts, etc.) and the like.
  • the storage data area may store data (such as photos, contacts, etc.) created during the use of the electronic device 100 and the like.
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like.
  • the processor 110 may cause the electronic device 100 to perform various functional applications and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor 110 .
  • the internal memory 121 is used to store the vibration mode mapping relationship, the first configuration file, and the mapping relationship between vibration mode and vibration waveform parameters in the embodiment of the present application.
  • the vibration pattern mapping relationship may include the following first mapping table, second mapping table, and third mapping table.
  • the vibration mode mapping relationship is used to represent the mapping relationship between the application scenarios and configuration information of the electronic device.
  • the configuration information can be information such as strings.
  • the first configuration file is used to indicate the vibration mode, thereby enabling the electronic device 100 to obtain parameters of the vibration waveform according to the first configuration file.
  • the vibration mode is used to represent the vibration mode of the motor in the electronic device 100 , the parameters of the vibration waveform are used to drive the motor to vibrate, and the waveform generated by the motor vibration is the vibration waveform.
  • the parameters of the vibration waveform may include, but are not limited to, vibration intensity, vibration start time, vibration duration, and vibration type.
  • the type of vibration can be rotor vibration and/or linear vibration.
  • the internal memory 121 may pre-store the above-mentioned vibration mode mapping relationship, the first configuration file, and the mapping relationship between vibration mode and vibration waveform parameters.
  • the user can customize the setting of the vibration mode mapping relationship, the first configuration file, and the mapping relationship between vibration mode and vibration waveform parameters.
  • the internal memory 121 may pre-store the parameters of the application scenario, vibration mode, vibration mode, and vibration waveform of the electronic device 100 for the user to select.
  • the electronic device 100 may generate a vibration pattern mapping relationship and a mapping relationship between vibration patterns and vibration waveform parameters according to the user's selection, and store them in the internal memory 121 .
  • the parameters of the vibration waveform are represented by the first parameter, the second parameter or the parameter.
  • the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
  • the audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
  • Speaker 170A also referred to as a "speaker" is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also referred to as "earpiece” is used to convert audio electrical signals into sound signals.
  • the microphone 170C also called “microphone” or “microphone”, is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C.
  • the electronic device 100 may be provided with two microphones 170C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
  • the earphone jack 170D is used to connect wired earphones.
  • the earphone interface 170D may be a USB interface 130, a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) Standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the sensors 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and an ambient light sensor 180L , Bone conduction sensor 180M and so on.
  • the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals.
  • the pressure sensor 180A may be provided on the display screen 194 .
  • the capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes.
  • the electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 .
  • the angular velocity of electronic device 100 about three axes ie, x, y, and z axes
  • the gyro sensor 180B can be used for image stabilization.
  • the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse motion to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation, somatosensory game scenes, and the like.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes).
  • the magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • the electronic device 100 can measure the distance through infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
  • the keys 190 include a power-on key, a volume key, and the like.
  • the key 190 may be a mechanical key or a touch key.
  • the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
  • the motor 191 may be a rotor motor and/or a linear motor, such as an X-axis linear motor or a Z-axis linear motor. At least one motor 191 may be included in the electronic device. Motor motion, such as motor rotation or linear motion, can generate vibrations, which in turn cause electronic equipment to vibrate.
  • the at least two motors may be the same type of motors, eg, the motors may both be rotor motors, X-axis linear motors, or Z-axis linear motors.
  • at least two motors may be different types of motors, at least some of the motors may be different types of motors, or at least some of the motors may be the same type of motors.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be contacted and separated from the electronic device 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 .
  • the electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. Multiple cards can be of the same type or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to realize functions such as call and data communication.
  • the electronic device 100 adopts an eSIM, that is, an embedded SIM card, and the eSIM card may be embedded in the electronic device 100 .
  • the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the embodiments of the present application take an Android system with a layered architecture as an example to exemplarily describe the software structure of the electronic device 100 .
  • FIG. 2 is a block diagram of a software structure of an electronic device to which an embodiment of the present application is applicable.
  • the layered architecture divides the software system of the electronic device 100 into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
  • the Android system can be divided into five layers, namely, an application layer (applications), an application framework layer (application framework), an Android runtime (Android runtime), a system library, and a hardware abstraction layer (hardware abstraction layer). layer, HAL) and the kernel layer (kernel).
  • application layer applications
  • application framework application framework
  • Android runtime Android runtime
  • system library system library
  • hardware abstraction layer hardware abstraction layer
  • kernel layer kernel layer
  • the application layer may include a series of application packages, and the application layer runs the application by calling the application programming interface (API) provided by the application framework layer.
  • API application programming interface
  • the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and so on.
  • the application framework layer provides APIs and programming frameworks for applications in the application layer.
  • the application framework layer includes some predefined functions. As shown in Figure 2, the application framework layer may include window managers, content providers, view systems, telephony managers, resource managers, notification managers, and the like.
  • a window manager is used to manage window programs.
  • the window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, take screenshots, etc.
  • Content providers are used to store and retrieve data and make these data accessible to applications. Data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone book, etc.
  • the view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications.
  • a display interface can consist of one or more views.
  • the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide the communication function of the electronic device 100 .
  • the resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files, etc.
  • the notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages, and can disappear automatically after a brief pause without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications of applications running in the background, and notifications on the screen in the form of dialog windows. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device 100 vibrates, and an indicator light flashes.
  • the Android runtime includes core libraries and a virtual machine.
  • the Android runtime is responsible for the scheduling and management of the Android system.
  • the core library consists of two parts: one is the function functions that the java language needs to call, and the other is the core library of Android.
  • the application layer and the application framework layer run in virtual machines.
  • the virtual machine executes the java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, safety and exception management, and garbage collection.
  • a system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
  • the Surface Manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to realize 3D graphics drawing, image rendering, compositing and layer processing, etc.
  • 2D graphics engine is a drawing engine for 2D drawing.
  • the hardware abstraction layer may include multiple library modules, such as a camera library module, a motor library module, and the like.
  • the Android system can load the corresponding library modules for the device hardware, thereby realizing the purpose of accessing the device hardware by the application framework layer.
  • Device hardware may include, for example, motors, cameras, etc. in electronic devices.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer is used to drive the hardware and make the hardware work.
  • the kernel layer at least includes a display driver, a camera driver, an audio driver, a sensor driver, a motor driver, and the like, which are not limited in this embodiment of the present application.
  • the inner core layer adopts a motor drive to drive the motor (hardware) in the electronic device 100 to move, so as to generate vibration.
  • FIG. 3 is another software structural block diagram of an electronic device to which the embodiments of the present application are applicable.
  • the application framework layer, the Android runtime and the system library shown in FIG. 2 are taken as one layer, (in the following embodiments, the layer is the application framework layer as an example for description), and the application layer and The communication interface between the application framework layers is described as a separate toolkit KIT layer.
  • the KIT layer may include, for example, a window service interface, a display framework interface, and the like.
  • the software architecture of the electronic device may include the first layer, the second layer, the third layer, the fourth layer and the fifth layer.
  • the layer is the KIT layer
  • the third layer is the application framework layer
  • the fourth layer is the hardware abstraction layer
  • the fifth layer is the kernel layer. It should be understood that, in some embodiments, a layer that implements the same function may be referred to by other names, or a layer that can implement the function of multiple layers may be regarded as a layer, or a layer that can implement the function of multiple layers may be divided into multiple layers.
  • Floor the software architecture of the electronic device may include the first layer, the second layer, the third layer, the fourth layer and the fifth layer.
  • the layer is the KIT layer
  • the third layer is the application framework layer
  • the fourth layer is the hardware abstraction layer
  • the fifth layer is the kernel layer.
  • FIG. 4 is a schematic diagram of an arrangement of a motor according to an embodiment of the present application.
  • the electronic device 100 includes two motors as an example for illustration. In this embodiment of the present application, the electronic device 100 may further include more or less motors. Arrangement restrictions. As shown in FIG. 4 , the electronic device 100 is provided with a motor 1 and a motor 2 , and the motor 1 and the motor 2 may be respectively provided at two ends of the electronic device 100 .
  • the motor 1 may be arranged at the position m of the electronic device 100
  • the motor 2 may be arranged at the position n of the electronic device 100 .
  • FIG. 4 is an example of the arrangement of the motors.
  • the motor 1 and the motor 2 in the embodiment of the present application may also be arranged diagonally (eg, position o and position p), or arranged at the same end of the electronic device 100 (eg, position 0). s and position t).
  • the vibration method of the electronic device provided by the embodiment of the present application will be described with reference to the software structure shown in FIG. 3 and the arrangement of the motors in FIG. 4 .
  • the screen orientation may include landscape orientation and portrait orientation.
  • the portrait screen may include the first direction and the third direction
  • the landscape screen may include the second direction and the fourth direction.
  • the vertical screen when the electronic device is facing forward may be used as the first direction, as shown in a in FIG. 5 .
  • the first direction is rotated 90° clockwise as the second direction
  • the second direction is rotated 90° clockwise as the third direction
  • the third direction is rotated 90° clockwise as the fourth direction.
  • the first direction, the second direction, the third direction and the fourth direction may be shown as a, b, c and d in FIG. 5 , respectively.
  • the electronic device is a mobile phone as an example for illustration.
  • the electronic device is located between two screen orientations, in this embodiment of the present application, the angle between the vertical centerline of the electronic device and the vertical centerline of the electronic device when the electronic device is located in the two screen orientations can be obtained.
  • the smaller screen orientation is used as the screen orientation of the electronic device.
  • the electronic device is located between the first direction and the second direction.
  • the first included angle or/and the second included angle may be obtained, where the first included angle is the angle between the vertical centerline of the electronic device and the vertical centerline when the electronic device is in the first direction Angle, such as 55°, the second included angle is to obtain the included angle between the vertical centerline of the electronic device and the vertical centerline of the electronic device when the electronic device is in the second direction, such as 35°, and then the first angle with the smaller included angle is determined.
  • the second orientation is used as the screen orientation of the electronic device. It should be understood that the vertical centerline of the electronic device may be shown as a dashed-dotted line as shown in FIG. 6 .
  • Main Motor A predefined motor.
  • the motor 2 in FIG. 4 may be pre-defined as the main motor.
  • the motor 2 in FIG. 4 may be pre-defined as the left motor, and the motor 1 as the right motor. It should be understood that, in the following embodiments, the first motor may be the left motor and the second motor may be the right motor for description. Wherein, the arrangement positions of the first motor and the second motor in the electronic device are different, as shown in FIG. 4 .
  • the embodiment of the present application provides a vibration method, which can determine to use a single motor or multiple motors to realize different types of vibration according to the application scenario of the electronic device, which brings a more diversified and more three-dimensional vibration to the user and improves the user experience.
  • FIG. 7 is a schematic flowchart of an embodiment of a vibration method provided by an embodiment of the present application. As shown in FIG. 7 , the vibration method provided in the embodiment of the present application may include:
  • the application layer determines a target vibration mode according to a first application scenario of the electronic device.
  • the electronic device can perform vibration feedback.
  • Applications with vibration feedback may be, but are not limited to, audio and video playback applications, input method applications, game applications, and clock applications.
  • the first application scenario of the electronic device may be an application program currently running on the electronic device, or a scenario in which the electronic device makes an incoming call or a scenario in which a short message is received. In order to facilitate distinguishing between the application scenario in which the current electronic device is located and other application scenarios, the first application scenario is used as the application scenario in which the current electronic device is located in this embodiment of the present application. It should be understood that the first application scenarios of the electronic devices are different, and the target vibration modes of the electronic devices are different.
  • the different first application scenarios correspond to different target vibration modes, and some of the different first application scenarios may also correspond to the same target vibration mode.
  • the different vibration modes may be at least one of the following vibration parameters of the motors in the electronic device: the number of vibrating motors, the vibration intensity, the time to start the vibration, the duration of the vibration, or the type of vibration.
  • the type of vibration can be, but is not limited to, rotor vibration and/or linear vibration.
  • the electronic device may enter the first application scenario in response to the first operation.
  • the first operation may not be limited to being a user's operation, or an operation of an element inside the electronic device.
  • the operation of the user may be, but is not limited to, the user triggering the interface of the electronic device, speaking a voice, the user carrying the electronic device from one external environment to another external environment, and the like.
  • the operations of the components inside the electronic device may be, but are not limited to, operations in which a processor in the electronic device issues instructions, operations in which the application layer detects changes in screen orientation, and the like.
  • S701 may be replaced with: the first motor module in the application layer determines the target vibration mode according to the application scenario of the electronic device.
  • the first motor module may be a module in the application layer for performing an action related to motor vibration.
  • the first motor module in the application layer is represented by the application layer for description.
  • the first application scenario of the electronic device may be a scenario of an interface displayed by the electronic device.
  • the application layer can determine the target vibration mode according to the scene of the interface.
  • the scene of the interface is different, and the target vibration mode is different.
  • the scene of the interface can be such as the scene of starting the game, the scene of character upgrading, or the scene of passing the level, etc.
  • the scene of the interface of the game application can be specifically shown in Table 1.
  • the application layer may include a stack for storing interface information, and the top of the stack includes information about the current interface displayed by the electronic device.
  • the information of the current interface may include, but is not limited to, the scene of the current interface, the controls in the current interface, or the coordinate positions of the controls.
  • the controls in the current interface may include shooting controls or direction controls, etc., which are used to control the actions of the characters in the game.
  • the coordinate position of the control refers to the coordinate position of the control on the interface of the electronic device. In this way, the application layer can query the top of the stack to obtain the information of the current interface, and then obtain the scene of the interface displayed by the electronic device.
  • the application layer may store the first mapping table.
  • the first mapping table is used to represent the mapping relationship between the scene of the interface, the identifier of the vibration mode and the first configuration information, as shown in Table 1.
  • the identification of the vibration mode can be a number number, a character, etc., and the identification of the vibration mode is used to distinguish different vibration modes.
  • the embodiment of the present application does not limit the identification of the vibration mode.
  • Table 1 the numbers composed of numbers and letters are: example to illustrate.
  • the first configuration information is used to enable the KIT layer and the application framework layer to determine the target vibration mode.
  • the first configuration information may be information such as a character string.
  • the first mapping table may further include a description of the vibration mode corresponding to the scene of the interface.
  • the description of the vibration mode is used to indicate the vibration mode, so as to distinguish the vibration modes corresponding to different interface scenes.
  • the identifier of the vibration mode can also be replaced with the identifier of the scene of the interface, and the identifier of the scene of the interface is used to distinguish different scenes of the interface.
  • the application layer can also store the first mapping table in a database format or an extensible markup language (extensible markup language, XML) format, and Table 1 is an example of a format of the first mapping table.
  • the application layer can determine the target vibration mode according to the interface scene and the first mapping table.
  • the electronic device may characterize the target vibration mode with an identification of the vibration mode (identification of a scene of an interface), a description of the vibration mode, or first configuration information.
  • the application layer can determine the target vibration mode corresponding to the scene of character upgrade according to the scene of character upgrade and the first mapping table. For "Dual Motor Shake (Briefly Shake)".
  • the description of the vibration mode is “dual motor vibration”, and the vibration modes of the dual motors can be different.
  • the suffix “dual” of the character string in the first configuration information indicates dual motor vibration.
  • the suffix “rtol” means vibration from the right motor to the left motor, and “ltor” means vibration from the left motor to the right motor.
  • the suffix “left_l” or “Onlyl” means that only the left motor vibrates, and the suffix “right_r” or “Onlyr” means that only the right motor vibrates.
  • the target vibration mode in the embodiment of the present application may be the vibration of a target type of motor, such as an X-axis linear motor, a Z-axis linear motor, or a rotor motor.
  • the first configuration information is "X” in “haptic.game_qz.stren_X”, which can indicate that the target vibration mode is X-axis linear motor vibration.
  • the first configuration information is "Z” in “haptic.game_qz.stren_Z”, which can indicate the target.
  • the vibration mode is Z-axis linear motor vibration
  • the first configuration information is "O" in "haptic.game_qz.stren_O”, which may indicate that the target vibration mode is rotor motor vibration, which is not shown in Table 1. Table 1 is used as an example for description in the following embodiments.
  • the first configuration information in Table 1 may not include a suffix.
  • the suffixes "rtol”, “ltor”, “left_l”, “Onlyl”, “right_r”, and “Onlyr” may not be included in the first configuration information, and the first configuration information may be configured by the application layer or the program framework layer according to the For the screen orientation of the electronic device, add a suffix to the first configuration information.
  • the suffix "dual” may not be included in the first configuration information, but the hardware abstraction layer adds a suffix to the first configuration information. For details, refer to the following description of the hardware abstraction layer.
  • the application scenario of the electronic device may be vibrating with music.
  • the audio played by the electronic device is different, and the target vibration pattern is different.
  • the application framework layer can obtain the audio file to be played, and the audio file can be a waveform sound (wav) file.
  • the audio channel can be included in the wav file, and the channel can be left channel, right channel, dual channel or multi-channel.
  • the above application layer can call the API of the KIT layer to obtain the audio channel from the application framework layer, and then determine the target vibration mode according to the audio channel. Exemplarily, if the audio channel is the left channel, the application layer may determine that the target vibration mode is the left motor vibration.
  • the application layer can determine the target vibration mode to be the right motor vibration. If the audio channel is binaural, the application layer can determine the target vibration mode as left motor and right motor vibration.
  • the electronic device may include at least three motors, and if the audio channels are multi-channel, the application layer may determine that the target vibration mode is at least three motor vibrations.
  • the application scenario of the electronic device may be a scenario of playing audio.
  • different audio frequencies may correspond to different target vibration modes.
  • the application layer can obtain the identifier of the audio played by the electronic device, and then determine the target vibration mode according to the identifier of the audio.
  • the identification of the audio may be, but not limited to, the name of the audio, the number of the audio, and the like.
  • the application scenario of the electronic device may be the screen orientation of the electronic device.
  • the screen orientation of the electronic device is different, and the target vibration mode is different.
  • the application layer can obtain the screen orientation, and then determine the target vibration mode according to the screen orientation.
  • the application layer may call the API for detecting the screen orientation in the KIT layer to obtain the screen orientation of the electronic device.
  • the API for detecting screen orientation can be a window service or a display FWK interface.
  • the application layer calls the API of acquiring sensor data in the KIT layer to acquire data from the sensor. Sensors such as gyroscopes and/or acceleration sensors.
  • the application layer can obtain the screen orientation of the electronic device based on the data from the sensor. Exemplarily, the data range intervals in which the data of the sensors are located are different, and the screen orientations of the electronic devices are different.
  • a second mapping table may be stored in the application layer.
  • the second mapping table is used to represent the mapping relationship between the screen orientation, the identifier of the vibration mode and the first configuration information, as shown in Table 2.
  • the application layer can determine the target vibration mode according to the screen orientation and the second mapping table.
  • the application layer determines the target vibration mode as the main motor vibration according to the vertical screen and the second mapping table.
  • the target vibration mode can be dual-motor vibration, for example, motor 1 and motor 2 vibrate at the same time.
  • the second mapping table may include a description of the vibration mode corresponding to the vibration mode identifier.
  • the application scenario of the electronic device may be the user's operation on the interface of the electronic device.
  • the application layer can determine the target vibration mode according to the user's operation information on the interface of the electronic device.
  • the operation information is different, and the target vibration mode is different.
  • the operation information may include the user's operation position and/or operation action, the operation position may be the coordinate position of the user's operation on the interface, and the operation action may include, but is not limited to, single click, double click, and slide.
  • the application layer can receive touch information from a touch panel, and the touch information can be referred to as TP information, and the TP information can include the user's information on the interface of the electronic device.
  • the operation information, and then the application layer can obtain the operation information of the user on the interface of the electronic device.
  • the application layer may determine the target vibration mode according to the user's operation position.
  • the target vibration mode is different depending on the user's operating position. Exemplarily, as shown in FIG. 4 , if the user's operating position is close to the right motor (motor 1 ), it can be determined that the target vibration mode is right motor vibration. If the user's operating position is close to the left motor (motor 2 ), it can be determined that the target vibration mode is the left motor vibration. It should be understood that in this embodiment of the present application, the screen of the electronic device may be pre-divided into an area close to the left motor and an area close to the right motor.
  • the screen of the electronic device may be pre-divided into multiple regions according to the placement positions of the motors, so as to determine which motor is close to the user's operating position.
  • the application layer may determine the target vibration mode according to the user's operation action.
  • the target vibration modes are different depending on the user's operation actions. Exemplarily, if the user's operation action is clicking, the target vibration mode may be the main motor vibration, and if the user's operation action is sliding, the target vibration mode may be dual-motor vibration.
  • the application layer may determine the target vibration mode according to the user's operation position and operation action.
  • the user's operation actions and/or operation actions are different, and the target vibration patterns are different.
  • the application layer can determine that the target vibration mode is the vibration of motor 1 to motor 2, such as the vibration of motor 2.
  • the intensity becomes weak, and the vibration intensity of the motor 1 changes from weak to strong, bringing the user a bottom-to-top vibration experience.
  • the third mapping table can be stored in the application layer.
  • the third mapping table is used to represent the mapping relationship between the operation information of the user on the interface of the electronic device, the identifier of the vibration mode and the first configuration information, as shown in Table 3.
  • the application layer can determine the target vibration mode according to the user's operation information on the interface of the electronic device and the third mapping table.
  • the third mapping table may include a description of the vibration mode corresponding to the vibration mode identifier.
  • the application scenario of the electronic device may be an external environment where the electronic device is located.
  • the external environment where the electronic device is located is different, and the target vibration mode is different.
  • the application layer may determine whether the external environment where the electronic device is located is night or day according to time. If it is night (for example, between 24:00 and 6:00), the target vibration mode can be single-motor vibration.
  • the application layer may determine, according to schedule information, ticketing information, and payment information in the electronic device, that the external environment in which the electronic device is located is a movie-watching environment, a shopping environment, a public transportation environment, and the like.
  • the target vibration mode can be single-motor vibration.
  • the target vibration mode can be dual-motor vibration. The vibration of the single-motor vibration is weaker than that of the dual-motor vibration, so that according to the external environment where the electronic device is located, the user can be prompted with a vibration mode that fits the environment, and the user experience can be improved.
  • the application layer can detect the decibel of the noise in the external environment where the electronic device is located, and if the decibel of the noise is greater than the preset decibel, the target vibration mode can be dual-motor vibration. If the decibel of the noise is less than or equal to the preset decibel, the target vibration mode may be single-motor vibration.
  • single-motor vibration and “dual-motor vibration” in the above-mentioned target vibration mode are illustrative examples, and other vibration modes may also be used for vibration in the embodiments of the present application.
  • the above first mapping table, second mapping table and/or third mapping table can be preset, and the application program layer can determine the target vibration mode according to the application scenario of the electronic device.
  • the first mapping table may be pre-stored in the application layer.
  • the second mapping table and/or the third mapping table may be pre-stored in the application layer.
  • a third mapping table may be pre-stored in the application layer.
  • the first mapping table, the second mapping table and the third mapping table may be referred to as a vibration mode mapping relationship, and the vibration mode mapping relationship is used to represent the application scenario of the electronic device, the identification of the vibration mode and the first configuration information. Mapping relations.
  • the vibration mode mapping relationship further includes a description of the vibration mode corresponding to the identification of the vibration mode.
  • the application layer can obtain the number of motors in the electronic device.
  • the application layer can obtain the number of motors when the application starts.
  • the application layer can obtain the number of motors when the application is started for the first time after installation, and save the number of motors, so that the application layer does not need to repeatedly obtain the number of motors when the application is started subsequently.
  • the application layer can obtain the number of motors when determining the target vibration pattern.
  • the KIT layer may include an API for querying the number of motors, and the application layer may call the API to query and obtain the number of motors.
  • the function corresponding to the API is vibratorEx.getHwParameter("vibratorNumOnChip"), and the application layer can obtain the number of motors according to this function.
  • the information in quotation marks indicates the number of motors. For example, “" indicates that the electronic device supports 1 motor, “sub:1” indicates that the electronic device supports 2 motors, and “sub2:2” indicates that the electronic device supports 3 motors. Among them, “" indicates an empty field in quotation marks.
  • the purpose of using "" is for compatibility with software versions that do not have this function.
  • the application layer can obtain whether the motor in the electronic device supports a linear motor, so as to obtain the vibration capability of the motor. Among them, the application layer can obtain whether the motor supports linear motors when obtaining the number of motors.
  • the KIT layer may include an API for querying whether the motor supports a linear motor, and the application layer may call the API to query to obtain whether the motor supports a linear motor.
  • the function corresponding to the API is "getHwParameter(vibrator Ex.HW_VIBRATOR_GRADE_VALUE)", and the application layer can call this API to query whether the motor in the electronic device supports linear motors.
  • the VALUE value is NULL, it means that the motor does not support linear motors, and when VALUE corresponds to a specific value, it means that the motor supports linear motors.
  • the application layer determines the identifier of the target vibration mode or the first target configuration information according to the target vibration mode and the vibration mode mapping relationship.
  • the application layer may determine the identification of the target vibration mode according to the "mapping relationship between the vibration mode and the identification of the vibration mode" in the vibration mode mapping relationship.
  • the identifier of the target vibration mode is the identifier of the vibration mode mapped by the target vibration mode in the vibration mode mapping relationship. Exemplarily, if the target vibration mode is a clearance reward vibration, the target vibration mode corresponding to the target vibration mode is identified as "2A".
  • the application layer may determine the first target configuration information according to the "mapping relationship between the vibration mode and the first configuration information" in the vibration mode mapping relationship.
  • the first target configuration information may be the first configuration information of the target vibration mode mapping in the vibration mode mapping relationship.
  • the first target configuration information may be a target character string. Exemplarily, the identifier of the target vibration mode is "2A”, and the first target configuration information is "haptic.game_qmqz.pass_dual".
  • the vibrations are directional and may also be referred to as stereoscopic vibrations.
  • the application layer can determine the initial configuration information according to the target vibration mode and the vibration mode mapping relationship, and then determine the first target configuration information according to the first screen orientation of the electronic device and the initial configuration information. It should be understood that at least one of the first screen orientation and the initial configuration information is different, and the first target configuration information is different.
  • the initial configuration information may be referred to as the first target configuration information to be determined.
  • the first screen orientation is the current screen orientation of the electronic device.
  • the directional nature of vibration can be understood as the transmission of vibration from one part of the electronic device to another.
  • the first configuration information mapped to the target vibration mode may be the initial configuration information "haptic.game_qmqz.pass_dual", and the suffix "dual" in the initial configuration information corresponds to Vibration is not directional. Therefore, the application layer can use the initial configuration information as the first target configuration information.
  • the vibration is directional.
  • the scene of the interface is "open game vibration”
  • two strings of "haptic.game_qz.open_ltor” and “haptic.game_qz.open_rtol” can be configured.
  • the application layer can acquire the first screen orientation of the electronic device, and then determine the first target configuration information according to the first screen orientation and the initial configuration information.
  • the first screen orientation is the second orientation
  • the left side to the right side of the electronic device is a predefined left motor to right motor, that is, "ltor”.
  • the application layer determines that the first screen orientation of the electronic device is the second orientation, it may determine that the first target configuration information may be "haptic.game_qz.open_ltor" according to the initial configuration information.
  • the application program The layer may add a suffix to the initial configuration information according to the first screen orientation to obtain the first target configuration information. If the first screen orientation is the second orientation, the application layer can determine that the suffix is "ltor", and the first target configuration information can be obtained as "haptic.game_qz.open_ltor”.
  • the first target configuration information is used to represent the first screen orientation.
  • the first target configuration information is "haptic.game_qz.open_ltor", it can be represented that the left side to the right side of the electronic device is “left motor to right motor”, so that the first screen direction can be the second direction.
  • S702 when the first application scenario of the electronic device is an interface scenario, S702 may be replaced by: the application layer determines the identifier of the interface scenario or the first target configuration information according to the mapping relationship between the interface scenario and the vibration mode .
  • the "identification of the target vibration mode" in the following S703-S708 may be replaced by the "identification of the scene of the interface”.
  • the application layer sends the identifier of the target vibration mode or the first target configuration information to the KIT layer.
  • the application layer can send the identification of the target vibration mode to the KIT layer.
  • the application layer may send the first target configuration information to the KIT layer.
  • the embodiment of the present application may predefine whether the application layer acquires the identifier of the target vibration mode or the first target configuration information.
  • an identifier corresponding to the target vibration mode of the first application may be pre-defined, and when the first application is running, the application layer may determine the target vibration mode and the vibration mode mapping relationship according to the mapping relationship between the target vibration mode and the vibration mode. The identification of the target vibration mode, and the identification of the target vibration mode is sent to the KIT layer.
  • S703 may be replaced with: the first motor module in the application layer sends the identification of the target vibration mode or the first target configuration information to the motor interface in the KIT layer.
  • the KIT layer is used to represent the motor interface in the KIT layer for description.
  • the vibration mode mapping relationship may not be stored in the KIT layer.
  • the KIT layer receives the first target configuration information from the application layer, and can send the first target configuration information to the application framework layer.
  • the vibration mode mapping relationship is stored in the KIT layer.
  • the KIT layer receives the identification of the target vibration mode from the application layer, it can determine the initial configuration information of the identification mapping of the target vibration mode according to the mapping relationship between the identification of the target vibration mode and the first configuration information in the vibration mode mapping relationship , and send initial configuration information to the application framework layer.
  • the initial configuration information may be: the first configuration information of the identification mapping of the target vibration mode in the vibration mode mapping relationship. It should be understood that the identification of the target vibration mode is different, and the initial configuration information is different.
  • the initial configuration information may be "haptic.game_qmqz.pass_dual” corresponding to "2A" in the vibration mode mapping relationship. If the identifier of the target vibration mode is "11A”, the initial configuration information may be "haptic.game_qz.open_ltor” and “haptic.game_qz.open_rtol”.
  • the above S704 may be replaced with: if the KIT layer receives the first target configuration information from the application layer, the first target configuration information is sent to the second motor module in the application framework layer; if the KIT layer After receiving the identification of the target vibration mode from the application layer, initial configuration information is determined according to the vibration mode mapping relationship, and the initial configuration information is sent to the second motor module in the application framework layer.
  • the second motor module may be a module in the application framework layer for performing actions related to motor vibration.
  • the application framework layer represents the second motor module in the application framework layer as an example for description.
  • the application framework layer sends the first target configuration information to the hardware abstraction layer.
  • the application framework layer can obtain the first target configuration information according to the first screen orientation of the electronic device and the initial configuration information, and send the first target configuration information to the hardware abstraction layer.
  • Target configuration information At least one of the first screen orientation and the initial configuration information is different, and the first target configuration information is different. It should be noted that, for the process of acquiring the first target configuration information by the application framework layer according to the first screen orientation and initial configuration information, reference may be made to the relevant description of the application layer acquiring the first target configuration information in S702 above.
  • the application framework layer may call the window service or the display framework interface to obtain the first screen orientation of the electronic device.
  • the application framework layer may call an API in the KIT layer to obtain data from the sensor to obtain data from the sensor.
  • the application framework layer can obtain the screen orientation of the electronic device based on the data from the sensor.
  • S705 can be replaced with: if the application framework layer receives the first target configuration information from the KIT layer, it sends the first target configuration information to the motor library module in the hardware abstraction layer; if the application framework layer The layer receives the initial configuration information from the KIT layer, obtains the first target configuration information according to the first screen orientation and initial configuration information of the electronic device, and sends the first target configuration information to the motor library module in the hardware abstraction layer.
  • the motor library module in the hardware abstraction layer is represented by the hardware abstraction layer for description.
  • the hardware abstraction layer acquires a first target configuration file according to the first target configuration information, where the first target configuration file is used to represent the target vibration mode.
  • the hardware abstraction layer may pre-store multiple first configuration files, the first configuration file is used to represent the vibration mode, the first configuration file is used to enable the kernel layer to determine the vibration mode, and the first configuration file may be XML document.
  • the first target configuration information is different, and the first target configuration files are different.
  • the first target configuration file is used to represent the target vibration mode, and the first configuration file is used to enable the inner core layer to determine the target vibration mode to generate parameters corresponding to the target vibration mode.
  • the hardware abstraction layer may perform a string search in the first configuration file, and use the first configuration file including the first target configuration information as the first target configuration file.
  • the scene of the interface is "turn on game vibration”
  • the first target configuration information is "haptic.game_qz.open_ltor”
  • the first target configuration file corresponding to the first target configuration information is as follows:
  • “30" in “302” in the ID is used to represent the vibration mode of motor vibration, such as vibration mode No. 30. 2 is used to characterize the vibration with 2-level vibration intensity.
  • the mapping relationship between the vibration mode and the number of the motor vibration (as shown in Table 4 below), and the mapping relationship between the gear position and the vibration intensity can be pre-configured.
  • the first target configuration file may include information such as amplitude, time, and intensity of motor vibration. It should be understood that, as shown in FIG. 4 , the vibration modes of the motor vibration are different, and the numbers of the vibration modes are different.
  • Line 2 in (1) and (2) such as " ⁇ NAME>haptic.game_qz.open_ltor_dualL ⁇ /NAME>” and ⁇ NAME>haptic.game_qz.open_ltor_dualR ⁇ /NAME>, both include first target configuration information" haptic.game_qz.open_ltor", and the vibration modes of motor vibration “dualL”, “dualR”. Among them, “dualL” represents the vibration mode of the left motor in the dual motor, and “dualR” represents the vibration mode of the right motor in the dual motor.
  • the "0" in the third row “ ⁇ VALUE>0,30 ⁇ VALUE>” in (1) and (2) can represent the time when the vibration starts, and "30" represents the 30th vibration mode.
  • the above (1) and (2) indicate that both the left motor and the right motor vibrate in the No. 30 vibration mode at 0s.
  • (1) is the first target profile enabling left motor vibration
  • (2) is the first target profile enabling left motor vibration.
  • the hardware abstraction layer may query the string in the first configuration file to synchronously obtain the first target configuration file (1) corresponding to the left motor and the right motor The corresponding first target configuration files (2) respectively.
  • the hardware abstraction layer sends the first target configuration file to the kernel layer.
  • S707 may be replaced by: the motor library module in the hardware abstraction layer sends the first target configuration file to the motor driver in the kernel layer.
  • the motor drive in the inner core layer is characterized by the inner core layer.
  • the kernel layer obtains a first parameter corresponding to the target vibration mode according to the first target configuration file, and drives the motor to vibrate with the first parameter.
  • the first target configuration files are different, the target vibration modes are different, and the first parameters are different.
  • the first parameter is used to drive the motor to vibrate in the target vibration pattern.
  • the kernel layer receives the first target configuration file from the hardware abstraction layer, it can parse the first target configuration file to obtain the target vibration mode.
  • the kernel layer parses the first target configuration files (1) and (2) as above, and can obtain the target vibration mode as the No. 30 vibration mode.
  • a fourth mapping table may be stored in the kernel layer, and the fourth mapping table is used to represent the mapping relationship between vibration modes and parameters.
  • the fourth mapping table may include a mapping relationship between the identifier of the vibration mode and the parameter.
  • the kernel layer can obtain the parameter corresponding to the target vibration mode, that is, the first parameter, according to the first target configuration file and the fourth mapping table.
  • the inner core layer may acquire the first parameter corresponding to the vibration mode No. 30 according to the vibration mode No. 30 and the fourth mapping table. It should be understood that since the vibration mode No. 30 is the vibration of the left motor and the right motor, the inner core layer can simultaneously obtain the parameters for enabling the vibration of the left motor and the parameters for the vibration of the right motor.
  • a preset array and sampling frequency may be stored in the kernel layer.
  • the kernel layer can sample in the preset array according to the sampling frequency, and obtain the array corresponding to the target vibration mode, that is, the first parameter.
  • the inner core layer drives the motor to vibrate with the first parameter. It should be understood that for other principles of the inner core layer driving the motor vibration, reference may be made to the related descriptions in the prior art.
  • a single motor or multiple motors are used to realize different types of vibration, which brings more diversified and three-dimensional vibration to the user and improves the user experience.
  • the configuration information and configuration file of the motor vibration can be re-acquired according to the first application scenario of the electronic device, and then the motor vibration can be changed. to fit the screen orientation of the electronic device.
  • the application layer can detect the screen orientation of the electronic device. If the electronic device is in the first application scenario, and the application layer detects that the screen orientation is changed, the electronic device may perform steps S701-S708 as above.
  • the application layer re-determines and delivers the first target configuration information, and then the hardware abstraction layer can obtain the first target configuration file adapted to the screen orientation according to the first target configuration information, so that the kernel layer uses the correct first parameter Accurately drive motor vibration.
  • the application framework layer can detect the screen orientation. If the electronic device is in the first application scenario and the application layer detects that the screen orientation is changed, the application framework layer can modify the first target configuration information according to the screen orientation. Furthermore, the hardware abstraction layer can obtain the first target configuration file adapted to the screen orientation based on the modified first target configuration information, so that the kernel layer can accurately drive the motor to vibrate with the correct first parameter.
  • the screen orientation is the second direction
  • the scene of the interface is "footsteps vibrate, people coming from the left”
  • the target vibration mode is left motor vibration
  • the ⁇ NAME> line in the first target configuration file can be used. It is "haptic.game_qz.left_l_OnlyL”, which means that only motor 2 vibrates, as shown in a in Figure 8.
  • the scene of the interface does not change, but because the position of the motor changes relative to the scene of the interface, the left side of the electronic device in the fourth direction is the motor 1, and the motor 1 is
  • the ⁇ NAME> line in the first target configuration file can be changed to "haptic.game_qz.right_r_OnlyR", which means that only motor 1 vibrates, as shown in b in Figure 8.
  • the screen orientation of the electronic device is changed, and the scene of the interface is "footsteps vibrate, and a person is coming from the left"
  • the user feels the motor vibration on the left side of the electronic device, which fits the user's feeling.
  • the first application scenario of the electronic device can be adapted according to the change of the screen orientation, so that the motor vibration can better fit the user's feeling.
  • a plurality of wavy lines are used to represent motor vibration, and the length of the wavy lines represents the intensity of motor vibration.
  • the change in the length of the wavy line can represent the change in the intensity of the motor vibration.
  • vibration mode when the screen orientation shown in FIG. 8 changes is also applicable to the following interface scenarios: for example, the bomb on the left side of the interface explodes, the left face of the character on the interface is hit, the left side of the character is injured, etc.
  • the application layer can re-determine and deliver the first target configuration information, or the application framework layer can modify the first target configuration information according to the screen orientation, which can cause the hardware abstraction layer to obtain the first target configuration information.
  • the first target configuration file adapted to the screen orientation, and then the kernel layer can accurately drive the motor to vibrate with the correct first parameter, adapt to the first application scenario of the electronic device, and improve the user experience.
  • the vibration method of the embodiment of the present application will be described below with reference to a specific first application scenario of the electronic device. It should be understood that the vibration mode of the electronic device in the first application scenario is for illustration.
  • the first application scenario of the electronic device is an interface scenario.
  • the scene of the interface is "the scene of starting the game”
  • the target vibration mode corresponding to “the scene of starting the game” is “vibration transitions from the left to the right”
  • the screen direction is switched from the second direction
  • the fourth direction is taken as an example for description.
  • the application layer determines the target vibration mode according to the scene of starting the game.
  • the game scene of the interface is different, and the target vibration mode can be different.
  • at least some game scenes with different interfaces correspond to different target vibration modes, and some game scenes with different interfaces may also correspond to the same target vibration mode.
  • the application layer determines the identification of the target vibration mode or the first target configuration information according to the mapping relationship between the target vibration mode and the vibration mode, and sends the identification of the target vibration mode or the first target configuration information to the KIT layer.
  • the application layer can determine the identification of the target vibration mode as 11A according to the target vibration mode and the vibration mode mapping relationship. If the first screen orientation is the second orientation, the application layer determines the first target configuration information as "haptic.game_qz.open_ltor" according to the first screen orientation.
  • S901 and S902 may be replaced by: the application layer determines the identifier of the interface scene or the first target configuration information according to the scene of starting the game, and sends the identifier of the interface scene or the first target to the KIT layer configuration information.
  • the "identification of the target vibration mode" in the following S903-S912 and S907A may be replaced with "the identification of the scene of the interface”.
  • the KIT layer receives the first target configuration information "haptic.game_qz.open_ltor” from the application layer, it sends the first target configuration information "haptic.game_qz.open_ltor” to the application framework layer. If the KIT layer receives the target vibration mode identifier 11A from the application layer, it determines the initial configuration information "haptic.game_qz.open_ltor” and “haptic.game_qz.open_rtol", or "haptic.game_qz.open” according to the vibration mode mapping relationship ", and sends initial configuration information to the application framework layer. The following description takes the initial configuration information as "haptic.game_qz.open” as an example.
  • the application framework layer receives the first target configuration information from the KIT layer, then sends the first target configuration information to the hardware abstraction layer; if the application framework layer receives the initial configuration information from the KIT layer, according to the electronic device The first screen orientation and initial configuration information are obtained, the first target configuration information is obtained, and the first target configuration information is sent to the hardware abstraction layer.
  • the application framework layer receives the first target configuration information "haptic.game_qz.open_ltor” from the KIT layer, it sends the first target configuration information "haptic.game_qz.open_ltor” to the hardware abstraction layer. If the application framework layer receives the initial configuration information "haptic.game_qz.open” from the KIT layer, the application framework layer obtains the first target configuration information according to the second direction and the initial configuration information "haptic.game_qz.open”” haptic.game_qz.open_ltor", and send the first target configuration information "haptic.game_qz.open_ltor” to the hardware abstraction layer.
  • the hardware abstraction layer acquires the first target configuration file according to the first target configuration information, and sends the first target configuration file to the kernel layer.
  • the hardware abstraction layer may determine the first target configuration file including the first target configuration information "haptic.game_qz.open_ltor" according to the first target configuration information.
  • the first target configuration file is used to represent the first vibration mode, and the first configuration file is used to enable the inner core layer to determine the first vibration mode, and to generate a first parameter corresponding to the first vibration mode.
  • the first target configuration file may be as follows (3) and (4):
  • the target vibration mode is dual-motor vibration
  • the vibration intensity of the motor on the left side of the electronic device changes from strong to weak
  • the vibration intensity of the motor on the right changes from weak. It becomes stronger, giving the user the feeling that the vibration transitions from the left to the right.
  • the transition of the vibration from the left to the right represents "the vibration intensity of motor 2 changes from strong to weak
  • the vibration intensity of motor 1 changes from weak to strong.
  • the hardware abstraction layer may query a string to obtain the first target configuration file of the left motor (first motor) and the first target of the right motor (second motor) synchronously configuration file.
  • the kernel layer generates a first parameter corresponding to the target vibration mode according to the first target configuration file, and drives the motor to vibrate with the first parameter.
  • the target vibration mode indicated by the first target configuration file is used as the first vibration mode
  • the target vibration mode indicated by the second target configuration file is used here.
  • the second vibration mode is explained.
  • the inner core layer obtains the first parameter corresponding to the first vibration mode according to the first vibration mode and the fourth mapping table.
  • the first configuration files are different, and the first vibration modes are different.
  • the inner core layer can drive the motor to vibrate in the first vibration mode with the first parameter. Wherein, the first parameter is different, and the first vibration mode is different.
  • the first parameter is used to drive the first motor to vibrate with the first waveform, and the second motor to vibrate with the second waveform.
  • the kernel layer may acquire the first parameter according to the first target configuration files (3) and (4) above, and the first parameter may include the first sub-parameter and the second sub-parameter.
  • the inner core layer uses the first sub-parameter to drive the first motor to vibrate with the first waveform, and the inner core layer uses the second sub-parameter to drive the second motor to vibrate with the second waveform. That is to say, the kernel layer can simultaneously acquire the first sub-parameter enabling vibration of the first motor and the second sub-parameter enabling vibration of the second motor according to the first target parameter.
  • the first waveform may be an L waveform as shown in a in FIG. 9
  • the second waveform may be an R waveform as shown in a in FIG. 9
  • the first waveform is used to represent that the vibration intensity of the first motor changes from strong to weak
  • the second waveform is used to represent that the vibration intensity of the second motor changes from weak to strong.
  • L and R in a and b in FIG. 9 represent the left and right sides of the actual orientation of the electronic device.
  • the first motor vibrating with the first waveform can be understood as: the first motor vibrates, and the waveform of the vibration is the first waveform.
  • the vibration of the second motor with the second waveform can be understood as: the second motor vibrates, and the waveform of the vibration is the second waveform.
  • a in Fig. 9 represents "vibration transitions from left to right", the vibration intensity of the left motor changes from strong to weak, and the vibration intensity of the right motor changes from weak to strong. That is, the vibration intensity of the first motor changes from strong to weak, and the vibration intensity of the second motor changes from weak to strong.
  • the vibration diagram corresponding to the waveform diagram shown in a in FIG. 9 is shown in c in FIG. 9 , when the screen orientation is the second direction, and the scene of the interface is the scene of starting the game (boxing game), the motor
  • the vibration intensity of 2 changes from strong to weak
  • the vibration intensity of motor 1 changes from weak to strong, bringing the user a three-dimensional vibration from the left to the right.
  • the vibration mode of the motor shown in c in FIG. 9 is the first vibration mode
  • the first vibration mode is that the vibration intensity of the motor 2 changes from strong to weak
  • the vibration intensity of the motor 1 changes from weak to strong.
  • the target vibration mode is determined according to the scene of starting the game.
  • the screen orientation of the electronic device in response to the second operation, is switched from the first screen orientation to the second screen orientation.
  • the second operation may be a user's operation.
  • the user's operation is like the user rotating the electronic device.
  • the first screen orientation is the second orientation
  • the second screen orientation is the fourth orientation as an example for description.
  • the application layer determines the identifier of the target vibration mode as 11A according to the mapping relationship between the target vibration mode and the vibration mode, and sends 11A to the KIT layer; or, the application layer determines the second target according to the mapping relationship between the target vibration mode and the vibration mode
  • the configuration information is haptic.game_qz.open_rtol, and the second target configuration information haptic.game_qz.open_rtol is sent to the KIT layer.
  • the predefined left and right motors also change with respect to the left and right of the electronic screen.
  • "transition from left to right” means that motor 1 vibrates to motor 2, because motor 2 is a predefined left motor, and motor 1 is a predefined right motor.
  • the right motor vibrates to left motor.
  • the application layer can regenerate the second target configuration information as haptic.game_qz.open_rtol, and send the second target configuration information haptic.game_qz.open_rtol to the KIT layer.
  • haptic.game_qz.open_rtol indicates that when the target vibration mode is in the fourth direction, the vibration of the motor transitions from the left to the right, and the user still feels the vibration from the left to the right. In this way, the vibration of the motor can be adaptively adjusted according to the rotation of the screen, so that when the screen is rotated, it can be adapted to the user's feeling.
  • the KIT layer receives the second target configuration information haptic.game_qz.open_rtol from the application layer, it sends the second target configuration information haptic.game_qz.open_rtol to the application framework layer; if the KIT layer receives the second target configuration information haptic.game_qz.open_rtol from the application layer.
  • the identifier 11A of the target vibration mode is determined according to the vibration mode mapping relationship, and the initial configuration information haptic.game_qz.open is determined, and the initial configuration information haptic.game_qz.open is sent to the application framework layer.
  • the hardware abstraction layer acquires a second target configuration file according to the second target configuration information, and sends the second target configuration file to the kernel layer.
  • the hardware abstraction layer may determine a second target configuration file containing the first target configuration information "haptic.game_qz.open_rtol" according to the first target configuration information.
  • the second target configuration information is different, and the second target configuration files are different.
  • the second target configuration file is used to represent the second vibration mode
  • the first configuration file is used to enable the inner core layer to determine the second vibration mode, and to generate a second parameter corresponding to the second vibration mode.
  • the second target configuration file can be as follows (5) and (6):
  • the vibration of the motor can be adaptively adjusted according to the rotation of the screen, so that when the screen is rotated, it can be adapted to the user's feeling.
  • the hardware abstraction layer can obtain the second target configuration of the left motor synchronously according to the second target configuration information. file and the second target profile for the right motor.
  • the kernel layer generates the target vibration mode corresponding to the second parameter according to the second target configuration file, and drives the motor to vibrate with the second parameter.
  • the kernel layer acquires the second parameter corresponding to the second vibration mode according to the second vibration mode indicated by the second target configuration file and the fourth mapping table.
  • the second configuration file is different, and the second vibration mode is different.
  • the inner core layer may drive the motor to vibrate in the second vibration mode with the second parameter.
  • the second parameter is different, and the second vibration mode is different.
  • the second vibration mode may be the same as or different from the first vibration mode.
  • the second vibration mode may be different from the first vibration mode as an example for description.
  • the second vibration mode may be different from the first vibration mode and may be embodied as: at least one of the third waveform and the fourth waveform is different from the first waveform, and/or at least one of the third waveform and the fourth waveform is different from the first waveform The two waveforms are different.
  • the second parameter is used to drive the first motor to vibrate with the third waveform, and the second motor to vibrate with the fourth waveform.
  • the kernel layer may generate the second parameter according to the second target configuration files (5) and (6) above, and the second parameter may include the third sub-parameter and the fourth sub-parameter.
  • the inner core layer uses the third sub-parameter to drive the first motor to vibrate with the third waveform, and the inner core layer uses the fourth sub-parameter to drive the second motor to vibrate with the fourth waveform. That is to say, the kernel layer can simultaneously acquire the third sub-parameter for enabling the vibration of the first motor and the fourth sub-parameter for enabling the vibration of the second motor according to the second target parameter.
  • the third waveform may be a waveform of R as shown in b in FIG. 9
  • the fourth waveform may be a waveform of L as shown in b in FIG. 9
  • the third waveform is used to represent that the vibration intensity of the first motor changes from weak to strong
  • the fourth waveform is used to represent that the vibration intensity of the second motor changes from strong to weak.
  • the first motor vibrating with the third waveform can be understood as: the first motor vibrates, and the vibration waveform is the third waveform.
  • the second motor vibrating with the fourth waveform can be understood as: the second motor vibrates, and the vibration waveform is the fourth waveform.
  • b in Fig. 9 represents "vibration transitions from left to right"
  • the vibration intensity of the right motor changes from strong to weak
  • the vibration intensity of the left motor changes from weak to strong. That is, the vibration intensity of the second motor changes from strong to weak
  • the vibration intensity of the first motor changes from weak to strong.
  • the vibration diagram corresponding to the waveform shown in b in FIG. 9 is shown in d in FIG. 9 , when the screen direction is switched from the second direction to the fourth direction, and the scene of the interface is the scene of starting the game , the vibration intensity of motor 1 changes from strong to weak, and the vibration intensity of motor 2 changes from weak to strong, which can also bring the user a three-dimensional vibration from the left to the right.
  • the vibration mode of the motor shown in d in FIG. 9 is the second vibration mode
  • the second vibration mode is that the vibration intensity of motor 1 changes from strong to weak
  • the vibration intensity of motor 2 changes from weak to strong.
  • the second vibration mode of the motor of d in FIG. 9 is different from the first vibration mode of the motor of c in FIG. 9 .
  • the interface displayed by the electronic device can be adjusted as the screen orientation changes. Referring to c and d in FIG. 9 , when the screen orientation of the electronic device is switched from the second direction to the fourth direction When the direction of the electronic device is adjusted, the interface displayed by the electronic device can be adjusted according to the screen direction, so that the user can view the positive interface. .
  • the first waveform in this embodiment of the present application may be the same as the fourth waveform
  • the second waveform may be the same as the third waveform.
  • the first waveform of the first motor is the same as the fourth waveform of the second motor
  • the third waveform of the first motor is the same as the second waveform of the second motor. Under the scene", it brings users the same "vibration transition from left to right" vibration experience.
  • the application framework layer can also detect the screen orientation of the electronic device, the above S907-S910 can be replaced with S907A. It should be understood that after S907A, the above-mentioned S911 and S912 may be performed.
  • the application framework layer detects that the screen orientation is switched from the first screen orientation to the second screen orientation, it modifies the first target configuration information to the second target configuration information according to the second screen orientation, and sends the first target configuration information to the hardware abstraction layer. 2. Target configuration information.
  • the second screen orientation is different, and the second target configuration information is different.
  • the first target configuration information in the first screen orientation is haptic.game_qz.open_ltor
  • the left motor and right motor in the current second screen orientation are relative to The left and right of the electronic device are turned 180 degrees.
  • the application framework layer can modify the first target configuration information to the second target configuration information "haptic.game_qz.open_rtol" according to the second screen orientation.
  • the vibration corresponding to a in Figure 10 when the screen orientation of the electronic device is the second direction, the scene of the interface is that the vehicle drives from the left to the right, and the target vibration mode corresponding to the scene of the interface is "vibration from The left side transitions to the right side", the vibration corresponding to a in Figure 10, such as the vibration intensity of motor 2 changes from strong to weak, and the vibration intensity of motor 1 changes from weak to strong.
  • the first target configuration information may be "haptic.game_qz.car_ltor".
  • the vibration intensity of motor 1 changes from strong to weak
  • the vibration intensity of motor 2 changes from weak to strong.
  • the second target configuration information can be modified to "haptic.game_qz.car_rtol". Such vibration can combine the user's vision and touch to bring the user a three-dimensional vibration effect, so that the user has an immersive experience.
  • the motor vibration transitions from the left to the right as an example to illustrate that the motor vibrates in different vibration modes before and after the screen is rotated. Similar to scene 1, before and after the screen is rotated, the motors vibrate in different vibration modes, which can be understood as different vibration modes of the two motors. Exemplary, can include left motor vibration (as shown in Figure 8), right motor vibration, left motor and right motor vibration alternately, motor vibration transition from right to left, dual motor vibration but left and right motor vibration The intensity or type of shock varies.
  • the scene of the interface changes from "the scene of starting the game” to "the scene of being attacked"
  • the first operation may be a display issued by a processor inside the electronic device "under attack” Attack Scenario" command.
  • the application layer detects that the scene of the interface changes from the “scenario of starting the game” shown in d in Figure 9 to the "scenario that is attacked” shown in e in Figure 9, the application layer can "Scenario", determine the target vibration mode as dual-motor vibration, specifically, the dual-motors vibrate with the same vibration intensity for the same time at the same time.
  • the application layer can use the first configuration information corresponding to the identifier of the target vibration mode in the vibration mode mapping relationship as the first target configuration information.
  • the application framework layer may obtain the first target configuration information according to the relevant description in FIG. 7 above.
  • the application layer determines that the identification of the target vibration mode is 6A, or the first target configuration information is haptic.game_qmqz.Shoot2_dual, and sends the identification 6A or the first target vibration mode to the KIT layer.
  • a target configuration information haptic.game_qmqz.Shoot2_dual. If the KIT layer receives the first target configuration information haptic.game_qmqz.Shoot2_dual from the application layer, it sends the first target configuration information haptic.game_qmqz.Shoot2_dual to the application framework layer.
  • the KIT layer receives the identification 6A of the target vibration mode from the application layer, it determines the first target configuration information haptic.game_qmqz.Shoot2_dual according to the vibration mode mapping relationship, and sends the initial configuration information haptic.game_qmqz.Shoot2_dual to the application framework layer .
  • the application framework layer may determine the initial configuration information as the first target configuration information according to the first screen orientation and the initial configuration information haptic.game_qmqz.Shoot2_dual, and send the first target configuration information haptic.game_qmqz.Shoot2_dual to the kernel layer.
  • the kernel layer may use the first configuration file containing the first target configuration information as the first target configuration file.
  • the first target configuration file corresponding to the "attacked scenario” can be shown in the following (7) and (8):
  • the first target configuration file in the "attacked scene" is used to indicate the first vibration mode, and the identifier of the first vibration mode is 1.
  • the first vibration mode is that the left motor and the right motor vibrate in the No. 1 vibration mode at 0s, and the No. 1 special effect means that the motor 1 and the motor 2 vibrate at the same time and vibrate for 3ms. It is conceivable that, in the first vibration mode, the first waveform of the vibration of the first motor is the same as the second waveform of the vibration of the second motor.
  • the motor 1 and the motor 2 vibrate at the same time and vibrate for 3 ms.
  • the vibration has no directionality, that is, there is no left and right vibration. difference.
  • the corresponding second target configuration information in the second direction may also be haptic.game_qmqz.Shoot2_dual. Therefore, as shown in f in FIG. 9, the motor vibrates in the second vibration mode.
  • the second vibration mode is that the motor 1 and the motor 2 can vibrate simultaneously for 3ms at the 0th s.
  • the second vibration mode is the same as the first vibration mode. It is conceivable that, in the second vibration mode, the third waveform of the vibration of the first motor is the same as the fourth waveform of the vibration of the second motor, and the first waveform and the third waveform are the same. It should be understood that in e and f in FIG. 9 , the vibration intensity of motor 1 and motor 2 are the same. In the figure, wavy lines of the same length are used to indicate that the vibration intensities of motor 1 and motor 2 are the same.
  • the first application scenario of the electronic device is the user's operation on the interface of the electronic device.
  • the application program is taken as an example of the clock application program for illustration.
  • a in FIG. 11 is an editing interface of an alarm clock, and the editing interface includes a wheel selection area 1101 of time and a selection area 1102 of an alarm type. The user can swipe up or down in the wheel selection area 1101 to select the time.
  • the alarm type selection area 1102 may include a "repeat" setting option for the alarm, a ringtone option for the alarm, a duration option for the alarm, and a snooze interval option for the alarm.
  • the motor vibration is taken as an example when the user selects the time of the alarm clock for description.
  • the type of vibration when the user performs an upward sliding operation in the scroll wheel selection area 1101 of the time, the type of vibration may be dual motor vibration (transition from the lower side to the upper side).
  • the type of vibration is dual motor vibration (transition from the upper side to the lower side).
  • the application layer determines a target vibration mode according to the user's operation information.
  • the user's operation information may include the user's operation position and/or operation action. Exemplarily, if the user's operation action is sliding, and the user's operation position is from position x to position y in a in Figure 11 , it can be determined that the user's operation is sliding from bottom to top. According to the user's operation information and the vibration mode mapping relationship, the application layer determines that the target vibration mode is dual-motor vibration (transition from the lower side to the upper side), that is, the vibration from the left motor to the right motor.
  • the application layer determines the identifier of the target vibration mode as the first target configuration information according to the target vibration mode and the vibration mode mapping relationship, and sends the identifier of the target vibration mode or the first target configuration information to the KIT layer.
  • the application layer can determine that the target vibration mode is identified as 3C according to the target vibration mode and the vibration mode mapping relationship. It should be understood that the motor at the lower end of the electronic device is a predefined left motor, and the upper motor is a predefined right motor. If the first screen orientation is the first orientation, from bottom to top (ie, from the left motor to the right motor), the first screen orientation may be represented by "ltor”. Correspondingly, when the screen direction is the third direction, the direction from bottom to top is from the right motor to the left motor, and the screen direction can be represented by "rtol". In this embodiment of the present application, the application layer determines the first target configuration information as "haptic.clock1_ltor" according to the first screen orientation.
  • the KIT layer receives the first target configuration information haptic.clock1_ltor from the application layer, it sends the first target configuration information haptic.clock1_ltor to the application framework layer; if the KIT layer receives the target vibration pattern from the application layer If the identifier is 3C, the initial configuration information haptic.clock1 is determined according to the vibration mode mapping relationship according to the vibration mode mapping relationship, and the initial configuration information haptic.clock1 is sent to the application framework layer.
  • the application framework layer receives the first target configuration information haptic.clock1_ltor from the KIT layer, it sends the first target configuration information haptic.clock1_ltor to the hardware abstraction layer; if the application framework layer receives the initial configuration from the KIT layer If the information haptic.clock1 is obtained, the first target configuration information haptic.clock1_ltor is obtained according to the first screen orientation of the electronic device and the initial configuration information haptic.clock1, and the first target configuration information haptic.clock1_ltor is sent to the hardware abstraction layer.
  • the hardware abstraction layer acquires the first target configuration file according to the first target configuration information, and sends the first target configuration file to the kernel layer.
  • the hardware abstraction layer is in the first configuration file, and can determine the to-be-determined first target configuration file including the first target configuration information according to the first target configuration information.
  • the first target configuration file can be as follows (9) and (10):
  • the lower end of the electronic device is the motor 2, that is, the left motor
  • the upper end of the electronic device is the motor 1, that is, the right motor.
  • the kernel layer generates a first parameter corresponding to the target vibration mode according to the first target configuration file, and drives the motor to vibrate with the first parameter.
  • the target vibration mode is the first vibration mode
  • the first vibration mode is: the vibration of the left motor changes from strong to weak
  • the vibration of the right motor changes from weak to strong.
  • the second target configuration information may be “ haptic.clock1_rtol”
  • the corresponding second vibration mode is shown in b in Figure 11.
  • the second vibration mode is: the vibration of the right motor changes from strong to weak, and the vibration of the left motor changes from weak to strong.
  • the vibration method is described by taking the application as an input method application as an example, and the vibration method may include:
  • the application layer determines a target vibration mode according to the user's operation information.
  • the user's operation information may be the user's operation position.
  • the application layer can determine the motor vibration close to the user's operation position according to the user's operation position.
  • the area close to the motor 2 and the area close to the motor 1 are pre-divided.
  • the dotted line in a in Figure 12 divides the screen into two areas, the area to which Motor 2 belongs is the area close to Motor 2, and the area to which Motor 1 belongs is the area close to Motor 1.
  • the first screen orientation of the electronic device is the first direction
  • the keyboard is located below the interface of the electronic device.
  • the application layer determines that the identifier of the target vibration mode is 2C, or the first target configuration information is haptic.shurufa_ltor according to the mapping relationship between the target vibration mode and the vibration mode, and sends the identifier 2C of the target vibration mode or the first target to the KIT layer Configuration information haptic.shurufa_ltor.
  • the suffix "ltor” or “rtol” may not be carried in the first target configuration information.
  • the KIT layer receives the first target configuration information haptic.shurufa_ltor from the application layer, then sends the first target configuration information haptic.shurufa_ltor to the application framework layer; if the KIT layer receives the target vibration pattern from the application layer If the identifier is 2C, the initial target configuration information haptic.shurufa is determined according to the vibration mode mapping relationship, and the initial target configuration information haptic.shurufa is sent to the application framework layer.
  • the application framework layer receives the first target configuration information from the KIT layer, then sends the first target configuration information haptic.shurufa_ltor to the hardware abstraction layer; if the application framework layer receives the initial configuration information haptic.shurufa_ltor from the KIT layer shurufa, then obtains the first target configuration information haptic.shurufa_ltor according to the first screen orientation and initial configuration information of the electronic device, and sends the first target configuration information to the hardware abstraction layer.
  • the hardware abstraction layer acquires the first target configuration file according to the first target configuration information, and sends the first target configuration file to the kernel layer.
  • the first target configuration information is haptic.shurufa_ltor, and the hardware abstraction layer is in the first configuration file. According to the first target configuration information, it can be determined that the first target configuration file containing the first target configuration information "haptic.shurufa_ltor" is as follows:
  • the first target profile indicates that the left motor vibrates in the 4th vibration mode and the 5th vibration intensity at 0s.
  • the kernel layer generates a first parameter corresponding to the target vibration mode according to the first target configuration file, and drives the motor to vibrate with the first parameter.
  • the screen direction is the first direction
  • the positions of the controls in the keyboard in the input method when the user clicks are all close to the motor 2, then when the user clicks the controls in the keyboard in the input method
  • the target vibration mode is the first vibration mode
  • the first vibration mode is the vibration of the motor 2 .
  • the positions of the controls in the keyboard in the input method that the user clicks are all close to the motor 1.
  • the user application framework layer can obtain the second target configuration information "haptic.shurufa_rtol", and the ⁇ NAME> behavior in the second target configuration file is "haptic.shurufa_rtol_OnlyR", indicating that the first vibration mode is motor 1 vibration.
  • the application layer can determine the second vibration mode according to the position where the user clicks the control in the keyboard in the input method.
  • the second vibration mode is the left motor (motor 2) vibration, in the second target configuration file.
  • the ⁇ NAME> behavior is "haptic.shurufa_rtol_OnlyL”.
  • the second vibration mode is the right motor (motor 1) vibration, ⁇ NAME in the second target configuration file > Behavior "haptic.shurufa_rtol_OnlyR”.
  • the target second vibration mode is dual motor (motor 1 and motor 2) vibration, and the ⁇ NAME> behavior in the second target configuration file is "haptic. shurufa_rtol_dual”.
  • Scenario 3 The first application scenario of the electronic device may be vibrating with music.
  • the electronic device includes two speakers, which are respectively disposed at both ends of the electronic device as an example for description, as shown in a in FIG. 13 .
  • the speaker 1 when the audio is the left channel, the speaker 1 outputs audio.
  • the audio When the audio is the right channel, the speaker 2 outputs audio.
  • speaker 1 and speaker 2 When the audio is two-channel, speaker 1 and speaker 2 output audio.
  • the audio may be multi-channel, and the electronic device may also include at least three speakers. When the audio is multi-channel, at least three speakers can output audio.
  • the vibration method may include:
  • the application layer determines the target vibration mode according to the audio channel.
  • the application layer acquires the audio channel
  • the speaker 1 when the audio is the right channel, the speaker 1 outputs audio
  • the target vibration mode is the vibration of the motor 1 close to the speaker 1
  • the speaker 2 When the audio is the left channel, the speaker 2 outputs audio
  • the target vibration mode is the vibration of the motor 2 close to the speaker 2.
  • speaker 1 and speaker 2 When the audio is two-channel, speaker 1 and speaker 2 output audio, and the target vibration mode is that motor 1 and motor 2 vibrate at the same time.
  • the following description takes the screen direction as the first direction, the audio as the right channel, and the speaker 1 outputs audio as an example.
  • the application layer determines the identifier of the target vibration mode, or the first target configuration information is haptic.music1_ltor according to the target vibration mode and the vibration mode mapping relationship, and sends the identifier of the target vibration mode or the first target configuration information haptic to the KIT layer .music1._ltor.
  • the KIT layer receives the first target configuration information haptic.music1_ltor from the application layer, it sends the first target configuration information haptic.music1_ltor to the application framework layer; if the KIT layer receives the target vibration pattern from the application layer , the initial configuration information haptic.music1 is determined according to the vibration mode mapping relationship, and the initial configuration information haptic.music1 is sent to the application framework layer.
  • the application framework layer receives the first target configuration information haptic.music1_ltor from the KIT layer, it sends the first target configuration information haptic.music1_ltor to the hardware abstraction layer; if the application framework layer receives the initial configuration from the KIT layer information haptic.music1, then obtain the first target configuration information haptic.music1_ltor according to the first screen orientation and initial configuration information of the electronic device, and send the first target configuration information haptic.music1._ltor to the hardware abstraction layer.
  • the hardware abstraction layer acquires the first target configuration file according to the first target configuration information, and sends the first target configuration file to the kernel layer.
  • the hardware abstraction layer may determine the first target configuration file including the first target configuration information "haptic.music1_ltor" according to the first target configuration information.
  • the first target configuration file can look like this:
  • the first target profile indicates that when the audio is the right channel, the right motor vibrates with special effect No. 400 at 0s.
  • the kernel layer generates a first parameter corresponding to the target vibration mode according to the first target configuration file, and drives the motor to vibrate with the first parameter.
  • the speaker 1 when the audio is the right channel, the speaker 1 outputs the audio “la la la”, and the motor 1 vibrates.
  • the application layer when the audio channel changes, the application layer can re-acquire the second target configuration information according to the above S1701-S1706.
  • the first target configuration information may be changed from “haptic.music1_ltor” to "haptic.music2_ltor”.
  • music2 represents the left channel
  • music1 represents the right channel.
  • the ⁇ NAME> line in the first target configuration file can be changed from "haptic.music1_ltor_OnlyR” to "haptic.music2_ltor_OnlyL” in the second target configuration file.
  • the speaker 2 outputs the audio "Hahaha", and the motor 2 vibrates.
  • the application framework layer may modify the first target configuration information haptic.music1_ltor to the second target configuration information haptic.music2_ltor according to the audio channel , and further, the hardware abstraction layer can also obtain the ⁇ NAME> behavior "haptic.music2_ltor_OnlyL" in the second target configuration file, so as to realize the vibration as shown in b in FIG. 13 .
  • the application framework layer For the process of acquiring the audio channel by the application framework layer, reference may be made to the relevant description of S701 above.
  • the ⁇ NAME> line in the first target configuration file may change from "haptic.music2_ltor_OnlyL” to "haptic.music12_ltor_dual”
  • the "haptic.music12_ltor_dual” is used to represent the simultaneous vibration of dual motors, and music12 represents dual channels.
  • speaker 1 and speaker 2 output the audio "spring is beautiful", and motor 1 and motor 2 vibrate.
  • the application layer or the application framework layer can modify the target configuration information based on the embodiment shown in the above-mentioned FIG. 13 , if the detected screen orientation is changed, so as to realize that the electronic device can adjust the screen orientation according to the screen orientation. And the purpose of the vibration is to change the channel of the audio.
  • modification of target configuration information when the application layer or the application framework layer detects a change in the screen orientation reference may be made to the above-mentioned related descriptions.
  • the interface of the electronic device may display a video corresponding to the audio, and this scenario is that the electronic device plays a music video (MV), a concert, or the like.
  • MV music video
  • the audio channel and the vibration of the motor can be changed as the screen orientation of the electronic device changes. The following describes this embodiment with reference to FIG. 14 .
  • a in FIG. 14 shows a scene of the electronic device playing a concert
  • the left side of the interface of the electronic device is the drum
  • the right side is the electronic organ.
  • the audio of the drum is the left channel
  • the speaker 2 can output the audio of the drum
  • the audio of the electronic organ is the right channel
  • the speaker 1 can output the audio of the electronic organ.
  • the speaker 2 when the electronic device plays the audio of the drum, the speaker 2 outputs the audio of the drum, and the motor 2 vibrates, as shown in a in FIG. 14 .
  • the speaker 1 outputs the audio of the electronic organ, and the motor 1 vibrates, as shown in b in FIG. 14 .
  • the speaker 1 When the electronic device plays the audio of the electronic organ and the drum, the speaker 1 outputs the audio of the electronic organ, the speaker 2 outputs the audio of the drum, and the motor 1 and the motor 2 vibrate, as shown in c in FIG. 14 .
  • the motor 1 and the motor 2 vibrate, as shown in c in FIG. 14 .
  • the electronic device When the electronic device is switched from the first screen orientation to the second screen orientation, for example, the electronic device is switched from the second orientation to the fourth orientation, the left side of the interface of the electronic device is still the drum, and the right side is still the electronic organ. But the position of the motor and horn in the electronic device has changed with respect to the left and right of the electronic device.
  • the audio of the drum when the electronic device outputs the audio of the drum, the audio of the drum can be changed from the left channel to the right channel, Then, the audio of the drum is output from the speaker 1, and the motor 1 vibrates, as shown by d in FIG. 14 .
  • the audio of the electronic organ is changed from the right channel to the left channel, and then the audio of the drum is output by the speaker 2, and the motor 2 vibrates, as shown in e in FIG. 14 .
  • the speaker 1 outputs the audio of the drum
  • the speaker 2 outputs the audio of the electronic organ
  • the motor 1 and the motor 2 vibrate, as shown in f in FIG. 14 .
  • the user can still feel the same vibration experience and audio experience when the orientation of the screen is changed, which improves the user experience.
  • the first application scene of the electronic device may be an interface scene, and the interface scene is a concert scene as shown in FIG. 14 .
  • the target vibration mode corresponding to the scene of the interface may be preset.
  • the actions of the application layer, the KIT layer, the application framework layer, the hardware abstraction layer and the kernel layer can be referred to the descriptions in the above-mentioned embodiments, so as to realize the change of the vibration mode of the motor vibration when the screen orientation of the electronic device is changed. The example shown in 13 will not be repeated here.
  • the electronic device changes the audio channel when the orientation of the screen is changed.
  • the application layer or the application framework layer can modify the audio channel when the screen orientation is changed, so as to achieve the purpose of changing the audio channel when the screen orientation changes as shown in Figure 14 above.
  • the application layer or the application framework layer can detect the change of the screen orientation, and then modify the target configuration information, and modify the audio channel, so that the electronic device can change the vibration mode according to the change of the screen orientation, and according to the audio
  • the change of the channel and the purpose of changing the audio output can improve the user experience.
  • the first application scenario of the electronic device may be the screen orientation of the electronic device.
  • an input method application is used as an example for description.
  • the electronic device may perform vibration feedback in combination with the screen orientation.
  • the vibration method may include:
  • the target vibration mode when the electronic device is in a portrait orientation, can be the main motor vibration.
  • the electronic device When the electronic device is horizontal, in order to increase the vibration, dual-motor vibration can be used.
  • the following is an example of an electronic device with a vertical screen for description.
  • the application layer determines the identification 1B of the target vibration mode, or the first target configuration information is haptic.shurufa3_ltor according to the mapping relationship between the target vibration mode and the vibration mode, and sends the identification 1B of the target vibration mode or the first target configuration to the KIT layer Information haptic.shurufa3_ltor.
  • the KIT layer receives the first target configuration information haptic.shurufa3_ltor from the application layer, it sends the first target configuration information haptic.shurufa3_ltor to the application framework layer; if the KIT layer receives the target vibration pattern from the application layer 1B, then determine the initial configuration information haptic.shurufa3 according to the vibration mode mapping relationship, and send the initial configuration information haptic.shurufa3 to the application framework layer.
  • the application framework layer receives the first target configuration information haptic.shurufa3_ltor from the KIT layer, it sends the first target configuration information haptic.shurufa3_ltor to the hardware abstraction layer; if the application framework layer receives the initial configuration from the KIT layer information haptic.shurufa3, then obtain the first target configuration information haptic.shurufa3_ltor according to the first screen orientation and initial configuration information of the electronic device, and send the first target configuration information haptic.shurufa3_ltor to the hardware abstraction layer.
  • the hardware abstraction layer acquires the first target configuration file according to the first target configuration information, and sends the first target configuration file to the kernel layer.
  • the hardware abstraction layer can determine the first target configuration file containing the first target configuration information "haptic.shurufa3_ltor" according to the first target configuration information as follows:
  • the first target configuration file indicates that in the input method application, when the electronic device is in a portrait orientation, the main motor (motor 2) vibrates with special effect No. 20 at 0s.
  • the kernel layer generates a first parameter corresponding to the target vibration mode according to the first target configuration file, and drives the motor to vibrate with the first parameter.
  • the target vibration mode is the first vibration mode
  • the first vibration mode is the motor 2 vibration.
  • the second vibration mode is that the two motors vibrate together.
  • the dual motors vibrate, that is, motor 1 and motor 2 vibrate.
  • the first application scenario of the electronic device may be a scenario of playing audio.
  • the first configuration file is preconfigured with configuration files corresponding to audios with different identifiers.
  • the electronic device can realize the vibration of the motor during audio playback according to the above S701-S708.
  • the first configuration information delivered by the application layer or the application framework layer to the hardware abstraction layer may include an audio identifier, so that the hardware abstraction layer obtains the first target configuration file corresponding to the audio according to the audio identifier.
  • the target vibration mode of audio A is "the left motor vibrates at the 1st s, does not vibrate at the 2nd s, and vibrates at the 3rd s, and the right motor does not vibrate at the 1st s, vibrates at the 2nd s, and vibrates at the 3rd s".
  • the vibration ⁇ VALUE> sequence in haptic_music1_xxx_dualL in the first target configuration file is (0, 1000, 2000, 1000)
  • the vibration ⁇ VALUE> sequence in haptic_music1_xxx_dualR is (1000, 1000, 2000, 1000).
  • the kernel layer can realize the vibration effect of "the left motor vibrates for the 1st s, does not vibrate in the 2s, and vibrates in the 3s, and the right motor does not vibrate in the 1s, vibrates in the 2s, and vibrates in the 3s".
  • the actions of the application layer, KIT layer, application framework layer, hardware abstraction layer, and kernel layer in the electronic device in this scenario may refer to the descriptions in the foregoing embodiments.
  • Scenario 6 The first application scenario of the electronic device is the external environment where the electronic device is located.
  • the target vibration mode may be the vibration of the motor 1 .
  • the external environment in which the electronic device is located changes from a movie viewing environment to a user riding bus environment, and the decibel of the noise is greater than the preset decibel, and the target vibration mode can be motor 1 and motor 2 vibration.
  • the actions of the application layer, KIT layer, application framework layer, hardware abstraction layer, and kernel layer in the electronic device in this scenario may refer to the descriptions in the foregoing embodiments.
  • Table 5 is used as an example to describe the first application scenario (including the application program) applicable in the embodiments of the present application below:
  • the application layer can detect the first application scenario of the electronic device, so that the motor vibrates in a corresponding vibration mode, and the specific implementation process can refer to the relevant description in the above embodiment.
  • calibration testing, functional testing, and burn-in testing can be performed on the motor.
  • the test equipment may send a calibration start command to the electronic equipment to be tested (hereinafter referred to as electronic equipment) to start the motor.
  • the electronic device can feed back the check return value to the test device.
  • the electronic device may start the F0 frequency sweep to obtain the check return value.
  • the return value of 1 indicates that the motor starts successfully
  • the return value of 0 indicates that the motor fails to start.
  • the test device may call the calibration EEC3 instruction, specifically, call the SetHwParameter(mmi_vibrator_calib_on) function to send a calibration start command to the electronic device.
  • the preset flow or code of the F0 frequency sweep can be stored in a non-volatile memory (NVRAM), so that the electronic device can perform a calibration test on the motor.
  • NVRAM non-volatile memory
  • the test equipment sends a calibration query command to the electronic equipment to obtain the number of motors.
  • the electronic device can feed back the check return value to the test device.
  • the return value 1 indicates that the query is successful
  • the return value 0 indicates that the query fails.
  • a successful query characterizes that there is a motor in the electronic device.
  • the test device may call the calibration EEC3 instruction, specifically, call the get.HwParameter(vibratorNUMOnChip) function to send a calibration start command to the electronic device.
  • the functional test is used to test the vibration function of the motor to determine whether the motor can vibrate according to the preset vibration pattern.
  • the test device sends a function test start command to the electronic device to test the vibration function of the motor.
  • the electronic device receives the function test start command, it can drive the motor to vibrate according to the preset vibration mode.
  • the testing device sends an FF84 command to the electronic device to instruct the electronic device to initiate a vibration function test.
  • the native vibration in the figure can be understood as: the electronic device can call the get.SystemService(Content.VIBRATOR_SERVICE) function to drive the motor to vibrate according to the preset vibration mode.
  • the default vibration mode can be 10s vibration, and the vibration stops after 2s vibration and 1s interval.
  • the tester can also manually press the start button corresponding to the motor to drive the motor to vibrate according to the preset vibration mode.
  • the aging test is used to test the aging performance of the motor when it has been vibrating, such as obtaining the vibration duration of the motor to determine the usable duration of the motor.
  • the electronic device can drive the motor to vibrate natively.
  • the electronic device can call the get.SystemService(Content.VIBRATOR_SERVICE) function to drive the motor to vibrate according to the preset vibration mode to obtain the vibration duration of the motor.
  • calibration testing, functional testing, and burn-in testing may be performed on the at least two motors.
  • each motor can be pre-numbered.
  • the test equipment can carry the motor number in the test command to perform the test on the motor with the corresponding number.
  • the motors may be numbered with ID 1, ID 2, ID 3, . . . and so on.
  • the test device sends a calibration start command to the electronic device to start the motor.
  • the test equipment can call the calibration EEC3 (ID) command, specifically calling the SetHwParameter(mmi_vibrator_calib_on, ID) function to send the calibration start command to the electronic device.
  • ID the calibration EEC3
  • the function includes the ID of the motor. , so that the electronic device determines that the motor to be tested is the motor corresponding to the ID.
  • functions such as “SetHwParameter(mmi_vibrator_calib_on, 1)” and “SetHwParameter(mmi_vibrator_calib_on, 2)” are used as examples for description, indicating that the test equipment requests the electronic equipment to perform a calibration test on the motor with ID 1 and ID 2 .
  • the testing device sends a calibration query command to the electronic device to obtain the number of motors.
  • the test equipment can call the calibration EEC3(ID) instruction, specifically, calling the get.HwParameter(vibratorNUMOnChip) function to send a calibration start command to the electronic equipment.
  • the return value of 3 indicates that the query is successful, and the return value of other values indicates that the query fails.
  • the return value 3 is used to avoid duplication with the ID of the motor. It is conceivable that the return value may also be other custom values.
  • the test equipment sends a function test start command, such as an FF84(ID) command, to the electronic device.
  • the FF84(ID) command can include the ID of the motor, so that the electronic device can test the vibration function of the motor corresponding to the ID.
  • the electronic device can drive the motor to vibrate according to the preset vibration mode.
  • the electronic device can drive the main motor (eg, motor 2 ) to perform native vibration, and drive the secondary motor (motor 1 ) to perform special vibration.
  • the special effect vibration in the figure can be understood as: the electronic device can call the mVibratorEx.set.HwParameter function to drive the motor to vibrate according to the preset vibration mode.
  • the tester can also manually press the start button corresponding to the motor to drive the main motor and/or the auxiliary motor to vibrate according to the preset vibration mode.
  • the electronic device can drive the main motor to vibrate natively.
  • the electronic device can call the get.SystemService(Content.VIBRATOR_SERVICE) function to drive the main motor to vibrate according to the preset vibration mode, so as to obtain the available vibration of the main motor. Vibration duration.
  • the electronic device can drive the auxiliary motor to perform special effects vibration.
  • the electronic device can call the mVibratorEx.set.HwParameter function to drive the auxiliary motor to vibrate according to the preset vibration mode to obtain the available vibration duration of the auxiliary motor.
  • the electronic device provided by the embodiment of the present application may include: a processor (for example, a CPU), a memory, and at least two motors.
  • the memory may include high-speed random-access memory (RAM), and may also include non-volatile memory (NVM), such as at least one disk memory, in which various instructions can be stored to Used to complete various processing functions and implement the method steps of the present application.
  • NVM non-volatile memory
  • At least two motors are used to perform the vibration action in the above embodiment.
  • the electronic device involved in this application may further include: a power supply, a communication bus, and a communication port. The above-mentioned communication ports are used to realize connection and communication between the electronic device and other peripheral devices.
  • the memory is used to store computer-executable program codes, and the program codes include instructions; when the processor executes the instructions, the instructions cause the processor of the electronic device to perform actions other than the vibration action in the above method embodiments,
  • the implementation principle and technical effect thereof are similar, and are not repeated here.
  • the above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more application specific integrated circuits (ASIC), or one or more microprocessors A digital signal processor (DSP), or one or more field programmable gate arrays (FPGA), etc.
  • ASIC application specific integrated circuit
  • DSP digital signal processor
  • FPGA field programmable gate arrays
  • the processing element may be a general-purpose processor, such as a central processing unit (central processing unit, CPU) or other processors that can call program codes.
  • CPU central processing unit
  • these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC).
  • SOC system-on-a-chip
  • a computer program product includes one or more computer instructions.
  • the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server, or data center over a wire (e.g.
  • a computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that includes an integration of one or more available media.
  • Useful media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), among others.
  • any embodiments or designs described in the embodiments of the present application as “exemplary” or “such as” should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as “exemplary” or “such as” is intended to present the related concepts in a specific manner.
  • the meaning of "plurality" refers to two or more. For example, multiple processing units refers to two or more processing units; multiple systems refers to two or more systems.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Theoretical Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Environmental & Geological Engineering (AREA)
  • User Interface Of Digital Computer (AREA)
  • Telephone Function (AREA)

Abstract

本申请提供一种震动方法、装置、电子设备和可读存储介质,该方法包括:响应于第一操作,电子设备进入第一应用场景,电子设备包括至少两个马达;响应于电子设备进入第一应用场景,且电子设备的屏幕方向为第一屏幕方向,至少两个马达以第一震动模式震动;响应于第二操作,电子设备的屏幕方向从第一屏幕方向切换至第二屏幕方向,至少两个马达以第二震动模式震动,第一震动模式与第二震动模式不同。本申请实施例中,马达的震动模式可以适配电子设备的屏幕方向进行改变,进而达到依据屏幕方向适配用户的震动感受的效果,提高用户体验。

Description

震动方法、装置、电子设备和可读存储介质
本申请要求于2020年12月15日提交国家知识产权局、申请号为202011475685.7、申请名称为“震动方法、装置、电子设备和可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及震动技术,尤其涉及一种震动方法、装置、电子设备和可读存储介质。
背景技术
电子设备可以在接收到信息或电话时震动,或者可以响应于游戏的特定场景震动。电子设备之所以震动,是因为电子设备中包括马达,马达的震动使得用户感受到电子设备的震动。
目前,电子设备中设置一颗马达,该马达以一种固定的震动模式震动,导致用户在任何场景中感受到的电子设备的震动效果都是相同的,用户体验差。
发明内容
本申请实施例提供一种震动方法、装置、电子设备和可读存储介质,马达的震动模式可以适配电子设备的屏幕方向进行改变,提高用户体验。
第一方面,本申请实施例提供一种震动方法,该震动方法应用于电子设备,所述电子设备包括至少两个马达。该方法可以包括:响应于第一操作,电子设备进入第一应用场景,响应于所述电子设备进入所述第一应用场景,且所述电子设备的屏幕方向为第一屏幕方向,所述至少两个马达以第一震动模式震动。响应于第二操作,所述电子设备的屏幕方向从所述第一屏幕方向切换至第二屏幕方向,所述至少两个马达以第二震动模式震动,所述第一震动模式与所述第二震动模式不同。
其中,第一操作、第二操作可以为用户的操作或者电子设备的元件的操作。第一应用场景可以包括以下场景中的至少一个:所述电子设备显示的界面的场景、跟随音乐震动的场景、播放音频的场景、用户对所述电子设备的界面的操作的场景或所述电子设备所处的外界环境。也就是说,本申请实施例中,当电子设备处于第一应用场景,且电子设备的屏幕方向为第一屏幕方向,所述至少两个马达以第一震动模式震动。当电子设备处于第一应用场景,且电子设备的从第一屏幕方向切换至第二屏幕方向,所述至少两个马达以不同于第一震动模式的第二震动模式震动。
本申请实施例中,马达的震动模式可以适配电子设备的屏幕方向进行改变,可以提高用户体验。
在一种可能的实现方式中,响应于第二操作,所述电子设备的屏幕方向从所述第一屏幕方向切换至第二屏幕方向,且所述电子设备显示的界面跟随所述电子设备的屏幕方向旋转,所述至少两个马达以第二震动模式震动。
该种方式中,不仅马达的震动模式可以适配电子设备的屏幕方向进行改变,电子设备显示的界面跟随所述电子设备的屏幕方向旋转,进而达到根据用户的视觉适配用户的震动感受 的效果,提高用户体验。
在一种可能的实现方式中,响应于第二操作,所述电子设备的屏幕方向从所述第一屏幕方向切换至第二屏幕方向,且所述电子设备播放的音频的声道跟随所述电子设备的屏幕方向改变。
该种方式中,不仅马达的震动模式可以适配电子设备的屏幕方向进行改变,电子设备播放的音频也可以跟随所述电子设备的屏幕方向的旋转而改变,进而达到根据用户的听觉适配用户的震动感受的效果,提高用户体验。
在一种可能的实现方式中,响应于第二操作,所述电子设备的屏幕方向从所述第一屏幕方向切换至第二屏幕方向,且所述电子设备显示的界面跟随所述电子设备的屏幕方向旋转,所述电子设备播放的音频的声道跟随所述电子设备的屏幕方向改变。
该种方式中,不仅马达的震动模式可以适配电子设备的屏幕方向进行改变,电子设备播放的音频、以及电子设备的界面也可以跟随所述电子设备的屏幕方向的旋转而改变,进而达到根据用户的听觉、视觉适配用户的震动感受的效果,提高用户体验。
在一种可能的实现方式中,响应于所述第二操作,所述电子设备的屏幕方向从所述第一屏幕方向切换至所述第二屏幕方向,所述电子设备显示的界面未跟随所述电子设备的屏幕方向旋转,所述至少两个马达以所述第一震动模式震动。
该种方式中,电子设备的屏幕方向改变,但电子设备的界面未旋转,为了适配用户的视觉感受,马达的震动模式不改变,能够提高用户体验。
在一种可能的实现方式中,所述至少两个马达包括第一马达和第二马达,所述至少两个马达以第一震动模式震动,包括:所述第一马达以第一波形震动,所述第二马达以第二波形震动;所述至少两个马达以第二震动模式震动,包括:所述第一马达以第三波形震动,所述第二马达以第四波形震动。其中,第一震动模式和第二震动模式不同可以表现为:所述第三波形与所述第四波形中的至少一个与所述第一波形不同,和/或,所述第三波形与所述第四波形中的至少一个与所述第二波形不同。
其中,所述第一参数包括第一子参数和第二子参数,所述第二参数包括第三子参数和第四子参数。电子设备可以以所述第一子参数驱动所述第一马达以所述第一波形震动,电子设备可以以所述第二子参数驱动所述第二马达以所述第二波形震动。电子设备可以以所述第三子参数驱动所述第一马达以所述第三波形震动,电子设备可以以所述第四子参数驱动所述第二马达以所述第四波形震动。
在一种可能的实现方式中,在电子设备的界面的场景为同一场景时,屏幕方向发生切换,第二震动模式与第一震动模式不同。本申请实施例中的所述第一波形和所述第四波形相同,所述第二波形与所述第三波形相同,可以在电子设备处于同一界面的场景下,给用户带来相同的震动感受。
在一种可能的实现方式中,所述第一波形用于表征所述第一马达的震动强度从强变弱,所述第二波形用于表征所述第二马达的震动强度从弱变强。
该种方式中,电子设备处于同一界面的场景下,可以给用户带来相同的震动从左侧震动至右侧的立体震动感受。
在一种可能的实现方式中,所述第一马达和所述第二马达在所述电子设备中的位置不同。马达的设置位置不同,马达之间的震动进行耦合,可以使得用户感受到更清晰的震动感受。
下述对电子设备驱动至少两个马达震动的过程进行说明:
在一种可能的实现方式中,电子设备可以生成第一目标配置文件,所述第一目标配置文 件用于指示所述第一震动模式。电子设备可以根据所述第一目标配置文件,生成第一参数,所述第一参数用于驱动所述第一马达以所述第一波形震动,以及所述第二马达以所述第二波形震动。同理的,电子设备生成第二目标配置文件,所述第二目标配置文件用于指示所述第二震动模式;电子设备根据第二配置文件,生成第二参数,所述第二参数用于驱动所述第一马达以所述第三波形震动,以及所述第二马达以所述第四波形震动。
在一种可能的实现方式中,所述第一应用场景和所述第一屏幕方向中的至少一个不同时,所述第一目标配置文件不同;以及,所述第一应用场景和所述第二屏幕方向中的至少一个不同时,所述第二目标配置文件不同。
可选的,电子设备可以根据所述第一应用场景、所述第一屏幕方向,以及震动模式映射关系,获取第一目标配置信息,所述震动模式映射关系用于表征所述电子设备的应用场景和第一配置信息的映射关系,所述第一目标配置信息用于表征所述第一屏幕方向;将包含有所述第一目标配置信息的第一配置文件作为所述第一目标配置文件。
可选的,电子设备可以获取第二目标配置信息,所述第二目标配置信息用于表征所述第二屏幕方向;将包含有所述第二目标配置信息的第一配置文件作为所述第二目标配置文件。其中,电子设备可以根据所述第一应用场景、所述第二屏幕方向,以及所述震动模式映射关系,获取所述第二目标配置信息;或者,电子设备可以根据所述第二屏幕方向,将所述第一目标配置信息修改为所述第二目标配置信息。
在一种可能的实现方式中,电子设备中可以包括第一层、第二层、第三层、第四层和第五层,下述以第一层为应用程序层、第二层为KIT层、第三层为应用程序框架层、第四层为硬件抽象层、第五层为内核层为例对电子设备驱动至少两个马达震动的过程进行说明:
下面以如下两种方式说明电子设备生成第一目标配置文件的过程:
第一种方式:应用程序层根据所述第一应用场景、所述第一屏幕方向,以及所述震动模式映射关系,获取所述第一目标配置信息;所述应用程序层通过所述KIT层、所述应用程序框架层向所述硬件抽象层发送所述第一目标配置信息;所述硬件抽象层将包含有所述第一目标配置信息的第一配置文件作为所述第一目标配置文件。
在一种可能的实现方式中,所述第一应用场景不同,目标震动模式的标识不同,所述目标震动模式为所述第一震动模式或所述第二震动模式;以及,所述目标震动模式的标识不同,初始配置信息不同,所述初始配置信息为待确定的第一目标配置信息。
第二种方式:所述应用程序层根据所述第一应用场景和所述震动模式映射关系,获取所述目标震动模式的标识,所述震动模式映射关系还用于表征所述电子设备的应用场景和震动模式的标识的映射关系;所述应用程序层向所述KIT层发送所述目标震动模式的标识;所述KIT层根据所述目标震动模式的标识和所述震动模式映射关系,获取所述初始配置信息,所述初始配置信息为:所述震动模式映射关系中所述目标震动模式的标识映射的第一配置信息;所述KIT层向所述应用程序框架层发送所述初始配置信息;所述应用程序框架层根据所述第一屏幕方向和所述初始配置信息,获取所述第一目标配置信息;所述应用程序框架层向所述硬件抽象层发送所述第一目标配置信息;所述硬件抽象层将包含有所述第一目标配置信息的第一配置文件作为所述第一目标配置文件。
上述两种方式的区别在于:应用程序层获取第一目标配置信息,还是应用程序框架层获取第二目标配置信息。本申请实施例中,对于不同的应用程序,预先配置由应用程序层获取第一目标配置信息,或者由应用程序框架层获取第二目标配置信息。
在一种可能的实现方式中,所述第一目标配置文件不同,所述第一参数不同;以及,所 述第二目标配置文件不同,所述第二参数不同。
在一种可能的实现方式中,所述硬件抽象层向所述内核层发送所述第一目标配置文件;所述内核层根据所述第一目标配置文件,生成所述第一参数;以及,所述硬件抽象层向所述内核层发送所述第二目标配置文件;所述内核层根据所述第一目标配置文件,生成所述第二参数。
在一种可能的实现方式中,所述第一参数包括第一子参数和第二子参数,所述第二参数包括第三子参数和第四子参数;所述生成所述第一参数之后,还包括:所述内核层以所述第一子参数驱动所述第一马达以所述第一波形震动,所述内核层以所述第二子参数驱动所述第二马达以所述第二波形震动;所述生成所述第二参数之后,还包括:所述内核层以所述第三子参数驱动所述第一马达以所述第三波形震动,所述内核层以所述第四子参数驱动所述第二马达以所述第四波形震动。
第二方面,本申请实施例提供一种震动装置,包括:第一马达模块、第二马达模块、马达接口、马达库模块、马达驱动。
响应于第一操作,电子设备进入第一应用场景,所述电子设备包括至少两个马达;响应于所述电子设备进入所述第一应用场景,且所述电子设备的屏幕方向为第一屏幕方向,所述至少两个马达以第一震动模式震动;响应于第二操作,所述电子设备的屏幕方向从所述第一屏幕方向切换至第二屏幕方向,所述至少两个马达以第二震动模式震动,所述第一震动模式与所述第二震动模式不同。
在一种可能的实现方式中,所述电子设备显示的界面跟随所述电子设备的屏幕方向旋转。
在一种可能的实现方式中,所述电子设备播放的音频的声道跟随所述电子设备的屏幕方向改变。
在一种可能的实现方式中,响应于所述第二操作,所述电子设备的屏幕方向从所述第一屏幕方向切换至所述第二屏幕方向,所述电子设备显示的界面未跟随所述电子设备的屏幕方向旋转,所述至少两个马达以所述第一震动模式震动。
在一种可能的实现方式中,所述至少两个马达包括第一马达和第二马达。所述第一马达以第一波形震动,所述第二马达以第二波形震动;所述第一马达以第三波形震动,所述第二马达以第四波形震动,其中,所述第三波形与所述第四波形中的至少一个与所述第一波形不同,和/或,所述第三波形与所述第四波形中的至少一个与所述第二波形不同。
在一种可能的实现方式中,所述第一波形和所述第四波形相同,所述第二波形与所述第三波形相同。
在一种可能的实现方式中,所述第一波形用于表征所述第一马达的震动强度从强变弱,所述第二波形用于表征所述第二马达的震动强度从弱变强。
在一种可能的实现方式中,所述第一马达和所述第二马达在所述电子设备中的位置不同。
在一种可能的实现方式中,马达驱动,用于生成第一参数,所述第一参数用于驱动所述第一马达以所述第一波形震动,以及所述第二马达以所述第二波形震动;所述马达驱动,还用于生成第二参数,所述第二参数用于驱动所述第一马达以所述第三波形震动,以及所述第二马达以所述第四波形震动。
在一种可能的实现方式中,马达库模块,用于生成第一目标配置文件,所述第一目标配置文件用于指示所述第一震动模式;所述马达库模块,还用于生成第二目标配置文件,所述第二目标配置文件用于指示所述第二震动模式。
在一种可能的实现方式中,所述第一应用场景和所述第一屏幕方向中的至少一个不同时, 所述第一目标配置文件不同;以及,所述第一应用场景和所述第二屏幕方向中的至少一个不同时,所述第二目标配置文件不同。
在一种可能的实现方式中,第一马达模块,或者第一马达模块和第二马达模块,用于根据所述第一应用场景、所述第一屏幕方向,以及震动模式映射关系,获取第一目标配置信息,所述震动模式映射关系用于表征所述电子设备的应用场景和第一配置信息的映射关系,所述第一目标配置信息用于表征所述第一屏幕方向;马达库模块,用于将包含有所述第一目标配置信息的第一配置文件作为所述第一目标配置文件。
在一种可能的实现方式中,第一马达模块和/或第二马达模块获取第二目标配置信息,所述第二目标配置信息用于表征所述第二屏幕方向;马达库模块,用于将包含有所述第二目标配置信息的第一配置文件作为所述第二目标配置文件。
在一种可能的实现方式中,所述第一马达模块,用于根据所述第一应用场景、所述第二屏幕方向,以及所述震动模式映射关系,获取所述第二目标配置信息;或者,所述第二马达模块,用于根据所述第二屏幕方向,将所述第一目标配置信息修改为所述第二目标配置信息。
在一种可能的实现方式中,所述第一应用场景包括以下场景中的至少一个:所述电子设备显示的界面的场景、跟随音乐震动的场景、播放音频的场景、用户对所述电子设备的界面的操作的场景或所述电子设备所处的外界环境。
在一种可能的实现方式中,所述电子设备包括第一层、第二层、第三层和第四层;所述第一层中的第一马达模块,用于根据所述第一应用场景、所述第一屏幕方向,以及所述震动模式映射关系,获取所述第一目标配置信息;所述第一层中的第一马达模块通过所述第二层中的马达接口、所述第三层中的第二马达模块向所述第四层中的马达库模块发送所述第一目标配置信息;所述第四层中的马达库模块将包含有所述第一目标配置信息的第一配置文件作为所述第一目标配置文件。
在一种可能的实现方式中,所述第一应用场景不同,目标震动模式的标识不同,所述目标震动模式为所述第一震动模式或所述第二震动模式;以及,所述目标震动模式的标识不同,初始配置信息不同,所述初始配置信息为待确定的第一目标配置信息。
在一种可能的实现方式中,所述第一层中的第一马达模块,用于根据所述第一应用场景和所述震动模式映射关系,获取所述目标震动模式的标识,所述震动模式映射关系还用于表征所述电子设备的应用场景和震动模式的标识的映射关系;所述第一层中的第一马达模块向所述第二层中的马达接口发送所述目标震动模式的标识;所述第二层中的马达接口,用于根据所述目标震动模式的标识和所述震动模式映射关系,获取所述初始配置信息,所述初始配置信息为:所述震动模式映射关系中所述目标震动模式的标识映射的第一配置信息;所述第二层中的马达接口向所述第三层中的第二马达模块发送所述初始配置信息;所述第三层中的第二马达模块,用于根据所述第一屏幕方向和所述初始配置信息,获取所述第一目标配置信息;所述第三层中的第二马达模块向所述第四层中的马达库模块发送所述第一目标配置信息;所述第四层中的马达库模块将包含有所述第一目标配置信息的第一配置文件作为所述第一目标配置文件。
在一种可能的实现方式中,所述第一目标配置文件不同,所述第一参数不同;以及,所述第二目标配置文件不同,所述第二参数不同。
在一种可能的实现方式中,所述第四层中的马达库模块向所述第五层中的马达驱动发送所述第一目标配置文件;所述第五层中的马达驱动根据所述第一目标配置文件,生成所述第一参数;以及,所述第四层中的马达库模块向所述第五层中的马达驱动发送所述第二目标配 置文件;所述第五层中的马达驱动根据所述第一目标配置文件,生成所述第二参数。
在一种可能的实现方式中,所述第一参数包括第一子参数和第二子参数,所述第二参数包括第三子参数和第四子参数;所述第五层中的马达驱动以所述第一子参数驱动所述第一马达以所述第一波形震动,所述第五层中的马达驱动以所述第二子参数驱动所述第二马达以所述第二波形震动;以及,所述第五层中的马达驱动以所述第三子参数驱动所述第一马达以所述第三波形震动,所述第五层中的马达驱动以所述第四子参数驱动所述第二马达以所述第四波形震动。
第三方面,本申请实施例提供一种电子设备,所述电子设备包括:至少两个马达。
响应于第一操作,所述电子设备进入第一应用场景,所述电子设备包括至少两个马达;响应于所述电子设备进入所述第一应用场景,且所述电子设备的屏幕方向为第一屏幕方向,所述至少两个马达以第一震动模式震动;响应于第二操作,所述电子设备的屏幕方向从所述第一屏幕方向切换至第二屏幕方向;所述至少两个马达以第二震动模式震动,所述第一震动模式与所述第二震动模式不同。
应理解,所述至少两个马达用于执行上述如第一方面或第一方面的各可能的实现方式中的震动动作,所述电子设备用于执行上述如第一方面或第一方面的各可能的实现方式中除了震动之外的方法。
第四方面,本申请实施例提供一种电子设备,所述电子设备包括:处理器、存储器、至少两个马达。
所述至少两个马达,用于产生如上第一方面以及各可能的实现方式中的震动,以使所述电子设备震动;存储器用于存储计算机可执行程序代码,程序代码包括指令;当处理器执行指令时,指令使所述电子设备执行如第一方面或第一方面的各可能的实现方式中除了震动之外的方法。
第五方面,本申请实施例提供一种震动装置,包括用于执行以上第一方面或第一方面各可能的实施方式所提供的方法的单元、模块或电路。该震动装置可以为电子设备,也可以为应用于电子设备的一个模块,例如,可以为应用于电子设备的芯片。
第六方面,本申请实施例提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面或第一方面的各种可能的实现方式中的方法。
第七方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述第一方面或第一方面的各种可能的实现方式中的方法。
上述第二方面至第七方面的各可能的实现方式,其有益效果可以参见上述第一方面和第一方面的各可能的实现方式所带来的有益效果,在此不加赘述。
本申请提供一种震动方法、装置、电子设备和可读存储介质,该方法包括:响应于第一操作,电子设备进入第一应用场景,电子设备包括至少两个马达;响应于电子设备进入第一应用场景,且电子设备的屏幕方向为第一屏幕方向,至少两个马达以第一震动模式震动;响应于第二操作,电子设备的屏幕方向从第一屏幕方向切换至第二屏幕方向,至少两个马达以第二震动模式震动,第一震动模式与第二震动模式不同。本申请实施例中,马达的震动模式可以适配电子设备的屏幕方向进行改变,进而达到依据屏幕方向适配用户的震动感受的效果,提高用户体验。
附图说明
图1为本申请实施例适用的电子设备的一种结构示意图;
图2为本申请实施例适用的电子设备的一种软件结构框图;
图3为本申请实施例适用的电子设备的另一种软件结构框图;
图4为本申请实施例提供的马达的一种排布示意图;
图5为屏幕方向的示意图;
图6为确定屏幕方向的一种示意图;
图7为本申请实施例提供的震动方法的一种实施例的流程示意图;
图8为本申请实施例提供的一种震动示意图;
图9为本申请实施例提供的另一种震动示意图;
图10为本申请实施例提供的另一种震动示意图;
图11为本申请实施例提供的另一种震动示意图;
图12为本申请实施例提供的另一种震动示意图;
图13为本申请实施例提供的另一种震动示意图;
图14为本申请实施例提供的另一种震动示意图;
图15为本申请实施例提供的另一种震动示意图;
图16为本申请实施例提供的另一种震动示意图;
图17为本申请实施例提供的一种测试对比示意图;
图18为本申请实施例提供的另一种测试对比示意图;
图19为本申请实施例提供的另一种测试对比示意图。
具体实施方式
图1为本申请实施例适用的电子设备的一种结构示意图。如图1所示,该电子设备100可以包括:处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。可以理解的是,本实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件,或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,显示处理单元(display process unit,DPU),和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。在一些实施例中,电子设备100也可以包括一个或多个处理器110。其中,处理器可以是电子设备100的神经中枢和指挥中心。处理器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110用过或循环使用的指令或数据。如果处理器110 需要再次使用该指令或数据,可从所述存储器中直接调用。这就避免了重复存取,减少了处理器110的等待时间,因而提高了电子设备100的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。其中,USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与***设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。
可以理解的是,本申请实施例示意的各模块间的接口连接关系为示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备100供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信 号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN),蓝牙,全球导航卫星***(global navigation satellite system,GNSS),调频(frequency modulation,FM),NFC,红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括GSM,GPRS,CDMA,WCDMA,TD-SCDMA,LTE,GNSS,WLAN,NFC,FM,和/或IR技术等。上述GNSS可以包括全球卫星定位***(global positioning system,GPS),全球导航卫星***(global navigation satellite system,GLONASS),北斗卫星导航***(bei dou navigation satellite system,BDS),准天顶卫星***(quasi-zenith satellite system,QZSS)和/或星基增强***(satellite based augmentation systems,SBAS)。
电子设备100通过GPU,显示屏194,以及应用处理器等可以实现显示功能。应用处理器可以包括NPU、DPU。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行指令以生成或改变显示信息。NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。DPU也称为显示子***(Display Sub-System,DSS),DPU用于对显示屏194的色彩进行调整,DPU可以通过三维查找表(3D look up table,3D LUT)对显示屏的色彩进行调整。DPU还可以对画面进行缩放、降噪、对比度增强、背光亮度管理、hdr处理、显示器参数Gamma调整等处理。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,一个或多个摄像头193,视频编解码器,GPU,一个或多个显示屏194以及应用处理器等实现拍摄功能。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐、照片、视频等数据文件保存在外部存储卡中。
内部存储器121可以用于存储一个或多个计算机程序,该一个或多个计算机程序包括指令。处理器110可以通过运行存储在内部存储器121的上述指令,从而使得电子设备100执行各种功能应用以及数据处理等。内部存储器121可以包括存储程序区和存储数据区。其中, 存储程序区可存储操作***;该存储程序区还可以存储一个或多个应用程序(比如图库、联系人等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如照片,联系人等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。在一些实施例中,处理器110可以通过运行存储在内部存储器121的指令,和/或存储在设置于处理器110中的存储器的指令,来使得电子设备100执行各种功能应用及数据处理。
内部存储器121用于存储本申请实施例中的震动模式映射关系、第一配置文件,以及震动模式和震动波形的参数的映射关系。其中,震动模式映射关系可以包括如下第一映射表、第二映射表、第三映射表。震动模式映射关系用于表征电子设备的应用场景和配置信息的映射关系。配置信息可以为字符串等信息。第一配置文件用于指示震动模式,进而使能电子设备100根据第一配置文件,获取震动波形的参数。震动模式用于表示电子设备100中的马达震动的方式,震动波形的参数用于驱动马达震动,马达震动产生的波形为该震动波形。震动波形的参数可以包括但不限于为:震动强度、震动开始时间、震动时长和震动的类型。震动的类型可以为转子震动和/或线性震动。
在一种实施例中,内部存储器121中可以预先存储上述震动模式映射关系、第一配置文件,以及震动模式和震动波形的参数的映射关系。在一种实施例中,用户可以自定义设置震动模式映射关系、第一配置文件,以及震动模式和震动波形的参数的映射关系。其中,当用户自定义设置时,内部存储器121中可以预先存储电子设备100的应用场景、震动模式、震动模式、震动波形的参数,以供用户选择。电子设备100可以根据用户的选择,生成震动模式映射关系,以及震动模式和震动波形的参数的映射关系,以存储在内部存储器121。应理解,下述实施例中以第一参数、第二参数或参数表示震动波形的参数。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。其中,音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,还可以是美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
传感器180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
其中,压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景等。
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。
按键190包括开机键,音量键等。按键190可以是机械按键,也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以为转子马达和/或线性马达,线性马达如X轴线性马达或Z轴线性马达。电子设备中可以包括至少一个马达191。马达运动,如马达转动或线性运动,可以产生震动,进而使得电子设备震动。当电子设备100包括至少两个马达时,至少两个马达可以是相同类型的马达,例如,马达可以均为转子马达、X轴线性马达或Z轴线性马达。或者,至少两个马达可以是不同类型的马达,马达中的至少部分马达可以是不同类型的马达,或者,马达中的至少部分马达可以是相同类型的马达。
SIM卡接口195用于连接SIM卡。SIM卡可以通过***SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时***多张卡。多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡,eSIM卡可以嵌在电子设备100中。
电子设备100的软件***可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android***为例,示例性说明电子设备100的软件结构。图2为本申请实施例适用的电子设备的一种软件结构框图。分层架构将电子设备100的软件***分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。 在一些实施例中,可以将Android***分为五层,分别为应用程序层(applications)、应用程序框架层(application framework)、安卓运行时(Android runtime)和***库、硬件抽象层(hardware abstract layer,HAL)以及内核层(kernel)。
应用程序层可以包括一系列应用程序包,应用程序层通过调用应用程序框架层所提供的应用程序接口(application programming interface,API)运行应用程序。如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
应用程序框架层为应用程序层的应用程序提供API和编程框架。应用程序框架层包括一些预先定义的函数。如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图***,电话管理器,资源管理器,通知管理器等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。视图***包括可视控件,例如显示文字的控件,显示图片的控件等。视图***可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等。通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在***顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备100振动,指示灯闪烁等。
安卓运行时包括核心库和虚拟机。安卓运行时负责安卓***的调度和管理。核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。***库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。
表面管理器用于对显示子***进行管理,并且为多个应用程序提供了2D和3D图层的融合。媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。三维图形处理库用于实现三维图形绘图,图像渲染,合成和图层处理等。2D图形引擎是2D绘图的绘图引擎。
硬件抽象层,可以包含多个库模块,库模块如可以为摄像头库模块、马达库模块等。Android***可以为设备硬件加载相应的库模块,进而实现应用程序框架层访问设备硬件的目的。设备硬件可以包括如电子设备中的马达、摄像头等。
内核层是硬件和软件之间的层。内核层用于驱动硬件,使得硬件工作。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动,马达驱动等,本申请实施例对此不做限制。示例性的,本申请实施例中,内核层采用马达驱动以驱动电子设备100中的马达(硬件)运动,以产生震动。
在一种实施例中,图3为本申请实施例适用的电子设备的另一种软件结构框图。图3中将图2所示的应用程序框架层、安卓运行时和***库作为一层,(下述实施例中以该层为应用程序框架层为例进行说明),且将应用程序层和应用程序框架层之间的通信接口作为单独的工具包KIT层进行说明。KIT层可以包括如窗口服务接口、显示框架接口等。
在一种实施例中,电子设备的软件架构可以包括第一层、第二层、第三层、第四层和第五层,下述实施例中以第一层为应用程序层、第二层为KIT层、第三层为应用程序框架层,第四层为硬件抽象层、第五层为内核层为例进行说明。应理解,在一些实施例中,可以将实现相同功能的层称为其他名称,或者将能够实现多个层的功能的层作为一层,或者将能够实现多个层的功能的层划分为多层。
图4为本申请实施例提供的马达的一种排布示意图。图4中以电子设备100包括两个马达为例进行说明,本申请实施例中电子设备100还可以包括更多或更少的马达,图4并不构成对电子设备100中的马达的数量和排布的限定。如图4所示,电子设备100中设置有马达1和马达2,马达1和马达2可以分别设置在电子设备100的两端。如马达1可以设置在电子设备100的位置m处,马达2可以设置在电子设备100的位置n处。应理解,马达1和马达2设置在电子设备100的内部,图中为了表征马达的位置在电子设备100的表面以虚线表示。图4为马达的排布的一种示例,本申请实施例中的马达1和马达2还可以对角设置(如位置o和位置p),或者排布在电子设备100的同一端(如位置s和位置t)。下述实施例中结合图3所示的软件结构,以及图4中的马达的排布方式对本申请实施例提供的电子设备的震动方法进行说明。
本申请实施例中的术语释义:
屏幕方向:本申请实施例中,屏幕方向可以包括横屏和竖屏。竖屏可以包括第一方向和第三方向,横屏可以包括第二方向和第四方向。本申请实施例中可以将电子设备正向时的竖屏作为第一方向,如图5中的a所示。第一方向顺时针旋转90°为第二方向,第二方向顺时针旋转90°为第三方向,第三方向顺时针旋转90°为第四方向。第一方向、第二方向、第三方向和第四方向可以分别如图5中的a、b、c和d所示。应理解,图5中以电子设备为手机为例说明。
应理解,若电子设备处于两种屏幕方向之间,本申请实施例中可以获取电子设备的竖直中心线与电子设备处于两种屏幕方向时的竖直中心线之间夹角,将夹角较小的屏幕方向作为电子设备的屏幕方向。示例性的,如图6所示,如电子设备处于第一方向和第二方向之间。本申请实施例中可以获取第一夹角或/和第二夹角,其中,第一夹角为电子设备的竖直中心线与电子设备处于第一方向时的竖直中心线之间的夹角,如55°,第二夹角为获取电子设备的竖直中心线与电子设备处于第二方向时的竖直中心线之间的夹角,如35°,进而将夹角较小的第二方向作为电子设备的屏幕方向。应理解,电子设备的竖直中心线可以如图6中所示的点划线所示。
主马达:预先定义的马达。示例性的,本申请实施例中可以预先定义图4中的马达2为主马达。
左马达和右马达:预定义的马达。示例性的,本申请实施例中可以预先定义图4中的马达2为左马达,马达1为右马达。应理解,下述实施例中可以以第一马达为左马达,以第二马达为右马达进行说明。其中,第一马达和第二马达在电子设备中的设置位置不同,如图4所示。
本申请实施例提供一种震动方法,可以根据电子设备的应用场景,确定采用单马达或者多马达实现不同类型的震动,给用户带来更加多元化、更立体的震感,提高用户体验。
下面结合具体的实施例对本申请实施例提供的震动方法进行说明。下述实施例可以相互结合,对于相同或相似的概念或过程不再赘述。图7为本申请实施例提供的震动方法的一种实施例的流程示意图。如图7所示,本申请实施例提供的震动方法可以包括:
S701,应用程序层根据电子设备的第一应用场景,确定目标震动模式。
用户在电子设备上使用具有震动反馈的应用程序时,或者电子设备来电或接收短消息时,电子设备可以进行震动反馈。具有震动反馈的应用程序可以但不限于为音视频播放类应用程序、输入法应用程序、游戏类应用程序、时钟应用程序。电子设备的第一应用场景可以为当前电子设备运行的应用程序,或电子设备来电的场景或接收短消息的场景。为了便于区分当前电子设备所处的应用场景和其他应用场景,本申请实施例中以第一应用场景作为当前电子设备所处的应用场景。应理解,电子设备的第一应用场景不同,电子设备的目标震动模式不同。或者,在一种实施例中,至少部分不同第一应用场景对应不同的目标震动模式,也可以部分不同第一应用场景对应相同的目标震动模式。震动模式不同,可以为电子设备中的马达的如下至少一种震动参数不同:震动的马达的数量、震动强度、开始震动的时间、震动时长或震动的类型。震动的类型可以但不限于为转子震动和/或线性震动。
在一种实施例中,可以响应于第一操作,电子设备进入第一应用场景。第一操作可以不限于为用户的操作,或者电子设备内部的元件的操作。其中,用户的操作可以但不限于为:用户触发电子设备的界面、说出语音、用户携带电子设备从一外界环境进入另一外界环境等。电子设备内部的元件的操作可以但不限于为:电子设备中的处理器下发指令的操作、应用程序层检测到屏幕方向的变化的操作等。
在一种实施例中,S701可以替换为:应用程序层中的第一马达模块根据电子设备的应用场景,确定目标震动模式。第一马达模块可以为应用程序层中用于执行与马达震动相关的动作的模块。下述以应用程序层表征应用程序层中第一马达模块进行说明。
在一种可能的实现方式中,电子设备的第一应用场景可以为电子设备显示的界面的场景。应用程序层可以根据界面的场景,确定目标震动模式。可选的,界面的场景不同,目标震动模式不同。示例性的,当应用程序为游戏类应用程序时,界面的场景可以如开启游戏的场景、人物升级的场景或过关奖励的场景等,游戏类应用程序的界面的场景具体可以如表一所示。可选的,应用程序层中可以包括用于存储界面的信息的栈,栈的栈顶包括电子设备显示的当前界面的信息。其中,当前界面的信息可以包括但不限于当前界面的场景、当前界面中的控件或控件的坐标位置。当前界面中的控件可以包括射击控件或方向控件等,用于控制游戏中的角色的动作。控件的坐标位置指的是控件在电子设备的界面上的坐标位置。在该种方式中,应用程序层可以查询栈顶,获取当前界面的信息,进而获取电子设备显示的界面的场景。
本申请实施例中,应用程序层中可以存储有第一映射表。第一映射表用于表征界面的场景、震动模式的标识和第一配置信息之间的映射关系,如表一所示。其中,震动模式的标识可以为数字编号、字符等,震动模式的标识用于区分不同的振动模式,本申请实施例对震动模式的标识不做限制,表一中以数字和字母组成的编号为例进行说明。第一配置信息用于使能KIT层、应用程序框架层确定目标震动模式。可选的,第一配置信息可以为字符串等信息。在一种实施例中,第一映射表中还可以包括界面的场景对应的震动模式的描述。震动模式的描述用于指示震动模式,以区分不同界面的场景对应的震动模式。在一种实施例中,震动模 式的标识也可以替换为界面的场景的标识,界面的场景的标识用于区分不同的界面的场景。
应理解,应用程序层还可以采用数据库格式或可扩展标记语言(extensible markup language,XML)格式存储第一映射表,表一为第一映射表的一种格式的示例。应用程序层可以根据界面的场景以及第一映射表,确定目标震动模式。在一种实施例中,电子设备可以以震动模式的标识(界面的场景的标识)、震动模式的描述或第一配置信息来表征目标震动模式。
表一
Figure PCTCN2021117278-appb-000001
示例性的,如表一所示,当电子设备显示的界面的场景为人物升级的场景,则应用程序层根据人物升级的场景和第一映射表,可以确定人物升级的场景对应的目标震动模式为“双马达震动(短促地震动)”。
如表一所示,对于震动模式的描述为“双马达震动”,双马达的震动模式可以不同,表一 中以“双马达震动1”、“双马达震动2”等对不同的双马达震动的模式进行区分。第一配置信息中的字符串的后缀“dual”表示双马达震动。后缀“rtol”表示从右马达震动至左马达,“ltor”表示从左马达震动至右马达。后缀“left_l”或“Onlyl”表示只有左马达震动,后缀“right_r”或“Onlyr”表示只有右马达震动。应注意的是,本申请实施例中的目标震动模式可以为目标类型的马达震动,目标类型的马达如X轴线性马达、Z轴线性马达、或转子马达。如第一配置信息为“haptic.game_qz.stren_X”中的“X”可以表示目标震动模式为X轴线性马达震动,第一配置信息为“haptic.game_qz.stren_Z”中的“Z”可以表示目标震动模式为Z轴线性马达震动,第一配置信息为“haptic.game_qz.stren_O”中的“O”可以表示目标震动模式为转子马达震动,表一中未示出。下述实施例中以表一为例进行说明。
在一种实施例中,表一中的第一配置信息可以不包括后缀。在一种实施例中,第一配置信息中可以不包括后缀“rtol”、“ltor”、“left_l”、“Onlyl”、“right_r”、“Onlyr”,进而由应用程序层或程序框架层根据电子设备的屏幕方向,为第一配置信息添加后缀,具体可以参照下述应用程序层、应用程序框架层的相关描述。在一种实施例中,第一配置信息中可以不包括后缀“dual”,而由硬件抽象层为第一配置信息添加后缀,具体可以参照下述硬件抽象层的相关描述。
在一种可能的实现方式中,电子设备的应用场景可以为跟随音乐震动。电子设备播放的音频不同,目标震动模式不同。对于音频播放类的应用程序,应用程序框架层可以获取待播放的音频文件,该音频文件可以为波形声音(wav)文件。wav文件中可以包括音频的声道,声道可以为左声道、右声道、双声道或多声道。上述应用程序层可以调用KIT层的API从应用程序框架层获取音频的声道,进而根据音频的声道,确定目标震动模式。示例性的,如音频的声道为左声道,则应用程序层可以确定目标震动模式为左马达震动。如音频的声道为右声道,则应用程序层可以确定目标震动模式为右马达震动。如音频的声道为双声道,则应用程序层可以确定目标震动模式为左马达和右马达震动。在一种实施中,电子设备可以包括至少三个马达,若音频的声道为多声道,则应用程序层可以确定目标震动模式为至少三个马达震动。
应理解,上述表一所示的跟随音乐震动的场景既可以划分至“电子设备的应用场景为跟随音乐震动”,也可以划分至“电子设备的应用场景为界面的场景”中,但无论何种划分,均可以实现马达随着音频的声道震动的目的。
在一种可能的实现方式中,电子设备的应用场景可以为播放音频的场景。可选的,不同的音频可以对应不同的目标震动模式。应用程序层可以获取电子设备播放的音频的标识,进而根据音频的标识确定目标震动模式。其中,音频的标识可以但不限于为音频的名称、音频的编号等。
在一种可能的实现方式中,电子设备的应用场景可以为电子设备的屏幕方向。可选的,电子设备的屏幕方向不同,目标震动模式不同。应用程序层可以获取屏幕方向,进而根据屏幕方向确定目标震动模式。可选的,应用程序层可以调用KIT层中用于检测屏幕方向的API,以获取电子设备的屏幕方向。用于检测屏幕方向的API可以为窗口服务(window service)或显示框架(display FWK)接口。可选的,应用程序层调用KIT层中获取传感器的数据的API,以获取来自传感器的数据。传感器如为陀螺仪和/或加速度传感器。应用程序层可以根据来自传感器数据,获取电子设备的屏幕方向。示例性的,传感器的数据所处的数据范围区间不同,电子设备的屏幕方向不同。
本申请实施例中,应用程序层中可以存储有第二映射表。第二映射表用于表征屏幕方向、震动模式的标识和第一配置信息之间的映射关系,如表二所示。应用程序层可以根据屏幕方 向和第二映射表,确定目标震动模式。示例性的,当电子设备为竖屏时,应用程序层根据屏幕竖屏和第二映射表,确定目标震动模式为主马达震动。当电子设备为横屏时,为了增加震感,目标震动模式可以为双马达震动,如马达1和马达2同时震动。在一种可能的实施例中,第二映射表中可以包括震动模式的标识对应的震动模式的描述。
表二
Figure PCTCN2021117278-appb-000002
在一种可能的实现方式中,电子设备的应用场景可以为用户对电子设备的界面的操作。应用程序层可以根据用户对电子设备的界面的操作信息,确定目标震动模式。可选的,操作信息不同,目标震动模式不同。操作信息可以包括用户的操作位置和/或操作动作,操作位置可以为用户在界面上进行操作的坐标位置,操作动作可以包括但不限于为单击、双击、滑动。应理解,当用户在电子设备的界面上进行操作时,应用程序层可以接收来自触摸屏(touch panel)的触摸信息,该触摸信息可以称为TP信息,TP信息可以包括用户对电子设备的界面的操作信息,进而应用程序层可以获取用户对电子设备的界面的操作信息。
可选的,应用程序层可以根据用户的操作位置,确定目标震动模式。可选的,用户的操作位置不同,目标震动模式不同。示例性的,如图4所示,若用户的操作位置靠近右马达(马达1),可以确定目标震动模式为右马达震动。若用户的操作位置靠近左马达(马达2),可以确定目标震动模式为左马达震动。应理解,本申请实施例中,可以预先将电子设备的屏幕预先划分为靠近左马达的区域,以及靠近右马达的区域。当用户的操作位置落入靠近左马达的区域时,可以确定用户的操作位置靠近左马达。当用户的操作位置落入靠近右马达的区域时,可以确定用户的操作位置靠近右马达。应理解的是,当电子设备中包括多个马达时,可以根据马达的设置位置,预先将电子设备的屏幕预先划分为多个区域,以确定用户的操作位置靠近哪个马达。
可选的,应用程序层可以根据用户的操作动作,确定目标震动模式。可选的,用户的操作动作不同,目标震动模式不同。示例性的,如用户的操作动作为点击时,目标震动模式可以为主马达震动,若用户的操作动作为滑动时,目标震动模式可以为双马达震动。
可选的,应用程序层可以根据用户的操作位置和操作动作,确定目标震动模式。用户的操作动作和/或操作动作不同,目标震动模式不同。示例性的,如图4所示,应用程序层根据用户的操作位置和操作动作,若确定用户是从下至上滑动,则可以确定目标震动模式为马达1震动至马达2,如马达2的震动强度强变弱,马达1的震动强度从弱变强,给用户带来从下至上的震动感受。
该种方式中,应用程序层中可以存储第三映射表。该第三映射表用于表征用户对电子设备的界面的操作信息、震动模式的标识和第一配置信息之间的映射关系,如表三所示。应用程序层可以根据用户对电子设备的界面的操作信息以及第三映射表,确定目标震动模式。在一种实施例中,第三映射表中可以包括震动模式的标识对应的震动模式的描述。
表三
Figure PCTCN2021117278-appb-000003
Figure PCTCN2021117278-appb-000004
在一种可能的实现方式中,电子设备的应用场景可以为电子设备所处的外界环境。可选的,电子设备所处的外界环境不同,目标震动模式不同。
可选的,应用程序层可以根据时间,确定电子设备所处的外界环境是夜晚还是白天。若是夜晚(如24点之后至6点之间),则目标震动模式可以为单马达震动。
可选的,应用程序层可以根据电子设备中的日程信息、票务信息、支付信息,确定电子设备所处的外界环境为观影环境、逛街环境、乘坐公交环境等。对于观影环境,如电子设备来电,则目标震动模式可以为单马达震动。对于观影环境,如电子设备来电,则目标震动模式可以为双马达震动。单马达震动的震感比双马达震动的震感弱,以便可以根据电子设备所处的外界环境,以贴合该环境的震动方式提示用户,提高用户体验。
可选的,应用程序层可以检测电子设备所处的外界环境中的噪声的分贝,若噪声的分贝大于预设分贝,则目标震动模式可以为双马达震动。若噪声的分贝小于或等于预设分贝,则目标震动模式可以为单马达震动。
应理解,上述目标震动模式中的“单马达震动”,以及“双马达震动”为示例说明,本申请实施例中还可以采用其他震动方式震动。
综上述,对于不同应用程序,可以预先设置有如上第一映射表、第二映射表和/或第三映射表,应用程序层可以根据电子设备的应用场景,确定目标震动模式。在一种实施例中,对于音视频播放类应用程序、游戏类应用程序,应用程序层中可以预先存储第一映射表。对于输入法应用程序,应用程序层中可以预先存储第二映射表和/或第三映射表。对于时钟应用程序,应用程序层中可以预先存储第三映射表。其中,第一映射表、第二映射表和第三映射表可以称为震动模式映射关系,该震动模式映射关系用于表征电子设备的应用场景、震动模式的标识和第一配置信息之间的映射关系。在一种实施例中,震动模式映射关系中还包括震动模式的标识对应的震动模式的描述。
在一种实施例中,应用程序层可以获取电子设备中的马达数量。其中,应用程序层可以在应用程序启动时获取马达数量。或者,应用程序层可以在应用程序安装后第一次启动时获取马达数量,且保存马达数量,以便应用程序在后续启动时应用程序层不用重复获取马达数量。或者,应用程序层可以在确定目标震动模式时获取马达数量。可选的,本申请实施例中,KIT层中可以包括查询马达数量的API,应用程序层可以调用该API查询获取马达数量。示例性的,API对应的函数为vibratorEx.getHwParameter(“vibratorNumOnChip”),应用程序层根据该函数可以得到马达数量。其中,引号中的信息表征马达的数量,如“”表示电子设备支持1颗马达,“sub:1”表示电子设备支持2颗马达,“sub2:2”表示电子设备支持3颗马达。其中,“”表示引号中为空字段。采用“”的目的是为了兼容没有这个函数的软件版本。
在一种实施例中,应用程序层可以获取电子设备中的马达是否支持线性马达,以获取马达的震动能力。其中,应用程序层可以在获取马达数量时获取马达是否支持线性马达。可选的,本申请实施例中,KIT层可以包括查询马达是否支持线性马达的API,应用程序层可以调用该API查询获取马达是否支持线性马达。示例性的,API对应的函数为“getHwParameter(vibrator Ex.HW_VIBRATOR_GRADE_VALUE)”,应用程序层可以调用该API查询电子设备中的马达是否支持线性马达。其中,当VALUE值为NULL时,表示马达不支持线性马达,当VALUE对应有具体数值时,表示马达支持线性马达。
S702,应用程序层根据目标震动模式和震动模式映射关系,确定目标震动模式的标识或第一目标配置信息。
应理解,目标震动模式不同,目标震动模式的标识不同,第一目标配置信息也不同。
在一种可能的实现方式中,应用程序层在确定目标震动模式后,可以根据震动模式映射关系中“震动模式与震动模式的标识的映射关系”,确定目标震动模式的标识。该目标震动模式的标识为震动模式映射关系中目标震动模式映射的震动模式的标识。示例性的,目标震动模式为过关奖励震动,则该目标震动模式对应的目标震动模式的标识为“2A”。
在一种实施例中,应用程序层在确定目标震动模式后,可以根据震动模式映射关系中“震动模式与第一配置信息的映射关系”,确定第一目标配置信息。该第一目标配置信息可以为震动模式映射关系中目标震动模式映射的第一配置信息。第一目标配置信息可以为目标字符串。示例性的,目标震动模式的标识为“2A”,则第一目标配置信息为“haptic.game_qmqz.pass_dual”。
在一种实施例中,对于后缀“rtol”、“ltor”、“left_l”、“Onlyl”、“right_r”或“Onlyr”的震动,震动具有方向性,也可以称为立体震动。应用程序层可以根据目标震动模式和震动模式映射关系,确定初始配置信息,进而根据电子设备的第一屏幕方向和初始配置信息,确定第一目标配置信息。应理解,第一屏幕方向和初始配置信息中的至少一个不同,第一目标配置信息不同。初始配置信息可以称为待确定的第一目标配置信息。其中,第一屏幕方向为电子设备的当前的屏幕方向。震动具有方向性可以理解为:震动从电子设备中的一个部分传递至另一部分。
示例性的,如目标震动模式为“过关奖励震动”,该目标震动模式映射的第一配置信息可以为初始配置信息“haptic.game_qmqz.pass_dual”,该初始配置信息中的后缀“dual”对应的震动不具有方向性。因此,应用程序层可以将该初始配置信息作为第一目标配置信息。
对于一个立体震动的界面的场景,震动具有方向性。示例性的,如界面的场景为“开启游戏震动”,可以配置有“haptic.game_qz.open_ltor”和“haptic.game_qz.open_rtol”两个字符串。该种场景下,应用程序层可以获取电子设备的第一屏幕方向,进而根据第一屏幕方向和初始配置信息,确定第一目标配置信息。示例性的,如第一屏幕方向为第二方向,则电子设备的左侧到右侧,即为预定义的左马达至右马达,即“ltor”。若第一屏幕方向为第四方向,则电子设备的左侧到右侧,即为预定义的右马达至左马达,即“rtol”。其中,若应用程序层确定电子设备的第一屏幕方向为第二方向,则可以根据初始配置信息,确定第一目标配置信息可以为“haptic.game_qz.open_ltor”。
在一种实施例中,若上述表一中的第一配置信息中不包括后缀“rtol”或“ltor”,如目标震动模式映射的初始配置信息为“haptic.game_qz.open”,则应用程序层可以根据第一屏幕方向,为该初始配置信息添加后缀,得到第一目标配置信息。如第一屏幕方向为第二方向,则应用程序层可以确定后缀为“ltor”,则可以得到第一目标配置信息为“haptic.game_qz.open_ltor”。
应理解,第一目标配置信息用于表征第一屏幕方向。如第一目标配置信息为“haptic.game_qz.open_ltor”,可以表征电子设备的左侧到右侧为“左马达到右马达”,以表征第一屏幕方向可以为第二方向。
在一种实施例中,当电子设备的第一应用场景为界面的场景,S702可以替换为:应用程序层根据界面的场景和震动模式映射关系,确定界面的场景的标识或第一目标配置信息。在该种实施例中,下述S703-S708中的“目标震动模式的标识”可以替换为“界面的场景的标识”。
S703,应用程序层向KIT层发送目标震动模式的标识或第一目标配置信息。
应用程序层在获取目标震动模式的标识后,可以向KIT层发送目标震动模式的标识。或 者,应用程序层在获取第一目标配置信息后,可以向KIT层发送第一目标配置信息。在一种可能的实现方式中,本申请实施例可以预先定义应用程序层获取目标震动模式的标识还是第一目标配置信息。示例性的,对于第一应用程序来说,可以预先定义第一应用程序对应目标震动模式的标识,则第一应用程序在运行时,应用程序层可以根据目标震动模式和震动模式映射关系,确定目标震动模式的标识,且向KIT层发送目标震动模式的标识。
在一种实施例中,S703可以替换为:应用程序层中的第一马达模块向KIT层中的马达接口发送目标震动模式的标识或第一目标配置信息。下述实施例中以KIT层表征KIT层中的马达接口进行说明。
S704,若KIT层接收到来自应用程序层的第一目标配置信息,则向应用程序框架层发送第一目标配置信息;若KIT层接收到来自应用程序层的目标震动模式的标识,则根据震动模式映射关系确定初始配置信息,且向应用程序框架层发送初始配置信息。
在一种可能的实现方式中,KIT层中可以不存储震动模式映射关系。其中,KIT层接收到来自应用程序层的第一目标配置信息,可以向应用程序框架层发送第一目标配置信息。
在一种可能的实现方式中,KIT层中存储有震动模式映射关系。其中,KIT层接收到来自应用程序层的目标震动模式的标识后,可以根据震动模式映射关系中目标震动模式的标识与第一配置信息的映射关系,确定目标震动模式的标识映射的初始配置信息,且向应用程序框架层发送初始配置信息。其中,初始配置信息可以为:震动模式映射关系中目标震动模式的标识映射的第一配置信息。应理解,目标震动模式的标识不同,初始配置信息不同。
示例性的,如目标震动模式的标识为“2A”,则初始配置信息可以为震动模式映射关系中“2A”对应的“haptic.game_qmqz.pass_dual”。如目标震动模式的标识为“11A”,则初始配置信息可以为“haptic.game_qz.open_ltor”和“haptic.game_qz.open_rtol”。
本申请实施例中,上述S704可以替换为:若KIT层接收到来自应用程序层的第一目标配置信息,则向应用程序框架层中的第二马达模块发送第一目标配置信息;若KIT层接收到来自应用程序层的目标震动模式的标识,则根据震动模式映射关系确定初始配置信息,且向应用程序框架层中的第二马达模块发送初始配置信息。应理解,第二马达模块可以为应用程序框架层中用于执行与马达震动相关的动作的模块。下述实施例中以应用程序框架层表征应用程序框架层中的第二马达模块为例进行说明。
S705,若应用程序框架层接收到来自KIT层的第一目标配置信息,则向硬件抽象层发送第一目标配置信息;若应用程序框架层接收到来自KIT层的初始配置信息,则根据电子设备的第一屏幕方向和初始配置信息,获取第一目标配置信息,且向硬件抽象层发送第一目标配置信息。
其中,若应用程序框架层接收到来自KIT层的第一目标配置信息,则应用程序框架层向硬件抽象层发送第一目标配置信息。若应用程序框架层接收到来自KIT层的初始配置信息,则应用程序框架层可以根据电子设备的第一屏幕方向和该初始配置信息,获取第一目标配置信息,且向硬件抽象层发送第一目标配置信息。第一屏幕方向和初始配置信息中的至少一个不同,第一目标配置信息不同。应注意,应用程序框架层根据第一屏幕方向和初始配置信息,获取第一目标配置信息的过程,可以参照上述S702中应用程序层获取第一目标配置信息的相关描述。在一种实施例中,应用程序框架层可以调用窗口服务或显示框架接口获取电子设备的第一屏幕方向。在一种实施例中,应用程序框架层可以调用KIT层中获取传感器的数据的API,以获取来自传感器的数据。应用程序框架层可以根据来自传感器数据,获取电子设备的屏幕方向。
在一种实施例中,S705可以替换为:若应用程序框架层接收到来自KIT层的第一目标配置信息,则向硬件抽象层中的马达库模块发送第一目标配置信息;若应用程序框架层接收到来自KIT层的初始配置信息,则根据电子设备的第一屏幕方向和初始配置信息,获取第一目标配置信息,且向硬件抽象层中的马达库模块发送第一目标配置信息。下述实施例中以硬件抽象层表征硬件抽象层中的马达库模块进行说明。
S706,硬件抽象层根据第一目标配置信息,获取第一目标配置文件,第一目标配置文件用于表征目标震动模式。
本申请实施例中,硬件抽象层可以预先存储多个第一配置文件,第一配置文件用于表征震动模式,第一配置文件用于使能内核层确定震动模式,第一配置文件可以为XML文件。第一目标配置信息不同,第一目标配置文件不同。第一目标配置文件用于表征目标震动模式,第一配置文件用于使能内核层确定目标震动模式,以生成目标震动模式对应的参数。
在一种可能的实现方式中,硬件抽象层在接收到第一目标配置信息后,可以在第一配置文件中进行字符串搜索,将包括第一目标配置信息的第一配置文件作为第一目标配置文件。示例性的,如界面的场景为“开启游戏震动”,如第一目标配置信息为“haptic.game_qz.open_ltor”,与该第一目标配置信息对应的第一目标配置文件如下所示:
<HAPTIC_EFFCT ID=〝302〞>
<NAME>haptic.game_qz.open_ltor_dualL</NAME>
<VALUE>0,30<VALUE>                 (1)
以及,
<HAPTIC_EFFCT ID=〝302〞>
<NAME>haptic.game_qz.open_ltor_dualR</NAME>
<VALUE>0,30<VALUE>                 (2)
示例性的,第一目标配置文件中(1)和(2)的第1行“<HAPTIC_EFFCT ID=〝302〞>”表征第一配置文件的标识,如编号。其中,ID中“302”中的“30”用于表征马达震动的震动模式,如30号震动模式。2用于表征以2档震动强度进行震动。应理解,本申请实施例中可以预先配置马达震动的震动模式与编号的映射关系(如下表四所示),以及档位与震动强度的映射关系。在一种实施例中,第一目标配置文件中可以包括马达震动的幅度、时间、强度等信息。应理解,如图4所示,马达震动的震动模式不同,震动模式的编号不同。
(1)和(2)中的第2行,如“<NAME>haptic.game_qz.open_ltor_dualL</NAME>”和<NAME>haptic.game_qz.open_ltor_dualR</NAME>,均包括第一目标配置信息“haptic.game_qz.open_ltor”,以及马达震动的震动方式“dualL”、“dualR”。其中,“dualL”表征双马达中的左马达的震动方式,“dualR”表征双马达中的右马达的震动方式。
(1)和(2)中的第3行“<VALUE>0,30<VALUE>”中的“0”可以表征震动开始的时间,“30”表征30号震动模式。上述(1)和(2)表征左马达和右马达均在第0s时,以30号震动模式震动。如上,(1)为使能左马达震动的第一目标配置文件,(2)为使能左马达震动的第一目标配置文件。在一种实施例中,硬件抽象层在接收到第一目标配置信息时,可以在第一配置文件中,查询字符串,同步获取左马达对应的第一目标配置文件(1),以及右马达分别对应的第一目标配置文件(2)。
表四
Figure PCTCN2021117278-appb-000005
Figure PCTCN2021117278-appb-000006
S707,硬件抽象层向内核层发送第一目标配置文件。
在一种实施例中,S707可以替换为:硬件抽象层中的马达库模块向内核层中的马达驱动发送第一目标配置文件。下述以内核层表征内核层中的马达驱动进行说明。
S708,内核层根据第一目标配置文件,获取目标震动模式对应的第一参数,并以第一参数驱动马达震动。
第一目标配置文件不同,目标震动模式不同,第一参数不同。第一参数用于驱动马达以目标震动模式震动。内核层接收到来自硬件抽象层的第一目标配置文件时,可以解析第一目标配置文件,得到目标震动模式。示例性的,内核层解析如上第一目标配置文件(1)和(2),可以得到目标震动模式为30号震动模式。在一种可能的实现方式中,内核层中可以存储有第四映射表,第四映射表用于表征震动模式和参数之间的映射关系。可选的,该第四映射表可以包括震动模式的标识和参数之间的映射关系。内核层可以根据第一目标配置文件,以及该第四映射表,获取目标震动模式对应的参数,即第一参数。示例性的,内核层可以根据30号震动模式以及第四映射表,获取30号震动模式对应的第一参数。应理解,因为30号震动模式为左马达和右马达震动,则内核层可以同步获取使能左马达震动的参数和右马达震动的参数。
在一种实施例中,内核层中可以存储预设数组以及采样频率。内核层可以根据采样频率在预设数组中采样,得到目标震动模式对应的数组,即第一参数。内核层以第一参数驱动马达震动。应理解,内核层驱动马达震动的其他原理可以参照现有技术的相关描述。
本申请实施例中根据电子设备不同的应用场景,采用单马达或者多马达以实现不同类型的震动,给用户带来更加多元化、更立体的震感,提高用户体验。
在一种实施例中,因为马达震动具有方向性,本申请实施例中可以在屏幕方向改变时,根据电子设备的第一应用场景,重新获取马达震动的配置信息和配置文件,进而改变马达震动的方向,以适配电子设备的屏幕方向。
一种可能的实现方式中,应用程序层可以检测电子设备的屏幕方向。若电子设备处于第一应用场景,且应用程序层检测到屏幕方向改变,电子设备可以执行如上S701-S708。应用 程序层重新确定且下发第一目标配置信息,进而硬件抽象层可以根据该第一目标配置信息,获取适配于屏幕方向的第一目标配置文件,进而使得内核层以正确的第一参数准确驱动马达震动。
一种可能的实现方式中,应用程序框架层可以检测屏幕方向。若电子设备处于第一应用场景,且应用程序层检测到屏幕方向改变,应用程序框架层可以根据屏幕方向,修改第一目标配置信息。进而硬件抽象层可以基于修改后的第一目标配置信息,获取适配于屏幕方向的第一目标配置文件,进而使得内核层以正确的第一参数准确驱动马达震动。
示例性的,当屏幕方向为第二方向,且界面的场景为“脚步声震动,左侧来人”时,目标震动模式为左马达震动,则第一目标配置文件中的<NAME>行可以为“haptic.game_qz.left_l_OnlyL”,表示只有马达2震动,如图8中的a所示。当屏幕方向从第二方向切换至第四方向时,界面的场景未改变,但由于马达的位置相对于界面的场景发生改变,第四方向时电子设备的左侧为马达1,而马达1为预定义的右马达,则第一目标配置文件中的<NAME>行可以为变成“haptic.game_qz.right_r_OnlyR”,表示只有马达1震动,如图8中的b所示。如此示例,电子设备的屏幕方向改变,界面的场景均为“脚步声震动,左侧来人”时,用户感受到的均为电子设备的左侧的马达震动,贴合用户的感受。
本申请实施例中可以根据屏幕方向的改变,适配电子设备的第一应用场景,使得马达震动更能贴合用户的感受。应理解,本申请实施例的图示中以多个波浪线表征马达震动,波浪线的长短表征马达震动的强度的强弱。其中,波浪线越长表征马达震动的强度越强,波浪线越短表征马达震动的强度越弱。靠近电子设备的波浪线至远离电子设备的波浪线的方向上,波浪线长短的变化可以表征马达震动的强度的变化。
应理解,图8所示的屏幕方向发生改变时的震动模式也适用于如下界面的场景:如界面上左侧的炸弹***、界面上的人物的左脸被打、人物的左侧受伤等。
本申请实施例中,若屏幕方向发生改变,应用程序层可以重新确定且下发第一目标配置信息,或者由应用程序框架层根据屏幕方向修改第一目标配置信息,均可以使得硬件抽象层获取适配于屏幕方向的第一目标配置文件,进而达到内核层以正确的第一参数准确驱动马达震动,适配电子设备的第一应用场景,提高用户体验。
下面结合电子设备的具体的第一应用场景,对本申请实施例的震动方法进行说明。应理解,在第一应用场景中电子设备的震动模式为示例说明。
场景一:电子设备的第一应用场景为界面的场景。本申请实施例中以界面的场景为“开启游戏的场景”,以“开启游戏的场景”对应的目标震动模式为“震动从左侧过渡到右侧”,且以屏幕方向从第二方向切换至第四方向为例进行说明。
本申请实施例的震动方法可以包括:
S901,应用程序层根据开启游戏的场景,确定目标震动模式。
其中,界面的游戏场景不同,目标震动模式可以不同。在一种实施例中,至少部分不同界面的游戏场景对应不同的目标震动模式,也可以部分不同界面的游戏场景对应相同的目标震动模式。
S902,应用程序层根据目标震动模式和震动模式映射关系,确定目标震动模式的标识或第一目标配置信息,且向KIT层发送目标震动模式的标识或第一目标配置信息。
其中,应用程序层根据目标震动模式和震动模式映射关系,可以确定目标震动模式的标识为11A。若第一屏幕方向为第二方向,则应用程序层根据第一屏幕方向确定第一目标配置 信息为“haptic.game_qz.open_ltor”。
在一种实施例中,S901和S902可以替换为:应用程序层根据开启游戏的场景,确定界面的场景的标识或第一目标配置信息,且向KIT层发送界面的场景的标识或第一目标配置信息。在该种实施例中,下述S903-S912、S907A中的“目标震动模式的标识”可以替换为“界面的场景的标识”。
S903,若KIT层接收到来自应用程序层的第一目标配置信息,则向应用程序框架层发送第一目标配置信息;若KIT层接收到来自应用程序层的目标震动模式的标识,则根据震动模式映射关系确定初始配置信息,且向应用程序框架层发送初始配置信息。
若KIT层接收到来自应用程序层的第一目标配置信息“haptic.game_qz.open_ltor”,则向应用程序框架层发送第一目标配置信息“haptic.game_qz.open_ltor”。若KIT层接收到来自应用程序层的目标震动模式的标识11A,则根据震动模式映射关系确定初始配置信息“haptic.game_qz.open_ltor”和“haptic.game_qz.open_rtol”,或者“haptic.game_qz.open”,且向应用程序框架层发送初始配置信息。下述以初始配置信息为“haptic.game_qz.open”为例进行说明。
S904,若应用程序框架层接收到来自KIT层的第一目标配置信息,则向硬件抽象层发送第一目标配置信息;若应用程序框架层接收到来自KIT层的初始配置信息,则根据电子设备的第一屏幕方向和初始配置信息,获取第一目标配置信息,且向硬件抽象层发送第一目标配置信息。
若应用程序框架层接收到来自KIT层的第一目标配置信息“haptic.game_qz.open_ltor”,则向硬件抽象层发送第一目标配置信息“haptic.game_qz.open_ltor”。若应用程序框架层接收到来自KIT层的初始配置信息“haptic.game_qz.open”,则应用程序框架层根据第二方向和初始配置信息“haptic.game_qz.open”,获取第一目标配置信息“haptic.game_qz.open_ltor”,且向硬件抽象层发送第一目标配置信息“haptic.game_qz.open_ltor”。
S905,硬件抽象层根据第一目标配置信息,获取第一目标配置文件,且向内核层发送第一目标配置文件。
其中,硬件抽象层在第一配置文件中,可以根据第一目标配置信息,确定包含有第一目标配置信息“haptic.game_qz.open_ltor”的第一目标配置文件。第一目标配置文件用于表征第一震动模式,第一配置文件用于使能内核层确定第一震动模式,生成第一震动模式对应的第一参数。第一目标配置文件可如下(3)和(4)所示:
<HAPTIC_EFFCT ID=〝21〞>
<NAME>haptic.game_qz.open_ltor_dualL</NAME>
<VALUE>0,2<VALUE>                     (3)
<HAPTIC_EFFCT ID=〝21〞>
<NAME>haptic.game_qz.open_ltor_dualR</NAME>
<VALUE>0,2<VALUE>                     (4)
(3)和(4)表征目标震动模式是双马达震动,且震动从左侧过渡到右侧,电子设备的左侧的马达的震动强度从强变弱,右侧的马达的震动强度从弱变强,给用户带来震动从左侧过渡到右侧的感受。当第一屏幕方向为第二方向时,震动从左侧过渡到右侧表征的是“马达2的震动强度从强变弱,马达1的震动强度从弱变强”。本申请实施例中,硬件抽象层在接收到第一配置信息时,可以查询字符串,同步获取左马达(第一马达)的第一目标配置文件和右马达(第二马达)的第一目标配置文件。
S906,内核层根据第一目标配置文件,生成目标震动模式对应的第一参数,并以第一参 数驱动马达震动。
应理解,为了与下述的第二目标配置文件指示的目标震动模式进行区分,此处以第一目标配置文件指示的目标震动模式为第一震动模式,以第二目标配置文件指示的目标震动模式为第二震动模式进行说明。
内核层根据第一震动模式,以及第四映射表,获取第一震动模式对应的第一参数。第一配置文件不同,第一震动模式不同。内核层可以以第一参数驱动马达以第一震动模式震动。其中,第一参数不同,第一震动模式不同。
第一参数用于驱动第一马达以第一波形震动,以及第二马达以第二波形震动。在一种实施例中,内核层根据如上第一目标配置文件(3)和(4),可以获取第一参数,第一参数可以包括第一子参数和第二子参数。其中,内核层以第一子参数驱动第一马达以第一波形震动,内核层以第二子参数驱动第二马达以第二波形震动。也就是说,内核层可以根据第一目标参数,同步获取使能第一马达震动的第一子参数,以及使能第二马达震动的第二子参数。
示例性的,第一波形可以如图9中的a所示的L的波形,第二波形可以如图9中的a所示的R的波形。第一波形用于表征第一马达的震动强度从强变弱,第二波形用于表征第二马达的震动强度从弱变强。应理解,图9中的a和b中的L和R表征电子设备的实际方位的左侧和右侧。其中,第一马达以第一波形震动可以理解为:第一马达震动,震动的波形为第一波形。第二马达以第二波形震动可以理解为:第二马达震动,震动的波形为第二波形。其中,图9中的a表示“震动从左侧过渡到右侧”,左马达的震动强度从强变弱,右马达的震动强度从弱变强。即第一马达的震动强度从强变弱,第二马达的震动强度从弱变强。
示例性的,图9中的a所示的波形图对应的震动示意图如图9中的c所示,当屏幕方向为第二方向,界面的场景为开启游戏(拳击游戏)的场景时,马达2的震动强度从强变弱,马达1的震动强度从弱变强,给用户带来震动从左侧过渡到右侧的立体震动。应理解,图9中的c所示的马达的震动模式为第一震动模式,第一震动模式为马达2的震动强度从强变弱,马达1的震动强度从弱变强。
S907,若应用程序层检测到屏幕方向从第一屏幕方向切换至第二屏幕方向,则根据开启游戏的场景,确定目标震动模式。
在一种实施例中,响应于第二操作,电子设备的屏幕方向从第一屏幕方向切换至第二屏幕方向。可选的,第二操作可以为用户的操作。用户的操作如用户旋转电子设备。本申请实施例中以第一屏幕方向为第二方向,第二屏幕方向为第四方向为例进行说明。
S908,应用程序层根据目标震动模式和震动模式映射关系,确定目标震动模式的标识为11A,且向KIT层发送11A;或者,应用程序层根据目标震动模式和震动模式映射关系,确定第二目标配置信息为haptic.game_qz.open_rtol,且向KIT层发送第二目标配置信息haptic.game_qz.open_rtol。
其中,因为屏幕方向从第二方向切换至第四方向,则预定义的左马达和右马达相对于电子屏幕的左和右也发生变化。在第四方向时,“从左侧过渡到右侧”为马达1震动至马达2,因为马达2为预定义的左马达,马达1为预定义的右马达,对应的,是右马达震动至左马达。应用程序层可以重新生成第二目标配置信息为haptic.game_qz.open_rtol,且向KIT层发送第二目标配置信息haptic.game_qz.open_rtol。
haptic.game_qz.open_rtol表征目标震动模式为在第四方向时,马达的震动是从左侧过渡到右侧,用户感受到的仍是从左侧震动到右侧。这样,马达的震动可以根据屏幕的旋转进行自适应调整,以便在屏幕旋转时,都能适配用户的感受。
S909,若KIT层接收到来自应用程序层的第二目标配置信息haptic.game_qz.open_rtol,则向应用程序框架层发送第二目标配置信息haptic.game_qz.open_rtol;若KIT层接收到来自应用程序层的目标震动模式的标识11A,则根据震动模式映射关系确定初始配置信息haptic.game_qz.open,且向应用程序框架层发送初始配置信息haptic.game_qz.open。
S910,若应用程序框架层接收来自KIT层的第二目标配置信息haptic.game_qz.open_rtol,则向硬件抽象层发送第二目标配置信息haptic.game_qz.open_rtol;若应用程序框架层接收来自KIT层的初始配置信息haptic.game_qz.open,则根据第二屏幕方向和初始配置信息haptic.game_qz.open,得到第二目标配置信息haptic.game_qz.open_rtol,且向硬件抽象层发送第二目标配置信息haptic.game_qz.open_rtol。
S911,硬件抽象层根据第二目标配置信息,获取第二目标配置文件,且向内核层发送第二目标配置文件。
与上述S905相同的,硬件抽象层在第一配置文件中,可以根据第一目标配置信息,确定包含有第一目标配置信息“haptic.game_qz.open_rtol”的第二目标配置文件。在一种实施例中,第一应用场景和第二屏幕方向中的至少一个不同时,第二目标配置信息不同,第二目标配置文件不同。第二目标配置文件用于表征第二震动模式,第一配置文件用于使能内核层确定第二震动模式,生成第二震动模式对应的第二参数。第二目标配置文件可如下(5)和(6)所示:
<HAPTIC_EFFCT ID=〝21〞>
<NAME>haptic.game_qz.open_rtol_dualL</NAME>
<VALUE>0,2<VALUE>                    (5)
<HAPTIC_EFFCT ID=〝21〞>
<NAME>haptic.game_qz.open_rtol_dualR</NAME>
<VALUE>0,2<VALUE>                    (6)
这样,马达的震动可以根据屏幕的旋转进行自适应调整,以便在屏幕旋转时,都能适配用户的感受。因为(5)和(6)分别为左马达和右马达分别对应的第二目标配置文件,本申请实施例中,硬件抽象层可以根据第二目标配置信息,同步获取左马达的第二目标配置文件和右马达的第二目标配置文件。
S912,内核层根据第二目标配置文件,生成目标震动模式对应第二参数,并以第二参数驱动马达震动。
内核层根据第二目标配置文件指示的第二震动模式,以及第四映射表,获取第二震动模式对应的第二参数。第二配置文件不同,第二震动模式不同。内核层可以以第二参数驱动马达以第二震动模式震动。其中,第二参数不同,第二震动模式不同。第二震动模式可以与第一震动模式相同或不同。
下述图9中以第二震动模式可以与第一震动模式不同为例进行说明。其中,第二震动模式可以与第一震动模式不同可以体现为:第三波形与第四波形中的至少一个与第一波形不同,和/或第三波形与第四波形中的至少一个与第二波形不同。
第二参数用于驱动第一马达以第三波形震动,以及第二马达以第四波形震动。在一种实施例中,内核层根据如上第二目标配置文件(5)和(6),可以生成第二参数,第二参数可以包括第三子参数和第四子参数。其中,内核层以第三子参数驱动第一马达以第三波形震动,内核层以第四子参数驱动第二马达以第四波形震动。也就是说,内核层可以根据第二目标参数,同步获取使能第一马达震动的第三子参数,以及使能第二马达震动的第四子参数。
示例性的,第三波形可以如图9中的b所示的R的波形,第四波形可以如图9中的b所示的L的波形。第三波形用于表征第一马达的震动强度从弱变强,第四波形用于表征第二马达的震动强度从强变弱。其中,第一马达以第三波形震动可以理解为:第一马达震动,震动的波形为第三波形。第二马达以第四波形震动可以理解为:第二马达震动,震动的波形为第四波形。
其中,图9中的b表示“震动从左侧过渡到右侧”,右马达的震动强度从强变弱,左马达的震动强度从弱变强。即第二马达的震动强度从强变弱,第一马达的震动强度从弱变强。示例性的,图9中的b所示的波形图对应的震动示意图如图9中的d所示,当屏幕方向从第二方向切换至第四方向,且界面的场景为开启游戏的场景时,马达1的震动强度从强变弱,马达2的震动强度从弱变强,同样可以给用户带来震动从左侧过渡到右侧的立体震动。应理解,图9中的d所示的马达的震动模式为第二震动模式,第二震动模式为马达1的震动强度从强变弱,马达2的震动强度从弱变强。图9中的d的马达的第二震动模式,与图9中的c的马达的第一震动模式不同。在该种实施例中,电子设备显示的界面可以随着屏幕方向的改变而进行调整,其中,参照图9中的c和d所示,当电子设备的屏幕方向从第二方向切换至第四方向时,电子设备显示的界面可以适配于屏幕方向进行调整,使得用户可以观看到正向的界面,本申请实施例对电子设备显示的界面跟随电子设备的屏幕方向进行调整的方法不做赘述。
在电子设备的界面的场景为同一场景时,屏幕方向发生切换,第二震动模式与第一震动模式不同。为了使得电子设备处于同一界面的场景下,给用户带来相同的震动感受,本申请实施例中的第一波形可以与第四波形相同,第二波形可以与第三波形相同。如上图9中的a和b所示,第一马达的第一波形和第二马达的第四波形相同,第一马达的第三波形和第二马达的第二波形相同,可以在“开启游戏的场景”下,带给用户相同的“震动从左侧过渡到右侧”震动感受。
在一种可能的实现方式中,因为应用程序框架层也可以检测电子设备的屏幕方向,因此上述S907-S910可以替换为S907A。应理解,在S907A之后,可以执行上述S911和S912。
S907A,若应用程序框架层检测到屏幕方向从第一屏幕方向切换至第二屏幕方向,则根据第二屏幕方向,将第一目标配置信息修改为第二目标配置信息,向硬件抽象层发送第二目标配置信息。
第二屏幕方向不同,第二目标配置信息不同。示例性的,如上述第一屏幕方向(第二方向)时的第一目标配置信息为haptic.game_qz.open_ltor,而目前的第二屏幕方向(第四方向)时的左马达和右马达相对于电子设备的左和右发生180度转变。如第二方向时ltor表征的左马达到右马达,在第四方向左马达至右马达变为rtol。因此,应用程序框架层可以根据第二屏幕方向,将第一目标配置信息修改为第二目标配置信息“haptic.game_qz.open_rtol”。
同理的,如图10中的a所示,电子设备的屏幕方向为第二方向时,界面的场景为车辆从左侧开向右侧,该界面的场景对应的目标震动模式为“震动从左侧过渡到右侧”,则图10中的a对应的震动如马达2的震动强度从强变弱,马达1的震动强度从弱变强。其中第一目标配置信息可以为“haptic.game_qz.car_ltor”。当电子设备的屏幕方向切换至第四方向,如图10中的b所示。图10中的b对应的震动如马达1的震动强度从强变弱,马达2的震动强度从弱变强,其中的第二目标配置信息可以修改为“haptic.game_qz.car_rtol”。这样的震动可以将用户的视觉和触觉结合,给用户带来立体震动效果,使用户拥有沉浸式体验。
应理解,场景一中以马达震动从左侧过渡到右侧为例说明了屏幕旋转前后,马达以不同的震动模式震动。与该场景一类似的,屏幕旋转前后,马达以不同的震动模式震动可以理解 为两个马达的震动方式不同。示例性的,可以包括左马达震动(如图8所示)、右马达震动、左马达和右马达交替震动、马达震动从右侧过渡到左侧、双马达震动但左马达和右马达的震动强度或震动的类型不同。
在一种实施例中,响应于第一操作,界面的场景从“开启游戏的场景”变为“受到攻击的场景”,该第一操作可以为电子设备内部的处理器下发的显示“受到攻击的场景”的指令。当应用程序层检测到界面的场景从图9中的d所示的“开启游戏的场景”变为图9中的e所示的“受到攻击的场景”时,应用程序层可以根据“受到攻击的场景”,确定目标震动模式为双马达震动,具体为双马达同时以相同的震动强度震动相同的时间。因为该目标震动模式不具有方向性,因此应用程序层可以将震动模式映射关系中目标震动模式的标识对应的第一配置信息作为第一目标配置信息。在一种可能的实现方式中,若震动模式映射关系中的第一配置信息中不包括后缀,则应用程序框架层可以根据如上图7中的相关描述获取第一目标配置信息。
其中,应用程序层根据目标震动模式和震动模式映射关系,确定目标震动模式的标识为6A,或第一目标配置信息为haptic.game_qmqz.Shoot2_dual,且向KIT层发送目标震动模式的标识6A或第一目标配置信息haptic.game_qmqz.Shoot2_dual。若KIT层接收到来自应用程序层的第一目标配置信息haptic.game_qmqz.Shoot2_dual,则向应用程序框架层发送第一目标配置信息haptic.game_qmqz.Shoot2_dual。若KIT层接收到来自应用程序层的目标震动模式的标识6A,则根据震动模式映射关系确定第一目标配置信息haptic.game_qmqz.Shoot2_dual,且向应用程序框架层发送初始配置信息haptic.game_qmqz.Shoot2_dual。应用程序框架层可以根据第一屏幕方向和初始配置信息haptic.game_qmqz.Shoot2_dual,确定该初始配置信息为第一目标配置信息,且向内核层发送第一目标配置信息haptic.game_qmqz.Shoot2_dual。内核层可以将包含有第一目标配置信息的第一配置文件作为第一目标配置文件。
该实施例中的应用程序层、KIT层、应用程序框架层、硬件抽象层以及内核层执行的操作可以参照上述实施例的相关描述。
“受到攻击的场景”对应的第一目标配置文件可以如下(7)和(8)所示:
<HAPTIC_EFFCT ID=〝12〞>
<NAME>haptic.game_qmqz.Shoot2_dualL</NAME>
<VALUE>0,1<VALUE>                (7)
<HAPTIC_EFFCT ID=〝12〞>
<NAME>haptic.game_qmqz.Shoot2_dualR</NAME>
<VALUE>0,1<VALUE>                (8)
应理解,“受到攻击的场景”中第一目标配置文件用于指示第一震动模式,该第一震动模式的标识为1。第一震动模式为左马达和右马达在第0s时以1号震动模式进行震动,1号特效表征马达1和马达2同时震动且震动3ms。可以想到的是,该第一震动模式下,第一马达震动的第一波形与第二马达震动的第二波形相同。
示例性的,如图9中的e所示,马达1和马达2同时震动且震动3ms。其中,若在双马达震动的过程中,电子设备的屏幕方向从第四方向切换至第二方向,因为该种目标震动模式中双马达是同时震动的,震动没有方向性,即没有左右震动的差别。第二方向时对应的第二目标配置信息也可以为haptic.game_qmqz.Shoot2_dual。因此,如图9中的f所示,马达以第二震动模式震动。第二震动模式为在第0s时马达1和马达2可以同时震动3ms。第二震动模式与第一震动模式相同。可以想到的是,该第二震动模式下,第一马达震动的第三波形与第 二马达震动的第四波形相同,且第一波形和第三波形相同。应理解,图9中的e和f中,马达1和马达2的震动强度相同。图中采用相同长度的波浪线表征马达1和马达2的震动强度相同。
场景二:电子设备的第一应用场景为用户对电子设备的界面的操作。本申请实施例中先以应用程序为时钟应用程序为例说明。图11中的a为闹钟的编辑界面,该编辑界面上包括时间的滚轮选择区域1101、闹钟类型的选择区域1102。其中,用户可以在滚轮选择区域1101中上滑或者下滑以选择时间。闹钟类型的选择区域1102可以包括闹钟的“重复”设置选项、闹钟的铃声选项、闹钟的响铃时长选项、以及闹钟的再响间隔选项。本申请实施例中以用户在选择闹钟的时间时马达震动为例进行说明。
其中,当用户在时间的滚轮选择区域1101中执行上滑操作时,震动的类型可以为双马达震动(从下侧过渡到上侧)。当用户在时间的滚轮选择区域1101中执行下滑操作时,震动的类型为双马达震动(从上侧过渡到下侧)。下面结合上述震动方法对该场景二进行说明,震动方法可以包括:
S1301,应用程序层根据用户的操作信息,确定目标震动模式。
用户的操作信息可以包括用户的操作位置和/或操作动作。示例性的,如用户的操作动作是滑动,用户的操作位置如图11中a的位置x至位置y,则可以确定用户的操作为从下至上滑动。应用程序层根据用户的操作信息以及震动模式映射关系,确定目标震动模式为双马达震动(从下侧过渡到上侧),即从左马达震动至右马达。
S1302,应用程序层根据目标震动模式和震动模式映射关系,确定目标震动模式的标识为或第一目标配置信息,且向KIT层发送目标震动模式的标识或第一目标配置信息。
其中,应用程序层根据目标震动模式和震动模式映射关系,可以确定目标震动模式的标识为3C。应理解,电子设备下端的马达为预定义的左马达,上马达为预定义的右马达。若第一屏幕方向为第一方向,则从下往上(即左马达至右马达),第一屏幕方向可以由“ltor”表示。相对应的,当屏幕方向为第三方向,则从下往上为右马达至左马达,屏幕方向可以由“rtol”表示。本申请实施例中,应用程序层根据第一屏幕方向确定第一目标配置信息为“haptic.clock1_ltor”。
S1303,若KIT层接收到来自应用程序层的第一目标配置信息haptic.clock1_ltor,则向应用程序框架层发送第一目标配置信息haptic.clock1_ltor;若KIT层接收到来自应用程序层的目标震动模式的标识3C,则根据震动模式映射关系则根据震动模式映射关系确定初始配置信息haptic.clock1,且向应用程序框架层发送初始配置信息haptic.clock1。
S1304,若应用程序框架层接收到来自KIT层的第一目标配置信息haptic.clock1_ltor,则向硬件抽象层发送第一目标配置信息haptic.clock1_ltor;若应用程序框架层接收到来自KIT层的初始配置信息haptic.clock1,则根据电子设备的第一屏幕方向和初始配置信息haptic.clock1,获取第一目标配置信息haptic.clock1_ltor,且向硬件抽象层发送第一目标配置信息haptic.clock1_ltor。
S1305,硬件抽象层根据第一目标配置信息,获取第一目标配置文件,且向内核层发送第一目标配置文件。
其中,硬件抽象层在第一配置文件中,可以根据第一目标配置信息,确定包括第一目标配置信息的待确定的第一目标配置文件。第一目标配置文件可以如下(9)和(10)所示:
<HAPTIC_EFFCT ID=〝33〞>
<NAME>haptic.clock1_ltor_dualL</NAME>
<VALUE>0,3<VALUE>                  (9)
<HAPTIC_EFFCT ID=〝33〞>
<NAME>haptic.clock1_ltor_dualR</NAME>
<VALUE>0,3<VALUE>                  (10)
若第一屏幕方向为第一方向,电子设备的下端为马达2,即左马达,电子设备的上端为马达1,即右马达。根据如上第一目标配置文件可以确定从电子设备的左马达震动至右马达,即实现震动从下侧过渡到上侧。
S1306,内核层根据第一目标配置文件,生成目标震动模式对应的第一参数,并以第一参数驱动马达震动。
示例性的,图11中的a,当用户在时间的滚轮选择区域1101中执行上滑操作时,目标震动模式为第一震动模式,第一震动模式为:左马达的震动从强变弱,右马达的震动从弱变强。
在一种实施例中,若图11中的a的屏幕方向从第一方向切换至第三方向,当用户在时间的滚轮选择区域1101中执行上滑操作时,第二目标配置信息可以为“haptic.clock1_rtol”,对应的第二震动模式如图11中的b所示。第二震动模式为:右马达的震动从强变弱,左马达的震动从弱变强。
本申请实施例中再以应用程序为输入法应用程序为例对震动方法进行说明,震动方法可以包括:
S1401,应用程序层根据用户的操作信息,确定目标震动模式。
用户的操作信息可以为用户的操作位置。示例性的,用户点击输入法中的键盘中的控件时,应用程序层可以根据用户的操作位置,确定靠近用户的操作位置的马达震动。本申请实施例中预先划分靠近马达2的区域和靠近马达1的区域。如图12中a中的虚线将屏幕划分成两个区域,马达2所属的区域为靠近马达2的区域,马达1所属的区域为靠近马达1的区域。
如图12中a所示,电子设备的第一屏幕方向为第一方向,键盘位于电子设备的界面的下方,用户采用输入法搜索信息时,用户点击输入法中的键盘中的控件的位置均落入靠近马达2的区域中。也就是说,用户在键盘中的操作位置均靠近马达2,应用程序层可以用户的操作位置,确定目标震动模式为马达2(左马达)震动。
S1402,应用程序层根据目标震动模式和震动模式映射关系,确定目标震动模式的标识为2C,或第一目标配置信息为haptic.shurufa_ltor,且向KIT层发送目标震动模式的标识2C或第一目标配置信息haptic.shurufa_ltor。
在一种实施例中,电子设备的屏幕方向为第一方向或第三方向时,第一目标配置信息中可以不携带后缀“ltor”或“rtol”。
S1403,若KIT层接收到来自应用程序层的第一目标配置信息haptic.shurufa_ltor,则向应用程序框架层发送第一目标配置信息haptic.shurufa_ltor;若KIT层接收到来自应用程序层的目标震动模式的标识2C,则根据震动模式映射关系确定初始目标配置信息haptic.shurufa,且向应用程序框架层发送初始目标配置信息haptic.shurufa。
S1404,若应用程序框架层接收到来自KIT层的第一目标配置信息,则向硬件抽象层发送第一目标配置信息haptic.shurufa_ltor;若应用程序框架层接收到来自KIT层的初始配置信息haptic.shurufa,则根据电子设备的第一屏幕方向和初始配置信息,获取第一目标配置信息haptic.shurufa_ltor,且向硬件抽象层发送第一目标配置信息。
S1405,硬件抽象层根据第一目标配置信息,获取第一目标配置文件,且向内核层发送第一目标配置文件。
第一目标配置信息为haptic.shurufa_ltor,硬件抽象层在第一配置文件中,可以根据第一目标配置信息,确定包含有第一目标配置信息“haptic.shurufa_ltor”的第一目标配置文件如下:
<HAPTIC_EFFCT ID=〝45〞>
<NAME>haptic.shurufa_ltor_OnlyL</NAME>
<VALUE>0,4<VALUE>
第一目标配置文件表征左马达在第0s时以4号震动模式、5档震动强度震动。
S1405,内核层根据第一目标配置文件,生成目标震动模式对应的第一参数,并以第一参数驱动马达震动。
示例性的,如图12中的a所示,屏幕方向为第一方向,用户点击输入法中的键盘中的控件的位置均靠近马达2,则用户点击输入法中的键盘中的控件时,目标震动模式为第一震动模式,第一震动模式为马达2震动。
在一种实施例中,若图12中的a的屏幕方向从第一方向切换至第三方向,如图12中的b所示,用户点击输入法中的键盘中的控件的位置均靠近马达1,用户应用程序框架层可以获取第二目标配置信息“haptic.shurufa_rtol”,第二目标配置文件中的<NAME>行为“haptic.shurufa_rtol_OnlyR”,表征第一震动模式为马达1震动。
在一种实施例中,若屏幕方向从第三方向切换至第二方向,如图12中的c所示。应用程序层可以根据用户点击输入法中的键盘中的控件的位置,确定第二震动模式。示例性的,如图12中的c所示,用户点击虚线以左的控件时,用户的操作位置靠近左马达,则第二震动模式为左马达(马达2)震动,第二目标配置文件中的<NAME>行为“haptic.shurufa_rtol_OnlyL”。如图12中的d所示,当用户点击虚线以右的控件时,用户的操作位置靠近右马达,则第二震动模式为右马达(马达1)震动,第二目标配置文件中的<NAME>行为“haptic.shurufa_rtol_OnlyR”。如图12中的e所示,当用户点击虚线位置覆盖的控件时,目标第二震动模式为双马达(马达1和马达2)震动,第二目标配置文件中的<NAME>行为“haptic.shurufa_rtol_dual”。
场景三:电子设备的第一应用场景可以为跟随音乐震动。
本申请实施例中以电子设备中包括两个喇叭,分别设置在电子设备的两端为例进行说明,如图13中的a所示。示例性的,音频为左声道时,喇叭1输出音频。音频为右声道时,喇叭2输出音频。音频为双声道时,喇叭1和喇叭2输出音频。可以理解的是,音频可以为多声道,电子设备上也可以包括至少三个喇叭。当音频为多声道时,至少三个喇叭可以输出音频。
下面结合上述震动方法对该场景三进行说明,震动方法可以包括:
S1701,应用程序层根据音频的声道,确定目标震动模式。
应用程序层获取音频的声道的方式可以参照上述实施例的相关描述。本申请实施例中,音频为右声道时,喇叭1输出音频,则目标震动模式为靠近喇叭1的马达1震动。音频为左声道时,喇叭2输出音频,则目标震动模式为靠近喇叭2的马达2震动。音频为双声道时,喇叭1和喇叭2输出音频,则目标震动模式为马达1和马达2同时震动。
下面以屏幕方向为第一方向、音频为右声道、喇叭1输出音频为例进行说明。
S1702,应用程序层根据目标震动模式和震动模式映射关系,确定目标震动模式的标识,或第一目标配置信息为haptic.music1_ltor,且向KIT层发送目标震动模式的标识或第一目标 配置信息haptic.music1._ltor。
S1703,若KIT层接收到来自应用程序层的第一目标配置信息haptic.music1_ltor,则向应用程序框架层发送第一目标配置信息haptic.music1_ltor;若KIT层接收到来自应用程序层的目标震动模式的标识,则根据震动模式映射关系确定初始配置信息haptic.music1,且向应用程序框架层发送初始配置信息haptic.music1。
S1704,若应用程序框架层接收到来自KIT层的第一目标配置信息haptic.music1_ltor,则向硬件抽象层发送第一目标配置信息haptic.music1_ltor;若应用程序框架层接收到来自KIT层的初始配置信息haptic.music1,则根据电子设备的第一屏幕方向和初始配置信息,获取第一目标配置信息haptic.music1_ltor,且向硬件抽象层发送第一目标配置信息haptic.music1._ltor。
S1705,硬件抽象层根据第一目标配置信息,获取第一目标配置文件,且向内核层发送第一目标配置文件。
其中,硬件抽象层在第一配置文件中,可以根据第一目标配置信息,确定包含有第一目标配置信息“haptic.music1_ltor”的第一目标配置文件。第一目标配置文件可如下所示:
<HAPTIC_EFFCT ID=〝4003〞>
<NAME>haptic.music1_ltor_OnlyR</NAME>
<VALUE>0,400<VALUE>
第一目标配置文件表征音频为右声道时,右马达震动在第0s时以400号特效震动。
S1706,内核层根据第一目标配置文件,生成目标震动模式对应的第一参数,并以第一参数驱动马达震动。
示例性的,如图13中的a所示,当音频为右声道,喇叭1输出音频“啦啦啦”,马达1震动。
本申请实施例中,当音频的声道发生变化时,应用程序层可以根据如上S1701-S1706,重新获取第二目标配置信息。如当音频的声道从右声道变成左声道,则第一目标配置信息可以从“haptic.music1_ltor”变成“haptic.music2_ltor”。music2表征左声道,music1表征右声道。相应的,第一目标配置文件中的<NAME>行从“haptic.music1_ltor_OnlyR”可以变成第二目标配置文件中的“haptic.music2_ltor_OnlyL”。如图13中的b所示,当音频为左声道时,喇叭2输出音频“哈哈哈”,马达2震动。
因为音频的声道变化很快,为了减小时延,本申请实施例中,应用程序框架层可以根据音频的声道,将第一目标配置信息haptic.music1_ltor修改为第二目标配置信息haptic.music2_ltor,进而也可以实现硬件抽象层获取第二目标配置文件中的<NAME>行为“haptic.music2_ltor_OnlyL”,实现如图13中的b中所示的震动。应用程序框架层获取音频的声道的过程可以参照上述S701的相关描述。
在一种可能的实现方式中,当音频的声道从左声道变成双声道时,第一目标配置文件中的<NAME>行从“haptic.music2_ltor_OnlyL”可以变成“haptic.music12_ltor_dual”,该“haptic.music12_ltor_dual”用于表示双马达同时震动,music12表征双声道。如图13中的c所示,当音频为双声道,喇叭1和喇叭2输出音频“春天好美丽”,马达1和马达2震动。
在一种实施例中,应用程序层或应用程序框架层可以上述图13所示的实施例的基础上,若检测到检测屏幕方向改变,可以修改目标配置信息,进而实现电子设备可以根据屏幕方向和音频的声道的变化而震动的目的。其中,应用程序层或应用程序框架层检测屏幕方向改变时修改目标配置信息可以参照上述的相关描述。
在一种实施例中,当电子设备播放音频时,电子设备的界面可以显示该音频对应的视频,该种场景为电子设备播放音乐短片(music video,MV)、音乐会等。在该种实施例中,音频的声道和马达的震动可以随着电子设备的屏幕方向变化而改变,下述结合图14对该种实施例进行说明。
当电子设备的屏幕方向为第二方向时,图14中的a所示的为电子设备播放音乐会的场景,电子设备的界面的左侧为鼓,右侧为电子琴。其中,鼓的音频为左声道,喇叭2可以输出鼓的音频,电子琴的音频为右声道,喇叭1可以输出电子琴的音频。本申请实施例中,当电子设备播放鼓的音频时,喇叭2输出鼓的音频,且马达2震动,如图14中的a所示。当电子设备播放电子琴的音频时,喇叭1输出电子琴的音频,且马达1震动,如图14中的b所示。当电子设备播放电子琴和鼓的音频时,喇叭1输出电子琴的音频,喇叭2输出鼓的音频,且马达1和马达2震动,如图14中的c所示。应理解,图14中的a、b和c中的实施方式可以参照上述S1701-S1706,在此不做赘述。
当电子设备从第一屏幕方向切换至第二屏幕方向,如电子设备从第二方向切换至第四方向,电子设备的界面的左侧仍为鼓,右侧仍为电子琴。但是电子设备中的马达和喇叭相对于电子设备的左和右的位置发生了改变。为了使得用户感受到如图14的a、b和c中相同的震动和音频,本申请实施例中可以在电子设备输出鼓的音频时,将鼓的音频从左声道改变为右声道,进而由喇叭1输出鼓的音频,且马达1震动,如图14中的d所示。当电子设备输出电子琴的音频时,将电子琴的音频从右声道改变为左声道,进而由喇叭2输出鼓的音频,且马达2震动,如图14中的e所示。同理的,当电子设备播放电子琴和鼓的音频时,喇叭1输出鼓的音频,喇叭2输出电子琴的音频,且马达1和马达2震动,如图14中的f所示。该种实施例中,屏幕方向的改变,用户仍感可以感受到的相同的震动体验和音频体验,提高了用户体验。
在一种可能的实现方式中,电子设备的第一应用场景可以为界面的场景,界面的场景为如图14所示的音乐会场景。本申请实施例中可以预先设置该界面的场景对应的目标震动模式。应用程序层、KIT层、应用程序框架层、硬件抽象层以及内核层的动作可以参照上述实施例中的描述,进而实现电子设备的屏幕方向改变时,马达震动的震动模式改变,也可以参照图13所示的示例,在此不做赘述。
在一种可能的实现方式中,对于屏幕方向改变时,电子设备改变音频的声道。具体可以为:应用程序层或应用程序框架层检测到屏幕方向改变时,可以修改音频的声道,进而实现如上图14中屏幕方向改变时,音频的声道改变的目的。
本申请实施例中,应用程序层或应用程序框架层可以检测屏幕方向改变,进而修改目标配置信息,且修改音频的声道,以实现电子设备可以根据屏幕方向的变化而改变震动模式,根据音频的声道的变化而改变音频输出的目的,可以提高用户体验。
场景四:电子设备的第一应用场景可以为电子设备的屏幕方向。本申请实施例,以输入法应用程序为例进行说明。示例性的,当用户点击输入法中的键盘的控件时,电子设备可以结合屏幕方向进行震动反馈。
下面结合上述震动方法对该场景四进行说明,震动方法可以包括:
S1801,应用程序层检测到用户的操作动作时,根据屏幕方向,确定目标震动模式。
在一种实施例中,如电子设备为竖屏时,目标震动模式可以为主马达震动。当电子设备为横屏时,为了增加震感,可以采用双马达震动。下面以电子设备为竖屏为例进行说明。
S1802,应用程序层根据目标震动模式和震动模式映射关系,确定目标震动模式的标识1B,或第一目标配置信息为haptic.shurufa3_ltor,且向KIT层发送目标震动模式的标识1B或第一目标配置信息haptic.shurufa3_ltor。
S1803,若KIT层接收到来自应用程序层的第一目标配置信息haptic.shurufa3_ltor,则向应用程序框架层发送第一目标配置信息haptic.shurufa3_ltor;若KIT层接收到来自应用程序层的目标震动模式的标识1B,则根据震动模式映射关系确定初始配置信息haptic.shurufa3,且向应用程序框架层发送初始配置信息haptic.shurufa3。
S1804,若应用程序框架层接收到来自KIT层的第一目标配置信息haptic.shurufa3_ltor,则向硬件抽象层发送第一目标配置信息haptic.shurufa3_ltor;若应用程序框架层接收到来自KIT层的初始配置信息haptic.shurufa3,则根据电子设备的第一屏幕方向和初始配置信息,获取第一目标配置信息haptic.shurufa3_ltor,且向硬件抽象层发送第一目标配置信息haptic.shurufa3_ltor。
S1805,硬件抽象层根据第一目标配置信息,获取第一目标配置文件,且向内核层发送第一目标配置文件。
其中,硬件抽象层在第一配置文件中,可以根据第一目标配置信息,确定包含有第一目标配置信息“haptic.shurufa3_ltor”的第一目标配置文件如下所示:
<HAPTIC_EFFCT ID=〝205〞>
<NAME>haptic.shurufa3_ltor_main</NAME>
<VALUE>0,20<VALUE>
第一目标配置文件表征输入法应用程序中,电子设备为竖屏时,主马达(马达2)在第0s时以20号特效震动。
S1805,内核层根据第一目标配置文件,生成目标震动模式对应的第一参数,并以第一参数驱动马达震动。
示例性的,如图15中的a所示,当屏幕方向为第一方向时,用户点击键盘中的控件,目标震动模式为第一震动模式,第一震动模式为马达2震动。
本申请实施例中,当屏幕方向从第一方向切换至第二方向时,屏幕方向为横屏时,第二震动模式为两个马达一起震动。如图15中的b所示,当用户点击键盘中的控件时,双马达震动,即马达1和马达2震动。
场景五:电子设备的第一应用场景可以为播放音频的场景。
在该种场景中,不同的音频可以对应不同的目标震动模式,不同的音频可以以音频的标识进行区分。第一配置文件中预先配置包括不同标识的音频对应的配置文件。电子设备可以依据上述S701-S708实现音频播放时马达的震动。应理解,应用程序层或应用程序框架层下发至硬件抽象层的第一配置信息中可以包括音频的标识,以使硬件抽象层根据音频的标识,获取音频对应的第一目标配置文件。
示例性的,如音频A的目标震动模式为“左边马达第1s震动,第2s不震动,第3s震动,右边马达第1s不震动,第2s震动,第3s震动”。对应的,第一目标配置文件中的haptic_music1_xxx_dualL中的震动<VALUE>序列为(0,1000,2000,1000),在haptic_music1_xxx_dualR中震动<VALUE>序列为(1000,1000,2000,1000)。据此,内核层根据第一目标配置文件可以实现“左边马达第1s震动,第2s不震动,第3s震动,右边马达第1s不震动,第2s震动,第3s震动”的震动效果。应理解,该场景中电子设备中的应用程序 层、KIT层、应用程序框架层、硬件抽象层以及内核层的动作可以参照上述实施例中的描述。
场景六:电子设备的第一应用场景为电子设备所处的外界环境。
如图16中的a所示,若电子设备所处的外界环境为观影环境,噪声的分贝小于或等于预设分贝,则目标震动模式可以为马达1震动。如图16中的b所示,电子设备所处的外界环境从观影环境变为用户乘坐公交的环境,噪声的分贝大于预设分贝,则目标震动模式可以为马达1和马达2震动。应理解,该场景中电子设备中的应用程序层、KIT层、应用程序框架层、硬件抽象层以及内核层的动作可以参照上述实施例中的描述。
下面对本申请实施例中适用的第一应用场景(包括应用程序)以表五为例进行说明:
表五
Figure PCTCN2021117278-appb-000007
其中,应用程序层可以检测电子设备的第一应用场景,以使得马达采用对应的震动模式震动,具体实现过程可以参照上述实施例中的相关描述。
下述对本申请实施例提供的震动方法在产线测试时的测试过程进行简要说明:
在一种实施例中,当电子设备中设置一个马达时,可以对该马达进行校准测试、功能测试和老化测试。
一、校准测试。校准测试用于对马达是否能够启动、是否能够返回马达个数等进行测试。参照图17中的a所示,本申请实施例中,测试设备可以向待测试的电子设备(下述称为电子设备)发送校准启动命令,以启动马达。电子设备接收到该校准启动命令,可以向测试设备反馈检查返回值。示例性的,可以电子设备启动F0扫频,以获取检查返回值。其中,返回值 1表示马达启动成功,返回值0表示马达启动失败。在一种实施例中,测试设备可以调用校准EEC3指令,具体为调用SetHwParameter(mmi_vibrator_calib_on)函数向电子设备发送校准启动命令。应理解,F0扫频的预设流程或代码可以存储在非易失性存储器(non-volatile memory,NVRAM)中,以便电子设备可以对马达进行校准测试。
参照图17中的a所示,测试设备向电子设备发送校准查询命令,以获取马达的个数。电子设备接收到该校准查询命令,可以向测试设备反馈检查返回值。其中,返回值1表示查询成功,返回值0表示查询失败。查询成功表征电子设备中有一个马达。在一种实施例中,测试设备可以调用校准EEC3指令,具体为调用get.HwParameter(vibratorNUMOnChip)函数向电子设备发送校准启动命令。
二、功能测试。功能测试用于对马达的震动功能进行测试,以确定马达是否能够按照预设震动模式震动。参照图18中的a所示,测试设备向电子设备发送功能测试启动命令,以测试马达的震动功能。电子设备接收到该功能测试启动命令,可以驱动马达按照预设震动模式进行震动。在一种实施例中,测试设备向电子设备发送FF84指令,以指示电子设备启动震动功能测试。图中的原生震动可以理解为:电子设备可以调用get.SystemService(Content.VIBRATOR_SERVICE)函数驱动马达按照预设震动模式进行震动。预设震动模式可以为10s震动,间隔2s震动1s后停止震动。
在一种可能的实现方式中,测试人员也可以手动按压马达对应的启动按键,驱动马达按照预设震动模式进行震动。
三、老化测试。老化测试用于测试一直处于震动时的马达的老化的性能,比如获取马达的震动时长,以确定马达可用的时长。参照图19中的a所示,电子设备可以驱动马达进行原生震动,如电子设备可以调用get.SystemService(Content.VIBRATOR_SERVICE)函数驱动马达按照预设震动模式进行震动,以获取马达的震动时长。
在一种实施例中,当电子设备中包括至少两个马达时,可以对至少两个马达进行校准测试、功能测试和老化测试。与上述测试不同的是,因为电子设备中的马达不止一个,因此可以预先对每个马达进行编号。在测试时,测试设备可以在测试命令中携带马达的编号,以对对应编号的马达执行测试。示例性的,马达可以编号是ID为1、ID为2、ID为3……,以此类推。
一、校准测试。参照图17中的b所示,本申请实施例中,测试设备向电子设备发送校准启动命令,以启动马达。与图17中的a不同的是,测试设备可以调用校准EEC3(ID)指令,具体为调用SetHwParameter(mmi_vibrator_calib_on,ID)函数向电子设备发送校准启动命令,应注意的是,函数中包括马达的ID,以使得电子设备确定待测试的马达为该ID对应的马达。图17的b中以函数如“SetHwParameter(mmi_vibrator_calib_on,1)”,“SetHwParameter(mmi_vibrator_calib_on,2)”为例进行说明,表征测试设备向电子设备请求对ID为1、ID为2的马达进行校准测试。
同理的,参照图17中的b所示,测试设备向电子设备发送校准查询命令,以获取马达的个数。测试设备可以调用校准EEC3(ID)指令,具体为调用get.HwParameter(vibratorNUMOnChip)函数向电子设备发送校准启动命令。其中,返回值3表示查询成功,返回值为其他值表示查询失败。本申请实施例中采用返回值3,是为了避免了与马达的ID重复,可以想到的是,返回值也可以是其他自定义的值。
二、功能测试。参照图18中的b所示,测试设备向电子设备发送功能测试启动命令,如FF84(ID)指令。该FF84(ID)指令中可以包括马达的ID,以使电子设备对对应ID的马达 进行震动功能的测试。电子设备接收到该FF84(ID)指令,可以驱动马达按照预设震动模式进行震动。在一种实施例中,电子设备可以驱动主马达(如马达2)进行原生震动,驱动副马达(马达1)进行特效震动。图中的特效震动可以理解为:电子设备可以调用mVibratorEx.set.HwParameter函数驱动马达按照预设震动模式进行震动。
在一种可能的实现方式中,测试人员也可以手动按压马达对应的启动按键,驱动主马达和/或副马达按照预设震动模式进行震动。
三、老化测试。参照图19中的b所示,电子设备可以驱动主马达进行原生震动,如电子设备可以调用get.SystemService(Content.VIBRATOR_SERVICE)函数驱动主马达按照预设震动模式进行震动,以获取主马达可用的震动时长。电子设备可以驱动副马达进行特效震动,如电子设备可以调用mVibratorEx.set.HwParameter函数驱动副马达按照预设震动模式进行震动,以获取副马达可用的震动时长。
在一种实施例中,本申请实施例提供的电子设备可以包括:处理器(例如CPU)、存储器和至少两个马达。存储器可能包含高速随机存取存储器(random-access memory,RAM),也可能还包括非易失性存储器(non-volatile memory,NVM),例如至少一个磁盘存储器,存储器中可以存储各种指令,以用于完成各种处理功能以及实现本申请的方法步骤。至少两个马达,用于执行上述实施例中震动动作。可选的,本申请涉及的电子设备还可以包括:电源、通信总线以及通信端口。上述通信端口用于实现电子设备与其他外设之间进行连接通信。在本申请实施例中,存储器用于存储计算机可执行程序代码,程序代码包括指令;当处理器执行指令时,指令使电子设备的处理器执行上述方法实施例中除了震动动作之外的动作,其实现原理和技术效果类似,在此不再赘述。
需要说明的是,以上这些模块可以是被配置成实施以上方法的一个或多个集成电路,例如:一个或多个专用集成电路(application specific integrated circuit,ASIC),或,一个或多个微处理器(digital signal processor,DSP),或,一个或者多个现场可编程门阵列(field programmable gate array,FPGA)等。再如,当以上某个模块通过处理元件调度程序代码的形式实现时,该处理元件可以是通用处理器,例如中央处理器(central processing unit,CPU)或其它可以调用程序代码的处理器。再如,这些模块可以集成在一起,以片上***(system-on-a-chip,SOC)的形式实现。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本申请实施例的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。
本申请实施例中的术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。本申请实施例的说明书和权利要求书中的术语“第一”和“第二”等是用于区别不同的对象, 而不是用于描述对象的特定顺序。例如,第一目标对象和第二目标对象等是用于区别不同的目标对象,而不是用于描述目标对象的特定顺序。在本申请实施例中,“示例性的”或者“例如”等表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。在本申请实施例的描述中,除非另有说明,“多个”的含义是指两个或两个以上。例如,多个处理单元是指两个或两个以上的处理单元;多个***是指两个或两个以上的***。
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。

Claims (24)

  1. 一种震动方法,其特征在于,包括:
    响应于第一操作,电子设备进入第一应用场景,所述电子设备包括至少两个马达;
    响应于所述电子设备进入所述第一应用场景,且所述电子设备的屏幕方向为第一屏幕方向,所述至少两个马达以第一震动模式震动;
    响应于第二操作,所述电子设备的屏幕方向从所述第一屏幕方向切换至第二屏幕方向,所述至少两个马达以第二震动模式震动,所述第一震动模式与所述第二震动模式不同。
  2. 根据权利要求1所述的方法,其特征在于,所述电子设备的屏幕方向从所述第一屏幕方向切换至第二屏幕方向之后,还包括:
    所述电子设备显示的界面跟随所述电子设备的屏幕方向进行调整。
  3. 根据权利要求1或2所述的方法,其特征在于,所述电子设备的屏幕方向从所述第一屏幕方向切换至第二屏幕方向之后,还包括:
    所述电子设备播放的音频的声道跟随所述电子设备的屏幕方向改变。
  4. 根据权利要求1-3中任一项所述的方法,其特征在于,所述方法还包括:
    响应于所述第二操作,所述电子设备的屏幕方向从所述第一屏幕方向切换至所述第二屏幕方向,所述电子设备显示的界面未跟随所述电子设备的屏幕方向进行调整,所述至少两个马达以所述第一震动模式震动。
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,所述至少两个马达包括第一马达和第二马达,所述至少两个马达以第一震动模式震动,包括:
    所述第一马达以第一波形震动,所述第二马达以第二波形震动;
    所述至少两个马达以第二震动模式震动,包括:
    所述第一马达以第三波形震动,所述第二马达以第四波形震动,其中,所述第三波形与所述第四波形中的至少一个与所述第一波形不同,和/或,所述第三波形与所述第四波形中的至少一个与所述第二波形不同。
  6. 根据权利要求5所述的方法,其特征在于,所述第一波形和所述第四波形相同,所述第二波形与所述第三波形相同。
  7. 根据权利要求6所述的方法,其特征在于,所述第一波形用于表征所述第一马达的震动强度从强变弱,所述第二波形用于表征所述第二马达的震动强度从弱变强。
  8. 根据权利要求5-7中任一项所述的方法,其特征在于,所述第一马达和所述第二马达在所述电子设备中的位置不同。
  9. 根据权利要求5-8中任一项所述的方法,其特征在于,所述至少两个马达以第一震动模式震动之前,还包括:
    生成第一参数,所述第一参数用于驱动所述第一马达以所述第一波形震动,以及所述第二马达以所述第二波形震动;
    所述至少两个马达以第二震动模式震动之前,还包括:
    生成第二参数,所述第二参数用于驱动所述第一马达以所述第三波形震动,以及所述第二马达以所述第四波形震动。
  10. 根据权利要求9所述的方法,其特征在于,所述生成第一参数之前,还包括:
    生成第一目标配置文件,所述第一目标配置文件用于指示所述第一震动模式;
    所述生成第二参数之前,还包括:
    生成第二目标配置文件,所述第二目标配置文件用于指示所述第二震动模式。
  11. 根据权利要求10所述的方法,其特征在于,
    所述第一应用场景和所述第一屏幕方向中的至少一个不同时,所述第一目标配置文件不同;以及,
    所述第一应用场景和所述第二屏幕方向中的至少一个不同时,所述第二目标配置文件不同。
  12. 根据权利要求11所述的方法,其特征在于,所述生成第一目标配置文件,包括:
    根据所述第一应用场景、所述第一屏幕方向,以及震动模式映射关系,获取第一目标配置信息,所述震动模式映射关系用于表征所述电子设备的应用场景和第一配置信息的映射关系,所述第一目标配置信息用于表征所述第一屏幕方向;
    将包含有所述第一目标配置信息的第一配置文件作为所述第一目标配置文件。
  13. 根据权利要求12所述的方法,其特征在于,所述生成第二目标配置文件,包括:
    获取第二目标配置信息,所述第二目标配置信息用于表征所述第二屏幕方向;
    将包含有所述第二目标配置信息的第一配置文件作为所述第二目标配置文件。
  14. 根据权利要求13所述的方法,其特征在于,所述获取第二目标配置信息,包括:
    根据所述第一应用场景、所述第二屏幕方向,以及所述震动模式映射关系,获取所述第二目标配置信息;或者,
    根据所述第二屏幕方向,将所述第一目标配置信息修改为所述第二目标配置信息。
  15. 根据权利要求1-14中任一项所述的方法,其特征在于,所述第一应用场景包括以下场景中的至少一个:所述电子设备显示的界面的场景、跟随音乐震动的场景、播放音频的场景、用户对所述电子设备的界面的操作的场景或所述电子设备所处的外界环境。
  16. 根据权利要求12所述的方法,其特征在于,所述电子设备包括第一层、第二层、第三层和第四层;
    所述根据所述第一应用场景、所述第一屏幕方向,以及震动模式映射关系,获取第一目标配置信息,包括:
    所述第一层根据所述第一应用场景、所述第一屏幕方向,以及所述震动模式映射关系,获取所述第一目标配置信息;
    所述将包含有所述第一目标配置信息的第一配置文件作为所述第一目标配置文件,包括:
    所述第一层通过所述第二层、所述第三层向所述第四层发送所述第一目标配置信息;
    所述第四层将包含有所述第一目标配置信息的第一配置文件作为所述第一目标配置文件。
  17. 根据权利要求12所述的方法,其特征在于,
    所述第一应用场景不同,目标震动模式的标识不同,所述目标震动模式为所述第一震动模式或所述第二震动模式;以及,
    所述目标震动模式的标识不同,初始配置信息不同,所述初始配置信息为待确定的第一目标配置信息。
  18. 根据权利要求17所述的方法,其特征在于,所述电子设备包括第一层、第二层、第三层和第四层;
    所述根据所述第一应用场景、所述第一屏幕方向,以及震动模式映射关系,获取第一目标配置信息,包括:
    所述第一层根据所述第一应用场景和所述震动模式映射关系,获取所述目标震动模式的标识,所述震动模式映射关系还用于表征所述电子设备的应用场景和震动模式的标识的映射 关系;
    所述第一层向所述第二层发送所述目标震动模式的标识;
    所述第二层根据所述目标震动模式的标识和所述震动模式映射关系,获取所述初始配置信息,所述初始配置信息为:所述震动模式映射关系中所述目标震动模式的标识映射的第一配置信息;
    所述第二层向所述第三层发送所述初始配置信息;
    所述第三层根据所述第一屏幕方向和所述初始配置信息,获取所述第一目标配置信息;
    所述将包含有所述第一目标配置信息的第一配置文件作为所述第一目标配置文件,包括:
    所述第三层向所述第四层发送所述第一目标配置信息;
    所述第四层将包含有所述第一目标配置信息的第一配置文件作为所述第一目标配置文件。
  19. 根据权利要求16或18所述的方法,其特征在于,
    所述第一目标配置文件不同,所述第一参数不同;以及,
    所述第二目标配置文件不同,所述第二参数不同。
  20. 根据权利要求19所述的方法,其特征在于,所述电子设备包括第五层;所述生成第一参数,包括:
    所述第四层向所述第五层发送所述第一目标配置文件;
    所述第五层根据所述第一目标配置文件,生成所述第一参数;
    所述生成第二参数,包括:
    所述第四层向所述第五层发送所述第二目标配置文件;
    所述第五层根据所述第一目标配置文件,生成所述第二参数。
  21. 根据权利要求20所述的方法,其特征在于,所述第一参数包括第一子参数和第二子参数,所述第二参数包括第三子参数和第四子参数;所述生成所述第一参数之后,还包括:
    所述第五层以所述第一子参数驱动所述第一马达以所述第一波形震动,所述第五层以所述第二子参数驱动所述第二马达以所述第二波形震动;
    所述生成所述第二参数之后,还包括:
    所述第五层以所述第三子参数驱动所述第一马达以所述第三波形震动,所述第五层以所述第四子参数驱动所述第二马达以所述第四波形震动。
  22. 一种电子设备,其特征在于,所述电子设备包括至少两个马达,所述电子设备用于:
    响应于第一操作,所述电子设备进入第一应用场景;
    响应于所述电子设备进入所述第一应用场景,且所述电子设备的屏幕方向为第一屏幕方向,所述至少两个马达以第一震动模式震动;
    响应于第二操作,所述电子设备的屏幕方向从所述第一屏幕方向切换至第二屏幕方向;
    所述至少两个马达以第二震动模式震动,所述第一震动模式与所述第二震动模式不同。
  23. 一种计算机可读存储介质,其特征在于,所述计算机存储介质存储有计算机指令,当所述计算机指令被计算机执行时,使得所述计算机执行权利要求1-21中任一项所述的方法。
  24. 一种计算机程序产品,包括计算机程序或指令,其特征在于,所述计算机程序或指令被处理器执行时,实现权利要求1-21中任一项所述的方法。
PCT/CN2021/117278 2020-12-15 2021-09-08 震动方法、装置、电子设备和可读存储介质 WO2022127211A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP21854861.8A EP4044569A4 (en) 2020-12-15 2021-09-08 VIBRATION METHOD AND APPARATUS AND ELECTRONIC DEVICE AND READABLE STORAGE MEDIA
US17/787,544 US20230251714A1 (en) 2020-12-15 2021-09-08 Vibration method and apparatus, electronic device, and readable storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011475685.7 2020-12-15
CN202011475685.7A CN114640742A (zh) 2020-12-15 2020-12-15 震动方法、装置、电子设备和可读存储介质

Publications (1)

Publication Number Publication Date
WO2022127211A1 true WO2022127211A1 (zh) 2022-06-23

Family

ID=81325478

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/117278 WO2022127211A1 (zh) 2020-12-15 2021-09-08 震动方法、装置、电子设备和可读存储介质

Country Status (4)

Country Link
US (1) US20230251714A1 (zh)
EP (1) EP4044569A4 (zh)
CN (1) CN114640742A (zh)
WO (1) WO2022127211A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116659782B (zh) * 2022-11-22 2023-12-12 荣耀终端有限公司 马达测试方法和设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140135074A1 (en) * 2011-07-06 2014-05-15 Nec Casio Mobile Communications, Ltd. Notifying Devices, Notifying Methods, and Programs
CN108153419A (zh) * 2017-12-25 2018-06-12 联想(北京)有限公司 一种电子设备和控制方法
CN109120190A (zh) * 2018-08-01 2019-01-01 瑞声科技(新加坡)有限公司 一种马达驱动方法、移动终端以及计算机可读存储介质
CN110121008A (zh) * 2019-05-21 2019-08-13 Oppo广东移动通信有限公司 振动方法、终端及存储介质
CN111443815A (zh) * 2020-04-22 2020-07-24 维沃移动通信有限公司 一种振动提醒方法及电子设备

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20110074333A (ko) * 2009-12-24 2011-06-30 삼성전자주식회사 휴대 단말의 진동 발생 방법 및 장치
CN103869949B (zh) * 2012-12-14 2017-06-27 联想(北京)有限公司 一种控制振动的方法及电子设备
CN109213319A (zh) * 2018-08-04 2019-01-15 瑞声科技(新加坡)有限公司 基于场景的振动反馈方法及移动终端
WO2020037611A1 (zh) * 2018-08-23 2020-02-27 华为技术有限公司 通知消息的处理方法及电子设备
CN110244838A (zh) * 2019-05-09 2019-09-17 瑞声科技(新加坡)有限公司 一种马达驱动信号的生成方法、电子设备及存储介质
CN110465080A (zh) * 2019-07-25 2019-11-19 维沃移动通信有限公司 控制振动的方法、装置、移动终端及计算机可读存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140135074A1 (en) * 2011-07-06 2014-05-15 Nec Casio Mobile Communications, Ltd. Notifying Devices, Notifying Methods, and Programs
CN108153419A (zh) * 2017-12-25 2018-06-12 联想(北京)有限公司 一种电子设备和控制方法
CN109120190A (zh) * 2018-08-01 2019-01-01 瑞声科技(新加坡)有限公司 一种马达驱动方法、移动终端以及计算机可读存储介质
CN110121008A (zh) * 2019-05-21 2019-08-13 Oppo广东移动通信有限公司 振动方法、终端及存储介质
CN111443815A (zh) * 2020-04-22 2020-07-24 维沃移动通信有限公司 一种振动提醒方法及电子设备

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4044569A4

Also Published As

Publication number Publication date
EP4044569A4 (en) 2022-11-16
EP4044569A1 (en) 2022-08-17
US20230251714A1 (en) 2023-08-10
CN114640742A (zh) 2022-06-17

Similar Documents

Publication Publication Date Title
RU2766255C1 (ru) Способ голосового управления и электронное устройство
CN112231025B (zh) Ui组件显示的方法及电子设备
CN115473957B (zh) 一种图像处理方法和电子设备
CN111724775B (zh) 一种语音交互方法及电子设备
WO2020063605A1 (zh) 一种生成截图的方法、控制方法及电子设备
WO2022160991A1 (zh) 权限控制方法和电子设备
CN114124980B (zh) 一种启动应用的方法、设备、***、终端及存储介质
CN114995715B (zh) 悬浮球的控制方法和相关装置
CN114089932A (zh) 多屏显示方法、装置、终端设备及存储介质
CN113641271A (zh) 应用窗口的管理方法、终端设备及计算机可读存储介质
WO2022127211A1 (zh) 震动方法、装置、电子设备和可读存储介质
CN115378302A (zh) 线性马达的控制方法、装置、设备及可读存储介质
CN114650330A (zh) 一种添加操作序列的方法、电子设备和***
CN114444000A (zh) 页面布局文件的生成方法、装置、电子设备以及可读存储介质
CN114844984B (zh) 通知消息的提醒方法及电子设备
CN113380240B (zh) 语音交互方法和电子设备
WO2022062902A1 (zh) 一种文件传输方法和电子设备
WO2022033355A1 (zh) 一种邮件处理方法及电子设备
WO2022078116A1 (zh) 笔刷效果图生成方法、图像编辑方法、设备和存储介质
WO2022052962A1 (zh) 应用模块启动方法和电子设备
CN115641867A (zh) 语音处理方法和终端设备
CN115373957A (zh) 杀应用的方法及设备
CN113867851A (zh) 电子设备操作引导信息录制方法、获取方法和终端设备
CN115242547B (zh) 一种远程协助的***、方法和电子设备
WO2022206709A1 (zh) 应用程序的组件加载方法及相关装置

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2021854861

Country of ref document: EP

Effective date: 20220217

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21854861

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE