google / bundletool

Bundletool is a command-line tool to manipulate Android App Bundles
https://g.co/androidappbundle
Apache License 2.0
3.5k stars 384 forks source link

Support multi-user scenario for local testing #370

Open jaewan-github opened 1 month ago

jaewan-github commented 1 month ago

Is your feature request related to a problem? Please describe.

Problem: Can't test non-primary user (=userId=0) case on Android

install-apks only pushes data to /sdcard, but adb shell only supports /sdcard for primary user.

Describe the solution you'd like

Take extra parameter --user-id, so data can be pushed to per-user storage (/data/media/${user_id}/)

Additional context

You can reproduce the issue by creating additional user, and try test app installation there.

jaewan-github commented 1 month ago

Let me share possible workaround for the record.

In the Android shell (root + remount)

cp -R /sdcard/Android/data/${pkg_name} /data/media/$(am get-current-user)/Android/data/
chmod -R 777 /data/media/$(am get-current-user)/Android/data/${pkg_name}