From 588da6ab8bc19c6cd8e7b3f8ebaaf716eb76b444 Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Fri, 22 Sep 2023 08:32:18 +0900 Subject: [PATCH] Fix kotlin static code analysis --- .../clusterclient/AddressUpdateFragment.kt | 6 +++++- .../clusterclient/GroupSettingFragment.kt | 18 ++++++++---------- .../google/chip/chiptool/util/DeviceIdUtil.kt | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt index 6f7cbbeb4d6e89..6ff5107b48130d 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt @@ -2,6 +2,7 @@ package com.google.chip.chiptool.clusterclient import android.content.Context import android.os.Bundle +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -61,7 +62,9 @@ class AddressUpdateFragment : Fragment() { binding.deviceIdEd.setText(deviceIdList[position].toULong(16).toString()) } - override fun onNothingSelected(parent: AdapterView<*>?) {} + override fun onNothingSelected(parent: AdapterView<*>?) { + Log.d(TAG, "onNothingSelected") + } } } @@ -81,6 +84,7 @@ class AddressUpdateFragment : Fragment() { } companion object { + private const val TAG = "AddressUpdateFragment" // Refer from NodeId.h (src/lib/core/NodeId.h) private const val MIN_GROUP_NODE_ID = 0xFFFF_FFFF_FFFF_0000UL private const val MASK_GROUP_ID = 0x0000_0000_0000_FFFFUL diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/GroupSettingFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/GroupSettingFragment.kt index 94ba73b52a5e46..b40fc1c541c3d7 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/GroupSettingFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/GroupSettingFragment.kt @@ -296,14 +296,14 @@ class GroupSettingFragment : Fragment() { ClusterIDMapping.GroupKeyManagement.KeySetWriteCommandField.GroupKeySet.id ) ) - put(ContextSpecificTag(0), keySetId) - put(ContextSpecificTag(1), keyPolicy) - put(ContextSpecificTag(2), epochKey0) - put(ContextSpecificTag(3), epochStartTime0) - put(ContextSpecificTag(4), epochKey1) - put(ContextSpecificTag(5), epochStartTime1) - put(ContextSpecificTag(6), epochKey2) - put(ContextSpecificTag(7), epochStartTime2) + put(ContextSpecificTag(0 /* keySetId */), keySetId) + put(ContextSpecificTag(1 /* keyPolicy */), keyPolicy) + put(ContextSpecificTag(2 /* epochKey0 */), epochKey0) + put(ContextSpecificTag(3 /* epochStartTime0 */), epochStartTime0) + put(ContextSpecificTag(4 /* epochKey1 */), epochKey1) + put(ContextSpecificTag(5 /* epochStartTime1 */), epochStartTime1) + put(ContextSpecificTag(6 /* epochKey2 */), epochKey2) + put(ContextSpecificTag(7 /* epochStartTime2 */), epochStartTime2) endStructure() endStructure() } @@ -604,8 +604,6 @@ class GroupSettingFragment : Fragment() { } inner class ChipControllerCallback : GenericChipDeviceListener() { - override fun onConnectDeviceComplete() {} - override fun onCommissioningComplete(nodeId: Long, errorCode: Int) { Log.d(TAG, "onCommissioningComplete for nodeId $nodeId: $errorCode") } diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/util/DeviceIdUtil.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/util/DeviceIdUtil.kt index 1ca52fce2a2ee9..4f63cea2fe3e8c 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/util/DeviceIdUtil.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/util/DeviceIdUtil.kt @@ -26,7 +26,7 @@ object DeviceIdUtil { fun setCommissionedNodeId(context: Context, nodeId: Long) { val nodeList = getCommissionedNodeId(context) - nodeList.add(nodeId.toULong().toString(16)) + nodeList.add(nodeId.toULong().toString(16 /* hex */)) getPrefs(context).edit().putStringSet(DEVICE_ID_LIST_PREFS_KEY, nodeList.toSet()).apply() }