summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/ActivityManagerInternal.java5
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java15
-rw-r--r--services/core/java/com/android/server/wm/DisplayContent.java9
3 files changed, 27 insertions, 2 deletions
diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java
index 9b6764d96fb2..14cae95508e7 100644
--- a/core/java/android/app/ActivityManagerInternal.java
+++ b/core/java/android/app/ActivityManagerInternal.java
@@ -413,4 +413,9 @@ public abstract class ActivityManagerInternal {
* @return The intent used to launch the home activity.
*/
public abstract Intent getHomeIntent();
+
+ /**
+ * WindowManager notifies AM when display size of the default display changes.
+ */
+ public abstract void notifyDefaultDisplaySizeChanged();
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 2861600db52f..ee4bedf37abb 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -26870,6 +26870,21 @@ public class ActivityManagerService extends IActivityManager.Stub
return ActivityManagerService.this.getHomeIntent();
}
}
+
+ @Override
+ public void notifyDefaultDisplaySizeChanged() {
+ synchronized (this) {
+ if (mSystemServiceManager.isBootCompleted()) {
+ Slog.i(TAG, "Killing processes because of display size change");
+ killAllBackgroundProcessesExcept(-1, ActivityManager.PROCESS_STATE_SERVICE);
+
+ // TODO: Ugly hack to unblock the release
+ if (mHomeProcess != null) {
+ removeProcessLocked(mHomeProcess, false, true, "kill home screen size");
+ }
+ }
+ }
+ }
}
/**
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 2887e5ef9061..2941e93d12dc 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -1775,8 +1775,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
final int newDensity = mDisplayInfo.logicalDensityDpi;
final DisplayCutout newCutout = mDisplayInfo.displayCutout;
- final boolean displayMetricsChanged = mInitialDisplayWidth != newWidth
- || mInitialDisplayHeight != newHeight
+ final boolean sizeChanged = mInitialDisplayWidth != newWidth
+ || mInitialDisplayHeight != newHeight;
+ final boolean displayMetricsChanged = sizeChanged
|| mInitialDisplayDensity != mDisplayInfo.logicalDensityDpi
|| !Objects.equals(mInitialDisplayCutout, newCutout);
@@ -1798,6 +1799,10 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
mInitialDisplayCutout = newCutout;
mService.reconfigureDisplayLocked(this);
}
+
+ if (isDefaultDisplay && sizeChanged) {
+ mService.mH.post(mService.mAmInternal::notifyDefaultDisplaySizeChanged);
+ }
}
/** Sets the maximum width the screen resolution can be */