Calculate StatusBar height locally in Launcher
When reading the status bar inset on devices with multiple displays after switching the displays the inset is not updated immediately (SystemUI should update the height of the window first by reacting to the display switch in it's own process). Due to this race condition Launcher is very likely to calculate DeviceProfile with incorrect inset of the previous display first and update it to the correct one only after SystemUI finished the window update. To avoid this adding calculation of the StatusBar height to Launcher locally using the same utility method that is used by SystemUI. Bug: 264656380 Test: manual test that the statusbar height is calculated correctly in Launcher on a device with two displays, both on the inner and outer display and different rotations Change-Id: Ia16ecadd8fcac29082d27ca693ab7740ce6161c4
This commit is contained in:
1 parent
d96be3ebb4
commit
a8037620bd
2 files changed
+22
-4
No files matched your search
@@ -23,6 +23,7 @@ import android.view.Surface;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowMetrics;
|
||||
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.launcher3.util.WindowBounds;
|
||||
import com.android.launcher3.util.window.CachedDisplayInfo;
|
||||
import com.android.launcher3.util.window.WindowManagerProxy;
|
||||
@@ -44,6 +45,13 @@ public class SystemWindowManagerProxy extends WindowManagerProxy {
|
||||
.getRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getStatusBarHeight(Context context, boolean isPortrait, int statusBarInset) {
|
||||
// See b/264656380, calculate the status bar height manually as the inset in the system
|
||||
// server might not be updated by this point yet causing extra DeviceProfile updates
|
||||
return SystemBarUtils.getStatusBarHeight(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayMap<CachedDisplayInfo, WindowBounds[]> estimateInternalDisplayBounds(
|
||||
Context displayInfoContext) {
|
||||
|
||||
Reference in new issue
Block a user