[2/n] Android 14 port

This commit is contained in:
Peter Cai 2023-10-07 19:36:35 -04:00
parent ebc4ea1e26
commit edbcfc74f2
7 changed files with 91 additions and 81 deletions

View file

@ -1,4 +1,4 @@
From 9f88617d1af3f068efdff111984a7a631464a205 Mon Sep 17 00:00:00 2001
From 45ee12fd0ac92b5e6a07de927716b8b03c18f1fd 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
@ -10,10 +10,10 @@ Change-Id: I3dd66d436629d37c8ec795df6569736195ae570e
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
index b5a1168b..547a3a16 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 {
@@ -1666,6 +1666,14 @@ public class ImsManager implements FeatureUpdates {
}
}
@ -29,5 +29,5 @@ index c41426d0..2c6d656f 100644
* Push configuration updates to the ImsService implementation.
*/
--
2.40.0
2.41.0

View file

@ -1,7 +1,7 @@
From bcaff4d8a493c657519ae50cf7f3661da6c4a46b Mon Sep 17 00:00:00 2001
From d8c305abadf223aef7237029d9b58c6756922a7d 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
Subject: [PATCH 1/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)
@ -42,5 +42,5 @@ index 3fdbfe0ed7..fb8011c3df 100644
* Write Send SMS event using ImsService. Expecting response from
* {@link #writeOnSmsSolicitedResponse}.
--
2.40.0
2.41.0

View file

@ -1,45 +0,0 @@
From 02041484d88e3c8a6cd62e1253f4b12b15be6852 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Mon, 5 Sep 2022 14:02:37 -0400
Subject: [PATCH 1/5] SubscriptionController: Do not override default calling
account from third-party apps
When the user has selected a calling account from a third-party app as
default, it should not be overridden by the rest of the telephony
subsystem (e.g. SIM subcription updates, or default SIM slot selection).
Otherwise, it creates a somewhat annoying situation where the user has
to keep re-selecting the desired calling account after every reboot.
Test: manual
Change-Id: Iccab64e9b3b3ab4773bd8944d47c2006f229d472
---
.../internal/telephony/SubscriptionController.java | 11 ++++++++++-
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
index 82799bea8b..5105d3a183 100644
--- a/src/java/com/android/internal/telephony/SubscriptionController.java
+++ b/src/java/com/android/internal/telephony/SubscriptionController.java
@@ -2855,8 +2855,17 @@ public class SubscriptionController extends ISub.Stub {
subId);
TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
+ PhoneAccountHandle currentHandle = telecomManager.getUserSelectedOutgoingPhoneAccount();
+ String currentPackageName =
+ currentHandle == null ? null : currentHandle.getComponentName().getPackageName();
+ boolean currentIsSim = "com.android.phone".equals(currentPackageName);
+ // Do not override user selected outgoing calling account
+ // if the user has selected a third-party app as default
+ boolean shouldKeepOutgoingAccount = currentHandle != null && !currentIsSim;
- telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle);
+ if (!shouldKeepOutgoingAccount) {
+ telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle);
+ }
logd("[setDefaultVoiceSubId] requesting change to phoneAccountHandle=" + newHandle);
if (previousDefaultSub != getDefaultSubId()) {
--
2.40.0

View file

@ -1,7 +1,7 @@
From 9550951ff96e643d143da826cb9560da572850a1 Mon Sep 17 00:00:00 2001
From b299cb6cb26268d1a0a58b8df42ea334d7bdc950 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
Subject: [PATCH 2/5] Pass correct value to setPreferredNetworkType() for RIL
version < 1.4
Change-Id: Id14be66a2ea4e85b6504bc03fd7d2f038185c17d
@ -11,10 +11,10 @@ Change-Id: Id14be66a2ea4e85b6504bc03fd7d2f038185c17d
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
index 5ecdfcbbd4..174b89c141 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 {
@@ -3027,7 +3027,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
mMetrics.writeSetPreferredNetworkType(mPhoneId, networkType);
try {
@ -22,13 +22,13 @@ index 6de66527e1..0c1b7cdf8c 100644
+ networkProxy.setPreferredNetworkTypeBitmap(
+ rr.mSerial, mAllowedNetworkTypesBitmask, networkType);
} catch (RemoteException | RuntimeException e) {
handleRadioProxyExceptionForRR(NETWORK_SERVICE, "setPreferredNetworkType", e);
handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "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
index 246c2e0204..2e352a96b4 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 {
@@ -389,16 +389,17 @@ public class RadioNetworkProxy extends RadioServiceProxy {
* Call IRadioNetwork#setPreferredNetworkTypeBitmap
* @param serial Serial number of request
* @param networkTypesBitmask Preferred network types bitmask to set
@ -49,5 +49,5 @@ index b88103510a..661fa56954 100644
}
--
2.40.0
2.41.0

View file

@ -1,7 +1,7 @@
From 53160d33c83afe4f56862c3c12d4b61e2970209b Mon Sep 17 00:00:00 2001
From 2861b7ed720286f3a69782d4fc18128e742d8949 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
Subject: [PATCH 3/5] Fix baseband being too long to fit into a 91 chars
property, preventing telephony subsystem from starting
Change-Id: I1762e4a8cc137626be89f350229d6be162bdaf57
@ -10,10 +10,10 @@ Change-Id: I1762e4a8cc137626be89f350229d6be162bdaf57
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
index 5eae06112c..d5302413bc 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 {
@@ -3282,7 +3282,7 @@ public class GsmCdmaPhone extends Phone {
String version = (String)ar.result;
if (version != null) {
int length = version.length();
@ -23,5 +23,5 @@ index 76a8d57246..9a72712c59 100644
length <= MAX_VERSION_LEN ? version
: version.substring(length - MAX_VERSION_LEN, length));
--
2.40.0
2.41.0

View file

@ -1,4 +1,4 @@
From c527732943bc02fd434cbecbd07787e2d429023d Mon Sep 17 00:00:00 2001
From ec5993b869fc758bd48c1636ee009bad8d4205bf 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
@ -13,14 +13,14 @@ This conditionally reverts commit 75c3dc9ba272b43971f519caba0382f9871c7d9d.
Change-Id: I55a8f3bbca4a2b9a6bc7511e9fe2d0884a8818e5
---
.../imsphone/ImsPhoneCallTracker.java | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
.../telephony/imsphone/ImsPhoneCallTracker.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
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
index c3ee0f6060..f11b921c08 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;
@@ -70,6 +70,7 @@ import android.os.Registrant;
import android.os.RegistrantList;
import android.os.RemoteException;
import android.os.SystemClock;
@ -28,30 +28,27 @@ index 5968ba6fa1..86034f6fa1 100644
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));
@@ -385,7 +386,19 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
@Nullable
public IImsCallSessionListener onIncomingCall(
@NonNull IImsCallSession c, @Nullable String callId, @Nullable Bundle extras) {
- return executeAndWaitForReturn(()-> processIncomingCall(c, callId, 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));
+ return executeAndWaitForReturn(()-> processIncomingCall(c, callId, 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),
+ return TelephonyUtils.runWithCleanCallingIdentity(()-> processIncomingCall(c, callId, extras),
+ mExecutor);
+ }
}
@Override
--
2.40.0
2.41.0

View file

@ -0,0 +1,58 @@
From 2685c843046fcfb12b42f530ed4d5b8fa28cdc9e Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Mon, 5 Sep 2022 14:02:37 -0400
Subject: [PATCH 5/5] SubscriptionController: Do not override default calling
account from third-party apps
When the user has selected a calling account from a third-party app as
default, it should not be overridden by the rest of the telephony
subsystem (e.g. SIM subcription updates, or default SIM slot selection).
Otherwise, it creates a somewhat annoying situation where the user has
to keep re-selecting the desired calling account after every reboot.
Test: manual
Change-Id: Iccab64e9b3b3ab4773bd8944d47c2006f229d472
---
.../SubscriptionManagerService.java | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java b/src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java
index 8e773c072d..1efe9ba3b4 100644
--- a/src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java
+++ b/src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java
@@ -78,6 +78,7 @@ import android.util.Base64;
import android.util.EventLog;
import android.util.IndentingPrintWriter;
import android.util.LocalLog;
+import android.util.Log;
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
@@ -2839,7 +2840,22 @@ public class SubscriptionManagerService extends ISub.Stub {
TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
if (telecomManager != null) {
- telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle);
+ PhoneAccountHandle currentHandle = telecomManager.getUserSelectedOutgoingPhoneAccount();
+ log("[setDefaultVoiceSubId] current phoneAccountHandle=" + currentHandle);
+
+ String currentPackageName =
+ currentHandle == null ? null : currentHandle.getComponentName().getPackageName();
+ boolean currentIsSim = "com.android.phone".equals(currentPackageName);
+ // Do not override user selected outgoing calling account
+ // if the user has selected a third-party app as default
+ boolean shouldKeepOutgoingAccount = currentHandle != null && !currentIsSim;
+
+ if (!shouldKeepOutgoingAccount) {
+ telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle);
+ log("[setDefaultVoiceSubId] change to phoneAccountHandle=" + newHandle);
+ } else {
+ log("[setDefaultVoiceSubId] default phoneAccountHandle not changed.");
+ }
}
updateDefaultSubId();
--
2.41.0