ShizuStore

HyperOS FCM Fix

dingwen07

0.3.1 · GitHub

Download APK
Vendor-specific Android 11+ 1 month ago GPL-3.0
350 ShizuStore
6.5k GitHub
187 Stars
3 MB Size

More about this app

Keeps Google Play services unrestricted on HyperOS so FCM push notifications arrive on time

HyperOS FCM Fix

English | 简体中文 | 繁體中文

HyperOS FCM Fix prevents Xiaomi HyperOS from freezing Google Play services or over-restricting apps that need timely Firebase Cloud Messaging (FCM) notifications. It uses Shizuku's ADB shell identity and does not require root.

Get it on GitHub

Get it on Obtainium

Features

  • Keeps Google Play services (com.google.android.gms) in HyperOS's hidden no-restrictions list (MILLET_NO_RESTRICT_APP) and repairs the entry when PowerKeeper rewrites the list.
  • Disables the known Greezer GMS limiter and restores GMS to its normal runtime allowlist.
  • Offers optional FCM Connection Protection for CN Google Play services builds that may not reconnect promptly.
  • Offers experimental nighttime FCM protection for HyperOS 4, off by default, while keeping deep Doze enabled.
  • Finds installed third-party FCM apps without requesting QUERY_ALL_PACKAGES.
  • Provides separate Aurogon FCM protection, Auto unstop, HyperOS Autostart, and AOSP battery-optimization controls for each enabled app.
  • Restores protection after reboots, app updates, or Shizuku restarts, and keeps diagnostic records for troubleshooting.

Requirements and setup

The app runs only in the owner profile on a Xiaomi device with HyperOS. Its manifest requires Xiaomi's com.miui.system shared library, so unsupported devices cannot install it. It does not modify PowerKeeper, clear app data, or use root.

  1. Install Shizuku from GitHub Releases, then start it through wireless debugging, ADB, or Sui. The Play Store build of Shizuku may have compatibility issues on Android 16 QPR2.
  2. Install and open HyperOS FCM Fix, then grant its Shizuku permission.
  3. Confirm that Google Play services shows Protection active. GMS is protected automatically and does not appear as an app you need to enable.
  4. Enable only the apps for which timely notifications matter, then review their Aurogon, Auto unstop, Autostart, and battery settings.
  5. Use Apply now after changing several settings or while troubleshooting. After a reboot, restart Shizuku and return to the app to confirm that protection has resumed.

Note

To stop using HyperOS FCM Fix, first turn off Nighttime FCM protection (HyperOS 4) if enabled, with Shizuku running so its app-added exemption can be removed. Set each managed app's HyperOS Autostart to the state you want while the app and its Autostart management switch are still enabled. Then disable every managed app and reboot before uninstalling. Disabling an app removes its Aurogon and Auto unstop rules and returns managed battery optimization to Optimized; the remaining temporary system changes reset after reboot. HyperOS Autostart is the exception and keeps the last applied state.

Tip

Start with AOSP battery optimization set to Optimized. Use Unrestricted only for an app whose notifications remain delayed, because allowing more background activity can increase battery use.

Protection behavior

Google Play services

The core fix preserves all existing entries in Settings.System.MILLET_NO_RESTRICT_APP and appends com.google.android.gms only when it is missing. A Shizuku UserService checks the setting every 30 seconds by default; 60- and 120-second intervals are also available.

Every full FCM protection pass also issues the equivalent of dumpsys greezer IM GMS disable and dumpsys greezer LM add com.google.android.gms. A pass occurs during the fixed recovery job, boot or app-update recovery, Apply now, and configurable periodic policy enforcement. These commands do not run in the 30/60/120-second polling loop. Boot or app update can queue both recovery and stale policy enforcement, so the commands may run twice close together. A failure of either Greezer command is reported as unavailable but does not by itself make WorkManager retry.

The UserService does not hold a wake lock. If Android suspends its process during Doze, polling pauses and resumes when the process can run again, so the selected interval is not exact. A fixed 15-minute WorkManager recovery job re-establishes the monitor and reapplies GMS and Aurogon protection when Shizuku is available; it also runs Auto unstop and, when FCM Connection Protection is enabled, finishes by requesting a GMS reconnect. WorkManager is subject to system scheduling and may run later during Doze.

FCM Connection Protection is a separate, optional workaround for CN GMS builds that may not reconnect promptly. While the UserService is runnable, it checks whether GMS has an established FCM socket on ports 5228–5230 and sends a targeted com.google.android.intent.action.GCM_RECONNECT broadcast when no connection is found or the check is unavailable. The recovery job also sends the broadcast whenever it actually runs. Turning this option off does not disable the MILLET_NO_RESTRICT_APP repair.

Nighttime FCM protection (HyperOS 4) is experimental and off by default. It addresses an additional nighttime freeze reproduced on a China HyperOS 4 build even with Xiaomi's older nighttime battery saving disabled. It maintains GMS in Xiaomi's shared game predownload exemption list, keeping deep Doze enabled. The exemption applies whenever present, including daytime, and may increase battery use.

The existing polling loop and 15-minute recovery job both check this list. Healthy checks only read it; startup or a missing-entry repair signals the framework and sends owner-GMS thaw and reconnect broadcasts. Those repair broadcasts run even if FCM Connection Protection is off. Other entries are retained. Turning the nighttime option off removes GMS only if this app introduced it; preexisting GMS is preserved. Cleanup waits for Shizuku if unavailable. Xiaomi's download components can clear the list, so protection depends on the monitor being able to run.

GMS has separate UIDs and transport state in different Android profiles. The shared package exemption can cover clone GMS, but the app's socket checks and recovery broadcasts target owner GMS. Immediate thaw of already-frozen clone GMS, overnight delivery, battery cost, and reboot/OTA behavior remain unverified. See the HyperOS 4 nighttime investigation for evidence and limits.

Managed apps

The app list contains non-system packages that declare a receiver for com.google.android.c2dm.intent.RECEIVE. Each enabled app has four independent controls:

  • Aurogon FCM protection: permits the FCM Intent through Xiaomi's broadcast control so it can be delivered to the app, including when delivery requires starting the app.
  • Auto unstop (Android 16+): clears FLAG_STOPPED every 15 minutes so the app remains eligible to be started by FCM; it does not launch the app itself.
  • HyperOS Autostart: permits the process start when FCM delivery targets an app with no running process, such as after the process has been killed. In that case it works together with the Aurogon rule. It manages both Xiaomi Autostart AppOps.
  • AOSP battery optimization: mainly lets users suppress an app's background activity while keeping FCM unaffected. It applies Unrestricted, Optimized, or Restricted to the selected Android profiles.

On first enable, Aurogon, Auto unstop, and Autostart management are turned on. Telegram is enabled by default and starts with battery optimization managed as Optimized; other discovered apps start disabled with battery management off.

Disabling an app removes it from the managed Aurogon and Auto unstop sets while retaining its saved choices. If battery management was enabled, the app is changed to Optimized once. Its Autostart state is left unchanged.

Apply now processes every enabled app. A separate WorkManager job uses the Periodical enforcement frequency setting to reapply managed Autostart and battery policies automatically for every enabled app. Setting it to Off disables this periodic enforcement job, but does not stop GMS protection, the fixed 15-minute GMS and Aurogon recovery job, or Auto unstop.

Autostart and battery policies target the Android profiles selected in the app; the owner and XSpace profiles are selected by default. Android's unrestricted device-idle allowlist is package-wide, so Unrestricted and Optimized changes are not isolated per profile.

Diagnostics

Open Diagnostics at the bottom of the main screen to inspect, refresh, copy, or clear session logs covering Shizuku connections, background jobs, privileged operations, and FCM repairs. The files are stored under /storage/emulated/0/Android/data/net.extrawdw.apps.miuisucks.powerkeeper/files/logs/. Logcat entries use the PowerKeeperFix prefix.

Technical investigation

Build

Open the project in Android Studio and run the app configuration.

Close

How Shizuku is used

Can keep FCM push reliable and manage autostart and battery limits via Shizuku's `IBinder.shellCommand` privileged path.

This is an AI-assisted analysis of Shizuku-related usages in the app's public source code. It is best effort, so it may not catch every single usage.

How this app uses Shizuku

Shizuku is used to run privileged system commands that keep push notifications working and enforce per-app battery rules on HyperOS and Xiaomi devices.

  • Keep FCM unrestricted: Google Play services is kept in the no restrict list with the settings get and settings put commands through Shizuku so power saving does not throttle push.
  • Manage broadcast rules: Broadcast settings are read and updated with the settings get, settings put and settings delete commands through Shizuku to allow FCM broadcasts for selected apps.
  • Tune GMS limiters: The limiter state is adjusted through Shizuku to disable the explicit GMS limiter and restore the ordinary GMS allowlist.
  • Control autostart behavior: Per-app autostart rules are set to allow or ignore with the appops set command through Shizuku for each selected Android user.
  • Control background execution: Per-app background running rules are set to allow or ignore with the appops set command and Doze allowlisting is added or removed with the deviceidle whitelist command through Shizuku.
  • Protect this app: The app applies the same autostart, background and Doze allowlist plus active standby bucket settings to itself with appops set, deviceidle whitelist, activity set-inactive and activity set-standby-bucket through Shizuku.
  • Restart stopped apps: Stopped packages are found with package listing and restarted with the package unstop command through Shizuku for auto unstop.
  • Reconnect push on demand: An FCM reconnect broadcast is sent with the activity broadcast command through Shizuku, including automatic polling that repairs the power and broadcast settings.
  • Support multi-user devices: Installed packages and Android users are discovered with package listing through Shizuku so policies apply to the users selected in the app.

Android APIs or commands used

  • IBinder.shellCommand
  • IBinder.dump
  • Binder.clearCallingIdentity
  • Binder.restoreCallingIdentity
  • appops set
  • appops write-settings
  • deviceidle whitelist
  • activity set-inactive
  • activity set-standby-bucket
  • activity broadcast
  • package list packages
  • package list users
  • package unstop
  • settings get
  • settings put
  • settings delete

Notable details

Targets Xiaomi and HyperOS devices and skips enforcement on unsupported devices. Policies are reapplied in the background so the system cannot silently revert the FCM and battery settings.

Close

Changelog

What's new for version 0.3.1

Full Changelog: https://github.com/dingwen07/hyperos-fcm-fix/compare/v0.2.3...v0.3.1

What’s new

Nighttime FCM protection (HyperOS 4)

A new experimental Nighttime FCM protection (HyperOS 4) option works around extra nighttime freezing of Google Play services (23:00–07:59, local time) while keeping deep Doze enabled. It is off by default.

  • Maintains Google Play services in Xiaomi’s shared game predownload freeze-exemption list and repairs missing membership during protection polling and recovery.
  • On startup or repair, sends targeted thaw and reconnect broadcasts for owner-profile Google Play services, even when FCM Connection Protection is off.
  • Preserves other entries and removes only the Google Play services entry added by this app when disabled.
  • The exemption applies whenever enabled, including daytime, and may increase battery use. Turn this option off with Shizuku running before uninstalling.

Adaptive interface

  • Navigation now adapts between a bottom bar and a side rail based on window size and fold posture.
  • Wider windows show Home in two columns and the Apps list beside app settings, with a draggable divider to resize the panes.
  • App settings support predictive Back in the wider layout, with improved sheet sizing and large-text layout in compact windows.
  • Improved edge-to-edge rendering with a side rail and corrected padding around the system navigation bar.
  • Fixed app settings sheets opening too low after repeated screen rotation.

Default app protection

  • WeChat is no longer enabled for protection by default.

更新内容

夜间 FCM 保护(HyperOS 4)

新增实验性 夜间 FCM 保护(HyperOS 4) 选项,用于规避 Google Play 服务在夜间(当地时间 23:00–07:59)受到的额外冻结,同时保留深度 Doze。默认关闭。

  • 将 Google Play 服务保留在小米共享的游戏预下载冻结豁免列表中,并在保护轮询和恢复任务中修复缺失的条目。
  • 启动或修复时,向主用户中的 Google Play 服务发送定向解冻和重新连接广播,即使关闭 FCM 连接保护也会执行。
  • 保留其他条目,停用时仅移除本应用添加的 Google Play 服务条目。
  • 启用期间豁免持续生效,包括白天,可能增加耗电量。卸载前请在 Shizuku 运行时关闭此选项。

自适应界面

  • 导航现根据窗口大小和折叠姿态,在底部导航栏与侧边导航栏之间自动调整。
  • 较宽窗口中的主页采用双列布局,应用列表与应用设置并排显示,可拖动分隔线调整面板宽度。
  • 较宽布局中的应用设置支持预测性返回,并改善了紧凑窗口中底部面板的尺寸和大字体布局。
  • 改善了侧边导航栏布局中的全面屏显示,并修正了系统导航栏周围的间距。
  • 修复了反复旋转屏幕后,应用设置面板打开位置过低的问题。

默认应用保护

  • 微信不再默认启用保护。

更新內容

夜間 FCM 保護(HyperOS 4)

新增實驗性 夜間 FCM 保護(HyperOS 4) 選項,用於避開 Google Play 服務在夜間(當地時間 23:00–07:59)受到的額外凍結,同時保留深度 Doze。預設關閉。

  • 將 Google Play 服務保留在小米共用的遊戲預先下載凍結豁免清單中,並在保護輪詢與復原工作中修復缺少的項目。
  • 啟動或修復時,向主要使用者中的 Google Play 服務傳送定向解凍與重新連線廣播,即使關閉 FCM 連線保護也會執行。
  • 保留其他項目,停用時僅移除本應用程式新增的 Google Play 服務項目。
  • 啟用期間豁免持續生效,包括白天,可能增加耗電量。解除安裝前請在 Shizuku 執行時關閉此選項。

自適應介面

  • 導覽現在會根據視窗大小與摺疊姿態,在底部導覽列與側邊導覽列之間自動調整。
  • 較寬視窗中的首頁採用雙欄配置,應用程式清單與應用程式設定並排顯示,可拖曳分隔線調整面板寬度。
  • 較寬配置中的應用程式設定支援預測返回,並改善了精簡視窗中底部面板的尺寸與大字體配置。
  • 改善了側邊導覽列配置中的全螢幕顯示,並修正了系統導覽列周圍的間距。
  • 修復了反覆旋轉螢幕後,應用程式設定面板開啟位置過低的問題。

預設應用程式保護

  • 微信不再預設啟用保護。

Attachments

8687abc635702125df70d65c1d54fe3bdedcb654b1b2eac59210ad728b14f10b  hyperos-fcm-fix_v0.3.1_11.apk
e74bc6a506f8850c2bfb22bf4230e7dcd29b5a1dd5c1c8d2491224e3ec93ca60  hyperos-fcm-fix_v0.3.1_11_mapping.txt
Close

Permissions

6 permissions requested

  • android.permission.RECEIVE_BOOT_COMPLETED
  • android.permission.WAKE_LOCK
  • android.permission.ACCESS_NETWORK_STATE
  • android.permission.FOREGROUND_SERVICE
  • net.extrawdw.apps.miuisucks.powerkeeper.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION
  • moe.shizuku.manager.permission.API_V23
Close