Adds a method to track camera usages

This CL adds a new method to AppOpsManager for tracking apps' camera
usages.

Bug: 205156620
Bug: 216362856
Test: Successful build
Change-Id: I1bb424208ad422c462c17b822b72b5e87035e061
This commit is contained in:
Changyeon Jo
2021-11-24 17:55:16 -08:00
parent e3c43139c7
commit 62bcafb36c

View File

@@ -51,6 +51,9 @@ public class RecentAppOpsAccess {
private static final int[] MICROPHONE_OPS = new int[]{
AppOpsManager.OP_RECORD_AUDIO,
};
private static final int[] CAMERA_OPS = new int[]{
AppOpsManager.OP_CAMERA,
};
private static final String TAG = RecentAppOpsAccess.class.getSimpleName();
@@ -98,6 +101,13 @@ public class RecentAppOpsAccess {
return new RecentAppOpsAccess(context, MICROPHONE_OPS);
}
/**
* Creates an instance of {@link RecentAppOpsAccess} for camera access.
*/
public static RecentAppOpsAccess createForCamera(Context context) {
return new RecentAppOpsAccess(context, CAMERA_OPS);
}
/**
* Fills a list of applications which queried for access recently within specified time.
* Apps are sorted by recency. Apps with more recent accesses are in the front.