Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a26f33e authored by Vladimir Komsiyski's avatar Vladimir Komsiyski Committed by Android (Google) Code Review
Browse files

Merge "Skip the VDM call if running on the default device." into main

parents 49b876c8 af22baee
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -407,7 +407,7 @@ public final class ActivityThread extends ClientTransactionHandler

    private int mLastSessionId;
    // Holds the value of the last reported device ID value from the server for the top activity.
    int mLastReportedDeviceId;
    int mLastReportedDeviceId = Context.DEVICE_ID_DEFAULT;
    final ArrayMap<IBinder, CreateServiceData> mServicesData = new ArrayMap<>();
    @UnsupportedAppUsage
    final ArrayMap<IBinder, Service> mServices = new ArrayMap<>();
@@ -4856,12 +4856,15 @@ 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.
                if (mLastReportedDeviceId == Context.DEVICE_ID_DEFAULT) {
                    service.updateDeviceId(mLastReportedDeviceId);
                } else {
                    VirtualDeviceManager vdm = context.getSystemService(VirtualDeviceManager.class);
                if (mLastReportedDeviceId == Context.DEVICE_ID_DEFAULT
                        || vdm.isValidVirtualDeviceId(mLastReportedDeviceId)) {
                    if (vdm != null && vdm.isValidVirtualDeviceId(mLastReportedDeviceId)) {
                        service.updateDeviceId(mLastReportedDeviceId);
                    }
                }
            }
            service.onCreate();
            mServicesData.put(data.token, data);
            mServices.put(data.token, service);