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

Commit 5430507e authored by joonhunshin's avatar joonhunshin Committed by Automerger Merge Worker
Browse files

Refactoring ImsManager to access aosp storage instead accessing ImsConfig directly am: 41d39dd8

parents 4d01c473 41d39dd8
Loading
Loading
Loading
Loading
+38 −90
Original line number Original line Diff line number Diff line
@@ -1613,76 +1613,55 @@ public class ImsManager implements FeatureUpdates {
    }
    }


    /**
    /**
     * Will return with config value or throw an ImsException if we receive an error from
     * Will return with MmTel config value or return false if we receive an error from the AOSP
     * ImsConfig for that value.
     * storage(ImsProvisioningController) implementation for that value.
     */
     */
    private boolean getProvisionedBool(ImsConfig config, int item) throws ImsException {
    private boolean getImsProvisionedBoolNoException(int capability, int tech) {
        int value = 0;
        int subId = getSubId();
        ITelephony telephony = getITelephony();
        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
        try {
            logw("getImsProvisionedBoolNoException subId is invalid");
            if (telephony != null) {
            return false;
                value = telephony.getImsProvisioningInt(getSubId(), item);
            }
        } catch (RemoteException e) {
            throw new ImsException(
                    "getProvisionedBool : couldn't reach telephony! item: " + item,
                    ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
        }
        }
        return value == ProvisioningManager.PROVISIONING_VALUE_ENABLED;

        ITelephony iTelephony = getITelephony();
        if (iTelephony == null) {
            logw("getImsProvisionedBoolNoException ITelephony interface is invalid");
            return false;
        }
        }


    /**
     * Will set config value or throw an ImsException if we receive an error from ImsConfig for that
     * value.
     */
    private void setProvisionedBool(ImsConfig config, int item, int value) throws ImsException {
        int result = ImsConfigImplBase.CONFIG_RESULT_UNKNOWN;
        ITelephony telephony = getITelephony();
        try {
        try {
            if (telephony != null) {
            return  iTelephony.getImsProvisioningStatusForCapability(subId, capability, tech);
                result = telephony.setImsProvisioningInt(getSubId(), item, value);
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw new ImsException(
            logw("getImsProvisionedBoolNoException: operation failed for capability=" + capability
                    "setProvisionedBool : couldn't reach telephony! item: " + item,
                    + ". Exception:" + e.getMessage() + ". Returning false.");
                    ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
            return false;
        }
        }
        if (result != ImsConfigImplBase.CONFIG_RESULT_SUCCESS) {
            throw new ImsException("setProvisionedBool failed with error for item: " + item,
                    ImsReasonInfo.CODE_LOCAL_INTERNAL_ERROR);
        }
        return;
    }
    }


    /**
    /**
     * Will return with config value or return false if we receive an error from
     * Will return with Rcs config value or return false if we receive an error from the AOSP
     * ImsConfigImplBase implementation for that value.
     * storage(ImsProvisioningController) implementation for that value.
     */
     */
    private boolean getProvisionedBoolNoException(int item) {
    private boolean getRcsProvisionedBoolNoException(int capability, int tech) {
        try {
        int subId = getSubId();
            ImsConfig config = getConfigInterface();
        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            return getProvisionedBool(config, item);
            logw("getRcsProvisionedBoolNoException subId is invalid");
        } catch (ImsException ex) {
            logw("getProvisionedBoolNoException: operation failed for item=" + item
                    + ". Exception:" + ex.getMessage() + ". Returning false.");
            return false;
            return false;
        }
        }

        ITelephony iTelephony = getITelephony();
        if (iTelephony == null) {
            logw("getRcsProvisionedBoolNoException ITelephony interface is invalid");
            return false;
        }
        }


    /**
     * Will return with config value or return false if we receive an error from
     * ImsConfigImplBase implementation for that value.
     */
    private boolean setProvisionedBoolNoException(int item, int value) {
        try {
        try {
            ImsConfig config = getConfigInterface();
            return  iTelephony.getRcsProvisioningStatusForCapability(subId, capability, tech);
            setProvisionedBool(config, item, value);
        } catch (RemoteException e) {
        } catch (ImsException ex) {
            logw("getRcsProvisionedBoolNoException: operation failed for capability=" + capability
            logw("setProvisionedBoolNoException: operation failed for item=" + item
                    + ". Exception:" + e.getMessage() + ". Returning false.");
                    + ", value=" + value + ". Exception:" + ex.getMessage());
            return false;
            return false;
        }
        }
        return true;
    }
    }


    /**
    /**
@@ -3124,34 +3103,6 @@ public class ImsManager implements FeatureUpdates {
        }
        }
    }
    }


    public void setVolteProvisioned(boolean isProvisioned) {
        int provisionStatus = isProvisioned ? ProvisioningManager.PROVISIONING_VALUE_ENABLED :
                ProvisioningManager.PROVISIONING_VALUE_DISABLED;
        setProvisionedBoolNoException(ImsConfig.ConfigConstants.VLT_SETTING_ENABLED,
                provisionStatus);
    }

    public void setWfcProvisioned(boolean isProvisioned) {
        int provisionStatus = isProvisioned ? ProvisioningManager.PROVISIONING_VALUE_ENABLED :
                ProvisioningManager.PROVISIONING_VALUE_DISABLED;
        setProvisionedBoolNoException(
                ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED, provisionStatus);
    }

    public void setVtProvisioned(boolean isProvisioned) {
        int provisionStatus = isProvisioned ? ProvisioningManager.PROVISIONING_VALUE_ENABLED :
                ProvisioningManager.PROVISIONING_VALUE_DISABLED;
        setProvisionedBoolNoException(ImsConfig.ConfigConstants.LVC_SETTING_ENABLED,
                provisionStatus);
    }

    public void setEabProvisioned(boolean isProvisioned) {
        int provisionStatus = isProvisioned ? ProvisioningManager.PROVISIONING_VALUE_ENABLED :
                ProvisioningManager.PROVISIONING_VALUE_DISABLED;
        setProvisionedBoolNoException(ImsConfig.ConfigConstants.EAB_SETTING_ENABLED,
                provisionStatus);
    }

    private boolean isDataEnabled() {
    private boolean isDataEnabled() {
        TelephonyManager tm = mContext.getSystemService(TelephonyManager.class);
        TelephonyManager tm = mContext.getSystemService(TelephonyManager.class);
        if (tm == null) {
        if (tm == null) {
@@ -3163,23 +3114,20 @@ public class ImsManager implements FeatureUpdates {
    }
    }


    private boolean isVolteProvisioned() {
    private boolean isVolteProvisioned() {
        return getProvisionedBoolNoException(
        return getImsProvisionedBoolNoException(CAPABILITY_TYPE_VOICE, REGISTRATION_TECH_LTE);
                ImsConfig.ConfigConstants.VLT_SETTING_ENABLED);
    }
    }


    private boolean isEabProvisioned() {
    private boolean isEabProvisioned() {
        return getProvisionedBoolNoException(
        return getRcsProvisionedBoolNoException(CAPABILITY_TYPE_PRESENCE_UCE,
                ImsConfig.ConfigConstants.EAB_SETTING_ENABLED);
                REGISTRATION_TECH_LTE);
    }
    }


    private boolean isWfcProvisioned() {
    private boolean isWfcProvisioned() {
        return getProvisionedBoolNoException(
        return getImsProvisionedBoolNoException(CAPABILITY_TYPE_VOICE, REGISTRATION_TECH_IWLAN);
                ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED);
    }
    }


    private boolean isVtProvisioned() {
    private boolean isVtProvisioned() {
        return getProvisionedBoolNoException(
        return getImsProvisionedBoolNoException(CAPABILITY_TYPE_VIDEO, REGISTRATION_TECH_LTE);
                ImsConfig.ConfigConstants.LVC_SETTING_ENABLED);
    }
    }


    private boolean isMmTelProvisioningRequired(int capability, int tech) {
    private boolean isMmTelProvisioningRequired(int capability, int tech) {
+115 −47

File changed.

Preview size limit exceeded, changes collapsed.