Snap for 8254899 from 14fc5bbc7a to tm-release
Change-Id: I0850dc321adf772eb1efed70746429412916cb59
This commit is contained in:
@@ -156,6 +156,12 @@ enum Attribute {
|
||||
ALL_APPS_SEARCH_RESULT_LEGACY_SHORTCUT = 30;
|
||||
ALL_APPS_SEARCH_RESULT_ASSISTANT_MEMORY = 31;
|
||||
|
||||
// Suggestion Type provided by AGA
|
||||
ONE_SEARCH_WEB_QUERY = 32;
|
||||
ONE_SEARCH_WEB_TRENDING = 33;
|
||||
ONE_SEARCH_WEB_ENTITY = 34;
|
||||
ONE_SEARCH_WEB_ANSWER = 35;
|
||||
|
||||
WIDGETS_BOTTOM_TRAY = 28;
|
||||
WIDGETS_TRAY_PREDICTION = 29;
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.Utilities.postAsyncCallback;
|
||||
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
import static com.android.systemui.shared.recents.utilities.Utilities.postAtFrontOfQueueAsynchronously;
|
||||
|
||||
import android.animation.Animator;
|
||||
|
||||
@@ -44,7 +44,7 @@ import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVIT
|
||||
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_TRANSITIONS;
|
||||
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
|
||||
import static com.android.launcher3.statehandlers.DepthController.DEPTH;
|
||||
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
|
||||
import static com.android.launcher3.views.FloatingIconView.getFloatingIconView;
|
||||
import static com.android.quickstep.TaskViewUtils.findTaskViewToLaunch;
|
||||
|
||||
@@ -29,10 +29,12 @@ import android.annotation.Nullable;
|
||||
import android.content.SharedPreferences;
|
||||
import android.view.ViewConfiguration;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
|
||||
import com.android.quickstep.AnimatedFloat;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.systemui.shared.system.WindowManagerWrapper;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.StringJoiner;
|
||||
@@ -60,15 +62,16 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
|
||||
// If any of these flags are enabled, inset apps by our stashed height instead of our unstashed
|
||||
// height. This way the reported insets are consistent even during transitions out of the app.
|
||||
// Currently any flag that causes us to stash in an app is included, except for IME since that
|
||||
// covers the underlying app anyway and thus the app shouldn't change insets.
|
||||
// Currently any flag that causes us to stash in an app is included, except for IME or All Apps
|
||||
// since those cover the underlying app anyway and thus the app shouldn't change insets.
|
||||
private static final int FLAGS_REPORT_STASHED_INSETS_TO_APP = FLAGS_STASHED_IN_APP
|
||||
& ~FLAG_STASHED_IN_APP_IME;
|
||||
& ~FLAG_STASHED_IN_APP_IME & ~FLAG_STASHED_IN_APP_ALL_APPS;
|
||||
|
||||
/**
|
||||
* How long to stash/unstash when manually invoked via long press.
|
||||
*/
|
||||
public static final long TASKBAR_STASH_DURATION = 300;
|
||||
public static final long TASKBAR_STASH_DURATION =
|
||||
WindowManagerWrapper.ANIMATION_DURATION_RESIZE;
|
||||
|
||||
/**
|
||||
* How long to stash/unstash when keyboard is appearing/disappearing.
|
||||
@@ -187,7 +190,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
* Returns whether the taskbar can visually stash into a handle based on the current device
|
||||
* state.
|
||||
*/
|
||||
private boolean supportsVisualStashing() {
|
||||
public boolean supportsVisualStashing() {
|
||||
return !mActivity.isThreeButtonNav();
|
||||
}
|
||||
|
||||
@@ -254,7 +257,14 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
* Returns the height that taskbar will inset when inside apps.
|
||||
*/
|
||||
public int getContentHeightToReportToApps() {
|
||||
if (hasAnyFlag(FLAGS_REPORT_STASHED_INSETS_TO_APP)) {
|
||||
if (supportsVisualStashing() && hasAnyFlag(FLAGS_REPORT_STASHED_INSETS_TO_APP)) {
|
||||
DeviceProfile dp = mActivity.getDeviceProfile();
|
||||
if (hasAnyFlag(FLAG_STASHED_IN_APP_SETUP) && dp.isTaskbarPresent && !dp.isLandscape) {
|
||||
// We always show the back button in SUW but in portrait the SUW layout may not
|
||||
// be wide enough to support overlapping the nav bar with its content. For now,
|
||||
// just inset by the bar height.
|
||||
return mUnstashedHeight;
|
||||
}
|
||||
boolean isAnimating = mAnimator != null && mAnimator.isStarted();
|
||||
return mControllers.stashedHandleViewController.isStashedHandleVisible() || isAnimating
|
||||
? mStashedHeight : 0;
|
||||
|
||||
@@ -22,8 +22,10 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
import static com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo.TOUCHABLE_INSETS_REGION;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Insets;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowInsets;
|
||||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
@@ -59,6 +61,10 @@ class TaskbarAllAppsContext extends BaseTaskbarContext {
|
||||
private final TaskbarAllAppsDragLayer mDragLayer;
|
||||
private final TaskbarAllAppsContainerView mAppsView;
|
||||
|
||||
// We automatically stash taskbar when all apps is opened in gesture navigation mode.
|
||||
private final boolean mWillTaskbarBeVisuallyStashed;
|
||||
private final int mStashedTaskbarHeight;
|
||||
|
||||
TaskbarAllAppsContext(
|
||||
TaskbarActivityContext taskbarContext,
|
||||
TaskbarAllAppsController windowController,
|
||||
@@ -79,6 +85,9 @@ class TaskbarAllAppsContext extends BaseTaskbarContext {
|
||||
windowController,
|
||||
taskbarStashController);
|
||||
mAppsView = slideInView.getAppsView();
|
||||
|
||||
mWillTaskbarBeVisuallyStashed = taskbarStashController.supportsVisualStashing();
|
||||
mStashedTaskbarHeight = taskbarStashController.getStashedHeight();
|
||||
}
|
||||
|
||||
TaskbarAllAppsViewController getAllAppsViewController() {
|
||||
@@ -189,5 +198,37 @@ class TaskbarAllAppsContext extends BaseTaskbarContext {
|
||||
inoutInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
|
||||
return updateInsetsDueToStashing(insets);
|
||||
}
|
||||
|
||||
/**
|
||||
* Taskbar automatically stashes when opening all apps, but we don't report the insets as
|
||||
* changing to avoid moving the underlying app. But internally, the apps view should still
|
||||
* layout according to the stashed insets rather than the unstashed insets. So this method
|
||||
* does two things:
|
||||
* 1) Sets navigationBars bottom inset to stashedHeight.
|
||||
* 2) Sets tappableInsets bottom inset to 0.
|
||||
*/
|
||||
private WindowInsets updateInsetsDueToStashing(WindowInsets oldInsets) {
|
||||
if (!mActivity.mWillTaskbarBeVisuallyStashed) {
|
||||
return oldInsets;
|
||||
}
|
||||
WindowInsets.Builder updatedInsetsBuilder = new WindowInsets.Builder(oldInsets);
|
||||
|
||||
Insets oldNavInsets = oldInsets.getInsets(WindowInsets.Type.navigationBars());
|
||||
Insets newNavInsets = Insets.of(oldNavInsets.left, oldNavInsets.top, oldNavInsets.right,
|
||||
mActivity.mStashedTaskbarHeight);
|
||||
updatedInsetsBuilder.setInsets(WindowInsets.Type.navigationBars(), newNavInsets);
|
||||
|
||||
Insets oldTappableInsets = oldInsets.getInsets(WindowInsets.Type.tappableElement());
|
||||
Insets newTappableInsets = Insets.of(oldTappableInsets.left, oldTappableInsets.top,
|
||||
oldTappableInsets.right, 0);
|
||||
updatedInsetsBuilder.setInsets(WindowInsets.Type.tappableElement(), newTappableInsets);
|
||||
|
||||
return updatedInsetsBuilder.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar.allapps;
|
||||
|
||||
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
|
||||
@@ -158,6 +159,7 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
|
||||
layoutParams.gravity = Gravity.BOTTOM;
|
||||
layoutParams.packageName = mTaskbarContext.getPackageName();
|
||||
layoutParams.setFitInsetsTypes(0); // Handled by container view.
|
||||
layoutParams.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
||||
layoutParams.setSystemApplicationOverlay(true);
|
||||
return layoutParams;
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.SKIP_SCRIM;
|
||||
import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_RIGHT;
|
||||
import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_UP;
|
||||
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
import static com.android.quickstep.util.VibratorWrapper.OVERVIEW_HAPTIC;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
|
||||
|
||||
@@ -32,10 +32,10 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_GESTURE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_LEFT;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_RIGHT;
|
||||
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
import static com.android.quickstep.GestureState.GestureEndTarget.HOME;
|
||||
import static com.android.quickstep.GestureState.GestureEndTarget.LAST_TASK;
|
||||
import static com.android.quickstep.GestureState.GestureEndTarget.NEW_TASK;
|
||||
|
||||
@@ -44,7 +44,7 @@ import com.android.systemui.shared.system.RemoteTransitionCompat;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListener;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListeners;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAnimationListener {
|
||||
@@ -156,12 +156,26 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
RemoteAnimationTargetCompat appearedTaskTarget = appearedTaskTargets[0];
|
||||
BaseActivityInterface activityInterface = mLastGestureState.getActivityInterface();
|
||||
// Convert appTargets to type RemoteAnimationTarget for all apps except Home app
|
||||
RemoteAnimationTarget[] nonHomeApps = Arrays.stream(appearedTaskTargets)
|
||||
.filter(remoteAnimationTarget ->
|
||||
remoteAnimationTarget.activityType != ACTIVITY_TYPE_HOME)
|
||||
final ArrayList<RemoteAnimationTargetCompat> tmpNonHomeApps = new ArrayList<>();
|
||||
final ArrayList<RemoteAnimationTargetCompat> tmpHomeApps = new ArrayList<>();
|
||||
for (RemoteAnimationTargetCompat compat : appearedTaskTargets) {
|
||||
if (compat.activityType != ACTIVITY_TYPE_HOME) {
|
||||
tmpNonHomeApps.add(compat);
|
||||
} else {
|
||||
tmpHomeApps.add(compat);
|
||||
}
|
||||
}
|
||||
RemoteAnimationTarget[] nonHomeApps = tmpNonHomeApps.stream()
|
||||
.map(RemoteAnimationTargetCompat::unwrap)
|
||||
.toArray(RemoteAnimationTarget[]::new);
|
||||
|
||||
RemoteAnimationTarget[] homeApps = tmpHomeApps.stream()
|
||||
.map(RemoteAnimationTargetCompat::unwrap)
|
||||
.toArray(RemoteAnimationTarget[]::new);
|
||||
if (homeApps.length > 0
|
||||
&& activityInterface.getCreatedActivity() instanceof RecentsActivity) {
|
||||
((RecentsActivity) activityInterface.getCreatedActivity()).startHome();
|
||||
return;
|
||||
}
|
||||
RemoteAnimationTarget[] nonAppTargets =
|
||||
SystemUiProxy.INSTANCE.getNoCreate()
|
||||
.onGoingToRecentsLegacy(false, nonHomeApps);
|
||||
@@ -198,8 +212,16 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
RemoteTransitionCompat transition = new RemoteTransitionCompat(mCallbacks,
|
||||
mController != null ? mController.getController() : null,
|
||||
mCtx.getIApplicationThread());
|
||||
final ActivityOptions options = ActivityOptionsCompat.makeRemoteTransition(transition)
|
||||
.setTransientLaunch();
|
||||
final ActivityOptions options = ActivityOptionsCompat.makeRemoteTransition(transition);
|
||||
// Allowing to pause Home if Home is top activity and Recents is not Home. So when user
|
||||
// start home when recents animation is playing, the home activity can be resumed again
|
||||
// to let the transition controller collect Home activity.
|
||||
ActivityManager.RunningTaskInfo rti = gestureState.getRunningTask();
|
||||
boolean homeIsOnTop = rti != null && rti.topActivity != null
|
||||
&& rti.topActivity.equals(gestureState.getHomeIntent().getComponent());
|
||||
if (!homeIsOnTop) {
|
||||
options.setTransientLaunch();
|
||||
}
|
||||
options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_RECENTS_ANIMATION, eventTime);
|
||||
UI_HELPER_EXECUTOR.execute(() -> mCtx.startActivity(intent, options.toBundle()));
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
package com.android.quickstep.interaction;
|
||||
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL;
|
||||
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
|
||||
import static com.android.quickstep.AbsSwipeUpHandler.MAX_SWIPE_DURATION;
|
||||
import static com.android.quickstep.interaction.TutorialController.TutorialType.HOME_NAVIGATION_COMPLETE;
|
||||
|
||||
@@ -141,7 +141,9 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
getCardinality(info) /* cardinality */,
|
||||
info.getWidget().getSpanX(),
|
||||
info.getWidget().getSpanY(),
|
||||
getFeatures(info));
|
||||
getFeatures(info),
|
||||
null /* attributes */
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +172,8 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
info.getAttribute().getNumber(), // attribute_id = 15;
|
||||
getCardinality(info), // cardinality = 16;
|
||||
info.getWidget().getSpanX(), // span_x = 17 [default = 1];
|
||||
info.getWidget().getSpanY() // span_y = 18 [default = 1];
|
||||
info.getWidget().getSpanY(), // span_y = 18 [default = 1];
|
||||
null /* attributes */
|
||||
);
|
||||
}
|
||||
|
||||
@@ -413,7 +416,8 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
atomInfo.getFolderIcon().getLabelInfo() /* edittext */,
|
||||
getCardinality(atomInfo) /* cardinality */,
|
||||
getFeatures(atomInfo) /* features */,
|
||||
getSearchAttributes(atomInfo) /* searchAttributes */
|
||||
getSearchAttributes(atomInfo) /* searchAttributes */,
|
||||
null /* attributes */
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -725,7 +725,8 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
TestLogging.recordEvent(
|
||||
TestProtocol.SEQUENCE_MAIN, "startActivityFromRecentsAsync", mTask);
|
||||
ActivityOptionsWrapper opts = mActivity.getActivityLaunchOptions(this, null);
|
||||
opts.options.setLaunchDisplayId(getRootViewDisplayId());
|
||||
opts.options.setLaunchDisplayId(
|
||||
getDisplay() == null ? DEFAULT_DISPLAY : getDisplay().getDisplayId());
|
||||
if (ActivityManagerWrapper.getInstance()
|
||||
.startActivityFromRecents(mTask.key, opts.options)) {
|
||||
RecentsView recentsView = getRecentsView();
|
||||
@@ -766,7 +767,8 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
// Indicate success once the system has indicated that the transition has started
|
||||
ActivityOptions opts = ActivityOptionsCompat.makeCustomAnimation(
|
||||
getContext(), 0, 0, () -> callback.accept(true), MAIN_EXECUTOR.getHandler());
|
||||
opts.setLaunchDisplayId(getRootViewDisplayId());
|
||||
opts.setLaunchDisplayId(
|
||||
getDisplay() == null ? DEFAULT_DISPLAY : getDisplay().getDisplayId());
|
||||
if (freezeTaskList) {
|
||||
ActivityOptionsCompat.setFreezeRecentTasksList(opts);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.animation.ValueAnimator.AnimatorUpdateListener;
|
||||
|
||||
@@ -19,7 +19,7 @@ import static com.android.launcher3.Utilities.boundToRange;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.anim.Interpolators.clampToProgress;
|
||||
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
|
||||
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.Animator.AnimatorListener;
|
||||
|
||||
@@ -25,7 +25,7 @@ import android.util.FloatProperty;
|
||||
import androidx.annotation.FloatRange;
|
||||
import androidx.dynamicanimation.animation.SpringForce;
|
||||
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.window.RefreshRateTracker;
|
||||
|
||||
/**
|
||||
* Utility class to build an object animator which follows the same path as a spring animation for
|
||||
@@ -134,7 +134,7 @@ public class SpringAnimationBuilder {
|
||||
}
|
||||
|
||||
public SpringAnimationBuilder computeParams() {
|
||||
int singleFrameMs = DisplayController.getSingleFrameMs(mContext);
|
||||
int singleFrameMs = RefreshRateTracker.getSingleFrameMs(mContext);
|
||||
double naturalFreq = Math.sqrt(mStiffness);
|
||||
double dampedFreq = naturalFreq * Math.sqrt(1 - mDampingRatio * mDampingRatio);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustom
|
||||
import static com.android.launcher3.config.FeatureFlags.ALWAYS_USE_HARDWARE_OPTIMIZATION_FOR_FOLDER_ANIMATIONS;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_LABEL_UPDATED;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED;
|
||||
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
|
||||
@@ -508,7 +508,9 @@ public class PopupContainerWithArrow<T extends Context & ActivityContext>
|
||||
@Override
|
||||
protected void closeComplete() {
|
||||
super.closeComplete();
|
||||
mActivityContext.getDragController().removeDragListener(this);
|
||||
if (mActivityContext.getDragController() != null) {
|
||||
mActivityContext.getDragController().removeDragListener(this);
|
||||
}
|
||||
PopupContainerWithArrow openPopup = getOpen(mActivityContext);
|
||||
if (openPopup == null || openPopup.mOriginalIcon != mOriginalIcon) {
|
||||
mOriginalIcon.setTextVisibility(mOriginalIcon.shouldTextBeVisible());
|
||||
|
||||
@@ -26,7 +26,7 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNKNOWN_SWIPEDOWN;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNKNOWN_SWIPEUP;
|
||||
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
|
||||
import android.animation.Animator.AnimatorListener;
|
||||
import android.animation.ValueAnimator;
|
||||
|
||||
@@ -20,7 +20,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
|
||||
|
||||
import static com.android.launcher3.Utilities.dpiFromPx;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.launcher3.util.WindowManagerCompat.MIN_TABLET_WIDTH;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
@@ -34,7 +33,6 @@ import android.content.IntentFilter;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Point;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.hardware.display.DisplayManager.DisplayListener;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
@@ -44,7 +42,6 @@ import android.view.Display;
|
||||
|
||||
import androidx.annotation.AnyThread;
|
||||
import androidx.annotation.UiThread;
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.uioverrides.ApiWrapper;
|
||||
@@ -58,7 +55,7 @@ import java.util.Set;
|
||||
* Utility class to cache properties of default display to avoid a system RPC on every call.
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
public class DisplayController implements DisplayListener, ComponentCallbacks, SafeCloseable {
|
||||
public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
|
||||
private static final String TAG = "DisplayController";
|
||||
|
||||
@@ -102,7 +99,6 @@ public class DisplayController implements DisplayListener, ComponentCallbacks, S
|
||||
}
|
||||
mInfo = new Info(getDisplayInfoContext(display), display,
|
||||
getInternalDisplays(mDM), emptyMap());
|
||||
mDM.registerDisplayListener(this, UI_HELPER_EXECUTOR.getHandler());
|
||||
}
|
||||
|
||||
private static ArrayMap<String, PortraitSize> getInternalDisplays(
|
||||
@@ -128,35 +124,6 @@ public class DisplayController implements DisplayListener, ComponentCallbacks, S
|
||||
} else {
|
||||
// TODO: unregister broadcast receiver
|
||||
}
|
||||
mDM.unregisterDisplayListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onDisplayAdded(int displayId) { }
|
||||
|
||||
@Override
|
||||
public final void onDisplayRemoved(int displayId) { }
|
||||
|
||||
@WorkerThread
|
||||
@Override
|
||||
public final void onDisplayChanged(int displayId) {
|
||||
if (displayId != DEFAULT_DISPLAY) {
|
||||
return;
|
||||
}
|
||||
Display display = mDM.getDisplay(DEFAULT_DISPLAY);
|
||||
if (display == null) {
|
||||
return;
|
||||
}
|
||||
if (Utilities.ATLEAST_S) {
|
||||
// Only update refresh rate. Everything else comes from component callbacks
|
||||
mInfo.mSingleFrameMs = getSingleFrameMs(display);
|
||||
return;
|
||||
}
|
||||
handleInfoChange(display);
|
||||
}
|
||||
|
||||
public static int getSingleFrameMs(Context context) {
|
||||
return INSTANCE.get(context).getInfo().mSingleFrameMs;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,8 +254,6 @@ public class DisplayController implements DisplayListener, ComponentCallbacks, S
|
||||
|
||||
public static class Info {
|
||||
|
||||
private int mSingleFrameMs;
|
||||
|
||||
// Configuration properties
|
||||
public final int rotation;
|
||||
public final float fontScale;
|
||||
@@ -318,7 +283,6 @@ public class DisplayController implements DisplayListener, ComponentCallbacks, S
|
||||
densityDpi = config.densityDpi;
|
||||
mScreenSizeDp = new PortraitSize(config.screenHeightDp, config.screenWidthDp);
|
||||
|
||||
mSingleFrameMs = getSingleFrameMs(display);
|
||||
currentSize = new Point();
|
||||
display.getRealSize(currentSize);
|
||||
|
||||
@@ -400,9 +364,4 @@ public class DisplayController implements DisplayListener, ComponentCallbacks, S
|
||||
return Objects.hash(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
private static int getSingleFrameMs(Display display) {
|
||||
float refreshRate = display.getRefreshRate();
|
||||
return refreshRate > 0 ? (int) (1000 / refreshRate) : 16;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.launcher3.util.window;
|
||||
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
import android.content.Context;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.hardware.display.DisplayManager.DisplayListener;
|
||||
import android.view.Display;
|
||||
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
import com.android.launcher3.util.SafeCloseable;
|
||||
|
||||
/**
|
||||
* Utility class to track refresh rate of the current device
|
||||
*/
|
||||
public class RefreshRateTracker implements DisplayListener, SafeCloseable {
|
||||
|
||||
private static final MainThreadInitializedObject<RefreshRateTracker> INSTANCE =
|
||||
new MainThreadInitializedObject<>(RefreshRateTracker::new);
|
||||
|
||||
private int mSingleFrameMs = 1;
|
||||
|
||||
private final DisplayManager mDM;
|
||||
|
||||
private RefreshRateTracker(Context context) {
|
||||
mDM = context.getSystemService(DisplayManager.class);
|
||||
updateSingleFrameMs();
|
||||
mDM.registerDisplayListener(this, UI_HELPER_EXECUTOR.getHandler());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the single frame time in ms
|
||||
*/
|
||||
public static int getSingleFrameMs(Context context) {
|
||||
return INSTANCE.get(context).mSingleFrameMs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onDisplayAdded(int displayId) { }
|
||||
|
||||
@Override
|
||||
public final void onDisplayRemoved(int displayId) { }
|
||||
|
||||
@WorkerThread
|
||||
@Override
|
||||
public final void onDisplayChanged(int displayId) {
|
||||
if (displayId == DEFAULT_DISPLAY) {
|
||||
updateSingleFrameMs();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSingleFrameMs() {
|
||||
Display display = mDM.getDisplay(DEFAULT_DISPLAY);
|
||||
if (display != null) {
|
||||
float refreshRate = display.getRefreshRate();
|
||||
mSingleFrameMs = refreshRate > 0 ? (int) (1000 / refreshRate) : 16;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
mDM.unregisterDisplayListener(this);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import static android.view.MotionEvent.ACTION_CANCEL;
|
||||
import static android.view.MotionEvent.ACTION_DOWN;
|
||||
import static android.view.MotionEvent.ACTION_UP;
|
||||
|
||||
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.WallpaperManager;
|
||||
|
||||
@@ -40,8 +40,8 @@ import com.android.launcher3.GestureNavContract;
|
||||
import com.android.launcher3.Insettable;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.util.window.RefreshRateTracker;
|
||||
|
||||
/**
|
||||
* Similar to {@link FloatingIconView} but displays a surface with the targetIcon. It then passes
|
||||
@@ -97,7 +97,7 @@ public class FloatingSurfaceView extends AbstractFloatingView implements
|
||||
|
||||
// Remove after some time, to avoid flickering
|
||||
Executors.MAIN_EXECUTOR.getHandler().postDelayed(mRemoveViewRunnable,
|
||||
DisplayController.getSingleFrameMs(mLauncher));
|
||||
RefreshRateTracker.getSingleFrameMs(mLauncher));
|
||||
}
|
||||
|
||||
private void removeViewFromParent() {
|
||||
|
||||
Reference in New Issue
Block a user