Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eae728cf authored by Nagendra Prasad Nagarle Basavaraju's avatar Nagendra Prasad Nagarle Basavaraju
Browse files

[Telephony Fix] ServiceStateTracker fails to update the DB

-  On notifyServiceStateChanged(), ServiceStateTracker fails to update
   the ServiceStateProvider Db Table with valid sub id SS information.
-  Currently only on poll state completion, if there is change @ poll
   state information, then only SS Information was updated to
   ServiceStateProvider DB Table.
-  Additional scenario Handled at this CL: During sub id change from
   invalid to valid, incase there is pollstate request done but no
   change detected, update SS Information at ServiceStateProvide DB
   table with valid sub Id entry.

Bug: 281220038
Test: Device Test
Test: Sanity Test Result b/285111686, b/285114296,b/281220038#comment25
Change-Id: I36dac42485e047345bb62d7a0c712706ba590bad
parent 7ecd81e4
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -405,6 +405,11 @@ public class ServiceStateTracker extends Handler {
                    // state in case our service state was never broadcasted (we don't notify
                    // service states when the subId is invalid)
                    mPhone.notifyServiceStateChanged(mPhone.getServiceState());
                    // On SubscriptionId changed from invalid  to valid sub id, create
                    // ServiceStateProvider with valid sub id entry. Note: PollStateDone can update
                    // the DB again,for the SubID with any change detected at poll state request
                    log("Update SS information on moving from invalid to valid sub id");
                    updateServiceStateToDb(mPhone.getServiceState());
                }

                boolean restoreSelection = !context.getResources().getBoolean(
@@ -3803,10 +3808,7 @@ public class ServiceStateTracker extends Handler {
                mPhone.notifyServiceStateChanged(mPhone.getServiceState());
            }

            // insert into ServiceStateProvider. This will trigger apps to wake through JobScheduler
            mPhone.getContext().getContentResolver()
                    .insert(getUriForSubscriptionId(mPhone.getSubId()),
                            getContentValuesForServiceState(mSS));
            updateServiceStateToDb(mPhone.getServiceState());

            TelephonyMetrics.getInstance().writeServiceStateChanged(mPhone.getPhoneId(), mSS);
            mPhone.getVoiceCallSessionStats().onServiceStateChanged(mSS);
@@ -3936,6 +3938,16 @@ public class ServiceStateTracker extends Handler {
        }
    }

    /**
     * Insert SS information into ServiceStateProvider DB table for a sub id.
     * This will trigger apps to wake through JobScheduler
     */
    private void updateServiceStateToDb(ServiceState serviceState) {
        mPhone.getContext().getContentResolver()
                .insert(getUriForSubscriptionId(mPhone.getSubId()),
                        getContentValuesForServiceState(serviceState));
    }

    private String getOperatorNameFromEri() {
        String eriText = null;
        if (mPhone.isPhoneTypeCdma()) {