Android 去掉Google商店和Google服务默认的安全提示的通知

法1.

/frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java

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, boolean postSilently) {

if (HwNotificationManagerService.disableNotification()) {

return;

}

if (DBG) {

Slog.v(TAG, "enqueueNotificationInternal: pkg=" + pkg + " id=" + id

  • " notification=" + notification);

}

//*/add start

if(pkg.equals("com.google.android.gms") || pkg.equals("com.android.vending")){
return;
}

//*/add end

if (pkg == null || notification == null) {

throw new IllegalArgumentException("null not allowed: pkg=" + pkg

  • " id=" + id + " notification=" + notification);

}

====================================================================

法2.

/frameworks/base/services/core/java/com/android/server/wm/AlertWindowNotification.java

AlertWindowNotification(WindowManagerService service, String packageName ) {

mService = service;

mPackageName = packageName ;

mNotificationManager =

(NotificationManager) mService.mContext.getSystemService(NOTIFICATION_SERVICE);

mNotificationTag = CHANNEL_PREFIX + mPackageName;

mRequestCode = sNextRequestCode++;

mIconUtilities = new IconUtilities(mService.mContext);

}

void post() {
//*/
if(mPackageName.contains("com.google.android.gms") || mPackageName.contains("com.android.vending")){

}else {
mService.mH.post(this::onPostNotification);
}

/*/

mService.mH.post(this::onPostNotification);

//*/
}

相关推荐
1104.北光c°3 分钟前
滑动窗口HotKey探测机制:让你的缓存TTL更智能
java·开发语言·笔记·程序人生·算法·滑动窗口·hotkey
for_ever_love__1 小时前
Objective-C学习 NSSet 和 NSMutableSet 功能详解
开发语言·学习·ios·objective-c
云原生指北3 小时前
GitHub Copilot SDK 入门:五分钟构建你的第一个 AI Agent
java
似水明俊德7 小时前
02-C#.Net-反射-面试题
开发语言·面试·职场和发展·c#·.net
Leinwin7 小时前
OpenClaw 多 Agent 协作框架的并发限制与企业化规避方案痛点直击
java·运维·数据库
薛定谔的悦7 小时前
MQTT通信协议业务层实现的完整开发流程
java·后端·mqtt·struts
enjoy嚣士8 小时前
springboot之Exel工具类
java·spring boot·后端·easyexcel·excel工具类
Thera7778 小时前
C++ 高性能时间轮定时器:从单例设计到 Linux timerfd 深度优化
linux·开发语言·c++
罗超驿8 小时前
独立实现双向链表_LinkedList
java·数据结构·链表·linkedlist
炘爚9 小时前
C语言(文件操作)
c语言·开发语言