Merge "Fix entry bounds for 3 button nav" into tm-qpr-dev am: 321127d14a

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21847300

Change-Id: I2a4dafc799be1cc58b4cf54062571a7b39a5de6d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Mateusz Cicheński
2023-03-09 00:12:54 +00:00
committed by Automerger Merge Worker
2 changed files with 47 additions and 10 deletions

View File

@@ -83,7 +83,6 @@ import android.view.Display;
import android.view.HapticFeedbackConstants;
import android.view.RemoteAnimationTarget;
import android.view.View;
import android.view.WindowManagerGlobal;
import android.window.BackEvent;
import android.window.OnBackAnimationCallback;
import android.window.OnBackInvokedDispatcher;
@@ -421,15 +420,18 @@ public class QuickstepLauncher extends Launcher {
*/
private void onStateOrResumeChanging(boolean inTransition) {
LauncherState state = getStateManager().getState();
if (!ENABLE_PIP_KEEP_CLEAR_ALGORITHM) {
boolean started = ((getActivityFlags() & ACTIVITY_STATE_STARTED)) != 0;
if (started) {
DeviceProfile profile = getDeviceProfile();
boolean willUserBeActive =
(getActivityFlags() & ACTIVITY_STATE_USER_WILL_BE_ACTIVE) != 0;
boolean visible = (state == NORMAL || state == OVERVIEW)
&& (willUserBeActive || isUserActive())
&& !profile.isVerticalBarLayout();
boolean started = ((getActivityFlags() & ACTIVITY_STATE_STARTED)) != 0;
if (started) {
DeviceProfile profile = getDeviceProfile();
boolean willUserBeActive =
(getActivityFlags() & ACTIVITY_STATE_USER_WILL_BE_ACTIVE) != 0;
boolean visible = (state == NORMAL || state == OVERVIEW)
&& (willUserBeActive || isUserActive())
&& !profile.isVerticalBarLayout();
if (ENABLE_PIP_KEEP_CLEAR_ALGORITHM) {
SystemUiProxy.INSTANCE.get(this)
.setLauncherKeepClearAreaHeight(visible, profile.hotseatBarSizePx);
} else {
SystemUiProxy.INSTANCE.get(this).setShelfHeight(visible, profile.hotseatBarSizePx);
}
}

View File

@@ -87,6 +87,7 @@ public class SystemUiProxy implements ISystemUiProxy {
new MainThreadInitializedObject<>(SystemUiProxy::new);
private static final int MSG_SET_SHELF_HEIGHT = 1;
private static final int MSG_SET_LAUNCHER_KEEP_CLEAR_AREA_HEIGHT = 2;
private ISystemUiProxy mSystemUiProxy;
private IPip mPip;
@@ -121,6 +122,10 @@ public class SystemUiProxy implements ISystemUiProxy {
private int mLastShelfHeight;
private boolean mLastShelfVisible;
// Used to dedupe calls to SystemUI
private int mLastLauncherKeepClearAreaHeight;
private boolean mLastLauncherKeepClearAreaHeightVisible;
private final Context mContext;
private final Handler mAsyncHandler;
@@ -453,6 +458,33 @@ public class SystemUiProxy implements ISystemUiProxy {
}
}
/**
* Sets the height of the keep clear area that is going to be reported by
* the Launcher for the Hotseat.
*/
public void setLauncherKeepClearAreaHeight(boolean visible, int height) {
Message.obtain(mAsyncHandler, MSG_SET_LAUNCHER_KEEP_CLEAR_AREA_HEIGHT,
visible ? 1 : 0 , height).sendToTarget();
}
@WorkerThread
private void setLauncherKeepClearAreaHeight(int visibleInt, int height) {
boolean visible = visibleInt != 0;
boolean changed = visible != mLastLauncherKeepClearAreaHeightVisible
|| height != mLastLauncherKeepClearAreaHeight;
IPip pip = mPip;
if (pip != null && changed) {
mLastLauncherKeepClearAreaHeightVisible = visible;
mLastLauncherKeepClearAreaHeight = height;
try {
pip.setLauncherKeepClearAreaHeight(visible, height);
} catch (RemoteException e) {
Log.w(TAG, "Failed call setLauncherKeepClearAreaHeight visible: " + visible
+ " height: " + height, e);
}
}
}
/**
* Sets listener to get pip animation callbacks.
*/
@@ -945,6 +977,9 @@ public class SystemUiProxy implements ISystemUiProxy {
case MSG_SET_SHELF_HEIGHT:
setShelfHeightAsync(msg.arg1, msg.arg2);
return true;
case MSG_SET_LAUNCHER_KEEP_CLEAR_AREA_HEIGHT:
setLauncherKeepClearAreaHeight(msg.arg1, msg.arg2);
return true;
}
return false;