Loading src/com/android/settings/system/reset/ResetNetworkConfirm.kt +15 −8 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.settings.SettingsEnums import android.content.DialogInterface import android.content.DialogInterface import android.os.Bundle import android.os.Bundle import android.os.Looper import android.os.Looper import android.telecom.TelecomManager import android.telephony.SubscriptionManager import android.telephony.SubscriptionManager import android.util.Log import android.util.Log import android.view.LayoutInflater import android.view.LayoutInflater Loading Loading @@ -89,7 +90,12 @@ class ResetNetworkConfirm : InstrumentedFragment() { /** Configure the UI for the final confirmation interaction */ /** Configure the UI for the final confirmation interaction */ private fun View.establishFinalConfirmationState() { private fun View.establishFinalConfirmationState() { requireViewById<View>(R.id.execute_reset_network).setOnClickListener { requireViewById<View>(R.id.execute_reset_network).setOnClickListener { val tm = context.getSystemService(TelecomManager::class.java) if (tm != null && tm.isInCall) { showResetInternetDialog(); showResetInternetDialog(); } else { onResetClicked() } } } } } Loading Loading @@ -138,9 +144,13 @@ class ResetNetworkConfirm : InstrumentedFragment() { * settings to its factory-default state. * settings to its factory-default state. */ */ @VisibleForTesting @VisibleForTesting suspend fun onResetClicked() { fun onResetClicked() { if (!Utils.isMonkeyRunning() && !resetStarted) { resetStarted = true viewLifecycleOwner.lifecycleScope.launch { showProgressDialog() showProgressDialog() resetNetwork() resetNetwork() } } } } private fun showProgressDialog() { private fun showProgressDialog() { Loading @@ -165,10 +175,7 @@ class ResetNetworkConfirm : InstrumentedFragment() { val builder = AlertDialog.Builder(requireContext()) val builder = AlertDialog.Builder(requireContext()) val resetInternetClickListener = val resetInternetClickListener = DialogInterface.OnClickListener { dialog, which -> DialogInterface.OnClickListener { dialog, which -> if (!Utils.isMonkeyRunning() && !resetStarted) { onResetClicked() resetStarted = true viewLifecycleOwner.lifecycleScope.launch { onResetClicked() } } } } builder.setTitle(R.string.reset_your_internet_title) builder.setTitle(R.string.reset_your_internet_title) Loading Loading
src/com/android/settings/system/reset/ResetNetworkConfirm.kt +15 −8 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.settings.SettingsEnums import android.content.DialogInterface import android.content.DialogInterface import android.os.Bundle import android.os.Bundle import android.os.Looper import android.os.Looper import android.telecom.TelecomManager import android.telephony.SubscriptionManager import android.telephony.SubscriptionManager import android.util.Log import android.util.Log import android.view.LayoutInflater import android.view.LayoutInflater Loading Loading @@ -89,7 +90,12 @@ class ResetNetworkConfirm : InstrumentedFragment() { /** Configure the UI for the final confirmation interaction */ /** Configure the UI for the final confirmation interaction */ private fun View.establishFinalConfirmationState() { private fun View.establishFinalConfirmationState() { requireViewById<View>(R.id.execute_reset_network).setOnClickListener { requireViewById<View>(R.id.execute_reset_network).setOnClickListener { val tm = context.getSystemService(TelecomManager::class.java) if (tm != null && tm.isInCall) { showResetInternetDialog(); showResetInternetDialog(); } else { onResetClicked() } } } } } Loading Loading @@ -138,9 +144,13 @@ class ResetNetworkConfirm : InstrumentedFragment() { * settings to its factory-default state. * settings to its factory-default state. */ */ @VisibleForTesting @VisibleForTesting suspend fun onResetClicked() { fun onResetClicked() { if (!Utils.isMonkeyRunning() && !resetStarted) { resetStarted = true viewLifecycleOwner.lifecycleScope.launch { showProgressDialog() showProgressDialog() resetNetwork() resetNetwork() } } } } private fun showProgressDialog() { private fun showProgressDialog() { Loading @@ -165,10 +175,7 @@ class ResetNetworkConfirm : InstrumentedFragment() { val builder = AlertDialog.Builder(requireContext()) val builder = AlertDialog.Builder(requireContext()) val resetInternetClickListener = val resetInternetClickListener = DialogInterface.OnClickListener { dialog, which -> DialogInterface.OnClickListener { dialog, which -> if (!Utils.isMonkeyRunning() && !resetStarted) { onResetClicked() resetStarted = true viewLifecycleOwner.lifecycleScope.launch { onResetClicked() } } } } builder.setTitle(R.string.reset_your_internet_title) builder.setTitle(R.string.reset_your_internet_title) Loading