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

//*/
}

相关推荐
mjhcsp1 分钟前
C++ long long 类型深度解析:大整数处理的基石
开发语言·c++·策略模式·long long
oak隔壁找我2 分钟前
RabbitMQ 实现延迟通知的完整方案
java·后端
信码由缰7 分钟前
Java的优势有哪些
java
trow14 分钟前
ConcurrentHashMap线程安全实现详解
java·后端
trow14 分钟前
HashMap核心原理与源码剖析
java·后端
YuanlongWang19 分钟前
C# 设计模式——工厂模式
开发语言·设计模式·c#
VB.Net26 分钟前
VB.Net循序渐进(第二版)
开发语言·.net·vb.net
埃伊蟹黄面32 分钟前
深入理解STL关联容器:map/multimap与set/multiset全解析
开发语言·c++
21号 134 分钟前
4.客户端(Redis)
开发语言·数据库·github
可观测性用观测云44 分钟前
云原生架构下微服务接入 SkyWalking 最佳实践
java