Loading res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -11420,4 +11420,9 @@ <!-- [CHAR LIMIT=NONE] Title for Accessibility Software Cursor setting for keyboard shift. --> <string name="software_cursor_trigger_keyboard_shift_enabled_title" translatable="false">Shift gesture detection region above keyboard</string> <!-- [CHAR LIMIT=NONE] Title for preference: Convert to eSIM --> <string name="convert_to_esim_title">Convert to eSIM</string> <!-- [CHAR LIMIT=NONE] Title for preference: Transfer eSIM to another device --> <string name="transfer_esim_to_another_device_title">Transfer eSIM to another device</string> </resources> res/xml/mobile_network_settings.xml +12 −0 Original line number Diff line number Diff line Loading @@ -250,6 +250,18 @@ settings:controller="com.android.settings.network.telephony.NrAdvancedCallingPreferenceController"/> </PreferenceCategory> <Preference android:key="convert_to_esim" android:persistent="false" android:title="@string/convert_to_esim_title" settings:controller="com.android.settings.network.telephony.ConvertToEsimPreferenceController"/> <Preference android:key="transfer_esim" android:persistent="false" android:title="@string/transfer_esim_to_another_device_title" settings:controller="com.android.settings.network.telephony.TransferEsimPreferenceController"/> <Preference android:key="erase_sim" android:persistent="false" Loading src/com/android/settings/network/telephony/ConvertToEsimPreferenceController.java 0 → 100644 +145 −0 Original line number Diff line number Diff line /** * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.network.telephony; import static androidx.lifecycle.Lifecycle.Event.ON_START; import static androidx.lifecycle.Lifecycle.Event.ON_STOP; import android.content.Context; import android.text.TextUtils; import androidx.annotation.VisibleForTesting; import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.OnLifecycleEvent; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.settings.network.MobileNetworkRepository; import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.mobile.dataservice.DataServiceUtils; import com.android.settingslib.mobile.dataservice.MobileNetworkInfoEntity; import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity; import com.android.settingslib.mobile.dataservice.UiccInfoEntity; import java.util.ArrayList; import java.util.List; public class ConvertToEsimPreferenceController extends TelephonyBasePreferenceController implements LifecycleObserver, MobileNetworkRepository.MobileNetworkCallback { private Preference mPreference; private LifecycleOwner mLifecycleOwner; private MobileNetworkRepository mMobileNetworkRepository; private List<SubscriptionInfoEntity> mSubscriptionInfoEntityList = new ArrayList<>(); private SubscriptionInfoEntity mSubscriptionInfoEntity; public ConvertToEsimPreferenceController(Context context, String key, Lifecycle lifecycle, LifecycleOwner lifecycleOwner, int subId) { super(context, key); mSubId = subId; mMobileNetworkRepository = MobileNetworkRepository.createBySubId(context, this, mSubId); mLifecycleOwner = lifecycleOwner; if (lifecycle != null) { lifecycle.addObserver(this); } } public void init(int subId, SubscriptionInfoEntity subInfoEntity) { mSubId = subId; mSubscriptionInfoEntity = subInfoEntity; } @OnLifecycleEvent(ON_START) public void onStart() { mMobileNetworkRepository.addRegister(mLifecycleOwner); } @OnLifecycleEvent(ON_STOP) public void onStop() { mMobileNetworkRepository.removeRegister(); } @Override public void displayPreference(PreferenceScreen screen) { super.displayPreference(screen); mPreference = screen.findPreference(getPreferenceKey()); } @Override public int getAvailabilityStatus(int subId) { return CONDITIONALLY_UNAVAILABLE; // TODO(b/262195754): Need the intent to enabled the feature. // return mSubscriptionInfoEntity != null && mSubscriptionInfoEntity.isActiveSubscriptionId // && !mSubscriptionInfoEntity.isEmbedded ? AVAILABLE // : CONDITIONALLY_UNAVAILABLE; } @VisibleForTesting void update() { if (mPreference == null) { return; } mPreference.setVisible(getAvailabilityStatus(mSubId) == AVAILABLE); } @Override public boolean handlePreferenceTreeClick(Preference preference) { if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) { return false; } // Send intent to launch LPA return true; } @VisibleForTesting public void setSubscriptionInfoEntity(SubscriptionInfoEntity subscriptionInfoEntity) { mSubscriptionInfoEntity = subscriptionInfoEntity; } @Override public void onAirplaneModeChanged(boolean airplaneModeEnabled) { } @Override public void onAvailableSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList) { } @Override public void onActiveSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList) { // TODO(b/262195754): Need the intent to enabled the feature. // if (DataServiceUtils.shouldUpdateEntityList(mSubscriptionInfoEntityList, // subInfoEntityList)) { // mSubscriptionInfoEntityList = subInfoEntityList; // mSubscriptionInfoEntityList.forEach(entity -> { // if (Integer.parseInt(entity.subId) == mSubId) { // mSubscriptionInfoEntity = entity; // update(); // } // }); // } } @Override public void onAllUiccInfoChanged(List<UiccInfoEntity> uiccInfoEntityList) { } @Override public void onAllMobileNetworkInfoChanged( List<MobileNetworkInfoEntity> mobileNetworkInfoEntityList) { } } src/com/android/settings/network/telephony/MobileDataPreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -26,10 +26,10 @@ import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import androidx.annotation.VisibleForTesting; import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.OnLifecycleEvent; import androidx.annotation.VisibleForTesting; import androidx.fragment.app.FragmentManager; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; Loading src/com/android/settings/network/telephony/MobileNetworkSettings.java +5 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings impleme private static final String KEY_CALLS_PREF = "calls_preference"; private static final String KEY_SMS_PREF = "sms_preference"; private static final String KEY_MOBILE_DATA_PREF = "mobile_data_enable"; private static final String KEY_CONVERT_TO_ESIM_PREF = "convert_to_esim"; //String keys for preference lookup private static final String BUTTON_CDMA_SYSTEM_SELECT_KEY = "cdma_system_select_key"; Loading Loading @@ -178,6 +179,8 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings impleme new SmsDefaultSubscriptionController(context, KEY_SMS_PREF, getSettingsLifecycle(), this), new MobileDataPreferenceController(context, KEY_MOBILE_DATA_PREF, getSettingsLifecycle(), this, mSubId), new ConvertToEsimPreferenceController(context, KEY_CONVERT_TO_ESIM_PREF, getSettingsLifecycle(), this, mSubId)); } Loading Loading @@ -286,6 +289,8 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings impleme .addListener(videoCallingPreferenceController); use(ContactDiscoveryPreferenceController.class).init(getParentFragmentManager(), mSubId); use(NrAdvancedCallingPreferenceController.class).init(mSubId); use(TransferEsimPreferenceController.class).init(mSubId, mSubscriptionInfoEntity); use(ConvertToEsimPreferenceController.class).init(mSubId, mSubscriptionInfoEntity); } @Override Loading Loading
res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -11420,4 +11420,9 @@ <!-- [CHAR LIMIT=NONE] Title for Accessibility Software Cursor setting for keyboard shift. --> <string name="software_cursor_trigger_keyboard_shift_enabled_title" translatable="false">Shift gesture detection region above keyboard</string> <!-- [CHAR LIMIT=NONE] Title for preference: Convert to eSIM --> <string name="convert_to_esim_title">Convert to eSIM</string> <!-- [CHAR LIMIT=NONE] Title for preference: Transfer eSIM to another device --> <string name="transfer_esim_to_another_device_title">Transfer eSIM to another device</string> </resources>
res/xml/mobile_network_settings.xml +12 −0 Original line number Diff line number Diff line Loading @@ -250,6 +250,18 @@ settings:controller="com.android.settings.network.telephony.NrAdvancedCallingPreferenceController"/> </PreferenceCategory> <Preference android:key="convert_to_esim" android:persistent="false" android:title="@string/convert_to_esim_title" settings:controller="com.android.settings.network.telephony.ConvertToEsimPreferenceController"/> <Preference android:key="transfer_esim" android:persistent="false" android:title="@string/transfer_esim_to_another_device_title" settings:controller="com.android.settings.network.telephony.TransferEsimPreferenceController"/> <Preference android:key="erase_sim" android:persistent="false" Loading
src/com/android/settings/network/telephony/ConvertToEsimPreferenceController.java 0 → 100644 +145 −0 Original line number Diff line number Diff line /** * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.network.telephony; import static androidx.lifecycle.Lifecycle.Event.ON_START; import static androidx.lifecycle.Lifecycle.Event.ON_STOP; import android.content.Context; import android.text.TextUtils; import androidx.annotation.VisibleForTesting; import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.OnLifecycleEvent; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.settings.network.MobileNetworkRepository; import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.mobile.dataservice.DataServiceUtils; import com.android.settingslib.mobile.dataservice.MobileNetworkInfoEntity; import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity; import com.android.settingslib.mobile.dataservice.UiccInfoEntity; import java.util.ArrayList; import java.util.List; public class ConvertToEsimPreferenceController extends TelephonyBasePreferenceController implements LifecycleObserver, MobileNetworkRepository.MobileNetworkCallback { private Preference mPreference; private LifecycleOwner mLifecycleOwner; private MobileNetworkRepository mMobileNetworkRepository; private List<SubscriptionInfoEntity> mSubscriptionInfoEntityList = new ArrayList<>(); private SubscriptionInfoEntity mSubscriptionInfoEntity; public ConvertToEsimPreferenceController(Context context, String key, Lifecycle lifecycle, LifecycleOwner lifecycleOwner, int subId) { super(context, key); mSubId = subId; mMobileNetworkRepository = MobileNetworkRepository.createBySubId(context, this, mSubId); mLifecycleOwner = lifecycleOwner; if (lifecycle != null) { lifecycle.addObserver(this); } } public void init(int subId, SubscriptionInfoEntity subInfoEntity) { mSubId = subId; mSubscriptionInfoEntity = subInfoEntity; } @OnLifecycleEvent(ON_START) public void onStart() { mMobileNetworkRepository.addRegister(mLifecycleOwner); } @OnLifecycleEvent(ON_STOP) public void onStop() { mMobileNetworkRepository.removeRegister(); } @Override public void displayPreference(PreferenceScreen screen) { super.displayPreference(screen); mPreference = screen.findPreference(getPreferenceKey()); } @Override public int getAvailabilityStatus(int subId) { return CONDITIONALLY_UNAVAILABLE; // TODO(b/262195754): Need the intent to enabled the feature. // return mSubscriptionInfoEntity != null && mSubscriptionInfoEntity.isActiveSubscriptionId // && !mSubscriptionInfoEntity.isEmbedded ? AVAILABLE // : CONDITIONALLY_UNAVAILABLE; } @VisibleForTesting void update() { if (mPreference == null) { return; } mPreference.setVisible(getAvailabilityStatus(mSubId) == AVAILABLE); } @Override public boolean handlePreferenceTreeClick(Preference preference) { if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) { return false; } // Send intent to launch LPA return true; } @VisibleForTesting public void setSubscriptionInfoEntity(SubscriptionInfoEntity subscriptionInfoEntity) { mSubscriptionInfoEntity = subscriptionInfoEntity; } @Override public void onAirplaneModeChanged(boolean airplaneModeEnabled) { } @Override public void onAvailableSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList) { } @Override public void onActiveSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList) { // TODO(b/262195754): Need the intent to enabled the feature. // if (DataServiceUtils.shouldUpdateEntityList(mSubscriptionInfoEntityList, // subInfoEntityList)) { // mSubscriptionInfoEntityList = subInfoEntityList; // mSubscriptionInfoEntityList.forEach(entity -> { // if (Integer.parseInt(entity.subId) == mSubId) { // mSubscriptionInfoEntity = entity; // update(); // } // }); // } } @Override public void onAllUiccInfoChanged(List<UiccInfoEntity> uiccInfoEntityList) { } @Override public void onAllMobileNetworkInfoChanged( List<MobileNetworkInfoEntity> mobileNetworkInfoEntityList) { } }
src/com/android/settings/network/telephony/MobileDataPreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -26,10 +26,10 @@ import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import androidx.annotation.VisibleForTesting; import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.OnLifecycleEvent; import androidx.annotation.VisibleForTesting; import androidx.fragment.app.FragmentManager; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; Loading
src/com/android/settings/network/telephony/MobileNetworkSettings.java +5 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings impleme private static final String KEY_CALLS_PREF = "calls_preference"; private static final String KEY_SMS_PREF = "sms_preference"; private static final String KEY_MOBILE_DATA_PREF = "mobile_data_enable"; private static final String KEY_CONVERT_TO_ESIM_PREF = "convert_to_esim"; //String keys for preference lookup private static final String BUTTON_CDMA_SYSTEM_SELECT_KEY = "cdma_system_select_key"; Loading Loading @@ -178,6 +179,8 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings impleme new SmsDefaultSubscriptionController(context, KEY_SMS_PREF, getSettingsLifecycle(), this), new MobileDataPreferenceController(context, KEY_MOBILE_DATA_PREF, getSettingsLifecycle(), this, mSubId), new ConvertToEsimPreferenceController(context, KEY_CONVERT_TO_ESIM_PREF, getSettingsLifecycle(), this, mSubId)); } Loading Loading @@ -286,6 +289,8 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings impleme .addListener(videoCallingPreferenceController); use(ContactDiscoveryPreferenceController.class).init(getParentFragmentManager(), mSubId); use(NrAdvancedCallingPreferenceController.class).init(mSubId); use(TransferEsimPreferenceController.class).init(mSubId, mSubscriptionInfoEntity); use(ConvertToEsimPreferenceController.class).init(mSubId, mSubscriptionInfoEntity); } @Override Loading