Skip to content

Commit

Permalink
3.120
Browse files Browse the repository at this point in the history
  • Loading branch information
rev1si0n committed Mar 10, 2023
1 parent a36627c commit 3b58313
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 38 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
3.120
* 现 LAMDA 已支持本身作为代理
* 新增获取系统最近 Activity 的接口
* 修复一个协议中的 race condition (maybe)
* 增加部分命令,移除 SQLite db view
* 实验性的 H.264 投屏

3.108
* 优化网络断连处理逻辑
* 增加 Redroid (remote android) 支持
Expand Down
107 changes: 77 additions & 30 deletions README.md

Large diffs are not rendered by default.

Binary file removed image/dbview.gif
Binary file not shown.
2 changes: 1 addition & 1 deletion lamda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#
# Distributed under MIT license.
# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
__version__ = "3.108"
__version__ = "3.120"
23 changes: 19 additions & 4 deletions lamda/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
import warnings
import builtins
import logging
import atexit
import grpc

from urllib.parse import quote
from collections import defaultdict
from os.path import basename, dirname, expanduser, join as joinpath
from google.protobuf.json_format import MessageToDict, MessageToJson
from grpc_interceptor import ClientInterceptor
from google.protobuf.json_format import MessageToDict
from google.protobuf.message import Message
from asn1crypto import pem, x509

Expand Down Expand Up @@ -71,6 +70,7 @@
"Point",
"Bound",
"load_proto",
"to_dict",
"Device",
"logger",
]
Expand Down Expand Up @@ -219,6 +219,11 @@ def load_proto(name):
return grpc.protos_and_services(name)


def to_dict(prot):
r = MessageToJson(prot, preserving_proto_field_name=True)
return json.loads(r)


class BaseServiceStub(object):
def __init__(self, stub):
self.stub = stub
Expand Down Expand Up @@ -868,7 +873,7 @@ def query_launch_activity(self):
"""
req = protos.ApplicationRequest(name=self.applicationId)
r = self.stub.queryLaunchActivity(req)
return r
return to_dict(r)
def is_permission_granted(self, permission):
"""
检查是否已经授予应用某权限(应用需要运行时获取的权限)
Expand Down Expand Up @@ -984,6 +989,13 @@ def enumerate_all_pkg_names(self):
"""
r = self.stub.enumerateAllPkgNames(protos.Empty())
return r.names
def get_last_activities(self, count=3):
"""
获取系统中最后一个活动的详细信息
"""
req = protos.Integer(value=count)
r = self.stub.getLastActivities(req).activities
return list(map(to_dict, r))
def start_activity(self, **activity):
"""
启动 activity(任意, always return true)
Expand Down Expand Up @@ -1637,6 +1649,8 @@ def enumerate_all_pkg_names(self):
return self.stub("Application").enumerate_all_pkg_names()
def enumerate_running_processes(self):
return self.stub("Application").enumerate_running_processes()
def get_last_activities(self, count=3):
return self.stub("Application").get_last_activities(count=count)
def start_activity(self, **activity):
return self.stub("Application").start_activity(**activity)
def application(self, applicationId):
Expand Down Expand Up @@ -1807,7 +1821,8 @@ def __exit__(self, type, value, traceback):
help="service ip address")
parser.add_argument("-port", type=int, default=65000,
help="service port")
parser.add_argument("-cert", type=str, default=None,
crt = os.environ.get("CERTIFICATE", None)
parser.add_argument("-cert", type=str, default=crt,
help="ssl cert")
args = parser.parse_args()

Expand Down
16 changes: 13 additions & 3 deletions lamda/rpc/application.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,23 @@ message ApplicationActivityRequest {
repeated string categories = 6;
int64 flags = 7;
bool debug = 8;
string data = 9;
}

message ApplicationActivityInfo {
string package = 1;
string component = 2;
string action = 3;
repeated string categories = 4;
string action = 2;
string category = 3;
string component = 4;
google.protobuf.Struct extras = 5;
repeated string categories = 6;
int64 flags = 7;
bool debug = 8;
string data = 9;
}

message ApplicationActivityInfoList {
repeated ApplicationActivityInfo activities = 1;
}

message ApplicationPermissions {
Expand Down
1 change: 1 addition & 0 deletions lamda/rpc/services.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ service Application {
rpc getPermissions(ApplicationRequest) returns (ApplicationPermissions) {}
rpc resetApplicationData(ApplicationRequest) returns (Boolean) {}
rpc deleteApplicationCache(ApplicationRequest) returns (Boolean) {}
rpc getLastActivities(Integer) returns (ApplicationActivityInfoList) {}
rpc startActivity(ApplicationActivityRequest) returns (Boolean) {}
rpc applicationInfo(ApplicationRequest) returns (ApplicationInfo) {}
rpc startApplication(ApplicationRequest) returns (Boolean) {}
Expand Down

0 comments on commit 3b58313

Please sign in to comment.