From 78355813b349092536599917bf0551d9bee07505 Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Thu, 25 Aug 2022 04:29:18 +0900 Subject: [PATCH] Remove Android updateDevice API (#22093) --- .../clusterclient/AddressUpdateFragment.kt | 17 +---------------- .../clusterclient/SensorClientFragment.kt | 13 ------------- .../main/res/layout/address_update_fragment.xml | 14 -------------- .../devicecontroller/ChipDeviceController.java | 6 ------ 4 files changed, 1 insertion(+), 49 deletions(-) diff --git a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt index 1bb841b81965b3..217cbc00737721 100644 --- a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt +++ b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt @@ -13,7 +13,6 @@ import com.google.chip.chiptool.R import com.google.chip.chiptool.util.DeviceIdUtil import kotlinx.android.synthetic.main.address_update_fragment.deviceIdEd import kotlinx.android.synthetic.main.address_update_fragment.fabricIdEd -import kotlinx.android.synthetic.main.address_update_fragment.view.updateAddressBtn /** Fragment for updating the address of a device given its fabric and node ID. */ class AddressUpdateFragment: Fragment() { @@ -28,9 +27,7 @@ class AddressUpdateFragment: Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View { - return inflater.inflate(R.layout.address_update_fragment, container, false).apply { - updateAddressBtn.setOnClickListener { updateAddressClick() } - } + return inflater.inflate(R.layout.address_update_fragment, container, false).apply { } } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { @@ -40,16 +37,4 @@ class AddressUpdateFragment: Fragment() { fabricIdEd.setText(compressedFabricId.toULong().toString(16).padStart(16, '0')) deviceIdEd.setText(DeviceIdUtil.getLastDeviceId(requireContext()).toString()) } - - private fun updateAddressClick() { - try { - deviceController.updateDevice( - fabricIdEd.text.toString().toULong(16).toLong(), - deviceIdEd.text.toString().toULong().toLong() - ) - Toast.makeText(requireContext(), "Address update started", Toast.LENGTH_SHORT).show() - } catch (ex: Exception) { - Toast.makeText(requireContext(), "Address update failed: $ex", Toast.LENGTH_SHORT).show() - } - } } \ No newline at end of file diff --git a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt index 64f35095652732..587eb85020651c 100644 --- a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt +++ b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt @@ -66,7 +66,6 @@ class SensorClientFragment : Fragment() { ChipClient.getDeviceController(requireContext()).setCompletionListener(null) deviceIdEd.setOnEditorActionListener { textView, actionId, _ -> if (actionId == EditorInfo.IME_ACTION_DONE) { - updateAddress(textView.text.toString()) resetSensorGraph() // reset the graph on device change } actionId == EditorInfo.IME_ACTION_DONE @@ -116,7 +115,6 @@ class SensorClientFragment : Fragment() { override fun onStart() { super.onStart() deviceIdEd.setText(DeviceIdUtil.getLastDeviceId(requireContext()).toString()) - updateAddress(deviceIdEd.text.toString()) } override fun onStop() { @@ -124,17 +122,6 @@ class SensorClientFragment : Fragment() { super.onStop() } - private fun updateAddress(deviceId: String) { - try { - ChipClient.getDeviceController(requireContext()).updateDevice( - /* fabric ID */ 5544332211, - deviceId.toULong().toLong() - ) - } catch (ex: Exception) { - showMessage(R.string.update_device_address_failure, ex.toString()) - } - } - private fun resetSensorGraph() { watchSensorBtn.isChecked = false sensorGraph.visibility = View.INVISIBLE diff --git a/src/android/CHIPTool/app/src/main/res/layout/address_update_fragment.xml b/src/android/CHIPTool/app/src/main/res/layout/address_update_fragment.xml index c76cc76fc7b85e..3a401297e326aa 100644 --- a/src/android/CHIPTool/app/src/main/res/layout/address_update_fragment.xml +++ b/src/android/CHIPTool/app/src/main/res/layout/address_update_fragment.xml @@ -32,18 +32,4 @@ android:layout_height="wrap_content" app:barrierDirection="bottom" app:constraint_referenced_ids="fabricIdEd,deviceIdEd" /> - -