Skip to content

Run UI updates on main Handler; fix delete task#15

Open
Howard20181 wants to merge 7 commits intolibxposed:masterfrom
Howard20181:mainlooper
Open

Run UI updates on main Handler; fix delete task#15
Howard20181 wants to merge 7 commits intolibxposed:masterfrom
Howard20181:mainlooper

Conversation

@Howard20181
Copy link

No description provided.

Copilot AI review requested due to automatic review settings March 18, 2026 12:39
Copy link

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 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 Handler earlier and use it to post UI updates from onServiceBind.
  • 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

  • onServiceBind appears to run off the main thread (given the new handler.post { ... }). In that case, the setOnClickListener calls should also be made on the main thread; consider moving the click-listener setup into the same handler.post { ... } block (or otherwise ensuring this callback is dispatched on the UI thread) to avoid CalledFromWrongThreadException/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 <175728472+Copilot@users.noreply.github.com>
Copy link

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 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 Delete task to delete rootProject.layout.buildDirectory instead of rootProject.buildDir.
  • Post onServiceBind UI updates and click-listener setup onto the main looper Handler.
  • Add (currently unused) Log import in MainActivity.

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.

Copy link

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 refactors the example app’s service-connection flow so UI updates happen via a centralized Application-level service listener (rather than directly from the Activity binding callback), and updates the Gradle delete task to use the modern build directory API.

Changes:

  • Replace MainActivity’s direct XposedServiceHelper.registerListener usage with an App.ServiceStateListener callback model.
  • Add a new App : Application that registers the XposedServiceHelper listener and dispatches service state changes on the main thread.
  • Update the root Delete task to delete via rootProject.layout.buildDirectory and register App in the manifest.

Reviewed changes

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

File Description
build.gradle.kts Updates the custom Delete task to use layout.buildDirectory.
app/src/main/java/io/github/libxposed/example/MainActivity.kt Refactors UI updates to react to service state changes and adds null-safe service interactions.
app/src/main/java/io/github/libxposed/example/App.kt Introduces an Application class that centrally tracks/broadcasts XposedService bind/die events.
app/src/main/AndroidManifest.xml Registers the new Application class.

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

Copy link

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

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


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

Copy link

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

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


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

Copy link

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

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.


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

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.

2 participants