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

Commit e6efa054 authored by Andrei Onea's avatar Andrei Onea
Browse files

Fix regression in Dalvik:HEAP_TOTAL

Make HiddenApiUsageLogger a singleton initialised in Zygote pre-fork and
rely on copy-on-write to prevent heap size increases

Test: atest google/perf/memory/memory-test
Bug: 123705750
Change-Id: I384d3bdefa6525fcce494783c548e85979bce4d5
Merged-In: Idc5ad13d4e158659009290f410ce721013345308
parent 21b38267
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -315,9 +315,14 @@ class ZygoteConnection {
        }
    }

    private class HiddenApiUsageLogger implements VMRuntime.HiddenApiUsageLogger {
    private static class HiddenApiUsageLogger implements VMRuntime.HiddenApiUsageLogger {

        private final MetricsLogger mMetricsLogger = new MetricsLogger();
        private static HiddenApiUsageLogger sInstance = new HiddenApiUsageLogger();

        public static HiddenApiUsageLogger getInstance() {
            return HiddenApiUsageLogger.sInstance;
        }

        public void hiddenApiUsed(String packageName, String signature,
                int accessMethod, boolean accessDenied) {
@@ -351,7 +356,7 @@ class ZygoteConnection {
    private void handleHiddenApiAccessLogSampleRate(int samplingRate) {
        try {
            ZygoteInit.setHiddenApiAccessLogSampleRate(samplingRate);
            ZygoteInit.setHiddenApiUsageLogger(new HiddenApiUsageLogger());
            ZygoteInit.setHiddenApiUsageLogger(HiddenApiUsageLogger.getInstance());
            mSocketOutStream.writeInt(0);
        } catch (IOException ioe) {
            throw new IllegalStateException("Error writing to command socket", ioe);