# Path: smaliparser/utils.py
# KEY_PUBLIC = "public"
# KEY_PRIVATE = "private"
# KEY_PROTECTED = "protected"
# KEY_STATIC = "static"
# KEY_FINAL = "final"
# KEY_SYNTHETIC = "synthetic"
# KEY_ABSTRACT = "abstract"
# KEY_CONSTRUCTOR = "constructor"
# KEY_BRIDGE = "bridge"
# KEY_DECLARED_SYNCHRONIZED = "declared-synchronized"
# KEY_NATIVE = "native"
# KEY_SYNCHRONIZED = "synchronized"
# KEY_VARARGS = "varargs"
# KEY_ENUM = "enum"
# KEY_TRANSIENT = "transient"
# KEY_VOLATILE = "volatile"
# KEY_INTERFACE = "interface"
#     TAG = "smali-parser"
#     DEBUG = False
#     FAILED_LIST = []
#     SUCCESS_LIST = []
#     ADVICE = ""
#     SUCCESS = ""
# PRJ_ROOT = os.getcwd()
# REJECT = '%s/autopatch/reject' %(PRJ_ROOT)
# BOSP = '%s/autopatch/bosp' %(PRJ_ROOT)
# AOSP = '%s/autopatch/aosp' %(PRJ_ROOT)
# TARGET = "%s/out/obj/autofix/target" %(PRJ_ROOT)
# OUT_REJECT = '%s/autopatch/still-reject' %(PRJ_ROOT)
# SMALI_POST_SUFFIX = r'\.smali'
# PART_SMALI_POST_SUFFIX = r'\.smali\.part'
# SMALI_POST_SUFFIX_LEN = 6
#     CUR_ACTION = None
#     ATTENTION = None
#     ENABLE = True
# class SLog():
# class precheck():
# class annotation():
#     def e(s):
#     def w(s):
#     def d(s):
#     def i(s):
#     def fail(s):
#     def ok(s):
#     def conclude():
#     def setAdviceStr(str):
#     def setSuccessStr(str):
# def has(list, item):
# def isSmaliFile(smaliPath):
# def isPartSmaliFile(smaliPath):
# def getSmaliPathList(source, smaliDirMaxDepth = 0):
# def getPackageFromClass(className):
# def getSmaliDict(smaliDir, smaliDirMaxDepth = 0):
# def getJarNameFromPath(smaliPath):
# def getBaseSmaliPath(smaliPath):
# def getClassBaseNameFromPath(smaliPath):
# def getClassFromPath(smaliPath):
# def getReturnType(methodName):
# def getMatchFile(smaliFile, targetDir = BOSP):
# def getSimpleMethodName(methodName):
#     def getInstance():
#     def setInstance(nInstance):
#     def canAddField(field):
#     def shouldIgnore(smali):
#     def precheck(self, tSmali, bSmali, entry):
# def preCheck(tSmali, bSmali, entry):
#     def disable():
#     def enable():
#     def setAction(action):
#     def setAttention(attention):
#     def getAppendStr():
#     def getReplaceToBospPreContent(entry):
#     def getAddToBospPreContent(entry):


import commands
import shutil
import os, sys
import getopt
from name2num import NameToNumForOneFile
from num2name import NumToNameForOneFile
from idtoname import idtoname
from nametoid import nametoid
from smaliparser import utils
from smaliparser import SmaliLib
from smaliparser import Smali
                (commands.mkarg(smaliFile), commands.mkarg(linesPatch))
        commands.getstatusoutput(cmd)

        os.remove(linesPatch)
        origFile = smaliFile + ".orig"
        if os.path.exists(origFile): os.remove(origFile)

        return smaliFile

    @staticmethod
    def log(message):
        if Format.DEBUG: print message

    @staticmethod
    def __doJob__(f, job, action):
        if job == Format.DO:
            f.do(action)
        elif job == Format.UNDO_DO:
            f.undo()
        else:
            Format.log("Error Action %s" % action)

    @staticmethod
    def format(job, libPath, smaliFileList = None, action = ALL_ACTION):
        if smaliFileList is None:
            smaliFileList = utils.getSmaliPathList(libPath)

        idx = 0
        while idx < len(smaliFileList):
            if os.path.isdir(smaliFileList[idx]):

# Path: smaliparser/utils.py
# KEY_PUBLIC = "public"
# KEY_PRIVATE = "private"
# KEY_PROTECTED = "protected"
# KEY_STATIC = "static"
# KEY_FINAL = "final"
# KEY_SYNTHETIC = "synthetic"
# KEY_ABSTRACT = "abstract"
# KEY_CONSTRUCTOR = "constructor"
# KEY_BRIDGE = "bridge"
# KEY_DECLARED_SYNCHRONIZED = "declared-synchronized"
# KEY_NATIVE = "native"
# KEY_SYNCHRONIZED = "synchronized"
# KEY_VARARGS = "varargs"
# KEY_ENUM = "enum"
# KEY_TRANSIENT = "transient"
# KEY_VOLATILE = "volatile"
# KEY_INTERFACE = "interface"
#     TAG = "smali-parser"
#     DEBUG = False
#     FAILED_LIST = []
#     SUCCESS_LIST = []
#     ADVICE = ""
#     SUCCESS = ""
# PRJ_ROOT = os.getcwd()
# REJECT = '%s/autopatch/reject' %(PRJ_ROOT)
# BOSP = '%s/autopatch/bosp' %(PRJ_ROOT)
# AOSP = '%s/autopatch/aosp' %(PRJ_ROOT)
# TARGET = "%s/out/obj/autofix/target" %(PRJ_ROOT)
# OUT_REJECT = '%s/autopatch/still-reject' %(PRJ_ROOT)
# SMALI_POST_SUFFIX = r'\.smali'
# PART_SMALI_POST_SUFFIX = r'\.smali\.part'
# SMALI_POST_SUFFIX_LEN = 6
#     CUR_ACTION = None
#     ATTENTION = None
#     ENABLE = True
# class SLog():
# class precheck():
# class annotation():
#     def e(s):
#     def w(s):
#     def d(s):
#     def i(s):
#     def fail(s):
#     def ok(s):
#     def conclude():
#     def setAdviceStr(str):
#     def setSuccessStr(str):
# def has(list, item):
# def isSmaliFile(smaliPath):
# def isPartSmaliFile(smaliPath):
# def getSmaliPathList(source, smaliDirMaxDepth = 0):
# def getPackageFromClass(className):
# def getSmaliDict(smaliDir, smaliDirMaxDepth = 0):
# def getJarNameFromPath(smaliPath):
# def getBaseSmaliPath(smaliPath):
# def getClassBaseNameFromPath(smaliPath):
# def getClassFromPath(smaliPath):
# def getReturnType(methodName):
# def getMatchFile(smaliFile, targetDir = BOSP):
# def getSimpleMethodName(methodName):
#     def getInstance():
#     def setInstance(nInstance):
#     def canAddField(field):
#     def shouldIgnore(smali):
#     def precheck(self, tSmali, bSmali, entry):
# def preCheck(tSmali, bSmali, entry):
#     def disable():
#     def enable():
#     def setAction(action):
#     def setAttention(attention):
#     def getAppendStr():
#     def getReplaceToBospPreContent(entry):
#     def getAddToBospPreContent(entry):


# Path: formatters/format.py
import commands
import shutil
import os, sys
import getopt
from name2num import NameToNumForOneFile
from num2name import NumToNameForOneFile
from idtoname import idtoname
from nametoid import nametoid
from smaliparser import utils
from smaliparser import SmaliLib
from smaliparser import Smali

                (commands.mkarg(smaliFile), commands.mkarg(linesPatch))
        commands.getstatusoutput(cmd)

        os.remove(linesPatch)
        origFile = smaliFile + ".orig"
        if os.path.exists(origFile): os.remove(origFile)

        return smaliFile

    @staticmethod
    def log(message):
        if Format.DEBUG: print message

    @staticmethod
    def __doJob__(f, job, action):
        if job == Format.DO:
            f.do(action)
        elif job == Format.UNDO_DO:
            f.undo()
        else:
            Format.log("Error Action %s" % action)

    @staticmethod
    def format(job, libPath, smaliFileList = None, action = ALL_ACTION):
        if smaliFileList is None:
            smaliFileList = utils.getSmaliPathList(libPath)

        idx = 0
        while idx < len(smaliFileList):
            if os.path.isdir(smaliFileList[idx]):

                Format.format(job, libPath, utils.getSmaliPathList(libPath), action)