summaryrefslogtreecommitdiff
path: root/telephony/common
diff options
context:
space:
mode:
authorChen Xu <fionaxu@google.com>2020-05-19 04:41:50 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-05-19 04:41:50 +0000
commitb44d6d6d48eaa6576561ce805d1bcf07db9123b7 (patch)
tree7ba2cfe36c92b058337359fc37217f3f34f90999 /telephony/common
parent799b92b2d507f2317da9b511e55d859b1c115c98 (diff)
parent1eff8d2232c68cfa62b281d189656a23c927b151 (diff)
Merge "allow CBR to write SMS database" into rvc-dev
Diffstat (limited to 'telephony/common')
-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 bb6f154335a9..b35b3236afc6 100644
--- a/telephony/common/com/android/internal/telephony/SmsApplication.java
+++ b/telephony/common/com/android/internal/telephony/SmsApplication.java
@@ -536,13 +536,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.
@@ -744,17 +747,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,