use of com.android.voicemail.impl.OmtpVvmCarrierConfigHelper in project android_packages_apps_Dialer by LineageOS.
the class VvmDumpHandler method dump.
public static void dump(Context context, FileDescriptor fd, PrintWriter writer, String[] args) {
IndentingPrintWriter indentedWriter = new IndentingPrintWriter(writer, " ");
indentedWriter.println("******* OmtpVvm *******");
indentedWriter.println("======= Configs =======");
indentedWriter.increaseIndent();
for (PhoneAccountHandle handle : context.getSystemService(TelecomManager.class).getCallCapablePhoneAccounts()) {
OmtpVvmCarrierConfigHelper config = new OmtpVvmCarrierConfigHelper(context, handle);
indentedWriter.println(config.toString());
}
indentedWriter.decreaseIndent();
indentedWriter.println("======== Logs =========");
VvmLog.dump(fd, indentedWriter, args);
}
use of com.android.voicemail.impl.OmtpVvmCarrierConfigHelper in project android_packages_apps_Dialer by LineageOS.
the class VisualVoicemailSettingsUtil method setEnabled.
public static void setEnabled(Context context, PhoneAccountHandle phoneAccount, boolean isEnabled) {
VvmLog.i("VisualVoicemailSettingsUtil.setEnable", phoneAccount + " enabled:" + isEnabled);
new VisualVoicemailPreferences(context, phoneAccount).edit().putBoolean(IS_ENABLED_KEY, isEnabled).apply();
OmtpVvmCarrierConfigHelper config = new OmtpVvmCarrierConfigHelper(context, phoneAccount);
if (isEnabled) {
config.startActivation();
} else {
VvmAccountManager.removeAccount(context, phoneAccount);
config.startDeactivation();
}
}
use of com.android.voicemail.impl.OmtpVvmCarrierConfigHelper in project android_packages_apps_Dialer by LineageOS.
the class VoicemailChangePinActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPhoneAccountHandle = getIntent().getParcelableExtra(EXTRA_PHONE_ACCOUNT_HANDLE);
mConfig = new OmtpVvmCarrierConfigHelper(this, mPhoneAccountHandle);
setContentView(R.layout.voicemail_change_pin);
setTitle(R.string.change_pin_title);
readPinLength();
View view = findViewById(android.R.id.content);
mCancelButton = (Button) view.findViewById(R.id.cancel_button);
mCancelButton.setOnClickListener(this);
mNextButton = (Button) view.findViewById(R.id.next_button);
mNextButton.setOnClickListener(this);
mPinEntry = (EditText) view.findViewById(R.id.pin_entry);
mPinEntry.setOnEditorActionListener(this);
mPinEntry.addTextChangedListener(this);
if (mPinMaxLength != 0) {
mPinEntry.setFilters(new InputFilter[] { new LengthFilter(mPinMaxLength) });
}
mHeaderText = (TextView) view.findViewById(R.id.headerText);
mHintText = (TextView) view.findViewById(R.id.hintText);
mErrorText = (TextView) view.findViewById(R.id.errorText);
if (isDefaultOldPinSet(this, mPhoneAccountHandle)) {
mOldPin = getDefaultOldPin(this, mPhoneAccountHandle);
updateState(State.VerifyOldPin);
} else {
updateState(State.EnterOldPin);
}
}
use of com.android.voicemail.impl.OmtpVvmCarrierConfigHelper in project android_packages_apps_Dialer by LineageOS.
the class OmtpVvmSyncService method setupAndSendRequest.
private void setupAndSendRequest(BaseTask task, PhoneAccountHandle phoneAccount, Voicemail voicemail, String action, VoicemailStatus.Editor status) {
if (!VisualVoicemailSettingsUtil.isEnabled(mContext, phoneAccount)) {
VvmLog.v(TAG, "Sync requested for disabled account");
return;
}
if (!VvmAccountManager.isAccountActivated(mContext, phoneAccount)) {
ActivationTask.start(mContext, phoneAccount, null);
return;
}
OmtpVvmCarrierConfigHelper config = new OmtpVvmCarrierConfigHelper(mContext, phoneAccount);
LoggerUtils.logImpressionOnMainThread(mContext, DialerImpression.Type.VVM_SYNC_STARTED);
// DATA_IMAP_OPERATION_STARTED posting should not be deferred. This event clears all data
// channel errors, which should happen when the task starts, not when it ends. It is the
// "Sync in progress..." status.
config.handleEvent(VoicemailStatus.edit(mContext, phoneAccount), OmtpEvents.DATA_IMAP_OPERATION_STARTED);
try (NetworkWrapper network = VvmNetworkRequest.getNetwork(config, phoneAccount, status)) {
if (network == null) {
VvmLog.e(TAG, "unable to acquire network");
task.fail();
return;
}
doSync(task, network.get(), phoneAccount, voicemail, action, status);
} catch (RequestFailedException e) {
config.handleEvent(status, OmtpEvents.DATA_NO_CONNECTION_CELLULAR_REQUIRED);
task.fail();
}
}
use of com.android.voicemail.impl.OmtpVvmCarrierConfigHelper in project android_packages_apps_Dialer by LineageOS.
the class OmtpMessageReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
mContext = context;
VisualVoicemailSms sms = intent.getExtras().getParcelable(OmtpService.EXTRA_VOICEMAIL_SMS);
PhoneAccountHandle phone = sms.getPhoneAccountHandle();
if (phone == null) {
// This should never happen
VvmLog.i(TAG, "Received message for null phone account");
return;
}
if (!context.getSystemService(UserManager.class).isUserUnlocked()) {
VvmLog.i(TAG, "Received message on locked device");
// LegacyModeSmsHandler can handle new message notifications without storage access
LegacyModeSmsHandler.handle(context, sms);
// done.
return;
}
OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(mContext, phone);
if (!helper.isValid()) {
VvmLog.e(TAG, "vvm config no longer valid");
return;
}
if (!VisualVoicemailSettingsUtil.isEnabled(mContext, phone)) {
if (helper.isLegacyModeEnabled()) {
LegacyModeSmsHandler.handle(context, sms);
} else {
VvmLog.i(TAG, "Received vvm message for disabled vvm source.");
}
return;
}
String eventType = sms.getPrefix();
Bundle data = sms.getFields();
if (eventType == null || data == null) {
VvmLog.e(TAG, "Unparsable VVM SMS received, ignoring");
return;
}
if (eventType.equals(OmtpConstants.SYNC_SMS_PREFIX)) {
SyncMessage message = new SyncMessage(data);
VvmLog.v(TAG, "Received SYNC sms for " + phone + " with event " + message.getSyncTriggerEvent());
processSync(phone, message);
} else if (eventType.equals(OmtpConstants.STATUS_SMS_PREFIX)) {
VvmLog.v(TAG, "Received Status sms for " + phone);
// If the STATUS SMS is initiated by ActivationTask the TaskSchedulerService will reject
// the follow request. Providing the data will also prevent ActivationTask from
// requesting another STATUS SMS. The following task will only run if the carrier
// spontaneous send a STATUS SMS, in that case, the VVM service should be reactivated.
ActivationTask.start(context, phone, data);
} else {
VvmLog.w(TAG, "Unknown prefix: " + eventType);
VisualVoicemailProtocol protocol = helper.getProtocol();
if (protocol == null) {
return;
}
Bundle statusData = helper.getProtocol().translateStatusSmsBundle(helper, eventType, data);
if (statusData != null) {
VvmLog.i(TAG, "Protocol recognized the SMS as STATUS, activating");
ActivationTask.start(context, phone, data);
}
}
}
Aggregations