Loading core/java/android/app/ActivityThread.java +1 −1 Original line number Diff line number Diff line Loading @@ -6381,7 +6381,7 @@ public final class ActivityThread extends ClientTransactionHandler { VMDebug.setAllocTrackerStackDepth(Integer.parseInt(property)); } if (data.trackAllocation) { DdmVmInternal.enableRecentAllocations(true); DdmVmInternal.setRecentAllocationsTrackingEnabled(true); } // Note when this process has started. Process.setStartTimes(SystemClock.elapsedRealtime(), SystemClock.uptimeMillis()); Loading core/java/android/ddm/DdmHandle.java 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.ddm; import org.apache.harmony.dalvik.ddmc.ChunkHandler; import java.nio.ByteBuffer; /** * Contains utility methods for chunk serialization and deserialization. */ public abstract class DdmHandle extends ChunkHandler { /** * Utility function to copy a String out of a ByteBuffer. * * This is here because multiple chunk handlers can make use of it, * and there's nowhere better to put it. */ public static String getString(ByteBuffer buf, int len) { char[] data = new char[len]; for (int i = 0; i < len; i++) { data[i] = buf.getChar(); } return new String(data); } /** * Utility function to copy a String into a ByteBuffer. */ public static void putString(ByteBuffer buf, String str) { int len = str.length(); for (int i = 0; i < len; i++) { buf.putChar(str.charAt(i)); } } } core/java/android/ddm/DdmHandleAppName.java +4 −4 Original line number Diff line number Diff line Loading @@ -30,9 +30,9 @@ import java.nio.ByteBuffer; /** * Track our app name. We don't (currently) handle any inbound packets. */ public class DdmHandleAppName extends ChunkHandler { public class DdmHandleAppName extends DdmHandle { public static final int CHUNK_APNM = type("APNM"); public static final int CHUNK_APNM = ChunkHandler.type("APNM"); private static volatile Names sNames = new Names("", ""); Loading @@ -51,13 +51,13 @@ public class DdmHandleAppName extends ChunkHandler { * Called when the DDM server connects. The handler is allowed to * send messages to the server. */ public void connected() {} public void onConnected() {} /** * Called when the DDM server disconnects. Can be used to disable * periodic transmissions or clean up saved state. */ public void disconnected() {} public void onDisconnected() {} /** * Handle a chunk of data. Loading core/java/android/ddm/DdmHandleExit.java +7 −5 Original line number Diff line number Diff line Loading @@ -16,18 +16,20 @@ package android.ddm; import android.util.Log; import org.apache.harmony.dalvik.ddmc.Chunk; import org.apache.harmony.dalvik.ddmc.ChunkHandler; import org.apache.harmony.dalvik.ddmc.DdmServer; import android.util.Log; import java.nio.ByteBuffer; /** * Handle an EXIT chunk. */ public class DdmHandleExit extends ChunkHandler { public class DdmHandleExit extends DdmHandle { public static final int CHUNK_EXIT = type("EXIT"); public static final int CHUNK_EXIT = ChunkHandler.type("EXIT"); private static DdmHandleExit mInstance = new DdmHandleExit(); Loading @@ -46,13 +48,13 @@ public class DdmHandleExit extends ChunkHandler { * Called when the DDM server connects. The handler is allowed to * send messages to the server. */ public void connected() {} public void onConnected() {} /** * Called when the DDM server disconnects. Can be used to disable * periodic transmissions or clean up saved state. */ public void disconnected() {} public void onDisconnected() {} /** * Handle a chunk of data. We're only registered for "EXIT". Loading core/java/android/ddm/DdmHandleHeap.java +7 −11 Original line number Diff line number Diff line Loading @@ -16,21 +16,18 @@ package android.ddm; import android.util.Log; import org.apache.harmony.dalvik.ddmc.Chunk; import org.apache.harmony.dalvik.ddmc.ChunkHandler; import org.apache.harmony.dalvik.ddmc.DdmServer; import org.apache.harmony.dalvik.ddmc.DdmVmInternal; import android.os.Debug; import android.util.Log; import java.io.IOException; import java.nio.ByteBuffer; /** * Handle native and virtual heap requests. */ public class DdmHandleHeap extends ChunkHandler { public class DdmHandleHeap extends DdmHandle { public static final int CHUNK_HPGC = type("HPGC"); public static final int CHUNK_HPGC = ChunkHandler.type("HPGC"); private static DdmHandleHeap mInstance = new DdmHandleHeap(); Loading @@ -49,13 +46,13 @@ public class DdmHandleHeap extends ChunkHandler { * Called when the DDM server connects. The handler is allowed to * send messages to the server. */ public void connected() {} public void onConnected() {} /** * Called when the DDM server disconnects. Can be used to disable * periodic transmissions or clean up saved state. */ public void disconnected() {} public void onDisconnected() {} /** * Handle a chunk of data. Loading @@ -68,8 +65,7 @@ public class DdmHandleHeap extends ChunkHandler { if (type == CHUNK_HPGC) { return handleHPGC(request); } else { throw new RuntimeException("Unknown packet " + ChunkHandler.name(type)); throw new RuntimeException("Unknown packet " + name(type)); } } Loading Loading
core/java/android/app/ActivityThread.java +1 −1 Original line number Diff line number Diff line Loading @@ -6381,7 +6381,7 @@ public final class ActivityThread extends ClientTransactionHandler { VMDebug.setAllocTrackerStackDepth(Integer.parseInt(property)); } if (data.trackAllocation) { DdmVmInternal.enableRecentAllocations(true); DdmVmInternal.setRecentAllocationsTrackingEnabled(true); } // Note when this process has started. Process.setStartTimes(SystemClock.elapsedRealtime(), SystemClock.uptimeMillis()); Loading
core/java/android/ddm/DdmHandle.java 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.ddm; import org.apache.harmony.dalvik.ddmc.ChunkHandler; import java.nio.ByteBuffer; /** * Contains utility methods for chunk serialization and deserialization. */ public abstract class DdmHandle extends ChunkHandler { /** * Utility function to copy a String out of a ByteBuffer. * * This is here because multiple chunk handlers can make use of it, * and there's nowhere better to put it. */ public static String getString(ByteBuffer buf, int len) { char[] data = new char[len]; for (int i = 0; i < len; i++) { data[i] = buf.getChar(); } return new String(data); } /** * Utility function to copy a String into a ByteBuffer. */ public static void putString(ByteBuffer buf, String str) { int len = str.length(); for (int i = 0; i < len; i++) { buf.putChar(str.charAt(i)); } } }
core/java/android/ddm/DdmHandleAppName.java +4 −4 Original line number Diff line number Diff line Loading @@ -30,9 +30,9 @@ import java.nio.ByteBuffer; /** * Track our app name. We don't (currently) handle any inbound packets. */ public class DdmHandleAppName extends ChunkHandler { public class DdmHandleAppName extends DdmHandle { public static final int CHUNK_APNM = type("APNM"); public static final int CHUNK_APNM = ChunkHandler.type("APNM"); private static volatile Names sNames = new Names("", ""); Loading @@ -51,13 +51,13 @@ public class DdmHandleAppName extends ChunkHandler { * Called when the DDM server connects. The handler is allowed to * send messages to the server. */ public void connected() {} public void onConnected() {} /** * Called when the DDM server disconnects. Can be used to disable * periodic transmissions or clean up saved state. */ public void disconnected() {} public void onDisconnected() {} /** * Handle a chunk of data. Loading
core/java/android/ddm/DdmHandleExit.java +7 −5 Original line number Diff line number Diff line Loading @@ -16,18 +16,20 @@ package android.ddm; import android.util.Log; import org.apache.harmony.dalvik.ddmc.Chunk; import org.apache.harmony.dalvik.ddmc.ChunkHandler; import org.apache.harmony.dalvik.ddmc.DdmServer; import android.util.Log; import java.nio.ByteBuffer; /** * Handle an EXIT chunk. */ public class DdmHandleExit extends ChunkHandler { public class DdmHandleExit extends DdmHandle { public static final int CHUNK_EXIT = type("EXIT"); public static final int CHUNK_EXIT = ChunkHandler.type("EXIT"); private static DdmHandleExit mInstance = new DdmHandleExit(); Loading @@ -46,13 +48,13 @@ public class DdmHandleExit extends ChunkHandler { * Called when the DDM server connects. The handler is allowed to * send messages to the server. */ public void connected() {} public void onConnected() {} /** * Called when the DDM server disconnects. Can be used to disable * periodic transmissions or clean up saved state. */ public void disconnected() {} public void onDisconnected() {} /** * Handle a chunk of data. We're only registered for "EXIT". Loading
core/java/android/ddm/DdmHandleHeap.java +7 −11 Original line number Diff line number Diff line Loading @@ -16,21 +16,18 @@ package android.ddm; import android.util.Log; import org.apache.harmony.dalvik.ddmc.Chunk; import org.apache.harmony.dalvik.ddmc.ChunkHandler; import org.apache.harmony.dalvik.ddmc.DdmServer; import org.apache.harmony.dalvik.ddmc.DdmVmInternal; import android.os.Debug; import android.util.Log; import java.io.IOException; import java.nio.ByteBuffer; /** * Handle native and virtual heap requests. */ public class DdmHandleHeap extends ChunkHandler { public class DdmHandleHeap extends DdmHandle { public static final int CHUNK_HPGC = type("HPGC"); public static final int CHUNK_HPGC = ChunkHandler.type("HPGC"); private static DdmHandleHeap mInstance = new DdmHandleHeap(); Loading @@ -49,13 +46,13 @@ public class DdmHandleHeap extends ChunkHandler { * Called when the DDM server connects. The handler is allowed to * send messages to the server. */ public void connected() {} public void onConnected() {} /** * Called when the DDM server disconnects. Can be used to disable * periodic transmissions or clean up saved state. */ public void disconnected() {} public void onDisconnected() {} /** * Handle a chunk of data. Loading @@ -68,8 +65,7 @@ public class DdmHandleHeap extends ChunkHandler { if (type == CHUNK_HPGC) { return handleHPGC(request); } else { throw new RuntimeException("Unknown packet " + ChunkHandler.name(type)); throw new RuntimeException("Unknown packet " + name(type)); } } Loading