Android 去掉通知
去掉锁屏界面通知
O : frameworks\base\packages\SettingsProvider\res\values\defaults.xml
<!-- Default for Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 1==on -->
<integer name="def_lock_screen_show_notifications">0</integer>
去掉下拉栏通知
O : \frameworks\base\services\core\java\com\android\server\notification\NotificationManagerService.java:3567
//mHandler.post(new EnqueueNotificationRunnable(userId, r));//注释掉启动通知的线程
根据特定的apk来决定是否屏蔽下拉通知
R: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) {
...
// Need escalated privileges to get package importance
final long token = Binder.clearCallingIdentity();
boolean isAppForeground;
try {
isAppForeground = mActivityManager.getPackageImportance(pkg) == IMPORTANCE_FOREGROUND;
} finally {
Binder.restoreCallingIdentity(token);
}
//mHandler.post(new EnqueueNotificationRunnable(userId, r, isAppForeground));//dhy
//dhy add
android.util.Log.e("dhyxxx","xxxxxxx apk==" + pkg);//dhy
if(("com.android.bluetooth").equals(pkg)){
mHandler.post(new EnqueueNotificationRunnable(userId, r, isAppForeground));//dhy
}
//dhy add end
}