aboutsummaryrefslogtreecommitdiff
path: root/partner_support
diff options
context:
space:
mode:
authorNick Chalko <nchalko@google.com>2018-03-17 21:29:13 -0700
committerNick Chalko <nchalko@google.com>2018-03-17 21:54:54 -0700
commit0e65ecd08816cb177151a325cb43e25be919b1d5 (patch)
tree2fd6781b28dfbaf7199aef6835549a3c6cff4b9e /partner_support
parent363cfbb22bbdb0db9c236f22926d68ee1b8ea56c (diff)
downloadTV-0e65ecd08816cb177151a325cb43e25be919b1d5.tar.gz
Use @AutoValue annotation processor
Change-Id: Ie0dbdef3b5e61d8994c92ab27c66f28d480fdcbd Bug: 72052568 Test: m LiveTv
Diffstat (limited to 'partner_support')
-rw-r--r--partner_support/Android.mk10
-rw-r--r--partner_support/src/com/google/android/tv/partner/support/AutoValue_EpgInput.java97
-rw-r--r--partner_support/src/com/google/android/tv/partner/support/AutoValue_Lineup.java114
-rw-r--r--partner_support/src/com/google/android/tv/partner/support/EpgInput.java3
-rw-r--r--partner_support/src/com/google/android/tv/partner/support/Lineup.java3
5 files changed, 14 insertions, 213 deletions
diff --git a/partner_support/Android.mk b/partner_support/Android.mk
index 9a45e705..9d921a0f 100644
--- a/partner_support/Android.mk
+++ b/partner_support/Android.mk
@@ -15,6 +15,16 @@ LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_STATIC_JAVA_LIBRARIES := android-support-annotations
+LOCAL_JAVA_LIBRARIES := \
+ auto-value-jar \
+
+LOCAL_ANNOTATION_PROCESSORS := \
+ auto-value-jar-host \
+
+LOCAL_ANNOTATION_PROCESSOR_CLASSES := \
+ com.google.auto.value.processor.AutoValueProcessor
+
+
include $(LOCAL_PATH)/buildconfig.mk
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/partner_support/src/com/google/android/tv/partner/support/AutoValue_EpgInput.java b/partner_support/src/com/google/android/tv/partner/support/AutoValue_EpgInput.java
deleted file mode 100644
index aad51c76..00000000
--- a/partner_support/src/com/google/android/tv/partner/support/AutoValue_EpgInput.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2018 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 com.google.android.tv.partner.support;
-
-
-
-/**
- * Hand copy of generated Autovalue class.
- *
- * TODO get autovalue working
- */
-final class AutoValue_EpgInput extends EpgInput {
-
- private final long id;
- private final String inputId;
- private final String lineupId;
-
- AutoValue_EpgInput(
- long id,
- String inputId,
- String lineupId) {
- this.id = id;
- if (inputId == null) {
- throw new NullPointerException("Null inputId");
- }
- this.inputId = inputId;
- if (lineupId == null) {
- throw new NullPointerException("Null lineupId");
- }
- this.lineupId = lineupId;
- }
-
- @Override
- public long getId() {
- return id;
- }
-
- @Override
- public String getInputId() {
- return inputId;
- }
-
- @Override
- public String getLineupId() {
- return lineupId;
- }
-
- @Override
- public String toString() {
- return "EpgInput{"
- + "id=" + id + ", "
- + "inputId=" + inputId + ", "
- + "lineupId=" + lineupId
- + "}";
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this) {
- return true;
- }
- if (o instanceof EpgInput) {
- EpgInput that = (EpgInput) o;
- return (this.id == that.getId())
- && (this.inputId.equals(that.getInputId()))
- && (this.lineupId.equals(that.getLineupId()));
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- int h$ = 1;
- h$ *= 1000003;
- h$ ^= (int) ((id >>> 32) ^ id);
- h$ *= 1000003;
- h$ ^= inputId.hashCode();
- h$ *= 1000003;
- h$ ^= lineupId.hashCode();
- return h$;
- }
-
-}
diff --git a/partner_support/src/com/google/android/tv/partner/support/AutoValue_Lineup.java b/partner_support/src/com/google/android/tv/partner/support/AutoValue_Lineup.java
deleted file mode 100644
index 076f8a2a..00000000
--- a/partner_support/src/com/google/android/tv/partner/support/AutoValue_Lineup.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2018 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 com.google.android.tv.partner.support;
-
-import android.support.annotation.Nullable;
-import java.util.List;
-
-/**
- * Hand copy of generated Autovalue class.
- *
- * TODO get autovalue working
- */
-
-final class AutoValue_Lineup extends Lineup {
-
- private final String id;
- private final int type;
- private final String name;
- private final List<String> channels;
-
- AutoValue_Lineup(
- String id,
- int type,
- @Nullable String name,
- List<String> channels) {
- if (id == null) {
- throw new NullPointerException("Null id");
- }
- this.id = id;
- this.type = type;
- this.name = name;
- if (channels == null) {
- throw new NullPointerException("Null channels");
- }
- this.channels = channels;
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public int getType() {
- return type;
- }
-
- @Nullable
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public List<String> getChannels() {
- return channels;
- }
-
- @Override
- public String toString() {
- return "Lineup{"
- + "id=" + id + ", "
- + "type=" + type + ", "
- + "name=" + name + ", "
- + "channels=" + channels
- + "}";
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this) {
- return true;
- }
- if (o instanceof Lineup) {
- Lineup that = (Lineup) o;
- return (this.id.equals(that.getId()))
- && (this.type == that.getType())
- && ((this.name == null) ? (that.getName() == null) : this.name.equals(that.getName()))
- && (this.channels.equals(that.getChannels()));
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- int h$ = 1;
- h$ *= 1000003;
- h$ ^= id.hashCode();
- h$ *= 1000003;
- h$ ^= type;
- h$ *= 1000003;
- h$ ^= (name == null) ? 0 : name.hashCode();
- h$ *= 1000003;
- h$ ^= channels.hashCode();
- return h$;
- }
-
-}
diff --git a/partner_support/src/com/google/android/tv/partner/support/EpgInput.java b/partner_support/src/com/google/android/tv/partner/support/EpgInput.java
index 82cc463a..20b3542a 100644
--- a/partner_support/src/com/google/android/tv/partner/support/EpgInput.java
+++ b/partner_support/src/com/google/android/tv/partner/support/EpgInput.java
@@ -17,13 +17,14 @@
package com.google.android.tv.partner.support;
import android.content.ContentValues;
+import com.google.auto.value.AutoValue;
/**
* Value class representing a TV Input that uses Live TV EPG.
*
* @see {@link EpgContract.EpgInputs}
*/
-// TODO(b/72052568): Get autovalue to work in aosp master
+@AutoValue
public abstract class EpgInput {
public static EpgInput createEpgChannel(long id, String inputId, String lineupId) {
diff --git a/partner_support/src/com/google/android/tv/partner/support/Lineup.java b/partner_support/src/com/google/android/tv/partner/support/Lineup.java
index 6123eebd..c5d30464 100644
--- a/partner_support/src/com/google/android/tv/partner/support/Lineup.java
+++ b/partner_support/src/com/google/android/tv/partner/support/Lineup.java
@@ -18,12 +18,13 @@ package com.google.android.tv.partner.support;
import android.content.ContentValues;
import android.support.annotation.Nullable;
+import com.google.auto.value.AutoValue;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/** Value class for {@link com.google.android.tv.partner.support.EpgContract.Lineups} */
-// TODO(b/72052568): Get autovalue to work in aosp master
+@AutoValue
public abstract class Lineup {
/** Lineup type for cable. */
public static final int LINEUP_CABLE = 0;