apps: SHIFT-OTA: 1.0.16 (10000016)

Change-Id: Ica7981ea3cd86b1376f89f88d3fd2ac9301cbdce
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
diff --git a/apps/SHIFT-OTA/Android.mk b/apps/SHIFT-OTA/Android.mk
new file mode 100644
index 0000000..3fdcb98
--- /dev/null
+++ b/apps/SHIFT-OTA/Android.mk
@@ -0,0 +1,42 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE        := SHIFT-OTA
+LOCAL_MODULE_CLASS  := APPS
+LOCAL_MODULE_TAGS   := optional
+LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
+
+LOCAL_CERTIFICATE := releasekey
+LOCAL_PRIVILEGED_MODULE := true
+LOCAL_SYSTEM_EXT_MODULE := true
+
+LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
+
+LOCAL_REQUIRED_MODULES := \
+    privapp_whitelist_com.shiftos.updater.xml \
+    shiftos-updates.rc \
+
+LOCAL_OPTIONAL_USES_LIBRARIES := \
+    androidx.window.extensions \
+    androidx.window.sidecar \
+
+LOCAL_OVERRIDES_PACKAGES := Updater
+
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := privapp_whitelist_com.shiftos.updater.xml
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_PATH := $(TARGET_OUT_SYSTEM_EXT_ETC)/permissions
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := shiftos-updates.rc
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_PATH := $(TARGET_OUT_SYSTEM_EXT_ETC)/init
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
+include $(BUILD_PREBUILT)
diff --git a/apps/SHIFT-OTA/SHIFT-OTA.apk b/apps/SHIFT-OTA/SHIFT-OTA.apk
new file mode 100644
index 0000000..73b151a
--- /dev/null
+++ b/apps/SHIFT-OTA/SHIFT-OTA.apk
Binary files differ
diff --git a/apps/SHIFT-OTA/output-metadata.json b/apps/SHIFT-OTA/output-metadata.json
new file mode 100644
index 0000000..9ebc86d
--- /dev/null
+++ b/apps/SHIFT-OTA/output-metadata.json
@@ -0,0 +1,20 @@
+{
+  "version": 3,
+  "artifactType": {
+    "type": "APK",
+    "kind": "Directory"
+  },
+  "applicationId": "com.shiftos.updater",
+  "variantName": "release",
+  "elements": [
+    {
+      "type": "SINGLE",
+      "filters": [],
+      "attributes": [],
+      "versionCode": 10000016,
+      "versionName": "1.0.16",
+      "outputFile": "SHIFT-OTA_1.0.16_release.apk"
+    }
+  ],
+  "elementType": "File"
+}
\ No newline at end of file
diff --git a/apps/SHIFT-OTA/privapp_whitelist_com.shiftos.updater.xml b/apps/SHIFT-OTA/privapp_whitelist_com.shiftos.updater.xml
new file mode 100644
index 0000000..934963d
--- /dev/null
+++ b/apps/SHIFT-OTA/privapp_whitelist_com.shiftos.updater.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2022 SHIFT GmbH
+
+     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.
+-->
+<permissions>
+    <privapp-permissions package="com.shiftos.updater">
+        <permission name="android.permission.ACCESS_CACHE_FILESYSTEM"/>
+        <permission name="android.permission.REBOOT"/>
+        <permission name="android.permission.RECOVERY"/>
+        <permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND"/>
+        <permission name="android.permission.START_FOREGROUND_SERVICES_FROM_BACKGROUND"/>
+        <permission name="android.permission.WRITE_MEDIA_STORAGE"/>
+    </privapp-permissions>
+</permissions>
diff --git a/apps/SHIFT-OTA/shiftos-updates.rc b/apps/SHIFT-OTA/shiftos-updates.rc
new file mode 100644
index 0000000..c2aac65
--- /dev/null
+++ b/apps/SHIFT-OTA/shiftos-updates.rc
@@ -0,0 +1,4 @@
+on post-fs-data
+    # Create an additional OTA package directory that unlike /data/ota_package
+    # will not be touched by GmsCore.
+    mkdir /data/shiftos_updates 0770 system cache encryption=Require