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

Commit a761b1d4 authored by vagdevi's avatar vagdevi Committed by Hall Liu
Browse files

Surface APIs to use WorkSource

Add WorkSource to following RIL (and related)  APIs:
- nvReadItem
- nvWriteItem
- setSimCardPower
- getModemActivityInfo
- setAllowedCarriers
- getAllowedCarriers

Also gave APIs default empty implementation.

Bug: 111665837
Test: testing done locally by having a package call these APIs
and verify that bugreport prints about APIs in dumpsys
in package's WakeLockAccountant
Change-Id: I41ff4cc198f16abe2b3d4a4bf9b2d616b974d6d8
Merged-In: I41ff4cc198f16abe2b3d4a4bf9b2d616b974d6d8
parent a38578a5
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -1895,8 +1895,9 @@ public interface CommandsInterface {
     *
     * @param itemID the ID of the item to read
     * @param response callback message with the String response in the obj field
     * @param workSource calling WorkSource
     */
    void nvReadItem(int itemID, Message response);
    default void nvReadItem(int itemID, Message response, WorkSource workSource) {}

    /**
     * Write one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
@@ -1905,8 +1906,10 @@ public interface CommandsInterface {
     * @param itemID the ID of the item to read
     * @param itemValue the value to write, as a String
     * @param response Callback message.
     * @param workSource calling WorkSource
     */
    void nvWriteItem(int itemID, String itemValue, Message response);
    default void nvWriteItem(int itemID, String itemValue, Message response,
            WorkSource workSource) {}

    /**
     * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
@@ -2059,23 +2062,27 @@ public interface CommandsInterface {
     * Get modem activity info and stats
     *
     * @param result Callback message contains the modem activity information
     * @param workSource calling WorkSource
     */
    public void getModemActivityInfo(Message result);
    default void getModemActivityInfo(Message result, WorkSource workSource) {}

    /**
     * Set allowed carriers
     *
     * @param carriers Allowed carriers
     * @param result Callback message contains the number of carriers set successfully
     * @param workSource calling WorkSource
     */
    public void setAllowedCarriers(List<CarrierIdentifier> carriers, Message result);
    default void setAllowedCarriers(List<CarrierIdentifier> carriers, Message result,
            WorkSource workSource) {}

    /**
     * Get allowed carriers
     *
     * @param result Callback message contains the allowed carriers
     * @param workSource calling WorkSource
     */
    public void getAllowedCarriers(Message result);
    default void getAllowedCarriers(Message result, WorkSource workSource) {}

    /**
     * Register for unsolicited PCO data.  This information is carrier-specific,
@@ -2167,8 +2174,9 @@ public interface CommandsInterface {
     * - {@link android.telephony.TelephonyManager#CARD_POWER_UP}
     * - {@link android.telephony.TelephonyManager#CARD_POWER_UP_PASS_THROUGH}
     * @param result callback message contains the information of SUCCESS/FAILURE
     * @param workSource calling WorkSource
     */
    void setSimCardPower(int state, Message result);
    default void setSimCardPower(int state, Message result, WorkSource workSource) {}

    /**
     * Register for unsolicited Carrier Public Key.
+16 −12
Original line number Diff line number Diff line
@@ -2102,9 +2102,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     *
     * @param itemID the ID of the item to read
     * @param response callback message with the String response in the obj field
     * @param workSource calling WorkSource
     */
    public void nvReadItem(int itemID, Message response) {
        mCi.nvReadItem(itemID, response);
    public void nvReadItem(int itemID, Message response, WorkSource workSource) {
        mCi.nvReadItem(itemID, response, workSource);
    }

    /**
@@ -2114,9 +2115,11 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     * @param itemID the ID of the item to read
     * @param itemValue the value to write, as a String
     * @param response Callback message.
     * @param workSource calling WorkSource
     */
    public void nvWriteItem(int itemID, String itemValue, Message response) {
        mCi.nvWriteItem(itemID, itemValue, response);
    public void nvWriteItem(int itemID, String itemValue, Message response,
            WorkSource workSource) {
        mCi.nvWriteItem(itemID, itemValue, response, workSource);
    }

    /**
@@ -3481,8 +3484,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
     * Returns the modem activity information
     */
    public void getModemActivityInfo(Message response)  {
        mCi.getModemActivityInfo(response);
    public void getModemActivityInfo(Message response, WorkSource workSource)  {
        mCi.getModemActivityInfo(response, workSource);
    }

    /**
@@ -3497,8 +3500,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
     * Set allowed carriers
     */
    public void setAllowedCarriers(List<CarrierIdentifier> carriers, Message response) {
        mCi.setAllowedCarriers(carriers, response);
    public void setAllowedCarriers(List<CarrierIdentifier> carriers, Message response,
            WorkSource workSource) {
        mCi.setAllowedCarriers(carriers, response, workSource);
    }

    /** Sets the SignalStrength reporting criteria. */
@@ -3514,8 +3518,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
     * Get allowed carriers
     */
    public void getAllowedCarriers(Message response) {
        mCi.getAllowedCarriers(response);
    public void getAllowedCarriers(Message response, WorkSource workSource) {
        mCi.getAllowedCarriers(response, workSource);
    }

    /**
@@ -3657,8 +3661,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     * - {@link android.telephony.TelephonyManager#CARD_POWER_UP}
     * - {@link android.telephony.TelephonyManager#CARD_POWER_UP_PASS_THROUGH}
     **/
    public void setSimPowerState(int state) {
        mCi.setSimCardPower(state, null);
    public void setSimPowerState(int state, WorkSource workSource) {
        mCi.setSimCardPower(state, null, workSource);
    }

    public void setRadioIndicationUpdateMode(int filters, int mode) {
+21 −12
Original line number Diff line number Diff line
@@ -3242,11 +3242,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    @Override
    public void nvReadItem(int itemID, Message result) {
    public void nvReadItem(int itemID, Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_NV_READ_ITEM, result,
                    mRILDefaultWorkSource);
                    workSource);

            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
@@ -3262,11 +3263,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    @Override
    public void nvWriteItem(int itemId, String itemValue, Message result) {
    public void nvWriteItem(int itemId, String itemValue, Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_NV_WRITE_ITEM, result,
                    mRILDefaultWorkSource);
                    workSource);

            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
@@ -3601,11 +3603,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    @Override
    public void getModemActivityInfo(Message result) {
    public void getModemActivityInfo(Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_GET_ACTIVITY_INFO, result,
                    mRILDefaultWorkSource);
                    workSource);

            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
@@ -3627,12 +3630,15 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    @Override
    public void setAllowedCarriers(List<CarrierIdentifier> carriers, Message result) {
    public void setAllowedCarriers(List<CarrierIdentifier> carriers, Message result,
            WorkSource workSource) {
        checkNotNull(carriers, "Allowed carriers list cannot be null.");
        workSource = getDeafultWorkSourceIfInvalid(workSource);

        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_ALLOWED_CARRIERS, result,
                    mRILDefaultWorkSource);
                    workSource);

            if (RILJ_LOGD) {
                String logStr = "";
@@ -3686,11 +3692,13 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    @Override
    public void getAllowedCarriers(Message result) {
    public void getAllowedCarriers(Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);

        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_GET_ALLOWED_CARRIERS, result,
                    mRILDefaultWorkSource);
                    workSource);

            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
@@ -3835,11 +3843,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    @Override
    public void setSimCardPower(int state, Message result) {
    public void setSimCardPower(int state, Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_SIM_CARD_POWER, result,
                    mRILDefaultWorkSource);
                    workSource);

            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + state);
+0 −25
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.net.KeepalivePacketData;
import android.net.LinkProperties;
import android.os.Handler;
import android.os.Message;
import android.service.carrier.CarrierIdentifier;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkScanRequest;
import android.telephony.data.DataProfile;
@@ -33,8 +32,6 @@ import com.android.internal.telephony.UUSInfo;
import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;

import java.util.List;

/**
 * Volte doesn't need CommandsInterface. The class does nothing but made to work
 * with Phone's constructor.
@@ -588,12 +585,6 @@ class ImsPhoneCommandInterface extends BaseCommands implements CommandsInterface
    public void iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2,
                                            int p3, String data, Message response) {}

    @Override
    public void nvReadItem(int itemID, Message response) {}

    @Override
    public void nvWriteItem(int itemID, String itemValue, Message response) {}

    @Override
    public void nvWriteCdmaPrl(byte[] preferredRoamingList, Message response) {}

@@ -627,23 +618,11 @@ class ImsPhoneCommandInterface extends BaseCommands implements CommandsInterface
    public void pullLceData(Message result) {
    }

    @Override
    public void getModemActivityInfo(Message result) {
    }

    @Override
    public void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo,
                                                Message result) {
    }

    @Override
    public void setAllowedCarriers(List<CarrierIdentifier> carriers, Message result) {
    }

    @Override
    public void getAllowedCarriers(Message result) {
    }

    @Override
    public void sendDeviceState(int stateType, boolean state, Message result) {
    }
@@ -663,10 +642,6 @@ class ImsPhoneCommandInterface extends BaseCommands implements CommandsInterface
            Message result) {
    }

    @Override
    public void setSimCardPower(int state, Message result) {
    }

    @Override
    public void startNattKeepalive(
            int contextId, KeepalivePacketData packetData, int intervalMillis, Message result) {
+0 −27
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.net.KeepalivePacketData;
import android.net.LinkProperties;
import android.os.Handler;
import android.os.Message;
import android.service.carrier.CarrierIdentifier;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkScanRequest;
import android.telephony.data.DataProfile;
@@ -32,8 +31,6 @@ import com.android.internal.telephony.UUSInfo;
import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;

import java.util.List;

/**
 * SIP doesn't need CommandsInterface. The class does nothing but made to work
 * with Phone's constructor.
@@ -593,14 +590,6 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface {
            int p3, String data, Message response) {
    }

    @Override
    public void nvReadItem(int itemID, Message response) {
    }

    @Override
    public void nvWriteItem(int itemID, String itemValue, Message response) {
    }

    @Override
    public void nvWriteCdmaPrl(byte[] preferredRoamingList, Message response) {
    }
@@ -629,23 +618,11 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface {
    public void pullLceData(Message result) {
    }

    @Override
    public void getModemActivityInfo(Message result) {
    }

    @Override
    public void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo,
                                                Message result) {
    }

    @Override
    public void setAllowedCarriers(List<CarrierIdentifier> carriers, Message result) {
    }

    @Override
    public void getAllowedCarriers(Message result) {
    }

    @Override
    public void sendDeviceState(int stateType, boolean state, Message result) {
    }
@@ -665,10 +642,6 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface {
            Message result) {
    }

    @Override
    public void setSimCardPower(int state, Message result) {
    }

    @Override
    public void startNattKeepalive(
            int contextId, KeepalivePacketData packetData, int intervalMillis, Message result) {
Loading