feat: 第三轮深度完善 — SQLite/JSON/网络/媒体/文本 真实实现

SQLite真实数据库:
- SQLiteDatabase: execSQL/insert/insertOrThrow/replace/update/delete/query 用sqlite3
- 修复getVersion/setVersion用PRAGMA user_version
- 修复getMaximumSize/getPageSize/setMaximumSize/setPageSize用PRAGMA
- SQLiteStatement: execute/simpleQueryForLong/simpleQueryForString/execQuery
- SQLiteOpenHelper: onCreate/onUpgrade/onDowngrade回调正确触发
- 修复SQLiteCursor.moveToPosition越界处理
- 修复ContentValues值对提取bug

JSON真实实现:
- JSONObject: isNull/append/putOnce/putOpt/getNames
- JSONArray: 完整put/get/opt/length/toString

网络真实实现:
- NetworkInterface: getByName/getNetworkInterfaces/getHardwareAddress 用/sys/class/net+fcntl.ioctl
- InterfaceAddress: 新增类
- ConnectivityManager: getActiveNetwork/getAllNetworks 用LinuxNetwork
- WifiManager: getScanResults用nmcli, setWifiEnabled用nmcli/rfkill
- BluetoothAdapter: getAddress/getName 用bluetoothctl

媒体真实实现:
- MediaPlayer: prepare检查文件, getCurrentPosition实时计算, getDuration/getVideoWidth用ffprobe
- MediaRecorder: setVideoSize/setVideoFrameRate/setVideoEncodingBitRate配置存储
- MediaMetadataRetriever: extractMetadata用ffprobe, getFrameAtTime用ffmpeg, getEmbeddedPicture用ffmpeg

文本真实实现:
- TextUtils: split用re.split, concat/indexOf/lastIndexOf/urlEncode/urlDecode
- SpannableString: setSpan/getSpans/getSpanFlags/nextSpanTransition 真实实现
- SpannableStringBuilder: 修复append重载bug

Provider增强:
- Settings: putBoolean/getBoolean
- MediaStore: getContentUri/VOLUME常量
- ContactsContract: 补全常量和CommonDataKinds

Util增强:
- Log: w/e/wtf支持Throwable参数, 修复wtf重复定义bug
- TypedValue: 修复complexToDimension/complexToFloat/getFloat实现

修复:
- __init__.py: 补全NetworkInterface/InetAddress/MediaMetadataRetriever/SpannableStringBuilder导出

统计: 221模块, 3666类, 31005方法, 183529行
This commit is contained in:
shuiyu1123 committed 2026-06-25 00:40:59 +00:00
1 parent 4235f8692c
commit fbb8263b13
13 files changed
+1373 -146

No files matched your search

+39
View File
@@ -320,6 +320,45 @@ class LinuxBluetooth:
return LinuxBluetooth.STATE_ON
return LinuxBluetooth.STATE_OFF
@staticmethod
def get_address() -> Optional[str]:
"""获取本机蓝牙适配器地址"""
if not HAS_BLUETOOTHCTL:
return None
code, out, _ = _run(["bluetoothctl", "show"])
if code == 0 and out:
for line in out.split("\n"):
line = line.strip()
if line.startswith("Controller "):
parts = line.split()
if len(parts) >= 2:
return parts[1]
return None
@staticmethod
def get_name() -> Optional[str]:
"""获取本机蓝牙适配器名称 (Alias 优先, 回退到 Controller 行括号内名称)"""
if not HAS_BLUETOOTHCTL:
return None
code, out, _ = _run(["bluetoothctl", "show"])
if code == 0 and out:
alias = None
controller_name = None
for line in out.split("\n"):
stripped = line.strip()
if stripped.startswith("Controller ") and "(" in stripped:
start = stripped.find("(")
end = stripped.find(")", start)
if start != -1 and end != -1:
controller_name = stripped[start + 1:end]
elif stripped.startswith("Alias:"):
alias = stripped[len("Alias:"):].strip()
if alias:
return alias
if controller_name:
return controller_name
return None
@staticmethod
def enable() -> bool:
if not HAS_BLUETOOTHCTL: