# Interface: com.pnfsoftware.jeb.core.units.code.android.IDexDecompilerUnit

Specialized interface representing Dex \(Dalvik\) decompiler Units.

## Static Field: propnameEmulatorConfigPath
Type: `java.lang.String`

Constant value: `EmulatorConfigPath`
Description: Unit property name for the emulator configuration path.

## Method: addSpecialComment
- parameter: `address`, type: `java.lang.String`
- parameter: `value`, type: `java.lang.String`

Description: Add a special comment to the decompiled output.
parameter: address: target address
parameter: value: comment value

## Method: applyCodeMatches
- return type: `int`

Description: Apply the currently un\-applied code matches. When applying matches, matched methods may be renamed, classes may be renamed and/or moved to existing or newly\-created packages. Related types may be renamed as well. 

 Note: if the `.CodeMatchSetting` unit property is set to 2 or above, this method is automatically called after [#decompileToUnit](#decompileToUnit).
return: a number indicating the number of modifications performed \(e.g. renames, moves, etc.\)

## Method: clearCachedIRs

Description: Forcefully clear the cache of IRs for decompiled methods.

## Method: clearCodeMatches

Description: Clear the map of currently un\-applied code matches.

## Method: clearSpecialComments
- parameter: `address`, type: `java.lang.String`

Description: Clear special comments at an address.
parameter: address: target address

## Method: createEmulatedAndroid
- return type: `com.pnfsoftware.jeb.core.units.code.android.IEmulatedAndroid`

Description: Create a limited environment to emulate dex code and native code. Currently, the emulated environment is a simple Arm 64\-bit \(aarch64\) Android 13 system \(API level 33\). This dex decompiler must be the descendant of an APK unit.
return: an emulated Android environment

## Method: createGenericUnpacker
- return type: `com.pnfsoftware.jeb.core.units.code.android.IGenericUnpacker`

Description: Create a generic unpacker, backed by an [emulated\-android](IEmulatedAndroid) object, that can be used to attempt to retrieve resources unpacked at runtime. This dex decompiler must be the descendant of an APK unit.
return: an emulated Android environment

## Method: formatOngoingDecompilations
- return type: `java.lang.String`

Description: Generate a user\-friendly text buffer of the decompilations currently being performed by this unit.
return: formatted ongoing decompilation information

## Method: getClass
- parameter: `csig`, type: `java.lang.String`
- parameter: `createIfNotExist`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaClass`

Description: Retrieve a previously decompiled AST class object or create an empty AST class element.
parameter: csig: class signature
parameter: createIfNotExist: true to create an empty element if none exists
return: the Java class, or null if none exists and creation was not requested

## Method: getCodeMatchingOverride
- return type: `java.lang.Boolean`

Description: Retrieve the code matching behavior override. Refer to [#setCodeMatchingOverride(Boolean)](#setCodeMatchingOverride(Boolean)) for details.
return: null if there is no override; else, a boolean value

## Method: getCodeUnit
- return type: `com.pnfsoftware.jeb.core.units.code.android.IDexUnit`


## Method: getCountOfCachedIRs
- return type: `int`

Description: Retrieve the number of cached IRs for decompiled methods.
return: the number of cached IRs

## Method: getDynamicContentManager
- return type: `com.pnfsoftware.jeb.core.units.code.java.IDynamicContentManager`

Description: Retrieve a DCR used during AST generation.
return: the dynamic content manager

## Method: getField
- parameter: `fsig`, type: `java.lang.String`
- parameter: `createIfNotExist`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaField`

Description: Retrieve a previously decompiled AST field object or create an empty AST field element.
parameter: fsig: field signature
parameter: createIfNotExist: true to create an empty element if none exists
return: the Java field, or null if none exists and creation was not requested

## Method: getGlobalDecompilationEvents
- return type: `java.util.Collection<com.pnfsoftware.jeb.core.units.code.android.DexDecompilerEvent<?>>`

Description: Retrieve the list decompilation events, without duplicates. Note that this queue is managed separately than [user\-controlled event queues](#registerEventQueue(DexDecompilerEventQueue)).
return: the global decompilation events

## Method: getGlobalDecompilationEvents
- parameter: `keepDuplicates`, type: `boolean`
- return type: `java.util.Collection<com.pnfsoftware.jeb.core.units.code.android.DexDecompilerEvent<?>>`

Description: Retrieve a copy of the decompilation events. Note that this queue is managed separately than [user\-controlled event queues](#registerEventQueue(DexDecompilerEventQueue)).
parameter: keepDuplicates: if true, duplicate events will be present in the returned collection
return: the global decompilation events

## Method: getHighLevelContext
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaGlobalContext`

Description: Retrieve the global AST context.
return: the global AST context

## Method: getIdentifierName
- parameter: `ident`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaIdentifier`
- return type: `java.lang.String`

Description: Retrieve the effective \(renamed\) name of an identifier in this method's AST.
parameter: ident: identifier
return: the effective name

## Method: getIntermediateContext
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDGlobalContext`

Description: Retrieve the global IR context.
return: the global IR context

## Method: getMethod
- parameter: `msig`, type: `java.lang.String`
- parameter: `createIfNotExist`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaMethod`

Description: Retrieve a previously decompiled AST method object or create an empty AST method element.
parameter: msig: method signature
parameter: createIfNotExist: true to create an empty element if none exists
return: the Java method, or null if none exists and creation was not requested

## Method: getUnappliedCodeMatches
- return type: `java.util.Map<java.lang.String,com.pnfsoftware.jeb.core.units.code.MethodMatch>`

Description: Retrieve the currently un\-applied code matches.
return: a map of original internal method signature to its current best code match

## Method: recordDecompilationEvent
- parameter: `event`, type: `com.pnfsoftware.jeb.core.units.code.android.DexDecompilerEvent<?>`

Description: Record a decompilation event.
parameter: event: event to record

## Method: registerEventQueue
- parameter: `queue`, type: `com.pnfsoftware.jeb.core.units.code.android.DexDecompilerEventQueue`

Description: Register a user\-controlled event queue that will receive decompilation events.
parameter: queue: event queue to register

## Method: resetClassElement
- parameter: `c`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaClass`
- return type: `boolean`

Description: Remove an AST class object.
parameter: c: class to reset
return: success indicator

## Method: resetDecompilation
- parameter: `identifier`, type: `java.lang.String`

Description: Remove a decompiled object \(i.e., same as [#removeDecompilation(String)](#removeDecompilation(String)).\) For a dex decompiler, reset and removal actions are equivalent.

## Method: resetFieldElement
- parameter: `f`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaField`
- return type: `boolean`

Description: Remove an AST field object.
parameter: f: field to reset
return: success indicator

## Method: resetGlobalDecompilationEvents

Description: Reset the global decompilation events list. This operation is not reversible.

## Method: resetMethodElement
- parameter: `m`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaMethod`
- return type: `boolean`

Description: Remove an AST method object.
parameter: m: method to reset
return: success indicator

## Method: retrieveCachedIR
- parameter: `msig`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`

Description: Attempt to retrieve the *Intermediate Representation* \(IR\) of a previously decompiled method.
parameter: msig: original method signature \(internal format, e.g.            `Lcom/xyz/Object;->foo(I)V`\)
return: an IR object or null if it was not found in the cache

## Method: retrieveCachedIRs
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext>`

Description: Retrieve all cached IRs available at this time.
return: a list of IR method contexts \(the list is a copy of the cache and may be modified         without affecting the cache\)

## Method: setCachePolicy
- parameter: `maxCount`, type: `int`
- parameter: `maxSeconds`, type: `int`

Description: 
deprecated: call [#setIRCachePolicy(int, int)](#setIRCachePolicy(int, int)) instead
parameter: maxCount: maximum number of entries in the cache
parameter: maxSeconds: timeout in seconds after the last access

## Method: setCodeMatchingOverride
- parameter: `enabled`, type: `java.lang.Boolean`
- return type: `java.lang.Boolean`

Description: Override the `.CodeMatchSetting` unit property. 

 Note: this flag does not override [#FLAG_ALLOW_EXTRA_WORK](#FLAG_ALLOW_EXTRA_WORK), which must a required condition to allow code matching
parameter: enabled: null to disable the override; true to force\-enable code matching; false to            force\-disable code matching
return: the previous setting for the override

## Method: setIRCachePolicy
- parameter: `maxCount`, type: `int`
- parameter: `maxSeconds`, type: `int`

Description: Set the policy for the cache of decompiled IRs. 

 Special calls:
 \- To store all IRs and disabled cache eviction, call with maxCount=\-1 and maxSeconds=\-1.
 \- To disabled IR storage entirely, call with maxCount=0 or maxSeconds=0.
parameter: maxCount: maximum number of entries in the cache \(\-1 means no cap, which is not            recommended; 0 can be used to disable caching entirely\)
parameter: maxSeconds: starting from the last access to an entry, this value is a timeout in            seconds after which the entry is auto\-removed from the cache \(\-1 means no            time\-based removal\)

## Method: setIdentifierName
- parameter: `msig`, type: `java.lang.String`
- parameter: `currentName`, type: `java.lang.String`
- parameter: `newName`, type: `java.lang.String`
- return type: `boolean`

Description: Rename an identifier by method signature and current name.
parameter: msig: method signature
parameter: currentName: current identifier name
parameter: newName: new identifier name
return: success indicator

## Method: setIdentifierName
- parameter: `ident`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaIdentifier`
- parameter: `name`, type: `java.lang.String`
- return type: `boolean`

Description: Rename an identifier.
parameter: ident: identifier to rename
parameter: name: new name
return: success indicator

## Method: setIdentifierName
- parameter: `ident`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaIdentifier`
- parameter: `name`, type: `java.lang.String`
- parameter: `failOnNameConflict`, type: `boolean`
- parameter: `notify`, type: `boolean`
- return type: `boolean`

Description: Rename an identifier.
parameter: ident: identifier to rename
parameter: name: new name
parameter: failOnNameConflict: true to fail if the name conflicts with another identifier
parameter: notify: true to notify listeners of the change
return: success indicator

## Method: unregisterEventQueue
- parameter: `queue`, type: `com.pnfsoftware.jeb.core.units.code.android.DexDecompilerEventQueue`

Description: Unregister a previously registered user\-controlled decompilation event queue.
parameter: queue: event queue to unregister

