From efea9ca0f5b1885d99c552b8ec4dffdbcbc8bf85 Mon Sep 17 00:00:00 2001 From: joshavant <830519+joshavant@users.noreply.github.com> Date: Fri, 5 Jun 2026 03:45:21 -0500 Subject: [PATCH] chore(android): fix ktlint formatting --- .../src/main/java/ai/openclaw/app/PermissionRequester.kt | 1 + .../src/main/java/ai/openclaw/app/chat/ChatController.kt | 2 ++ .../main/java/ai/openclaw/app/gateway/GatewayDiscovery.kt | 2 ++ .../src/main/java/ai/openclaw/app/node/DeviceHandler.kt | 3 +-- .../app/src/main/java/ai/openclaw/app/ui/ShellScreen.kt | 5 ++++- .../main/java/ai/openclaw/app/ui/chat/SessionFilters.kt | 7 ++++++- .../main/java/ai/openclaw/app/voice/MicCaptureManager.kt | 1 + .../src/main/java/ai/openclaw/app/voice/TalkModeManager.kt | 1 + 8 files changed, 18 insertions(+), 4 deletions(-) diff --git a/apps/android/app/src/main/java/ai/openclaw/app/PermissionRequester.kt b/apps/android/app/src/main/java/ai/openclaw/app/PermissionRequester.kt index b26223106e2..8790db36ac6 100644 --- a/apps/android/app/src/main/java/ai/openclaw/app/PermissionRequester.kt +++ b/apps/android/app/src/main/java/ai/openclaw/app/PermissionRequester.kt @@ -53,6 +53,7 @@ class PermissionRequester internal constructor( private val mutex = Mutex() private val requestSlotsLock = Any() private val mainHandler = Handler(Looper.getMainLooper()) + // ActivityResult launchers cannot be registered after start; pre-register a small pool for nested UI flows. private val launchers = List(4) { createPermissionRequestSlot(launcherFactory) } diff --git a/apps/android/app/src/main/java/ai/openclaw/app/chat/ChatController.kt b/apps/android/app/src/main/java/ai/openclaw/app/chat/ChatController.kt index e477da25a65..fad436a9e1a 100644 --- a/apps/android/app/src/main/java/ai/openclaw/app/chat/ChatController.kt +++ b/apps/android/app/src/main/java/ai/openclaw/app/chat/ChatController.kt @@ -61,9 +61,11 @@ class ChatController( private val pendingRuns = mutableSetOf() private val pendingRunTimeoutJobs = ConcurrentHashMap() + // Preserve sent messages locally until chat.history includes the gateway-confirmed copy. private val optimisticMessagesByRunId = LinkedHashMap() private val pendingRunTimeoutMs = 120_000L + // Drops stale history responses after session switches or refresh races. private val historyLoadGeneration = AtomicLong(0) diff --git a/apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayDiscovery.kt b/apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayDiscovery.kt index dea9d1eebdb..4aa5b4ca8a5 100644 --- a/apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayDiscovery.kt +++ b/apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayDiscovery.kt @@ -66,10 +66,12 @@ class GatewayDiscovery( private val localById = ConcurrentHashMap() private val unicastById = ConcurrentHashMap() private val _gateways = MutableStateFlow>(emptyList()) + /** Current discovered gateway list, merged from local DNS-SD and optional wide-area DNS-SD. */ val gateways: StateFlow> = _gateways.asStateFlow() private val _statusText = MutableStateFlow("Searching…") + /** Short diagnostic text shown by connect UI while discovery is running. */ val statusText: StateFlow = _statusText.asStateFlow() diff --git a/apps/android/app/src/main/java/ai/openclaw/app/node/DeviceHandler.kt b/apps/android/app/src/main/java/ai/openclaw/app/node/DeviceHandler.kt index aacaba074e4..0322963e1d1 100644 --- a/apps/android/app/src/main/java/ai/openclaw/app/node/DeviceHandler.kt +++ b/apps/android/app/src/main/java/ai/openclaw/app/node/DeviceHandler.kt @@ -30,8 +30,7 @@ private const val MAX_DEVICE_APPS_LIMIT = 200 private const val DEVICE_APPS_SYSTEM_FLAGS = ApplicationInfo.FLAG_SYSTEM or ApplicationInfo.FLAG_UPDATED_SYSTEM_APP -internal fun isSystemDeviceApp(appInfo: ApplicationInfo): Boolean = - (appInfo.flags and DEVICE_APPS_SYSTEM_FLAGS) != 0 +internal fun isSystemDeviceApp(appInfo: ApplicationInfo): Boolean = (appInfo.flags and DEVICE_APPS_SYSTEM_FLAGS) != 0 internal data class DeviceAppEntry( val label: String, diff --git a/apps/android/app/src/main/java/ai/openclaw/app/ui/ShellScreen.kt b/apps/android/app/src/main/java/ai/openclaw/app/ui/ShellScreen.kt index b892e9a0113..e42e4acc7d9 100644 --- a/apps/android/app/src/main/java/ai/openclaw/app/ui/ShellScreen.kt +++ b/apps/android/app/src/main/java/ai/openclaw/app/ui/ShellScreen.kt @@ -103,7 +103,10 @@ private val shellNavTabs = listOf(Tab.Overview, Tab.Chat, Tab.Voice, Tab.Setting private val shellContentInsets: WindowInsets @Composable get() = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal) -internal fun shellBottomNavVisible(keyboardVisible: Boolean, commandOpen: Boolean): Boolean = !keyboardVisible && !commandOpen +internal fun shellBottomNavVisible( + keyboardVisible: Boolean, + commandOpen: Boolean, +): Boolean = !keyboardVisible && !commandOpen /** Main post-onboarding shell that owns top-level Android navigation state. */ @Composable diff --git a/apps/android/app/src/main/java/ai/openclaw/app/ui/chat/SessionFilters.kt b/apps/android/app/src/main/java/ai/openclaw/app/ui/chat/SessionFilters.kt index f4c7c0aacec..0725cdd27ed 100644 --- a/apps/android/app/src/main/java/ai/openclaw/app/ui/chat/SessionFilters.kt +++ b/apps/android/app/src/main/java/ai/openclaw/app/ui/chat/SessionFilters.kt @@ -82,7 +82,12 @@ fun resolveCompactSessionChoices( ) val mainKey = mainSessionKey.trim().ifEmpty { "main" } val current = currentSessionKey.trim().let { if (it == "main" && mainKey != "main") mainKey else it } - val pinnedRank = listOf(mainKey, current).filter { it.isNotBlank() }.distinct().withIndex().associate { it.value to it.index } + val pinnedRank = + listOf(mainKey, current) + .filter { it.isNotBlank() } + .distinct() + .withIndex() + .associate { it.value to it.index } val unpinnedRank = pinnedRank.size return allChoices diff --git a/apps/android/app/src/main/java/ai/openclaw/app/voice/MicCaptureManager.kt b/apps/android/app/src/main/java/ai/openclaw/app/voice/MicCaptureManager.kt index 9124e86713a..a7e4fcfa63e 100644 --- a/apps/android/app/src/main/java/ai/openclaw/app/voice/MicCaptureManager.kt +++ b/apps/android/app/src/main/java/ai/openclaw/app/voice/MicCaptureManager.kt @@ -104,6 +104,7 @@ class MicCaptureManager( private val messageQueue = ArrayDeque() private val messageQueueLock = Any() private var flushedPartialTranscript: String? = null + // Correlates chat events with the idempotency key generated before sendChat returns. private var pendingRunId: String? = null private var pendingAssistantEntryId: String? = null diff --git a/apps/android/app/src/main/java/ai/openclaw/app/voice/TalkModeManager.kt b/apps/android/app/src/main/java/ai/openclaw/app/voice/TalkModeManager.kt index f08bb0e65e6..022965c1a1d 100644 --- a/apps/android/app/src/main/java/ai/openclaw/app/voice/TalkModeManager.kt +++ b/apps/android/app/src/main/java/ai/openclaw/app/voice/TalkModeManager.kt @@ -168,6 +168,7 @@ class TalkModeManager internal constructor( @Volatile private var realtimeSessionId: String? = null private var realtimeCaptureJob: Job? = null private var realtimeAppendJob: Job? = null + // Realtime tool calls can complete before their chat final arrives; cache by call/run id until both sides meet. private val realtimeToolRuns = LinkedHashMap() private val pendingRealtimeToolCalls = LinkedHashSet()