Skip to content

Commit

Permalink
Remove extra call of getApplicationContext()
Browse files Browse the repository at this point in the history
  • Loading branch information
MatkovIvan committed Jun 24, 2022
1 parent 90baebb commit 30d5e03
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

## Version 4.4.5 (Under development)

### App Center

* **[Fix]** Fix crash when SDK is started from overridden `Application.attachBaseContext`.

___

## Version 4.4.4
Expand Down
Expand Up @@ -35,7 +35,7 @@ static Context getApplicationContext(Application application) {
return application.createDeviceProtectedStorageContext();
}
}
return application.getApplicationContext();
return application;
}

/**
Expand Down
Expand Up @@ -39,7 +39,6 @@ public class ApplicationContextUtilsTest {

@Before
public void setUp() {
when(mApplication.getApplicationContext()).thenReturn(mApplication);
when(mApplication.isDeviceProtectedStorage()).thenReturn(false);
when(mApplication.createDeviceProtectedStorageContext()).thenReturn(mDeviceProtectedStorageContext);
when(mApplication.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
Expand Down Expand Up @@ -79,9 +78,6 @@ public void contextOnNewUnlockedDevice() {

/* It should be regular context. */
assertEquals(mApplication, ApplicationContextUtils.getApplicationContext(mApplication));

/* Verify get application context. */
verify(mApplication).getApplicationContext();
}

@Test
Expand All @@ -95,9 +91,6 @@ public void contextOnOldDevice() {

/* It should be regular context. */
assertEquals(mApplication, ApplicationContextUtils.getApplicationContext(mApplication));

/* Verify get application context. */
verify(mApplication).getApplicationContext();
}

@Test
Expand Down

0 comments on commit 30d5e03

Please sign in to comment.