Update adb.js

This commit is contained in:
Namhyeon Go 2022-03-02 18:05:34 +09:00 committed by GitHub
parent 9ac5d5003f
commit 86f8dcfb7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,15 +36,23 @@ function ADBObject() {
};
this.getProperty = function(id, name) {
return SHELL.exec([this.binPath, "-s", id, "shell", "getprop", name]);
return this.sendShell(id, ["getprop", name]);
};
this.disableService = function(id, name) {
return SHELL.exec([this.binPath, "-s", id, "shell", "svc", name, "disable"]);
return this.sendShell(id, ["svc", name, "disable"]);
};
this.enableService = function(id, name) {
return SHELL.exec([this.binPath, "-s", id, "shell", "svc", name, "enable"]);
return this.sendShell(id, ["svc", name, "enable"]);
};
this.sendShell = function(id, args) {
try {
return SHELL.exec([this.binPath, "-s", id, "shell"].concat(args));
} catch (e) {
return "";
}
};
}
@ -52,6 +60,6 @@ exports.create = function() {
return new ADBObject();
};
exports.VERSIONINFO = "Android Debug Bridge Interface (adb.js) version 0.1";
exports.VERSIONINFO = "Android Debug Bridge Interface (adb.js) version 0.2";
exports.global = global;
exports.require = global.require;