зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1542286 - Show the application version instead of the Gecko version for Fenix runtimes r=daisuke
Depends on D29377 Differential Revision: https://phabricator.services.mozilla.com/D29462 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
590a0556ef
Коммит
f828dbc07e
|
@ -148,6 +148,11 @@ function connectRuntime(id) {
|
|||
// by the Device actor.
|
||||
const runtimeName = runtime.isFenix ? runtime.name : deviceDescription.name;
|
||||
|
||||
// For Fenix runtimes, the version we should display is the application version
|
||||
// retrieved from ADB, and not the Gecko version returned by the Device actor.
|
||||
const version = runtime.isFenix ?
|
||||
runtime.extra.adbPackageVersion : deviceDescription.version;
|
||||
|
||||
const runtimeDetails = {
|
||||
clientWrapper,
|
||||
compatibilityReport,
|
||||
|
@ -159,7 +164,7 @@ function connectRuntime(id) {
|
|||
name: runtimeName,
|
||||
os: deviceDescription.os,
|
||||
type: runtime.type,
|
||||
version: deviceDescription.version,
|
||||
version,
|
||||
},
|
||||
isMultiE10s: deviceDescription.isMultiE10s,
|
||||
serviceWorkersAvailable,
|
||||
|
@ -386,6 +391,7 @@ function updateUSBRuntimes(adbRuntimes) {
|
|||
extra: {
|
||||
connectionParameters,
|
||||
deviceName: adbRuntime.deviceName,
|
||||
adbPackageVersion: adbRuntime.versionName,
|
||||
},
|
||||
isConnecting: false,
|
||||
isConnectionFailed: false,
|
||||
|
|
|
@ -19,6 +19,7 @@ class UsbRuntime {
|
|||
this.isFenix = adbRuntime.isFenix;
|
||||
this.isUnavailable = false;
|
||||
this.isUnplugged = false;
|
||||
this.versionName = adbRuntime.versionName;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +37,7 @@ class UnavailableUsbRuntime {
|
|||
this.isFenix = false;
|
||||
this.isUnavailable = true;
|
||||
this.isUnplugged = false;
|
||||
this.versionName = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,6 +55,7 @@ class UnpluggedUsbRuntime {
|
|||
this.isFenix = false;
|
||||
this.isUnavailable = true;
|
||||
this.isUnplugged = true;
|
||||
this.versionName = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,6 +105,10 @@ const runtimeExtra = {
|
|||
// device name
|
||||
// unavailable on this-firefox and network-location runtimes
|
||||
deviceName: PropTypes.string,
|
||||
|
||||
// version of the application coming from ADB, only available via USB. Useful for Fenix
|
||||
// runtimes, because the version can't be retrieved from Service.appInfo.
|
||||
adbPackageVersion: PropTypes.string,
|
||||
};
|
||||
|
||||
const runtime = {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
const { RuntimeTypes } = require("devtools/client/webide/modules/runtime-types");
|
||||
const { prepareTCPConnection } = require("devtools/shared/adb/commands/index");
|
||||
const { shell } = require("devtools/shared/adb/commands/index");
|
||||
|
||||
class AdbRuntime {
|
||||
constructor(adbDevice, socketPath) {
|
||||
|
@ -15,6 +16,16 @@ class AdbRuntime {
|
|||
this._socketPath = socketPath;
|
||||
}
|
||||
|
||||
async init() {
|
||||
const packageName = this._packageName();
|
||||
const query = `dumpsys package ${packageName} | grep versionName`;
|
||||
const versionNameString = await shell(this._adbDevice.id, query);
|
||||
const matches = versionNameString.match(/versionName=([\d.]+)/);
|
||||
if (matches && matches[1]) {
|
||||
this._versionName = matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
get id() {
|
||||
return this._adbDevice.id + "|" + this._socketPath;
|
||||
}
|
||||
|
@ -31,6 +42,10 @@ class AdbRuntime {
|
|||
return this._adbDevice.name;
|
||||
}
|
||||
|
||||
get versionName() {
|
||||
return this._versionName;
|
||||
}
|
||||
|
||||
get shortName() {
|
||||
const packageName = this._packageName();
|
||||
|
||||
|
|
|
@ -134,7 +134,13 @@ class Adb extends EventEmitter {
|
|||
|
||||
async _getDeviceRuntimes(device) {
|
||||
const socketPaths = [...await device.getRuntimeSocketPaths()];
|
||||
return socketPaths.map(socketPath => new AdbRuntime(device, socketPath));
|
||||
const runtimes = [];
|
||||
for (const socketPath of socketPaths) {
|
||||
const runtime = new AdbRuntime(device, socketPath);
|
||||
await runtime.init();
|
||||
runtimes.push(runtime);
|
||||
}
|
||||
return runtimes;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче