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

Commit db35269a authored by Jesse Wilson's avatar Jesse Wilson
Browse files

Don't call broken+deprecated SamplingProfiler.writeHprofData

http://b/3381260
Change-Id: I5cf5ef8fbac2ada3669a0f7eff42f834db6573d7
parent 3a27acef
Loading
Loading
Loading
Loading
+13 −17
Original line number Diff line number Diff line
@@ -16,22 +16,21 @@

package com.android.internal.os;

import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.SystemProperties;
import android.util.Log;
import dalvik.system.SamplingProfiler;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.ThreadFactory;

import android.content.pm.PackageInfo;
import android.util.Log;
import android.os.*;
import java.util.concurrent.atomic.AtomicBoolean;
import libcore.io.IoUtils;

/**
 * Integrates the framework with Dalvik's sampling profiler.
@@ -162,19 +161,16 @@ public class SamplingProfilerIntegration {
        PrintStream out = null;
        try {
            out = new PrintStream(new BufferedOutputStream(new FileOutputStream(path)));
        } catch (IOException e) {
            Log.e(TAG, "Could not open " + path + ":" + e);
            return;
        }
        try {
            generateSnapshotHeader(name, packageInfo, out);
            INSTANCE.writeHprofData(out);
        } finally {
            out.close();
        }
            new SamplingProfiler.AsciiHprofWriter(INSTANCE.getHprofData(), out).write();
            if (out.checkError()) {
            Log.e(TAG, "Error writing snapshot.");
                throw new IOException();
            }
        } catch (IOException e) {
            Log.e(TAG, "Error writing snapshot to " + path, e);
            return;
        } finally {
            IoUtils.closeQuietly(out);
        }
        // set file readable to the world so that SamplingProfilerService
        // can put it to dropbox