Parse installed pkgs for Distraction Optimization.
1. Check the configurable whitelist for apps and activities that can run
during DO.
2. If not in whitelist, check if the apps have tagged their activities
to be DO and add them to the allowable list.
Bug: 68717481
Test: Whitelisted and DO tagged apps can run while restrictions are in
place.
Change-Id: Ic46b95dd9e4e4194c8753d26250f0dc123163908
diff --git a/service/src/com/android/car/ICarImpl.java b/service/src/com/android/car/ICarImpl.java
index d5303ef..43bb451 100644
--- a/service/src/com/android/car/ICarImpl.java
+++ b/service/src/com/android/car/ICarImpl.java
@@ -414,6 +414,7 @@
private static final String COMMAND_INJECT_VHAL_EVENT = "inject-vhal-event";
private static final String COMMAND_ENABLE_UXR = "enable-uxr";
private static final String COMMAND_GARAGE_MODE = "garage-mode";
+ private static final String COMMAND_GET_DO_ACTIVITIES = "get-do-activities";
private static final String PARAM_DAY_MODE = "day";
private static final String PARAM_NIGHT_MODE = "night";
@@ -436,6 +437,8 @@
pw.println("\t Disable UX restrictions and App blocking.");
pw.println("\tgarage-mode [on|off|query]");
pw.println("\t Force into garage mode or check status.");
+ pw.println("\tget-do-activities pkgname");
+ pw.println("\t Get Distraction Optimized activities in given package");
}
public void exec(String[] args, PrintWriter writer) {
@@ -482,6 +485,27 @@
mCarPackageManagerService.setEnableActivityBlocking(enableBlocking);
}
break;
+ case COMMAND_GET_DO_ACTIVITIES:
+ if (args.length < 2) {
+ writer.println("Incorrect number of arguments");
+ dumpHelp(writer);
+ break;
+ }
+ String pkgName = args[1].toLowerCase();
+ if (mCarPackageManagerService != null) {
+ String[] doActivities =
+ mCarPackageManagerService.getDistractionOptimizedActivities(
+ pkgName);
+ if (doActivities != null) {
+ writer.println("DO Activities for " + pkgName);
+ for (String a : doActivities) {
+ writer.println(a);
+ }
+ } else {
+ writer.println("No DO Activities for " + pkgName);
+ }
+ }
+ break;
default:
writer.println("Unknown command.");
dumpHelp(writer);