Skip to content

Commit

Permalink
stf: Device name related updates (#516)
Browse files Browse the repository at this point in the history
* stf: Upstream android-device-list library to cover newer devices
* 1.2.1 version is nearly 2.5 years old so it does not cover latest android devices thus creates un-friendly device names, fixes it
* no breaking API/ABI changes
* to the latest 1.2.7 version https://github.com/pbakondy/android-device-list/blob/master/package.json#L3

Signed-off-by: sirmordred <[email protected]>

* stf: Allow users to override device names
* it allows to users to change device names by setting ro.stf.product.device attribute via: e.g adb shell setprop ro.stf.product.device Samsung Galaxy S9
* Not all time android-device-list library is updated, even if it is updated, it does not cover all devices
* Users must have a way to override device name so they can change it as they want (alternative is: overriding ro.product.device attribute but changing that attribute may cause some unexpected system errors because it is used by android os in device as well)
* Preserve current behavior: if stf could not find ro.stf.product.device attribute, it falls to base implementation

Signed-off-by: sirmordred <[email protected]>

* stf: Changed prefix of custom device name property
* some properties starts with prefixes like "ro" are not allowed to change in some phones, use "debug" instead
for more info: https://stackoverflow.com/questions/66877858/android-setprop-failed-to-set-property

Signed-off-by: sirmordred <[email protected]>

Co-authored-by: Karol Wrótniak <[email protected]>
  • Loading branch information
sirmordred and koral-- authored Apr 27, 2022
1 parent 3425d83 commit 481f220
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/util/devutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ devutil.makeIdentity = function(serial, properties) {
var cpuPlatform = properties['ro.board.platform']
var openGLESVersion = properties['ro.opengles.version']
var marketName = properties['ro.product.device']
var customMarketName = properties['debug.stf.product.device']

openGLESVersion = parseInt(openGLESVersion, 10)
if (isNaN(openGLESVersion)) {
Expand All @@ -159,7 +160,10 @@ devutil.makeIdentity = function(serial, properties) {
model = model.substr(manufacturer.length)
}

if (marketName) {
if (customMarketName) {
marketName = customMarketName
}
else if (marketName) {
var devices = androidDeviceList.getDevicesByDeviceId(marketName)
if (devices.length > 0) {
marketName = devices[0].name
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@devicefarmer/stf-wiki": "^1.0.0",
"@julusian/jpeg-turbo": "^0.5.4",
"@slack/client": "^3.5.4",
"android-device-list": "^1.2.1",
"android-device-list": "^1.2.7",
"aws-sdk": "^2.4.13",
"basic-auth": "^1.0.3",
"bluebird": "^2.10.1",
Expand Down

0 comments on commit 481f220

Please sign in to comment.