aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2022-08-15 22:04:23 -0700
committerXin Li <delphij@google.com>2022-08-15 22:04:23 -0700
commit5557d4a3c4994216b2d877b425221bdd09b2dc36 (patch)
tree9f382e3685397526cec3272c18e01f6749a11542
parent34db0a318b6f72ac1f8244faf5e2f60c9c611ffe (diff)
parent40451798aafd03edd3ff40f66585370504485699 (diff)
downloadDialer-5557d4a3c4994216b2d877b425221bdd09b2dc36.tar.gz
DO NOT MERGE - Merge Android 13
Bug: 242648940 Merged-In: I7bdf6a91cdc9f1615b35f1707cbdaf46015b70bf Change-Id: I46714bd3cbf5554d7732598b218fcfda77de526e
-rw-r--r--AndroidManifest.xml3
-rw-r--r--java/com/android/contacts/common/model/ContactLoader.java5
-rw-r--r--java/com/android/contacts/common/model/account/GoogleAccountType.java23
-rw-r--r--java/com/android/dialer/app/DevicePolicyResources.java54
-rw-r--r--java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java5
-rw-r--r--java/com/android/dialer/app/calllog/MissedCallNotifier.java22
-rw-r--r--java/com/android/dialer/commandline/impl/CallCommand.java4
-rw-r--r--java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java9
-rw-r--r--java/com/android/dialer/notification/VoicemailChannelUtils.java36
-rw-r--r--java/com/android/incallui/StatusBarNotifier.java75
-rw-r--r--java/com/android/voicemail/impl/sms/StatusSmsFetcher.java2
11 files changed, 158 insertions, 80 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f48c425ca..a106e12c9 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -23,6 +23,8 @@
android:minSdkVersion="24"
android:targetSdkVersion="30"/>
+
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
@@ -60,6 +62,7 @@
<uses-permission android:name="android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS"/>
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE"/>
<!-- We use this to disable the status bar buttons of home, back and recent
diff --git a/java/com/android/contacts/common/model/ContactLoader.java b/java/com/android/contacts/common/model/ContactLoader.java
index 12cca4f13..a3a3b9d7f 100644
--- a/java/com/android/contacts/common/model/ContactLoader.java
+++ b/java/com/android/contacts/common/model/ContactLoader.java
@@ -39,6 +39,7 @@ import android.text.TextUtils;
import com.android.contacts.common.GroupMetaData;
import com.android.contacts.common.model.account.AccountType;
import com.android.contacts.common.model.account.AccountTypeWithDataSet;
+import com.android.contacts.common.model.account.GoogleAccountType;
import com.android.contacts.common.model.dataitem.DataItem;
import com.android.contacts.common.model.dataitem.PhoneDataItem;
import com.android.contacts.common.model.dataitem.PhotoDataItem;
@@ -727,6 +728,10 @@ public class ContactLoader extends AsyncTaskLoader<Contact> {
final String servicePackageName = accountType.getViewContactNotifyServicePackageName();
if (!TextUtils.isEmpty(serviceName) && !TextUtils.isEmpty(servicePackageName)) {
final Uri uri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
+ if (accountType instanceof GoogleAccountType) {
+ ((GoogleAccountType) accountType).handleRawContactViewed(context, uri);
+ continue;
+ }
final Intent intent = new Intent();
intent.setClassName(servicePackageName, serviceName);
intent.setAction(Intent.ACTION_VIEW);
diff --git a/java/com/android/contacts/common/model/account/GoogleAccountType.java b/java/com/android/contacts/common/model/account/GoogleAccountType.java
index a25544bb9..e10ade479 100644
--- a/java/com/android/contacts/common/model/account/GoogleAccountType.java
+++ b/java/com/android/contacts/common/model/account/GoogleAccountType.java
@@ -18,6 +18,8 @@ package com.android.contacts.common.model.account;
import android.content.ContentValues;
import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.Event;
import android.provider.ContactsContract.CommonDataKinds.Phone;
@@ -196,11 +198,28 @@ public class GoogleAccountType extends BaseAccountType {
@Override
public String getViewContactNotifyServiceClassName() {
- return "com.google.android.syncadapters.contacts." + "SyncHighResPhotoIntentService";
+ return PLUS_EXTENSION_PACKAGE_NAME + ".people.sync.focus.SyncHighResPhotoIntentOperation";
}
@Override
public String getViewContactNotifyServicePackageName() {
- return "com.google.android.syncadapters.contacts";
+ return PLUS_EXTENSION_PACKAGE_NAME;
+ }
+
+ /**
+ * Sends a broadcast to the sync adapter to trigger a high res photo sync for the contact which
+ * was viewed
+ * @param context context to send broadcast in
+ * @param rawContactUri Uri of the raw contact viewed
+ */
+ public void handleRawContactViewed(Context context, Uri rawContactUri) {
+ final Intent intent = new Intent();
+ intent.setData(rawContactUri);
+ // New broadcast for syncing high res photo.
+ intent.setPackage(GoogleAccountType.PLUS_EXTENSION_PACKAGE_NAME);
+ intent.setAction(
+ "com.google.android.gms.people.sync.focus.SYNC_HIGH_RES_PHOTO");
+
+ context.sendBroadcast(intent);
}
}
diff --git a/java/com/android/dialer/app/DevicePolicyResources.java b/java/com/android/dialer/app/DevicePolicyResources.java
new file mode 100644
index 000000000..c783f0bb3
--- /dev/null
+++ b/java/com/android/dialer/app/DevicePolicyResources.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2022 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.dialer.app;
+
+import android.app.admin.DevicePolicyManager;
+
+/**
+ * Class containing the required identifiers to update device management resources.
+ *
+ * <p>See {@link DevicePolicyManager#getDrawable} and {@link DevicePolicyManager#getString}.
+ */
+public class DevicePolicyResources {
+
+ private static final String PREFIX = "Dialer.";
+
+ /**
+ * The title of the in-call notification for an incoming work call.
+ */
+ public static final String NOTIFICATION_INCOMING_WORK_CALL_TITLE =
+ PREFIX + "NOTIFICATION_INCOMING_WORK_CALL_TITLE";
+
+ /**
+ * The title of the in-call notification for an ongoing work call.
+ */
+ public static final String NOTIFICATION_ONGOING_WORK_CALL_TITLE =
+ PREFIX + "NOTIFICATION_ONGOING_WORK_CALL_TITLE";
+
+ /**
+ * Missed call notification label, used when there's exactly one missed call from work
+ * contact.
+ */
+ public static final String NOTIFICATION_MISSED_WORK_CALL_TITLE =
+ PREFIX + "NOTIFICATION_MISSED_WORK_CALL_TITLE";
+
+ /**
+ * Label for notification indicating that call is being made over wifi.
+ */
+ public static final String NOTIFICATION_WIFI_WORK_CALL_LABEL =
+ PREFIX + "NOTIFICATION_WIFI_WORK_CALL_LABEL";
+}
diff --git a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java
index 1388f43a5..62ae748de 100644
--- a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java
+++ b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java
@@ -36,7 +36,6 @@ import com.android.dialer.common.LogUtil;
import com.android.dialer.location.GeoUtil;
import com.android.dialer.notification.DialerNotificationManager;
import com.android.dialer.notification.NotificationChannelManager;
-import com.android.dialer.notification.VoicemailChannelUtils;
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.theme.base.ThemeComponent;
@@ -182,8 +181,8 @@ public final class LegacyVoicemailNotifier {
if (context.getSystemService(TelephonyManager.class).getPhoneCount() <= 1) {
return NOTIFICATION_TAG;
}
- return NOTIFICATION_TAG_PREFIX
- + VoicemailChannelUtils.getHashedPhoneAccountId(phoneAccountHandle);
+
+ return NOTIFICATION_TAG_PREFIX + phoneAccountHandle.getId();
}
private LegacyVoicemailNotifier() {}
diff --git a/java/com/android/dialer/app/calllog/MissedCallNotifier.java b/java/com/android/dialer/app/calllog/MissedCallNotifier.java
index 4b5bfba8a..f2d2af834 100644
--- a/java/com/android/dialer/app/calllog/MissedCallNotifier.java
+++ b/java/com/android/dialer/app/calllog/MissedCallNotifier.java
@@ -15,9 +15,12 @@
*/
package com.android.dialer.app.calllog;
+import static com.android.dialer.app.DevicePolicyResources.NOTIFICATION_MISSED_WORK_CALL_TITLE;
+
import android.app.Notification;
import android.app.Notification.Builder;
import android.app.PendingIntent;
+import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -107,7 +110,7 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> {
void updateMissedCallNotification(int count, @Nullable String number) {
LogUtil.enterBlock("MissedCallNotifier.updateMissedCallNotification");
- final int titleResId;
+ final String titleText;
CharSequence expandedText; // The text in the notification's line 1 and 2.
List<NewCall> newCalls = callLogNotificationsQueryHelper.getNewMissedCalls();
@@ -168,10 +171,13 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> {
ContactInfo contactInfo =
callLogNotificationsQueryHelper.getContactInfo(
call.number, call.numberPresentation, call.countryIso);
- titleResId =
- contactInfo.userType == ContactsUtils.USER_TYPE_WORK
- ? R.string.notification_missedWorkCallTitle
- : R.string.notification_missedCallTitle;
+ if (contactInfo.userType == ContactsUtils.USER_TYPE_WORK) {
+ titleText = context.getSystemService(DevicePolicyManager.class).getResources().getString(
+ NOTIFICATION_MISSED_WORK_CALL_TITLE,
+ () -> context.getString(R.string.notification_missedWorkCallTitle));
+ } else {
+ titleText = context.getString(R.string.notification_missedCallTitle);
+ }
if (TextUtils.equals(contactInfo.name, contactInfo.formattedNumber)
|| TextUtils.equals(contactInfo.name, contactInfo.number)) {
@@ -189,7 +195,7 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> {
groupSummary.setLargeIcon(photoIcon);
}
} else {
- titleResId = R.string.notification_missedCallsTitle;
+ titleText = context.getString(R.string.notification_missedCallsTitle);
expandedText = context.getString(R.string.notification_missedCallsMsg, count);
}
@@ -199,14 +205,14 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> {
// notification content is hidden.
Notification.Builder publicSummaryBuilder = createNotificationBuilder();
publicSummaryBuilder
- .setContentTitle(context.getText(titleResId))
+ .setContentTitle(titleText)
.setContentIntent(createCallLogPendingIntent())
.setDeleteIntent(
CallLogNotificationsService.createCancelAllMissedCallsPendingIntent(context));
// Create the notification summary suitable for display when sensitive information is showing.
groupSummary
- .setContentTitle(context.getText(titleResId))
+ .setContentTitle(titleText)
.setContentText(expandedText)
.setContentIntent(createCallLogPendingIntent())
.setDeleteIntent(
diff --git a/java/com/android/dialer/commandline/impl/CallCommand.java b/java/com/android/dialer/commandline/impl/CallCommand.java
index 5bcf78548..d0008a321 100644
--- a/java/com/android/dialer/commandline/impl/CallCommand.java
+++ b/java/com/android/dialer/commandline/impl/CallCommand.java
@@ -19,8 +19,6 @@ package com.android.dialer.commandline.impl;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
-import android.telecom.PhoneAccount;
-import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import com.android.dialer.buildtype.BuildType;
import com.android.dialer.buildtype.BuildType.Type;
@@ -67,8 +65,6 @@ public class CallCommand implements Command {
}
String number = args.expectPositional(0, "number");
TelecomManager telecomManager = appContext.getSystemService(TelecomManager.class);
- PhoneAccountHandle phoneAccountHandle =
- telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL);
CallIntentBuilder callIntentBuilder;
if ("voicemail".equals(number)) {
callIntentBuilder =
diff --git a/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java b/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java
index 9201604be..0c1461313 100644
--- a/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java
+++ b/java/com/android/dialer/contacts/hiresphoto/HighResolutionPhotoRequesterImpl.java
@@ -51,8 +51,8 @@ public class HighResolutionPhotoRequesterImpl implements HighResolutionPhotoRequ
@VisibleForTesting
static final ComponentName SYNC_HIGH_RESOLUTION_PHOTO_SERVICE =
new ComponentName(
- "com.google.android.syncadapters.contacts",
- "com.google.android.syncadapters.contacts.SyncHighResPhotoIntentService");
+ "com.google.android.gms",
+ "com.google.android.gms.people.sync.focus.SyncHighResPhotoIntentOperation");
private final Context appContext;
private final ListeningExecutorService backgroundExecutor;
@@ -81,7 +81,8 @@ public class HighResolutionPhotoRequesterImpl implements HighResolutionPhotoRequ
private void requestInternal(Uri contactUri) throws RequestFailedException {
for (Long rawContactId : getGoogleRawContactIds(getContactId(contactUri))) {
Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
- Intent intent = new Intent(Intent.ACTION_VIEW);
+ Intent intent = new Intent();
+ intent.setAction("com.google.android.gms.people.sync.focus.SYNC_HIGH_RES_PHOTO");
intent.setComponent(SYNC_HIGH_RESOLUTION_PHOTO_SERVICE);
intent.setDataAndType(rawContactUri, RawContacts.CONTENT_ITEM_TYPE);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
@@ -89,7 +90,7 @@ public class HighResolutionPhotoRequesterImpl implements HighResolutionPhotoRequ
LogUtil.i(
"HighResolutionPhotoRequesterImpl.requestInternal",
"requesting photo for " + rawContactUri);
- appContext.startService(intent);
+ appContext.sendBroadcast(intent);
} catch (IllegalStateException | SecurityException e) {
throw new RequestFailedException("unable to start sync adapter", e);
}
diff --git a/java/com/android/dialer/notification/VoicemailChannelUtils.java b/java/com/android/dialer/notification/VoicemailChannelUtils.java
index 83bda0f18..ddc0f773c 100644
--- a/java/com/android/dialer/notification/VoicemailChannelUtils.java
+++ b/java/com/android/dialer/notification/VoicemailChannelUtils.java
@@ -16,8 +16,6 @@
package com.android.dialer.notification;
-import static java.nio.charset.StandardCharsets.UTF_8;
-
import android.Manifest.permission;
import android.annotation.TargetApi;
import android.app.NotificationChannel;
@@ -40,35 +38,15 @@ import android.util.ArraySet;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.util.PermissionsUtil;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/** Utilities for working with voicemail channels. */
@TargetApi(VERSION_CODES.O)
-public final class VoicemailChannelUtils {
+/* package */ final class VoicemailChannelUtils {
@VisibleForTesting static final String GLOBAL_VOICEMAIL_CHANNEL_ID = "phone_voicemail";
private static final String PER_ACCOUNT_VOICEMAIL_CHANNEL_ID_PREFIX = "phone_voicemail_account_";
- private static final char[] hexDigits = "0123456789abcdef".toCharArray();
-
- /**
- * Returns a String representation of the hashed value of the PhoneAccountHandle's id (the
- * Sim ICC ID).
- * In case it fails to hash the id it will return an empty string.
- */
- public static String getHashedPhoneAccountId(@NonNull PhoneAccountHandle handle) {
- byte[] handleBytes = handle.getId().getBytes(UTF_8);
- try {
- byte[] hashedBytes = MessageDigest.getInstance("SHA-256").digest(handleBytes);
- return byteArrayToHexString(hashedBytes);
- } catch (NoSuchAlgorithmException e) {
- LogUtil.e("VoicemailChannelUtils.getHashedPhoneAccountId",
- "NoSuchAlgorithmException throw! Returning empty string!");
- return "";
- }
- }
@SuppressWarnings("MissingPermission") // isSingleSimDevice() returns true if no permission
static Set<String> getAllChannelIds(@NonNull Context context) {
@@ -146,17 +124,7 @@ public final class VoicemailChannelUtils {
private static String getChannelIdForAccount(@NonNull PhoneAccountHandle handle) {
Assert.isNotNull(handle);
- return PER_ACCOUNT_VOICEMAIL_CHANNEL_ID_PREFIX
- + ":"
- + getHashedPhoneAccountId(handle);
- }
-
- private static String byteArrayToHexString(byte[] bytes) {
- StringBuilder sb = new StringBuilder(2 * bytes.length);
- for (byte b : bytes) {
- sb.append(hexDigits[(b >> 4) & 0xf]).append(hexDigits[b & 0xf]);
- }
- return sb.toString();
+ return PER_ACCOUNT_VOICEMAIL_CHANNEL_ID_PREFIX + ":" + handle.getId();
}
/**
diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java
index 99ff7255e..39428512b 100644
--- a/java/com/android/incallui/StatusBarNotifier.java
+++ b/java/com/android/incallui/StatusBarNotifier.java
@@ -18,6 +18,9 @@ package com.android.incallui;
import static android.telecom.Call.Details.PROPERTY_HIGH_DEF_AUDIO;
import static com.android.contacts.common.compat.CallCompat.Details.PROPERTY_ENTERPRISE_CALL;
+import static com.android.dialer.app.DevicePolicyResources.NOTIFICATION_INCOMING_WORK_CALL_TITLE;
+import static com.android.dialer.app.DevicePolicyResources.NOTIFICATION_ONGOING_WORK_CALL_TITLE;
+import static com.android.dialer.app.DevicePolicyResources.NOTIFICATION_WIFI_WORK_CALL_LABEL;
import static com.android.incallui.NotificationBroadcastReceiver.ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST;
import static com.android.incallui.NotificationBroadcastReceiver.ACTION_ANSWER_SPEAKEASY_CALL;
import static com.android.incallui.NotificationBroadcastReceiver.ACTION_ANSWER_VIDEO_INCOMING_CALL;
@@ -31,6 +34,7 @@ import static com.android.incallui.NotificationBroadcastReceiver.ACTION_TURN_ON_
import android.Manifest;
import android.app.Notification;
import android.app.PendingIntent;
+import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
@@ -677,6 +681,10 @@ public class StatusBarNotifier
call.getState() == DialerCallState.INCOMING
|| call.getState() == DialerCallState.CALL_WAITING;
+ // Is the call placed through work connection service.
+ boolean isWorkCall = call.hasProperty(PROPERTY_ENTERPRISE_CALL)
+ || userType == ContactsUtils.USER_TYPE_WORK;
+
if (isIncomingOrWaiting
&& call.getNumberPresentation() == TelecomManager.PRESENTATION_ALLOWED) {
@@ -687,54 +695,73 @@ public class StatusBarNotifier
}
}
- int resId = R.string.notification_ongoing_call;
- String wifiBrand = context.getString(R.string.notification_call_wifi_brand);
+
+ String message = getOngoingCallNotificationMessage(isWorkCall);
+ String wifiBrand = getWifiBrand(isWorkCall);
+
+ // TODO(a bug): Potentially apply this template logic everywhere.
if (call.hasProperty(Details.PROPERTY_WIFI)) {
- resId = R.string.notification_ongoing_call_wifi_template;
+ message = context.getString(R.string.notification_ongoing_call_wifi_template, wifiBrand);
}
if (isIncomingOrWaiting) {
if (call.isSpam()) {
- resId = R.string.notification_incoming_spam_call;
+ message = context.getString(R.string.notification_incoming_spam_call);
} else if (shouldShowEnrichedCallNotification(call.getEnrichedCallSession())) {
- resId = getECIncomingCallText(call.getEnrichedCallSession());
+ message = context.getString(getECIncomingCallText(call.getEnrichedCallSession()));
} else if (call.hasProperty(Details.PROPERTY_WIFI)) {
- resId = R.string.notification_incoming_call_wifi_template;
+ message = context.getString(R.string.notification_incoming_call_wifi_template, wifiBrand);
} else if (call.getAccountHandle() != null && hasMultiplePhoneAccounts(call)) {
return getMultiSimIncomingText(call);
} else if (call.isVideoCall()) {
- resId = R.string.notification_incoming_video_call;
+ message = context.getString(R.string.notification_incoming_video_call);
} else {
- resId = R.string.notification_incoming_call;
+ message = getIncomingCallNotificationMessage(isWorkCall);
}
} else if (call.getState() == DialerCallState.ONHOLD) {
- resId = R.string.notification_on_hold;
+ message = context.getString(R.string.notification_on_hold);
} else if (DialerCallState.isDialing(call.getState())) {
- resId = R.string.notification_dialing;
+ message = context.getString(R.string.notification_dialing);
} else if (call.isVideoCall()) {
- resId =
- call.getVideoTech().isPaused()
+ message = context.getString(call.getVideoTech().isPaused()
? R.string.notification_ongoing_paused_video_call
- : R.string.notification_ongoing_video_call;
+ : R.string.notification_ongoing_video_call);
} else if (call.getVideoTech().getSessionModificationState()
== SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
- resId = R.string.notification_requesting_video_call;
+ message = context.getString(R.string.notification_requesting_video_call);
}
- // Is the call placed through work connection service.
- boolean isWorkCall = call.hasProperty(PROPERTY_ENTERPRISE_CALL);
- if (userType == ContactsUtils.USER_TYPE_WORK || isWorkCall) {
- resId = getWorkStringFromPersonalString(resId);
- wifiBrand = context.getString(R.string.notification_call_wifi_work_brand);
+ return message;
+ }
+
+ private String getOngoingCallNotificationMessage(boolean isWorkCall) {
+ if (isWorkCall) {
+ DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
+ return dpm.getResources().getString(NOTIFICATION_ONGOING_WORK_CALL_TITLE, () ->
+ context.getString(R.string.notification_ongoing_work_call));
+ } else {
+ return context.getString(R.string.notification_ongoing_call);
}
+ }
- if (resId == R.string.notification_incoming_call_wifi_template
- || resId == R.string.notification_ongoing_call_wifi_template) {
- // TODO(a bug): Potentially apply this template logic everywhere.
- return context.getString(resId, wifiBrand);
+ private String getIncomingCallNotificationMessage(boolean isWorkCall) {
+ if (isWorkCall) {
+ DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
+ return dpm.getResources().getString(NOTIFICATION_INCOMING_WORK_CALL_TITLE, () ->
+ context.getString(R.string.notification_incoming_work_call));
+ } else {
+ return context.getString(R.string.notification_incoming_call);
}
+ }
- return context.getString(resId);
+ private String getWifiBrand(boolean isWorkCall) {
+ if (isWorkCall) {
+ DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
+ return dpm.getResources().getString(NOTIFICATION_WIFI_WORK_CALL_LABEL, () ->
+ context.getString(R.string.notification_call_wifi_work_brand));
+ } else {
+ return context.getString(R.string.notification_call_wifi_brand);
+ }
}
private boolean shouldShowEnrichedCallNotification(Session session) {
diff --git a/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java b/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java
index 335ec3e03..dd945e9a0 100644
--- a/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java
+++ b/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java
@@ -54,7 +54,7 @@ public class StatusSmsFetcher extends BroadcastReceiver implements Closeable {
private static final long STATUS_SMS_TIMEOUT_MILLIS = 60_000;
private static final String PERMISSION_DIALER_ORIGIN =
- "com.android.dialer.permission.DIALER_ORIGIN";
+ "com.android.dialer.permission.DIALER_ORIGIN";
private static final String ACTION_REQUEST_SENT_INTENT =
"com.android.voicemailomtp.sms.REQUEST_SENT";