欢迎来到天天文库
浏览记录
ID:35478333
大小:57.95 KB
页数:12页
时间:2019-03-25
《sip电话的下层逻辑分析》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、注意,回调函数的参数是从下往上传递的_■进入安全模式的初始化过程sipdemo应用初始化时注册一个接收机IncomingCallReceiver,只接受处理action:android.SipDemo.INCOMING_CALL应用开始的时候onStart时,开始SIP初始化和SIP注册。先调用sipmanager,在应用程序初始化的时候就已经创建了sipmanager和sipservice的单实例对象。并且每次返回应用程序首界面的时候会重新调用—/XinitializeManager();privateSipManager(
2、Contextcontext){mContext=context;createSipServiceQ;privatevoidcreateSipServiceQ{IBinderb=ServiceManager.getService(Context.SIP^SERVICE);mSipService=ISipService.Stub.asInterface(b);publicstaticvoidstartSipService(Contextcontext){slog(,,startSipServicen);if(SipManager
3、.isApiSupported(context)){ServiceManager.acidService("sip;newSipService(context));这回创建一个manager实例,—个sipservice实例。在初始化sipservice实例的时候会privateMyExecutormExecutor=newMyExecutor();//Executesimmediatetasksinasinglethread.Hold/releasewakelockforrunningtasksprivateSipServi
4、ce(Contextcontext){讦(DBG)log("SipService:started!");mContext=context;mConnectivityReceiver=newConnectivityReceiver();mWifiLock=((W币Manager)context.getSystemService(Context.WIFI_SERVICE)).createWifiLock(W币Manager.WIFI_MODE_FULL,TAG);mWifiLock.setReferenceCounted(faIs
5、e);mSipOnW币Only=SipManager.isSipW币Only(context);mMyWakeLock=newSipWakeLock((PowerManager)context.getSystemService(Context.POWER_SERVICE));mTimer=newSipWakeupTimer(contextzmExecutor);//Thread.实例化sipsercvice的时候,会同时把应用程序的上下文传递下来,实例化一个网络变化接收器,(这个接收机在下一步注册了以后才能生效,只在网络变化时
6、才会受到触发执行),实例化一个SipWakeLock实例用来保持PARTIAL_WAKE_LOCK:保持CPU运转,屏幕和键盘灯有可能是关闭的,只有在调用此类的acquire时才获得锁zrelease时释放锁。实例化一个SipWakeupTimer(Timerthatcanscheduleeventstooccurevenwhenthedeviceisinsleep.),实例化时会把接着使用open方法,此时调用此方法后要将注册监听器传递到sipservice.open3()在IBinder里面的onTransact函数中调用
7、Binder.getCallingUid()和Binder.getCallingPid()来判断外来方的身份,并将其作为Setsthecallingprocess'sUidinthesipservice.在open3方法中会创建一SipSessionGroupExt对象,这个对象会按照//SipProfileURI->group的结构存到MAP中privateMapmSipGroups二newHashMap();系统初次
8、启动时,SipSessionGroupExtgroup二null,所以group=newSipSessionGroupExt(localProfile,incomingCallPendinglntent,null);在实例化一个group对象时,会同时在SipSessionG
此文档下载收益归作者所有