云服务: 国际版 ROM 下为中国区账号解除相册云同步封锁 - #1667
Open
jason5545 wants to merge 1 commit into
Open
Conversation
…onal builds On international builds, CloudService unconditionally runs the gallery sync termination helper (setIsSyncable(gallery, 0) + setSyncAutomatically(gallery, false)) whenever cloud config applies, leaving accounts whose region still supports Gallery cloud sync stuck at "requesting" forever. When the user selects Mi Cloud as the gallery backup server (gallery_backup_server == 1) and the Xiaomi account region is CN, intercept those two writes for the gallery authority and repair the sync state (syncable=1, auto-sync on, request sync) on CloudService start. Non-CN accounts keep the stock behavior.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 26 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
国际版(IS_INTERNATIONAL_BUILD=true)ROM 上,CloudService 在每次应用云端配置时都会无条件执行相册同步终止逻辑(ServiceTerminatedHelper):
ContentResolver.setIsSyncable(gallery, 0)ContentResolver.setSyncAutomatically(gallery, false)这是为海外账号相册云同步下线(2023-05-31 截止)而设计的。但中国区账号的相册云服务仍然有效,在国际版 ROM(如 xiaomi.eu)上登录中国区账号时,配合相册选择小米云备份,设置里能看到开关,却永远卡在「正在请求」——因为同步框架里的 syncable 被反复置 0,请求从未真正发出。
方案
新增
RestoreGallerySync(作用于 com.miui.cloudservice),在以下两个条件同时满足时自动生效,无需额外开关:gallery_backup_server == 1)acc_user_region,非 CN 账号完全保持原行为)生效后:
setIsSyncable(0)/setSyncAutomatically(false)写入测试
dumpsys content中com.miui.gallery.cloud.providersyncable=0,历史同步次数 0USER SUCCESS,云端 3800+ 条数据完整拉回,缩略图与原图正常下载兼容性说明
ContentResolver.setIsSyncable/setSyncAutomatically两个 AOSP 稳定 API,不涉及混淆类名,对 CloudService 版本变化稳健