summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/Attributable.java
diff options
context:
space:
mode:
authorWilliam Escande <wescande@google.com>2021-12-14 16:16:11 +0100
committerWilliam Escande <wescande@google.com>2021-12-14 16:22:07 +0100
commitd517127a57b499305f82ec6eea6da8e0bd485e87 (patch)
tree225b57cbd2b77982302493bc31d3012addf2186f /framework/java/android/bluetooth/Attributable.java
parent80dbb1067cda144c7933718b8f49467d6a87b247 (diff)
Copy attributable to Bluetooth
Attributable is called by bluetooth and it's hidden. By copying into bluetooth we are now allowed to call it Bug: 210467788 Test: build Tag: #refactor Change-Id: I73ea07c9439988ab5477c82799f718c6d81513be
Diffstat (limited to 'framework/java/android/bluetooth/Attributable.java')
-rw-r--r--framework/java/android/bluetooth/Attributable.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/Attributable.java b/framework/java/android/bluetooth/Attributable.java
new file mode 100644
index 0000000000..d9acbe3eef
--- /dev/null
+++ b/framework/java/android/bluetooth/Attributable.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.bluetooth;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.AttributionSource;
+
+import java.util.List;
+
+/**
+ * Marker interface for a class which can have an {@link AttributionSource}
+ * assigned to it; these are typically {@link android.os.Parcelable} classes
+ * which need to be updated after crossing Binder transaction boundaries.
+ *
+ * @hide
+ */
+public interface Attributable {
+ void setAttributionSource(@NonNull AttributionSource attributionSource);
+
+ static @Nullable <T extends Attributable> T setAttributionSource(
+ @Nullable T attributable,
+ @NonNull AttributionSource attributionSource) {
+ if (attributable != null) {
+ attributable.setAttributionSource(attributionSource);
+ }
+ return attributable;
+ }
+
+ static @Nullable <T extends Attributable> List<T> setAttributionSource(
+ @Nullable List<T> attributableList,
+ @NonNull AttributionSource attributionSource) {
+ if (attributableList != null) {
+ final int size = attributableList.size();
+ for (int i = 0; i < size; i++) {
+ setAttributionSource(attributableList.get(i), attributionSource);
+ }
+ }
+ return attributableList;
+ }
+}