android 11 屏蔽 某些app 的通知功能

文章分析了Android系统中两个服务的代码变更,展示了如何通过包名判断来屏蔽来自特定应用(如懒人教育和九学王)的通知。这些更改涉及到NotificationManagerService和AlertWindowNotification类,影响了通知的处理方式。
摘要由CSDN通过智能技术生成

下面列举了俩种方法 :都时通过包名 来判断的

diff --git a/alps/frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java b/alps/frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java
index b9c65b7b72b..f4da1abca7b 100755
--- a/alps/frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/alps/frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -5729,6 +5729,10 @@ public class NotificationManagerService extends SystemService {
     void enqueueNotificationInternal(final String pkg, final String opPkg, final int callingUid,
             final int callingPid, final String tag, final int id, final Notification notification,
             int incomingUserId) {
+       if(pkg.equals("com.jxw.pushservice") || pkg.equals("com.jxw.mskt.video") || pkg.equals("com.jxw.newyouer.video")){
+            return;
+        }
+
         enqueueNotificationInternal(pkg, opPkg, callingUid, callingPid, tag, id, notification,
         incomingUserId, false);
     }
diff --git a/alps/frameworks/base/services/core/java/com/android/server/wm/AlertWindowNotification.java b/alps/frameworks/base/services/core/java/com/android/server/wm/AlertWindowNotification.java
old mode 100644
new mode 100755
index fde03695024..85259397678
--- a/alps/frameworks/base/services/core/java/com/android/server/wm/AlertWindowNotification.java
+++ b/alps/frameworks/base/services/core/java/com/android/server/wm/AlertWindowNotification.java
@@ -69,7 +69,11 @@ class AlertWindowNotification {
     void post() {
         // We can't create/post the notification while the window manager lock is held since it will
         // end up calling into activity manager. So, we post a message to do it later.
-        mService.mH.post(this::onPostNotification);
+       if(mPackageName.contains("com.qi")||mPackageName.contains("wyt")||mPackageName.contains("aiworks")||mPackageName.equals("com.tencent.deviceapp")){
+       //nothing to do
+       }else{        
+       mService.mH.post(this::onPostNotification);
+       }
     }

以上是屏蔽 懒人教育 和 九学王 学习软件的一些通知窗口

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值