From b4831d9fdeb13ad3574fcf2aeb13a0f46d592349 Mon Sep 17 00:00:00 2001 From: hoffc Date: Wed, 26 Jan 2022 15:28:54 +0800 Subject: [PATCH 1/6] Settings: Fix FC when learn more textview help intent is NULL Click the learn more textview in footer preference and trigger its help intent action. FC occurs when its help intent is NULL. Add NULL check and hide the learn more textview if its help intent is not set. Buganizer: 216401549 Change-Id: I3bad6814ef399d1ecd3003649edf42102478242b Merged-In: I4e7a7c926205be1179d55d33ada345024c8a44ab --- .../fuelgauge/AdvancedPowerUsageDetail.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java index 3319e1b1492..7ed6337c9bb 100644 --- a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java +++ b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java @@ -354,12 +354,15 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements footerString = context.getString(R.string.manager_battery_usage_footer); } mFooterPreference.setTitle(footerString); - mFooterPreference.setLearnMoreAction(v -> - startActivityForResult(HelpUtils.getHelpIntent(context, - context.getString(R.string.help_url_app_usage_settings), - /*backupContext=*/ ""), /*requestCode=*/ 0)); - mFooterPreference.setLearnMoreContentDescription( - context.getString(R.string.manager_battery_usage_link_a11y)); + final Intent helpIntent = HelpUtils.getHelpIntent(context, + context.getString(R.string.help_url_app_usage_settings), + /*backupContext=*/ ""); + if (helpIntent != null) { + mFooterPreference.setLearnMoreAction(v -> + startActivityForResult(helpIntent, /*requestCode=*/ 0)); + mFooterPreference.setLearnMoreContentDescription( + context.getString(R.string.manager_battery_usage_link_a11y)); + } } @Override From 2b860e009f61e75e2fca929640a8b2fed18117cd Mon Sep 17 00:00:00 2001 From: My Name Date: Tue, 1 Feb 2022 13:38:37 +0000 Subject: [PATCH 2/6] Adding configuration to timeout for "Android is starting message" Low end devices takes longer than 2sec for booting generally. The timeout keeps the screen blank for 2sec. Adding a configuration so that we can override it for JioPhone Next. Bug: 199120420 Test: tested manually on cuttlefish Change-Id: I58c649e05f0023d4c1ee9d5117d8ca143b2ffa6a --- src/com/android/settings/FallbackHome.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/FallbackHome.java b/src/com/android/settings/FallbackHome.java index 40867aa0726..b70470b5318 100644 --- a/src/com/android/settings/FallbackHome.java +++ b/src/com/android/settings/FallbackHome.java @@ -42,7 +42,7 @@ import java.util.Objects; public class FallbackHome extends Activity { private static final String TAG = "FallbackHome"; - private static final int PROGRESS_TIMEOUT = 2000; + private int mProgressTimeout; private boolean mProvisioned; private WallpaperManager mWallManager; @@ -76,6 +76,12 @@ public class FallbackHome extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + mProgressTimeout = getResources().getInteger( + com.android.internal.R.integer.config_progressTimeoutFallbackHome); + + if (mProgressTimeout <= 0) { + mProgressTimeout = 0; + } // Set ourselves totally black before the device is provisioned so that // we don't flash the wallpaper before SUW @@ -107,7 +113,7 @@ public class FallbackHome extends Activity { protected void onResume() { super.onResume(); if (mProvisioned) { - mHandler.postDelayed(mProgressTimeoutRunnable, PROGRESS_TIMEOUT); + mHandler.postDelayed(mProgressTimeoutRunnable, mProgressTimeout); } } From 4e543a38f6037cee6f6237c755d9fdc00270d6e2 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Fri, 14 Jan 2022 23:13:54 +0800 Subject: [PATCH 3/6] Do not let guest user disable secure nfc Bug: 209446496 Test: manual Merged-In: I7253f7f08fde04e30400a30d9a0d24f1ceff04b0 Change-Id: I7253f7f08fde04e30400a30d9a0d24f1ceff04b0 (cherry picked from commit d9e3e6e4b1c3cb1a04dba0f530505843ef44a748) --- .../AdvancedConnectedDeviceDashboardFragment.java | 9 +++++++++ src/com/android/settings/nfc/SecureNfcEnabler.java | 14 +++++++++++--- .../nfc/SecureNfcPreferenceController.java | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java b/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java index 0d130d92122..fe14c52c228 100644 --- a/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java +++ b/src/com/android/settings/connecteddevice/AdvancedConnectedDeviceDashboardFragment.java @@ -18,12 +18,16 @@ package com.android.settings.connecteddevice; import android.app.settings.SettingsEnums; import android.content.Context; import android.content.pm.PackageManager; +import android.content.pm.UserInfo; +import android.os.UserHandle; +import android.os.UserManager; import android.provider.SearchIndexableResource; import com.android.settings.R; import com.android.settings.bluetooth.BluetoothFilesPreferenceController; import com.android.settings.dashboard.DashboardFragment; import com.android.settings.nfc.AndroidBeamPreferenceController; +import com.android.settings.nfc.SecureNfcPreferenceController; import com.android.settings.print.PrintSettingPreferenceController; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settingslib.core.AbstractPreferenceController; @@ -106,6 +110,11 @@ public class AdvancedConnectedDeviceDashboardFragment extends DashboardFragment if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC)) { keys.add(AndroidBeamPreferenceController.KEY_ANDROID_BEAM_SETTINGS); } + final UserManager userManager = context.getSystemService(UserManager.class); + final UserInfo myUserInfo = userManager.getUserInfo(UserHandle.myUserId()); + if (myUserInfo.isGuest()) { + keys.add(SecureNfcPreferenceController.KEY_SECURENFC_SETTINGS); + } return keys; } diff --git a/src/com/android/settings/nfc/SecureNfcEnabler.java b/src/com/android/settings/nfc/SecureNfcEnabler.java index 9acaf6461f2..f31a382a571 100644 --- a/src/com/android/settings/nfc/SecureNfcEnabler.java +++ b/src/com/android/settings/nfc/SecureNfcEnabler.java @@ -18,9 +18,8 @@ package com.android.settings.nfc; import android.content.Context; import android.nfc.NfcAdapter; -import android.provider.Settings; +import android.os.UserManager; -import androidx.annotation.VisibleForTesting; import androidx.preference.SwitchPreference; import com.android.settings.R; @@ -32,10 +31,12 @@ import com.android.settings.R; */ public class SecureNfcEnabler extends BaseNfcEnabler { private final SwitchPreference mPreference; + private final UserManager mUserManager; public SecureNfcEnabler(Context context, SwitchPreference preference) { super(context); mPreference = preference; + mUserManager = context.getSystemService(UserManager.class); } @Override @@ -48,7 +49,7 @@ public class SecureNfcEnabler extends BaseNfcEnabler { case NfcAdapter.STATE_ON: mPreference.setSummary(R.string.nfc_secure_toggle_summary); mPreference.setChecked(mPreference.isChecked()); - mPreference.setEnabled(true); + mPreference.setEnabled(isToggleable()); break; case NfcAdapter.STATE_TURNING_ON: mPreference.setEnabled(false); @@ -58,4 +59,11 @@ public class SecureNfcEnabler extends BaseNfcEnabler { break; } } + + private boolean isToggleable() { + if (mUserManager.isGuestUser()) { + return false; + } + return true; + } } diff --git a/src/com/android/settings/nfc/SecureNfcPreferenceController.java b/src/com/android/settings/nfc/SecureNfcPreferenceController.java index 12dbd5749ca..1a514a683cb 100644 --- a/src/com/android/settings/nfc/SecureNfcPreferenceController.java +++ b/src/com/android/settings/nfc/SecureNfcPreferenceController.java @@ -29,6 +29,7 @@ import com.android.settingslib.core.lifecycle.events.OnResume; public class SecureNfcPreferenceController extends TogglePreferenceController implements LifecycleObserver, OnResume, OnPause { + public static final String KEY_SECURENFC_SETTINGS = "nfc_secure_settings"; private final NfcAdapter mNfcAdapter; private SecureNfcEnabler mSecureNfcEnabler; From 9082be89bfabf6a3e34d7f8cc7d3181ba29da680 Mon Sep 17 00:00:00 2001 From: Kate Montgomery Date: Sat, 5 Feb 2022 00:29:28 +0000 Subject: [PATCH 4/6] Clear recent access list when fragment is paused. When the fragment is resumed, the recent access list will be reloaded. Clearing the list ahead of time results in a nicer animation and matches the animtion when the fragment is first open. Bug: 191503437 Test: manual Change-Id: I91d01057acc601e6b2a40401f8bd69c5f5aa3579 --- .../android/settings/location/LocationSettings.java | 12 +++++++++++- .../RecentLocationAccessPreferenceController.java | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java index 8f9787b08a5..13300c93c36 100644 --- a/src/com/android/settings/location/LocationSettings.java +++ b/src/com/android/settings/location/LocationSettings.java @@ -63,6 +63,7 @@ public class LocationSettings extends DashboardFragment implements private LocationSwitchBarController mSwitchBarController; private LocationEnabler mLocationEnabler; + private RecentLocationAccessPreferenceController mController; @Override public int getMetricsCategory() { @@ -86,12 +87,21 @@ public class LocationSettings extends DashboardFragment implements super.onAttach(context); use(AppLocationPermissionPreferenceController.class).init(this); - use(RecentLocationAccessPreferenceController.class).init(this); + mController = use(RecentLocationAccessPreferenceController.class); + mController.init(this); use(RecentLocationAccessSeeAllButtonPreferenceController.class).init(this); use(LocationForWorkPreferenceController.class).init(this); use(LocationSettingsFooterPreferenceController.class).init(this); } + @Override + public void onPause() { + super.onPause(); + if (mController != null) { + mController.clearPreferenceList(); + } + } + @Override protected int getPreferenceScreenResId() { return R.xml.location_settings; diff --git a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java index ba660ee3c6d..ea3704cccc0 100644 --- a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java +++ b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java @@ -126,6 +126,15 @@ public class RecentLocationAccessPreferenceController extends LocationBasePrefer mCategoryRecentLocationRequests.setVisible(enabled); } + /** + * Clears the list of apps which recently accessed location from the screen. + */ + public void clearPreferenceList() { + if (mCategoryRecentLocationRequests != null) { + mCategoryRecentLocationRequests.removeAll(); + } + } + /** * Initialize {@link ProfileSelectFragment.ProfileType} of the controller * From b48802c15211313e57d0f4d3eca6eb7777d0e359 Mon Sep 17 00:00:00 2001 From: tom hsu Date: Mon, 24 Jan 2022 22:10:02 +0800 Subject: [PATCH 5/6] [Panlingual] Add PackageManager api to Per app language. Bug: 216099500 Test: atest pass Test: local test with Settings app Change-Id: Icbdb1475d45e0652de369711ea21b5043f36dc19 --- .../appinfo/AppLocaleDetails.java | 33 ++++++-- .../appinfo/AppLocaleDetailsTest.java | 81 ++++++++++++++----- 2 files changed, 87 insertions(+), 27 deletions(-) diff --git a/src/com/android/settings/applications/appinfo/AppLocaleDetails.java b/src/com/android/settings/applications/appinfo/AppLocaleDetails.java index aee360e22f6..164cfd9f2fa 100644 --- a/src/com/android/settings/applications/appinfo/AppLocaleDetails.java +++ b/src/com/android/settings/applications/appinfo/AppLocaleDetails.java @@ -18,6 +18,7 @@ package com.android.settings.applications.appinfo; import static com.android.settings.widget.EntityHeaderController.ActionType; import android.app.Activity; +import android.app.LocaleConfig; import android.app.LocaleManager; import android.app.settings.SettingsEnums; import android.content.Context; @@ -289,12 +290,18 @@ public class AppLocaleDetails extends AppInfoBase implements RadioButtonPreferen @VisibleForTesting void handleSupportedLocales() { - //TODO Waiting for PackageManager api - String[] languages = getAssetSystemLocales(); - - for (String language : languages) { - mSupportedLocales.add(Locale.forLanguageTag(language)); + LocaleList localeList = getPackageLocales(); + if (localeList == null) { + String[] languages = getAssetSystemLocales(); + for (String language : languages) { + mSupportedLocales.add(Locale.forLanguageTag(language)); + } + } else { + for (int i = 0; i < localeList.size(); i++) { + mSupportedLocales.add(localeList.get(i)); + } } + if (mSuggestedLocales != null || !mSuggestedLocales.isEmpty()) { mSupportedLocales.removeAll(mSuggestedLocales); } @@ -349,9 +356,23 @@ public class AppLocaleDetails extends AppInfoBase implements RadioButtonPreferen packageManager.getPackageInfo(mPackageName, PackageManager.MATCH_ALL) .applicationInfo).getAssets().getNonSystemLocales(); } catch (PackageManager.NameNotFoundException e) { - Log.w(TAG, "Can not found the package name : " + e); + Log.w(TAG, "Can not found the package name : " + mPackageName + " / " + e); } return new String[0]; } + + @VisibleForTesting + LocaleList getPackageLocales() { + try { + LocaleConfig localeConfig = + new LocaleConfig(mContext.createPackageContext(mPackageName, 0)); + if (localeConfig.getStatus() == LocaleConfig.STATUS_SUCCESS) { + return localeConfig.getSupportedLocales(); + } + } catch (PackageManager.NameNotFoundException e) { + Log.w(TAG, "Can not found the package name : " + mPackageName + " / " + e); + } + return null; + } } } diff --git a/tests/unit/src/com/android/settings/applications/appinfo/AppLocaleDetailsTest.java b/tests/unit/src/com/android/settings/applications/appinfo/AppLocaleDetailsTest.java index 1042a6a20a7..ed4c127dcf5 100644 --- a/tests/unit/src/com/android/settings/applications/appinfo/AppLocaleDetailsTest.java +++ b/tests/unit/src/com/android/settings/applications/appinfo/AppLocaleDetailsTest.java @@ -55,6 +55,7 @@ public class AppLocaleDetailsTest { private LocaleList mSystemLocales; private LocaleList mAppLocale; private String[] mAssetLocales; + private LocaleList mPackageLocales; @Before @UiThreadTest @@ -67,11 +68,13 @@ public class AppLocaleDetailsTest { when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager); when(mContext.getSystemService(LocaleManager.class)).thenReturn(mLocaleManager); - setupInitialLocales("en", - "tw", - "jp", - "en, uk, jp, ne", - new String[]{"en", "ne", "ms", "pa"}); + setupInitialLocales( + /* appLocale= */ "en", + /* simCountry= */ "tw", + /* networkCountry= */ "jp", + /* systemLocales= */ "en, uk, jp, ne", + /* packageLocales= */ "pa, cn, tw, en", + /* assetLocales= */ new String[]{"en", "ne", "ms", "pa"}); } @Test @@ -105,11 +108,13 @@ public class AppLocaleDetailsTest { @UiThreadTest public void handleAllLocalesData_withoutAppLocale_1stSuggestedLocaleIsSimCountryLocale() { Locale simCountryLocale = new Locale("zh", "TW"); - setupInitialLocales("", - "tw", - "", - "en, uk, jp, ne", - new String[]{"en", "ne", "ms", "pa"}); + setupInitialLocales( + /* appLocale= */ "", + /* simCountry= */ "tw", + /* networkCountry= */ "", + /* systemLocales= */ "en, uk, jp, ne", + /* packageLocales= */ "", + /* assetLocales= */ new String[]{}); DummyAppLocaleDetailsHelper helper = new DummyAppLocaleDetailsHelper(mContext, APP_PACKAGE_NAME); @@ -124,11 +129,13 @@ public class AppLocaleDetailsTest { @UiThreadTest public void handleAllLocalesData_withoutAppLocale_1stSuggestedLocaleIsNetworkCountryLocale() { Locale networkCountryLocale = new Locale("en", "GB"); - setupInitialLocales("", - "", - "gb", - "en, uk, jp, ne", - new String[]{"en", "ne", "ms", "pa"}); + setupInitialLocales( + /* appLocale= */ "", + /* simCountry= */ "", + /* networkCountry= */ "gb", + /* systemLocales= */ "en, uk, jp, ne", + /* packageLocales= */ "", + /* assetLocales= */ new String[]{}); DummyAppLocaleDetailsHelper helper = new DummyAppLocaleDetailsHelper(mContext, APP_PACKAGE_NAME); @@ -142,11 +149,32 @@ public class AppLocaleDetailsTest { @Test @UiThreadTest public void handleAllLocalesData_noAppAndSimNetworkLocale_1stLocaleIsFirstOneInSystemLocales() { - setupInitialLocales("", - "", - "", - "en, uk, jp, ne", - new String[]{"en", "ne", "ms", "pa"}); + setupInitialLocales( + /* appLocale= */ "", + /* simCountry= */ "", + /* networkCountry= */ "", + /* systemLocales= */ "en, uk, jp, ne", + /* packageLocales= */ "", + /* assetLocales= */ new String[]{}); + DummyAppLocaleDetailsHelper helper = + new DummyAppLocaleDetailsHelper(mContext, APP_PACKAGE_NAME); + + helper.handleAllLocalesData(); + + Locale locale = Iterables.get(helper.getSuggestedLocales(), 0); + assertTrue(locale.equals(mSystemLocales.get(0))); + } + + @Test + @UiThreadTest + public void handleAllLocalesData_hasPackageAndSystemLocales_1stLocaleIs1stOneInSystemLocales() { + setupInitialLocales( + /* appLocale= */ "", + /* simCountry= */ "", + /* networkCountry= */ "", + /* systemLocales= */ "en, uk, jp, ne", + /* packageLocales= */ "pa, cn, tw, en", + /* assetLocales= */ new String[]{}); DummyAppLocaleDetailsHelper helper = new DummyAppLocaleDetailsHelper(mContext, APP_PACKAGE_NAME); @@ -204,6 +232,11 @@ public class AppLocaleDetailsTest { * * @param systemLocales System locales, a locale list by a multiple language tags with comma. * example: "en, uk, jp" + * + * @param packageLocales PackageManager locales, a locale list by a multiple language tags with + * comma. + * example: "en, uk, jp" + * * @param assetLocales Asset locales, a locale list by a multiple language tags with String * array. * example: new String[] {"en", "ne", "ms", "pa"} @@ -212,10 +245,12 @@ public class AppLocaleDetailsTest { String simCountry, String networkCountry, String systemLocales, + String packageLocales, String[] assetLocales) { mAppLocale = LocaleList.forLanguageTags(appLocale); mSystemLocales = LocaleList.forLanguageTags(systemLocales); mAssetLocales = assetLocales; + mPackageLocales = LocaleList.forLanguageTags(packageLocales); when(mTelephonyManager.getSimCountryIso()).thenReturn(simCountry); when(mTelephonyManager.getNetworkCountryIso()).thenReturn(networkCountry); when(mLocaleManager.getApplicationLocales(anyString())).thenReturn(mAppLocale); @@ -237,6 +272,10 @@ public class AppLocaleDetailsTest { LocaleList getCurrentSystemLocales() { return mSystemLocales; } - } + @Override + LocaleList getPackageLocales() { + return mPackageLocales; + } + } } From 4d0749febdfb7d297e6e16a04d09f56dd2c99b55 Mon Sep 17 00:00:00 2001 From: SongFerngWang Date: Tue, 8 Feb 2022 16:37:43 +0800 Subject: [PATCH 6/6] [MEP] Refactor SlotSidecar API for all of sim page. remove the SlotSidecar's run() and using new run() with port id information. Bug: 218439715 Test: manual test for UI Change-Id: I81479a0c514f2b8f58b9167b31d357f017732482 --- .../SwitchToEuiccSubscriptionSidecar.java | 15 ++++-------- .../network/SwitchToRemovableSlotSidecar.java | 23 ------------------- .../settings/sim/ChooseSimActivity.java | 5 ++-- .../SwitchToEsimConfirmDialogActivity.java | 4 +++- .../sim/receivers/SimSlotChangeHandler.java | 5 ++-- 5 files changed, 14 insertions(+), 38 deletions(-) diff --git a/src/com/android/settings/network/SwitchToEuiccSubscriptionSidecar.java b/src/com/android/settings/network/SwitchToEuiccSubscriptionSidecar.java index 9524164bc33..c6d1ea0149b 100644 --- a/src/com/android/settings/network/SwitchToEuiccSubscriptionSidecar.java +++ b/src/com/android/settings/network/SwitchToEuiccSubscriptionSidecar.java @@ -69,20 +69,15 @@ public class SwitchToEuiccSubscriptionSidecar extends EuiccOperationSidecar { } } - /** Starts calling EuiccManager#switchToSubscription to enable/disable the eSIM profile. */ - // ToDo: delete this api and refactor the related code. - public void run(int subscriptionId) { - setState(State.RUNNING, Substate.UNUSED); - mCallbackIntent = createCallbackIntent(); - mEuiccManager.switchToSubscription(subscriptionId, mCallbackIntent); - } - /** * Starts calling EuiccManager#switchToSubscription to enable/disable the eSIM profile. * * @param subscriptionId the esim's subscriptionId. - * @param port the esim's portId. If user wants to inactivate esim, then user must to assign the - * the port. If user wants to activate esim, then the port can be -1. + * @param port the esim's portId. If user wants to inactivate esim, then user must to assign + * the corresponding port. If user wants to activate esim, then the port can be + * {@link UiccSlotUtil#INVALID_PORT_ID}. When it is + * {@link UiccSlotUtil#INVALID_PORT_ID}, the system will reassign a corresponding + * port id. * @param removedSubInfo if the all of slots have sims, it should remove the one of active sim. * If the removedSubInfo is null, then use the default value. * The default value is the esim slot and portId 0. diff --git a/src/com/android/settings/network/SwitchToRemovableSlotSidecar.java b/src/com/android/settings/network/SwitchToRemovableSlotSidecar.java index 9b9c0ddbd1a..e98b405ee3d 100644 --- a/src/com/android/settings/network/SwitchToRemovableSlotSidecar.java +++ b/src/com/android/settings/network/SwitchToRemovableSlotSidecar.java @@ -80,29 +80,6 @@ public class SwitchToRemovableSlotSidecar extends EuiccOperationSidecar } } - /** - * Starts switching to the removable slot. It disables the active eSIM profile before switching - * if there is one. - * - * @param physicalSlotId removable physical SIM slot ID. - */ - // ToDo: delete this api and refactor the related code. - public void run(int physicalSlotId) { - mPhysicalSlotId = physicalSlotId; - SubscriptionManager subscriptionManager = - getContext().getSystemService(SubscriptionManager.class); - if (SubscriptionUtil.getActiveSubscriptions(subscriptionManager).stream() - .anyMatch(SubscriptionInfo::isEmbedded)) { - // In SS mode, the esim is active, then inactivate the esim. - Log.i(TAG, "There is an active eSIM profile. Disable the profile first."); - // Use INVALID_SUBSCRIPTION_ID to disable the only active profile. - mSwitchToSubscriptionSidecar.run(SubscriptionManager.INVALID_SUBSCRIPTION_ID, 0, null); - } else { - Log.i(TAG, "There is no active eSIM profiles. Start to switch to removable slot."); - mSwitchSlotSidecar.runSwitchToRemovableSlot(mPhysicalSlotId, null); - } - } - /** * Starts switching to the removable slot. * diff --git a/src/com/android/settings/sim/ChooseSimActivity.java b/src/com/android/settings/sim/ChooseSimActivity.java index d0ccc4c9d01..cebc1ba6d98 100644 --- a/src/com/android/settings/sim/ChooseSimActivity.java +++ b/src/com/android/settings/sim/ChooseSimActivity.java @@ -159,11 +159,12 @@ public class ChooseSimActivity extends Activity mSelectedItemIndex = subItem.getId(); if (mSelectedItemIndex == INDEX_PSIM) { Log.i(TAG, "Ready to switch to pSIM slot."); - mSwitchToRemovableSlotSidecar.run(UiccSlotUtil.INVALID_PHYSICAL_SLOT_ID); + mSwitchToRemovableSlotSidecar.run(UiccSlotUtil.INVALID_PHYSICAL_SLOT_ID, null); } else { Log.i(TAG, "Ready to switch to eSIM subscription with index: " + mSelectedItemIndex); mSwitchToEuiccSubscriptionSidecar.run( - mEmbeddedSubscriptions.get(mSelectedItemIndex).getSubscriptionId()); + mEmbeddedSubscriptions.get(mSelectedItemIndex).getSubscriptionId(), + UiccSlotUtil.INVALID_PORT_ID, null); } } diff --git a/src/com/android/settings/sim/SwitchToEsimConfirmDialogActivity.java b/src/com/android/settings/sim/SwitchToEsimConfirmDialogActivity.java index be2fa2d1c6d..db6e1b44f34 100644 --- a/src/com/android/settings/sim/SwitchToEsimConfirmDialogActivity.java +++ b/src/com/android/settings/sim/SwitchToEsimConfirmDialogActivity.java @@ -23,6 +23,7 @@ import android.util.Log; import com.android.settings.R; import com.android.settings.SidecarFragment; import com.android.settings.network.SwitchToEuiccSubscriptionSidecar; +import com.android.settings.network.UiccSlotUtil; import com.android.settings.network.telephony.AlertDialogFragment; import com.android.settings.network.telephony.ConfirmDialogFragment; import com.android.settings.network.telephony.SubscriptionActionDialogActivity; @@ -110,7 +111,8 @@ public class SwitchToEsimConfirmDialogActivity extends SubscriptionActionDialogA return; } Log.i(TAG, "User confirmed to switch to embedded slot."); - mSwitchToEuiccSubscriptionSidecar.run(mSubToEnabled.getSubscriptionId()); + mSwitchToEuiccSubscriptionSidecar.run(mSubToEnabled.getSubscriptionId(), + UiccSlotUtil.INVALID_PORT_ID, null); showProgressDialog( getString( R.string.sim_action_switch_sub_dialog_progress, diff --git a/src/com/android/settings/sim/receivers/SimSlotChangeHandler.java b/src/com/android/settings/sim/receivers/SimSlotChangeHandler.java index e0bc9cd7995..8c8964f798c 100644 --- a/src/com/android/settings/sim/receivers/SimSlotChangeHandler.java +++ b/src/com/android/settings/sim/receivers/SimSlotChangeHandler.java @@ -210,10 +210,11 @@ public class SimSlotChangeHandler { } List groupedEmbeddedSubscriptions = getGroupedEmbeddedSubscriptions(); - if (groupedEmbeddedSubscriptions.size() == 0 || !removableSlotInfo.getPorts().stream() .findFirst().get().isActive()) { - Log.i(TAG, "eSIM slot is active or no subscriptions exist. Do nothing."); + Log.i(TAG, "eSIM slot is active or no subscriptions exist. Do nothing." + + " The removableSlotInfo: " + removableSlotInfo + + ", groupedEmbeddedSubscriptions: " + groupedEmbeddedSubscriptions); return; }