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

//*/
}

相关推荐
kong79069281 小时前
Java-Intellij IDEA 自动导包设置
java·ide·intellij-idea
kkai人工智能2 小时前
AI写作:从“废话”到“爆款”
开发语言·人工智能·ai·ai写作
twj_one5 小时前
Arthas使用
java
lizz315 小时前
C++模板编程:从入门到精通
java·开发语言·c++
shoubepatien6 小时前
JAVA -- 05
java·开发语言
寰天柚子6 小时前
Java并发编程中的线程安全问题与解决方案全解析
java·开发语言·python
沐知全栈开发6 小时前
Bootstrap 下拉菜单:设计与实现指南
开发语言
memgLIFE6 小时前
Springboot 分层结构
java·spring boot·spring
shoubepatien6 小时前
JAVA -- 08
java·后端·intellij-idea
kong79069286 小时前
Java新特性-(二)Java基础语法
java·新特性·java 基础语法