[core] add meta mobileWidth and mobileHeight params
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const exec = require('./exec');
|
||||
const run = require('../run/index');
|
||||
const {StringWritable} = require('./tail');
|
||||
const Command = require('../run/command');
|
||||
|
||||
const through = require('through2');
|
||||
@@ -125,10 +125,35 @@ class Android extends Sdk {
|
||||
});
|
||||
}
|
||||
|
||||
_installApk(filename, pack) {
|
||||
this.log.i('install *%s*', filename);
|
||||
return this.adb(['install', '-r', '-d', filename])
|
||||
.then(() => {
|
||||
return false;
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.includes('INSTALL_FAILED_UPDATE_INCOMPATIBLE')) {
|
||||
this.log.w('!INSTALL FAILED UPDATE INCOMPATIBLE!');
|
||||
return true;
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
})
|
||||
.then(reinstall => {
|
||||
if (reinstall) {
|
||||
this.log.i('uninstall *%s*', pack);
|
||||
return this.adb(['uninstall', pack]).then(() => {
|
||||
this.log.i('install *%s*', filename);
|
||||
return this.adb(['install', '-r', '-d', filename]);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
install() {
|
||||
const self = this;
|
||||
return through.obj(function(file, enc, callback) {
|
||||
self.adb(['install', '-r', file.path]).then(() => {
|
||||
self._installApk(file.path, file.package).then(() => {
|
||||
this.push(file);
|
||||
callback();
|
||||
});
|
||||
@@ -139,6 +164,7 @@ class Android extends Sdk {
|
||||
const self = this;
|
||||
return through.obj(function(file, enc, callback) {
|
||||
const name = `${file.package}/${file.activity}`;
|
||||
self.log.i('start *%s*', name);
|
||||
self.adb(['shell', 'am', 'start', '-n', name]).then(() => {
|
||||
setTimeout(() => {
|
||||
self.adb(['shell', `"ps | grep ${file.package}"`]).then(result => {
|
||||
@@ -155,7 +181,14 @@ class Android extends Sdk {
|
||||
const self = this;
|
||||
return through.obj(function(file, enc, callback) {
|
||||
const cmd = `${self.adbBin} logcat --pid ${file.pid}`;
|
||||
this.push(new Command(cmd).exec());
|
||||
const command = new Command(cmd).exec();
|
||||
this.push(command);
|
||||
command.contents.pipe(new StringWritable(line => {
|
||||
if (line.includes('SDL') && (line.includes('onDestroy()') || line.includes('onStop()'))) {
|
||||
callback();
|
||||
throw 'Exit'; // ToDo:
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user