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 android.ddm; 18 19 import org.apache.harmony.dalvik.ddmc.DdmServer; 20 import android.util.Config; 21 import android.util.Log; 22 23 /** 24 * Just a place to stick handler registrations, instead of scattering 25 * them around. 26 */ 27 public class DdmRegister { 28 29 private DdmRegister() {} 30 31 /** 32 * Register handlers for all known chunk types. 33 * 34 * If you write a handler, add a registration call here. 35 * 36 * Note that this is invoked by the application (usually through a 37 * static initializer in the main class), not the VM. It's done this 38 * way so that the handlers can use Android classes with native calls 39 * that aren't registered until after the VM is initialized (e.g. 40 * logging). It also allows debugging of DDM handler initialization. 41 * 42 * The chunk dispatcher will pause until we call registrationComplete(), 43 * so that we don't have a race that causes us to drop packets before 44 * we finish here. 45 */ 46 public static void registerHandlers() { 47 if (Config.LOGV) 48 Log.v("ddm", "Registering DDM message handlers"); 49 DdmHandleHello.register(); 50 DdmHandleThread.register(); 51 DdmHandleHeap.register(); 52 DdmHandleNativeHeap.register(); 53 DdmHandleProfiling.register(); 54 DdmHandleExit.register(); 55 56 DdmServer.registrationComplete(); 57 } 58 } 59 60