Android weixin service, androidweixin

Source: Internet
Author: User

Android weixin service, androidweixin
Introduction

After thinking for a long time, why can't Android services be killed? Why does it automatically enable or receive messages if it has no permissions or manual start? Strange?

No matter what method it uses, first look at its source code, and then analyze and release its own conclusions.


Code Analysis Services and broadcasts in AndroidManifest. xml

<! -- Notification broadcast acceptance --> <receiver er android: name = "com. tencent. mm. booter. policyreceiver "android: exported =" false "/> <policer android: name =" com. tencent. mm. booter. notification. notificationDeleteReceive "/> <! -- Crash broadcast --> <javaser android: name = "com. tencent. mm. sandbox. monitor. crashUploadAlarmReceiver "android: exported =" false "/> <javaser android: name =" com. tencent. mm. booter. mountReceiver "> <intent-filter> <action android: name =" android. intent. action. MEDIA_MOUNTED "/> <action android: name =" android. intent. action. MEDIA_EJECT "/> <action android: name =" android. intent. action. MEDIA_UNMOUNTED "/> <action android: n Ame = "android. intent. action. MEDIA_SHARED "/> <action android: name =" android. intent. action. MEDIA_SCANNER_STARTED "/> <action android: name =" android. intent. action. MEDIA_SCANNER_FINISHED "/> <action android: name =" android. intent. action. MEDIA_REMOVED "/> <action android: name =" android. intent. action. MEDIA_BAD_REMOVAL "/> <data android: scheme =" file "/> </intent-filter> </Cycler> <service android: name =" com. te Ncent. mm. booter. notifyReceiver $ NotifyService "/> <service android: name =" com. tencent. mm. modelfriend. addrBookObserver $ AddrBookService "/> <Cycler android: name =" com. tencent. mm. booter. descrithreceiver "> // Bluetooth broadcast <intent-filter> <action android: name =" android. media. SCO_AUDIO_STATE_CHANGED "/> <action android: name =" android. media. ACTION_SCO_AUDIO_STATE_UPDATED "/> </intent-filter> </er ER> <receiver android Oid: name = "com. tencent. mm. booter. installReceiver "> // installer advertisement <intent-filter> <action android: name =" com. android. vending. INSTALL_REFERRER "/> // only accept error? </Intent-filter> </receiver> <receiver android: name = "com. tencent. mm. booter. MMReceivers $ ToolsProcessReceiver "android: exported =" false "android: process =": tools "/> <receiver er android: name =" com. tencent. mm. plugin. backup. bakpcmodel. bakchatPcmgrNorify "// notification bar broadcast android: permission =" "> <intent-filter> <action android: name =" MMBakchatServiceStart "/> <action android: name = "MMBakchatServiceStop"/> </intent-filter> </receiver> <service android: name = "com. tencent. mm. plugin. backup. bakpcmodel. bakchatPcUsbService "android: exported =" false "> <intent-filter> <action android: name =" com. tencent. mm. plugin. backup. bakpcmodel. bakchatPcUsbService "/> </intent-filter> </service> <service android: name =" com. tencent. mm. booter. coreService "// core service android: process =": push "/> <service android: name =" com. tencent. mm. booter. cache. cacheService "// buffer service android: process =": push "/> <er android: name =" com. tencent. mm. booter. MMReceivers $ BootReceiver "// launch broadcast android: process =": push "> <intent-filter> <action android: name =" android. intent. action. BOOT_COMPLETED "/> </intent-filter> </Cycler> <Cycler android: name =" com. tencent. mm. booter. MMReceivers $ ConnectionReceiver "// connect to network broadcast android: process =": push "> <intent-filter> <action android: name =" android.net. conn. CONNECTIVITY_CHANGE "/> </intent-filter> </receiver> <er android: name =" com. tencent. mm. booter. MMReceivers $ AlarmReceiver "// timer android: process =": push "/> <javaser android: name =" com. tencent. mm. jni. platformcomm. alarm "// platform timer android: exported =" false "android: process =": push "/> <er android: name =" com. tencent. mm. plugin. base. stub. WXEntryActivity $ entrypolicer "> <intent-filter> <action android: name =" com. tencent. mm. plugin. openapi. intent. ACTION_HANDLE_APP_REGISTER "/> <action android: name =" com. tencent. mm. plugin. openapi. intent. ACTION_HANDLE_APP_UNREGISTER "/> </intent-filter> </Cycler> <service android: name =" com. tencent. mm. remoteservice. remoteService "/> <er android: name =" com. tencent. mm. modelstat. watchDogPushReceiver "// watchdog broadcast android: exported =" false "android: process =": push "/> <service android: name =" com. tencent. mm. pluginsdk. model. downloader. fileDownloadManger $ FileDownloadService "/> <javaser android: name =" com. tencent. mm. pluginsdk. model. downloader. fileDownloadManger $ FileDownloadReceiver "> <intent-filter> <action android: name =" android. intent. action. DOWNLOAD_COMPLETE "/> <action android: name =" android. intent. action. download_icationication_clicked "/> </intent-filter> </receiver> <service android: name =" com. tencent. mm. plugin. accountsync. model. accountAuthenticatorService "android: exported =" true "> <intent-filter> <action android: name =" android. accounts. accountAuthenticator "/> </intent-filter> <meta-data android: name =" android. accounts. accountAuthenticator "android: resource =" @ xml/g "/> </service> <service android: name =" com. tencent. mm. plugin. accountsync. model. contactsSyncService "android: exported =" true "> <intent-filter> <action android: name =" android. content. syncAdapter "/> </intent-filter> <meta-data android: name =" android. content. syncAdapter "android: resource =" @ xml/bf "/> <meta-data android: name =" android. provider. CONTACTS_STRUCTURE "android: resource =" @ xml/aa "/> </service> <Cycler android: name =" com. tencent. mm. plugin. gcm. modelgcm. gcmBroadcastReceiver "android: permission =" com. google. android. c2dm. permission. SEND "> <intent-filter> <action android: name =" com. google. android. c2dm. intent. RECEIVE "/> <action android: name =" com. google. android. c2dm. intent. REGISTRATION "/> <category android: name =" com. tencent. mm "/> </intent-filter> </Cycler> <service android: name =" com. tencent. mm. plugin. notification. ui. failSendMsgNotification $ FailSendNormalMsgNotificationService "/> <service android: name =" com. tencent. mm. plugin. notification. ui. failSendMsgNotification $ FailSendSnsMsgNotificationService "/> <service android: name =" com. tencent. mm. sandbox. monitor. predictionmonitorservice "android: process =": sandbox "/> <service // service android: name =" com. tencent. mm. sandbox. updater. updaterService "android: process =": sandbox "/> <Cycler // android: name =" com. tencent. mm. plugin. shoot. remote. remoteNetSceneMgr $ RespReceiver "android: exported =" false "android: process =": tools "> --> </javaser> <javaser // register broadcast android: name =" com. tencent. mm. plugin. shootstub. communicate. reqReceiver "android: exported =" false "> <intent-filter> <action android: name =" com. tencent. mm. action. SHOOT_STUB_REQ "/> </intent-filter> </javaser> // web service <service android: name =" com. tencent. mm. plugin. webview. stub. webViewStubService "/>
CoreService core service

Public class CoreService extends Service implements f, ag, bs {private as eoE; // sdk platform library private AB eoF = new AB (); // network information private boolean eoG = true; public final int eoH =-1213; private final AE eoI = new d (this); private com. tencent. mm. modelstat. k eoJ = null; // call management interface private AddrBookObserver eoK; // The Local Address Book listens to private watchdogpushsf-er eoL; // The watchdog (PUSH message) private WakerLock eoM = null; private com. tence Nt. mm. platformtools. k eoN = new com. tencent. mm. platformtools. k (); // platform interface private ax eoO = new ax (new e (this), false); // thread-related operations (like Handle) private void DV () // restart {x. w ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," [complete exit] "); br. IS (). e (3, 10000, ""); bn. onDestroy (); try {// timer MMReceivers. alarmReceiver. ao (getApplicationContext (); MMReceivers. alarmReceiver. am (getApplicationContext (); Alarm. AB (getApplicationContext (); x. appenderClose (); // log record Process. killProcess (Process. myPid (); return;} catch (Exception localException) {}} public final void as (boolean paramBoolean )/ /Similar to start {if (! ParamBoolean) {x. w ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," [network lost] "); br. IO (). eBE = false; br. IP (). gn (0); br. IN (). a (10502, "", null); if (this. eoG) {br. IR (). iy (); this. eoF. ei ();} this. eoG = false;} while (true) {return; x. w ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," [network connected] "); br. IO (). eBE = true; boolean bool = this. eoF. ej (); if (this. eoG )&&(! Bool) {Object [] arrayOfObject = new Object [1]; arrayOfObject [0] = Boolean. valueOf (this. eoG); x. I ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," network not change or can't get network info, lastStatus connect: % B ", arrayOfObject);} if (bool) br. IR (). iy (); this. eoG = true; br. IP (). gn (1); br. IN (). a (10501, "", null); if (this. eoM = null) this. eoM = new WakerLock (getApplicationContext (); if (! This. eoM. isLocking () this. eoM. lock (14000L); x. I ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," checking ready, start in 7000 ms "); this. eoO. dv (7000L) ;}} public final boolean B (int paramInt, byte [] paramArrayOfByte) {int I = 0; if (getSharedPreferences ("system_config_prefs", m. gh ()). getBoolean ("settings_fully_exit", true) x. I ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," fully exited, no need to your y worker "); while (true) {return I; Intent localIntent = new Intent (this, policyreceiver. class); localIntent. putExtra ("policy_option_type", 2); localIntent. putExtra ("policy_uin", this. eoE. ID (). qk (); localIntent. putExtra ("policy_resptype", paramInt); localIntent. putExtra ("yy_respbuf", paramArrayOfByte); localIntent. putExtra (" Notfiy_recv_time ", cm. Jo (); localIntent. putExtra (" policy_skey ", this. eoE. ID (). sq (); x. I ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," Y broadcast: "+ localIntent. getAction () + ", type =" + paramInt); try {sendBroadcast (localIntent); label165: I = 1;} catch (Exception localException) {Object [] arrayOfObject = new Object [1]; arrayOfObject [I] = localException. toString (); x. f ("! 32 @/B4Tb64lLpIzvC/release + sd "," onNotify hasDestroyed % s ", arrayOfObject); break label165 :}} public IBinder onBind (Intent paramIntent) {x. d ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," onBind ~~~ ThreadID: "+ Thread. currentThread (); return this. eoE;} @ JgMethodChecked (author = 20, fComment = "checked", lastDate = "20140429", reviewer = 20, vComment = {com. jg. EType. RECEIVERCHECK}) public void onCreate () {Object localObject = null; x. d ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," onCreate ~~~ ThreadID: "+ Thread. currentThread (); super. onCreate (); if (Build. VERSION. SDK_INT <18) // set the process attribute startForeground (-1213, new Notification () based on the version; ClassLoader localClassLoader = CoreService. class. getClassLoader (); // load service o. a (com. tencent. mm. sdk. a. jBq, localClassLoader); // The jbq attributes are as follows // public static String jBq = "wechatbaseprj"; // public static String jBr = "wechatnetwork"; // public static String jBs = "Wechatxlog"; // public static String jBt = "wechatkvcomm"; // public static String jBu = "wechatcdn"; // public static String jBv = "wechataccessory "; // public static String jBx = "wechatwebp"; // public static String jBy = "wechatutils"; ak localak = new ak (Looper. getmainlogoff (); // message thread PlatformComm. a (ai. getContext (), localak); // universal platform interface g localg = new g (this); // a message localg. DX (); ac. a (this. eoI ); If (PlatformComm. exG = null) PlatformComm. exG = this; br. a (localak); // Communication Interface br. setContext (getApplicationContext (); br. a (new bt (); br. a (new bu (); br. a (this); // communication interface if (this. eoJ = null) this. eoJ = new com. tencent. mm. modelstat. k (); // network and push br. a (this. eoJ); br. a (new bk (); this. eoE = br. IR (); if (this. eoE = null) {x. I ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," autoAuth is null and new one "); this. eoE = new as (br. AE (); br. e (this. eoE); label228: bn. onCreate (); if (br. IS ()! = Null) break label551; x. I ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," NetTaskAdapter is null and new one "); br. a (new bp ();} while (true) {if (br. IT () = null) {x. I ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," NetTaskAdapter is null and new one "); br. a (new bo (); br. IT (). eBo = this;} String str1 = localg. getString (". com. tencent. mm. debug. server. host. http "); String str2 = localg. getString (". com. tencent. mm. debug. server. ports. http "); String str3 = localg. getString (". com. tencent. mm. debug. server. host. socket "); String str4 = localg. getString (". com. tencent. mm. debug. server. Ports. socket "); this. eoE. c (str1, str2, str3, str4); String str5 = localg. getString (". com. tencent. mm. debug. server. host. newdns "); String str6; String str7; label389: ConnectivityManager localConnectivityManager; if (str5! = Null) & (str5.contains (":") {String [] arrayOfString = str5.split (":"); str6 = arrayOfString [0]; str7 = arrayOfString [1]; this. eoE. setNewDnsDebugHost (str6, str7); MMReceivers. alarmReceiver. ao (getApplicationContext (); // start to accept MMReceivers. alarmReceiver. an (getApplicationContext (); localConnectivityManager = (ConnectivityManager) getSystemService ("connectivity");} try {// network NetworkInfo localNetw OrkInfo = localConnectivityManager. getActiveNetworkInfo (); localObject = localNetworkInfo; label436: if (localObject! = Null) & (localObject. getState () = NetworkInfo. state. CONNECTED) break label581; br. IO (). eBE = false; br. IP (). gn (0); label464: this. eoK = new AddrBookObserver (this); getContentResolver (). registerContentObserver (com. tencent. mm. pluginsdk. a. aJf (), true, this. eoK); this. eoL = new WatchDogPushReceiver (); registerReceiver (this. eoL, new IntentFilter ("com. tencent. mm. watchDogPushReceiver "); o. a (com. tenc Ent. mm. sdk. a. jBy, CoreService. class. getClassLoader (); return; x. w ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," autoAuth is not null and reset "); this. eoE. reset (); break label228: label551: x. w ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," NetTaskAdapter is not null and reset "); label581: br. IS (). reset ();} catch (Exception localException) {x. e ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," getActiveNetworkInfo failed. "); break label436: br. IO (). eBE = true; br. IP (). gn (1); break label464: str6 = str5; str7 = null; break label389 :}} public void onDestroy () // destroy {x. d ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," onDestroy ~~~ ThreadID: "+ Thread. currentThread (); this. eoJ. a (10002, null, null); // getContentResolver () related to the push message (). unregisterContentObserver (this. eoK); // cancel the address book to listen to unregisterReceiver (this. eoL); // cancel pushing super. onDestroy (); DV (); // restart} public void onRebind (Intent paramIntent) {x. d ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," onRebind ~~~ ThreadID: "+ Thread. currentThread (); super. onRebind (paramIntent);} public boolean onUnbind (Intent paramIntent) {x. d ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," onUnbind ~~~ ThreadID: "+ Thread. currentThread (); br. IO (). a (null); // Communication Interface br. IU (). a (null); return super. onUnbind (paramIntent);} public final void restartProcess () // restart {x. w ("! 32 @/B4Tb64lLpIzvC/moQitzBn6RBAuk + sd "," restartProcess "); DV ();}}


Conclusion

Why can't its services be killed? The author guesses as follows:

1. reflect and modify the attributes of your app, so that you can receive the broadcast. (Not found from source code)

2. There are calls in the general SDK library, and QQ, address book, and so on share a library. This library determines that this service is enabled. (Not found from source code)

3. The timer is triggered cyclically. For example, there is a time interval between the ending processes. Do you want to use this interval to start each other? (I guess the source code is not followed up in detail)

4. List the App as a system level and install it to the system directory. (Not found from source code)


No matter whether the conclusion is correct, you can test the result by yourself.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.