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

Commit 1975a56d authored by Malcolm Chen's avatar Malcolm Chen
Browse files

Fix bug that sPhones is not mocked in test.

In TelephonyTest.java, array mPhones is created before initMocks is
called, thus mPhone is not included properly in that array.

Bug: 64132030
Test: unit-test
Change-Id: Ifb7c48a9fa6f4c468f11b99064df0854f4769f18
parent 97742aa6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ public abstract class TelephonyTest {
    private Object mLock = new Object();
    private boolean mReady;
    protected HashMap<String, IBinder> mServiceManagerMockedServices = new HashMap<>();
    private Phone[] mPhones = new Phone[] {mPhone};
    private Phone[] mPhones;


    protected HashMap<Integer, ImsManager> mImsManagerInstances = new HashMap<>();
@@ -307,6 +307,7 @@ public abstract class TelephonyTest {
        TAG = tag;
        MockitoAnnotations.initMocks(this);

        mPhones = new Phone[] {mPhone};
        mSimulatedCommands = new SimulatedCommands();
        mContextFixture = new ContextFixture();
        mContext = mContextFixture.getTestDouble();
@@ -459,6 +460,7 @@ public abstract class TelephonyTest {

        //SIM
        doReturn(1).when(mTelephonyManager).getSimCount();
        doReturn(1).when(mTelephonyManager).getPhoneCount();

        //Use reflection to mock singletons
        replaceInstance(CallManager.class, "INSTANCE", null, mCallManager);