Remove unnecessary async

Because if the work wasn't scheduled by the time the main page was
shown, the switch would be shown in the wrong state. And these
calls are fast, and can be done on the main thread

Test: turn off DND access for apps with DND rules
Fixes: 207058117
Change-Id: I186413f4237ef754bdfa5cc469e1b7be4ff71f2c
This commit is contained in:
Julia Reynolds
2022-02-23 12:51:45 -05:00
parent de08d984ef
commit 6fd71484b5

View File

@@ -97,17 +97,13 @@ public class ZenAccessController extends BasePreferenceController {
public static void setAccess(final Context context, final String pkg, final boolean access) {
logSpecialPermissionChange(access, pkg, context);
AsyncTask.execute(() -> {
final NotificationManager mgr = context.getSystemService(NotificationManager.class);
mgr.setNotificationPolicyAccessGranted(pkg, access);
});
final NotificationManager mgr = context.getSystemService(NotificationManager.class);
mgr.setNotificationPolicyAccessGranted(pkg, access);
}
public static void deleteRules(final Context context, final String pkg) {
AsyncTask.execute(() -> {
final NotificationManager mgr = context.getSystemService(NotificationManager.class);
mgr.removeAutomaticZenRules(pkg);
});
final NotificationManager mgr = context.getSystemService(NotificationManager.class);
mgr.removeAutomaticZenRules(pkg);
}
@VisibleForTesting