MartinPSDev/Claudio
GitHub: MartinPSDev/Claudio
这是一个通过反编译并使用 Kotlin 重构 Claude 安卓客户端的开源项目,旨在为开发者提供研究现代生产级安卓应用架构、网络请求模式及安全机制的透明视图。
Stars: 0 | Forks: 0
# CLAUDIO ANDROID APP
## 关于
本项目是 Claude Android 应用的 Kotlin 重构版本,通过使用 Smali 字节码分析反编译的 APK 构建而成。其目的是了解生产级 Android 应用的架构、网络请求模式和组件结构。
## ⚠️ 重要声明
### 仅供教育用途
本仓库**仅用于教育目的**——用于研究 Android 架构、Jetpack Compose 模式、服务设计和网络实现。它不用于分发、商业用途,也不作为原始应用的功能替代品。
### 代码准确性
本仓库中的代码**可能与原始 Anthropic 应用有所不同、不完整或包含错误**。该重构基于 Smali 反编译,其中涉及对混淆字节码的解读。某些逻辑可能不准确、缺失或仅为近似实现。
### 构建与运行时错误
如果您尝试在物理设备或模拟器上编译并运行本项目,**极有可能会失败**,原因如下:
- **缺少签名密钥:** 原始 Claude 应用使用 Anthropic 的私有证书进行签名。
- **缺少 API 密钥和机密信息:** Firebase、Datadog、Sentry、Segment 及其他第三方服务需要凭据(`google-services.json`、API token 等),而这些凭据未包含在本仓库中。
- **Play Protect 限制:** Android 的 Play Protect 系统可能会在没有匹配签名的情况下阻止安装。
- **缺少 `google-services.json`:** 该文件已通过 `.gitignore` 从仓库中排除。缺少此文件 Firebase 将无法运行。
- **服务器端身份验证:** 应用使用通过专有登录流程获取的 session token 与 Anthropic 的后端进行通信。
## 项目结构
```
claudio_kotlin/
app/src/main/java/com/anthropic/claude/
│
├── agentchat/ AgentChatDestination
│
├── analytics/ AnalyticsProperties
│ ├── ads/ GooglePlayReferrer
│ ├── events/ AnalyticsEvent, PushEvents
│ └── screens/ AnalyticsScreens
│
├── api/
│ ├── account/ Account, AccountProfile, AccountSettings, AccountConsentModels,
│ │ AccountDeletableResponse, AccountRequestModels (UpdateAccountRequest,
│ │ AppStartResponse), Organization, RavenType, SubscriptionLevel
│ ├── artifacts/ ArtifactModels
│ ├── chat/ ChatConversation, ChatConversationSettings,
│ │ ChatConversationWithProjectReference, ChatCompletionEvent,
│ │ ChatCompletionRequest, ChatFeedback, ChatFeedbackType,
│ │ ChatMessage, ChatResponseTypes, ConversationSearch,
│ │ CreateChatRequest, MessageAssets, MessageAttachment,
│ │ MessageFileModels (MessageImageFile, MessageDocumentFile,
│ │ RecordToolApprovalRequest, ChatScreenParams),
│ │ MessageSender, SensitiveTextField, ToolState,
│ │ UpdatableChatConversationSettings
│ │ ├── citation/ CitationModels
│ │ ├── messages/ BellNoteDelta, CompactionStatus, CompletionMessage,
│ │ │ ContentBlock, ContentBlockDelta, FlagBlock, McpAuthRequiredEvent,
│ │ │ MessageDelta, MessageFlag, StreamEvent, TextBlock, ThinkingSummary,
│ │ │ ThinkingVoiceBlocks (ThinkingBlock, VoiceNoteBlock),
│ │ │ ToolResultBlock, ToolUseBlock, ToolUseBlockUpdateDelta,
│ │ │ UnknownContentBlock
│ │ └── tool/ ResearchModels, ResearchStatusModels
│ ├── common/ RateLimit
│ ├── consent/ ConsentModels
│ ├── conway/ ConwayModels
│ ├── errors/ ApiErrors
│ ├── events/ BatchEventLoggingResponse,
│ │ GrowthBookEvents (GrowthBookExperimentEventData,
│ │ GrowthBookFeatureEvaluationEventData)
│ ├── experience/ ExperienceModels, SpotlightContent, BannerContent
│ ├── export/ ExportModels
│ ├── feedback/ FeedbackModels
│ ├── kyc/ KycModels
│ ├── login/ CodeConfiguration, SendMagicLinkRequest,
│ │ VerifyLoginRequests (VerifyGoogleMobileRequest, VerifyMagicLinkRequest)
│ ├── mcp/ McpModels, McpServer, McpTool, DirectoryServer, DirectoryServerType
│ ├── memory/ MemorySynthesisResponse
│ ├── mobile/ MobileModels
│ ├── model/ ModelOption, ThinkingModeOption
│ ├── notification/ NotificationModels, FeaturePreference, NotificationChannelUpdateParams
│ ├── orbit/ OrbitModels
│ ├── project/ Project, ProjectActorAccount, ProjectDoc, ProjectEnums,
│ │ ProjectParams (ProjectCreateParams, ProjectUpdateParams), ProjectType
│ ├── purchase/ VerifyPurchaseResponse
│ ├── share/ ChatSnapshotModels
│ ├── styles/ StyleModels, CustomStyle, DefaultStyle
│ ├── sync/ SyncAuthModels
│ ├── tasks/ TaskModels, TaskAgentModels
│ ├── trusteddevice/ EnrollTrustedDeviceResponse
│ ├── usage/ UsageModels
│ ├── verification/ PhoneVerificationModels
│ └── wiggle/ WiggleModels
│
├── app/
│ ├── onboarding/v2/ OnboardingPage (7-step sealed)
│ ├── verification/ VerificationScreens
│ └── SettingsScreenParams
│
├── application/ ClaudeApplication
│
├── artifact/
│ ├── details/ ArtifactFullScreenParams
│ ├── dialog/ PublishArtifactParams
│ ├── model/ ArtifactMetadata, ArtifactType (9-subtype sealed)
│ └── sheet/ ArtifactSheetParams
│
├── audio/ MicrophoneAudioException
│
├── bell/
│ ├── api/ BellApiServerMessage sealed, BellApiClientMessage sealed
│ ├── assist/ ClaudeRecognitionService, ClaudeVoiceInteractionService,
│ │ ClaudeVoiceInteractionSessionService, ClaudeVoiceSession
│ ├── tts/ TTSPlaybackService
│ └── BellModeService
│
├── chat/
│ ├── bottomsheet/ ChatScreenBottomSheetModels (ChatScreenModalBottomSheetDestination)
│ │ ├── model/ ChatBottomSheetModels (ChatBottomSheetModel, ChatBottomSheetOption)
│ │ └── tool/approval/appuse/ MobileAppUseDestination (Approval, CalendarSelection)
│ ├── input/draft/ DraftMessage, QueuedSendRequest
│ ├── parse/ ParsedContentBlock (McpToolInvocation, Thinking), ParsedContentBlockId
│ │ └── sse/ ServerSentEventError, ServerSentEventException
│ ├── queue/ QueuedMessageWorkerArgs, QueuedMessageWorker
│ ├── share/ SharedChatModalBottomSheetDestination (4 destinations)
│ └── MessageSseService
│
├── chatlist/all/
│ ├── bottomsheet/ AllChatsListBottomSheetDestination
│ └── overlays/ AllChatsListOverlay
│
├── code/remote/
│ ├── bottomsheet/ CodeRemoteBottomSheetDestination (ApprovalDiffDetail/ChannelMessage/ViewCode)
│ ├── notification/ CCRPermissionActionReceiver/Worker, SessionReplyActionReceiver/Worker
│ └── CodeRemoteSessionScreenParams
│
├── configs/
│ ├── flags/ UploadConfig, FileUploadConfig, StreamSmoothingConfig,
│ │ OnboardingConfig, AgentChatWorkerTypesConfig,
│ │ AgentChatOnboardingConfig, FlagConfigs
│ └── GrowthBookConfigs (GrowthBookExposureSampleRateConfig, PersistedFeatureOverrides)
│
├── connector/auth/ McpAuthException (ExchangeFailed, Denied, StartFailed,
│ MissingCallbackParameters)
│
├── conway/
│ ├── protocol/ ConwayProtocol (ClientRegistrationRequest/Response,
│ │ ConwayExtensionMeta, AgentState, StreamMessage sealed,
│ │ RichMessage sealed, ToolResultMessage, ContainerHealthResponse)
│ │ ConwayProtocolExtras (ConwaySearchHit, PaginatedMessages,
│ │ ConwayErrorPayload, ConwayClientInfo, ContentBlock sealed,
│ │ ModelInfo, UiDemoAppDestination)
│ └── AppForegroundDetector, ConwayAppScreen, ConwayScopeHolder, ConwayWakeWorker
│
├── core/telemetry/ SilentException
├── deeplink/ DeepLinkActivity
│
├── firebase/fcm/ AnthropicFirebaseMessagingService
│ (FcmIntentExtras 11 keys, CcrActions 3 actions,
│ 17 FCM payload key constants)
│
├── login/ MagicLinkSentConfig
│
├── mainactivity/ MainActivity, AssistantOverlayActivity, IntentRouter
│
├── mcpapps/
│ ├── transport/ JsonRpc, HostCapabilities, HostContext, InitializeResult,
│ │ McpCapabilities, UiResources
│ └── McpAppModels (HydratedImageContent, McpAppFetchException,
│ ModelContextTooLargeException, DomainValidationException)
│
├── model/ IncomingPayload
│
├── models/organization/
│ ├── configtypes/ AvailableModelsConfig, ModelFallbacksConfig,
│ │ GroveConfigStrings, MobileAppUseToolConfig
│ └── DefaultModelConfig
│
├── networking/
│ ├── cookies/serializer/ SerializableCookie
│ └── AnthropicApiClient
│
├── policy/ PermissionsRationaleActivity
│
├── project/
│ ├── create/ CreateTemplateProjectScreenParams, UploadMaterialsScreenParams
│ ├── details/ ProjectDetailsScreenParams, ProjectDetailsDialogDestination
│ │ └── custominstructions/ CustomInstructionsDialogRoute
│ ├── knowledge/ ProjectKnowledgeParams
│ └── menu/ ProjectItemMenuDialogDestination (Delete/Rename/Dismissed)
│
├── protos/push/ ConwayWakeRequest (Wire proto)
│
├── sessions/
│ ├── api/ ControlRequestContent (11 fields + PermissionUpdate)
│ └── types/ SessionResource, SessionTypes, SessionContext, SharedSessionData,
│ BridgeEnvironmentInfo, ControlResponsePayload,
│ EnvironmentResource, PostTurnSummary
│
├── settings/
│ ├── internal/ InternalSettingsAppScreen (4 destinations)
│ │ └── growthbook/ GrowthBookModels
│ └── SettingsAppScreen
│
├── stt/repo/ SpeechToTextLanguageNotFoundException
│ └── api/ STTApiMessage
│
├── tasks/ui/ TasksBottomSheetDestination, TasksListOverlay
│
├── tool/
│ ├── calendar/ EventInfo
│ ├── custom/ PhoneCallMonitorEvent
│ ├── mcp/ ServerBaseFrame
│ ├── model/ ToolModels (Tool sealed, SourceImage, SearchToolInput,
│ │ TaskStatusInput, PreviewData variants, ToolInvocationResult,
│ │ SearchMcpRegistryInput, TaskListOutput),
│ │ DisplayToolInputs (PlacesMapDisplayV0Input, RecipeDisplayV0Input,
│ │ ChartDisplayV0Input, EventCreateV0Input),
│ │ SuggestConnectorsOutput, TaskProposeOutput
│ └── ui/chat/ PhoneCallSheetDestination, FormSheetDestination
│
├── types/strings/ DomainTypes (20+ inline value classes: ChatId, ProjectId,
│ MessageId, SessionId, AccountId...), ModelId
│
├── ui/
│ ├── code/ SessionInputData, DiffLineComment, PendingAskUserQuestionSelections
│ └── MainScreen
│
├── wear/ AuthSyncCredentials, PhoneWearableListenerService,
│ SerializableCookieSlim
└── widget/ ClaudeAppWidgetReceiver
```
## **总计:75+ 个包中的 211 个 Kotlin 文件**(提交 `c52c2d9`)
## 技术栈(源自原始 APK)
| 层级 | 技术 |
|---|---|
| 语言 | Kotlin 2.1.20 |
| UI | Jetpack Compose 1.10.4 + Material3 1.5.0-alpha12 |
| 架构 | MVVM + StateFlow |
| 网络 | OkHttp 5.5.0 + Retrofit 2.11.0 + Moshi 1.15.2 |
| 异步处理 | Coroutines 1.10.2 |
| 序列化 | kotlinx.serialization 1.8.1 |
| 存储 | Room 2.8.4 + DataStore 1.3.0-alpha06 |
| Protobuf | Wire 5.5.0 |
| 分析 | Firebase 33.13.0, Datadog 2.18.1, Sentry 8.8.0, Segment 1.19.1 |
| 最低 SDK | 32 (Android 12L) |
| 目标 SDK | 36 (Android 16) |
## 许可证
本项目**仅出于教育和研究目的**共享。所有商标、服务标志和品牌名称均属于其各自的所有者。Claude™ 是 Anthropic, PBC 的商标。
标签:AI聊天, Android应用, Anthropic, APK分析, CIS基准, Claude, CVE检测, Firebase, Jetpack Compose, Kotlin, Smali, URL提取, 云资产清单, 反编译, 安卓架构, 源码还原, 目录枚举, 移动安全, 网络安全, 逆向工程, 隐私保护