Loading src/java/com/android/internal/telephony/BaseCommands.java +9 −6 Original line number Original line Diff line number Diff line Loading @@ -76,6 +76,7 @@ public abstract class BaseCommands implements CommandsInterface { protected RegistrantList mModemResetRegistrants = new RegistrantList(); protected RegistrantList mModemResetRegistrants = new RegistrantList(); protected RegistrantList mNattKeepaliveStatusRegistrants = new RegistrantList(); protected RegistrantList mNattKeepaliveStatusRegistrants = new RegistrantList(); protected RegistrantList mPhysicalChannelConfigurationRegistrants = new RegistrantList(); protected RegistrantList mPhysicalChannelConfigurationRegistrants = new RegistrantList(); protected RegistrantList mLceInfoRegistrants = new RegistrantList(); protected Registrant mGsmSmsRegistrant; protected Registrant mGsmSmsRegistrant; protected Registrant mCdmaSmsRegistrant; protected Registrant mCdmaSmsRegistrant; Loading @@ -96,7 +97,6 @@ public abstract class BaseCommands implements CommandsInterface { protected Registrant mGsmBroadcastSmsRegistrant; protected Registrant mGsmBroadcastSmsRegistrant; protected Registrant mCatCcAlphaRegistrant; protected Registrant mCatCcAlphaRegistrant; protected Registrant mSsRegistrant; protected Registrant mSsRegistrant; protected Registrant mLceInfoRegistrant; // Preferred network type received from PhoneFactory. // Preferred network type received from PhoneFactory. // This is used when establishing a connection to the // This is used when establishing a connection to the Loading Loading @@ -911,14 +911,17 @@ public abstract class BaseCommands implements CommandsInterface { @Override @Override public void registerForLceInfo(Handler h, int what, Object obj) { public void registerForLceInfo(Handler h, int what, Object obj) { mLceInfoRegistrant = new Registrant(h, what, obj); Registrant r = new Registrant(h, what, obj); synchronized (mStateMonitor) { mLceInfoRegistrants.add(r); } } } @Override @Override public void unregisterForLceInfo(Handler h) { public void unregisterForLceInfo(Handler h) { if (mLceInfoRegistrant != null && mLceInfoRegistrant.getHandler() == h) { synchronized (mStateMonitor) { mLceInfoRegistrant.clear(); mLceInfoRegistrants.remove(h); mLceInfoRegistrant = null; } } } } Loading src/java/com/android/internal/telephony/LinkCapacityEstimate.java 0 → 100644 +73 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; /** * Link Bandwidth Information from the Radio */ public class LinkCapacityEstimate { /** Any field that is not reported shall be set to INVALID */ public static final int INVALID = -1; /** LCE is active; Deprecated in HAL 1.2 */ public static final int STATUS_ACTIVE = 0; /** LCE is suspended; Deprecated in HAL 1.2 */ public static final int STATUS_SUSPENDED = 1; /** Downlink radio link capacity in kbps */ public final int downlinkCapacityKbps; /** Uplink radio link capacity; added in HAL 1.2 */ public final int uplinkCapacityKbps; /** Confidence of the downlink estimate as a percentage [1, 100]; deprecated in HAL 1.2 */ public final int confidence; /** Status of the LCE; deprecated in HAL 1.2 */ public final int status; // either STATUS_ACTIVE, STATUS_SUSPENDED, or INVALID /** Constructor matching the estimate in Radio HAL v1.0 */ public LinkCapacityEstimate(int downlinkCapacityKbps, int confidence, int status) { this.downlinkCapacityKbps = downlinkCapacityKbps; this.confidence = confidence; this.status = status; this.uplinkCapacityKbps = INVALID; } /** Constructor matching the estimate in Radio HAL v1.2 */ public LinkCapacityEstimate(int downlinkCapacityKbps, int uplinkCapacityKbps) { this.downlinkCapacityKbps = downlinkCapacityKbps; this.uplinkCapacityKbps = uplinkCapacityKbps; this.confidence = INVALID; this.status = INVALID; } @Override public String toString() { return new StringBuilder() .append("{downlinkCapacityKbps=") .append(downlinkCapacityKbps) .append(", uplinkCapacityKbps=") .append(uplinkCapacityKbps) .append(", confidence=") .append(confidence) .append(", status=") .append(status) .toString(); } } src/java/com/android/internal/telephony/RIL.java +43 −13 Original line number Original line Diff line number Diff line Loading @@ -3383,6 +3383,14 @@ public class RIL extends BaseCommands implements CommandsInterface { @Override @Override public void startLceService(int reportIntervalMs, boolean pullMode, Message result) { public void startLceService(int reportIntervalMs, boolean pullMode, Message result) { IRadio radioProxy = getRadioProxy(result); IRadio radioProxy = getRadioProxy(result); android.hardware.radio.V1_2.IRadio radioProxy12 = android.hardware.radio.V1_2.IRadio.castFrom(radioProxy); if (radioProxy12 != null) { // We have a 1.2 or later radio, so the LCE 1.0 LCE service control path is unused. // Instead the LCE functionality is always-on and provides unsolicited indications. return; } if (radioProxy != null) { if (radioProxy != null) { RILRequest rr = obtainRequest(RIL_REQUEST_START_LCE, result, RILRequest rr = obtainRequest(RIL_REQUEST_START_LCE, result, mRILDefaultWorkSource); mRILDefaultWorkSource); Loading @@ -3403,6 +3411,14 @@ public class RIL extends BaseCommands implements CommandsInterface { @Override @Override public void stopLceService(Message result) { public void stopLceService(Message result) { IRadio radioProxy = getRadioProxy(result); IRadio radioProxy = getRadioProxy(result); android.hardware.radio.V1_2.IRadio radioProxy12 = android.hardware.radio.V1_2.IRadio.castFrom(radioProxy); if (radioProxy12 != null) { // We have a 1.2 or later radio, so the LCE 1.0 LCE service control is unused. // Instead the LCE functionality is always-on and provides unsolicited indications. return; } if (radioProxy != null) { if (radioProxy != null) { RILRequest rr = obtainRequest(RIL_REQUEST_STOP_LCE, result, RILRequest rr = obtainRequest(RIL_REQUEST_STOP_LCE, result, mRILDefaultWorkSource); mRILDefaultWorkSource); Loading @@ -3419,6 +3435,17 @@ public class RIL extends BaseCommands implements CommandsInterface { } } } } /** * This will only be called if the LCE service is started in PULL mode, which is * only enabled when using Radio HAL versions 1.1 and earlier. * * It is still possible for vendors to override this behavior and use the 1.1 version * of LCE; however, this is strongly discouraged and this functionality will be removed * when HAL 1.x support is dropped. * * @deprecated HAL 1.2 and later use an always-on LCE that relies on indications. */ @Deprecated @Override @Override public void pullLceData(Message response) { public void pullLceData(Message response) { IRadio radioProxy = getRadioProxy(response); IRadio radioProxy = getRadioProxy(response); Loading Loading @@ -4949,21 +4976,24 @@ public class RIL extends BaseCommands implements CommandsInterface { return rc; return rc; } } static ArrayList<Integer> convertHalLceData(LceDataInfo lce, RIL ril) { static LinkCapacityEstimate convertHalLceData(LceDataInfo halData, RIL ril) { final ArrayList<Integer> capacityResponse = new ArrayList<Integer>(); final LinkCapacityEstimate lce = new LinkCapacityEstimate( final int capacityDownKbps = lce.lastHopCapacityKbps; halData.lastHopCapacityKbps, final int confidenceLevel = Byte.toUnsignedInt(lce.confidenceLevel); Byte.toUnsignedInt(halData.confidenceLevel), final int lceSuspended = lce.lceSuspended ? 1 : 0; halData.lceSuspended ? LinkCapacityEstimate.STATUS_SUSPENDED : LinkCapacityEstimate.STATUS_ACTIVE); ril.riljLog("LCE capacity information received:" + ril.riljLog("LCE capacity information received:" + lce); " capacity=" + capacityDownKbps + return lce; " confidence=" + confidenceLevel + } " lceSuspended=" + lceSuspended); capacityResponse.add(capacityDownKbps); static LinkCapacityEstimate convertHalLceData( capacityResponse.add(confidenceLevel); android.hardware.radio.V1_2.LinkCapacityEstimate halData, RIL ril) { capacityResponse.add(lceSuspended); final LinkCapacityEstimate lce = new LinkCapacityEstimate( return capacityResponse; halData.downlinkCapacityKbps, halData.uplinkCapacityKbps); ril.riljLog("LCE capacity information received:" + lce); return lce; } } private static void writeToParcelForGsm( private static void writeToParcelForGsm( Loading src/java/com/android/internal/telephony/RadioIndication.java +12 −4 Original line number Original line Diff line number Diff line Loading @@ -241,7 +241,15 @@ public class RadioIndication extends IRadioIndication.Stub { */ */ public void currentLinkCapacityEstimate(int indicationType, public void currentLinkCapacityEstimate(int indicationType, android.hardware.radio.V1_2.LinkCapacityEstimate lce) { android.hardware.radio.V1_2.LinkCapacityEstimate lce) { // TODO(b/70638175) Implement method. mRil.processIndication(indicationType); LinkCapacityEstimate response = RIL.convertHalLceData(lce, mRil); if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_LCEDATA_RECV, response); if (mRil.mLceInfoRegistrants != null) { mRil.mLceInfoRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); } } } /** /** Loading Loading @@ -831,12 +839,12 @@ public class RadioIndication extends IRadioIndication.Stub { public void lceData(int indicationType, LceDataInfo lce) { public void lceData(int indicationType, LceDataInfo lce) { mRil.processIndication(indicationType); mRil.processIndication(indicationType); ArrayList<Integer> response = RIL.convertHalLceData(lce, mRil); LinkCapacityEstimate response = RIL.convertHalLceData(lce, mRil); if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_LCEDATA_RECV, response); if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_LCEDATA_RECV, response); if (mRil.mLceInfoRegistrant != null) { if (mRil.mLceInfoRegistrants != null) { mRil.mLceInfoRegistrant.notifyRegistrant(new AsyncResult(null, response, null)); mRil.mLceInfoRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); } } } } Loading src/java/com/android/internal/telephony/RadioResponse.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2009,7 +2009,7 @@ public class RadioResponse extends IRadioResponse.Stub { RILRequest rr = mRil.processResponse(responseInfo); RILRequest rr = mRil.processResponse(responseInfo); if (rr != null) { if (rr != null) { ArrayList<Integer> ret = RIL.convertHalLceData(lceInfo, mRil); LinkCapacityEstimate ret = RIL.convertHalLceData(lceInfo, mRil); if (responseInfo.error == RadioError.NONE) { if (responseInfo.error == RadioError.NONE) { sendMessageResponse(rr.mResult, ret); sendMessageResponse(rr.mResult, ret); } } Loading Loading
src/java/com/android/internal/telephony/BaseCommands.java +9 −6 Original line number Original line Diff line number Diff line Loading @@ -76,6 +76,7 @@ public abstract class BaseCommands implements CommandsInterface { protected RegistrantList mModemResetRegistrants = new RegistrantList(); protected RegistrantList mModemResetRegistrants = new RegistrantList(); protected RegistrantList mNattKeepaliveStatusRegistrants = new RegistrantList(); protected RegistrantList mNattKeepaliveStatusRegistrants = new RegistrantList(); protected RegistrantList mPhysicalChannelConfigurationRegistrants = new RegistrantList(); protected RegistrantList mPhysicalChannelConfigurationRegistrants = new RegistrantList(); protected RegistrantList mLceInfoRegistrants = new RegistrantList(); protected Registrant mGsmSmsRegistrant; protected Registrant mGsmSmsRegistrant; protected Registrant mCdmaSmsRegistrant; protected Registrant mCdmaSmsRegistrant; Loading @@ -96,7 +97,6 @@ public abstract class BaseCommands implements CommandsInterface { protected Registrant mGsmBroadcastSmsRegistrant; protected Registrant mGsmBroadcastSmsRegistrant; protected Registrant mCatCcAlphaRegistrant; protected Registrant mCatCcAlphaRegistrant; protected Registrant mSsRegistrant; protected Registrant mSsRegistrant; protected Registrant mLceInfoRegistrant; // Preferred network type received from PhoneFactory. // Preferred network type received from PhoneFactory. // This is used when establishing a connection to the // This is used when establishing a connection to the Loading Loading @@ -911,14 +911,17 @@ public abstract class BaseCommands implements CommandsInterface { @Override @Override public void registerForLceInfo(Handler h, int what, Object obj) { public void registerForLceInfo(Handler h, int what, Object obj) { mLceInfoRegistrant = new Registrant(h, what, obj); Registrant r = new Registrant(h, what, obj); synchronized (mStateMonitor) { mLceInfoRegistrants.add(r); } } } @Override @Override public void unregisterForLceInfo(Handler h) { public void unregisterForLceInfo(Handler h) { if (mLceInfoRegistrant != null && mLceInfoRegistrant.getHandler() == h) { synchronized (mStateMonitor) { mLceInfoRegistrant.clear(); mLceInfoRegistrants.remove(h); mLceInfoRegistrant = null; } } } } Loading
src/java/com/android/internal/telephony/LinkCapacityEstimate.java 0 → 100644 +73 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; /** * Link Bandwidth Information from the Radio */ public class LinkCapacityEstimate { /** Any field that is not reported shall be set to INVALID */ public static final int INVALID = -1; /** LCE is active; Deprecated in HAL 1.2 */ public static final int STATUS_ACTIVE = 0; /** LCE is suspended; Deprecated in HAL 1.2 */ public static final int STATUS_SUSPENDED = 1; /** Downlink radio link capacity in kbps */ public final int downlinkCapacityKbps; /** Uplink radio link capacity; added in HAL 1.2 */ public final int uplinkCapacityKbps; /** Confidence of the downlink estimate as a percentage [1, 100]; deprecated in HAL 1.2 */ public final int confidence; /** Status of the LCE; deprecated in HAL 1.2 */ public final int status; // either STATUS_ACTIVE, STATUS_SUSPENDED, or INVALID /** Constructor matching the estimate in Radio HAL v1.0 */ public LinkCapacityEstimate(int downlinkCapacityKbps, int confidence, int status) { this.downlinkCapacityKbps = downlinkCapacityKbps; this.confidence = confidence; this.status = status; this.uplinkCapacityKbps = INVALID; } /** Constructor matching the estimate in Radio HAL v1.2 */ public LinkCapacityEstimate(int downlinkCapacityKbps, int uplinkCapacityKbps) { this.downlinkCapacityKbps = downlinkCapacityKbps; this.uplinkCapacityKbps = uplinkCapacityKbps; this.confidence = INVALID; this.status = INVALID; } @Override public String toString() { return new StringBuilder() .append("{downlinkCapacityKbps=") .append(downlinkCapacityKbps) .append(", uplinkCapacityKbps=") .append(uplinkCapacityKbps) .append(", confidence=") .append(confidence) .append(", status=") .append(status) .toString(); } }
src/java/com/android/internal/telephony/RIL.java +43 −13 Original line number Original line Diff line number Diff line Loading @@ -3383,6 +3383,14 @@ public class RIL extends BaseCommands implements CommandsInterface { @Override @Override public void startLceService(int reportIntervalMs, boolean pullMode, Message result) { public void startLceService(int reportIntervalMs, boolean pullMode, Message result) { IRadio radioProxy = getRadioProxy(result); IRadio radioProxy = getRadioProxy(result); android.hardware.radio.V1_2.IRadio radioProxy12 = android.hardware.radio.V1_2.IRadio.castFrom(radioProxy); if (radioProxy12 != null) { // We have a 1.2 or later radio, so the LCE 1.0 LCE service control path is unused. // Instead the LCE functionality is always-on and provides unsolicited indications. return; } if (radioProxy != null) { if (radioProxy != null) { RILRequest rr = obtainRequest(RIL_REQUEST_START_LCE, result, RILRequest rr = obtainRequest(RIL_REQUEST_START_LCE, result, mRILDefaultWorkSource); mRILDefaultWorkSource); Loading @@ -3403,6 +3411,14 @@ public class RIL extends BaseCommands implements CommandsInterface { @Override @Override public void stopLceService(Message result) { public void stopLceService(Message result) { IRadio radioProxy = getRadioProxy(result); IRadio radioProxy = getRadioProxy(result); android.hardware.radio.V1_2.IRadio radioProxy12 = android.hardware.radio.V1_2.IRadio.castFrom(radioProxy); if (radioProxy12 != null) { // We have a 1.2 or later radio, so the LCE 1.0 LCE service control is unused. // Instead the LCE functionality is always-on and provides unsolicited indications. return; } if (radioProxy != null) { if (radioProxy != null) { RILRequest rr = obtainRequest(RIL_REQUEST_STOP_LCE, result, RILRequest rr = obtainRequest(RIL_REQUEST_STOP_LCE, result, mRILDefaultWorkSource); mRILDefaultWorkSource); Loading @@ -3419,6 +3435,17 @@ public class RIL extends BaseCommands implements CommandsInterface { } } } } /** * This will only be called if the LCE service is started in PULL mode, which is * only enabled when using Radio HAL versions 1.1 and earlier. * * It is still possible for vendors to override this behavior and use the 1.1 version * of LCE; however, this is strongly discouraged and this functionality will be removed * when HAL 1.x support is dropped. * * @deprecated HAL 1.2 and later use an always-on LCE that relies on indications. */ @Deprecated @Override @Override public void pullLceData(Message response) { public void pullLceData(Message response) { IRadio radioProxy = getRadioProxy(response); IRadio radioProxy = getRadioProxy(response); Loading Loading @@ -4949,21 +4976,24 @@ public class RIL extends BaseCommands implements CommandsInterface { return rc; return rc; } } static ArrayList<Integer> convertHalLceData(LceDataInfo lce, RIL ril) { static LinkCapacityEstimate convertHalLceData(LceDataInfo halData, RIL ril) { final ArrayList<Integer> capacityResponse = new ArrayList<Integer>(); final LinkCapacityEstimate lce = new LinkCapacityEstimate( final int capacityDownKbps = lce.lastHopCapacityKbps; halData.lastHopCapacityKbps, final int confidenceLevel = Byte.toUnsignedInt(lce.confidenceLevel); Byte.toUnsignedInt(halData.confidenceLevel), final int lceSuspended = lce.lceSuspended ? 1 : 0; halData.lceSuspended ? LinkCapacityEstimate.STATUS_SUSPENDED : LinkCapacityEstimate.STATUS_ACTIVE); ril.riljLog("LCE capacity information received:" + ril.riljLog("LCE capacity information received:" + lce); " capacity=" + capacityDownKbps + return lce; " confidence=" + confidenceLevel + } " lceSuspended=" + lceSuspended); capacityResponse.add(capacityDownKbps); static LinkCapacityEstimate convertHalLceData( capacityResponse.add(confidenceLevel); android.hardware.radio.V1_2.LinkCapacityEstimate halData, RIL ril) { capacityResponse.add(lceSuspended); final LinkCapacityEstimate lce = new LinkCapacityEstimate( return capacityResponse; halData.downlinkCapacityKbps, halData.uplinkCapacityKbps); ril.riljLog("LCE capacity information received:" + lce); return lce; } } private static void writeToParcelForGsm( private static void writeToParcelForGsm( Loading
src/java/com/android/internal/telephony/RadioIndication.java +12 −4 Original line number Original line Diff line number Diff line Loading @@ -241,7 +241,15 @@ public class RadioIndication extends IRadioIndication.Stub { */ */ public void currentLinkCapacityEstimate(int indicationType, public void currentLinkCapacityEstimate(int indicationType, android.hardware.radio.V1_2.LinkCapacityEstimate lce) { android.hardware.radio.V1_2.LinkCapacityEstimate lce) { // TODO(b/70638175) Implement method. mRil.processIndication(indicationType); LinkCapacityEstimate response = RIL.convertHalLceData(lce, mRil); if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_LCEDATA_RECV, response); if (mRil.mLceInfoRegistrants != null) { mRil.mLceInfoRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); } } } /** /** Loading Loading @@ -831,12 +839,12 @@ public class RadioIndication extends IRadioIndication.Stub { public void lceData(int indicationType, LceDataInfo lce) { public void lceData(int indicationType, LceDataInfo lce) { mRil.processIndication(indicationType); mRil.processIndication(indicationType); ArrayList<Integer> response = RIL.convertHalLceData(lce, mRil); LinkCapacityEstimate response = RIL.convertHalLceData(lce, mRil); if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_LCEDATA_RECV, response); if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_LCEDATA_RECV, response); if (mRil.mLceInfoRegistrant != null) { if (mRil.mLceInfoRegistrants != null) { mRil.mLceInfoRegistrant.notifyRegistrant(new AsyncResult(null, response, null)); mRil.mLceInfoRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); } } } } Loading
src/java/com/android/internal/telephony/RadioResponse.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2009,7 +2009,7 @@ public class RadioResponse extends IRadioResponse.Stub { RILRequest rr = mRil.processResponse(responseInfo); RILRequest rr = mRil.processResponse(responseInfo); if (rr != null) { if (rr != null) { ArrayList<Integer> ret = RIL.convertHalLceData(lceInfo, mRil); LinkCapacityEstimate ret = RIL.convertHalLceData(lceInfo, mRil); if (responseInfo.error == RadioError.NONE) { if (responseInfo.error == RadioError.NONE) { sendMessageResponse(rr.mResult, ret); sendMessageResponse(rr.mResult, ret); } } Loading