Merge "libbatteryservice_headers: recovery_available"
diff --git a/cmds/dumpsys/tests/dumpsys_test.cpp b/cmds/dumpsys/tests/dumpsys_test.cpp
index 6337611..3ada153 100644
--- a/cmds/dumpsys/tests/dumpsys_test.cpp
+++ b/cmds/dumpsys/tests/dumpsys_test.cpp
@@ -74,7 +74,7 @@
explicit WriteOnFdAction(const std::string& output) : output_(output) {
}
virtual Result Perform(const ArgumentTuple& args) {
- int fd = ::std::tr1::get<0>(args);
+ int fd = ::testing::get<0>(args);
android::base::WriteStringToFd(output_, fd);
}
diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp
index 96d8c47..7291ef3 100644
--- a/cmds/installd/otapreopt.cpp
+++ b/cmds/installd/otapreopt.cpp
@@ -88,6 +88,12 @@
"DEXOPT_MASK unexpected.");
+template<typename T>
+static constexpr bool IsPowerOfTwo(T x) {
+ static_assert(std::is_integral<T>::value, "T must be integral");
+ // TODO: assert unsigned. There is currently many uses with signed values.
+ return (x & (x - 1)) == 0;
+}
template<typename T>
static constexpr T RoundDown(T x, typename std::decay<T>::type n) {
diff --git a/libs/binder/include/binder/Binder.h b/libs/binder/include/binder/Binder.h
index 3404881..0b60b4e 100644
--- a/libs/binder/include/binder/Binder.h
+++ b/libs/binder/include/binder/Binder.h
@@ -40,13 +40,13 @@
uint32_t flags = 0);
virtual status_t linkToDeath(const sp<DeathRecipient>& recipient,
- void* cookie = NULL,
+ void* cookie = nullptr,
uint32_t flags = 0);
virtual status_t unlinkToDeath( const wp<DeathRecipient>& recipient,
- void* cookie = NULL,
+ void* cookie = nullptr,
uint32_t flags = 0,
- wp<DeathRecipient>* outRecipient = NULL);
+ wp<DeathRecipient>* outRecipient = nullptr);
virtual void attachObject( const void* objectID,
void* object,
diff --git a/libs/binder/include/binder/BpBinder.h b/libs/binder/include/binder/BpBinder.h
index 8bd297b..c4c8ba3 100644
--- a/libs/binder/include/binder/BpBinder.h
+++ b/libs/binder/include/binder/BpBinder.h
@@ -47,12 +47,12 @@
uint32_t flags = 0);
virtual status_t linkToDeath(const sp<DeathRecipient>& recipient,
- void* cookie = NULL,
+ void* cookie = nullptr,
uint32_t flags = 0);
virtual status_t unlinkToDeath( const wp<DeathRecipient>& recipient,
- void* cookie = NULL,
+ void* cookie = nullptr,
uint32_t flags = 0,
- wp<DeathRecipient>* outRecipient = NULL);
+ wp<DeathRecipient>* outRecipient = nullptr);
virtual void attachObject( const void* objectID,
void* object,
diff --git a/libs/binder/include/binder/Debug.h b/libs/binder/include/binder/Debug.h
index be0266c..58e2b32 100644
--- a/libs/binder/include/binder/Debug.h
+++ b/libs/binder/include/binder/Debug.h
@@ -31,12 +31,12 @@
typedef void (*debugPrintFunc)(void* cookie, const char* txt);
void printTypeCode(uint32_t typeCode,
- debugPrintFunc func = 0, void* cookie = 0);
+ debugPrintFunc func = nullptr, void* cookie = nullptr);
void printHexData(int32_t indent, const void *buf, size_t length,
size_t bytesPerLine=16, int32_t singleLineBytesCutoff=16,
size_t alignment=0, bool cArrayStyle=false,
- debugPrintFunc func = 0, void* cookie = 0);
+ debugPrintFunc func = nullptr, void* cookie = nullptr);
ssize_t getBinderKernelReferences(size_t count, uintptr_t* buf);
diff --git a/libs/binder/include/binder/IBinder.h b/libs/binder/include/binder/IBinder.h
index 2e62957..318070a 100644
--- a/libs/binder/include/binder/IBinder.h
+++ b/libs/binder/include/binder/IBinder.h
@@ -132,7 +132,7 @@
* directly do with it now that it has passed on.)
*/
virtual status_t linkToDeath(const sp<DeathRecipient>& recipient,
- void* cookie = NULL,
+ void* cookie = nullptr,
uint32_t flags = 0) = 0;
/**
@@ -143,9 +143,9 @@
* added with that cookie will be unlinked.
*/
virtual status_t unlinkToDeath( const wp<DeathRecipient>& recipient,
- void* cookie = NULL,
+ void* cookie = nullptr,
uint32_t flags = 0,
- wp<DeathRecipient>* outRecipient = NULL) = 0;
+ wp<DeathRecipient>* outRecipient = nullptr) = 0;
virtual bool checkSubclass(const void* subclassID) const;
diff --git a/libs/binder/include/binder/IInterface.h b/libs/binder/include/binder/IInterface.h
index 227d0ae..01c5161 100644
--- a/libs/binder/include/binder/IInterface.h
+++ b/libs/binder/include/binder/IInterface.h
@@ -116,7 +116,7 @@
const String16& _descriptor)
{
if (_descriptor == INTERFACE::descriptor) return this;
- return NULL;
+ return nullptr;
}
template<typename INTERFACE>
diff --git a/libs/binder/include/binder/IMemory.h b/libs/binder/include/binder/IMemory.h
index 15a104f..3099bf5 100644
--- a/libs/binder/include/binder/IMemory.h
+++ b/libs/binder/include/binder/IMemory.h
@@ -72,7 +72,7 @@
public:
DECLARE_META_INTERFACE(Memory)
- virtual sp<IMemoryHeap> getMemory(ssize_t* offset=0, size_t* size=0) const = 0;
+ virtual sp<IMemoryHeap> getMemory(ssize_t* offset=nullptr, size_t* size=nullptr) const = 0;
// helpers
void* fastPointer(const sp<IBinder>& heap, ssize_t offset) const;
diff --git a/libs/binder/include/binder/IPCThreadState.h b/libs/binder/include/binder/IPCThreadState.h
index c1d9a9a..dce3f38 100644
--- a/libs/binder/include/binder/IPCThreadState.h
+++ b/libs/binder/include/binder/IPCThreadState.h
@@ -95,7 +95,7 @@
status_t sendReply(const Parcel& reply, uint32_t flags);
status_t waitForResponse(Parcel *reply,
- status_t *acquireResult=NULL);
+ status_t *acquireResult=nullptr);
status_t talkWithDriver(bool doReceive=true);
status_t writeTransactionData(int32_t cmd,
uint32_t binderFlags,
diff --git a/libs/binder/include/binder/IServiceManager.h b/libs/binder/include/binder/IServiceManager.h
index 197026d..1d39aa3 100644
--- a/libs/binder/include/binder/IServiceManager.h
+++ b/libs/binder/include/binder/IServiceManager.h
@@ -84,9 +84,9 @@
status_t getService(const String16& name, sp<INTERFACE>* outService)
{
const sp<IServiceManager> sm = defaultServiceManager();
- if (sm != NULL) {
+ if (sm != nullptr) {
*outService = interface_cast<INTERFACE>(sm->getService(name));
- if ((*outService) != NULL) return NO_ERROR;
+ if ((*outService) != nullptr) return NO_ERROR;
}
return NAME_NOT_FOUND;
}
diff --git a/libs/binder/include/binder/MemoryDealer.h b/libs/binder/include/binder/MemoryDealer.h
index 60a624c..fe5a31d 100644
--- a/libs/binder/include/binder/MemoryDealer.h
+++ b/libs/binder/include/binder/MemoryDealer.h
@@ -34,7 +34,7 @@
class MemoryDealer : public RefBase
{
public:
- MemoryDealer(size_t size, const char* name = 0,
+ MemoryDealer(size_t size, const char* name = nullptr,
uint32_t flags = 0 /* or bits such as MemoryHeapBase::READ_ONLY */ );
virtual sp<IMemory> allocate(size_t size);
diff --git a/libs/binder/include/binder/MemoryHeapBase.h b/libs/binder/include/binder/MemoryHeapBase.h
index ea9b66c..5e0a382 100644
--- a/libs/binder/include/binder/MemoryHeapBase.h
+++ b/libs/binder/include/binder/MemoryHeapBase.h
@@ -52,7 +52,7 @@
/*
* maps memory from ashmem, with the given name for debugging
*/
- MemoryHeapBase(size_t size, uint32_t flags = 0, char const* name = NULL);
+ MemoryHeapBase(size_t size, uint32_t flags = 0, char const* name = nullptr);
virtual ~MemoryHeapBase();
@@ -74,7 +74,7 @@
/* this is only needed as a workaround, use only if you know
* what you are doing */
status_t setDevice(const char* device) {
- if (mDevice == 0)
+ if (mDevice == nullptr)
mDevice = device;
return mDevice ? NO_ERROR : ALREADY_EXISTS;
}
@@ -83,7 +83,7 @@
MemoryHeapBase();
// init() takes ownership of fd
status_t init(int fd, void *base, int size,
- int flags = 0, const char* device = NULL);
+ int flags = 0, const char* device = nullptr);
private:
status_t mapfd(int fd, size_t size, uint32_t offset = 0);
diff --git a/libs/binder/include/binder/Parcel.h b/libs/binder/include/binder/Parcel.h
index c5fede6..c9c273a 100644
--- a/libs/binder/include/binder/Parcel.h
+++ b/libs/binder/include/binder/Parcel.h
@@ -91,7 +91,7 @@
// IPCThreadState, which as an optimization may optionally be
// passed in.
bool enforceInterface(const String16& interface,
- IPCThreadState* threadState = NULL) const;
+ IPCThreadState* threadState = nullptr) const;
bool checkInterface(IBinder*) const;
void freeData();
@@ -554,7 +554,7 @@
friend class Parcel;
public:
inline const void* data() const { return mData; }
- inline void* mutableData() { return isMutable() ? mData : NULL; }
+ inline void* mutableData() { return isMutable() ? mData : nullptr; }
};
class WritableBlob : public Blob {
@@ -594,7 +594,7 @@
}
if (size) {
void* buffer = writeInplace(size);
- if (buffer == NULL)
+ if (buffer == nullptr)
return NO_MEMORY;
return val.flatten(buffer, size);
}
@@ -622,7 +622,7 @@
}
if (size) {
void const* buffer = readInplace(size);
- return buffer == NULL ? NO_MEMORY :
+ return buffer == nullptr ? NO_MEMORY :
val.unflatten(buffer, size);
}
return NO_ERROR;
diff --git a/libs/binder/tests/binderLibTest.cpp b/libs/binder/tests/binderLibTest.cpp
index f23ac52..73c2eba 100644
--- a/libs/binder/tests/binderLibTest.cpp
+++ b/libs/binder/tests/binderLibTest.cpp
@@ -1189,7 +1189,7 @@
return ret;
}
buf = data.readInplace(size);
- if (buf == NULL) {
+ if (buf == nullptr) {
return BAD_VALUE;
}
ret = write(fd.get(), buf, size);
diff --git a/libs/vr/libpdx/service_tests.cpp b/libs/vr/libpdx/service_tests.cpp
index e623abf..938d737 100644
--- a/libs/vr/libpdx/service_tests.cpp
+++ b/libs/vr/libpdx/service_tests.cpp
@@ -51,22 +51,24 @@
// method(IoVecMatcher(IoVecArray{{ptr1, size1}, {ptr2, size2}})));
using IoVecArray = std::vector<iovec>;
MATCHER_P(IoVecMatcher, iovec_array, "") {
+ auto local_arg = arg;
for (const iovec& item : iovec_array) {
- if (arg->iov_base != item.iov_base || arg->iov_len != item.iov_len)
+ if (local_arg->iov_base != item.iov_base || local_arg->iov_len != item.iov_len)
return false;
- arg++;
+ local_arg++;
}
return true;
}
using IoVecData = std::vector<std::string>;
MATCHER_P(IoVecDataMatcher, iovec_data, "") {
+ auto local_arg = arg;
for (const std::string& item : iovec_data) {
- std::string data{reinterpret_cast<const char*>(arg->iov_base),
- arg->iov_len};
+ std::string data{reinterpret_cast<const char*>(local_arg->iov_base),
+ local_arg->iov_len};
if (data != item)
return false;
- arg++;
+ local_arg++;
}
return true;
}
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 11c3db0..40d89bd 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2004,6 +2004,16 @@
layerInfo->set_refresh_pending(isBufferLatched());
layerInfo->set_window_type(state.type);
layerInfo->set_app_id(state.appId);
+ layerInfo->set_curr_frame(mCurrentFrameNumber);
+
+ for (const auto& pendingState : mPendingStates) {
+ auto barrierLayer = pendingState.barrierLayer.promote();
+ if (barrierLayer != nullptr) {
+ BarrierLayerProto* barrierLayerProto = layerInfo->add_barrier_layer();
+ barrierLayerProto->set_id(barrierLayer->sequence);
+ barrierLayerProto->set_frame_number(pendingState.frameNumber);
+ }
+ }
}
void Layer::writeToProto(LayerProto* layerInfo, int32_t displayId) {
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 7680f2a..9167399 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -114,6 +114,33 @@
using ui::RenderIntent;
namespace {
+
+#pragma clang diagnostic push
+#pragma clang diagnostic error "-Wswitch-enum"
+
+bool isWideColorMode(const ColorMode colorMode) {
+ switch (colorMode) {
+ case ColorMode::DISPLAY_P3:
+ case ColorMode::ADOBE_RGB:
+ case ColorMode::DCI_P3:
+ case ColorMode::BT2020:
+ case ColorMode::BT2100_PQ:
+ case ColorMode::BT2100_HLG:
+ return true;
+ case ColorMode::NATIVE:
+ case ColorMode::STANDARD_BT601_625:
+ case ColorMode::STANDARD_BT601_625_UNADJUSTED:
+ case ColorMode::STANDARD_BT601_525:
+ case ColorMode::STANDARD_BT601_525_UNADJUSTED:
+ case ColorMode::STANDARD_BT709:
+ case ColorMode::SRGB:
+ return false;
+ }
+ return false;
+}
+
+#pragma clang diagnostic pop
+
class ConditionalLock {
public:
ConditionalLock(Mutex& mutex, bool lock) : mMutex(mutex), mLocked(lock) {
@@ -126,6 +153,7 @@
Mutex& mMutex;
bool mLocked;
};
+
} // namespace anonymous
// ---------------------------------------------------------------------------
@@ -2262,14 +2290,8 @@
if (hasWideColorDisplay) {
std::vector<ColorMode> modes = getHwComposer().getColorModes(displayId);
for (ColorMode colorMode : modes) {
- switch (colorMode) {
- case ColorMode::DISPLAY_P3:
- case ColorMode::ADOBE_RGB:
- case ColorMode::DCI_P3:
- hasWideColorGamut = true;
- break;
- default:
- break;
+ if (isWideColorMode(colorMode)) {
+ hasWideColorGamut = true;
}
std::vector<RenderIntent> renderIntents =
diff --git a/services/surfaceflinger/layerproto/layers.proto b/services/surfaceflinger/layerproto/layers.proto
index eb34694..e34772f 100644
--- a/services/surfaceflinger/layerproto/layers.proto
+++ b/services/surfaceflinger/layerproto/layers.proto
@@ -82,6 +82,10 @@
optional bool is_protected = 36;
// If active_buffer is not null, record its transform
optional TransformProto buffer_transform = 37;
+ // Current frame number being rendered.
+ optional uint64 curr_frame = 38;
+ // A list of barriers that the layer is waiting to update state.
+ repeated BarrierLayerProto barrier_layer = 39;
}
message PositionProto {
@@ -133,3 +137,10 @@
optional float b = 3;
optional float a = 4;
}
+
+message BarrierLayerProto {
+ // layer id the barrier is waiting on.
+ optional int32 id = 1;
+ // frame number the barrier is waiting on.
+ optional uint64 frame_number = 2;
+}
diff --git a/vulkan/libvulkan/Android.bp b/vulkan/libvulkan/Android.bp
index 7f4f2c4..cbba5f4 100644
--- a/vulkan/libvulkan/Android.bp
+++ b/vulkan/libvulkan/Android.bp
@@ -43,7 +43,6 @@
],
cppflags: [
- "-std=c++14",
"-Wno-c99-extensions",
"-Wno-c++98-compat-pedantic",
"-Wno-exit-time-destructors",