use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class SMSDispatcher method sendData.
/**
* Send a data based SMS to a specific application port.
*
* @param callingPackage the package name of the calling app
* @param destAddr the address to send the message to
* @param scAddr is the service center address or null to use
* the current default SMSC
* @param destPort the port to deliver the message to
* @param data the body of the message to send
* @param sentIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is successfully sent, or failed.
* The result code will be <code>Activity.RESULT_OK<code> for success,
* or one of these errors:<br>
* <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
* <code>RESULT_ERROR_RADIO_OFF</code><br>
* <code>RESULT_ERROR_NULL_PDU</code><br>
* <code>RESULT_ERROR_NO_SERVICE</code><br>.
* For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
* the extra "errorCode" containing a radio technology specific value,
* generally only useful for troubleshooting.<br>
* The per-application based SMS control checks sentIntent. If sentIntent
* is NULL the caller will be checked against all unknown applications,
* which cause smaller number of SMS to be sent in checking period.
* @param deliveryIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is delivered to the recipient. The
* raw pdu of the status report is in the extended data ("pdu").
*/
@UnsupportedAppUsage
protected void sendData(String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) {
SmsMessageBase.SubmitPduBase pdu = getSubmitPdu(scAddr, destAddr, destPort, data, (deliveryIntent != null));
if (pdu != null) {
HashMap map = getSmsTrackerMap(destAddr, scAddr, destPort, data, pdu);
SmsTracker tracker = getSmsTracker(callingPackage, map, sentIntent, deliveryIntent, getFormat(), null, /*messageUri*/
false, /*expectMore*/
null, /*fullMessageText*/
false, /*isText*/
true, /*persistMessage*/
isForVvm, 0L);
if (!sendSmsByCarrierApp(true, /* isDataSms */
tracker)) {
sendSubmitPdu(tracker);
}
} else {
Rlog.e(TAG, "SMSDispatcher.sendData(): getSubmitPdu() returned null");
triggerSentIntentForFailure(sentIntent);
}
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class SMSDispatcher method checkCallerIsPhoneOrCarrierApp.
@UnsupportedAppUsage
private void checkCallerIsPhoneOrCarrierApp() {
int uid = Binder.getCallingUid();
int appId = UserHandle.getAppId(uid);
if (appId == Process.PHONE_UID || uid == 0) {
return;
}
try {
PackageManager pm = mContext.getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo(getCarrierAppPackageName(), 0);
if (UserHandle.getAppId(ai.uid) != UserHandle.getAppId(Binder.getCallingUid())) {
throw new SecurityException("Caller is not phone or carrier app!");
}
} catch (PackageManager.NameNotFoundException re) {
throw new SecurityException("Caller is not phone or carrier app!");
}
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class ServiceStateTracker method fixUnknownMcc.
@UnsupportedAppUsage
private String fixUnknownMcc(String operatorNumeric, int sid) {
if (sid <= 0) {
// no cdma information is available, do nothing
return operatorNumeric;
}
// resolve the mcc from sid, using time zone information from the latest NITZ signal when
// available.
int utcOffsetHours = 0;
boolean isDst = false;
boolean isNitzTimeZone = false;
NitzData lastNitzData = mLastNitzData;
if (lastNitzData != null) {
utcOffsetHours = lastNitzData.getLocalOffsetMillis() / MS_PER_HOUR;
Integer dstAdjustmentMillis = lastNitzData.getDstAdjustmentMillis();
isDst = (dstAdjustmentMillis != null) && (dstAdjustmentMillis != 0);
isNitzTimeZone = true;
}
int mcc = mHbpcdUtils.getMcc(sid, utcOffsetHours, (isDst ? 1 : 0), isNitzTimeZone);
if (mcc > 0) {
operatorNumeric = mcc + DEFAULT_MNC;
}
return operatorNumeric;
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class ServiceStateTracker method setSignalStrengthDefaultValues.
@UnsupportedAppUsage
private void setSignalStrengthDefaultValues() {
mSignalStrength = new SignalStrength();
mSignalStrengthUpdatedTime = System.currentTimeMillis();
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class ServiceStateTracker method updateRoamingState.
/**
* Query the carrier configuration to determine if there any network overrides
* for roaming or not roaming for the current service state.
*/
@UnsupportedAppUsage
protected void updateRoamingState() {
PersistableBundle bundle = getCarrierConfig();
if (mPhone.isPhoneTypeGsm()) {
/**
* Since the roaming state of gsm service (from +CREG) and
* data service (from +CGREG) could be different, the new SS
* is set to roaming when either is true.
*
* There are exceptions for the above rule.
* The new SS is not set as roaming while gsm service or
* data service reports roaming but indeed it is same
* operator. And the operator is considered non roaming.
*
* The test for the operators is to handle special roaming
* agreements and MVNO's.
*/
boolean roaming = (mGsmVoiceRoaming || mGsmDataRoaming);
if (roaming && !isOperatorConsideredRoaming(mNewSS) && (isSameNamedOperators(mNewSS) || isOperatorConsideredNonRoaming(mNewSS))) {
log("updateRoamingState: resource override set non roaming.isSameNamedOperators=" + isSameNamedOperators(mNewSS) + ",isOperatorConsideredNonRoaming=" + isOperatorConsideredNonRoaming(mNewSS));
roaming = false;
}
if (alwaysOnHomeNetwork(bundle)) {
log("updateRoamingState: carrier config override always on home network");
roaming = false;
} else if (isNonRoamingInGsmNetwork(bundle, mNewSS.getOperatorNumeric())) {
log("updateRoamingState: carrier config override set non roaming:" + mNewSS.getOperatorNumeric());
roaming = false;
} else if (isRoamingInGsmNetwork(bundle, mNewSS.getOperatorNumeric())) {
log("updateRoamingState: carrier config override set roaming:" + mNewSS.getOperatorNumeric());
roaming = true;
}
mNewSS.setRoaming(roaming);
} else {
String systemId = Integer.toString(mNewSS.getCdmaSystemId());
if (alwaysOnHomeNetwork(bundle)) {
log("updateRoamingState: carrier config override always on home network");
setRoamingOff();
} else if (isNonRoamingInGsmNetwork(bundle, mNewSS.getOperatorNumeric()) || isNonRoamingInCdmaNetwork(bundle, systemId)) {
log("updateRoamingState: carrier config override set non-roaming:" + mNewSS.getOperatorNumeric() + ", " + systemId);
setRoamingOff();
} else if (isRoamingInGsmNetwork(bundle, mNewSS.getOperatorNumeric()) || isRoamingInCdmaNetwork(bundle, systemId)) {
log("updateRoamingState: carrier config override set roaming:" + mNewSS.getOperatorNumeric() + ", " + systemId);
setRoamingOn();
}
if (TelephonyUtils.IS_DEBUGGABLE && SystemProperties.getBoolean(PROP_FORCE_ROAMING, false)) {
mNewSS.setRoaming(true);
}
}
}
Aggregations