From 45ffc83758e1ae466289bc863d2ec31f485d14d6 Mon Sep 17 00:00:00 2001 From: Khaled Abdelmohsen Date: Wed, 2 Oct 2019 15:00:55 +0100 Subject: [PATCH] Define APIs for loading rules Define fine-grained APIs for loading rules to be used by the rule evaluation engine. The loader supports loading rules based on some app install metadata keys such as PackageName, AppCertificate, InstallerName, and InstallerCertificate. Bug: 141970289 Test: N/A Change-Id: Iec171974f9e9a63049cac10464a97116eea20b2b --- .../server/integrity/engine/RuleLoader.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 services/core/java/com/android/server/integrity/engine/RuleLoader.java diff --git a/services/core/java/com/android/server/integrity/engine/RuleLoader.java b/services/core/java/com/android/server/integrity/engine/RuleLoader.java new file mode 100644 index 0000000000000..567d7e95dd93e --- /dev/null +++ b/services/core/java/com/android/server/integrity/engine/RuleLoader.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.integrity.engine; + +import java.util.ArrayList; +import java.util.List; + +/** + * A helper class for loading rules to the rule evaluation engine. + * + *

Expose fine-grained APIs for loading rules to be passed to the rule evaluation engine. + * + *

It supports: + *

+ * + *

It does NOT support: + *

+ */ +final class RuleLoader { + + List loadRulesByPackageName(String packageName) { + // TODO: Add logic based on rule storage. + return new ArrayList<>(); + } + + List loadRulesByAppCertificate(String appCertificate) { + // TODO: Add logic based on rule storage. + return new ArrayList<>(); + } + + List loadRulesByInstallerName(String installerName) { + // TODO: Add logic based on rule storage. + return new ArrayList<>(); + } + + List loadRulesByInstallerCertificate(String installerCertificate) { + // TODO: Add logic based on rule storage. + return new ArrayList<>(); + } +}