use of android.telephony.CallForwardingInfo in project android_packages_apps_Settings by omnirom.
the class SmartForwardingUtils method getAllSlotCallForwardingStatus.
public static CallForwardingInfo[] getAllSlotCallForwardingStatus(Context context, SubscriptionManager sm, TelephonyManager tm) {
int phoneCount = tm.getActiveModemCount();
CallForwardingInfo[] allStatus = new CallForwardingInfo[phoneCount];
for (int i = 0; i < phoneCount; i++) {
int subId = sm.getSubscriptionIds(i)[0];
CallForwardingInfo callWaitingStatus = getBackupCallForwardingStatus(context, subId);
allStatus[i] = callWaitingStatus;
}
return allStatus;
}
use of android.telephony.CallForwardingInfo in project android_packages_apps_Settings by omnirom.
the class SmartForwardingActivity method disableSmartForwarding.
public void disableSmartForwarding() {
TelephonyManager tm = getSystemService(TelephonyManager.class);
SubscriptionManager sm = getSystemService(SubscriptionManager.class);
boolean[] callWaitingStatus = getAllSlotCallWaitingStatus(this, sm, tm);
CallForwardingInfo[] callForwardingInfo = getAllSlotCallForwardingStatus(this, sm, tm);
// Disable feature
ListenableFuture disableTask = service.submit(new DisableSmartForwardingTask(tm, callWaitingStatus, callForwardingInfo));
Futures.addCallback(disableTask, new FutureCallback() {
@Override
public void onSuccess(Object result) {
clearAllBackupData(SmartForwardingActivity.this, sm, tm);
}
@Override
public void onFailure(Throwable t) {
Log.e(TAG, "Disable Feature exception" + t);
}
}, ContextCompat.getMainExecutor(this));
}
use of android.telephony.CallForwardingInfo in project android_packages_apps_Settings by omnirom.
the class SmartForwardingUtils method getBackupCallForwardingStatus.
public static CallForwardingInfo getBackupCallForwardingStatus(Context context, int subId) {
SharedPreferences preferences = context.getSharedPreferences(SMART_FORWARDING_PREF + subId, Context.MODE_PRIVATE);
if (preferences.contains(CALL_FORWARDING_ENABLED_KEY)) {
boolean enabled = preferences.getBoolean(CALL_FORWARDING_ENABLED_KEY, false);
int reason = preferences.getInt(CALL_FORWARDING_REASON_KEY, CallForwardingInfo.REASON_UNCONDITIONAL);
String number = preferences.getString(CALL_FORWARDING_NUMBER_KEY, "");
int time = preferences.getInt(CALL_FORWARDING_TIME_KEY, 1);
return new CallForwardingInfo(enabled, reason, number, time);
} else {
return null;
}
}
Aggregations