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

Commit e05e489c authored by Vinit Deshpande's avatar Vinit Deshpande
Browse files

Merge remote-tracking branch 'goog/mirror-m-wireless-internal-release'

Change-Id: I80c47b7384f104d5a3680cc34e9cbb11145ee4a0
parents 9fee0a3f dff6ace4
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ public abstract class Connection {
        public void onVideoStateChanged(int videoState);
        public void onLocalVideoCapabilityChanged(boolean capable);
        public void onRemoteVideoCapabilityChanged(boolean capable);
        public void onWifiChanged(boolean isWifi);
        public void onVideoProviderChanged(
                android.telecom.Connection.VideoProvider videoProvider);
        public void onAudioQualityChanged(int audioQuality);
@@ -62,6 +63,8 @@ public abstract class Connection {
        @Override
        public void onRemoteVideoCapabilityChanged(boolean capable) {}
        @Override
        public void onWifiChanged(boolean isWifi) {}
        @Override
        public void onVideoProviderChanged(
                android.telecom.Connection.VideoProvider videoProvider) {}
        @Override
@@ -108,6 +111,7 @@ public abstract class Connection {
    private int mVideoState;
    private boolean mLocalVideoCapable;
    private boolean mRemoteVideoCapable;
    private boolean mIsWifi;
    private int mAudioQuality;
    private android.telecom.Connection.VideoProvider mVideoProvider;
    public Call.State mPreHandoverState = Call.State.IDLE;
@@ -486,6 +490,15 @@ public abstract class Connection {
        return mRemoteVideoCapable;
    }

    /**
     * Returns whether the connection is using a wifi network.
     *
     * @return {@code True} if the connection is using a wifi network.
     */
    public boolean isWifi() {
        return mIsWifi;
    }

    /**
     * Returns the {@link android.telecom.Connection.VideoProvider} for the connection.
     *
@@ -541,6 +554,18 @@ public abstract class Connection {
        }
    }

    /**
     * Sets whether a wifi network is used for the connection.
     *
     * @param isWifi {@code True} if wifi is being used.
     */
    public void setWifi(boolean isWifi) {
        mIsWifi = isWifi;
        for (Listener l : mListeners) {
            l.onWifiChanged(mIsWifi);
        }
    }

    /**
     * Set the audio quality for the connection.
     *
+14 −37
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Slog;
@@ -224,28 +223,6 @@ public final class MccTable {
        }
    }

    // Bug 19232829: It is possible to get through provisioning without setting up a persistent
    // locale value. We don't modify the locale if the device has completed "provisioning" because
    // we don't want to change the locale if the user inserts a new SIM or a new version of Android
    // is better at recognizing MCC values than an older version.
    private static boolean canUpdateLocale(Context context) {
        return !(userHasPersistedLocale() || isDeviceProvisioned(context));
    }

    private static boolean userHasPersistedLocale() {
        final String persistedLocale = SystemProperties.get("persist.sys.locale", "");
        return !persistedLocale.isEmpty();
    }

    private static boolean isDeviceProvisioned(Context context) {
        try {
            return Settings.Global.getInt(
                    context.getContentResolver(), Settings.Global.DEVICE_PROVISIONED) != 0;
        } catch (Settings.SettingNotFoundException e) {
            return false;
        }
    }

    /**
     * Return Locale for the language and country or null if no good match.
     *
@@ -266,13 +243,23 @@ public final class MccTable {
        }

        // Check whether a developer is trying to test an arbitrary MCC.
        boolean debuggingMccOverride = isDebuggingMccOverride();
        boolean debuggingMccOverride = false;
        if (Build.IS_DEBUGGABLE) {
            String overrideMcc = SystemProperties.get("persist.sys.override_mcc", "");
            if (!overrideMcc.isEmpty()) {
                debuggingMccOverride = true;
            }
        }

        // If this is a regular user and they already have a persisted locale, we're done.
        if (!(debuggingMccOverride || canUpdateLocale(context))) {
            Slog.d(LOG_TAG, "getLocaleForLanguageCountry: not permitted to update locale");
        if (!debuggingMccOverride) {
            String persistSysLanguage = SystemProperties.get("persist.sys.language", "");
            String persistSysCountry = SystemProperties.get("persist.sys.country", "");
            if (!(persistSysLanguage.isEmpty() && persistSysCountry.isEmpty())) {
                Slog.d(LOG_TAG, "getLocaleForLanguageCountry: skipping already persisted");
                return null;
            }
        }

        // Find the best match we actually have a localization for.
        // TODO: this should really follow the CLDR chain of parent locales!
@@ -328,16 +315,6 @@ public final class MccTable {
        return null;
    }

    private static boolean isDebuggingMccOverride() {
        if (Build.IS_DEBUGGABLE) {
            String overrideMcc = SystemProperties.get("persist.sys.override_mcc", "");
            if (!overrideMcc.isEmpty()) {
                return true;
            }
        }
        return false;
    }

    /**
     * Utility code to set the system locale if it's not set already
     * @param context Context to act on.
+20 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ public interface Phone {
    static final String REASON_SINGLE_PDN_ARBITRATION = "SinglePdnArbitration";
    static final String REASON_DATA_SPECIFIC_DISABLED = "specificDisabled";
    static final String REASON_SIM_NOT_READY = "simNotReady";
    static final String REASON_IWLAN_AVAILABLE = "iwlanAvailable";

    // Used for band mode selection methods
    static final int BM_UNSPECIFIED = 0; // selected by baseband automatically
@@ -1923,6 +1924,11 @@ public interface Phone {
     */
    public boolean isRadioAvailable();

    /**
     * Is Radio turned on
     */
    public boolean isRadioOn();

    /**
     * shutdown Radio gracefully
     */
@@ -1973,4 +1979,18 @@ public interface Phone {
     * @return true if IMS is Registered
     */
    public boolean isImsRegistered();

    /**
     * Determines if video calling is enabled for the phone.
     *
     * @return {@code true} if video calling is enabled, {@code false} otherwise.
     */
    public boolean isVideoEnabled();

    /**
     * @return {@code true} if we are in emergency call back mode. This is a period where the phone
     * should be using as little power as possible and be ready to receive an incoming call from the
     * emergency operator.
     */
    public boolean isInEcm();
}
+38 −3
Original line number Diff line number Diff line
@@ -1447,9 +1447,9 @@ public abstract class PhoneBase extends Handler implements Phone {
    }

    /**
     * @return true if we are in the emergency call back mode. This is a period where
     * the phone should be using as little power as possible and be ready to receive an
     * incoming call from the emergency operator.
     * @return {@code true} if we are in emergency call back mode. This is a period where the phone
     * should be using as little power as possible and be ready to receive an incoming call from the
     * emergency operator.
     */
    public boolean isInEcm() {
        return false;
@@ -2105,6 +2105,11 @@ public abstract class PhoneBase extends Handler implements Phone {
        return mCi.getRadioState().isAvailable();
    }

    @Override
    public boolean isRadioOn() {
        return mCi.getRadioState().isOn();
    }

    @Override
    public void shutdownRadio() {
        getServiceStateTracker().requestShutdown();
@@ -2135,6 +2140,36 @@ public abstract class PhoneBase extends Handler implements Phone {
        mCi.unregisterForRadioCapabilityChanged(this);
    }

    /**
     * Determines if  IMS is enabled for call.
     *
     * @return {@code true} if IMS calling is enabled.
     */
    public boolean isImsUseEnabled() {
        boolean imsUseEnabled =
                ((ImsManager.isVolteEnabledByPlatform(mContext) &&
                ImsManager.isEnhanced4gLteModeSettingEnabledByUser(mContext)) ||
                (ImsManager.isWfcEnabledByPlatform(mContext) &&
                ImsManager.isWfcEnabledByUser(mContext)) &&
                ImsManager.isNonTtyOrTtyOnVolteEnabled(mContext));
        return imsUseEnabled;
    }

    /**
     * Determines if video calling is enabled for the IMS phone.
     *
     * @return {@code true} if video calling is enabled.
     */
    @Override
    public boolean isVideoEnabled() {
        ImsPhone imsPhone = mImsPhone;
        if ((imsPhone != null)
                && (imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)) {
            return imsPhone.isVideoEnabled();
        }
        return false;
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("PhoneBase: subId=" + getSubId());
        pw.println(" mPhoneId=" + mPhoneId);
+25 −0
Original line number Diff line number Diff line
@@ -1469,6 +1469,11 @@ public class PhoneProxy extends Handler implements Phone {
        return mCommandsInterface.getRadioState().isAvailable();
    }

    @Override
    public boolean isRadioOn() {
        return mCommandsInterface.getRadioState().isOn();
    }

    @Override
    public void shutdownRadio() {
        mActivePhone.shutdownRadio();
@@ -1507,6 +1512,26 @@ public class PhoneProxy extends Handler implements Phone {
        return mActivePhone.isImsRegistered();
    }

    /**
     * Determines if video calling is enabled for the IMS phone.
     *
     * @return {@code true} if video calling is enabled.
     */
    @Override
    public boolean isVideoEnabled() {
        return mActivePhone.isVideoEnabled();
    }

    /**
     * @return true if we are in the emergency call back mode. This is a period where
     * the phone should be using as little power as possible and be ready to receive an
     * incoming call from the emergency operator.
     */
    @Override
    public boolean isInEcm() {
        return mActivePhone.isInEcm();
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        try {
            ((PhoneBase)mActivePhone).dump(fd, pw, args);
Loading