|
@@ -0,0 +1,1406 @@
|
|
|
+# -*-coding:utf-8-*-
|
|
|
+import os
|
|
|
+import xml.etree.ElementTree as ET
|
|
|
+import re
|
|
|
+
|
|
|
+import hashlib
|
|
|
+
|
|
|
+import shutil
|
|
|
+import json
|
|
|
+from V1.PrintLog import printlog
|
|
|
+from V1 import Contants, File, GeneralModifySmali, Replace, Aapt_Util, apk_utils
|
|
|
+from xml.etree.ElementTree import Element
|
|
|
+
|
|
|
+
|
|
|
+# 联想
|
|
|
+def LenovoReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "OPENAPPID"):
|
|
|
+ # 替换联想id
|
|
|
+ replaceLeonovoIdShell = 'sed -i "1,\\$s/lenovo_id/%s/g" %s/AndroidManifest.xml ' % (value, prj_path)
|
|
|
+ printlog("replaceLeonovoIdShell: %s" % replaceLeonovoIdShell)
|
|
|
+ os.system(replaceLeonovoIdShell)
|
|
|
+
|
|
|
+ manifestRootExt = r'<application android:networkSecurityConfig="@xml/network_security_config"'
|
|
|
+ replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
|
|
|
+ printlog("LenovoReplace replace add application root point shell: %s" % replacePkgNameShell)
|
|
|
+ os.system(replacePkgNameShell)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+# 豌豆荚
|
|
|
+def WandoujiaReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : wdj")
|
|
|
+ if (key == "APPKEY_ID"):
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ printlog("prj_am_path :%s" % prj_am_path)
|
|
|
+ lines = open(prj_am_path).readlines()
|
|
|
+ fp = open(prj_am_path, 'w')
|
|
|
+ for s in lines:
|
|
|
+ if (s.find("Wandoujia-PaySdk-") != -1):
|
|
|
+ printlog("replace Wandoujia-PaySdk-%s" % value)
|
|
|
+ s = re.sub('Wandoujia-PaySdk-.*\"', 'Wandoujia-PaySdk-' + value + '\"', s)
|
|
|
+ fp.write(s)
|
|
|
+ fp.close()
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+# 虫虫
|
|
|
+def ChongchongReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : Chongchong")
|
|
|
+ if (key == "app_id"):
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ printlog("prj_am_path :%s" % prj_am_path)
|
|
|
+ lines = open(prj_am_path).readlines()
|
|
|
+ fp = open(prj_am_path, 'w')
|
|
|
+ for s in lines:
|
|
|
+ if (s.find("qqPay") != -1):
|
|
|
+ printlog("replace qqPay:%s" % value)
|
|
|
+ s = re.sub('qqPay.*\"', 'qqPay' + value + '\"', s);
|
|
|
+ fp.write(s)
|
|
|
+ fp.close()
|
|
|
+
|
|
|
+ # 360
|
|
|
+
|
|
|
+
|
|
|
+def QihuReplace(prj_path, dir_split, key, value):
|
|
|
+ global appkey
|
|
|
+ printlog("specail replace : 360")
|
|
|
+ if (key == "QHOPENSDK_APPKEY"):
|
|
|
+ replacePkgNameShell = 'sed -i "s/qihu_appkey/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
|
|
|
+ printlog("QihuReplace replace qihu_appkey shell: %s" % replacePkgNameShell)
|
|
|
+ os.system(replacePkgNameShell)
|
|
|
+ if (key == "QHOPENSDK_APPSECRET"):
|
|
|
+ prj_param = "%s/assets/YyrhParam.cnf" % prj_path
|
|
|
+ prj_am_path = "%s/AndroidManifest.xml" % prj_path
|
|
|
+ appsecret = value
|
|
|
+ metadatas = ET.parse(prj_am_path).getroot().find("application").findall("meta-data")
|
|
|
+ for meta in metadatas:
|
|
|
+ if (meta.attrib["{http://schemas.android.com/apk/res/android}name"] == "QHOPENSDK_APPKEY"):
|
|
|
+ appkey = meta.attrib["{http://schemas.android.com/apk/res/android}value"]
|
|
|
+ printlog("prj_am_path:%s" % prj_am_path)
|
|
|
+
|
|
|
+ m = hashlib.md5()
|
|
|
+ printlog("appsecret :%s" % appsecret)
|
|
|
+ printlog("appkey: %s" % appkey)
|
|
|
+
|
|
|
+ md5value = "%s#%s" % (appsecret, appkey)
|
|
|
+ printlog("md5value :%s" % md5value)
|
|
|
+
|
|
|
+ m.update(md5value)
|
|
|
+ privatekey = m.hexdigest()
|
|
|
+ printlog("privatekey:%s" % privatekey)
|
|
|
+
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, 'QHOPENSDK_PRIVATEKEY', privatekey)
|
|
|
+
|
|
|
+ manifestRootExt = r'<application android:networkSecurityConfig="@xml/network_security_config"'
|
|
|
+ replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
|
|
|
+ printlog("qihu360 replace add application root point shell: %s" % replacePkgNameShell)
|
|
|
+ os.system(replacePkgNameShell)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def OppoReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : oppo")
|
|
|
+ if (key == "APPKEY"):
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ printlog("prj_am_path: %s" % prj_am_path)
|
|
|
+ # 替换app_key
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, 'app_key', value)
|
|
|
+ printlog("appkey: %s" % value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def OppoMlReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : oppoml")
|
|
|
+ if (key == "APPKEY"):
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ printlog("prj_am_path: %s" % prj_am_path)
|
|
|
+ # 替换app_key
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, 'app_key', value)
|
|
|
+ printlog("appkey: %s" % value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def downjoyReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : downjoy")
|
|
|
+ if (key == "APP_ID"):
|
|
|
+ splash_activity = "com.downjoy.activity.SdkLoadActivity"
|
|
|
+ prj_am_path = "%s/AndroidManifest.xml" % prj_path
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splash_activity, prj_am_path)
|
|
|
+ printlog(game_activity)
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, 'CP_ACTIVITY', game_activity)
|
|
|
+ lines = open(prj_am_path).readlines()
|
|
|
+ fp = open(prj_am_path, 'w')
|
|
|
+ for s in lines:
|
|
|
+ if (s.find("dcnngsdk") != -1):
|
|
|
+ printlog("replace dcnngsdk:%s" % value)
|
|
|
+ s = re.sub('dcnngsdk.*\"', 'dcnngsdk' + value + '\"', s)
|
|
|
+ fp.write(s)
|
|
|
+ fp.close()
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def YYBReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "QQ_APP_ID"):
|
|
|
+ # 替换qq app id
|
|
|
+ replaceQQAPPIDShell = 'sed -i "s/qq_app_id/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
|
|
|
+ printlog("yingyongbao qq app id shell: %s" % replaceQQAPPIDShell)
|
|
|
+ os.system(replaceQQAPPIDShell)
|
|
|
+
|
|
|
+ # 替换ysdkconf.ini
|
|
|
+ printlog("path ysdkconfig.ini:%s/assets/ysdkconf.ini" % prj_path)
|
|
|
+ Replace.replaceAssets_Param("%s/assets/ysdkconf.ini" % prj_path, key, value)
|
|
|
+ Replace.replaceAssets_Param("%s/assets/ysdkconf.ini" % prj_path, "OFFER_ID", value)
|
|
|
+
|
|
|
+ prj_am_path = "%s/AndroidManifest.xml" % prj_path
|
|
|
+ game_activity = Replace.getLauchActivityName(prj_path)
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, 'MAIN_ACTIVITY', game_activity)
|
|
|
+
|
|
|
+ if (key == "WX_APP_ID"):
|
|
|
+ replaceWXAPPIDShell = 'sed -i "s/wx_app_id/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
|
|
|
+ printlog("yingyongbao wx app id shell: %s" % replaceWXAPPIDShell)
|
|
|
+ os.system(replaceWXAPPIDShell)
|
|
|
+
|
|
|
+ # 替换ysdkconf.ini
|
|
|
+ Replace.replaceAssets_Param("%s/assets/ysdkconf.ini" % prj_path, key, value)
|
|
|
+ if (key == "IS_SAND_BOX"):
|
|
|
+ ysdk_sand_url = "https://ysdktest.qq.com"
|
|
|
+ ysdk_online_url = "https://ysdk.qq.com"
|
|
|
+ if value == "1":
|
|
|
+ ysdk_url = ysdk_sand_url
|
|
|
+ else:
|
|
|
+ ysdk_url = ysdk_online_url
|
|
|
+ Replace.replaceAssets_Param("%s/assets/ysdkconf.ini" % prj_path, "YSDK_URL", ysdk_url)
|
|
|
+
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def HuaweiReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "APP_ID"):
|
|
|
+ replaceAppidShell = '/bin/sed -i "s/APP_ID/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
|
|
|
+ printlog("huawei replace appid shell: %s" % replaceAppidShell)
|
|
|
+ os.system(replaceAppidShell)
|
|
|
+ if (key == "PAY_ID"):
|
|
|
+ replacePayidShell = '/bin/sed -i "s/PAY_ID/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
|
|
|
+ printlog("huawei replace payid shell: %s" % replacePayidShell)
|
|
|
+ os.system(replacePayidShell)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def AnzhiReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : anzhi")
|
|
|
+ prj_am_path = "%s/AndroidManifest.xml" % prj_path
|
|
|
+ pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
|
|
|
+ if (key == "APP_KEY"):
|
|
|
+ lines = open(prj_am_path).readlines()
|
|
|
+ fp = open(prj_am_path, 'w')
|
|
|
+ for s in lines:
|
|
|
+ if (s.find("packagename") != -1):
|
|
|
+ s = re.sub('packagename', pkgName, s);
|
|
|
+ fp.write(s)
|
|
|
+ fp.close()
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def GuopanReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : guopan")
|
|
|
+ prj_am_path = "%s/AndroidManifest.xml" % prj_path
|
|
|
+ pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
|
|
|
+ if (key == "APP_ID"):
|
|
|
+ lines = open(prj_am_path).readlines()
|
|
|
+ fp = open(prj_am_path, 'w')
|
|
|
+ for s in lines:
|
|
|
+ if (s.find("gp_packagename") != -1):
|
|
|
+ s = re.sub('gp_packagename', pkgName + ".StubContentProvider", s);
|
|
|
+ fp.write(s)
|
|
|
+ fp.close()
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def LeshiReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : leshi")
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ if (key == "LEPAY_APPID"):
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, 'lepay_appid', value)
|
|
|
+ if (key == "LEPAY_APPKEY"):
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, 'lepay_appkey', value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def QuickReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : Quick")
|
|
|
+
|
|
|
+ if (key == "PRODUCT_CODE"):
|
|
|
+ splashactivity = "com.yythird.sdk.SplashActivity"
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ prj_param = "%s/assets/YyrhParam.cnf" % prj_path
|
|
|
+
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
|
|
|
+ printlog("GAMEACTIVITY :%s" % game_activity)
|
|
|
+ Replace.replaceAssets_Param(prj_param, "GAMEACTIVITY", game_activity)
|
|
|
+
|
|
|
+ if (key == "SDK_TYPE"):
|
|
|
+ printlog("merge qitian Smali")
|
|
|
+ if value == "qitian":
|
|
|
+ printlog("merge qitian Smali")
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ ret = 0
|
|
|
+ ret = ret | File.mergeDir("%s/quick/quick/qitian_smali" % sdk_root_dir, "%s/smali" % prj_path)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def LjsdkReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : LjsdkReplace")
|
|
|
+
|
|
|
+ if (key == "XMGAME_PRODUCT_CODE"):
|
|
|
+
|
|
|
+ prj_param = "%s/assets/param.cnf" % prj_path
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ splashactivity = "third.sdk.SplashActivity"
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
|
|
|
+ printlog("GAMEACTIVITY :%s" % game_activity)
|
|
|
+ Replace.replaceAssets_Param(prj_param, "GAMEACTIVITY", game_activity)
|
|
|
+
|
|
|
+ pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
|
|
|
+ pkgLine = 'package="' + pkgName + '"'
|
|
|
+ printlog("pkgValue :%s" % pkgLine)
|
|
|
+ addPkgLine = ' xmlns:tools="http://schemas.android.com/tools" '
|
|
|
+ addPerLine = ' tools:ignore="ProtectedPermissions" '
|
|
|
+ permissionName = 'android:name="android.permission.PACKAGE_USAGE_STATS"'
|
|
|
+
|
|
|
+ lines = open(prj_am_path).readlines()
|
|
|
+ fp = open(prj_am_path, 'w')
|
|
|
+ for s in lines:
|
|
|
+ if (s.find(pkgLine) != -1):
|
|
|
+ s = re.sub(pkgLine, pkgLine + addPkgLine, s);
|
|
|
+ printlog("pkgLine :%s" % s)
|
|
|
+ if (s.find(permissionName) != -1):
|
|
|
+ s = re.sub(permissionName, permissionName + addPerLine, s);
|
|
|
+ printlog("permissionName :%s" % s)
|
|
|
+ fp.write(s)
|
|
|
+ fp.close()
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def UcsdkReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : UcsdkReplace")
|
|
|
+ if (key == "GAME_ID"):
|
|
|
+ replaceGidShell = 'sed -i "s/GAME_ID/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
|
|
|
+ printlog("uc replace GAME_ID shell: %s" % replaceGidShell)
|
|
|
+ os.system(replaceGidShell)
|
|
|
+ # GeneralModifySmali.modifyLauchSmali(prj_path)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def XiaomisdkReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : XiaomisdkReplace")
|
|
|
+ if (key == "APP_ID"):
|
|
|
+ # 获取包名
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ Replace.modifyRfileSmaliPath("xiaomi", prj_path);
|
|
|
+
|
|
|
+ printlog(" xiaomi begin replace game package v4 smali -------------------------------")
|
|
|
+ pkgV4Path = "%s/smali/android/support/v4" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgV4Path)
|
|
|
+ sdkV4Path = "%s/xiaomi/xiaomi/smali/android/support/v4" % sdk_root_dir
|
|
|
+ printlog("sdkV4Path:%s" % sdkV4Path)
|
|
|
+ if os.path.exists(pkgV4Path):
|
|
|
+ File.copyAllFile(sdkV4Path, pkgV4Path)
|
|
|
+
|
|
|
+ pkgAnnotation = "%s/smali/android/support/annotation" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgAnnotation)
|
|
|
+ sdkAnnotation = "%s/xiaomi/xiaomi/smali/android/support/annotation" % sdk_root_dir
|
|
|
+ if os.path.exists(pkgAnnotation):
|
|
|
+ File.copyAllFile(sdkAnnotation, pkgAnnotation)
|
|
|
+
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+# 百度
|
|
|
+def BaiduReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : baidu")
|
|
|
+ if (key == "APP_ID"):
|
|
|
+ GeneralModifySmali.modifyLauchSmali(prj_path)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+# 圣本
|
|
|
+def ShengbensdkReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : ShengbensdkReplace")
|
|
|
+ if (key == "AGENT"):
|
|
|
+ jsonFilePath = prj_path + dir_split + "assets" + dir_split + "hnsb_config.json"
|
|
|
+ printlog("path hnsb_config.json :%s" % jsonFilePath)
|
|
|
+ with open(jsonFilePath, 'r') as fp:
|
|
|
+ jsonData = json.load(fp)
|
|
|
+ jsonData['sdk']["ver"] = value
|
|
|
+ newJsonData = jsonData
|
|
|
+ fp.close()
|
|
|
+ with open(jsonFilePath, 'w') as fp:
|
|
|
+ json.dump(newJsonData, fp)
|
|
|
+ fp.close()
|
|
|
+
|
|
|
+ if (key == "APP_ID"):
|
|
|
+ jsonFilePath = prj_path + dir_split + "assets" + dir_split + "hnsb_config.json"
|
|
|
+ with open(jsonFilePath, 'r') as fp:
|
|
|
+ jsonData = json.load(fp)
|
|
|
+ jsonData['sdk']["appid"] = value
|
|
|
+ newJsonData = jsonData
|
|
|
+ fp.close()
|
|
|
+ with open(jsonFilePath, 'w') as fp:
|
|
|
+ json.dump(newJsonData, fp)
|
|
|
+ fp.close()
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def JinkuosdkReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : JinkuosdkReplace")
|
|
|
+ printlog("path yy.properties :%s/assets/u8_developer_config.properties" % prj_path)
|
|
|
+ Replace.replaceAssets_Param("%s/assets/u8_developer_config.properties" % prj_path, key, value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def HdhdsdkReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : HdhdsdkReplace")
|
|
|
+ if (key == "APP_ID"):
|
|
|
+ GeneralModifySmali.modifyLauchSmali(prj_path)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def SamsungReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : SamsungReplace")
|
|
|
+ if (key == "APPV_KEY"):
|
|
|
+ ptKey = value[0:99]
|
|
|
+ pvData = value[99:len(value)]
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ printlog("prj_am_path: %s" % prj_am_path)
|
|
|
+ # 替换app_key
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, 'ptKey', ptKey)
|
|
|
+ prj_param = "%s/assets/YyrhParam.cnf" % prj_path
|
|
|
+ Replace.replaceAssets_Param(prj_param, "pvData", pvData)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def TTReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : TTReplace")
|
|
|
+ if (key == "GAME_ID"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/tt_game_sdk_opt.properties" % prj_path, "gameId", value)
|
|
|
+ if (key == "GAME_KEY"):
|
|
|
+ replaceKeyShell = 'sed -i "s/@WSX3edc/%s/g" %s/assets/TTGameSDKConfig.cfg' % (value, prj_path)
|
|
|
+ printlog("replaceMainLineShell:%s" % replaceKeyShell)
|
|
|
+ os.system(replaceKeyShell)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def YXFReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : YXFReplace")
|
|
|
+ if (key == "YGAPPID"):
|
|
|
+ replacePkgNameShell = '/bin/sed -i "1,\\$s/YXFAPPID/%s/g" %s/AndroidManifest.xml' % (value, prj_path)
|
|
|
+ printlog("replacePkgNameShell:%s" % replacePkgNameShell)
|
|
|
+ os.system(replacePkgNameShell)
|
|
|
+
|
|
|
+ manifestRootExt = r'<application android:usesCleartextTraffic="true"'
|
|
|
+ replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
|
|
|
+ printlog("youxiFan replace add application root point shell: %s" % replacePkgNameShell)
|
|
|
+ os.system(replacePkgNameShell)
|
|
|
+ if (key == "IS_SPLASH"):
|
|
|
+ if (value == "0"):
|
|
|
+ GeneralModifySmali.modifyYXFLauchSmali(prj_path)
|
|
|
+ if (key == "screenOrientation"):
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ if (value == "screenOrientation:0"):
|
|
|
+ splash = "%s/yxf/yxf/extension/sp_landscape.png" % sdk_root_dir
|
|
|
+ apkres = "%s/res/drawable/crash_screen.png" % prj_path
|
|
|
+ shutil.copy(splash, apkres)
|
|
|
+ if (value == "screenOrientation:1"):
|
|
|
+ splash = "%s/yxf/yxf/extension/sp_portrait.png" % sdk_root_dir
|
|
|
+ apkres = "%s/res/drawable/crash_screen.png" % prj_path
|
|
|
+ shutil.copy(splash, apkres)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def VivosdkReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : VivosdkReplace")
|
|
|
+ if (key == "APP_ID"):
|
|
|
+ printlog("path supplierconfig.json :%s/assets/supplierconfig.json" % prj_path)
|
|
|
+ replaceConfigShell = '/bin/sed -i "1,\\$s/APP_ID/%s/g" %s/assets/supplierconfig.json' % (value, prj_path)
|
|
|
+ printlog("replaceConfigShell APP_ID:%s" % replaceConfigShell)
|
|
|
+ os.system(replaceConfigShell)
|
|
|
+
|
|
|
+ jsonFilePath = prj_path + dir_split + "assets" + dir_split + "supplierconfig.json"
|
|
|
+ printlog("path supplierconfig.json :%s" % jsonFilePath)
|
|
|
+ with open(jsonFilePath, 'r') as fp:
|
|
|
+ jsonData = json.load(fp)
|
|
|
+ jsonData['supplier']["vivo"]["appid"] = value
|
|
|
+ newJsonData = jsonData
|
|
|
+ fp.close()
|
|
|
+ with open(jsonFilePath, 'w') as fp:
|
|
|
+ json.dump(newJsonData, fp)
|
|
|
+ fp.close()
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def XTsdkReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : Xiantu3011sdkReplace")
|
|
|
+ if (key == "GAME_ID"):
|
|
|
+ # 获取包名
|
|
|
+ Replace.modifyRfileSmaliPath("3011", prj_path);
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def DDTsdkReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : DDTsdkReplace")
|
|
|
+ if (key == "APP_ID"):
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ splashactivity = "com.ddtsdk.ui.activity.MHPerActivity"
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
|
|
|
+ printlog("GAMEACTIVITY :%s" % game_activity)
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, "mainAct", game_activity)
|
|
|
+ if (key == "agent"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/ddt.properties" % prj_path, key, value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def QiyuReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "APP_ID"):
|
|
|
+ manifestRootExt = r'<application android:usesCleartextTraffic="true"'
|
|
|
+ replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
|
|
|
+ printlog("QiyuReplace add application root point shell: %s" % replacePkgNameShell)
|
|
|
+ os.system(replacePkgNameShell)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def WankaReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "APPID"):
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ namespace = '{http://schemas.android.com/apk/res/android}'
|
|
|
+
|
|
|
+ manifestRootExt = r'<application xmlns:tools="http://schemas.android.com/tools" tools:replace="android:theme,android:name"'
|
|
|
+ replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
|
|
|
+ printlog("WankaReplace replace add application root point shell: %s" % replacePkgNameShell)
|
|
|
+ os.system(replacePkgNameShell)
|
|
|
+
|
|
|
+ tree = ET.parse(prj_am_path)
|
|
|
+
|
|
|
+ activitys = tree.getroot().find("application").findall("activity")
|
|
|
+ for activity in activitys:
|
|
|
+ filters = activity.findall('intent-filter')
|
|
|
+ for filter in filters:
|
|
|
+ categorys = filter.findall('category')
|
|
|
+ for category in categorys:
|
|
|
+ categoryname = category.attrib[namespace + "name"]
|
|
|
+ if (categoryname == "android.intent.category.LAUNCHER"):
|
|
|
+ element = Element('intent-filter')
|
|
|
+ el1 = Element('action android:name="android.intent.action.VIEW"')
|
|
|
+ el2 = Element('category android:name="android.intent.category.DEFAULT"')
|
|
|
+ el3 = Element('category android:name="android.intent.category.BROWSABLE"')
|
|
|
+ el4_value = 'data android:scheme="app%s"' % value
|
|
|
+ el4 = Element(el4_value)
|
|
|
+ element.append(el1)
|
|
|
+ element.append(el2)
|
|
|
+ element.append(el3)
|
|
|
+ element.append(el4)
|
|
|
+ activity.append(element)
|
|
|
+ activity.set(namespace + 'launchMode', "singleTask")
|
|
|
+ tree.write(prj_am_path, "UTF-8", xml_declaration=True, method='xml')
|
|
|
+
|
|
|
+ pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
|
|
|
+ Aapt_Util.createRFile(prj_path, False, pkgName)
|
|
|
+ sdkRpath = "android/support/v7/appcompat"
|
|
|
+ pkgRpath = pkgName.replace(".", "/")
|
|
|
+ sdkAbsoluteRpath = "%s/smali/%s" % (prj_path, sdkRpath)
|
|
|
+ pkgAbsoluteRpath = "%s/smali/%s" % (prj_path, pkgRpath)
|
|
|
+
|
|
|
+ Replace.createRFile2Sdk(pkgAbsoluteRpath, sdkAbsoluteRpath, pkgRpath, sdkRpath)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def DDDReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "channelId"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/dingdd.properties" % prj_path, 'channelId', value)
|
|
|
+ if (key == "adId"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/dingdd.properties" % prj_path, 'adId', value)
|
|
|
+ if (key == "adFlag"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/dingdd.properties" % prj_path, 'adFlag', value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def LZYXReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "ML_Channel"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/mlgame_developer_config.properties" % prj_path, 'ML_Channel', value)
|
|
|
+ if (key == "ML_APPKEY"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/mlgame_developer_config.properties" % prj_path, 'ML_APPKEY', value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def WSReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "HS_APPID"):
|
|
|
+ manifestRootExt = r'<application android:networkSecurityConfig="@xml/huosdk_network_security_config"'
|
|
|
+ replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
|
|
|
+ printlog("qihu360 replace add application root point shell: %s" % replacePkgNameShell)
|
|
|
+ os.system(replacePkgNameShell)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def XBReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "GID"):
|
|
|
+ printlog("path gameshaiApp.ini :%s/assets/gameshaiApp.ini" % prj_path)
|
|
|
+ Replace.replaceAssets_Param("%s/assets/gameshaiApp.ini" % prj_path, 'gid', value)
|
|
|
+ if (key == "PID"):
|
|
|
+ printlog("path gameshaiApp.ini :%s/assets/gameshaiApp.ini" % prj_path)
|
|
|
+ Replace.replaceAssets_Param("%s/assets/gameshaiApp.ini" % prj_path, 'pid', value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def YoudianReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "APPID"):
|
|
|
+ apkPkgDir = ET.parse("%s/AndroidManifest.xml" % prj_path).getroot().attrib["package"].replace(".", "/")
|
|
|
+ apkRfilePath = "%s/smali/%s" % (prj_path, apkPkgDir)
|
|
|
+
|
|
|
+ Replace.modifyRfileSmaliPath("youdian", prj_path);
|
|
|
+
|
|
|
+ publicXml = "%s/res/values/public.xml" % prj_path
|
|
|
+ sdk_jar_dir = apk_utils.getToolsJarHome()
|
|
|
+ jarPath = "%s/MergeSamli.jar" % sdk_jar_dir
|
|
|
+ javaMerCm = 'java -jar %s %s %s' % (jarPath, publicXml, apkRfilePath)
|
|
|
+ printlog("javaMerCm:%s" % javaMerCm)
|
|
|
+ os.system(javaMerCm)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def Xiao7Replace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "APPKEY"):
|
|
|
+ apkRfilePath = "%s/smali_classes2/com/smwl/smsdk" % prj_path
|
|
|
+ publicXml = "%s/res/values/public.xml" % prj_path
|
|
|
+ sdk_jar_dir = apk_utils.getToolsJarHome()
|
|
|
+ jarPath = "%s/MergeSamli.jar" % sdk_jar_dir
|
|
|
+ javaMerCm = 'java -jar %s %s %s' % (jarPath, publicXml, apkRfilePath)
|
|
|
+ printlog("javaMerCm:%s" % javaMerCm)
|
|
|
+ os.system(javaMerCm)
|
|
|
+
|
|
|
+ printlog(" Xiao7Replace begin replace game package v4 smali -------------------------------")
|
|
|
+
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ pkgV4Path = "%s/smali/android/support/v4" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgV4Path)
|
|
|
+ sdkV4Path = "%s/x7sy/x7sy/smali/android/support/v4" % sdk_root_dir
|
|
|
+ printlog("sdkV4Path:%s" % sdkV4Path)
|
|
|
+ if os.path.exists(pkgV4Path):
|
|
|
+ File.copyAllFile(sdkV4Path, pkgV4Path)
|
|
|
+
|
|
|
+ pkgName = ET.parse("%s/AndroidManifest.xml" % prj_path).getroot().attrib["package"]
|
|
|
+ Aapt_Util.createRFile(prj_path, False, pkgName)
|
|
|
+
|
|
|
+ pkgName = "android.support.constraint"
|
|
|
+ Aapt_Util.createRFile(prj_path, False, pkgName)
|
|
|
+
|
|
|
+
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ prj_param = "%s/assets/YyrhParam.cnf" % prj_path
|
|
|
+
|
|
|
+ splashactivity = "com.yythird.sdk.SplashActivity"
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
|
|
|
+ Replace.replaceAssets_Param(prj_param, "GAME_ACTIVITY", game_activity)
|
|
|
+ printlog("xiaoqi GAME_ACTIVITY :%s" % game_activity)
|
|
|
+
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def NwanKaReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "channelId"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/wk.properties" % prj_path, 'channelId', value)
|
|
|
+ if (key == "adId"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/wk.properties" % prj_path, 'adId', value)
|
|
|
+ if (key == "adFlag"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/wk.properties" % prj_path, 'adFlag', value)
|
|
|
+
|
|
|
+ manifestRootExt = r'<application xmlns:tools="http://schemas.android.com/tools" tools:replace="android:theme,android:name"'
|
|
|
+ replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
|
|
|
+ printlog("WankaReplace replace add application root point shell: %s" % replacePkgNameShell)
|
|
|
+ os.system(replacePkgNameShell)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def MBaiduReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "APP_ID"):
|
|
|
+ manifestRootExt = r'<application android:networkSecurityConfig="@xml/network_security_config"'
|
|
|
+ replacePkgNameShell = "sed -i 's!<application!%s!g' %s/AndroidManifest.xml" % (manifestRootExt, prj_path)
|
|
|
+ printlog("MbaiduReplace replace add application root point shell: %s" % replacePkgNameShell)
|
|
|
+ os.system(replacePkgNameShell)
|
|
|
+
|
|
|
+ GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/com/baidu/passport/sapi2")
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def ShenshouReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "BALANCENAME"):
|
|
|
+ prj_style_path = prj_path + dir_split + "res/values-v28/styles.xml"
|
|
|
+ printlog("prj_style_path: %s" % prj_style_path)
|
|
|
+ File.safeFileDelete(prj_style_path)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def DaYanReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "GD"):
|
|
|
+ filepath = "%s/assets/sdkchannel.txt" % prj_path
|
|
|
+ replacePdShell = 'sed -i "s#%s#%s#g" %s' % ("PD", value, filepath)
|
|
|
+ printlog(replacePdShell)
|
|
|
+ os.system(replacePdShell)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def DaLanReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : DaLanReplace")
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+
|
|
|
+ if (key == "DL_APPID"):
|
|
|
+ splashactivity = "com.dalan.dl_assembly.SplashScreenActivity"
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
|
|
|
+ printlog("GAMEACTIVITY :%s" % game_activity)
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, "dalan_union_main_activity", game_activity)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def KSyxReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "kwai_app_id"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/allin_developer_config.properties" % prj_path, 'kwai_app_id', value)
|
|
|
+ printlog(" KSyxReplace begin replace game package v4 smali -------------------------------")
|
|
|
+
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ pkgV4Path = "%s/smali/android/support/v4" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgV4Path)
|
|
|
+
|
|
|
+ sdkV4Path = "%s/ksyx/ksyx/smali/android/support/v4" % sdk_root_dir
|
|
|
+ printlog("sdkV4Path:%s" % sdkV4Path)
|
|
|
+ if os.path.exists(pkgV4Path):
|
|
|
+ File.copyAllFile(sdkV4Path, pkgV4Path)
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ Replace.replaceAM_AllowBackup(prj_am_path)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def LlhyReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : LlhyReplace")
|
|
|
+ if (key == "LLHY_APP_ID"):
|
|
|
+ metaKey = "unityplayer.SkipPermissionsDialog"
|
|
|
+ Replace.replaceAM_Meta_data("%s/AndroidManifest.xml" % prj_path, metaKey,
|
|
|
+ "true")
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def HnqsReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : HnqsReplace")
|
|
|
+ if (key == "agent"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/jmhy.properties" % prj_path, 'agent', value)
|
|
|
+ metaKey = "unityplayer.SkipPermissionsDialog"
|
|
|
+ Replace.replaceAM_Meta_data("%s/AndroidManifest.xml" % prj_path, metaKey,
|
|
|
+ "true")
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ sdk_smali_dir = "%s/hnqs/hnqs/extension/yyrh" % sdk_root_dir
|
|
|
+ temp_old_smali_dir = "%s/smali/com/yyrh" % prj_path
|
|
|
+ if os.path.exists(sdk_smali_dir):
|
|
|
+ File.copyAllFile(sdk_smali_dir, temp_old_smali_dir)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def SogouReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "GID"):
|
|
|
+
|
|
|
+ printlog(" SogouReplace begin replace game package v4 smali -------------------------------")
|
|
|
+
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ pkgV4Path = "%s/smali/android/support/v4" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgV4Path)
|
|
|
+
|
|
|
+ sdkV4Path = "%s/sogou/sogou/smali/android/support/v4" % sdk_root_dir
|
|
|
+ printlog("sdkV4Path:%s" % sdkV4Path)
|
|
|
+ if os.path.exists(pkgV4Path):
|
|
|
+ File.copyAllFile(sdkV4Path, pkgV4Path)
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ Replace.replaceAM_AllowBackup(prj_am_path)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def JinRiTouTiaoReplace(prj_path, dir_split, key, value):
|
|
|
+ jsonFilePath = prj_path + dir_split + "assets" + dir_split + "config.json"
|
|
|
+ if key == 'APP_ID':
|
|
|
+ with open(jsonFilePath, 'r') as fp:
|
|
|
+ jsonData = json.load(fp)
|
|
|
+ jsonData['app']["app_id"] = value
|
|
|
+ jsonData['app']['main_activity'] = GeneralModifySmali.getLauchActivityName(prj_path)
|
|
|
+ orientation = GeneralModifySmali.getLauchActivityScreenOrientation(prj_path)
|
|
|
+ if orientation == "landscape" or orientation == "sensorLandscape":
|
|
|
+ screen_orientation = "sensorLandscape"
|
|
|
+ else:
|
|
|
+ screen_orientation = "sensorPortrait"
|
|
|
+
|
|
|
+ jsonData['app']['screen_orientation'] = screen_orientation
|
|
|
+ newJsonData = jsonData
|
|
|
+ fp.close()
|
|
|
+
|
|
|
+ with open(jsonFilePath, 'w') as fp:
|
|
|
+ json.dump(newJsonData, fp)
|
|
|
+ fp.close()
|
|
|
+
|
|
|
+ GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/game_sdk/packers/rocket_sdk")
|
|
|
+ GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali_classes2/game_sdk/packers/rocket_sdk")
|
|
|
+ GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/androidx/navigation/ui")
|
|
|
+ GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali_classes3/android/support/design")
|
|
|
+ GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali_classes3/android/support/v7/appcompat")
|
|
|
+
|
|
|
+ # GeneralModifySmali.replaceSdkV4Smali(prj_path,"jrtt/jrtt/smali/android/support/v4")
|
|
|
+
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ pkgV4Path = "%s/smali/android/support/v4" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgV4Path)
|
|
|
+
|
|
|
+ sdkV4Path = "%s/jrtt/jrtt/smali_classes3/android/support/v4" % sdk_root_dir
|
|
|
+ printlog("sdkV4Path:%s" % sdkV4Path)
|
|
|
+ if os.path.exists(pkgV4Path):
|
|
|
+ File.copyAllFile(sdkV4Path, pkgV4Path)
|
|
|
+
|
|
|
+ GeneralModifySmali.modifyJrttV7ResIdSmali(prj_path)
|
|
|
+ else:
|
|
|
+ Replace.replaceJsonValue(jsonFilePath, "app", key, value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def FengQiReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "channelId") or (key == "adId") or (key == "adFlag"):
|
|
|
+ # 替换fq.properties
|
|
|
+ printlog("path fq.properties:%s/assets/fq.properties" % prj_path)
|
|
|
+ Replace.replaceAssets_Param("%s/assets/fq.properties" % prj_path, key, value)
|
|
|
+ pass
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def BlueStackReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "APP_ID":
|
|
|
+ replaceBlueStackIdShell = 'sed -i "1,\\$s/APP_ID/%s/g" %s/assets/BSSDKConfig.xml ' % (value, prj_path)
|
|
|
+ printlog("replaceBlueStackIdShell: %s" % replaceBlueStackIdShell)
|
|
|
+ os.system(replaceBlueStackIdShell)
|
|
|
+
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+# 司墨
|
|
|
+def SiMoReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "APP_ID":
|
|
|
+ config_path = prj_path + '/assets/SIMgame_config.xml'
|
|
|
+ tree = ET.parse(config_path)
|
|
|
+ root = tree.getroot()
|
|
|
+ for elem in root.iter('appid'):
|
|
|
+ elem.text = value
|
|
|
+ tree.write(config_path, "UTF-8", xml_declaration=True, method='xml')
|
|
|
+
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+# 乘龙
|
|
|
+def ChenLongReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "CL_PID":
|
|
|
+ Replace.replaceAssets_Param("%s/assets/_cl_developer_config.properties" % prj_path, 'CL_PID', value)
|
|
|
+ if key == "CL_KEY":
|
|
|
+ Replace.replaceAssets_Param("%s/assets/_cl_developer_config.properties" % prj_path, 'CL_KEY', value)
|
|
|
+ if key == "CL_DEBUG_GD":
|
|
|
+ Replace.replaceAssets_Param("%s/assets/_cl_developer_config.properties" % prj_path, 'CL_DEBUG_GD', value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def JiuZiReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : JiuZiReplace")
|
|
|
+
|
|
|
+ if (key == "gid"):
|
|
|
+ prj_param = "%s/assets/YyrhParam.cnf" % prj_path
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ splash_activity = "com.yythird.sdk.SplashActivity"
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splash_activity, prj_am_path)
|
|
|
+ printlog("GAMEACTIVITY :%s" % game_activity)
|
|
|
+ Replace.replaceAssets_Param(prj_param, "GAMEACTIVITY", game_activity)
|
|
|
+
|
|
|
+ pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
|
|
|
+ Aapt_Util.createRFile(prj_path, False, pkgName)
|
|
|
+
|
|
|
+ apkRfilePath = "%s/smali/com/jzyx/sdk" % prj_path
|
|
|
+ printlog("apkRfilePath:%s" % apkRfilePath)
|
|
|
+ publicXml = "%s/res/values/public.xml" % prj_path
|
|
|
+ sdk_jar_dir = apk_utils.getToolsJarHome()
|
|
|
+ jarPath = "%s/MergeSamli.jar" % sdk_jar_dir
|
|
|
+ javaMerCm = 'java -jar %s %s %s' % (jarPath, publicXml, apkRfilePath)
|
|
|
+ printlog("javaMerCm:%s" % javaMerCm)
|
|
|
+ os.system(javaMerCm)
|
|
|
+
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def BingNiaoReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : DaLanReplace")
|
|
|
+
|
|
|
+ if (key == "YH_GAME_ID"):
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ splashactivity = "prj.iyinghun.platform.sdk.SplashScreenActivity"
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
|
|
|
+ printlog("GAMEACTIVITY :%s" % game_activity)
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, "prj.chameleon.intent.main", game_activity)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def BingChengReplace(prj_path, dir_split, key, value):
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ namespace = '{http://schemas.android.com/apk/res/android}'
|
|
|
+ ET.register_namespace('android', "http://schemas.android.com/apk/res/android")
|
|
|
+ if (key == "BC_GAME_ID"):
|
|
|
+ tree = ET.parse(prj_am_path)
|
|
|
+ pkgName = tree.getroot().attrib["package"]
|
|
|
+ activitys = tree.getroot().find("application").findall("activity")
|
|
|
+ for activity in activitys:
|
|
|
+ filters = activity.findall('intent-filter')
|
|
|
+ for filter in filters:
|
|
|
+ categorys = filter.findall('category')
|
|
|
+ for category in categorys:
|
|
|
+ categoryname = category.attrib[namespace + "name"]
|
|
|
+ if (categoryname == "android.intent.category.LAUNCHER"):
|
|
|
+ element = Element('intent-filter')
|
|
|
+ el1 = Element('action android:name="android.intent.action.VIEW"')
|
|
|
+ el2 = Element('category android:name="android.intent.category.DEFAULT"')
|
|
|
+ el3 = Element('category android:name="android.intent.category.BROWSABLE"')
|
|
|
+ el4_value = 'data android:host="%s" android:scheme="%s"' % (value, pkgName)
|
|
|
+ el4 = Element(el4_value)
|
|
|
+ element.append(el1)
|
|
|
+ element.append(el2)
|
|
|
+ element.append(el3)
|
|
|
+ element.append(el4)
|
|
|
+ activity.append(element)
|
|
|
+ tree.write(prj_am_path, "UTF-8", xml_declaration=True, method='xml')
|
|
|
+
|
|
|
+
|
|
|
+def SuixingHuYuReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "game_id"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/suixin/suixin_sdk.ini" % prj_path, key, value)
|
|
|
+ if (key == "pid"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/suixin/suixin_sdk.ini" % prj_path, key, value)
|
|
|
+ if (key == "is_land"):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/suixin/suixin_sdk.ini" % prj_path, key, value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def ShouQuReplace(prj_path, dir_split, key, value):
|
|
|
+ config_path = "%s/assets/sqsdk_config" % prj_path
|
|
|
+ with open(config_path, "r") as f:
|
|
|
+ content = f.read()
|
|
|
+ json_data = json.loads(content)
|
|
|
+ json_data[key] = value
|
|
|
+ with open(config_path, "w") as f:
|
|
|
+ f.write(json.dumps(json_data))
|
|
|
+
|
|
|
+ if key == "app_key":
|
|
|
+ manifest_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ param_cnf = "%s/assets/YyrhParam.cnf" % prj_path
|
|
|
+ splash_activity = "com.yythird.sdk.SplashActivity"
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splash_activity, manifest_path)
|
|
|
+ Replace.replaceAssets_Param(param_cnf, "GAMEACTIVITY", game_activity)
|
|
|
+ printlog("GAMEACTIVITY :%s" % game_activity)
|
|
|
+
|
|
|
+
|
|
|
+def HaiNanQiJingReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "PACKAGE_TAG":
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ sdkSmaliPath = "%s/hnqj/hnqj/smali/com" % sdk_root_dir
|
|
|
+ pkgSmaliPath = "%s/smali/com" % prj_path
|
|
|
+
|
|
|
+ printlog("sdkSmaliPath :%s" % sdkSmaliPath)
|
|
|
+ printlog("pkgSmaliPath :%s" % pkgSmaliPath)
|
|
|
+ if os.path.exists(pkgSmaliPath):
|
|
|
+ File.copyAllFile(sdkSmaliPath, pkgSmaliPath)
|
|
|
+ if Contants.isTestEnvironment():
|
|
|
+ key = "https://fxsy.qijinghao.com"
|
|
|
+ value = "http://testsdkapi.yyxxgame.com"
|
|
|
+ file = "%s/smali/com/yyrh/c/a.smali" % prj_path
|
|
|
+ Replace.replaceKeyword(key, value, file)
|
|
|
+
|
|
|
+ file = "%s/smali/com/yyrh/ui/a.smali" % prj_path
|
|
|
+ Replace.replaceKeyword(key, value, file)
|
|
|
+
|
|
|
+ file = "%s/smali/com/yyrh/a/d.smali" % prj_path
|
|
|
+ Replace.replaceKeyword(key, value, file)
|
|
|
+
|
|
|
+ file = "%s/smali/com/yyrh/sdk/SDKEntry.smali" % prj_path
|
|
|
+ Replace.replaceKeyword(key, value, file)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def HongGuoReplace(prj_path, dir_split, key, value):
|
|
|
+ config_path = "%s/assets/gameInfo.json" % prj_path
|
|
|
+ with open(config_path, "r") as f:
|
|
|
+ content = f.read()
|
|
|
+ json_data = json.loads(content)
|
|
|
+ json_data[key] = value
|
|
|
+ with open(config_path, "w") as f:
|
|
|
+ f.write(json.dumps(json_data))
|
|
|
+
|
|
|
+ if key == "game_id":
|
|
|
+ manifest_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ param_cnf = "%s/assets/YyrhParam.cnf" % prj_path
|
|
|
+ splash_activity = "com.yythird.sdk.SplashActivity"
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splash_activity, manifest_path)
|
|
|
+ Replace.replaceAssets_Param(param_cnf, "GAMEACTIVITY", game_activity)
|
|
|
+
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ printlog(" HongGuoReplace begin replace game package v4 smali -------------------------------")
|
|
|
+ pkgV4Path = "%s/smali/android/support/v4" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgV4Path)
|
|
|
+ sdkV4Path = "%s/hg/hg/smali/android/support/v4" % sdk_root_dir
|
|
|
+ printlog("sdkV4Path:%s" % sdkV4Path)
|
|
|
+ if os.path.exists(pkgV4Path):
|
|
|
+ File.copyAllFile(sdkV4Path, pkgV4Path)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def BaizeReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "APP_ID":
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ param_cnf = "%s/assets/YyrhParam.cnf" % prj_path
|
|
|
+ splashactivity = "com.yythird.sdk.SplashActivity"
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
|
|
|
+ printlog("GAMEACTIVITY :%s" % game_activity)
|
|
|
+ Replace.replaceAssets_Param(param_cnf, "GAMEACTIVITY", game_activity)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def YanXinReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "ProductCode":
|
|
|
+ Replace.modifyRfileSmaliPath("yx", prj_path)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def ZhangShangHuYuReplace(prj_path, dir_split, key, value):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/yy.properties" % prj_path, key, value)
|
|
|
+ if key == "channelId":
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ printlog(" ZhangShangHuYuReplace begin replace game package v4 smali -------------------------------")
|
|
|
+ pkgV4Path = "%s/smali/android/support/v7" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgV4Path)
|
|
|
+ sdkV4Path = "%s/zshy/zshy/smali/android/support/v7" % sdk_root_dir
|
|
|
+ printlog("sdkV4Path:%s" % sdkV4Path)
|
|
|
+ if os.path.exists(pkgV4Path):
|
|
|
+ File.copyAllFile(sdkV4Path, pkgV4Path)
|
|
|
+
|
|
|
+ GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/android/support/v7/cardview")
|
|
|
+
|
|
|
+ printlog(" HongGuoReplace begin replace game package v4 smali -------------------------------")
|
|
|
+ pkgV4Path = "%s/smali/android/support/v4" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgV4Path)
|
|
|
+ sdkV4Path = "%s/zshy/zshy/smali/android/support/v4" % sdk_root_dir
|
|
|
+ printlog("sdkV4Path:%s" % sdkV4Path)
|
|
|
+ if os.path.exists(pkgV4Path):
|
|
|
+ File.copyAllFile(sdkV4Path, pkgV4Path)
|
|
|
+
|
|
|
+ apkRfilePath = "%s/smali/com/zshy/zshysdk" % prj_path
|
|
|
+ printlog("apkRfilePath:%s" % apkRfilePath)
|
|
|
+ publicXml = "%s/res/values/public.xml" % prj_path
|
|
|
+ sdk_jar_dir = apk_utils.getToolsJarHome()
|
|
|
+ jarPath = "%s/MergeSamli.jar" % sdk_jar_dir
|
|
|
+ javaMerCm = 'java -jar %s %s %s' % (jarPath, publicXml, apkRfilePath)
|
|
|
+ printlog("javaMerCm:%s" % javaMerCm)
|
|
|
+ os.system(javaMerCm)
|
|
|
+
|
|
|
+ Replace.modifyRfileSmaliPath("zshy", prj_path);
|
|
|
+
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def XiYouWangReplace(prj_path, dir_split, key, value):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/xy_developer_config.properties" % prj_path, key, value)
|
|
|
+ if key == "XY_APP_ID":
|
|
|
+ splash_activity = "com.xiyou.sdk.XiYouSplashActivity"
|
|
|
+ manifest_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splash_activity, manifest_path)
|
|
|
+ Replace.replaceAM_Meta_data(manifest_path, 'XY_GAME_MAIN_ACTIVITY_NAME', game_activity)
|
|
|
+
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+
|
|
|
+ printlog(" xiyouwang begin replace game package v4 smali -------------------------------")
|
|
|
+ pkgV4Path = "%s/smali/android/support/v4" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgV4Path)
|
|
|
+ sdkV4Path = "%s/xiyou/xiyou/smali/android/support/v4" % sdk_root_dir
|
|
|
+ printlog("sdkV4Path:%s" % sdkV4Path)
|
|
|
+ if os.path.exists(pkgV4Path):
|
|
|
+ File.copyAllFile(sdkV4Path, pkgV4Path)
|
|
|
+ prj_am_path = "%s/AndroidManifest.xml" % prj_path
|
|
|
+ pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
|
|
|
+ Aapt_Util.createRFile(prj_path, False, pkgName)
|
|
|
+
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def XunLeiReplace(prj_path, dir_split, key, value):
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ namespace = '{http://schemas.android.com/apk/res/android}'
|
|
|
+ ET.register_namespace('android', "http://schemas.android.com/apk/res/android")
|
|
|
+ if (key == "schemeCallback"):
|
|
|
+ tree = ET.parse(prj_am_path)
|
|
|
+ activitys = tree.getroot().find("application").findall("activity")
|
|
|
+ for activity in activitys:
|
|
|
+ activityName = activity.attrib[namespace + "name"]
|
|
|
+ printlog("activityName:%s" % activityName)
|
|
|
+ if (activityName == "com.xovs.common.auth.processor.XLAuthBackActivity"):
|
|
|
+ filters = activity.findall('intent-filter')
|
|
|
+ for filter in filters:
|
|
|
+ datas = filter.findall('data')
|
|
|
+ for data in datas:
|
|
|
+ printlog("data:%s" % data)
|
|
|
+ data.set(namespace + "scheme", value)
|
|
|
+ tree.write(prj_am_path, "UTF-8", xml_declaration=True, method='xml')
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def CanLongReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "PRODUCT_CODE":
|
|
|
+ Replace.modifyRfileSmaliPath("canlong", prj_path);
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def ShangHaiXiYuanReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "PACKAGE_TAG":
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ sdkSmaliPath = "%s/shxy/shxy/smali/com/yyrh" % sdk_root_dir
|
|
|
+ pkgSmaliPath = "%s/smali/com/yyrh" % prj_path
|
|
|
+
|
|
|
+ printlog("sdkSmaliPath :%s" % sdkSmaliPath)
|
|
|
+ printlog("pkgSmaliPath :%s" % pkgSmaliPath)
|
|
|
+ if os.path.exists(pkgSmaliPath):
|
|
|
+ File.copyAllFile(sdkSmaliPath, pkgSmaliPath)
|
|
|
+ if Contants.isTestEnvironment():
|
|
|
+ key = "https://sdkapi.bklinok.com"
|
|
|
+ value = "http://testsdkapi.yyxxgame.com"
|
|
|
+ file = "%s/smali/com/yyrh/c/a.smali" % prj_path
|
|
|
+ Replace.replaceKeyword(key, value, file)
|
|
|
+ file = "%s/smali/com/yyrh/a/d.smali" % prj_path
|
|
|
+ Replace.replaceKeyword(key, value, file)
|
|
|
+ file = "%s/smali/com/yyrh/sdk/SDKEntry.smali" % prj_path
|
|
|
+ Replace.replaceKeyword(key, value, file)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def YuanYouRongHeReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "PACKAGE_TAG":
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ sdkSmaliPath = "%s/mixsdk/mixsdk/smali/com/yyrh" % sdk_root_dir
|
|
|
+ pkgSmaliPath = "%s/smali/com/yyrh" % prj_path
|
|
|
+
|
|
|
+ printlog("sdkSmaliPath :%s" % sdkSmaliPath)
|
|
|
+ printlog("pkgSmaliPath :%s" % pkgSmaliPath)
|
|
|
+ if os.path.exists(pkgSmaliPath):
|
|
|
+ File.copyAllFile(sdkSmaliPath, pkgSmaliPath)
|
|
|
+
|
|
|
+ sdkSmaliPath = "%s/mixsdk/mixsdk/smali/com/yythird/base" % sdk_root_dir
|
|
|
+ pkgSmaliPath = "%s/smali/com/yythird/base" % prj_path
|
|
|
+
|
|
|
+ printlog("sdkSmaliPath :%s" % sdkSmaliPath)
|
|
|
+ printlog("pkgSmaliPath :%s" % pkgSmaliPath)
|
|
|
+ if os.path.exists(pkgSmaliPath):
|
|
|
+ File.copyAllFile(sdkSmaliPath, pkgSmaliPath)
|
|
|
+
|
|
|
+ if Contants.isTestEnvironment():
|
|
|
+ key = "https://sdkapi.yyxxgame.com"
|
|
|
+ value = "http://testsdkapi.yyxxgame.com"
|
|
|
+ file = "%s/smali/com/yyrh/c/a.smali" % prj_path
|
|
|
+ Replace.replaceKeyword(key, value, file)
|
|
|
+ file = "%s/smali/com/yyrh/sdk/SDKEntry.smali" % prj_path
|
|
|
+ Replace.replaceKeyword(key, value, file)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def BaLeReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "CHANNEL_ID":
|
|
|
+ GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/com/sdk/douyou")
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def QiPaReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "Super_Game_ID":
|
|
|
+ splash_activity = "com.supersdk.application.MySplashActivity"
|
|
|
+ prj_am_path = "%s/AndroidManifest.xml" % prj_path
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splash_activity, prj_am_path)
|
|
|
+ tree = ET.parse(prj_am_path)
|
|
|
+
|
|
|
+ activitys = tree.getroot().find("application").findall("activity")
|
|
|
+ for activity in activitys:
|
|
|
+ namespace = '{http://schemas.android.com/apk/res/android}'
|
|
|
+ xml_activity_name = activity.attrib[namespace + "name"]
|
|
|
+ if xml_activity_name == game_activity:
|
|
|
+ filter = activity.find('intent-filter')
|
|
|
+ el1 = Element('action android:name="com.super.sdk.MAIN"')
|
|
|
+ filter.append(el1)
|
|
|
+ tree.write(prj_am_path, "UTF-8", xml_declaration=True, method='xml')
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def DouyinReplace(prj_path, dir_split, key, value):
|
|
|
+ jsonFilePath = prj_path + dir_split + "assets" + dir_split + "config.json"
|
|
|
+ if key == 'app_id':
|
|
|
+ with open(jsonFilePath, 'r') as fp:
|
|
|
+ jsonData = json.load(fp)
|
|
|
+ jsonData["app_id"] = value
|
|
|
+ jsonData['screen_orientation'] = GeneralModifySmali.getLauchActivityName(prj_path)
|
|
|
+ orientation = GeneralModifySmali.getLauchActivityScreenOrientation(prj_path)
|
|
|
+ if orientation == "landscape" or orientation == "sensorLandscape":
|
|
|
+ screen_orientation = "sensorLandscape"
|
|
|
+ else:
|
|
|
+ screen_orientation = "sensorPortrait"
|
|
|
+
|
|
|
+ jsonData['screen_orientation'] = screen_orientation
|
|
|
+ newJsonData = jsonData
|
|
|
+ fp.close()
|
|
|
+
|
|
|
+ with open(jsonFilePath, 'w') as fp:
|
|
|
+ json.dump(newJsonData, fp)
|
|
|
+ fp.close()
|
|
|
+
|
|
|
+ printlog(" douyin begin replace game package v4 smali -------------------------------")
|
|
|
+ pkgV4Path = "%s/smali/android/support/v4" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgV4Path)
|
|
|
+ File.del_file(pkgV4Path)
|
|
|
+
|
|
|
+ prj_am_path = "%s/AndroidManifest.xml" % prj_path
|
|
|
+ pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
|
|
|
+ Aapt_Util.createRFile(prj_path, False, pkgName)
|
|
|
+
|
|
|
+ sdkRpath = "android/support/v7/appcompat"
|
|
|
+ pkgRpath = pkgName.replace(".", "/")
|
|
|
+ sdkAbsoluteRpath = "%s/smali_classes3/%s" % (prj_path, sdkRpath)
|
|
|
+ pkgAbsoluteRpath = "%s/smali/%s" % (prj_path, pkgRpath)
|
|
|
+
|
|
|
+ Replace.createRFile2Sdk(pkgAbsoluteRpath, sdkAbsoluteRpath, pkgRpath, sdkRpath)
|
|
|
+
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def MoMoYuReplace(prj_path, dir_split, key, value):
|
|
|
+ xml_path = "%s/res/values/strings.xml" % prj_path
|
|
|
+ Replace.replaceXmlValue(xml_path, key, value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def QuxuanReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "app_id":
|
|
|
+ prj_am_path = "%s/AndroidManifest.xml" % prj_path
|
|
|
+ value = "Qdazzle_%s" % value
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, "CommonSDK_AppID", value)
|
|
|
+
|
|
|
+ GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/com/qdazzle/sdk")
|
|
|
+
|
|
|
+ if key == "app_key":
|
|
|
+ prj_am_path = "%s/AndroidManifest.xml" % prj_path
|
|
|
+ value = "Qdazzle_%s" % value
|
|
|
+ Replace.replaceAM_Meta_data(prj_am_path, "CommonSDK_AppKey", value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def MuMuReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "YOFUN_APP_ID":
|
|
|
+ printlog("specail replace : MuMuReplace")
|
|
|
+
|
|
|
+ splashactivity = "com.yythird.sdk.SplashActivity"
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ prj_param = "%s/assets/YyrhParam.cnf" % prj_path
|
|
|
+
|
|
|
+ game_activity = Replace.replaceGameActivityLaunchAttribute(splashactivity, prj_am_path)
|
|
|
+ printlog("GAMEACTIVITY :%s" % game_activity)
|
|
|
+ Replace.replaceAssets_Param(prj_param, "GAMEACTIVITY", game_activity)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def HeFengReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "ver":
|
|
|
+ printlog("specail replace : HeFengReplace")
|
|
|
+ printlog("path hf.properties :%s/assets/hf.properties" % prj_path)
|
|
|
+ Replace.replaceAssets_Param("%s/assets/hf.properties" % prj_path, "agent", value)
|
|
|
+
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def ShengBenFuliReplace(prj_path, dir_split, key, value):
|
|
|
+ if key == "appid":
|
|
|
+ printlog("specail replace : ShengBenFuliReplace")
|
|
|
+ splash_activity = "com.fysdk.activity.FyGuideActivity"
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+
|
|
|
+ namespace = '{http://schemas.android.com/apk/res/android}'
|
|
|
+ ET.register_namespace('android', "http://schemas.android.com/apk/res/android")
|
|
|
+ tree = ET.parse(prj_am_path)
|
|
|
+
|
|
|
+ activitys = tree.getroot().find("application").findall("activity")
|
|
|
+ for activity in activitys:
|
|
|
+ filters = activity.findall('intent-filter')
|
|
|
+ for filter in filters:
|
|
|
+ categorys = filter.findall('category')
|
|
|
+ actions = filter.findall('action')
|
|
|
+ for category in categorys:
|
|
|
+ category_name = category.attrib[namespace + "name"]
|
|
|
+ if category_name == "android.intent.category.LAUNCHER":
|
|
|
+ action_name = activity.attrib[namespace + "name"]
|
|
|
+ if action_name != splash_activity:
|
|
|
+ printlog("delete :%s" % category_name)
|
|
|
+ category.attrib[namespace + "name"] = "android.intent.category.DEFAULT"
|
|
|
+ printlog("LAUNCHER replace DEFAULT :%s" % category.attrib[namespace + "name"])
|
|
|
+ for action in actions:
|
|
|
+ action_name = action.attrib[namespace + "name"]
|
|
|
+ if action_name == "android.intent.action.MAIN":
|
|
|
+ printlog("delete :%s" % action_name)
|
|
|
+ action.attrib[namespace + "name"] = "game.MAIN"
|
|
|
+ tree.write(prj_am_path, "UTF-8", xml_declaration=True, method='xml')
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def MuXueReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : MuXueReplace")
|
|
|
+ Replace.replaceAssets_Param("%s/assets/gs.properties" % prj_path, key, value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def QiYouReplace(prj_path, dir_split, key, value):
|
|
|
+ if (key == "blgame_gameid"):
|
|
|
+ prj_am_path = prj_path + dir_split + "AndroidManifest.xml"
|
|
|
+ pkgName = ET.parse(prj_am_path).getroot().attrib["package"]
|
|
|
+
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ pkgV4Path = "%s/smali/android/support/design" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgV4Path)
|
|
|
+ sdkV4Path = "%s/7you/7you/smali/android/support/design" % sdk_root_dir
|
|
|
+ printlog("sdkV4Path:%s" % sdkV4Path)
|
|
|
+ if os.path.exists(pkgV4Path):
|
|
|
+ File.copyAllFile(sdkV4Path, pkgV4Path)
|
|
|
+
|
|
|
+ Aapt_Util.createRFile(prj_path, False, pkgName)
|
|
|
+ GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/android/support/v7/appcompat")
|
|
|
+ GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/android/support/design")
|
|
|
+ GeneralModifySmali.modifyRfileIdSmali(prj_path, "/smali/android/support/v7/cardview")
|
|
|
+
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def YueWanReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : YueWanReplace")
|
|
|
+ if (key == "J_GAME_ID"):
|
|
|
+ sdk_root_dir = apk_utils.getCutSdkRootHome()
|
|
|
+ printlog(" YueWanReplace begin replace game package v4 smali -------------------------------")
|
|
|
+ pkgV4Path = "%s/smali/android/support/v4" % prj_path
|
|
|
+ printlog("pkgV4Path:%s" % pkgV4Path)
|
|
|
+ sdkV4Path = "%s/yuewan/yuewan/smali/android/support/v4" % sdk_root_dir
|
|
|
+ printlog("sdkV4Path:%s" % sdkV4Path)
|
|
|
+ if os.path.exists(pkgV4Path):
|
|
|
+ File.copyAllFile(sdkV4Path, pkgV4Path)
|
|
|
+
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def ShengYueReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : ShengYueReplace")
|
|
|
+ jsonFilePath = prj_path + dir_split + "assets" + dir_split + "UUConfig.json"
|
|
|
+ Replace.replaceJsonValue(jsonFilePath, "", key, value)
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+def JiZhiHuiReplace(prj_path, dir_split, key, value):
|
|
|
+ printlog("specail replace : JiZhiHuiReplace")
|
|
|
+
|
|
|
+ config_path = "%s/assets/xggameinfo.txt" % prj_path
|
|
|
+ with open(config_path, "r") as f:
|
|
|
+ content = f.read()
|
|
|
+ json_data = json.loads(content)
|
|
|
+ json_data[key] = value
|
|
|
+ with open(config_path, "w") as f:
|
|
|
+ f.write(json.dumps(json_data))
|
|
|
+
|
|
|
+
|
|
|
+def JiMiReplace(prj_path, dir_split, key, value):
|
|
|
+ Replace.replaceAssets_Param("%s/assets/jmhy.properties" % prj_path, key, value)
|
|
|
+
|
|
|
+
|
|
|
+specialReplace = {
|
|
|
+ "lenovo": LenovoReplace,
|
|
|
+ "baidu": BaiduReplace,
|
|
|
+ "wandoujia": WandoujiaReplace,
|
|
|
+ "qh360": QihuReplace,
|
|
|
+ "oppo": OppoReplace,
|
|
|
+ "oppoml": OppoMlReplace,
|
|
|
+ "chongchong": ChongchongReplace,
|
|
|
+ "yingyongbao": YYBReplace,
|
|
|
+ "downjoy": downjoyReplace,
|
|
|
+ "huawei": HuaweiReplace,
|
|
|
+ "anzhi": AnzhiReplace,
|
|
|
+ "leshi": LeshiReplace,
|
|
|
+ "quick": QuickReplace,
|
|
|
+ "guopan": GuopanReplace,
|
|
|
+ "ljsdk": LjsdkReplace,
|
|
|
+ "uc": UcsdkReplace,
|
|
|
+ "xiaomi": XiaomisdkReplace,
|
|
|
+ "hnshengben": ShengbensdkReplace,
|
|
|
+ "jk": JinkuosdkReplace,
|
|
|
+ "hd": HdhdsdkReplace,
|
|
|
+ "samsung": SamsungReplace,
|
|
|
+ "ttyy": TTReplace,
|
|
|
+ "yxf": YXFReplace,
|
|
|
+ "vivo": VivosdkReplace,
|
|
|
+ "3011": XTsdkReplace,
|
|
|
+ "ddt": DDTsdkReplace,
|
|
|
+ "wanka": WankaReplace,
|
|
|
+ "ddd": DDDReplace,
|
|
|
+ "lzyx": LZYXReplace,
|
|
|
+ "ws": WSReplace,
|
|
|
+ "xb": XBReplace,
|
|
|
+ "youdian": YoudianReplace,
|
|
|
+ "x7sy": Xiao7Replace,
|
|
|
+ "nwanka": NwanKaReplace,
|
|
|
+ "mbaidu": MBaiduReplace,
|
|
|
+ "shenshou": ShenshouReplace,
|
|
|
+ "dyyx": DaYanReplace,
|
|
|
+ "dl": DaLanReplace,
|
|
|
+ "ksyx": KSyxReplace,
|
|
|
+ "llhy": LlhyReplace,
|
|
|
+ "hnqs": HnqsReplace,
|
|
|
+ "sogou": SogouReplace,
|
|
|
+ "jrtt": JinRiTouTiaoReplace,
|
|
|
+ "fq": FengQiReplace,
|
|
|
+ "bs": BlueStackReplace,
|
|
|
+ "simo": SiMoReplace,
|
|
|
+ "cl": ChenLongReplace,
|
|
|
+ "qianmian": JinRiTouTiaoReplace,
|
|
|
+ "jiuzi": JiuZiReplace,
|
|
|
+ "bingniao": BingNiaoReplace,
|
|
|
+ "bingcheng": BingChengReplace,
|
|
|
+ "sxhy": SuixingHuYuReplace,
|
|
|
+ "shouqu": ShouQuReplace,
|
|
|
+ "hnqj": HaiNanQiJingReplace,
|
|
|
+ "hg": HongGuoReplace,
|
|
|
+ "baize": BaizeReplace,
|
|
|
+ "yx": YanXinReplace,
|
|
|
+ "zshy": ZhangShangHuYuReplace,
|
|
|
+ "xiyou": XiYouWangReplace,
|
|
|
+ "xunlei": XunLeiReplace,
|
|
|
+ "canlong": CanLongReplace,
|
|
|
+ "shxy": ShangHaiXiYuanReplace,
|
|
|
+ "mixsdk": YuanYouRongHeReplace,
|
|
|
+ "bale": BaLeReplace,
|
|
|
+ "7pa": QiPaReplace,
|
|
|
+ "dymmy": MoMoYuReplace,
|
|
|
+ "dyly": DouyinReplace,
|
|
|
+ "qx": QuxuanReplace,
|
|
|
+ "wymumu": MuMuReplace,
|
|
|
+ "hf": HeFengReplace,
|
|
|
+ "sbfl": ShengBenFuliReplace,
|
|
|
+ "muxue": MuXueReplace,
|
|
|
+ "7you": QiYouReplace,
|
|
|
+ "yuewan": YueWanReplace,
|
|
|
+ "shengyue": ShengYueReplace,
|
|
|
+ "jzh": JiZhiHuiReplace,
|
|
|
+ "jmhy": JiMiReplace
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+def getSpecilReplace(sdk_name):
|
|
|
+ if sdk_name in specialReplace:
|
|
|
+ return specialReplace[sdk_name]
|
|
|
+ else:
|
|
|
+ return None
|
|
|
+ pass
|