summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Khaled Abdelmohsen <khelmy@google.com> 2019-10-01 11:17:51 +0100
committer Khaled Abdelmohsen <khelmy@google.com> 2019-10-01 17:50:03 +0100
commit5ada5987a3df255771aed59f801dddac050d18f1 (patch)
tree3a72a9cf038d878ff0b696f7369f989864b803fd
parentc71dbf9c7b021a41bbf970556c3a454e0fc2d830 (diff)
Add AppIntsallMetadata class.
Bug: 141907044 Test: No logic added. Change-Id: Ieea365014e8907fa51b06a1dc6943e480fd04e66
-rw-r--r--services/core/java/com/android/server/integrity/engine/AppInstallMetadata.java44
-rw-r--r--services/core/java/com/android/server/integrity/engine/RuleEvaluation.java29
2 files changed, 73 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/integrity/engine/AppInstallMetadata.java b/services/core/java/com/android/server/integrity/engine/AppInstallMetadata.java
new file mode 100644
index 000000000000..c2ed3df0ffff
--- /dev/null
+++ b/services/core/java/com/android/server/integrity/engine/AppInstallMetadata.java
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+/**
+ * The app install metadata.
+ *
+ * <p>The integrity component retrieves metadata for app installs from package manager, passing it
+ * to the rule evaluation engine to evaluate the metadata against the rules.
+ */
+public final class AppInstallMetadata {
+ final String mPackageName;
+ // Raw string encoding for the SHA-256 hash of the certificate of the app.
+ final String mAppCertificate;
+ final String mInstallerName;
+ // Raw string encoding for the SHA-256 hash of the certificate of the installer.
+ final String mInstallerCertificate;
+ final int mVersionCode;
+ final boolean mIsPreInstalled;
+
+ AppInstallMetadata(String packageName, String appCertificate, String installerName,
+ String installerCertificate, int versionCode, boolean isPreInstalled) {
+ this.mPackageName = packageName;
+ this.mAppCertificate = appCertificate;
+ this.mInstallerName = installerName;
+ this.mInstallerCertificate = installerCertificate;
+ this.mVersionCode = versionCode;
+ this.mIsPreInstalled = isPreInstalled;
+ }
+}
diff --git a/services/core/java/com/android/server/integrity/engine/RuleEvaluation.java b/services/core/java/com/android/server/integrity/engine/RuleEvaluation.java
new file mode 100644
index 000000000000..93c9adaac12d
--- /dev/null
+++ b/services/core/java/com/android/server/integrity/engine/RuleEvaluation.java
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+/**
+ * The engine used to evaluate rules against app installs.
+ *
+ * <p>Every app install is evaluated against rules (pushed by the verifier) by the evaluation engine
+ * to allow/block that install.
+ */
+public final class RuleEvaluation {
+ private static final String TAG = "RuleEvaluation";
+
+ // TODO: Add singleton injection.
+}