Work Profile Configuration
TikMatrix supports configuring Work Profile users for each device individually, which is very useful for enterprise-managed devices or dual-app environments.
What is Work Profile
Work Profile is an Android feature that allows creating an independent work environment on the same device. By configuring different user IDs, you can:
- Use TikMatrix normally on enterprise-managed devices
- Set different user configurations for different app environments
- Achieve more granular device management and permission control
Using Shelter Tool to Clone Applications
Before configuring Work Profile, you need to use the Shelter tool to clone TikTok and TikMatrix applications:
What is Shelter
Shelter is an open-source application that creates and manages Work Profile on Android devices. It allows you to run duplicate applications in an isolated work environment.
Installing Shelter
- Download Shelter from F-Droid or Google Play Store
- Install and open Shelter on your device
- Follow the setup wizard to create a Work Profile
Cloning Required Applications
After setting up Shelter, you need to clone both TikTok and TikMatrix applications:
-
Clone TikTok Application:
- Open Shelter and go to the "Main" tab
- Find TikTok in the application list
- Tap the "Clone to Work Profile" button
- Wait for the cloning process to complete
-
Clone TikMatrix Application:
- In Shelter, locate TikMatrix in the application list
- Tap the "Clone to Work Profile" button
- Confirm the cloning operation
Verify Cloning Success
After successful cloning:
- You'll see both TikTok and TikMatrix with a briefcase icon in your app drawer
- These are the Work Profile versions of the applications
- The original applications remain unchanged in the main profile
How to Configure Work Profile
1. Open the Work Profile dialog
In the device list, every row ends with a briefcase icon in the actions column. Click it to open the Work Profile dialog for that device.
To configure several devices at once, tick their checkboxes and use the Set Work Profile button in the selection toolbar above the list.
2. Pick the user
TikMatrix reads the device's user list and shows it in the dialog, so there is nothing to look up or type from memory. Each user is listed with its id and name, tagged as:
- Primary — the device owner, user 0. Automation aimed at this user needs no work profile.
- Work profile — a managed profile, which is what Shelter creates. This is the one to pick.
- Stopped — the user exists but is not running at the moment.
Click the user you want. If the device cannot be reached right now, type the id into the box below instead.
Leave the box empty, or pick the primary user, to clear the setting and go back to user 0.
3. Save
Before saving, TikMatrix checks the user you picked:
- that it exists on the device, and
- that TikMatrix, its test package and the app being automated have all been cloned into it.
If something is missing the dialog says exactly what, and the button changes to Save anyway — click it again to save regardless. This is what catches a mistyped id, or a profile the apps were never cloned into, while you are still looking at the dialog rather than hours later when a task fails.
A device with a work profile configured shows its user id on the briefcase icon in the device list.
User ID Description
Common User IDs
- 0: Primary user (default user)
- 10: First work profile user
- 11: Second work profile user
- Additional user IDs follow this pattern
The dialog lists whatever the device actually has, so treat these as a guide rather than something to rely on.
Configuration File Storage
Work Profile configurations are saved to data/work_profile_user.json:
{
"device_serial_1": "10",
"device_serial_2": "11"
}
Keys are the device's serial number — the one shown in the device list, not the ip:port address a wireless device happens to be connected on. TikMatrix writes them that way itself, so a device keeps its setting across reconnects and IP changes.
Only devices that use a work profile appear in the file. Clearing a device removes its entry rather than storing 0.
Managing Device Configurations
Each device's configuration is independent. From the device list you can:
- Set a different user id for each device
- Change or clear a device's setting at any time
- Select several devices and set or clear them together with Set Work Profile
Editing work_profile_user.json by hand still works and no longer needs a restart: TikMatrix notices the file changed within a couple of seconds.
Troubleshooting
Common Issues
Q: Commands fail after setting Work Profile
A: Open the dialog again and read what the pre-save check reports. The usual causes are:
- The id names a user that does not exist on the device
- TikMatrix or the app being automated was never cloned into that profile
- The profile is stopped — unlock the device and open a work-profile app once
Q: How to cancel Work Profile configuration
A: Open the dialog, clear the input box or pick the primary user, and save.
Q: What to do if configuration is lost
A: Configurations are stored in a local JSON file. If lost, you can reconfigure them or restore data/work_profile_user.json from a backup.
Q: Shelter-related issues
A: If you encounter issues with Shelter:
- Cloning fails: Ensure you have administrator permissions and sufficient storage space
- Cloned apps not visible: Check if Work Profile is properly activated in Shelter
- Apps crash in Work Profile: Try re-cloning the applications or updating Shelter
- Can't find cloned apps: Look for apps with briefcase icons in your app drawer
Best Practices
Enterprise Environment
- Unified Management: Set the same user ID for all enterprise devices
- Permission Separation: Use different user IDs to distinguish different permission levels
- Backup Configuration: Regularly backup the
work_profile_user.jsonfile
Personal Use
- App Isolation: Set different user environments for different purposes
- Testing Environment: Use independent user IDs for app testing
- Privacy Protection: Improve privacy security through user separation
Shelter Tool Management
- Regular Updates: Keep Shelter application updated to ensure compatibility
- Application Synchronization: Ensure both TikTok and TikMatrix are cloned before configuring Work Profile
- Backup Shelter Settings: Export and backup Shelter configurations for easy recovery
- Monitor App Updates: When TikTok or TikMatrix updates, you may need to update the cloned versions as well
Technical Details
A work profile is a second Android user on the same device, so the setting changes three things about how TikMatrix drives the phone.
Commands that understand Android users are told which one. Android's shell commands each expect the --user flag in a different position, and putting it in the wrong one is ignored rather than rejected, so TikMatrix places it per command:
# `settings` takes the flag before its verb
adb shell settings --user 10 put system screen_off_timeout 2147483647
# `am`, `ime` and `pm` take it after theirs
adb shell am start --user 10 -n com.zhiliaoapp.musically/.MainActivity
adb shell ime set --user 10 com.github.tikmatrix/.FastInputIME
adb shell pm list packages --user 10 com.zhiliaoapp.musically
Only am, pm, ime, content and settings are treated this way. Commands with no notion of an Android user — input, chmod, rm, pkill, ip, mkdir — are sent unchanged. input in particular dispatches to the foreground window rather than to a user, so taps and swipes need no flag.
File paths point at the profile's storage. Material pushed to the device goes to /storage/emulated/10/DCIM instead of /storage/emulated/0/DCIM, so the cloned app can see it.
Installed apps are linked into the profile. adb install reaches the primary user only, so after each install TikMatrix runs pm install-existing --user 10 <package> to make the same APK available inside the profile.