You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Introduce a new communication method between Magisk and Magisk Manager. Magisk used to hardcode classnames and send broadcast/start activities to specific components. This new method makes no assumption of any class names, so Magisk Manager can easily be fully obfuscated. In addition, the new method connects Magisk and Magisk Manager with random abstract Linux sockets instead of socket files in filesystems, bypassing file system complexities (selinux, permissions and such)
36 lines
1.3 KiB
Java
36 lines
1.3 KiB
Java
package com.topjohnwu.magisk.receivers;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.text.TextUtils;
|
|
|
|
import com.topjohnwu.magisk.Data;
|
|
import com.topjohnwu.magisk.SuRequestActivity;
|
|
import com.topjohnwu.magisk.services.OnBootService;
|
|
import com.topjohnwu.magisk.utils.SuConnector;
|
|
|
|
public class BootReceiver extends BroadcastReceiver {
|
|
|
|
@Override
|
|
public void onReceive(Context context, Intent intent) {
|
|
if (TextUtils.equals(intent.getAction(), Intent.ACTION_BOOT_COMPLETED)) {
|
|
switch (intent.getExtras().getString("action", "boot")) {
|
|
case "request":
|
|
Intent i = new Intent(context, Data.classMap.get(SuRequestActivity.class))
|
|
.putExtra("socket", intent.getStringExtra("socket"))
|
|
.putExtra("version", 2)
|
|
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
context.startActivity(i);
|
|
break;
|
|
case "log":
|
|
SuConnector.handleLogs(intent, 2);
|
|
break;
|
|
case "boot":
|
|
OnBootService.enqueueWork(context);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|