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

Commit 669077d8 authored by Yurii Zubrytskyi's avatar Yurii Zubrytskyi
Browse files

[res] Fix a StrictMode violation in IdmapDaemon

it needs to access the disk to check for idmap existence

Fixes: 375181272
Test: build + boot
Flag: EXEMPT bugfix
Change-Id: I65e45844c096a9d3984512c9c1bdd5437c74c9c8
parent f3ce6028
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.IBinder;
import android.os.IIdmap2;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.SystemClock;
import android.os.SystemService;
import android.text.TextUtils;
@@ -181,6 +182,8 @@ class IdmapDaemon {
    }

    boolean idmapExists(String overlayPath, int userId) {
        // The only way to verify an idmap is to read its state on disk.
        final StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
        try (Connection c = connect()) {
            final IIdmap2 idmap2 = c.getIdmap2();
            if (idmap2 == null) {
@@ -193,6 +196,8 @@ class IdmapDaemon {
        } catch (Exception e) {
            Slog.wtf(TAG, "failed to check if idmap exists for " + overlayPath, e);
            return false;
        } finally {
            StrictMode.setThreadPolicy(oldPolicy);
        }
    }