Skip to content

Support multi-user Android profiles (e.g. Googlebook User 10) in DeployBrush - #99

Merged
maxmmitchell merged 2 commits into
android:mainfrom
nikitatar:fix/googlebook-multiuser-deploy
Oct 20, 2026
Merged

maxmmitchell merged 2 commits into
android:mainfrom
nikitatar:fix/googlebook-multiuser-deploy

Conversation

@nikitatar

Copy link
Copy Markdown
Contributor

Summary

Updates DesktopDeployer in DeployBrush.kt to detect and support multi-user Android profiles (such as User 10 on Googlebook / Android Desktop devices) when deploying brushes from the AI Brush Designer CLI (/deploy).

Problem

  • On standard single-user Android phones/emulators, adb shell am get-current-user returns 0, and /sdcard/ maps to /storage/emulated/0/, matching the foreground user's external_files FileProvider directory.
  • On multi-user devices such as Googlebook, the active foreground Android user is 10, while /sdcard/ in adb still points to User 0 (/storage/emulated/0/) and Android FUSE isolation prevents shell (uid=2000) from directly writing to /storage/emulated/10/Android/data/....
  • Consequently, launching Cahier with content://com.example.cahier.provider/external_files/new.brushfamily on User 10 failed with java.io.FileNotFoundException: open failed: ENOENT.

Solution

  1. Query the active Android user via adb shell am get-current-user (defaulting to "0").
  2. When currentUser == "0", preserve the existing external_files deployment behavior unchanged.
  3. When currentUser != "0", copy the staged .brushfamily file into the active user's internal cache/shares/ directory using run-as com.example.cahier --user <currentUser>, launch MainActivity with --user <currentUser>, and import from content://com.example.cahier.provider/shared_files/<file> (already defined in app/src/main/res/xml/filepaths.xml).

Testing

  • Verified /deploy end-to-end from the AI Brush Designer CLI on a Googlebook running as Android User 10.
  • Verified :tools:test unit tests pass.

@google-cla

google-cla Bot commented Oct 16, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@nikitatar
nikitatar force-pushed the fix/googlebook-multiuser-deploy branch from c4c1214 to 05935cb Compare October 16, 2026 21:07

@maxmmitchell maxmmitchell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, will address style concerns on backport.

Comment thread tools/src/main/java/com/example/cahier/tools/DeployBrush.kt

@cka-dev cka-dev left a comment

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.

1 nit comment

@maxmmitchell
maxmmitchell requested a review from cka-dev October 20, 2026 12:57
@maxmmitchell
maxmmitchell merged commit eee0510 into android:main Oct 20, 2026
8 checks 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.

3 participants