mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-14 10:24:32 -05:00
9d1efb33c3
Signed-off-by: Tad <tad@spotco.us>
142 lines
6.4 KiB
Diff
142 lines
6.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Thomas Stuart <tjstuart@google.com>
|
|
Date: Thu, 23 Jun 2022 14:27:43 -0700
|
|
Subject: [PATCH] switch TelecomManager List getters to ParceledListSlice
|
|
|
|
It was shown that given a large phoneAccountHandles that are
|
|
over 1 mb, a TransactionTooLarge exception can be silently thrown
|
|
causing an empty list to be returned.
|
|
|
|
In order to prevent this behavior, all Lists that return a
|
|
PhoneAccountHandle or PhoneAccount have been switched to
|
|
ParceledListSlice.
|
|
|
|
bug: 236263294
|
|
Test: atest android.telecom.cts.PhoneAccountRegistrarTest
|
|
#testRegisterPhoneAccountHandleWithFieldOverLimit
|
|
Change-Id: I025245b2a6f8cfaca86f268851a9d8f0817e07dd
|
|
Merged-In: I025245b2a6f8cfaca86f268851a9d8f0817e07dd
|
|
(cherry picked from commit 773cddde3d522606ff032fe8e432321c70edca09)
|
|
Merged-In: I025245b2a6f8cfaca86f268851a9d8f0817e07dd
|
|
---
|
|
telecomm/java/android/telecom/TelecomManager.java | 14 ++++++++------
|
|
.../android/internal/telecom/ITelecomService.aidl | 13 +++++++------
|
|
2 files changed, 15 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
|
|
index 6dc3f917533a..b2734cecf4a6 100644
|
|
--- a/telecomm/java/android/telecom/TelecomManager.java
|
|
+++ b/telecomm/java/android/telecom/TelecomManager.java
|
|
@@ -791,7 +791,7 @@ public class TelecomManager {
|
|
try {
|
|
if (isServiceConnected()) {
|
|
return getTelecomService().getPhoneAccountsSupportingScheme(uriScheme,
|
|
- mContext.getOpPackageName());
|
|
+ mContext.getOpPackageName()).getList();
|
|
}
|
|
} catch (RemoteException e) {
|
|
Log.e(TAG, "Error calling ITelecomService#getPhoneAccountsSupportingScheme", e);
|
|
@@ -833,7 +833,8 @@ public class TelecomManager {
|
|
public List<PhoneAccountHandle> getSelfManagedPhoneAccounts() {
|
|
try {
|
|
if (isServiceConnected()) {
|
|
- return getTelecomService().getSelfManagedPhoneAccounts(mContext.getOpPackageName());
|
|
+ return getTelecomService()
|
|
+ .getSelfManagedPhoneAccounts(mContext.getOpPackageName()).getList();
|
|
}
|
|
} catch (RemoteException e) {
|
|
Log.e(TAG, "Error calling ITelecomService#getSelfManagedPhoneAccounts()", e);
|
|
@@ -852,7 +853,7 @@ public class TelecomManager {
|
|
try {
|
|
if (isServiceConnected()) {
|
|
return getTelecomService().getCallCapablePhoneAccounts(
|
|
- includeDisabledAccounts, mContext.getOpPackageName());
|
|
+ includeDisabledAccounts, mContext.getOpPackageName()).getList();
|
|
}
|
|
} catch (RemoteException e) {
|
|
Log.e(TAG, "Error calling ITelecomService#getCallCapablePhoneAccounts(" +
|
|
@@ -872,7 +873,8 @@ public class TelecomManager {
|
|
public List<PhoneAccountHandle> getPhoneAccountsForPackage() {
|
|
try {
|
|
if (isServiceConnected()) {
|
|
- return getTelecomService().getPhoneAccountsForPackage(mContext.getPackageName());
|
|
+ return getTelecomService()
|
|
+ .getPhoneAccountsForPackage(mContext.getPackageName()).getList();
|
|
}
|
|
} catch (RemoteException e) {
|
|
Log.e(TAG, "Error calling ITelecomService#getPhoneAccountsForPackage", e);
|
|
@@ -926,7 +928,7 @@ public class TelecomManager {
|
|
public List<PhoneAccount> getAllPhoneAccounts() {
|
|
try {
|
|
if (isServiceConnected()) {
|
|
- return getTelecomService().getAllPhoneAccounts();
|
|
+ return getTelecomService().getAllPhoneAccounts().getList();
|
|
}
|
|
} catch (RemoteException e) {
|
|
Log.e(TAG, "Error calling ITelecomService#getAllPhoneAccounts", e);
|
|
@@ -944,7 +946,7 @@ public class TelecomManager {
|
|
public List<PhoneAccountHandle> getAllPhoneAccountHandles() {
|
|
try {
|
|
if (isServiceConnected()) {
|
|
- return getTelecomService().getAllPhoneAccountHandles();
|
|
+ return getTelecomService().getAllPhoneAccountHandles().getList();
|
|
}
|
|
} catch (RemoteException e) {
|
|
Log.e(TAG, "Error calling ITelecomService#getAllPhoneAccountHandles", e);
|
|
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
|
|
index 8ebac2c6273a..64a9b2bd0d84 100644
|
|
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
|
|
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
|
|
@@ -23,6 +23,7 @@ import android.telecom.PhoneAccountHandle;
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import android.telecom.PhoneAccount;
|
|
+import android.content.pm.ParceledListSlice;
|
|
|
|
/**
|
|
* Interface used to interact with Telecom. Mostly this is used by TelephonyManager for passing
|
|
@@ -55,24 +56,24 @@ interface ITelecomService {
|
|
/**
|
|
* @see TelecomServiceImpl#getCallCapablePhoneAccounts
|
|
*/
|
|
- List<PhoneAccountHandle> getCallCapablePhoneAccounts(
|
|
+ ParceledListSlice getCallCapablePhoneAccounts(
|
|
boolean includeDisabledAccounts, String callingPackage);
|
|
|
|
/**
|
|
* @see TelecomServiceImpl#getSelfManagedPhoneAccounts
|
|
*/
|
|
- List<PhoneAccountHandle> getSelfManagedPhoneAccounts(String callingPackage);
|
|
+ ParceledListSlice getSelfManagedPhoneAccounts(String callingPackage);
|
|
|
|
/**
|
|
* @see TelecomManager#getPhoneAccountsSupportingScheme
|
|
*/
|
|
- List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(in String uriScheme,
|
|
+ ParceledListSlice getPhoneAccountsSupportingScheme(in String uriScheme,
|
|
String callingPackage);
|
|
|
|
/**
|
|
* @see TelecomManager#getPhoneAccountsForPackage
|
|
*/
|
|
- List<PhoneAccountHandle> getPhoneAccountsForPackage(in String packageName);
|
|
+ ParceledListSlice getPhoneAccountsForPackage(in String packageName);
|
|
|
|
/**
|
|
* @see TelecomManager#getPhoneAccount
|
|
@@ -87,12 +88,12 @@ interface ITelecomService {
|
|
/**
|
|
* @see TelecomManager#getAllPhoneAccounts
|
|
*/
|
|
- List<PhoneAccount> getAllPhoneAccounts();
|
|
+ ParceledListSlice getAllPhoneAccounts();
|
|
|
|
/**
|
|
* @see TelecomManager#getAllPhoneAccountHandles
|
|
*/
|
|
- List<PhoneAccountHandle> getAllPhoneAccountHandles();
|
|
+ ParceledListSlice getAllPhoneAccountHandles();
|
|
|
|
/**
|
|
* @see TelecomServiceImpl#getSimCallManager
|