Merge "AppOpsService: Don't log stack traces for isolated processes"

This commit is contained in:
Hai Zhang
2022-12-16 23:37:11 +00:00
committed by Gerrit Code Review

View File

@@ -2797,7 +2797,11 @@ public class AppOpsService extends IAppOpsService.Stub {
try { try {
pvr = verifyAndGetBypass(uid, packageName, null); pvr = verifyAndGetBypass(uid, packageName, null);
} catch (SecurityException e) { } catch (SecurityException e) {
if (Process.isIsolated(uid)) {
Slog.e(TAG, "Cannot setMode: isolated process");
} else {
Slog.e(TAG, "Cannot setMode", e); Slog.e(TAG, "Cannot setMode", e);
}
return; return;
} }
@@ -3252,7 +3256,11 @@ public class AppOpsService extends IAppOpsService.Stub {
try { try {
pvr = verifyAndGetBypass(uid, packageName, null); pvr = verifyAndGetBypass(uid, packageName, null);
} catch (SecurityException e) { } catch (SecurityException e) {
Slog.e(TAG, "checkOperation", e); if (Process.isIsolated(uid)) {
Slog.e(TAG, "Cannot checkOperation: isolated process");
} else {
Slog.e(TAG, "Cannot checkOperation", e);
}
return AppOpsManager.opToDefaultMode(code); return AppOpsManager.opToDefaultMode(code);
} }
@@ -3458,7 +3466,11 @@ public class AppOpsService extends IAppOpsService.Stub {
attributionTag = null; attributionTag = null;
} }
} catch (SecurityException e) { } catch (SecurityException e) {
Slog.e(TAG, "noteOperation", e); if (Process.isIsolated(uid)) {
Slog.e(TAG, "Cannot noteOperation: isolated process");
} else {
Slog.e(TAG, "Cannot noteOperation", e);
}
return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag,
packageName); packageName);
} }
@@ -3974,7 +3986,11 @@ public class AppOpsService extends IAppOpsService.Stub {
attributionTag = null; attributionTag = null;
} }
} catch (SecurityException e) { } catch (SecurityException e) {
Slog.e(TAG, "startOperation", e); if (Process.isIsolated(uid)) {
Slog.e(TAG, "Cannot startOperation: isolated process");
} else {
Slog.e(TAG, "Cannot startOperation", e);
}
return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag,
packageName); packageName);
} }
@@ -4148,7 +4164,11 @@ public class AppOpsService extends IAppOpsService.Stub {
attributionTag = null; attributionTag = null;
} }
} catch (SecurityException e) { } catch (SecurityException e) {
if (Process.isIsolated(uid)) {
Slog.e(TAG, "Cannot finishOperation: isolated process");
} else {
Slog.e(TAG, "Cannot finishOperation", e); Slog.e(TAG, "Cannot finishOperation", e);
}
return; return;
} }