summaryrefslogtreecommitdiff
path: root/telephony
diff options
context:
space:
mode:
authorChen Xu <fionaxu@google.com>2020-05-13 09:17:06 -0700
committerChen Xu <fionaxu@google.com>2020-06-30 13:26:06 -0700
commit7a172565f3e693c673d806053eec781f6122e31e (patch)
tree0ec6ac1c80bc2fd6517ee3b5b124cf785aa8177f /telephony
parenta4ddee215e41ea232340c14ef92d6e9f290e5174 (diff)
allow CBR to write SMS database
This is to support KR government requirement: CBR message should be available in SMS.inbox. The solution is to insert CBR message once displayed to users. this feature is disabled by default and OEM can turn it on for specific mcc per country/carrier regulations. Bug: 144749813 Test: Manual test on different messenger apps. Change-Id: I5535cefb32e89694094299f3b89321f735983ef1 Merged-in: I5535cefb32e89694094299f3b89321f735983ef1
Diffstat (limited to 'telephony')
-rw-r--r--telephony/common/com/android/internal/telephony/SmsApplication.java27
1 files changed, 18 insertions, 9 deletions
diff --git a/telephony/common/com/android/internal/telephony/SmsApplication.java b/telephony/common/com/android/internal/telephony/SmsApplication.java
index 1a049e6c517e..d69282579b77 100644
--- a/telephony/common/com/android/internal/telephony/SmsApplication.java
+++ b/telephony/common/com/android/internal/telephony/SmsApplication.java
@@ -542,13 +542,16 @@ public final class SmsApplication {
// Assign permission to special system apps
assignExclusiveSmsPermissionsToSystemApp(context, packageManager, appOps,
- PHONE_PACKAGE_NAME);
+ PHONE_PACKAGE_NAME, true);
assignExclusiveSmsPermissionsToSystemApp(context, packageManager, appOps,
- BLUETOOTH_PACKAGE_NAME);
+ BLUETOOTH_PACKAGE_NAME, true);
assignExclusiveSmsPermissionsToSystemApp(context, packageManager, appOps,
- MMS_SERVICE_PACKAGE_NAME);
+ MMS_SERVICE_PACKAGE_NAME, true);
assignExclusiveSmsPermissionsToSystemApp(context, packageManager, appOps,
- TELEPHONY_PROVIDER_PACKAGE_NAME);
+ TELEPHONY_PROVIDER_PACKAGE_NAME, true);
+ // CellbroadcastReceiver is a mainline module thus skip signature match.
+ assignExclusiveSmsPermissionsToSystemApp(context, packageManager, appOps,
+ CellBroadcastUtils.getDefaultCellBroadcastReceiverPackageName(context), false);
// Give AppOps permission to UID 1001 which contains multiple
// apps, all of them should be able to write to telephony provider.
@@ -738,17 +741,23 @@ public final class SmsApplication {
* @param packageManager The package manager instance
* @param appOps The AppOps manager instance
* @param packageName The package name of the system app
+ * @param sigatureMatch whether to check signature match
*/
private static void assignExclusiveSmsPermissionsToSystemApp(Context context,
- PackageManager packageManager, AppOpsManager appOps, String packageName) {
+ PackageManager packageManager, AppOpsManager appOps, String packageName,
+ boolean sigatureMatch) {
// First check package signature matches the caller's package signature.
// Since this class is only used internally by the system, this check makes sure
// the package signature matches system signature.
- final int result = packageManager.checkSignatures(context.getPackageName(), packageName);
- if (result != PackageManager.SIGNATURE_MATCH) {
- Log.e(LOG_TAG, packageName + " does not have system signature");
- return;
+ if (sigatureMatch) {
+ final int result = packageManager.checkSignatures(context.getPackageName(),
+ packageName);
+ if (result != PackageManager.SIGNATURE_MATCH) {
+ Log.e(LOG_TAG, packageName + " does not have system signature");
+ return;
+ }
}
+
try {
PackageInfo info = packageManager.getPackageInfo(packageName, 0);
int mode = appOps.unsafeCheckOp(AppOpsManager.OPSTR_WRITE_SMS, info.applicationInfo.uid,