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

Commit 03f7fd1f authored by Benedict Wong's avatar Benedict Wong Committed by Automerger Merge Worker
Browse files

Prevent concurrent modification exceptions in VcnManagementService am: 5c5b4850

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1715568

Change-Id: Ic3342f4b42188efeb7452b1c6715c51ca64a11ff
parents 53720c43 5c5b4850
Loading
Loading
Loading
Loading
+34 −29
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ import java.util.concurrent.TimeUnit;
// TODO(b/180451994): ensure all incoming + outgoing calls have a cleared calling identity
public class VcnManagementService extends IVcnManagementService.Stub {
    @NonNull private static final String TAG = VcnManagementService.class.getSimpleName();
    private static final long DUMP_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5);

    public static final boolean VDBG = false; // STOPSHIP: if true

@@ -1001,6 +1002,8 @@ public class VcnManagementService extends IVcnManagementService.Stub {

        final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ");

        // Post to handler thread to prevent ConcurrentModificationExceptions, and avoid lock-hell.
        mHandler.runWithScissors(() -> {
            pw.println("VcnManagementService dump:");
            pw.increaseIndent();

@@ -1026,7 +1029,8 @@ public class VcnManagementService extends IVcnManagementService.Stub {
                pw.println("mConfigs:");
                pw.increaseIndent();
                for (Entry<ParcelUuid, VcnConfig> entry : mConfigs.entrySet()) {
                pw.println(entry.getKey() + ": " + entry.getValue().getProvisioningPackageName());
                    pw.println(entry.getKey() + ": "
                            + entry.getValue().getProvisioningPackageName());
                }
                pw.decreaseIndent();
                pw.println();
@@ -1041,6 +1045,7 @@ public class VcnManagementService extends IVcnManagementService.Stub {
            }

            pw.decreaseIndent();
        }, DUMP_TIMEOUT_MILLIS);
    }

    // TODO(b/180452282): Make name more generic and implement directly with VcnManagementService