Skip to content

Conversation

@KOWX712
Copy link
Contributor

@KOWX712 KOWX712 commented Nov 13, 2025

this is a squash of:

Co-Authored-By: Rifat Azad [email protected]
Co-Authored-By: Fahrez256Bit [email protected]
Signed-off-by: KOWX712 [email protected]

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 <[email protected]>
Co-Authored-By: Fahrez256Bit <[email protected]>
Signed-off-by: KOWX712 <[email protected]>
@KOWX712
Copy link
Contributor Author

KOWX712 commented Nov 13, 2025

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

Copy link
Contributor

Copilot AI left a comment

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.

KOWX712 and others added 6 commits November 13, 2025 20:39
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 <[email protected]>
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 <[email protected]>
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.
@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
Copy link
Contributor Author

KOWX712 commented Nov 13, 2025

demo index.html

@CanerKaraca23
Copy link
Contributor

CanerKaraca23 commented Nov 13, 2025

What about integrating all WebUI X features to KernelSU?

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

@YuKongA YuKongA left a comment

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
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 <[email protected]>
Co-Authored-By: Fahrez256Bit
<[email protected]>
Signed-off-by: KOWX712 <[email protected]>

---------

Signed-off-by: KOWX712 <[email protected]>
Co-authored-by: Rifat Azad <[email protected]>
Co-authored-by: Fahrez256Bit <[email protected]>
Co-authored-by: Copilot <[email protected]>
KOWX712 added a commit to KOWX712/KernelSU 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 14, 2025
KOWX712 added a commit to KOWX712/Tricky-Addon-Update-Target-List that referenced this pull request Nov 24, 2025
@CanerKaraca23
Copy link
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 <[email protected]>
Co-authored-by: Fahrez256Bit <[email protected]>
Signed-off-by: KOWX712 <[email protected]>
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 <[email protected]>
Co-authored-by: Fahrez256Bit <[email protected]>
Signed-off-by: KOWX712 <[email protected]>
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 <[email protected]>
Co-authored-by: Rifat Azad <[email protected]>
Co-authored-by: Fahrez256Bit <[email protected]>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Dec 24, 2025
ref: tiann/KernelSU#2928

Co-Authored-By: Rifat Azad <[email protected]>
Co-Authored-By: Fahrez256Bit <[email protected]>
Signed-off-by: KOWX712 <[email protected]>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Dec 24, 2025
ref: tiann/KernelSU#2928

Co-Authored-By: Rifat Azad <[email protected]>
Co-Authored-By: Fahrez256Bit <[email protected]>
Signed-off-by: KOWX712 <[email protected]>
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 <[email protected]>
Co-authored-by: Rifat Azad <[email protected]>
Co-authored-by: Fahrez256Bit <[email protected]>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Dec 28, 2025
ref: tiann/KernelSU#2928

Co-Authored-By: Rifat Azad <[email protected]>
Co-Authored-By: Fahrez256Bit <[email protected]>
Signed-off-by: KOWX712 <[email protected]>
KOWX712 added a commit to KOWX712/KsuWebUIStandalone that referenced this pull request Dec 28, 2025
ref: tiann/KernelSU#2928

Co-Authored-By: Rifat Azad <[email protected]>
Co-Authored-By: Fahrez256Bit <[email protected]>
Signed-off-by: KOWX712 <[email protected]>
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 <[email protected]>
Co-Authored-By: Fahrez256Bit
<[email protected]>
Co-authored-by: KOWX712 <[email protected]>

---------

Co-authored-by: KOWX712 <[email protected]>
Co-authored-by: Rifat Azad <[email protected]>
Co-authored-by: Fahrez256Bit <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: u9521 <[email protected]>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 3, 2026
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 <[email protected]>
Co-Authored-By: Fahrez256Bit
<[email protected]>
Co-authored-by: KOWX712 <[email protected]>

---------

Co-authored-by: KOWX712 <[email protected]>
Co-authored-by: Rifat Azad <[email protected]>
Co-authored-by: Fahrez256Bit <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: u9521 <[email protected]>
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
SQMY-dor pushed a commit to SQMY-dor/APatch that referenced this pull request Jan 5, 2026
* manager: introduce pm api in webui

- sync with tiann/KernelSU#2928


Signed-off-by: KOWX712 <[email protected]>
Co-authored-by: Rifat Azad <[email protected]>
Co-authored-by: Fahrez256Bit <[email protected]>
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.

4 participants