Restart Activity when the display bounds or insets are changed.
Without this, Maps shows the current location icon in the previous center.
Bug: 191271445
Test: Change the cluster display size and check if Maps will show
the current location icon in the center of the changed TDA.
Change-Id: I4c72588835e6c44bb5547f3926d5744151f55650
diff --git a/ClusterHomeSample/src/com/android/car/cluster/home/ClusterHomeApplication.java b/ClusterHomeSample/src/com/android/car/cluster/home/ClusterHomeApplication.java
index dc4fdc1..4f89c88 100644
--- a/ClusterHomeSample/src/com/android/car/cluster/home/ClusterHomeApplication.java
+++ b/ClusterHomeSample/src/com/android/car/cluster/home/ClusterHomeApplication.java
@@ -194,8 +194,12 @@
public void onClusterStateChanged(
ClusterState state, @ClusterHomeManager.Config int changes) {
mClusterState = state;
- if ((changes & ClusterHomeManager.CONFIG_UI_TYPE) != 0
- && mLastLaunchedUiType != state.uiType) {
+ // We'll restart Activity when the display bounds or insets are changed, to let Activity
+ // redraw itself to fit the changed attributes.
+ if ((changes & ClusterHomeManager.CONFIG_DISPLAY_BOUNDS) != 0
+ || (changes & ClusterHomeManager.CONFIG_DISPLAY_INSETS) != 0
+ || ((changes & ClusterHomeManager.CONFIG_UI_TYPE) != 0
+ && mLastLaunchedUiType != state.uiType)) {
startClusterActivity(state.uiType);
}
}