Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dbfec000 authored by Pavel Zhamaitsiak's avatar Pavel Zhamaitsiak Committed by The Android Automerger
Browse files

Add button in "hidden" settings to flip "VoLTE Provisioned" flag

VoLTE Provisioned flag can be lost when new device image is flashed. Currently
there is no way to trigger Verizon provisioning update from device. This patch
adds button in hidden settings which allow to manually change value of the
flag.

Bug: 19038362
Change-Id: I23f13004dbcf9eaf711c66261696772b1d7bfd6e
parent 50f455fa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_JAVA_LIBRARIES := bouncycastle conscrypt telephony-common
LOCAL_JAVA_LIBRARIES := bouncycastle conscrypt telephony-common ims-common
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 android-support-v13 jsr305

LOCAL_MODULE_TAGS := optional
+8 −0
Original line number Diff line number Diff line
@@ -226,6 +226,14 @@
                android:layout_height="wrap_content"
                />

        <!-- VoLTE provisioned -->
        <Button android:id="@+id/volte_provisioned_flag"
                android:textSize="14sp"
                android:layout_marginTop="8dip"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />

        <!-- SMS over IMS -->
        <Button android:id="@+id/sms_over_ims"
                android:textSize="14sp"
+5 −0
Original line number Diff line number Diff line
@@ -72,6 +72,11 @@
    <!-- Phone IMS registration required off. Only shown in diagnostic screen, so precise translation is not needed. -->
    <string name="ims_reg_required_off">Turn off IMS registration required</string>

    <!-- VoLTE provisioning flag on. Only shown in diagnostic screen, so precise translation is not needed. -->
    <string name="volte_provisioned_flag_on">Turn on VoLTE provisioned flag</string>
    <!-- VoLTE provisioning flag off. Only shown in diagnostic screen, so precise translation is not needed. -->
    <string name="volte_provisioned_flag_off">Turn off VoLTE provisioned flag</string>

    <!-- Phone ram dump on. Only shown in diagnostic screen, so precise translation is not needed. -->
    <string name="lte_ram_dump_on">Turn on lte ram dump</string>
    <!-- Phone ram dump off. Only shown in diagnostic screen, so precise translation is not needed. -->
+52 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.settings;

import android.app.Activity;
import android.app.QueuedWork;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -55,6 +56,9 @@ import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.PhoneStateIntentReceiver;
import com.android.internal.telephony.TelephonyProperties;
import com.android.ims.ImsConfig;
import com.android.ims.ImsException;
import com.android.ims.ImsManager;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
@@ -195,6 +199,7 @@ public class RadioInfo extends Activity {
                case EVENT_SERVICE_STATE_CHANGED:
                    updateServiceState();
                    updatePowerState();
                    updateImsVoLteProvisionedState();
                    break;

                case EVENT_QUERY_PREFERRED_TYPE_DONE:
@@ -303,6 +308,9 @@ public class RadioInfo extends Activity {
        imsRegRequiredButton = (Button) findViewById(R.id.ims_reg_required);
        imsRegRequiredButton.setOnClickListener(mImsRegRequiredHandler);

        imsVoLteProvisionedButton = (Button) findViewById(R.id.volte_provisioned_flag);
        imsVoLteProvisionedButton.setOnClickListener(mImsVoLteProvisionedHandler);

        smsOverImsButton = (Button) findViewById(R.id.sms_over_ims);
        smsOverImsButton.setOnClickListener(mSmsOverImsHandler);

@@ -360,6 +368,7 @@ public class RadioInfo extends Activity {
        updatePowerState();
        updateCellInfoListRate();
        updateImsRegRequiredState();
        updateImsVoLteProvisionedState();
        updateSmsOverImsState();
        updateLteRamDumpState();
        updateProperties();
@@ -1002,6 +1011,49 @@ public class RadioInfo extends Activity {
        return SystemProperties.getBoolean(PROPERTY_SMS_OVER_IMS, false);
    }

    private Button imsVoLteProvisionedButton;
    OnClickListener mImsVoLteProvisionedHandler = new OnClickListener() {
        @Override
        public void onClick(View v) {
            log(String.format("toggle VoLTE provisioned: currently %s",
                    (isImsVoLteProvisioned() ? "on":"off")));
            final boolean newValue = !isImsVoLteProvisioned();
            if (phone != null) {
                final ImsManager imsManager = ImsManager.getInstance(phone.getContext(), phone.getSubId());
                if (imsManager != null) {
                    QueuedWork.singleThreadExecutor().submit(new Runnable() {
                        public void run() {
                            try {
                                imsManager.getConfigInterface().setProvisionedValue(
                                        ImsConfig.ConfigConstants.VLT_SETTING_ENABLED,
                                        newValue? 1 : 0);
                            } catch (ImsException e) {
                                Log.e(TAG, "setImsVoLteProvisioned() exception:", e);
                            }
                        }
                    });
                }
            }
            updateImsVoLteProvisionedState();
        }
    };

    private boolean isImsVoLteProvisioned() {
        if (phone != null) {
            ImsManager imsManager = ImsManager.getInstance(phone.getContext(), phone.getSubId());
            return imsManager.isVolteProvisionedOnDevice(phone.getContext());
        }
        return false;
    }

    private void updateImsVoLteProvisionedState() {
        log("updateImsVoLteProvisionedState isImsVoLteProvisioned()=" + isImsVoLteProvisioned());
        String buttonText = isImsVoLteProvisioned() ?
                getString(R.string.volte_provisioned_flag_off) :
                getString(R.string.volte_provisioned_flag_on);
        imsVoLteProvisionedButton.setText(buttonText);
    }

    private void updateSmsOverImsState() {
        log("updateSmsOverImsState isSmsOverImsEnabled()=" + isSmsOverImsEnabled());
        String buttonText = isSmsOverImsEnabled() ?