Check for valid last reported deviceId when starting service
If last reported virtual deviceId has been removed/closed since the latest activity was started, updateDeviceId would throw an exception due to the deviceId being invalid. Bug: 264250568 Test: atest DeviceAssociationTest Change-Id: I5f57c0361f76646001cc606e819969b0114946f7
This commit is contained in:
@@ -4558,7 +4558,11 @@ public final class ActivityThread extends ClientTransactionHandler
|
||||
service.attach(context, this, data.info.name, data.token, app,
|
||||
ActivityManager.getService());
|
||||
if (!service.isUiContext()) { // WindowProviderService is a UI Context.
|
||||
service.updateDeviceId(mLastReportedDeviceId);
|
||||
VirtualDeviceManager vdm = context.getSystemService(VirtualDeviceManager.class);
|
||||
if (mLastReportedDeviceId == VirtualDeviceManager.DEVICE_ID_DEFAULT
|
||||
|| vdm.isValidVirtualDeviceId(mLastReportedDeviceId)) {
|
||||
service.updateDeviceId(mLastReportedDeviceId);
|
||||
}
|
||||
}
|
||||
service.onCreate();
|
||||
mServicesData.put(data.token, data);
|
||||
|
||||
Reference in New Issue
Block a user