Documentation ¶
Overview ¶
设备控制
环境路径获取
Index ¶
- func CommandExists(cmd string) bool
- func FileExists(path string) bool
- type Device
- func (d *Device) BatteryStats(pkg string) string
- func (d *Device) Cat(path string) string
- func (d *Device) Ls(path string) string
- func (d *Device) NetStats()
- func (d *Device) PmListPackages(file bool, pt PackageType, uid bool, show_versioncode bool) string
- func (d *Device) Pull(remote string, local string)
- func (d *Device) Push(local string, remote string)
- type PackageType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandExists ¶
func FileExists ¶
Types ¶
type Device ¶
type Device struct { AdbPath string // contains filtered or unexported fields }
连接设备,操作设备
func (*Device) BatteryStats ¶
func (*Device) NetStats ¶
func (d *Device) NetStats()
TODO 首次安装时间,最近更新时间 TODO 打开次数 * TODO 默认电话应用 默认短信应用 辅助功能已经开启的应用 打开设备管理的应用
// TODO 流量
最近1天的流量 最近1周的流量 最近1月的流量
https://blog.csdn.net/u012514113/article/details/135731086 流量获取方式不一样, 低版本和高版本的位置不一样。 - dumpsys netstats detail - dumpsys netstats --full --uid --tag
// 总的
mAppUidStatsMap: uid rxBytes rxPackets txBytes txPackets 10433 8195953 15523 1416948 13365 10229 186523823 134524 2989837 25572
接收的字节数,
TODO 已经授权的高危权限 ¶
获取应用的流量
https://developer.android.com/tools/dumpsys?hl=zh-cn#uid_stats - dumpsys netstats --full --uid
func (*Device) PmListPackages ¶
Prints all packages; optionally only those whose name contains the text in FILTER.
list packages [-f] [-d] [-e] [-s] [-3] [-i] [-l] [-u] [-U]
[--show-versioncode] [--apex-only] [--uid UID] [--user USER_ID] [FILTER]
Options are:
-f: see their associated file -a: all known packages (but excluding APEXes) -d: filter to only show disabled packages -e: filter to only show enabled packages -s: filter to only show system packages -3: filter to only show third party packages -i: see the installer for the packages -l: ignored (used for compatibility with older releases) -U: also show the package UID -u: also include uninstalled packages --show-versioncode: also show the version code --apex-only: only show APEX packages --uid UID: filter to only show packages with the given UID --user USER_ID: only list packages belonging to the given user
func (*Device) Pull ¶
copy files/dirs from device
pull [-a] [-z ALGORITHM] [-Z] REMOTE... LOCAL
-a: preserve file timestamp and mode -z: enable compression with a specified algorithm (any/none/brotli/lz4/zstd) -Z: disable compression
func (*Device) Push ¶
copy local files/directories to device
push [--sync] [-z ALGORITHM] [-Z] LOCAL... REMOTE
--sync: only push files that are newer on the host than the device -n: dry run: push files to device without storing to the filesystem -z: enable compression with a specified algorithm (any/none/brotli/lz4/zstd) -Z: disable compression
type PackageType ¶
type PackageType int
定义 pm list packages 的显示类型
const ( All PackageType = iota System ThridParty )
Click to show internal directories.
Click to hide internal directories.