-
-
Save plucena24/04ba6e9bc19853788f5ccbed388a6c12 to your computer and use it in GitHub Desktop.
*update_transaction_codes.py* parses Android services source code to find out transaction codes and saves them in YAML format for later use. *transaction_codes.yaml* is an example of the resulting file. *service_call_test.py* shows how it can be used
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import sys | |
import time | |
import yaml | |
import subprocess | |
import re | |
import struct | |
ADB_PATH = '/android/platform-tools/adb' | |
YAML_FILE = 'transaction_codes.yaml' | |
SERVICE_NAMES = '''phone iphonesubinfo isub isms usb wifi window input input_method connectivity clipboard | |
package display hardware bluetooth_manager audio telecom user telephony.registry power sensorservice | |
activity mount notification imms device_policy lock_settings trust accessibility deviceidle account'''.split() | |
TRANSACTION_CODES = {svc:{} for svc in SERVICE_NAMES} | |
def load_TRANSACTION_CODES(): | |
global TRANSACTION_CODES, YAML_FILE | |
try: | |
with open(YAML_FILE, 'r') as f: | |
TRANSACTION_CODES = yaml.safe_load(f.read()) | |
except Exception as e: | |
pass | |
def adbdevices(): | |
global ADB_PATH | |
return set([device.split('\t')[0] for device in subprocess.check_output([ADB_PATH, 'devices']).splitlines() if device.endswith('\tdevice')]) | |
def adbshell(command): | |
global SERIAL, ADB_PATH | |
return subprocess.check_output([ADB_PATH, '-s', SERIAL, 'shell', command]).decode('utf-8').replace('\r\n', '\n').rstrip('\n') | |
def get_android_version(): | |
return str(adbshell('getprop ro.build.version.release')) | |
def build_service_call_command(svc, func, *args): | |
global VERSION, TRANSACTION_CODES | |
code = TRANSACTION_CODES.get(svc, {}).get(func.lower(), {}).get(VERSION, 0) | |
if code == 0: | |
raise Exception('Unknown service function!') | |
cmd = 'service call {} {}'.format(svc, code) | |
for arg in args: | |
if arg is None: | |
cmd += ' null' | |
elif isinstance(arg, int): | |
cmd += ' i32 {}'.format(arg) | |
elif isinstance(arg, (str, unicode)): | |
cmd += ' s16 "{}"'.format(arg) | |
return cmd | |
class Parcel(object): | |
def __init__(self, text): | |
if text.startswith('Result: Parcel(') and text.endswith('\')'): | |
self.data = ''.join([ struct.pack('<L', int(x, 16)) for x in re.findall('([0-9a-f]{8}) ', text)]) | |
self.resultcode = self.get_int(0) | |
else: | |
raise Exception('Unexpected input!') | |
def __nonzero__(self): | |
return self.resultcode == 0 | |
def __repr__(self): | |
return 'Parcel(\'{}\')'.format(self.data.encode('hex')) | |
def get_int(self, offset=4): | |
return int(struct.unpack('<L', buffer(self.data, offset, 4))[0]) | |
def get_utf16(self, offset=4): | |
return str(buffer(self.data, offset + 4, self.get_int(offset) * 2)).decode('utf-16') | |
load_TRANSACTION_CODES() | |
SERIAL = sorted(adbdevices())[0] | |
VERSION = get_android_version() | |
print 'rotation =', Parcel(adbshell(build_service_call_command('window', 'getrotation'))).get_int() | |
print 'IMEI =', Parcel(adbshell(build_service_call_command('iphonesubinfo', 'getdeviceid'))).get_utf16() | |
print 'isInteractive =', bool(Parcel(adbshell(build_service_call_command('power', 'isInteractive'))).get_int()) | |
print 'isDeviceLocked =', bool(Parcel(adbshell(build_service_call_command('trust', 'isDeviceLocked'))).get_int()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clipboard: | |
'#PACKAGE_NAME+/android-5.0.2_r1': android.content.IClipboard | |
'#PACKAGE_NAME+/android-5.1.0_r1': android.content.IClipboard | |
'#PACKAGE_URL+/android-5.0.2_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.0.2_r1/core/java/android/content/IClipboard.aidl | |
'#PACKAGE_URL+/android-5.1.0_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.1.0_r1/core/java/android/content/IClipboard.aidl | |
addprimaryclipchangedlistener: | |
5.0.2: 5 | |
'5.1': 5 | |
getprimaryclip: | |
5.0.2: 2 | |
'5.1': 2 | |
getprimaryclipdescription: | |
5.0.2: 3 | |
'5.1': 3 | |
hasclipboardtext: | |
5.0.2: 7 | |
'5.1': 7 | |
hasprimaryclip: | |
5.0.2: 4 | |
'5.1': 4 | |
removeprimaryclipchangedlistener: | |
5.0.2: 6 | |
'5.1': 6 | |
setprimaryclip: | |
5.0.2: 1 | |
'5.1': 1 | |
connectivity: | |
'#PACKAGE_NAME+/android-5.0.2_r1': android.net.IConnectivityManager | |
'#PACKAGE_NAME+/android-5.1.0_r1': android.net.IConnectivityManager | |
'#PACKAGE_URL+/android-5.0.2_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.0.2_r1/core/java/android/net/IConnectivityManager.aidl | |
'#PACKAGE_URL+/android-5.1.0_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.1.0_r1/core/java/android/net/IConnectivityManager.aidl | |
addvpnaddress: | |
5.0.2: 64 | |
'5.1': 62 | |
captiveportalcheckcompleted: | |
5.0.2: 44 | |
'5.1': 44 | |
checkmobileprovisioning: | |
5.0.2: 47 | |
'5.1': 47 | |
establishvpn: | |
5.0.2: 39 | |
'5.1': 39 | |
findconnectiontypeforiface: | |
5.0.2: 46 | |
'5.1': 46 | |
getactivelinkproperties: | |
5.0.2: 10 | |
'5.1': 11 | |
getactivelinkqualityinfo: | |
5.0.2: 51 | |
getactivenetworkinfo: | |
5.0.2: 1 | |
'5.1': 1 | |
getactivenetworkinfoforuid: | |
5.0.2: 2 | |
'5.1': 2 | |
getactivenetworkquotainfo: | |
5.0.2: 15 | |
'5.1': 16 | |
getalllinkqualityinfo: | |
5.0.2: 52 | |
getallnetworkinfo: | |
5.0.2: 5 | |
'5.1': 5 | |
getallnetworks: | |
5.0.2: 7 | |
'5.1': 7 | |
getallnetworkstate: | |
5.0.2: 14 | |
'5.1': 15 | |
getdefaultnetworkcapabilitiesforuser: | |
'5.1': 8 | |
getdefaultproxy: | |
'5.1': 35 | |
getglobalproxy: | |
5.0.2: 33 | |
'5.1': 33 | |
getlasttethererror: | |
5.0.2: 21 | |
'5.1': 21 | |
getlegacyvpninfo: | |
5.0.2: 42 | |
'5.1': 42 | |
getlinkproperties: | |
5.0.2: 12 | |
'5.1': 13 | |
getlinkpropertiesfortype: | |
5.0.2: 11 | |
'5.1': 12 | |
getlinkqualityinfo: | |
5.0.2: 50 | |
getmobileprovisioningurl: | |
5.0.2: 48 | |
'5.1': 48 | |
getmobileredirectedprovisioningurl: | |
5.0.2: 49 | |
'5.1': 49 | |
getnetworkcapabilities: | |
5.0.2: 13 | |
'5.1': 14 | |
getnetworkfortype: | |
5.0.2: 6 | |
'5.1': 6 | |
getnetworkinfo: | |
5.0.2: 3 | |
'5.1': 3 | |
getnetworkinfofornetwork: | |
5.0.2: 4 | |
'5.1': 4 | |
getprovisioningoractivenetworkinfo: | |
5.0.2: 8 | |
'5.1': 9 | |
getproxy: | |
5.0.2: 35 | |
getrestoredefaultnetworkdelay: | |
5.0.2: 63 | |
'5.1': 61 | |
gettetherablebluetoothregexs: | |
5.0.2: 29 | |
'5.1': 29 | |
gettetherableifaces: | |
5.0.2: 23 | |
'5.1': 23 | |
gettetherableusbregexs: | |
5.0.2: 27 | |
'5.1': 27 | |
gettetherablewifiregexs: | |
5.0.2: 28 | |
'5.1': 28 | |
gettethereddhcpranges: | |
5.0.2: 26 | |
'5.1': 26 | |
gettetheredifaces: | |
5.0.2: 24 | |
'5.1': 24 | |
gettetheringerroredifaces: | |
5.0.2: 25 | |
'5.1': 25 | |
getvpnconfig: | |
5.0.2: 40 | |
'5.1': 40 | |
isactivenetworkmetered: | |
5.0.2: 16 | |
'5.1': 17 | |
isnetworksupported: | |
5.0.2: 9 | |
'5.1': 10 | |
istetheringsupported: | |
5.0.2: 22 | |
'5.1': 22 | |
listenfornetwork: | |
5.0.2: 60 | |
'5.1': 58 | |
pendinglistenfornetwork: | |
5.0.2: 61 | |
'5.1': 59 | |
pendingrequestfornetwork: | |
5.0.2: 59 | |
'5.1': 56 | |
preparevpn: | |
5.0.2: 37 | |
'5.1': 37 | |
registernetworkagent: | |
5.0.2: 57 | |
'5.1': 54 | |
registernetworkfactory: | |
5.0.2: 55 | |
'5.1': 52 | |
releasenetworkrequest: | |
5.0.2: 62 | |
'5.1': 60 | |
releasependingnetworkrequest: | |
'5.1': 57 | |
removevpnaddress: | |
5.0.2: 65 | |
'5.1': 63 | |
reportbadnetwork: | |
5.0.2: 32 | |
'5.1': 32 | |
reportinetcondition: | |
5.0.2: 31 | |
'5.1': 31 | |
requestnetwork: | |
5.0.2: 58 | |
'5.1': 55 | |
requestroutetohostaddress: | |
5.0.2: 17 | |
'5.1': 18 | |
setairplanemode: | |
5.0.2: 54 | |
'5.1': 51 | |
setdatadependency: | |
5.0.2: 36 | |
'5.1': 36 | |
setglobalproxy: | |
5.0.2: 34 | |
'5.1': 34 | |
setpolicydataenable: | |
5.0.2: 18 | |
setprovisioningnotificationvisible: | |
5.0.2: 53 | |
'5.1': 50 | |
setunderlyingnetworksforvpn: | |
'5.1': 64 | |
setusbtethering: | |
5.0.2: 30 | |
'5.1': 30 | |
setvpnpackageauthorization: | |
5.0.2: 38 | |
'5.1': 38 | |
startlegacyvpn: | |
5.0.2: 41 | |
'5.1': 41 | |
supplymessenger: | |
5.0.2: 45 | |
'5.1': 45 | |
tether: | |
5.0.2: 19 | |
'5.1': 19 | |
unregisternetworkfactory: | |
5.0.2: 56 | |
'5.1': 53 | |
untether: | |
5.0.2: 20 | |
'5.1': 20 | |
updatelockdownvpn: | |
5.0.2: 43 | |
'5.1': 43 | |
input: | |
'#PACKAGE_NAME+/android-5.0.2_r1': android.hardware.input.IInputManager | |
'#PACKAGE_NAME+/android-5.1.0_r1': android.hardware.input.IInputManager | |
'#PACKAGE_URL+/android-5.0.2_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.0.2_r1/core/java/android/hardware/input/IInputManager.aidl | |
'#PACKAGE_URL+/android-5.1.0_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.1.0_r1/core/java/android/hardware/input/IInputManager.aidl | |
addkeyboardlayoutforinputdevice: | |
5.0.2: 13 | |
'5.1': 13 | |
cancelvibrate: | |
5.0.2: 17 | |
'5.1': 17 | |
getcurrentkeyboardlayoutforinputdevice: | |
5.0.2: 10 | |
'5.1': 10 | |
getinputdevice: | |
5.0.2: 1 | |
'5.1': 1 | |
getinputdeviceids: | |
5.0.2: 2 | |
'5.1': 2 | |
getkeyboardlayout: | |
5.0.2: 9 | |
'5.1': 9 | |
getkeyboardlayouts: | |
5.0.2: 8 | |
'5.1': 8 | |
getkeyboardlayoutsforinputdevice: | |
5.0.2: 12 | |
'5.1': 12 | |
gettouchcalibrationforinputdevice: | |
5.0.2: 6 | |
'5.1': 6 | |
haskeys: | |
5.0.2: 3 | |
'5.1': 3 | |
injectinputevent: | |
5.0.2: 5 | |
'5.1': 5 | |
registerinputdeviceschangedlistener: | |
5.0.2: 15 | |
'5.1': 15 | |
removekeyboardlayoutforinputdevice: | |
5.0.2: 14 | |
'5.1': 14 | |
setcurrentkeyboardlayoutforinputdevice: | |
5.0.2: 11 | |
'5.1': 11 | |
settouchcalibrationforinputdevice: | |
5.0.2: 7 | |
'5.1': 7 | |
trypointerspeed: | |
5.0.2: 4 | |
'5.1': 4 | |
vibrate: | |
5.0.2: 16 | |
'5.1': 16 | |
iphonesubinfo: | |
'#PACKAGE_NAME+/android-5.0.2_r1': com.android.internal.telephony.IPhoneSubInfo | |
'#PACKAGE_NAME+/android-5.1.0_r1': com.android.internal.telephony.IPhoneSubInfo | |
'#PACKAGE_URL+/android-5.0.2_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.0.2_r1/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl | |
'#PACKAGE_URL+/android-5.1.0_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.1.0_r1/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl | |
getcompletevoicemailnumber: | |
5.0.2: 19 | |
'5.1': 21 | |
getcompletevoicemailnumberforsubscriber: | |
5.0.2: 20 | |
'5.1': 22 | |
getdeviceid: | |
5.0.2: 1 | |
'5.1': 1 | |
getdeviceidforphone: | |
'5.1': 3 | |
getdeviceidforsubscriber: | |
5.0.2: 2 | |
getdevicesvn: | |
5.0.2: 4 | |
'5.1': 5 | |
getdevicesvnusingsubid: | |
'5.1': 6 | |
getgroupidlevel1: | |
5.0.2: 7 | |
'5.1': 9 | |
getgroupidlevel1forsubscriber: | |
5.0.2: 8 | |
'5.1': 10 | |
geticcserialnumber: | |
5.0.2: 9 | |
'5.1': 11 | |
geticcserialnumberforsubscriber: | |
5.0.2: 10 | |
'5.1': 12 | |
geticcsimchallengeresponse: | |
5.0.2: 29 | |
'5.1': 31 | |
getimeiforsubscriber: | |
5.0.2: 3 | |
'5.1': 4 | |
getisimchallengeresponse: | |
5.0.2: 28 | |
'5.1': 30 | |
getisimdomain: | |
5.0.2: 24 | |
'5.1': 26 | |
getisimimpi: | |
5.0.2: 23 | |
'5.1': 25 | |
getisimimpu: | |
5.0.2: 25 | |
'5.1': 27 | |
getisimist: | |
5.0.2: 26 | |
'5.1': 28 | |
getisimpcscf: | |
5.0.2: 27 | |
'5.1': 29 | |
getline1alphatag: | |
5.0.2: 13 | |
'5.1': 15 | |
getline1alphatagforsubscriber: | |
5.0.2: 14 | |
'5.1': 16 | |
getline1number: | |
5.0.2: 11 | |
'5.1': 13 | |
getline1numberforsubscriber: | |
5.0.2: 12 | |
'5.1': 14 | |
getmsisdn: | |
5.0.2: 15 | |
'5.1': 17 | |
getmsisdnforsubscriber: | |
5.0.2: 16 | |
'5.1': 18 | |
getnaiforsubscriber: | |
'5.1': 2 | |
getsubscriberid: | |
5.0.2: 5 | |
'5.1': 7 | |
getsubscriberidforsubscriber: | |
5.0.2: 6 | |
'5.1': 8 | |
getvoicemailalphatag: | |
5.0.2: 21 | |
'5.1': 23 | |
getvoicemailalphatagforsubscriber: | |
5.0.2: 22 | |
'5.1': 24 | |
getvoicemailnumber: | |
5.0.2: 17 | |
'5.1': 19 | |
getvoicemailnumberforsubscriber: | |
5.0.2: 18 | |
'5.1': 20 | |
isms: | |
'#PACKAGE_NAME+/android-5.0.2_r1': com.android.internal.telephony.ISms | |
'#PACKAGE_NAME+/android-5.1.0_r1': com.android.internal.telephony.ISms | |
'#PACKAGE_URL+/android-5.0.2_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.0.2_r1/telephony/java/com/android/internal/telephony/ISms.aidl | |
'#PACKAGE_URL+/android-5.1.0_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.1.0_r1/telephony/java/com/android/internal/telephony/ISms.aidl | |
copymessagetoiccef: | |
5.0.2: 7 | |
'5.1': 7 | |
copymessagetoiccefforsubscriber: | |
5.0.2: 8 | |
'5.1': 8 | |
disablecellbroadcast: | |
5.0.2: 19 | |
'5.1': 18 | |
disablecellbroadcastforsubscriber: | |
5.0.2: 20 | |
'5.1': 19 | |
disablecellbroadcastrange: | |
5.0.2: 23 | |
'5.1': 22 | |
disablecellbroadcastrangeforsubscriber: | |
5.0.2: 24 | |
'5.1': 23 | |
enablecellbroadcast: | |
5.0.2: 17 | |
'5.1': 16 | |
enablecellbroadcastforsubscriber: | |
5.0.2: 18 | |
'5.1': 17 | |
enablecellbroadcastrange: | |
5.0.2: 21 | |
'5.1': 20 | |
enablecellbroadcastrangeforsubscriber: | |
5.0.2: 22 | |
'5.1': 21 | |
getallmessagesfromiccef: | |
5.0.2: 3 | |
'5.1': 3 | |
getallmessagesfromiccefforsubscriber: | |
5.0.2: 4 | |
'5.1': 4 | |
getimssmsformat: | |
5.0.2: 32 | |
'5.1': 32 | |
getimssmsformatforsubscriber: | |
5.0.2: 33 | |
'5.1': 33 | |
getpreferredsmssubscription: | |
5.0.2: 31 | |
'5.1': 31 | |
getpremiumsmspermission: | |
5.0.2: 25 | |
'5.1': 24 | |
getpremiumsmspermissionforsubscriber: | |
5.0.2: 26 | |
'5.1': 25 | |
injectsmspdu: | |
5.0.2: 13 | |
'5.1': 13 | |
isimssmssupported: | |
5.0.2: 29 | |
'5.1': 28 | |
isimssmssupportedforsubscriber: | |
5.0.2: 30 | |
'5.1': 29 | |
isms.stub.asinterface(sm.getservice: | |
5.0.2: 2 | |
'5.1': 2 | |
issmspromptenabled: | |
5.0.2: 34 | |
'5.1': 34 | |
issmssimpickactivityneeded: | |
'5.1': 30 | |
senddata: | |
5.0.2: 9 | |
'5.1': 9 | |
senddataforsubscriber: | |
5.0.2: 10 | |
'5.1': 10 | |
sendmultiparttext: | |
5.0.2: 15 | |
'5.1': 14 | |
sendmultiparttextforsubscriber: | |
5.0.2: 16 | |
'5.1': 15 | |
sendstoredmultiparttext: | |
5.0.2: 36 | |
'5.1': 36 | |
sendstoredtext: | |
5.0.2: 35 | |
'5.1': 35 | |
sendtext: | |
5.0.2: 11 | |
'5.1': 11 | |
sendtextforsubscriber: | |
5.0.2: 12 | |
'5.1': 12 | |
servicemanagernative.getdefault: | |
5.0.2: 1 | |
'5.1': 1 | |
setpremiumsmspermission: | |
5.0.2: 27 | |
'5.1': 26 | |
setpremiumsmspermissionforsubscriber: | |
5.0.2: 28 | |
'5.1': 27 | |
updatemessageoniccef: | |
5.0.2: 5 | |
'5.1': 5 | |
updatemessageoniccefforsubscriber: | |
5.0.2: 6 | |
'5.1': 6 | |
updatesmssendstatus: | |
5.0.2: 14 | |
phone: | |
'#PACKAGE_NAME+/android-5.0.2_r1': com.android.internal.telephony.ITelephony | |
'#PACKAGE_NAME+/android-5.1.0_r1': com.android.internal.telephony.ITelephony | |
'#PACKAGE_URL+/android-5.0.2_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.0.2_r1/telephony/java/com/android/internal/telephony/ITelephony.aidl | |
'#PACKAGE_URL+/android-5.1.0_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.1.0_r1/telephony/java/com/android/internal/telephony/ITelephony.aidl | |
answerringingcall: | |
5.0.2: 5 | |
'5.1': 5 | |
answerringingcallforsubscriber: | |
'5.1': 6 | |
call: | |
5.0.2: 2 | |
'5.1': 2 | |
checkcarrierprivilegesforpackage: | |
5.0.2: 90 | |
'5.1': 93 | |
dial: | |
5.0.2: 1 | |
'5.1': 1 | |
disabledataconnectivity: | |
5.0.2: 38 | |
'5.1': 39 | |
disablelocationupdates: | |
5.0.2: 35 | |
'5.1': 36 | |
disablelocationupdatesforsubscriber: | |
5.0.2: 36 | |
'5.1': 37 | |
enabledataconnectivity: | |
5.0.2: 37 | |
'5.1': 38 | |
enablelocationupdates: | |
5.0.2: 33 | |
'5.1': 34 | |
enablelocationupdatesforsubscriber: | |
5.0.2: 34 | |
'5.1': 35 | |
enablesimplifiednetworksettingsforsubscriber: | |
5.0.2: 92 | |
enablevideocalling: | |
'5.1': 106 | |
endcall: | |
5.0.2: 3 | |
'5.1': 3 | |
endcallforsubscriber: | |
5.0.2: 4 | |
'5.1': 4 | |
getactivephonetype: | |
5.0.2: 46 | |
'5.1': 47 | |
getactivephonetypeforsubscriber: | |
5.0.2: 47 | |
'5.1': 48 | |
getallcellinfo: | |
5.0.2: 67 | |
'5.1': 69 | |
getcalculatedpreferrednetworktype: | |
5.0.2: 80 | |
'5.1': 82 | |
getcallstate: | |
5.0.2: 42 | |
'5.1': 43 | |
getcallstateforsubscriber: | |
5.0.2: 43 | |
'5.1': 44 | |
getcarrierpackagenamesforintent: | |
5.0.2: 91 | |
'5.1': 94 | |
getcarrierprivilegestatus: | |
'5.1': 92 | |
getcdmaeriiconindex: | |
5.0.2: 48 | |
'5.1': 49 | |
getcdmaeriiconindexforsubscriber: | |
5.0.2: 49 | |
'5.1': 50 | |
getcdmaeriiconmode: | |
5.0.2: 50 | |
'5.1': 51 | |
getcdmaeriiconmodeforsubscriber: | |
5.0.2: 51 | |
'5.1': 52 | |
getcdmaeritext: | |
5.0.2: 52 | |
'5.1': 53 | |
getcdmaeritextforsubscriber: | |
5.0.2: 53 | |
'5.1': 54 | |
getcdmamdn: | |
5.0.2: 87 | |
'5.1': 90 | |
getcdmamin: | |
5.0.2: 88 | |
'5.1': 91 | |
getcelllocation: | |
5.0.2: 40 | |
'5.1': 41 | |
getdataactivity: | |
5.0.2: 44 | |
'5.1': 45 | |
getdataenabled: | |
5.0.2: 84 | |
'5.1': 87 | |
getdatanetworktype: | |
5.0.2: 59 | |
'5.1': 61 | |
getdatanetworktypeforsubscriber: | |
5.0.2: 60 | |
'5.1': 62 | |
getdatastate: | |
5.0.2: 45 | |
'5.1': 46 | |
getdefaultsim: | |
5.0.2: 69 | |
'5.1': 71 | |
getdeviceid: | |
'5.1': 109 | |
getline1alphatagfordisplay: | |
5.0.2: 96 | |
'5.1': 97 | |
getline1numberfordisplay: | |
5.0.2: 95 | |
'5.1': 96 | |
getlteoncdmamode: | |
5.0.2: 65 | |
'5.1': 67 | |
getlteoncdmamodeforsubscriber: | |
5.0.2: 66 | |
'5.1': 68 | |
getmergedsubscriberids: | |
'5.1': 98 | |
getneighboringcellinfo: | |
5.0.2: 41 | |
'5.1': 42 | |
getnetworktype: | |
5.0.2: 57 | |
'5.1': 59 | |
getnetworktypeforsubscriber: | |
5.0.2: 58 | |
'5.1': 60 | |
getpcscfaddress: | |
5.0.2: 85 | |
'5.1': 88 | |
getpreferrednetworktype: | |
5.0.2: 81 | |
'5.1': 83 | |
getradioaccessfamily: | |
'5.1': 105 | |
getsimplifiednetworksettingsenabledforsubscriber: | |
5.0.2: 93 | |
gettetherapnrequired: | |
'5.1': 84 | |
getvoicemessagecount: | |
5.0.2: 55 | |
'5.1': 57 | |
getvoicemessagecountforsubscriber: | |
5.0.2: 56 | |
'5.1': 58 | |
getvoicenetworktype: | |
5.0.2: 61 | |
'5.1': 63 | |
getvoicenetworktypeforsubscriber: | |
5.0.2: 62 | |
'5.1': 64 | |
handlepinmmi: | |
5.0.2: 24 | |
'5.1': 25 | |
handlepinmmiforsubscriber: | |
5.0.2: 25 | |
'5.1': 26 | |
hascarrierprivileges: | |
5.0.2: 89 | |
hasicccard: | |
5.0.2: 63 | |
'5.1': 65 | |
hasicccardusingslotid: | |
5.0.2: 64 | |
'5.1': 66 | |
icccloselogicalchannel: | |
5.0.2: 71 | |
'5.1': 73 | |
iccexchangesimio: | |
5.0.2: 74 | |
'5.1': 76 | |
iccopenlogicalchannel: | |
5.0.2: 70 | |
'5.1': 72 | |
icctransmitapdubasicchannel: | |
5.0.2: 73 | |
'5.1': 75 | |
icctransmitapdulogicalchannel: | |
5.0.2: 72 | |
'5.1': 74 | |
invokeoemrilrequestraw: | |
5.0.2: 98 | |
'5.1': 101 | |
isdataconnectivitypossible: | |
5.0.2: 39 | |
'5.1': 40 | |
isidle: | |
5.0.2: 11 | |
'5.1': 12 | |
isidleforsubscriber: | |
5.0.2: 12 | |
'5.1': 13 | |
isimsregistered: | |
'5.1': 108 | |
isoffhook: | |
5.0.2: 7 | |
'5.1': 8 | |
isoffhookforsubscriber: | |
5.0.2: 8 | |
'5.1': 9 | |
isradioon: | |
5.0.2: 13 | |
'5.1': 14 | |
isradioonforsubscriber: | |
5.0.2: 14 | |
'5.1': 15 | |
isringing: | |
5.0.2: 10 | |
'5.1': 11 | |
isringingforsubscriber: | |
5.0.2: 9 | |
'5.1': 10 | |
issimpinenabled: | |
5.0.2: 15 | |
'5.1': 16 | |
isvideocallingenabled: | |
'5.1': 107 | |
needmobileradioshutdown: | |
5.0.2: 99 | |
'5.1': 102 | |
needsotaserviceprovisioning: | |
5.0.2: 54 | |
'5.1': 55 | |
nvreaditem: | |
5.0.2: 76 | |
'5.1': 78 | |
nvresetconfig: | |
5.0.2: 79 | |
'5.1': 81 | |
nvwritecdmaprl: | |
5.0.2: 78 | |
'5.1': 80 | |
nvwriteitem: | |
5.0.2: 77 | |
'5.1': 79 | |
sendenvelopewithstatus: | |
5.0.2: 75 | |
'5.1': 77 | |
setcellinfolistrate: | |
5.0.2: 68 | |
'5.1': 70 | |
setdataenabled: | |
5.0.2: 83 | |
'5.1': 86 | |
setimsregistrationstate: | |
5.0.2: 86 | |
'5.1': 89 | |
setline1numberfordisplayforsubscriber: | |
5.0.2: 94 | |
'5.1': 95 | |
setoperatorbrandoverride: | |
5.0.2: 97 | |
'5.1': 99 | |
setpreferrednetworktype: | |
5.0.2: 82 | |
'5.1': 85 | |
setradio: | |
5.0.2: 28 | |
'5.1': 29 | |
setradiocapability: | |
'5.1': 104 | |
setradioforsubscriber: | |
5.0.2: 29 | |
'5.1': 30 | |
setradiopower: | |
5.0.2: 30 | |
'5.1': 31 | |
setroamingoverride: | |
'5.1': 100 | |
setvoicemailnumber: | |
'5.1': 56 | |
shutdownmobileradios: | |
5.0.2: 100 | |
'5.1': 103 | |
silenceringer: | |
5.0.2: 6 | |
'5.1': 7 | |
supplypin: | |
5.0.2: 16 | |
'5.1': 17 | |
supplypinforsubscriber: | |
5.0.2: 17 | |
'5.1': 18 | |
supplypinreportresult: | |
5.0.2: 20 | |
'5.1': 21 | |
supplypinreportresultforsubscriber: | |
5.0.2: 21 | |
'5.1': 22 | |
supplypuk: | |
5.0.2: 18 | |
'5.1': 19 | |
supplypukforsubscriber: | |
5.0.2: 19 | |
'5.1': 20 | |
supplypukreportresult: | |
5.0.2: 22 | |
'5.1': 23 | |
supplypukreportresultforsubscriber: | |
5.0.2: 23 | |
'5.1': 24 | |
toggleradioonoff: | |
5.0.2: 26 | |
'5.1': 27 | |
toggleradioonoffforsubscriber: | |
5.0.2: 27 | |
'5.1': 28 | |
updateservicelocation: | |
5.0.2: 31 | |
'5.1': 32 | |
updateservicelocationforsubscriber: | |
5.0.2: 32 | |
'5.1': 33 | |
usb: | |
'#PACKAGE_NAME+/android-5.0.2_r1': android.hardware.usb.IUsbManager | |
'#PACKAGE_NAME+/android-5.1.0_r1': android.hardware.usb.IUsbManager | |
'#PACKAGE_URL+/android-5.0.2_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.0.2_r1/core/java/android/hardware/usb/IUsbManager.aidl | |
'#PACKAGE_URL+/android-5.1.0_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.1.0_r1/core/java/android/hardware/usb/IUsbManager.aidl | |
allowusbdebugging: | |
5.0.2: 17 | |
'5.1': 17 | |
cleardefaults: | |
5.0.2: 14 | |
'5.1': 14 | |
clearusbdebuggingkeys: | |
5.0.2: 19 | |
'5.1': 19 | |
denyusbdebugging: | |
5.0.2: 18 | |
'5.1': 18 | |
getcurrentaccessory: | |
5.0.2: 3 | |
'5.1': 3 | |
getdevicelist: | |
5.0.2: 1 | |
'5.1': 1 | |
grantaccessorypermission: | |
5.0.2: 12 | |
'5.1': 12 | |
grantdevicepermission: | |
5.0.2: 11 | |
'5.1': 11 | |
hasaccessorypermission: | |
5.0.2: 8 | |
'5.1': 8 | |
hasdefaults: | |
5.0.2: 13 | |
'5.1': 13 | |
hasdevicepermission: | |
5.0.2: 7 | |
'5.1': 7 | |
openaccessory: | |
5.0.2: 4 | |
'5.1': 4 | |
opendevice: | |
5.0.2: 2 | |
'5.1': 2 | |
requestaccessorypermission: | |
5.0.2: 10 | |
'5.1': 10 | |
requestdevicepermission: | |
5.0.2: 9 | |
'5.1': 9 | |
setaccessorypackage: | |
5.0.2: 6 | |
'5.1': 6 | |
setcurrentfunction: | |
5.0.2: 15 | |
'5.1': 15 | |
setdevicepackage: | |
5.0.2: 5 | |
'5.1': 5 | |
setmassstoragebackingfile: | |
5.0.2: 16 | |
'5.1': 16 | |
wifi: | |
'#PACKAGE_NAME+/android-5.0.2_r1': android.net.wifi.IWifiManager | |
'#PACKAGE_NAME+/android-5.1.0_r1': android.net.wifi.IWifiManager | |
'#PACKAGE_URL+/android-5.0.2_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.0.2_r1/wifi/java/android/net/wifi/IWifiManager.aidl | |
'#PACKAGE_URL+/android-5.1.0_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.1.0_r1/wifi/java/android/net/wifi/IWifiManager.aidl | |
acquiremulticastlock: | |
5.0.2: 31 | |
'5.1': 32 | |
acquirewifilock: | |
5.0.2: 26 | |
'5.1': 27 | |
addorupdatenetwork: | |
5.0.2: 5 | |
'5.1': 5 | |
addtoblacklist: | |
5.0.2: 39 | |
'5.1': 40 | |
clearblacklist: | |
5.0.2: 40 | |
'5.1': 41 | |
disableephemeralnetwork: | |
'5.1': 59 | |
disablenetwork: | |
5.0.2: 8 | |
'5.1': 8 | |
disconnect: | |
5.0.2: 13 | |
'5.1': 14 | |
enableaggressivehandover: | |
5.0.2: 54 | |
'5.1': 55 | |
enablenetwork: | |
5.0.2: 7 | |
'5.1': 7 | |
enabletdls: | |
5.0.2: 43 | |
'5.1': 44 | |
enabletdlswithmacaddress: | |
5.0.2: 44 | |
'5.1': 45 | |
enableverboselogging: | |
5.0.2: 51 | |
'5.1': 52 | |
getaggressivehandover: | |
5.0.2: 53 | |
'5.1': 54 | |
getallowscanswithtraffic: | |
5.0.2: 55 | |
'5.1': 56 | |
getbatchedscanresults: | |
5.0.2: 47 | |
'5.1': 48 | |
getchannellist: | |
5.0.2: 10 | |
'5.1': 10 | |
getconfigfile: | |
5.0.2: 42 | |
'5.1': 43 | |
getconfigurednetworks: | |
5.0.2: 3 | |
'5.1': 3 | |
getconnectioninfo: | |
5.0.2: 16 | |
'5.1': 17 | |
getconnectionstatistics: | |
5.0.2: 57 | |
'5.1': 58 | |
getdhcpinfo: | |
5.0.2: 24 | |
'5.1': 25 | |
getfrequencyband: | |
5.0.2: 21 | |
'5.1': 22 | |
getprivilegedconfigurednetworks: | |
5.0.2: 4 | |
'5.1': 4 | |
getscanresults: | |
5.0.2: 12 | |
'5.1': 13 | |
getsupportedfeatures: | |
5.0.2: 1 | |
'5.1': 1 | |
getverboselogginglevel: | |
5.0.2: 52 | |
'5.1': 53 | |
getwifiapconfiguration: | |
5.0.2: 35 | |
'5.1': 36 | |
getwifiapenabledstate: | |
5.0.2: 34 | |
'5.1': 35 | |
getwifienabledstate: | |
5.0.2: 18 | |
'5.1': 19 | |
getwifiservicemessenger: | |
5.0.2: 41 | |
'5.1': 42 | |
getwpsnfcconfigurationtoken: | |
5.0.2: 50 | |
'5.1': 51 | |
initializemulticastfiltering: | |
5.0.2: 29 | |
'5.1': 30 | |
isbatchedscansupported: | |
5.0.2: 48 | |
'5.1': 49 | |
isdualbandsupported: | |
5.0.2: 22 | |
'5.1': 23 | |
ismulticastenabled: | |
5.0.2: 30 | |
'5.1': 31 | |
isscanalwaysavailable: | |
5.0.2: 25 | |
'5.1': 26 | |
pingsupplicant: | |
5.0.2: 9 | |
'5.1': 9 | |
pollbatchedscan: | |
5.0.2: 49 | |
'5.1': 50 | |
reassociate: | |
5.0.2: 15 | |
'5.1': 16 | |
reconnect: | |
5.0.2: 14 | |
'5.1': 15 | |
releasemulticastlock: | |
5.0.2: 32 | |
'5.1': 33 | |
releasewifilock: | |
5.0.2: 28 | |
'5.1': 29 | |
removenetwork: | |
5.0.2: 6 | |
'5.1': 6 | |
reportactivityinfo: | |
5.0.2: 2 | |
'5.1': 2 | |
requestbatchedscan: | |
5.0.2: 45 | |
'5.1': 46 | |
saveconfiguration: | |
5.0.2: 23 | |
'5.1': 24 | |
setallowscanswithtraffic: | |
5.0.2: 56 | |
'5.1': 57 | |
setcountrycode: | |
5.0.2: 19 | |
'5.1': 20 | |
setfrequencyband: | |
5.0.2: 20 | |
'5.1': 21 | |
setwifiapconfiguration: | |
5.0.2: 36 | |
'5.1': 37 | |
setwifiapenabled: | |
5.0.2: 33 | |
'5.1': 34 | |
setwifienabled: | |
5.0.2: 17 | |
'5.1': 18 | |
startlocationrestrictedscan: | |
'5.1': 12 | |
startscan: | |
5.0.2: 11 | |
'5.1': 11 | |
startwifi: | |
5.0.2: 37 | |
'5.1': 38 | |
stopbatchedscan: | |
5.0.2: 46 | |
'5.1': 47 | |
stopwifi: | |
5.0.2: 38 | |
'5.1': 39 | |
updatewifilockworksource: | |
5.0.2: 27 | |
'5.1': 28 | |
window: | |
'#PACKAGE_NAME+/android-5.0.2_r1': android.view.IWindowManager | |
'#PACKAGE_NAME+/android-5.1.0_r1': android.view.IWindowManager | |
'#PACKAGE_URL+/android-5.0.2_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.0.2_r1/core/java/android/view/IWindowManager.aidl | |
'#PACKAGE_URL+/android-5.1.0_r1': https://android.googlesource.com/platform/frameworks/base/+/android-5.1.0_r1/core/java/android/view/IWindowManager.aidl | |
addapptoken: | |
5.0.2: 20 | |
'5.1': 20 | |
addwindowtoken: | |
5.0.2: 18 | |
'5.1': 18 | |
clearforceddisplaydensity: | |
5.0.2: 13 | |
'5.1': 13 | |
clearforceddisplaysize: | |
5.0.2: 9 | |
'5.1': 9 | |
clearwindowcontentframestats: | |
5.0.2: 74 | |
'5.1': 75 | |
closesystemdialogs: | |
5.0.2: 50 | |
'5.1': 51 | |
disablekeyguard: | |
5.0.2: 42 | |
'5.1': 43 | |
dismisskeyguard: | |
5.0.2: 48 | |
'5.1': 49 | |
enablescreenifneeded: | |
5.0.2: 73 | |
'5.1': 74 | |
executeapptransition: | |
5.0.2: 31 | |
'5.1': 32 | |
exitkeyguardsecurely: | |
5.0.2: 44 | |
'5.1': 45 | |
freezerotation: | |
5.0.2: 65 | |
'5.1': 66 | |
getanimationscale: | |
5.0.2: 51 | |
'5.1': 52 | |
getanimationscales: | |
5.0.2: 52 | |
'5.1': 53 | |
getapporientation: | |
5.0.2: 23 | |
'5.1': 23 | |
getbasedisplaydensity: | |
5.0.2: 11 | |
'5.1': 11 | |
getbasedisplaysize: | |
5.0.2: 7 | |
'5.1': 7 | |
getcurrentanimatorscale: | |
5.0.2: 55 | |
'5.1': 56 | |
getinitialdisplaydensity: | |
5.0.2: 10 | |
'5.1': 10 | |
getinitialdisplaysize: | |
5.0.2: 6 | |
'5.1': 6 | |
getpendingapptransition: | |
5.0.2: 26 | |
'5.1': 26 | |
getpreferredoptionspanelgravity: | |
5.0.2: 64 | |
'5.1': 65 | |
getrotation: | |
5.0.2: 61 | |
'5.1': 62 | |
getwindowcontentframestats: | |
5.0.2: 75 | |
'5.1': 76 | |
hasnavigationbar: | |
5.0.2: 70 | |
'5.1': 71 | |
inkeyguardrestrictedinputmode: | |
5.0.2: 47 | |
'5.1': 48 | |
inputmethodclienthasfocus: | |
5.0.2: 5 | |
'5.1': 5 | |
iskeyguardlocked: | |
5.0.2: 45 | |
'5.1': 46 | |
iskeyguardsecure: | |
5.0.2: 46 | |
'5.1': 47 | |
isrotationfrozen: | |
5.0.2: 67 | |
'5.1': 68 | |
issafemodeenabled: | |
5.0.2: 72 | |
'5.1': 73 | |
isviewserverrunning: | |
5.0.2: 3 | |
'5.1': 3 | |
keyguardgoingaway: | |
5.0.2: 49 | |
'5.1': 50 | |
locknow: | |
5.0.2: 71 | |
'5.1': 72 | |
opensession: | |
5.0.2: 4 | |
'5.1': 4 | |
overridependingapptransition: | |
5.0.2: 27 | |
'5.1': 27 | |
overridependingapptransitionaspectscaledthumb: | |
5.0.2: 30 | |
'5.1': 30 | |
overridependingapptransitioninplace: | |
'5.1': 31 | |
overridependingapptransitionscaleup: | |
5.0.2: 28 | |
'5.1': 28 | |
overridependingapptransitionthumb: | |
5.0.2: 29 | |
'5.1': 29 | |
pausekeydispatching: | |
5.0.2: 15 | |
'5.1': 15 | |
prepareapptransition: | |
5.0.2: 25 | |
'5.1': 25 | |
reenablekeyguard: | |
5.0.2: 43 | |
'5.1': 44 | |
removeapptoken: | |
5.0.2: 37 | |
'5.1': 38 | |
removerotationwatcher: | |
5.0.2: 63 | |
'5.1': 64 | |
removewindowtoken: | |
5.0.2: 19 | |
'5.1': 19 | |
resumekeydispatching: | |
5.0.2: 16 | |
'5.1': 16 | |
screenshotapplications: | |
5.0.2: 68 | |
'5.1': 69 | |
setanimationscale: | |
5.0.2: 53 | |
'5.1': 54 | |
setanimationscales: | |
5.0.2: 54 | |
'5.1': 55 | |
setappgroupid: | |
5.0.2: 21 | |
'5.1': 21 | |
setapporientation: | |
5.0.2: 22 | |
'5.1': 22 | |
setappstartingwindow: | |
5.0.2: 32 | |
'5.1': 33 | |
setappvisibility: | |
5.0.2: 34 | |
'5.1': 35 | |
setappwillbehidden: | |
5.0.2: 33 | |
'5.1': 34 | |
seteventdispatching: | |
5.0.2: 17 | |
'5.1': 17 | |
setfocusedapp: | |
5.0.2: 24 | |
'5.1': 24 | |
setforceddisplaydensity: | |
5.0.2: 12 | |
'5.1': 12 | |
setforceddisplaysize: | |
5.0.2: 8 | |
'5.1': 8 | |
setintouchmode: | |
5.0.2: 56 | |
'5.1': 57 | |
setnewconfiguration: | |
5.0.2: 39 | |
'5.1': 40 | |
setoverscan: | |
5.0.2: 14 | |
'5.1': 14 | |
setscreencapturedisabled: | |
5.0.2: 59 | |
'5.1': 60 | |
setstrictmodevisualindicatorpreference: | |
5.0.2: 58 | |
'5.1': 59 | |
showstrictmodeviolation: | |
5.0.2: 57 | |
'5.1': 58 | |
startappfreezingscreen: | |
5.0.2: 35 | |
'5.1': 36 | |
startfreezingscreen: | |
5.0.2: 40 | |
'5.1': 41 | |
startviewserver: | |
5.0.2: 1 | |
'5.1': 1 | |
statusbarvisibilitychanged: | |
5.0.2: 69 | |
'5.1': 70 | |
stopappfreezingscreen: | |
5.0.2: 36 | |
'5.1': 37 | |
stopfreezingscreen: | |
5.0.2: 41 | |
'5.1': 42 | |
stopviewserver: | |
5.0.2: 2 | |
'5.1': 2 | |
thawrotation: | |
5.0.2: 66 | |
'5.1': 67 | |
updateorientationfromapptokens: | |
5.0.2: 38 | |
'5.1': 39 | |
updaterotation: | |
5.0.2: 60 | |
'5.1': 61 | |
watchrotation: | |
5.0.2: 62 | |
'5.1': 63 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import sys | |
import time | |
import yaml | |
import requests | |
import subprocess | |
import base64 | |
import re | |
ADB_PATH = '/android/platform-tools/adb' | |
GOOGLE_SOURCE_URL = 'https://android.googlesource.com' | |
BASE_REPO = 'platform/frameworks/base' | |
YAML_FILE = 'transaction_codes.yaml' | |
SERVICE_NAMES = '''phone iphonesubinfo isub isms usb wifi window input input_method connectivity clipboard | |
package display hardware bluetooth_manager audio telecom user telephony.registry power sensorservice | |
activity mount notification imms device_policy lock_settings trust accessibility deviceidle account'''.split() | |
TRANSACTION_CODES = {svc:{} for svc in SERVICE_NAMES} | |
def adbdevices(): | |
global ADB_PATH | |
return set([device.split('\t')[0] for device in subprocess.check_output([ADB_PATH, 'devices']).splitlines() if device.endswith('\tdevice')]) | |
def adbshell(command): | |
global SERIAL, ADB_PATH | |
return subprocess.check_output([ADB_PATH, '-s', SERIAL, 'shell', command]).decode('utf-8').replace('\r\n', '\n').rstrip('\n') | |
def load_yaml(): | |
global TRANSACTION_CODES, YAML_FILE | |
try: | |
with open(YAML_FILE, 'r') as f: | |
TRANSACTION_CODES = yaml.safe_load(f.read()) | |
except Exception as e: | |
pass | |
def save_yaml(): | |
global TRANSACTION_CODES, YAML_FILE | |
try: | |
with open(YAML_FILE, 'w') as f: | |
f.write(yaml.dump(TRANSACTION_CODES, default_flow_style=False)) | |
except Exception as e: | |
pass | |
def get_google_source(url, format='text', decode=True): | |
try: | |
req = requests.get(url, params={'format': format}) | |
if req.status_code == 200: | |
if decode: | |
return base64.decodestring(req.content) | |
return req.content | |
except Exception as e: | |
pass | |
return '' | |
def get_service_package_names(): | |
return dict(re.findall(r'^\d+\s+(\S+): \[(\S*)\]', str(adbshell('service list')), re.M)) | |
def get_google_source_link(link, tag='+/master'): | |
global GOOGLE_SOURCE_URL, BASE_REPO | |
return link if link.startswith (('http:', 'https:')) else '{}/{}/{}/{}'.format(GOOGLE_SOURCE_URL, BASE_REPO, tag, link) | |
def get_service_package_links(): | |
global TAG | |
return [aidl for aidl in ''.join([line for line in get_google_source(get_google_source_link('Android.mk', TAG)).replace('\\\n', '').splitlines() | |
if line.startswith('LOCAL_SRC_FILES ')]).split() if aidl.endswith('.aidl')] | |
def get_android_version(): | |
return str(adbshell('getprop ro.build.version.release')) | |
def get_all_android_versions(): | |
return sorted(re.findall(r' refs/tags/android-([0-9.]+)_r1$', get_google_source(get_google_source_link('tags/', '+refs'), decode=False), re.M)) | |
def get_android_tag(version): | |
for tag in get_all_android_versions(): | |
if tag.startswith(version): | |
return '+/android-{}_r1'.format(tag) | |
def get_function_names(src): | |
src = src[src.find('\ninterface '):].replace('\n', ' ').lower() | |
for fn in src.split(';'): | |
if fn.endswith(')'): | |
yield fn.rsplit('(', 1)[0].rsplit(' ', 1)[-1] | |
load_yaml() | |
DEVICES = sorted(adbdevices().intersection(sys.argv[1:])) if len(sys.argv) > 1 else sorted(adbdevices()) | |
for SERIAL in DEVICES: | |
VERSION = get_android_version() | |
TAG = get_android_tag(VERSION) | |
PACKAGE_NAMES = get_service_package_names() | |
PACKAGE_URLS = { pkg[0:-5].replace('/', '.'):pkg for pkg in get_service_package_links() } | |
for svc_name in sorted(TRANSACTION_CODES.keys()): | |
TRANSACTION_CODES[svc_name]['#PACKAGE_NAME{}'.format(TAG)] = PACKAGE_NAMES.get(svc_name, '#UNKNOWN#') | |
link = None | |
print SERIAL, VERSION, TAG, svc_name, PACKAGE_NAMES.get(svc_name, '#') | |
for pkg in sorted(PACKAGE_URLS.keys()): | |
if pkg.endswith(PACKAGE_NAMES.get(svc_name, '#')): | |
link = PACKAGE_URLS.get(pkg) | |
TRANSACTION_CODES[svc_name]['#PACKAGE_URL{}'.format(TAG)] = get_google_source_link(link, TAG) | |
break | |
if link is None: | |
continue | |
for i, fn in enumerate(get_function_names(get_google_source(get_google_source_link(link, TAG)))): | |
TRANSACTION_CODES[svc_name].setdefault(fn, {})[VERSION] = i + 1 | |
save_yaml() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment