Movatterモバイル変換


[0]ホーム

URL:


CN103593217B - A kind of hook key adjusting earphone starts method and the terminal of application order - Google Patents

A kind of hook key adjusting earphone starts method and the terminal of application order
Download PDF

Info

Publication number
CN103593217B
CN103593217BCN201310611136.1ACN201310611136ACN103593217BCN 103593217 BCN103593217 BCN 103593217BCN 201310611136 ACN201310611136 ACN 201310611136ACN 103593217 BCN103593217 BCN 103593217B
Authority
CN
China
Prior art keywords
earphone
priority
hook
broadcast
order
Prior art date
Legal status (The legal status 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 status listed.)
Expired - Fee Related
Application number
CN201310611136.1A
Other languages
Chinese (zh)
Other versions
CN103593217A (en
Inventor
张寅祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
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 Guangdong Oppo Mobile Telecommunications Corp LtdfiledCriticalGuangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201310611136.1ApriorityCriticalpatent/CN103593217B/en
Publication of CN103593217ApublicationCriticalpatent/CN103593217A/en
Application grantedgrantedCritical
Publication of CN103593217BpublicationCriticalpatent/CN103593217B/en
Expired - Fee Relatedlegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Landscapes

Abstract

Translated fromChinese

本发明公开了一种调整耳机的hook键启动应用次序的方法及终端,该方法包括:在AudioService模块扩展一个新的API接口;查找系统中所有注册在AndroidManifest.xml配置文件中的静态广播接收者,找出所有的注册了android.intent.action.MEDIA_BUTTON广播的广播接收者所对应的APK程序;通过API接口对APK程序接收处理耳机hook事件的优先级次序进行重新排序,使优先级最高的APK程序被耳机的hook键默认为最先启动的应用程序。本发明避免了多个支持耳机的hook键快速启动的应用之间产生混乱,用户可以指定某个应用优先接收处理耳机hook事件。

The invention discloses a method and a terminal for adjusting the order of starting an application by a hook key of an earphone. The method includes: expanding a new API interface in the AudioService module; searching for all static broadcast receivers registered in the AndroidManifest.xml configuration file in the system , find out all the APK programs corresponding to the broadcast receivers that have registered the android.intent.action.MEDIA_BUTTON broadcast; through the API interface, reorder the priority order of the APK program receiving and processing the earphone hook event, so that the APK with the highest priority The program is defaulted to be the first application launched by the headset's hook button. The invention avoids confusion among multiple applications that support the quick start of the earphone hook key, and the user can designate a certain application to receive and process the earphone hook event preferentially.

Description

Translated fromChinese
一种调整耳机的hook键启动应用次序的方法及终端A method and terminal for adjusting the order of starting applications by hook keys of earphones

技术领域technical field

本发明涉及通信终端技术领域,更具体地说,是涉及一种调整耳机的hook键启动应用次序的方法及终端。The present invention relates to the technical field of communication terminals, and more specifically, relates to a method and a terminal for adjusting the order of starting applications by a hook key of an earphone.

背景技术Background technique

Android平台对耳机hook的管理,是通过有序广播来处理的:Intent.ACTION_MEDIA_BUTTON即android.intent.action.MEDIA_BUTTON。应用程序通过在AndroidManifest.xml配置文件里注册对应android.intent.action.MEDIA_BUTTON的广播接收者,即receiver,就可达到被耳机的hook键快速启动的目的。The Android platform manages the earphone hook through orderly broadcasting: Intent.ACTION_MEDIA_BUTTON is android.intent.action.MEDIA_BUTTON. By registering the broadcast receiver corresponding to android.intent.action.MEDIA_BUTTON in the AndroidManifest.xml configuration file, that is, the receiver, the application can achieve the purpose of being quickly started by the hook button of the headset.

正是由于Android平台允许通过耳机的hook键快速启动应用,导致目前几乎所有的播放器都有这个功能,如果从单个播放器功能来看,是非常完美的体验,但是,如果Android终端用户安装了多个支持耳机的hook键快速启动的应用时,就会给带来以下问题:It is precisely because the Android platform allows the application to be quickly launched through the hook button of the headset, so that almost all players currently have this function. From the perspective of a single player function, it is a perfect experience. However, if the Android terminal user installs the When there are multiple applications that support the quick start of the headset's hook button, it will cause the following problems:

(1)同时启动了多个应用,当然,该情况比较少见,一般应用会独享该hook事件;(1) Multiple applications are launched at the same time. Of course, this situation is relatively rare, and the general application will exclusively enjoy the hook event;

(2)快速启动的应用不是用户想要,即用户无法指定。(2) The application to be quickly launched is not what the user wants, that is, the user cannot specify it.

发明内容Contents of the invention

本发明的目的在于克服现有技术中的上述缺陷,提供一种调整耳机的hook键启动应用次序的方法及终端,避免了多个支持耳机的hook键快速启动的应用之间产生混乱,使用户可以指定某个应用优先收到耳机hook事件。The purpose of the present invention is to overcome the above-mentioned defects in the prior art, provide a method and a terminal for adjusting the application sequence of the hook key of the earphone to start, avoid confusion among multiple applications that support the quick start of the hook key of the earphone, and make the user You can specify an application to receive headset hook events first.

为实现上述目的,本发明提供的技术方案如下:一种调整耳机的hook键启动应用次序的方法,其包括以下步骤:In order to achieve the above object, the technical solution provided by the present invention is as follows: a method for adjusting the hook key of the earphone to start the application sequence, which includes the following steps:

在Android系统的AudioService模块里扩展一个新的用于支持重新定义耳机hook广播的优先级的API接口;Expand a new API interface to support redefining the priority of headphone hook broadcasting in the AudioService module of the Android system;

查找系统中所有注册在AndroidManifest.xml配置文件中的静态广播接收者,找出所有的注册了android.intent.action.MEDIA_BUTTON广播的广播接收者所对应的APK程序;Find all the static broadcast receivers registered in the AndroidManifest.xml configuration file in the system, and find out the APK programs corresponding to all the broadcast receivers registered with the android.intent.action.MEDIA_BUTTON broadcast;

通过所述API接口对所述APK程序接收处理耳机hook事件的优先级次序进行重新排序,使优先级最高的APK程序被耳机的hook键默认为最先启动的应用程序。The priority sequence of the APK program receiving and processing the earphone hook event is reordered through the API interface, so that the APK program with the highest priority is defaulted as the first application program started by the earphone hook key.

进一步而言,该方法还包括以下步骤:Further, the method also includes the following steps:

当APK程序被重新排序后,将调整后的优先级次序保存在系统文件中,在后续的关机重启后,仍按照调整后的优先级次序来保证耳机hook事件启动最高优先级的APK程序。After the APK program is reordered, the adjusted priority order is saved in the system file. After subsequent shutdown and restart, the adjusted priority order is still used to ensure that the earphone hook event starts the highest priority APK program.

进一步而言,所述在Android系统的AudioService模块里扩展一个新的用于支持重新定义耳机hook广播的优先级的API接口的步骤具体包括:Further, the steps of expanding a new API interface for supporting the priority of redefining the earphone hook broadcasting in the AudioService module of the Android system specifically include:

声明一个作为AudioService模块的代理的AudioManager对象;Declare an AudioManager object as a proxy for the AudioService module;

调用新定义的AudioManager对象的adjustHeadsetHookOrder接口;Call the adjustHeadsetHookOrder interface of the newly defined AudioManager object;

系统响应来自AudioManager对象的adjustHeadsetHookOrder接口的调用并根据所述adjustHeadsetHookOrder接口传输过来的参数进行相应的优先级次序调整;其中,所述参数包括广播接收者的名称、APK程序的名称和优先级次序。The system responds to calls from the adjustHeadsetHookOrder interface of the AudioManager object and performs corresponding priority adjustment according to the parameters transmitted by the adjustHeadsetHookOrder interface; wherein the parameters include the name of the broadcast receiver, the name of the APK program, and the priority order.

进一步而言,所述系统响应来自AudioManager对象的adjustHeadsetHookOrder接口的调用的步骤之前还包括:Further, before the step of the system responding to the call from the adjustHeadsetHookOrder interface of the AudioManager object, the steps further include:

检查调用AudioManager对象的adjustHeadsetHookOrder接口的应用进程是否有权限操作所述adjustHeadsetHookOrder接口;Check whether the application process calling the adjustHeadsetHookOrder interface of the AudioManager object has permission to operate the adjustHeadsetHookOrder interface;

若所述应用进程符合权限要求,则系统响应来自AudioManager对象的adjustHeadsetHookOrder接口的调用。If the application process meets the permission requirement, the system responds to the call from the adjustHeadsetHookOrder interface of the AudioManager object.

进一步而言,所述通过所述API接口对所述APK程序接收处理耳机hook事件的优先级次序进行重新排序,使优先级最高的APK程序被耳机的hook键默认为最先启动的应用程序的步骤具体包括:Further, the priority order of the APK program receiving and processing the earphone hook event is reordered through the API interface, so that the APK program with the highest priority is defaulted as the first application program to be started by the earphone hook key. The steps specifically include:

当找出系统所有的注册了android.intent.action.MEDIA_BUTTON广播的广播接收者时,则通过AudioManager对象的adjustHeadsetHookOrder接口对所述广播接收者进行优先级次序处理;When all the broadcast receivers registered with the android.intent.action.MEDIA_BUTTON broadcast in the system are found out, the broadcast receivers are prioritized through the adjustHeadsetHookOrder interface of the AudioManager object;

所述广播接收者按照从高至低的优先级次序接收android.intent.action.MEDIA_BUTTON广播;The broadcast receiver receives the android.intent.action.MEDIA_BUTTON broadcast in order of priority from high to low;

当后续有新增加的广播接收者时,则默认排在最低次序。When there are new broadcast receivers added later, they will be ranked in the lowest order by default.

进一步而言,所述优先级次序处理包括对单一广播接收者的优先级次序处理或一次多个广播接收者的优先级次序处理。Further, the priority order processing includes priority order processing for a single broadcast receiver or priority order processing for multiple broadcast receivers at a time.

本发明还提供了一种终端,其包括:The present invention also provides a terminal, which includes:

AudioService模块,其扩展有一个新的用于支持重新定义耳机hook广播的优先级的API接口;AudioService module, its extension has a new API interface to support redefining the priority of headphone hook broadcast;

耳机hook管理模块,用于查找系统中所有注册在AndroidManifest.xml配置文件中的静态广播接收者,找出所有的注册了android.intent.action.MEDIA_BUTTON广播的广播接收者所对应的APK程序;通过所述API接口对所述APK程序接收处理耳机hook事件的优先级次序进行重新排序,使优先级最高的APK程序被耳机的hook键默认为最先启动的程序。The headset hook management module is used to find all the static broadcast receivers registered in the AndroidManifest.xml configuration file in the system, and find out the APK programs corresponding to all the broadcast receivers registered with the android.intent.action.MEDIA_BUTTON broadcast; through The API interface reorders the priority order of the APK program for receiving and processing earphone hook events, so that the APK program with the highest priority is defaulted as the first program to be started by the earphone hook key.

进一步而言,所述耳机hook管理模块还用于当APK程序被重新排序后,将调整后的优先级次序保存在系统文件中,在后续的关机重启后,仍按照调整后的优先级次序来保证耳机hook事件启动最高优先级的APK程序。Further, the earphone hook management module is also used to save the adjusted priority order in the system file after the APK program is reordered, and after the subsequent shutdown and restart, still follow the adjusted priority order Ensure that the headphone hook event starts the APK program with the highest priority.

与现有技术相比,本发明的有益效果在于:Compared with prior art, the beneficial effect of the present invention is:

本发明的AudioService模块扩展出一个API接口,用于重新定义耳机hook广播的优先级,以确保注册android.intent.action.MEDIA_BUTTON广播的某个广播接收者可以最先接收处理,使得用户可以指定某个APK程序优先处理耳机hook事件,避免了多个支持耳机的hook键快速启动的应用之间产生混乱,提升用户体验。The AudioService module of the present invention expands an API interface, which is used to redefine the priority of the earphone hook broadcast, so as to ensure that a certain broadcast receiver registered for the android.intent.action.MEDIA_BUTTON broadcast can receive and process first, so that the user can specify a An APK program prioritizes the headset hook event, avoiding confusion among multiple applications that support the headset's hook button to quickly start, and improving user experience.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are For some embodiments of the present invention, those skilled in the art can also obtain other drawings based on these drawings without creative work.

图1是本发明实施例一所述的调整耳机的hook键启动应用次序的方法流程图;FIG. 1 is a flowchart of a method for adjusting the order of starting an application by a hook key of an earphone according to Embodiment 1 of the present invention;

图2是本发明实施例一所述的扩展API接口的流程图;FIG. 2 is a flow chart of the extended API interface described in Embodiment 1 of the present invention;

图3是本发明实施例二所述的终端的结构框图。FIG. 3 is a structural block diagram of a terminal according to Embodiment 2 of the present invention.

具体实施方式detailed description

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

实施例一Embodiment one

本发明的实施例一提供了一种调整耳机的hook键启动应用次序的方法,下面结合附图对本实施例进行详细说明。Embodiment 1 of the present invention provides a method for adjusting the order of starting applications by a hook key of an earphone, and this embodiment will be described in detail below with reference to the accompanying drawings.

图1是本发明实施例一的方法流程图,请参考图1,本发明实施例的方法包括以下步骤:Fig. 1 is a method flow chart of the first embodiment of the present invention, please refer to Fig. 1, the method of the embodiment of the present invention includes the following steps:

步骤S1、在Android系统的AudioService模块里扩展一个新的用于支持重新定义耳机hook广播的优先级的API接口;Step S1, expanding a new API interface used to support redefining the priority of earphone hook broadcasting in the AudioService module of the Android system;

在本实施例,如图2所示,图中左边为应用调用API接口的流程,右边为系统根据API接口进行调整的流程,步骤S1具体包括:In this embodiment, as shown in FIG. 2, the left side of the figure is the process of calling the API interface by the application, and the right side is the process of the system adjusting according to the API interface. Step S1 specifically includes:

步骤S11、声明一个AudioManager对象;Step S11, declare an AudioManager object;

其中,AudioManager对象为AudioService模块的一个代理,AudioManager对象就是定义控制系统声音的对象,存在于应用进程。AudioService模块为声音服务端,存在于Android的系统进程,即SystemServer。Among them, the AudioManager object is a proxy of the AudioService module, and the AudioManager object is an object that defines the sound of the control system and exists in the application process. The AudioService module is a sound server, which exists in the Android system process, that is, SystemServer.

步骤S12、调用新定义的AudioManager对象的adjustHeadsetHookOrder接口;Step S12, calling the adjustHeadsetHookOrder interface of the newly defined AudioManager object;

其中,adjustHeadsetHookOrder接口是直接承担调整优先级任务的API接口。Among them, the adjustHeadsetHookOrder interface is an API interface that directly undertakes the task of adjusting the priority.

步骤S13、检查调用AudioManager对象的adjustHeadsetHookOrder接口的应用进程是否有权限操作所述adjustHeadsetHookOrder接口;Step S13, check whether the application process calling the adjustHeadsetHookOrder interface of the AudioManager object has permission to operate the adjustHeadsetHookOrder interface;

其中,若所述应用进程符合权限要求,则执行步骤S14。Wherein, if the application process meets the permission requirement, step S14 is executed.

步骤S14、系统响应来自AudioManager对象的adjustHeadsetHookOrder接口的调用;Step S14, the system responds to the call from the adjustHeadsetHookOrder interface of the AudioManager object;

步骤S15、根据所述adjustHeadsetHookOrder接口传输过来的参数进行相应的优先级次序调整;Step S15, perform corresponding priority order adjustment according to the parameters transmitted from the adjustHeadsetHookOrder interface;

其中,所述参数包括广播接收者的名称、APK程序的名称和优先级次序。Wherein, the parameters include the name of the broadcast receiver, the name and priority order of the APK program.

步骤S2、查找系统中所有注册在AndroidManifest.xml配置文件中的静态广播接收者,找出所有的注册了android.intent.action.MEDIA_BUTTON广播的广播接收者所对应的APK程序;Step S2, find all the static broadcast receivers registered in the AndroidManifest.xml configuration file in the system, and find out the APK programs corresponding to all the broadcast receivers registered with the android.intent.action.MEDIA_BUTTON broadcast;

在本实施例中,广播接收者(Receiver)是一个专注于接收广播通知信息并做出对应处理的组件。广播接收者注册关注的广播通知信息,即对应的一个Action动作。In this embodiment, the broadcast receiver (Receiver) is a component focused on receiving broadcast notification information and making corresponding processing. The broadcast notification information that the broadcast receiver registers and pays attention to, that is, a corresponding Action.

广播接收者所对应的广播分两类:普通广播和有序广播。步骤S2关注的是注册action为android.intent.action.MEDIA_BUTTON的有序广播。其中,广播接收者注册在AndroidManifest.xml配置文件中的程序代码可以为:There are two types of broadcasts corresponding to broadcast receivers: ordinary broadcasts and ordered broadcasts. Step S2 focuses on the ordered broadcast of the registered action as android.intent.action.MEDIA_BUTTON. Among them, the program code of the broadcast receiver registered in the AndroidManifest.xml configuration file can be:

<receiver android:name="com.android.music.MediaButtonIntentReceiver"><receiver android:name="com.android.music.MediaButtonIntentReceiver">

<intent-filter><intent-filter>

<action android:name="android.intent.action.MEDIA_BUTTON"/><action android:name="android.intent.action.MEDIA_BUTTON"/>

</intent-filter></intent-filter>

</receiver></receiver>

步骤S3、通过所述API接口对所述APK程序接收处理耳机hook事件的优先级次序进行重新排序,使优先级最高的APK程序被耳机的hook键默认为最先启动的应用程序;Step S3, reorder the priority order of the APK program receiving and processing the earphone hook event through the API interface, so that the APK program with the highest priority is defaulted as the first application program to be started by the earphone hook key;

在本实施例中,步骤S3具体包括:In this embodiment, step S3 specifically includes:

步骤S31、当找出系统所有的注册了android.intent.action.MEDIA_BUTTON广播的广播接收者时,则通过AudioManager对象的adjustHeadsetHookOrder接口对所述广播接收者进行优先级次序处理;Step S31, when all the broadcast receivers registered with the android.intent.action.MEDIA_BUTTON broadcast in the system are found, the priority order processing is performed on the broadcast receivers through the adjustHeadsetHookOrder interface of the AudioManager object;

其中,所述优先级次序处理包括对单一广播接收者的优先级次序处理或一次多个广播接收者的优先级次序处理。Wherein, the priority order processing includes priority order processing for a single broadcast receiver or priority order processing for multiple broadcast receivers at a time.

另外,Android系统中的每个有序广播接收者都会定义一个priority(整型数字),如:<intent-filter android:priority="20">。一般地,priority的数值越大,优先级越高,通过改变priority的数值即可调整广播接收者的优先级次序。In addition, each ordered broadcast receiver in the Android system will define a priority (integer number), such as: <intent-filter android:priority="20">. Generally, the larger the value of priority, the higher the priority, and the priority order of broadcast receivers can be adjusted by changing the value of priority.

步骤S32、所述广播接收者按照从高至低的优先级次序接收android.intent.action.MEDIA_BUTTON广播;Step S32, the broadcast receiver receives the android.intent.action.MEDIA_BUTTON broadcast according to the order of priority from high to low;

步骤S33、当后续有新增加的广播接收者时,则默认排在最低次序。Step S33, when there is a newly added broadcast receiver, it will be ranked in the lowest order by default.

步骤S4、当APK程序被重新排序后,将调整后的优先级次序保存在系统文件中,在后续的关机重启后,仍按照调整后的优先级次序来保证耳机hook事件启动最高优先级的APK程序。Step S4, when the APK program is reordered, save the adjusted priority order in the system file, and after the subsequent shutdown and restart, still follow the adjusted priority order to ensure that the earphone hook event starts the APK with the highest priority program.

在本实施例中,在后续的关机重启后,AudioService模块会读取该系统文件,直接安装系统文件里登记的优先级调整,确保该调整一直有效。系统文件可以为数据库、xml、txt等格式用于保存数据的文件。In this embodiment, after subsequent shutdown and restart, the AudioService module will read the system file and directly install the priority adjustment registered in the system file to ensure that the adjustment is always valid. The system file can be a file for saving data in a database, xml, txt and other formats.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,所述的程序可以在存储于一计算机可读取存储介质中,所述的存储介质,如ROM/RAM、磁盘、光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the method of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the described Storage media, such as ROM/RAM, magnetic disk, optical disk, etc.

实施例二Embodiment two

本发明的实施例二提供了一种终端,该终端可以是手机、平板电脑等移动终端设备。请参考图3,其包括:Embodiment 2 of the present invention provides a terminal, and the terminal may be a mobile terminal device such as a mobile phone or a tablet computer. Please refer to Figure 3, which includes:

AudioService模块21,其扩展有一个新的用于支持重新定义耳机hook广播的优先级的API接口;AudioService module 21, its extension has a new API interface to support redefining the priority of headphone hook broadcast;

在本实施例中,AudioService模块21扩展一个API接口的过程为:声明一个作为AudioService模块的代理的AudioManager对象;调用新定义的AudioManager对象的adjustHeadsetHookOrder接口;检查调用AudioManager对象的adjustHeadsetHookOrder接口的应用进程是否有权限操作所述adjustHeadsetHookOrder接口;若所述应用进程符合权限要求,系统响应来自AudioManager对象的adjustHeadsetHookOrder接口的调用并根据所述adjustHeadsetHookOrder接口传输过来的参数进行相应的优先级次序调整;其中,所述参数包括广播接收者的名称、APK程序的名称和优先级次序。In this embodiment, the process of AudioService module 21 extending an API interface is: declare an AudioManager object as the proxy of the AudioService module; Call the adjustHeadsetHookOrder interface of the newly defined AudioManager object; Check whether the application process calling the adjustHeadsetHookOrder interface of the AudioManager object has Permission to operate the adjustHeadsetHookOrder interface; if the application process meets the permission requirements, the system responds to the call from the adjustHeadsetHookOrder interface of the AudioManager object and adjusts the corresponding priority order according to the parameters transmitted by the adjustHeadsetHookOrder interface; wherein, the parameters include The name of the broadcast receiver, the name of the APK program and the order of priority.

耳机hook管理模块22,用于查找系统中所有注册在AndroidManifest.xml配置文件中的静态广播接收者,找出所有的注册了android.intent.action.MEDIA_BUTTON广播的广播接收者所对应的APK程序;通过所述API接口对所述APK程序接收处理耳机hook事件的优先级次序进行重新排序,使优先级最高的APK程序被耳机的hook键默认为最先启动的程序;The earphone hook management module 22 is used to find all the static broadcast receivers registered in the AndroidManifest.xml configuration file in the system, find out all the APK programs corresponding to the broadcast receivers who have registered the android.intent.action.MEDIA_BUTTON broadcast; Reorder the priority order of the APK program receiving and processing the earphone hook event through the API interface, so that the APK program with the highest priority is defaulted as the first started program by the hook key of the earphone;

在本实施例中,耳机hook管理模块22进行优先级次序调整的过程为:当找出系统所有的注册了android.intent.action.MEDIA_BUTTON广播的广播接收者时,则通过AudioManager对象的adjustHeadsetHookOrder接口对所述广播接收者进行优先级次序处理;所述广播接收者按照从高至低的优先级次序接收android.intent.action.MEDIA_BUTTON广播;当后续有新增加的广播接收者时,则默认排在最低次序。In this embodiment, the process of adjusting the priority order of the earphone hook management module 22 is: when finding out all the broadcast receivers registered with the android.intent.action.MEDIA_BUTTON broadcast in the system, then through the adjustHeadsetHookOrder interface of the AudioManager object to The broadcast receivers perform priority order processing; the broadcast receivers receive the android.intent.action.MEDIA_BUTTON broadcast according to the priority order from high to low; when there are new broadcast receivers added later, they are ranked by default lowest order.

其中,所述优先级次序处理包括对单一广播接收者的优先级次序处理或一次多个广播接收者的优先级次序处理。Wherein, the priority order processing includes priority order processing for a single broadcast receiver or priority order processing for multiple broadcast receivers at a time.

在本实施例中,所述耳机hook管理模块22还用于当APK程序被重新排序后,将调整后的优先级次序保存在系统文件中,在后续的关机重启后,仍按照调整后的优先级次序来保证耳机hook事件启动最高优先级的APK程序。In this embodiment, the earphone hook management module 22 is also used to save the adjusted priority order in the system file after the APK program is reordered, and after the subsequent shutdown and restart, the adjusted priority order is still used. To ensure that the headphone hook event starts the APK program with the highest priority.

需要说明的是,上述实施例提供的一种终端,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将系统的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。It should be noted that, the terminal provided by the above embodiment is only illustrated by the division of the above functional modules. In practical applications, the above function allocation can be completed by different functional modules according to the needs, that is, the internal structure of the system Divided into different functional modules to complete all or part of the functions described above.

综上所述,本发明的AudioService模块扩展出一个API接口,用于重新定义耳机hook广播的优先级,以确保注册android.intent.action.MEDIA_BUTTON广播的某个广播接收者可以最先接收处理,使得用户可以指定某个APK程序优先处理耳机hook事件,避免了多个支持耳机的hook键快速启动的应用之间产生混乱,提升了用户体验。To sum up, the AudioService module of the present invention extends an API interface for redefining the priority of the earphone hook broadcast, so as to ensure that a certain broadcast receiver registered for the android.intent.action.MEDIA_BUTTON broadcast can receive and process it first, The user can designate a certain APK program to process the headset hook event first, avoiding confusion among multiple applications that support the headset's hook button to quickly start, and improving the user experience.

上述实施例为本发明较佳的实施方式,但本发明的实施方式并不受上述实施例的限制,其他的任何未背离本发明的精神实质与原理下所作的改变、修饰、替代、组合、简化,均应为等效的置换方式,都包含在本发明的保护范围之内。The above-mentioned embodiment is a preferred embodiment of the present invention, but the embodiment of the present invention is not limited by the above-mentioned embodiment, and any other changes, modifications, substitutions, combinations, Simplifications should be equivalent replacement methods, and all are included in the protection scope of the present invention.

Claims (8)

CN201310611136.1A2013-11-262013-11-26A kind of hook key adjusting earphone starts method and the terminal of application orderExpired - Fee RelatedCN103593217B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201310611136.1ACN103593217B (en)2013-11-262013-11-26A kind of hook key adjusting earphone starts method and the terminal of application order

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201310611136.1ACN103593217B (en)2013-11-262013-11-26A kind of hook key adjusting earphone starts method and the terminal of application order

Publications (2)

Publication NumberPublication Date
CN103593217A CN103593217A (en)2014-02-19
CN103593217Btrue CN103593217B (en)2016-10-26

Family

ID=50083375

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201310611136.1AExpired - Fee RelatedCN103593217B (en)2013-11-262013-11-26A kind of hook key adjusting earphone starts method and the terminal of application order

Country Status (1)

CountryLink
CN (1)CN103593217B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104298505A (en)*2014-09-232015-01-21深圳市金立通信设备有限公司Operation method for application program
CN104281263A (en)*2014-09-232015-01-14深圳市金立通信设备有限公司Terminal
CN104699503A (en)*2015-02-282015-06-10深圳市同洲电子股份有限公司Method and device for replacing function execution logic in Android system
CN105516487B (en)*2015-12-042019-07-16上海斐讯数据通信技术有限公司Broadcast receiving method, system and equipment
CN107800546B (en)*2016-08-312021-03-30华为技术有限公司Management method and device for broadcast messages
CN106534571B (en)*2016-11-302019-10-11宇龙计算机通信科技(深圳)有限公司A kind of event notification method and terminal
CN108279939B (en)*2016-12-302021-07-23阿里巴巴集团控股有限公司Method, device and equipment for supporting newly-added broadcast receiver by Android plug-in framework
CN106851016B (en)*2017-03-102019-03-19Oppo广东移动通信有限公司Method, device and terminal for queuing broadcast messages
CN106851595B (en)*2017-03-102019-08-02Oppo广东移动通信有限公司Ordered broadcast processing method and device and terminal equipment
CN106919461B (en)*2017-03-102022-07-15Oppo广东移动通信有限公司Method and device for adjusting broadcast receiver queue and terminal equipment
CN107402790B (en)*2017-07-312020-01-31Oppo广东移动通信有限公司 Application startup method, device, storage medium and terminal
CN111930481B (en)*2020-07-162024-06-18重庆帮企科技集团有限公司Android system-based process priority improving method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN102739839A (en)*2011-04-072012-10-17深圳富泰宏精密工业有限公司Mobile phone application program starting method and system
CN102970416A (en)*2012-11-012013-03-13深圳天珑无线科技有限公司Method for achieving multi-functional control of single-button line-control earphone and communication terminal
CN103095902A (en)*2011-11-072013-05-08联想(北京)有限公司Information processing method and equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JP2004206581A (en)*2002-12-262004-07-22Toshiba Corp AUDIO APPARATUS AND METHOD OF ACQUIRING VOICE INFORMATION IN ACOUSTIC APPARATUS

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN102739839A (en)*2011-04-072012-10-17深圳富泰宏精密工业有限公司Mobile phone application program starting method and system
CN103095902A (en)*2011-11-072013-05-08联想(北京)有限公司Information processing method and equipment
CN102970416A (en)*2012-11-012013-03-13深圳天珑无线科技有限公司Method for achieving multi-functional control of single-button line-control earphone and communication terminal

Also Published As

Publication numberPublication date
CN103593217A (en)2014-02-19

Similar Documents

PublicationPublication DateTitle
CN103593217B (en)A kind of hook key adjusting earphone starts method and the terminal of application order
CN112055424B (en)Electronic device and method for switching electronic device
CN112544092B (en) Electronic device, external electronic device and method for managing embedded subscriber identification module of external electronic device
CN103888619B (en) A message processing method and system thereof
CN102739769A (en)Synchronization method and apparatus of portable terminal
CN105100059A (en)Method, device and system for processing high-concurrent requests
US20140187212A1 (en)Ringtone processing method and apparatus
US20160085566A1 (en)Accessory Setting Service
US9860177B2 (en)Managing network load using device application programs
CN110177368B (en) A call establishment method and system, and a video communication server
US20200192628A1 (en)Audio Output Method, Electronic Device, and Storage Medium
WO2013182157A1 (en)Application program processing method and device
CN105898075A (en)Method and device for automatically adjusting contextual model
CN105306729A (en)Method and system for adjusting call volume
US20150031323A1 (en)Apparatus and method to implement a queuing process by a position enabled mobile device to prioritize the legitimacy of initiation messages from emergency location platforms
WO2012163113A1 (en)Method and device for data service protection
CN103974215B (en)Control method of electronic device and electronic equipment
CN111159462B (en)Method and terminal for playing songs
CN114374958A (en)Bluetooth communication method, device and equipment
WO2016054885A1 (en)Operation object processing method and apparatus
CN108833668B (en)Shutdown method and related product
CN111459514B (en) A terminal upgrade processing method, server and base station
CN106601277B (en) Method and device for downloading audio files by Bluetooth player
CN106210325A (en)A kind of the method for social networking application incoming ring tone, device and terminal are set
CN116709393B (en) Recovery method and electronic device when cellular data service activation fails

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
C14Grant of patent or utility model
GR01Patent grant
CP01Change in the name or title of a patent holder
CP01Change in the name or title of a patent holder

Address after:Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee after:GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before:Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee before:GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

CF01Termination of patent right due to non-payment of annual fee
CF01Termination of patent right due to non-payment of annual fee

Granted publication date:20161026


[8]ページ先頭

©2009-2025 Movatter.jp