Initial unified commit for Android 11, syncing up to v311

This commit is contained in:
Andy CrossGate Yan
2021-08-08 02:20:00 +00:00
commit 01693449b8
191 changed files with 23879 additions and 0 deletions

View File

@@ -0,0 +1,133 @@
From f63609cfc0fcc6a488ba7d024a1b1e3853637b09 Mon Sep 17 00:00:00 2001
From: jhenrique09 <jhenrique09.mcz@hotmail.com>
Date: Sun, 29 Mar 2020 17:38:39 -0300
Subject: [PATCH] fwb: Start device specific popup camera service conditionally
Change-Id: I07f97fe58495ef666fa317d14fa1334389015e11
---
.../custom/popupcamera/PopUpCameraUtils.java | 20 +++++++++++++++++++
core/res/res/values/lineage_config.xml | 3 +++
core/res/res/values/lineage_symbols.xml | 3 +++
.../server/camera/CameraServiceProxy.java | 20 +++++++++++++++++++
4 files changed, 46 insertions(+)
create mode 100644 core/java/com/android/internal/util/custom/popupcamera/PopUpCameraUtils.java
diff --git a/core/java/com/android/internal/util/custom/popupcamera/PopUpCameraUtils.java b/core/java/com/android/internal/util/custom/popupcamera/PopUpCameraUtils.java
new file mode 100644
index 00000000000..f7988608141
--- /dev/null
+++ b/core/java/com/android/internal/util/custom/popupcamera/PopUpCameraUtils.java
@@ -0,0 +1,20 @@
+/*
+* Copyright (C) 2019 The Pixel Experience 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.internal.util.custom.popupcamera;
+
+public class PopUpCameraUtils {
+ public static String MANAGE_POPUP_CAMERA_SERVICE_PERMISSION = "org.pixelexperience.device.MANAGE_POPUP_CAMERA_SERVICE";
+}
diff --git a/core/res/res/values/lineage_config.xml b/core/res/res/values/lineage_config.xml
index 4b090379f5a..3315de74147 100644
--- a/core/res/res/values/lineage_config.xml
+++ b/core/res/res/values/lineage_config.xml
@@ -34,4 +34,7 @@
<!-- The list of components which should be forced to be enabled. -->
<string-array name="config_forceEnabledComponents" translatable="false">
</string-array>
+
+ <!-- Component name of popup camera service -->
+ <string name="config_popUpCameraServiceComponentName" translatable="false"></string>
</resources>
diff --git a/core/res/res/values/lineage_symbols.xml b/core/res/res/values/lineage_symbols.xml
index 155da4479fb..c7e58b3943f 100644
--- a/core/res/res/values/lineage_symbols.xml
+++ b/core/res/res/values/lineage_symbols.xml
@@ -25,4 +25,7 @@
<java-symbol type="array" name="config_deviceDisabledComponents" />
<java-symbol type="array" name="config_globallyDisabledComponents" />
<java-symbol type="array" name="config_forceEnabledComponents" />
+
+ <!-- Component name of popup camera service -->
+ <java-symbol type="string" name="config_popUpCameraServiceComponentName" />
</resources>
diff --git a/services/core/java/com/android/server/camera/CameraServiceProxy.java b/services/core/java/com/android/server/camera/CameraServiceProxy.java
index 5f7a72c8512..9e72fa09993 100644
--- a/services/core/java/com/android/server/camera/CameraServiceProxy.java
+++ b/services/core/java/com/android/server/camera/CameraServiceProxy.java
@@ -16,6 +16,7 @@
package com.android.server.camera;
import android.content.BroadcastReceiver;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -32,6 +33,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemProperties;
+import android.os.UserHandle;
import android.os.UserManager;
import android.util.ArrayMap;
import android.util.ArraySet;
@@ -53,6 +55,8 @@ import java.util.Set;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import com.android.internal.util.custom.popupcamera.PopUpCameraUtils;
+
/**
* CameraServiceProxy is the system_server analog to the camera service running in cameraserver.
*
@@ -106,6 +110,8 @@ public class CameraServiceProxy extends SystemService
private final boolean mNotifyNfc;
private final boolean mAllowMediaUid;
+ private final String mPopUpCameraServiceComponentName;
+
private ScheduledThreadPoolExecutor mLogWriterService = new ScheduledThreadPoolExecutor(
/*corePoolSize*/ 1);
@@ -218,6 +224,8 @@ public class CameraServiceProxy extends SystemService
// Don't keep any extra logging threads if not needed
mLogWriterService.setKeepAliveTime(1, TimeUnit.SECONDS);
mLogWriterService.allowCoreThreadTimeOut(true);
+ mPopUpCameraServiceComponentName = mContext.getResources().getString(
+ com.android.internal.R.string.config_popUpCameraServiceComponentName);
}
@Override
@@ -338,6 +346,18 @@ public class CameraServiceProxy extends SystemService
}
}
+ @Override
+ public void onBootPhase(int phase) {
+ if (phase == PHASE_BOOT_COMPLETED &&
+ !mPopUpCameraServiceComponentName.equals("")) {
+ String perm = PopUpCameraUtils.MANAGE_POPUP_CAMERA_SERVICE_PERMISSION;
+ mContext.enforceCallingOrSelfPermission(perm, "Missing or invalid popup camera service permission: " + perm);
+ Intent i = new Intent();
+ i.setComponent(ComponentName.unflattenFromString(mPopUpCameraServiceComponentName));
+ mContext.startServiceAsUser(i, UserHandle.SYSTEM);
+ }
+ }
+
/**
* Dump camera usage events to log.
* Package-private
--
2.25.1

View File

@@ -0,0 +1,69 @@
From 9b7fb863d5b8ed266574f5bbd73dd896f8534f89 Mon Sep 17 00:00:00 2001
From: XiNGRZ <chenxingyu92@gmail.com>
Date: Thu, 13 Feb 2020 20:19:22 +0800
Subject: [PATCH] build: Add support of generating kernel includes for prebuilt
kernels
For prebuilt kernels, point TARGET_KERNEL_HEADER_SOURCE to the dummy
kernel source used to generate headers for HALs.
Change-Id: I8dbbe3760230ae32f4252e99d1c777a029046d39
---
build/soong/Android.bp | 4 ++--
config/BoardConfigKernel.mk | 4 ++++
config/BoardConfigSoong.mk | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/build/soong/Android.bp b/build/soong/Android.bp
index ee68c11e..03006e44 100644
--- a/build/soong/Android.bp
+++ b/build/soong/Android.bp
@@ -21,7 +21,7 @@ lineage_generator {
name: "generated_kernel_includes",
// The headers make command
- cmd: "$(PATH_OVERRIDE_SOONG) $(KERNEL_MAKE_CMD) $(KERNEL_MAKE_FLAGS) -C $(TARGET_KERNEL_SOURCE) O=$(KERNEL_BUILD_OUT_PREFIX)$(genDir) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) headers_install",
+ cmd: "$(PATH_OVERRIDE_SOONG) $(KERNEL_MAKE_CMD) $(KERNEL_MAKE_FLAGS) -C $(TARGET_KERNEL_HEADER_SOURCE) O=$(KERNEL_BUILD_OUT_PREFIX)$(genDir) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) headers_install",
// Directories that can be imported by a cc_* module generated_headers property
export_include_dirs: [
@@ -32,7 +32,7 @@ lineage_generator {
],
// Sources for dependency tracking
- dep_root: "$(TARGET_KERNEL_SOURCE)",
+ dep_root: "$(TARGET_KERNEL_HEADER_SOURCE)",
dep_files: [
"Makefile",
"include/**/*",
diff --git a/config/BoardConfigKernel.mk b/config/BoardConfigKernel.mk
index 8479369a..508927fd 100644
--- a/config/BoardConfigKernel.mk
+++ b/config/BoardConfigKernel.mk
@@ -52,6 +52,10 @@ else
KERNEL_ARCH := $(TARGET_KERNEL_ARCH)
endif
+ifneq ($(TARGET_KERNEL_SOURCE),)
+TARGET_KERNEL_HEADER_SOURCE := $(TARGET_KERNEL_SOURCE)
+endif
+
CLANG_PREBUILTS := $(BUILD_TOP)/prebuilts/clang/host/$(HOST_PREBUILT_TAG)/clang-r383902b
GCC_PREBUILTS := $(BUILD_TOP)/prebuilts/gcc/$(HOST_PREBUILT_TAG)
# arm64 toolchain
diff --git a/config/BoardConfigSoong.mk b/config/BoardConfigSoong.mk
index c0b01674..aacc8c56 100644
--- a/config/BoardConfigSoong.mk
+++ b/config/BoardConfigSoong.mk
@@ -9,7 +9,7 @@ EXPORT_TO_SOONG := \
KERNEL_MAKE_FLAGS \
PATH_OVERRIDE_SOONG \
TARGET_KERNEL_CONFIG \
- TARGET_KERNEL_SOURCE
+ TARGET_KERNEL_HEADER_SOURCE
# Setup SOONG_CONFIG_* vars to export the vars listed above.
# Documentation here:
--
2.25.1