Notification.GroupHelper.onNotificationPosted

This hook has nothing to do with privacy. It prevents notifications from being grouped by Android Oreo and later for a set of user-configrable apps. Look into the Notification.Ranker.onNotification* hooks for the same functionality for Marshmallow and Nougat. Instructions: 1. Download both hooks: - Notification.GroupHelper.onNotificationPosted - Notification.GroupHelper.onNotificationRemoved 2. Make sure that the Fif collection is enabled in XPL Pro. 3. In XPL, navigate to the "Android System" (android) app (you may have to change the filter to "Show all apps" first), and expand the restriction categories. 4.a. Check the "Group notifications" category. 4.b. Or, alternately, enable both Notification.GroupHelper.onNotificationPosted and Notification.GroupHelper.onNotificationRemoved hooks for "Android System" (android) in XPL Pro. 5. Configure a list of apps whose notifications should not be grouped with XPrivacyLua Pro, under "Custom Values", "Ungrouped notification package names". List items are whitespace separated, and must match exactly, eg. "com.android.chrome". Notes: It is recommended not to force stop the system app, but reboot between changes to the hook or its configuration/settings. Changelog: v4 - 2019-12-17 First public release.

CollectionFif
GroupGroup notifications
NameNotification.GroupHelper.onNotificationPosted
AuthorFif_
Version4
Updated (UTC)2019-12-20 22:44:11
Created (UTC)2019-12-20 22:44:11
Downloads514
Class namecom.android.server.notification.GroupHelper
Method nameonNotificationPosted
Parameter typesandroid.service.notification.StatusBarNotification, boolean
Return type-
Min SDK26
Max SDK999
Min APK0
Max APK2147483647
Excluded packages^(?!android$).*
EnabledYes
OptionalNo
UsageYes
NotifyNo
SettingsUngrouped notification package names
-- Fif.Notification is a Lua hook set designed to work with XPrivacyLua.
-- Copyright (C) 2018, 2019 Philippe Troin (Fif_ on XDA)

-- Fif.Notification is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.

-- Fif.Notification is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.

-- You should have received a copy of the GNU General Public License
-- along with XPrivacyLua.  If not, see <http://www.gnu.org/licenses/>.

function before(hook, param)
    local notif = param:getArgument(0)
    if notif == nil then
        return false
    end

    local context = param:getApplicationContext()
    local UngroupedApps = param:getValue('Fif.Notification.UngroupedApps', context)

    if UngroupedApps == nil then
        local packages = param:getSetting("Ungrouped notification package names")
        UngroupedApps = {}
        local ungroupedAppsLog = {}
        if packages ~= nil then
            packages:gsub('[%S]+', function(x) UngroupedApps[x] = true table.insert(ungroupedAppsLog, x) end)
        end
        param:putValue('Fif.Notification.UngroupedApps', UngroupedApps, context)
        log('Apps with ungrouped notifications: ' .. table.concat(ungroupedAppsLog, ', '))
    end

    local package = notif:getPackageName()
    
    if UngroupedApps[package] then
        log('Deny ' .. package)
        param:setResult(nil)
        return true, package
    else
        log('Allow ' .. package)
        return false
    end
end