Integrate telephony with Safety Center
Grant telephony permission to send safety center updates. Receive the
refresh broadcast from Safety Center and forward it to the phone
instance.
Bug: 308985417
Test: manual
Change-Id: I0935dccf57efcc1a817fce55dbe02b7a1379c8a0
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index b2548f1..9f4922a 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -172,6 +172,9 @@
<!-- Needed to bind the domain selection service. -->
<uses-permission android:name="android.permission.BIND_DOMAIN_SELECTION_SERVICE" />
+ <!-- Needed to send safety center updates for cellular transparency features -->
+ <uses-permission android:name="android.permission.SEND_SAFETY_CENTER_UPDATE"/>
+
<application android:name="PhoneApp"
android:persistent="true"
android:label="@string/phoneAppLabel"
@@ -575,6 +578,14 @@
android:name="com.android.internal.telephony.uicc.ShowInstallAppNotificationReceiver"
android:exported="false"/>
+ <receiver
+ android:name=".security.SafetySourceReceiver"
+ android:exported="false">
+ <intent-filter>
+ <action android:name="android.safetycenter.action.REFRESH_SAFETY_SOURCES"/>
+ </intent-filter>
+ </receiver>
+
<activity
android:name="com.android.phone.settings.PickSmsSubscriptionActivity"
android:exported="false"
diff --git a/src/com/android/phone/security/SafetySourceReceiver.java b/src/com/android/phone/security/SafetySourceReceiver.java
new file mode 100644
index 0000000..c846c43
--- /dev/null
+++ b/src/com/android/phone/security/SafetySourceReceiver.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.phone.security;
+
+import static android.safetycenter.SafetyCenterManager.ACTION_REFRESH_SAFETY_SOURCES;
+import static android.safetycenter.SafetyCenterManager.EXTRA_REFRESH_SAFETY_SOURCES_BROADCAST_ID;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import com.android.phone.PhoneGlobals;
+
+public final class SafetySourceReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ if (!ACTION_REFRESH_SAFETY_SOURCES.equals(action)) {
+ return;
+ }
+
+ String refreshBroadcastId =
+ intent.getStringExtra(EXTRA_REFRESH_SAFETY_SOURCES_BROADCAST_ID);
+ if (refreshBroadcastId == null) {
+ return;
+ }
+
+ PhoneGlobals.getPhone().refreshSafetySources(refreshBroadcastId);
+ }
+}