Compare commits

...

14 commits

40 changed files with 1319 additions and 608 deletions

View file

@ -1,3 +1,4 @@
#!/bin/bash #!/bin/bash
# Always execute in the script's directory
pushd "$(dirname "$(realpath "$0")")"
find . -name "*.patch" -printf "%h\n" | uniq | xargs -I{} bash -c "cd $(pwd)/../{}; git am $(pwd)/{}/*" find . -name "*.patch" -printf "%h\n" | uniq | xargs -I{} bash -c "cd $(pwd)/../{}; git am $(pwd)/{}/*"

View file

@ -0,0 +1,136 @@
From ea0f283eec1e7750351302dbc2009fa905cef375 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sat, 19 Feb 2022 08:20:25 -0500
Subject: [PATCH] Add new mechanism to fake vendor props on a per-process basis
This reads debug.phh.props.<process name>. If its value is "vendor",
then ro.product.device/ro.product.manufacturer is read from vendor
Squashed: Rework property overriding
- Support property read with callback in addition to previous
constant-size property_get
- Add another class of redirect "keymaster", to redirect to AOSP/GSI
props + SPL based on boot.img
---
libc/system_properties/system_properties.cpp | 81 +++++++++++++++++++-
1 file changed, 79 insertions(+), 2 deletions(-)
diff --git a/libc/system_properties/system_properties.cpp b/libc/system_properties/system_properties.cpp
index 1cb15c3df..40ff48bad 100644
--- a/libc/system_properties/system_properties.cpp
+++ b/libc/system_properties/system_properties.cpp
@@ -35,6 +35,8 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
#include <new>
@@ -50,6 +52,79 @@
#define SERIAL_DIRTY(serial) ((serial)&1)
#define SERIAL_VALUE_LEN(serial) ((serial) >> 24)
+static char comm[128];
+static bool self_ok = false;
+static char comm_override[PROP_VALUE_MAX];
+
+static void read_self() {
+ //NB: Not atomic, but should be good enough, there is no possible corruption from concurrency
+ if(self_ok) return;
+ self_ok = true;
+
+ char cmdline[128];
+ int fd = open("/proc/self/cmdline", O_RDONLY);
+ if(fd<0) return;
+ read(fd, cmdline, sizeof(cmdline)-1);
+ for(unsigned i=0; i<sizeof(cmdline); i++)
+ if(cmdline[i] == '\n')
+ cmdline[i] = 0;
+ close(fd);
+
+ // Truncate to last /, we don't want `/` in the prop
+ const char *c = strrchr(cmdline, '/');
+ if (c != nullptr) {
+ c = c+1;
+ } else {
+ c = cmdline;
+ }
+ // Take only the last 16 bytes (prop names max is 32)
+ if(strlen(c) < 15) {
+ strcpy(comm, c);
+ } else {
+ strcpy(comm, c + strlen(c) - 15);
+ }
+
+
+ //That's calling ourselves but that's fine because we already have self_ok = true
+ char propName[PROP_NAME_MAX];
+ memset(propName, 0, PROP_NAME_MAX);
+ strncpy(propName, "debug.phh.props.", PROP_NAME_MAX - 1);
+ strncat(propName, comm, PROP_NAME_MAX - strlen(propName) - 1);
+
+ //async_safe_format_log(ANDROID_LOG_WARN, "libc", "Reading debug prop %s", propName);
+ __system_property_get(propName, comm_override);
+}
+
+static const char* redirectToProp(const char *name) {
+ read_self();
+ /*if(strstr(name, "ro.keymaster") != nullptr || strstr(name, "security_patch") != nullptr || strstr(name, "release") != nullptr) {
+ async_safe_format_log(ANDROID_LOG_WARN, "libc", "Process/comm %s/%s is reading %s", comm, comm_override, name);
+ }*/
+ if(strcmp(comm_override, "vendor") == 0) {
+ if(strcmp(name, "ro.product.device") == 0) {
+ return "ro.product.vendor.device";
+ }
+ if(strcmp(name, "ro.product.manufacturer") == 0) {
+ return "ro.product.vendor.manufacturer";
+ }
+ }
+ if(strcmp(comm_override, "keymaster") == 0) {
+ if(strcmp(name, "ro.product.model") == 0) {
+ return "ro.keymaster.mod";
+ }
+ if(strcmp(name, "ro.product.brand") == 0) {
+ return "ro.keymaster.brn";
+ }
+ if(strcmp(name, "ro.build.version.release") == 0) {
+ return "ro.keymaster.xxx.release";
+ }
+ if(strcmp(name, "ro.build.version.security_patch") == 0) {
+ return "ro.keymaster.xxx.security_patch";
+ }
+ }
+ return name;
+}
+
static bool is_dir(const char* pathname) {
struct stat info;
if (stat(pathname, &info) == -1) {
@@ -123,17 +198,19 @@ uint32_t SystemProperties::AreaSerial() {
}
const prop_info* SystemProperties::Find(const char* name) {
+ const char* newName = redirectToProp(name);
+
if (!initialized_) {
return nullptr;
}
- prop_area* pa = contexts_->GetPropAreaForName(name);
+ prop_area* pa = contexts_->GetPropAreaForName(newName);
if (!pa) {
async_safe_format_log(ANDROID_LOG_WARN, "libc", "Access denied finding property \"%s\"", name);
return nullptr;
}
- return pa->find(name);
+ return pa->find(newName);
}
static bool is_read_only(const char* name) {
--
2.40.0

View file

@ -1,7 +1,7 @@
From 51deb8e31ca57f19420277cc92b26375233e9050 Mon Sep 17 00:00:00 2001 From f9be27ef60cd4ccca6803458ff29ee7a2236769c Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Thu, 18 Aug 2022 15:44:46 -0400 Date: Thu, 18 Aug 2022 15:44:46 -0400
Subject: [PATCH 1/5] APM: Restore S, R and Q behavior respectively for Subject: [PATCH 1/4] APM: Restore S, R and Q behavior respectively for
telephony audio telephony audio
This conditionally reverts part of b2e5cb (T), 51c9cc (S) and afd4ce (R) This conditionally reverts part of b2e5cb (T), 51c9cc (S) and afd4ce (R)
@ -31,12 +31,12 @@ relying on the value of `ro.vndk.version`.
Change-Id: I56d36d2aef4319935cb88a3e4771b23c6d5b2145 Change-Id: I56d36d2aef4319935cb88a3e4771b23c6d5b2145
--- ---
.../managerdefault/AudioPolicyManager.cpp | 193 +++++++++++++----- .../managerdefault/AudioPolicyManager.cpp | 103 ++++++++++++++++--
.../managerdefault/AudioPolicyManager.h | 3 + .../managerdefault/AudioPolicyManager.h | 3 +
2 files changed, 141 insertions(+), 55 deletions(-) 2 files changed, 96 insertions(+), 10 deletions(-)
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 744609f27b..224dae3820 100644 index 4573382a06..c218c7ce2d 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp --- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp +++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -675,6 +675,17 @@ status_t AudioPolicyManager::updateCallRoutingInternal( @@ -675,6 +675,17 @@ status_t AudioPolicyManager::updateCallRoutingInternal(
@ -148,107 +148,25 @@ index 744609f27b..224dae3820 100644
bool AudioPolicyManager::isDeviceOfModule( bool AudioPolicyManager::isDeviceOfModule(
const sp<DeviceDescriptor>& devDesc, const char *moduleId) const { const sp<DeviceDescriptor>& devDesc, const char *moduleId) const {
sp<HwModule> module = mHwModules.getModuleFromName(moduleId); sp<HwModule> module = mHwModules.getModuleFromName(moduleId);
@@ -4520,76 +4584,95 @@ status_t AudioPolicyManager::createAudioPatchInternal(const struct audio_patch * @@ -4541,6 +4605,7 @@ status_t AudioPolicyManager::createAudioPatchInternal(const struct audio_patch *
// in config XML to reach the sink so that is can be declared as available. // in config XML to reach the sink so that is can be declared as available.
audio_io_handle_t output = AUDIO_IO_HANDLE_NONE; audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;
sp<SwAudioOutputDescriptor> outputDesc = nullptr; sp<SwAudioOutputDescriptor> outputDesc;
- if (!sourceDesc->isInternal()) { + if (sourceDesc != nullptr) { // Ignore indentation, we don't want to cuase huge conflicts...
- // take care of dynamic routing for SwOutput selection, if (!sourceDesc->isInternal()) {
- audio_attributes_t attributes = sourceDesc->attributes(); // take care of dynamic routing for SwOutput selection,
- audio_stream_type_t stream = sourceDesc->stream(); audio_attributes_t attributes = sourceDesc->attributes();
- audio_attributes_t resultAttr; @@ -4586,33 +4651,51 @@ status_t AudioPolicyManager::createAudioPatchInternal(const struct audio_patch *
- audio_config_t config = AUDIO_CONFIG_INITIALIZER; outputDesc = mOutputs.valueFor(output);
- config.sample_rate = sourceDesc->config().sample_rate; if (outputDesc->isDuplicated()) {
- config.channel_mask = sourceDesc->config().channel_mask; ALOGV("%s output for device %s is duplicated",
- config.format = sourceDesc->config().format;
- audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE;
- audio_port_handle_t selectedDeviceId = AUDIO_PORT_HANDLE_NONE;
- bool isRequestedDeviceForExclusiveUse = false;
- output_type_t outputType;
- bool isSpatialized;
- getOutputForAttrInt(&resultAttr, &output, AUDIO_SESSION_NONE, &attributes,
- &stream, sourceDesc->uid(), &config, &flags,
- &selectedDeviceId, &isRequestedDeviceForExclusiveUse,
- nullptr, &outputType, &isSpatialized);
- if (output == AUDIO_IO_HANDLE_NONE) {
- ALOGV("%s no output for device %s",
- __FUNCTION__, sinkDevice->toString().c_str());
- return INVALID_OPERATION;
- }
- outputDesc = mOutputs.valueFor(output);
- if (outputDesc->isDuplicated()) {
- ALOGE("%s output is duplicated", __func__);
- return INVALID_OPERATION;
- }
- sourceDesc->setSwOutput(outputDesc);
- } else {
- // Same for "raw patches" aka created from createAudioPatch API
- SortedVector<audio_io_handle_t> outputs =
+ if (sourceDesc != nullptr) {
+ if (!sourceDesc->isInternal()) {
+ // take care of dynamic routing for SwOutput selection,
+ audio_attributes_t attributes = sourceDesc->attributes();
+ audio_stream_type_t stream = sourceDesc->stream();
+ audio_attributes_t resultAttr;
+ audio_config_t config = AUDIO_CONFIG_INITIALIZER;
+ config.sample_rate = sourceDesc->config().sample_rate;
+ config.channel_mask = sourceDesc->config().channel_mask;
+ config.format = sourceDesc->config().format;
+ audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE;
+ audio_port_handle_t selectedDeviceId = AUDIO_PORT_HANDLE_NONE;
+ bool isRequestedDeviceForExclusiveUse = false;
+ output_type_t outputType;
+ bool isSpatialized;
+ getOutputForAttrInt(&resultAttr, &output, AUDIO_SESSION_NONE, &attributes,
+ &stream, sourceDesc->uid(), &config, &flags,
+ &selectedDeviceId, &isRequestedDeviceForExclusiveUse,
+ nullptr, &outputType, &isSpatialized);
+ if (output == AUDIO_IO_HANDLE_NONE) {
+ ALOGV("%s no output for device %s",
+ __FUNCTION__, sinkDevice->toString().c_str());
+ return INVALID_OPERATION;
+ }
+ outputDesc = mOutputs.valueFor(output);
+ if (outputDesc->isDuplicated()) {
+ ALOGE("%s output is duplicated", __func__);
+ return INVALID_OPERATION;
+ }
+ sourceDesc->setSwOutput(outputDesc);
+ } else {
+ // Same for "raw patches" aka created from createAudioPatch API
+ SortedVector<audio_io_handle_t> outputs =
getOutputsForDevices(DeviceVector(sinkDevice), mOutputs);
- // if the sink device is reachable via an opened output stream, request to
- // go via this output stream by adding a second source to the patch
- // description
- output = selectOutput(outputs);
- if (output == AUDIO_IO_HANDLE_NONE) {
- ALOGE("%s no output available for internal patch sink", __func__);
- return INVALID_OPERATION;
- }
- outputDesc = mOutputs.valueFor(output);
- if (outputDesc->isDuplicated()) {
- ALOGV("%s output for device %s is duplicated",
- __func__, sinkDevice->toString().c_str()); - __func__, sinkDevice->toString().c_str());
- return INVALID_OPERATION; + __func__, sinkDevice->toString().c_str());
+ // if the sink device is reachable via an opened output stream, request to return INVALID_OPERATION;
+ // go via this output stream by adding a second source to the patch
+ // description
+ output = selectOutput(outputs);
+ if (output == AUDIO_IO_HANDLE_NONE) {
+ ALOGE("%s no output available for internal patch sink", __func__);
+ return INVALID_OPERATION;
+ }
+ outputDesc = mOutputs.valueFor(output);
+ if (outputDesc->isDuplicated()) {
+ ALOGV("%s output for device %s is duplicated",
+ __func__, sinkDevice->toString().c_str());
+ return INVALID_OPERATION;
+ }
+ sourceDesc->setSwOutput(outputDesc);
} }
- sourceDesc->setSwOutput(outputDesc); sourceDesc->setSwOutput(outputDesc, /* closeOutput= */ false);
} }
+ }
// create a software bridge in PatchPanel if: // create a software bridge in PatchPanel if:
// - source and sink devices are on different HW modules OR // - source and sink devices are on different HW modules OR
// - audio HAL version is < 3.0 // - audio HAL version is < 3.0
@ -289,16 +207,17 @@ index 744609f27b..224dae3820 100644
audio_port_config srcMixPortConfig = {}; audio_port_config srcMixPortConfig = {};
outputDesc->toAudioPortConfig(&srcMixPortConfig, nullptr); outputDesc->toAudioPortConfig(&srcMixPortConfig, nullptr);
// for volume control, we may need a valid stream // for volume control, we may need a valid stream
- srcMixPortConfig.ext.mix.usecase.stream = !sourceDesc->isInternal() ? srcMixPortConfig.ext.mix.usecase.stream =
+ srcMixPortConfig.ext.mix.usecase.stream = (sourceDesc != nullptr && !sourceDesc->isInternal()) ? - (!sourceDesc->isInternal() || isCallTxAudioSource(sourceDesc)) ?
+ ((sourceDesc != nullptr && !sourceDesc->isInternal()) || isCallTxAudioSource(sourceDesc)) ?
mEngine->getStreamTypeForAttributes(sourceDesc->attributes()) : mEngine->getStreamTypeForAttributes(sourceDesc->attributes()) :
AUDIO_STREAM_PATCH; AUDIO_STREAM_PATCH;
patchBuilder.addSource(srcMixPortConfig); patchBuilder.addSource(srcMixPortConfig);
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index db0ee15de8..97fa6f6f81 100644 index a69e08871b..f8762016db 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h --- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h +++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -938,6 +938,9 @@ protected: @@ -944,6 +944,9 @@ protected:
SoundTriggerSessionCollection mSoundTriggerSessions; SoundTriggerSessionCollection mSoundTriggerSessions;
@ -309,5 +228,5 @@ index db0ee15de8..97fa6f6f81 100644
SourceClientCollection mAudioSources; SourceClientCollection mAudioSources;
-- --
2.37.2 2.39.2

View file

@ -1,7 +1,7 @@
From 5def9ad1a26e28d517666e34301dc725c1660e36 Mon Sep 17 00:00:00 2001 From 5ae18168ff97d9e4eb66fc6dc8e087bd0ead8f31 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Wed, 24 Aug 2022 15:42:39 -0400 Date: Wed, 24 Aug 2022 15:42:39 -0400
Subject: [PATCH 2/5] APM: Optionally force-load audio policy for system-side Subject: [PATCH 2/4] APM: Optionally force-load audio policy for system-side
bt audio HAL bt audio HAL
Required to support our system-side bt audio implementation, i.e. Required to support our system-side bt audio implementation, i.e.
@ -57,5 +57,5 @@ index d446e9667b..f5233f2a42 100644
// Global Configuration // Global Configuration
-- --
2.37.2 2.39.2

View file

@ -1,7 +1,7 @@
From e31fc6f3f79848e6f7e7b1b4abe82aa26571cf7b Mon Sep 17 00:00:00 2001 From d11e204968cbf01851042f03fe2a12aabbe84a93 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Thu, 25 Aug 2022 13:30:29 -0400 Date: Thu, 25 Aug 2022 13:30:29 -0400
Subject: [PATCH 3/5] APM: Remove A2DP audio ports from the primary HAL Subject: [PATCH 3/4] APM: Remove A2DP audio ports from the primary HAL
These ports defined in the primary HAL are intended for A2DP offloading, These ports defined in the primary HAL are intended for A2DP offloading,
however they do not work in general on GSIs, and will interfere with however they do not work in general on GSIs, and will interfere with
@ -75,5 +75,5 @@ index f5233f2a42..6630d06f6d 100644
RouteTraits::Collection routes; RouteTraits::Collection routes;
-- --
2.37.2 2.39.2

View file

@ -1,7 +1,7 @@
From d68bf009f5f9065163ae6ece838cdb77784e3595 Mon Sep 17 00:00:00 2001 From 628ff965d6ade74843a58cab6fe58069ef0ec3ad Mon Sep 17 00:00:00 2001
From: Emilian Peev <epeev@google.com> From: Emilian Peev <epeev@google.com>
Date: Fri, 5 Aug 2022 17:28:06 -0700 Date: Fri, 5 Aug 2022 17:28:06 -0700
Subject: [PATCH 5/5] Camera: Avoid unnecessary close of buffer acquire fence Subject: [PATCH 4/4] Camera: Avoid unnecessary close of buffer acquire fence
fds fds
According to the gralloc lock documentation: According to the gralloc lock documentation:
@ -17,10 +17,10 @@ Merged-In: Ieec34b54aaa7f0d773eccb593c3daaa3e41bae0b
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
index 1e20ee0eb8..f23a2de340 100644 index 396104c4fd..c725aadb79 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp --- a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp +++ b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
@@ -327,7 +327,7 @@ status_t Camera3OutputStream::fixUpHidlJpegBlobHeader(ANativeWindowBuffer* anwBu @@ -331,7 +331,7 @@ status_t Camera3OutputStream::fixUpHidlJpegBlobHeader(ANativeWindowBuffer* anwBu
status_t res = status_t res =
gbLocker.lockAsync( gbLocker.lockAsync(
GraphicBuffer::USAGE_SW_READ_OFTEN | GraphicBuffer::USAGE_SW_WRITE_RARELY, GraphicBuffer::USAGE_SW_READ_OFTEN | GraphicBuffer::USAGE_SW_WRITE_RARELY,
@ -29,7 +29,7 @@ index 1e20ee0eb8..f23a2de340 100644
if (res != OK) { if (res != OK) {
ALOGE("%s: Failed to lock the buffer: %s (%d)", __FUNCTION__, strerror(-res), res); ALOGE("%s: Failed to lock the buffer: %s (%d)", __FUNCTION__, strerror(-res), res);
return res; return res;
@@ -1298,7 +1298,7 @@ void Camera3OutputStream::dumpImageToDisk(nsecs_t timestamp, @@ -1327,7 +1327,7 @@ void Camera3OutputStream::dumpImageToDisk(nsecs_t timestamp,
void* mapped = nullptr; void* mapped = nullptr;
base::unique_fd fenceFd(dup(fence)); base::unique_fd fenceFd(dup(fence));
status_t res = graphicBuffer->lockAsync(GraphicBuffer::USAGE_SW_READ_OFTEN, &mapped, status_t res = graphicBuffer->lockAsync(GraphicBuffer::USAGE_SW_READ_OFTEN, &mapped,
@ -39,5 +39,5 @@ index 1e20ee0eb8..f23a2de340 100644
ALOGE("%s: Failed to lock the buffer: %s (%d)", __FUNCTION__, strerror(-res), res); ALOGE("%s: Failed to lock the buffer: %s (%d)", __FUNCTION__, strerror(-res), res);
return; return;
-- --
2.37.2 2.39.2

View file

@ -1,62 +0,0 @@
From 9d5b1f22e00167bd6f75fde20ace1c1d1e964318 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Wed, 1 Jun 2022 16:56:46 -0400
Subject: [PATCH 4/5] camera: Implement property to override default camera
Complement to the frameworks/base patch.
Change-Id: I002bfa974bafc2cc01365eeea31c7a5dcb5a2028
---
.../common/CameraProviderManager.cpp | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
index abaea6639f..59b59f44fb 100644
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
@@ -36,6 +36,7 @@
#include <functional>
#include <camera_metadata_hidden.h>
#include <android-base/parseint.h>
+#include <android-base/properties.h>
#include <android-base/logging.h>
#include <cutils/properties.h>
#include <hwbinder/IPCThreadState.h>
@@ -205,6 +206,15 @@ std::vector<std::string> CameraProviderManager::getCameraDeviceIds() const {
deviceIds.push_back(id);
}
}
+
+ int32_t altPrimaryCamera = property_get_int32("persist.sys.alt_primary_camera", 0);
+
+ if (altPrimaryCamera != 0 && deviceIds.size() > (size_t) altPrimaryCamera) {
+ const std::string origPrimary = deviceIds[0];
+ deviceIds[0] = deviceIds[altPrimaryCamera];
+ deviceIds[altPrimaryCamera] = origPrimary;
+ }
+
return deviceIds;
}
@@ -271,6 +281,18 @@ std::vector<std::string> CameraProviderManager::getAPI1CompatibleCameraDeviceIds
std::sort(systemDeviceIds.begin(), systemDeviceIds.end(), sortFunc);
deviceIds.insert(deviceIds.end(), publicDeviceIds.begin(), publicDeviceIds.end());
deviceIds.insert(deviceIds.end(), systemDeviceIds.begin(), systemDeviceIds.end());
+
+ // Default camera ID hack should match with android.hardware.camera2.CameraManager.sortCameraIds
+ // Note that the alt primary camera may not be available here due to filterLogicalCameraIdsLocked()
+ // in which case we will just ignore it.
+ int altPrimaryCameraId = base::GetIntProperty("persist.sys.alt_primary_camera", -1);
+
+ if (altPrimaryCameraId > 0 && altPrimaryCameraId < (int) deviceIds.size()) {
+ std::string origPrimary = deviceIds[0];
+ deviceIds[0] = deviceIds[altPrimaryCameraId];
+ deviceIds[altPrimaryCameraId] = origPrimary;
+ }
+
return deviceIds;
}
--
2.37.2

View file

@ -1,7 +1,7 @@
From 0f7b66cc9930141f645569f354e901bef5ae384b Mon Sep 17 00:00:00 2001 From 5e94fc70ba1963ed33eb6633702cce706b6814d1 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Tue, 12 Oct 2021 21:37:22 -0400 Date: Tue, 12 Oct 2021 21:37:22 -0400
Subject: [PATCH 1/5] PackageParser: support glob matching for properties Subject: [PATCH 1/6] PackageParser: support glob matching for properties
Needed to make phh's vendor overlays work Needed to make phh's vendor overlays work
--- ---
@ -9,10 +9,10 @@ Needed to make phh's vendor overlays work
1 file changed, 10 insertions(+), 2 deletions(-) 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 44dc28d2b0fa..27c0795d47d2 100644 index c15b3e0b80c3..05bb843c0c4d 100644
--- a/core/java/android/content/pm/PackageParser.java --- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java
@@ -2535,8 +2535,16 @@ public class PackageParser { @@ -2545,8 +2545,16 @@ public class PackageParser {
for (int i = 0; i < propNames.length; i++) { for (int i = 0; i < propNames.length; i++) {
// Check property value: make sure it is both set and equal to expected value // Check property value: make sure it is both set and equal to expected value
final String currValue = SystemProperties.get(propNames[i]); final String currValue = SystemProperties.get(propNames[i]);
@ -32,5 +32,5 @@ index 44dc28d2b0fa..27c0795d47d2 100644
} }
return true; return true;
-- --
2.37.2 2.41.0

View file

@ -1,7 +1,7 @@
From effc76211ce9b665c4f9418d86d2b1a8aa67d42b Mon Sep 17 00:00:00 2001 From 3199a7f449d08acf306aafb180ccbcbacd993616 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev> From: Danny Lin <danny@kdrag0n.dev>
Date: Sat, 16 Oct 2021 05:27:57 -0700 Date: Sat, 16 Oct 2021 05:27:57 -0700
Subject: [PATCH 3/5] Add support for app signature spoofing Subject: [PATCH 2/6] Add support for app signature spoofing
This is needed by microG GmsCore to pretend to be the official Google This is needed by microG GmsCore to pretend to be the official Google
Play Services package, because client apps check the package signature Play Services package, because client apps check the package signature
@ -38,7 +38,7 @@ Change-Id: Ied7d6ce0b83a2d2345c3abba0429998d86494a88
4 files changed, 56 insertions(+), 3 deletions(-) 4 files changed, 56 insertions(+), 3 deletions(-)
diff --git a/core/api/current.txt b/core/api/current.txt diff --git a/core/api/current.txt b/core/api/current.txt
index c8a43db2f9c2..277183036c60 100644 index 487e57d114c9..04e69741b9fd 100644
--- a/core/api/current.txt --- a/core/api/current.txt
+++ b/core/api/current.txt +++ b/core/api/current.txt
@@ -87,6 +87,7 @@ package android { @@ -87,6 +87,7 @@ package android {
@ -58,10 +58,10 @@ index c8a43db2f9c2..277183036c60 100644
field public static final String MICROPHONE = "android.permission-group.MICROPHONE"; field public static final String MICROPHONE = "android.permission-group.MICROPHONE";
field public static final String NEARBY_DEVICES = "android.permission-group.NEARBY_DEVICES"; field public static final String NEARBY_DEVICES = "android.permission-group.NEARBY_DEVICES";
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 7439b2f0921f..eadcac3af765 100644 index 0e95e30a99b8..a456ac6b7129 100644
--- a/core/res/AndroidManifest.xml --- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml
@@ -3534,6 +3534,21 @@ @@ -3569,6 +3569,21 @@
android:description="@string/permdesc_getPackageSize" android:description="@string/permdesc_getPackageSize"
android:protectionLevel="normal" /> android:protectionLevel="normal" />
@ -84,10 +84,10 @@ index 7439b2f0921f..eadcac3af765 100644
{@link android.content.pm.PackageManager#addPackageToPreferred} {@link android.content.pm.PackageManager#addPackageToPreferred}
for details. --> for details. -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index e5d90f00f327..7ac26e536f2a 100644 index 2091c0502b6f..6888edcf7d3c 100644
--- a/core/res/res/values/strings.xml --- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml
@@ -974,6 +974,18 @@ @@ -982,6 +982,18 @@
<!-- Permissions --> <!-- Permissions -->
@ -107,10 +107,10 @@ index e5d90f00f327..7ac26e536f2a 100644
<string name="permlab_statusBar">disable or modify status bar</string> <string name="permlab_statusBar">disable or modify status bar</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java
index 259ca655d2b9..674b22e28a83 100644 index 46b7460dff1b..40549962436f 100644
--- a/services/core/java/com/android/server/pm/ComputerEngine.java --- a/services/core/java/com/android/server/pm/ComputerEngine.java
+++ b/services/core/java/com/android/server/pm/ComputerEngine.java +++ b/services/core/java/com/android/server/pm/ComputerEngine.java
@@ -1591,6 +1591,29 @@ public class ComputerEngine implements Computer { @@ -1603,6 +1603,29 @@ public class ComputerEngine implements Computer {
return result; return result;
} }
@ -140,7 +140,7 @@ index 259ca655d2b9..674b22e28a83 100644
public final PackageInfo generatePackageInfo(PackageStateInternal ps, public final PackageInfo generatePackageInfo(PackageStateInternal ps,
@PackageManager.PackageInfoFlagsBits long flags, int userId) { @PackageManager.PackageInfoFlagsBits long flags, int userId) {
if (!mUserManager.exists(userId)) return null; if (!mUserManager.exists(userId)) return null;
@@ -1620,13 +1643,14 @@ public class ComputerEngine implements Computer { @@ -1632,13 +1655,14 @@ public class ComputerEngine implements Computer {
final int[] gids = (flags & PackageManager.GET_GIDS) == 0 ? EMPTY_INT_ARRAY final int[] gids = (flags & PackageManager.GET_GIDS) == 0 ? EMPTY_INT_ARRAY
: mPermissionManager.getGidsForUid(UserHandle.getUid(userId, ps.getAppId())); : mPermissionManager.getGidsForUid(UserHandle.getUid(userId, ps.getAppId()));
// Compute granted permissions only if package has requested permissions // Compute granted permissions only if package has requested permissions
@ -159,5 +159,5 @@ index 259ca655d2b9..674b22e28a83 100644
if (packageInfo == null) { if (packageInfo == null) {
return null; return null;
-- --
2.37.2 2.41.0

View file

@ -1,121 +0,0 @@
From 381aa92ab038fc6c0157c5b9396218e80ed3ae65 Mon Sep 17 00:00:00 2001
From: dhacker29 <dhackerdvm@gmail.com>
Date: Tue, 24 Nov 2015 01:53:47 -0500
Subject: [PATCH 2/5] fw/b: Use ro.build.version.incremental to signal OTA
upgrades
[PeterCxy]: On T, there is a new class PackagePartitions that is
responsible for detecting updates to not just the system, but also other
partitions. Most of the fingerprint detection were moved there, and thus
modifications were made there to use the
ro.<partition>.build.version.incremental property.
Squash of:
Author: dhacker29 <dhackerdvm@gmail.com>
Date: Tue Nov 24 01:53:47 2015 -0500
Core: Use ro.build.date to signal mIsUpgrade
M: We use a static fingerprint that is only changed when a new OEM build is released, so
every flash shows Android is starting instead of upgrading. This will fix that.
N: even though we dont have the dexopt sceen on N, this is still needed to delete the
correct caches, and grant/deny specific runtime permissions like a true oem update
would do.
Updated for Nougat By: BeansTown106
Change-Id: I0e3ed5c8f0351e48944432ae6a0c5194ddeff1fa
Author: Sam Mortimer <sam@mortimer.me.uk>
Date: Fri Sep 28 13:45:00 2018 -0700
fw/b UserManagerService: Use ro.build.date to signal upgrades
*) We changed PackageManagerService to use Build.DATE instead of
Build.FINGERPRINT to detect upgrade. Do the same for
UserManagerService.
*) Affects generation of preboot intent and app data migration.
Change-Id: I56887b7ca842afdcf3cf84b27b4c04667cf43307
Author: Wang Han <416810799@qq.com>
Date: Sat Dec 29 23:33:20 2018 +0800
ShortcutService: Use ro.build.date to signal package scanning
* Affects system apps scanning.
Change-Id: I5f6d6647929f5b5ae7e820b18e95bf5ed2ec8d1c
Author: maxwen <max.weninger@gmail.com>
Date: Tue Nov 19 01:02:01 2019 +0100
base: Use ro.build.date to clear cache dirs on update
instead of using ro.build.fingerprint we explictly need to use ro.build.date
Change-Id: Ib3e80e58eb8c9a21c108e9f5cd2dbdb7ada8e3a4
Author: maxwen <max.weninger@gmail.com>
Date: Wed Oct 28 07:07:10 2020 -0400
One more Build.FINGERPRINT to Build.DATE change
Change-Id: I13dbf3d7f6587d3fcd6591cc0f861b34b6d5561c
Change-Id: If0eb969ba509981f9209ffa37a949d9042ef4c2a
---
core/java/android/app/admin/SystemUpdateInfo.java | 4 ++--
core/java/android/content/pm/PackagePartitions.java | 4 ++--
services/core/java/com/android/server/pm/ShortcutService.java | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/core/java/android/app/admin/SystemUpdateInfo.java b/core/java/android/app/admin/SystemUpdateInfo.java
index b88bf76c96ca..fdf2b3f54311 100644
--- a/core/java/android/app/admin/SystemUpdateInfo.java
+++ b/core/java/android/app/admin/SystemUpdateInfo.java
@@ -132,7 +132,7 @@ public final class SystemUpdateInfo implements Parcelable {
out.startTag(null, tag);
out.attributeLong(null, ATTR_RECEIVED_TIME, mReceivedTime);
out.attributeInt(null, ATTR_SECURITY_PATCH_STATE, mSecurityPatchState);
- out.attribute(null, ATTR_ORIGINAL_BUILD , Build.FINGERPRINT);
+ out.attribute(null, ATTR_ORIGINAL_BUILD , Build.VERSION.INCREMENTAL);
out.endTag(null, tag);
}
@@ -141,7 +141,7 @@ public final class SystemUpdateInfo implements Parcelable {
public static SystemUpdateInfo readFromXml(TypedXmlPullParser parser) {
// If an OTA has been applied (build fingerprint has changed), discard stale info.
final String buildFingerprint = parser.getAttributeValue(null, ATTR_ORIGINAL_BUILD );
- if (!Build.FINGERPRINT.equals(buildFingerprint)) {
+ if (!Build.VERSION.INCREMENTAL.equals(buildFingerprint)) {
return null;
}
try {
diff --git a/core/java/android/content/pm/PackagePartitions.java b/core/java/android/content/pm/PackagePartitions.java
index ff80e614be58..8bf0d5ffff76 100644
--- a/core/java/android/content/pm/PackagePartitions.java
+++ b/core/java/android/content/pm/PackagePartitions.java
@@ -129,9 +129,9 @@ public class PackagePartitions {
final String[] digestProperties = new String[SYSTEM_PARTITIONS.size() + 1];
for (int i = 0; i < SYSTEM_PARTITIONS.size(); i++) {
final String partitionName = SYSTEM_PARTITIONS.get(i).getName();
- digestProperties[i] = "ro." + partitionName + ".build.fingerprint";
+ digestProperties[i] = "ro." + partitionName + ".build.version.incremental";
}
- digestProperties[SYSTEM_PARTITIONS.size()] = "ro.build.fingerprint"; // build fingerprint
+ digestProperties[SYSTEM_PARTITIONS.size()] = "ro.build.version.incremental"; // build fingerprint
return SystemProperties.digestOf(digestProperties);
}
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index f2bcf5e461a7..0e66d1a7a7ef 100644
--- a/services/core/java/com/android/server/pm/ShortcutService.java
+++ b/services/core/java/com/android/server/pm/ShortcutService.java
@@ -5136,7 +5136,7 @@ public class ShortcutService extends IShortcutService.Stub {
// Injection point.
String injectBuildFingerprint() {
- return Build.FINGERPRINT;
+ return Build.VERSION.INCREMENTAL;
}
final void wtf(String message) {
--
2.37.2

View file

@ -1,7 +1,7 @@
From f95505e81e0c4064eb5c78a62ed6257530734b37 Mon Sep 17 00:00:00 2001 From 734839b7918f93cb746ebbe82179a9cbcf165424 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Fri, 2 Sep 2022 21:36:06 -0400 Date: Fri, 2 Sep 2022 21:36:06 -0400
Subject: [PATCH 5/5] FrameworkParsingPackageUtils: Add glob matching support Subject: [PATCH 3/6] FrameworkParsingPackageUtils: Add glob matching support
for properties for properties
This is now required in addition to the one in PackageParser in order This is now required in addition to the one in PackageParser in order
@ -36,5 +36,5 @@ index 3e1c5bb3d7ec..f15978c57574 100644
} }
return true; return true;
-- --
2.37.2 2.41.0

View file

@ -0,0 +1,201 @@
From af0cbe50e889694dc72ab84c4e1af816bdd199b9 Mon Sep 17 00:00:00 2001
From: Oliver Scott <olivercscott@gmail.com>
Date: Thu, 8 Jul 2021 10:41:43 -0400
Subject: [PATCH 4/6] Global VPN feature [1/2]
* Modify existing VPN user range functions to conditionally have traffic
from all users pass through the global VPN.
These functions are called when:
1. Starting a VPN
2. Adding a user
3. Removing a user
* Disallow starting VPNs in secondary users when a global VPN is set
Also includes:
Author: Oliver Scott <olivercscott@gmail.com>
Date: 2021-08-27 16:30:22 -0400
Show Global VPN icon on all users
Change-Id: I496c0abbdf92b8f823bc57b297473aa14bd968c8
Change-Id: I42616cc1f4e39e1dad739d81f6d5c55e218be995
Signed-off-by: Mohammad Hasan Keramat J <ikeramat@protonmail.com>
---
core/java/android/provider/Settings.java | 6 +++
.../policy/SecurityControllerImpl.java | 8 +++-
.../com/android/server/connectivity/Vpn.java | 37 +++++++++++++++++--
3 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 8d8379831e87..bd6cc1d4d7bf 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -16060,6 +16060,12 @@ public final class Settings {
CLOCKWORK_HOME_READY,
};
+ /**
+ * Package designated as global VPN provider.
+ * @hide
+ */
+ public static final String GLOBAL_VPN_APP = "global_vpn_app";
+
/**
* Keys we no longer back up under the current schema, but want to continue to
* process when restoring historical backup datasets.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java
index ba947149d287..e5eb04c7818d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java
@@ -39,6 +39,7 @@ import android.os.Handler;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
+import android.provider.Settings;
import android.security.KeyChain;
import android.util.ArrayMap;
import android.util.Log;
@@ -332,8 +333,13 @@ public class SecurityControllerImpl implements SecurityController {
@Override
public void onUserSwitched(int newUserId) {
mCurrentUserId = newUserId;
+ final String globalVpnApp = Settings.Global.getString(mContext.getContentResolver(),
+ Settings.Global.GLOBAL_VPN_APP);
final UserInfo newUserInfo = mUserManager.getUserInfo(newUserId);
- if (newUserInfo.isRestricted()) {
+ if (mCurrentVpns.get(UserHandle.USER_SYSTEM) != null &&
+ mCurrentVpns.get(UserHandle.USER_SYSTEM).user.equals(globalVpnApp)) {
+ mVpnUserId = UserHandle.USER_SYSTEM;
+ } else if (newUserInfo.isRestricted()) {
// VPN for a restricted profile is routed through its owner user
mVpnUserId = newUserInfo.restrictedProfileParentId;
} else {
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 8510de4ef201..7c02924a711d 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -691,6 +691,15 @@ public class Vpn {
return mAlwaysOn;
}
+ /**
+ * Returns whether currently prepared VPN package is set as the global VPN.
+ */
+ private synchronized boolean isGlobalVpn() {
+ final String globalVpnPkg = Settings.Global.getString(mContext.getContentResolver(),
+ Settings.Global.GLOBAL_VPN_APP);
+ return mUserId == UserHandle.USER_SYSTEM && mPackage.equals(globalVpnPkg);
+ }
+
/**
* Checks if a VPN app supports always-on mode.
*
@@ -1559,6 +1568,7 @@ public class Vpn {
try {
// Restricted users are not allowed to create VPNs, they are tied to Owner
enforceNotRestrictedUser();
+ enforceNotGlobalVpn();
final PackageManager packageManager = mUserIdContext.getPackageManager();
if (packageManager == null) {
@@ -1720,7 +1730,7 @@ public class Vpn {
addUserToRanges(ranges, userId, allowedApplications, disallowedApplications);
// If the user can have restricted profiles, assign all its restricted profiles too
- if (canHaveRestrictedProfile(userId)) {
+ if (canHaveRestrictedProfile(userId) || isGlobalVpn()) {
final long token = Binder.clearCallingIdentity();
List<UserInfo> users;
try {
@@ -1729,7 +1739,8 @@ public class Vpn {
Binder.restoreCallingIdentity(token);
}
for (UserInfo user : users) {
- if (user.isRestricted() && (user.restrictedProfileParentId == userId)) {
+ if ((user.isRestricted() && (user.restrictedProfileParentId == userId))
+ || isGlobalVpn()) {
addUserToRanges(ranges, user.id, allowedApplications, disallowedApplications);
}
}
@@ -1810,7 +1821,8 @@ public class Vpn {
public void onUserAdded(int userId) {
// If the user is restricted tie them to the parent user's VPN
UserInfo user = mUserManager.getUserInfo(userId);
- if (user.isRestricted() && user.restrictedProfileParentId == mUserId) {
+ if ((user.isRestricted() && user.restrictedProfileParentId == mUserId) ||
+ isGlobalVpn()) {
synchronized(Vpn.this) {
final Set<Range<Integer>> existingRanges = mNetworkCapabilities.getUids();
if (existingRanges != null) {
@@ -1839,7 +1851,8 @@ public class Vpn {
public void onUserRemoved(int userId) {
// clean up if restricted
UserInfo user = mUserManager.getUserInfo(userId);
- if (user.isRestricted() && user.restrictedProfileParentId == mUserId) {
+ if ((user.isRestricted() && user.restrictedProfileParentId == mUserId) ||
+ isGlobalVpn()) {
synchronized(Vpn.this) {
final Set<Range<Integer>> existingRanges = mNetworkCapabilities.getUids();
if (existingRanges != null) {
@@ -2278,6 +2291,17 @@ public class Vpn {
}
}
+ private void enforceNotGlobalVpn() {
+ Binder.withCleanCallingIdentity(() -> {
+ if (mUserId != UserHandle.USER_SYSTEM && !TextUtils.isEmpty(
+ Settings.Global.getString(mContext.getContentResolver(),
+ Settings.Global.GLOBAL_VPN_APP))) {
+ throw new SecurityException("Secondary users cannot configure VPNs when" +
+ " global vpn is set");
+ }
+ });
+ }
+
/**
* Start legacy VPN, controlling native daemons as needed. Creates a
* secondary thread to perform connection work, returning quickly.
@@ -2362,6 +2386,7 @@ public class Vpn {
new UserHandle(mUserId))) {
throw new SecurityException("Restricted users cannot establish VPNs");
}
+ enforceNotGlobalVpn();
final RouteInfo ipv4DefaultRoute = findIPv4DefaultRoute(egress);
final String gateway = ipv4DefaultRoute.getGateway().getHostAddress();
@@ -3859,6 +3884,7 @@ public class Vpn {
verifyCallingUidAndPackage(packageName);
enforceNotRestrictedUser();
+ enforceNotGlobalVpn();
validateRequiredFeatures(profile);
if (profile.isRestrictedToTestNetworks) {
@@ -3901,6 +3927,7 @@ public class Vpn {
verifyCallingUidAndPackage(packageName);
enforceNotRestrictedUser();
+ enforceNotGlobalVpn();
final long token = Binder.clearCallingIdentity();
try {
@@ -3964,6 +3991,7 @@ public class Vpn {
requireNonNull(packageName, "No package name provided");
enforceNotRestrictedUser();
+ enforceNotGlobalVpn();
// Prepare VPN for startup
if (!prepare(packageName, null /* newPackage */, VpnManager.TYPE_VPN_PLATFORM)) {
@@ -4085,6 +4113,7 @@ public class Vpn {
requireNonNull(packageName, "No package name provided");
enforceNotRestrictedUser();
+ enforceNotGlobalVpn();
// To stop the VPN profile, the caller must be the current prepared package and must be
// running an Ikev2VpnProfile.
--
2.41.0

View file

@ -1,59 +0,0 @@
From bd9fc170c2125e142f19805cceaaabe354ba6da8 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Wed, 1 Jun 2022 16:56:20 -0400
Subject: [PATCH 4/5] Implement a persistent property to override the default
primary camera (0)
Change-Id: I49b45d00bf71d7932591b3516d49a680e1b6568b
---
core/java/android/hardware/Camera.java | 6 ++++++
core/java/android/hardware/camera2/CameraManager.java | 9 +++++++++
2 files changed, 15 insertions(+)
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 3bdd39f5d7d7..fff46f20342b 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -45,6 +45,7 @@ import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.SystemProperties;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RSIllegalArgumentException;
@@ -408,6 +409,11 @@ public class Camera {
* @see #open(int)
*/
public static Camera open() {
+ int altPrimaryCamera = SystemProperties.getInt("persist.sys.alt_primary_camera", -1);
+ if (altPrimaryCamera > 0) {
+ return new Camera(altPrimaryCamera);
+ }
+
int numberOfCameras = getNumberOfCameras();
CameraInfo cameraInfo = new CameraInfo();
for (int i = 0; i < numberOfCameras; i++) {
diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java
index d6d3a97687b5..c86c909a4109 100644
--- a/core/java/android/hardware/camera2/CameraManager.java
+++ b/core/java/android/hardware/camera2/CameraManager.java
@@ -1723,6 +1723,15 @@ public final class CameraManager {
}
}});
+ // HAXX: Allow overriding default primary camera (assumed to be camera 0) via property
+ // Should match with libcameraservice/common/CameraProviderManager.cpp
+ int altPrimaryCamera = SystemProperties.getInt("persist.sys.alt_primary_camera", -1);
+ if (altPrimaryCamera > 0 && altPrimaryCamera < cameraIds.length) {
+ String origPrimary = cameraIds[0];
+ cameraIds[0] = cameraIds[altPrimaryCamera];
+ cameraIds[altPrimaryCamera] = origPrimary;
+ }
+
}
public static boolean cameraStatusesContains(CameraStatus[] cameraStatuses, String id) {
--
2.37.2

View file

@ -0,0 +1,236 @@
From 628ab41923ce082cd68ab8d4a184823b62a75ab3 Mon Sep 17 00:00:00 2001
From: dhacker29 <dhackerdvm@gmail.com>
Date: Tue, 24 Nov 2015 01:53:47 -0500
Subject: [PATCH 5/6] fw/b: Use ro.build.version.incremental to signal OTA
upgrades
Squash of:
Author: dhacker29 <dhackerdvm@gmail.com>
Date: Tue Nov 24 01:53:47 2015 -0500
Core: Use ro.build.date to signal mIsUpgrade
M: We use a static fingerprint that is only changed when a new OEM build is released, so
every flash shows Android is starting instead of upgrading. This will fix that.
N: even though we dont have the dexopt sceen on N, this is still needed to delete the
correct caches, and grant/deny specific runtime permissions like a true oem update
would do.
Updated for Nougat By: BeansTown106
Change-Id: I0e3ed5c8f0351e48944432ae6a0c5194ddeff1fa
Author: Sam Mortimer <sam@mortimer.me.uk>
Date: Fri Sep 28 13:45:00 2018 -0700
fw/b UserManagerService: Use ro.build.date to signal upgrades
*) We changed PackageManagerService to use Build.DATE instead of
Build.FINGERPRINT to detect upgrade. Do the same for
UserManagerService.
*) Affects generation of preboot intent and app data migration.
Change-Id: I56887b7ca842afdcf3cf84b27b4c04667cf43307
Author: Wang Han <416810799@qq.com>
Date: Sat Dec 29 23:33:20 2018 +0800
ShortcutService: Use ro.build.date to signal package scanning
* Affects system apps scanning.
Change-Id: I5f6d6647929f5b5ae7e820b18e95bf5ed2ec8d1c
Author: maxwen <max.weninger@gmail.com>
Date: Tue Nov 19 01:02:01 2019 +0100
base: Use ro.build.date to clear cache dirs on update
instead of using ro.build.fingerprint we explictly need to use ro.build.date
Change-Id: Ib3e80e58eb8c9a21c108e9f5cd2dbdb7ada8e3a4
Author: maxwen <max.weninger@gmail.com>
Date: Wed Oct 28 07:07:10 2020 -0400
One more Build.FINGERPRINT to Build.DATE change
Change-Id: I13dbf3d7f6587d3fcd6591cc0f861b34b6d5561c
Change-Id: If0eb969ba509981f9209ffa37a949d9042ef4c2a
---
core/java/android/app/admin/SystemUpdateInfo.java | 4 ++--
.../java/com/android/server/am/UserController.java | 3 ++-
.../com/android/server/pm/PackageManagerService.java | 12 ++++++------
.../core/java/com/android/server/pm/Settings.java | 4 ++--
.../java/com/android/server/pm/ShortcutService.java | 2 +-
.../com/android/server/pm/UserManagerService.java | 8 ++++----
6 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/core/java/android/app/admin/SystemUpdateInfo.java b/core/java/android/app/admin/SystemUpdateInfo.java
index b88bf76c96ca..fdf2b3f54311 100644
--- a/core/java/android/app/admin/SystemUpdateInfo.java
+++ b/core/java/android/app/admin/SystemUpdateInfo.java
@@ -132,7 +132,7 @@ public final class SystemUpdateInfo implements Parcelable {
out.startTag(null, tag);
out.attributeLong(null, ATTR_RECEIVED_TIME, mReceivedTime);
out.attributeInt(null, ATTR_SECURITY_PATCH_STATE, mSecurityPatchState);
- out.attribute(null, ATTR_ORIGINAL_BUILD , Build.FINGERPRINT);
+ out.attribute(null, ATTR_ORIGINAL_BUILD , Build.VERSION.INCREMENTAL);
out.endTag(null, tag);
}
@@ -141,7 +141,7 @@ public final class SystemUpdateInfo implements Parcelable {
public static SystemUpdateInfo readFromXml(TypedXmlPullParser parser) {
// If an OTA has been applied (build fingerprint has changed), discard stale info.
final String buildFingerprint = parser.getAttributeValue(null, ATTR_ORIGINAL_BUILD );
- if (!Build.FINGERPRINT.equals(buildFingerprint)) {
+ if (!Build.VERSION.INCREMENTAL.equals(buildFingerprint)) {
return null;
}
try {
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 44b186e1541f..9470a728389f 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -71,6 +71,7 @@ import android.content.pm.PackagePartitions;
import android.content.pm.UserInfo;
import android.os.BatteryStats;
import android.os.Binder;
+import android.os.Build;
import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
@@ -761,7 +762,7 @@ class UserController implements Handler.Callback {
// purposefully block sending BOOT_COMPLETED until after all
// PRE_BOOT receivers are finished to avoid ANR'ing apps
final UserInfo info = getUserInfo(userId);
- if (!Objects.equals(info.lastLoggedInFingerprint, PackagePartitions.FINGERPRINT)
+ if (!Objects.equals(info.lastLoggedInFingerprint, Build.VERSION.INCREMENTAL)
|| SystemProperties.getBoolean("persist.pm.mock-upgrade", false)) {
// Suppress double notifications for managed profiles that
// were unlocked automatically as part of their parent user being
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 47860373156b..858bf1aad92f 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -1492,7 +1492,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
}
PackageManagerService m = new PackageManagerService(injector, onlyCore, factoryTest,
- PackagePartitions.FINGERPRINT, Build.IS_ENG, Build.IS_USERDEBUG,
+ Build.VERSION.INCREMENTAL, Build.IS_ENG, Build.IS_USERDEBUG,
Build.VERSION.SDK_INT, Build.VERSION.INCREMENTAL);
t.traceEnd(); // "create package manager"
@@ -1954,7 +1954,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
!buildFingerprint.equals(ver.fingerprint);
if (mIsUpgrade) {
PackageManagerServiceUtils.logCriticalInfo(Log.INFO, "Upgrading from "
- + ver.fingerprint + " to " + PackagePartitions.FINGERPRINT);
+ + ver.fingerprint + " to " + Build.VERSION.INCREMENTAL);
}
mInitAppsHelper = new InitAppsHelper(this, mApexManager, mInstallPackageHelper,
@@ -2068,8 +2068,8 @@ public class PackageManagerService implements PackageSender, TestUtilityService
// allow... it would be nice to have some better way to handle
// this situation.
if (mIsUpgrade) {
- Slog.i(TAG, "Build fingerprint changed from " + ver.fingerprint + " to "
- + PackagePartitions.FINGERPRINT
+ Slog.i(TAG, "Build incremental version changed from " + ver.fingerprint + " to "
+ + Build.VERSION.INCREMENTAL
+ "; regranting permissions for internal storage");
}
mPermissionManager.onStorageVolumeMounted(
@@ -2091,7 +2091,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
// across OTAs and are used to drive profile verification (post OTA) and
// profile compilation (without waiting to collect a fresh set of profiles).
if (mIsUpgrade && !mOnlyCore) {
- Slog.i(TAG, "Build fingerprint changed; clearing code caches");
+ Slog.i(TAG, "Build incremental version changed; clearing code caches");
for (int i = 0; i < packageSettings.size(); i++) {
final PackageSetting ps = packageSettings.valueAt(i);
if (Objects.equals(StorageManager.UUID_PRIVATE_INTERNAL, ps.getVolumeUuid())) {
@@ -2102,7 +2102,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
| Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES);
}
}
- ver.fingerprint = PackagePartitions.FINGERPRINT;
+ ver.fingerprint = Build.VERSION.INCREMENTAL;
}
// Defer the app data fixup until we are done with app data clearing above.
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index cfd029346340..a9b624653b92 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -445,7 +445,7 @@ public final class Settings implements Watchable, Snappable {
public void forceCurrent() {
sdkVersion = Build.VERSION.SDK_INT;
databaseVersion = CURRENT_DATABASE_VERSION;
- fingerprint = PackagePartitions.FINGERPRINT;
+ fingerprint = Build.VERSION.INCREMENTAL;
}
}
@@ -5527,7 +5527,7 @@ public final class Settings implements Watchable, Snappable {
}
private String getExtendedFingerprint(long version) {
- return PackagePartitions.FINGERPRINT + "?pc_version=" + version;
+ return Build.VERSION.INCREMENTAL + "?pc_version=" + version;
}
private static long uniformRandom(double low, double high) {
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index a2b2983a8f35..4564e9dccc13 100644
--- a/services/core/java/com/android/server/pm/ShortcutService.java
+++ b/services/core/java/com/android/server/pm/ShortcutService.java
@@ -5168,7 +5168,7 @@ public class ShortcutService extends IShortcutService.Stub {
// Injection point.
String injectBuildFingerprint() {
- return Build.FINGERPRINT;
+ return Build.VERSION.INCREMENTAL;
}
final void wtf(String message) {
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 88aeb17dc2b4..af7b481dd311 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -4104,7 +4104,7 @@ public class UserManagerService extends IUserManager.Stub {
userInfo.creationTime = getCreationTime();
userInfo.partial = true;
userInfo.preCreated = preCreate;
- userInfo.lastLoggedInFingerprint = PackagePartitions.FINGERPRINT;
+ userInfo.lastLoggedInFingerprint = Build.VERSION.INCREMENTAL;
if (userTypeDetails.hasBadge() && parentId != UserHandle.USER_NULL) {
userInfo.profileBadge = getFreeProfileBadgeLU(parentId, userType);
}
@@ -5390,7 +5390,7 @@ public class UserManagerService extends IUserManager.Stub {
t.traceBegin("onBeforeStartUser-" + userId);
final int userSerial = userInfo.serialNumber;
// Migrate only if build fingerprints mismatch
- boolean migrateAppsData = !PackagePartitions.FINGERPRINT.equals(
+ boolean migrateAppsData = !Build.VERSION.INCREMENTAL.equals(
userInfo.lastLoggedInFingerprint);
t.traceBegin("prepareUserData");
mUserDataPreparer.prepareUserData(userId, userSerial, StorageManager.FLAG_STORAGE_DE);
@@ -5421,7 +5421,7 @@ public class UserManagerService extends IUserManager.Stub {
}
final int userSerial = userInfo.serialNumber;
// Migrate only if build fingerprints mismatch
- boolean migrateAppsData = !PackagePartitions.FINGERPRINT.equals(
+ boolean migrateAppsData = !Build.VERSION.INCREMENTAL.equals(
userInfo.lastLoggedInFingerprint);
final TimingsTraceAndSlog t = new TimingsTraceAndSlog();
@@ -5466,7 +5466,7 @@ public class UserManagerService extends IUserManager.Stub {
if (now > EPOCH_PLUS_30_YEARS) {
userData.info.lastLoggedInTime = now;
}
- userData.info.lastLoggedInFingerprint = PackagePartitions.FINGERPRINT;
+ userData.info.lastLoggedInFingerprint = Build.VERSION.INCREMENTAL;
scheduleWriteUser(userData);
}
--
2.41.0

View file

@ -0,0 +1,127 @@
From 54e70eb7ce231f6a1bef4ffdedb6008b3a949820 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Sat, 15 Oct 2022 09:33:56 +0000
Subject: [PATCH 6/6] Revert "Remove more FDE methods from StorageManager"
This reverts commit bd13f84152449a3ead6fa8604fd31f48c0224676.
---
.../android/os/storage/StorageManager.java | 69 ++++++++++++++++---
.../internal/os/RoSystemProperties.java | 4 ++
2 files changed, 65 insertions(+), 8 deletions(-)
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index d9604b3f0145..603612e82007 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -1681,13 +1681,18 @@ public class StorageManager {
}
/** {@hide}
- * Is this device encrypted?
- * <p>
- * Note: all devices launching with Android 10 (API level 29) or later are
- * required to be encrypted. This should only ever return false for
- * in-development devices on which encryption has not yet been configured.
- *
- * @return true if encrypted, false if not encrypted
+ * Is this device encryptable or already encrypted?
+ * @return true for encryptable or encrypted
+ * false not encrypted and not encryptable
+ */
+ public static boolean isEncryptable() {
+ return RoSystemProperties.CRYPTO_ENCRYPTABLE;
+ }
+
+ /** {@hide}
+ * Is this device already encrypted?
+ * @return true for encrypted. (Implies isEncryptable() == true)
+ * false not encrypted
*/
public static boolean isEncrypted() {
return RoSystemProperties.CRYPTO_ENCRYPTED;
@@ -1696,7 +1701,7 @@ public class StorageManager {
/** {@hide}
* Is this device file encrypted?
* @return true for file encrypted. (Implies isEncrypted() == true)
- * false not encrypted or using "managed" encryption
+ * false not encrypted or block encrypted
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static boolean isFileEncryptedNativeOnly() {
@@ -1706,6 +1711,54 @@ public class StorageManager {
return RoSystemProperties.CRYPTO_FILE_ENCRYPTED;
}
+ /** {@hide}
+ * Is this device block encrypted?
+ * @return true for block encrypted. (Implies isEncrypted() == true)
+ * false not encrypted or file encrypted
+ */
+ public static boolean isBlockEncrypted() {
+ return false;
+ }
+
+ /** {@hide}
+ * Is this device block encrypted with credentials?
+ * @return true for crediential block encrypted.
+ * (Implies isBlockEncrypted() == true)
+ * false not encrypted, file encrypted or default block encrypted
+ */
+ public static boolean isNonDefaultBlockEncrypted() {
+ return false;
+ }
+
+ /** {@hide}
+ * Is this device in the process of being block encrypted?
+ * @return true for encrypting.
+ * false otherwise
+ * Whether device isEncrypted at this point is undefined
+ * Note that only system services and CryptKeeper will ever see this return
+ * true - no app will ever be launched in this state.
+ * Also note that this state will not change without a teardown of the
+ * framework, so no service needs to check for changes during their lifespan
+ */
+ public static boolean isBlockEncrypting() {
+ return false;
+ }
+
+ /** {@hide}
+ * Is this device non default block encrypted and in the process of
+ * prompting for credentials?
+ * @return true for prompting for credentials.
+ * (Implies isNonDefaultBlockEncrypted() == true)
+ * false otherwise
+ * Note that only system services and CryptKeeper will ever see this return
+ * true - no app will ever be launched in this state.
+ * Also note that this state will not change without a teardown of the
+ * framework, so no service needs to check for changes during their lifespan
+ */
+ public static boolean inCryptKeeperBounce() {
+ return false;
+ }
+
/** {@hide} */
public static boolean isFileEncryptedEmulatedOnly() {
return SystemProperties.getBoolean(StorageManager.PROP_EMULATE_FBE, false);
diff --git a/core/java/com/android/internal/os/RoSystemProperties.java b/core/java/com/android/internal/os/RoSystemProperties.java
index cccd80e82420..adb5c107bc62 100644
--- a/core/java/com/android/internal/os/RoSystemProperties.java
+++ b/core/java/com/android/internal/os/RoSystemProperties.java
@@ -62,10 +62,14 @@ public class RoSystemProperties {
public static final CryptoProperties.type_values CRYPTO_TYPE =
CryptoProperties.type().orElse(CryptoProperties.type_values.NONE);
// These are pseudo-properties
+ public static final boolean CRYPTO_ENCRYPTABLE =
+ CRYPTO_STATE != CryptoProperties.state_values.UNSUPPORTED;
public static final boolean CRYPTO_ENCRYPTED =
CRYPTO_STATE == CryptoProperties.state_values.ENCRYPTED;
public static final boolean CRYPTO_FILE_ENCRYPTED =
CRYPTO_TYPE == CryptoProperties.type_values.FILE;
+ public static final boolean CRYPTO_BLOCK_ENCRYPTED =
+ CRYPTO_TYPE == CryptoProperties.type_values.BLOCK;
public static final boolean CONTROL_PRIVAPP_PERMISSIONS_LOG =
"log".equalsIgnoreCase(CONTROL_PRIVAPP_PERMISSIONS);
--
2.41.0

View file

@ -0,0 +1,33 @@
From 9f88617d1af3f068efdff111984a7a631464a205 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sun, 14 Nov 2021 13:47:29 -0500
Subject: [PATCH] Pie MTK IMS calls static
ImsManager.updateImsServiceConfig(Context,int,boolean). Bring it back
Change-Id: I3dd66d436629d37c8ec795df6569736195ae570e
---
src/java/com/android/ims/ImsManager.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java
index c41426d0..2c6d656f 100644
--- a/src/java/com/android/ims/ImsManager.java
+++ b/src/java/com/android/ims/ImsManager.java
@@ -1667,6 +1667,14 @@ public class ImsManager implements FeatureUpdates {
}
}
+ public static void updateImsServiceConfig(Context context, int phoneId, boolean force) {
+ ImsManager mgr = ImsManager.getInstance(context, phoneId);
+ if (mgr != null) {
+ mgr.updateImsServiceConfig();
+ }
+ Rlog.e(TAG, "updateImsServiceConfig: ImsManager null, returning without update.");
+ }
+
/**
* Push configuration updates to the ImsService implementation.
*/
--
2.40.0

View file

@ -1,7 +1,7 @@
From 2de099f8a86c02bc74b28beb7fbf8ccc71b17922 Mon Sep 17 00:00:00 2001 From 02041484d88e3c8a6cd62e1253f4b12b15be6852 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Mon, 5 Sep 2022 14:02:37 -0400 Date: Mon, 5 Sep 2022 14:02:37 -0400
Subject: [PATCH] SubscriptionController: Do not override default calling Subject: [PATCH 1/5] SubscriptionController: Do not override default calling
account from third-party apps account from third-party apps
When the user has selected a calling account from a third-party app as When the user has selected a calling account from a third-party app as
@ -14,29 +14,32 @@ to keep re-selecting the desired calling account after every reboot.
Test: manual Test: manual
Change-Id: Iccab64e9b3b3ab4773bd8944d47c2006f229d472 Change-Id: Iccab64e9b3b3ab4773bd8944d47c2006f229d472
--- ---
.../internal/telephony/SubscriptionController.java | 9 ++++++++- .../internal/telephony/SubscriptionController.java | 11 ++++++++++-
1 file changed, 8 insertions(+), 1 deletion(-) 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java
index 7e762d7af0..f2bff8b15f 100644 index 82799bea8b..5105d3a183 100644
--- a/src/java/com/android/internal/telephony/SubscriptionController.java --- a/src/java/com/android/internal/telephony/SubscriptionController.java
+++ b/src/java/com/android/internal/telephony/SubscriptionController.java +++ b/src/java/com/android/internal/telephony/SubscriptionController.java
@@ -2846,7 +2846,14 @@ public class SubscriptionController extends ISub.Stub { @@ -2855,8 +2855,17 @@ public class SubscriptionController extends ISub.Stub {
PhoneAccountHandle currentHandle = telecomManager.getUserSelectedOutgoingPhoneAccount(); subId);
logd("[setDefaultVoiceSubId] current phoneAccountHandle=" + currentHandle);
- if (!Objects.equals(currentHandle, newHandle)) { TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
+ PhoneAccountHandle currentHandle = telecomManager.getUserSelectedOutgoingPhoneAccount();
+ String currentPackageName = + String currentPackageName =
+ currentHandle == null ? null : currentHandle.getComponentName().getPackageName(); + currentHandle == null ? null : currentHandle.getComponentName().getPackageName();
+ boolean currentIsSim = "com.android.phone".equals(currentPackageName); + boolean currentIsSim = "com.android.phone".equals(currentPackageName);
+ // Do not override user selected outgoing calling account + // Do not override user selected outgoing calling account
+ // if the user has selected a third-party app as default + // if the user has selected a third-party app as default
+ boolean shouldKeepOutgoingAccount = currentHandle != null && !currentIsSim; + boolean shouldKeepOutgoingAccount = currentHandle != null && !currentIsSim;
+
+ if (!Objects.equals(currentHandle, newHandle) && !shouldKeepOutgoingAccount) { - telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle);
telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle); + if (!shouldKeepOutgoingAccount) {
logd("[setDefaultVoiceSubId] change to phoneAccountHandle=" + newHandle); + telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle);
} else { + }
-- logd("[setDefaultVoiceSubId] requesting change to phoneAccountHandle=" + newHandle);
2.37.2
if (previousDefaultSub != getDefaultSubId()) {
--
2.40.0

View file

@ -0,0 +1,46 @@
From bcaff4d8a493c657519ae50cf7f3661da6c4a46b Mon Sep 17 00:00:00 2001
From: ironydelerium <42721860+ironydelerium@users.noreply.github.com>
Date: Fri, 31 Dec 2021 02:20:28 -0800
Subject: [PATCH 2/5] Reintroduce 'public void
TelephonyMetrics.writeRilSendSms(int, int, int, int)'. (#8)
The MediaTek IMS package for Android Q, at the very least (likely for the rest, too)
invoke this method in their `sendSms` method; Google, in their infinite wisdom,
decided that this method needed a message ID passed in as well, changing the signature
to 'public void TelephonyMetrics.writeRilSendSms(int, int, int, int, long)' and resulting
in a MethodNotFoundException being raised in com.mediatek.ims, crashing it.
Fixes https://github.com/phhusson/treble_experimentations/issues/2125.
Co-authored-by: Sarah Vandomelen <sarah@sightworks.com>
---
.../telephony/metrics/TelephonyMetrics.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java b/src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java
index 3fdbfe0ed7..fb8011c3df 100644
--- a/src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java
+++ b/src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java
@@ -2320,6 +2320,19 @@ public class TelephonyMetrics {
smsSession.increaseExpectedResponse();
}
+ /**
+ * Write Send SMS event (backwards-compatible method for R and earlier IMS implementations)
+ *
+ * @param phoneId Phone id
+ * @param rilSerial RIL request serial number
+ * @param tech SMS RAT
+ * @param format SMS format. Either {@link SmsMessage#FORMAT_3GPP} or
+ * {@link SmsMessage#FORMAT_3GPP2}.
+ */
+ public void writeRilSendSms(int phoneId, int rilSerial, int tech, int format) {
+ writeRilSendSms(phoneId, rilSerial, tech, format, 0);
+ }
+
/**
* Write Send SMS event using ImsService. Expecting response from
* {@link #writeOnSmsSolicitedResponse}.
--
2.40.0

View file

@ -0,0 +1,53 @@
From 9550951ff96e643d143da826cb9560da572850a1 Mon Sep 17 00:00:00 2001
From: LuK1337 <priv.luk@gmail.com>
Date: Fri, 21 Oct 2022 20:55:05 +0200
Subject: [PATCH 3/5] Pass correct value to setPreferredNetworkType() for RIL
version < 1.4
Change-Id: Id14be66a2ea4e85b6504bc03fd7d2f038185c17d
---
src/java/com/android/internal/telephony/RIL.java | 3 ++-
.../com/android/internal/telephony/RadioNetworkProxy.java | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index 6de66527e1..0c1b7cdf8c 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -2879,7 +2879,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
mMetrics.writeSetPreferredNetworkType(mPhoneId, networkType);
try {
- networkProxy.setPreferredNetworkTypeBitmap(rr.mSerial, mAllowedNetworkTypesBitmask);
+ networkProxy.setPreferredNetworkTypeBitmap(
+ rr.mSerial, mAllowedNetworkTypesBitmask, networkType);
} catch (RemoteException | RuntimeException e) {
handleRadioProxyExceptionForRR(NETWORK_SERVICE, "setPreferredNetworkType", e);
}
diff --git a/src/java/com/android/internal/telephony/RadioNetworkProxy.java b/src/java/com/android/internal/telephony/RadioNetworkProxy.java
index b88103510a..661fa56954 100644
--- a/src/java/com/android/internal/telephony/RadioNetworkProxy.java
+++ b/src/java/com/android/internal/telephony/RadioNetworkProxy.java
@@ -379,16 +379,17 @@ public class RadioNetworkProxy extends RadioServiceProxy {
* Call IRadioNetwork#setPreferredNetworkTypeBitmap
* @param serial Serial number of request
* @param networkTypesBitmask Preferred network types bitmask to set
+ * @param networkType Preferred network type to set for RIL version < 1.4
* @throws RemoteException
*/
- public void setPreferredNetworkTypeBitmap(int serial, int networkTypesBitmask)
+ public void setPreferredNetworkTypeBitmap(int serial, int networkTypesBitmask, int networkType)
throws RemoteException {
if (isEmpty() || mHalVersion.greaterOrEqual(RIL.RADIO_HAL_VERSION_1_6)) return;
if (mHalVersion.greaterOrEqual(RIL.RADIO_HAL_VERSION_1_4)) {
((android.hardware.radio.V1_4.IRadio) mRadioProxy).setPreferredNetworkTypeBitmap(serial,
RILUtils.convertToHalRadioAccessFamily(networkTypesBitmask));
} else {
- mRadioProxy.setPreferredNetworkType(serial, networkTypesBitmask);
+ mRadioProxy.setPreferredNetworkType(serial, networkType);
}
}
--
2.40.0

View file

@ -0,0 +1,57 @@
From c527732943bc02fd434cbecbd07787e2d429023d Mon Sep 17 00:00:00 2001
From: ExactExampl <exactxmpl@pixelexperience.org>
Date: Tue, 11 Oct 2022 12:38:00 +0300
Subject: [PATCH 4/5] Conditionally revert "Block Binder thread until incoming
call process completes"
* Legacy IMS packages handling incoming calls in such a way that
a blocked binder thread won`t allow to complete call setup,
thus we have half dead incoming calls with unattached call session
(caller can hear dialing tone whereas recipient got nothing)
This conditionally reverts commit 75c3dc9ba272b43971f519caba0382f9871c7d9d.
Change-Id: I55a8f3bbca4a2b9a6bc7511e9fe2d0884a8818e5
---
.../imsphone/ImsPhoneCallTracker.java | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
index 5968ba6fa1..86034f6fa1 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
@@ -50,6 +50,7 @@ import android.os.Registrant;
import android.os.RegistrantList;
import android.os.RemoteException;
import android.os.SystemClock;
+import android.os.SystemProperties;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.sysprop.TelephonyProperties;
@@ -322,10 +323,19 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
@Override
public void onIncomingCall(IImsCallSession c, Bundle extras) {
- // we want to ensure we block this binder thread until incoming call setup completes
- // as to avoid race conditions where the ImsService tries to update the state of the
- // call before the listeners have been attached.
- executeAndWait(()-> processIncomingCall(c, extras));
+ final boolean shouldBlockBinderThreadOnIncomingCalls = SystemProperties.getBoolean(
+ "ro.telephony.block_binder_thread_on_incoming_calls", true);
+ if (shouldBlockBinderThreadOnIncomingCalls) {
+ // we want to ensure we block this binder thread until incoming call setup completes
+ // as to avoid race conditions where the ImsService tries to update the state of the
+ // call before the listeners have been attached.
+ executeAndWait(()-> processIncomingCall(c, extras));
+ } else {
+ // for legacy IMS we want to avoid blocking the binder thread, otherwise
+ // we end up with half dead incoming calls with unattached call session
+ TelephonyUtils.runWithCleanCallingIdentity(()-> processIncomingCall(c, extras),
+ mExecutor);
+ }
}
@Override
--
2.40.0

View file

@ -0,0 +1,27 @@
From 53160d33c83afe4f56862c3c12d4b61e2970209b Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 6 Dec 2021 16:28:22 -0500
Subject: [PATCH 5/5] Fix baseband being too long to fit into a 91 chars
property, preventing telephony subsystem from starting
Change-Id: I1762e4a8cc137626be89f350229d6be162bdaf57
---
src/java/com/android/internal/telephony/GsmCdmaPhone.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
index 76a8d57246..9a72712c59 100644
--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java
+++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
@@ -3124,7 +3124,7 @@ public class GsmCdmaPhone extends Phone {
String version = (String)ar.result;
if (version != null) {
int length = version.length();
- final int MAX_VERSION_LEN = SystemProperties.PROP_VALUE_MAX/2;
+ final int MAX_VERSION_LEN = SystemProperties.PROP_VALUE_MAX/2 - 2;
TelephonyManager.from(mContext).setBasebandVersionForPhone(getPhoneId(),
length <= MAX_VERSION_LEN ? version
: version.substring(length - MAX_VERSION_LEN, length));
--
2.40.0

View file

@ -1,7 +1,7 @@
From 8d396831eabfaa0859313db9598a5641f51493e6 Mon Sep 17 00:00:00 2001 From 8cd54396bbf29cc977497b53c1464a80aea69825 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev> From: Danny Lin <danny@kdrag0n.dev>
Date: Mon, 11 Oct 2021 20:48:44 -0700 Date: Mon, 11 Oct 2021 20:48:44 -0700
Subject: [PATCH 2/5] Expose themed icon setting in ThemePicker Subject: [PATCH 1/4] Expose themed icon setting in ThemePicker
Change-Id: I44e9288c3de13a3604b7a03857ec400753317d9a Change-Id: I44e9288c3de13a3604b7a03857ec400753317d9a
--- ---
@ -38,5 +38,5 @@ index 7d7054f5a5..d2955c4327 100644
</application> </application>
-- --
2.37.2 2.40.1

View file

@ -1,7 +1,7 @@
From c304a46115f8244f55f38b85ca68613905c6c015 Mon Sep 17 00:00:00 2001 From 0d97b73a079dd81b0dd8c0bb512a926d37f76cf9 Mon Sep 17 00:00:00 2001
From: Luca Stefani <luca.stefani.ge1@gmail.com> From: Luca Stefani <luca.stefani.ge1@gmail.com>
Date: Fri, 1 Nov 2019 23:17:59 +0100 Date: Fri, 1 Nov 2019 23:17:59 +0100
Subject: [PATCH 3/5] Properly expose GridCustomizationsProvider Subject: [PATCH 2/4] Properly expose GridCustomizationsProvider
Change-Id: I8268a215257ae0e399c56ac8b44cdfdff8cc92a0 Change-Id: I8268a215257ae0e399c56ac8b44cdfdff8cc92a0
--- ---
@ -9,10 +9,10 @@ Change-Id: I8268a215257ae0e399c56ac8b44cdfdff8cc92a0
1 file changed, 3 insertions(+), 1 deletion(-) 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml
index 02b83fe889..00e7fc35ad 100644 index 0c7b48fe66..1fe86ad022 100644
--- a/AndroidManifest-common.xml --- a/AndroidManifest-common.xml
+++ b/AndroidManifest-common.xml +++ b/AndroidManifest-common.xml
@@ -135,7 +135,9 @@ @@ -137,7 +137,9 @@
<provider <provider
android:name="com.android.launcher3.graphics.GridCustomizationsProvider" android:name="com.android.launcher3.graphics.GridCustomizationsProvider"
android:authorities="${packageName}.grid_control" android:authorities="${packageName}.grid_control"
@ -24,5 +24,5 @@ index 02b83fe889..00e7fc35ad 100644
<!-- <!--
The settings activity. To extend point settings_fragment_name to appropriate fragment class The settings activity. To extend point settings_fragment_name to appropriate fragment class
-- --
2.37.2 2.40.1

View file

@ -1,7 +1,7 @@
From cf2a48c3b77753dbb850726495308dad64205497 Mon Sep 17 00:00:00 2001 From 4fd73068a8fa6246676d52b6ae63f04341319520 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev> From: Danny Lin <danny@kdrag0n.dev>
Date: Wed, 6 Oct 2021 22:45:33 -0700 Date: Wed, 6 Oct 2021 22:45:33 -0700
Subject: [PATCH 4/5] Fix all apps header color in dark mode Subject: [PATCH 3/4] Fix all apps header color in dark mode
Change-Id: Ib2ce7f6e3c9b87a4626699cb54673d88392a5f41 Change-Id: Ib2ce7f6e3c9b87a4626699cb54673d88392a5f41
--- ---
@ -9,17 +9,17 @@ Change-Id: Ib2ce7f6e3c9b87a4626699cb54673d88392a5f41
1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+)
diff --git a/res/values/styles.xml b/res/values/styles.xml diff --git a/res/values/styles.xml b/res/values/styles.xml
index 21095109a6..63f46e413d 100644 index 5dc4f0afa1..f5d64729c8 100644
--- a/res/values/styles.xml --- a/res/values/styles.xml
+++ b/res/values/styles.xml +++ b/res/values/styles.xml
@@ -99,6 +99,7 @@ @@ -94,6 +94,7 @@
<item name="android:colorControlHighlight">#19FFFFFF</item> <item name="android:colorControlHighlight">#19FFFFFF</item>
<item name="android:colorPrimary">#FF212121</item> <item name="android:colorPrimary">#FF212121</item>
<item name="allAppsScrimColor">?android:attr/colorBackgroundFloating</item> <item name="allAppsScrimColor">?android:attr/colorBackgroundFloating</item>
+ <item name="allappsHeaderProtectionColor">@color/popup_color_tertiary_dark</item> + <item name="allappsHeaderProtectionColor">@color/popup_color_tertiary_dark</item>
<item name="allAppsNavBarScrimColor">#80000000</item> <item name="allAppsNavBarScrimColor">#80000000</item>
<item name="allAppsTheme">@style/AllAppsTheme.Dark</item>
<item name="popupColorPrimary">@color/popup_color_primary_dark</item> <item name="popupColorPrimary">@color/popup_color_primary_dark</item>
<item name="popupColorSecondary">@color/popup_color_secondary_dark</item>
-- --
2.37.2 2.40.1

View file

@ -1,7 +1,7 @@
From f11b5953c3d3a4e69fcf91eb5642d5e7e37fe398 Mon Sep 17 00:00:00 2001 From 8f1880d3576c0c6521e38558d56e55df92922c8a Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Wed, 17 Aug 2022 22:02:33 -0400 Date: Fri, 7 Jul 2023 18:13:32 -0400
Subject: [PATCH 1/5] Disable QSB in BuildConfig Subject: [PATCH 4/4] Disable QSB in BuildConfig
Change-Id: I3150ef1d9b8c161ed2a6569d1ae75bba0060b36f Change-Id: I3150ef1d9b8c161ed2a6569d1ae75bba0060b36f
--- ---
@ -9,16 +9,18 @@ Change-Id: I3150ef1d9b8c161ed2a6569d1ae75bba0060b36f
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src_build_config/com/android/launcher3/BuildConfig.java b/src_build_config/com/android/launcher3/BuildConfig.java diff --git a/src_build_config/com/android/launcher3/BuildConfig.java b/src_build_config/com/android/launcher3/BuildConfig.java
index 9a81d3f54c..8c83bcc372 100644 index 1f2e0e5387..ab6c528580 100644
--- a/src_build_config/com/android/launcher3/BuildConfig.java --- a/src_build_config/com/android/launcher3/BuildConfig.java
+++ b/src_build_config/com/android/launcher3/BuildConfig.java +++ b/src_build_config/com/android/launcher3/BuildConfig.java
@@ -23,5 +23,5 @@ public final class BuildConfig { @@ -24,7 +24,7 @@ public final class BuildConfig {
* Flag to state if the QSB is on the first screen and placed on the top, * Flag to state if the QSB is on the first screen and placed on the top,
* this can be overwritten in other launchers with a different value, if needed. * this can be overwritten in other launchers with a different value, if needed.
*/ */
- public static final boolean QSB_ON_FIRST_SCREEN = true; - public static final boolean QSB_ON_FIRST_SCREEN = true;
+ public static final boolean QSB_ON_FIRST_SCREEN = false; + public static final boolean QSB_ON_FIRST_SCREEN = false;
}
-- /**
2.37.2 * Flag to control various developer centric features
--
2.40.1

View file

@ -1,73 +0,0 @@
From dbb30694c2cce4a5fb70ea6a8c5594bcca7cba4d Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Sun, 10 Oct 2021 03:38:23 -0700
Subject: [PATCH 5/5] Fix Personal/Work profile tab colors in All Apps
The default AOSP colors are broken and result in poor contrast, among
other issues.
Change-Id: Id7824bc08cac0aad055f41c0b617e15300af05d4
---
res/color-night-v31/all_apps_tab_text.xml | 6 +++---
.../all_apps_tabs_background.xml | 18 ++++++++++++++++++
res/color-v31/all_apps_tab_text.xml | 6 +++---
3 files changed, 24 insertions(+), 6 deletions(-)
create mode 100644 res/color-night-v31/all_apps_tabs_background.xml
diff --git a/res/color-night-v31/all_apps_tab_text.xml b/res/color-night-v31/all_apps_tab_text.xml
index 83237b49e5..eaac621cfc 100644
--- a/res/color-night-v31/all_apps_tab_text.xml
+++ b/res/color-night-v31/all_apps_tab_text.xml
@@ -14,6 +14,6 @@
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="@android:color/system_neutral1_50" android:state_selected="true"/>
- <item android:color="@android:color/system_neutral2_700"/>
-</selector>
\ No newline at end of file
+ <item android:color="?android:textColorPrimaryInverse" android:state_selected="true"/>
+ <item android:color="?android:textColorSecondary"/>
+</selector>
diff --git a/res/color-night-v31/all_apps_tabs_background.xml b/res/color-night-v31/all_apps_tabs_background.xml
new file mode 100644
index 0000000000..fc8a4d7d79
--- /dev/null
+++ b/res/color-night-v31/all_apps_tabs_background.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral1_800" />
+</selector>
diff --git a/res/color-v31/all_apps_tab_text.xml b/res/color-v31/all_apps_tab_text.xml
index c3520a7ab5..d133a31a2d 100644
--- a/res/color-v31/all_apps_tab_text.xml
+++ b/res/color-v31/all_apps_tab_text.xml
@@ -14,6 +14,6 @@
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="@android:color/system_neutral1_900" android:state_selected="true"/>
- <item android:color="@android:color/system_neutral2_700"/>
-</selector>
\ No newline at end of file
+ <item android:color="?android:textColorPrimary" android:state_selected="true"/>
+ <item android:color="?android:textColorSecondary"/>
+</selector>
--
2.37.2

View file

@ -0,0 +1,180 @@
From 16c9311e41992ddd8d0bfb5a340cedbf001e3413 Mon Sep 17 00:00:00 2001
From: Oliver Scott <olivercscott@gmail.com>
Date: Thu, 8 Jul 2021 10:40:49 -0400
Subject: [PATCH] Global VPN feature [2/2]
* Create a global VPN toggle for VPNs in the system user. It is only
enabled when no VPN is active in any user.
Change-Id: Ic3b79beb635afe03642fce9473bc481239166566
Signed-off-by: Mohammad Hasan Keramat J <ikeramat@protonmail.com>
---
res/values/strings.xml | 5 ++
res/xml/vpn_app_management.xml | 6 +++
.../settings/vpn2/AppManagementFragment.java | 48 ++++++++++++++++++-
3 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 28b35b3fcf..29ca3882e9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -14457,4 +14457,9 @@
<!-- [CHAR LIMIT=NONE] Hint for QR code process failure -->
<string name="bt_le_audio_qr_code_is_not_valid_format">QR code isn\u0027t a valid format</string>
+ <!-- VPN app management screen, global VPN -->
+ <string name="global_vpn_title">Global VPN</string>
+ <string name="global_vpn_summary">Force all traffic on the device through this VPN, including work profile and other users.</string>
+ <string name="global_vpn_summary_on">Force all traffic on the device through this VPN, including work profile and other users. Note: When enabled, you will not be able to use a separate VPN in a work profile or other users</string>
+ <string name="global_vpn_summary_any_vpn_active">You need to disable all active VPN connections first to enable this</string>
</resources>
diff --git a/res/xml/vpn_app_management.xml b/res/xml/vpn_app_management.xml
index adc441d846..e00f23ccfa 100644
--- a/res/xml/vpn_app_management.xml
+++ b/res/xml/vpn_app_management.xml
@@ -31,6 +31,12 @@
android:selectable="false"/>
-->
+ <SwitchPreference
+ android:key="global_vpn"
+ android:title="@string/global_vpn_title"
+ android:defaultValue="false"
+ android:summary="@string/global_vpn_summary" />
+
<com.android.settingslib.RestrictedSwitchPreference
android:order="10"
android:key="always_on_vpn"
diff --git a/src/com/android/settings/vpn2/AppManagementFragment.java b/src/com/android/settings/vpn2/AppManagementFragment.java
index d4ee5b9c47..7a52e0c42c 100644
--- a/src/com/android/settings/vpn2/AppManagementFragment.java
+++ b/src/com/android/settings/vpn2/AppManagementFragment.java
@@ -28,10 +28,12 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.UserInfo;
import android.net.VpnManager;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
+import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.widget.TextView;
@@ -41,6 +43,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
+import androidx.preference.SwitchPreference;
import com.android.internal.net.VpnConfig;
import com.android.internal.util.ArrayUtils;
@@ -64,6 +67,7 @@ public class AppManagementFragment extends SettingsPreferenceFragment
private static final String ARG_PACKAGE_NAME = "package";
private static final String KEY_VERSION = "version";
+ private static final String KEY_GLOBAL_VPN = "global_vpn";
private static final String KEY_ALWAYS_ON_VPN = "always_on_vpn";
private static final String KEY_LOCKDOWN_VPN = "lockdown_vpn";
private static final String KEY_FORGET_VPN = "forget_vpn";
@@ -79,6 +83,7 @@ public class AppManagementFragment extends SettingsPreferenceFragment
private String mVpnLabel;
// UI preference
+ private SwitchPreference mPreferenceGlobal;
private RestrictedSwitchPreference mPreferenceAlwaysOn;
private RestrictedSwitchPreference mPreferenceLockdown;
private RestrictedPreference mPreferenceForget;
@@ -123,10 +128,16 @@ public class AppManagementFragment extends SettingsPreferenceFragment
mDevicePolicyManager = getContext().getSystemService(DevicePolicyManager.class);
mVpnManager = getContext().getSystemService(VpnManager.class);
+ mPreferenceGlobal = (SwitchPreference) findPreference(KEY_GLOBAL_VPN);
mPreferenceAlwaysOn = (RestrictedSwitchPreference) findPreference(KEY_ALWAYS_ON_VPN);
mPreferenceLockdown = (RestrictedSwitchPreference) findPreference(KEY_LOCKDOWN_VPN);
mPreferenceForget = (RestrictedPreference) findPreference(KEY_FORGET_VPN);
+ if (mUserId != UserHandle.USER_SYSTEM) {
+ removePreference(KEY_GLOBAL_VPN);
+ }
+
+ mPreferenceGlobal.setOnPreferenceChangeListener(this);
mPreferenceAlwaysOn.setOnPreferenceChangeListener(this);
mPreferenceLockdown.setOnPreferenceChangeListener(this);
mPreferenceForget.setOnPreferenceClickListener(this);
@@ -204,6 +215,8 @@ public class AppManagementFragment extends SettingsPreferenceFragment
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
switch (preference.getKey()) {
+ case KEY_GLOBAL_VPN:
+ return onGlobalVpnClick((Boolean) newValue);
case KEY_ALWAYS_ON_VPN:
return onAlwaysOnVpnClick((Boolean) newValue, mPreferenceLockdown.isChecked());
case KEY_LOCKDOWN_VPN:
@@ -243,6 +256,11 @@ public class AppManagementFragment extends SettingsPreferenceFragment
return setAlwaysOnVpnByUI(alwaysOnSetting, lockdown);
}
+ private boolean onGlobalVpnClick(final boolean global) {
+ return Settings.Global.putString(getContext().getContentResolver(),
+ Settings.Global.GLOBAL_VPN_APP, global ? mPackageName : "");
+ }
+
@Override
public void onConfirmLockdown(Bundle options, boolean isEnabled, boolean isLockdown) {
setAlwaysOnVpnByUI(isEnabled, isLockdown);
@@ -276,7 +294,18 @@ public class AppManagementFragment extends SettingsPreferenceFragment
final boolean alwaysOn = isVpnAlwaysOn();
final boolean lockdown = alwaysOn
&& VpnUtils.isAnyLockdownActive(getActivity());
-
+ final boolean anyVpnActive = isAnyVpnActive();
+ final boolean globalVpn = isGlobalVpn();
+
+ mPreferenceGlobal.setEnabled(!anyVpnActive);
+ mPreferenceGlobal.setChecked(globalVpn);
+ if (globalVpn) {
+ mPreferenceGlobal.setSummary(R.string.global_vpn_summary_on);
+ } else if (anyVpnActive) {
+ mPreferenceGlobal.setSummary(R.string.global_vpn_summary_any_vpn_active);
+ } else {
+ mPreferenceGlobal.setSummary(R.string.global_vpn_summary);
+ }
mPreferenceAlwaysOn.setChecked(alwaysOn);
mPreferenceLockdown.setChecked(lockdown);
updateRestrictedViews();
@@ -322,6 +351,11 @@ public class AppManagementFragment extends SettingsPreferenceFragment
return mPackageName.equals(getAlwaysOnVpnPackage());
}
+ private boolean isGlobalVpn() {
+ return mPackageName.equals(Settings.Global.getString(
+ getContext().getContentResolver(), Settings.Global.GLOBAL_VPN_APP));
+ }
+
/**
* @return false if the intent doesn't contain an existing package or can't retrieve activated
* vpn info.
@@ -376,6 +410,18 @@ public class AppManagementFragment extends SettingsPreferenceFragment
return config != null && !TextUtils.equals(config.user, mPackageName);
}
+ /**
+ * @return {@code true} if any VPN (VpnService or legacy) is connected or set as always-on.
+ */
+ private boolean isAnyVpnActive() {
+ for (UserInfo userInfo : UserManager.get(getContext()).getUsers()) {
+ if (mVpnManager.getVpnConfig(userInfo.id) != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public static class CannotConnectFragment extends InstrumentedDialogFragment {
private static final String TAG = "CannotConnect";
private static final String ARG_VPN_LABEL = "label";
--
2.40.0

View file

@ -1,7 +1,7 @@
From d043802a9e21a05b3fda0d2c3c41a69e513248e0 Mon Sep 17 00:00:00 2001 From 12224023faccc52724a443670bd77c6aa229ce58 Mon Sep 17 00:00:00 2001
From: Luca Stefani <luca.stefani.ge1@gmail.com> From: Luca Stefani <luca.stefani.ge1@gmail.com>
Date: Fri, 1 Nov 2019 21:14:29 +0100 Date: Fri, 1 Nov 2019 21:14:29 +0100
Subject: [PATCH 1/6] Add wallpaper privapp whitelist Subject: [PATCH 1/5] Add wallpaper privapp whitelist
Change-Id: I044b1d9201ac0b8780fc37a387f401f3dd0ddeac Change-Id: I044b1d9201ac0b8780fc37a387f401f3dd0ddeac
--- ---
@ -11,10 +11,10 @@ Change-Id: I044b1d9201ac0b8780fc37a387f401f3dd0ddeac
create mode 100644 privapp_whitelist_com.android.wallpaper.xml create mode 100644 privapp_whitelist_com.android.wallpaper.xml
diff --git a/Android.bp b/Android.bp diff --git a/Android.bp b/Android.bp
index c85fd2b..5c1f487 100644 index 6d9ff8f6..ff9413ac 100644
--- a/Android.bp --- a/Android.bp
+++ b/Android.bp +++ b/Android.bp
@@ -104,5 +104,15 @@ android_app { @@ -117,5 +117,15 @@ android_app {
platform_apis: true, platform_apis: true,
manifest: "AndroidManifest.xml", manifest: "AndroidManifest.xml",
additional_manifests: [":WallpaperPicker2_Manifest"], additional_manifests: [":WallpaperPicker2_Manifest"],
@ -32,7 +32,7 @@ index c85fd2b..5c1f487 100644
+} +}
diff --git a/privapp_whitelist_com.android.wallpaper.xml b/privapp_whitelist_com.android.wallpaper.xml diff --git a/privapp_whitelist_com.android.wallpaper.xml b/privapp_whitelist_com.android.wallpaper.xml
new file mode 100644 new file mode 100644
index 0000000..e3f3b65 index 00000000..e3f3b658
--- /dev/null --- /dev/null
+++ b/privapp_whitelist_com.android.wallpaper.xml +++ b/privapp_whitelist_com.android.wallpaper.xml
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
@ -61,5 +61,5 @@ index 0000000..e3f3b65
+ </privapp-permissions> + </privapp-permissions>
+</permissions> +</permissions>
-- --
2.37.2 2.40.0

View file

@ -1,7 +1,7 @@
From 5a3e22296f8de9fa21140cf28f622875928ba8ca Mon Sep 17 00:00:00 2001 From 4b626d87eafd37bf950550f5c14b42f5eaab19eb Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev> From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 5 Oct 2021 19:00:36 -0700 Date: Tue, 5 Oct 2021 19:00:36 -0700
Subject: [PATCH 2/6] Override legacy WallpaperPicker app Subject: [PATCH 2/5] Override legacy WallpaperPicker app
Change-Id: I9a1907527eea0e8e7cd10bab64ba79c2c4006c59 Change-Id: I9a1907527eea0e8e7cd10bab64ba79c2c4006c59
--- ---
@ -9,10 +9,10 @@ Change-Id: I9a1907527eea0e8e7cd10bab64ba79c2c4006c59
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Android.bp b/Android.bp diff --git a/Android.bp b/Android.bp
index 5c1f487..ce850c5 100644 index ff9413ac..dee08f45 100644
--- a/Android.bp --- a/Android.bp
+++ b/Android.bp +++ b/Android.bp
@@ -106,7 +106,7 @@ android_app { @@ -119,7 +119,7 @@ android_app {
additional_manifests: [":WallpaperPicker2_Manifest"], additional_manifests: [":WallpaperPicker2_Manifest"],
required: ["privapp_whitelist_com.android.wallpaper.xml"], required: ["privapp_whitelist_com.android.wallpaper.xml"],
@ -22,5 +22,5 @@ index 5c1f487..ce850c5 100644
prebuilt_etc_xml { prebuilt_etc_xml {
-- --
2.37.2 2.40.0

View file

@ -1,7 +1,7 @@
From 75de47c866b31a8930bc7e58954928712dbcbe60 Mon Sep 17 00:00:00 2001 From 0068121d698911e9bc86a224b3f9a2fb7bdc6cbc Mon Sep 17 00:00:00 2001
From: LuK1337 <priv.luk@gmail.com> From: LuK1337 <priv.luk@gmail.com>
Date: Tue, 15 Sep 2020 03:27:19 +0200 Date: Tue, 15 Sep 2020 03:27:19 +0200
Subject: [PATCH 3/6] Add wallpaper default permissions Subject: [PATCH 3/5] Add wallpaper default permissions
Change-Id: If43a594da31fbab9280ce45b049737f6c534b620 Change-Id: If43a594da31fbab9280ce45b049737f6c534b620
--- ---
@ -11,10 +11,10 @@ Change-Id: If43a594da31fbab9280ce45b049737f6c534b620
create mode 100644 default_permissions_com.android.wallpaper.xml create mode 100644 default_permissions_com.android.wallpaper.xml
diff --git a/Android.bp b/Android.bp diff --git a/Android.bp b/Android.bp
index ce850c5..8ad98d2 100644 index dee08f45..74479801 100644
--- a/Android.bp --- a/Android.bp
+++ b/Android.bp +++ b/Android.bp
@@ -105,7 +105,11 @@ android_app { @@ -118,7 +118,11 @@ android_app {
manifest: "AndroidManifest.xml", manifest: "AndroidManifest.xml",
additional_manifests: [":WallpaperPicker2_Manifest"], additional_manifests: [":WallpaperPicker2_Manifest"],
@ -27,7 +27,7 @@ index ce850c5..8ad98d2 100644
overrides: ["WallpaperPicker2", "WallpaperPicker"], overrides: ["WallpaperPicker2", "WallpaperPicker"],
} }
@@ -116,3 +120,11 @@ prebuilt_etc_xml { @@ -129,3 +133,11 @@ prebuilt_etc_xml {
filename_from_src: true, filename_from_src: true,
sub_dir: "permissions", sub_dir: "permissions",
} }
@ -41,7 +41,7 @@ index ce850c5..8ad98d2 100644
+} +}
diff --git a/default_permissions_com.android.wallpaper.xml b/default_permissions_com.android.wallpaper.xml diff --git a/default_permissions_com.android.wallpaper.xml b/default_permissions_com.android.wallpaper.xml
new file mode 100644 new file mode 100644
index 0000000..41b23ce index 00000000..41b23ce1
--- /dev/null --- /dev/null
+++ b/default_permissions_com.android.wallpaper.xml +++ b/default_permissions_com.android.wallpaper.xml
@@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
@ -83,5 +83,5 @@ index 0000000..41b23ce
+ </exception> + </exception>
+</exceptions> +</exceptions>
-- --
2.37.2 2.40.0

View file

@ -1,7 +1,7 @@
From 0d59123442f547d1d3cbd5e4200d6f2ec6d4bed0 Mon Sep 17 00:00:00 2001 From e51787a4ad9f2a70d9d68cad29a8974244c2c0b6 Mon Sep 17 00:00:00 2001
From: Luca Stefani <luca.stefani.ge1@gmail.com> From: Luca Stefani <luca.stefani.ge1@gmail.com>
Date: Fri, 1 Nov 2019 23:17:08 +0100 Date: Fri, 1 Nov 2019 23:17:08 +0100
Subject: [PATCH 4/6] Specify we read and write launcher settings Subject: [PATCH 4/5] Specify we read and write launcher settings
Change-Id: Ifc8196588443b007602118389ca76d34ab531f14 Change-Id: Ifc8196588443b007602118389ca76d34ab531f14
--- ---
@ -9,10 +9,10 @@ Change-Id: Ifc8196588443b007602118389ca76d34ab531f14
1 file changed, 3 insertions(+) 1 file changed, 3 insertions(+)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ff8f187..cace7db 100755 index 4e71bcc6..26f4fce0 100755
--- a/AndroidManifest.xml --- a/AndroidManifest.xml
+++ b/AndroidManifest.xml +++ b/AndroidManifest.xml
@@ -37,6 +37,9 @@ @@ -45,6 +45,9 @@
</intent> </intent>
</queries> </queries>
@ -23,5 +23,5 @@ index ff8f187..cace7db 100755
tools:replace="android:icon,android:name" tools:replace="android:icon,android:name"
android:extractNativeLibs="false" android:extractNativeLibs="false"
-- --
2.37.2 2.40.0

View file

@ -1,7 +1,7 @@
From b7867190ba594edc894d3833746c5af07ad596af Mon Sep 17 00:00:00 2001 From 3156edaae20291237f095d2d5bb66e8ba0a4cea5 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev> From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 5 Oct 2021 22:40:58 -0700 Date: Tue, 5 Oct 2021 22:40:58 -0700
Subject: [PATCH 6/6] Add permission for launcher preview rendering Subject: [PATCH 5/5] Add permission for launcher preview rendering
Change-Id: Ie707dcd98161e8f5993b0504295fddc3f395cd20 Change-Id: Ie707dcd98161e8f5993b0504295fddc3f395cd20
--- ---
@ -10,7 +10,7 @@ Change-Id: Ie707dcd98161e8f5993b0504295fddc3f395cd20
2 files changed, 2 insertions(+) 2 files changed, 2 insertions(+)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 85bf749..897a21f 100755 index 26f4fce0..40281cf9 100755
--- a/AndroidManifest.xml --- a/AndroidManifest.xml
+++ b/AndroidManifest.xml +++ b/AndroidManifest.xml
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
@ -18,21 +18,20 @@ index 85bf749..897a21f 100755
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/> <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<uses-permission android:name="android.permission.SET_WALLPAPER_COMPONENT" /> <uses-permission android:name="android.permission.SET_WALLPAPER_COMPONENT" />
+ <uses-permission android:name="android.permission.BIND_WALLPAPER" /> + <uses-permission android:name="android.permission.BIND_WALLPAPER" />
<uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
<uses-permission android:name="android.permission.MODIFY_DAY_NIGHT_MODE" /> <uses-permission android:name="android.permission.MODIFY_DAY_NIGHT_MODE" />
<uses-permission android:name="android.permission.CUSTOMIZE_SYSTEM_UI" />
diff --git a/privapp_whitelist_com.android.wallpaper.xml b/privapp_whitelist_com.android.wallpaper.xml diff --git a/privapp_whitelist_com.android.wallpaper.xml b/privapp_whitelist_com.android.wallpaper.xml
index e3f3b65..5dee99b 100644 index e3f3b658..47133be8 100644
--- a/privapp_whitelist_com.android.wallpaper.xml --- a/privapp_whitelist_com.android.wallpaper.xml
+++ b/privapp_whitelist_com.android.wallpaper.xml +++ b/privapp_whitelist_com.android.wallpaper.xml
@@ -17,6 +17,7 @@ @@ -20,5 +20,6 @@
<permissions>
<privapp-permissions package="com.android.wallpaper">
<permission name="android.permission.SET_WALLPAPER_COMPONENT"/>
+ <permission name="android.permission.BIND_WALLPAPER"/>
<permission name="android.permission.MODIFY_DAY_NIGHT_MODE"/> <permission name="android.permission.MODIFY_DAY_NIGHT_MODE"/>
<permission name="android.permission.CHANGE_OVERLAY_PACKAGES"/> <permission name="android.permission.CHANGE_OVERLAY_PACKAGES"/>
<permission name="android.permission.WRITE_SECURE_SETTINGS" /> <permission name="android.permission.WRITE_SECURE_SETTINGS" />
+ <permission name="android.permission.BIND_WALLPAPER"/>
</privapp-permissions>
</permissions>
-- --
2.37.2 2.40.0

View file

@ -1,33 +0,0 @@
From da21218f9905f70f8b83d2a6bbbdc91e322333c5 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 5 Oct 2021 19:12:40 -0700
Subject: [PATCH 5/6] Declare HOME query for launcher discovery
ThemePicker needs to query the current launcher in order to render
launcher/wallpaper previews, toggle themed icons, and change the app
grid size.
Change-Id: Id79fe1eaa4d09f775a37a1dfb1091ed08a1d3422
---
AndroidManifest.xml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index cace7db..85bf749 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -35,6 +35,11 @@
<intent>
<action android:name="com.android.launcher3.action.PARTNER_CUSTOMIZATION" />
</intent>
+ <!-- Intent filter with action used to discover launcher -->
+ <intent>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.HOME" />
+ </intent>
</queries>
<uses-permission android:name="com.android.launcher3.permission.READ_SETTINGS" />
--
2.37.2

View file

@ -1,4 +1,4 @@
From a1d10cb31ae386c01a66c8bf0a028b8f33e5bd32 Mon Sep 17 00:00:00 2001 From 08cae5289428f6a99f2a6d28145fa542d1288916 Mon Sep 17 00:00:00 2001
From: "tzu-hsien.huang" <tzu-hsien.huang@mediatek.com> From: "tzu-hsien.huang" <tzu-hsien.huang@mediatek.com>
Date: Wed, 20 Jul 2022 15:12:01 +0800 Date: Wed, 20 Jul 2022 15:12:01 +0800
Subject: [PATCH 1/3] Additionally check le_set_event_mask command resturn Subject: [PATCH 1/3] Additionally check le_set_event_mask command resturn
@ -24,10 +24,10 @@ Change-Id: I2b0cede7f47eecd2124a386e958773289eb6f11c
1 file changed, 10 insertions(+), 1 deletion(-) 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/system/gd/hci/controller.cc b/system/gd/hci/controller.cc diff --git a/system/gd/hci/controller.cc b/system/gd/hci/controller.cc
index da5986fcb7..8be21a20a3 100644 index 9dac2b6a84..50342d639e 100644
--- a/system/gd/hci/controller.cc --- a/system/gd/hci/controller.cc
+++ b/system/gd/hci/controller.cc +++ b/system/gd/hci/controller.cc
@@ -540,7 +540,7 @@ struct Controller::impl { @@ -548,7 +548,7 @@ struct Controller::impl {
void le_set_event_mask(uint64_t le_event_mask) { void le_set_event_mask(uint64_t le_event_mask) {
std::unique_ptr<LeSetEventMaskBuilder> packet = LeSetEventMaskBuilder::Create(le_event_mask); std::unique_ptr<LeSetEventMaskBuilder> packet = LeSetEventMaskBuilder::Create(le_event_mask);
hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn( hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn(
@ -36,7 +36,7 @@ index da5986fcb7..8be21a20a3 100644
} }
template <class T> template <class T>
@@ -551,6 +551,15 @@ struct Controller::impl { @@ -559,6 +559,15 @@ struct Controller::impl {
ASSERT(status_view.GetStatus() == ErrorCode::SUCCESS); ASSERT(status_view.GetStatus() == ErrorCode::SUCCESS);
} }
@ -53,5 +53,5 @@ index da5986fcb7..8be21a20a3 100644
case OpCode::name: { \ case OpCode::name: { \
uint16_t index = (uint16_t)OpCodeIndex::name; \ uint16_t index = (uint16_t)OpCodeIndex::name; \
-- --
2.37.2 2.40.1

View file

@ -1,4 +1,4 @@
From 0e2bf3f3d46efaa7d01d3554b7e5ceeac9664c69 Mon Sep 17 00:00:00 2001 From 55a4e7e7158f50f3e8840b526e15d7c9f10423de Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Wed, 24 Aug 2022 10:41:29 -0400 Date: Wed, 24 Aug 2022 10:41:29 -0400
Subject: [PATCH 2/3] gd: hci: Ignore unexpected status events Subject: [PATCH 2/3] gd: hci: Ignore unexpected status events
@ -13,7 +13,7 @@ Change-Id: Ifb9a65fd77f21d15a8dc1ced9240194d38218ef6
1 file changed, 7 insertions(+), 8 deletions(-) 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/system/gd/hci/hci_layer.cc b/system/gd/hci/hci_layer.cc diff --git a/system/gd/hci/hci_layer.cc b/system/gd/hci/hci_layer.cc
index 57d7e55fff..b5a9d065be 100644 index 5def729ac8..9c235294bb 100644
--- a/system/gd/hci/hci_layer.cc --- a/system/gd/hci/hci_layer.cc
+++ b/system/gd/hci/hci_layer.cc +++ b/system/gd/hci/hci_layer.cc
@@ -195,14 +195,13 @@ struct HciLayer::impl { @@ -195,14 +195,13 @@ struct HciLayer::impl {
@ -39,5 +39,5 @@ index 57d7e55fff..b5a9d065be 100644
command_queue_.pop_front(); command_queue_.pop_front();
-- --
2.37.2 2.40.1

View file

@ -1,4 +1,4 @@
From cad9f7f7aeaf57e5fead759bcc68b75262ba3708 Mon Sep 17 00:00:00 2001 From f2d820597f4dcbb08e4e0c9026dc1d56fe7b3bfd Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net> From: Peter Cai <peter@typeblog.net>
Date: Wed, 24 Aug 2022 15:45:18 -0400 Date: Wed, 24 Aug 2022 15:45:18 -0400
Subject: [PATCH 3/3] audio_hal_interface: Optionally use sysbta HAL Subject: [PATCH 3/3] audio_hal_interface: Optionally use sysbta HAL
@ -13,38 +13,38 @@ Change-Id: I59973e6ec84c5923be8a7c67b36b2e237f000860
3 files changed, 18 insertions(+), 4 deletions(-) 3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.cc b/system/audio_hal_interface/aidl/client_interface_aidl.cc diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.cc b/system/audio_hal_interface/aidl/client_interface_aidl.cc
index 814c6c7796..a38b6da495 100644 index 9af28031f7..5a9dbbccad 100644
--- a/system/audio_hal_interface/aidl/client_interface_aidl.cc --- a/system/audio_hal_interface/aidl/client_interface_aidl.cc
+++ b/system/audio_hal_interface/aidl/client_interface_aidl.cc +++ b/system/audio_hal_interface/aidl/client_interface_aidl.cc
@@ -55,7 +55,7 @@ BluetoothAudioClientInterface::BluetoothAudioClientInterface( @@ -56,7 +56,7 @@ BluetoothAudioClientInterface::BluetoothAudioClientInterface(
bool BluetoothAudioClientInterface::is_aidl_available() { bool BluetoothAudioClientInterface::is_aidl_available() {
auto service = AServiceManager_checkService( return AServiceManager_isDeclared(
- kDefaultAudioProviderFactoryInterface.c_str()); - kDefaultAudioProviderFactoryInterface.c_str());
+ audioProviderFactoryInterface().c_str()); + audioProviderFactoryInterface().c_str());
return (service != nullptr);
} }
std::vector<AudioCapabilities>
@@ -72,7 +72,7 @@ BluetoothAudioClientInterface::GetAudioCapabilities(SessionType session_type) { @@ -72,7 +72,7 @@ BluetoothAudioClientInterface::GetAudioCapabilities(SessionType session_type) {
} }
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder( auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(
::ndk::SpAIBinder(AServiceManager_getService( ::ndk::SpAIBinder(AServiceManager_waitForService(
- kDefaultAudioProviderFactoryInterface.c_str()))); - kDefaultAudioProviderFactoryInterface.c_str())));
+ audioProviderFactoryInterface().c_str()))); + audioProviderFactoryInterface().c_str())));
if (provider_factory == nullptr) { if (provider_factory == nullptr) {
LOG(ERROR) << __func__ << ", can't get capability from unknown factory"; LOG(ERROR) << __func__ << ", can't get capability from unknown factory";
@@ -100,7 +100,7 @@ void BluetoothAudioClientInterface::FetchAudioProvider() { @@ -99,7 +99,7 @@ void BluetoothAudioClientInterface::FetchAudioProvider() {
} }
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder( auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(
::ndk::SpAIBinder(AServiceManager_getService( ::ndk::SpAIBinder(AServiceManager_waitForService(
- kDefaultAudioProviderFactoryInterface.c_str()))); - kDefaultAudioProviderFactoryInterface.c_str())));
+ audioProviderFactoryInterface().c_str()))); + audioProviderFactoryInterface().c_str())));
if (provider_factory == nullptr) { if (provider_factory == nullptr) {
LOG(ERROR) << __func__ << ", can't get capability from unknown factory"; LOG(ERROR) << __func__ << ", can't get capability from unknown factory";
diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.h b/system/audio_hal_interface/aidl/client_interface_aidl.h diff --git a/system/audio_hal_interface/aidl/client_interface_aidl.h b/system/audio_hal_interface/aidl/client_interface_aidl.h
index 87dd450997..36d5fa5e86 100644 index 17abefe8fe..07dd11266f 100644
--- a/system/audio_hal_interface/aidl/client_interface_aidl.h --- a/system/audio_hal_interface/aidl/client_interface_aidl.h
+++ b/system/audio_hal_interface/aidl/client_interface_aidl.h +++ b/system/audio_hal_interface/aidl/client_interface_aidl.h
@@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
@ -55,7 +55,7 @@ index 87dd450997..36d5fa5e86 100644
#define BLUETOOTH_AUDIO_HAL_PROP_DISABLED \ #define BLUETOOTH_AUDIO_HAL_PROP_DISABLED \
"persist.bluetooth.bluetooth_audio_hal.disabled" "persist.bluetooth.bluetooth_audio_hal.disabled"
@@ -115,6 +116,12 @@ class BluetoothAudioClientInterface { @@ -117,6 +118,12 @@ class BluetoothAudioClientInterface {
// "android.hardware.bluetooth.audio.IBluetoothAudioProviderFactory/default"; // "android.hardware.bluetooth.audio.IBluetoothAudioProviderFactory/default";
static inline const std::string kDefaultAudioProviderFactoryInterface = static inline const std::string kDefaultAudioProviderFactoryInterface =
std::string() + IBluetoothAudioProviderFactory::descriptor + "/default"; std::string() + IBluetoothAudioProviderFactory::descriptor + "/default";
@ -103,5 +103,5 @@ index a2c192f37d..c3d1cf35c2 100644
return; return;
} }
-- --
2.37.2 2.40.1

View file

@ -0,0 +1,34 @@
From cf04b02d96fef364996067ca4ecc51b65f521dca Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Tue, 6 Dec 2022 18:30:32 -0500
Subject: [PATCH] Revert "detect inability to write to index != 0 of bpf map
array"
This reverts commit ead9d83423877458023056f6ccf9390950d6726f.
---
bpfloader/BpfLoader.cpp | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp
index 5cd80b7..bc72811 100644
--- a/bpfloader/BpfLoader.cpp
+++ b/bpfloader/BpfLoader.cpp
@@ -199,15 +199,6 @@ int main(int argc, char** argv) {
}
}
- int key = 1;
- int value = 123;
- android::base::unique_fd map(
- android::bpf::createMap(BPF_MAP_TYPE_ARRAY, sizeof(key), sizeof(value), 2, 0));
- if (android::bpf::writeToMapEntry(map, &key, &value, BPF_ANY)) {
- ALOGE("Critical kernel bug - failure to write into index 1 of 2 element bpf map array.");
- return 1;
- }
-
if (android::base::SetProperty("bpf.progs_loaded", "1") == false) {
ALOGE("Failed to set bpf.progs_loaded property");
return 1;
--
2.38.1

View file

@ -1,27 +0,0 @@
From edc01c6d7e6cebfaa1e7301b4d1dbc1541fd83b0 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Thu, 7 Oct 2021 15:48:11 -0400
Subject: [PATCH 1/2] Stop overriding system properties from vendor
This is annoying to disable apexes, or force adb
Change-Id: Ifd0072c631349b23945df4ab401ba26eca07131f
---
init/property_service.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 9f7c21543..bb295586a 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -726,7 +726,6 @@ static void LoadProperties(char* data, const char* filter, const char* filename,
} else if (it->second != value) {
LOG(WARNING) << "Overriding previous property '" << key << "':'" << it->second
<< "' with new value '" << value << "'";
- it->second = value;
}
} else {
LOG(ERROR) << "Do not have permissions to set '" << key << "' to '" << value
--
2.37.2

View file

@ -1,7 +1,7 @@
From 1d0dc75a012a6a336beb420a3642b2837da9ed8a Mon Sep 17 00:00:00 2001 From f53da166596fc34df3255b1c5120fd7cdcf21e5f Mon Sep 17 00:00:00 2001
From: Isaac Chen <tingyi364@gmail.com> From: Isaac Chen <tingyi364@gmail.com>
Date: Wed, 23 Jun 2021 13:07:30 +0800 Date: Wed, 23 Jun 2021 13:07:30 +0800
Subject: [PATCH 2/2] init: Do not start console service when debuggable Subject: [PATCH 1/2] init: Do not start console service when debuggable
Google added a check for this in R, when it's running it will show a Google added a check for this in R, when it's running it will show a
notification about that performance is impacted. notification about that performance is impacted.
@ -13,10 +13,10 @@ Change-Id: I34cfd6b42d3b9aee4b3e63181480cfb8b1255f29
1 file changed, 3 deletions(-) 1 file changed, 3 deletions(-)
diff --git a/rootdir/init.rc b/rootdir/init.rc diff --git a/rootdir/init.rc b/rootdir/init.rc
index cd71aa8aa..417de0d4a 100644 index 02e51d2c4..ab45bb032 100644
--- a/rootdir/init.rc --- a/rootdir/init.rc
+++ b/rootdir/init.rc +++ b/rootdir/init.rc
@@ -1268,9 +1268,6 @@ on property:ro.debuggable=1 @@ -1277,9 +1277,6 @@ on property:ro.debuggable=1
# Give reads to anyone for the accessibility trace folder on debug builds. # Give reads to anyone for the accessibility trace folder on debug builds.
chmod 0775 /data/misc/a11ytrace chmod 0775 /data/misc/a11ytrace
@ -27,5 +27,5 @@ index cd71aa8aa..417de0d4a 100644
# TODO(b/135984674): reset all necessary properties here. # TODO(b/135984674): reset all necessary properties here.
setprop sys.boot_completed "" setprop sys.boot_completed ""
-- --
2.37.2 2.40.0

View file

@ -0,0 +1,32 @@
From b50dd85e88568bddedbab1e18984a5b5578c8612 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Fri, 21 Apr 2023 13:08:48 -0400
Subject: [PATCH 2/2] Let system override some properties (ro.apex.updatable,
ro.adb.secure, etc.)
Change-Id: I3c84fa617f0ab7990abb0d905230a8703cf39bf7
---
init/property_service.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 26341b196..19fc09d63 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -726,7 +726,12 @@ static void LoadProperties(char* data, const char* filter, const char* filename,
} else if (it->second != value) {
LOG(WARNING) << "Overriding previous property '" << key << "':'" << it->second
<< "' with new value '" << value << "'";
- it->second = value;
+ if (strcmp("ro.apex.updatable", key) == 0 || strcmp("ro.control_privapp_permissions", key) == 0
+ || strstr(key, "adb") || strstr(key, "secure")) {
+ LOG(WARNING) << "... Ignored";
+ } else {
+ it->second = value;
+ }
}
} else {
LOG(ERROR) << "Do not have permissions to set '" << key << "' to '" << value
--
2.40.0