Run UI updates on main Handler; fix delete task#15
Run UI updates on main Handler; fix delete task#15Howard20181 wants to merge 2 commits intolibxposed:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates build tooling and adjusts MainActivity’s service-bind UI updates to run on the main thread, likely to avoid background-thread UI access when the XposedService binds.
Changes:
- Update the Gradle delete task to delete via
rootProject.layout.buildDirectory. - Create a main-thread
Handlerearlier and use it to post UI updates fromonServiceBind. - Add a debug log line when the service binds.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| build.gradle.kts | Switches delete target from buildDir to layout.buildDirectory. |
| app/src/main/java/io/github/libxposed/example/MainActivity.kt | Posts service-bind UI updates to the main thread and adds bind-time logging. |
Comments suppressed due to low confidence (1)
app/src/main/java/io/github/libxposed/example/MainActivity.kt:59
onServiceBindappears to run off the main thread (given the newhandler.post { ... }). In that case, thesetOnClickListenercalls should also be made on the main thread; consider moving the click-listener setup into the samehandler.post { ... }block (or otherwise ensuring this callback is dispatched on the UI thread) to avoidCalledFromWrongThreadException/undefined behavior.
handler.post {
binding.binder.text = "Binder acquired"
binding.api.text = "API " + service.apiVersion
binding.framework.text = "Framework " + service.frameworkName
binding.frameworkVersion.text = "Framework version " + service.frameworkVersion
binding.frameworkVersionCode.text = "Framework version code " + service.frameworkVersionCode
binding.frameworkProperties.text = "Framework properties: " + service.frameworkProperties.toHexString()
binding.scope.text = "Scope: " + service.scope
}
binding.requestScope.setOnClickListener {
service.requestScope(listOf("com.android.settings"), mCallback)
}
binding.randomPrefs.setOnClickListener {
val prefs = service.getRemotePreferences("test")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR modernizes the Gradle clean task to use the ProjectLayout build directory API and adjusts MainActivity to ensure service-binding UI updates run on the main thread via a Handler.
Changes:
- Update Gradle
Deletetask to deleterootProject.layout.buildDirectoryinstead ofrootProject.buildDir. - Post
onServiceBindUI updates and click-listener setup onto the main looperHandler. - Add (currently unused)
Logimport inMainActivity.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
build.gradle.kts |
Switches clean/delete target to the layout-based build directory provider. |
app/src/main/java/io/github/libxposed/example/MainActivity.kt |
Ensures UI updates in onServiceBind are executed on the main thread using Handler.post. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import android.os.Bundle | ||
| import android.os.Handler | ||
| import android.os.Looper | ||
| import android.util.Log |
No description provided.