Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add market name to device properties. #1002

Merged
merged 4 commits into from
Jan 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/db/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ dbapi.saveDeviceIdentity = function(serial, identity) {
, product: identity.product
, cpuPlatform: identity.cpuPlatform
, openGLESVersion: identity.openGLESVersion
, marketName: identity.marketName
}))
}

Expand Down
1 change: 1 addition & 0 deletions lib/units/device/plugins/solo.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module.exports = syrup.serial()
, identity.product
, identity.cpuPlatform
, identity.openGLESVersion
, identity.marketName
))
])
})
Expand Down
10 changes: 10 additions & 0 deletions lib/util/devutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var util = require('util')

var split = require('split')
var Promise = require('bluebird')
var androidDeviceList = require('android-device-list')

var devutil = module.exports = Object.create(null)

Expand Down Expand Up @@ -135,6 +136,7 @@ devutil.makeIdentity = function(serial, properties) {
var product = properties['ro.product.name']
var cpuPlatform = properties['ro.board.platform']
var openGLESVersion = properties['ro.opengles.version']
var marketName = properties['ro.product.device']

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

if (marketName) {
var devices = androidDeviceList.getDevicesByDeviceId(marketName)
if (devices.length > 0) {
marketName = devices[0].name
}
}

// Clean up remaining model name
// model = model.replace(/[_ ]/g, '')
return {
Expand All @@ -171,5 +180,6 @@ devutil.makeIdentity = function(serial, properties) {
, product: product
, cpuPlatform: cpuPlatform
, openGLESVersion: openGLESVersion
, marketName: marketName
}
}
1 change: 1 addition & 0 deletions lib/wire/wire.proto
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ message DeviceIdentityMessage {
optional string product = 12;
optional string cpuPlatform = 13;
optional string openGLESVersion = 14;
optional string marketName = 15;
}

message DeviceProperty {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"adbkit": "^2.11.1",
"adbkit-apkreader": "^3.1.1",
"adbkit-monkey": "^1.0.1",
"android-device-list": "^1.2.1",
"aws-sdk": "^2.4.13",
"basic-auth": "^1.0.3",
"bluebird": "^2.10.1",
Expand Down
6 changes: 6 additions & 0 deletions res/app/device-list/column/device-column-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ module.exports = function DeviceColumnService($filter, gettext) {
return device.manufacturer || ''
}
})
, marketName: TextCell({
title: gettext('Market name')
, value: function(device) {
return device.marketName || ''
}
})
, sdk: NumberCell({
title: gettext('SDK')
, defaultOrder: 'desc'
Expand Down
4 changes: 4 additions & 0 deletions res/app/device-list/device-list-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ module.exports = function DeviceListCtrl(
name: 'manufacturer'
, selected: false
}
, {
name: 'marketName'
, selected: false
}
, {
name: 'sdk'
, selected: false
Expand Down