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);

//*/
}

相关推荐
for_ever_love__8 分钟前
爬虫项目: 获取高分电影的数据总结
开发语言·python·学习
weixin_3077791313 分钟前
C++代码实现MATLAB中的ode23t函数功能
开发语言·c++·算法·matlab
爱划水不秃头的程序员21 分钟前
堆 栈 和常量池的关系是啥 是jvm对他们进行的划分吗
java
周GZ23 分钟前
4个提问,deepseek讲解Java中的线程池
java
LuTshoes23 分钟前
context 上下文工程
java·人工智能·spring·ai
wuminyu23 分钟前
Markword在紧凑对象头上的实现原理剖析
java·linux·c语言·jvm·c++
君顾134 分钟前
24小时自助健身房系统开发实战与完整指南
java·开发语言·健身房
鹿角片ljp44 分钟前
LeetCode 78:子集|回溯、选与不选、递归和path快照
java·数据结构·算法
金玉满堂@bj1 小时前
多环境部署方案(开发、测试、生产,搭配Tomcat\+WAR包)
java·tomcat·maven
syagain_zsx1 小时前
算法基础篇 · 02 高精度(C++ 题解)
开发语言·c++·学习·高精度