Merge "Hide shelf in 2-Button Landscape" into ub-launcher3-rvc-dev
This commit is contained in:
+3
-1
@@ -217,7 +217,9 @@ public class QuickstepLauncher extends BaseQuickstepLauncher {
|
||||
break;
|
||||
}
|
||||
case OVERVIEW_STATE_ORDINAL: {
|
||||
DiscoveryBounce.showForOverviewIfNeeded(this);
|
||||
RecentsView recentsView = getOverviewPanel();
|
||||
DiscoveryBounce.showForOverviewIfNeeded(this,
|
||||
recentsView.getPagedOrientationHandler());
|
||||
RecentsView rv = getOverviewPanel();
|
||||
sendCustomAccessibilityEvent(
|
||||
rv.getPageAt(rv.getCurrentPage()), TYPE_VIEW_FOCUSED, null);
|
||||
|
||||
+7
-1
@@ -19,6 +19,8 @@ import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
|
||||
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
|
||||
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
|
||||
import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS;
|
||||
import static com.android.quickstep.SysUINavigationMode.getMode;
|
||||
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -127,7 +129,11 @@ public class OverviewState extends LauncherState {
|
||||
|
||||
@Override
|
||||
public int getVisibleElements(Launcher launcher) {
|
||||
if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(launcher)) {
|
||||
RecentsView recentsView = launcher.getOverviewPanel();
|
||||
boolean hideShelfTwoButtonLandscape = getMode(launcher) == TWO_BUTTONS &&
|
||||
!recentsView.getPagedOrientationHandler().isLayoutNaturalToLauncher();
|
||||
if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(launcher) ||
|
||||
hideShelfTwoButtonLandscape) {
|
||||
return OVERVIEW_BUTTONS;
|
||||
} else if (launcher.getDeviceProfile().isVerticalBarLayout()) {
|
||||
return VERTICAL_SWIPE_INDICATOR | OVERVIEW_BUTTONS;
|
||||
|
||||
@@ -36,6 +36,7 @@ import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
@@ -50,12 +51,14 @@ import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.statemanager.StatefulActivity;
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.launcher3.util.VibratorWrapper;
|
||||
import com.android.launcher3.views.FloatingIconView;
|
||||
import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener;
|
||||
import com.android.quickstep.util.ActiveGestureLog;
|
||||
import com.android.quickstep.util.ActivityInitListener;
|
||||
import com.android.quickstep.util.AppWindowAnimationHelper;
|
||||
import com.android.quickstep.util.RectFSpringAnim;
|
||||
import com.android.quickstep.util.TaskViewSimulator;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
@@ -398,7 +401,16 @@ public abstract class BaseSwipeUpHandler<T extends StatefulActivity<?>, Q extend
|
||||
|
||||
protected boolean onActivityInit(Boolean alreadyOnHome) {
|
||||
T createdActivity = mActivityInterface.getCreatedActivity();
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.PAUSE_NOT_DETECTED, "BaseSwipeUpHandler.1");
|
||||
}
|
||||
if (createdActivity != null) {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.PAUSE_NOT_DETECTED, "BaseSwipeUpHandler.2");
|
||||
}
|
||||
((RecentsView) createdActivity.getOverviewPanel())
|
||||
.setLayoutRotation(mDeviceState.getCurrentActiveRotation(),
|
||||
mDeviceState.getDisplayRotation());
|
||||
initTransitionEndpoints(InvariantDeviceProfile.INSTANCE.get(mContext)
|
||||
.getDeviceProfile(mContext));
|
||||
}
|
||||
|
||||
+3
-1
@@ -100,7 +100,9 @@ public final class LauncherActivityInterface extends
|
||||
super.onSwipeUpToRecentsComplete();
|
||||
Launcher launcher = getCreatedActivity();
|
||||
if (launcher != null) {
|
||||
DiscoveryBounce.showForOverviewIfNeeded(launcher);
|
||||
RecentsView recentsView = launcher.getOverviewPanel();
|
||||
DiscoveryBounce.showForOverviewIfNeeded(launcher,
|
||||
recentsView.getPagedOrientationHandler());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -276,6 +276,8 @@ public class LauncherSwipeHandler extends BaseSwipeUpHandler<Launcher, RecentsVi
|
||||
if (mActivity == activity) {
|
||||
return true;
|
||||
}
|
||||
mTaskViewSimulator.setLayoutRotation(mDeviceState.getCurrentActiveRotation(),
|
||||
mDeviceState.getDisplayRotation());
|
||||
if (mActivity != null) {
|
||||
// The launcher may have been recreated as a result of device rotation.
|
||||
int oldState = mStateCallback.getState() & ~LAUNCHER_UI_STATES;
|
||||
|
||||
@@ -616,21 +616,6 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
return;
|
||||
}
|
||||
mDeviceState.enableMultipleRegions(baseInputConsumer instanceof OtherActivityInputConsumer);
|
||||
BaseDraggingActivity activity =
|
||||
mOverviewComponentObserver.getActivityInterface().getCreatedActivity();
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.PAUSE_NOT_DETECTED, "handleOrientationSetup.2");
|
||||
}
|
||||
if (activity == null || !(activity.getOverviewPanel() instanceof RecentsView)) {
|
||||
return;
|
||||
}
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.PAUSE_NOT_DETECTED, "handleOrientationSetup.3");
|
||||
}
|
||||
((RecentsView) activity.getOverviewPanel())
|
||||
.setLayoutRotation(mDeviceState.getCurrentActiveRotation(),
|
||||
mDeviceState.getDisplayRotation());
|
||||
activity.getDragLayer().recreateControllers();
|
||||
}
|
||||
|
||||
private InputConsumer newBaseConsumer(GestureState previousGestureState,
|
||||
|
||||
@@ -27,6 +27,7 @@ import static com.android.launcher3.logging.LoggerUtils.extractObjectNameAndAddr
|
||||
import static com.android.launcher3.states.RotationHelper.ALLOW_ROTATION_PREFERENCE_KEY;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS;
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
@@ -53,6 +54,7 @@ import com.android.launcher3.testing.TestProtocol;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.launcher3.util.WindowBounds;
|
||||
import com.android.quickstep.BaseActivityInterface;
|
||||
import com.android.quickstep.SysUINavigationMode;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.util.function.IntConsumer;
|
||||
@@ -118,6 +120,9 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE | FLAG_SYSTEM_ROTATION_ALLOWED
|
||||
| FLAG_ROTATION_WATCHER_SUPPORTED | FLAG_ROTATION_WATCHER_ENABLED;
|
||||
|
||||
private SysUINavigationMode.NavigationModeChangeListener mNavModeChangeListener =
|
||||
newMode -> setFlag(FLAG_ROTATION_WATCHER_SUPPORTED, newMode != TWO_BUTTONS);
|
||||
|
||||
private final Context mContext;
|
||||
private final ContentResolver mContentResolver;
|
||||
private final SharedPreferences mSharedPrefs;
|
||||
@@ -163,13 +168,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
if (isFixedRotationTransformEnabled(context)) {
|
||||
mFlags |= FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_FLAG;
|
||||
}
|
||||
if (mOrientationListener.canDetectOrientation()) {
|
||||
mFlags |= FLAG_ROTATION_WATCHER_SUPPORTED;
|
||||
}
|
||||
|
||||
// initialize external flags
|
||||
updateAutoRotateSetting();
|
||||
updateHomeRotationSetting();
|
||||
initFlags();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -273,6 +272,18 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
mSharedPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY, false));
|
||||
}
|
||||
|
||||
private void initFlags() {
|
||||
SysUINavigationMode.Mode currentMode = SysUINavigationMode.getMode(mContext);
|
||||
if (mOrientationListener.canDetectOrientation() &&
|
||||
currentMode != TWO_BUTTONS) {
|
||||
mFlags |= FLAG_ROTATION_WATCHER_SUPPORTED;
|
||||
}
|
||||
|
||||
// initialize external flags
|
||||
updateAutoRotateSetting();
|
||||
updateHomeRotationSetting();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes any system values and registers corresponding change listeners. It must be
|
||||
* paired with {@link #destroyListeners()} call
|
||||
@@ -283,9 +294,11 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
mContentResolver.registerContentObserver(
|
||||
Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION),
|
||||
false, mSystemAutoRotateObserver);
|
||||
SysUINavigationMode.Mode currentMode =
|
||||
SysUINavigationMode.INSTANCE.get(mContext)
|
||||
.addModeChangeListener(mNavModeChangeListener);
|
||||
}
|
||||
updateAutoRotateSetting();
|
||||
updateHomeRotationSetting();
|
||||
initFlags();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,6 +308,8 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
|
||||
if (isMultipleOrientationSupportedByDevice()) {
|
||||
mSharedPrefs.unregisterOnSharedPreferenceChangeListener(this);
|
||||
mContentResolver.unregisterContentObserver(mSystemAutoRotateObserver);
|
||||
SysUINavigationMode.INSTANCE.get(mContext)
|
||||
.removeModeChangeListener(mNavModeChangeListener);
|
||||
}
|
||||
setRotationWatcherEnabled(false);
|
||||
}
|
||||
|
||||
@@ -91,6 +91,9 @@ public class InsettableFrameLayout extends FrameLayout implements Insettable {
|
||||
@Override
|
||||
public void onViewAdded(View child) {
|
||||
super.onViewAdded(child);
|
||||
if (!isAttachedToWindow()) {
|
||||
return;
|
||||
}
|
||||
setFrameLayoutChildInsets(child, mInsets, new Rect());
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.statemanager.StateManager.StateListener;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.launcher3.util.OnboardingPrefs;
|
||||
|
||||
/**
|
||||
@@ -153,16 +154,19 @@ public class DiscoveryBounce extends AbstractFloatingView {
|
||||
new DiscoveryBounce(launcher, 0).show(HOTSEAT);
|
||||
}
|
||||
|
||||
public static void showForOverviewIfNeeded(Launcher launcher) {
|
||||
showForOverviewIfNeeded(launcher, true);
|
||||
public static void showForOverviewIfNeeded(Launcher launcher,
|
||||
PagedOrientationHandler orientationHandler) {
|
||||
showForOverviewIfNeeded(launcher, true, orientationHandler);
|
||||
}
|
||||
|
||||
private static void showForOverviewIfNeeded(Launcher launcher, boolean withDelay) {
|
||||
private static void showForOverviewIfNeeded(Launcher launcher, boolean withDelay,
|
||||
PagedOrientationHandler orientationHandler) {
|
||||
OnboardingPrefs onboardingPrefs = launcher.getOnboardingPrefs();
|
||||
if (!launcher.isInState(OVERVIEW)
|
||||
|| !launcher.hasBeenResumed()
|
||||
|| launcher.isForceInvisible()
|
||||
|| launcher.getDeviceProfile().isVerticalBarLayout()
|
||||
|| !orientationHandler.isLayoutNaturalToLauncher()
|
||||
|| onboardingPrefs.getBoolean(OnboardingPrefs.SHELF_BOUNCE_SEEN)
|
||||
|| launcher.getSystemService(UserManager.class).isDemoUser()
|
||||
|| Utilities.IS_RUNNING_IN_TEST_HARNESS) {
|
||||
@@ -170,7 +174,8 @@ public class DiscoveryBounce extends AbstractFloatingView {
|
||||
}
|
||||
|
||||
if (withDelay) {
|
||||
new Handler().postDelayed(() -> showForOverviewIfNeeded(launcher, false), DELAY_MS);
|
||||
new Handler().postDelayed(() -> showForOverviewIfNeeded(launcher, false,
|
||||
orientationHandler), DELAY_MS);
|
||||
return;
|
||||
} else if (AbstractFloatingView.getTopOpenView(launcher) != null) {
|
||||
// TODO: Move these checks to the top and call this method after invalidate handler.
|
||||
|
||||
Reference in New Issue
Block a user