Skip to content

fix: CSService trigger on Android 17 (ContextualSearchManager wrapper) - #184

Open
FreeTeaspoon wants to merge 1 commit into
parallelcc:mainfrom
FreeTeaspoon:fix/cs-service-android17
Open

fix: CSService trigger on Android 17 (ContextualSearchManager wrapper)#184
FreeTeaspoon wants to merge 1 commit into
parallelcc:mainfrom
FreeTeaspoon:fix/cs-service-android17

Conversation

@FreeTeaspoon

Copy link
Copy Markdown

Problem

On Android 17 the CSService trigger fails with:

NoSuchMethodException: IContextualSearchManager.startContextualSearch [int]

Android 17 added a ContextualSearchConfig parameter to IContextualSearchManager.startContextualSearch and dropped the single-argument form, so the direct Binder reflection call in CSMSHooker no longer resolves and Circle to Search never opens from the tile or shortcut.

Fix

Call the framework wrapper android.app.contextualsearch.ContextualSearchManager.startContextualSearch(int) instead of IContextualSearchManager directly. The wrapper exists on Android 15, 16 and 17 and builds the Binder call with whatever arguments the installed platform expects, so there is no version branching in the module.

Single-file change, 8 lines added, 6 removed.

Tested

  • Xiaomi phone, HyperOS, Android 17 (SDK 37), LSPosed v2.2.0 (7854).
  • Quick Settings tile and MainActivity launch both open ContextualSearchServiceEntrypointLensientActivity with CSService selected.
  • Also verified with voice_interaction_service deliberately set to XiaoAI, which is the case where CSHelper fails: CSService now opens Circle to Search regardless of the active voice interaction service.
  • No MiCTS errors in logcat.

Relation to #183

#183 fixes the same NoSuchMethodException as part of a much larger HyperOS 4 change (native launcher hooks, HomeKeyRule, NativeLauncherTriggerHooker). This PR is only the minimal subset needed for the tile/shortcut path, so it can land independently while the rest of #183 is reviewed. It takes a slightly different route (the framework wrapper rather than the two-argument Binder method with a null config), but the two are not in conflict beyond a trivial rebase of CSMSHooker.kt.

…id 17

Android 17 added a ContextualSearchConfig parameter to
IContextualSearchManager.startContextualSearch and removed the
single-argument form, so the direct Binder reflection call failed with
NoSuchMethodException and Circle to Search never opened.

Call the framework wrapper ContextualSearchManager.startContextualSearch(int)
instead. It exists on Android 15, 16 and 17 and builds the Binder call with
whatever arguments the installed platform expects.
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Restore CSService triggers on Android 17 via framework manager

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Routes CSService starts through the framework manager instead of the version-specific Binder
 interface.
• Restores tile and shortcut Circle to Search triggers on Android 17.
• Retains Android 15 and 16 compatibility without SDK-specific branching.
Diagram

sequenceDiagram
    actor Caller as Tile or Shortcut
    participant VIMS as VIMS Hook
    participant CSMS as CSMS Hooker
    participant Manager as Framework Manager
    participant Service as Contextual Search Service
    Caller->>VIMS: Trigger request
    VIMS->>CSMS: Start with entry point
    CSMS->>Manager: startContextualSearch(int)
    Manager->>Service: Platform Binder call
    Service-->>Caller: Open Circle to Search
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Call Binder overload by Android version
  • ➕ Provides direct control over the exact Binder arguments.
  • ➕ Matches the service interface exposed by each platform release.
  • ➖ Requires SDK-specific signature detection or branching.
  • ➖ Remains coupled to hidden Binder interfaces that may change again.
  • ➖ Duplicates adaptation already implemented by the framework manager.

Recommendation: Use the PR's framework-wrapper approach. ContextualSearchManager provides the stable entry point across Android 15–17 and delegates signature adaptation to the platform, avoiding brittle reflection against version-specific Binder overloads.

Files changed (1) +8 / -6

Bug fix (1) +8 / -6
CSMSHooker.ktInvoke contextual search through the framework manager +8/-6

Invoke contextual search through the framework manager

• Replaces direct IContextualSearchManager Binder reflection with ContextualSearchManager.startContextualSearch(int). This restores Android 17 compatibility while preserving the existing permission and package-name hooks and removes the unused IBinder import.

app/src/main/java/com/parallelc/micts/hooker/CSMSHooker.kt

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can show, collapse, or hide each part of a finding: code, evidence, and all

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@FreeTeaspoon
FreeTeaspoon force-pushed the fix/cs-service-android17 branch from dc63d86 to 7660d6d Compare September 6, 2026 10:13
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.

1 participant