Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adbkit

Package Overview
Dependencies
Maintainers
2
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adbkit - npm Package Compare versions

Comparing version 2.0.14 to 2.0.15

lib/adb/command/host-transport/startservice.js

31

lib/adb/client.js
(function() {
var ClearCommand, Client, Connection, ForwardCommand, FrameBufferCommand, GetDevicePathCommand, GetFeaturesCommand, GetPackagesCommand, GetPropertiesCommand, GetSerialNoCommand, GetStateCommand, HostDevicesCommand, HostDevicesWithPathsCommand, HostKillCommand, HostTrackDevicesCommand, HostTransportCommand, HostVersionCommand, InstallCommand, IsInstalledCommand, ListForwardsCommand, LogCommand, Logcat, LogcatCommand, Monkey, MonkeyCommand, Parser, ProcStat, Promise, RebootCommand, RemountCommand, ScreencapCommand, ShellCommand, StartActivityCommand, Sync, SyncCommand, TcpCommand, TcpUsbServer, TrackJdwpCommand, UninstallCommand, WaitBootCompleteCommand, debug;
var ClearCommand, Client, Connection, ForwardCommand, FrameBufferCommand, GetDevicePathCommand, GetFeaturesCommand, GetPackagesCommand, GetPropertiesCommand, GetSerialNoCommand, GetStateCommand, HostDevicesCommand, HostDevicesWithPathsCommand, HostKillCommand, HostTrackDevicesCommand, HostTransportCommand, HostVersionCommand, InstallCommand, IsInstalledCommand, ListForwardsCommand, LogCommand, Logcat, LogcatCommand, Monkey, MonkeyCommand, Parser, ProcStat, Promise, RebootCommand, RemountCommand, ScreencapCommand, ShellCommand, StartActivityCommand, StartServiceCommand, Sync, SyncCommand, TcpCommand, TcpUsbServer, TrackJdwpCommand, UninstallCommand, WaitBootCompleteCommand, debug;

@@ -62,2 +62,4 @@ Monkey = require('adbkit-monkey');

StartServiceCommand = require('./command/host-transport/startservice');
SyncCommand = require('./command/host-transport/sync');

@@ -86,2 +88,4 @@

Client = (function() {
var NoUserOptionError;
function Client(options) {

@@ -374,5 +378,24 @@ var _base, _base1;

return new StartActivityCommand(transport).execute(options);
}).nodeify(callback);
})["catch"](NoUserOptionError, (function(_this) {
return function() {
options.user = null;
return _this.startActivity(serial, options);
};
})(this)).nodeify(callback);
};
Client.prototype.startService = function(serial, options, callback) {
return this.transport(serial).then(function(transport) {
if (!(options.user || options.user === null)) {
options.user = 0;
}
return new StartServiceCommand(transport).execute(options);
})["catch"](NoUserOptionError, (function(_this) {
return function() {
options.user = null;
return _this.startService(serial, options);
};
})(this)).nodeify(callback);
};
Client.prototype.syncService = function(serial, callback) {

@@ -426,2 +449,6 @@ return this.transport(serial).then(function(transport) {

NoUserOptionError = function(err) {
return err.message.indexOf('--user') !== -1;
};
return Client;

@@ -428,0 +455,0 @@

57

lib/adb/command/host-transport/startactivity.js

@@ -36,2 +36,39 @@ (function() {

var args;
args = this._intentArgs(options);
if (options.debug) {
args.push('-D');
}
if (options.wait) {
args.push('-W');
}
if (options.user || options.user === 0) {
args.push('--user', this._escape(options.user));
}
return this._run('start', args);
};
StartActivityCommand.prototype._run = function(command, args) {
this._send("shell:am " + command + " " + (args.join(' ')));
return this.parser.readAscii(4).then((function(_this) {
return function(reply) {
switch (reply) {
case Protocol.OKAY:
return _this.parser.searchLine(RE_ERROR)["finally"](function() {
return _this.connection.end();
}).then(function(match) {
throw new Error(match[1]);
})["catch"](Parser.PrematureEOFError, function(err) {
return true;
});
case Protocol.FAIL:
return _this.parser.readError();
default:
return _this.parser.unexpected(reply, 'OKAY or FAIL');
}
};
})(this));
};
StartActivityCommand.prototype._intentArgs = function(options) {
var args;
args = [];

@@ -67,21 +104,3 @@ if (options.extras) {

}
this._send("shell:am start " + (args.join(' ')));
return this.parser.readAscii(4).then((function(_this) {
return function(reply) {
switch (reply) {
case Protocol.OKAY:
return _this.parser.searchLine(RE_ERROR)["finally"](function() {
return _this.connection.end();
}).then(function(match) {
throw new Error(match[1]);
})["catch"](Parser.PrematureEOFError, function(err) {
return true;
});
case Protocol.FAIL:
return _this.parser.readError();
default:
return _this.parser.unexpected(reply, 'OKAY or FAIL');
}
};
})(this));
return args;
};

@@ -88,0 +107,0 @@

{
"name": "adbkit",
"version": "2.0.14",
"version": "2.0.15",
"description": "A pure Node.js client for the Android Debug Bridge.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -615,2 +615,5 @@ # adbkit

* **options** The activity configuration. The following options are available:
- **debug** Set to `true` to enable debugging.
- **wait** Set to `true` to wait for the activity to launch.
- **user** The user to run as. Not set by default. If the option is unsupported by the device, an attempt will be made to run the same command again without the user option.
- **action** The action.

@@ -633,2 +636,19 @@ - **data** The data URI, if any.

#### client.startService(serial, options[, callback])
Starts the configured service on the device. Roughly analogous to `adb shell am startservice <options>`.
* **serial** The serial number of the device. Corresponds to the device ID in `client.listDevices()`.
* **options** The service configuration. The following options are available:
- **user** The user to run as. Defaults to `0`. If the option is unsupported by the device, an attempt will be made to run the same command again without the user option.
- **action** See `client.startActivity()` for details.
- **data** See `client.startActivity()` for details.
- **mimeType** See `client.startActivity()` for details.
- **category** See `client.startActivity()` for details.
- **component** See `client.startActivity()` for details.
- **flags** See `client.startActivity()` for details.
- **extras** See `client.startActivity()` for details.
* Returns: `Promise`
* Resolves with: `true`
#### client.stat(serial, path[, callback])

@@ -635,0 +655,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc