From c75f33a2bc3e09c8f6daa12b6b1b1b383987e4d7 Mon Sep 17 00:00:00 2001 From: Marco Loaiza Date: Thu, 5 Jan 2023 15:18:02 +0000 Subject: [PATCH] Update deviceId from server process when activity is destroyed When an activity is removed from WindowProcessController, non UI Contexts, such as application context should be updated with the default deviceId. There were two issues in WindowProcessController preventing this to happen: - mTopActivityDeviceId should be updated whenever the deviceId changed even if it is not dispatched to the client. This way if the activity is later removed, we can detect a change in the topActivityDeviceId and report it back to the client. The only case when mTopActivityDeviceId is updated and not dispatched is when activity is started, but the deviceId is passed to the client via other channels. - Getting the topActivityDeviceId should return the DEVICE_ID_DEFAULT if there are no activities. Bug: 264530057 Test: atest DeviceAssociationTest Change-Id: I712ea9a68fdc55074b61349b5c70ba12946d5f0a --- .../android/server/wm/WindowProcessController.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowProcessController.java b/services/core/java/com/android/server/wm/WindowProcessController.java index 7c0318d2bee4d..d1d0a4f15f4d5 100644 --- a/services/core/java/com/android/server/wm/WindowProcessController.java +++ b/services/core/java/com/android/server/wm/WindowProcessController.java @@ -210,7 +210,7 @@ public class WindowProcessController extends ConfigurationContainer