基于android12
修改文件位置:system/core/adb/daemon/shell_service.cpp
cpp
static std::string GetHostName() {
char buf[HOST_NAME_MAX];
if (gethostname(buf, sizeof(buf)) != -1 && strcmp(buf, "localhost") != 0) return buf;
// 在此处return你想return的任何string
return android::base::GetProperty("ro.product.device", "android");
}
修改后make adbd
编译的产物在:system/apex/com.android.adbd/bin/adbd
替换设备中的文件,重启。