ibinder安卓系统怎么添加耳机插入的状态?

ibinder  时间:2021-06-17  阅读:()

Fragment中如何启动服务和绑定服务?

Intent intent = new Intent(getActivity(),a.class); geActivity().bindService(intent, Conn, Context.BIND_AUTO_CREATE);这样会连接服务失败

BINDER是什么意思

binder 英[?ba?nd?(r)] 美[?ba?nd?] n. 粘合剂; 包扎物,包扎工具; [法] 临时契约; 装订工; [例句]The final operation in propellant manufacture is the curing of the binder. 制造推进剂的最后操作是粘合剂的固化。

[其他] 复数:binders

安卓系统怎么添加耳机插入的状态?

  1.在frameworks/base/core/res/res/drawable-mdpi目录先添加一个stat_sys_headset.png资源文件。

这里面资源文件的目录要根据设备的分辨率来确定,我的设备是HVGA的,因此资源文件放在drawable-mdpi目录下。


  2.修改frameworks/base/services//android/server/status/StatusBarPolicy.java


  1.public class StatusBarPolicy {


  2. private static finalString TAG =“StatusBarPolicy” ;


  4. private static StatusBarPolicy sInstance;


  5. ……


  7. // alarm clock


  8. // Icon lit when clock is set


  9. private IBinder mAlarmClockIcon;


  10. private IconData mAlarmClockIconData;


  12. //modify here start


  13. //HeadSet


  14. private IBinder mHeadSetPlugIcon;


  15. private IconData mHeadSetPlugIconData;


  16. //modify here end


  17. ……


  19. private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {


  20. @Override


  21. public voidonReceive(Context context, Intent intent) {


  22. Stringaction = intent.getAction();


  23. if (action.equals(Intent.ACTION_TIME_TICK)) {


  24. updateClock();


  25. }


  26. ……


  27. else if (action.equals(Intent.ACTION_ALARM_CHANGED)) {


  28. updateAlarm(intent);


  29. }


  30. //modify here start


  31. else if (action.equals(Intent.ACTION_HEADSET_PLUG)) {


  32. updateHeadset(intent);


  33. }


  34. //modify here end


  35. else if (action.equals(Intent.ACTION_SYNC_STATE_CHANGED)) {


  36. updateSyncState(intent);


  37. }


  38. ……


  39. };


  40. private StatusBarPolicy(Context context, StatusBarService service) {


  41. mContext = context;


  42. mService = service;


  43. mSignalStrength = new SignalStrength();


  44. if (FeatureOption.MTK_GEMINI_SUPPORT == true ) {


  45. mSignalStrengthGemini = new SignalStrength();


  46. }


  47. mBatteryStats = BatteryStatsService.getService();


  48. …


  49. //modify here start


  50. //HeadSet


  51. mHeadSetPlugIconData = IconData.makeIcon(


  52. “headset” ,


  53. .android.internal.R.drawable.stat_sys_headset, 0 , 0 );


  54. mHeadSetPlugIcon = service.addIcon(mHeadSetPlugIconData, null );


  55. service.setIconVisibility(mHeadSetPlugIcon, false );


  56. //modify here end


  57. …


  59. IntentFilterfilter = new IntentFilter();


  61. // Registerfor Intent broadcasts for…


  62. filter.addAction(Intent.ACTION_TIME_TICK);


  63. …


  64. //modify here start


  65. filter.addAction(Intent.ACTION_HEADSET_PLUG);


  66. //modify here end


  67. …


  69. }


  71. //modify here start


  72. private final void updateHeadset(Intent intent) {


  74. Slog.d(TAG,“updateHeadset: state=” + intent.getIntExtra(“state” , 0 ));


  75. mService.setIconVisibility(mHeadSetPlugIcon, (intent.getIntExtra(“state” ,0 ) == 1 )?true :false );


  76. }


  77. //modify here end


  78. ……


  79.}


  3.修改frameworks/base/core/res/res/values/arrays.xml


  < string-array name=“status_bar_icon_order”>


   clock


   secure


   alarm_clock


   battery


   phone_signal_2


   phone_signal


   phone_evdo_signal


   data_connection


   cdma_eri


   tty


   volume


   mute


   speakerphone


  


   headset


  


   wifi


   tty


   bluetooth


   gps


   sync_active


   sync_failing


   ime


  


  其中 “headset”这个字符串就是 “mHeadSetPlugIconData = IconData.makeIcon( ”headset“, null 0 , 0 );”中的第一个参数。

headset ”这个语句的位置于图标在status bar上显示的位置有关。


ZJI:520元/月香港服务器-2*E5-2630L/32GB/480G SSD/30M带宽/2IP

ZJI发布了一款7月份特别促销独立服务器:香港邦联四型,提供65折优惠码,限量30台(每用户限购1台),优惠后每月520元起。ZJI是原来Wordpress圈知名主机商家:维翔主机,成立于2011年,2018年9月启用新域名ZJI,提供中国香港、台湾、日本、美国独立服务器(自营/数据中心直营)租用及VDS、虚拟主机空间、域名注册等业务。下面列出这款服务器的配置信息。香港邦联四型CPU:2*E5-2...

GreenCloudVPS($30/年),500G大硬盘VPS,10Gbps带宽

GreenCloudVPS最近在新加坡DC2节点上了新机器,Dual Xeon Silver 4216 CPU,DDR4内存,10Gbps网络端口,推出了几款大硬盘VPS套餐,基于KVM架构,500GB磁盘起年付30美元。除了大硬盘套餐外,还加推了几款采用NVMe硬盘的常规套餐,最低年付20美元。不过需要提醒的是,机房非直连中国,尤其是电信用户ping值感人,包括新加坡DC1也是如此。大硬盘VPS...

[6.18]IMIDC:香港/台湾服务器月付30美元起,日本/俄罗斯服务器月付49美元起

IMIDC发布了6.18大促销活动,针对香港、台湾、日本和莫斯科独立服务器提供特别优惠价格最低月付30美元起。IMIDC名为彩虹数据(Rainbow Cloud),是一家香港本土运营商,全线产品自营,自有IP网络资源等,提供的产品包括VPS主机、独立服务器、站群独立服务器等,数据中心区域包括香港、日本、台湾、美国和南非等地机房,CN2网络直连到中国大陆。香港服务器   $39/...

ibinder为你推荐
dnf装备代码DNF代码,装备,不是EX云办公平台云办公平台对企业办公有什么好处呢?erp系统教程在一个公司里怎样去学ERP东兴证券网站东兴证券超强版下载怎样删除聊天记录自己已发出的微信聊天记录怎样删除才不会让对方看见在线沟通有效沟通的六个要点flex是什么这些b365m和b360m什么意思driversbackup我的电脑d盘里有个Backup文件夹 怎么能让他显示出来全峰快递官网请问全峰快递客服是多少?6位qq号码申请6位QQ号 怎么申请
美国vps 阿云浏览器 腾讯云数据库 轻量 河南移动邮件系统 静态空间 linux服务器维护 drupal安装 阿里云手机官网 群英网络 乐视会员免费领取 汤博乐 shuangcheng accountsuspended 空间排行榜 建站技术 web服务器 美国vpn服务器 低价 压力测试工具 更多