• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2012, Google LLC
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google LLC nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 package com.android.tools.smali.dexlib2.dexbacked.raw;
32 
33 import javax.annotation.Nonnull;
34 
35 public class ItemType {
36     public static final int HEADER_ITEM = 0x0000;
37     public static final int STRING_ID_ITEM = 0x0001;
38     public static final int TYPE_ID_ITEM = 0x0002;
39     public static final int PROTO_ID_ITEM = 0x0003;
40     public static final int FIELD_ID_ITEM = 0x0004;
41     public static final int METHOD_ID_ITEM = 0x0005;
42     public static final int CLASS_DEF_ITEM = 0x0006;
43     public static final int CALL_SITE_ID_ITEM = 0x0007;
44     public static final int METHOD_HANDLE_ITEM = 0x0008;
45     public static final int MAP_LIST = 0x1000;
46     public static final int TYPE_LIST = 0x1001;
47     public static final int ANNOTATION_SET_REF_LIST = 0x1002;
48     public static final int ANNOTATION_SET_ITEM = 0x1003;
49     public static final int CLASS_DATA_ITEM = 0x2000;
50     public static final int CODE_ITEM = 0x2001;
51     public static final int STRING_DATA_ITEM = 0x2002;
52     public static final int DEBUG_INFO_ITEM = 0x2003;
53     public static final int ANNOTATION_ITEM = 0x2004;
54     public static final int ENCODED_ARRAY_ITEM = 0x2005;
55     public static final int ANNOTATION_DIRECTORY_ITEM = 0x2006;
56     public static final int HIDDENAPI_CLASS_DATA_ITEM = 0xF000;
57 
58     @Nonnull
getItemTypeName(int itemType)59     public static String getItemTypeName(int itemType) {
60         switch (itemType) {
61             case HEADER_ITEM: return "header_item";
62             case STRING_ID_ITEM: return "string_id_item";
63             case TYPE_ID_ITEM: return "type_id_item";
64             case PROTO_ID_ITEM: return "proto_id_item";
65             case FIELD_ID_ITEM: return "field_id_item";
66             case METHOD_ID_ITEM: return "method_id_item";
67             case CLASS_DEF_ITEM: return "class_def_item";
68             case CALL_SITE_ID_ITEM: return "call_site_id_item";
69             case METHOD_HANDLE_ITEM: return "method_handle_item";
70             case MAP_LIST: return "map_list";
71             case TYPE_LIST: return "type_list";
72             case ANNOTATION_SET_REF_LIST: return "annotation_set_ref_list";
73             case ANNOTATION_SET_ITEM: return "annotation_set_item";
74             case CLASS_DATA_ITEM: return "class_data_item";
75             case CODE_ITEM: return "code_item";
76             case STRING_DATA_ITEM: return "string_data_item";
77             case DEBUG_INFO_ITEM: return "debug_info_item";
78             case ANNOTATION_ITEM: return "annotation_item";
79             case ENCODED_ARRAY_ITEM: return "encoded_array_item";
80             case ANNOTATION_DIRECTORY_ITEM: return "annotation_directory_item";
81             case HIDDENAPI_CLASS_DATA_ITEM: return "hiddenapi_class_data_item";
82             default: return "unknown dex item type";
83         }
84     }
85 }
86