When apn is read only, hide the save button.
Test: Visual Test
Fix: 320200491
Change-Id: I8280fdaa3643a982137936473d827b8502a6e023
diff --git a/src/com/android/settings/network/apn/ApnEditPageProvider.kt b/src/com/android/settings/network/apn/ApnEditPageProvider.kt
index 52066a1..2600618 100644
--- a/src/com/android/settings/network/apn/ApnEditPageProvider.kt
+++ b/src/com/android/settings/network/apn/ApnEditPageProvider.kt
@@ -101,17 +101,19 @@
RegularScaffold(
title = if (apnDataInit.newApn) stringResource(id = R.string.apn_add) else stringResource(id = R.string.apn_edit),
actions = {
- IconButton(onClick = {
- if (!apnData.validEnabled) apnData = apnData.copy(validEnabled = true)
- val valid = validateAndSaveApnData(
- apnDataInit,
- apnData,
- context,
- uriInit,
- networkTypeSelectedOptionsState
- )
- if (valid) navController.navigateBack()
- }) { Icon(imageVector = Icons.Outlined.Done, contentDescription = null) }
+ if (!apnData.customizedConfig.readOnlyApn) {
+ IconButton(onClick = {
+ if (!apnData.validEnabled) apnData = apnData.copy(validEnabled = true)
+ val valid = validateAndSaveApnData(
+ apnDataInit,
+ apnData,
+ context,
+ uriInit,
+ networkTypeSelectedOptionsState
+ )
+ if (valid) navController.navigateBack()
+ }) { Icon(imageVector = Icons.Outlined.Done, contentDescription = null) }
+ }
},
) {
Column {
@@ -212,7 +214,9 @@
emptyVal = stringResource(R.string.network_type_unspecified),
enabled = apnData.networkTypeEnabled
) {}
- if (!apnData.newApn) {
+ if (!apnData.newApn && !apnData.customizedConfig.readOnlyApn
+ && apnData.customizedConfig.isAddApnAllowed
+ ) {
Preference(
object : PreferenceModel {
override val title = stringResource(R.string.menu_delete)