use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class IccSmsInterfaceManager method getAllMessagesFromIccEf.
/**
* Retrieves all messages currently stored on Icc.
*
* @return list of SmsRawData of all sms on Icc
*/
@UnsupportedAppUsage
public List<SmsRawData> getAllMessagesFromIccEf(String callingPackage) {
if (DBG)
log("getAllMessagesFromEF");
mContext.enforceCallingOrSelfPermission(Manifest.permission.RECEIVE_SMS, "Reading messages from Icc");
enforceAccessMessageOnICC("Reading messages from Icc");
enforceNotOnHandlerThread("getAllMessagesFromIccEf");
if (mAppOps.noteOp(AppOpsManager.OPSTR_READ_ICC_SMS, Binder.getCallingUid(), callingPackage) != AppOpsManager.MODE_ALLOWED) {
return new ArrayList<SmsRawData>();
}
synchronized (mLock) {
IccFileHandler fh = mPhone.getIccFileHandler();
if (fh == null) {
loge("Cannot load Sms records. No icc card?");
mSms = null;
return mSms;
}
Message response = mHandler.obtainMessage(EVENT_LOAD_DONE);
fh.loadEFLinearFixedAll(IccConstants.EF_SMS, response);
try {
mLock.wait();
} catch (InterruptedException e) {
loge("interrupted while trying to load from the Icc");
}
}
return mSms;
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class IccSmsInterfaceManager method copyMessageToIccEf.
/**
* Copies a raw SMS PDU to the ICC.
*
* @param callingPackage the package name of the calling app.
* @param status message status. One of these status:
* <code>STATUS_ON_ICC_READ</code>
* <code>STATUS_ON_ICC_UNREAD</code>
* <code>STATUS_ON_ICC_SENT</code>
* <code>STATUS_ON_ICC_UNSENT</code>
* @param pdu the raw PDU to store.
* @param smsc the SMSC for this message. Null means use default.
* @return true for success. Otherwise false.
*/
@UnsupportedAppUsage
public boolean copyMessageToIccEf(String callingPackage, int status, byte[] pdu, byte[] smsc) {
// NOTE smsc not used in RUIM
if (DBG)
log("copyMessageToIccEf: status=" + status + " ==> " + "pdu=(" + Arrays.toString(pdu) + "), smsc=(" + Arrays.toString(smsc) + ")");
enforceReceiveAndSend("Copying message to Icc");
enforceNotOnHandlerThread("copyMessageToIccEf");
if (mAppOps.noteOp(AppOpsManager.OPSTR_WRITE_ICC_SMS, Binder.getCallingUid(), callingPackage) != AppOpsManager.MODE_ALLOWED) {
return false;
}
synchronized (mLock) {
mSuccess = false;
Message response = mHandler.obtainMessage(EVENT_UPDATE_DONE);
// RIL_REQUEST_WRITE_SMS_TO_SIM vs RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM
if (PhoneConstants.PHONE_TYPE_GSM == mPhone.getPhoneType()) {
mPhone.mCi.writeSmsToSim(status, IccUtils.bytesToHexString(smsc), IccUtils.bytesToHexString(pdu), response);
} else {
mPhone.mCi.writeSmsToRuim(status, pdu, response);
}
try {
mLock.wait();
} catch (InterruptedException e) {
loge("interrupted while trying to update by index");
}
}
return mSuccess;
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class IccSmsInterfaceManager method updateMessageOnIccEf.
/**
* Update the specified message on the Icc.
*
* @param index record index of message to update
* @param status new message status (STATUS_ON_ICC_READ,
* STATUS_ON_ICC_UNREAD, STATUS_ON_ICC_SENT,
* STATUS_ON_ICC_UNSENT, STATUS_ON_ICC_FREE)
* @param pdu the raw PDU to store
* @return success or not
*/
@UnsupportedAppUsage
public boolean updateMessageOnIccEf(String callingPackage, int index, int status, byte[] pdu) {
if (DBG)
log("updateMessageOnIccEf: index=" + index + " status=" + status + " ==> " + "(" + Arrays.toString(pdu) + ")");
enforceReceiveAndSend("Updating message on Icc");
enforceAccessMessageOnICC("Updating message on Icc");
enforceNotOnHandlerThread("updateMessageOnIccEf");
if (mAppOps.noteOp(AppOpsManager.OPSTR_WRITE_ICC_SMS, Binder.getCallingUid(), callingPackage) != AppOpsManager.MODE_ALLOWED) {
return false;
}
synchronized (mLock) {
mSuccess = false;
Message response = mHandler.obtainMessage(EVENT_UPDATE_DONE);
if ((status & 0x01) == STATUS_ON_ICC_FREE) {
// Will eventually fail if icc card is not present.
if (PhoneConstants.PHONE_TYPE_GSM == mPhone.getPhoneType()) {
mPhone.mCi.deleteSmsOnSim(index, response);
} else {
mPhone.mCi.deleteSmsOnRuim(index, response);
}
} else {
// IccFilehandler can be null if ICC card is not present.
IccFileHandler fh = mPhone.getIccFileHandler();
if (fh == null) {
response.recycle();
return mSuccess;
/* is false */
}
byte[] record = makeSmsRecordData(status, pdu);
fh.updateEFLinearFixed(IccConstants.EF_SMS, index, record, null, response);
}
try {
mLock.wait();
} catch (InterruptedException e) {
loge("interrupted while trying to update by index");
}
}
return mSuccess;
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class InboundSmsHandler method handleNewSms.
@UnsupportedAppUsage
private void handleNewSms(AsyncResult ar) {
if (ar.exception != null) {
loge("Exception processing incoming SMS: " + ar.exception);
return;
}
int result;
try {
SmsMessage sms = (SmsMessage) ar.result;
mLastSmsWasInjected = false;
result = dispatchMessage(sms.mWrappedSmsMessage);
} catch (RuntimeException ex) {
loge("Exception dispatching message", ex);
result = RESULT_SMS_DISPATCH_FAILURE;
}
// e.g. for SMS-PP data download. Any other result, we should ack here.
if (result != Activity.RESULT_OK) {
boolean handled = (result == Intents.RESULT_SMS_HANDLED);
notifyAndAcknowledgeLastIncomingSms(handled, result, null);
}
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class PhoneFactory method getPhone.
@UnsupportedAppUsage
public static Phone getPhone(int phoneId) {
Phone phone;
String dbgInfo = "";
synchronized (sLockProxyPhones) {
if (!sMadeDefaults) {
throw new IllegalStateException("Default phones haven't been made yet!");
// CAF_MSIM FIXME need to introduce default phone id ?
} else if (phoneId == SubscriptionManager.DEFAULT_PHONE_INDEX) {
if (DBG) {
dbgInfo = "phoneId == DEFAULT_PHONE_ID return sPhone";
}
phone = sPhone;
} else {
if (DBG) {
dbgInfo = "phoneId != DEFAULT_PHONE_ID return sPhones[phoneId]";
}
phone = (phoneId >= 0 && phoneId < sPhones.length) ? sPhones[phoneId] : null;
}
if (DBG) {
Rlog.d(LOG_TAG, "getPhone:- " + dbgInfo + " phoneId=" + phoneId + " phone=" + phone);
}
return phone;
}
}
Aggregations