Skip to content
Commit a3d9f76b authored by Leland Miller's avatar Leland Miller
Browse files

Use injected instance of RcsControllerCall

Instead of static methods, create an instance of RcsControllerCall that
holds a reference to the Context and inject it where it is used.

This will be used in a follow up commit that will require the calling
package name be passed when calling IRcs methods.

This change will allow passing a calling package name to an
RcsServiceCall or an RcsServiceCallWithNoReturn, so uses of the call
method might look something like:

```
mRcsControllerCall.call((iRcs, callingPackage) ->
        iRcs.getFileTransferContentUri(mId, callingPackage));
```

Alternatives to storing the context here would have been:

1. To store the context everywhere the RcsControllerCall is injected and
   get the calling package name at each RcsControllerCall call

2. To store the calling package name everywhere that the
   RcsControllerCall instance is injected

Compared to solution 1, the implemented solution avoids repeating the
logic of retrieving the calling package.

Compared to solution 2, the implemented solution does not introduce any
complexity. In addition, the individual classes do not care about the
calling package name outside of the need to pass it to an IRcs method.
In the future, the implemented solution may also provide a useful point
to provide logic involving calls and the context (or other injected
dependencies). Though this future concern is not alone enough to justify
the solution, since the solution adds no additional complexity against
other solutions, it seems like a nice benefit.

Note, to avoid polluting this commit, a follow-up issue (b/128029441)
has been created to adjust the name of RcsControllerCall to reflect that
an instance of RcsControllerCall does not represent a single call to
RcsController.

Bug: 123699565
Test: Existing tests pass
Change-Id: Ib0f55f14397e5eb1e5a55864094c0be0c4e37c06
parent 35d29333
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment