mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 15:56:49 +00:00
Fix Tapl drag to folder issue on S5 and R3
Bug: 205015793 Bug: 205014516 Test: atest Launcher3Tests Test: https://android-build.googleplex.com/builds/abtd/run/L47800000953216369 Test: https://android-build.googleplex.com/builds/abtd/run/L63300000953213948 Change-Id: If481d2b6503e8d47953b00c102719c447f43da41
This commit is contained in:
@@ -33,6 +33,7 @@ import android.content.pm.LauncherActivityInfo;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Point;
|
||||
import android.os.Debug;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
@@ -55,6 +56,8 @@ import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.statemanager.StateManager;
|
||||
import com.android.launcher3.tapl.HomeAllApps;
|
||||
import com.android.launcher3.tapl.HomeAppIcon;
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation;
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation.ContainerType;
|
||||
import com.android.launcher3.tapl.TestHelpers;
|
||||
@@ -602,4 +605,26 @@ public abstract class AbstractLauncherUiTest {
|
||||
|
||||
protected void onLauncherActivityClose(Launcher launcher) {
|
||||
}
|
||||
|
||||
protected HomeAppIcon createShortcutInCenterIfNotExist(String name) {
|
||||
Point dimension = mLauncher.getWorkspace().getIconGridDimensions();
|
||||
return createShortcutIfNotExist(name, dimension.x / 2, dimension.y / 2);
|
||||
}
|
||||
|
||||
protected HomeAppIcon createShortcutIfNotExist(String name, int cellX, int cellY) {
|
||||
HomeAppIcon homeAppIcon = mLauncher.getWorkspace().tryGetWorkspaceAppIcon(name);
|
||||
if (homeAppIcon == null) {
|
||||
HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
|
||||
allApps.freeze();
|
||||
try {
|
||||
allApps.getAppIcon(name).dragToWorkspace(cellX, cellY);
|
||||
} finally {
|
||||
allApps.unfreeze();
|
||||
}
|
||||
homeAppIcon = mLauncher.getWorkspace().getWorkspaceAppIcon(name);
|
||||
}
|
||||
return homeAppIcon;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user