Skip to content

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

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

Run UI updates on main Handler; fix delete task#15
Howard20181 wants to merge 2 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 <[email protected]>
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.

import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
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