зеркало из https://github.com/mozilla/gecko-dev.git
Bug 991589 - Use ro.product.model to identify USB devices. r=jryans
This commit is contained in:
Родитель
9611e51a76
Коммит
45d7df3ae9
|
@ -533,7 +533,10 @@ exports.AppManager = AppManager = {
|
|||
_updateUSBRuntimes: function() {
|
||||
this.runtimeList.usb = [];
|
||||
for (let id of Devices.available()) {
|
||||
this.runtimeList.usb.push(new USBRuntime(id));
|
||||
let r = new USBRuntime(id);
|
||||
this.runtimeList.usb.push(r);
|
||||
r.updateNameFromADB().then(
|
||||
() => this.update("runtimelist"), () => {});
|
||||
}
|
||||
this.update("runtimelist");
|
||||
},
|
||||
|
|
|
@ -33,7 +33,24 @@ USBRuntime.prototype = {
|
|||
return this.id;
|
||||
},
|
||||
getName: function() {
|
||||
return this.id;
|
||||
return this._productModel || this.id;
|
||||
},
|
||||
updateNameFromADB: function() {
|
||||
if (this._productModel) {
|
||||
return promise.resolve();
|
||||
}
|
||||
let device = Devices.getByName(this.id);
|
||||
let deferred = promise.defer();
|
||||
if (device && device.shell) {
|
||||
device.shell("getprop ro.product.model").then(stdout => {
|
||||
this._productModel = stdout;
|
||||
deferred.resolve();
|
||||
}, () => {});
|
||||
} else {
|
||||
this._productModel = null;
|
||||
deferred.reject();
|
||||
}
|
||||
return deferred.promise;
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче