The OEM battery optimization problem
While Android provides system-level battery optimizations (Doze mode and App Standby), manufacturers like Xiaomi, Huawei, Samsung, Oppo, and Vivo add their own battery management layers with additional restrictions.Why standard exemptions aren’t enough
You can be fully exempt from Android’s battery optimizations but still get killed by OEM restrictions:Manufacturer-specific implementations
Each manufacturer implements their own battery optimization system with different settings and behaviors:Xiaomi (MIUI)
Features:- Autostart Manager - Controls which apps can start in the background
- Battery Saver - Aggressive app killing when screen is off
- App Battery Saver - Per-app power restrictions
- Security → Permissions → Autostart
- Battery & Performance → App Battery Saver
- Settings → Apps → Manage Apps → [Your App] → Battery Saver → No Restrictions
MIUI implementation detail: The library attempts to open these activities:
com.miui.securitycenter/com.miui.permcenter.autostart.AutoStartManagementActivitycom.miui.securitycenter/com.miui.powercenter.PowerSettings
Huawei / Honor (EMUI / Magic UI)
Features:- Startup Manager - Controls background app launches
- Protected Apps - Apps that won’t be killed when screen is off
- Battery Optimization - Per-app power management
- Phone Manager → Startup Manager
- Settings → Apps → [Your App] → Battery → App Launch (set to Manual)
- Phone Manager → Protected Apps
EMUI implementation detail: The library tries these activities:
com.huawei.systemmanager/com.huawei.systemmanager.startupmgr.ui.StartupNormalAppListActivitycom.huawei.systemmanager/com.huawei.systemmanager.optimize.process.ProtectActivitycom.huawei.systemmanager/com.huawei.systemmanager.appcontrol.activity.StartupAppControlActivity
Samsung (OneUI)
Features:- Sleeping Apps - Apps put to sleep when not used
- Deep Sleeping Apps - Aggressive background restriction
- Battery Optimization - Per-app power settings
- Settings → Battery → Background Usage Limits → Never Sleeping Apps
- Settings → Apps → [Your App] → Battery → Optimize Battery Usage → All Apps → Disable
OneUI implementation detail: The library tries:
com.samsung.android.lool/com.samsung.android.sm.ui.battery.BatteryActivitycom.samsung.android.sm/com.samsung.android.sm.ui.battery.BatteryActivity
Oppo / Realme (ColorOS / Realme UI)
Features:- Startup Manager - Background app launch control
- Battery Optimization - Aggressive power management
- App Freeze - Suspends unused apps
- Settings → Privacy → Permission Manager → Startup Manager
- Settings → Battery → Power Saving Options (disable)
- Settings → Apps → [Your App] → Battery → Allow Background Activity
Vivo (FuntouchOS / OriginOS)
Features:- Background Running Apps - Whitelist for background execution
- High Background Power Consumption - App power monitoring
- Autostart - Control app launches
- Settings → Battery → Background Power Consumption Management → High Background Power Consumption
- Settings → More Settings → Applications → Autostart
- iManager → App Manager → Background Running Apps
OnePlus (OxygenOS)
Features:- Advanced Optimization - Background app restrictions
- Battery Optimization - Per-app power settings
- Settings → Apps → [Your App] → Battery → Battery Optimization → Don’t Optimize
- Settings → Battery → Battery Optimization → Advanced Optimization (disable)
Other manufacturers
The library also supports:- Asus (ZenUI) - Autostart Manager and mobile manager
- Lenovo - Pure Background feature
- Meizu (Flyme) - Power app permissions
- Nokia (HMD Global) - Power saving exceptions
Complete OEM compatibility table
Here’s a comprehensive list of supported manufacturers and their OEM settings availability:| Manufacturer | Brand/OS | openOEMSettings() Support | Settings Available |
|---|---|---|---|
| Xiaomi | MIUI | ✅ Full | Autostart, Battery Saver |
| Huawei | EMUI | ✅ Full | Startup Manager, Protected Apps |
| Honor | Magic UI | ✅ Full | Startup Manager |
| Samsung | OneUI | ✅ Full | Sleeping Apps, Battery |
| Oppo | ColorOS | ✅ Full | Startup Manager, Power Saving |
| Vivo | FuntouchOS | ✅ Full | Background Running, Autostart |
| OnePlus | OxygenOS | ✅ Full | Advanced Optimization |
| Realme | Realme UI | ✅ Full | Startup Manager |
| Asus | ZenUI | ✅ Full | Autostart Manager |
| Lenovo | - | ✅ Full | Pure Background |
| Meizu | Flyme | ✅ Full | Power App Permissions |
| Nokia | - | ✅ Full | Power Saving Exceptions |
| Stock Android | ⚡ Fallback | Standard battery settings | |
| Other | Stock-based | ⚡ Fallback | Standard battery settings |
- Standard battery optimization settings list
- App details settings page
Opening OEM settings
TheopenOEMSettings() method automatically detects the device manufacturer and opens the appropriate settings:
How it works internally
The library maintains a map of OEM-specific intents for each manufacturer:openOEMSettings():
- It detects the manufacturer using
Build.MANUFACTURER - Looks up the manufacturer in the
oemSettingsIntentsmap - Tries each intent in order until one succeeds
- Falls back to standard battery optimization settings if no OEM settings work
- Final fallback to app details settings
OEM settings activities may not exist on all device variants or OS versions. The library tries multiple known activities per manufacturer and handles failures gracefully.
Fallback behavior
When OEM-specific settings aren’t available or fail to open, the library automatically falls back:Fallback level 1: Battery optimization settings
ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS - the standard Android battery optimization list.
Fallback level 2: App details
ACTION_APPLICATION_DETAILS_SETTINGS - the app’s details page where users can access permissions and other settings.
Complete setup flow for OEM devices
Here’s a comprehensive implementation that handles OEM restrictions alongside standard Android battery optimizations:User experience best practices
1. Progressive disclosure
Don’t overwhelm users with all settings at once. Start with standard Android exemptions, then guide to OEM settings only if needed:2. Visual setup guides
For manufacturers with complex settings, consider providing visual guides:3. Setup verification
Since there’s no programmatic way to check OEM settings status, use user confirmation:4. Persistent reminders
For apps that critically depend on background execution, gently remind users:Testing on different OEMs
Testing OEM restrictions requires physical devices from each manufacturer:Testing checklist
For each OEM device:-
Install app without any exemptions
- Verify background tasks are killed
- Check logs for termination
-
Grant standard Android exemption only
- Verify if background tasks still get killed
- Document behavior
-
Open OEM settings
- Verify correct settings page opens
- Grant all necessary permissions
-
Test background reliability
- Lock screen for 5+ minutes
- Verify background tasks continue
- Check system logs for kills
-
Test after reboot
- Restart device
- Verify autostart works
- Check if settings persist
Debugging OEM issues
Use ADB to monitor app lifecycle:Limitations
1. No programmatic detection
There’s no Android API to check OEM-specific settings status:2. Activities may not exist
OEM settings activities vary by:- Device model
- OS version
- Region
- Carrier customization
3. Settings locations change
Manufacturers frequently reorganize settings between OS versions. The library includes multiple fallback activities per manufacturer, but some devices may require manual navigation.4. User confusion
OEM settings interfaces are often complex and poorly translated, leading to user confusion. Provide clear visual guides or video tutorials for critical apps.Related topics
- Battery Optimization - Standard Android exemptions
- Doze and App Standby - Android’s power management
- Wake Locks - Keep CPU running during tasks

