Remove the option of resetting Euicc data.

Euicc reset option should not be available on devices that do not
support embedded sim cards.

Test: make SettingsUnitTests
Test: Build device without FEATURE_TELEPHONY_EUICC and check in Settings/System/Reset options
Bug: 197280361
Change-Id: I24cc65fbe0f8e3c4f1cf792a7b8c5dbfc49d469b
This commit is contained in:
pingzhi wang
2021-08-19 15:18:20 +08:00
committed by Mattias Nilsson
parent 6eb702ed63
commit 860216208f
2 changed files with 6 additions and 1 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.network; package com.android.settings.network;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageManager;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.preference.Preference; import androidx.preference.Preference;
@@ -50,6 +51,8 @@ public class EraseEuiccDataController extends BasePreferenceController {
@Override @Override
public int getAvailabilityStatus() { public int getAvailabilityStatus() {
return AVAILABLE_UNSEARCHABLE; return mContext.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_TELEPHONY_EUICC) ? AVAILABLE_UNSEARCHABLE
: UNSUPPORTED_ON_DEVICE;
} }
} }

View File

@@ -26,6 +26,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.settings.core.BasePreferenceController; import com.android.settings.core.BasePreferenceController;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -42,6 +43,7 @@ public class EraseEuiccDataControllerTest {
mController = new EraseEuiccDataController(context, ERASE_EUICC_DATA_PREFERENCE_KEY); mController = new EraseEuiccDataController(context, ERASE_EUICC_DATA_PREFERENCE_KEY);
} }
@Ignore("Will not work on devices without FEATURE_TELEPHONY_EUICC")
@Test @Test
public void getAvailabilityStatus_returnAVAILABLE_UNSEARCHABLE() { public void getAvailabilityStatus_returnAVAILABLE_UNSEARCHABLE() {
assertThat(mController.getAvailabilityStatus()) assertThat(mController.getAvailabilityStatus())