Imgur
现在需要完善加入一个提示词 Login 类似如下效果,参考了网上博客和 gpt 都是各种报错,附上修改代码,请教一下有啥方法可以实现,谢谢
Imgur
system/core$
diff --git a/adb/adb.cpp b/adb/adb.cpp
old mode 100644
new mode 100755
index c3e9731a3..ce1ed0b21
--- a/adb/adb.cpp
+++ b/adb/adb.cpp
@@ -99,7 +99,11 @@ apacket* get_apacket(void)
memset(&p->msg, 0, sizeof(p->msg));
return p;
}
-
+//evan add
+#if !ADB_HOST
+int accept_shell;
+#endif
+//evan end
void put_apacket(apacket *p)
{
delete p;
@@ -107,13 +111,20 @@ void put_apacket(apacket *p)
void handle_online(atransport *t)
{
+//evan add
D("adb: online");
+ LOG(INFO) online = 1;
t->SetConnectionEstablished(true);
+ #if !ADB_HOST
+ accept_shell=0;
+ #endif
+//evan end
}
void handle_offline(atransport *t)
{
+//evan add
if (t->GetConnectionState() == kCsOffline) {
LOG(INFO) serial_name() online = 0;
-
+ #if !ADB_HOST
+ accept_shell=0;
+ #endif
+//evan end
// This is necessary to avoid a race condition that occurred when a transport closes
// while a client socket is still active.
close_all_sockets(t);
@@ -329,8 +343,12 @@ static void handle_new_connection(atransport* t, apacket* p) {
send_tls_request(t);
} else if (!auth_required) {
LOG(INFO)
+//evan end
#include "sysdeps.h"
#include
@@ -50,7 +52,7 @@ void service_bootstrap_func(std::string service_name, std::function func) {
int s[2];
if (adb_socketpair(s)) {
@@ -73,10 +75,58 @@ unique_fd create_service_thread(const char* service_name, std::function= 0) {
+ close_on_exec(ret);
+ }
+ }
+ return ret;
+ }
+#endif
+//evan end
if (is_socket_spec(name)) {
std::string error;
if (!socket_spec_connect(&ret, name, nullptr, nullptr, &error)) {