Loading core/java/android/view/InsetsController.java +11 −7 Original line number Original line Diff line number Diff line Loading @@ -568,15 +568,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private void updateState(InsetsState newState) { private void updateState(InsetsState newState) { mState.setDisplayFrame(newState.getDisplayFrame()); mState.setDisplayFrame(newState.getDisplayFrame()); for (int i = newState.getSourcesCount() - 1; i >= 0; i--) { for (int i = newState.getSourcesCount() - 1; i >= 0; i--) { final InsetsSource source = newState.sourceAt(i); InsetsSource source = newState.sourceAt(i); final int type = source.getType(); getSourceConsumer(source.getType()).updateSource(source); final InsetsSourceConsumer consumer = getSourceConsumer(type); consumer.updateSource(source); mHost.updateCompatSysUiVisibility(type, source.isVisible(), consumer.getControl() != null); } } for (int i = mState.getSourcesCount() - 1; i >= 0; i--) { for (int i = mState.getSourcesCount() - 1; i >= 0; i--) { final InsetsSource source = mState.sourceAt(i); InsetsSource source = mState.sourceAt(i); if (newState.peekSource(source.getType()) == null) { if (newState.peekSource(source.getType()) == null) { mState.removeSource(source.getType()); mState.removeSource(source.getType()); } } Loading Loading @@ -1010,6 +1006,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation updateRequestedState(); updateRequestedState(); } } /** * @see ViewRootImpl#updateCompatSysUiVisibility(int, boolean, boolean) */ public void updateCompatSysUiVisibility(@InternalInsetsType int type, boolean visible, boolean hasControl) { mHost.updateCompatSysUiVisibility(type, visible, hasControl); } /** /** * Called when current window gains focus. * Called when current window gains focus. */ */ Loading core/java/android/view/InsetsSourceConsumer.java +12 −3 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.view; import static android.view.InsetsController.ANIMATION_TYPE_NONE; import static android.view.InsetsController.ANIMATION_TYPE_NONE; import static android.view.InsetsController.AnimationType; import static android.view.InsetsController.AnimationType; import static android.view.InsetsState.getDefaultVisibility; import static android.view.InsetsState.toPublicType; import static android.view.InsetsState.toPublicType; import android.annotation.IntDef; import android.annotation.IntDef; Loading Loading @@ -82,7 +83,7 @@ public class InsetsSourceConsumer { mState = state; mState = state; mTransactionSupplier = transactionSupplier; mTransactionSupplier = transactionSupplier; mController = controller; mController = controller; mRequestedVisible = InsetsState.getDefaultVisibility(type); mRequestedVisible = getDefaultVisibility(type); } } /** /** Loading Loading @@ -200,12 +201,20 @@ public class InsetsSourceConsumer { } } boolean applyLocalVisibilityOverride() { boolean applyLocalVisibilityOverride() { final InsetsSource source = mState.peekSource(mType); final boolean isVisible = source != null ? source.isVisible() : getDefaultVisibility(mType); final boolean hasControl = mSourceControl != null; // We still need to let the legacy app know the visibility change even if we don't have the // control. mController.updateCompatSysUiVisibility( mType, hasControl ? mRequestedVisible : isVisible, hasControl); // If we don't have control, we are not able to change the visibility. // If we don't have control, we are not able to change the visibility. if (mSourceControl == null) { if (!hasControl) { return false; return false; } } if (mState.getSource(mType).isVisible() == mRequestedVisible) { if (isVisible == mRequestedVisible) { return false; return false; } } mState.getSource(mType).setVisible(mRequestedVisible); mState.getSource(mType).setVisible(mRequestedVisible); Loading core/java/android/view/ViewRootImpl.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -1977,6 +1977,7 @@ public final class ViewRootImpl implements ViewParent, (mCompatibleVisibilityInfo.globalVisibility & ~View.SYSTEM_UI_FLAG_LOW_PROFILE) (mCompatibleVisibilityInfo.globalVisibility & ~View.SYSTEM_UI_FLAG_LOW_PROFILE) | (mAttachInfo.mSystemUiVisibility & View.SYSTEM_UI_FLAG_LOW_PROFILE); | (mAttachInfo.mSystemUiVisibility & View.SYSTEM_UI_FLAG_LOW_PROFILE); if (mDispatchedSystemUiVisibility != mCompatibleVisibilityInfo.globalVisibility) { if (mDispatchedSystemUiVisibility != mCompatibleVisibilityInfo.globalVisibility) { mHandler.removeMessages(MSG_DISPATCH_SYSTEM_UI_VISIBILITY); mHandler.sendMessage(mHandler.obtainMessage( mHandler.sendMessage(mHandler.obtainMessage( MSG_DISPATCH_SYSTEM_UI_VISIBILITY, mCompatibleVisibilityInfo)); MSG_DISPATCH_SYSTEM_UI_VISIBILITY, mCompatibleVisibilityInfo)); } } Loading Loading @@ -2031,8 +2032,10 @@ public final class ViewRootImpl implements ViewParent, } } } else { } else { info.globalVisibility |= systemUiFlag; info.globalVisibility |= systemUiFlag; info.localChanges &= ~systemUiFlag; } } if (mDispatchedSystemUiVisibility != info.globalVisibility) { if (mDispatchedSystemUiVisibility != info.globalVisibility) { mHandler.removeMessages(MSG_DISPATCH_SYSTEM_UI_VISIBILITY); mHandler.sendMessage(mHandler.obtainMessage(MSG_DISPATCH_SYSTEM_UI_VISIBILITY, info)); mHandler.sendMessage(mHandler.obtainMessage(MSG_DISPATCH_SYSTEM_UI_VISIBILITY, info)); } } } } Loading Loading
core/java/android/view/InsetsController.java +11 −7 Original line number Original line Diff line number Diff line Loading @@ -568,15 +568,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private void updateState(InsetsState newState) { private void updateState(InsetsState newState) { mState.setDisplayFrame(newState.getDisplayFrame()); mState.setDisplayFrame(newState.getDisplayFrame()); for (int i = newState.getSourcesCount() - 1; i >= 0; i--) { for (int i = newState.getSourcesCount() - 1; i >= 0; i--) { final InsetsSource source = newState.sourceAt(i); InsetsSource source = newState.sourceAt(i); final int type = source.getType(); getSourceConsumer(source.getType()).updateSource(source); final InsetsSourceConsumer consumer = getSourceConsumer(type); consumer.updateSource(source); mHost.updateCompatSysUiVisibility(type, source.isVisible(), consumer.getControl() != null); } } for (int i = mState.getSourcesCount() - 1; i >= 0; i--) { for (int i = mState.getSourcesCount() - 1; i >= 0; i--) { final InsetsSource source = mState.sourceAt(i); InsetsSource source = mState.sourceAt(i); if (newState.peekSource(source.getType()) == null) { if (newState.peekSource(source.getType()) == null) { mState.removeSource(source.getType()); mState.removeSource(source.getType()); } } Loading Loading @@ -1010,6 +1006,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation updateRequestedState(); updateRequestedState(); } } /** * @see ViewRootImpl#updateCompatSysUiVisibility(int, boolean, boolean) */ public void updateCompatSysUiVisibility(@InternalInsetsType int type, boolean visible, boolean hasControl) { mHost.updateCompatSysUiVisibility(type, visible, hasControl); } /** /** * Called when current window gains focus. * Called when current window gains focus. */ */ Loading
core/java/android/view/InsetsSourceConsumer.java +12 −3 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.view; import static android.view.InsetsController.ANIMATION_TYPE_NONE; import static android.view.InsetsController.ANIMATION_TYPE_NONE; import static android.view.InsetsController.AnimationType; import static android.view.InsetsController.AnimationType; import static android.view.InsetsState.getDefaultVisibility; import static android.view.InsetsState.toPublicType; import static android.view.InsetsState.toPublicType; import android.annotation.IntDef; import android.annotation.IntDef; Loading Loading @@ -82,7 +83,7 @@ public class InsetsSourceConsumer { mState = state; mState = state; mTransactionSupplier = transactionSupplier; mTransactionSupplier = transactionSupplier; mController = controller; mController = controller; mRequestedVisible = InsetsState.getDefaultVisibility(type); mRequestedVisible = getDefaultVisibility(type); } } /** /** Loading Loading @@ -200,12 +201,20 @@ public class InsetsSourceConsumer { } } boolean applyLocalVisibilityOverride() { boolean applyLocalVisibilityOverride() { final InsetsSource source = mState.peekSource(mType); final boolean isVisible = source != null ? source.isVisible() : getDefaultVisibility(mType); final boolean hasControl = mSourceControl != null; // We still need to let the legacy app know the visibility change even if we don't have the // control. mController.updateCompatSysUiVisibility( mType, hasControl ? mRequestedVisible : isVisible, hasControl); // If we don't have control, we are not able to change the visibility. // If we don't have control, we are not able to change the visibility. if (mSourceControl == null) { if (!hasControl) { return false; return false; } } if (mState.getSource(mType).isVisible() == mRequestedVisible) { if (isVisible == mRequestedVisible) { return false; return false; } } mState.getSource(mType).setVisible(mRequestedVisible); mState.getSource(mType).setVisible(mRequestedVisible); Loading
core/java/android/view/ViewRootImpl.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -1977,6 +1977,7 @@ public final class ViewRootImpl implements ViewParent, (mCompatibleVisibilityInfo.globalVisibility & ~View.SYSTEM_UI_FLAG_LOW_PROFILE) (mCompatibleVisibilityInfo.globalVisibility & ~View.SYSTEM_UI_FLAG_LOW_PROFILE) | (mAttachInfo.mSystemUiVisibility & View.SYSTEM_UI_FLAG_LOW_PROFILE); | (mAttachInfo.mSystemUiVisibility & View.SYSTEM_UI_FLAG_LOW_PROFILE); if (mDispatchedSystemUiVisibility != mCompatibleVisibilityInfo.globalVisibility) { if (mDispatchedSystemUiVisibility != mCompatibleVisibilityInfo.globalVisibility) { mHandler.removeMessages(MSG_DISPATCH_SYSTEM_UI_VISIBILITY); mHandler.sendMessage(mHandler.obtainMessage( mHandler.sendMessage(mHandler.obtainMessage( MSG_DISPATCH_SYSTEM_UI_VISIBILITY, mCompatibleVisibilityInfo)); MSG_DISPATCH_SYSTEM_UI_VISIBILITY, mCompatibleVisibilityInfo)); } } Loading Loading @@ -2031,8 +2032,10 @@ public final class ViewRootImpl implements ViewParent, } } } else { } else { info.globalVisibility |= systemUiFlag; info.globalVisibility |= systemUiFlag; info.localChanges &= ~systemUiFlag; } } if (mDispatchedSystemUiVisibility != info.globalVisibility) { if (mDispatchedSystemUiVisibility != info.globalVisibility) { mHandler.removeMessages(MSG_DISPATCH_SYSTEM_UI_VISIBILITY); mHandler.sendMessage(mHandler.obtainMessage(MSG_DISPATCH_SYSTEM_UI_VISIBILITY, info)); mHandler.sendMessage(mHandler.obtainMessage(MSG_DISPATCH_SYSTEM_UI_VISIBILITY, info)); } } } } Loading