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

Commit 3a715e87 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[pm/metrics][8/n] log to SecurityLog"

parents e56846d9 19bb9aa5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -8013,6 +8013,9 @@ package android.app.admin {
    field public static final int TAG_MEDIA_UNMOUNT = 210014; // 0x3345e
    field public static final int TAG_OS_SHUTDOWN = 210010; // 0x3345a
    field public static final int TAG_OS_STARTUP = 210009; // 0x33459
    field public static final int TAG_PACKAGE_INSTALLED = 210041; // 0x33479
    field public static final int TAG_PACKAGE_UNINSTALLED = 210043; // 0x3347b
    field public static final int TAG_PACKAGE_UPDATED = 210042; // 0x3347a
    field public static final int TAG_PASSWORD_CHANGED = 210036; // 0x33474
    field public static final int TAG_PASSWORD_COMPLEXITY_REQUIRED = 210035; // 0x33473
    field public static final int TAG_PASSWORD_COMPLEXITY_SET = 210017; // 0x33461
+39 −0
Original line number Diff line number Diff line
@@ -96,6 +96,9 @@ public class SecurityLog {
            TAG_WIFI_DISCONNECTION,
            TAG_BLUETOOTH_CONNECTION,
            TAG_BLUETOOTH_DISCONNECTION,
            TAG_PACKAGE_INSTALLED,
            TAG_PACKAGE_UPDATED,
            TAG_PACKAGE_UNINSTALLED,
    })
    public @interface SecurityLogTag {}

@@ -562,6 +565,39 @@ public class SecurityLog {
    public static final int TAG_BLUETOOTH_DISCONNECTION =
            SecurityLogTags.SECURITY_BLUETOOTH_DISCONNECTION;

    /**
     * Indicates that a package is installed.
     * The log entry contains the following information about the
     * event, encapsulated in an {@link Object} array and accessible via
     * {@link SecurityEvent#getData()}:
     * <li> [0] Name of the package being installed ({@code String})
     * <li> [1] Package version code ({@code Long})
     * <li> [2] UserId of the user that installed this package ({@code Integer})
     */
    public static final int TAG_PACKAGE_INSTALLED = SecurityLogTags.SECURITY_PACKAGE_INSTALLED;

    /**
     * Indicates that a package is updated.
     * The log entry contains the following information about the
     * event, encapsulated in an {@link Object} array and accessible via
     * {@link SecurityEvent#getData()}:
     * <li> [0] Name of the package being updated ({@code String})
     * <li> [1] Package version code ({@code Long})
     * <li> [2] UserId of the user that updated this package ({@code Integer})
     */
    public static final int TAG_PACKAGE_UPDATED = SecurityLogTags.SECURITY_PACKAGE_UPDATED;

    /**
     * Indicates that a package is uninstalled.
     * The log entry contains the following information about the
     * event, encapsulated in an {@link Object} array and accessible via
     * {@link SecurityEvent#getData()}:
     * <li> [0] Name of the package being uninstalled ({@code String})
     * <li> [1] Package version code ({@code Long})
     * <li> [2] UserId of the user that uninstalled this package ({@code Integer})
     */
    public static final int TAG_PACKAGE_UNINSTALLED = SecurityLogTags.SECURITY_PACKAGE_UNINSTALLED;

    /**
     * Event severity level indicating that the event corresponds to normal workflow.
     */
@@ -772,6 +808,9 @@ public class SecurityLog {
                    break;
                case SecurityLog.TAG_CERT_AUTHORITY_INSTALLED:
                case SecurityLog.TAG_CERT_AUTHORITY_REMOVED:
                case SecurityLog.TAG_PACKAGE_INSTALLED:
                case SecurityLog.TAG_PACKAGE_UPDATED:
                case SecurityLog.TAG_PACKAGE_UNINSTALLED:
                    try {
                        userId = getIntegerData(2);
                    } catch (Exception e) {
+4 −1
Original line number Diff line number Diff line
@@ -45,3 +45,6 @@ option java_package android.app.admin
210038 security_wifi_disconnection              (bssid|3),(reason|3)
210039 security_bluetooth_connection            (addr|3),(success|1),(reason|3)
210040 security_bluetooth_disconnection         (addr|3),(reason|3)
210041 security_package_installed               (package_name|3),(version_code|1),(user_id|1)
210042 security_package_updated                 (package_name|3),(version_code|1),(user_id|1)
210043 security_package_uninstalled             (package_name|3),(version_code|1),(user_id|1)
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -261,7 +261,7 @@ final class DeletePackageHelper {
            final boolean killApp = (deleteFlags & PackageManager.DELETE_DONT_KILL_APP) == 0;
            info.sendPackageRemovedBroadcasts(killApp, removedBySystem);
            info.sendSystemPackageUpdatedBroadcasts();
            PackageMetrics.onUninstallSucceeded(info, deleteFlags, mUserManagerInternal);
            PackageMetrics.onUninstallSucceeded(info, deleteFlags, userId);
        }

        // Force a gc to clear up things.
@@ -550,6 +550,7 @@ final class DeletePackageHelper {
            outInfo.mRemovedUsers = userIds;
            outInfo.mBroadcastUsers = userIds;
            outInfo.mIsExternal = ps.isExternalStorage();
            outInfo.mRemovedPackageVersionCode = ps.getVersionCode();
        }
    }

+1 −0
Original line number Diff line number Diff line
@@ -1608,6 +1608,7 @@ final class InstallPackageHelper {
                            ps.getUninstallReason(userId));
                }
                removedInfo.mIsExternal = oldPackage.isExternalStorage();
                removedInfo.mRemovedPackageVersionCode = oldPackage.getLongVersionCode();
                request.setRemovedInfo(removedInfo);

                sysPkg = oldPackage.isSystem();
Loading