Skip to content

manager: add webview padding if no request from insets css#3083

Merged
aviraxp merged 3 commits into
tiann:mainfrom
KOWX712:inset
Dec 21, 2025
Merged

manager: add webview padding if no request from insets css#3083
aviraxp merged 3 commits into
tiann:mainfrom
KOWX712:inset

Conversation

@KOWX712

@KOWX712 KOWX712 commented Dec 20, 2025

Copy link
Copy Markdown
Collaborator
  • Also expose ksu.enableInsets() for js to enable/disable webview insets.
  • Since not all webui support insets, insets now is disabled by default, but if web request resource from internal/insets.css, insets will be enabled once automatically.
  • No changes are required for current WebUI. This makes insets feature fully opt-in only, web that doesn't support inset will not be affected anymore.
  • Usecase: if a webui want to use inset, it can request insets css at first, but if it want to load external webpage in current window afterwards then it can use ksu.enableInsets(false) to disable insets.

Signed-off-by: KOWX712 leecc0503@gmail.com

- Also expose ksu.enableInsets() for js to enable/disable webview insets.
- Since not all webui support insets, insets now is disabled by defaule, but if web request resource from `internal/insets.css`, insets will be enabled once automatically.
- No changes are required for current WebUI. This makes insets feature fully opt-in only, web that doesn't support inset will not be affected anymore.
- Usecase: if a webui want to use inset, it can request insets css at first, but if it want to load external webpage in current window afterwards then it can use ksu.enableInsets(false) to disable insets.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the webview insets feature opt-in to prevent affecting WebUIs that don't support insets. The insets are now disabled by default and automatically enabled when internal/insets.css is requested. Additionally, a JavaScript interface ksu.enableInsets() is exposed to allow WebUIs to dynamically control insets behavior.

Key changes:

  • Insets feature is now disabled by default with automatic opt-in when internal/insets.css is requested
  • Added ksu.enableInsets() JavaScript interface for runtime insets control
  • WebView is now wrapped in a FrameLayout container with conditional padding based on insets state

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
WebViewInterface.kt Adds enableInsets() JavaScript interface method to allow web content to control insets
WebUIActivity.kt Wraps WebView in a FrameLayout container, moves insets listener to container, adds conditional padding logic, and implements enableInsets() method
SuFilePathHandler.java Adds OnInsetsRequestedListener interface and callback to notify when internal/insets.css is requested

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebUIActivity.kt Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebUIActivity.kt Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt Outdated
@aviraxp aviraxp merged commit 3385b10 into tiann:main Dec 21, 2025
16 checks passed
aviraxp pushed a commit that referenced this pull request Dec 21, 2025
documentation for #2952, #3083

Signed-off-by: KOWX712 <leecc0503@gmail.com>
@KOWX712 KOWX712 deleted the inset branch December 21, 2025 08:33
KOWX712 added a commit to KOWX712/KernelSU that referenced this pull request Dec 21, 2025
- Also expose ksu.enableInsets() for js to enable/disable webview
insets.
- Since not all webui support insets, insets now is disabled by default,
but if web request resource from `internal/insets.css`, insets will be
enabled once automatically.
- No changes are required for current WebUI. This makes insets feature
fully opt-in only, web that doesn't support inset will not be affected
anymore.
- Usecase: if a webui want to use inset, it can request insets css at
first, but if it want to load external webpage in current window
afterwards then it can use ksu.enableInsets(false) to disable insets.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/KernelSU that referenced this pull request Dec 21, 2025
documentation for tiann#2952, tiann#3083

Signed-off-by: KOWX712 <leecc0503@gmail.com>
rsuntk pushed a commit to rsuntk/KernelSU that referenced this pull request Dec 21, 2025
- Also expose ksu.enableInsets() for js to enable/disable webview
insets.
- Since not all webui support insets, insets now is disabled by default,
but if web request resource from `internal/insets.css`, insets will be
enabled once automatically.
- No changes are required for current WebUI. This makes insets feature
fully opt-in only, web that doesn't support inset will not be affected
anymore.
- Usecase: if a webui want to use inset, it can request insets css at
first, but if it want to load external webpage in current window
afterwards then it can use ksu.enableInsets(false) to disable insets.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/APatch that referenced this pull request Dec 23, 2025
sync tiann/KernelSU#2952, tiann/KernelSU#3083

add insets support to WebUI, no change are required for existing WebUI module.

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
bklynali pushed a commit to bklynali/BK-KSU that referenced this pull request Dec 23, 2025
- Also expose ksu.enableInsets() for js to enable/disable webview
insets.
- Since not all webui support insets, insets now is disabled by default,
but if web request resource from `internal/insets.css`, insets will be
enabled once automatically.
- No changes are required for current WebUI. This makes insets feature
fully opt-in only, web that doesn't support inset will not be affected
anymore.
- Usecase: if a webui want to use inset, it can request insets css at
first, but if it want to load external webpage in current window
afterwards then it can use ksu.enableInsets(false) to disable insets.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
bklynali pushed a commit to bklynali/BK-KSU that referenced this pull request Dec 23, 2025
documentation for tiann#2952, tiann#3083

Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Dec 24, 2025
ref: tiann/KernelSU#2952, tiann/KernelSU#3083

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Dec 24, 2025
ref: tiann/KernelSU#2952, tiann/KernelSU#3083

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Dec 24, 2025
ref: tiann/KernelSU#2952, tiann/KernelSU#3083

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Dec 28, 2025
ref: tiann/KernelSU#2952, tiann/KernelSU#3083

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Dec 28, 2025
ref: tiann/KernelSU#2952, tiann/KernelSU#3083

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Dec 28, 2025
ref: tiann/KernelSU#2952, tiann/KernelSU#3083

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/KernelSU that referenced this pull request Jan 1, 2026
since insets is toggeable in tiann#3083, fullScreen will only toggle system bar but not insets. This commit restore how fullScreen function like previous version, both system bar and insets are toggled simultaniously.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
aviraxp pushed a commit that referenced this pull request Jan 1, 2026
since insets is toggeable in #3083, fullScreen will only toggle system
bar but not insets. This commit restore how fullScreen function like
previous version, both system bar and insets are toggled simultaniously.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
rsuntk pushed a commit to rsuntk/KernelSU that referenced this pull request Jan 3, 2026
since insets is toggeable in tiann#3083, fullScreen will only toggle system
bar but not insets. This commit restore how fullScreen function like
previous version, both system bar and insets are toggled simultaniously.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
Signed-off-by: rsuntk <rissu.ntk@gmail.com>
KOWX712 added a commit to KOWX712/KernelSU that referenced this pull request Jan 3, 2026
since insets is toggeable in tiann#3083, fullScreen will only toggle system
bar but not insets. This commit restore how fullScreen function like
previous version, both system bar and insets are toggled simultaniously.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
- Also expose ksu.enableInsets() for js to enable/disable webview
insets.
- Since not all webui support insets, insets now is disabled by default,
but if web request resource from `internal/insets.css`, insets will be
enabled once automatically.
- No changes are required for current WebUI. This makes insets feature
fully opt-in only, web that doesn't support inset will not be affected
anymore.
- Usecase: if a webui want to use inset, it can request insets css at
first, but if it want to load external webpage in current window
afterwards then it can use ksu.enableInsets(false) to disable insets.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
documentation for tiann#2952, tiann#3083

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
since insets is toggeable in tiann#3083, fullScreen will only toggle system
bar but not insets. This commit restore how fullScreen function like
previous version, both system bar and insets are toggled simultaniously.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
- Also expose ksu.enableInsets() for js to enable/disable webview
insets.
- Since not all webui support insets, insets now is disabled by default,
but if web request resource from `internal/insets.css`, insets will be
enabled once automatically.
- No changes are required for current WebUI. This makes insets feature
fully opt-in only, web that doesn't support inset will not be affected
anymore.
- Usecase: if a webui want to use inset, it can request insets css at
first, but if it want to load external webpage in current window
afterwards then it can use ksu.enableInsets(false) to disable insets.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
documentation for tiann#2952, tiann#3083

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
since insets is toggeable in tiann#3083, fullScreen will only toggle system
bar but not insets. This commit restore how fullScreen function like
previous version, both system bar and insets are toggled simultaniously.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
Prslc pushed a commit to Prslc/APatch that referenced this pull request Jan 6, 2026
sync tiann/KernelSU#2952, tiann/KernelSU#3083

add insets support to WebUI, no change are required for existing WebUI module.

minor touch up

manager: fix ksu.fullScreen

ref: tiann/KernelSU#3126

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 8, 2026
- Also expose ksu.enableInsets() for js to enable/disable webview
insets.
- Since not all webui support insets, insets now is disabled by default,
but if web request resource from `internal/insets.css`, insets will be
enabled once automatically.
- No changes are required for current WebUI. This makes insets feature
fully opt-in only, web that doesn't support inset will not be affected
anymore.
- Usecase: if a webui want to use inset, it can request insets css at
first, but if it want to load external webpage in current window
afterwards then it can use ksu.enableInsets(false) to disable insets.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 8, 2026
documentation for tiann#2952, tiann#3083

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 8, 2026
since insets is toggeable in tiann#3083, fullScreen will only toggle system
bar but not insets. This commit restore how fullScreen function like
previous version, both system bar and insets are toggled simultaniously.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
Admirepowered pushed a commit to bmax121/APatch that referenced this pull request Jan 10, 2026
sync tiann/KernelSU#2952, tiann/KernelSU#3083

add insets support to WebUI, no change are required for existing WebUI module.



Signed-off-by: KOWX712 <leecc0503@gmail.com>
Co-authored-by: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-authored-by: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Prslc pushed a commit to Prslc/APatch that referenced this pull request Jan 11, 2026
sync tiann/KernelSU#2952, tiann/KernelSU#3083

add insets support to WebUI, no change are required for existing WebUI module.

minor touch up

manager: fix ksu.fullScreen

ref: tiann/KernelSU#3126

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 13, 2026
- Also expose ksu.enableInsets() for js to enable/disable webview
insets.
- Since not all webui support insets, insets now is disabled by default,
but if web request resource from `internal/insets.css`, insets will be
enabled once automatically.
- No changes are required for current WebUI. This makes insets feature
fully opt-in only, web that doesn't support inset will not be affected
anymore.
- Usecase: if a webui want to use inset, it can request insets css at
first, but if it want to load external webpage in current window
afterwards then it can use ksu.enableInsets(false) to disable insets.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 13, 2026
documentation for tiann#2952, tiann#3083

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 13, 2026
since insets is toggeable in tiann#3083, fullScreen will only toggle system
bar but not insets. This commit restore how fullScreen function like
previous version, both system bar and insets are toggled simultaniously.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 13, 2026
since insets is toggeable in tiann#3083, fullScreen will only toggle system
bar but not insets. This commit restore how fullScreen function like
previous version, both system bar and insets are toggled simultaniously.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 13, 2026
since insets is toggeable in tiann#3083, fullScreen will only toggle system
bar but not insets. This commit restore how fullScreen function like
previous version, both system bar and insets are toggled simultaniously.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 14, 2026
since insets is toggeable in tiann#3083, fullScreen will only toggle system
bar but not insets. This commit restore how fullScreen function like
previous version, both system bar and insets are toggled simultaniously.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 20, 2026
since insets is toggeable in tiann#3083, fullScreen will only toggle system
bar but not insets. This commit restore how fullScreen function like
previous version, both system bar and insets are toggled simultaniously.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Feb 8, 2026
ref: tiann/KernelSU#2952, tiann/KernelSU#3083

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Feb 23, 2026
- Also expose ksu.enableInsets() for js to enable/disable webview
insets.
- Since not all webui support insets, insets now is disabled by default,
but if web request resource from `internal/insets.css`, insets will be
enabled once automatically.
- No changes are required for current WebUI. This makes insets feature
fully opt-in only, web that doesn't support inset will not be affected
anymore.
- Usecase: if a webui want to use inset, it can request insets css at
first, but if it want to load external webpage in current window
afterwards then it can use ksu.enableInsets(false) to disable insets.

Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Mar 11, 2026
ref: tiann/KernelSU#2952, tiann/KernelSU#3083

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Mar 11, 2026
ref: tiann/KernelSU#2952, tiann/KernelSU#3083

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Apr 14, 2026
ref: tiann/KernelSU#2952, tiann/KernelSU#3083

Co-Authored-By: Der_Googler <54764558+dergoogler@users.noreply.github.com>
Co-Authored-By: Light_summer <93428659+lightsummer233@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/FolkPatch that referenced this pull request May 29, 2026
The WebUI failed to load CSS/JS assets because the WebView was configured and loadUrl was called inside the AndroidView factory during Compose composition, which blocked the main thread and called loadUrl before the WebView had valid dimensions.
Refactor to match the KernelSU pattern:
- Create WebView and configure WebViewAssetLoader on IO dispatcher
- Build WebView fully on Main thread outside AndroidView
- Defer loadUrl until width > 0 && height > 0 via layout listener

- related:
  - tiann/KernelSU#2952
  - tiann/KernelSU#3083
  - tiann/KernelSU#3126
  - tiann/KernelSU#3190

Signed-off-by: KOWX712 <leecc0503@gmail.com>
matsuzaka-yuki pushed a commit to LyraVoid/FolkPatch that referenced this pull request May 30, 2026
#151)

The WebUI failed to load CSS/JS assets because the WebView was configured and loadUrl was called inside the AndroidView factory during Compose composition, which blocked the main thread and called loadUrl before the WebView had valid dimensions.
Refactor to match the KernelSU pattern:
- Create WebView and configure WebViewAssetLoader on IO dispatcher
- Build WebView fully on Main thread outside AndroidView
- Defer loadUrl until width > 0 && height > 0 via layout listener

- related:
  - tiann/KernelSU#2952
  - tiann/KernelSU#3083
  - tiann/KernelSU#3126
  - tiann/KernelSU#3190

Signed-off-by: KOWX712 <leecc0503@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants