script.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. # coding:utf8
  2. __author__ = '极无双'
  3. import os
  4. from xml.etree import ElementTree as ET
  5. def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
  6. fix_fake_recharge_screen_orientation_portrait(decompileDir)
  7. def fix_fake_recharge_screen_orientation_portrait(decompile_dir_path):
  8. namespace = '{http://schemas.android.com/apk/res/android}'
  9. ET._namespace_map['android'] = 'http://schemas.android.com/apk/res/android'
  10. manifest_path = os.path.join(decompile_dir_path, 'AndroidManifest.xml')
  11. xml_tree = ET.parse(manifest_path)
  12. xml_root = xml_tree.getroot()
  13. activity_nodes = xml_root.findall('.//activity')
  14. print activity_nodes
  15. for activity_node in activity_nodes:
  16. print activity_node.attrib
  17. activity_name = activity_node.get(namespace + 'name')
  18. print activity_name
  19. if 'com.cccolyun.sdkkit.gameplatform.paysdk.view.activity.CoolPaySDKActivity' == activity_name:
  20. activity_node.set(namespace + 'screenOrientation', 'portrait')
  21. xml_tree.write(manifest_path, encoding=u'utf-8', xml_declaration=True)
  22. break
  23. if __name__ == '__main__':
  24. ""