Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove extra call of getApplicationContext() #1639

Merged
merged 2 commits into from Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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