Ale*_*zev 12 java java-native-interface android uninstall
我发现卸载后的360安全应用程序在浏览器中打开了他们的页面.
他们可以在所有Android版本(4. ,5.和6.*)上做到这一点,我不明白如何.
也许有人有任何想法?我在这里和这里以及其他人都知道同样的问题,但他们仍然没有答案.
这不是一个bug,inotify 因为它仅适用于<4.4.2 android,没有其他进程以新方式侦听相同的bug,我查了一下.
他们的lib中有一些魔力 eternity.so
让我试着澄清一下.
在我们可以使用Android 4.4之前inotify,它提供了一种监视文件系统事件的机制,我们创建了一个守护进程来监视我们在应用程序目录中创建的文件是否已删除或我们的主应用程序目录是否已删除,这应该在用户卸载应用程序时发生,JNI代码看起来像这样:
// initializes a new inotify instance and returns a file descriptor
fd = inotify_init();
// watch directory delete/create events
inotify_add_watch(fd, DIRECTORY, IN_DELETE | IN_CREATE);
__android_log_print(ANDROID_LOG_INFO, "TAG", "Watching [%s]", DIRECTORY);
// TODO: implement checkIfDeleted
if(checkIfDeleted()) {
// execute intent to open url
system("/system/bin/am start --user 0 -a android.intent.action.VIEW -d https://www...");
Run Code Online (Sandbox Code Playgroud)
这不再有效,因为卸载还会终止组进程,从当前源代码附加相关代码
看一下git log
我需要更多时间来研究无根设备,360security将应用程序与特定架构(也称为ABI)打包,并且可能每个API都可以减少APK大小,遗憾的是apkmirror(.com)只有ARM可供下载,我更喜欢阅读x86,可能在不久的将来编辑这个答案.
到目前为止,本机代码似乎正在创建文件并使用锁来检测卸载后进程何时死机,然后使用JNI接口来调用回调.
为了简化,似乎它自己锁定,然后加入同步模块notify_and_waitfor.
您可以在此处查看Android 5.0的本机代码示例
NativeHelper源代码(反编译):
带关键字的所有方法native都在eternity二进制内部实现
package com.qihoo.eternity;
import com.qihoo.eternity.b;
public class NativeHelper {
static {
try {
System.loadLibrary((String)"eternity");
}
catch (Exception exception) {}
}
public native void look(String var1, String var2, String var3, String var4, String var5);
public void onU() {
b.a().g();
}
public native void pass(String var1, String var2);
public void peerDead() {
b.a().f();
}
public native void watch(String var1, String var2, String var3, String var4);
public native void watch2(String var1, String var2, String var3, String var4, String var5);
}
Run Code Online (Sandbox Code Playgroud)
NativeHelper的应用程序参考:
com/qihoo/eternity/b.java:203:
new NativeHelper().look(b.this.h.getPackageName(), b.b((b)b.this).f, string2, b.b(b.this.i), string3);
com/qihoo/eternity/b.java:224:
new NativeHelper().watch(new File(file, "a1").getAbsolutePath(), new File(file, "a2").getAbsolutePath(), new File(file, "a3").getAbsolutePath(), new File(file, "a4").getAbsolutePath());
com/qihoo/eternity/b.java:264:
new NativeHelper().watch(new File(file, "a2").getAbsolutePath(), new File(file, "a1").getAbsolutePath(), new File(file, "a4").getAbsolutePath(), new File(file, "a3").getAbsolutePath());
com/qihoo/eternity/b.java:518:
new NativeHelper().pass(this.a, this.b);
com/qihoo/eternity/b.java:563:
new NativeHelper().watch2(new File(file, "b1").getAbsolutePath(), new File(file, "b2").getAbsolutePath(), new File(file, "b3").getAbsolutePath(), new File(file, "b4").getAbsolutePath(), b.this.h.getDir("lib", 0).getAbsolutePath());
com/qihoo/eternity/b.java:588:
new NativeHelper().watch2(new File(file, "b2").getAbsolutePath(), new File(file, "b1").getAbsolutePath(), new File(file, "b4").getAbsolutePath(), new File(file, "b3").getAbsolutePath(), b.this.h.getDir("lib", 0).getAbsolutePath());
Run Code Online (Sandbox Code Playgroud)
一种解决方案是eternity.so在JNI文件夹中包含共享对象并实现NativeHelper.onU方法:)
应用程序可以指定BroadcastReceiverwith 操作:
"android.intent.action.PACKAGE_REMOVED"
Run Code Online (Sandbox Code Playgroud)
每次删除包时都会调用它,即使它是应用程序自己的包。然后,在 中Receiver,应用程序可以检查到底删除了哪个包并做出相应的反应。
请注意,不同版本的系统可能会对此进行不同的处理,Receiver在应用程序进程关闭之前给出不同的时间。因此,执行的操作应该快速并针对外部目标,例如发送一个ACTION_VIEW带有您提到的网页网址的 Intent :-)
| 归档时间: |
|
| 查看次数: |
1091 次 |
| 最近记录: |