Merge "Removing unused SplitScreen bounds notification from systemUI" into tm-qpr-dev
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.quickstep;
|
package com.android.quickstep;
|
||||||
|
|
||||||
|
import static android.accessibilityservice.AccessibilityService.GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS;
|
||||||
import static android.view.MotionEvent.ACTION_CANCEL;
|
import static android.view.MotionEvent.ACTION_CANCEL;
|
||||||
import static android.view.MotionEvent.ACTION_DOWN;
|
import static android.view.MotionEvent.ACTION_DOWN;
|
||||||
import static android.view.MotionEvent.ACTION_UP;
|
import static android.view.MotionEvent.ACTION_UP;
|
||||||
@@ -47,7 +48,6 @@ import android.app.Service;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.graphics.Region;
|
import android.graphics.Region;
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Icon;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@@ -87,7 +87,6 @@ import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
|
|||||||
import com.android.launcher3.util.DisplayController;
|
import com.android.launcher3.util.DisplayController;
|
||||||
import com.android.launcher3.util.OnboardingPrefs;
|
import com.android.launcher3.util.OnboardingPrefs;
|
||||||
import com.android.launcher3.util.TraceHelper;
|
import com.android.launcher3.util.TraceHelper;
|
||||||
import com.android.launcher3.util.WindowBounds;
|
|
||||||
import com.android.quickstep.inputconsumers.AccessibilityInputConsumer;
|
import com.android.quickstep.inputconsumers.AccessibilityInputConsumer;
|
||||||
import com.android.quickstep.inputconsumers.AssistantInputConsumer;
|
import com.android.quickstep.inputconsumers.AssistantInputConsumer;
|
||||||
import com.android.quickstep.inputconsumers.DeviceLockedInputConsumer;
|
import com.android.quickstep.inputconsumers.DeviceLockedInputConsumer;
|
||||||
@@ -104,7 +103,6 @@ import com.android.quickstep.util.ActiveGestureLog;
|
|||||||
import com.android.quickstep.util.ActiveGestureLog.CompoundString;
|
import com.android.quickstep.util.ActiveGestureLog.CompoundString;
|
||||||
import com.android.quickstep.util.ProtoTracer;
|
import com.android.quickstep.util.ProtoTracer;
|
||||||
import com.android.quickstep.util.ProxyScreenStatusProvider;
|
import com.android.quickstep.util.ProxyScreenStatusProvider;
|
||||||
import com.android.quickstep.util.SplitScreenBounds;
|
|
||||||
import com.android.systemui.shared.recents.IOverviewProxy;
|
import com.android.systemui.shared.recents.IOverviewProxy;
|
||||||
import com.android.systemui.shared.recents.ISystemUiProxy;
|
import com.android.systemui.shared.recents.ISystemUiProxy;
|
||||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||||
@@ -143,18 +141,7 @@ public class TouchInteractionService extends Service
|
|||||||
private static final boolean BUBBLES_HOME_GESTURE_ENABLED =
|
private static final boolean BUBBLES_HOME_GESTURE_ENABLED =
|
||||||
SystemProperties.getBoolean("persist.wm.debug.bubbles_home_gesture", true);
|
SystemProperties.getBoolean("persist.wm.debug.bubbles_home_gesture", true);
|
||||||
|
|
||||||
private static final String KEY_BACK_NOTIFICATION_COUNT = "backNotificationCount";
|
|
||||||
private static final String NOTIFY_ACTION_BACK = "com.android.quickstep.action.BACK_GESTURE";
|
|
||||||
private static final String HAS_ENABLED_QUICKSTEP_ONCE = "launcher.has_enabled_quickstep_once";
|
private static final String HAS_ENABLED_QUICKSTEP_ONCE = "launcher.has_enabled_quickstep_once";
|
||||||
private static final int MAX_BACK_NOTIFICATION_COUNT = 3;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* System Action ID to show all apps.
|
|
||||||
* TODO: Use AccessibilityService's corresponding global action constant in S
|
|
||||||
*/
|
|
||||||
private static final int SYSTEM_ACTION_ID_ALL_APPS = 14;
|
|
||||||
|
|
||||||
private int mBackGestureNotificationCounter = -1;
|
|
||||||
|
|
||||||
private final TISBinder mTISBinder = new TISBinder();
|
private final TISBinder mTISBinder = new TISBinder();
|
||||||
|
|
||||||
@@ -265,12 +252,6 @@ public class TouchInteractionService extends Service
|
|||||||
MAIN_EXECUTOR.execute(() -> mDeviceState.setDeferredGestureRegion(region));
|
MAIN_EXECUTOR.execute(() -> mDeviceState.setDeferredGestureRegion(region));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSplitScreenSecondaryBoundsChanged(Rect bounds, Rect insets) {
|
|
||||||
WindowBounds wb = new WindowBounds(bounds, insets);
|
|
||||||
MAIN_EXECUTOR.execute(() -> SplitScreenBounds.INSTANCE.setSecondaryWindowBounds(wb));
|
|
||||||
}
|
|
||||||
|
|
||||||
@BinderThread
|
@BinderThread
|
||||||
@Override
|
@Override
|
||||||
public void onScreenTurnedOn() {
|
public void onScreenTurnedOn() {
|
||||||
@@ -484,8 +465,6 @@ public class TouchInteractionService extends Service
|
|||||||
|
|
||||||
// Temporarily disable model preload
|
// Temporarily disable model preload
|
||||||
// new ModelPreload().start(this);
|
// new ModelPreload().start(this);
|
||||||
mBackGestureNotificationCounter = Math.max(0, Utilities.getDevicePrefs(this)
|
|
||||||
.getInt(KEY_BACK_NOTIFICATION_COUNT, MAX_BACK_NOTIFICATION_COUNT));
|
|
||||||
resetHomeBounceSeenOnQuickstepEnabledFirstTime();
|
resetHomeBounceSeenOnQuickstepEnabledFirstTime();
|
||||||
|
|
||||||
mOverviewComponentObserver.setOverviewChangeListener(this::onOverviewTargetChange);
|
mOverviewComponentObserver.setOverviewChangeListener(this::onOverviewTargetChange);
|
||||||
@@ -523,11 +502,11 @@ public class TouchInteractionService extends Service
|
|||||||
Icon.createWithResource(this, R.drawable.ic_apps),
|
Icon.createWithResource(this, R.drawable.ic_apps),
|
||||||
getString(R.string.all_apps_label),
|
getString(R.string.all_apps_label),
|
||||||
getString(R.string.all_apps_label),
|
getString(R.string.all_apps_label),
|
||||||
PendingIntent.getActivity(this, SYSTEM_ACTION_ID_ALL_APPS, intent,
|
PendingIntent.getActivity(this, GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS, intent,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE));
|
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE));
|
||||||
am.registerSystemAction(allAppsAction, SYSTEM_ACTION_ID_ALL_APPS);
|
am.registerSystemAction(allAppsAction, GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS);
|
||||||
} else {
|
} else {
|
||||||
am.unregisterSystemAction(SYSTEM_ACTION_ID_ALL_APPS);
|
am.unregisterSystemAction(GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
StatefulActivity newOverviewActivity = mOverviewComponentObserver.getActivityInterface()
|
StatefulActivity newOverviewActivity = mOverviewComponentObserver.getActivityInterface()
|
||||||
@@ -605,7 +584,7 @@ public class TouchInteractionService extends Service
|
|||||||
ProtoTracer.INSTANCE.get(this).remove(this);
|
ProtoTracer.INSTANCE.get(this).remove(this);
|
||||||
|
|
||||||
getSystemService(AccessibilityManager.class)
|
getSystemService(AccessibilityManager.class)
|
||||||
.unregisterSystemAction(SYSTEM_ACTION_ID_ALL_APPS);
|
.unregisterSystemAction(GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS);
|
||||||
|
|
||||||
mTaskbarManager.destroy();
|
mTaskbarManager.destroy();
|
||||||
sConnected = false;
|
sConnected = false;
|
||||||
|
|||||||
@@ -1,107 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2020 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.quickstep.util;
|
|
||||||
|
|
||||||
import static android.view.Surface.ROTATION_0;
|
|
||||||
import static android.view.Surface.ROTATION_180;
|
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.view.WindowMetrics;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.annotation.UiThread;
|
|
||||||
|
|
||||||
import com.android.launcher3.R;
|
|
||||||
import com.android.launcher3.util.DisplayController;
|
|
||||||
import com.android.launcher3.util.WindowBounds;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Utility class to hold the information abound a window bounds for split screen
|
|
||||||
*/
|
|
||||||
@TargetApi(Build.VERSION_CODES.R)
|
|
||||||
public class SplitScreenBounds {
|
|
||||||
|
|
||||||
public static final SplitScreenBounds INSTANCE = new SplitScreenBounds();
|
|
||||||
private final ArrayList<OnChangeListener> mListeners = new ArrayList<>();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private WindowBounds mBounds;
|
|
||||||
|
|
||||||
private SplitScreenBounds() { }
|
|
||||||
|
|
||||||
@UiThread
|
|
||||||
public void setSecondaryWindowBounds(@NonNull WindowBounds bounds) {
|
|
||||||
if (!bounds.equals(mBounds)) {
|
|
||||||
mBounds = bounds;
|
|
||||||
for (OnChangeListener listener : mListeners) {
|
|
||||||
listener.onSecondaryWindowBoundsChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public @NonNull WindowBounds getSecondaryWindowBounds(Context context) {
|
|
||||||
if (mBounds == null) {
|
|
||||||
mBounds = createDefaultWindowBounds(context);
|
|
||||||
}
|
|
||||||
return mBounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates window bounds as 50% of device size
|
|
||||||
*/
|
|
||||||
private static WindowBounds createDefaultWindowBounds(Context context) {
|
|
||||||
WindowMetrics wm = context.getSystemService(WindowManager.class).getMaximumWindowMetrics();
|
|
||||||
WindowBounds bounds = WindowBounds.fromWindowMetrics(wm);
|
|
||||||
|
|
||||||
int rotation = DisplayController.INSTANCE.get(context).getInfo().rotation;
|
|
||||||
int halfDividerSize = context.getResources()
|
|
||||||
.getDimensionPixelSize(R.dimen.multi_window_task_divider_size) / 2;
|
|
||||||
|
|
||||||
if (rotation == ROTATION_0 || rotation == ROTATION_180) {
|
|
||||||
bounds.bounds.top = bounds.insets.top + bounds.availableSize.y / 2 + halfDividerSize;
|
|
||||||
bounds.insets.top = 0;
|
|
||||||
} else {
|
|
||||||
bounds.bounds.left = bounds.insets.left + bounds.availableSize.x / 2 + halfDividerSize;
|
|
||||||
bounds.insets.left = 0;
|
|
||||||
}
|
|
||||||
return new WindowBounds(bounds.bounds, bounds.insets);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addOnChangeListener(OnChangeListener listener) {
|
|
||||||
mListeners.add(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeOnChangeListener(OnChangeListener listener) {
|
|
||||||
mListeners.remove(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface to receive window bounds changes
|
|
||||||
*/
|
|
||||||
public interface OnChangeListener {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when window bounds for secondary window changes
|
|
||||||
*/
|
|
||||||
void onSecondaryWindowBoundsChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -178,7 +178,6 @@ import com.android.quickstep.util.GroupTask;
|
|||||||
import com.android.quickstep.util.LayoutUtils;
|
import com.android.quickstep.util.LayoutUtils;
|
||||||
import com.android.quickstep.util.RecentsOrientedState;
|
import com.android.quickstep.util.RecentsOrientedState;
|
||||||
import com.android.quickstep.util.SplitAnimationTimings;
|
import com.android.quickstep.util.SplitAnimationTimings;
|
||||||
import com.android.quickstep.util.SplitScreenBounds;
|
|
||||||
import com.android.quickstep.util.SplitSelectStateController;
|
import com.android.quickstep.util.SplitSelectStateController;
|
||||||
import com.android.quickstep.util.SurfaceTransaction;
|
import com.android.quickstep.util.SurfaceTransaction;
|
||||||
import com.android.quickstep.util.SurfaceTransactionApplier;
|
import com.android.quickstep.util.SurfaceTransactionApplier;
|
||||||
@@ -210,7 +209,7 @@ import java.util.function.Consumer;
|
|||||||
public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_TYPE>,
|
public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_TYPE>,
|
||||||
STATE_TYPE extends BaseState<STATE_TYPE>> extends PagedView implements Insettable,
|
STATE_TYPE extends BaseState<STATE_TYPE>> extends PagedView implements Insettable,
|
||||||
TaskThumbnailCache.HighResLoadingState.HighResLoadingStateChangedCallback,
|
TaskThumbnailCache.HighResLoadingState.HighResLoadingStateChangedCallback,
|
||||||
TaskVisualsChangeListener, SplitScreenBounds.OnChangeListener {
|
TaskVisualsChangeListener {
|
||||||
|
|
||||||
private static final String TAG = "RecentsView";
|
private static final String TAG = "RecentsView";
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
@@ -948,7 +947,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
SystemUiProxy.INSTANCE.get(getContext()).setPipAnimationListener(
|
SystemUiProxy.INSTANCE.get(getContext()).setPipAnimationListener(
|
||||||
mIPipAnimationListener);
|
mIPipAnimationListener);
|
||||||
mOrientationState.initListeners();
|
mOrientationState.initListeners();
|
||||||
SplitScreenBounds.INSTANCE.addOnChangeListener(this);
|
|
||||||
mTaskOverlayFactory.initListeners();
|
mTaskOverlayFactory.initListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -965,7 +963,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
executeSideTaskLaunchCallback();
|
executeSideTaskLaunchCallback();
|
||||||
RecentsModel.INSTANCE.get(getContext()).removeThumbnailChangeListener(this);
|
RecentsModel.INSTANCE.get(getContext()).removeThumbnailChangeListener(this);
|
||||||
SystemUiProxy.INSTANCE.get(getContext()).setPipAnimationListener(null);
|
SystemUiProxy.INSTANCE.get(getContext()).setPipAnimationListener(null);
|
||||||
SplitScreenBounds.INSTANCE.removeOnChangeListener(this);
|
|
||||||
mIPipAnimationListener.setActivityAndRecentsView(null, null);
|
mIPipAnimationListener.setActivityAndRecentsView(null, null);
|
||||||
mOrientationState.destroyListeners();
|
mOrientationState.destroyListeners();
|
||||||
mTaskOverlayFactory.removeListeners();
|
mTaskOverlayFactory.removeListeners();
|
||||||
@@ -5209,12 +5206,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSecondaryWindowBoundsChanged() {
|
|
||||||
// Invalidate the task view size
|
|
||||||
setInsets(mInsets);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Enables or disables modal state for RecentsView */
|
/** Enables or disables modal state for RecentsView */
|
||||||
public abstract void setModalStateEnabled(boolean isModalState, boolean animate);
|
public abstract void setModalStateEnabled(boolean isModalState, boolean animate);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user