From 35df60f316555cf3bb28195c774cb41e7776a07b Mon Sep 17 00:00:00 2001 From: Bonian Chen Date: Fri, 30 Jul 2021 23:47:04 +0800 Subject: [PATCH 1/2] [Settings] eSIM existance detection rule change 1. eSIM retrieved from SubscriptionManager#getAvailableSubscriptionInfoList() should be considered as existed all the time. 2. When SIM are both inactive(or active), sorted the ordering based on ordering provided by telephony framework. Bug: 195090132 Bug: 195091953 Bug: 194197762 Test: local Change-Id: I2fe43a35e5b7965bde3b579e2297e9cdd89ec228 (cherry picked from commit 848d097b94c0adb73d88db14e46e5f103fe8b9d1) (cherry picked from commit 824deb0ee3727f23ab68a75176825c4c73f482a9) --- .../settings/network/helper/SubscriptionAnnotation.java | 3 +-- .../settings/network/helper/SubscriptionGrouping.java | 8 ++++++-- .../settings/network/helper/SubscriptionGroupingTest.java | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/com/android/settings/network/helper/SubscriptionAnnotation.java b/src/com/android/settings/network/helper/SubscriptionAnnotation.java index 29d4fb5b900..79fbf68b6d9 100644 --- a/src/com/android/settings/network/helper/SubscriptionAnnotation.java +++ b/src/com/android/settings/network/helper/SubscriptionAnnotation.java @@ -90,16 +90,15 @@ public class SubscriptionAnnotation { mOrderWithinList = subInfoIndex; mType = mSubInfo.isEmbedded() ? TYPE_ESIM : TYPE_PSIM; + mIsExisted = true; if (mType == TYPE_ESIM) { int cardId = mSubInfo.getCardId(); - mIsExisted = eSimCardId.contains(cardId); mIsActive = activeSimSlotIndexList.contains(mSubInfo.getSimSlotIndex()); mIsAllowToDisplay = (cardId < 0) // always allow when eSIM not in slot || isDisplayAllowed(context); return; } - mIsExisted = true; mIsActive = (mSubInfo.getSimSlotIndex() > SubscriptionManager.INVALID_SIM_SLOT_INDEX) && activeSimSlotIndexList.contains(mSubInfo.getSimSlotIndex()); mIsAllowToDisplay = isDisplayAllowed(context); diff --git a/src/com/android/settings/network/helper/SubscriptionGrouping.java b/src/com/android/settings/network/helper/SubscriptionGrouping.java index cfb5ea92650..c4e0fd71bb8 100644 --- a/src/com/android/settings/network/helper/SubscriptionGrouping.java +++ b/src/com/android/settings/network/helper/SubscriptionGrouping.java @@ -16,6 +16,7 @@ package com.android.settings.network.helper; import android.os.ParcelUuid; +import android.util.Log; import androidx.annotation.Keep; import androidx.annotation.VisibleForTesting; @@ -44,9 +45,12 @@ import java.util.stream.Collectors; */ public class SubscriptionGrouping implements UnaryOperator> { + private static final String LOG_TAG = "SubscriptionGrouping"; // implementation of UnaryOperator public List apply(List listOfSubscriptions) { + Log.d(LOG_TAG, "Grouping " + listOfSubscriptions); + // group by GUID Map> groupedSubInfoList = listOfSubscriptions.stream() @@ -89,8 +93,8 @@ public class SubscriptionGrouping annoSelector = annoSelector // eSIM in front of pSIM .thenComparingInt(anno -> -anno.getType()) - // subscription ID in reverse order - .thenComparingInt(anno -> -anno.getSubscriptionId()); + // maintain the ordering given within constructor + .thenComparingInt(anno -> annoList.indexOf(anno)); return annoList.stream().sorted(annoSelector).findFirst().orElse(null); } } diff --git a/tests/unit/src/com/android/settings/network/helper/SubscriptionGroupingTest.java b/tests/unit/src/com/android/settings/network/helper/SubscriptionGroupingTest.java index 97bdb7433a7..bea720939a3 100644 --- a/tests/unit/src/com/android/settings/network/helper/SubscriptionGroupingTest.java +++ b/tests/unit/src/com/android/settings/network/helper/SubscriptionGroupingTest.java @@ -68,7 +68,7 @@ public class SubscriptionGroupingTest { List result = mTarget .apply(Arrays.asList(subAnno2, subAnno1, subAnno3)); assertThat(result.size()).isEqualTo(1); - assertThat(result.get(0)).isEqualTo(subAnno3); + assertThat(result.get(0)).isEqualTo(subAnno1); } @Test From c9a609eb6d183e3ecd0e68fe9bb9ec27d9dda561 Mon Sep 17 00:00:00 2001 From: Beverly Date: Thu, 5 Aug 2021 08:56:28 -0400 Subject: [PATCH 2/2] Use pattern subtitle string on all enroll stages So the views won't relayout and cause the pattern to render in a strange way. Test: manual Bug: 194368020 Change-Id: If6fd7ade4fd6783fe5d1ef78acc847928e01bd29 --- src/com/android/settings/password/ChooseLockPattern.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/password/ChooseLockPattern.java b/src/com/android/settings/password/ChooseLockPattern.java index 3c43fc34d25..e85ce60c6c4 100644 --- a/src/com/android/settings/password/ChooseLockPattern.java +++ b/src/com/android/settings/password/ChooseLockPattern.java @@ -370,13 +370,13 @@ public class ChooseLockPattern extends SettingsActivity { LeftButtonMode.Gone, RightButtonMode.Ok, ID_EMPTY_MESSAGE, false), ChoiceTooShort( R.string.lock_settings_picker_biometrics_added_security_message, - ID_EMPTY_MESSAGE, + R.string.lockpattern_choose_pattern_description, R.string.lockpattern_recording_incorrect_too_short, LeftButtonMode.Retry, RightButtonMode.ContinueDisabled, ID_EMPTY_MESSAGE, true), FirstChoiceValid( R.string.lock_settings_picker_biometrics_added_security_message, - ID_EMPTY_MESSAGE, + R.string.lockpattern_choose_pattern_description, R.string.lockpattern_pattern_entered_header, LeftButtonMode.Retry, RightButtonMode.Continue, ID_EMPTY_MESSAGE, false), NeedToConfirm(