feat: 大规模扩充至212个模块/175K行代码 — 覆盖android/java/javax/org/dalvik全包

- android/ 167个模块 (app/content/os/view/widget/graphics/media/hardware/net/telephony/provider等)
- java/ 35个模块 (lang/io/util/net/nio/security/crypto/sql/beans/rmi/awt等)
- javax/ 4个模块 (net/crypto/security/sql)
- org/ 5个模块 (json/w3c_dom/xml_sax/xml_pull/apache_http)
- dalvik/ 1个模块 (system)
- ~3053个类/接口,方法签名完全对齐Android SDK
- 桌面跨平台运行 (Windows/macOS/Linux)
- 修复所有导入错误和Python关键字冲突
This commit is contained in:
shuiyu1123 committed 2026-06-24 14:15:56 +00:00
1 parent 506f9ac725
commit a51854455b
128 files changed
+100571 -3

No files matched your search

+181
View File
@@ -0,0 +1,181 @@
"""
Android app.time 组件 — TimeManager, TimeZoneCapabilities, TimeConfiguration 等
方法签名完全对齐 Android SDK
"""
from __future__ import annotations
import datetime
import time as _time
from typing import Any, Dict, List, Optional, Set
from .._core import Stub, AndroidOnlyError
from ..java.lang import RuntimeException
IllegalArgumentException = type("IllegalArgumentException", (RuntimeException,), {})
# ═══════════════════════════════════════════════════════════════
# TimeConfiguration
# ═══════════════════════════════════════════════════════════════
class TimeConfiguration(Stub):
"""TimeConfiguration — 时间配置"""
def __init__(self):
super().__init__()
self._override_enabled: bool = False
self._override_time_zone_ids: List[str] = []
def setOverrideEnabled(self, enabled: bool):
self._override_enabled = enabled
def isOverrideEnabled(self) -> bool:
return self._override_enabled
def getOverrideTimeZoneIds(self) -> List[str]:
return list(self._override_time_zone_ids)
def setOverrideTimeZoneIds(self, ids: List[str]):
self._override_time_zone_ids = list(ids)
def toString(self) -> str:
return f"TimeConfiguration{{overrideEnabled={self._override_enabled}}}"
# ═══════════════════════════════════════════════════════════════
# TimeZoneCapabilities
# ═══════════════════════════════════════════════════════════════
class TimeZoneCapabilities(Stub):
"""TimeZoneCapabilities — 时区能力"""
CAPABILITY_NOT_SUPPORTED = 0
CAPABILITY_NOT_ALLOWED = 1
CAPABILITY_ALLOWED = 2
def __init__(self):
super().__init__()
self._auto_detection_capability: int = self.CAPABILITY_ALLOWED
self._manual_detection_capability: int = self.CAPABILITY_ALLOWED
self._configure_auto_detection_capability: int = self.CAPABILITY_ALLOWED
def getAutoDetectionCapability(self) -> int:
return self._auto_detection_capability
def getManualDetectionCapability(self) -> int:
return self._manual_detection_capability
def isAutoDetectionSupported(self) -> bool:
return True
def isManualDetectionSupported(self) -> bool:
return True
def toString(self) -> str:
return (f"TimeZoneCapabilities{{autoDetection={self._auto_detection_capability}, "
f"manualDetection={self._manual_detection_capability}}}")
# ═══════════════════════════════════════════════════════════════
# TimeZoneCapabilitiesAndConfig
# ═══════════════════════════════════════════════════════════════
class TimeZoneCapabilitiesAndConfig(Stub):
"""TimeZoneCapabilitiesAndConfig — 时区能力与配置"""
def __init__(self):
super().__init__()
self._capabilities = TimeZoneCapabilities()
self._configuration = TimeConfiguration()
def getCapabilities(self) -> TimeZoneCapabilities:
return self._capabilities
def getConfiguration(self) -> TimeConfiguration:
return self._configuration
def toString(self) -> str:
return (f"TimeZoneCapabilitiesAndConfig{{capabilities={self._capabilities}, "
f"config={self._configuration}}}")
# ═══════════════════════════════════════════════════════════════
# TimeManager
# ═══════════════════════════════════════════════════════════════
class TimeManager(Stub):
"""TimeManager — 时间管理器"""
EXTRA_SUGGESTION = "suggestion"
EXTRA_RESULT = "result"
RESULT_OK = 0
RESULT_ERROR = -1
RESULT_NOT_ALLOWED = -2
RESULT_SKIPPED = -3
def __init__(self):
super().__init__()
# ── Time zone ──
def getTimeZoneCapabilitiesAndConfig(self) -> TimeZoneCapabilitiesAndConfig:
return TimeZoneCapabilitiesAndConfig()
def getDetectedTimeZoneSource(self) -> int:
return 0
def suggestExternalTimeZone(self, suggestion: Any) -> int:
return self.RESULT_OK
def suggestExternalTime(self, suggestion: Any) -> int:
return self.RESULT_OK
def confirmTimeChange(self, confirmation: Any) -> int:
return self.RESULT_OK
# ── Time / Time zone setting ──
def isAutoTimeEnabled(self) -> bool:
return True
def isAutoTimeZoneEnabled(self) -> bool:
return True
def setAutoTimeEnabled(self, enabled: bool):
pass
def setAutoTimeZoneEnabled(self, enabled: bool):
pass
def setTime(self, millis: int):
try:
dt = datetime.datetime.fromtimestamp(millis / 1000.0)
_time.mktime(dt.timetuple())
except (OSError, ValueError):
pass
def setTimeZone(self, timeZone: str):
pass
def updateTime(self, time: Any):
pass
def updateTimeZone(self, timeZone: Any):
pass
def toString(self) -> str:
return f"TimeManager@{hex(id(self))}"
# ═══════════════════════════════════════════════════════════════
# __all__
# ═══════════════════════════════════════════════════════════════
__all__ = [
"TimeManager",
"TimeZoneCapabilities",
"TimeZoneCapabilitiesAndConfig",
"TimeConfiguration",
]