Skip to content

manager: introduce webui package manager api#2928

Merged
tiann merged 9 commits into
tiann:mainfrom
KOWX712:webui_pm
Nov 14, 2025
Merged

manager: introduce webui package manager api#2928
tiann merged 9 commits into
tiann:mainfrom
KOWX712:webui_pm

Conversation

@KOWX712

@KOWX712 KOWX712 commented Nov 13, 2025

Copy link
Copy Markdown
Collaborator

this is a squash of:

Co-Authored-By: Rifat Azad 33044977+rifsxd@users.noreply.github.com
Co-Authored-By: Fahrez256Bit 167403685+fahrez256@users.noreply.github.com
Signed-off-by: KOWX712 leecc0503@gmail.com

KOWX712 and others added 2 commits November 13, 2025 14:05
this is a squash of:

* manager: introduce app package info API for webui-next (KernelSU-Next/KernelSU-Next@58167a4)

* manager: sort a-z order for webui-next list packages api (KernelSU-Next/KernelSU-Next@4a9733c)

* manager: implement getPackagesIcons and cacheAllPackageIcons api to webui-next (KernelSU-Next/KernelSU-Next@a361fa3)

* manager/webui: let getPackagesIcons generate icon and store in cache as well when called (KernelSU-Next/KernelSU-Next@6afa86d)

* POC: load icon app via ksu://icon/[packageName] (KernelSU-Next#674) (KernelSU-Next/KernelSU-Next@bc9927b)

* manager: refine webui package manager (0400c42)

Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-Authored-By: Fahrez256Bit <167403685+fahrez256@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
@KOWX712

KOWX712 commented Nov 13, 2025

Copy link
Copy Markdown
Collaborator Author

这里同时提供了 ksu://icon/[packageName] 和 getPackagesIcons() 两种获取图标的方式,如果觉得不需要可以移除 getPackagesIcons()

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 introduces a comprehensive package manager API for the WebUI, enabling web-based modules to query installed applications and retrieve their metadata and icons. The changes include JavaScript interface methods for package listing, detailed package information retrieval, and icon caching mechanisms, along with a custom ksu://icon/[packageName] URL scheme handler.

  • Adds JavaScript interface APIs (listPackages, getPackagesInfo, getPackagesIcons, cacheAllPackageIcons) for package management in WebView
  • Implements dual icon caching strategies: Base64-encoded strings for JavaScript access and bitmap cache for URL-based access
  • Preloads app list at application startup for improved initial response time

Reviewed Changes

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

Show a summary per file
File Description
WebViewInterface.kt Implements four new JavaScript interface methods for package listing, metadata retrieval, and icon encoding with Base64 caching
WebUIActivity.kt Adds ksu://icon/ URL scheme handler to serve app icons directly via WebView requests and initializes SuperUserViewModel
AppIconUtil.java Provides utility for synchronous icon loading with bitmap caching for the URL handler
SuperUserViewModel.kt Exposes static apps list and getAppIconDrawable() helper for cross-component access
KernelSUApplication.kt Implements ViewModelStoreOwner and preloads app list during application initialization

💡 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/AppIconUtil.java Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/webui/AppIconUtil.java Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt Outdated
Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/webui/WebViewInterface.kt Outdated
KOWX712 and others added 6 commits November 13, 2025 20:39
…nterface.kt

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The @RequiresApi(Build.VERSION_CODES.P) annotation is unnecessary here. The PackageInfo.longVersionCode property (line 246) was indeed added in API 28 (P), but this annotation doesn't prevent runtime crashes on older APIs. Consider using a version check or the compat accessor PackageInfoCompat.getLongVersionCode() from AndroidX core library for backward compatibility.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Memory leak: Bitmaps stored in the cache are never cleared, which can lead to memory exhaustion over time, especially with many applications installed. Consider implementing a size-limited cache (e.g., using LruCache) or clearing the cache when appropriate.

Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>
…til.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The static apps field is accessed from multiple threads without synchronization. The field is written in fetchAppList() (line 173 in the full file) which runs on IO dispatcher, but is read from WebView JavaScript interface methods which run on arbitrary threads. This can lead to race conditions and visibility issues.
…til.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@KOWX712 KOWX712 marked this pull request as draft November 13, 2025 13:13
@KOWX712 KOWX712 marked this pull request as ready for review November 13, 2025 13:20
@KOWX712

KOWX712 commented Nov 13, 2025

Copy link
Copy Markdown
Collaborator Author

demo index.html

@CanerKaraca23

CanerKaraca23 commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

What about integrating all WebUI X features to KernelSU?

@Ylarod Ylarod requested a review from YuKongA November 14, 2025 00:05

@YuKongA YuKongA left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Image

@tiann tiann merged commit 2ab6152 into tiann:main Nov 14, 2025
15 checks passed
@KOWX712 KOWX712 deleted the webui_pm branch November 14, 2025 03:58
tiann pushed a commit that referenced this pull request Nov 14, 2025
npm update #2928

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
KOWX712 added a commit to KOWX712/KernelSU that referenced this pull request Nov 14, 2025
this is a squash of:

* manager: introduce app package info API for webui-next
(KernelSU-Next/KernelSU-Next@58167a4)

* manager: sort a-z order for webui-next list packages api
(KernelSU-Next/KernelSU-Next@4a9733c)

* manager: implement getPackagesIcons and cacheAllPackageIcons api to
webui-next (KernelSU-Next/KernelSU-Next@a361fa3)

* manager/webui: let getPackagesIcons generate icon and store in cache
as well when called (KernelSU-Next/KernelSU-Next@6afa86d)

* POC: load icon app via ksu://icon/[packageName] (KernelSU-Next#674)
(KernelSU-Next/KernelSU-Next@bc9927b)

* manager: refine webui package manager (0400c42)

Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-Authored-By: Fahrez256Bit
<167403685+fahrez256@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>

---------

Signed-off-by: KOWX712 <leecc0503@gmail.com>
Co-authored-by: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-authored-by: Fahrez256Bit <167403685+fahrez256@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
KOWX712 added a commit to KOWX712/KernelSU that referenced this pull request Nov 14, 2025
npm update tiann#2928

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
KOWX712 added a commit to KOWX712/Tricky-Addon-Update-Target-List that referenced this pull request Nov 14, 2025
KOWX712 added a commit to KOWX712/Tricky-Addon-Update-Target-List that referenced this pull request Nov 24, 2025
@CanerKaraca23

Copy link
Copy Markdown
Contributor

@KOWX712 seems not working for me? Icons unavailable.
Screenshot_2025-11-29-04-54-05-386_me weishu kernelsu

KOWX712 added a commit to KOWX712/Tricky-Addon-Update-Target-List that referenced this pull request Dec 6, 2025
KOWX712 added a commit to KOWX712/APatch that referenced this pull request Dec 22, 2025
- sync with tiann/KernelSU#2928

Co-authored-by: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-authored-by: Fahrez256Bit <167403685+fahrez256@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
KOWX712 added a commit to KOWX712/APatch that referenced this pull request Dec 22, 2025
- sync with tiann/KernelSU#2928

Co-authored-by: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-authored-by: Fahrez256Bit <167403685+fahrez256@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
Admirepowered pushed a commit to bmax121/APatch that referenced this pull request Dec 23, 2025
* manager: introduce pm api in webui

- sync with tiann/KernelSU#2928


Signed-off-by: KOWX712 <leecc0503@gmail.com>
Co-authored-by: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-authored-by: Fahrez256Bit <167403685+fahrez256@users.noreply.github.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Dec 24, 2025
ref: tiann/KernelSU#2928

Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-Authored-By: Fahrez256Bit <167403685+fahrez256@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#2928

Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-Authored-By: Fahrez256Bit <167403685+fahrez256@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
Prslc pushed a commit to Prslc/APatch that referenced this pull request Dec 27, 2025
* manager: introduce pm api in webui

- sync with tiann/KernelSU#2928

Signed-off-by: KOWX712 <leecc0503@gmail.com>
Co-authored-by: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-authored-by: Fahrez256Bit <167403685+fahrez256@users.noreply.github.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Dec 28, 2025
ref: tiann/KernelSU#2928

Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-Authored-By: Fahrez256Bit <167403685+fahrez256@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#2928

Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-Authored-By: Fahrez256Bit <167403685+fahrez256@users.noreply.github.com>
Signed-off-by: KOWX712 <leecc0503@gmail.com>
u9521 added a commit to u9521/KernelSU that referenced this pull request Jan 3, 2026
this is a squash of:

* manager: introduce app package info API for webui-next
(KernelSU-Next/KernelSU-Next@58167a4)

* manager: sort a-z order for webui-next list packages api
(KernelSU-Next/KernelSU-Next@4a9733c)

* manager: implement getPackagesIcons and cacheAllPackageIcons api to
webui-next (KernelSU-Next/KernelSU-Next@a361fa3)

* manager/webui: let getPackagesIcons generate icon and store in cache
as well when called (KernelSU-Next/KernelSU-Next@6afa86d)

* POC: load icon app via ksu://icon/[packageName] (KernelSU-Next#674)
(KernelSU-Next/KernelSU-Next@bc9927b)

* manager: refine webui package manager (KOWX712/KernelSU@0400c42)

Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-Authored-By: Fahrez256Bit
<167403685+fahrez256@users.noreply.github.com>
Co-authored-by: KOWX712 <leecc0503@gmail.com>

---------

Co-authored-by: KOWX712 <leecc0503@gmail.com>
Co-authored-by: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-authored-by: Fahrez256Bit <167403685+fahrez256@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: u9521 <63995396+u9521@users.noreply.github.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 3, 2026
npm update tiann#2928

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
u9521 added a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
this is a squash of:

* manager: introduce app package info API for webui-next
(KernelSU-Next/KernelSU-Next@58167a4)

* manager: sort a-z order for webui-next list packages api
(KernelSU-Next/KernelSU-Next@4a9733c)

* manager: implement getPackagesIcons and cacheAllPackageIcons api to
webui-next (KernelSU-Next/KernelSU-Next@a361fa3)

* manager/webui: let getPackagesIcons generate icon and store in cache
as well when called (KernelSU-Next/KernelSU-Next@6afa86d)

* POC: load icon app via ksu://icon/[packageName] (KernelSU-Next#674)
(KernelSU-Next/KernelSU-Next@bc9927b)

* manager: refine webui package manager (KOWX712/KernelSU@0400c42)

Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-Authored-By: Fahrez256Bit
<167403685+fahrez256@users.noreply.github.com>
Co-authored-by: KOWX712 <leecc0503@gmail.com>

---------

Co-authored-by: KOWX712 <leecc0503@gmail.com>
Co-authored-by: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-authored-by: Fahrez256Bit <167403685+fahrez256@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: u9521 <63995396+u9521@users.noreply.github.com>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
npm update tiann#2928

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Feb 8, 2026
ref: tiann/KernelSU#2928

Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-Authored-By: Fahrez256Bit <167403685+fahrez256@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#2928

Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-Authored-By: Fahrez256Bit <167403685+fahrez256@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#2928

Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-Authored-By: Fahrez256Bit <167403685+fahrez256@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#2928

Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com>
Co-Authored-By: Fahrez256Bit <167403685+fahrez256@users.noreply.github.com>
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.

5 participants