Skip to content

Commit

Permalink
QA-15737 Научиться доставать market name прямо из устройства
Browse files Browse the repository at this point in the history
-add different ways to get vendor's market name
  • Loading branch information
a.chistov committed Jan 9, 2025
1 parent f8e3b63 commit 15af734
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
2 changes: 2 additions & 0 deletions doc/DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ STF consists of multiple independent processes communicating via [ZeroMQ](http:/

Each unit and its function will be explained later in the document.

Market name(on UI) for device take from device's settings(if vendor's market name reachable by command `settings get global device_name`), if you would like to have other market name just change settings.

## Assumptions

For this example deployment, the following assumptions will be made. You will need to adjust them as you see fit. Note that this deployment was designed to be relatively easy to set up without external tools, and may not be optimal. They're also configured so that you can run everything on a single host if required.
Expand Down
28 changes: 25 additions & 3 deletions lib/util/devutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ devutil.makeIdentity = async function(serial, properties, adb) {
let product = properties['ro.product.name']
let cpuPlatform = properties['ro.board.platform']
let openGLESVersion = properties['ro.opengles.version']
let marketName = await devutil.getDeviceMarketName(adb, serial)
let marketName = await devutil.getDeviceMarketName(adb, serial, properties)
let customMarketName = properties['debug.stf.product.device']
let macAddress = properties.mac_address
let ram = properties.ram
Expand Down Expand Up @@ -182,12 +182,34 @@ devutil.makeIdentity = async function(serial, properties, adb) {
}
}

devutil.getDeviceMarketName = function(adb, serial) {
devutil.getDeviceMarketName = function(adb, serial, properties) {
let manufacturer = properties['ro.product.manufacturer']
return adb.getDevice(serial).execOut('settings get global device_name', 'utf-8').then(function(deviceName) {
if (!deviceName || deviceName === 'null\n') {
return adb.getDevice(serial).execOut('settings get secure bluetooth_name', 'utf-8').then(function(bluetoothName) {
if (!bluetoothName || bluetoothName === 'null\n') {
return null
switch (manufacturer) {
case 'ARCHOS':
case 'GOOGLE':
return properties['ro.product.model']
case 'HMD GLOBAL':
return properties['ro.product.nickname']
case 'OPPO':
return adb.getDevice(serial).execOut('settings get secure oppo_device_name', 'utf-8').then(function(oppoDeviceName) {
if (!oppoDeviceName || oppoDeviceName === 'null\n') {
return properties['ro.oppo.market.name']
}
return oppoDeviceName
})
case 'HUAWEI':
return properties['ro.config.marketing_name']
case 'XIAOMI':
return properties['ro.config.marketing_name']
case 'ITEL MOBILE LIMITED':
return properties['transsion.device.name']
default:
return properties['ro.product.device']
}
}
return bluetoothName
})
Expand Down

0 comments on commit 15af734

Please sign in to comment.