Merge changes from topic "immersive" into rvc-dev
* changes: Add test api getStatus/NavigationBarBackgroundView. Notify the visibility change to update color views without control.
This commit is contained in:
@@ -4966,6 +4966,11 @@ package android.view {
|
|||||||
method @Nullable public static AutoCloseable startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.concurrent.Callable<java.io.OutputStream>);
|
method @Nullable public static AutoCloseable startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.concurrent.Callable<java.io.OutputStream>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract class Window {
|
||||||
|
method @Nullable public android.view.View getNavigationBarBackgroundView();
|
||||||
|
method @Nullable public android.view.View getStatusBarBackgroundView();
|
||||||
|
}
|
||||||
|
|
||||||
public interface WindowManager extends android.view.ViewManager {
|
public interface WindowManager extends android.view.ViewManager {
|
||||||
method public default void setShouldShowIme(int, boolean);
|
method public default void setShouldShowIme(int, boolean);
|
||||||
method public default void setShouldShowSystemDecors(int, boolean);
|
method public default void setShouldShowSystemDecors(int, boolean);
|
||||||
|
|||||||
@@ -200,6 +200,15 @@ public class InsetsSourceConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean applyLocalVisibilityOverride() {
|
boolean applyLocalVisibilityOverride() {
|
||||||
|
return applyLocalVisibilityOverride(false /* notifyWithoutControl */);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param notifyWithoutControl set it true when the caller wants to notify the visibility
|
||||||
|
* changes even if the consumer doesn't have the control.
|
||||||
|
* @return true if it needs to notify the visibility changes to the controller
|
||||||
|
*/
|
||||||
|
private boolean applyLocalVisibilityOverride(boolean notifyWithoutControl) {
|
||||||
InsetsSource source = mState.peekSource(mType);
|
InsetsSource source = mState.peekSource(mType);
|
||||||
final boolean isVisible = source != null && source.isVisible();
|
final boolean isVisible = source != null && source.isVisible();
|
||||||
final boolean hasControl = mSourceControl != null;
|
final boolean hasControl = mSourceControl != null;
|
||||||
@@ -211,7 +220,7 @@ public class InsetsSourceConsumer {
|
|||||||
|
|
||||||
// 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 (!hasControl) {
|
if (!hasControl) {
|
||||||
return false;
|
return notifyWithoutControl;
|
||||||
}
|
}
|
||||||
if (isVisible == mRequestedVisible) {
|
if (isVisible == mRequestedVisible) {
|
||||||
return false;
|
return false;
|
||||||
@@ -293,7 +302,9 @@ public class InsetsSourceConsumer {
|
|||||||
mRequestedVisible = requestedVisible;
|
mRequestedVisible = requestedVisible;
|
||||||
mIsAnimationPending = false;
|
mIsAnimationPending = false;
|
||||||
}
|
}
|
||||||
if (applyLocalVisibilityOverride()) {
|
// We need to notify the visibility changed even if we don't have mSourceControl in order
|
||||||
|
// to update color views.
|
||||||
|
if (applyLocalVisibilityOverride(true /* notifyWithoutControl */)) {
|
||||||
mController.notifyVisibilityChanged();
|
mController.notifyVisibilityChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import android.annotation.NonNull;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.StyleRes;
|
import android.annotation.StyleRes;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
|
import android.annotation.TestApi;
|
||||||
import android.app.WindowConfiguration;
|
import android.app.WindowConfiguration;
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
import android.compat.annotation.UnsupportedAppUsage;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -1794,6 +1795,24 @@ public abstract class Window {
|
|||||||
*/
|
*/
|
||||||
public abstract @NonNull View getDecorView();
|
public abstract @NonNull View getDecorView();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the status bar background view or null.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
|
public @Nullable View getStatusBarBackgroundView() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the navigation bar background view or null.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
|
public @Nullable View getNavigationBarBackgroundView() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the current decor view, but only if it has already been created;
|
* Retrieve the current decor view, but only if it has already been created;
|
||||||
* otherwise returns null.
|
* otherwise returns null.
|
||||||
|
|||||||
@@ -324,6 +324,14 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
|
|||||||
return mBackgroundFallback.getDrawable();
|
return mBackgroundFallback.getDrawable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable View getStatusBarBackgroundView() {
|
||||||
|
return mStatusColorViewState.view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable View getNavigationBarBackgroundView() {
|
||||||
|
return mNavigationColorViewState.view;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean gatherTransparentRegion(Region region) {
|
public boolean gatherTransparentRegion(Region region) {
|
||||||
boolean statusOpaque = gatherTransparentRegion(mStatusColorViewState, region);
|
boolean statusOpaque = gatherTransparentRegion(mStatusColorViewState, region);
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
|
|||||||
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
|
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
import android.app.SearchManager;
|
import android.app.SearchManager;
|
||||||
@@ -3949,4 +3950,16 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
public void removeScrollCaptureCallback(@NonNull ScrollCaptureCallback callback) {
|
public void removeScrollCaptureCallback(@NonNull ScrollCaptureCallback callback) {
|
||||||
getViewRootImpl().removeScrollCaptureCallback(callback);
|
getViewRootImpl().removeScrollCaptureCallback(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public View getStatusBarBackgroundView() {
|
||||||
|
return mDecor != null ? mDecor.getStatusBarBackgroundView() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public View getNavigationBarBackgroundView() {
|
||||||
|
return mDecor != null ? mDecor.getNavigationBarBackgroundView() : null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user