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

//*/
}

相关推荐
cnxy1881 小时前
围棋对弈Python程序开发完整指南:步骤1 - 棋盘基础框架搭建
开发语言·python
Nonoas2 小时前
动态代理:发布订阅的高级玩法
java·ide·intellij-idea
程序员-周李斌3 小时前
Java 死锁
java·开发语言·后端
皮皮林5513 小时前
Prometheus+Grafana,打造强大的监控与可视化平台
java
JasmineWr3 小时前
CompletableFuture相关问题
java·开发语言
零雲3 小时前
java面试:知道java的反射机制吗
java·开发语言·面试
Jeremy爱编码3 小时前
实现 Trie (前缀树)
开发语言·c#
laocooon5238578864 小时前
插入法排序 python
开发语言·python·算法
你的冰西瓜4 小时前
C++中的list容器详解
开发语言·c++·stl·list
java1234_小锋4 小时前
Java进程占用的内存有哪些部分?
java