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

//*/
}

相关推荐
太阳的后裔1 小时前
随笔一些用C#封装的控件
开发语言·c#
tianyuanwo1 小时前
Rust语言组件RPM包编译原理与Cargo工具详解
开发语言·网络·rust·rpm
float_六七4 小时前
IntelliJ IDEA双击Ctrl的妙用
java·ide·intellij-idea
能摆一天是一天5 小时前
JAVA stream().flatMap()
java·windows
CodeCraft Studio5 小时前
PDF处理控件Aspose.PDF教程:使用 Python 将 PDF 转换为 Base64
开发语言·python·pdf·base64·aspose·aspose.pdf
零点零一5 小时前
VS+QT的编程开发工作:关于QT VS tools的使用 qt的官方帮助
开发语言·qt
颜如玉6 小时前
🤲🏻🤲🏻🤲🏻临时重定向一定要能重定向🤲🏻🤲🏻🤲🏻
java·http·源码
程序员的世界你不懂7 小时前
【Flask】测试平台开发,新增说明书编写和展示功能 第二十三篇
java·前端·数据库
星空寻流年7 小时前
设计模式第一章(建造者模式)
java·设计模式·建造者模式
lingchen19067 小时前
MATLAB的数值计算(三)曲线拟合与插值
开发语言·matlab