Merge "Move initialization from onCreate to attachBaseContext" into sc-v2-dev
This commit is contained in:
@@ -53,6 +53,7 @@ public abstract class WindowProviderService extends Service {
|
|||||||
private final WindowTokenClient mWindowToken = new WindowTokenClient();
|
private final WindowTokenClient mWindowToken = new WindowTokenClient();
|
||||||
private final WindowContextController mController = new WindowContextController(mWindowToken);
|
private final WindowContextController mController = new WindowContextController(mWindowToken);
|
||||||
private WindowManager mWindowManager;
|
private WindowManager mWindowManager;
|
||||||
|
private boolean mInitialized;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type of this {@link WindowProviderService}.
|
* Returns the type of this {@link WindowProviderService}.
|
||||||
@@ -122,13 +123,17 @@ public abstract class WindowProviderService extends Service {
|
|||||||
return context.createTokenContext(mWindowToken, display);
|
return context.createTokenContext(mWindowToken, display);
|
||||||
}
|
}
|
||||||
|
|
||||||
@CallSuper
|
/** @hide */
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
protected void attachBaseContext(Context newBase) {
|
||||||
super.onCreate();
|
super.attachBaseContext(newBase);
|
||||||
mWindowToken.attachContext(this);
|
if (!mInitialized) {
|
||||||
mController.attachToDisplayArea(getWindowType(), getDisplayId(), getWindowContextOptions());
|
mWindowToken.attachContext(this);
|
||||||
mWindowManager = WindowManagerImpl.createWindowContextWindowManager(this);
|
mController.attachToDisplayArea(getWindowType(), getDisplayId(),
|
||||||
|
getWindowContextOptions());
|
||||||
|
mWindowManager = WindowManagerImpl.createWindowContextWindowManager(this);
|
||||||
|
mInitialized = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("OnNameExpected")
|
@SuppressLint("OnNameExpected")
|
||||||
|
|||||||
Reference in New Issue
Block a user