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

Commit 4b4d80db authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

Add support for UNSOL PCO Data.

PCO is a container in data-call responses with a range
of optional fields devoted to carrier-proprietary signalling.
This change includes a class to contain this opaque info on
its way to carrier apps.

bug:28961371
bug:28567303
Change-Id: I8ad4e8e56f71d29a7dce52074959459b3063e103
parent 6ab6544f
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -73,6 +73,8 @@ public abstract class BaseCommands implements CommandsInterface {
    protected RegistrantList mHardwareConfigChangeRegistrants = new RegistrantList();
    protected RegistrantList mPhoneRadioCapabilityChangedRegistrants =
            new RegistrantList();
    protected RegistrantList mPcoDataRegistrants = new RegistrantList();


    protected Registrant mGsmSmsRegistrant;
    protected Registrant mCdmaSmsRegistrant;
@@ -900,4 +902,14 @@ public abstract class BaseCommands implements CommandsInterface {
          mLceInfoRegistrant = null;
      }
    }

    @Override
    public void registerForPcoData(Handler h, int what, Object obj) {
        mPcoDataRegistrants.add(new Registrant(h, what, obj));
    }

    @Override
    public void unregisterForPcoData(Handler h) {
        mPcoDataRegistrants.remove(h);
    }
}
+17 −0
Original line number Diff line number Diff line
@@ -2035,4 +2035,21 @@ public interface CommandsInterface {
     * @param result Callback message contains the allowed carriers
     */
    public void getAllowedCarriers(Message result);

    /**
     * Register for unsolicited PCO data.  This information is carrier-specific,
     * opaque binary blobs destined for carrier apps for interpretation.
     *
     * @param h Handler for notificaiton message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    public void registerForPcoData(Handler h, int what, Object obj);

    /**
     * Unregister for PCO data.
     *
     * @param h handler to be removed
     */
    public void unregisterForPcoData(Handler h);
}
+13 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import android.provider.Settings.SettingNotFoundException;
import android.service.carrier.CarrierIdentifier;
import android.telephony.CellInfo;
import android.telephony.NeighboringCellInfo;
import android.telephony.PcoData;
import android.telephony.PhoneNumberUtils;
import android.telephony.RadioAccessFamily;
import android.telephony.Rlog;
@@ -3113,6 +3114,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
            case RIL_UNSOL_ON_SS: ret =  responseSsData(p); break;
            case RIL_UNSOL_STK_CC_ALPHA_NOTIFY: ret =  responseString(p); break;
            case RIL_UNSOL_LCEDATA_RECV: ret = responseLceData(p); break;
            case RIL_UNSOL_PCO_DATA: ret = responsePcoData(p); break;

            default:
                throw new RuntimeException("Unrecognized unsol response: " + response);
@@ -3548,6 +3550,11 @@ public final class RIL extends BaseCommands implements CommandsInterface {
                    mLceInfoRegistrant.notifyRegistrant(new AsyncResult(null, ret, null));
                }
                break;
            case RIL_UNSOL_PCO_DATA:
                if (RILJ_LOGD) unsljLogRet(response, ret);

                mPcoDataRegistrants.notifyRegistrants(new AsyncResult(null, ret, null));
                break;
        }
    }

@@ -4346,6 +4353,11 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        return retVal;
    }

    private Object responsePcoData(Parcel p) {
        return new PcoData(p);
    }


    static String
    requestToString(int request) {
/*
@@ -4554,6 +4566,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
            case RIL_UNSOL_ON_SS: return "UNSOL_ON_SS";
            case RIL_UNSOL_STK_CC_ALPHA_NOTIFY: return "UNSOL_STK_CC_ALPHA_NOTIFY";
            case RIL_UNSOL_LCEDATA_RECV: return "UNSOL_LCE_INFO_RECV";
            case RIL_UNSOL_PCO_DATA: return "UNSOL_PCO_DATA";
            default: return "<unknown response>";
        }
    }
+8 −0
Original line number Diff line number Diff line
@@ -2084,4 +2084,12 @@ public class SimulatedCommands extends BaseCommands
    public boolean isDataAllowed() {
        return mAllowed.get();
    }

    @Override
    public void registerForPcoData(Handler h, int what, Object obj) {
    }

    @Override
    public void unregisterForPcoData(Handler h) {
    }
}
+8 −0
Original line number Diff line number Diff line
@@ -1363,4 +1363,12 @@ public class SimulatedCommandsVerifier implements CommandsInterface {
    public void getAllowedCarriers(Message result) {

    }

    @Override
    public void registerForPcoData(Handler h, int what, Object obj) {
    }

    @Override
    public void unregisterForPcoData(Handler h) {
    }
}