Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is plug-in technology?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "what is plug-in technology". Friends who are interested might as well take a look at it. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what is plug-in technology"!

What is a plug-in, generally refers to an apk, dex, jar file. Plug-in technology means that the plug-in is loaded through classloader and then can be used by the host system. Plug-in files generally refer to access from the network and stored on the sdcard. Of course, apk that has been installed in the phone's data/app directory can also be called a plug-in.

The main difficulty of plug-in technology is how to load plug-ins with classloader. Classloader loads single classloader and multi-classloader. The advantage of multi-classloader is obvious. The classes of each plug-in are isolated in different classloader, so there will be no problem with different versions of the same library. But for Android, there are too many points in multi-classloader hook system api (mainly classloader in hook LoadedApk, replace classloader with custom classloader, which is a tortuous process) A single classloader hook is simpler (you only need to get the current classloader in the host APP, usually PathClassloader, and get the parent class BaseDexClassLoader#pathList, which stores the Element object generated by the plug-in file, so add our plug-in to generate an Element into it)

The idea of plug-in is relatively simple, but the implementation is more complex, because it needs to reflect a lot of hook system apk, which is not very good for the stability of the system. And with the Android system upgrade requires constant maintenance, so the development of such a plug-in requires a dedicated team maintenance cost is relatively high.

Virtual APP

Virtual APP implementation is a direct virtual replacement of the main services of the system, of course, the implementation process is also through the reflection system api, and then its own replacement to achieve the interception of the APP running process.

Virtual app application installation system existing applications and show, click to start the target application to start virtual APP LeadingActivity, at this time running in the APP process.

Then start activity through VAMS, which runs in the VAMS process, where you replace the target intent with StubAcitivy. Then start StubActivity and run in the StubAcitity process: P, and the following will run in: P process as the process that starts APP

Then call ActivityManagerNative through reflection, and then start activity across the process call system AMS, following the system startActivity process. And then because of hook, HCallbackHandler. Replace the original real target intent in callback. Then callback returns to false and continues to give it to ActivityThread#handlerLauncherAcitivty for processing

At this point, I believe you have a deeper understanding of "what is plug-in technology". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report