Loading flags/uicc.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -142,3 +142,11 @@ flag { description: "This flag reset the cache if the sim phonebook is empty" bug:"404094844" } # OWNER=arunvoddu TARGET=25Q4 flag { name: "cat_service_creation_fix" namespace: "telephony" description: "This flag reset the cache if the sim phonebook is empty" bug:"417398404" } No newline at end of file src/java/com/android/internal/telephony/cat/CatService.java +37 −18 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.telephony.cat; import static com.android.internal.telephony.cat.CatCmdMessage.SetupEventListConstants.IDLE_SCREEN_AVAILABLE_EVENT; import static com.android.internal.telephony.cat.CatCmdMessage.SetupEventListConstants.LANGUAGE_SELECTION_EVENT; import static com.android.internal.telephony.cat.CatCmdMessage.SetupEventListConstants.USER_ACTIVITY_EVENT; import static com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType.APPTYPE_UNKNOWN; import android.app.Activity; import android.app.ActivityManager; Loading Loading @@ -52,6 +53,7 @@ import com.android.internal.telephony.ProxyController; import com.android.internal.telephony.SmsController; import com.android.internal.telephony.flags.FeatureFlags; import com.android.internal.telephony.flags.FeatureFlagsImpl; import com.android.internal.telephony.flags.Flags; import com.android.internal.telephony.subscription.SubscriptionManagerService; import com.android.internal.telephony.uicc.IccCardStatus.CardState; import com.android.internal.telephony.uicc.IccFileHandler; Loading Loading @@ -218,6 +220,34 @@ public class CatService extends Handler implements AppInterface { mContext.registerReceiver(mSmsBroadcastReceiver, new IntentFilter(SMS_SENT_ACTION)); } private static UiccCardApplication getValidUiccApplication(UiccProfile uiccProfile) { UiccCardApplication ca = null; if (uiccProfile != null) { /* Since Cat is not tied to any application, but rather is Uicc application * in itself - just get first FileHandler and IccRecords object */ ca = uiccProfile.getApplicationIndex(0); /** * Case where the SIMs reporting "UNKNOWN" application type. * If an "UNKNOWN" application is detected, its file handler won't be initialized * correctly. * To avoid issues, always use the file handler from a known, valid SIM application. */ if (Flags.catServiceCreationFix() && ca.getType() == APPTYPE_UNKNOWN && uiccProfile.getNumApplications() > 1) { for (int i = 1; i < uiccProfile.getNumApplications(); i++) { UiccCardApplication tmpCa = uiccProfile.getApplicationIndex(i); if (tmpCa.getType() != APPTYPE_UNKNOWN) { ca = tmpCa; break; } } } } return ca; } /** * Used for instantiating the Service from the Card. * Loading @@ -238,16 +268,11 @@ public class CatService extends Handler implements AppInterface { UiccCardApplication ca = null; IccFileHandler fh = null; IccRecords ir = null; if (uiccProfile != null) { /* Since Cat is not tied to any application, but rather is Uicc application * in itself - just get first FileHandler and IccRecords object */ ca = uiccProfile.getApplicationIndex(0); ca = getValidUiccApplication(uiccProfile); if (ca != null) { fh = ca.getIccFileHandler(); ir = ca.getIccRecords(); } } synchronized (sInstanceLock) { if (sInstance == null) { Loading Loading @@ -1302,16 +1327,10 @@ public class CatService extends Handler implements AppInterface { Context context, UiccProfile uiccProfile) { UiccCardApplication ca = null; IccRecords ir = null; if (uiccProfile != null) { /* Since Cat is not tied to any application, but rather is Uicc application * in itself - just get first FileHandler and IccRecords object */ ca = uiccProfile.getApplicationIndex(0); ca = getValidUiccApplication(uiccProfile); if (ca != null) { ir = ca.getIccRecords(); } } synchronized (sInstanceLock) { if ((ir != null) && (mIccRecords != ir)) { Loading Loading
flags/uicc.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -142,3 +142,11 @@ flag { description: "This flag reset the cache if the sim phonebook is empty" bug:"404094844" } # OWNER=arunvoddu TARGET=25Q4 flag { name: "cat_service_creation_fix" namespace: "telephony" description: "This flag reset the cache if the sim phonebook is empty" bug:"417398404" } No newline at end of file
src/java/com/android/internal/telephony/cat/CatService.java +37 −18 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.telephony.cat; import static com.android.internal.telephony.cat.CatCmdMessage.SetupEventListConstants.IDLE_SCREEN_AVAILABLE_EVENT; import static com.android.internal.telephony.cat.CatCmdMessage.SetupEventListConstants.LANGUAGE_SELECTION_EVENT; import static com.android.internal.telephony.cat.CatCmdMessage.SetupEventListConstants.USER_ACTIVITY_EVENT; import static com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType.APPTYPE_UNKNOWN; import android.app.Activity; import android.app.ActivityManager; Loading Loading @@ -52,6 +53,7 @@ import com.android.internal.telephony.ProxyController; import com.android.internal.telephony.SmsController; import com.android.internal.telephony.flags.FeatureFlags; import com.android.internal.telephony.flags.FeatureFlagsImpl; import com.android.internal.telephony.flags.Flags; import com.android.internal.telephony.subscription.SubscriptionManagerService; import com.android.internal.telephony.uicc.IccCardStatus.CardState; import com.android.internal.telephony.uicc.IccFileHandler; Loading Loading @@ -218,6 +220,34 @@ public class CatService extends Handler implements AppInterface { mContext.registerReceiver(mSmsBroadcastReceiver, new IntentFilter(SMS_SENT_ACTION)); } private static UiccCardApplication getValidUiccApplication(UiccProfile uiccProfile) { UiccCardApplication ca = null; if (uiccProfile != null) { /* Since Cat is not tied to any application, but rather is Uicc application * in itself - just get first FileHandler and IccRecords object */ ca = uiccProfile.getApplicationIndex(0); /** * Case where the SIMs reporting "UNKNOWN" application type. * If an "UNKNOWN" application is detected, its file handler won't be initialized * correctly. * To avoid issues, always use the file handler from a known, valid SIM application. */ if (Flags.catServiceCreationFix() && ca.getType() == APPTYPE_UNKNOWN && uiccProfile.getNumApplications() > 1) { for (int i = 1; i < uiccProfile.getNumApplications(); i++) { UiccCardApplication tmpCa = uiccProfile.getApplicationIndex(i); if (tmpCa.getType() != APPTYPE_UNKNOWN) { ca = tmpCa; break; } } } } return ca; } /** * Used for instantiating the Service from the Card. * Loading @@ -238,16 +268,11 @@ public class CatService extends Handler implements AppInterface { UiccCardApplication ca = null; IccFileHandler fh = null; IccRecords ir = null; if (uiccProfile != null) { /* Since Cat is not tied to any application, but rather is Uicc application * in itself - just get first FileHandler and IccRecords object */ ca = uiccProfile.getApplicationIndex(0); ca = getValidUiccApplication(uiccProfile); if (ca != null) { fh = ca.getIccFileHandler(); ir = ca.getIccRecords(); } } synchronized (sInstanceLock) { if (sInstance == null) { Loading Loading @@ -1302,16 +1327,10 @@ public class CatService extends Handler implements AppInterface { Context context, UiccProfile uiccProfile) { UiccCardApplication ca = null; IccRecords ir = null; if (uiccProfile != null) { /* Since Cat is not tied to any application, but rather is Uicc application * in itself - just get first FileHandler and IccRecords object */ ca = uiccProfile.getApplicationIndex(0); ca = getValidUiccApplication(uiccProfile); if (ca != null) { ir = ca.getIccRecords(); } } synchronized (sInstanceLock) { if ((ir != null) && (mIccRecords != ir)) { Loading