debug: 添加详细日志以便调试壁纸更换问题
This commit is contained in:
1 parent
49f1b78faa
commit
bd50ea8b25
2 files changed
+18
-1
No files matched your search
@@ -18,7 +18,8 @@
|
||||
"mcp__plugin_serena_serena__get_symbols_overview",
|
||||
"mcp__plugin_serena_serena__find_file",
|
||||
"Bash(./gradlew assembleDebug --stacktrace 2>&1:*)",
|
||||
"Bash(gradle assembleDebug:*)"
|
||||
"Bash(gradle assembleDebug:*)",
|
||||
"mcp__plugin_serena_serena__list_dir"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,10 @@ public class AutoWallpaperService extends WallpaperService {
|
||||
if (engine != null) {
|
||||
boolean forceChange = intent.getBooleanExtra("force_change", false);
|
||||
boolean scheduled = intent.getBooleanExtra("scheduled", false);
|
||||
Log.i(TAG, "Refresh wallpaper requested: forceChange=" + forceChange + ", scheduled=" + scheduled);
|
||||
engine.refreshWallpaper(forceChange, scheduled);
|
||||
} else {
|
||||
Log.e(TAG, "Engine is null!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,6 +117,7 @@ public class AutoWallpaperService extends WallpaperService {
|
||||
}
|
||||
|
||||
public void refreshWallpaper(boolean forceChange, boolean scheduled) {
|
||||
Log.i(TAG, "refreshWallpaper called: forceChange=" + forceChange + ", scheduled=" + scheduled + ", visible=" + visible);
|
||||
if (forceChange) {
|
||||
forceChangeNext = true;
|
||||
}
|
||||
@@ -122,6 +126,8 @@ public class AutoWallpaperService extends WallpaperService {
|
||||
}
|
||||
if (visible) {
|
||||
handler.post(this::drawWallpaper);
|
||||
} else {
|
||||
Log.w(TAG, "Engine not visible, wallpaper will update when visible");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,15 +156,21 @@ public class AutoWallpaperService extends WallpaperService {
|
||||
// 核心逻辑:根据触发来源决定是否更换壁纸
|
||||
boolean shouldChange = false;
|
||||
|
||||
Log.i(TAG, "drawWallpaper: forceChangeNext=" + forceChangeNext + ", scheduledNext=" + scheduledNext +
|
||||
", changeOnReturn=" + config.isChangeOnReturnToHome());
|
||||
|
||||
if (forceChangeNext) {
|
||||
// 用户主动触发(如点击"立即更换"):强制更换
|
||||
shouldChange = true;
|
||||
Log.i(TAG, "Forced change by user");
|
||||
} else if (scheduledNext) {
|
||||
// 定时器触发:必须更换(这是主要的自动更换机制)
|
||||
shouldChange = true;
|
||||
Log.i(TAG, "Scheduled change");
|
||||
} else if (config.isChangeOnReturnToHome()) {
|
||||
// 返回桌面触发:根据配置决定
|
||||
shouldChange = true;
|
||||
Log.i(TAG, "Change on return to home");
|
||||
}
|
||||
|
||||
if (shouldChange) {
|
||||
@@ -166,20 +178,24 @@ public class AutoWallpaperService extends WallpaperService {
|
||||
image = getNextWallpaper(config);
|
||||
|
||||
if (image != null) {
|
||||
Log.i(TAG, "Drawing new wallpaper: " + image.getUri());
|
||||
drawImage(canvas, image.getUri());
|
||||
prefs.saveConfig(config);
|
||||
prefs.saveLastUri(image.getUri());
|
||||
} else {
|
||||
Log.w(TAG, "No more wallpapers available");
|
||||
drawPlaceholder(canvas);
|
||||
}
|
||||
} else {
|
||||
// 不更换:使用当前壁纸
|
||||
Log.i(TAG, "Reusing current wallpaper");
|
||||
String lastUri = prefs.getLastUri();
|
||||
if (lastUri != null) {
|
||||
// 复用当前壁纸
|
||||
drawImage(canvas, lastUri);
|
||||
} else {
|
||||
// 没有当前壁纸,使用下一张
|
||||
Log.i(TAG, "No current wallpaper, getting next one");
|
||||
image = getNextWallpaper(config);
|
||||
if (image != null) {
|
||||
drawImage(canvas, image.getUri());
|
||||
|
||||
Reference in new issue
Block a user