1/*
2 * Copyright (C) 2014 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
17package android.support.v4.media.session;
18
19import android.media.session.PlaybackState;
20import android.os.SystemClock;
21
22class PlaybackStateCompatApi21 {
23    public static int getState(Object stateObj) {
24        return ((PlaybackState)stateObj).getState();
25    }
26
27    public static long getPosition(Object stateObj) {
28        return ((PlaybackState)stateObj).getPosition();
29    }
30
31    public static long getBufferedPosition(Object stateObj) {
32        return ((PlaybackState)stateObj).getBufferedPosition();
33    }
34
35    public static float getPlaybackSpeed(Object stateObj) {
36        return ((PlaybackState)stateObj).getPlaybackSpeed();
37    }
38
39    public static long getActions(Object stateObj) {
40        return ((PlaybackState)stateObj).getActions();
41    }
42
43    public static CharSequence getErrorMessage(Object stateObj) {
44        return ((PlaybackState)stateObj).getErrorMessage();
45    }
46
47    public static long getLastPositionUpdateTime(Object stateObj) {
48        return ((PlaybackState)stateObj).getLastPositionUpdateTime();
49    }
50
51    public static Object newInstance(int state, long position, long bufferedPosition,
52            float speed, long actions, CharSequence errorMessage, long updateTime) {
53        PlaybackState.Builder stateObj = new PlaybackState.Builder();
54        stateObj.setState(state, position, speed, updateTime);
55        stateObj.setBufferedPosition(bufferedPosition);
56        stateObj.setActions(actions);
57        stateObj.setErrorMessage(errorMessage);
58        return stateObj.build();
59    }
60}
61