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

Commit cf463af8 authored by Songchun Fan's avatar Songchun Fan
Browse files

[pm/metrics] do not log package name for adb installations

Per privacy requirements, we will not log package name if the
installation is initiated from adb.

Test: manual with adb install
Test: $ ./out/host/linux-x86/bin/statsd_testdrive 263
event_metrics {
  data {
    elapsed_timestamp_nanos: 630320497997
    atom {
      package_installer_v2_reported {
        is_incremental: true
        package_name: ""
        duration_millis: 567
        return_code: 1
      }
    }
  }
}

BUG: 152913040
Change-Id: I147358e59bf6a43fc76b6721ec1a415167b305d7
parent 8650e9aa
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -1801,11 +1801,16 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
        }
    }

    private void logDataLoaderInstallationSession(int returnCode, String extraMessage) {
    private void logDataLoaderInstallationSession(int returnCode) {
        // Skip logging the side-loaded app installations, as those are private and aren't reported
        // anywhere; app stores already have a record of the installation and that's why reporting
        // it here is fine
        final String packageNameToLog =
                (params.installFlags & PackageManager.INSTALL_FROM_ADB) == 0 ? mPackageName : "";
        final long currentTimestamp = System.currentTimeMillis();
        FrameworkStatsLog.write(FrameworkStatsLog.PACKAGE_INSTALLER_V2_REPORTED,
                isIncrementalInstallation(),
                mPackageName,
                packageNameToLog,
                currentTimestamp - createdMillis,
                returnCode);
    }
@@ -2812,7 +2817,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {

        mCallback.onSessionFinished(this, success);
        if (isDataLoaderInstallation()) {
            logDataLoaderInstallationSession(returnCode, msg);
            logDataLoaderInstallationSession(returnCode);
        }
    }