Merge "SF: Re-enable fence tracker by default" into nyc-mr1-dev
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp
index 55e9521..c0c91da 100644
--- a/cmds/installd/commands.cpp
+++ b/cmds/installd/commands.cpp
@@ -70,6 +70,12 @@
return strcmp(tmp_property_value, "true") == 0;
}
+// Keep profile paths in sync with ActivityThread.
+constexpr const char* PRIMARY_PROFILE_NAME = "primary.prof";
+static std::string create_primary_profile(const std::string& profile_dir) {
+ return StringPrintf("%s/%s", profile_dir.c_str(), PRIMARY_PROFILE_NAME);
+}
+
int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int flags,
appid_t appid, const char* seinfo, int target_sdk_version) {
uid_t uid = multiuser_get_uid(userid, appid);
@@ -105,6 +111,12 @@
PLOG(ERROR) << "Failed to prepare " << profile_path;
return -1;
}
+ std::string profile_file = create_primary_profile(profile_path);
+ // read-write only for the app user.
+ if (fs_prepare_file_strict(profile_file.c_str(), 0600, uid, uid) != 0) {
+ PLOG(ERROR) << "Failed to prepare " << profile_path;
+ return -1;
+ }
const std::string ref_profile_path = create_data_ref_profile_package_path(pkgname);
// dex2oat/profman runs under the shared app gid and it needs to read/write reference
// profiles.
@@ -157,12 +169,6 @@
return 0;
}
-// Keep profile paths in sync with ActivityThread.
-constexpr const char* PRIMARY_PROFILE_NAME = "primary.prof";
-static std::string create_primary_profile(const std::string& profile_dir) {
- return StringPrintf("%s/%s", profile_dir.c_str(), PRIMARY_PROFILE_NAME);
-}
-
static bool clear_profile(const std::string& profile) {
base::unique_fd ufd(open(profile.c_str(), O_WRONLY | O_NOFOLLOW | O_CLOEXEC));
if (ufd.get() < 0) {
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 65f8255..07cfb4f 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -444,14 +444,6 @@
mSlots[found].mBufferState.dequeue();
- // If shared buffer mode has just been enabled, cache the slot of the
- // first buffer that is dequeued and mark it as the shared buffer.
- if (mCore->mSharedBufferMode && mCore->mSharedBufferSlot ==
- BufferQueueCore::INVALID_BUFFER_SLOT) {
- mCore->mSharedBufferSlot = found;
- mSlots[found].mBufferState.mShared = true;
- }
-
if ((buffer == NULL) ||
buffer->needsReallocation(width, height, format, usage))
{
@@ -483,9 +475,21 @@
eglDisplay = mSlots[found].mEglDisplay;
eglFence = mSlots[found].mEglFence;
- *outFence = mSlots[found].mFence;
+ // Don't return a fence in shared buffer mode, except for the first
+ // frame.
+ *outFence = (mCore->mSharedBufferMode &&
+ mCore->mSharedBufferSlot == found) ?
+ Fence::NO_FENCE : mSlots[found].mFence;
mSlots[found].mEglFence = EGL_NO_SYNC_KHR;
mSlots[found].mFence = Fence::NO_FENCE;
+
+ // If shared buffer mode has just been enabled, cache the slot of the
+ // first buffer that is dequeued and mark it as the shared buffer.
+ if (mCore->mSharedBufferMode && mCore->mSharedBufferSlot ==
+ BufferQueueCore::INVALID_BUFFER_SLOT) {
+ mCore->mSharedBufferSlot = found;
+ mSlots[found].mBufferState.mShared = true;
+ }
} // Autolock scope
if (returnFlags & BUFFER_NEEDS_REALLOCATION) {
diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp
index 320fddb..f8d4d13 100644
--- a/services/surfaceflinger/tests/Transaction_test.cpp
+++ b/services/surfaceflinger/tests/Transaction_test.cpp
@@ -66,6 +66,8 @@
sp<ISurfaceComposer> sf(ComposerService::getComposerService());
sp<IBinder> display(sf->getBuiltInDisplay(
ISurfaceComposer::eDisplayIdMain));
+ SurfaceComposerClient::openGlobalTransaction();
+ SurfaceComposerClient::closeGlobalTransaction(true);
ASSERT_EQ(NO_ERROR, sf->captureScreen(display, producer, Rect(), 0, 0,
0, INT_MAX, false));
*sc = new ScreenCapture(cpuConsumer);