mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-22 17:39:19 +00:00
Allow customised install arguments (#75)
* add pmInstallArgs launch config property * add missing launchActivity description correct default trace value * add launchActivity to the README * add comment describing why we look for IllegalArgumentException
This commit is contained in:
@@ -245,6 +245,7 @@ class AndroidDebugSession extends DebugSession {
|
||||
this.app_src_root = ensure_path_end_slash(args.appSrcRoot);
|
||||
this.apk_fpn = args.apkFile;
|
||||
this.manifest_fpn = args.manifestFile;
|
||||
this.pmInstallArgs = args.pmInstallArgs;
|
||||
if (typeof args.callStackDisplaySize === 'number' && args.callStackDisplaySize >= 0)
|
||||
this.callStackDisplaySize = args.callStackDisplaySize|0;
|
||||
|
||||
@@ -397,16 +398,19 @@ class AndroidDebugSession extends DebugSession {
|
||||
copyAndInstallAPK() {
|
||||
// copy the file to the device
|
||||
this.LOG('Deploying current build...');
|
||||
const device_apk_fpn = '/data/local/tmp/debug.apk';
|
||||
return this._device.adbclient.push_file({
|
||||
filepathname:'/data/local/tmp/debug.apk',
|
||||
filepathname:device_apk_fpn,
|
||||
filedata:this._apk_file_data,
|
||||
filemtime:new Date().getTime(),
|
||||
})
|
||||
.then(() => {
|
||||
// send the install command
|
||||
this.LOG('Installing...');
|
||||
const command = `pm install ${Array.isArray(this.pmInstallArgs) ? this.pmInstallArgs.join(' ') : '-r'} ${device_apk_fpn}`;
|
||||
D(command);
|
||||
return this._device.adbclient.shell_cmd({
|
||||
command:'pm install -r /data/local/tmp/debug.apk',
|
||||
command,
|
||||
untilclosed:true,
|
||||
})
|
||||
})
|
||||
@@ -418,6 +422,12 @@ class AndroidDebugSession extends DebugSession {
|
||||
if (m) {
|
||||
return $.Deferred().rejectWith(this, [new Error('Installation failed. ' + m[0])]);
|
||||
}
|
||||
// now the 'pm install' command can have user-defined arguments, we must check that the command
|
||||
// is not rejected because of bad values
|
||||
m = stdout.match(/^java.lang.IllegalArgumentException:.+/m);
|
||||
if (m) {
|
||||
return $.Deferred().rejectWith(this, [new Error('Installation failed. ' + m[0])]);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user