Merge "Fix potential race in Theme creation" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b0a5fd0384
@@ -256,28 +256,34 @@ class ContextImpl extends Context {
|
||||
|
||||
@Override
|
||||
public void setTheme(int resId) {
|
||||
if (mThemeResource != resId) {
|
||||
mThemeResource = resId;
|
||||
initializeTheme();
|
||||
synchronized (mSync) {
|
||||
if (mThemeResource != resId) {
|
||||
mThemeResource = resId;
|
||||
initializeTheme();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResId() {
|
||||
return mThemeResource;
|
||||
synchronized (mSync) {
|
||||
return mThemeResource;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resources.Theme getTheme() {
|
||||
if (mTheme != null) {
|
||||
synchronized (mSync) {
|
||||
if (mTheme != null) {
|
||||
return mTheme;
|
||||
}
|
||||
|
||||
mThemeResource = Resources.selectDefaultTheme(mThemeResource,
|
||||
getOuterContext().getApplicationInfo().targetSdkVersion);
|
||||
initializeTheme();
|
||||
|
||||
return mTheme;
|
||||
}
|
||||
|
||||
mThemeResource = Resources.selectDefaultTheme(mThemeResource,
|
||||
getOuterContext().getApplicationInfo().targetSdkVersion);
|
||||
initializeTheme();
|
||||
|
||||
return mTheme;
|
||||
}
|
||||
|
||||
private void initializeTheme() {
|
||||
|
||||
Reference in New Issue
Block a user