summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/spam
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/incallui/spam')
-rw-r--r--java/com/android/incallui/spam/AndroidManifest.xml41
-rw-r--r--java/com/android/incallui/spam/SpamCallListListener.java13
-rw-r--r--java/com/android/incallui/spam/SpamNotificationActivity.java5
-rw-r--r--java/com/android/incallui/spam/res/drawable/spam_notification_icon.xml34
-rw-r--r--java/com/android/incallui/spam/res/values/strings.xml54
5 files changed, 137 insertions, 10 deletions
diff --git a/java/com/android/incallui/spam/AndroidManifest.xml b/java/com/android/incallui/spam/AndroidManifest.xml
new file mode 100644
index 000000000..46319a6c1
--- /dev/null
+++ b/java/com/android/incallui/spam/AndroidManifest.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 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
+ -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.incallui.autoresizetext">
+
+ <application>
+ <!--
+ Comments for attributes in SpamNotificationActivity:
+ taskAffinity="" -> Open the dialog without opening the dialer app behind it
+ noHistory="true" -> Navigating away finishes activity
+ excludeFromRecents="true" -> Don't show in "recent apps" screen
+ -->
+ <activity
+ android:excludeFromRecents="true"
+ android:exported="false"
+ android:name=".SpamNotificationActivity"
+ android:noHistory="true"
+ android:taskAffinity=""
+ android:theme="@style/AfterCallNotificationTheme">
+ </activity>
+
+ <service
+ android:exported="false"
+ android:name=".SpamNotificationService"/>
+
+ </application>
+</manifest>
diff --git a/java/com/android/incallui/spam/SpamCallListListener.java b/java/com/android/incallui/spam/SpamCallListListener.java
index 997d4d6bc..f8bc9cebe 100644
--- a/java/com/android/incallui/spam/SpamCallListListener.java
+++ b/java/com/android/incallui/spam/SpamCallListListener.java
@@ -50,7 +50,6 @@ import com.android.dialer.notification.NotificationChannelId;
import com.android.dialer.spam.Spam;
import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.util.PermissionsUtil;
-import com.android.incallui.R;
import com.android.incallui.call.CallList;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.DialerCall.CallHistoryStatus;
@@ -90,7 +89,7 @@ public class SpamCallListListener implements CallList.Listener {
/** Checks if the number is in the call history. */
@TargetApi(VERSION_CODES.M)
- private final class NumberInCallHistoryWorker implements Worker<Void, Integer> {
+ private static final class NumberInCallHistoryWorker implements Worker<Void, Integer> {
private final Context appContext;
private final String number;
@@ -262,7 +261,7 @@ public class SpamCallListListener implements CallList.Listener {
.setCategory(Notification.CATEGORY_STATUS)
.setPriority(Notification.PRIORITY_DEFAULT)
.setColor(context.getColor(R.color.dialer_theme_color))
- .setSmallIcon(R.drawable.ic_call_end_white_24dp)
+ .setSmallIcon(R.drawable.quantum_ic_call_end_vd_theme_24)
.setGroup(GROUP_KEY);
if (BuildCompat.isAtLeastO()) {
builder.setChannelId(NotificationChannelId.DEFAULT);
@@ -289,7 +288,7 @@ public class SpamCallListListener implements CallList.Listener {
// Add contact
.addAction(
new Notification.Action.Builder(
- R.drawable.ic_person_add_grey600_24dp,
+ R.drawable.quantum_ic_person_add_vd_theme_24,
context.getString(R.string.spam_notification_add_contact_action_text),
createActivityPendingIntent(
call, SpamNotificationActivity.ACTION_ADD_TO_CONTACTS))
@@ -297,7 +296,7 @@ public class SpamCallListListener implements CallList.Listener {
// Block/report spam
.addAction(
new Notification.Action.Builder(
- R.drawable.ic_block_grey600_24dp,
+ R.drawable.quantum_ic_block_vd_theme_24,
context.getString(R.string.spam_notification_report_spam_action_text),
createBlockReportSpamPendingIntent(call))
.build())
@@ -401,14 +400,14 @@ public class SpamCallListListener implements CallList.Listener {
// Not spam
.addAction(
new Notification.Action.Builder(
- R.drawable.ic_close_grey600_24dp,
+ R.drawable.quantum_ic_close_vd_theme_24,
context.getString(R.string.spam_notification_not_spam_action_text),
createNotSpamPendingIntent(call))
.build())
// Block/report spam
.addAction(
new Notification.Action.Builder(
- R.drawable.ic_block_grey600_24dp,
+ R.drawable.quantum_ic_block_vd_theme_24,
context.getString(R.string.spam_notification_block_spam_action_text),
createBlockReportSpamPendingIntent(call))
.build())
diff --git a/java/com/android/incallui/spam/SpamNotificationActivity.java b/java/com/android/incallui/spam/SpamNotificationActivity.java
index 160db2622..86988ad23 100644
--- a/java/com/android/incallui/spam/SpamNotificationActivity.java
+++ b/java/com/android/incallui/spam/SpamNotificationActivity.java
@@ -39,7 +39,6 @@ import com.android.dialer.logging.Logger;
import com.android.dialer.logging.ReportingLocation;
import com.android.dialer.notification.DialerNotificationManager;
import com.android.dialer.spam.Spam;
-import com.android.incallui.R;
import com.android.incallui.call.DialerCall;
/** Creates the after call notification dialogs. */
@@ -374,7 +373,7 @@ public class SpamNotificationActivity extends FragmentActivity {
.setTitle(getString(R.string.spam_notification_title, getFormattedNumber(number)))
.setMessage(getString(R.string.spam_notification_spam_call_expanded_text))
.setNeutralButton(
- getString(R.string.notification_action_dismiss),
+ getString(R.string.spam_notification_action_dismiss),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
@@ -460,7 +459,7 @@ public class SpamNotificationActivity extends FragmentActivity {
.setCancelable(false)
.setMessage(getString(R.string.spam_notification_non_spam_call_expanded_text))
.setNeutralButton(
- getString(R.string.notification_action_dismiss),
+ getString(R.string.spam_notification_action_dismiss),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
diff --git a/java/com/android/incallui/spam/res/drawable/spam_notification_icon.xml b/java/com/android/incallui/spam/res/drawable/spam_notification_icon.xml
new file mode 100644
index 000000000..a414428cb
--- /dev/null
+++ b/java/com/android/incallui/spam/res/drawable/spam_notification_icon.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ Copyright (C) 2016 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
+ -->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item>
+ <shape android:shape="oval">
+ <solid android:color="@color/incall_call_spam_background_color"/>
+ <size
+ android:height="@android:dimen/notification_large_icon_height"
+ android:width="@android:dimen/notification_large_icon_width"/>
+ </shape>
+ </item>
+
+ <item
+ android:drawable="@drawable/quantum_ic_report_white_36"
+ android:gravity="center"/>
+
+</layer-list>
diff --git a/java/com/android/incallui/spam/res/values/strings.xml b/java/com/android/incallui/spam/res/values/strings.xml
new file mode 100644
index 000000000..02e7225a0
--- /dev/null
+++ b/java/com/android/incallui/spam/res/values/strings.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2017 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
+ -->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- Title for the notification to the user after a call from an unknown number ends. [CHAR LIMIT=100] -->
+ <string name="non_spam_notification_title">Know <xliff:g id="number">%1$s</xliff:g>?</string>
+ <!-- Title for the notification to the user after a call from an spammer ends. [CHAR LIMIT=100] -->
+ <string name="spam_notification_title">Is <xliff:g id="number">%1$s</xliff:g> spam?</string>
+ <!-- Text for the toast shown after the user presses block/report spam. [CHAR LIMIT=100] -->
+ <string name="spam_notification_block_report_toast_text"><xliff:g id="number">%1$s</xliff:g> blocked and call was reported as spam.</string>
+ <!-- Text for the toast shown after the user presses not spam. [CHAR LIMIT=100] -->
+ <string name="spam_notification_not_spam_toast_text">Call from <xliff:g id="number">%1$s</xliff:g> reported as not spam.</string>
+ <!-- Text displayed in the collapsed notification to the user after a non-spam call ends. [CHAR LIMIT=100] -->
+ <string name="spam_notification_non_spam_call_collapsed_text">Tap to add to contacts or block spam number.</string>
+ <!-- Text displayed in the expanded notification to the user after a non-spam call ends. [CHAR LIMIT=NONE] -->
+ <string name="spam_notification_non_spam_call_expanded_text">This is the first time this number called you. If this call was spam, you can block this number and report it.</string>
+ <!-- Text displayed in the collapsed notification to the user after a spam call ends. [CHAR LIMIT=100] -->
+ <string name="spam_notification_spam_call_collapsed_text">Tap to report as NOT SPAM, or block it.</string>
+ <!-- Text displayed in the expanded notification to the user after a spam call ends. [CHAR LIMIT=NONE] -->
+ <string name="spam_notification_spam_call_expanded_text">We suspected this to be a spammer. If this call wasn\'t spam, tap "NOT SPAM" to report our mistake.</string>
+ <!-- Text for the reporting spam action in the after call prompt. [CHAR LIMIT=20] -->
+ <string name="spam_notification_report_spam_action_text">Block &amp; report</string>
+ <!-- Text for the adding to contacts action in the after call prompt. [CHAR LIMIT=20] -->
+ <string name="spam_notification_add_contact_action_text">Add contact</string>
+ <!-- Text for the reporting as not spam action in the after call prompt. [CHAR LIMIT=20] -->
+ <string name="spam_notification_not_spam_action_text">Not spam</string>
+ <!-- Text for the blocking spam action in the after call prompt. [CHAR LIMIT=20] -->
+ <string name="spam_notification_block_spam_action_text">Block number</string>
+ <!-- Text for the adding to contacts action in the after call dialog. [CHAR LIMIT=40] -->
+ <string name="spam_notification_dialog_add_contact_action_text">Add to contacts</string>
+ <!-- Text for the blocking and reporting spam action in the after call dialog. [CHAR LIMIT=40] -->
+ <string name="spam_notification_dialog_block_report_spam_action_text">Block &amp; report spam</string>
+ <!-- Text for the marking a call as not spam in the after call dialog. [CHAR LIMIT=40] -->
+ <string name="spam_notification_dialog_was_not_spam_action_text">Not spam</string>
+
+ <!-- Label for "Dismiss" notification action. [CHAR LIMIT=12] -->
+ <string name="spam_notification_action_dismiss">Decline</string>
+
+</resources>