use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class SubscriptionController method getSubInfo.
/**
* Query SubInfoRecord(s) from subinfo database
* @param selection A filter declaring which rows to return
* @param queryKey query key content
* @return Array list of queried result from database
*/
@UnsupportedAppUsage
public List<SubscriptionInfo> getSubInfo(String selection, Object queryKey) {
if (VDBG)
logd("selection:" + selection + ", querykey: " + queryKey);
String[] selectionArgs = null;
if (queryKey != null) {
selectionArgs = new String[] { queryKey.toString() };
}
ArrayList<SubscriptionInfo> subList = null;
Cursor cursor = mContext.getContentResolver().query(SubscriptionManager.CONTENT_URI, null, selection, selectionArgs, null);
try {
if (cursor != null) {
while (cursor.moveToNext()) {
SubscriptionInfo subInfo = getSubInfoRecord(cursor);
if (subInfo != null) {
if (subList == null) {
subList = new ArrayList<SubscriptionInfo>();
}
subList.add(subInfo);
}
}
} else {
if (DBG)
logd("Query fail");
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return subList;
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class SubscriptionInfoUpdater method broadcastSimStateChanged.
@UnsupportedAppUsage
protected void broadcastSimStateChanged(int phoneId, String state, String reason) {
Intent i = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
// TODO - we'd like this intent to have a single snapshot of all sim state,
// but until then this should not use REPLACE_PENDING or we may lose
// information
// i.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING
// | Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
i.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
i.putExtra(PhoneConstants.PHONE_NAME_KEY, "Phone");
i.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE, state);
i.putExtra(IccCardConstants.INTENT_KEY_LOCKED_REASON, reason);
SubscriptionManager.putPhoneIdAndSubIdExtra(i, phoneId);
logd("Broadcasting intent ACTION_SIM_STATE_CHANGED " + state + " reason " + reason + " for phone: " + phoneId);
IntentBroadcaster.getInstance().broadcastStickyIntent(sContext, i, phoneId);
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class SubscriptionController method setDefaultVoiceSubId.
@UnsupportedAppUsage
@Override
public void setDefaultVoiceSubId(int subId) {
enforceModifyPhoneState("setDefaultVoiceSubId");
if (subId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) {
throw new RuntimeException("setDefaultVoiceSubId called with DEFAULT_SUB_ID");
}
if (DBG)
logdl("[setDefaultVoiceSubId] subId=" + subId);
int previousDefaultSub = getDefaultSubId();
setGlobalSetting(Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, subId);
broadcastDefaultVoiceSubIdChanged(subId);
PhoneAccountHandle newHandle = subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID ? null : mTelephonyManager.getPhoneAccountHandleForSubscriptionId(subId);
TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
PhoneAccountHandle currentHandle = telecomManager.getUserSelectedOutgoingPhoneAccount();
if (!Objects.equals(currentHandle, newHandle)) {
telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle);
logd("[setDefaultVoiceSubId] change to phoneAccountHandle=" + newHandle);
} else {
logd("[setDefaultVoiceSubId] default phone account not changed");
}
if (previousDefaultSub != getDefaultSubId()) {
sendDefaultChangedBroadcast(getDefaultSubId());
}
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class CatService method isStkAppInstalled.
@UnsupportedAppUsage
private boolean isStkAppInstalled() {
Intent intent = new Intent(AppInterface.CAT_CMD_ACTION);
PackageManager pm = mContext.getPackageManager();
List<ResolveInfo> broadcastReceivers = pm.queryBroadcastReceivers(intent, PackageManager.GET_META_DATA);
int numReceiver = broadcastReceivers == null ? 0 : broadcastReceivers.size();
return (numReceiver > 0);
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class CatService method sendTerminalResponse.
@UnsupportedAppUsage
private void sendTerminalResponse(CommandDetails cmdDet, ResultCode resultCode, boolean includeAdditionalInfo, int additionalInfo, ResponseData resp) {
if (cmdDet == null) {
return;
}
ByteArrayOutputStream buf = new ByteArrayOutputStream();
Input cmdInput = null;
if (mCurrntCmd != null) {
cmdInput = mCurrntCmd.geInput();
}
// command details
int tag = ComprehensionTlvTag.COMMAND_DETAILS.value();
if (cmdDet.compRequired) {
tag |= 0x80;
}
buf.write(tag);
// length
buf.write(0x03);
buf.write(cmdDet.commandNumber);
buf.write(cmdDet.typeOfCommand);
buf.write(cmdDet.commandQualifier);
// device identities
// According to TS102.223/TS31.111 section 6.8 Structure of
// TERMINAL RESPONSE, "For all SIMPLE-TLV objects with Min=N,
// the ME should set the CR(comprehension required) flag to
// comprehension not required.(CR=0)"
// Since DEVICE_IDENTITIES and DURATION TLVs have Min=N,
// the CR flag is not set.
tag = ComprehensionTlvTag.DEVICE_IDENTITIES.value();
buf.write(tag);
// length
buf.write(0x02);
// source device id
buf.write(DEV_ID_TERMINAL);
// destination device id
buf.write(DEV_ID_UICC);
// result
tag = ComprehensionTlvTag.RESULT.value();
if (cmdDet.compRequired) {
tag |= 0x80;
}
buf.write(tag);
int length = includeAdditionalInfo ? 2 : 1;
buf.write(length);
buf.write(resultCode.value());
// additional info
if (includeAdditionalInfo) {
buf.write(additionalInfo);
}
// Fill optional data for each corresponding command
if (resp != null) {
resp.format(buf);
} else {
encodeOptionalTags(cmdDet, resultCode, cmdInput, buf);
}
byte[] rawData = buf.toByteArray();
String hexString = IccUtils.bytesToHexString(rawData);
if (DBG) {
CatLog.d(this, "TERMINAL RESPONSE: " + hexString);
}
mCmdIf.sendTerminalResponse(hexString, null);
}
Aggregations