Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d283f0fb authored by Dan Sandler's avatar Dan Sandler
Browse files

Don't block notifications from system packages.

Bug: 16703366
Change-Id: Id2f635e4e99df0c10afff8a0f5130179d381762c
parent 7641e1ad
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.widget.Toast;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
import com.android.settings.notification.NotificationAppList.AppRow;
import com.android.settings.notification.NotificationAppList.Backend;

@@ -184,6 +185,12 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
                }
            });
        }

        // Users cannot block notifications from system/signature packages
        if (Utils.isSystemPackage(pm, info)) {
            getPreferenceScreen().removePreference(mBlock);
            mPriority.setDependency(null); // don't have it depend on a preference that's gone
        }
    }

    private void toastAndFinish() {
@@ -199,7 +206,7 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
                final String p = packages[i];
                if (pkg.equals(p)) {
                    try {
                        return pm.getPackageInfo(pkg, 0);
                        return pm.getPackageInfo(pkg, PackageManager.GET_SIGNATURES);
                    } catch (NameNotFoundException e) {
                        Log.w(TAG, "Failed to load package " + pkg, e);
                    }
+0 −2
Original line number Diff line number Diff line
@@ -351,7 +351,6 @@ public class NotificationAppList extends PinnedHeaderListFragment
        public boolean priority;
        public boolean sensitive;
        public boolean first;  // first app in section
        public boolean isSystem;
    }

    private static final Comparator<AppRow> mRowComparator = new Comparator<AppRow>() {
@@ -377,7 +376,6 @@ public class NotificationAppList extends PinnedHeaderListFragment
        row.banned = backend.getNotificationsBanned(row.pkg, row.uid);
        row.priority = backend.getHighPriority(row.pkg, row.uid);
        row.sensitive = backend.getSensitive(row.pkg, row.uid);
        row.isSystem = Utils.isSystemPackage(pm, pkg);
        return row;
    }