PlaybackStateCompat.java 15.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505
package android.support.v4.media.session;

import android.media.session.PlaybackState;
import android.media.session.PlaybackState.CustomAction;
import android.media.session.PlaybackState.CustomAction.Builder;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.os.SystemClock;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.text.TextUtils;
import do;
import dp;
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public final class PlaybackStateCompat
  implements Parcelable
{
  public static final long ACTION_FAST_FORWARD = 64L;
  public static final long ACTION_PAUSE = 2L;
  public static final long ACTION_PLAY = 4L;
  public static final long ACTION_PLAY_FROM_MEDIA_ID = 1024L;
  public static final long ACTION_PLAY_FROM_SEARCH = 2048L;
  public static final long ACTION_PLAY_FROM_URI = 8192L;
  public static final long ACTION_PLAY_PAUSE = 512L;
  public static final long ACTION_PREPARE = 16384L;
  public static final long ACTION_PREPARE_FROM_MEDIA_ID = 32768L;
  public static final long ACTION_PREPARE_FROM_SEARCH = 65536L;
  public static final long ACTION_PREPARE_FROM_URI = 131072L;
  public static final long ACTION_REWIND = 8L;
  public static final long ACTION_SEEK_TO = 256L;
  public static final long ACTION_SET_RATING = 128L;
  public static final long ACTION_SKIP_TO_NEXT = 32L;
  public static final long ACTION_SKIP_TO_PREVIOUS = 16L;
  public static final long ACTION_SKIP_TO_QUEUE_ITEM = 4096L;
  public static final long ACTION_STOP = 1L;
  public static final Parcelable.Creator<PlaybackStateCompat> CREATOR = new Parcelable.Creator() {};
  public static final long PLAYBACK_POSITION_UNKNOWN = -1L;
  public static final int STATE_BUFFERING = 6;
  public static final int STATE_CONNECTING = 8;
  public static final int STATE_ERROR = 7;
  public static final int STATE_FAST_FORWARDING = 4;
  public static final int STATE_NONE = 0;
  public static final int STATE_PAUSED = 2;
  public static final int STATE_PLAYING = 3;
  public static final int STATE_REWINDING = 5;
  public static final int STATE_SKIPPING_TO_NEXT = 10;
  public static final int STATE_SKIPPING_TO_PREVIOUS = 9;
  public static final int STATE_SKIPPING_TO_QUEUE_ITEM = 11;
  public static final int STATE_STOPPED = 1;
  final int a;
  final long b;
  final long c;
  final float d;
  final long e;
  final CharSequence f;
  final long g;
  List<CustomAction> h;
  final long i;
  final Bundle j;
  private Object k;
  
  PlaybackStateCompat(int paramInt, long paramLong1, long paramLong2, float paramFloat, long paramLong3, CharSequence paramCharSequence, long paramLong4, List<CustomAction> paramList, long paramLong5, Bundle paramBundle)
  {
    this.a = paramInt;
    this.b = paramLong1;
    this.c = paramLong2;
    this.d = paramFloat;
    this.e = paramLong3;
    this.f = paramCharSequence;
    this.g = paramLong4;
    this.h = new ArrayList(paramList);
    this.i = paramLong5;
    this.j = paramBundle;
  }
  
  PlaybackStateCompat(Parcel paramParcel)
  {
    this.a = paramParcel.readInt();
    this.b = paramParcel.readLong();
    this.d = paramParcel.readFloat();
    this.g = paramParcel.readLong();
    this.c = paramParcel.readLong();
    this.e = paramParcel.readLong();
    this.f = ((CharSequence)TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(paramParcel));
    this.h = paramParcel.createTypedArrayList(CustomAction.CREATOR);
    this.i = paramParcel.readLong();
    this.j = paramParcel.readBundle();
  }
  
  public static PlaybackStateCompat fromPlaybackState(Object paramObject)
  {
    if ((paramObject == null) || (Build.VERSION.SDK_INT < 21)) {
      return null;
    }
    Object localObject3 = ((PlaybackState)paramObject).getCustomActions();
    Object localObject1 = null;
    if (localObject3 != null)
    {
      localObject2 = new ArrayList(((List)localObject3).size());
      localObject3 = ((List)localObject3).iterator();
      for (;;)
      {
        localObject1 = localObject2;
        if (!((Iterator)localObject3).hasNext()) {
          break;
        }
        ((List)localObject2).add(CustomAction.fromCustomAction(((Iterator)localObject3).next()));
      }
    }
    if (Build.VERSION.SDK_INT >= 22) {}
    for (Object localObject2 = ((PlaybackState)paramObject).getExtras();; localObject2 = null)
    {
      localObject1 = new PlaybackStateCompat(((PlaybackState)paramObject).getState(), ((PlaybackState)paramObject).getPosition(), ((PlaybackState)paramObject).getBufferedPosition(), ((PlaybackState)paramObject).getPlaybackSpeed(), ((PlaybackState)paramObject).getActions(), ((PlaybackState)paramObject).getErrorMessage(), ((PlaybackState)paramObject).getLastPositionUpdateTime(), (List)localObject1, ((PlaybackState)paramObject).getActiveQueueItemId(), (Bundle)localObject2);
      ((PlaybackStateCompat)localObject1).k = paramObject;
      return (PlaybackStateCompat)localObject1;
    }
  }
  
  public static int toKeyCode(long paramLong)
  {
    if (paramLong == 4L) {
      return 126;
    }
    if (paramLong == 2L) {
      return 127;
    }
    if (paramLong == 32L) {
      return 87;
    }
    if (paramLong == 16L) {
      return 88;
    }
    if (paramLong == 1L) {
      return 86;
    }
    if (paramLong == 64L) {
      return 90;
    }
    if (paramLong == 8L) {
      return 89;
    }
    if (paramLong == 512L) {
      return 85;
    }
    return 0;
  }
  
  public final int describeContents()
  {
    return 0;
  }
  
  public final long getActions()
  {
    return this.e;
  }
  
  public final long getActiveQueueItemId()
  {
    return this.i;
  }
  
  public final long getBufferedPosition()
  {
    return this.c;
  }
  
  public final List<CustomAction> getCustomActions()
  {
    return this.h;
  }
  
  public final CharSequence getErrorMessage()
  {
    return this.f;
  }
  
  @Nullable
  public final Bundle getExtras()
  {
    return this.j;
  }
  
  public final long getLastPositionUpdateTime()
  {
    return this.g;
  }
  
  public final float getPlaybackSpeed()
  {
    return this.d;
  }
  
  public final Object getPlaybackState()
  {
    if ((this.k != null) || (Build.VERSION.SDK_INT < 21)) {
      return this.k;
    }
    Object localObject = null;
    if (this.h != null)
    {
      ArrayList localArrayList = new ArrayList(this.h.size());
      Iterator localIterator = this.h.iterator();
      for (;;)
      {
        localObject = localArrayList;
        if (!localIterator.hasNext()) {
          break;
        }
        localArrayList.add(((CustomAction)localIterator.next()).getCustomAction());
      }
    }
    if (Build.VERSION.SDK_INT >= 22) {}
    for (this.k = dp.a(this.a, this.b, this.c, this.d, this.e, this.f, this.g, (List)localObject, this.i, this.j);; this.k = do.a(this.a, this.b, this.c, this.d, this.e, this.f, this.g, (List)localObject, this.i)) {
      return this.k;
    }
  }
  
  public final long getPosition()
  {
    return this.b;
  }
  
  public final int getState()
  {
    return this.a;
  }
  
  public final String toString()
  {
    StringBuilder localStringBuilder = new StringBuilder("PlaybackState {");
    localStringBuilder.append("state=").append(this.a);
    localStringBuilder.append(", position=").append(this.b);
    localStringBuilder.append(", buffered position=").append(this.c);
    localStringBuilder.append(", speed=").append(this.d);
    localStringBuilder.append(", updated=").append(this.g);
    localStringBuilder.append(", actions=").append(this.e);
    localStringBuilder.append(", error=").append(this.f);
    localStringBuilder.append(", custom actions=").append(this.h);
    localStringBuilder.append(", active item id=").append(this.i);
    localStringBuilder.append("}");
    return localStringBuilder.toString();
  }
  
  public final void writeToParcel(Parcel paramParcel, int paramInt)
  {
    paramParcel.writeInt(this.a);
    paramParcel.writeLong(this.b);
    paramParcel.writeFloat(this.d);
    paramParcel.writeLong(this.g);
    paramParcel.writeLong(this.c);
    paramParcel.writeLong(this.e);
    TextUtils.writeToParcel(this.f, paramParcel, paramInt);
    paramParcel.writeTypedList(this.h);
    paramParcel.writeLong(this.i);
    paramParcel.writeBundle(this.j);
  }
  
  @Retention(RetentionPolicy.SOURCE)
  @RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
  public static @interface Actions {}
  
  public static final class Builder
  {
    private final List<PlaybackStateCompat.CustomAction> a = new ArrayList();
    private int b;
    private long c;
    private long d;
    private float e;
    private long f;
    private CharSequence g;
    private long h;
    private long i = -1L;
    private Bundle j;
    
    public Builder() {}
    
    public Builder(PlaybackStateCompat paramPlaybackStateCompat)
    {
      this.b = paramPlaybackStateCompat.a;
      this.c = paramPlaybackStateCompat.b;
      this.e = paramPlaybackStateCompat.d;
      this.h = paramPlaybackStateCompat.g;
      this.d = paramPlaybackStateCompat.c;
      this.f = paramPlaybackStateCompat.e;
      this.g = paramPlaybackStateCompat.f;
      if (paramPlaybackStateCompat.h != null) {
        this.a.addAll(paramPlaybackStateCompat.h);
      }
      this.i = paramPlaybackStateCompat.i;
      this.j = paramPlaybackStateCompat.j;
    }
    
    public final Builder addCustomAction(PlaybackStateCompat.CustomAction paramCustomAction)
    {
      if (paramCustomAction == null) {
        throw new IllegalArgumentException("You may not add a null CustomAction to PlaybackStateCompat.");
      }
      this.a.add(paramCustomAction);
      return this;
    }
    
    public final Builder addCustomAction(String paramString1, String paramString2, int paramInt)
    {
      return addCustomAction(new PlaybackStateCompat.CustomAction(paramString1, paramString2, paramInt, null));
    }
    
    public final PlaybackStateCompat build()
    {
      return new PlaybackStateCompat(this.b, this.c, this.d, this.e, this.f, this.g, this.h, this.a, this.i, this.j);
    }
    
    public final Builder setActions(long paramLong)
    {
      this.f = paramLong;
      return this;
    }
    
    public final Builder setActiveQueueItemId(long paramLong)
    {
      this.i = paramLong;
      return this;
    }
    
    public final Builder setBufferedPosition(long paramLong)
    {
      this.d = paramLong;
      return this;
    }
    
    public final Builder setErrorMessage(CharSequence paramCharSequence)
    {
      this.g = paramCharSequence;
      return this;
    }
    
    public final Builder setExtras(Bundle paramBundle)
    {
      this.j = paramBundle;
      return this;
    }
    
    public final Builder setState(int paramInt, long paramLong, float paramFloat)
    {
      return setState(paramInt, paramLong, paramFloat, SystemClock.elapsedRealtime());
    }
    
    public final Builder setState(int paramInt, long paramLong1, float paramFloat, long paramLong2)
    {
      this.b = paramInt;
      this.c = paramLong1;
      this.h = paramLong2;
      this.e = paramFloat;
      return this;
    }
  }
  
  public static final class CustomAction
    implements Parcelable
  {
    public static final Parcelable.Creator<CustomAction> CREATOR = new Parcelable.Creator() {};
    private final String a;
    private final CharSequence b;
    private final int c;
    private final Bundle d;
    private Object e;
    
    CustomAction(Parcel paramParcel)
    {
      this.a = paramParcel.readString();
      this.b = ((CharSequence)TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(paramParcel));
      this.c = paramParcel.readInt();
      this.d = paramParcel.readBundle();
    }
    
    CustomAction(String paramString, CharSequence paramCharSequence, int paramInt, Bundle paramBundle)
    {
      this.a = paramString;
      this.b = paramCharSequence;
      this.c = paramInt;
      this.d = paramBundle;
    }
    
    public static CustomAction fromCustomAction(Object paramObject)
    {
      if ((paramObject == null) || (Build.VERSION.SDK_INT < 21)) {
        return null;
      }
      CustomAction localCustomAction = new CustomAction(((PlaybackState.CustomAction)paramObject).getAction(), ((PlaybackState.CustomAction)paramObject).getName(), ((PlaybackState.CustomAction)paramObject).getIcon(), ((PlaybackState.CustomAction)paramObject).getExtras());
      localCustomAction.e = paramObject;
      return localCustomAction;
    }
    
    public final int describeContents()
    {
      return 0;
    }
    
    public final String getAction()
    {
      return this.a;
    }
    
    public final Object getCustomAction()
    {
      if ((this.e != null) || (Build.VERSION.SDK_INT < 21)) {
        return this.e;
      }
      Object localObject = this.a;
      CharSequence localCharSequence = this.b;
      int i = this.c;
      Bundle localBundle = this.d;
      localObject = new PlaybackState.CustomAction.Builder((String)localObject, localCharSequence, i);
      ((PlaybackState.CustomAction.Builder)localObject).setExtras(localBundle);
      this.e = ((PlaybackState.CustomAction.Builder)localObject).build();
      return this.e;
    }
    
    public final Bundle getExtras()
    {
      return this.d;
    }
    
    public final int getIcon()
    {
      return this.c;
    }
    
    public final CharSequence getName()
    {
      return this.b;
    }
    
    public final String toString()
    {
      return "Action:mName='" + this.b + ", mIcon=" + this.c + ", mExtras=" + this.d;
    }
    
    public final void writeToParcel(Parcel paramParcel, int paramInt)
    {
      paramParcel.writeString(this.a);
      TextUtils.writeToParcel(this.b, paramParcel, paramInt);
      paramParcel.writeInt(this.c);
      paramParcel.writeBundle(this.d);
    }
    
    public static final class Builder
    {
      private final String a;
      private final CharSequence b;
      private final int c;
      private Bundle d;
      
      public Builder(String paramString, CharSequence paramCharSequence, int paramInt)
      {
        if (TextUtils.isEmpty(paramString)) {
          throw new IllegalArgumentException("You must specify an action to build a CustomAction.");
        }
        if (TextUtils.isEmpty(paramCharSequence)) {
          throw new IllegalArgumentException("You must specify a name to build a CustomAction.");
        }
        if (paramInt == 0) {
          throw new IllegalArgumentException("You must specify an icon resource id to build a CustomAction.");
        }
        this.a = paramString;
        this.b = paramCharSequence;
        this.c = paramInt;
      }
      
      public final PlaybackStateCompat.CustomAction build()
      {
        return new PlaybackStateCompat.CustomAction(this.a, this.b, this.c, this.d);
      }
      
      public final Builder setExtras(Bundle paramBundle)
      {
        this.d = paramBundle;
        return this;
      }
    }
  }
  
  @Retention(RetentionPolicy.SOURCE)
  @RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
  public static @interface MediaKeyAction {}
  
  @Retention(RetentionPolicy.SOURCE)
  @RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
  public static @interface State {}
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/media/session/PlaybackStateCompat.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */