Skip to content

Commit 3b58313

Browse files
committed
3.120
1 parent a36627c commit 3b58313

7 files changed

Lines changed: 118 additions & 38 deletions

File tree

CHANGELOG.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
3.120
2+
* 现 LAMDA 已支持本身作为代理
3+
* 新增获取系统最近 Activity 的接口
4+
* 修复一个协议中的 race condition (maybe)
5+
* 增加部分命令,移除 SQLite db view
6+
* 实验性的 H.264 投屏
7+
18
3.108
29
* 优化网络断连处理逻辑
310
* 增加 Redroid (remote android) 支持

README.md

Lines changed: 77 additions & 30 deletions
Large diffs are not rendered by default.

image/dbview.gif

-1.49 MB
Binary file not shown.

lamda/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
#
33
# Distributed under MIT license.
44
# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5-
__version__ = "3.108"
5+
__version__ = "3.120"

lamda/client.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@
1414
import warnings
1515
import builtins
1616
import logging
17-
import atexit
1817
import grpc
1918

2019
from urllib.parse import quote
2120
from collections import defaultdict
2221
from os.path import basename, dirname, expanduser, join as joinpath
22+
from google.protobuf.json_format import MessageToDict, MessageToJson
2323
from grpc_interceptor import ClientInterceptor
24-
from google.protobuf.json_format import MessageToDict
2524
from google.protobuf.message import Message
2625
from asn1crypto import pem, x509
2726

@@ -71,6 +70,7 @@
7170
"Point",
7271
"Bound",
7372
"load_proto",
73+
"to_dict",
7474
"Device",
7575
"logger",
7676
]
@@ -219,6 +219,11 @@ def load_proto(name):
219219
return grpc.protos_and_services(name)
220220

221221

222+
def to_dict(prot):
223+
r = MessageToJson(prot, preserving_proto_field_name=True)
224+
return json.loads(r)
225+
226+
222227
class BaseServiceStub(object):
223228
def __init__(self, stub):
224229
self.stub = stub
@@ -868,7 +873,7 @@ def query_launch_activity(self):
868873
"""
869874
req = protos.ApplicationRequest(name=self.applicationId)
870875
r = self.stub.queryLaunchActivity(req)
871-
return r
876+
return to_dict(r)
872877
def is_permission_granted(self, permission):
873878
"""
874879
检查是否已经授予应用某权限(应用需要运行时获取的权限)
@@ -984,6 +989,13 @@ def enumerate_all_pkg_names(self):
984989
"""
985990
r = self.stub.enumerateAllPkgNames(protos.Empty())
986991
return r.names
992+
def get_last_activities(self, count=3):
993+
"""
994+
获取系统中最后一个活动的详细信息
995+
"""
996+
req = protos.Integer(value=count)
997+
r = self.stub.getLastActivities(req).activities
998+
return list(map(to_dict, r))
987999
def start_activity(self, **activity):
9881000
"""
9891001
启动 activity(任意, always return true)
@@ -1637,6 +1649,8 @@ def enumerate_all_pkg_names(self):
16371649
return self.stub("Application").enumerate_all_pkg_names()
16381650
def enumerate_running_processes(self):
16391651
return self.stub("Application").enumerate_running_processes()
1652+
def get_last_activities(self, count=3):
1653+
return self.stub("Application").get_last_activities(count=count)
16401654
def start_activity(self, **activity):
16411655
return self.stub("Application").start_activity(**activity)
16421656
def application(self, applicationId):
@@ -1807,7 +1821,8 @@ def __exit__(self, type, value, traceback):
18071821
help="service ip address")
18081822
parser.add_argument("-port", type=int, default=65000,
18091823
help="service port")
1810-
parser.add_argument("-cert", type=str, default=None,
1824+
crt = os.environ.get("CERTIFICATE", None)
1825+
parser.add_argument("-cert", type=str, default=crt,
18111826
help="ssl cert")
18121827
args = parser.parse_args()
18131828

lamda/rpc/application.proto

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,23 @@ message ApplicationActivityRequest {
2929
repeated string categories = 6;
3030
int64 flags = 7;
3131
bool debug = 8;
32+
string data = 9;
3233
}
3334

3435
message ApplicationActivityInfo {
3536
string package = 1;
36-
string component = 2;
37-
string action = 3;
38-
repeated string categories = 4;
37+
string action = 2;
38+
string category = 3;
39+
string component = 4;
40+
google.protobuf.Struct extras = 5;
41+
repeated string categories = 6;
42+
int64 flags = 7;
43+
bool debug = 8;
44+
string data = 9;
45+
}
46+
47+
message ApplicationActivityInfoList {
48+
repeated ApplicationActivityInfo activities = 1;
3949
}
4050

4151
message ApplicationPermissions {

lamda/rpc/services.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ service Application {
3232
rpc getPermissions(ApplicationRequest) returns (ApplicationPermissions) {}
3333
rpc resetApplicationData(ApplicationRequest) returns (Boolean) {}
3434
rpc deleteApplicationCache(ApplicationRequest) returns (Boolean) {}
35+
rpc getLastActivities(Integer) returns (ApplicationActivityInfoList) {}
3536
rpc startActivity(ApplicationActivityRequest) returns (Boolean) {}
3637
rpc applicationInfo(ApplicationRequest) returns (ApplicationInfo) {}
3738
rpc startApplication(ApplicationRequest) returns (Boolean) {}

0 commit comments

Comments
 (0)