Merge "[stats] add metrics for package installer v2" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-04-09 21:22:09 +00:00
committed by Android (Google) Code Review
2 changed files with 33 additions and 0 deletions

View File

@@ -420,6 +420,7 @@ message Atom {
RankingSelected ranking_selected = 260 [(module) = "framework"];
TvSettingsUIInteracted tvsettings_ui_interacted = 261 [(module) = "tv_settings"];
LauncherStaticLayout launcher_snapshot = 262 [(module) = "sysui"];
PackageInstallerV2Reported package_installer_v2_reported = 263 [(module) = "framework"];
SdkExtensionStatus sdk_extension_status = 354;
}
@@ -9307,6 +9308,25 @@ message TvSettingsUIInteracted {
optional string additional_info = 3;
}
/**
* Logs information about a package installation using package installer V2 APIs.
*
* Logged from:
* frameworks/base/services/core/java/com/android/server/pm/PackageInstallerSession.java
*/
message PackageInstallerV2Reported {
// Whether this installation uses Incremental File System
optional bool is_incremental = 1;
// Name of the package that is intended to be installed
optional string package_name = 2;
// The duration between when the install was requested to when the install has completed
optional int64 duration_millis = 3;
// Installation result in final integer, which are SystemApi's.
// Return_code 1 indicates success.
// For full list, see frameworks/base/core/java/android/content/pm/PackageManager.java
optional int32 return_code = 4;
}
/**
* Logs settings provider values.
*

View File

@@ -128,6 +128,7 @@ import com.android.internal.content.PackageHelper;
import com.android.internal.messages.nano.SystemMessageProto;
import com.android.internal.os.SomeArgs;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.LocalServices;
import com.android.server.pm.Installer.InstallerException;
@@ -1801,6 +1802,15 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
}
}
private void logDataLoaderInstallationSession(int returnCode, String extraMessage) {
final long currentTimestamp = System.currentTimeMillis();
FrameworkStatsLog.write(FrameworkStatsLog.PACKAGE_INSTALLER_V2_REPORTED,
isIncrementalInstallation(),
mPackageName,
currentTimestamp - createdMillis,
returnCode);
}
/**
* Returns true if the session should attempt to inherit any existing native libraries already
* extracted at the current install location. This is necessary to prevent double loading of
@@ -2789,6 +2799,9 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
}
mCallback.onSessionFinished(this, success);
if (isDataLoaderInstallation()) {
logDataLoaderInstallationSession(returnCode, msg);
}
}
/** {@hide} */