tiann / KernelSU

A Kernel based root solution for Android
https://kernelsu.org
GNU General Public License v3.0
10.05k stars 1.63k forks source link

Cannot launch Manager in /system/priv-app/ with WSA #551

Closed s1204IT closed 1 year ago

s1204IT commented 1 year ago

Describe the bug Place the APK of KernelSU Manager in the /system/priv-app/KernelSU/KernelSU.apk and boot the device with clean user data.

To Reproduce Steps to reproduce the behavior:

  1. Put latest APK: /system/priv-app/KernelSU/KernelSU.apk
  2. Boot device
  3. Launch KernelSU Manager

Expected behavior The application starts normally.

Smartphone (please complete the following information):

Additional context

logcat ``` I IntentRedirectionHandler: Start activity for package me.weishu.kernelsu activityId 93ce118c-0900-49d5-aef4-493e6ce91703 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10010000 pkg=me.weishu.kernelsu cmp=me.weishu.kernelsu/.ui.MainActivity} from uid 10062 I IntentRedirectionHandler: Start activity for package me.weishu.kernelsu result: true V WsaTaskManager: TaskStackListener onTaskCreated task: 5 ComponentInfo{me.weishu.kernelsu/me.weishu.kernelsu.ui.MainActivity} V WsaTaskManager: TaskStackListener onTaskMovedToFront taskInfo: TaskInfo{userId=0 taskId=5 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10010000 pkg=me.weishu.kernelsu cmp=me.weishu.kernelsu/.ui.MainActivity } baseActivity=ComponentInfo{me.weishu.kernelsu/me.weishu.kernelsu.ui.MainActivity} topActivity=ComponentInfo{me.weishu.kernelsu/me.weishu.kernelsu.ui.MainActivity} origActivity=null realActivity=ComponentInfo{me.weishu.kernelsu/me.weishu.kernelsu.ui.MainActivity} numActivities=1 lastActiveTime=58328 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@173406a} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 displayCutoutSafeInsets=null topActivityInfo=ActivityInfo{7aee95b me.weishu.kernelsu.ui.MainActivity} launchCookies=[] positionInParent=Point(440, 262) parentTaskId=-1 isFocused=false isVisible=false isSleeping=false topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false locusId=null displayAreaFeatureId=1 cameraCompatControlState=hidden} I ActivityManager: Start proc 3311:me.weishu.kernelsu/u0a28 for top-activity {me.weishu.kernelsu/me.weishu.kernelsu.ui.MainActivity} I WsaTaskManager: onTaskAppeared taskId: 5 packageName: me.weishu.kernelsu V GraphicsEnvironment: ANGLE Developer option for 'me.weishu.kernelsu' set to: 'default' V GraphicsEnvironment: ANGLE GameManagerService for me.weishu.kernelsu: false D CoreBackPreview: Window{a8db9b7 u0 me.weishu.kernelsu/me.weishu.kernelsu.ui.MainActivity}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@d83588d, mPriority=-1} I ActivityTaskManager: Displayed me.weishu.kernelsu/.ui.MainActivity: +268ms E AndroidRuntime: Process: me.weishu.kernelsu, PID: 3311 E AndroidRuntime: at me.weishu.kernelsu.Natives.(Unknown Source:2) W ActivityTaskManager: Force finishing activity me.weishu.kernelsu/.ui.MainActivity I WindowManager: WIN DEATH: Window{a8db9b7 u0 me.weishu.kernelsu/me.weishu.kernelsu.ui.MainActivity} W InputManager-JNI: Input channel object 'a8db9b7 me.weishu.kernelsu/me.weishu.kernelsu.ui.MainActivity (client)' was disposed without first being removed with the input manager! I ActivityManager: Process me.weishu.kernelsu (pid 3311) has died: prcp TOP W WindowManager: Exception thrown during dispatchAppVisibility Window{a8db9b7 u0 me.weishu.kernelsu/me.weishu.kernelsu.ui.MainActivity EXITING} W InputManager-JNI: Input channel object 'aaef6f4 Splash Screen me.weishu.kernelsu (client)' was disposed without first being removed with the input manager! W ActivityTaskManager: Activity top resumed state loss timeout for ActivityRecord{e0ad4c4 u0 me.weishu.kernelsu/.ui.MainActivity} t-1 f}} ```

Reinstall the same APK and it will start.

adb shell pm install -r /system/priv-app/KernelSU/KernelSU.apk

Pre-built https://github.com/YT-Advanced/WSA-Script/actions/runs/5088965426

tiann commented 1 year ago

This is intend behavior, KernelSU shouldn't be a system apk. There are many reasons:

  1. It cannot be uninstalled, so others can detect it by package.
  2. The manager should be opened at least once, otherwise the module system won't work. If you make it a builtin, and make some builtin module, the module won't work.
s1204IT commented 1 year ago

Can we change the structure to something like Magisk?

tiann commented 1 year ago

Which structure?

s1204IT commented 1 year ago

Which structure?

KernelSU manager is installed from the first boot of the device without direct deployment on the system.

tiann commented 1 year ago

Because KernelSU modify the kernel, so this step must be done in the kernel, but the kernel is GPL-2 and the manager is GPL-3, they are not compatible, we cannot put manager to kernel, so there isn't a good way to do that.

Maybe you can put the ksud to /data/adb, and put a script to /data/adb/service.d and it would work without manager, and install manager in this script.

YT-Advanced commented 1 year ago

Maybe you can put the ksud to /data/adb, and put a script to /data/adb/service.d and it would work without manager, and install manager in this script.

Can you explain more about this way. Do you mean place ksud.so to /data/adb ? And also please give me a example script

hmtheboy154 commented 1 year ago

Which structure?

KernelSU manager is installed from the first boot of the device without direct deployment on the system.

Or you can do like what I did here https://github.com/supremegamers/device_generic_common/blob/bliss/12l-x86/init.sh#L679

So as you can see, whenever I build a new version, when booting new apps will always being installed. I use this one to install or update some user apps including KernelSU Manager on BlissOS