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

Commit a0cea561 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Write policy file less

Change-Id: I4357ad25c339d2210a977f661bbc9328bdb59096
Bug: 137568668
Bug: 135660478
Test: device boot, change notification settings, very settings on reboot
parent d4e1eabb
Loading
Loading
Loading
Loading
+11 −2
Original line number Original line Diff line number Diff line
@@ -473,6 +473,8 @@ public class NotificationManagerService extends SystemService {
    private MetricsLogger mMetricsLogger;
    private MetricsLogger mMetricsLogger;
    private TriPredicate<String, Integer, String> mAllowedManagedServicePackages;
    private TriPredicate<String, Integer, String> mAllowedManagedServicePackages;


    private final SavePolicyFileRunnable mSavePolicyFile = new SavePolicyFileRunnable();

    private static class Archive {
    private static class Archive {
        final int mBufferSize;
        final int mBufferSize;
        final ArrayDeque<StatusBarNotification> mBuffer;
        final ArrayDeque<StatusBarNotification> mBuffer;
@@ -666,7 +668,14 @@ public class NotificationManagerService extends SystemService {


    @VisibleForTesting
    @VisibleForTesting
    protected void handleSavePolicyFile() {
    protected void handleSavePolicyFile() {
        IoThread.getHandler().post(() -> {
        if (!IoThread.getHandler().hasCallbacks(mSavePolicyFile)) {
            IoThread.getHandler().post(mSavePolicyFile);
        }
    }

    private final class SavePolicyFileRunnable implements Runnable {
        @Override
        public void run() {
            if (DBG) Slog.d(TAG, "handleSavePolicyFile");
            if (DBG) Slog.d(TAG, "handleSavePolicyFile");
            synchronized (mPolicyFile) {
            synchronized (mPolicyFile) {
                final FileOutputStream stream;
                final FileOutputStream stream;
@@ -686,7 +695,7 @@ public class NotificationManagerService extends SystemService {
                }
                }
            }
            }
            BackupManager.dataChanged(getContext().getPackageName());
            BackupManager.dataChanged(getContext().getPackageName());
        });
        }
    }
    }


    private void writePolicyXml(OutputStream stream, boolean forBackup, int userId)
    private void writePolicyXml(OutputStream stream, boolean forBackup, int userId)