Replacing custom parcelables with platform types for test APIs

Bug: 377772352
Flag: EXEMPT test only
Test: Presubmit
Change-Id: Ie464c67adf6502aee1fe65ef643e1a67260b820f
This commit is contained in:
Sunny Goyal committed 2024-12-26 17:19:15 -08:00
1 parent eda3c8ec60
commit a39a09ba6a
13 files changed
+52 -307

No files matched your search

@@ -55,9 +55,7 @@ import com.android.launcher3.ShortcutAndWidgetContainer;
import com.android.launcher3.Workspace;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.icons.ClockDrawableWrapper;
import com.android.launcher3.testing.shared.HotseatCellCenterRequest;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.testing.shared.WorkspaceCellCenterRequest;
import com.android.launcher3.util.ActivityLifecycleCallbacksAdapter;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.ResourceBasedOverride;
@@ -265,15 +263,15 @@ public class TestInformationHandler implements ResourceBasedOverride {
});
case TestProtocol.REQUEST_WORKSPACE_CELL_CENTER: {
final WorkspaceCellCenterRequest request = extra.getParcelable(
TestProtocol.TEST_INFO_REQUEST_FIELD);
Rect cellPos = extra.getParcelable(TestProtocol.TEST_INFO_PARAM_CELL_SPAN);
return getLauncherUIProperty(Bundle::putParcelable, launcher -> {
final Workspace<?> workspace = launcher.getWorkspace();
// TODO(b/216387249): allow caller selecting different pages.
CellLayout cellLayout = (CellLayout) workspace.getPageAt(
workspace.getCurrentPage());
final Rect cellRect = getDescendantRectRelativeToDragLayerForCell(launcher,
cellLayout, request.cellX, request.cellY, request.spanX, request.spanY);
cellLayout, cellPos.left, cellPos.top, cellPos.width(),
cellPos.height());
return new Point(cellRect.centerX(), cellRect.centerY());
});
}
@@ -292,12 +290,11 @@ public class TestInformationHandler implements ResourceBasedOverride {
}
case TestProtocol.REQUEST_HOTSEAT_CELL_CENTER: {
final HotseatCellCenterRequest request = extra.getParcelable(
TestProtocol.TEST_INFO_REQUEST_FIELD);
int cellIndex = extra.getInt(TestProtocol.TEST_INFO_PARAM_INDEX);
return getLauncherUIProperty(Bundle::putParcelable, launcher -> {
final Hotseat hotseat = launcher.getHotseat();
final Rect cellRect = getDescendantRectRelativeToDragLayerForCell(launcher,
hotseat, request.cellInd, /* cellY= */ 0,
hotseat, cellIndex, /* cellY= */ 0,
/* spanX= */ 1, /* spanY= */ 1);
// TODO(b/234322284): return the real center point.
return new Point(cellRect.left + (cellRect.right - cellRect.left) / 3,