1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.bluetooth.audio_util;
18 
19 import android.media.session.PlaybackState;
20 
21 import java.util.List;
22 import java.util.Objects;
23 
24 /*
25  * Helper class to transport metadata around AVRCP
26  */
27 public class MediaData {
28     public List<Metadata> queue;
29     public PlaybackState state;
30     public Metadata metadata;
31 
MediaData(Metadata m, PlaybackState s, List<Metadata> q)32     public MediaData(Metadata m, PlaybackState s, List<Metadata> q) {
33         metadata = m;
34         state = s;
35         queue = q;
36     }
37 
38     @Override
equals(Object o)39     public boolean equals(Object o) {
40         if (o == null) return false;
41         if (!(o instanceof MediaData)) return false;
42 
43         final MediaData u = (MediaData) o;
44 
45         if (!MediaPlayerWrapper.playstateEquals(state, u.state)) {
46             return false;
47         }
48 
49         if (!Objects.equals(metadata, u.metadata)) {
50             return false;
51         }
52 
53         if (!Objects.equals(queue, u.queue)) {
54             return false;
55         }
56 
57         return true;
58     }
59 }
60