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

Commit c735364c authored by Song Chun Fan's avatar Song Chun Fan Committed by Gerrit Code Review
Browse files

Merge "Show event log when application data is deleted" into main

parents dae42913 33421f06
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -179,6 +179,15 @@ option java_package com.android.server
3130 pm_snapshot_stats (build_count|1|1),(reuse_count|1|1),(big_builds|1|1),(short_lived|1|1),(max_build_time|1|3),(cumm_build_time|2|3)
# Snapshot rebuild instance
3131 pm_snapshot_rebuild (build_time|1|3),(lifetime|1|3)
# Caller information to clear application data
1003160 pm_clear_app_data_caller (pid|1),(uid|1),(package|3)
# ---------------------------
# Installer.java
# ---------------------------
# Caller Information to clear application data
1003200 installer_clear_app_data_caller (pid|1),(uid|1),(package|3),(flags|1)
# Call stack to clear application data
1003201 installer_clear_app_data_call_stack (method|3),(class|3),(file|3),(line|1)

# ---------------------------
# InputMethodManagerService.java
+1 −0
Original line number Diff line number Diff line
@@ -3468,6 +3468,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        enforceNotIsolatedCaller("clearApplicationUserData");
        int uid = Binder.getCallingUid();
        int pid = Binder.getCallingPid();
        EventLog.writeEvent(EventLogTags.AM_CLEAR_APP_DATA_CALLER, pid, uid, packageName);
        final int resolvedUserId = mUserController.handleIncomingUser(pid, uid, userId, false,
                ALLOW_FULL_ONLY, "clearApplicationUserData", null);
+3 −0
Original line number Diff line number Diff line
@@ -129,3 +129,6 @@ option java_package com.android.server.am

# Intent Sender redirect for UserHandle.USER_CURRENT
30110 am_intent_sender_redirect_user (userId|1|5)

# Caller information to clear application data
1030002 am_clear_app_data_caller (pid|1),(uid|1),(package|3)
+23 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.content.Context;
import android.content.pm.PackageStats;
import android.os.Binder;
import android.os.Build;
import android.os.CreateAppDataArgs;
import android.os.CreateAppDataResult;
@@ -34,9 +35,11 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.storage.CrateMetadata;
import android.text.format.DateUtils;
import android.util.EventLog;
import android.util.Slog;

import com.android.internal.os.BackgroundThread;
import com.android.server.EventLogTags;
import com.android.server.SystemService;

import dalvik.system.BlockGuard;
@@ -438,6 +441,26 @@ public class Installer extends SystemService {
        if (!checkBeforeRemote()) return;
        try {
            mInstalld.clearAppData(uuid, packageName, userId, flags, ceDataInode);

            final StackTraceElement[] elements = Thread.currentThread().getStackTrace();
            String className;
            String methodName;
            String fileName;
            int lineNumber;
            final int pid = Binder.getCallingPid();
            final int uid = Binder.getCallingUid();
            EventLog.writeEvent(EventLogTags.INSTALLER_CLEAR_APP_DATA_CALLER, pid, uid, packageName,
                    flags);
            // Skip the first two elements since they are always the same, ie
            // Thread#getStackTrace() and VMStack#getThreadStackTrace()
            for (int i = 2; i < elements.length; i++) {
                className = elements[i].getClassName();
                methodName = elements[i].getMethodName();
                fileName = elements[i].getFileName();
                lineNumber = elements[i].getLineNumber();
                EventLog.writeEvent(EventLogTags.INSTALLER_CLEAR_APP_DATA_CALL_STACK, methodName,
                        className, fileName, lineNumber);
            }
        } catch (Exception e) {
            throw InstallerException.from(e);
        }
+6 −0
Original line number Diff line number Diff line
@@ -4729,6 +4729,9 @@ public class PackageManagerService implements PackageSender, TestUtilityService
                throw new SecurityException("Cannot clear data for a protected package: "
                        + packageName);
            }
            final int callingPid = Binder.getCallingPid();
            EventLog.writeEvent(EventLogTags.PM_CLEAR_APP_DATA_CALLER, callingPid, callingUid,
                    packageName);

            // Queue up an async operation since the package deletion may take a little while.
            mHandler.post(new Runnable() {
@@ -4861,6 +4864,9 @@ public class PackageManagerService implements PackageSender, TestUtilityService
                    /* checkShell= */ false, "delete application cache files");
            final int hasAccessInstantApps = mContext.checkCallingOrSelfPermission(
                    android.Manifest.permission.ACCESS_INSTANT_APPS);
            final int callingPid = Binder.getCallingPid();
            EventLog.writeEvent(EventLogTags.PM_CLEAR_APP_DATA_CALLER, callingPid, callingUid,
                    packageName);

            // Queue up an async operation since the package deletion may take a little while.
            mHandler.post(() -> {