Loading src/java/com/android/ims/ImsManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.ims; import android.annotation.Nullable; import android.app.PendingIntent; import android.content.Context; import android.content.pm.PackageManager; import android.os.Bundle; import android.os.Handler; import android.os.HandlerExecutor; Loading Loading @@ -308,8 +309,14 @@ public class ImsManager { * Start the creation of a connection to the underlying ImsService implementation. When the * service is connected, {@link Listener#connectionReady(ImsManager)} will be called with * an active ImsManager instance. * * If this device does not support an ImsStack (i.e. doesn't support * {@link PackageManager#FEATURE_TELEPHONY_IMS} feature), this method will do nothing. */ public void connect() { if (!ImsManager.isImsSupportedOnDevice(mContext)) { return; } mRetryCount = 0; // Send a message to connect to the Ims Service and open a connection through // getImsService(). Loading Loading @@ -448,6 +455,10 @@ public class ImsManager { } } public static boolean isImsSupportedOnDevice(Context context) { return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS); } /** * Returns the user configuration of Enhanced 4G LTE Mode setting. * Loading Loading @@ -2369,6 +2380,10 @@ public class ImsManager { */ private void checkAndThrowExceptionIfServiceUnavailable() throws ImsException { if (!isImsSupportedOnDevice(mContext)) { throw new ImsException("IMS not supported on device.", ImsReasonInfo.CODE_LOCAL_IMS_NOT_SUPPORTED_ON_DEVICE); } if (mMmTelFeatureConnection == null || !mMmTelFeatureConnection.isBinderAlive()) { createImsService(); Loading Loading @@ -2758,6 +2773,7 @@ public class ImsManager { public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("ImsManager:"); pw.println(" device supports IMS = " + isImsSupportedOnDevice(mContext)); pw.println(" mPhoneId = " + mPhoneId); pw.println(" mConfigUpdated = " + mConfigUpdated); pw.println(" mImsServiceProxy = " + mMmTelFeatureConnection); Loading src/java/com/android/ims/MmTelFeatureConnection.java +14 −10 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.ims; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.os.Handler; Loading Loading @@ -297,7 +298,7 @@ public class MmTelFeatureConnection { IImsRegistration imsRegistration = getRegistration(); if (imsRegistration != null) { try { getRegistration().addRegistrationCallback(localCallback); imsRegistration.addRegistrationCallback(localCallback); } catch (RemoteException e) { throw new IllegalStateException("ImsRegistrationCallbackAdapter: MmTelFeature" + " binder is dead."); Loading @@ -314,7 +315,7 @@ public class MmTelFeatureConnection { IImsRegistration imsRegistration = getRegistration(); if (imsRegistration != null) { try { getRegistration().removeRegistrationCallback(localCallback); imsRegistration.removeRegistrationCallback(localCallback); } catch (RemoteException e) { Log.w(TAG, "ImsRegistrationCallbackAdapter - unregisterCallback: couldn't" + " remove registration callback"); Loading Loading @@ -429,6 +430,7 @@ public class MmTelFeatureConnection { private final Object mLock = new Object(); // Updated by IImsServiceFeatureCallback when FEATURE_EMERGENCY_MMTEL is sent. private boolean mSupportsEmergencyCalling = false; private static boolean sImsSupportedOnDevice = true; // Cache the Registration and Config interfaces as long as the MmTel feature is connected. If // it becomes disconnected, invalidate. Loading @@ -451,8 +453,13 @@ public class MmTelFeatureConnection { private final CapabilityCallbackManager mCapabilityCallbackManager; private final ProvisioningCallbackManager mProvisioningCallbackManager; public static MmTelFeatureConnection create(Context context , int slotId) { public static @NonNull MmTelFeatureConnection create(Context context , int slotId) { MmTelFeatureConnection serviceProxy = new MmTelFeatureConnection(context, slotId); if (!ImsManager.isImsSupportedOnDevice(context)) { // Return empty service proxy in the case that IMS is not supported. sImsSupportedOnDevice = false; return serviceProxy; } TelephonyManager tm = getTelephonyManager(context); if (tm == null) { Loading Loading @@ -946,7 +953,10 @@ public class MmTelFeatureConnection { return mIsAvailable && mBinder != null && mBinder.isBinderAlive(); } protected void checkServiceIsReady() throws RemoteException { private void checkServiceIsReady() throws RemoteException { if (!sImsSupportedOnDevice) { throw new RemoteException("IMS is not supported on this device."); } if (!isBinderReady()) { throw new RemoteException("ImsServiceProxy is not ready to accept commands."); } Loading @@ -955,10 +965,4 @@ public class MmTelFeatureConnection { private IImsMmTelFeature getServiceInterface(IBinder b) { return IImsMmTelFeature.Stub.asInterface(b); } protected void checkBinderConnection() throws RemoteException { if (!isBinderAlive()) { throw new RemoteException("ImsServiceProxy is not available for that feature."); } } } Loading
src/java/com/android/ims/ImsManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.ims; import android.annotation.Nullable; import android.app.PendingIntent; import android.content.Context; import android.content.pm.PackageManager; import android.os.Bundle; import android.os.Handler; import android.os.HandlerExecutor; Loading Loading @@ -308,8 +309,14 @@ public class ImsManager { * Start the creation of a connection to the underlying ImsService implementation. When the * service is connected, {@link Listener#connectionReady(ImsManager)} will be called with * an active ImsManager instance. * * If this device does not support an ImsStack (i.e. doesn't support * {@link PackageManager#FEATURE_TELEPHONY_IMS} feature), this method will do nothing. */ public void connect() { if (!ImsManager.isImsSupportedOnDevice(mContext)) { return; } mRetryCount = 0; // Send a message to connect to the Ims Service and open a connection through // getImsService(). Loading Loading @@ -448,6 +455,10 @@ public class ImsManager { } } public static boolean isImsSupportedOnDevice(Context context) { return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS); } /** * Returns the user configuration of Enhanced 4G LTE Mode setting. * Loading Loading @@ -2369,6 +2380,10 @@ public class ImsManager { */ private void checkAndThrowExceptionIfServiceUnavailable() throws ImsException { if (!isImsSupportedOnDevice(mContext)) { throw new ImsException("IMS not supported on device.", ImsReasonInfo.CODE_LOCAL_IMS_NOT_SUPPORTED_ON_DEVICE); } if (mMmTelFeatureConnection == null || !mMmTelFeatureConnection.isBinderAlive()) { createImsService(); Loading Loading @@ -2758,6 +2773,7 @@ public class ImsManager { public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("ImsManager:"); pw.println(" device supports IMS = " + isImsSupportedOnDevice(mContext)); pw.println(" mPhoneId = " + mPhoneId); pw.println(" mConfigUpdated = " + mConfigUpdated); pw.println(" mImsServiceProxy = " + mMmTelFeatureConnection); Loading
src/java/com/android/ims/MmTelFeatureConnection.java +14 −10 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.ims; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.os.Handler; Loading Loading @@ -297,7 +298,7 @@ public class MmTelFeatureConnection { IImsRegistration imsRegistration = getRegistration(); if (imsRegistration != null) { try { getRegistration().addRegistrationCallback(localCallback); imsRegistration.addRegistrationCallback(localCallback); } catch (RemoteException e) { throw new IllegalStateException("ImsRegistrationCallbackAdapter: MmTelFeature" + " binder is dead."); Loading @@ -314,7 +315,7 @@ public class MmTelFeatureConnection { IImsRegistration imsRegistration = getRegistration(); if (imsRegistration != null) { try { getRegistration().removeRegistrationCallback(localCallback); imsRegistration.removeRegistrationCallback(localCallback); } catch (RemoteException e) { Log.w(TAG, "ImsRegistrationCallbackAdapter - unregisterCallback: couldn't" + " remove registration callback"); Loading Loading @@ -429,6 +430,7 @@ public class MmTelFeatureConnection { private final Object mLock = new Object(); // Updated by IImsServiceFeatureCallback when FEATURE_EMERGENCY_MMTEL is sent. private boolean mSupportsEmergencyCalling = false; private static boolean sImsSupportedOnDevice = true; // Cache the Registration and Config interfaces as long as the MmTel feature is connected. If // it becomes disconnected, invalidate. Loading @@ -451,8 +453,13 @@ public class MmTelFeatureConnection { private final CapabilityCallbackManager mCapabilityCallbackManager; private final ProvisioningCallbackManager mProvisioningCallbackManager; public static MmTelFeatureConnection create(Context context , int slotId) { public static @NonNull MmTelFeatureConnection create(Context context , int slotId) { MmTelFeatureConnection serviceProxy = new MmTelFeatureConnection(context, slotId); if (!ImsManager.isImsSupportedOnDevice(context)) { // Return empty service proxy in the case that IMS is not supported. sImsSupportedOnDevice = false; return serviceProxy; } TelephonyManager tm = getTelephonyManager(context); if (tm == null) { Loading Loading @@ -946,7 +953,10 @@ public class MmTelFeatureConnection { return mIsAvailable && mBinder != null && mBinder.isBinderAlive(); } protected void checkServiceIsReady() throws RemoteException { private void checkServiceIsReady() throws RemoteException { if (!sImsSupportedOnDevice) { throw new RemoteException("IMS is not supported on this device."); } if (!isBinderReady()) { throw new RemoteException("ImsServiceProxy is not ready to accept commands."); } Loading @@ -955,10 +965,4 @@ public class MmTelFeatureConnection { private IImsMmTelFeature getServiceInterface(IBinder b) { return IImsMmTelFeature.Stub.asInterface(b); } protected void checkBinderConnection() throws RemoteException { if (!isBinderAlive()) { throw new RemoteException("ImsServiceProxy is not available for that feature."); } } }