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

Commit a625ccdb authored by Brad Ebinger's avatar Brad Ebinger Committed by Android (Google) Code Review
Browse files

Merge "Updates IMS features when ImsService updates them" into pi-dev

parents 52143a05 6dd642bb
Loading
Loading
Loading
Loading
+23 −8
Original line number Original line Diff line number Diff line
@@ -89,8 +89,8 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
    private static final int HANDLER_CONFIG_CHANGED = 2;
    private static final int HANDLER_CONFIG_CHANGED = 2;
    // A query has been started for an ImsService to relay the features they support.
    // A query has been started for an ImsService to relay the features they support.
    private static final int HANDLER_START_DYNAMIC_FEATURE_QUERY = 3;
    private static final int HANDLER_START_DYNAMIC_FEATURE_QUERY = 3;
    // A query to request ImsService features has completed.
    // A query to request ImsService features has completed or the ImsService has updated features.
    private static final int HANDLER_DYNAMIC_FEATURE_QUERY_COMPLETE = 4;
    private static final int HANDLER_DYNAMIC_FEATURE_CHANGE = 4;
    // Testing: Overrides the current configuration for ImsService binding
    // Testing: Overrides the current configuration for ImsService binding
    private static final int HANDLER_OVERRIDE_IMS_SERVICE_CONFIG = 5;
    private static final int HANDLER_OVERRIDE_IMS_SERVICE_CONFIG = 5;


@@ -358,7 +358,7 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
                startDynamicQuery(info);
                startDynamicQuery(info);
                break;
                break;
            }
            }
            case HANDLER_DYNAMIC_FEATURE_QUERY_COMPLETE: {
            case HANDLER_DYNAMIC_FEATURE_CHANGE: {
                SomeArgs args = (SomeArgs) msg.obj;
                SomeArgs args = (SomeArgs) msg.obj;
                ComponentName name = (ComponentName) args.arg1;
                ComponentName name = (ComponentName) args.arg1;
                Set<ImsFeatureConfiguration.FeatureSlotPair> features =
                Set<ImsFeatureConfiguration.FeatureSlotPair> features =
@@ -401,7 +401,7 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
                        Set<ImsFeatureConfiguration.FeatureSlotPair> features) {
                        Set<ImsFeatureConfiguration.FeatureSlotPair> features) {
                    Log.d(TAG, "onComplete called for name: " + name + "features:"
                    Log.d(TAG, "onComplete called for name: " + name + "features:"
                            + printFeatures(features));
                            + printFeatures(features));
                    handleFeatureQueryComplete(name, features);
                    handleFeaturesChanged(name, features);
                }
                }


                @Override
                @Override
@@ -952,6 +952,21 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
        removeImsController(slotId, feature);
        removeImsController(slotId, feature);
    }
    }


    /**
     * Implementation of
     * {@link ImsServiceController.ImsServiceControllerCallbacks#imsServiceFeaturesChanged, which
     * notify the ImsResolver of a change to the supported ImsFeatures of a connected ImsService.
     */
    public void imsServiceFeaturesChanged(ImsFeatureConfiguration config,
            ImsServiceController controller) {
        if (controller == null || config == null) {
            return;
        }
        Log.i(TAG, "imsServiceFeaturesChanged: config=" + config.getServiceFeatures()
                + ", ComponentName=" + controller.getComponentName());
        handleFeaturesChanged(controller.getComponentName(), config.getServiceFeatures());
    }

    /**
    /**
     * Determines if the features specified should cause a bind or keep a binding active to an
     * Determines if the features specified should cause a bind or keep a binding active to an
     * ImsService.
     * ImsService.
@@ -1058,12 +1073,12 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
    /**
    /**
     * Schedules the processing of a completed query.
     * Schedules the processing of a completed query.
     */
     */
    private void handleFeatureQueryComplete(ComponentName name,
    private void handleFeaturesChanged(ComponentName name,
            Set<ImsFeatureConfiguration.FeatureSlotPair> features) {
            Set<ImsFeatureConfiguration.FeatureSlotPair> features) {
        SomeArgs args = SomeArgs.obtain();
        SomeArgs args = SomeArgs.obtain();
        args.arg1 = name;
        args.arg1 = name;
        args.arg2 = features;
        args.arg2 = features;
        mHandler.obtainMessage(HANDLER_DYNAMIC_FEATURE_QUERY_COMPLETE, args).sendToTarget();
        mHandler.obtainMessage(HANDLER_DYNAMIC_FEATURE_CHANGE, args).sendToTarget();
    }
    }


    // Starts a dynamic query. Called from handler ONLY.
    // Starts a dynamic query. Called from handler ONLY.
@@ -1083,7 +1098,7 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
            Set<ImsFeatureConfiguration.FeatureSlotPair> features) {
            Set<ImsFeatureConfiguration.FeatureSlotPair> features) {
        ImsServiceInfo service = getImsServiceInfoFromCache(name.getPackageName());
        ImsServiceInfo service = getImsServiceInfoFromCache(name.getPackageName());
        if (service == null) {
        if (service == null) {
            Log.w(TAG, "handleFeatureQueryComplete: Couldn't find cached info for name: "
            Log.w(TAG, "handleFeaturesChanged: Couldn't find cached info for name: "
                    + name);
                    + name);
            return;
            return;
        }
        }
@@ -1108,7 +1123,7 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
    public boolean isResolvingBinding() {
    public boolean isResolvingBinding() {
        return mHandler.hasMessages(HANDLER_START_DYNAMIC_FEATURE_QUERY)
        return mHandler.hasMessages(HANDLER_START_DYNAMIC_FEATURE_QUERY)
                // We haven't processed this message yet, so it is still resolving.
                // We haven't processed this message yet, so it is still resolving.
                || mHandler.hasMessages(HANDLER_DYNAMIC_FEATURE_QUERY_COMPLETE)
                || mHandler.hasMessages(HANDLER_DYNAMIC_FEATURE_CHANGE)
                || mFeatureQueryManager.isQueryInProgress();
                || mFeatureQueryManager.isQueryInProgress();
    }
    }


+18 −0
Original line number Original line Diff line number Diff line
@@ -149,6 +149,16 @@ public class ImsServiceController {
        }
        }
    }
    }


    private ImsService.Listener mFeatureChangedListener = new ImsService.Listener() {
        @Override
        public void onUpdateSupportedImsFeatures(ImsFeatureConfiguration c) {
            if (mCallbacks == null) {
                return;
            }
            mCallbacks.imsServiceFeaturesChanged(c, ImsServiceController.this);
        }
    };

    /**
    /**
     * Defines callbacks that are used by the ImsServiceController to notify when an ImsService
     * Defines callbacks that are used by the ImsServiceController to notify when an ImsService
     * has created or removed a new feature as well as the associated ImsServiceController.
     * has created or removed a new feature as well as the associated ImsServiceController.
@@ -162,6 +172,13 @@ public class ImsServiceController {
         * Called by ImsServiceController when a new MMTEL or RCS feature has been removed.
         * Called by ImsServiceController when a new MMTEL or RCS feature has been removed.
         */
         */
        void imsServiceFeatureRemoved(int slotId, int feature, ImsServiceController controller);
        void imsServiceFeatureRemoved(int slotId, int feature, ImsServiceController controller);

        /**
         * Called by the ImsServiceController when the ImsService has notified the framework that
         * its features have changed.
         */
        void imsServiceFeaturesChanged(ImsFeatureConfiguration config,
                ImsServiceController controller);
    }
    }


    /**
    /**
@@ -552,6 +569,7 @@ public class ImsServiceController {
        synchronized (mLock) {
        synchronized (mLock) {
            if (isServiceControllerAvailable()) {
            if (isServiceControllerAvailable()) {
                Log.d(LOG_TAG, "notifyImsServiceReady");
                Log.d(LOG_TAG, "notifyImsServiceReady");
                mIImsServiceController.setListener(mFeatureChangedListener);
                mIImsServiceController.notifyImsServiceReadyForFeatureCreation();
                mIImsServiceController.notifyImsServiceReadyForFeatureCreation();
            }
            }
        }
        }