aboutsummaryrefslogtreecommitdiff
path: root/java/com/android/dialer/app
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/dialer/app')
-rw-r--r--java/com/android/dialer/app/AndroidManifest.xml7
-rw-r--r--java/com/android/dialer/app/DevicePolicyResources.java54
-rw-r--r--java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java2
-rw-r--r--java/com/android/dialer/app/calllog/IntentProvider.java5
-rw-r--r--java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java1
-rw-r--r--java/com/android/dialer/app/calllog/MissedCallNotifier.java22
-rw-r--r--java/com/android/dialer/app/list/PhoneFavoriteTileView.java2
7 files changed, 78 insertions, 15 deletions
diff --git a/java/com/android/dialer/app/AndroidManifest.xml b/java/com/android/dialer/app/AndroidManifest.xml
index 190f098a5..ade5bd447 100644
--- a/java/com/android/dialer/app/AndroidManifest.xml
+++ b/java/com/android/dialer/app/AndroidManifest.xml
@@ -56,7 +56,7 @@
<uses-sdk
android:minSdkVersion="24"
- android:targetSdkVersion="28"/>
+ android:targetSdkVersion="30"/>
<application>
@@ -78,7 +78,8 @@
android:theme="@style/DialtactsTheme">
</activity>
- <receiver android:name="com.android.dialer.app.calllog.CallLogReceiver">
+ <receiver android:name="com.android.dialer.app.calllog.CallLogReceiver"
+ android:exported="true">
<intent-filter>
<action android:name="android.intent.action.NEW_VOICEMAIL"/>
<data
@@ -115,6 +116,7 @@
<receiver
android:directBootAware="true"
+ android:exported="true"
android:name="com.android.dialer.app.calllog.MissedCallNotificationReceiver">
<intent-filter>
<action android:name="android.telecom.action.SHOW_MISSED_CALLS_NOTIFICATION"/>
@@ -122,6 +124,7 @@
</receiver>
<!-- Handles voicemail notifications from telephony. Requires O -->
<receiver android:name=".voicemail.LegacyVoicemailNotificationReceiver"
+ android:exported="true"
android:directBootAware="true">
<intent-filter>
<action android:name="android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION"/>
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/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
index e044460c5..05011d102 100644
--- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
+++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
@@ -560,7 +560,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
case CallbackAction.VOICE:
if (callLogCache.isVoicemailNumber(accountHandle, number)) {
// Call to generic voicemail number, in case there are multiple accounts
- primaryActionButtonView.setTag(IntentProvider.getReturnVoicemailCallIntentProvider(null));
+ primaryActionButtonView.setTag(IntentProvider.getReturnVoicemailCallIntentProvider());
} else if (canSupportAssistedDialing()) {
primaryActionButtonView.setTag(
IntentProvider.getAssistedDialIntentProvider(
diff --git a/java/com/android/dialer/app/calllog/IntentProvider.java b/java/com/android/dialer/app/calllog/IntentProvider.java
index 21f341815..423b49c22 100644
--- a/java/com/android/dialer/app/calllog/IntentProvider.java
+++ b/java/com/android/dialer/app/calllog/IntentProvider.java
@@ -161,14 +161,13 @@ public abstract class IntentProvider {
};
}
- public static IntentProvider getReturnVoicemailCallIntentProvider(
- @Nullable PhoneAccountHandle phoneAccountHandle) {
+ public static IntentProvider getReturnVoicemailCallIntentProvider() {
return new IntentProvider() {
@Override
public Intent getIntent(Context context) {
return PreCall.getIntent(
context,
- CallIntentBuilder.forVoicemail(phoneAccountHandle, CallInitiationType.Type.CALL_LOG));
+ CallIntentBuilder.forVoicemail(CallInitiationType.Type.CALL_LOG));
}
};
}
diff --git a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java
index 31e9edc6a..62ae748de 100644
--- a/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java
+++ b/java/com/android/dialer/app/calllog/LegacyVoicemailNotifier.java
@@ -181,6 +181,7 @@ public final class LegacyVoicemailNotifier {
if (context.getSystemService(TelephonyManager.class).getPhoneCount() <= 1) {
return NOTIFICATION_TAG;
}
+
return NOTIFICATION_TAG_PREFIX + phoneAccountHandle.getId();
}
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/app/list/PhoneFavoriteTileView.java b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
index f9f8e0e5e..7f0a6bcd5 100644
--- a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
+++ b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
@@ -57,7 +57,7 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
// make room for the contact name and number label at the bottom of the image.
private static final float DEFAULT_IMAGE_LETTER_OFFSET = -0.12f;
private static final float DEFAULT_IMAGE_LETTER_SCALE = 0.70f;
- // Dummy clip data object that is attached to drag shadows so that text views
+ // Placeholder clip data object that is attached to drag shadows so that text views
// don't crash with an NPE if the drag shadow is released in their bounds
private static final ClipData EMPTY_CLIP_DATA = ClipData.newPlainText("", "");
/** View that contains the transparent shadow that is overlaid on top of the contact image. */