Commit 898deeea authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

weblayer: makes WebLayer.init() work after creation

Prior to this patch WebLayer.init() must be called before
super.onCreate() (from FragmentActivity), otherwise we hit NPEs.

Two changes are necessary to get this working:
. Remove call to ApplicationStatus.initialize().
. Supply false to ActivityWindowAndroid so that it doesn't listen to
  the activity.

BUG=none
TEST=none

Change-Id: I24a80de016b9a8433f883f9d9e9a5c12808abc91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1810252Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697737}
parent 0dbf2777
......@@ -73,7 +73,10 @@ public final class BrowserControllerImpl extends IBrowserController.Stub {
return implContext.getResources();
}
};
mWindowAndroid = new ActivityWindowAndroid(context);
// Use false to disable listening to activity state.
// TODO: this should *not* use ActivityWindowAndroid as that relies on Activity, and this
// code should not assume it is supplied an Activity.
mWindowAndroid = new ActivityWindowAndroid(context, false);
mContentViewRenderView = new ContentViewRenderView(context);
mContentViewRenderView.onNativeLibraryLoaded(
......
......@@ -11,7 +11,6 @@ import android.content.res.Resources;
import android.os.IBinder;
import android.util.AndroidRuntimeException;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.CommandLine;
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
......@@ -52,7 +51,6 @@ public final class WebLayerImpl extends IWebLayer.Stub {
});
ResourceBundle.setNoAvailableLocalePaks();
PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);
ApplicationStatus.initialize(application);
ChildProcessCreationParams.set(implContext.getPackageName(), true /* isExternalService */,
LibraryProcessType.PROCESS_CHILD, true /* bindToCaller */,
......
......@@ -64,11 +64,11 @@ public class WebLayerShellActivity extends FragmentActivity {
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Only call init for main process.
WebLayer.getInstance().init(getApplication());
super.onCreate(savedInstanceState);
LinearLayout mainView = new LinearLayout(this);
int viewId = View.generateViewId();
mainView.setId(viewId);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment