summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/call/TelecomAdapter.java
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-10-04 16:48:55 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-10-04 16:48:55 +0000
commitbc07ed7f31845b0565990999e90510c90e8dad9b (patch)
treeade09fe638ed0dc2bf65bd64fa6d68a4e51a0b82 /java/com/android/incallui/call/TelecomAdapter.java
parent69ff7c1717c363027a79a454da91e1ca59c1dd3e (diff)
parent5ee0b1e574ed93c7000e355e4a6b03fb9ed8aaba (diff)
Merge changes Ibf79b70e,Iab1415b0
* changes: Only show the most recent call type icon in the new call log, instead of the last 3. Make incoming and ongoing call notification foreground and highest priority.
Diffstat (limited to 'java/com/android/incallui/call/TelecomAdapter.java')
-rw-r--r--java/com/android/incallui/call/TelecomAdapter.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/java/com/android/incallui/call/TelecomAdapter.java b/java/com/android/incallui/call/TelecomAdapter.java
index 005278bff..0c0bbd473 100644
--- a/java/com/android/incallui/call/TelecomAdapter.java
+++ b/java/com/android/incallui/call/TelecomAdapter.java
@@ -16,12 +16,14 @@
package com.android.incallui.call;
+import android.app.Notification;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Looper;
import android.support.annotation.MainThread;
import android.support.annotation.VisibleForTesting;
import android.telecom.InCallService;
+import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import java.util.List;
@@ -167,4 +169,24 @@ public class TelecomAdapter implements InCallServiceListener {
}
return false;
}
+
+ /**
+ * Start a foreground notification. Calling it multiple times with the same id only updates the
+ * existing notification. Whoever called this function are responsible for calling {@link
+ * #stopForegroundNotification()} to remove the notification.
+ */
+ public void startForegroundNotification(int id, Notification notification) {
+ Assert.isNotNull(
+ mInCallService, "No inCallService available for starting foreground notification");
+ mInCallService.startForeground(id, notification);
+ }
+
+ /**
+ * Stop a started foreground notification. This does not stop {@code mInCallService} from running.
+ */
+ public void stopForegroundNotification() {
+ Assert.isNotNull(
+ mInCallService, "No inCallService available for stopping foreground notification");
+ mInCallService.stopForeground(true /*removeNotification*/);
+ }
}