| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.app.servertransaction; |
| 18 |
|
| 19 |
import android.annotation.Nullable; |
| 20 |
import android.app.ActivityThread.ActivityClientRecord; |
| 21 |
import android.app.ClientTransactionHandler; |
| 22 |
import android.app.PictureInPictureUiState; |
| 23 |
import android.os.Parcel; |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
public final class PipStateTransactionItem extends ActivityTransactionItem { |
| 30 |
|
| 31 |
private PictureInPictureUiState mPipState; |
| 32 |
|
| 33 |
@Override |
| 34 |
public void execute(ClientTransactionHandler client, ActivityClientRecord r, |
| 35 |
PendingTransactionActions pendingActions) { |
| 36 |
client.handlePictureInPictureStateChanged(r, mPipState); |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
private PipStateTransactionItem() {} |
| 42 |
|
| 43 |
|
| 44 |
public static PipStateTransactionItem obtain(PictureInPictureUiState pipState) { |
| 45 |
PipStateTransactionItem instance = ObjectPool.obtain(PipStateTransactionItem.class); |
| 46 |
if (instance == null) { |
| 47 |
instance = new PipStateTransactionItem(); |
| 48 |
} |
| 49 |
instance.mPipState = pipState; |
| 50 |
|
| 51 |
return instance; |
| 52 |
} |
| 53 |
|
| 54 |
@Override |
| 55 |
public void recycle() { |
| 56 |
mPipState = null; |
| 57 |
ObjectPool.recycle(this); |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
@Override |
| 64 |
public void writeToParcel(Parcel dest, int flags) { |
| 65 |
mPipState.writeToParcel(dest, flags); |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
private PipStateTransactionItem(Parcel in) { |
| 70 |
mPipState = PictureInPictureUiState.CREATOR.createFromParcel(in); |
| 71 |
} |
| 72 |
|
| 73 |
public static final @android.annotation.NonNull Creator<PipStateTransactionItem> CREATOR = |
| 74 |
new Creator<PipStateTransactionItem>() { |
| 75 |
public PipStateTransactionItem createFromParcel(Parcel in) { |
| 76 |
return new PipStateTransactionItem(in); |
| 77 |
} |
| 78 |
|
| 79 |
public PipStateTransactionItem[] newArray(int size) { |
| 80 |
return new PipStateTransactionItem[size]; |
| 81 |
} |
| 82 |
}; |
| 83 |
|
| 84 |
@Override |
| 85 |
public boolean equals(@Nullable Object o) { |
| 86 |
return this == o; |
| 87 |
} |
| 88 |
|
| 89 |
@Override |
| 90 |
public String toString() { |
| 91 |
return "PipStateTransactionItem{}"; |
| 92 |
} |
| 93 |
} |