summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweijiaxu <weijiaxu@google.com>2017-12-08 14:08:54 -0800
committerCopybara-Service <copybara-piper@google.com>2017-12-08 15:16:29 -0800
commita4c1acdf6686fef42d8ab914f98b392079109d08 (patch)
treec6ad73c1caff63a7b13feba330bd6c53f7d3a2d3
parent871113630c0de53938f635724b21e80414337ffd (diff)
Fix voicemail populator bug and change emergency call to emergency call back.
The voicemail populator bug was caused by missing Voicemail.PHONE_ACCOUNT_COMPONENT_NAME. Since we are making incoming emergency call by simulator. The name should be emergency call back. Bug: 70246587 Test: On a local device. PiperOrigin-RevId: 178424437 Change-Id: I471b2d19d1d431e2180a1f0481153831a9e51040
-rw-r--r--java/com/android/dialer/databasepopulator/VoicemailPopulator.java14
-rw-r--r--java/com/android/dialer/simulator/impl/SimulatorNotifications.java1
-rw-r--r--java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java5
3 files changed, 16 insertions, 4 deletions
diff --git a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
index b1f8d1fe4..97f6b0a32 100644
--- a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
+++ b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
@@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit;
/** Populates the device database with voicemail entries. */
public final class VoicemailPopulator {
private static final String ACCOUNT_ID = "ACCOUNT_ID";
-
+ private static String componentName = "";
private static final Voicemail.Builder[] SIMPLE_VOICEMAILS = {
// Long transcription with an embedded phone number.
Voicemail.builder()
@@ -48,6 +48,7 @@ public final class VoicemailPopulator {
+ "I hope you listen to all of it. This is very important. "
+ "Hi, this is a very long voicemail. "
+ "I hope you listen to all of it. It's very important.")
+ .setPhoneAccountComponentName(componentName)
.setDurationSeconds(10)
.setIsRead(false),
// RTL transcription.
@@ -55,24 +56,28 @@ public final class VoicemailPopulator {
.setPhoneNumber("+1-302-6365454")
.setTranscription("هزاران دوست کم اند و یک دشمن زیاد")
.setDurationSeconds(60)
+ .setPhoneAccountComponentName(componentName)
.setIsRead(true),
// Empty number.
Voicemail.builder()
.setPhoneNumber("")
.setTranscription("")
.setDurationSeconds(60)
+ .setPhoneAccountComponentName(componentName)
.setIsRead(true),
// No duration.
Voicemail.builder()
.setPhoneNumber("+1-302-6365454")
.setTranscription("")
.setDurationSeconds(0)
+ .setPhoneAccountComponentName(componentName)
.setIsRead(true),
// Short number.
Voicemail.builder()
.setPhoneNumber("711")
.setTranscription("This is a short voicemail.")
.setDurationSeconds(12)
+ .setPhoneAccountComponentName(componentName)
.setIsRead(true),
};
@@ -118,7 +123,7 @@ public final class VoicemailPopulator {
public static void enableVoicemail(@NonNull Context context) {
PhoneAccountHandle handle =
new PhoneAccountHandle(new ComponentName(context, VoicemailPopulator.class), ACCOUNT_ID);
-
+ componentName = handle.getComponentName().toString();
ContentValues values = new ContentValues();
values.put(Status.SOURCE_PACKAGE, handle.getComponentName().getPackageName());
if (VERSION.SDK_INT >= VERSION_CODES.N_MR1) {
@@ -147,6 +152,8 @@ public final class VoicemailPopulator {
public abstract boolean getIsRead();
+ public abstract String getPhoneAccountComponentName();
+
public static Builder builder() {
return new AutoValue_VoicemailPopulator_Voicemail.Builder();
}
@@ -159,6 +166,7 @@ public final class VoicemailPopulator {
values.put(Voicemails.SOURCE_PACKAGE, context.getPackageName());
values.put(Voicemails.IS_READ, getIsRead() ? 1 : 0);
values.put(Voicemails.TRANSCRIPTION, getTranscription());
+ values.put(Voicemails.PHONE_ACCOUNT_COMPONENT_NAME, getPhoneAccountComponentName());
return values;
}
@@ -175,6 +183,8 @@ public final class VoicemailPopulator {
public abstract Builder setIsRead(boolean isRead);
+ public abstract Builder setPhoneAccountComponentName(String phoneAccountComponentName);
+
public abstract Voicemail build();
}
}
diff --git a/java/com/android/dialer/simulator/impl/SimulatorNotifications.java b/java/com/android/dialer/simulator/impl/SimulatorNotifications.java
index 4ed7c9b8f..a243c34c3 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorNotifications.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorNotifications.java
@@ -56,6 +56,7 @@ final class SimulatorNotifications {
.setTranscription(String.format("Short transcript %d", i))
.setDurationSeconds(60)
.setIsRead(false)
+ .setPhoneAccountComponentName("")
.setTimeMillis(System.currentTimeMillis() - TimeUnit.HOURS.toMillis(i))
.build();
voicemails.add(voicemail.getAsContentValues(context));
diff --git a/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java b/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java
index 451896b73..9ffcfc8a8 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorVoiceCall.java
@@ -39,7 +39,8 @@ final class SimulatorVoiceCall
.addItem("Incoming call", () -> new SimulatorVoiceCall(context).addNewIncomingCall(false))
.addItem("Outgoing call", () -> new SimulatorVoiceCall(context).addNewOutgoingCall())
.addItem("Spam call", () -> new SimulatorVoiceCall(context).addNewIncomingCall(true))
- .addItem("Emergency call", () -> new SimulatorVoiceCall(context).addNewEmergencyCall())
+ .addItem(
+ "Emergency call back", () -> new SimulatorVoiceCall(context).addNewEmergencyCallBack())
.addItem(
"GSM conference",
() -> new SimulatorConferenceCreator(context, Simulator.CONFERENCE_TYPE_GSM).start(5))
@@ -71,7 +72,7 @@ final class SimulatorVoiceCall
SimulatorSimCallManager.addNewOutgoingCall(context, callerId, false /* isVideo */);
}
- private void addNewEmergencyCall() {
+ private void addNewEmergencyCallBack() {
String callerId = "911";
connectionTag = SimulatorSimCallManager.addNewIncomingCall(context, callerId, false);
}