summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2017-09-14 01:45:32 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-09-14 01:45:32 +0000
commite1d75df0579d29102575edff311b33dbd7449a83 (patch)
tree3c6132fb44e126272438f7eadd9b96b9b62ae845
parentdc29967441cf2c9e8e601f24e32ceab1709564ad (diff)
parentebbbd40d10dd9b43a5e8af8aea1184bc80b9951f (diff)
Merge "Setup SMS filter even if VVM is already activated"
am: ebbbd40d10 Change-Id: Ifba3beef2068539da94eed51eeadfb8130f0d505
-rw-r--r--java/com/android/dialer/enrichedcall/videoshare/VideoShareListener.java4
-rw-r--r--java/com/android/dialer/lightbringer/Lightbringer.java2
-rw-r--r--java/com/android/dialer/lightbringer/stub/LightbringerStub.java2
-rw-r--r--java/com/android/incallui/AnswerScreenPresenter.java2
-rw-r--r--java/com/android/incallui/CallButtonPresenter.java4
-rw-r--r--java/com/android/incallui/NotificationBroadcastReceiver.java2
-rw-r--r--java/com/android/incallui/videotech/VideoTech.java7
-rw-r--r--java/com/android/incallui/videotech/empty/EmptyVideoTech.java7
-rw-r--r--java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java8
-rw-r--r--java/com/android/incallui/videotech/ims/ImsVideoTech.java9
-rw-r--r--java/com/android/incallui/videotech/lightbringer/LightbringerTech.java16
-rw-r--r--java/com/android/voicemail/impl/ActivationTask.java21
-rw-r--r--java/com/android/voicemail/impl/settings/VisualVoicemailSettingsUtil.java3
13 files changed, 48 insertions, 39 deletions
diff --git a/java/com/android/dialer/enrichedcall/videoshare/VideoShareListener.java b/java/com/android/dialer/enrichedcall/videoshare/VideoShareListener.java
index 0e5f79f2b..a7d656a0a 100644
--- a/java/com/android/dialer/enrichedcall/videoshare/VideoShareListener.java
+++ b/java/com/android/dialer/enrichedcall/videoshare/VideoShareListener.java
@@ -16,7 +16,9 @@
package com.android.dialer.enrichedcall.videoshare;
+import android.content.Context;
import android.support.annotation.MainThread;
+import android.support.annotation.NonNull;
/** Receives updates when video share status has changed. */
public interface VideoShareListener {
@@ -26,5 +28,5 @@ public interface VideoShareListener {
* invite received or canceled, or when a session changes).
*/
@MainThread
- void onVideoShareChanged();
+ void onVideoShareChanged(@NonNull Context context);
}
diff --git a/java/com/android/dialer/lightbringer/Lightbringer.java b/java/com/android/dialer/lightbringer/Lightbringer.java
index 9120b24db..fa57b0166 100644
--- a/java/com/android/dialer/lightbringer/Lightbringer.java
+++ b/java/com/android/dialer/lightbringer/Lightbringer.java
@@ -40,7 +40,7 @@ public interface Lightbringer {
Intent getIntent(@NonNull Context context, @NonNull String number);
@MainThread
- void requestUpgrade(Call call);
+ void requestUpgrade(@NonNull Context context, Call call);
@MainThread
void registerListener(@NonNull LightbringerListener listener);
diff --git a/java/com/android/dialer/lightbringer/stub/LightbringerStub.java b/java/com/android/dialer/lightbringer/stub/LightbringerStub.java
index c98ae091b..a0309220a 100644
--- a/java/com/android/dialer/lightbringer/stub/LightbringerStub.java
+++ b/java/com/android/dialer/lightbringer/stub/LightbringerStub.java
@@ -67,7 +67,7 @@ public class LightbringerStub implements Lightbringer {
@MainThread
@Override
- public void requestUpgrade(Call call) {
+ public void requestUpgrade(@NonNull Context context, Call call) {
Assert.isMainThread();
Assert.isNotNull(call);
}
diff --git a/java/com/android/incallui/AnswerScreenPresenter.java b/java/com/android/incallui/AnswerScreenPresenter.java
index d53040145..58231d52b 100644
--- a/java/com/android/incallui/AnswerScreenPresenter.java
+++ b/java/com/android/incallui/AnswerScreenPresenter.java
@@ -104,7 +104,7 @@ public class AnswerScreenPresenter
DialerImpression.Type.VIDEO_CALL_REQUEST_ACCEPTED,
call.getUniqueCallId(),
call.getTimeAddedMs());
- call.getVideoTech().acceptVideoRequest();
+ call.getVideoTech().acceptVideoRequest(context);
}
} else {
if (answerVideoAsAudio) {
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java
index 658ae649b..bd5bb78c9 100644
--- a/java/com/android/incallui/CallButtonPresenter.java
+++ b/java/com/android/incallui/CallButtonPresenter.java
@@ -294,7 +294,7 @@ public class CallButtonPresenter
DialerImpression.Type.VIDEO_CALL_UPGRADE_REQUESTED,
mCall.getUniqueCallId(),
mCall.getTimeAddedMs());
- mCall.getVideoTech().upgradeToVideo();
+ mCall.getVideoTech().upgradeToVideo(mContext);
}
@Override
@@ -360,7 +360,7 @@ public class CallButtonPresenter
} else {
updateCamera(
InCallPresenter.getInstance().getInCallCameraManager().isUsingFrontFacingCamera());
- mCall.getVideoTech().resumeTransmission();
+ mCall.getVideoTech().resumeTransmission(mContext);
}
mInCallButtonUi.setVideoPaused(pause);
diff --git a/java/com/android/incallui/NotificationBroadcastReceiver.java b/java/com/android/incallui/NotificationBroadcastReceiver.java
index 5e757cf01..0daa017d7 100644
--- a/java/com/android/incallui/NotificationBroadcastReceiver.java
+++ b/java/com/android/incallui/NotificationBroadcastReceiver.java
@@ -95,7 +95,7 @@ public class NotificationBroadcastReceiver extends BroadcastReceiver {
} else {
DialerCall call = callList.getVideoUpgradeRequestCall();
if (call != null) {
- call.getVideoTech().acceptVideoRequest();
+ call.getVideoTech().acceptVideoRequest(context);
}
}
}
diff --git a/java/com/android/incallui/videotech/VideoTech.java b/java/com/android/incallui/videotech/VideoTech.java
index 79a8c605c..e3753bc65 100644
--- a/java/com/android/incallui/videotech/VideoTech.java
+++ b/java/com/android/incallui/videotech/VideoTech.java
@@ -17,6 +17,7 @@
package com.android.incallui.videotech;
import android.content.Context;
+import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.android.dialer.logging.DialerImpression;
import com.android.incallui.video.protocol.VideoCallScreen;
@@ -48,9 +49,9 @@ public interface VideoTech {
@SessionModificationState
int getSessionModificationState();
- void upgradeToVideo();
+ void upgradeToVideo(@NonNull Context context);
- void acceptVideoRequest();
+ void acceptVideoRequest(@NonNull Context context);
void acceptVideoRequestAsAudio();
@@ -60,7 +61,7 @@ public interface VideoTech {
void stopTransmission();
- void resumeTransmission();
+ void resumeTransmission(@NonNull Context context);
void pause();
diff --git a/java/com/android/incallui/videotech/empty/EmptyVideoTech.java b/java/com/android/incallui/videotech/empty/EmptyVideoTech.java
index 34dd1bf8b..76766dfe8 100644
--- a/java/com/android/incallui/videotech/empty/EmptyVideoTech.java
+++ b/java/com/android/incallui/videotech/empty/EmptyVideoTech.java
@@ -17,6 +17,7 @@
package com.android.incallui.videotech.empty;
import android.content.Context;
+import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.android.dialer.common.Assert;
import com.android.incallui.video.protocol.VideoCallScreen;
@@ -65,10 +66,10 @@ public class EmptyVideoTech implements VideoTech {
}
@Override
- public void upgradeToVideo() {}
+ public void upgradeToVideo(@NonNull Context context) {}
@Override
- public void acceptVideoRequest() {}
+ public void acceptVideoRequest(@NonNull Context context) {}
@Override
public void acceptVideoRequestAsAudio() {}
@@ -85,7 +86,7 @@ public class EmptyVideoTech implements VideoTech {
public void stopTransmission() {}
@Override
- public void resumeTransmission() {}
+ public void resumeTransmission(@NonNull Context context) {}
@Override
public void pause() {}
diff --git a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java
index 49170b8dc..954dfcd8b 100644
--- a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java
+++ b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java
@@ -16,6 +16,7 @@
package com.android.incallui.videotech.ims;
+import android.content.Context;
import android.os.Handler;
import android.telecom.Call;
import android.telecom.Connection;
@@ -37,17 +38,20 @@ public class ImsVideoCallCallback extends VideoCall.Callback {
private final Call call;
private final ImsVideoTech videoTech;
private final VideoTechListener listener;
+ private final Context context;
private int requestedVideoState = VideoProfile.STATE_AUDIO_ONLY;
ImsVideoCallCallback(
final LoggingBindings logger,
final Call call,
ImsVideoTech videoTech,
- VideoTechListener listener) {
+ VideoTechListener listener,
+ Context context) {
this.logger = logger;
this.call = call;
this.videoTech = videoTech;
this.listener = listener;
+ this.context = context;
}
@Override
@@ -74,7 +78,7 @@ public class ImsVideoCallCallback extends VideoCall.Callback {
} else {
LogUtil.i(
"ImsVideoTech.onSessionModifyRequestReceived", "call updated to %d", newVideoState);
- videoTech.acceptVideoRequest();
+ videoTech.acceptVideoRequest(context);
}
}
}
diff --git a/java/com/android/incallui/videotech/ims/ImsVideoTech.java b/java/com/android/incallui/videotech/ims/ImsVideoTech.java
index fec05dc55..c12474dc3 100644
--- a/java/com/android/incallui/videotech/ims/ImsVideoTech.java
+++ b/java/com/android/incallui/videotech/ims/ImsVideoTech.java
@@ -18,6 +18,7 @@ package com.android.incallui.videotech.ims;
import android.content.Context;
import android.os.Build;
+import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.telecom.Call;
import android.telecom.Call.Details;
@@ -120,7 +121,7 @@ public class ImsVideoTech implements VideoTech {
}
if (callback == null) {
- callback = new ImsVideoCallCallback(logger, call, this, listener);
+ callback = new ImsVideoCallCallback(logger, call, this, listener, context);
call.getVideoCall().registerCallback(callback);
}
@@ -165,7 +166,7 @@ public class ImsVideoTech implements VideoTech {
}
@Override
- public void upgradeToVideo() {
+ public void upgradeToVideo(@NonNull Context context) {
LogUtil.enterBlock("ImsVideoTech.upgradeToVideo");
int unpausedVideoState = getUnpausedVideoState(call.getDetails().getVideoState());
@@ -177,7 +178,7 @@ public class ImsVideoTech implements VideoTech {
}
@Override
- public void acceptVideoRequest() {
+ public void acceptVideoRequest(@NonNull Context context) {
int requestedVideoState = callback.getRequestedVideoState();
Assert.checkArgument(requestedVideoState != VideoProfile.STATE_AUDIO_ONLY);
LogUtil.i("ImsVideoTech.acceptUpgradeRequest", "videoState: " + requestedVideoState);
@@ -223,7 +224,7 @@ public class ImsVideoTech implements VideoTech {
}
@Override
- public void resumeTransmission() {
+ public void resumeTransmission(@NonNull Context context) {
LogUtil.enterBlock("ImsVideoTech.resumeTransmission");
transmissionStopped = false;
diff --git a/java/com/android/incallui/videotech/lightbringer/LightbringerTech.java b/java/com/android/incallui/videotech/lightbringer/LightbringerTech.java
index 4882ba879..a807759db 100644
--- a/java/com/android/incallui/videotech/lightbringer/LightbringerTech.java
+++ b/java/com/android/incallui/videotech/lightbringer/LightbringerTech.java
@@ -21,7 +21,6 @@ import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.telecom.Call;
-import com.android.contacts.common.compat.telecom.TelecomManagerCompat;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.configprovider.ConfigProviderBindings;
@@ -55,7 +54,7 @@ public class LightbringerTech implements VideoTech, LightbringerListener {
@Override
public boolean isAvailable(Context context) {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
LogUtil.v("LightbringerTech.isAvailable", "upgrade unavailable, only supported on O+");
return false;
}
@@ -71,11 +70,6 @@ public class LightbringerTech implements VideoTech, LightbringerListener {
return false;
}
- if (!TelecomManagerCompat.supportsHandover()) {
- LogUtil.v("LightbringerTech.isAvailable", "upgrade unavailable, telephony support missing");
- return false;
- }
-
if (!lightbringer.supportsUpgrade(context, callingNumber)) {
LogUtil.v("LightbringerTech.isAvailable", "upgrade unavailable, number does not support it");
return false;
@@ -125,13 +119,13 @@ public class LightbringerTech implements VideoTech, LightbringerListener {
}
@Override
- public void upgradeToVideo() {
+ public void upgradeToVideo(@NonNull Context context) {
listener.onImpressionLoggingNeeded(DialerImpression.Type.LIGHTBRINGER_UPGRADE_REQUESTED);
- lightbringer.requestUpgrade(call);
+ lightbringer.requestUpgrade(context, call);
}
@Override
- public void acceptVideoRequest() {
+ public void acceptVideoRequest(@NonNull Context context) {
throw Assert.createUnsupportedOperationFailException();
}
@@ -156,7 +150,7 @@ public class LightbringerTech implements VideoTech, LightbringerListener {
}
@Override
- public void resumeTransmission() {
+ public void resumeTransmission(@NonNull Context context) {
throw Assert.createUnsupportedOperationFailException();
}
diff --git a/java/com/android/voicemail/impl/ActivationTask.java b/java/com/android/voicemail/impl/ActivationTask.java
index d7a122ce3..29c91e01e 100644
--- a/java/com/android/voicemail/impl/ActivationTask.java
+++ b/java/com/android/voicemail/impl/ActivationTask.java
@@ -170,7 +170,9 @@ public class ActivationTask extends BaseTask {
if (VvmAccountManager.isAccountActivated(getContext(), phoneAccountHandle)) {
VvmLog.i(TAG, "Account is already activated");
- onSuccess(getContext(), phoneAccountHandle);
+ // The activated state might come from restored data, the filter still needs to be set up.
+ helper.activateSmsFilter();
+ onSuccess(getContext(), phoneAccountHandle, helper);
return;
}
helper.handleEvent(
@@ -230,7 +232,7 @@ public class ActivationTask extends BaseTask {
+ message.getReturnCode());
if (message.getProvisioningStatus().equals(OmtpConstants.SUBSCRIBER_READY)) {
VvmLog.d(TAG, "subscriber ready, no activation required");
- updateSource(getContext(), phoneAccountHandle, message);
+ updateSource(getContext(), phoneAccountHandle, message, helper);
} else {
if (helper.supportsProvisioning()) {
VvmLog.i(TAG, "Subscriber not ready, start provisioning");
@@ -240,7 +242,7 @@ public class ActivationTask extends BaseTask {
VvmLog.i(TAG, "Subscriber new but provisioning is not supported");
// Ignore the non-ready state and attempt to use the provided info as is.
// This is probably caused by not completing the new user tutorial.
- updateSource(getContext(), phoneAccountHandle, message);
+ updateSource(getContext(), phoneAccountHandle, message, helper);
} else {
VvmLog.i(TAG, "Subscriber not ready but provisioning is not supported");
helper.handleEvent(status, OmtpEvents.CONFIG_SERVICE_NOT_AVAILABLE);
@@ -251,20 +253,23 @@ public class ActivationTask extends BaseTask {
}
private static void updateSource(
- Context context, PhoneAccountHandle phone, StatusMessage message) {
+ Context context,
+ PhoneAccountHandle phone,
+ StatusMessage message,
+ OmtpVvmCarrierConfigHelper config) {
if (OmtpConstants.SUCCESS.equals(message.getReturnCode())) {
// Save the IMAP credentials in preferences so they are persistent and can be retrieved.
VvmAccountManager.addAccount(context, phone, message);
- onSuccess(context, phone);
+ onSuccess(context, phone, config);
} else {
VvmLog.e(TAG, "Visual voicemail not available for subscriber.");
}
}
- private static void onSuccess(Context context, PhoneAccountHandle phoneAccountHandle) {
- OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(context, phoneAccountHandle);
- helper.handleEvent(
+ private static void onSuccess(
+ Context context, PhoneAccountHandle phoneAccountHandle, OmtpVvmCarrierConfigHelper config) {
+ config.handleEvent(
VoicemailStatus.edit(context, phoneAccountHandle),
OmtpEvents.CONFIG_REQUEST_STATUS_SUCCESS);
clearLegacyVoicemailNotification(context, phoneAccountHandle);
diff --git a/java/com/android/voicemail/impl/settings/VisualVoicemailSettingsUtil.java b/java/com/android/voicemail/impl/settings/VisualVoicemailSettingsUtil.java
index 9ce32a97c..ae526d168 100644
--- a/java/com/android/voicemail/impl/settings/VisualVoicemailSettingsUtil.java
+++ b/java/com/android/voicemail/impl/settings/VisualVoicemailSettingsUtil.java
@@ -16,6 +16,7 @@
package com.android.voicemail.impl.settings;
import android.content.Context;
+import android.support.annotation.VisibleForTesting;
import android.telecom.PhoneAccountHandle;
import com.android.dialer.common.Assert;
import com.android.voicemail.VoicemailComponent;
@@ -28,7 +29,7 @@ import com.android.voicemail.impl.sync.VvmAccountManager;
/** Save whether or not a particular account is enabled in shared to be retrieved later. */
public class VisualVoicemailSettingsUtil {
- private static final String IS_ENABLED_KEY = "is_enabled";
+ @VisibleForTesting public static final String IS_ENABLED_KEY = "is_enabled";
public static void setEnabled(
Context context, PhoneAccountHandle phoneAccount, boolean isEnabled) {