skittles9823 / QuickSwitch

867 stars 40 forks source link

[Bug Report] The command did not take effect after running and restarting when using KernelSU #52

Open GoodbyeNJN opened 8 months ago

GoodbyeNJN commented 8 months ago

Description:

After excuting /data/adb/modules/quickswitch/quickswitch --ch=app.lawnchair command and restarting, the recents provider did not switch to Lawnchair correctly.

Environment:

Causes:

After executing the command, the directory structure was as follows (some files have been omitted):

.
├── overlays
│   ├── AndroidManifest.xml
│   └── overlay
│       └── values
│           ├── bools.xml
│           └── strings.xml
├── product
│   └── overlay
│       └── QuickSwitchOverlay
│           └── QuickSwitchOverlay.apk
└── system
    ├── etc
    │   ├── permissions
    │   │   └── privapp-permissions-app.lawnchair.xml
    │   └── sysconfig
    │       └── app.lawnchair-hiddenapi-package-whitelist.xml
    └── priv-app
        └── QuickSwitch-app.lawnchair-107
            └── QuickSwitch-app.lawnchair-107.apk

According to KernelSU documentation, the directory structure should be like this:

/data/adb/modules
├── .
├── .
|
└── $MODID                  <--- The folder is named with the ID of the module
    │
    │      *** Main Contents ***
    │
    ├── system              <--- This folder will be mounted if skip_mount does not exist
    │   ├── ...
    │   ├── ...
    │   └── ...
    │
    │      *** Auto Generated, DO NOT MANUALLY CREATE OR MODIFY ***
    │
    ├── vendor              <--- A symlink to $MODID/system/vendor
    ├── product             <--- A symlink to $MODID/system/product
    └── system_ext          <--- A symlink to $MODID/system/system_ext

Where product should be a symlink, but was actually a normal directory created by quickswitch, so it was not mounted correctly by overlayfs, which can be fixed by simply moving the product directory to the system directory

Reference: https://kernelsu.org/guide/module.html#kernelsu-modules