Only try to initialize appcompat properties if the folder is present
If the Init process doesn't write the appcompat system properties folder, do not attempt to initialize it Bug: 331307495 Test: manual (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d071e949a6153e76eb7c67e5947d4d387a8afe2d) Merged-In: I21716ea87e55a63a1b79127887c451d0fcf006f3 Change-Id: I21716ea87e55a63a1b79127887c451d0fcf006f3
This commit is contained in:
parent
785e161dd8
commit
9437444cf5
1 changed files with 10 additions and 6 deletions
|
@ -120,14 +120,18 @@ bool SystemProperties::AreaInit(const char* filename, bool* fsetxattr_failed,
|
|||
return false;
|
||||
}
|
||||
|
||||
auto* appcompat_contexts = new (appcompat_override_contexts_data_) ContextsSerialized();
|
||||
appcompat_filename_ = PropertiesFilename(properties_filename_.c_str(), "appcompat_override");
|
||||
if (!appcompat_contexts->Initialize(true, appcompat_filename_.c_str(), fsetxattr_failed,
|
||||
load_default_path)) {
|
||||
appcompat_override_contexts_ = nullptr;
|
||||
return false;
|
||||
appcompat_override_contexts_ = nullptr;
|
||||
if (access(appcompat_filename_.c_str(), F_OK) != -1) {
|
||||
auto* appcompat_contexts = new (appcompat_override_contexts_data_) ContextsSerialized();
|
||||
if (!appcompat_contexts->Initialize(true, appcompat_filename_.c_str(), fsetxattr_failed,
|
||||
load_default_path)) {
|
||||
// The appcompat folder exists, but initializing it failed
|
||||
return false;
|
||||
} else {
|
||||
appcompat_override_contexts_ = appcompat_contexts;
|
||||
}
|
||||
}
|
||||
appcompat_override_contexts_ = appcompat_contexts;
|
||||
|
||||
initialized_ = true;
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue