安卓自动化的一些API

python 复制代码
def run_adb_command():
    pass

创建指定大小的文件

python 复制代码
def create_random_file(file_path: str, file_size: int = 1024):
        # 1M = 1024 * 1024
        if file_path.endswith("/"):
            raise Exception(f"请输入正确的文件路径:{file_path}")
        file_name = file_path.rsplit("/", 1)[1]
        cmd = "dd if=/dev/zero of={} bs={} count=1".format(file_path, file_size)
        result = run_adb_command(func=cmd)
        if file_name in run_adb_command(func=f"ls {file_path}"):
            return True
        raise Exception(f"创建文件失败: {result}")

查看安卓系统时间

python 复制代码
def get_android_time(format: str = "+%Y%m%d%H%M%S"):
        """
            format:
                "+%Y%m%d%H%M%S": 20240612042045
                "+%F": 2024-06-12
                "+%R": 04:20
                "+%s": 1718241156
        """
        return run_adb_command(func=f"date {format}")
相关推荐
开维游戏引擎1 小时前
AI自动生成游戏时,deepseek和mimo对比
android·游戏·语言模型·游戏引擎·ai编程
江畔柳前堤1 小时前
github实战指南01-账号配置与 SSH 密钥
运维·人工智能·深度学习·ssh·github·pyqt·信号处理
Moshow郑锴3 小时前
Ubuntu 26.04 中文输入法 : fcitx5+Rime中州韵引擎
linux·运维·ubuntu
小赖同学啊5 小时前
智能连接器集群化高可用生产方案
linux·运维·人工智能
wanghao6664555 小时前
DevOps 从入门到实践:构建高效交付流水线
运维·devops
qq_546937275 小时前
从“能用”到“超神”,DeepSeek++给网页版装上“大脑”和“手脚”,支持长期记忆、MCP工具与自动化任务!
运维·自动化
ZStack开发者社区5 小时前
基于AI Agent的ZCF API文档全链路自动化
运维·人工智能·自动化
Moshow郑锴6 小时前
Ubuntu 26.04 更换阿里云源镜像
linux·运维·ubuntu
迷糊小面包7 小时前
Docker Hadopp集群版部署搭建及常规问题解疑
运维·docker·容器
ShineWinsu7 小时前
对于Linux:线程概念与分页存储管理的解析
linux·运维·服务器·面试·线程·进程·虚拟空间地址