Lawnchair: Fix serveral imports, fix QuickstepCompat* compilation

- Note: Currently, there is no real Q compat. Current Q Compat is the
  new R Compat. Yikes.
This commit is contained in:
Kshitij Gupta
2021-02-05 22:23:08 +05:30
parent 64f16600ea
commit f9fd430d68
23 changed files with 79 additions and 107 deletions

View File

@@ -15,7 +15,7 @@ import java.util.List;
public abstract class ActivityManagerCompat {
public abstract List<ActivityManager.RunningTaskInfo> getFilteredTasks(
int maxNum, int ignoreActivityType, int ignoreWindowingMode) throws RemoteException;
int maxNum, boolean filterOnlyVisibleRecents) throws RemoteException;
public abstract List<ActivityManager.RecentTaskInfo> getRecentTasks(
int maxNum, int flags, int userId) throws RemoteException;
@@ -31,8 +31,7 @@ public abstract class ActivityManagerCompat {
public abstract int startActivityFromRecents(int taskId, Bundle bOptions) throws RemoteException;
public abstract boolean setTaskWindowingModeSplitScreenPrimary(
int taskId, int createMode, boolean toTop, boolean animate,
Rect initialBounds, boolean showRecents) throws RemoteException;
int taskId, boolean onTop) throws RemoteException;
public abstract boolean removeTask(int taskId) throws RemoteException;

View File

@@ -3,12 +3,17 @@ package xyz.paphonb.quickstep.compat;
import android.graphics.Rect;
import android.view.IRecentsAnimationController;
import android.view.RemoteAnimationTarget;
import android.app.ActivityManager.TaskSnapshot;
public interface RecentsAnimationRunner {
void onAnimationStart(IRecentsAnimationController controller,
RemoteAnimationTarget[] apps, Rect homeContentInsets,
Rect minimizedHomeBounds);
RemoteAnimationTarget[] apps,
RemoteAnimationTarget[] wallpaperTargets,
Rect homeContentInsets,
Rect minimizedHomeBounds);
void onAnimationCanceled(boolean deferredWithScreenshot);
void onAnimationCanceled(TaskSnapshot taskSnapshot);
void onTaskAppeared(RemoteAnimationTarget app);
}

View File

@@ -1,6 +1,9 @@
package xyz.paphonb.quickstep.compat.pie;
import static android.app.ActivityManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import android.app.ActivityManager;
import android.app.ActivityManager.TaskSnapshot;
@@ -15,6 +18,8 @@ import android.view.IRecentsAnimationController;
import android.view.IRecentsAnimationRunner;
import android.view.RemoteAnimationTarget;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
@@ -24,35 +29,41 @@ import xyz.paphonb.quickstep.compat.RecentsAnimationRunner;
public class ActivityManagerCompatVP extends ActivityManagerCompat {
@Override
public List<ActivityManager.RunningTaskInfo> getFilteredTasks(int maxNum, int ignoreActivityType, int ignoreWindowingMode) throws RemoteException {
return ActivityManager.getService().getFilteredTasks(maxNum, ignoreActivityType, ignoreWindowingMode);
public List<ActivityManager.RunningTaskInfo> getFilteredTasks(int maxNum,
boolean filterOnlyVisibleRecents) throws RemoteException {
return ActivityManager.getService()
.getFilteredTasks(maxNum, ACTIVITY_TYPE_UNDEFINED, WINDOWING_MODE_UNDEFINED);
}
@Override
public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum, int flags, int userId) throws RemoteException {
public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum, int flags, int userId)
throws RemoteException {
return ActivityManager.getService().getRecentTasks(maxNum, flags, userId).getList();
}
@Override
public ActivityManager.TaskSnapshot getTaskSnapshot(int taskId, boolean reducedResolution) throws RemoteException {
public ActivityManager.TaskSnapshot getTaskSnapshot(int taskId, boolean reducedResolution)
throws RemoteException {
return ActivityManager.getService().getTaskSnapshot(taskId, reducedResolution);
}
@Override
public void startRecentsActivity(Intent intent, IAssistDataReceiver assistDataReceiver, final RecentsAnimationRunner recentsAnimationRunner) throws RemoteException {
public void startRecentsActivity(Intent intent, IAssistDataReceiver assistDataReceiver,
final RecentsAnimationRunner recentsAnimationRunner) throws RemoteException {
IRecentsAnimationRunner runner = null;
if (recentsAnimationRunner != null) {
runner = new IRecentsAnimationRunner.Stub() {
@Override
public void onAnimationStart(IRecentsAnimationController controller,
RemoteAnimationTarget[] apps, Rect homeContentInsets,
Rect minimizedHomeBounds) {
recentsAnimationRunner.onAnimationStart(controller, apps, homeContentInsets, minimizedHomeBounds);
RemoteAnimationTarget[] apps, Rect homeContentInsets,
Rect minimizedHomeBounds) {
recentsAnimationRunner.onAnimationStart(controller, apps,
new RemoteAnimationTarget[0], homeContentInsets, minimizedHomeBounds);
}
@Override
public void onAnimationCanceled() {
recentsAnimationRunner.onAnimationCanceled(false);
recentsAnimationRunner.onAnimationCanceled(null);
}
};
}
@@ -71,10 +82,9 @@ public class ActivityManagerCompatVP extends ActivityManagerCompat {
@Override
public boolean setTaskWindowingModeSplitScreenPrimary(
int taskId, int createMode, boolean toTop, boolean animate,
Rect initialBounds, boolean showRecents) throws RemoteException {
int taskId, boolean toTop) throws RemoteException {
return ActivityManager.getService().setTaskWindowingModeSplitScreenPrimary(taskId,
createMode, toTop, animate, initialBounds, showRecents);
SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT, toTop, true, null, true);
}
@Override

View File

@@ -24,35 +24,48 @@ import xyz.paphonb.quickstep.compat.RecentsAnimationRunner;
public class ActivityManagerCompatVQ extends ActivityManagerCompat {
@Override
public List<ActivityManager.RunningTaskInfo> getFilteredTasks(int maxNum, int ignoreActivityType, int ignoreWindowingMode) throws RemoteException {
return ActivityTaskManager.getService().getFilteredTasks(maxNum, ignoreActivityType, ignoreWindowingMode);
public List<ActivityManager.RunningTaskInfo> getFilteredTasks(int maxNum,
boolean filterOnlyVisibleRecents) throws RemoteException {
return ActivityTaskManager.getService().getFilteredTasks(maxNum, filterOnlyVisibleRecents);
}
@Override
public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum, int flags, int userId) throws RemoteException {
public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum, int flags, int userId)
throws RemoteException {
return ActivityTaskManager.getService().getRecentTasks(maxNum, flags, userId).getList();
}
@Override
public ActivityManager.TaskSnapshot getTaskSnapshot(int taskId, boolean reducedResolution) throws RemoteException {
public ActivityManager.TaskSnapshot getTaskSnapshot(int taskId, boolean reducedResolution)
throws RemoteException {
return ActivityTaskManager.getService().getTaskSnapshot(taskId, reducedResolution);
}
@Override
public void startRecentsActivity(Intent intent, IAssistDataReceiver assistDataReceiver, final RecentsAnimationRunner recentsAnimationRunner) throws RemoteException {
public void startRecentsActivity(Intent intent, IAssistDataReceiver assistDataReceiver,
final RecentsAnimationRunner recentsAnimationRunner) throws RemoteException {
IRecentsAnimationRunner runner = null;
if (recentsAnimationRunner != null) {
runner = new IRecentsAnimationRunner.Stub() {
@Override
public void onAnimationStart(IRecentsAnimationController controller,
RemoteAnimationTarget[] apps, Rect homeContentInsets,
Rect minimizedHomeBounds) {
recentsAnimationRunner.onAnimationStart(controller, apps, homeContentInsets, minimizedHomeBounds);
RemoteAnimationTarget[] apps,
RemoteAnimationTarget[] wallpaperTargets,
Rect homeContentInsets,
Rect minimizedHomeBounds) {
recentsAnimationRunner
.onAnimationStart(controller, apps, wallpaperTargets, homeContentInsets,
minimizedHomeBounds);
}
@Override
public void onAnimationCanceled(boolean deferredWithScreenshot) {
recentsAnimationRunner.onAnimationCanceled(deferredWithScreenshot);
public void onAnimationCanceled(TaskSnapshot taskSnapshot) {
recentsAnimationRunner.onAnimationCanceled(taskSnapshot);
}
@Override
public void onTaskAppeared(RemoteAnimationTarget app) {
recentsAnimationRunner.onTaskAppeared(app);
}
};
}
@@ -71,10 +84,9 @@ public class ActivityManagerCompatVQ extends ActivityManagerCompat {
@Override
public boolean setTaskWindowingModeSplitScreenPrimary(
int taskId, int createMode, boolean toTop, boolean animate,
Rect initialBounds, boolean showRecents) throws RemoteException {
return ActivityTaskManager.getService().setTaskWindowingModeSplitScreenPrimary(taskId,
createMode, toTop, animate, initialBounds, showRecents);
int taskId, boolean toTop) throws RemoteException {
return ActivityTaskManager.getService()
.setTaskWindowingModeSplitScreenPrimary(taskId, toTop);
}
@Override

View File

@@ -1,54 +0,0 @@
/*
* Copyright (C) 2018 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.systemui.shared.system;
import android.os.Build;
import android.util.StatsLog;
/**
* Wrapper class to make StatsLog hidden API accessible.
*/
public class StatsLogCompat {
/**
* StatsLog.write(StatsLog.LAUNCHER_EVENT, int action, int src_state, int dst_state,
* byte[] extension, boolean is_swipe_up_enabled);
*/
public static void write(int action, int srcState, int dstState, byte [] extension,
boolean swipeUpEnabled) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return;
StatsLog.write(19, action, srcState, dstState, extension,
swipeUpEnabled);
}
/**
* StatsLog.write(StatsLog.STYLE_EVENT, action, colorPackageHash,
* fontPackageHash, shapePackageHash, clockPackageHash,
* launcherGrid, wallpaperCategoryHash, wallpaperIdHash,
* colorPreference, locationPreference);
*/
public static void write(int action, int colorPackageHash,
int fontPackageHash, int shapePackageHash, int clockPackageHash,
int launcherGrid, int wallpaperCategoryHash, int wallpaperIdHash,
int colorPreference, int locationPreference) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return;
StatsLog.write(179, action, colorPackageHash,
fontPackageHash, shapePackageHash, clockPackageHash,
launcherGrid, wallpaperCategoryHash, wallpaperIdHash,
colorPreference, locationPreference);
}
}

View File

@@ -21,7 +21,7 @@ import android.graphics.Rect;
import android.os.CancellationSignal;
import android.view.View;
import com.android.launcher3.DragSource;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppWidgetProviderInfo;
import com.android.launcher3.PendingAddItemInfo;

View File

@@ -18,7 +18,7 @@
package ch.deletescape.lawnchair.folder
import com.android.launcher3.FolderInfo
import com.android.launcher3.WorkspaceItemInfo
import com.android.launcher3.model.data.WorkspaceItemInfo
class FirstItemProvider(private val info: FolderInfo) : FolderInfo.FolderListener {

View File

@@ -22,7 +22,7 @@ import android.content.pm.LauncherActivityInfo
import android.content.pm.ShortcutInfo
import android.graphics.drawable.AdaptiveIconDrawable
import android.graphics.drawable.Drawable
import com.android.launcher3.ItemInfo
import com.android.launcher3.model.data.ItemInfo
import com.android.launcher3.R
import com.android.launcher3.Utilities
import com.google.android.apps.nexuslauncher.DynamicIconProvider

View File

@@ -29,7 +29,7 @@ import android.os.ParcelFileDescriptor
import android.text.TextUtils
import ch.deletescape.lawnchair.adaptive.AdaptiveIconGenerator
import com.android.launcher3.FastBitmapDrawable
import com.android.launcher3.ItemInfo
import com.android.launcher3.model.data.ItemInfo
import com.android.launcher3.Utilities
import com.android.launcher3.util.ComponentKey
import java.io.FileDescriptor

View File

@@ -24,7 +24,7 @@ import ch.deletescape.lawnchair.lawnchairPrefs
import ch.deletescape.lawnchair.useApplicationContext
import ch.deletescape.lawnchair.util.SingletonHolder
import com.android.launcher3.FolderInfo
import com.android.launcher3.ItemInfo
import com.android.launcher3.model.data.ItemInfo
import com.android.launcher3.R
class FolderInfoProvider(context: Context) : CustomInfoProvider<FolderInfo>(context) {

View File

@@ -25,7 +25,7 @@ import ch.deletescape.lawnchair.iconpack.IconPackManager
import ch.deletescape.lawnchair.useApplicationContext
import ch.deletescape.lawnchair.util.SingletonHolder
import com.android.launcher3.LauncherAppState
import com.android.launcher3.WorkspaceItemInfo
import com.android.launcher3.model.data.WorkspaceItemInfo
import com.android.launcher3.compat.LauncherAppsCompat
import com.android.launcher3.icons.LauncherIcons

View File

@@ -29,7 +29,7 @@ import ch.deletescape.lawnchair.sesame.Sesame
import ch.deletescape.lawnchair.util.LawnchairSingletonHolder
import ch.deletescape.lawnchair.util.hasFlag
import com.android.launcher3.*
import com.android.launcher3.ItemInfoWithIcon.FLAG_SYSTEM_YES
import com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_SYSTEM_YES
import com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION
import com.android.launcher3.compat.LauncherAppsCompat
import com.android.launcher3.popup.SystemShortcut

View File

@@ -18,7 +18,7 @@ package com.android.launcher3;
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_ICON_BADGED;
import android.Manifest.permission;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_ICON_BADGED;
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_ICON_BADGED;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;

View File

@@ -45,13 +45,13 @@ import ch.deletescape.lawnchair.predictions.LawnchairAppPredictor;
import ch.deletescape.lawnchair.preferences.MultiSelectTabPreference;
import com.android.launcher3.AppInfo;
import com.android.launcher3.FolderInfo;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.ItemInfoWithIcon;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.widget.WidgetsBottomSheet;

View File

@@ -5,7 +5,7 @@ import android.view.View;
import androidx.annotation.Keep;
import ch.deletescape.lawnchair.override.CustomInfoProvider;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.popup.SystemShortcut;

View File

@@ -4,7 +4,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.R;
import com.android.launcher3.SecondaryDropTarget;
import com.android.launcher3.logging.LoggerUtils;

View File

@@ -19,7 +19,7 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.AppInfo;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.ItemInfoWithIcon;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.AllAppsRecyclerView;

View File

@@ -5,8 +5,8 @@ import android.graphics.Rect;
import android.view.View;
import com.android.launcher3.InstallShortcutReceiver;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.compat.ShortcutConfigActivityInfo;
import com.android.launcher3.dragndrop.BaseItemDragListener;
import com.android.launcher3.userevent.nano.LauncherLogProto;

View File

@@ -2,7 +2,7 @@ package com.google.android.apps.nexuslauncher.search;
import android.content.Intent;
import com.android.launcher3.ItemInfoWithIcon;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.util.ComponentKey;
public class AppItemInfoWithIcon extends ItemInfoWithIcon {

View File

@@ -7,7 +7,7 @@ import android.view.View;
import android.widget.Toast;
import com.android.launcher3.BaseActivity;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;

View File

@@ -2,7 +2,7 @@ package com.google.android.apps.nexuslauncher.search;
import android.content.SharedPreferences;
import com.android.launcher3.ItemInfoWithIcon;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherCallbacks;
import com.android.launcher3.icons.IconCache;

View File

@@ -4,7 +4,7 @@ import android.content.Context;
import android.view.View;
import android.widget.FrameLayout;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.logging.StatsLogUtils;
import com.android.launcher3.userevent.nano.LauncherLogProto;

View File

@@ -19,7 +19,7 @@ import ch.deletescape.lawnchair.smartspace.LawnchairSmartspaceController.CardDat
import ch.deletescape.lawnchair.smartspace.LawnchairSmartspaceController.WeatherData;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;