Merge "Close Transactions explicitly" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6d990b1296
@@ -98,6 +98,13 @@ public class InsetsSourceConsumer {
|
|||||||
*/
|
*/
|
||||||
private boolean mIsAnimationPending;
|
private boolean mIsAnimationPending;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type The {@link InternalInsetsType} of the consumed insets.
|
||||||
|
* @param state The current {@link InsetsState} of the consumed insets.
|
||||||
|
* @param transactionSupplier The source of new {@link Transaction} instances. The supplier
|
||||||
|
* must provide *new* instances, which will be explicitly closed by this class.
|
||||||
|
* @param controller The {@link InsetsController} to use for insets interaction.
|
||||||
|
*/
|
||||||
public InsetsSourceConsumer(@InternalInsetsType int type, InsetsState state,
|
public InsetsSourceConsumer(@InternalInsetsType int type, InsetsState state,
|
||||||
Supplier<Transaction> transactionSupplier, InsetsController controller) {
|
Supplier<Transaction> transactionSupplier, InsetsController controller) {
|
||||||
mType = type;
|
mType = type;
|
||||||
@@ -390,16 +397,17 @@ public class InsetsSourceConsumer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Transaction t = mTransactionSupplier.get();
|
try (Transaction t = mTransactionSupplier.get()) {
|
||||||
if (DEBUG) Log.d(TAG, "applyRequestedVisibilityToControl: " + mRequestedVisible);
|
if (DEBUG) Log.d(TAG, "applyRequestedVisibilityToControl: " + mRequestedVisible);
|
||||||
if (mRequestedVisible) {
|
if (mRequestedVisible) {
|
||||||
t.show(mSourceControl.getLeash());
|
t.show(mSourceControl.getLeash());
|
||||||
} else {
|
} else {
|
||||||
t.hide(mSourceControl.getLeash());
|
t.hide(mSourceControl.getLeash());
|
||||||
|
}
|
||||||
|
// Ensure the alpha value is aligned with the actual requested visibility.
|
||||||
|
t.setAlpha(mSourceControl.getLeash(), mRequestedVisible ? 1 : 0);
|
||||||
|
t.apply();
|
||||||
}
|
}
|
||||||
// Ensure the alpha value is aligned with the actual requested visibility.
|
|
||||||
t.setAlpha(mSourceControl.getLeash(), mRequestedVisible ? 1 : 0);
|
|
||||||
t.apply();
|
|
||||||
onPerceptible(mRequestedVisible);
|
onPerceptible(mRequestedVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,10 +65,12 @@ public class SyncRtSurfaceTransactionApplier {
|
|||||||
applyParams(t, params);
|
applyParams(t, params);
|
||||||
|
|
||||||
mTargetViewRootImpl.registerRtFrameCallback(frame -> {
|
mTargetViewRootImpl.registerRtFrameCallback(frame -> {
|
||||||
if (mTargetSc == null || !mTargetSc.isValid()) {
|
if (mTargetSc != null && mTargetSc.isValid()) {
|
||||||
return;
|
applyTransaction(t, frame);
|
||||||
}
|
}
|
||||||
applyTransaction(t, frame);
|
// The transaction was either dropped, successfully applied, or merged with a future
|
||||||
|
// transaction, so we can safely release its resources.
|
||||||
|
t.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Make sure a frame gets scheduled.
|
// Make sure a frame gets scheduled.
|
||||||
|
|||||||
@@ -4178,7 +4178,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
+ " didProduceBuffer=" + didProduceBuffer);
|
+ " didProduceBuffer=" + didProduceBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
Transaction tmpTransaction = new Transaction();
|
final Transaction tmpTransaction = new Transaction();
|
||||||
tmpTransaction.merge(mRtBLASTSyncTransaction);
|
tmpTransaction.merge(mRtBLASTSyncTransaction);
|
||||||
|
|
||||||
// If frame wasn't drawn, clear out the next transaction so it doesn't affect the next
|
// If frame wasn't drawn, clear out the next transaction so it doesn't affect the next
|
||||||
@@ -4209,6 +4209,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
blastSyncConsumer.accept(mSurfaceChangedTransaction);
|
blastSyncConsumer.accept(mSurfaceChangedTransaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tmpTransaction.close();
|
||||||
|
|
||||||
if (reportNextDraw) {
|
if (reportNextDraw) {
|
||||||
pendingDrawFinished();
|
pendingDrawFinished();
|
||||||
|
|||||||
Reference in New Issue
Block a user