## GrapheneOS Google Play Work Profile Injection Guide ### Preface If your employer requires the creation of a work profile using an application like VMWare Intelligent Hub, the work profile will not have Google Play Services installed by default, which is necessary for the setup to complete. This guide will detail the steps necessary to inject the Google Play Store into the work profile. This guide requires access to a computer with the `android-build-tools`, and a cable to connect the phone to the computer. ### On Phone (Preparation) - Install the Intelligent Hub app from the Google Play Store. - Follow the instructions in the Hub app until the Work Profile setup. - Allow the Work Profile to install, but after it is installed, *do not press Continue*. - Return to the Launcher for now. Do not close the Hub app. We need to do the necessary preparations to inject the Apps app to the work profile now. - Go to Settings, About Phone, and scroll to the bottom. - Click Build Number over and over until you are a developer. - Go to Settings, System, Developer Options. - Enable USB Debugging. ### On Mac (Preparation) - Connect phone to Mac with USB-C cable. - Change USB mode to PTP. - Reference the following commands. ```bash $ brew install android-platform-tools # add the adb command $ adb devices # list out connected devices # ensure the prompt on the Android device to connect to the Mac is accepted $ adb kill-server # restart server after accepting the prompt $ adb shell pm list users # list user profiles ``` The user ID is `12` for the work profile in the example output of `adb shell pm list users` below. ```bash UserInfo{0:Owner:c13} running UserInfo{12:Work profile:1030} running ``` ## On Mac (Installation) ```bash $ adb push <my-apk>.apk /data/local/tmp # push an apk to the device $ adb shell pm install -t --user <user-id> /data/local/tmp/<my-apk>.apk # install the apk $ adb shell am start --user <user-id> \ -n "app.grapheneos.apps/app.grapheneos.apps.ui.MainActivity" \ -a android.intent.action.MAIN \ -c android.intent.category.LAUNCHER # launches the Apps app ``` ### On Phone (Installation) - Within the Apps app, install the Google Play Store. - Open the Hub app again and press Continue. - The installation should complete successfully. - Go to Settings, Apps, See all apps, Work. - Set App battery usage to unrestricted for the following apps: - Google Play Store - Google Play services - Google Services Framework - Allow the contacts permission for the following apps: - Google Play services - Google Services Framework - Configure the Tunnel app following the prompts. - A VPN configuration should have been added to the work profile now. - Go to Settings, Network & Internet, VPN. - Click the Settings Icon next to the work profile VPN. - Disable Always-on VPN - Disable Block connections without VPN. - Perform any other setup required by other work profile apps. - Install other work profile apps from the work profile Play Store. - For every work profile app that might need it, disable battery optimization. ### On Phone (Cleanup) - Go to Settings app. - Go to System. - Go to Developer Options. - Disable USB Debugging. - Disable Developer Options. ### On Mac (Cleanup) ```bash $ brew remove android-platform-tools ``` ### Summary That's it! The Google Play Store has been injected into the work profile. ## Other Reference To determine how to run the Apps app using `adb`, see the following reference. ```bash $ brew install --cask android-studio # adds the aapt command used below # Launch the Android Studio app and go through the setup wizard. $ ~/Library/Android/sdk/build-tools/*/aapt dump badging <my-apk>.apk | grep launchable ``` ```bash # the output will look something like this launchable-activity: name='com.package.name.ActivityName' label='' icon='' # for example launchable-activity: name='app.grapheneos.apps.ui.MainActivity' label='' icon='' ``` So the command to run it would look like this: ```bash $ adb shell am start --user <user-id> \ -n "app.grapheneos.apps/app.grapheneos.apps.ui.MainActivity" \ -a android.intent.action.MAIN \ -c android.intent.category.LAUNCHER ```