Merge "installd: remove spammy warning for non-existent profile dirs." into nyc-dev
diff --git a/services/sensorservice/RecentEventLogger.cpp b/services/sensorservice/RecentEventLogger.cpp
index dba7211..754b603 100644
--- a/services/sensorservice/RecentEventLogger.cpp
+++ b/services/sensorservice/RecentEventLogger.cpp
@@ -76,7 +76,8 @@
     std::lock_guard<std::mutex> lk(mLock);
 
     if (mRecentEvents.size()) {
-        *event = mRecentEvents[mRecentEvents.size()-1].mEvent;
+        // Index 0 contains the latest event emplace()'ed
+        *event = mRecentEvents[0].mEvent;
         return true;
     } else {
         return false;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index c640f58..96252f3 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -178,6 +178,9 @@
     for (auto& point : mRemoteSyncPoints) {
         point->setTransactionApplied();
     }
+    for (auto& point : mLocalSyncPoints) {
+        point->setFrameAvailable();
+    }
     mFlinger->deleteTextureAsync(mTextureName);
     mFrameTracker.logAndResetStats(mName);
 }
@@ -1478,6 +1481,17 @@
                 (type >= Transform::SCALE));
     }
 
+    // If the layer is hidden, signal and clear out all local sync points so
+    // that transactions for layers depending on this layer's frames becoming
+    // visible are not blocked
+    if (c.flags & layer_state_t::eLayerHidden) {
+        Mutex::Autolock lock(mLocalSyncPointMutex);
+        for (auto& point : mLocalSyncPoints) {
+            point->setFrameAvailable();
+        }
+        mLocalSyncPoints.clear();
+    }
+
     // Commit the transaction
     commitTransaction(c);
     return flags;