Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: Ibdd6a210bb7ff228e3624cc319169f77aca3b51e
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index a805b6d..167294e 100755
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -380,7 +380,7 @@
// on the caller already having a local JNI ref
class LocalScopedBitmap {
public:
- LocalScopedBitmap(jlong bitmapHandle)
+ explicit LocalScopedBitmap(jlong bitmapHandle)
: mBitmap(reinterpret_cast<Bitmap*>(bitmapHandle)) {}
Bitmap* operator->() {
diff --git a/core/jni/android/graphics/HarfBuzzNGFaceSkia.cpp b/core/jni/android/graphics/HarfBuzzNGFaceSkia.cpp
index e537942..939249a 100644
--- a/core/jni/android/graphics/HarfBuzzNGFaceSkia.cpp
+++ b/core/jni/android/graphics/HarfBuzzNGFaceSkia.cpp
@@ -50,7 +50,7 @@
// calls. See the Harfbuzz source for references about what these callbacks do.
struct HarfBuzzFontData {
- HarfBuzzFontData(SkPaint* paint) : m_paint(paint) { }
+ explicit HarfBuzzFontData(SkPaint* paint) : m_paint(paint) { }
SkPaint* m_paint;
};
diff --git a/core/jni/android/graphics/Region.cpp b/core/jni/android/graphics/Region.cpp
index bcd0b60..b7d6524 100644
--- a/core/jni/android/graphics/Region.cpp
+++ b/core/jni/android/graphics/Region.cpp
@@ -268,7 +268,7 @@
SkRegion fRgn; // a copy of the caller's region
SkRegion::Iterator fIter; // an iterator acting upon the copy (fRgn)
- RgnIterPair(const SkRegion& rgn) : fRgn(rgn) {
+ explicit RgnIterPair(const SkRegion& rgn) : fRgn(rgn) {
// have our iterator reference our copy (fRgn), so we know it will be
// unchanged for the lifetime of the iterator
fIter.reset(fRgn);
diff --git a/core/jni/android_hardware_camera2_legacy_PerfMeasurement.cpp b/core/jni/android_hardware_camera2_legacy_PerfMeasurement.cpp
index f042058..a081665 100644
--- a/core/jni/android_hardware_camera2_legacy_PerfMeasurement.cpp
+++ b/core/jni/android_hardware_camera2_legacy_PerfMeasurement.cpp
@@ -114,7 +114,7 @@
* will be active at once, which is a function of the GPU's level of
* pipelining and the frequency of queries.
*/
- PerfMeasurementContext(size_t maxQueryCount):
+ explicit PerfMeasurementContext(size_t maxQueryCount):
mTimingStartIndex(0),
mTimingEndIndex(0),
mTimingQueryIndex(0) {
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 8385f75..5bbc4a4 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -1059,7 +1059,7 @@
class XmlAttributeFinder : public BackTrackingAttributeFinder<XmlAttributeFinder, jsize> {
public:
- XmlAttributeFinder(const ResXMLParser* parser)
+ explicit XmlAttributeFinder(const ResXMLParser* parser)
: BackTrackingAttributeFinder(0, parser != NULL ? parser->getAttributeCount() : 0)
, mParser(parser) {}
diff --git a/core/jni/android_view_GraphicBuffer.cpp b/core/jni/android_view_GraphicBuffer.cpp
index a4ab9fd..af975fb 100644
--- a/core/jni/android_view_GraphicBuffer.cpp
+++ b/core/jni/android_view_GraphicBuffer.cpp
@@ -88,7 +88,7 @@
class GraphicBufferWrapper {
public:
- GraphicBufferWrapper(const sp<GraphicBuffer>& buffer): buffer(buffer) {
+ explicit GraphicBufferWrapper(const sp<GraphicBuffer>& buffer): buffer(buffer) {
}
sp<GraphicBuffer> buffer;
diff --git a/core/jni/android_view_InputChannel.cpp b/core/jni/android_view_InputChannel.cpp
index 092ac27..c7998a1 100644
--- a/core/jni/android_view_InputChannel.cpp
+++ b/core/jni/android_view_InputChannel.cpp
@@ -43,7 +43,7 @@
class NativeInputChannel {
public:
- NativeInputChannel(const sp<InputChannel>& inputChannel);
+ explicit NativeInputChannel(const sp<InputChannel>& inputChannel);
~NativeInputChannel();
inline sp<InputChannel> getInputChannel() { return mInputChannel; }
diff --git a/core/jni/android_view_ThreadedRenderer.cpp b/core/jni/android_view_ThreadedRenderer.cpp
index 7b2a40b..6290706 100644
--- a/core/jni/android_view_ThreadedRenderer.cpp
+++ b/core/jni/android_view_ThreadedRenderer.cpp
@@ -68,7 +68,7 @@
class InvokeAnimationListeners : public MessageHandler {
public:
- InvokeAnimationListeners(std::vector<OnFinishedEvent>& events) {
+ explicit InvokeAnimationListeners(std::vector<OnFinishedEvent>& events) {
mOnFinishedEvents.swap(events);
}
@@ -108,7 +108,7 @@
class RootRenderNode : public RenderNode, ErrorHandler {
public:
- RootRenderNode(JNIEnv* env) : RenderNode() {
+ explicit RootRenderNode(JNIEnv* env) : RenderNode() {
mLooper = Looper::getForThread();
LOG_ALWAYS_FATAL_IF(!mLooper.get(),
"Must create RootRenderNode on a thread with a looper!");
@@ -197,7 +197,7 @@
class ContextFactoryImpl : public IContextFactory {
public:
- ContextFactoryImpl(RootRenderNode* rootNode) : mRootNode(rootNode) {}
+ explicit ContextFactoryImpl(RootRenderNode* rootNode) : mRootNode(rootNode) {}
virtual AnimationContext* createAnimationContext(renderthread::TimeLord& clock) {
return new AnimationContextBridge(clock, mRootNode);
diff --git a/core/jni/android_view_VelocityTracker.cpp b/core/jni/android_view_VelocityTracker.cpp
index 04ec705..e1f2241 100644
--- a/core/jni/android_view_VelocityTracker.cpp
+++ b/core/jni/android_view_VelocityTracker.cpp
@@ -45,7 +45,7 @@
class VelocityTrackerState {
public:
- VelocityTrackerState(const char* strategy);
+ explicit VelocityTrackerState(const char* strategy);
void clear();
void addMovement(const MotionEvent* event);
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 806eeda..d6dd983 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -3008,7 +3008,7 @@
struct ResTable::Header
{
- Header(ResTable* _owner) : owner(_owner), ownedData(NULL), header(NULL),
+ explicit Header(ResTable* _owner) : owner(_owner), ownedData(NULL), header(NULL),
resourceIDMap(NULL), resourceIDMapSize(0) { }
~Header()
diff --git a/libs/androidfw/ZipUtils.cpp b/libs/androidfw/ZipUtils.cpp
index 6fa0f14..5abfc8e 100644
--- a/libs/androidfw/ZipUtils.cpp
+++ b/libs/androidfw/ZipUtils.cpp
@@ -150,7 +150,7 @@
class FileReader {
public:
- FileReader(FILE* fp) :
+ explicit FileReader(FILE* fp) :
mFp(fp), mReadBuf(new unsigned char[kReadBufSize])
{
}
@@ -170,7 +170,7 @@
class FdReader {
public:
- FdReader(int fd) :
+ explicit FdReader(int fd) :
mFd(fd), mReadBuf(new unsigned char[kReadBufSize])
{
}
diff --git a/libs/hwui/AnimatorManager.cpp b/libs/hwui/AnimatorManager.cpp
index cd30b18..22947b0 100644
--- a/libs/hwui/AnimatorManager.cpp
+++ b/libs/hwui/AnimatorManager.cpp
@@ -155,7 +155,7 @@
class EndActiveAnimatorsFunctor {
public:
- EndActiveAnimatorsFunctor(AnimationContext& context) : mContext(context) {}
+ explicit EndActiveAnimatorsFunctor(AnimationContext& context) : mContext(context) {}
void operator() (BaseRenderNodeAnimator* animator) {
animator->forceEndNow(mContext);
diff --git a/libs/hwui/DeferredDisplayList.cpp b/libs/hwui/DeferredDisplayList.cpp
index 03aecd4..610398c 100644
--- a/libs/hwui/DeferredDisplayList.cpp
+++ b/libs/hwui/DeferredDisplayList.cpp
@@ -61,7 +61,7 @@
class DrawBatch : public Batch {
public:
- DrawBatch(const DeferInfo& deferInfo) : mAllOpsOpaque(true),
+ explicit DrawBatch(const DeferInfo& deferInfo) : mAllOpsOpaque(true),
mBatchId(deferInfo.batchId), mMergeId(deferInfo.mergeId) {
mOps.clear();
}
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp
index 644a4f3..a8e1a4b 100644
--- a/libs/hwui/SkiaCanvas.cpp
+++ b/libs/hwui/SkiaCanvas.cpp
@@ -164,7 +164,7 @@
class ClipCopier : public SkCanvas::ClipVisitor {
public:
- ClipCopier(SkCanvas* dstCanvas) : m_dstCanvas(dstCanvas) {}
+ explicit ClipCopier(SkCanvas* dstCanvas) : m_dstCanvas(dstCanvas) {}
virtual void clipRect(const SkRect& rect, SkRegion::Op op, bool antialias) {
m_dstCanvas->clipRect(rect, op, antialias);
diff --git a/libs/hwui/TessellationCache.cpp b/libs/hwui/TessellationCache.cpp
index 17cb3a7..84c2a40 100644
--- a/libs/hwui/TessellationCache.cpp
+++ b/libs/hwui/TessellationCache.cpp
@@ -110,7 +110,7 @@
class TessellationCache::TessellationProcessor : public TaskProcessor<VertexBuffer*> {
public:
- TessellationProcessor(Caches& caches)
+ explicit TessellationProcessor(Caches& caches)
: TaskProcessor<VertexBuffer*>(&caches.tasks) {}
~TessellationProcessor() {}
@@ -124,7 +124,7 @@
class TessellationCache::Buffer {
public:
- Buffer(const sp<Task<VertexBuffer*> >& task)
+ explicit Buffer(const sp<Task<VertexBuffer*> >& task)
: mTask(task)
, mBuffer(nullptr) {
}
@@ -283,7 +283,7 @@
class ShadowProcessor : public TaskProcessor<TessellationCache::vertexBuffer_pair_t*> {
public:
- ShadowProcessor(Caches& caches)
+ explicit ShadowProcessor(Caches& caches)
: TaskProcessor<TessellationCache::vertexBuffer_pair_t*>(&caches.tasks) {}
~ShadowProcessor() {}
diff --git a/libs/hwui/renderstate/RenderState.cpp b/libs/hwui/renderstate/RenderState.cpp
index 84b6965..229aa46 100644
--- a/libs/hwui/renderstate/RenderState.cpp
+++ b/libs/hwui/renderstate/RenderState.cpp
@@ -186,7 +186,7 @@
class DecStrongTask : public renderthread::RenderTask {
public:
- DecStrongTask(VirtualLightRefBase* object) : mObject(object) {}
+ explicit DecStrongTask(VirtualLightRefBase* object) : mObject(object) {}
virtual void run() override {
mObject->decStrong(nullptr);
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index 64075f1..8301107 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -129,7 +129,7 @@
private:
RenderThread* mRenderThread;
public:
- DispatchFrameCallbacks(RenderThread* rt) : mRenderThread(rt) {}
+ explicit DispatchFrameCallbacks(RenderThread* rt) : mRenderThread(rt) {}
virtual void run() override {
mRenderThread->dispatchFrameCallbacks();
diff --git a/libs/hwui/unit_tests/LinearAllocatorTests.cpp b/libs/hwui/unit_tests/LinearAllocatorTests.cpp
index b3959d1..18dc8f9 100644
--- a/libs/hwui/unit_tests/LinearAllocatorTests.cpp
+++ b/libs/hwui/unit_tests/LinearAllocatorTests.cpp
@@ -30,7 +30,7 @@
SignalingDtor() {
mDestroyed = nullptr;
}
- SignalingDtor(bool* destroyedSignal) {
+ explicit SignalingDtor(bool* destroyedSignal) {
mDestroyed = destroyedSignal;
*mDestroyed = false;
}
diff --git a/libs/storage/IMountService.cpp b/libs/storage/IMountService.cpp
index c643ed0..74638e7 100644
--- a/libs/storage/IMountService.cpp
+++ b/libs/storage/IMountService.cpp
@@ -55,7 +55,7 @@
class BpMountService: public BpInterface<IMountService>
{
public:
- BpMountService(const sp<IBinder>& impl)
+ explicit BpMountService(const sp<IBinder>& impl)
: BpInterface<IMountService>(impl)
{
}
diff --git a/libs/storage/IObbActionListener.cpp b/libs/storage/IObbActionListener.cpp
index 9656e65..a71341b 100644
--- a/libs/storage/IObbActionListener.cpp
+++ b/libs/storage/IObbActionListener.cpp
@@ -26,7 +26,7 @@
// This is a stub that real consumers should override.
class BpObbActionListener: public BpInterface<IObbActionListener> {
public:
- BpObbActionListener(const sp<IBinder>& impl)
+ explicit BpObbActionListener(const sp<IBinder>& impl)
: BpInterface<IObbActionListener>(impl)
{ }
diff --git a/media/mca/filterfw/jni/jni_gl_environment.cpp b/media/mca/filterfw/jni/jni_gl_environment.cpp
index 5f00739..096120e 100644
--- a/media/mca/filterfw/jni/jni_gl_environment.cpp
+++ b/media/mca/filterfw/jni/jni_gl_environment.cpp
@@ -39,7 +39,7 @@
class NativeWindowHandle : public WindowHandle {
public:
- NativeWindowHandle(ANativeWindow* window) : window_(window) {
+ explicit NativeWindowHandle(ANativeWindow* window) : window_(window) {
}
virtual ~NativeWindowHandle() {
diff --git a/native/android/asset_manager.cpp b/native/android/asset_manager.cpp
index dee3f8c..0e5e5c6 100644
--- a/native/android/asset_manager.cpp
+++ b/native/android/asset_manager.cpp
@@ -39,7 +39,7 @@
size_t mCurFileIndex;
String8 mCachedFileName;
- AAssetDir(AssetDir* dir) : mAssetDir(dir), mCurFileIndex(0) { }
+ explicit AAssetDir(AssetDir* dir) : mAssetDir(dir), mCurFileIndex(0) { }
~AAssetDir() { delete mAssetDir; }
};
@@ -48,7 +48,7 @@
struct AAsset {
Asset* mAsset;
- AAsset(Asset* asset) : mAsset(asset) { }
+ explicit AAsset(Asset* asset) : mAsset(asset) { }
~AAsset() { delete mAsset; }
};
diff --git a/native/android/choreographer.cpp b/native/android/choreographer.cpp
index e35c85b..c3629da 100644
--- a/native/android/choreographer.cpp
+++ b/native/android/choreographer.cpp
@@ -64,7 +64,7 @@
virtual ~Choreographer() = default;
private:
- Choreographer(const sp<Looper>& looper);
+ explicit Choreographer(const sp<Looper>& looper);
Choreographer(const Choreographer&) = delete;
virtual void dispatchVsync(nsecs_t timestamp, int32_t id, uint32_t count);
diff --git a/native/android/storage_manager.cpp b/native/android/storage_manager.cpp
index 399f1ff..137b72c 100644
--- a/native/android/storage_manager.cpp
+++ b/native/android/storage_manager.cpp
@@ -37,7 +37,7 @@
sp<AStorageManager> mStorageManager;
public:
- ObbActionListener(AStorageManager* mgr) :
+ explicit ObbActionListener(AStorageManager* mgr) :
mStorageManager(mgr)
{}
diff --git a/services/core/jni/com_android_server_AlarmManagerService.cpp b/services/core/jni/com_android_server_AlarmManagerService.cpp
index 246ab0d..407c072 100644
--- a/services/core/jni/com_android_server_AlarmManagerService.cpp
+++ b/services/core/jni/com_android_server_AlarmManagerService.cpp
@@ -74,7 +74,7 @@
class AlarmImplAlarmDriver : public AlarmImpl
{
public:
- AlarmImplAlarmDriver(int fd) : AlarmImpl(&fd, 1) { }
+ explicit AlarmImplAlarmDriver(int fd) : AlarmImpl(&fd, 1) { }
int set(int type, struct timespec *ts);
int setTime(struct timeval *tv);
diff --git a/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp b/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
index b72cf4d..5f73d42 100644
--- a/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
+++ b/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
@@ -84,7 +84,7 @@
// it to service thread.
class CecEventWrapper : public LightRefBase<CecEventWrapper> {
public:
- CecEventWrapper(const hdmi_event_t& event) {
+ explicit CecEventWrapper(const hdmi_event_t& event) {
// Copy message.
switch (event.type) {
case HDMI_EVENT_CEC_MESSAGE:
diff --git a/tools/aapt2/ResourceTable_test.cpp b/tools/aapt2/ResourceTable_test.cpp
index 06d8699..d3b9af3 100644
--- a/tools/aapt2/ResourceTable_test.cpp
+++ b/tools/aapt2/ResourceTable_test.cpp
@@ -28,7 +28,7 @@
struct TestValue : public Value {
std::u16string value;
- TestValue(StringPiece16 str) : value(str.toString()) {
+ explicit TestValue(StringPiece16 str) : value(str.toString()) {
}
TestValue* clone(StringPool* /*newPool*/) const override {