mirror of
https://github.com/yurisieucuti/treble_evolution.git
synced 2024-11-24 09:46:19 +00:00
59 lines
2.9 KiB
Diff
59 lines
2.9 KiB
Diff
From 8b7003d32b4a58e64a9de820931518d4e42d2283 Mon Sep 17 00:00:00 2001
|
|
From: Peter Cai <peter@typeblog.net>
|
|
Date: Mon, 5 Sep 2022 14:02:37 -0400
|
|
Subject: [PATCH 01/16] 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 a8d05a334b..42310ccc3f 100644
|
|
--- a/src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java
|
|
+++ b/src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java
|
|
@@ -81,6 +81,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;
|
|
@@ -3023,7 +3024,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.25.1
|
|
|