Thank you for your interest in contributing! This guide will help you understand the project structure and development workflow.
caros-profile-switcher/
├── build.ps1 # PowerShell build script
├── build.sh # Bash build script
├── caros_config.sh # Central configuration with defaults
├── grant_permissions.sh # Automatic permission management
├── module.prop # Magisk module metadata
├── post-fs-data.sh # Early boot initialization
├── service.sh # Main service loop (runs continuously)
├── system.prop # System property overrides
├── .gitignore # Git ignore rules
├── README.md # Main documentation
├── CHANGELOG.md # Version history
├── CONTRIBUTING.md # This file
├── META-INF/ # Magisk installer
│ └── com/google/android/
│ ├── update-binary # Magisk installation script
│ └── updater-script # Magisk marker file
└── rel/ # Build output directory (ignored by git)
- Text editor (VS Code recommended)
- PowerShell or Bash for building
- Android device with Magisk for testing
- ADB tools for debugging
- Clone the repository
- Make your changes
- Test on your device
- Build a release
- Submit a pull request
- Contains all default configuration values
- Provides
generate_user_config()function - Provides
apply_defaults()function - Sourced by both
post-fs-data.shandservice.sh
- Grants notification permissions to Android Auto, Waze, Maps, Nova, Spotify
- Grants location permissions (including background) to Maps, Waze, Android Auto
- Runs on boot and periodically (every 30 minutes)
- Configurable via
AUTO_GRANT_PERMISSIONSsetting
- Runs early in boot process
- Creates configuration file if missing
- Sets up directory structure
- Ensures proper permissions
- Main service loop (runs every 3 seconds)
- Detects connection state (WIRED/WIRELESS/IDLE)
- Applies appropriate profiles
- Manages device resources
- Logs state changes
- Check existing issues for similar work
- Create an issue to discuss major changes
- Update CHANGELOG.md for your changes
- Use clear, descriptive variable names
- Add comments for complex logic
- Follow existing shell script style
- Test thoroughly before committing
- Build the module:
./build.ps1or./build.sh - Install via Magisk Manager
- Reboot your device
- Check logs:
adb shell cat /data/adb/modules/caros-switcher/log.txt - Verify state changes work correctly
Edit module.prop:
version=X.Y.Z # Update version
versionCode=N # Increment by 1
description=... # Add changelog summaryEdit service.sh (around line 257):
log "CarOS Profile Switcher service vX.Y.Z started"- Add entry to
CHANGELOG.md - Update
README.mdif needed - Document any new configuration options
# PowerShell
.\build.ps1
# Or Bash
./build.sh- Install the generated ZIP via Magisk
- Test all profiles (WIRED/WIRELESS/IDLE)
- Check logs for errors
- Verify new features work
git add .
git commit -m "Release vX.Y.Z: Brief description"
git tag vX.Y.Z
git push origin main --tagsIn /sdcard/CarOS/config.env:
VERBOSE=1# Full log
adb shell cat /data/adb/modules/caros-switcher/log.txt
# Last 50 lines
adb shell tail -n 50 /data/adb/modules/caros-switcher/log.txt
# Follow in real-time
adb shell tail -f /data/adb/modules/caros-switcher/log.txt
# Check current state
adb shell cat /data/adb/modules/caros-switcher/state.json- Module not loading: Check Magisk version (needs 20.4+)
- Profiles not switching: Enable verbose logging and check BT/USB detection
- Permission errors: Verify SELinux isn't blocking operations
- Code follows existing style
- Version numbers updated in all files
- CHANGELOG.md updated
- Tested on actual device
- No errors in logs
- Documentation updated (if needed)
- Commit message is clear and descriptive
- Support for more car systems (BMW, Mercedes, etc.)
- Better charge limiting detection
- Auto-rotation management
- Screen brightness control
- Web-based configuration UI
- Profile scheduling (time-based rules)
- Multiple car profiles
- Integration with Tasker/Automate
- Video tutorials
- More troubleshooting guides
- Translations
- FAQ section
Have an idea? Open an issue with:
- Clear description of the feature
- Use case / why it's needed
- Example configuration (if applicable)
- Any implementation ideas
- Be respectful and professional
- Test before submitting
- Document your changes
- Help others learn
- Have fun! 🚗
For questions or discussions:
- Open an issue on GitHub
- Include logs if reporting bugs
- Be patient - this is maintained in free time
Happy coding and safe driving! 🚗💨