Skip to content

feat(open-in): add Android Studio Canary support#1989

Merged
arnestrickmann merged 2 commits into
generalaction:mainfrom
sergeym-monday:feat/open-in-android-studio-canary
May 12, 2026
Merged

feat(open-in): add Android Studio Canary support#1989
arnestrickmann merged 2 commits into
generalaction:mainfrom
sergeym-monday:feat/open-in-android-studio-canary

Conversation

@sergeym-monday
Copy link
Copy Markdown

Summary

  • Adds Android Studio Canary to the "Open In" app list in Settings → Interface, alongside stable Android Studio
  • Uses the official icon from the Android Studio Canary app bundle (Contents/bin/studio.svg)
  • Supports macOS (mdfind by display name + open -a), Windows (studio64/studio), and Linux (studio-preview/studio)
  • Adds mdfindQuery to PlatformConfig and a checkMacMdfindQuery helper in utils.ts

Why a new detection field?

Stable Android Studio and Canary share the same macOS bundle ID (com.google.android.studio), and Canary's display name is versioned per release (e.g. Android Studio Otter 3 Feature Drop 2025.2.3 Canary 3), so bundleIds and appNames (exact match) can't distinguish them. The new mdfindQuery field accepts a free-form Spotlight query — for Canary this combines bundle ID + kMDItemDisplayName == "*Canary*"cd — which reliably detects any Canary build regardless of codename or version suffix. Other JetBrains EAP builds could reuse it later.

Test plan

  • Android Studio Canary appears in Settings → Interface under "Open In" apps
  • On a machine with Canary installed (tested with Otter 3 Feature Drop 2025.2.3 Canary 3), the app is detected and shown
  • On a machine without Canary, it is hidden (hideIfUnavailable: true) — couldn't test without uninstalling
  • Clicking "Open" on a worktree launches Android Studio Canary at the correct path
  • Stable "Android Studio" entry is unaffected
  • pnpm run format, pnpm run lint, pnpm run typecheck, pnpm run build all pass

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 12, 2026

Greptile Summary

This PR adds Android Studio Canary as a new "Open In" app entry, using a new mdfindQuery field in PlatformConfig to handle macOS detection when stable and Canary share the same bundle ID. The macOS path is well-designed, but the Windows and Linux platform configs introduce false-positive detection issues.

  • macOS: Detection via mdfind with a compound Spotlight query (kMDItemCFBundleIdentifier && kMDItemDisplayName == "*Canary*"cd) is correct and reliably scoped to Canary builds. The new checkMacMdfindQuery helper in utils.ts works correctly but lacks a timeout, unlike all other helpers in the same file.
  • Windows: checkCommands for Canary (studio64, studio) are identical to stable Android Studio, so any machine with stable installed will show Canary as available and clicking it will launch the stable app.
  • Linux: The studio fallback in Canary's checkCommands causes the same false-positive — stable studio satisfies the check, and the open command falls back to launching stable after studio-preview fails.

Confidence Score: 3/5

Safe to merge for macOS users, but Windows and Linux users with stable Android Studio installed will see Canary falsely reported as available and may launch the wrong app.

The macOS implementation is solid. On Windows, identical checkCommands to stable Android Studio mean the Canary entry appears for every stable-AS user and clicking it opens the wrong app. On Linux, the studio fallback in checkCommands has the same problem. Both are present defects on live user machines.

src/shared/openInApps.ts — specifically the win32 and linux platform blocks for android-studio-canary

Important Files Changed

Filename Overview
src/shared/openInApps.ts Adds the android-studio-canary app config and mdfindQuery field to PlatformConfig. macOS detection is solid; Win32 checkCommands are identical to stable Android Studio (false-positive detection); Linux studio fallback in checkCommands also produces false positives.
src/main/core/app/utils.ts Adds checkMacMdfindQuery helper using execFile('mdfind', [query]). Logic is correct for passing a compound query expression. Missing a timeout option, unlike similar helpers in the same file.
src/main/core/app/service.ts Adds the mdfindQuery availability check as a new branch in checkInstalledApps, gated on platform === 'darwin'. Logic is correct and consistent with existing detection branches.
src/assets/images/android-studio-canary.svg New SVG icon asset for Android Studio Canary. Well-formed; missing a trailing newline (minor).

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[checkInstalledApps] --> B{bundleIds?}
    B -- yes --> C[checkMacApp per bundleId]
    C --> D{found?}
    D -- yes --> AVAIL[isAvailable = true]
    D -- no --> E{appNames?}
    B -- no --> E
    E -- yes --> F[checkMacAppByName per name]
    F --> G{found?}
    G -- yes --> AVAIL
    G -- no --> H{checkCommands?}
    E -- no --> H
    H -- yes --> I[checkCommand per cmd]
    I --> J{found?}
    J -- yes --> AVAIL
    J -- no --> K{mdfindQuery AND darwin?}
    H -- no --> K
    K -- yes --> L[checkMacMdfindQuery]
    L --> M{results?}
    M -- yes --> AVAIL
    M -- no --> UNAVAIL[isAvailable = false]
    K -- no --> UNAVAIL
    AVAIL --> N[availability record]
    UNAVAIL --> N
Loading
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
src/shared/openInApps.ts:460-463
**Win32 Canary detection is identical to stable Android Studio**

The `checkCommands` for `android-studio-canary` on Win32 (`studio64`, `studio`) are identical to the stable `android-studio` entry. Because `hideIfUnavailable: true` only hides the app when the commands are *not* found, any machine with stable Android Studio installed will show the Canary entry as available. Clicking it will then open stable instead of Canary, since both entries point to the same executable on PATH. There is no way to distinguish the two on Windows with this approach.

### Issue 2 of 3
src/shared/openInApps.ts:464-468
**Linux `studio` fallback causes false-positive detection of Canary**

`checkCommands: ['studio-preview', 'studio']` means that on a machine where only stable Android Studio (`studio`) is on PATH — with no `studio-preview` — Canary is still reported as available. When the user clicks it, `studio-preview {{path}}` fails silently, then `studio {{path}}` runs, opening stable Android Studio instead of Canary. Consider removing `'studio'` from `checkCommands` (keeping only `'studio-preview'`) so the entry is hidden unless the Canary-specific binary is actually present.

### Issue 3 of 3
src/main/core/app/utils.ts:188-193
**Missing timeout on `mdfind` invocation**

`checkMacMdfindQuery` passes no `timeout` option to `execFile`, so a slow or unresponsive Spotlight daemon could hang indefinitely. Every other `execFile`/`exec` call in this file (e.g., `execFileCommand`) defaults to 30 s. Consider adding `{ timeout: 30_000, env: buildExternalToolEnv() }` for consistency.

Reviews (1): Last reviewed commit: "feat(open-in): add Android Studio Canary..." | Re-trigger Greptile

Comment thread src/shared/openInApps.ts
Comment on lines +460 to +463
win32: {
openCommands: ['studio64 {{path}}', 'studio {{path}}'],
checkCommands: ['studio64', 'studio'],
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Win32 Canary detection is identical to stable Android Studio

The checkCommands for android-studio-canary on Win32 (studio64, studio) are identical to the stable android-studio entry. Because hideIfUnavailable: true only hides the app when the commands are not found, any machine with stable Android Studio installed will show the Canary entry as available. Clicking it will then open stable instead of Canary, since both entries point to the same executable on PATH. There is no way to distinguish the two on Windows with this approach.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/shared/openInApps.ts
Line: 460-463

Comment:
**Win32 Canary detection is identical to stable Android Studio**

The `checkCommands` for `android-studio-canary` on Win32 (`studio64`, `studio`) are identical to the stable `android-studio` entry. Because `hideIfUnavailable: true` only hides the app when the commands are *not* found, any machine with stable Android Studio installed will show the Canary entry as available. Clicking it will then open stable instead of Canary, since both entries point to the same executable on PATH. There is no way to distinguish the two on Windows with this approach.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 60012bc — removed studio64/studio from checkCommands and openCommands for Win32. The entry now uses only studio-preview, so it stays hidden unless a Canary-specific launcher is on PATH.

Comment thread src/shared/openInApps.ts
Comment on lines +464 to +468
linux: {
openCommands: ['studio-preview {{path}}', 'studio {{path}}'],
checkCommands: ['studio-preview', 'studio'],
},
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Linux studio fallback causes false-positive detection of Canary

checkCommands: ['studio-preview', 'studio'] means that on a machine where only stable Android Studio (studio) is on PATH — with no studio-preview — Canary is still reported as available. When the user clicks it, studio-preview {{path}} fails silently, then studio {{path}} runs, opening stable Android Studio instead of Canary. Consider removing 'studio' from checkCommands (keeping only 'studio-preview') so the entry is hidden unless the Canary-specific binary is actually present.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/shared/openInApps.ts
Line: 464-468

Comment:
**Linux `studio` fallback causes false-positive detection of Canary**

`checkCommands: ['studio-preview', 'studio']` means that on a machine where only stable Android Studio (`studio`) is on PATH — with no `studio-preview` — Canary is still reported as available. When the user clicks it, `studio-preview {{path}}` fails silently, then `studio {{path}}` runs, opening stable Android Studio instead of Canary. Consider removing `'studio'` from `checkCommands` (keeping only `'studio-preview'`) so the entry is hidden unless the Canary-specific binary is actually present.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 60012bc — removed the studio fallback from both checkCommands and openCommands for Linux. Only studio-preview remains, so stable-only machines won't show the Canary entry.

Comment on lines +188 to +193
export const checkMacMdfindQuery = (query: string): Promise<boolean> =>
new Promise((resolve) => {
execFile('mdfind', [query], { env: buildExternalToolEnv() }, (error, stdout) => {
resolve(!error && stdout.trim().length > 0);
});
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Missing timeout on mdfind invocation

checkMacMdfindQuery passes no timeout option to execFile, so a slow or unresponsive Spotlight daemon could hang indefinitely. Every other execFile/exec call in this file (e.g., execFileCommand) defaults to 30 s. Consider adding { timeout: 30_000, env: buildExternalToolEnv() } for consistency.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/main/core/app/utils.ts
Line: 188-193

Comment:
**Missing timeout on `mdfind` invocation**

`checkMacMdfindQuery` passes no `timeout` option to `execFile`, so a slow or unresponsive Spotlight daemon could hang indefinitely. Every other `execFile`/`exec` call in this file (e.g., `execFileCommand`) defaults to 30 s. Consider adding `{ timeout: 30_000, env: buildExternalToolEnv() }` for consistency.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 60012bc — added { timeout: 30_000, env: buildExternalToolEnv() } to the execFile call in checkMacMdfindQuery, matching execFileCommand's 30 s default.

- Remove studio64/studio fallback on Win32 — identical to stable AS, would
  falsely report Canary as installed and open the wrong app on click
- Remove studio fallback on Linux for the same reason; keep studio-preview only
- Add 30 s timeout to checkMacMdfindQuery for parity with other utils helpers

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@arnestrickmann arnestrickmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@arnestrickmann
Copy link
Copy Markdown
Contributor

Hi @sergeym-monday,
Thank you for your interest in contributing and for opening this PR - lgtm!

@arnestrickmann arnestrickmann merged commit cf072e0 into generalaction:main May 12, 2026
1 check passed
@sergeym-monday sergeym-monday deleted the feat/open-in-android-studio-canary branch May 13, 2026 07:12
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