Atom for when fgs accesses appop
statsd logs when an sensitive appop is accessed while a foreground
service is held. These appops include
OP_FINE_LOCATION
OP_COARSE_LOCATION
OP_RECORD_AUDIO
OP_CAMERA
It logs the number of times each of these appops is requested per session
during which the uid holds any foreground service.
Appops requested while the app's process state is TOP are ignored.
Also, the pre-existing ForegroundServiceStateChanged atom has an
additional field that logs whether the fgs is considered 'in-use' in the
context of being allowed while-in-use permissions.
Bug: 149497535
Test: atest UidAtomTests#testForegroundServiceState UidAtomTests#testForegroundServiceAccessAppOp
Test: manually monitor: adb shell cmd stats print-logs && adb logcat -v uid -s statsd | grep "statsd : {" | egrep '\((60|256)\)'
Change-Id: I991a427dc2ab00399188b10b266ab2d9aa92696d
Merged-In: I991a427dc2ab00399188b10b266ab2d9aa92696d
(cherry picked from commit 0c8637c067)
This commit is contained in:
@@ -6910,11 +6910,7 @@ public class AppOpsManager {
|
||||
* Does not throw a security exception, does not translate {@link #MODE_FOREGROUND}.
|
||||
*/
|
||||
public int unsafeCheckOpRaw(@NonNull String op, int uid, @NonNull String packageName) {
|
||||
try {
|
||||
return mService.checkOperationRaw(strOpToOp(op), uid, packageName);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
return unsafeCheckOpRawNoThrow(op, uid, packageName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6923,8 +6919,17 @@ public class AppOpsManager {
|
||||
* {@link #MODE_FOREGROUND}.
|
||||
*/
|
||||
public int unsafeCheckOpRawNoThrow(@NonNull String op, int uid, @NonNull String packageName) {
|
||||
return unsafeCheckOpRawNoThrow(strOpToOp(op), uid, packageName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <em>raw</em> mode associated with the op.
|
||||
* Does not throw a security exception, does not translate {@link #MODE_FOREGROUND}.
|
||||
* @hide
|
||||
*/
|
||||
public int unsafeCheckOpRawNoThrow(int op, int uid, @NonNull String packageName) {
|
||||
try {
|
||||
return mService.checkOperationRaw(strOpToOp(op), uid, packageName);
|
||||
return mService.checkOperationRaw(op, uid, packageName);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user