Merge "Separate advertiser from GATT client (1/4)"
diff --git a/api/current.txt b/api/current.txt
index 5a7c100..7b76478 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -54971,6 +54971,12 @@
   }
 
   public static abstract interface KeyStore.Entry {
+    method public default java.util.Set<java.security.KeyStore.Entry.Attribute> getAttributes();
+  }
+
+  public static abstract interface KeyStore.Entry.Attribute {
+    method public abstract java.lang.String getName();
+    method public abstract java.lang.String getValue();
   }
 
   public static abstract interface KeyStore.LoadStoreParameter {
@@ -54979,11 +54985,15 @@
 
   public static class KeyStore.PasswordProtection implements javax.security.auth.Destroyable java.security.KeyStore.ProtectionParameter {
     ctor public KeyStore.PasswordProtection(char[]);
+    ctor public KeyStore.PasswordProtection(char[], java.lang.String, java.security.spec.AlgorithmParameterSpec);
     method public synchronized char[] getPassword();
+    method public java.lang.String getProtectionAlgorithm();
+    method public java.security.spec.AlgorithmParameterSpec getProtectionParameters();
   }
 
   public static final class KeyStore.PrivateKeyEntry implements java.security.KeyStore.Entry {
     ctor public KeyStore.PrivateKeyEntry(java.security.PrivateKey, java.security.cert.Certificate[]);
+    ctor public KeyStore.PrivateKeyEntry(java.security.PrivateKey, java.security.cert.Certificate[], java.util.Set<java.security.KeyStore.Entry.Attribute>);
     method public java.security.cert.Certificate getCertificate();
     method public java.security.cert.Certificate[] getCertificateChain();
     method public java.security.PrivateKey getPrivateKey();
@@ -54994,11 +55004,13 @@
 
   public static final class KeyStore.SecretKeyEntry implements java.security.KeyStore.Entry {
     ctor public KeyStore.SecretKeyEntry(javax.crypto.SecretKey);
+    ctor public KeyStore.SecretKeyEntry(javax.crypto.SecretKey, java.util.Set<java.security.KeyStore.Entry.Attribute>);
     method public javax.crypto.SecretKey getSecretKey();
   }
 
   public static final class KeyStore.TrustedCertificateEntry implements java.security.KeyStore.Entry {
     ctor public KeyStore.TrustedCertificateEntry(java.security.cert.Certificate);
+    ctor public KeyStore.TrustedCertificateEntry(java.security.cert.Certificate, java.util.Set<java.security.KeyStore.Entry.Attribute>);
     method public java.security.cert.Certificate getTrustedCertificate();
   }
 
@@ -55134,10 +55146,11 @@
     method public abstract boolean equals(java.lang.Object);
     method public abstract java.lang.String getName();
     method public abstract int hashCode();
+    method public default boolean implies(javax.security.auth.Subject);
     method public abstract java.lang.String toString();
   }
 
-  public abstract interface PrivateKey implements java.security.Key {
+  public abstract interface PrivateKey implements javax.security.auth.Destroyable java.security.Key {
     field public static final long serialVersionUID = 6034044314589513430L; // 0x53bd3b559a12c6d6L
   }
 
diff --git a/api/system-current.txt b/api/system-current.txt
index f57851c..60425ce 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -58327,6 +58327,12 @@
   }
 
   public static abstract interface KeyStore.Entry {
+    method public default java.util.Set<java.security.KeyStore.Entry.Attribute> getAttributes();
+  }
+
+  public static abstract interface KeyStore.Entry.Attribute {
+    method public abstract java.lang.String getName();
+    method public abstract java.lang.String getValue();
   }
 
   public static abstract interface KeyStore.LoadStoreParameter {
@@ -58335,11 +58341,15 @@
 
   public static class KeyStore.PasswordProtection implements javax.security.auth.Destroyable java.security.KeyStore.ProtectionParameter {
     ctor public KeyStore.PasswordProtection(char[]);
+    ctor public KeyStore.PasswordProtection(char[], java.lang.String, java.security.spec.AlgorithmParameterSpec);
     method public synchronized char[] getPassword();
+    method public java.lang.String getProtectionAlgorithm();
+    method public java.security.spec.AlgorithmParameterSpec getProtectionParameters();
   }
 
   public static final class KeyStore.PrivateKeyEntry implements java.security.KeyStore.Entry {
     ctor public KeyStore.PrivateKeyEntry(java.security.PrivateKey, java.security.cert.Certificate[]);
+    ctor public KeyStore.PrivateKeyEntry(java.security.PrivateKey, java.security.cert.Certificate[], java.util.Set<java.security.KeyStore.Entry.Attribute>);
     method public java.security.cert.Certificate getCertificate();
     method public java.security.cert.Certificate[] getCertificateChain();
     method public java.security.PrivateKey getPrivateKey();
@@ -58350,11 +58360,13 @@
 
   public static final class KeyStore.SecretKeyEntry implements java.security.KeyStore.Entry {
     ctor public KeyStore.SecretKeyEntry(javax.crypto.SecretKey);
+    ctor public KeyStore.SecretKeyEntry(javax.crypto.SecretKey, java.util.Set<java.security.KeyStore.Entry.Attribute>);
     method public javax.crypto.SecretKey getSecretKey();
   }
 
   public static final class KeyStore.TrustedCertificateEntry implements java.security.KeyStore.Entry {
     ctor public KeyStore.TrustedCertificateEntry(java.security.cert.Certificate);
+    ctor public KeyStore.TrustedCertificateEntry(java.security.cert.Certificate, java.util.Set<java.security.KeyStore.Entry.Attribute>);
     method public java.security.cert.Certificate getTrustedCertificate();
   }
 
@@ -58490,10 +58502,11 @@
     method public abstract boolean equals(java.lang.Object);
     method public abstract java.lang.String getName();
     method public abstract int hashCode();
+    method public default boolean implies(javax.security.auth.Subject);
     method public abstract java.lang.String toString();
   }
 
-  public abstract interface PrivateKey implements java.security.Key {
+  public abstract interface PrivateKey implements javax.security.auth.Destroyable java.security.Key {
     field public static final long serialVersionUID = 6034044314589513430L; // 0x53bd3b559a12c6d6L
   }
 
diff --git a/api/test-current.txt b/api/test-current.txt
index 3ac9757..ec3b55f 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -55051,6 +55051,12 @@
   }
 
   public static abstract interface KeyStore.Entry {
+    method public default java.util.Set<java.security.KeyStore.Entry.Attribute> getAttributes();
+  }
+
+  public static abstract interface KeyStore.Entry.Attribute {
+    method public abstract java.lang.String getName();
+    method public abstract java.lang.String getValue();
   }
 
   public static abstract interface KeyStore.LoadStoreParameter {
@@ -55059,11 +55065,15 @@
 
   public static class KeyStore.PasswordProtection implements javax.security.auth.Destroyable java.security.KeyStore.ProtectionParameter {
     ctor public KeyStore.PasswordProtection(char[]);
+    ctor public KeyStore.PasswordProtection(char[], java.lang.String, java.security.spec.AlgorithmParameterSpec);
     method public synchronized char[] getPassword();
+    method public java.lang.String getProtectionAlgorithm();
+    method public java.security.spec.AlgorithmParameterSpec getProtectionParameters();
   }
 
   public static final class KeyStore.PrivateKeyEntry implements java.security.KeyStore.Entry {
     ctor public KeyStore.PrivateKeyEntry(java.security.PrivateKey, java.security.cert.Certificate[]);
+    ctor public KeyStore.PrivateKeyEntry(java.security.PrivateKey, java.security.cert.Certificate[], java.util.Set<java.security.KeyStore.Entry.Attribute>);
     method public java.security.cert.Certificate getCertificate();
     method public java.security.cert.Certificate[] getCertificateChain();
     method public java.security.PrivateKey getPrivateKey();
@@ -55074,11 +55084,13 @@
 
   public static final class KeyStore.SecretKeyEntry implements java.security.KeyStore.Entry {
     ctor public KeyStore.SecretKeyEntry(javax.crypto.SecretKey);
+    ctor public KeyStore.SecretKeyEntry(javax.crypto.SecretKey, java.util.Set<java.security.KeyStore.Entry.Attribute>);
     method public javax.crypto.SecretKey getSecretKey();
   }
 
   public static final class KeyStore.TrustedCertificateEntry implements java.security.KeyStore.Entry {
     ctor public KeyStore.TrustedCertificateEntry(java.security.cert.Certificate);
+    ctor public KeyStore.TrustedCertificateEntry(java.security.cert.Certificate, java.util.Set<java.security.KeyStore.Entry.Attribute>);
     method public java.security.cert.Certificate getTrustedCertificate();
   }
 
@@ -55214,10 +55226,11 @@
     method public abstract boolean equals(java.lang.Object);
     method public abstract java.lang.String getName();
     method public abstract int hashCode();
+    method public default boolean implies(javax.security.auth.Subject);
     method public abstract java.lang.String toString();
   }
 
-  public abstract interface PrivateKey implements java.security.Key {
+  public abstract interface PrivateKey implements javax.security.auth.Destroyable java.security.Key {
     field public static final long serialVersionUID = 6034044314589513430L; // 0x53bd3b559a12c6d6L
   }
 
diff --git a/core/java/android/net/LocalSocketImpl.java b/core/java/android/net/LocalSocketImpl.java
index b83fb26..0f0e9c4 100644
--- a/core/java/android/net/LocalSocketImpl.java
+++ b/core/java/android/net/LocalSocketImpl.java
@@ -516,13 +516,11 @@
                     Os.setsockoptLinger(fd, OsConstants.SOL_SOCKET, OsConstants.SO_LINGER, linger);
                     break;
                 case SocketOptions.SO_TIMEOUT:
-                    /*
-                     * SO_TIMEOUT from the core library gets converted to
-                     * SO_SNDTIMEO, but the option is supposed to set both
-                     * send and receive timeouts. Note: The incoming timeout
-                     * value is in milliseconds.
-                     */
+                    // The option must set both send and receive timeouts.
+                    // Note: The incoming timeout value is in milliseconds.
                     StructTimeval timeval = StructTimeval.fromMillis(intValue);
+                    Os.setsockoptTimeval(fd, OsConstants.SOL_SOCKET, OsConstants.SO_RCVTIMEO,
+                            timeval);
                     Os.setsockoptTimeval(fd, OsConstants.SOL_SOCKET, OsConstants.SO_SNDTIMEO,
                             timeval);
                     break;
diff --git a/libs/hwui/ClipArea.h b/libs/hwui/ClipArea.h
index 6eb2eef..32ab501 100644
--- a/libs/hwui/ClipArea.h
+++ b/libs/hwui/ClipArea.h
@@ -97,9 +97,9 @@
 };
 
 struct ClipBase {
-    ClipBase(ClipMode mode)
+    explicit ClipBase(ClipMode mode)
             : mode(mode) {}
-    ClipBase(const Rect& rect)
+    explicit ClipBase(const Rect& rect)
             : mode(ClipMode::Rectangle)
             , rect(rect) {}
     const ClipMode mode;
@@ -112,19 +112,19 @@
 };
 
 struct ClipRect : ClipBase {
-    ClipRect(const Rect& rect)
+    explicit ClipRect(const Rect& rect)
             : ClipBase(rect) {}
 };
 
 struct ClipRectList : ClipBase {
-    ClipRectList(const RectangleList& rectList)
+    explicit ClipRectList(const RectangleList& rectList)
             : ClipBase(ClipMode::RectangleList)
             , rectList(rectList) {}
     RectangleList rectList;
 };
 
 struct ClipRegion : ClipBase {
-    ClipRegion(const SkRegion& region)
+    explicit ClipRegion(const SkRegion& region)
             : ClipBase(ClipMode::Region)
             , region(region) {}
     ClipRegion()
diff --git a/libs/hwui/DeferredLayerUpdater.h b/libs/hwui/DeferredLayerUpdater.h
index 44a24c8..4005822 100644
--- a/libs/hwui/DeferredLayerUpdater.h
+++ b/libs/hwui/DeferredLayerUpdater.h
@@ -35,7 +35,7 @@
 public:
     // Note that DeferredLayerUpdater assumes it is taking ownership of the layer
     // and will not call incrementRef on it as a result.
-    ANDROID_API DeferredLayerUpdater(Layer* layer);
+    ANDROID_API explicit DeferredLayerUpdater(Layer* layer);
     ANDROID_API ~DeferredLayerUpdater();
 
     ANDROID_API bool setSize(int width, int height) {
diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h
index e10a81b..d656864 100644
--- a/libs/hwui/FontRenderer.h
+++ b/libs/hwui/FontRenderer.h
@@ -96,7 +96,7 @@
 
 class FontRenderer {
 public:
-    FontRenderer(const uint8_t* gammaTable);
+    explicit FontRenderer(const uint8_t* gammaTable);
     ~FontRenderer();
 
     void flushLargeCaches(std::vector<CacheTexture*>& cacheTextures);
diff --git a/libs/hwui/GpuMemoryTracker.h b/libs/hwui/GpuMemoryTracker.h
index 851aeae..bfb1bf1 100644
--- a/libs/hwui/GpuMemoryTracker.h
+++ b/libs/hwui/GpuMemoryTracker.h
@@ -52,7 +52,7 @@
     static void onFrameCompleted();
 
 protected:
-    GpuMemoryTracker(GpuObjectType type) : mType(type) {
+    explicit GpuMemoryTracker(GpuObjectType type) : mType(type) {
         ASSERT_GPU_THREAD();
         startTrackingObject();
     }
diff --git a/libs/hwui/PropertyValuesAnimatorSet.h b/libs/hwui/PropertyValuesAnimatorSet.h
index c7ae7c0..602fd91 100644
--- a/libs/hwui/PropertyValuesAnimatorSet.h
+++ b/libs/hwui/PropertyValuesAnimatorSet.h
@@ -73,7 +73,7 @@
 
 class PropertyAnimatorSetListener : public AnimationListener {
 public:
-    PropertyAnimatorSetListener(PropertyValuesAnimatorSet* set) : mSet(set) {}
+    explicit PropertyAnimatorSetListener(PropertyValuesAnimatorSet* set) : mSet(set) {}
     virtual void onAnimationFinished(BaseRenderNodeAnimator* animator) override;
 
 private:
diff --git a/libs/hwui/RecordedOp.h b/libs/hwui/RecordedOp.h
index aee9d63..5497f86 100644
--- a/libs/hwui/RecordedOp.h
+++ b/libs/hwui/RecordedOp.h
@@ -509,7 +509,7 @@
             , mode(PaintUtils::getXfermodeDirect(paint))
             , colorFilter(paint ? paint->getColorFilter() : nullptr) {}
 
-    LayerOp(RenderNode& node)
+    explicit LayerOp(RenderNode& node)
             : RecordedOp(RecordedOpId::LayerOp, Rect(node.getWidth(), node.getHeight()), Matrix4::identity(), nullptr, nullptr)
             , layerHandle(node.getLayerHandle())
             , alpha(node.properties().layerProperties().alpha() / 255.0f)
diff --git a/libs/hwui/VectorDrawable.h b/libs/hwui/VectorDrawable.h
index a5d1d4b..3586d8a 100644
--- a/libs/hwui/VectorDrawable.h
+++ b/libs/hwui/VectorDrawable.h
@@ -90,7 +90,7 @@
 public:
     class Properties {
     public:
-        Properties(Node* node) : mNode(node) {}
+        explicit Properties(Node* node) : mNode(node) {}
         inline void onPropertyChanged() {
             mNode->onPropertyChanged(this);
         }
@@ -132,7 +132,7 @@
 
     class PathProperties : public Properties {
     public:
-        PathProperties(Node* node) : Properties(node) {}
+        explicit PathProperties(Node* node) : Properties(node) {}
         void syncProperties(const PathProperties& prop) {
             mData = prop.mData;
             onPropertyChanged();
@@ -218,7 +218,7 @@
             float strokeMiterLimit = 4;
             int fillType = 0; /* non-zero or kWinding_FillType in Skia */
         };
-        FullPathProperties(Node* mNode) : Properties(mNode), mTrimDirty(false) {}
+        explicit FullPathProperties(Node* mNode) : Properties(mNode), mTrimDirty(false) {}
         ~FullPathProperties() {
             SkSafeUnref(fillGradient);
             SkSafeUnref(strokeGradient);
@@ -409,7 +409,7 @@
 public:
     class GroupProperties : public Properties {
     public:
-        GroupProperties(Node* mNode) : Properties(mNode) {}
+        explicit GroupProperties(Node* mNode) : Properties(mNode) {}
         struct PrimitiveFields {
             float rotate = 0;
             float pivotX = 0;
@@ -539,7 +539,7 @@
 
 class ANDROID_API Tree : public VirtualLightRefBase {
 public:
-    Tree(Group* rootNode) : mRootNode(rootNode) {
+    explicit Tree(Group* rootNode) : mRootNode(rootNode) {
         mRootNode->setPropertyChangedListener(&mPropertyChangedListener);
     }
 
@@ -576,7 +576,7 @@
 
     class TreeProperties {
     public:
-        TreeProperties(Tree* tree) : mTree(tree) {}
+        explicit TreeProperties(Tree* tree) : mTree(tree) {}
         // Properties that can only be modified by UI thread, therefore sync should
         // only go from UI to RT
         struct NonAnimatableProperties {
diff --git a/libs/hwui/hwui/Paint.h b/libs/hwui/hwui/Paint.h
index 9599c30..f72a632 100644
--- a/libs/hwui/hwui/Paint.h
+++ b/libs/hwui/hwui/Paint.h
@@ -30,7 +30,7 @@
 public:
     Paint();
     Paint(const Paint& paint);
-    Paint(const SkPaint& paint);
+    Paint(const SkPaint& paint);  // NOLINT(implicit)
     ~Paint();
 
     Paint& operator=(const Paint& other);
diff --git a/libs/hwui/renderstate/OffscreenBufferPool.h b/libs/hwui/renderstate/OffscreenBufferPool.h
index 73a3392..26d4e36 100644
--- a/libs/hwui/renderstate/OffscreenBufferPool.h
+++ b/libs/hwui/renderstate/OffscreenBufferPool.h
@@ -126,7 +126,7 @@
                 : width(OffscreenBuffer::computeIdealDimension(layerWidth))
                 , height(OffscreenBuffer::computeIdealDimension(layerHeight)) {}
 
-        Entry(OffscreenBuffer* layer)
+        explicit Entry(OffscreenBuffer* layer)
                 : layer(layer)
                 , width(layer->texture.width())
                 , height(layer->texture.height()) {
diff --git a/libs/hwui/tests/common/TestScene.h b/libs/hwui/tests/common/TestScene.h
index 706f2ff..060984e 100644
--- a/libs/hwui/tests/common/TestScene.h
+++ b/libs/hwui/tests/common/TestScene.h
@@ -55,7 +55,7 @@
 
     class Registrar {
     public:
-        Registrar(const TestScene::Info& info) {
+        explicit Registrar(const TestScene::Info& info) {
             TestScene::registerScene(info);
         }
     private:
diff --git a/libs/hwui/tests/common/TestUtils.h b/libs/hwui/tests/common/TestUtils.h
index a48469c..5a4ab99 100644
--- a/libs/hwui/tests/common/TestUtils.h
+++ b/libs/hwui/tests/common/TestUtils.h
@@ -102,7 +102,7 @@
     public:
         SignalingDtor()
                 : mSignal(nullptr) {}
-        SignalingDtor(int* signal)
+        explicit SignalingDtor(int* signal)
                 : mSignal(signal) {}
         void setSignal(int* signal) {
             mSignal = signal;
@@ -202,7 +202,7 @@
 
     class TestTask : public renderthread::RenderTask {
     public:
-        TestTask(RtCallback rtCallback)
+        explicit TestTask(RtCallback rtCallback)
                 : rtCallback(rtCallback) {}
         virtual ~TestTask() {}
         virtual void run() override;
diff --git a/libs/hwui/utils/FatVector.h b/libs/hwui/utils/FatVector.h
index 93d37c2..df8cb076 100644
--- a/libs/hwui/utils/FatVector.h
+++ b/libs/hwui/utils/FatVector.h
@@ -53,7 +53,7 @@
     typedef T value_type; // needed to implement std::allocator
     typedef T* pointer; // needed to implement std::allocator
 
-    InlineStdAllocator(Allocation& allocation)
+    explicit InlineStdAllocator(Allocation& allocation)
             : mAllocation(allocation) {}
     InlineStdAllocator(const InlineStdAllocator& other)
             : mAllocation(other.mAllocation) {}
@@ -93,7 +93,7 @@
         this->reserve(SIZE);
     }
 
-    FatVector(size_t capacity) : FatVector() {
+    explicit FatVector(size_t capacity) : FatVector() {
         this->resize(capacity);
     }
 
diff --git a/libs/hwui/utils/LinearAllocator.h b/libs/hwui/utils/LinearAllocator.h
index 34c8c6b..f95a6fe 100644
--- a/libs/hwui/utils/LinearAllocator.h
+++ b/libs/hwui/utils/LinearAllocator.h
@@ -157,7 +157,7 @@
     typedef T value_type; // needed to implement std::allocator
     typedef T* pointer; // needed to implement std::allocator
 
-    LinearStdAllocator(LinearAllocator& allocator)
+    explicit LinearStdAllocator(LinearAllocator& allocator)
             : linearAllocator(allocator) {}
     LinearStdAllocator(const LinearStdAllocator& other)
             : linearAllocator(other.linearAllocator) {}
@@ -170,7 +170,7 @@
     };
     // enable allocators to be constructed from other templated types
     template <class U>
-    LinearStdAllocator(const LinearStdAllocator<U>& other)
+    LinearStdAllocator(const LinearStdAllocator<U>& other)  // NOLINT(implicit)
             : linearAllocator(other.linearAllocator) {}
 
     T* allocate(size_t num, const void* = 0) {
@@ -195,7 +195,7 @@
 template <class T>
 class LsaVector : public std::vector<T, LinearStdAllocator<T>> {
 public:
-    LsaVector(const LinearStdAllocator<T>& allocator)
+    explicit LsaVector(const LinearStdAllocator<T>& allocator)
             : std::vector<T, LinearStdAllocator<T>>(allocator) {}
 };
 
diff --git a/media/mca/filterfw/native/core/gl_frame.h b/media/mca/filterfw/native/core/gl_frame.h
index f2a1ad5..fdbb1f5 100644
--- a/media/mca/filterfw/native/core/gl_frame.h
+++ b/media/mca/filterfw/native/core/gl_frame.h
@@ -38,7 +38,7 @@
     // Create an empty GL frame in the specified GL environment. Note, that the GLFrame does NOT
     // take ownership. The caller must make sure the GLEnv stays valid as long as the GLFrame is
     // alive.
-    GLFrame(GLEnv* gl_env);
+    explicit GLFrame(GLEnv* gl_env);
 
     // Deallocate a GL frame.
     ~GLFrame();
diff --git a/media/mca/filterfw/native/core/native_frame.h b/media/mca/filterfw/native/core/native_frame.h
index 0d335b3..2da557d 100644
--- a/media/mca/filterfw/native/core/native_frame.h
+++ b/media/mca/filterfw/native/core/native_frame.h
@@ -27,7 +27,7 @@
 class NativeFrame {
   public:
     // Create an empty native frame.
-    NativeFrame(int size);
+    explicit NativeFrame(int size);
 
     ~NativeFrame();