Skip to content

Commit

Permalink
Merge pull request #3907 from nextcloud/ezaquarii/initialize-main-app…
Browse files Browse the repository at this point in the history
…-context-before-content-providers-start

Initialize global context before MainApp.onCreate()
  • Loading branch information
tobiasKaminsky authored Apr 17, 2019
2 parents 2afb934 + 2a08cb4 commit 28f80cd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/com/owncloud/android/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import com.nextcloud.client.di.DaggerAppComponent;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.PassCodeManager;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.MediaFolder;
Expand Down Expand Up @@ -163,9 +162,17 @@ public class MainApp extends MultiDexApplication implements
@SuppressWarnings("unused")
private boolean mBound;

/**
* Temporary hack
*/
private static void initGlobalContext(Context context) {
mContext = context;
}

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
initGlobalContext(this);
DaggerAppComponent.builder()
.application(this)
.build()
Expand All @@ -187,7 +194,6 @@ public void onCreate() {
uploadsStorageManager
)
);
MainApp.mContext = getApplicationContext();

new SecurityUtils();
DisplayUtils.useCompatVectorIfNeeded();
Expand Down

0 comments on commit 28f80cd

Please sign in to comment.