Propagate light nav bar info
When SystemUI (notification UI) is pulled down, the windows behind are dimmed, including navigation bar. At this point of time, navigationbar color could be controlled by IME and system overrides it. With this fix, we check if IME is already controlling navbar color. Change-Id: I9f25860a5b7858f1d17d2921816910a938c656bb Fix: 122439339 Test: Manually verified using steps in bug.
This commit is contained in:
@@ -50,9 +50,11 @@ oneway interface IStatusBar
|
||||
* @param mask which flags to change
|
||||
* @param fullscreenBounds the current bounds of the fullscreen stack, in screen coordinates
|
||||
* @param dockedBounds the current bounds of the docked stack, in screen coordinates
|
||||
* @param navbarColorManagedByIme {@code true} if navigation bar color is managed by IME.
|
||||
*/
|
||||
void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis, int dockedStackVis,
|
||||
int mask, in Rect fullscreenBounds, in Rect dockedBounds);
|
||||
int mask, in Rect fullscreenBounds, in Rect dockedBounds,
|
||||
boolean navbarColorManagedByIme);
|
||||
|
||||
void topAppWindowChanged(int displayId, boolean menuVisible);
|
||||
void setImeWindowStatus(int displayId, in IBinder token, int vis, int backDisposition,
|
||||
|
||||
@@ -39,12 +39,13 @@ public final class RegisterStatusBarResult implements Parcelable {
|
||||
public final IBinder mImeToken;
|
||||
public final Rect mFullscreenStackBounds;
|
||||
public final Rect mDockedStackBounds;
|
||||
public final boolean mNavbarColorManagedByIme;
|
||||
|
||||
public RegisterStatusBarResult(ArrayMap<String, StatusBarIcon> icons, int disabledFlags1,
|
||||
int systemUiVisibility, boolean menuVisible, int imeWindowVis, int imeBackDisposition,
|
||||
boolean showImeSwitcher, int disabledFlags2, int fullscreenStackSysUiVisibility,
|
||||
int dockedStackSysUiVisibility, IBinder imeToken, Rect fullscreenStackBounds,
|
||||
Rect dockedStackBounds) {
|
||||
Rect dockedStackBounds, boolean navbarColorManagedByIme) {
|
||||
mIcons = new ArrayMap<>(icons);
|
||||
mDisabledFlags1 = disabledFlags1;
|
||||
mSystemUiVisibility = systemUiVisibility;
|
||||
@@ -58,6 +59,7 @@ public final class RegisterStatusBarResult implements Parcelable {
|
||||
mImeToken = imeToken;
|
||||
mFullscreenStackBounds = fullscreenStackBounds;
|
||||
mDockedStackBounds = dockedStackBounds;
|
||||
mNavbarColorManagedByIme = navbarColorManagedByIme;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,6 +82,7 @@ public final class RegisterStatusBarResult implements Parcelable {
|
||||
dest.writeStrongBinder(mImeToken);
|
||||
dest.writeTypedObject(mFullscreenStackBounds, flags);
|
||||
dest.writeTypedObject(mDockedStackBounds, flags);
|
||||
dest.writeBoolean(mNavbarColorManagedByIme);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,11 +106,12 @@ public final class RegisterStatusBarResult implements Parcelable {
|
||||
final IBinder imeToken = source.readStrongBinder();
|
||||
final Rect fullscreenStackBounds = source.readTypedObject(Rect.CREATOR);
|
||||
final Rect dockedStackBounds = source.readTypedObject(Rect.CREATOR);
|
||||
final boolean navbarColorManagedByIme = source.readBoolean();
|
||||
return new RegisterStatusBarResult(icons, disabledFlags1, systemUiVisibility,
|
||||
menuVisible, imeWindowVis, imeBackDisposition, showImeSwitcher,
|
||||
disabledFlags2, fullscreenStackSysUiVisibility,
|
||||
dockedStackSysUiVisibility, imeToken, fullscreenStackBounds,
|
||||
dockedStackBounds);
|
||||
dockedStackBounds, navbarColorManagedByIme);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,8 @@ public class RegisterStatusBarResultTest {
|
||||
0x80 /* dockedStackSysUiVisibility */,
|
||||
new Binder() /* imeToken */,
|
||||
new Rect(0x100, 0x200, 0x400, 0x800) /* fullscreenStackBounds */,
|
||||
new Rect(0x1000, 0x2000, 0x4000, 0x8000) /* dockedStackBounds */);
|
||||
new Rect(0x1000, 0x2000, 0x4000, 0x8000) /* dockedStackBounds */,
|
||||
true /* navbarColorManagedByIme */);
|
||||
|
||||
final RegisterStatusBarResult copy = clone(original);
|
||||
|
||||
@@ -80,6 +81,7 @@ public class RegisterStatusBarResultTest {
|
||||
assertThat(copy.mImeToken).isSameAs(original.mImeToken);
|
||||
assertThat(copy.mFullscreenStackBounds).isEqualTo(original.mFullscreenStackBounds);
|
||||
assertThat(copy.mDockedStackBounds).isEqualTo(original.mDockedStackBounds);
|
||||
assertThat(copy.mNavbarColorManagedByIme).isEqualTo(original.mNavbarColorManagedByIme);
|
||||
}
|
||||
|
||||
private RegisterStatusBarResult clone(RegisterStatusBarResult original) {
|
||||
|
||||
@@ -175,9 +175,11 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<
|
||||
* @param fullscreenStackBounds The current bounds of the fullscreen stack, in screen
|
||||
* coordinates.
|
||||
* @param dockedStackBounds The current bounds of the docked stack, in screen coordinates.
|
||||
* @param navbarColorManagedByIme {@code true} if navigation bar color is managed by IME.
|
||||
*/
|
||||
default void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
|
||||
int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
|
||||
int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds,
|
||||
boolean navbarColorManagedByIme) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -459,7 +461,8 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<
|
||||
|
||||
@Override
|
||||
public void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
|
||||
int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
|
||||
int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds,
|
||||
boolean navbarColorManagedByIme) {
|
||||
synchronized (mLock) {
|
||||
// Don't coalesce these, since it might have one time flags set such as
|
||||
// STATUS_BAR_UNHIDE which might get lost.
|
||||
@@ -469,6 +472,7 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<
|
||||
args.argi3 = fullscreenStackVis;
|
||||
args.argi4 = dockedStackVis;
|
||||
args.argi5 = mask;
|
||||
args.argi6 = navbarColorManagedByIme ? 1 : 0;
|
||||
args.arg1 = fullscreenStackBounds;
|
||||
args.arg2 = dockedStackBounds;
|
||||
mHandler.obtainMessage(MSG_SET_SYSTEMUI_VISIBILITY, args).sendToTarget();
|
||||
@@ -879,7 +883,8 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<
|
||||
args = (SomeArgs) msg.obj;
|
||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||
mCallbacks.get(i).setSystemUiVisibility(args.argi1, args.argi2, args.argi3,
|
||||
args.argi4, args.argi5, (Rect) args.arg1, (Rect) args.arg2);
|
||||
args.argi4, args.argi5, (Rect) args.arg1, (Rect) args.arg2,
|
||||
args.argi6 == 1);
|
||||
}
|
||||
args.recycle();
|
||||
break;
|
||||
|
||||
@@ -95,7 +95,8 @@ public class AutoHideController implements CommandQueue.Callbacks {
|
||||
|
||||
@Override
|
||||
public void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
|
||||
int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
|
||||
int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds,
|
||||
boolean navbarColorManagedByIme) {
|
||||
if (displayId != mDisplayId) {
|
||||
return;
|
||||
}
|
||||
@@ -119,7 +120,7 @@ public class AutoHideController implements CommandQueue.Callbacks {
|
||||
if (mSystemUiVisibility != newVal) {
|
||||
mCommandQueue.setSystemUiVisibility(mDisplayId, mSystemUiVisibility,
|
||||
fullscreenStackVis, dockedStackVis, mask, fullscreenStackBounds,
|
||||
dockedStackBounds);
|
||||
dockedStackBounds, navbarColorManagedByIme);
|
||||
}
|
||||
|
||||
notifySystemUiVisibilityChanged(mSystemUiVisibility);
|
||||
|
||||
@@ -79,6 +79,9 @@ public class LightBarController implements BatteryController.BatteryStateChangeC
|
||||
private final Rect mLastDockedBounds = new Rect();
|
||||
private boolean mQsCustomizing;
|
||||
|
||||
private boolean mDirectReplying;
|
||||
private boolean mNavbarColorManagedByIme;
|
||||
|
||||
@Inject
|
||||
public LightBarController(Context ctx, DarkIconDispatcher darkIconDispatcher,
|
||||
BatteryController batteryController) {
|
||||
@@ -100,7 +103,7 @@ public class LightBarController implements BatteryController.BatteryStateChangeC
|
||||
|
||||
public void onSystemUiVisibilityChanged(int fullscreenStackVis, int dockedStackVis,
|
||||
int mask, Rect fullscreenStackBounds, Rect dockedStackBounds, boolean sbModeChanged,
|
||||
int statusBarMode) {
|
||||
int statusBarMode, boolean navbarColorManagedByIme) {
|
||||
int oldFullscreen = mFullscreenStackVisibility;
|
||||
int newFullscreen = (oldFullscreen & ~mask) | (fullscreenStackVis & mask);
|
||||
int diffFullscreen = newFullscreen ^ oldFullscreen;
|
||||
@@ -122,12 +125,13 @@ public class LightBarController implements BatteryController.BatteryStateChangeC
|
||||
mFullscreenStackVisibility = newFullscreen;
|
||||
mDockedStackVisibility = newDocked;
|
||||
mLastStatusBarMode = statusBarMode;
|
||||
mNavbarColorManagedByIme = navbarColorManagedByIme;
|
||||
mLastFullscreenBounds.set(fullscreenStackBounds);
|
||||
mLastDockedBounds.set(dockedStackBounds);
|
||||
}
|
||||
|
||||
public void onNavigationVisibilityChanged(int vis, int mask, boolean nbModeChanged,
|
||||
int navigationBarMode) {
|
||||
int navigationBarMode, boolean navbarColorManagedByIme) {
|
||||
int oldVis = mSystemUiVisibility;
|
||||
int newVis = (oldVis & ~mask) | (vis & mask);
|
||||
int diffVis = newVis ^ oldVis;
|
||||
@@ -136,21 +140,24 @@ public class LightBarController implements BatteryController.BatteryStateChangeC
|
||||
boolean last = mNavigationLight;
|
||||
mHasLightNavigationBar = isLight(vis, navigationBarMode,
|
||||
View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
mNavigationLight = mHasLightNavigationBar && !mForceDarkForScrim && !mQsCustomizing;
|
||||
mNavigationLight = mHasLightNavigationBar
|
||||
&& (mDirectReplying && mNavbarColorManagedByIme || !mForceDarkForScrim)
|
||||
&& !mQsCustomizing;
|
||||
if (mNavigationLight != last) {
|
||||
updateNavigation();
|
||||
}
|
||||
}
|
||||
mSystemUiVisibility = newVis;
|
||||
mLastNavigationBarMode = navigationBarMode;
|
||||
mNavbarColorManagedByIme = navbarColorManagedByIme;
|
||||
}
|
||||
|
||||
private void reevaluate() {
|
||||
onSystemUiVisibilityChanged(mFullscreenStackVisibility,
|
||||
mDockedStackVisibility, 0 /* mask */, mLastFullscreenBounds, mLastDockedBounds,
|
||||
true /* sbModeChange*/, mLastStatusBarMode);
|
||||
true /* sbModeChange*/, mLastStatusBarMode, mNavbarColorManagedByIme);
|
||||
onNavigationVisibilityChanged(mSystemUiVisibility, 0 /* mask */, true /* nbModeChanged */,
|
||||
mLastNavigationBarMode);
|
||||
mLastNavigationBarMode, mNavbarColorManagedByIme);
|
||||
}
|
||||
|
||||
public void setQsCustomizing(boolean customizing) {
|
||||
@@ -159,6 +166,16 @@ public class LightBarController implements BatteryController.BatteryStateChangeC
|
||||
reevaluate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the direct-reply is in use or not.
|
||||
* @param directReplying {@code true} when the direct-reply is in-use.
|
||||
*/
|
||||
public void setDirectReplying(boolean directReplying) {
|
||||
if (mDirectReplying == directReplying) return;
|
||||
mDirectReplying = directReplying;
|
||||
reevaluate();
|
||||
}
|
||||
|
||||
public void setScrimState(ScrimState scrimState, float scrimBehindAlpha,
|
||||
GradientColors scrimInFrontColor) {
|
||||
boolean forceDarkForScrimLast = mForceDarkForScrim;
|
||||
@@ -260,7 +277,9 @@ public class LightBarController implements BatteryController.BatteryStateChangeC
|
||||
pw.print(" mLastNavigationBarMode="); pw.println(mLastNavigationBarMode);
|
||||
|
||||
pw.print(" mForceDarkForScrim="); pw.print(mForceDarkForScrim);
|
||||
pw.print(" mQsCustomizing="); pw.println(mQsCustomizing);
|
||||
pw.print(" mQsCustomizing="); pw.print(mQsCustomizing);
|
||||
pw.print(" mDirectReplying="); pw.println(mDirectReplying);
|
||||
pw.print(" mNavbarColorManagedByIme="); pw.println(mNavbarColorManagedByIme);
|
||||
|
||||
pw.println();
|
||||
|
||||
|
||||
@@ -512,12 +512,13 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback
|
||||
mAutoHideController.touchAutoHide();
|
||||
|
||||
mLightBarController.onNavigationVisibilityChanged(mSystemUiVisibility, 0 /* mask */,
|
||||
true /* nbModeChanged */, mNavigationBarMode);
|
||||
true /* nbModeChanged */, mNavigationBarMode, false /* navbarColorManagedByIme */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
|
||||
int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
|
||||
int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds,
|
||||
boolean navbarColorManagedByIme) {
|
||||
if (displayId != mDisplayId) {
|
||||
return;
|
||||
}
|
||||
@@ -545,7 +546,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback
|
||||
}
|
||||
}
|
||||
mLightBarController.onNavigationVisibilityChanged(
|
||||
vis, mask, nbModeChanged, mNavigationBarMode);
|
||||
vis, mask, nbModeChanged, mNavigationBarMode, navbarColorManagedByIme);
|
||||
}
|
||||
|
||||
private @TransitionMode int computeBarMode(int oldVis, int newVis) {
|
||||
|
||||
@@ -710,7 +710,8 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
|
||||
setSystemUiVisibility(mDisplayId, result.mSystemUiVisibility,
|
||||
result.mFullscreenStackSysUiVisibility, result.mDockedStackSysUiVisibility,
|
||||
0xffffffff, result.mFullscreenStackBounds, result.mDockedStackBounds);
|
||||
0xffffffff, result.mFullscreenStackBounds, result.mDockedStackBounds,
|
||||
result.mNavbarColorManagedByIme);
|
||||
topAppWindowChanged(mDisplayId, result.mMenuVisible);
|
||||
// StatusBarManagerService has a back up of IME token and it's restored here.
|
||||
setImeWindowStatus(mDisplayId, result.mImeToken, result.mImeWindowVis,
|
||||
@@ -2089,7 +2090,8 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
|
||||
@Override // CommandQueue
|
||||
public void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
|
||||
int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds) {
|
||||
int dockedStackVis, int mask, Rect fullscreenStackBounds, Rect dockedStackBounds,
|
||||
boolean navbarColorManagedByIme) {
|
||||
if (displayId != mDisplayId) {
|
||||
return;
|
||||
}
|
||||
@@ -2126,7 +2128,8 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
}
|
||||
}
|
||||
mLightBarController.onSystemUiVisibilityChanged(fullscreenStackVis, dockedStackVis,
|
||||
mask, fullscreenStackBounds, dockedStackBounds, sbModeChanged, mStatusBarMode);
|
||||
mask, fullscreenStackBounds, dockedStackBounds, sbModeChanged, mStatusBarMode,
|
||||
navbarColorManagedByIme);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2247,11 +2250,12 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
Log.v(TAG, "setLightsOn(" + on + ")");
|
||||
if (on) {
|
||||
setSystemUiVisibility(mDisplayId, 0, 0, 0, View.SYSTEM_UI_FLAG_LOW_PROFILE,
|
||||
mLastFullscreenStackBounds, mLastDockedStackBounds);
|
||||
mLastFullscreenStackBounds, mLastDockedStackBounds,
|
||||
false /* navbarColorManagedByIme */);
|
||||
} else {
|
||||
setSystemUiVisibility(mDisplayId, View.SYSTEM_UI_FLAG_LOW_PROFILE, 0, 0,
|
||||
View.SYSTEM_UI_FLAG_LOW_PROFILE, mLastFullscreenStackBounds,
|
||||
mLastDockedStackBounds);
|
||||
mLastDockedStackBounds, false /* navbarColorManagedByIme */);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry.EditedSuggestionInfo;
|
||||
import com.android.systemui.statusbar.notification.row.wrapper.NotificationViewWrapper;
|
||||
import com.android.systemui.statusbar.notification.stack.StackStateAnimator;
|
||||
import com.android.systemui.statusbar.phone.LightBarController;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -516,10 +517,12 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
|
||||
private final Drawable mBackground;
|
||||
private RemoteInputView mRemoteInputView;
|
||||
boolean mShowImeOnInputConnection;
|
||||
private LightBarController mLightBarController;
|
||||
|
||||
public RemoteEditText(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mBackground = getBackground();
|
||||
mLightBarController = Dependency.get(LightBarController.class);
|
||||
}
|
||||
|
||||
private void defocusIfNeeded(boolean animate) {
|
||||
@@ -558,6 +561,9 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
|
||||
if (!focused) {
|
||||
defocusIfNeeded(true /* animate */);
|
||||
}
|
||||
if (!mRemoteInputView.mRemoved) {
|
||||
mLightBarController.setDirectReplying(focused);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -112,19 +112,19 @@ public class CommandQueueTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void testSetSystemUiVisibility() {
|
||||
Rect r = new Rect();
|
||||
mCommandQueue.setSystemUiVisibility(DEFAULT_DISPLAY, 1, 2, 3, 4, null, r);
|
||||
mCommandQueue.setSystemUiVisibility(DEFAULT_DISPLAY, 1, 2, 3, 4, null, r, false);
|
||||
waitForIdleSync();
|
||||
verify(mCallbacks).setSystemUiVisibility(eq(DEFAULT_DISPLAY), eq(1), eq(2), eq(3), eq(4),
|
||||
eq(null), eq(r));
|
||||
eq(null), eq(r), eq(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetSystemUiVisibilityForSecondaryDisplay() {
|
||||
Rect r = new Rect();
|
||||
mCommandQueue.setSystemUiVisibility(SECONDARY_DISPLAY, 1, 2, 3, 4, null, r);
|
||||
mCommandQueue.setSystemUiVisibility(SECONDARY_DISPLAY, 1, 2, 3, 4, null, r, false);
|
||||
waitForIdleSync();
|
||||
verify(mCallbacks).setSystemUiVisibility(eq(SECONDARY_DISPLAY), eq(1), eq(2), eq(3), eq(4),
|
||||
eq(null), eq(r));
|
||||
eq(null), eq(r), eq(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -70,7 +70,7 @@ public class AutoHideControllerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testSetSystemUiVisibilityEarlyReturnWithDifferentDisplay() {
|
||||
mAutoHideController.setSystemUiVisibility(1, 1, 2, 3, 4, null, new Rect());
|
||||
mAutoHideController.setSystemUiVisibility(1, 1, 2, 3, 4, null, new Rect(), false);
|
||||
|
||||
verify(mAutoHideController, never()).notifySystemUiVisibilityChanged(anyInt());
|
||||
}
|
||||
@@ -78,7 +78,8 @@ public class AutoHideControllerTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void testSetSystemUiVisibilityEarlyReturnWithSameVisibility() {
|
||||
mAutoHideController
|
||||
.setSystemUiVisibility(DEFAULT_DISPLAY, View.VISIBLE, 2, 3, 4, null, new Rect());
|
||||
.setSystemUiVisibility(
|
||||
DEFAULT_DISPLAY, View.VISIBLE, 2, 3, 4, null, new Rect(), false);
|
||||
|
||||
verify(mAutoHideController, never()).notifySystemUiVisibilityChanged(anyInt());
|
||||
}
|
||||
@@ -92,7 +93,7 @@ public class AutoHideControllerTest extends SysuiTestCase {
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN | View.STATUS_BAR_UNHIDE;
|
||||
|
||||
mAutoHideController.setSystemUiVisibility(
|
||||
DEFAULT_DISPLAY, expectedStatus, 2, 3, FULL_MASK, null, new Rect());
|
||||
DEFAULT_DISPLAY, expectedStatus, 2, 3, FULL_MASK, null, new Rect(), false);
|
||||
|
||||
assertEquals("System UI visibility should not be changed",
|
||||
expectedStatus, mAutoHideController.mSystemUiVisibility);
|
||||
@@ -109,7 +110,7 @@ public class AutoHideControllerTest extends SysuiTestCase {
|
||||
|
||||
mAutoHideController.setSystemUiVisibility(
|
||||
DEFAULT_DISPLAY, View.STATUS_BAR_UNHIDE | View.NAVIGATION_BAR_UNHIDE,
|
||||
2, 3, FULL_MASK, null, new Rect());
|
||||
2, 3, FULL_MASK, null, new Rect(), false);
|
||||
|
||||
int expectedStatus = View.VISIBLE;
|
||||
assertEquals(expectedStatus, mAutoHideController.mSystemUiVisibility);
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.android.systemui.SysuiTestCase;
|
||||
import com.android.systemui.statusbar.NotificationTestHelper;
|
||||
import com.android.systemui.statusbar.RemoteInputController;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.phone.LightBarController;
|
||||
import com.android.systemui.util.Assert;
|
||||
|
||||
import org.junit.After;
|
||||
@@ -67,6 +68,7 @@ public class RemoteInputViewTest extends SysuiTestCase {
|
||||
@Mock private RemoteInputController mController;
|
||||
@Mock private ShortcutManager mShortcutManager;
|
||||
@Mock private RemoteInputQuickSettingsDisabler mRemoteInputQuickSettingsDisabler;
|
||||
@Mock private LightBarController mLightBarController;
|
||||
private BlockingQueueIntentReceiver mReceiver;
|
||||
private RemoteInputView mView;
|
||||
|
||||
@@ -77,6 +79,8 @@ public class RemoteInputViewTest extends SysuiTestCase {
|
||||
|
||||
mDependency.injectTestDependency(RemoteInputQuickSettingsDisabler.class,
|
||||
mRemoteInputQuickSettingsDisabler);
|
||||
mDependency.injectTestDependency(LightBarController.class,
|
||||
mLightBarController);
|
||||
|
||||
mReceiver = new BlockingQueueIntentReceiver();
|
||||
mContext.registerReceiver(mReceiver, new IntentFilter(TEST_ACTION), null,
|
||||
|
||||
@@ -77,7 +77,8 @@ public interface StatusBarManagerInternal {
|
||||
void onCameraLaunchGestureDetected(int source);
|
||||
void topAppWindowChanged(int displayId, boolean menuVisible);
|
||||
void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis, int dockedStackVis,
|
||||
int mask, Rect fullscreenBounds, Rect dockedBounds, String cause);
|
||||
int mask, Rect fullscreenBounds, Rect dockedBounds, boolean isNavbarColorManagedByIme,
|
||||
String cause);
|
||||
void toggleSplitScreen();
|
||||
void appTransitionFinished(int displayId);
|
||||
|
||||
|
||||
@@ -262,9 +262,10 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
|
||||
@Override
|
||||
public void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
|
||||
int dockedStackVis, int mask, Rect fullscreenBounds, Rect dockedBounds,
|
||||
String cause) {
|
||||
boolean isNavbarColorManagedByIme, String cause) {
|
||||
StatusBarManagerService.this.setSystemUiVisibility(displayId, vis, fullscreenStackVis,
|
||||
dockedStackVis, mask, fullscreenBounds, dockedBounds, cause);
|
||||
dockedStackVis, mask, fullscreenBounds, dockedBounds, isNavbarColorManagedByIme,
|
||||
cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -872,11 +873,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
|
||||
public void setSystemUiVisibility(int displayId, int vis, int mask, String cause) {
|
||||
final UiState state = getUiState(displayId);
|
||||
setSystemUiVisibility(displayId, vis, 0, 0, mask,
|
||||
state.mFullscreenStackBounds, state.mDockedStackBounds, cause);
|
||||
state.mFullscreenStackBounds, state.mDockedStackBounds,
|
||||
state.mNavbarColorManagedByIme, cause);
|
||||
}
|
||||
|
||||
private void setSystemUiVisibility(int displayId, int vis, int fullscreenStackVis,
|
||||
int dockedStackVis, int mask, Rect fullscreenBounds, Rect dockedBounds, String cause) {
|
||||
int dockedStackVis, int mask, Rect fullscreenBounds, Rect dockedBounds,
|
||||
boolean isNavbarColorManagedByIme, String cause) {
|
||||
// also allows calls from window manager which is in this process.
|
||||
enforceStatusBarService();
|
||||
|
||||
@@ -884,7 +887,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
|
||||
|
||||
synchronized (mLock) {
|
||||
updateUiVisibilityLocked(displayId, vis, fullscreenStackVis, dockedStackVis, mask,
|
||||
fullscreenBounds, dockedBounds);
|
||||
fullscreenBounds, dockedBounds, isNavbarColorManagedByIme);
|
||||
disableLocked(
|
||||
displayId,
|
||||
mCurrentUserId,
|
||||
@@ -896,17 +899,19 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
|
||||
|
||||
private void updateUiVisibilityLocked(final int displayId, final int vis,
|
||||
final int fullscreenStackVis, final int dockedStackVis, final int mask,
|
||||
final Rect fullscreenBounds, final Rect dockedBounds) {
|
||||
final Rect fullscreenBounds, final Rect dockedBounds,
|
||||
final boolean isNavbarColorManagedByIme) {
|
||||
final UiState state = getUiState(displayId);
|
||||
if (!state.systemUiStateEquals(vis, fullscreenStackVis, dockedStackVis,
|
||||
fullscreenBounds, dockedBounds)) {
|
||||
fullscreenBounds, dockedBounds, isNavbarColorManagedByIme)) {
|
||||
state.setSystemUiState(vis, fullscreenStackVis, dockedStackVis, fullscreenBounds,
|
||||
dockedBounds);
|
||||
dockedBounds, isNavbarColorManagedByIme);
|
||||
mHandler.post(() -> {
|
||||
if (mBar != null) {
|
||||
try {
|
||||
mBar.setSystemUiVisibility(displayId, vis, fullscreenStackVis,
|
||||
dockedStackVis, mask, fullscreenBounds, dockedBounds);
|
||||
dockedStackVis, mask, fullscreenBounds, dockedBounds,
|
||||
isNavbarColorManagedByIme);
|
||||
} catch (RemoteException ex) {
|
||||
Log.w(TAG, "Can not get StatusBar!");
|
||||
}
|
||||
@@ -945,6 +950,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
|
||||
private int mImeBackDisposition = 0;
|
||||
private boolean mShowImeSwitcher = false;
|
||||
private IBinder mImeToken = null;
|
||||
private boolean mNavbarColorManagedByIme = false;
|
||||
|
||||
private int getDisabled1() {
|
||||
return mDisabled1;
|
||||
@@ -972,21 +978,25 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
|
||||
}
|
||||
|
||||
private void setSystemUiState(final int vis, final int fullscreenStackVis,
|
||||
final int dockedStackVis, final Rect fullscreenBounds, final Rect dockedBounds) {
|
||||
final int dockedStackVis, final Rect fullscreenBounds, final Rect dockedBounds,
|
||||
final boolean navbarColorManagedByIme) {
|
||||
mSystemUiVisibility = vis;
|
||||
mFullscreenStackSysUiVisibility = fullscreenStackVis;
|
||||
mDockedStackSysUiVisibility = dockedStackVis;
|
||||
mFullscreenStackBounds.set(fullscreenBounds);
|
||||
mDockedStackBounds.set(dockedBounds);
|
||||
mNavbarColorManagedByIme = navbarColorManagedByIme;
|
||||
}
|
||||
|
||||
private boolean systemUiStateEquals(final int vis, final int fullscreenStackVis,
|
||||
final int dockedStackVis, final Rect fullscreenBounds, final Rect dockedBounds) {
|
||||
final int dockedStackVis, final Rect fullscreenBounds, final Rect dockedBounds,
|
||||
final boolean navbarColorManagedByIme) {
|
||||
return mSystemUiVisibility == vis
|
||||
&& mFullscreenStackSysUiVisibility == fullscreenStackVis
|
||||
&& mDockedStackSysUiVisibility == dockedStackVis
|
||||
&& mFullscreenStackBounds.equals(fullscreenBounds)
|
||||
&& mDockedStackBounds.equals(dockedBounds);
|
||||
&& mDockedStackBounds.equals(dockedBounds)
|
||||
&& mNavbarColorManagedByIme == navbarColorManagedByIme;
|
||||
}
|
||||
|
||||
private void setImeWindowState(final int vis, final int backDisposition,
|
||||
@@ -1051,7 +1061,8 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
|
||||
state.mImeBackDisposition, state.mShowImeSwitcher,
|
||||
gatherDisableActionsLocked(mCurrentUserId, 2),
|
||||
state.mFullscreenStackSysUiVisibility, state.mDockedStackSysUiVisibility,
|
||||
state.mImeToken, state.mFullscreenStackBounds, state.mDockedStackBounds);
|
||||
state.mImeToken, state.mFullscreenStackBounds, state.mDockedStackBounds,
|
||||
state.mNavbarColorManagedByIme);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,6 @@ import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.Px;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerInternal;
|
||||
import android.app.ActivityThread;
|
||||
import android.app.LoadedApk;
|
||||
import android.app.ResourcesManager;
|
||||
@@ -133,6 +132,7 @@ import android.os.SystemClock;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Pair;
|
||||
import android.util.PrintWriterPrinter;
|
||||
import android.util.Slog;
|
||||
import android.view.DisplayCutout;
|
||||
@@ -3113,7 +3113,9 @@ public class DisplayPolicy {
|
||||
WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_HOME, mNonDockedStackBounds);
|
||||
mService.getStackBounds(
|
||||
WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_STANDARD, mDockedStackBounds);
|
||||
final int visibility = updateSystemBarsLw(win, mLastSystemUiFlags, tmpVisibility);
|
||||
final Pair<Integer, Boolean> result =
|
||||
updateSystemBarsLw(win, mLastSystemUiFlags, tmpVisibility);
|
||||
final int visibility = result.first;
|
||||
final int diff = visibility ^ mLastSystemUiFlags;
|
||||
final int fullscreenDiff = fullscreenVisibility ^ mLastFullscreenStackSysUiFlags;
|
||||
final int dockedDiff = dockedVisibility ^ mLastDockedStackSysUiFlags;
|
||||
@@ -3133,13 +3135,14 @@ public class DisplayPolicy {
|
||||
mLastDockedStackBounds.set(mDockedStackBounds);
|
||||
final Rect fullscreenStackBounds = new Rect(mNonDockedStackBounds);
|
||||
final Rect dockedStackBounds = new Rect(mDockedStackBounds);
|
||||
final boolean isNavbarColorManagedByIme = result.second;
|
||||
mHandler.post(() -> {
|
||||
StatusBarManagerInternal statusBar = getStatusBarManagerInternal();
|
||||
if (statusBar != null) {
|
||||
final int displayId = getDisplayId();
|
||||
statusBar.setSystemUiVisibility(displayId, visibility, fullscreenVisibility,
|
||||
dockedVisibility, 0xffffffff, fullscreenStackBounds,
|
||||
dockedStackBounds, win.toString());
|
||||
dockedStackBounds, isNavbarColorManagedByIme, win.toString());
|
||||
statusBar.topAppWindowChanged(displayId, needsMenu);
|
||||
}
|
||||
});
|
||||
@@ -3222,7 +3225,7 @@ public class DisplayPolicy {
|
||||
return vis;
|
||||
}
|
||||
|
||||
private int updateSystemBarsLw(WindowState win, int oldVis, int vis) {
|
||||
private Pair<Integer, Boolean> updateSystemBarsLw(WindowState win, int oldVis, int vis) {
|
||||
final boolean dockedStackVisible =
|
||||
mDisplayContent.isStackVisible(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
|
||||
final boolean freeformStackVisible =
|
||||
@@ -3355,8 +3358,11 @@ public class DisplayPolicy {
|
||||
vis = updateLightNavigationBarLw(vis, mTopFullscreenOpaqueWindowState,
|
||||
mTopFullscreenOpaqueOrDimmingWindowState,
|
||||
mDisplayContent.mInputMethodWindow, navColorWin);
|
||||
// Navbar color is controlled by the IME.
|
||||
final boolean isManagedByIme =
|
||||
navColorWin != null && navColorWin == mDisplayContent.mInputMethodWindow;
|
||||
|
||||
return vis;
|
||||
return Pair.create(vis, isManagedByIme);
|
||||
}
|
||||
|
||||
private boolean drawsBarBackground(int vis, WindowState win, BarController controller,
|
||||
|
||||
Reference in New Issue
Block a user