Skip to content

Fix/android17 iserviceconnection#16

Merged
superturtlee merged 2 commits into
superturtlee:upstreamfrom
Leaf-lsgtky:fix/android17-iserviceconnection
Jul 24, 2026
Merged

Fix/android17 iserviceconnection#16
superturtlee merged 2 commits into
superturtlee:upstreamfrom
Leaf-lsgtky:fix/android17-iserviceconnection

Conversation

@superturtlee

Copy link
Copy Markdown
Owner

No description provided.

Android 17 (API 36) replaced the old 3-argument
IServiceConnection.connected(ComponentName, IBinder, boolean) with a
new 4-argument overload that adds an IBinderSession parameter, and
removed the old overload entirely from the framework interface.

Vector's IServiceConnection stub and the ManagerService connection
implementation only declared/overrode the old 3-argument signature.
When system_server dispatched the new 4-argument connected() to the
parasitic manager process on Android 17, the Stub lacked the new
abstract method and threw AbstractMethodError, killing the manager
process. system_server then hit DeadObjectException while dispatching
a broadcast to the dead process, triggering a framework restart
(SYSTEM_RESTART) every time the manager was opened.

Fix:
- Add an IBinderSession stub (android.app.IBinderSession extends
  IInterface) with binderTransactionCompleted(long) and
  binderTransactionStarting(String):long, matching the Android 17
  framework interface.
- Declare both connected() overloads in the IServiceConnection stub so
  it compiles against Android 8.1~17 (the old overload is simply never
  invoked on Android 17+).
- Override the new 4-argument connected() in ManagerService's
  connection Stub (no-op, same as the existing 3-argument override).
The build system passed string macros to the C/C++ compiler wrapped in
single quotes, e.g.  -DVERSION_NAME='2.0'  and
-DINJECTED_PACKAGE_NAME='com.android.shell'. On Linux/macOS the shell
strips the single quotes and the compiler sees a quoted string literal,
but on Windows single quotes are not shell quoting characters, so the
compiler receives -DVERSION_NAME='2.0' (a multi-character constant) or
-DINJECTED_PACKAGE_NAME='com.android.shell', causing compilation
failures:
  - narrowing conversion from 'int' to 'const char*'
  - expected unqualified-id / multi-character constant

Fix by passing the values as bare tokens
(-DVERSION_NAME=2.0, -DINJECTED_PACKAGE_NAME=com.android.shell) and
stringizing them at the C++ side via a STRINGIZE macro, which is robust
across Windows and Unix toolchains. Also move the stringize helper
macros out of a namespace (macros are not namespace members and cannot
be invoked with a qualified name).
@superturtlee
superturtlee merged commit a17861e into superturtlee:upstream Jul 24, 2026
1 check passed
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