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

Commit e129deed authored by Nathan Harold's avatar Nathan Harold
Browse files

Add WorkSource to updateServiceLocation

Plumb the work source from the requesting app to
the HAL for any caller requesting an update to the
device's service location.

Bug: 152648516
Test: atest CellLocationTest
Change-Id: Id73161a5ba542180457e29d4f5931f599022fccc
parent 83808955
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1558,9 +1558,15 @@ public interface CommandsInterface {
     * location information (lac and/or cid) has changed.
     *
     * @param enable true to enable, false to disable
     * @param workSource calling WorkSource
     * @param response callback message
     */
    void setLocationUpdates(boolean enable, Message response);
    default void setLocationUpdates(boolean enable, WorkSource workSource, Message response) {}

    /**
     * To be deleted
     */
    default void setLocationUpdates(boolean enable, Message response) {}

    /**
     * Gets the default SMSC address.
+2 −2
Original line number Diff line number Diff line
@@ -2402,8 +2402,8 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public void updateServiceLocation() {
        mSST.enableSingleLocationUpdate();
    public void updateServiceLocation(WorkSource workSource) {
        mSST.enableSingleLocationUpdate(workSource);
    }

    @Override
+9 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.ResultReceiver;
import android.os.WorkSource;
import android.telecom.VideoProfile;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkScanRequest;
@@ -811,8 +812,15 @@ public interface PhoneInternalInterface {

    /**
     * Update the ServiceState CellLocation for current network registration.
     *
     * @param workSource the caller to be billed for work.
     */
    default void updateServiceLocation(WorkSource workSource) {}

    /**
     * To be deleted.
     */
    void updateServiceLocation();
    default void updateServiceLocation() {}

    /**
     * Enable location update notifications.
+2 −2
Original line number Diff line number Diff line
@@ -3279,11 +3279,11 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    @Override
    public void setLocationUpdates(boolean enable, Message result) {
    public void setLocationUpdates(boolean enable, WorkSource workSource, Message result) {
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_LOCATION_UPDATES, result,
                    mRILDefaultWorkSource);
                    workSource == null ? mRILDefaultWorkSource : workSource);

            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> "
+8 −5
Original line number Diff line number Diff line
@@ -1079,29 +1079,32 @@ public class ServiceStateTracker extends Handler {
    private boolean mWantContinuousLocationUpdates;
    private boolean mWantSingleLocationUpdate;

    public void enableSingleLocationUpdate() {
    /**
     * Request a single update of the device's current registered cell.
     */
    public void enableSingleLocationUpdate(WorkSource workSource) {
        if (mWantSingleLocationUpdate || mWantContinuousLocationUpdates) return;
        mWantSingleLocationUpdate = true;
        mCi.setLocationUpdates(true, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED));
        mCi.setLocationUpdates(true, workSource, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED));
    }

    public void enableLocationUpdates() {
        if (mWantSingleLocationUpdate || mWantContinuousLocationUpdates) return;
        mWantContinuousLocationUpdates = true;
        mCi.setLocationUpdates(true, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED));
        mCi.setLocationUpdates(true, null, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED));
    }

    protected void disableSingleLocationUpdate() {
        mWantSingleLocationUpdate = false;
        if (!mWantSingleLocationUpdate && !mWantContinuousLocationUpdates) {
            mCi.setLocationUpdates(false, null);
            mCi.setLocationUpdates(false, null, null);
        }
    }

    public void disableLocationUpdates() {
        mWantContinuousLocationUpdates = false;
        if (!mWantSingleLocationUpdate && !mWantContinuousLocationUpdates) {
            mCi.setLocationUpdates(false, null);
            mCi.setLocationUpdates(false, null, null);
        }
    }