Sync up to v300.l
This commit is contained in:
parent
2347b96190
commit
7d0836656a
@ -0,0 +1,30 @@
|
||||
From 6a6c54584fae07783b493a56afd047984f589ed0 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 21 Dec 2020 20:19:11 +0100
|
||||
Subject: [PATCH 16/16] Make camera IDs filter-out optional
|
||||
|
||||
Nowadays most people have Camera 2 apps, and would like to have all
|
||||
cameras, rather than limit which cameras are available.
|
||||
Add a property for that.
|
||||
---
|
||||
.../camera/libcameraservice/common/CameraProviderManager.cpp | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
index 0bff3606df..3e6ad1ef52 100644
|
||||
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
@@ -183,7 +183,9 @@ std::vector<std::string> CameraProviderManager::getAPI1CompatibleCameraDeviceIds
|
||||
// API1 app doesn't handle logical and physical camera devices well. So
|
||||
// for each camera facing, only take the first id advertised by HAL in
|
||||
// all [logical, physical1, physical2, ...] id combos, and filter out the rest.
|
||||
- filterLogicalCameraIdsLocked(providerDeviceIds);
|
||||
+ if(!property_get_bool("persist.sys.phh.include_all_cameras", false)) {
|
||||
+ filterLogicalCameraIdsLocked(providerDeviceIds);
|
||||
+ }
|
||||
collectDeviceIdsLocked(providerDeviceIds, publicDeviceIds, systemDeviceIds);
|
||||
}
|
||||
auto sortFunc =
|
||||
--
|
||||
2.25.1
|
||||
|
@ -1,88 +0,0 @@
|
||||
From 858d6a97037b0f9eb751038a41d28564e7221222 Mon Sep 17 00:00:00 2001
|
||||
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
|
||||
Date: Mon, 30 Mar 2020 10:07:00 +0000
|
||||
Subject: [PATCH 19/25] Support Huawei light HAL
|
||||
|
||||
For https://github.com/phhusson/treble_experimentations/issues/1204
|
||||
|
||||
Change-Id: I719a13eb66a46703b7ff0e00113f9b98b3244996
|
||||
---
|
||||
services/core/jni/Android.bp | 1 +
|
||||
...om_android_server_lights_LightsService.cpp | 30 +++++++++++++++++++
|
||||
2 files changed, 31 insertions(+)
|
||||
|
||||
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
|
||||
index 24a3c68cae2..472c925f76f 100644
|
||||
--- a/services/core/jni/Android.bp
|
||||
+++ b/services/core/jni/Android.bp
|
||||
@@ -170,6 +170,7 @@ cc_defaults {
|
||||
"vendor.samsung.hardware.miscpower@2.0",
|
||||
"vendor.samsung.hardware.light@2.0",
|
||||
"vendor.samsung.hardware.light@3.0",
|
||||
+ "vendor.huawei.hardware.light@2.0",
|
||||
],
|
||||
|
||||
static_libs: [
|
||||
diff --git a/services/core/jni/com_android_server_lights_LightsService.cpp b/services/core/jni/com_android_server_lights_LightsService.cpp
|
||||
index 268b59a5801..5e535e3dcbf 100644
|
||||
--- a/services/core/jni/com_android_server_lights_LightsService.cpp
|
||||
+++ b/services/core/jni/com_android_server_lights_LightsService.cpp
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <vendor/samsung/hardware/light/2.0/types.h>
|
||||
#include <vendor/samsung/hardware/light/3.0/ISehLight.h>
|
||||
#include <vendor/samsung/hardware/light/3.0/types.h>
|
||||
+#include <vendor/huawei/hardware/light/2.0/ILight.h>
|
||||
#include <android-base/chrono_utils.h>
|
||||
#include <utils/misc.h>
|
||||
#include <utils/Log.h>
|
||||
@@ -48,11 +49,15 @@ using SecType = ::vendor::samsung::hardware::light::V2_0::SecType;
|
||||
using ISehLight = ::vendor::samsung::hardware::light::V3_0::ISehLight;
|
||||
using SehType = ::vendor::samsung::hardware::light::V3_0::SehType;
|
||||
using SehLightState = ::vendor::samsung::hardware::light::V3_0::SehLightState;
|
||||
+using ILightHw = ::vendor::huawei::hardware::light::V2_0::ILight;
|
||||
+using LightStateHw = ::android::hardware::light::V2_0::LightState;
|
||||
static bool sLightSupported = true;
|
||||
|
||||
static sp<ISecLight> sSecHal;
|
||||
static sp<ISehLight> sSehHal;
|
||||
static bool sSecTried = false;
|
||||
+static sp<ILightHw> sHwHal;
|
||||
+static bool sHwTried = false;
|
||||
|
||||
static bool validate(jint light, jint flash, jint brightness) {
|
||||
bool valid = true;
|
||||
@@ -192,6 +197,31 @@ static void setLight_native(
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (!sHwTried) {
|
||||
+ sHwHal = ILightHw::getService();
|
||||
+ //sHwTried = true;
|
||||
+ }
|
||||
+
|
||||
+ if (sHwHal != nullptr && light == 0) {
|
||||
+ ALOGE("sHwHal triggered!");
|
||||
+ int brightness = colorARGB & 0xff;
|
||||
+ int hwBrightness = brightness << 4;
|
||||
+ LightState state = constructState(hwBrightness, flashMode, onMS, offMS, brightnessMode);
|
||||
+ bool got260 = false;
|
||||
+ sHwHal->HWgetSupportedTypes([&](auto types) {
|
||||
+ for (const auto& type: types) {
|
||||
+ if (type == 260) {
|
||||
+ ALOGE("sHwHal reports 260 as a supported type");
|
||||
+ got260 = true;
|
||||
+ }
|
||||
+ }
|
||||
+ });
|
||||
+ if (got260) {
|
||||
+ sHwHal->HWsetLight(260, state);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
Type type = static_cast<Type>(light);
|
||||
LightState state = constructState(
|
||||
colorARGB, flashMode, onMS, offMS, brightnessMode);
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From aaa019b5f93c3954441456259b30077bdd96d784 Mon Sep 17 00:00:00 2001
|
||||
From 8bd0f8e1905ed0ecf275d383e816afb480feae30 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 6 Dec 2020 12:20:08 +0100
|
||||
Subject: [PATCH] Make rounded corners padding overridable with
|
||||
@ -6,13 +6,15 @@ Subject: [PATCH] Make rounded corners padding overridable with
|
||||
|
||||
Change-Id: Id5d73b06b9a2cb2da95ff31f204c1984555872ff
|
||||
---
|
||||
.../src/com/android/systemui/qs/QuickStatusBarHeader.java | 6 +++++-
|
||||
.../systemui/statusbar/phone/KeyguardStatusBarView.java | 6 +++++-
|
||||
.../systemui/statusbar/phone/PhoneStatusBarView.java | 6 +++++-
|
||||
3 files changed, 15 insertions(+), 3 deletions(-)
|
||||
.../systemui/qs/QuickStatusBarHeader.java | 6 +-
|
||||
.../phone/KeyguardStatusBarView.java | 6 +-
|
||||
.../statusbar/phone/PhoneStatusBarView.java | 6 +-
|
||||
..._server_power_PowerManagerService.cpp.orig | 641 ++++++++++++++++++
|
||||
4 files changed, 656 insertions(+), 3 deletions(-)
|
||||
create mode 100644 services/core/jni/com_android_server_power_PowerManagerService.cpp.orig
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
|
||||
index 7533f2ac1db3..94fd996d0858 100644
|
||||
index 7533f2ac1db..94fd996d085 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
|
||||
@@ -32,6 +32,7 @@ import android.graphics.Rect;
|
||||
@ -37,7 +39,7 @@ index 7533f2ac1db3..94fd996d0858 100644
|
||||
|
||||
// Update height for a few views, especially due to landscape mode restricting space.
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
|
||||
index 8a4ea21a11ca..a54269460e50 100644
|
||||
index 8a4ea21a11c..a54269460e5 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
|
||||
@@ -25,6 +25,7 @@ import android.content.res.Resources;
|
||||
@ -62,18 +64,18 @@ index 8a4ea21a11ca..a54269460e50 100644
|
||||
|
||||
private void updateVisibilities() {
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
|
||||
index 7c41bcd09b57..b0cf69b65f5d 100644
|
||||
index 1c6c7db6a69..f0e5c7bb3d2 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
|
||||
@@ -24,6 +24,7 @@ import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
@@ -25,6 +25,7 @@ import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.os.RemoteException;
|
||||
+import android.os.SystemProperties;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.EventLog;
|
||||
import android.util.Pair;
|
||||
@@ -287,8 +288,11 @@ public class PhoneStatusBarView extends PanelBar {
|
||||
@@ -331,8 +332,11 @@ public class PhoneStatusBarView extends PanelBar implements Callbacks {
|
||||
public void updateResources() {
|
||||
mCutoutSideNudge = getResources().getDimensionPixelSize(
|
||||
R.dimen.display_cutout_margin_consumption);
|
||||
@ -86,6 +88,653 @@ index 7c41bcd09b57..b0cf69b65f5d 100644
|
||||
|
||||
updateStatusBarHeight();
|
||||
}
|
||||
diff --git a/services/core/jni/com_android_server_power_PowerManagerService.cpp.orig b/services/core/jni/com_android_server_power_PowerManagerService.cpp.orig
|
||||
new file mode 100644
|
||||
index 00000000000..47fdcc9a87b
|
||||
--- /dev/null
|
||||
+++ b/services/core/jni/com_android_server_power_PowerManagerService.cpp.orig
|
||||
@@ -0,0 +1,641 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2010 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.
|
||||
+ */
|
||||
+
|
||||
+#define LOG_TAG "PowerManagerService-JNI"
|
||||
+
|
||||
+//#define LOG_NDEBUG 0
|
||||
+
|
||||
+#include <android/hardware/power/1.1/IPower.h>
|
||||
+#include <android/hardware/power/Boost.h>
|
||||
+#include <android/hardware/power/IPower.h>
|
||||
+#include <android/hardware/power/Mode.h>
|
||||
+#include <android/system/suspend/1.0/ISystemSuspend.h>
|
||||
+#include <android/system/suspend/ISuspendControlService.h>
|
||||
+#include <vendor/samsung/hardware/miscpower/2.0/ISehMiscPower.h>
|
||||
+#include <nativehelper/JNIHelp.h>
|
||||
+#include <vendor/lineage/power/1.0/ILineagePower.h>
|
||||
+#include "jni.h"
|
||||
+
|
||||
+#include <nativehelper/ScopedUtfChars.h>
|
||||
+
|
||||
+#include <limits.h>
|
||||
+
|
||||
+#include <android-base/chrono_utils.h>
|
||||
+#include <android_runtime/AndroidRuntime.h>
|
||||
+#include <android_runtime/Log.h>
|
||||
+#include <binder/IServiceManager.h>
|
||||
+#include <gui/SurfaceComposerClient.h>
|
||||
+#include <hardware/power.h>
|
||||
+#include <hardware_legacy/power.h>
|
||||
+#include <hidl/ServiceManagement.h>
|
||||
+#include <utils/Timers.h>
|
||||
+#include <utils/misc.h>
|
||||
+#include <utils/String8.h>
|
||||
+#include <utils/Log.h>
|
||||
+#include <android/keycodes.h>
|
||||
+
|
||||
+#include "com_android_server_power_PowerManagerService.h"
|
||||
+
|
||||
+using android::hardware::Return;
|
||||
+using android::hardware::Void;
|
||||
+using android::hardware::power::Boost;
|
||||
+using android::hardware::power::Mode;
|
||||
+using android::hardware::power::V1_0::PowerHint;
|
||||
+using android::hardware::power::V1_0::Feature;
|
||||
+using android::String8;
|
||||
+using android::system::suspend::V1_0::ISystemSuspend;
|
||||
+using android::system::suspend::V1_0::IWakeLock;
|
||||
+using android::system::suspend::V1_0::WakeLockType;
|
||||
+using android::system::suspend::ISuspendControlService;
|
||||
+using IPowerV1_1 = android::hardware::power::V1_1::IPower;
|
||||
+using IPowerV1_0 = android::hardware::power::V1_0::IPower;
|
||||
+using IPowerAidl = android::hardware::power::IPower;
|
||||
+using ILineagePowerV1_0 = vendor::lineage::power::V1_0::ILineagePower;
|
||||
+using vendor::lineage::power::V1_0::LineageFeature;
|
||||
+using ISehMiscPower = vendor::samsung::hardware::miscpower::V2_0::ISehMiscPower;
|
||||
+
|
||||
+namespace android {
|
||||
+
|
||||
+// ----------------------------------------------------------------------------
|
||||
+
|
||||
+static struct {
|
||||
+ jmethodID userActivityFromNative;
|
||||
+} gPowerManagerServiceClassInfo;
|
||||
+
|
||||
+// ----------------------------------------------------------------------------
|
||||
+
|
||||
+static jobject gPowerManagerServiceObj;
|
||||
+static sp<IPowerV1_0> gPowerHalHidlV1_0_ = nullptr;
|
||||
+static sp<IPowerV1_1> gPowerHalHidlV1_1_ = nullptr;
|
||||
+static sp<IPowerAidl> gPowerHalAidl_ = nullptr;
|
||||
+static sp<ILineagePowerV1_0> gLineagePowerHalV1_0_ = nullptr;
|
||||
+static sp<ISehMiscPower> gSehMiscPower = nullptr;
|
||||
+static bool gPowerHalExists = true;
|
||||
+static std::mutex gPowerHalMutex;
|
||||
+
|
||||
+enum class HalVersion {
|
||||
+ NONE,
|
||||
+ HIDL_1_0,
|
||||
+ HIDL_1_1,
|
||||
+ AIDL,
|
||||
+};
|
||||
+
|
||||
+static nsecs_t gLastEventTime[USER_ACTIVITY_EVENT_LAST + 1];
|
||||
+
|
||||
+// Throttling interval for user activity calls.
|
||||
+static const nsecs_t MIN_TIME_BETWEEN_USERACTIVITIES = 100 * 1000000L; // 100ms
|
||||
+
|
||||
+// ----------------------------------------------------------------------------
|
||||
+
|
||||
+static bool checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
|
||||
+ if (env->ExceptionCheck()) {
|
||||
+ ALOGE("An exception was thrown by callback '%s'.", methodName);
|
||||
+ LOGE_EX(env);
|
||||
+ env->ExceptionClear();
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+// Check validity of current handle to the power HAL service, and connect to it if necessary.
|
||||
+// The caller must be holding gPowerHalMutex.
|
||||
+static HalVersion connectPowerHalLocked() {
|
||||
+ static bool gPowerHalHidlExists = true;
|
||||
+ static bool gPowerHalAidlExists = true;
|
||||
+ if (!gPowerHalHidlExists && !gPowerHalAidlExists) {
|
||||
+ return HalVersion::NONE;
|
||||
+ }
|
||||
+ if (gPowerHalAidlExists) {
|
||||
+ if (!gPowerHalAidl_) {
|
||||
+ gPowerHalAidl_ = waitForVintfService<IPowerAidl>();
|
||||
+ }
|
||||
+ if (gPowerHalAidl_) {
|
||||
+ ALOGV("Successfully connected to Power HAL AIDL service.");
|
||||
+ return HalVersion::AIDL;
|
||||
+ } else {
|
||||
+ gPowerHalAidlExists = false;
|
||||
+ }
|
||||
+ }
|
||||
+ if (gPowerHalExists && gPowerHalHidlV1_0_ == nullptr) {
|
||||
+ gSehMiscPower = ISehMiscPower::getService();
|
||||
+ gPowerHalHidlV1_0_ = IPowerV1_0::getService("miscpower");
|
||||
+ }
|
||||
+ if (gPowerHalHidlExists && gPowerHalHidlV1_0_ == nullptr) {
|
||||
+ gPowerHalHidlV1_0_ = IPowerV1_0::getService();
|
||||
+ if (gPowerHalHidlV1_0_) {
|
||||
+ ALOGV("Successfully connected to Power HAL HIDL 1.0 service.");
|
||||
+ // Try cast to powerHAL HIDL V1_1
|
||||
+ gPowerHalHidlV1_1_ = IPowerV1_1::castFrom(gPowerHalHidlV1_0_);
|
||||
+ if (gPowerHalHidlV1_1_) {
|
||||
+ ALOGV("Successfully connected to Power HAL HIDL 1.1 service.");
|
||||
+ }
|
||||
+ } else {
|
||||
+ ALOGV("Couldn't load power HAL HIDL service");
|
||||
+ gPowerHalHidlExists = false;
|
||||
+ return HalVersion::NONE;
|
||||
+ }
|
||||
+ }
|
||||
+ if (gPowerHalHidlV1_1_) {
|
||||
+ return HalVersion::HIDL_1_1;
|
||||
+ } else if (gPowerHalHidlV1_0_) {
|
||||
+ return HalVersion::HIDL_1_0;
|
||||
+ }
|
||||
+ return HalVersion::NONE;
|
||||
+}
|
||||
+
|
||||
+// Check validity of current handle to the Lineage power HAL service, and call getService() if necessary.
|
||||
+// The caller must be holding gPowerHalMutex.
|
||||
+void connectLineagePowerHalLocked() {
|
||||
+ static bool gLineagePowerHalExists = true;
|
||||
+ if (gLineagePowerHalExists && gLineagePowerHalV1_0_ == nullptr) {
|
||||
+ gLineagePowerHalV1_0_ = ILineagePowerV1_0::getService();
|
||||
+ if (gLineagePowerHalV1_0_ != nullptr) {
|
||||
+ ALOGI("Loaded power HAL service");
|
||||
+ } else {
|
||||
+ ALOGI("Couldn't load power HAL service");
|
||||
+ gLineagePowerHalExists = false;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+sp<ISehMiscPower> getSehMiscPower() {
|
||||
+ std::lock_guard<std::mutex> lock(gPowerHalMutex);
|
||||
+ connectPowerHalLocked();
|
||||
+ return gSehMiscPower;
|
||||
+}
|
||||
+
|
||||
+// Retrieve a copy of PowerHAL HIDL V1_0
|
||||
+sp<IPowerV1_0> getPowerHalHidlV1_0() {
|
||||
+ std::lock_guard<std::mutex> lock(gPowerHalMutex);
|
||||
+ HalVersion halVersion = connectPowerHalLocked();
|
||||
+ if (halVersion == HalVersion::HIDL_1_0 || halVersion == HalVersion::HIDL_1_1) {
|
||||
+ return gPowerHalHidlV1_0_;
|
||||
+ }
|
||||
+
|
||||
+ return nullptr;
|
||||
+}
|
||||
+
|
||||
+// Retrieve a copy of PowerHAL HIDL V1_1
|
||||
+sp<IPowerV1_1> getPowerHalHidlV1_1() {
|
||||
+ std::lock_guard<std::mutex> lock(gPowerHalMutex);
|
||||
+ if (connectPowerHalLocked() == HalVersion::HIDL_1_1) {
|
||||
+ return gPowerHalHidlV1_1_;
|
||||
+ }
|
||||
+
|
||||
+ return nullptr;
|
||||
+}
|
||||
+
|
||||
+// Retrieve a copy of LineagePowerHAL V1_0
|
||||
+sp<ILineagePowerV1_0> getLineagePowerHalV1_0() {
|
||||
+ std::lock_guard<std::mutex> lock(gPowerHalMutex);
|
||||
+ connectLineagePowerHalLocked();
|
||||
+ return gLineagePowerHalV1_0_;
|
||||
+}
|
||||
+
|
||||
+// Check if a call to a power HAL function failed; if so, log the failure and invalidate the
|
||||
+// current handle to the power HAL service.
|
||||
+bool processPowerHalReturn(bool isOk, const char* functionName) {
|
||||
+ if (!isOk) {
|
||||
+ ALOGE("%s() failed: power HAL service not available.", functionName);
|
||||
+ gPowerHalMutex.lock();
|
||||
+ gPowerHalHidlV1_0_ = nullptr;
|
||||
+ gPowerHalHidlV1_1_ = nullptr;
|
||||
+ gPowerHalAidl_ = nullptr;
|
||||
+ gPowerHalMutex.unlock();
|
||||
+ }
|
||||
+ return isOk;
|
||||
+}
|
||||
+
|
||||
+enum class HalSupport {
|
||||
+ UNKNOWN = 0,
|
||||
+ ON,
|
||||
+ OFF,
|
||||
+};
|
||||
+
|
||||
+static void setPowerBoostWithHandle(sp<IPowerAidl> handle, Boost boost, int32_t durationMs) {
|
||||
+ // Android framework only sends boost upto DISPLAY_UPDATE_IMMINENT.
|
||||
+ // Need to increase the array size if more boost supported.
|
||||
+ static std::array<std::atomic<HalSupport>,
|
||||
+ static_cast<int32_t>(Boost::DISPLAY_UPDATE_IMMINENT) + 1>
|
||||
+ boostSupportedArray = {HalSupport::UNKNOWN};
|
||||
+
|
||||
+ // Quick return if boost is not supported by HAL
|
||||
+ if (boost > Boost::DISPLAY_UPDATE_IMMINENT ||
|
||||
+ boostSupportedArray[static_cast<int32_t>(boost)] == HalSupport::OFF) {
|
||||
+ ALOGV("Skipped setPowerBoost %s because HAL doesn't support it", toString(boost).c_str());
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (boostSupportedArray[static_cast<int32_t>(boost)] == HalSupport::UNKNOWN) {
|
||||
+ bool isSupported = false;
|
||||
+ handle->isBoostSupported(boost, &isSupported);
|
||||
+ boostSupportedArray[static_cast<int32_t>(boost)] =
|
||||
+ isSupported ? HalSupport::ON : HalSupport::OFF;
|
||||
+ if (!isSupported) {
|
||||
+ ALOGV("Skipped setPowerBoost %s because HAL doesn't support it",
|
||||
+ toString(boost).c_str());
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ auto ret = handle->setBoost(boost, durationMs);
|
||||
+ processPowerHalReturn(ret.isOk(), "setPowerBoost");
|
||||
+}
|
||||
+
|
||||
+static void setPowerBoost(Boost boost, int32_t durationMs) {
|
||||
+ std::unique_lock<std::mutex> lock(gPowerHalMutex);
|
||||
+ if (connectPowerHalLocked() != HalVersion::AIDL) {
|
||||
+ ALOGV("Power HAL AIDL not available");
|
||||
+ return;
|
||||
+ }
|
||||
+ sp<IPowerAidl> handle = gPowerHalAidl_;
|
||||
+ lock.unlock();
|
||||
+ setPowerBoostWithHandle(handle, boost, durationMs);
|
||||
+}
|
||||
+
|
||||
+static bool setPowerModeWithHandle(sp<IPowerAidl> handle, Mode mode, bool enabled) {
|
||||
+ // Android framework only sends mode upto DISPLAY_INACTIVE.
|
||||
+ // Need to increase the array if more mode supported.
|
||||
+ static std::array<std::atomic<HalSupport>, static_cast<int32_t>(Mode::DISPLAY_INACTIVE) + 1>
|
||||
+ modeSupportedArray = {HalSupport::UNKNOWN};
|
||||
+
|
||||
+ // Quick return if mode is not supported by HAL
|
||||
+ if (mode > Mode::DISPLAY_INACTIVE ||
|
||||
+ modeSupportedArray[static_cast<int32_t>(mode)] == HalSupport::OFF) {
|
||||
+ ALOGV("Skipped setPowerMode %s because HAL doesn't support it", toString(mode).c_str());
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (modeSupportedArray[static_cast<int32_t>(mode)] == HalSupport::UNKNOWN) {
|
||||
+ bool isSupported = false;
|
||||
+ handle->isModeSupported(mode, &isSupported);
|
||||
+ modeSupportedArray[static_cast<int32_t>(mode)] =
|
||||
+ isSupported ? HalSupport::ON : HalSupport::OFF;
|
||||
+ if (!isSupported) {
|
||||
+ ALOGV("Skipped setPowerMode %s because HAL doesn't support it", toString(mode).c_str());
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ auto ret = handle->setMode(mode, enabled);
|
||||
+ processPowerHalReturn(ret.isOk(), "setPowerMode");
|
||||
+ return ret.isOk();
|
||||
+}
|
||||
+
|
||||
+static bool setPowerMode(Mode mode, bool enabled) {
|
||||
+ std::unique_lock<std::mutex> lock(gPowerHalMutex);
|
||||
+ if (connectPowerHalLocked() != HalVersion::AIDL) {
|
||||
+ ALOGV("Power HAL AIDL not available");
|
||||
+ return false;
|
||||
+ }
|
||||
+ sp<IPowerAidl> handle = gPowerHalAidl_;
|
||||
+ lock.unlock();
|
||||
+ return setPowerModeWithHandle(handle, mode, enabled);
|
||||
+}
|
||||
+
|
||||
+static void sendPowerHint(PowerHint hintId, uint32_t data) {
|
||||
+ std::unique_lock<std::mutex> lock(gPowerHalMutex);
|
||||
+ switch (connectPowerHalLocked()) {
|
||||
+ case HalVersion::NONE:
|
||||
+ return;
|
||||
+ case HalVersion::HIDL_1_0: {
|
||||
+ sp<IPowerV1_0> handle = gPowerHalHidlV1_0_;
|
||||
+ lock.unlock();
|
||||
+ auto ret = handle->powerHint(hintId, data);
|
||||
+ processPowerHalReturn(ret.isOk(), "powerHint");
|
||||
+ break;
|
||||
+ }
|
||||
+ case HalVersion::HIDL_1_1: {
|
||||
+ sp<IPowerV1_1> handle = gPowerHalHidlV1_1_;
|
||||
+ lock.unlock();
|
||||
+ auto ret = handle->powerHintAsync(hintId, data);
|
||||
+ processPowerHalReturn(ret.isOk(), "powerHintAsync");
|
||||
+ break;
|
||||
+ }
|
||||
+ case HalVersion::AIDL: {
|
||||
+ if (hintId == PowerHint::INTERACTION) {
|
||||
+ sp<IPowerAidl> handle = gPowerHalAidl_;
|
||||
+ lock.unlock();
|
||||
+ setPowerBoostWithHandle(handle, Boost::INTERACTION, data);
|
||||
+ break;
|
||||
+ } else if (hintId == PowerHint::LAUNCH) {
|
||||
+ sp<IPowerAidl> handle = gPowerHalAidl_;
|
||||
+ lock.unlock();
|
||||
+ setPowerModeWithHandle(handle, Mode::LAUNCH, static_cast<bool>(data));
|
||||
+ break;
|
||||
+ } else if (hintId == PowerHint::LOW_POWER) {
|
||||
+ sp<IPowerAidl> handle = gPowerHalAidl_;
|
||||
+ lock.unlock();
|
||||
+ setPowerModeWithHandle(handle, Mode::LOW_POWER, static_cast<bool>(data));
|
||||
+ break;
|
||||
+ } else if (hintId == PowerHint::SUSTAINED_PERFORMANCE) {
|
||||
+ sp<IPowerAidl> handle = gPowerHalAidl_;
|
||||
+ lock.unlock();
|
||||
+ setPowerModeWithHandle(handle, Mode::SUSTAINED_PERFORMANCE,
|
||||
+ static_cast<bool>(data));
|
||||
+ break;
|
||||
+ } else if (hintId == PowerHint::VR_MODE) {
|
||||
+ sp<IPowerAidl> handle = gPowerHalAidl_;
|
||||
+ lock.unlock();
|
||||
+ setPowerModeWithHandle(handle, Mode::VR, static_cast<bool>(data));
|
||||
+ break;
|
||||
+ } else {
|
||||
+ ALOGE("Unsupported power hint: %s.", toString(hintId).c_str());
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ default: {
|
||||
+ ALOGE("Unknown power HAL state");
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ SurfaceComposerClient::notifyPowerHint(static_cast<int32_t>(hintId));
|
||||
+}
|
||||
+
|
||||
+void android_server_PowerManagerService_userActivity(nsecs_t eventTime, int32_t eventType,
|
||||
+ int32_t keyCode) {
|
||||
+ if (gPowerManagerServiceObj) {
|
||||
+ // Throttle calls into user activity by event type.
|
||||
+ // We're a little conservative about argument checking here in case the caller
|
||||
+ // passes in bad data which could corrupt system state.
|
||||
+ if (eventType >= 0 && eventType <= USER_ACTIVITY_EVENT_LAST) {
|
||||
+ nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
|
||||
+ if (eventTime > now) {
|
||||
+ eventTime = now;
|
||||
+ }
|
||||
+
|
||||
+ if (gLastEventTime[eventType] + MIN_TIME_BETWEEN_USERACTIVITIES > eventTime) {
|
||||
+ return;
|
||||
+ }
|
||||
+ gLastEventTime[eventType] = eventTime;
|
||||
+
|
||||
+ // Tell the power HAL when user activity occurs.
|
||||
+ sendPowerHint(PowerHint::INTERACTION, 0);
|
||||
+ }
|
||||
+
|
||||
+ JNIEnv* env = AndroidRuntime::getJNIEnv();
|
||||
+
|
||||
+ int flags = 0;
|
||||
+ if (keyCode == AKEYCODE_VOLUME_UP || keyCode == AKEYCODE_VOLUME_DOWN) {
|
||||
+ flags |= USER_ACTIVITY_FLAG_NO_BUTTON_LIGHTS;
|
||||
+ }
|
||||
+
|
||||
+ env->CallVoidMethod(gPowerManagerServiceObj,
|
||||
+ gPowerManagerServiceClassInfo.userActivityFromNative,
|
||||
+ nanoseconds_to_milliseconds(eventTime), eventType, flags);
|
||||
+ checkAndClearExceptionFromCallback(env, "userActivityFromNative");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static sp<ISystemSuspend> gSuspendHal = nullptr;
|
||||
+static sp<ISuspendControlService> gSuspendControl = nullptr;
|
||||
+static sp<IWakeLock> gSuspendBlocker = nullptr;
|
||||
+static std::mutex gSuspendMutex;
|
||||
+
|
||||
+// Assume SystemSuspend HAL is always alive.
|
||||
+// TODO: Force device to restart if SystemSuspend HAL dies.
|
||||
+sp<ISystemSuspend> getSuspendHal() {
|
||||
+ static std::once_flag suspendHalFlag;
|
||||
+ std::call_once(suspendHalFlag, [](){
|
||||
+ ::android::hardware::details::waitForHwService(ISystemSuspend::descriptor, "default");
|
||||
+ gSuspendHal = ISystemSuspend::getService();
|
||||
+ assert(gSuspendHal != nullptr);
|
||||
+ });
|
||||
+ return gSuspendHal;
|
||||
+}
|
||||
+
|
||||
+sp<ISuspendControlService> getSuspendControl() {
|
||||
+ static std::once_flag suspendControlFlag;
|
||||
+ std::call_once(suspendControlFlag, [](){
|
||||
+ gSuspendControl = waitForService<ISuspendControlService>(String16("suspend_control"));
|
||||
+ LOG_ALWAYS_FATAL_IF(gSuspendControl == nullptr);
|
||||
+ });
|
||||
+ return gSuspendControl;
|
||||
+}
|
||||
+
|
||||
+void enableAutoSuspend() {
|
||||
+ static bool enabled = false;
|
||||
+ if (!enabled) {
|
||||
+ sp<ISuspendControlService> suspendControl = getSuspendControl();
|
||||
+ suspendControl->enableAutosuspend(&enabled);
|
||||
+ }
|
||||
+
|
||||
+ {
|
||||
+ std::lock_guard<std::mutex> lock(gSuspendMutex);
|
||||
+ if (gSuspendBlocker) {
|
||||
+ gSuspendBlocker->release();
|
||||
+ gSuspendBlocker.clear();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void disableAutoSuspend() {
|
||||
+ std::lock_guard<std::mutex> lock(gSuspendMutex);
|
||||
+ if (!gSuspendBlocker) {
|
||||
+ sp<ISystemSuspend> suspendHal = getSuspendHal();
|
||||
+ gSuspendBlocker = suspendHal->acquireWakeLock(WakeLockType::PARTIAL,
|
||||
+ "PowerManager.SuspendLockout");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static jint nativeGetFeature(JNIEnv* /* env */, jclass /* clazz */, jint featureId) {
|
||||
+ int value = -1;
|
||||
+
|
||||
+ sp<ILineagePowerV1_0> lineagePowerHalV1_0 = getLineagePowerHalV1_0();
|
||||
+ if (lineagePowerHalV1_0 != nullptr) {
|
||||
+ value = lineagePowerHalV1_0->getFeature(static_cast<LineageFeature>(featureId));
|
||||
+ }
|
||||
+
|
||||
+ return static_cast<jint>(value);
|
||||
+}
|
||||
+
|
||||
+// ----------------------------------------------------------------------------
|
||||
+
|
||||
+static void nativeInit(JNIEnv* env, jobject obj) {
|
||||
+ gPowerManagerServiceObj = env->NewGlobalRef(obj);
|
||||
+
|
||||
+ gPowerHalMutex.lock();
|
||||
+ connectPowerHalLocked();
|
||||
+ gPowerHalMutex.unlock();
|
||||
+}
|
||||
+
|
||||
+static void nativeAcquireSuspendBlocker(JNIEnv *env, jclass /* clazz */, jstring nameStr) {
|
||||
+ ScopedUtfChars name(env, nameStr);
|
||||
+ acquire_wake_lock(PARTIAL_WAKE_LOCK, name.c_str());
|
||||
+}
|
||||
+
|
||||
+static void nativeReleaseSuspendBlocker(JNIEnv *env, jclass /* clazz */, jstring nameStr) {
|
||||
+ ScopedUtfChars name(env, nameStr);
|
||||
+ release_wake_lock(name.c_str());
|
||||
+}
|
||||
+
|
||||
+static void nativeSetInteractive(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) {
|
||||
+ std::unique_lock<std::mutex> lock(gPowerHalMutex);
|
||||
+ switch (connectPowerHalLocked()) {
|
||||
+ case HalVersion::NONE:
|
||||
+ return;
|
||||
+ case HalVersion::HIDL_1_0:
|
||||
+ FALLTHROUGH_INTENDED;
|
||||
+ case HalVersion::HIDL_1_1: {
|
||||
+ android::base::Timer t;
|
||||
+ sp<IPowerV1_0> handle = gPowerHalHidlV1_0_;
|
||||
+ lock.unlock();
|
||||
+ auto ret = handle->setInteractive(enable);
|
||||
+ processPowerHalReturn(ret.isOk(), "setInteractive");
|
||||
+ if (t.duration() > 20ms) {
|
||||
+ ALOGD("Excessive delay in setInteractive(%s) while turning screen %s",
|
||||
+ enable ? "true" : "false", enable ? "on" : "off");
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ case HalVersion::AIDL: {
|
||||
+ sp<IPowerAidl> handle = gPowerHalAidl_;
|
||||
+ lock.unlock();
|
||||
+ setPowerModeWithHandle(handle, Mode::INTERACTIVE, enable);
|
||||
+ return;
|
||||
+ }
|
||||
+ default: {
|
||||
+ ALOGE("Unknown power HAL state");
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ sp<ISehMiscPower> sehMiscPower = getSehMiscPower();
|
||||
+ if(sehMiscPower != nullptr) {
|
||||
+ android::base::Timer t;
|
||||
+ Return<void> ret = sehMiscPower->setInteractiveAsync(enable, 0);
|
||||
+ if(!ret.isOk()) {
|
||||
+ ALOGE("set interactive async() failed: seh misc setInteractiveAsync");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void nativeSetAutoSuspend(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) {
|
||||
+ if (enable) {
|
||||
+ android::base::Timer t;
|
||||
+ enableAutoSuspend();
|
||||
+ if (t.duration() > 100ms) {
|
||||
+ ALOGD("Excessive delay in autosuspend_enable() while turning screen off");
|
||||
+ }
|
||||
+ } else {
|
||||
+ android::base::Timer t;
|
||||
+ disableAutoSuspend();
|
||||
+ if (t.duration() > 100ms) {
|
||||
+ ALOGD("Excessive delay in autosuspend_disable() while turning screen on");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void nativeSendPowerHint(JNIEnv* /* env */, jclass /* clazz */, jint hintId, jint data) {
|
||||
+ sendPowerHint(static_cast<PowerHint>(hintId), data);
|
||||
+}
|
||||
+
|
||||
+static void nativeSetPowerBoost(JNIEnv* /* env */, jclass /* clazz */, jint boost,
|
||||
+ jint durationMs) {
|
||||
+ setPowerBoost(static_cast<Boost>(boost), durationMs);
|
||||
+}
|
||||
+
|
||||
+static jboolean nativeSetPowerMode(JNIEnv* /* env */, jclass /* clazz */, jint mode,
|
||||
+ jboolean enabled) {
|
||||
+ return setPowerMode(static_cast<Mode>(mode), enabled);
|
||||
+}
|
||||
+
|
||||
+static void nativeSetFeature(JNIEnv* /* env */, jclass /* clazz */, jint featureId, jint data) {
|
||||
+ std::unique_lock<std::mutex> lock(gPowerHalMutex);
|
||||
+ switch (connectPowerHalLocked()) {
|
||||
+ case HalVersion::NONE:
|
||||
+ return;
|
||||
+ case HalVersion::HIDL_1_0:
|
||||
+ FALLTHROUGH_INTENDED;
|
||||
+ case HalVersion::HIDL_1_1: {
|
||||
+ sp<IPowerV1_0> handle = gPowerHalHidlV1_0_;
|
||||
+ lock.unlock();
|
||||
+ auto ret = handle->setFeature(static_cast<Feature>(featureId), static_cast<bool>(data));
|
||||
+ processPowerHalReturn(ret.isOk(), "setFeature");
|
||||
+ return;
|
||||
+ }
|
||||
+ case HalVersion::AIDL: {
|
||||
+ sp<IPowerAidl> handle = gPowerHalAidl_;
|
||||
+ lock.unlock();
|
||||
+ setPowerModeWithHandle(handle, Mode::DOUBLE_TAP_TO_WAKE, static_cast<bool>(data));
|
||||
+ return;
|
||||
+ }
|
||||
+ default: {
|
||||
+ ALOGE("Unknown power HAL state");
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static bool nativeForceSuspend(JNIEnv* /* env */, jclass /* clazz */) {
|
||||
+ bool retval = false;
|
||||
+ getSuspendControl()->forceSuspend(&retval);
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+// ----------------------------------------------------------------------------
|
||||
+
|
||||
+static const JNINativeMethod gPowerManagerServiceMethods[] = {
|
||||
+ /* name, signature, funcPtr */
|
||||
+ {"nativeInit", "()V", (void*)nativeInit},
|
||||
+ {"nativeAcquireSuspendBlocker", "(Ljava/lang/String;)V",
|
||||
+ (void*)nativeAcquireSuspendBlocker},
|
||||
+ {"nativeForceSuspend", "()Z", (void*)nativeForceSuspend},
|
||||
+ {"nativeReleaseSuspendBlocker", "(Ljava/lang/String;)V",
|
||||
+ (void*)nativeReleaseSuspendBlocker},
|
||||
+ {"nativeSetInteractive", "(Z)V", (void*)nativeSetInteractive},
|
||||
+ {"nativeSetAutoSuspend", "(Z)V", (void*)nativeSetAutoSuspend},
|
||||
+ {"nativeSendPowerHint", "(II)V", (void*)nativeSendPowerHint},
|
||||
+ {"nativeSetPowerBoost", "(II)V", (void*)nativeSetPowerBoost},
|
||||
+ {"nativeSetPowerMode", "(IZ)Z", (void*)nativeSetPowerMode},
|
||||
+ {"nativeSetFeature", "(II)V", (void*)nativeSetFeature},
|
||||
+ {"nativeGetFeature", "(I)I", (void*)nativeGetFeature},
|
||||
+};
|
||||
+
|
||||
+#define FIND_CLASS(var, className) \
|
||||
+ var = env->FindClass(className); \
|
||||
+ LOG_FATAL_IF(! (var), "Unable to find class " className);
|
||||
+
|
||||
+#define GET_METHOD_ID(var, clazz, methodName, methodDescriptor) \
|
||||
+ var = env->GetMethodID(clazz, methodName, methodDescriptor); \
|
||||
+ LOG_FATAL_IF(! (var), "Unable to find method " methodName);
|
||||
+
|
||||
+#define GET_FIELD_ID(var, clazz, fieldName, fieldDescriptor) \
|
||||
+ var = env->GetFieldID(clazz, fieldName, fieldDescriptor); \
|
||||
+ LOG_FATAL_IF(! (var), "Unable to find field " fieldName);
|
||||
+
|
||||
+int register_android_server_PowerManagerService(JNIEnv* env) {
|
||||
+ int res = jniRegisterNativeMethods(env, "com/android/server/power/PowerManagerService",
|
||||
+ gPowerManagerServiceMethods, NELEM(gPowerManagerServiceMethods));
|
||||
+ (void) res; // Faked use when LOG_NDEBUG.
|
||||
+ LOG_FATAL_IF(res < 0, "Unable to register native methods.");
|
||||
+
|
||||
+ // Callbacks
|
||||
+
|
||||
+ jclass clazz;
|
||||
+ FIND_CLASS(clazz, "com/android/server/power/PowerManagerService");
|
||||
+
|
||||
+ GET_METHOD_ID(gPowerManagerServiceClassInfo.userActivityFromNative, clazz,
|
||||
+ "userActivityFromNative", "(JII)V");
|
||||
+
|
||||
+ // Initialize
|
||||
+ for (int i = 0; i <= USER_ACTIVITY_EVENT_LAST; i++) {
|
||||
+ gLastEventTime[i] = LLONG_MIN;
|
||||
+ }
|
||||
+ gPowerManagerServiceObj = NULL;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+} /* namespace android */
|
||||
--
|
||||
2.25.1
|
||||
|
||||
|
@ -0,0 +1,26 @@
|
||||
From 54222334328e1bf9202ca95a941894ce48758c40 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 11 Dec 2020 14:41:09 +0100
|
||||
Subject: [PATCH 30/35] Remove useless notification about "console" service
|
||||
being running
|
||||
|
||||
---
|
||||
.../core/java/com/android/server/am/ActivityManagerService.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
index 091c77ecaac..df72122a4c5 100644
|
||||
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
@@ -5563,7 +5563,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
}
|
||||
|
||||
private void showConsoleNotificationIfActive() {
|
||||
- if (!SystemProperties.get("init.svc.console").equals("running")) {
|
||||
+ if (!SystemProperties.get("init.svc.console").equals("running") || true) {
|
||||
return;
|
||||
}
|
||||
String title = mContext
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 9d2d5c8b106404769d8e6c2bebd4a2779fd2f21f Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Sun, 13 Dec 2020 01:38:50 +0100
|
||||
Subject: [PATCH 31/35] [Tethering] Ignore DUN required and always use main APN
|
||||
|
||||
---
|
||||
.../android/networkstack/tethering/TetheringConfiguration.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/packages/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java b/packages/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java
|
||||
index e1771a56137..65d17ffa54b 100644
|
||||
--- a/packages/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java
|
||||
+++ b/packages/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java
|
||||
@@ -132,7 +132,7 @@ public class TetheringConfiguration {
|
||||
tetherableBluetoothRegexs = getResourceStringArray(
|
||||
res, R.array.config_tether_bluetooth_regexs);
|
||||
|
||||
- isDunRequired = checkDunRequired(ctx);
|
||||
+ isDunRequired = false;
|
||||
|
||||
chooseUpstreamAutomatically = getResourceBoolean(
|
||||
res, R.bool.config_tether_upstream_automatic, false /** defaultValue */);
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,95 @@
|
||||
From e8f19bb6d060133e461791fc51c243f081fc00d0 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 16 Dec 2020 21:24:12 +0800
|
||||
Subject: [PATCH 32/35] Revert "Remove unused SystemProperties.set"
|
||||
|
||||
This reverts commit debb4616ef67f9ed5054eca51ec58592358ff55f.
|
||||
|
||||
* Needed for SPRD IMS
|
||||
---
|
||||
.../android/telephony/TelephonyManager.java | 69 +++++++++++++++++++
|
||||
1 file changed, 69 insertions(+)
|
||||
|
||||
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
|
||||
index 1b197b00069..89147084043 100644
|
||||
--- a/telephony/java/android/telephony/TelephonyManager.java
|
||||
+++ b/telephony/java/android/telephony/TelephonyManager.java
|
||||
@@ -7033,6 +7033,75 @@ public class TelephonyManager {
|
||||
}
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Sets a per-phone telephony property with the value specified.
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static void setTelephonyProperty(int phoneId, String property, String value) {
|
||||
+ String propVal = "";
|
||||
+ String p[] = null;
|
||||
+ String prop = SystemProperties.get(property);
|
||||
+
|
||||
+ if (value == null) {
|
||||
+ value = "";
|
||||
+ }
|
||||
+ value.replace(',', ' ');
|
||||
+ if (prop != null) {
|
||||
+ p = prop.split(",");
|
||||
+ }
|
||||
+
|
||||
+ if (!SubscriptionManager.isValidPhoneId(phoneId)) {
|
||||
+ Rlog.d(TAG, "setTelephonyProperty: invalid phoneId=" + phoneId +
|
||||
+ " property=" + property + " value: " + value + " prop=" + prop);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ for (int i = 0; i < phoneId; i++) {
|
||||
+ String str = "";
|
||||
+ if ((p != null) && (i < p.length)) {
|
||||
+ str = p[i];
|
||||
+ }
|
||||
+ propVal = propVal + str + ",";
|
||||
+ }
|
||||
+
|
||||
+ propVal = propVal + value;
|
||||
+ if (p != null) {
|
||||
+ for (int i = phoneId + 1; i < p.length; i++) {
|
||||
+ propVal = propVal + "," + p[i];
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ int propValLen = propVal.length();
|
||||
+ try {
|
||||
+ propValLen = propVal.getBytes("utf-8").length;
|
||||
+ } catch (java.io.UnsupportedEncodingException e) {
|
||||
+ Rlog.d(TAG, "setTelephonyProperty: utf-8 not supported");
|
||||
+ }
|
||||
+ if (propValLen > SystemProperties.PROP_VALUE_MAX) {
|
||||
+ Rlog.d(TAG, "setTelephonyProperty: property too long phoneId=" + phoneId +
|
||||
+ " property=" + property + " value: " + value + " propVal=" + propVal);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ SystemProperties.set(property, propVal);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets a global telephony property with the value specified.
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static void setTelephonyProperty(String property, String value) {
|
||||
+ if (value == null) {
|
||||
+ value = "";
|
||||
+ }
|
||||
+ Rlog.d(TAG, "setTelephonyProperty: success" + " property=" +
|
||||
+ property + " value: " + value);
|
||||
+ SystemProperties.set(property, value);
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Inserts or updates a list property. Expands the list if its length is not enough.
|
||||
*/
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,84 @@
|
||||
From 7268f850f701698f948f37a7d5bfac3cc4dae644 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 16 Dec 2020 13:46:15 +0800
|
||||
Subject: [PATCH 33/35] TelephonyManager: bring back getNetworkClass()
|
||||
|
||||
This partially reverts commit c058cac051ab083dc7fb7ea6aa85699110b2e9bf.
|
||||
|
||||
* Needed by Spreadtrum IMS
|
||||
---
|
||||
.../android/telephony/TelephonyManager.java | 58 +++++++++++++++++++
|
||||
1 file changed, 58 insertions(+)
|
||||
|
||||
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
|
||||
index 89147084043..f470d4595c3 100644
|
||||
--- a/telephony/java/android/telephony/TelephonyManager.java
|
||||
+++ b/telephony/java/android/telephony/TelephonyManager.java
|
||||
@@ -3135,6 +3135,64 @@ public class TelephonyManager {
|
||||
}
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Network Class Definitions.
|
||||
+ * Do not change this order, it is used for sorting during emergency calling in
|
||||
+ * {@link TelephonyConnectionService#getFirstPhoneForEmergencyCall()}. Any newer technologies
|
||||
+ * should be added after the current definitions.
|
||||
+ */
|
||||
+ /** Unknown network class. {@hide} */
|
||||
+ public static final int NETWORK_CLASS_UNKNOWN = 0;
|
||||
+ /** Class of broadly defined "2G" networks. {@hide} */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static final int NETWORK_CLASS_2_G = 1;
|
||||
+ /** Class of broadly defined "3G" networks. {@hide} */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static final int NETWORK_CLASS_3_G = 2;
|
||||
+ /** Class of broadly defined "4G" networks. {@hide} */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static final int NETWORK_CLASS_4_G = 3;
|
||||
+ /** Class of broadly defined "5G" networks. {@hide} */
|
||||
+ public static final int NETWORK_CLASS_5_G = 4;
|
||||
+
|
||||
+ /**
|
||||
+ * Return general class of network type, such as "3G" or "4G". In cases
|
||||
+ * where classification is contentious, this method is conservative.
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static int getNetworkClass(int networkType) {
|
||||
+ switch (networkType) {
|
||||
+ case NETWORK_TYPE_GPRS:
|
||||
+ case NETWORK_TYPE_GSM:
|
||||
+ case NETWORK_TYPE_EDGE:
|
||||
+ case NETWORK_TYPE_CDMA:
|
||||
+ case NETWORK_TYPE_1xRTT:
|
||||
+ case NETWORK_TYPE_IDEN:
|
||||
+ return NETWORK_CLASS_2_G;
|
||||
+ case NETWORK_TYPE_UMTS:
|
||||
+ case NETWORK_TYPE_EVDO_0:
|
||||
+ case NETWORK_TYPE_EVDO_A:
|
||||
+ case NETWORK_TYPE_HSDPA:
|
||||
+ case NETWORK_TYPE_HSUPA:
|
||||
+ case NETWORK_TYPE_HSPA:
|
||||
+ case NETWORK_TYPE_EVDO_B:
|
||||
+ case NETWORK_TYPE_EHRPD:
|
||||
+ case NETWORK_TYPE_HSPAP:
|
||||
+ case NETWORK_TYPE_TD_SCDMA:
|
||||
+ return NETWORK_CLASS_3_G;
|
||||
+ case NETWORK_TYPE_LTE:
|
||||
+ case NETWORK_TYPE_IWLAN:
|
||||
+ case NETWORK_TYPE_LTE_CA:
|
||||
+ return NETWORK_CLASS_4_G;
|
||||
+ case NETWORK_TYPE_NR:
|
||||
+ return NETWORK_CLASS_5_G;
|
||||
+ default:
|
||||
+ return NETWORK_CLASS_UNKNOWN;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Returns a string representation of the radio technology (network type)
|
||||
* currently in use on the device.
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,41 @@
|
||||
From 04a8e10d1ac42ade9e707081920940931bc80f07 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 16 Dec 2020 21:26:45 +0800
|
||||
Subject: [PATCH 34/35] TelephonyManager: add API annotations for
|
||||
setTelephonyProperty
|
||||
|
||||
* This method was added back by reverting commit
|
||||
debb4616ef67f9ed5054eca51ec58592358ff55f, but they do not conform to
|
||||
the new R API requirements.
|
||||
|
||||
* R requires such annotations.
|
||||
---
|
||||
telephony/java/android/telephony/TelephonyManager.java | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
|
||||
index f470d4595c3..4b912e88798 100644
|
||||
--- a/telephony/java/android/telephony/TelephonyManager.java
|
||||
+++ b/telephony/java/android/telephony/TelephonyManager.java
|
||||
@@ -7097,7 +7097,7 @@ public class TelephonyManager {
|
||||
* @hide
|
||||
*/
|
||||
@UnsupportedAppUsage
|
||||
- public static void setTelephonyProperty(int phoneId, String property, String value) {
|
||||
+ public static void setTelephonyProperty(int phoneId, @NonNull String property, @Nullable String value) {
|
||||
String propVal = "";
|
||||
String p[] = null;
|
||||
String prop = SystemProperties.get(property);
|
||||
@@ -7151,7 +7151,8 @@ public class TelephonyManager {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
- public static void setTelephonyProperty(String property, String value) {
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static void setTelephonyProperty(@NonNull String property, @Nullable String value) {
|
||||
if (value == null) {
|
||||
value = "";
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,72 @@
|
||||
From 792b863af87a7bd3d063da76ecefa7e229e1aded Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Fri, 18 Dec 2020 16:38:58 -0500
|
||||
Subject: [PATCH] Fix Samsung Power HAL (switch/case was filled with
|
||||
mines/returns), and cleanup code and add logs
|
||||
|
||||
---
|
||||
...droid_server_power_PowerManagerService.cpp | 25 +++++++++++--------
|
||||
1 file changed, 14 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/services/core/jni/com_android_server_power_PowerManagerService.cpp b/services/core/jni/com_android_server_power_PowerManagerService.cpp
|
||||
index 47fdcc9a87b..ed7d311ab9f 100644
|
||||
--- a/services/core/jni/com_android_server_power_PowerManagerService.cpp
|
||||
+++ b/services/core/jni/com_android_server_power_PowerManagerService.cpp
|
||||
@@ -83,7 +83,6 @@ static sp<IPowerV1_1> gPowerHalHidlV1_1_ = nullptr;
|
||||
static sp<IPowerAidl> gPowerHalAidl_ = nullptr;
|
||||
static sp<ILineagePowerV1_0> gLineagePowerHalV1_0_ = nullptr;
|
||||
static sp<ISehMiscPower> gSehMiscPower = nullptr;
|
||||
-static bool gPowerHalExists = true;
|
||||
static std::mutex gPowerHalMutex;
|
||||
|
||||
enum class HalVersion {
|
||||
@@ -129,9 +128,11 @@ static HalVersion connectPowerHalLocked() {
|
||||
gPowerHalAidlExists = false;
|
||||
}
|
||||
}
|
||||
- if (gPowerHalExists && gPowerHalHidlV1_0_ == nullptr) {
|
||||
+ if (gPowerHalHidlExists && gPowerHalHidlV1_0_ == nullptr) {
|
||||
+ ALOGE("Trying to connect to Samsung Power HAL");
|
||||
gSehMiscPower = ISehMiscPower::getService();
|
||||
gPowerHalHidlV1_0_ = IPowerV1_0::getService("miscpower");
|
||||
+ ALOGE("Got miscpower = %d, SehMiscPower = %d", gPowerHalHidlV1_0_ != nullptr ? 1 : 0, gSehMiscPower ? 1 : 0);
|
||||
}
|
||||
if (gPowerHalHidlExists && gPowerHalHidlV1_0_ == nullptr) {
|
||||
gPowerHalHidlV1_0_ = IPowerV1_0::getService();
|
||||
@@ -484,7 +485,17 @@ static void nativeReleaseSuspendBlocker(JNIEnv *env, jclass /* clazz */, jstring
|
||||
|
||||
static void nativeSetInteractive(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) {
|
||||
std::unique_lock<std::mutex> lock(gPowerHalMutex);
|
||||
- switch (connectPowerHalLocked()) {
|
||||
+
|
||||
+ auto powerHalType = connectPowerHalLocked();
|
||||
+ if(gSehMiscPower != nullptr) {
|
||||
+ android::base::Timer t;
|
||||
+ Return<void> ret = gSehMiscPower->setInteractiveAsync(enable, 0);
|
||||
+ if(!ret.isOk()) {
|
||||
+ ALOGE("set interactive async() failed: seh misc setInteractiveAsync");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ switch (powerHalType) {
|
||||
case HalVersion::NONE:
|
||||
return;
|
||||
case HalVersion::HIDL_1_0:
|
||||
@@ -512,14 +523,6 @@ static void nativeSetInteractive(JNIEnv* /* env */, jclass /* clazz */, jboolean
|
||||
return;
|
||||
}
|
||||
}
|
||||
- sp<ISehMiscPower> sehMiscPower = getSehMiscPower();
|
||||
- if(sehMiscPower != nullptr) {
|
||||
- android::base::Timer t;
|
||||
- Return<void> ret = sehMiscPower->setInteractiveAsync(enable, 0);
|
||||
- if(!ret.isOk()) {
|
||||
- ALOGE("set interactive async() failed: seh misc setInteractiveAsync");
|
||||
- }
|
||||
- }
|
||||
}
|
||||
|
||||
static void nativeSetAutoSuspend(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) {
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,26 @@
|
||||
From cc94e422c0a8b2680e7f9cfc391b2b03a56da765 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Tue, 5 Jan 2021 23:44:00 +0100
|
||||
Subject: [PATCH 11/11] unshared_oob didn't exist in O/P, so detect its
|
||||
supported based on vndk version
|
||||
|
||||
---
|
||||
cmds/installd/migrate_legacy_obb_data.sh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmds/installd/migrate_legacy_obb_data.sh b/cmds/installd/migrate_legacy_obb_data.sh
|
||||
index 7399681c3..9d5b73eae 100644
|
||||
--- a/cmds/installd/migrate_legacy_obb_data.sh
|
||||
+++ b/cmds/installd/migrate_legacy_obb_data.sh
|
||||
@@ -18,7 +18,7 @@
|
||||
rm -rf /data/media/0/Android/obb/test_probe
|
||||
mkdir -p /data/media/0/Android/obb/
|
||||
touch /data/media/0/Android/obb/test_probe
|
||||
-if ! test -f /data/media/0/Android/obb/test_probe ; then
|
||||
+if ! test -f /data/media/0/Android/obb/test_probe || [ "$(adb shell getprop ro.vndk.version)" -le 28 ]; then
|
||||
log -p i -t migrate_legacy_obb_data "No support for 'unshared_obb'. Not migrating"
|
||||
rm -rf /data/media/0/Android/obb/test_probe
|
||||
exit 0
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,34 @@
|
||||
From c692f80ef50353eff7bd66f628663adab1bffe7f Mon Sep 17 00:00:00 2001
|
||||
From: Artem Borisov <dedsa2002@gmail.com>
|
||||
Date: Sat, 10 Nov 2018 17:19:17 +0000
|
||||
Subject: [PATCH 2/2] Telephony: Don not call onUssdRelease for Huawei RIL
|
||||
|
||||
Huawei RIL doesn't seem to work properly with USSD_MODE_NW_RELEASE,
|
||||
always releasing USSD when it should be finished instead.
|
||||
Let's explicitly call onUssdFinished in this case.
|
||||
|
||||
Change-Id: I69faed1c51d4582834879975d6ab13daf7f48ad4
|
||||
---
|
||||
src/java/com/android/internal/telephony/GsmCdmaPhone.java | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
|
||||
index ec339c05c..136d06275 100644
|
||||
--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java
|
||||
+++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
|
||||
@@ -2548,7 +2548,11 @@ public class GsmCdmaPhone extends Phone {
|
||||
// Complete pending USSD
|
||||
|
||||
if (isUssdRelease) {
|
||||
- found.onUssdRelease();
|
||||
+ if (SystemProperties.getBoolean("persist.sys.radio.huawei", false)) {
|
||||
+ found.onUssdFinished(ussdMessage, isUssdRequest);
|
||||
+ } else {
|
||||
+ found.onUssdRelease();
|
||||
+ }
|
||||
} else if (isUssdError) {
|
||||
found.onUssdFinishedError();
|
||||
} else {
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,41 @@
|
||||
From abe69da83e1b79f661de25bd94f825ea0d57e7c6 Mon Sep 17 00:00:00 2001
|
||||
From: Artem Borisov <dedsa2002@gmail.com>
|
||||
Date: Wed, 19 Sep 2018 17:02:06 +0300
|
||||
Subject: [PATCH] Telephony: Support muting by RIL command
|
||||
|
||||
While almost everyone already moved to AudioManager years ago,
|
||||
some OEMs (cough Huawei) still use RIL for muting and don't
|
||||
promote the necessary calls in their audio HAL.
|
||||
Let's handle these odd cases too when it's necessary.
|
||||
|
||||
Change-Id: Id916dec2574d6e57b6f809fbaf2b0959c0cc7256
|
||||
---
|
||||
src/com/android/services/telephony/TelephonyConnection.java | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
|
||||
index b4dd050ee..52224f8f1 100755
|
||||
--- a/src/com/android/services/telephony/TelephonyConnection.java
|
||||
+++ b/src/com/android/services/telephony/TelephonyConnection.java
|
||||
@@ -28,6 +28,7 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.PersistableBundle;
|
||||
+import android.os.SystemProperties;
|
||||
import android.telecom.CallAudioState;
|
||||
import android.telecom.Conference;
|
||||
import android.telecom.Connection;
|
||||
@@ -822,6 +823,10 @@ abstract class TelephonyConnection extends Connection implements Holdable {
|
||||
// TODO: update TTY mode.
|
||||
if (getPhone() != null) {
|
||||
getPhone().setEchoSuppressionEnabled();
|
||||
+
|
||||
+ if (SystemProperties.getBoolean("persist.sys.radio.huawei", false)) {
|
||||
+ getPhone().setMute(audioState.isMuted());
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,30 @@
|
||||
From 1f6485e68983e667d611efaccfd74737951b3f45 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 2 Jul 2018 22:01:43 +0200
|
||||
Subject: [PATCH 1/2] [device] ::Huawei Kirin 960:: accept broken rpfilter
|
||||
match
|
||||
|
||||
How bad a security flaw is this?
|
||||
People lived with rpfilter on IPv4 for a very long time...
|
||||
|
||||
Change-Id: I9aa63d18e54a8254133adf97bf757c03d6b66757
|
||||
---
|
||||
server/TetherController.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
|
||||
index 2445fb70..bac80a3d 100644
|
||||
--- a/server/TetherController.cpp
|
||||
+++ b/server/TetherController.cpp
|
||||
@@ -748,7 +748,7 @@ int TetherController::setForwardRules(bool add, const char *intIface, const char
|
||||
"*raw\n"
|
||||
"%s %s -i %s -m rpfilter --invert ! -s fe80::/64 -j DROP\n"
|
||||
"COMMIT\n", op, LOCAL_RAW_PREROUTING, intIface);
|
||||
- if (iptablesRestoreFunction(V6, rpfilterCmd, nullptr) == -1 && add) {
|
||||
+ if (iptablesRestoreFunction(V6, rpfilterCmd, nullptr) == -1 && add && false) {
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,45 @@
|
||||
From cb5b32e075bd991ded7dd1a87a644ebcd9bd7383 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 29 Jul 2019 18:09:12 +0200
|
||||
Subject: [PATCH 2/2] Don't fail on FTP conntracking failing
|
||||
|
||||
The issue has been seen on some Samsung devices.
|
||||
See https://github.com/phhusson/treble_experimentations/issues/425
|
||||
|
||||
Thanks @zamrih for pin-pointing the issue and validating fix
|
||||
|
||||
Change-Id: I3d9c865eb5a4b421f9983210c2ceae62b4906234
|
||||
---
|
||||
server/TetherController.cpp | 12 +++++++++---
|
||||
1 file changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
|
||||
index bac80a3d..8762db99 100644
|
||||
--- a/server/TetherController.cpp
|
||||
+++ b/server/TetherController.cpp
|
||||
@@ -752,13 +752,19 @@ int TetherController::setForwardRules(bool add, const char *intIface, const char
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
- std::vector<std::string> v4 = {
|
||||
+ std::vector<std::string> v4Ftp = {
|
||||
"*raw",
|
||||
- StringPrintf("%s %s -p tcp --dport 21 -i %s -j CT --helper ftp", op,
|
||||
- LOCAL_RAW_PREROUTING, intIface),
|
||||
+ StringPrintf("%s %s -p tcp --dport 21 -i %s -j CT --helper ftp",
|
||||
+ op, LOCAL_RAW_PREROUTING, intIface),
|
||||
StringPrintf("%s %s -p tcp --dport 1723 -i %s -j CT --helper pptp", op,
|
||||
LOCAL_RAW_PREROUTING, intIface),
|
||||
"COMMIT",
|
||||
+ };
|
||||
+ if(iptablesRestoreFunction(V4, Join(v4Ftp, '\n'), nullptr) == -1) {
|
||||
+ ALOGE("Failed adding iptables CT target on FTP.");
|
||||
+ }
|
||||
+
|
||||
+ std::vector<std::string> v4 = {
|
||||
"*filter",
|
||||
StringPrintf("%s %s -i %s -o %s -m state --state ESTABLISHED,RELATED -g %s", op,
|
||||
LOCAL_FORWARD, extIface, intIface, LOCAL_TETHER_COUNTERS_CHAIN),
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,29 @@
|
||||
From ecbc25f6de3722fd9dfeaf062c1fff7c32268787 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Hugues Husson <phh@phh.me>
|
||||
Date: Mon, 21 Dec 2020 19:36:54 +0100
|
||||
Subject: [PATCH] Let vendor have priority over NFC config file, rather than
|
||||
GSI
|
||||
|
||||
Thanks @mikalovtch
|
||||
|
||||
Change-Id: Iaee468f3b8e5c8ec90ca7e856a6526d1cbcaa33e
|
||||
---
|
||||
src/adaptation/nfc_config.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/adaptation/nfc_config.cc b/src/adaptation/nfc_config.cc
|
||||
index 264968e..9260697 100644
|
||||
--- a/src/adaptation/nfc_config.cc
|
||||
+++ b/src/adaptation/nfc_config.cc
|
||||
@@ -30,7 +30,7 @@ using namespace ::android::base;
|
||||
namespace {
|
||||
std::string searchConfigPath(std::string file_name) {
|
||||
const std::vector<std::string> search_path = {
|
||||
- "/product/etc/", "/odm/etc/", "/vendor/etc/", "/system_ext/etc/", "/etc/",
|
||||
+ "/odm/etc/", "/vendor/etc/", "/product/etc/", "/system_ext/etc/", "/etc/",
|
||||
};
|
||||
for (std::string path : search_path) {
|
||||
path.append(file_name);
|
||||
--
|
||||
2.25.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user