Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck in Shizuku.bindUserService sometimes. #475

Closed
4 tasks done
laiqun opened this issue Apr 30, 2024 · 3 comments
Closed
4 tasks done

Stuck in Shizuku.bindUserService sometimes. #475

laiqun opened this issue Apr 30, 2024 · 3 comments

Comments

@laiqun
Copy link

laiqun commented Apr 30, 2024

Please report bugs of Shizuku itself.

Requirements:

  • Shizuku version is up-to-date
  • Shizuku is downloaded from official channels (GitHub release or Google Play)
  • Shizuku is not running in a virtual environment or broken ROM (GrapheneOS)
  • (Root users) No Xposed installed / Xposed is not enabled for Shizuku

Change "[ ]" to "[x]" if it meets the requirements.

Reports not meet the requirements will be immediately closed.

Information:

  • Shizuku version:13.5.4.r1049.0e53409
  • Mode: [adb, root]adb
  • Android version:14
  • Device: (optional)

Logs:

Related full logcat.

Describe the bug:

app may can't bindUserService success sometimes.
If lock Shizuku GUI, and wait for a while(300ms) after open my App, the rate of this issue can down.
Kill Shizuku GUI process, the issue occur rate also can down.

Additional context:

Add any other context about the problem here.

@laiqun laiqun changed the title Stuck in Shizuku.bindUserService, if shizuku GUI is shown. Stuck in Shizuku.bindUserService sometimes. Apr 30, 2024
@RikkaW
Copy link
Member

RikkaW commented Apr 30, 2024

Shizuku app helps UserService to send its binder to Shizuku server. So, if the normal operation of Shizuku app is affected, UserService will break as well.

return if (method == METHOD_SEND_USER_SERVICE) {
try {
extras.classLoader = BinderContainer::class.java.classLoader
val token = extras.getString(USER_SERVICE_ARG_TOKEN) ?: return null
val binder = extras.getParcelable<BinderContainer>(EXTRA_BINDER)?.binder ?: return null
val countDownLatch = CountDownLatch(1)
var reply: Bundle? = Bundle()
val listener = object : Shizuku.OnBinderReceivedListener {
override fun onBinderReceived() {
try {
Shizuku.attachUserService(binder, bundleOf(
USER_SERVICE_ARG_TOKEN to token
))
reply!!.putParcelable(EXTRA_BINDER, BinderContainer(Shizuku.getBinder()))
} catch (e: Throwable) {
LOGGER.e(e, "attachUserService $token")
reply = null
}
Shizuku.removeBinderReceivedListener(this)
countDownLatch.countDown()
}
}
Shizuku.addBinderReceivedListenerSticky(listener, workerHandler)
return try {
countDownLatch.await(5, TimeUnit.SECONDS)
reply
} catch (e: TimeoutException) {
LOGGER.e(e, "Binder not received in 5s")
null
}
} catch (e: Throwable) {
LOGGER.e(e, "sendUserService")
null
}

@laiqun
Copy link
Author

laiqun commented Apr 30, 2024

Maybe I didn't describe clearly.
Add logcat log:
FAIL:
2024-05-01 00:59:19.403 19003-19003 ShizukuServiceStarter system_process E provider is null moe.shizuku.privileged.api.shizuku 0
PASS:
2024-05-01 01:03:02.304 21064-21064 ShizukuServiceStarter com.example.xyclicker I send binder to moe.shizuku.privileged.api in user 0

@laiqun laiqun closed this as completed Jun 22, 2024
@laiqun
Copy link
Author

laiqun commented Jun 22, 2024

Same with Issue: #451

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

No branches or pull requests

2 participants