Use real IDP in DeviceProfileTest

- Mock WindowManagerProxy instead of IDP in DeviceProfileTest
- Extracted NavigationMode to standalone class
- Moved parseNavigationMode to WindowManagerProxy so it can be mocked
- Moved DeviceProfileTest to internal repo

Bug: 242086027
Test: DeviceProfileTest
Change-Id: Ia5a43293b1380f04d786d2adf8503cfd10f7674a
This commit is contained in:
Alex Chau
2022-09-02 17:27:11 +01:00
parent 77593150da
commit e818bcb997
28 changed files with 111 additions and 1551 deletions

View File

@@ -52,6 +52,7 @@ import com.android.launcher3.util.WindowBounds;
import java.io.PrintWriter;
import java.util.List;
import java.util.Locale;
@SuppressLint("NewApi")
public class DeviceProfile {
@@ -1354,6 +1355,10 @@ public class DeviceProfile {
return "\t" + name + ": " + value + "px (" + dpiFromPx(value, mMetrics.densityDpi) + "dp)";
}
private String dpPointFToString(String name, PointF value) {
return String.format(Locale.ENGLISH, "\t%s: PointF(%.1f, %.1f)dp", name, value.x, value.y);
}
/** Dumps various DeviceProfile variables to the specified writer. */
public void dump(Context context, String prefix, PrintWriter writer) {
writer.println(prefix + "DeviceProfile:");
@@ -1389,7 +1394,7 @@ public class DeviceProfile {
writer.println(prefix + "\tinv.numSearchContainerColumns: "
+ inv.numSearchContainerColumns);
writer.println(prefix + "\tminCellSize: " + inv.minCellSize[mTypeIndex] + "dp");
writer.println(prefix + dpPointFToString("minCellSize", inv.minCellSize[mTypeIndex]));
writer.println(prefix + pxToDpStr("cellWidthPx", cellWidthPx));
writer.println(prefix + pxToDpStr("cellHeightPx", cellHeightPx));
@@ -1669,7 +1674,7 @@ public class DeviceProfile {
mTransposeLayoutWithOrientation = !mInfo.isTablet(mWindowBounds);
}
if (mIsGestureMode == null) {
mIsGestureMode = DisplayController.getNavigationMode(mContext).hasGestures;
mIsGestureMode = mInfo.navigationMode.hasGestures;
}
if (mDotRendererCache == null) {
mDotRendererCache = new SparseArray<>();