Skip to content

Commit d3458d2

Browse files
committed
replace duplicate mac id
1 parent 0ae60c4 commit d3458d2

3 files changed

Lines changed: 10 additions & 30 deletions

File tree

src/vs/code/electron-main/app.ts

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
2626
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
2727
import { IURLService } from 'vs/platform/url/common/url';
2828
import { URLHandlerChannelClient, URLHandlerRouter } from 'vs/platform/url/common/urlIpc';
29-
import { ITelemetryService, machineIdKey, trueMachineIdKey } from 'vs/platform/telemetry/common/telemetry';
29+
import { ITelemetryService, machineIdKey } from 'vs/platform/telemetry/common/telemetry';
3030
import { NullTelemetryService, combinedAppender, LogAppender } from 'vs/platform/telemetry/common/telemetryUtils';
3131
import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc';
3232
import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService';
@@ -365,8 +365,8 @@ export class CodeApplication extends Disposable {
365365

366366
// Resolve unique machine ID
367367
this.logService.trace('Resolving machine identifier...');
368-
const { machineId, trueMachineId } = await this.resolveMachineId();
369-
this.logService.trace(`Resolved machine identifier: ${machineId} (trueMachineId: ${trueMachineId})`);
368+
const machineId = await this.resolveMachineId();
369+
this.logService.trace(`Resolved machine identifier: ${machineId}`);
370370

371371
// Spawn shared process after the first window has opened and 3s have passed
372372
const sharedProcess = this.instantiationService.createInstance(SharedProcess, machineId, this.userEnv);
@@ -387,7 +387,7 @@ export class CodeApplication extends Disposable {
387387
});
388388

389389
// Services
390-
const appInstantiationService = await this.createServices(machineId, trueMachineId, sharedProcess, sharedProcessReady);
390+
const appInstantiationService = await this.createServices(machineId, sharedProcess, sharedProcessReady);
391391

392392
// Create driver
393393
if (this.environmentService.driverHandle) {
@@ -412,32 +412,21 @@ export class CodeApplication extends Disposable {
412412
}
413413
}
414414

415-
private async resolveMachineId(): Promise<{ machineId: string, trueMachineId?: string }> {
415+
private async resolveMachineId(): Promise<string> {
416416

417417
// We cache the machineId for faster lookups on startup
418-
// and resolve it only once initially if not cached
418+
// and resolve it only once initially if not cached or we need to replace the macOS iBridge device
419419
let machineId = this.stateService.getItem<string>(machineIdKey);
420-
if (!machineId) {
420+
if (!machineId || (isMacintosh && machineId === '6c9d2bc8f91b89624add29c0abeae7fb42bf539fa1cdb2e3e57cd668fa9bcead')) {
421421
machineId = await getMachineId();
422422

423423
this.stateService.setItem(machineIdKey, machineId);
424424
}
425425

426-
// Check if machineId is hashed iBridge Device
427-
let trueMachineId: string | undefined;
428-
if (isMacintosh && machineId === '6c9d2bc8f91b89624add29c0abeae7fb42bf539fa1cdb2e3e57cd668fa9bcead') {
429-
trueMachineId = this.stateService.getItem<string>(trueMachineIdKey);
430-
if (!trueMachineId) {
431-
trueMachineId = await getMachineId();
432-
433-
this.stateService.setItem(trueMachineIdKey, trueMachineId);
434-
}
435-
}
436-
437-
return { machineId, trueMachineId };
426+
return machineId;
438427
}
439428

440-
private async createServices(machineId: string, trueMachineId: string | undefined, sharedProcess: SharedProcess, sharedProcessReady: Promise<Client<string>>): Promise<IInstantiationService> {
429+
private async createServices(machineId: string, sharedProcess: SharedProcess, sharedProcessReady: Promise<Client<string>>): Promise<IInstantiationService> {
441430
const services = new ServiceCollection();
442431

443432
switch (process.platform) {
@@ -489,7 +478,7 @@ export class CodeApplication extends Disposable {
489478
const appender = combinedAppender(new TelemetryAppenderClient(channel), new LogAppender(this.logService));
490479
const commonProperties = resolveCommonProperties(product.commit, product.version, machineId, product.msftInternalDomains, this.environmentService.installSourcePath);
491480
const piiPaths = this.environmentService.extensionsPath ? [this.environmentService.appRoot, this.environmentService.extensionsPath] : [this.environmentService.appRoot];
492-
const config: ITelemetryServiceConfig = { appender, commonProperties, piiPaths, trueMachineId, sendErrorTelemetry: true };
481+
const config: ITelemetryServiceConfig = { appender, commonProperties, piiPaths, sendErrorTelemetry: true };
493482

494483
services.set(ITelemetryService, new SyncDescriptor(TelemetryService, [config]));
495484
} else {

src/vs/platform/telemetry/common/telemetry.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,4 @@ export const currentSessionDateStorageKey = 'telemetry.currentSessionDate';
5555
export const firstSessionDateStorageKey = 'telemetry.firstSessionDate';
5656
export const lastSessionDateStorageKey = 'telemetry.lastSessionDate';
5757
export const machineIdKey = 'telemetry.machineId';
58-
export const trueMachineIdKey = 'telemetry.trueMachineId';
5958
export const crashReporterIdStorageKey = 'crashReporter.guid';

src/vs/platform/telemetry/common/telemetryService.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export interface ITelemetryServiceConfig {
2020
sendErrorTelemetry?: boolean;
2121
commonProperties?: Promise<{ [name: string]: any }>;
2222
piiPaths?: string[];
23-
trueMachineId?: string;
2423
}
2524

2625
export class TelemetryService implements ITelemetryService {
@@ -76,13 +75,6 @@ export class TelemetryService implements ITelemetryService {
7675
usingFallbackGuid: { classification: 'SystemMetaData', purpose: 'BusinessInsight', isMeasurement: true };
7776
};
7877
this.publicLog2<{ usingFallbackGuid: boolean }, MachineIdFallbackClassification>('machineIdFallback', { usingFallbackGuid: !isHashedId });
79-
80-
if (config.trueMachineId) {
81-
type MachineIdDisambiguationClassification = {
82-
correctedMachineId: { endPoint: 'MacAddressHash', classification: 'EndUserPseudonymizedInformation', purpose: 'FeatureInsight' };
83-
};
84-
this.publicLog2<{ correctedMachineId: string }, MachineIdDisambiguationClassification>('machineIdDisambiguation', { correctedMachineId: config.trueMachineId });
85-
}
8678
});
8779
}
8880
}

0 commit comments

Comments
 (0)