下面列出了android.view.SurfaceControl#mergeToGlobalTransaction ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private boolean updateVisibility() {
if (mHiddenForCrop || mHiddenForOtherReasons) {
if (mSurfaceShown) {
hideSurface(mTmpTransaction);
SurfaceControl.mergeToGlobalTransaction(mTmpTransaction);
}
return false;
} else {
if (!mSurfaceShown) {
return showSurface();
} else {
return true;
}
}
}
private void applySurfaceChangesTransaction(boolean recoveringMemory, int defaultDw,
int defaultDh) {
mHoldScreenWindow = null;
mObscuringWindow = null;
// TODO(multi-display): Support these features on secondary screens.
if (mService.mWatermark != null) {
mService.mWatermark.positionSurface(defaultDw, defaultDh);
}
if (mService.mStrictModeFlash != null) {
mService.mStrictModeFlash.positionSurface(defaultDw, defaultDh);
}
if (mService.mCircularDisplayMask != null) {
mService.mCircularDisplayMask.positionSurface(defaultDw, defaultDh,
mService.getDefaultDisplayRotation());
}
if (mService.mEmulatorDisplayOverlay != null) {
mService.mEmulatorDisplayOverlay.positionSurface(defaultDw, defaultDh,
mService.getDefaultDisplayRotation());
}
boolean focusDisplayed = false;
final int count = mChildren.size();
for (int j = 0; j < count; ++j) {
final DisplayContent dc = mChildren.get(j);
focusDisplayed |= dc.applySurfaceChangesTransaction(recoveringMemory);
}
if (focusDisplayed) {
mService.mH.sendEmptyMessage(REPORT_LOSING_FOCUS);
}
// Give the display manager a chance to adjust properties like display rotation if it needs
// to.
mService.mDisplayManagerInternal.performTraversal(mDisplayTransaction);
SurfaceControl.mergeToGlobalTransaction(mDisplayTransaction);
}
/**
* TODO: Once we totally eliminate global transaction we will pass transaction in here
* rather than merging to global.
*/
void prepareSurfaces() {
SurfaceControl.mergeToGlobalTransaction(getPendingTransaction());
// If a leash has been set when the transaction was committed, then the leash reparent has
// been committed.
mCommittedReparentToAnimationLeash = mSurfaceAnimator.hasLeash();
for (int i = 0; i < mChildren.size(); i++) {
mChildren.get(i).prepareSurfaces();
}
}
void hide(String reason) {
hide(mTmpTransaction, reason);
SurfaceControl.mergeToGlobalTransaction(mTmpTransaction);
}