summaryrefslogtreecommitdiff
path: root/InCallUI/tests/src/com/android/incallui/ringtone
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-02-22 16:32:36 -0800
committerEric Erfanian <erfanian@google.com>2017-03-01 09:56:52 -0800
commitccca31529c07970e89419fb85a9e8153a5396838 (patch)
treea7034c0a01672b97728c13282a2672771cd28baa /InCallUI/tests/src/com/android/incallui/ringtone
parente7ae4624ba6f25cb8e648db74e0d64c0113a16ba (diff)
Update dialer sources.
Test: Built package and system image. This change clobbers the old source, and is an export from an internal Google repository. The internal repository was forked form Android in March, and this change includes modifications since then, to near the v8 release. Since the fork, we've moved code from monolithic to independent modules. In addition, we've switched to Blaze/Bazel as the build sysetm. This export, however, still uses make. New dependencies have been added: - Dagger - Auto-Value - Glide - Libshortcutbadger Going forward, development will still be in Google3, and the Gerrit release will become an automated export, with the next drop happening in ~ two weeks. Android.mk includes local modifications from ToT. Abridged changelog: Bug fixes ● Not able to mute, add a call when using Phone app in multiwindow mode ● Double tap on keypad triggering multiple key and tones ● Reported spam numbers not showing as spam in the call log ● Crash when user tries to block number while Phone app is not set as default ● Crash when user picks a number from search auto-complete list Visual Voicemail (VVM) improvements ● Share Voicemail audio via standard exporting mechanisms that support file attachment (email, MMS, etc.) ● Make phone number, email and web sites in VVM transcript clickable ● Set PIN before declining VVM Terms of Service {Carrier} ● Set client type for outbound visual voicemail SMS {Carrier} New incoming call and incall UI on older devices (Android M) ● Updated Phone app icon ● New incall UI (large buttons, button labels) ● New and animated Answer/Reject gestures Accessibility ● Add custom answer/decline call buttons on answer screen for touch exploration accessibility services ● Increase size of touch target ● Add verbal feedback when a Voicemail fails to load ● Fix pressing of Phone buttons while in a phone call using Switch Access ● Fix selecting and opening contacts in talkback mode ● Split focus for ‘Learn More’ link in caller id & spam to help distinguish similar text Other ● Backup & Restore for App Preferences ● Prompt user to enable Wi-Fi calling if the call ends due to out of service and Wi-Fi is connected ● Rename “Dialpad” to “Keypad” ● Show "Private number" for restricted calls ● Delete unused items (vcard, add contact, call history) from Phone menu Change-Id: I2a7e53532a24c21bf308bf0a6d178d7ddbca4958
Diffstat (limited to 'InCallUI/tests/src/com/android/incallui/ringtone')
-rw-r--r--InCallUI/tests/src/com/android/incallui/ringtone/DialerRingtoneManagerTest.java219
-rw-r--r--InCallUI/tests/src/com/android/incallui/ringtone/InCallTonePlayerTest.java148
2 files changed, 0 insertions, 367 deletions
diff --git a/InCallUI/tests/src/com/android/incallui/ringtone/DialerRingtoneManagerTest.java b/InCallUI/tests/src/com/android/incallui/ringtone/DialerRingtoneManagerTest.java
deleted file mode 100644
index 01db20272..000000000
--- a/InCallUI/tests/src/com/android/incallui/ringtone/DialerRingtoneManagerTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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
- */
-
-package com.android.incallui.ringtone;
-
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import com.android.contacts.common.compat.CompatUtils;
-import com.android.incallui.Call;
-import com.android.incallui.Call.State;
-import com.android.incallui.CallList;
-
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-
-@SmallTest
-public class DialerRingtoneManagerTest extends AndroidTestCase {
-
- private static final Uri RINGTONE_URI = RingtoneManager
- .getDefaultUri(RingtoneManager.TYPE_RINGTONE);
-
- @Mock private InCallTonePlayer mInCallTonePlayer;
- @Mock private CallList mCallList;
- @Mock private Call mCall;
- private DialerRingtoneManager mRingtoneManagerEnabled;
- private DialerRingtoneManager mRingtoneManagerDisabled;
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- MockitoAnnotations.initMocks(this);
- mRingtoneManagerEnabled = new DialerRingtoneManager(mInCallTonePlayer, mCallList);
- mRingtoneManagerEnabled.setDialerRingingEnabledForTesting(true);
- mRingtoneManagerDisabled = new DialerRingtoneManager(mInCallTonePlayer, mCallList);
- mRingtoneManagerDisabled.setDialerRingingEnabledForTesting(false);
- }
-
- public void testNullInCallTonePlayer() {
- try {
- new DialerRingtoneManager(null, mCallList);
- fail();
- } catch (NullPointerException e) {}
- }
-
- public void testNullCallList() {
- try {
- new DialerRingtoneManager(mInCallTonePlayer, null);
- fail();
- } catch (NullPointerException e) {}
- }
-
- public void testShouldPlayRingtone_M() {
- if (CompatUtils.isNCompatible()) {
- return;
- }
- assertFalse(mRingtoneManagerEnabled.shouldPlayRingtone(0, RINGTONE_URI));
- }
-
- public void testShouldPlayRingtone_N_NullUri() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- assertFalse(mRingtoneManagerEnabled.shouldPlayRingtone(State.INCOMING, null));
- }
-
- public void testShouldPlayRingtone_N_Disabled() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- assertFalse(mRingtoneManagerDisabled.shouldPlayRingtone(State.INCOMING, RINGTONE_URI));
- }
-
- public void testShouldPlayRingtone_N_NotIncoming() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- assertFalse(mRingtoneManagerEnabled.shouldPlayRingtone(State.ACTIVE, RINGTONE_URI));
- }
-
- // Specific case for call waiting since that needs its own sound
- public void testShouldPlayRingtone_N_CallWaitingByState() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- assertFalse(mRingtoneManagerEnabled.shouldPlayRingtone(State.CALL_WAITING, RINGTONE_URI));
- }
-
- public void testShouldPlayRingtone_N_CallWaitingByActiveCall() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- Mockito.when(mCallList.getActiveCall()).thenReturn(mCall);
- assertFalse(mRingtoneManagerEnabled.shouldPlayRingtone(State.INCOMING, RINGTONE_URI));
- }
-
- public void testShouldPlayRingtone_N() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- assertTrue(mRingtoneManagerEnabled.shouldPlayRingtone(State.INCOMING, RINGTONE_URI));
- }
-
- public void testShouldPlayCallWaitingTone_M() {
- if (CompatUtils.isNCompatible()) {
- return;
- }
- assertFalse(mRingtoneManagerEnabled.shouldPlayCallWaitingTone(0));
- }
-
- public void testShouldPlayCallWaitingTone_N_Disabled() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- assertFalse(mRingtoneManagerDisabled.shouldPlayCallWaitingTone(State.CALL_WAITING));
- }
-
- public void testShouldPlayCallWaitingTone_N_NotCallWaiting() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- assertFalse(mRingtoneManagerEnabled.shouldPlayCallWaitingTone(State.ACTIVE));
- }
-
- // Specific case for incoming since it plays its own sound
- public void testShouldPlayCallWaitingTone_N_Incoming() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- assertFalse(mRingtoneManagerEnabled.shouldPlayCallWaitingTone(State.INCOMING));
- }
-
- public void testShouldPlayCallWaitingTone_N_AlreadyPlaying() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- Mockito.when(mInCallTonePlayer.isPlayingTone()).thenReturn(true);
- assertFalse(mRingtoneManagerEnabled.shouldPlayCallWaitingTone(State.CALL_WAITING));
- }
-
- public void testShouldPlayCallWaitingTone_N_ByState() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- assertTrue(mRingtoneManagerEnabled.shouldPlayCallWaitingTone(State.CALL_WAITING));
- }
-
- public void testShouldPlayCallWaitingTone_N_ByActiveCall() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- Mockito.when(mCallList.getActiveCall()).thenReturn(mCall);
- assertTrue(mRingtoneManagerEnabled.shouldPlayCallWaitingTone(State.INCOMING));
- }
-
- public void testPlayCallWaitingTone_M() {
- if (CompatUtils.isNCompatible()) {
- return;
- }
- mRingtoneManagerEnabled.playCallWaitingTone();
- Mockito.verify(mInCallTonePlayer, Mockito.never()).play(Mockito.anyInt());
- }
-
- public void testPlayCallWaitingTone_N_NotEnabled() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- mRingtoneManagerDisabled.playCallWaitingTone();
- Mockito.verify(mInCallTonePlayer, Mockito.never()).play(Mockito.anyInt());
- }
-
- public void testPlayCallWaitingTone_N() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- mRingtoneManagerEnabled.playCallWaitingTone();
- Mockito.verify(mInCallTonePlayer).play(Mockito.anyInt());
- }
-
- public void testStopCallWaitingTone_M() {
- if (CompatUtils.isNCompatible()) {
- return;
- }
- mRingtoneManagerEnabled.stopCallWaitingTone();
- Mockito.verify(mInCallTonePlayer, Mockito.never()).stop();
- }
-
- public void testStopCallWaitingTone_N_NotEnabled() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- mRingtoneManagerDisabled.stopCallWaitingTone();
- Mockito.verify(mInCallTonePlayer, Mockito.never()).stop();
- }
-
- public void testStopCallWaitingTone_N() {
- if (!CompatUtils.isNCompatible()) {
- return;
- }
- mRingtoneManagerEnabled.stopCallWaitingTone();
- Mockito.verify(mInCallTonePlayer).stop();
- }
-}
diff --git a/InCallUI/tests/src/com/android/incallui/ringtone/InCallTonePlayerTest.java b/InCallUI/tests/src/com/android/incallui/ringtone/InCallTonePlayerTest.java
deleted file mode 100644
index bde5c50e4..000000000
--- a/InCallUI/tests/src/com/android/incallui/ringtone/InCallTonePlayerTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.incallui.ringtone;
-
-import android.media.AudioManager;
-import android.media.ToneGenerator;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import com.android.incallui.async.PausableExecutor;
-import com.android.incallui.async.SingleProdThreadExecutor;
-
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-
-@SmallTest
-public class InCallTonePlayerTest extends AndroidTestCase {
-
- @Mock private ToneGeneratorFactory mToneGeneratorFactory;
- @Mock private ToneGenerator mToneGenerator;
- private InCallTonePlayer mInCallTonePlayer;
-
- /*
- * InCallTonePlayer milestones:
- * 1) After tone starts playing
- * 2) After tone finishes waiting (could have timed out)
- * 3) After cleaning up state to allow new tone to play
- */
- private PausableExecutor mExecutor;
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- MockitoAnnotations.initMocks(this);
- Mockito.when(mToneGeneratorFactory.newInCallToneGenerator(Mockito.anyInt(),
- Mockito.anyInt())).thenReturn(mToneGenerator);
- mExecutor = new SingleProdThreadExecutor();
- mInCallTonePlayer = new InCallTonePlayer(mToneGeneratorFactory, mExecutor);
- }
-
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- // Stop any playing so the InCallTonePlayer isn't stuck waiting for the tone to complete
- mInCallTonePlayer.stop();
- // Ack all milestones to ensure that the prod thread doesn't block forever
- mExecutor.ackAllMilestonesForTesting();
- }
-
- public void testIsPlayingTone_False() {
- assertFalse(mInCallTonePlayer.isPlayingTone());
- }
-
- public void testIsPlayingTone_True() throws InterruptedException {
- mInCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING);
- mExecutor.awaitMilestoneForTesting();
-
- assertTrue(mInCallTonePlayer.isPlayingTone());
- }
-
- public void testPlay_InvalidTone() {
- try {
- mInCallTonePlayer.play(Integer.MIN_VALUE);
- fail();
- } catch (IllegalArgumentException e) {}
- }
-
- public void testPlay_CurrentlyPlaying() throws InterruptedException {
- mInCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING);
- mExecutor.awaitMilestoneForTesting();
- try {
- mInCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING);
- fail();
- } catch (IllegalStateException e) {}
- }
-
- public void testPlay_VoiceCallStream() throws InterruptedException {
- mInCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING);
- mExecutor.awaitMilestoneForTesting();
- Mockito.verify(mToneGeneratorFactory).newInCallToneGenerator(AudioManager.STREAM_VOICE_CALL,
- InCallTonePlayer.VOLUME_RELATIVE_HIGH_PRIORITY);
- }
-
- public void testPlay_Single() throws InterruptedException {
- mInCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING);
- mExecutor.awaitMilestoneForTesting();
- mExecutor.ackMilestoneForTesting();
- mInCallTonePlayer.stop();
- mExecutor.ackMilestoneForTesting();
- mExecutor.awaitMilestoneForTesting();
- mExecutor.ackMilestoneForTesting();
-
- Mockito.verify(mToneGenerator).startTone(ToneGenerator.TONE_SUP_CALL_WAITING);
- }
-
- public void testPlay_Consecutive() throws InterruptedException {
- mInCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING);
- mExecutor.awaitMilestoneForTesting();
- mExecutor.ackMilestoneForTesting();
- // Prevent waiting forever
- mInCallTonePlayer.stop();
- mExecutor.ackMilestoneForTesting();
- mExecutor.awaitMilestoneForTesting();
- mExecutor.ackMilestoneForTesting();
-
- mInCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING);
- mExecutor.awaitMilestoneForTesting();
- mExecutor.ackMilestoneForTesting();
- mInCallTonePlayer.stop();
- mExecutor.ackMilestoneForTesting();
- mExecutor.awaitMilestoneForTesting();
- mExecutor.ackMilestoneForTesting();
-
- Mockito.verify(mToneGenerator, Mockito.times(2))
- .startTone(ToneGenerator.TONE_SUP_CALL_WAITING);
- }
-
- public void testStop_NotPlaying() {
- // No crash
- mInCallTonePlayer.stop();
- }
-
- public void testStop() throws InterruptedException {
- mInCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING);
- mExecutor.awaitMilestoneForTesting();
-
- mInCallTonePlayer.stop();
- mExecutor.ackMilestoneForTesting();
- mExecutor.awaitMilestoneForTesting();
-
- assertFalse(mInCallTonePlayer.isPlayingTone());
- }
-}