You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

魅族Flyme OS下Android应用通知停止显示的问题排查

Flyme OS下应用通知被系统自动拦截,仅修改Application ID可恢复

问题背景

开发了一个测试Android Notifications API的简单应用,仅包含一个触发通知的按钮。在运行Flyme OS的魅族手机上,初始安装后通知可正常显示,但使用一段时间后,点击按钮不再弹出通知。尝试删除重装应用、重启手机、重启Android Studio均无效,唯一有效的解决方式是修改项目的Application ID(Android Studio中右键根目录→Default Config标签→修改Application ID),修改后重装应用,通知即可恢复显示。

核心代码

public class MainActivity extends AppCompatActivity {

private AppBarConfiguration appBarConfiguration;
private ActivityMainBinding binding;

NotificationManager notification;
Button btn;
String ChannelID = "ChannelID";
String ChannelName = "ChannelName";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    binding = ActivityMainBinding.inflate(getLayoutInflater());
    setContentView(binding.getRoot());

    setSupportActionBar(binding.toolbar);

    NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);
    appBarConfiguration = new AppBarConfiguration.Builder(navController.getGraph()).build();
    NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);

    binding.fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });

    btn = findViewById(R.id.button_first);
    notification = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);

    btn.setOnClickListener(view -> {
        NotificationChannel notificationChannel = new NotificationChannel(ChannelID,
                ChannelName,
                NotificationManager.IMPORTANCE_HIGH);
        notification.createNotificationChannel(notificationChannel);

        NotificationCompat.Builder builder = new NotificationCompat.Builder(MainActivity.this, ChannelID);

        builder.setSmallIcon(R.mipmap.ic_launcher_round)
                .setContentTitle("Test Title").setContentText("Test content text");
        Notification n = builder.build();
        notification.notify((int) (new Date()).getTime(), builder.build());
    });
}
}

系统日志对比

通知正常显示时的系统日志

NotificationFirewall    pid-1562    D  getFilterResult Main begin
NotificationFirewall    pid-1562    D  interceptNotification A begin
NotificationFirewall    pid-1562    D  handleMessage: interceptNotification begin
NotificationFirewall    pid-1562    D  handleMessage: interceptNotification end,mResult=category=news;categoryPriority=0,notificationPriority=0;userFilter=0;tag=news;isValid=true;intercept=false,score=100.0,score_scale=10.0,shouldAffectRanking =true,shouldAffectIntercept=true,shouldAuthorityManagement=false,filterByUserBefore=false
NotificationFirewall    pid-1562    D  interceptNotification A end
NotificationFirewall    pid-1562    D  getFilterResult: mResultNull=false,mNotificationKey=0|com.example.notiftest5|-1785528131|null|10600,sbn.getKey()=0|com.example.notiftest5|-1785528131|null|10600
NotificationFirewall    pid-1562    D  getNotificationFilter: pkg=com.example.notiftest5,result=category=news;categoryPriority=0,notificationPriority=0;userFilter=0;tag=news;isValid=true;intercept=false,score=100.0,score_scale=10.0,shouldAffectRanking =true,shouldAffectIntercept=true,shouldAuthorityManagement=false,filterByUserBefore=false
NotificationFirewall    pid-1562    D  getNotificationFilter: pkg=com.example.notiftest5,isMediaNoti=false,isAutoFilterMode=true
NotificationService     pid-1562    D  enqueueNotificationInternal: pkg=com.example.notiftest5,id=-1785528131,ufk=com.example.notiftest5$ChannelID,n.filter=category=news;categoryPriority=0,notificationPriority=0;userFilter=0;tag=news;score=10.000000,score_scale=10.000000;intercept=false;shouldAffectRanking=true;shouldAffectIntercept=true;shouldAuthorityManagement=true;filterByUserBefore=false
NotificationService     pid-1562    D  showWakeUpScreen: aboveThreshold=true,DND=0,isUpdate=false,alertOnce=0,noClear=0,onGoing=0,category=nulluserFilter=0

通知被拦截时的系统日志

NotificationFirewall    pid-1562    D  getFilterResult Main begin
NotificationFirewall    pid-1562    D  interceptNotification A begin
NotificationFirewall    pid-1562    D  handleMessage: interceptNotification begin
NotificationFirewall    pid-1562    D  handleMessage: interceptNotification end,mResult=category=news;categoryPriority=0,notificationPriority=0;userFilter=0;tag=news;isValid=true;intercept=false,score=100.0,score_scale=10.0,shouldAffectRanking =true,shouldAffectIntercept=true,shouldAuthorityManagement=false,filterByUserBefore=false
NotificationFirewall    pid-1562    D  interceptNotification A end
NotificationFirewall    pid-1562    D  getFilterResult: mResultNull=false,mNotificationKey=0|com.example.notiftest|-1785734812|null|10599,sbn.getKey()=0|com.example.notiftest|-1785734812|null|10599
NotificationFirewall    pid-1562    D  getNotificationFilter: pkg=com.example.notiftest,result=category=news;categoryPriority=0,notificationPriority=0;userFilter=0;tag=news;isValid=true;intercept=false,score=100.0,score_scale=10.0,shouldAffectRanking =true,shouldAffectIntercept=true,shouldAuthorityManagement=false,filterByUserBefore=false
NotificationFirewall    pid-1562    D  getNotificationFilter: pkg=com.example.notiftest,isMediaNoti=false,isAutoFilterMode=true
NotificationService     pid-1562    D  enqueueNotificationInternal: pkg=com.example.notiftest,id=-1785734812,ufk=com.example.notiftest$ChannelID,n.filter=category=news;categoryPriority=0,notificationPriority=0;userFilter=0;tag=news;score=-100.000000,score_scale=10.000000;intercept=true;shouldAffectRanking=true;shouldAffectIntercept=true;shouldAuthorityManagement=true;filterByUserBefore=true
NotificationService     pid-1562    D  showWakeUpScreen: aboveThreshold=false,DND=0,isUpdate=false,alertOnce=0,noClear=0,onGoing=0,category=nulluserFilter=0

关键差异点

通知被拦截时,系统日志中的核心参数发生变化:

  • 正常状态:score=10.000000、intercept=false、filterByUserBefore=false
  • 拦截状态:score=-100.000000、intercept=true、filterByUserBefore=true

疑问

从日志可判断系统针对该Application ID设置了通知过滤规则,但找不到Flyme系统中关于NotificationFirewall或NotificationService的相关设置入口,不清楚通知被自动过滤的具体原因,也不知道如何清除或修改该过滤规则。

内容的提问来源于stack exchange,提问作者moriarty

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 20:24:54