1 /* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.apache.harmony.dalvik.ddmc; 18 19 import static android.annotation.SystemApi.Client.MODULE_LIBRARIES; 20 21 import android.annotation.SystemApi; 22 import android.compat.annotation.UnsupportedAppUsage; 23 24 /** 25 * Declarations for some VM-internal DDM stuff. 26 * 27 * @hide 28 */ 29 @SystemApi(client = MODULE_LIBRARIES) 30 @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE) 31 public final class DdmVmInternal { 32 33 /* do not instantiate */ DdmVmInternal()34 private DdmVmInternal() {} 35 36 /** 37 * Enable thread notification. 38 * 39 * This is built into the VM, since that's where threads get managed. 40 * 41 * @param enabled {@code true} to enable thread notification; {@code false} to disable 42 * 43 * @hide 44 */ 45 @SystemApi(client = MODULE_LIBRARIES) 46 @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE) setThreadNotifyEnabled(boolean enabled)47 native public static void setThreadNotifyEnabled(boolean enabled); 48 49 /** 50 * Get status info for all threads. This is for the THST chunk. 51 * 52 * Returns a byte array with the THST data, or null if something 53 * went wrong. 54 * 55 * @hide 56 */ 57 @UnsupportedAppUsage getThreadStats()58 native public static byte[] getThreadStats(); 59 60 /** 61 * Get a stack trace for the specified thread ID. The ID can be found 62 * in the data from getThreadStats. 63 * * 64 * @hide 65 */ 66 @UnsupportedAppUsage getStackTraceById(int threadId)67 native public static StackTraceElement[] getStackTraceById(int threadId); 68 69 /** 70 * Enable or disable "recent allocation" tracking. 71 * 72 * @param enabled {@code true} to enable recent allocation tracking; {@code false} to disable 73 * 74 * @hide 75 */ 76 @SystemApi(client = MODULE_LIBRARIES) 77 @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE) setRecentAllocationsTrackingEnabled(boolean enabled)78 native public static void setRecentAllocationsTrackingEnabled(boolean enabled); 79 } 80