Merge "Revert "Migrating RecentsAnimationDeviceState and dependent obje..."" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
9b0a007ae3
@@ -21,11 +21,9 @@ import com.android.launcher3.uioverrides.plugins.PluginManagerWrapperImpl
|
||||
import com.android.launcher3.util.ApiWrapper
|
||||
import com.android.launcher3.util.PluginManagerWrapper
|
||||
import com.android.launcher3.util.window.WindowManagerProxy
|
||||
import com.android.quickstep.util.GestureExclusionManager
|
||||
import com.android.quickstep.util.SystemWindowManagerProxy
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
||||
private object Modules {}
|
||||
|
||||
@@ -44,11 +42,3 @@ abstract class PluginManagerWrapperModule {
|
||||
@Binds
|
||||
abstract fun bindPluginManagerWrapper(impl: PluginManagerWrapperImpl): PluginManagerWrapper
|
||||
}
|
||||
|
||||
@Module
|
||||
object StaticObjectModule {
|
||||
|
||||
@Provides
|
||||
@JvmStatic
|
||||
fun provideGestureExclusionManager(): GestureExclusionManager = GestureExclusionManager.INSTANCE
|
||||
}
|
||||
|
||||
@@ -64,15 +64,12 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.dagger.ApplicationContext;
|
||||
import com.android.launcher3.dagger.LauncherAppComponent;
|
||||
import com.android.launcher3.dagger.LauncherAppSingleton;
|
||||
import com.android.launcher3.util.DaggerSingletonObject;
|
||||
import com.android.launcher3.util.DaggerSingletonTracker;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.DisplayController.DisplayInfoChangeListener;
|
||||
import com.android.launcher3.util.DisplayController.Info;
|
||||
import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
import com.android.launcher3.util.NavigationMode;
|
||||
import com.android.launcher3.util.SafeCloseable;
|
||||
import com.android.launcher3.util.SettingsCache;
|
||||
import com.android.quickstep.TopTaskTracker.CachedTaskInfo;
|
||||
import com.android.quickstep.util.ActiveGestureLog;
|
||||
@@ -88,14 +85,13 @@ import com.android.systemui.shared.system.TaskStackChangeListener;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListeners;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Manages the state of the system during a swipe up gesture.
|
||||
*/
|
||||
@LauncherAppSingleton
|
||||
public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, ExclusionListener {
|
||||
public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, ExclusionListener,
|
||||
SafeCloseable {
|
||||
|
||||
static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";
|
||||
|
||||
@@ -103,8 +99,8 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
private static final float QUICKSTEP_TOUCH_SLOP_RATIO_TWO_BUTTON = 3f;
|
||||
private static final float QUICKSTEP_TOUCH_SLOP_RATIO_GESTURAL = 1.414f;
|
||||
|
||||
public static DaggerSingletonObject<RecentsAnimationDeviceState> INSTANCE =
|
||||
new DaggerSingletonObject<>(LauncherAppComponent::getRecentsAnimationDeviceState);
|
||||
public static MainThreadInitializedObject<RecentsAnimationDeviceState> INSTANCE =
|
||||
new MainThreadInitializedObject<>(RecentsAnimationDeviceState::new);
|
||||
|
||||
private final Context mContext;
|
||||
private final DisplayController mDisplayController;
|
||||
@@ -114,11 +110,12 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
|
||||
private final RotationTouchHelper mRotationTouchHelper;
|
||||
private final TaskStackChangeListener mPipListener;
|
||||
private final DaggerSingletonTracker mLifeCycle;
|
||||
// Cache for better performance since it doesn't change at runtime.
|
||||
private final boolean mCanImeRenderGesturalNavButtons =
|
||||
InputMethodService.canImeRenderGesturalNavButtons();
|
||||
|
||||
private final ArrayList<Runnable> mOnDestroyActions = new ArrayList<>();
|
||||
|
||||
private @SystemUiStateFlags long mSystemUiStateFlags = QuickStepContract.SYSUI_STATE_AWAKE;
|
||||
private NavigationMode mMode = THREE_BUTTONS;
|
||||
private NavBarPosition mNavBarPosition;
|
||||
@@ -137,39 +134,35 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
private @NonNull Region mExclusionRegion = GestureExclusionManager.EMPTY_REGION;
|
||||
private boolean mExclusionListenerRegistered;
|
||||
|
||||
private RecentsAnimationDeviceState(Context context) {
|
||||
this(context, GestureExclusionManager.INSTANCE);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@Inject
|
||||
RecentsAnimationDeviceState(
|
||||
@ApplicationContext Context context,
|
||||
GestureExclusionManager exclusionManager,
|
||||
DisplayController displayController,
|
||||
ContextualSearchStateManager contextualSearchStateManager,
|
||||
RotationTouchHelper rotationTouchHelper,
|
||||
SettingsCache settingsCache,
|
||||
DaggerSingletonTracker lifeCycle) {
|
||||
RecentsAnimationDeviceState(Context context, GestureExclusionManager exclusionManager) {
|
||||
mContext = context;
|
||||
mDisplayController = displayController;
|
||||
mDisplayController = DisplayController.INSTANCE.get(context);
|
||||
mExclusionManager = exclusionManager;
|
||||
mContextualSearchStateManager = contextualSearchStateManager;
|
||||
mRotationTouchHelper = rotationTouchHelper;
|
||||
mLifeCycle = lifeCycle;
|
||||
mContextualSearchStateManager = ContextualSearchStateManager.INSTANCE.get(context);
|
||||
mIsOneHandedModeSupported = SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false);
|
||||
mRotationTouchHelper = RotationTouchHelper.INSTANCE.get(context);
|
||||
|
||||
// Register for exclusion updates
|
||||
mLifeCycle.addCloseable(this::unregisterExclusionListener);
|
||||
runOnDestroy(this::unregisterExclusionListener);
|
||||
|
||||
// Register for display changes changes
|
||||
mDisplayController.addChangeListener(this);
|
||||
onDisplayInfoChanged(context, mDisplayController.getInfo(), CHANGE_ALL);
|
||||
mLifeCycle.addCloseable(() -> mDisplayController.removeChangeListener(this));
|
||||
runOnDestroy(() -> mDisplayController.removeChangeListener(this));
|
||||
|
||||
SettingsCache settingsCache = SettingsCache.INSTANCE.get(mContext);
|
||||
if (mIsOneHandedModeSupported) {
|
||||
Uri oneHandedUri = Settings.Secure.getUriFor(ONE_HANDED_ENABLED);
|
||||
SettingsCache.OnChangeListener onChangeListener =
|
||||
enabled -> mIsOneHandedModeEnabled = enabled;
|
||||
settingsCache.register(oneHandedUri, onChangeListener);
|
||||
mIsOneHandedModeEnabled = settingsCache.getValue(oneHandedUri);
|
||||
mLifeCycle.addCloseable(() -> settingsCache.unregister(oneHandedUri, onChangeListener));
|
||||
runOnDestroy(() -> settingsCache.unregister(oneHandedUri, onChangeListener));
|
||||
} else {
|
||||
mIsOneHandedModeEnabled = false;
|
||||
}
|
||||
@@ -180,16 +173,14 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
enabled -> mIsSwipeToNotificationEnabled = enabled;
|
||||
settingsCache.register(swipeBottomNotificationUri, onChangeListener);
|
||||
mIsSwipeToNotificationEnabled = settingsCache.getValue(swipeBottomNotificationUri);
|
||||
mLifeCycle.addCloseable(
|
||||
() -> settingsCache.unregister(swipeBottomNotificationUri, onChangeListener));
|
||||
runOnDestroy(() -> settingsCache.unregister(swipeBottomNotificationUri, onChangeListener));
|
||||
|
||||
Uri setupCompleteUri = Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE);
|
||||
mIsUserSetupComplete = settingsCache.getValue(setupCompleteUri, 0);
|
||||
if (!mIsUserSetupComplete) {
|
||||
SettingsCache.OnChangeListener userSetupChangeListener = e -> mIsUserSetupComplete = e;
|
||||
settingsCache.register(setupCompleteUri, userSetupChangeListener);
|
||||
mLifeCycle.addCloseable(
|
||||
() -> settingsCache.unregister(setupCompleteUri, userSetupChangeListener));
|
||||
runOnDestroy(() -> settingsCache.unregister(setupCompleteUri, userSetupChangeListener));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -210,10 +201,21 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
}
|
||||
};
|
||||
TaskStackChangeListeners.getInstance().registerTaskStackListener(mPipListener);
|
||||
mLifeCycle.addCloseable(() ->
|
||||
runOnDestroy(() ->
|
||||
TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mPipListener));
|
||||
}
|
||||
|
||||
private void runOnDestroy(Runnable action) {
|
||||
mOnDestroyActions.add(action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
for (Runnable r : mOnDestroyActions) {
|
||||
r.run();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a listener for the nav mode change, guaranteed to be called after the device state's
|
||||
* mode has changed.
|
||||
@@ -226,7 +228,7 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
};
|
||||
mDisplayController.addChangeListener(listener);
|
||||
callback.run();
|
||||
mLifeCycle.addCloseable(() -> mDisplayController.removeChangeListener(listener));
|
||||
runOnDestroy(() -> mDisplayController.removeChangeListener(listener));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,16 +33,13 @@ import android.content.res.Resources;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.OrientationEventListener;
|
||||
|
||||
import com.android.launcher3.dagger.ApplicationContext;
|
||||
import com.android.launcher3.dagger.LauncherAppComponent;
|
||||
import com.android.launcher3.dagger.LauncherAppSingleton;
|
||||
import com.android.launcher3.testing.shared.TestProtocol;
|
||||
import com.android.launcher3.util.DaggerSingletonObject;
|
||||
import com.android.launcher3.util.DaggerSingletonTracker;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.DisplayController.DisplayInfoChangeListener;
|
||||
import com.android.launcher3.util.DisplayController.Info;
|
||||
import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
import com.android.launcher3.util.NavigationMode;
|
||||
import com.android.launcher3.util.SafeCloseable;
|
||||
import com.android.quickstep.util.RecentsOrientedState;
|
||||
import com.android.systemui.shared.Flags;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
@@ -51,20 +48,16 @@ import com.android.systemui.shared.system.TaskStackChangeListeners;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Helper class for transforming touch events
|
||||
*/
|
||||
@LauncherAppSingleton
|
||||
public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
public class RotationTouchHelper implements DisplayInfoChangeListener, SafeCloseable {
|
||||
|
||||
public static final DaggerSingletonObject<RotationTouchHelper> INSTANCE =
|
||||
new DaggerSingletonObject<>(LauncherAppComponent::getRotationTouchHelper);
|
||||
public static final MainThreadInitializedObject<RotationTouchHelper> INSTANCE =
|
||||
new MainThreadInitializedObject<>(RotationTouchHelper::new);
|
||||
|
||||
private final OrientationTouchTransformer mOrientationTouchTransformer;
|
||||
private final DisplayController mDisplayController;
|
||||
private final SystemUiProxy mSystemUiProxy;
|
||||
private final int mDisplayId;
|
||||
private int mDisplayRotation;
|
||||
|
||||
@@ -134,17 +127,12 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
private boolean mTaskListFrozen;
|
||||
private final Context mContext;
|
||||
|
||||
@Inject
|
||||
RotationTouchHelper(@ApplicationContext Context context,
|
||||
DisplayController displayController,
|
||||
SystemUiProxy systemUiProxy,
|
||||
DaggerSingletonTracker lifeCycle) {
|
||||
private RotationTouchHelper(Context context) {
|
||||
mContext = context;
|
||||
mDisplayController = displayController;
|
||||
mSystemUiProxy = systemUiProxy;
|
||||
mDisplayController = DisplayController.INSTANCE.get(mContext);
|
||||
Resources resources = mContext.getResources();
|
||||
mDisplayId = DEFAULT_DISPLAY;
|
||||
|
||||
Resources resources = mContext.getResources();
|
||||
mOrientationTouchTransformer = new OrientationTouchTransformer(resources, mMode,
|
||||
() -> QuickStepContract.getWindowCornerRadius(mContext));
|
||||
|
||||
@@ -172,13 +160,14 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
lifeCycle.addCloseable(() -> {
|
||||
mDisplayController.removeChangeListener(this);
|
||||
mOrientationListener.disable();
|
||||
TaskStackChangeListeners.getInstance()
|
||||
.unregisterTaskStackListener(mFrozenTaskListener);
|
||||
});
|
||||
@Override
|
||||
public void close() {
|
||||
mDisplayController.removeChangeListener(this);
|
||||
mOrientationListener.disable();
|
||||
TaskStackChangeListeners.getInstance()
|
||||
.unregisterTaskStackListener(mFrozenTaskListener);
|
||||
}
|
||||
|
||||
public boolean isTaskListFrozen() {
|
||||
@@ -351,7 +340,8 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
}
|
||||
|
||||
private void notifySysuiOfCurrentRotation(int rotation) {
|
||||
UI_HELPER_EXECUTOR.execute(() -> mSystemUiProxy.notifyPrioritizedRotation(rotation));
|
||||
UI_HELPER_EXECUTOR.execute(() -> SystemUiProxy.INSTANCE.get(mContext)
|
||||
.notifyPrioritizedRotation(rotation));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,13 +21,10 @@ import com.android.launcher3.dagger.LauncherBaseAppComponent;
|
||||
import com.android.launcher3.model.WellbeingModel;
|
||||
import com.android.launcher3.statehandlers.DesktopVisibilityController;
|
||||
import com.android.quickstep.OverviewComponentObserver;
|
||||
import com.android.quickstep.RecentsAnimationDeviceState;
|
||||
import com.android.quickstep.RotationTouchHelper;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.TopTaskTracker;
|
||||
import com.android.quickstep.fallback.window.RecentsDisplayModel;
|
||||
import com.android.quickstep.util.AsyncClockEventDelegate;
|
||||
import com.android.quickstep.util.ContextualSearchStateManager;
|
||||
|
||||
/**
|
||||
* Launcher Quickstep base component for Dagger injection.
|
||||
@@ -52,10 +49,4 @@ public interface QuickstepBaseAppComponent extends LauncherBaseAppComponent {
|
||||
DesktopVisibilityController getDesktopVisibilityController();
|
||||
|
||||
TopTaskTracker getTopTaskTracker();
|
||||
|
||||
RotationTouchHelper getRotationTouchHelper();
|
||||
|
||||
ContextualSearchStateManager getContextualSearchStateManager();
|
||||
|
||||
RecentsAnimationDeviceState getRecentsAnimationDeviceState();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import static android.app.contextualsearch.ContextualSearchManager.FEATURE_CONTE
|
||||
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_LAUNCH_OMNI_SUCCESSFUL_SYSTEM_ACTION;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.launcher3.util.MainThreadInitializedObject.forOverride;
|
||||
import static com.android.quickstep.util.SystemActionConstants.SYSTEM_ACTION_ID_SEARCH_SCREEN;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
@@ -43,13 +44,11 @@ import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.dagger.ApplicationContext;
|
||||
import com.android.launcher3.dagger.LauncherAppComponent;
|
||||
import com.android.launcher3.dagger.LauncherAppSingleton;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.util.DaggerSingletonObject;
|
||||
import com.android.launcher3.util.DaggerSingletonTracker;
|
||||
import com.android.launcher3.util.EventLogArray;
|
||||
import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
import com.android.launcher3.util.ResourceBasedOverride;
|
||||
import com.android.launcher3.util.SafeCloseable;
|
||||
import com.android.launcher3.util.SettingsCache;
|
||||
import com.android.launcher3.util.SimpleBroadcastReceiver;
|
||||
import com.android.quickstep.DeviceConfigWrapper;
|
||||
@@ -59,14 +58,12 @@ import com.android.quickstep.TopTaskTracker;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/** Long-lived class to manage Contextual Search states like the user setting and availability. */
|
||||
@LauncherAppSingleton
|
||||
public class ContextualSearchStateManager {
|
||||
public class ContextualSearchStateManager implements ResourceBasedOverride, SafeCloseable {
|
||||
|
||||
public static final DaggerSingletonObject<ContextualSearchStateManager> INSTANCE =
|
||||
new DaggerSingletonObject<>(LauncherAppComponent::getContextualSearchStateManager);
|
||||
public static final MainThreadInitializedObject<ContextualSearchStateManager> INSTANCE =
|
||||
forOverride(ContextualSearchStateManager.class,
|
||||
R.string.contextual_search_state_manager_class);
|
||||
|
||||
private static final String TAG = "ContextualSearchStMgr";
|
||||
private static final int MAX_DEBUG_EVENT_SIZE = 20;
|
||||
@@ -76,29 +73,23 @@ public class ContextualSearchStateManager {
|
||||
private final Runnable mSysUiStateChangeListener = this::updateOverridesToSysUi;
|
||||
private final SimpleBroadcastReceiver mContextualSearchPackageReceiver =
|
||||
new SimpleBroadcastReceiver(UI_HELPER_EXECUTOR, (unused) -> requestUpdateProperties());
|
||||
private final SettingsCache.OnChangeListener mContextualSearchSettingChangedListener =
|
||||
this::onContextualSearchSettingChanged;
|
||||
protected final EventLogArray mEventLogArray = new EventLogArray(TAG, MAX_DEBUG_EVENT_SIZE);
|
||||
|
||||
// Cached value whether the ContextualSearch intent filter matched any enabled components.
|
||||
private boolean mIsContextualSearchIntentAvailable;
|
||||
private boolean mIsContextualSearchSettingEnabled;
|
||||
|
||||
protected final Context mContext;
|
||||
protected final String mContextualSearchPackage;
|
||||
protected final SystemUiProxy mSystemUiProxy;
|
||||
protected final TopTaskTracker mTopTaskTracker;
|
||||
protected Context mContext;
|
||||
protected String mContextualSearchPackage;
|
||||
|
||||
@Inject
|
||||
public ContextualSearchStateManager(
|
||||
@ApplicationContext Context context,
|
||||
SettingsCache settingsCache,
|
||||
SystemUiProxy systemUiProxy,
|
||||
TopTaskTracker topTaskTracker,
|
||||
DaggerSingletonTracker lifeCycle) {
|
||||
public ContextualSearchStateManager() {}
|
||||
|
||||
public ContextualSearchStateManager(Context context) {
|
||||
mContext = context;
|
||||
mContextualSearchPackage = mContext.getResources().getString(
|
||||
com.android.internal.R.string.config_defaultContextualSearchPackageName);
|
||||
mSystemUiProxy = systemUiProxy;
|
||||
mTopTaskTracker = topTaskTracker;
|
||||
|
||||
if (areAllContextualSearchFlagsDisabled()
|
||||
|| !context.getPackageManager().hasSystemFeature(FEATURE_CONTEXTUAL_SEARCH)) {
|
||||
@@ -115,20 +106,11 @@ public class ContextualSearchStateManager {
|
||||
context, mContextualSearchPackage, Intent.ACTION_PACKAGE_ADDED,
|
||||
Intent.ACTION_PACKAGE_CHANGED, Intent.ACTION_PACKAGE_REMOVED);
|
||||
|
||||
SettingsCache.OnChangeListener settingChangedListener =
|
||||
isEnabled -> mIsContextualSearchSettingEnabled = isEnabled;
|
||||
settingsCache.register(SEARCH_ALL_ENTRYPOINTS_ENABLED_URI, settingChangedListener);
|
||||
mIsContextualSearchSettingEnabled =
|
||||
settingsCache.getValue(SEARCH_ALL_ENTRYPOINTS_ENABLED_URI);
|
||||
|
||||
systemUiProxy.addOnStateChangeListener(mSysUiStateChangeListener);
|
||||
|
||||
lifeCycle.addCloseable(() -> {
|
||||
mContextualSearchPackageReceiver.unregisterReceiverSafely(mContext);
|
||||
unregisterSearchScreenSystemAction();
|
||||
settingsCache.unregister(SEARCH_ALL_ENTRYPOINTS_ENABLED_URI, settingChangedListener);
|
||||
systemUiProxy.removeOnStateChangeListener(mSysUiStateChangeListener);
|
||||
});
|
||||
SettingsCache.INSTANCE.get(context).register(SEARCH_ALL_ENTRYPOINTS_ENABLED_URI,
|
||||
mContextualSearchSettingChangedListener);
|
||||
onContextualSearchSettingChanged(
|
||||
SettingsCache.INSTANCE.get(context).getValue(SEARCH_ALL_ENTRYPOINTS_ENABLED_URI));
|
||||
SystemUiProxy.INSTANCE.get(mContext).addOnStateChangeListener(mSysUiStateChangeListener);
|
||||
}
|
||||
|
||||
/** Return {@code true} if the Settings toggle is enabled. */
|
||||
@@ -136,6 +118,10 @@ public class ContextualSearchStateManager {
|
||||
return mIsContextualSearchSettingEnabled;
|
||||
}
|
||||
|
||||
private void onContextualSearchSettingChanged(boolean isEnabled) {
|
||||
mIsContextualSearchSettingEnabled = isEnabled;
|
||||
}
|
||||
|
||||
/** Whether search supports showing on the lockscreen. */
|
||||
protected boolean supportsShowWhenLocked() {
|
||||
return false;
|
||||
@@ -222,7 +208,7 @@ public class ContextualSearchStateManager {
|
||||
|
||||
protected final void updateOverridesToSysUi() {
|
||||
// LPH commit haptic is always enabled
|
||||
mSystemUiProxy.setOverrideHomeButtonLongPress(
|
||||
SystemUiProxy.INSTANCE.get(mContext).setOverrideHomeButtonLongPress(
|
||||
getLPHDurationMillis().orElse(0L), getLPHCustomSlopMultiplier().orElse(0f), true);
|
||||
Log.i(TAG, "Sent LPH override to sysui: " + getLPHDurationMillis().orElse(0L) + ";"
|
||||
+ getLPHCustomSlopMultiplier().orElse(0f));
|
||||
@@ -241,8 +227,10 @@ public class ContextualSearchStateManager {
|
||||
new ContextualSearchInvoker(mContext).show(
|
||||
ENTRYPOINT_SYSTEM_ACTION);
|
||||
if (contextualSearchInvoked) {
|
||||
String runningPackage = mTopTaskTracker.getCachedTopTask(
|
||||
/* filterOnlyVisibleRecents */ true).getPackageName();
|
||||
String runningPackage =
|
||||
TopTaskTracker.INSTANCE.get(mContext).getCachedTopTask(
|
||||
/* filterOnlyVisibleRecents */
|
||||
true).getPackageName();
|
||||
StatsLogManager.newInstance(mContext).logger()
|
||||
.withPackageName(runningPackage)
|
||||
.log(LAUNCHER_LAUNCH_OMNI_SUCCESSFUL_SYSTEM_ACTION);
|
||||
@@ -271,6 +259,15 @@ public class ContextualSearchStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
mContextualSearchPackageReceiver.unregisterReceiverSafely(mContext);
|
||||
unregisterSearchScreenSystemAction();
|
||||
SettingsCache.INSTANCE.get(mContext).unregister(SEARCH_ALL_ENTRYPOINTS_ENABLED_URI,
|
||||
mContextualSearchSettingChangedListener);
|
||||
SystemUiProxy.INSTANCE.get(mContext).removeOnStateChangeListener(mSysUiStateChangeListener);
|
||||
}
|
||||
|
||||
protected final void addEventLog(String event) {
|
||||
synchronized (mEventLogArray) {
|
||||
mEventLogArray.addLog(event);
|
||||
|
||||
Reference in New Issue
Block a user