The display might not be added yet or be already detached when
config is updated.
Bug:
32983305
Test: android.media.cts.EncodeVirtualDisplayWithCompositionTest
Test: #testVirtualDisplayRecycles
Change-Id: I3b0e52e8ebb93a57ab6b0e80c0599db33ce2ae03
import android.app.ContentProviderHolder;
import android.app.IActivityManager;
import android.app.WaitResult;
-import android.graphics.PointF;
import android.os.IDeviceIdentifiersPolicyService;
import com.android.internal.policy.IKeyguardDismissCallback;
enforceCallingPermission(CHANGE_CONFIGURATION, "updateDisplayOverrideConfiguration()");
synchronized (this) {
+ // Check if display is initialized in AM.
+ if (!mStackSupervisor.isDisplayAdded(displayId)) {
+ // Call might come when display is not yet added or has already been removed.
+ if (DEBUG_CONFIGURATION) {
+ Slog.w(TAG, "Trying to update display configuration for non-existing displayId="
+ + displayId);
+ }
+ return false;
+ }
+
if (values == null && mWindowManager != null) {
// sentinel: fetch the current configuration from the window manager
values = mWindowManager.computeNewConfiguration(displayId);
}
}
+ /** Check if display with specified id is added to the list. */
+ boolean isDisplayAdded(int displayId) {
+ return mActivityDisplays.get(displayId) != null;
+ }
+
private void calculateDefaultMinimalSizeOfResizeableTasks(ActivityDisplay display) {
mDefaultMinSizeOfResizeableTask =
mService.mContext.getResources().getDimensionPixelSize(
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_BOOT;
+import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_CONFIGURATION;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DRAG;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS_LIGHT;
case SEND_NEW_CONFIGURATION: {
removeMessages(SEND_NEW_CONFIGURATION, msg.obj);
final int displayId = (Integer) msg.obj;
- sendNewConfiguration(displayId);
+ if (mRoot.getDisplayContent(displayId) != null) {
+ sendNewConfiguration(displayId);
+ } else {
+ // Message could come after display has already been removed.
+ if (DEBUG_CONFIGURATION) {
+ Slog.w(TAG, "Trying to send configuration to non-existing displayId="
+ + displayId);
+ }
+ }
break;
}