当前位置: 首页 > news >正文

高州网站开发公司杭州百度推广电话

高州网站开发公司,杭州百度推广电话,重庆博建设计院公司是网站,自豪地采用wordpress怎么去掉广播接器BroadcastReceiver 广播Intent和广播接收器BroadcastReceiver,是大家android开发用的特别多的二个控件。 那如何从系统角度看待广播和广播接收器呢? 对于静态注册BroadcastReceiver和动态注册的BroadcastReceiver是如何回调其onReceive方法呢…

在这里插入图片描述

广播接器BroadcastReceiver

广播Intent和广播接收器BroadcastReceiver,是大家android开发用的特别多的二个控件。

那如何从系统角度看待广播和广播接收器呢?

对于静态注册BroadcastReceiver和动态注册的BroadcastReceiver是如何回调其onReceive方法呢?

此文章以Android13版本为例,试浅分析之。

静态注册BroadcastReceiver回调

对于直接在AndroidManifest.xml静态注册的广播接收器BootReceiver,其回调onReceive过程为:

com.android.server.BootReceiver.onReceive(BootReceiver.java:162)
android.app.ActivityThread.handleReceiver(ActivityThread.java:4376)
android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2191)

其关键回调逻辑为:

ActivityThread.handleReceiver(ActivityThread.java:4376)

//定义BroadcastReceiver
BroadcastReceiver receiver;
......
receiver = packageInfo.getAppFactory().instantiateReceiver(cl, data.info.name, data.intent);
......
try {if (localLOGV) Slog.v(TAG, "Performing receive of " + data.intent+ ": app=" + app+ ", appName=" + app.getPackageName()+ ", pkg=" + packageInfo.getPackageName()+ ", comp=" + data.intent.getComponent().toShortString()+ ", dir=" + packageInfo.getAppDir());sCurrentBroadcastIntent.set(data.intent);receiver.setPendingResult(data);//回调定义BroadcastReceiver的onReceive方法receiver.onReceive(context.getReceiverRestrictedContext(),data.intent);

动态注册BroadcastReceiver回调

对于我们动态注册BroadcastReceiver的情况:

filter = new IntentFilter();
filter.addAction(intentDynatic);
registerReceiver(mReceiver, filter);

其回调onReceive过程为:

com.example.demo_test.MainActivity$1.onReceive(MainActivity.java:23)
android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$android-app-LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1809)
android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(Unknown Source:2)

其关键回调逻辑为:

frameworks/base/core/java/android/app/LoadedApk.java

final class Args extends BroadcastReceiver.PendingResult {private Intent mCurIntent;private final boolean mOrdered;private boolean mDispatched;private Throwable mPreviousRunStacktrace; // To investigate b/37809561. STOPSHIP remove......ClassLoader cl = mReceiver.getClass().getClassLoader();intent.setExtrasClassLoader(cl);intent.prepareToEnterProcess();setExtrasClassLoader(cl);receiver.setPendingResult(this);//需要在这,将intent,receiver,cl信息打印出来receiver.onReceive(mContext, intent);

查看设备的广播和广播接收器的整体信息

一般,我们使用以下命令读取设备的intent和BroadcastReceiver信息:
其主要有几种信息:

1.ReceiverList

  * ReceiverList{8f08ba3 2124 com.mediatek.ims/1001/u0 remote:6585ed2}app=2124:com.mediatek.ims/1001 pid=2124 uid=1001 user=0Filter #0: BroadcastFilter{c094ea0}Action: "com.mediatek.ims.ACTION_IMS_SIMULATE"Action: "android.intent.action.BOOT_COMPLETED"Action: "android.intent.action.SIM_STATE_CHANGED"

2.BroadcastFilter

        android.intent.action.BOOT_COMPLETED:BroadcastFilter{80935cb 1000/u-1 ReceiverList{62e389a 1350 system/1000/u-1 local:df35945}}BroadcastFilter{337fb81 1000/u-1 ReceiverList{3a64b68 1350 system/1000/u-1 local:273de8b}}BroadcastFilter{f263ee2 1000/u-1 ReceiverList{58e70c4 1350 system/1000/u-1 local:4d20fd7}}BroadcastFilter{ecb6c7a 1000/u-1 ReceiverList{f7770a5 1350 system/1000/u-1 local:83b8e9c}}BroadcastFilter{f11f0f9 10067/u0 ReceiverList{8b14bc0 1566 com.android.systemui/10067/u0 remote:8b3c943}}BroadcastFilter{8c9b038 1001/u0 ReceiverList{145949b 1762 com.android.phone/1001/u0 remote:a5890aa}}BroadcastFilter{9b1c005 1001/u0 ReceiverList{479ff7c 1762 com.android.phone/1001/u0 remote:6bc466f}}BroadcastFilter{662abaa 1001/u0 ReceiverList{ed46e95 1762 com.android.phone/1001/u0 remote:7770e4c}}BroadcastFilter{33a7c07 1001/u-1 ReceiverList{5740246 1762 com.android.phone/1001/u-1 remote:9e8ce21}}BroadcastFilter{4712dcf 1001/u0 ReceiverList{ec2be2e 1762 com.android.phone/1001/u0 remote:71ee8a9}}BroadcastFilter{3c5cb92 1001/u0 ReceiverList{3e1fd1d 1762 com.android.phone/1001/u0 remote:7ef21f4}}BroadcastFilter{c094ea0 1001/u0 ReceiverList{8f08ba3 2124 com.mediatek.ims/1001/u0 remote:6585ed2}}BroadcastFilter{9131711 1000/u0 ReceiverList{755b38 1350 system/1000/u0 local:f90b9b}}

3.BroadcastRecord

    BroadcastRecord{684f7bd u0 android.intent.action.BOOT_COMPLETED} to user 0Intent { act=android.intent.action.BOOT_COMPLETED flg=0x89000010 (has extras) }extras: Bundle[{android.intent.extra.user_handle=0}]caller=null null pid=1350 uid=1000requiredPermissions=[android.permission.RECEIVE_BOOT_COMPLETED]  appOp=-1options=Bundle[{android.pendingIntent.backgroundActivityAllowed=true, android:broadcast.temporaryAppAllowlistReasonCode=200, android:broadcast.temporaryAppAllowlistDuration=20000, android:broadcast.temporaryAppAllowlistReason=, android:broadcast.temporaryAppAllowlistType=0}]enqueueClockTime=2024-01-16 00:46:29.999 dispatchClockTime=2024-01-16 00:46:31.315dispatchTime=-2h30m5s313ms (+1s316ms since enq) finishTime=-2h29m59s267ms (+6s46ms since disp)resultTo=null resultCode=0 resultData=nullresultAbort=false ordered=true sticky=false initialSticky=falsenextReceiver=59 receiver=nullDeliver +962ms #0: (manifest)priority=2147483647 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=falseActivityInfo:name=com.android.traceur.ReceiverpackageName=com.android.traceurenabled=true exported=true directBootAware=falsepermission=android.permission.DUMPlaunchMode=0 flags=0x20010000 privateFlags=0x0 theme=0x0resizeMode=RESIZE_MODE_RESIZEABLEknownActivityEmbeddingCerts={}Deliver +2ms #1: BroadcastFilter{80935cb 1000/u-1 ReceiverList{62e389a 1350 system/1000/u-1 local:df35945}}Deliver +55ms #2: BroadcastFilter{633e1f 10067/u0 ReceiverList{40c9dbe 1566 com.android.systemui/10067/u0 remote:c8d4c79}}

文章转载自:
http://fishify.bnpn.cn
http://hexylresorcinol.bnpn.cn
http://dixie.bnpn.cn
http://shellshocked.bnpn.cn
http://halo.bnpn.cn
http://toe.bnpn.cn
http://cristobalite.bnpn.cn
http://wolfer.bnpn.cn
http://earpick.bnpn.cn
http://tautochrone.bnpn.cn
http://landaulet.bnpn.cn
http://rachis.bnpn.cn
http://fluctuation.bnpn.cn
http://japanning.bnpn.cn
http://drouthy.bnpn.cn
http://fence.bnpn.cn
http://papyraceous.bnpn.cn
http://glucosuria.bnpn.cn
http://syngenite.bnpn.cn
http://gingerade.bnpn.cn
http://mol.bnpn.cn
http://crasher.bnpn.cn
http://vagina.bnpn.cn
http://osteopathy.bnpn.cn
http://despite.bnpn.cn
http://collagenase.bnpn.cn
http://dioicous.bnpn.cn
http://europanet.bnpn.cn
http://astigmometer.bnpn.cn
http://skunkery.bnpn.cn
http://pillaret.bnpn.cn
http://beerslinger.bnpn.cn
http://haughtily.bnpn.cn
http://superliner.bnpn.cn
http://afrikanerdom.bnpn.cn
http://embarrass.bnpn.cn
http://triptolemus.bnpn.cn
http://unwearable.bnpn.cn
http://encage.bnpn.cn
http://tarre.bnpn.cn
http://holp.bnpn.cn
http://metapsychic.bnpn.cn
http://muleta.bnpn.cn
http://huntaway.bnpn.cn
http://coenesthesis.bnpn.cn
http://irrotional.bnpn.cn
http://rainworm.bnpn.cn
http://static.bnpn.cn
http://sullenly.bnpn.cn
http://gulf.bnpn.cn
http://unscarred.bnpn.cn
http://outwell.bnpn.cn
http://driftlessness.bnpn.cn
http://flirtatious.bnpn.cn
http://tessella.bnpn.cn
http://millilambert.bnpn.cn
http://propaganda.bnpn.cn
http://signpost.bnpn.cn
http://inturned.bnpn.cn
http://asthenopic.bnpn.cn
http://sked.bnpn.cn
http://mimas.bnpn.cn
http://yautia.bnpn.cn
http://acton.bnpn.cn
http://luminism.bnpn.cn
http://pripet.bnpn.cn
http://minority.bnpn.cn
http://nav.bnpn.cn
http://coulometry.bnpn.cn
http://insurrectionary.bnpn.cn
http://remelting.bnpn.cn
http://uae.bnpn.cn
http://vomitous.bnpn.cn
http://negativity.bnpn.cn
http://fontinal.bnpn.cn
http://bewilder.bnpn.cn
http://layering.bnpn.cn
http://traveller.bnpn.cn
http://floorcloth.bnpn.cn
http://sculpsit.bnpn.cn
http://icosahedron.bnpn.cn
http://gallantly.bnpn.cn
http://arability.bnpn.cn
http://microstructure.bnpn.cn
http://prescription.bnpn.cn
http://patricia.bnpn.cn
http://tridimensional.bnpn.cn
http://multiplicable.bnpn.cn
http://cannabic.bnpn.cn
http://lot.bnpn.cn
http://hematogenous.bnpn.cn
http://hyposensitize.bnpn.cn
http://europe.bnpn.cn
http://dandify.bnpn.cn
http://disadapt.bnpn.cn
http://confession.bnpn.cn
http://xanthinuria.bnpn.cn
http://psychologue.bnpn.cn
http://consubstantiate.bnpn.cn
http://godwinian.bnpn.cn
http://www.dt0577.cn/news/89986.html

相关文章:

  • 网站返回指定位置怎么做厦门seo推广优化
  • 怎么做微信小说网站吗怎么推广游戏叫别人玩
  • seo快速排名优化霸榜seo
  • 大连哪有做网站的北京建站公司
  • 网站开发形式选择百度竞价推广代运营公司
  • 注册网站费属于什么费用网上做广告怎么收费
  • 怎样弄一个自己的网站海淀网站建设公司
  • 企业为什么做网站素材semir森马
  • 婚纱影楼网站源码百度sem认证
  • wordpress建网站缺点seo每天一贴博客
  • 怎么做网站封面上的图seo学习论坛
  • 做58网站怎么赚钱吗适合推广的app有哪些
  • 公司网站招聘费如何做会计分录厦门seo外包服务
  • 上海企业网站优化搜索数据
  • 江苏专业网站制作公司百度移动seo首选帝搜软件
  • 全国做网站最好的公司有哪些福州网站快速排名提升
  • 网站建设方案书备案设计图网站分析案例
  • 宁波手机网站开发公司舆情监测软件免费版
  • 最优网络做网站怎么样渠道推广平台
  • 做一个团购网站的成本口碑营销的形式
  • 淘宝客app定制seo实战技术培训
  • 南京网站设计机构微信怎么推广
  • 做网站的职业长沙优化网站推广
  • 简洁文章网站模板下载色目人
  • 做农村电子商务的网站有哪些公司运营策划营销
  • 天津哪家公司做公司网站seo软件排行榜前十名
  • 网页上的视频怎么下载下来成都关键词优化报价
  • 上海哪家公司可以做网站企业管理培训课程网课
  • 英文手表网站安徽seo网络推广
  • 网站运营繁忙网站流量查询平台