Skip to content

Commit

Permalink
fix #225
Browse files Browse the repository at this point in the history
  • Loading branch information
rafa0128 committed Sep 28, 2023
1 parent bce4e8e commit 1ff4dd0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion solox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

from __future__ import absolute_import

__version__ = '2.7.8'
__version__ = '2.7.9'
4 changes: 2 additions & 2 deletions solox/public/apm_pk.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ def getprocessCpuStat(self, pkgName, deviceId):
return processCpu


def getTotalCpuStat(self):
def getTotalCpuStat(self, deviceId):
"""get the total cpu usage at a certain time"""
cmd = 'cat /proc/stat |{} ^cpu'.format(d.filterType())
result = adb.shell(cmd=cmd, deviceId=self.deviceId)
result = adb.shell(cmd=cmd, deviceId=deviceId)
totalCpu = 0
lines = result.split('\n')
for line in lines:
Expand Down
17 changes: 13 additions & 4 deletions solox/public/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,15 @@ def getIdbyDevice(self, deviceinfo, platform):
else:
deviceId = deviceinfo
return deviceId

def getSdkVersion(self, deviceId):
version = adb.shell(cmd='getprop ro.build.version.sdk', deviceId=deviceId)
return version

def getPid(self, deviceId, pkgName):
"""Get the pid corresponding to the Android package name"""
try:
sdkversion = adb.shell(cmd='getprop ro.build.version.sdk', deviceId=deviceId)
sdkversion = self.getSdkVersion(deviceId)
if sdkversion and int(sdkversion) < 26:
result = os.popen(f"{self.adb} -s {deviceId} shell ps | {self.filterType()} {pkgName}").readlines()
processList = ['{}:{}'.format(process.split()[1],process.split()[8]) for process in result]
Expand Down Expand Up @@ -131,11 +135,16 @@ def checkPkgname(self, pkgname):
flag = False
return flag

def getPkgname(self, devicesId):
def getPkgname(self, deviceId):
"""Get all package names of Android devices"""
pkginfo = os.popen(f"{self.adb} -s {devicesId} shell pm list package")
pkginfo = os.popen(f"{self.adb} -s {deviceId} shell pm list packages --user 0")
pkglist = [p.lstrip('package').lstrip(":").strip() for p in pkginfo]
return pkglist
if pkglist.__len__() > 0:
return pkglist
else:
pkginfo = os.popen(f"{self.adb} -s {deviceId} shell pm list packages")
pkglist = [p.lstrip('package').lstrip(":").strip() for p in pkginfo]
return pkglist

def getDeviceInfoByiOS(self):
"""Get a list of all successfully connected iOS devices"""
Expand Down
2 changes: 1 addition & 1 deletion solox/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h2 class="page-title">
</li>
<li class="list-inline-item">
<a href="https://github.com/smart-test-ti/SoloX/releases" target="_blank" class="link-secondary" rel="noopener">
{% if lan == 'cn' %} 版本 {% else %} Releases {% endif %} . V2.7.8
{% if lan == 'cn' %} 版本 {% else %} Releases {% endif %} . V2.7.9
</a>
</li>
</ul>
Expand Down

0 comments on commit 1ff4dd0

Please sign in to comment.