def detectDeviceModule():
	deviceBrand = ADB.shell("getprop ro.product.brand").strip().lower()
	deviceModel = ADB.shell("getprop ro.product.model").strip().lower()
	if deviceBrand == "lge":
		if deviceModel == "lg-p500":
			return "lgp500" # LG-P500 (LG Optimus One)
	elif deviceBrand == "zte":
		if deviceModel == "zte v970" or deviceModel == "zte v970m":
			return "ztev970m" # xerodotc: Should be the same for both, but because I have ZTE V970M, I'll use "ztev970m" for module name
Пример #2
0
    def on_listView_clicked(self, index):
        MainWindow.actionGetRules.setEnabled(False)

        config.selectedDevice = config.devices[index.row()]

        ADB.startForward(config.selectedDevice, "8000", "9000")
        ADB.startForward(config.selectedDevice, "8001", "9001")

        checker.start()
Пример #3
0
def forward(path):
    sessionId = path.split("/")[0]
    host = ADB.host(sessionId)
    if request.method == 'GET':
        r = requests.get(host + '/wd/hub/session/' + path)
    elif request.method == 'DELETE':
        r = requests.delete(host + '/wd/hub/session/' + path, data=request.body.read())
        if path == sessionId:
            ADB.quit(sessionId)
    else:
        r = requests.post(host + '/wd/hub/session/' + path, data=request.body.read())
    if "application/json" in r.headers['content-type']:
        return json.loads(r.text)
    return r.text
Пример #4
0
def startSession():
    data = request.body.read()
    caps = json.loads(data)['desiredCapabilities']
    adb = ADB.adb(caps)
    if caps.has_key('app.install') and not caps['app.install']:
        pass
    else:
        adb.uninstall(caps['app.package'])
        adb.uninstall("org.openqa.selendroid")
        if os.path.exists(caps['app.apk']):
            apk_path = caps['app.apk']
        else:
            # todo create apk file from compressed data
            pass

        resigned = JARSIGN.resign(apk_path)
        adb.install(resigned)
        adb.install(selendroid_path)
    
    adb.instrumentation(caps['app.activity'])
    adb.forward()
    time.sleep(1) # need to give the activity a moment to start up

    print '%s/wd/hub/session' % adb.host
    r = requests.post('%s/wd/hub/session' % adb.host, data=data)
    adb.setSessionId(json.loads(r.text)['sessionId'])
    redirect('/wd/hub/session/' + adb.sessionId)
Пример #5
0
def get_gps_from_android():
    print("coordinates")
    try:
        coordinates = ADB.getRawGpsCoordinates()
        print(coordinates)
        if coordinates is None:
            eel.set_gps_from_android(None, None)
            return

        eel.set_gps_from_android(coordinates[0], coordinates[1])

    except Exception as e:
        print(e)
        eel.set_gps_from_android(None, None)
Пример #6
0
 def __init__(self):
     self.adb = ADB.ADB()
     pass
Пример #7
0
 def run(self):
     config.devices = ADB.getDevice()
     self.finish.emit()
Пример #8
0
 def run(self):
     MainWindow.info.setText("正在检测手机状态,请稍等...")
     ADB.checkAPK(config.selectedDevice, MainWindow.info)
     ADB.startHelperApp(config.selectedDevice, MainWindow.info)
     MainWindow.actionGetRules.setEnabled(True)
Пример #9
0
 def run(self):
     ADB.startTesting(config.selectedDevice)
Пример #10
0
 def on_actionStart_Server_triggered(self, triggered):
     ADB.startServer()
     pass
Пример #11
0
 def on_actionKill_Server_triggered(self, triggered):
     ADB.killServer()
     pass
Пример #12
0
Love Live! School Idol Festival: Keyboard Controller
File: Devices/__init__.py

Copyright (c) 2014 Visatouch Deeying ("xerodotc")
Love Live! School Idol Festival is a trademark of KLab and Bushiroad
'''

import sys
import ADB
import DeviceConfig

# Wait for device
# (I don't like to handle this here but it's required for device auto-detection)
try:
    print "Waiting for device..."
    ADB.waitDevice()
except KeyboardInterrupt as e:
    sys.exit()

# If device module is already (forced) defined then use it
# otherwise auto-detect
if DeviceConfig.DEVICE_MODULE != None:
    deviceModule = DeviceConfig.DEVICE_MODULE
else:
    from DeviceDetect import detectDeviceModule
    deviceModule = detectDeviceModule()

# Import _Device class according to device module
if deviceModule == "ztev970m":
    from ZTEV970M import _Device
elif deviceModule == "lgp500":