Don't block notifications from system packages.

Bug: 16703366
Change-Id: Id2f635e4e99df0c10afff8a0f5130179d381762c
This commit is contained in:
Dan Sandler
2014-09-03 16:48:13 +02:00
parent 7641e1ad44
commit d283f0fbd5
2 changed files with 8 additions and 3 deletions

View File

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