Merge "Import translations. DO NOT MERGE" into nyc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c02d0f5..c39bd5b 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -69,8 +69,7 @@
android:supportsRtl="true"
android:backupAgent='com.android.dialer.DialerBackupAgent'
android:usesCleartextTraffic="false"
- android:forceDeviceEncrypted="true"
- android:encryptionAware="true">
+ android:forceDeviceEncrypted="false">
<meta-data android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAIBXgtCEKQ6W0PXVnW-ZVia2KmlV2AxsTw3GjAeQ" />
@@ -86,6 +85,7 @@
android:icon="@mipmap/ic_launcher_phone"
android:windowSoftInputMode="stateAlwaysHidden|adjustNothing"
android:resizeableActivity="true"
+ android:encryptionAware="true"
>
<intent-filter>
<action android:name="android.intent.action.DIAL" />
@@ -281,10 +281,12 @@
<service
android:name=".calllog.CallLogNotificationsService"
+ android:encryptionAware="true"
android:exported="false"
/>
- <receiver android:name=".calllog.MissedCallNotificationReceiver">
+ <receiver android:name=".calllog.MissedCallNotificationReceiver"
+ android:encryptionAware="true">
<intent-filter>
<action android:name="android.telecom.action.SHOW_MISSED_CALLS_NOTIFICATION" />
</intent-filter>
@@ -318,11 +320,6 @@
android:resizeableActivity="true">
</activity>
- <!-- BroadcastReceiver for receiving Intents from Notification mechanism. -->
- <receiver android:name="com.android.incallui.NotificationBroadcastReceiver"
- android:encryptionAware="true"
- android:exported="false" />
-
<service android:name="com.android.incallui.InCallServiceImpl"
android:permission="android.permission.BIND_INCALL_SERVICE"
android:encryptionAware="true" >
@@ -334,6 +331,11 @@
</intent-filter>
</service>
+ <!-- BroadcastReceiver for receiving Intents from Notification mechanism. -->
+ <receiver android:name="com.android.incallui.NotificationBroadcastReceiver"
+ android:encryptionAware="true"
+ android:exported="false" />
+
<provider
android:name=".database.FilteredNumberProvider"
android:authorities="com.android.dialer.database.filterednumberprovider"
diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
index 946e0eb..173fe42 100644
--- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java
+++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
@@ -100,10 +100,7 @@
mNotificationManager =
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
mDialerRingtoneManager = new DialerRingtoneManager(
- new InCallTonePlayer(
- AudioModeProvider.getInstance(),
- new ToneGeneratorFactory(),
- new PausableExecutorImpl()),
+ new InCallTonePlayer(new ToneGeneratorFactory(), new PausableExecutorImpl()),
CallList.getInstance());
mCurrentNotification = NOTIFICATION_NONE;
}
diff --git a/InCallUI/src/com/android/incallui/ringtone/InCallTonePlayer.java b/InCallUI/src/com/android/incallui/ringtone/InCallTonePlayer.java
index d930a92..3a8b03d 100644
--- a/InCallUI/src/com/android/incallui/ringtone/InCallTonePlayer.java
+++ b/InCallUI/src/com/android/incallui/ringtone/InCallTonePlayer.java
@@ -21,20 +21,14 @@
import android.media.AudioManager;
import android.media.ToneGenerator;
-import android.provider.MediaStore.Audio;
import android.support.annotation.Nullable;
-import android.telecom.CallAudioState;
-import com.android.contacts.common.testing.NeededForTesting;
-import com.android.incallui.AudioModeProvider;
import com.android.incallui.Log;
import com.android.incallui.async.PausableExecutor;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import javax.annotation.concurrent.NotThreadSafe;
-
/**
* Class responsible for playing in-call related tones in a background thread. This class only
* allows one tone to be played at a time.
@@ -45,7 +39,6 @@
public static final int VOLUME_RELATIVE_HIGH_PRIORITY = 80;
- private final AudioModeProvider mAudioModeProvider;
private final ToneGeneratorFactory mToneGeneratorFactory;
private final PausableExecutor mExecutor;
private @Nullable CountDownLatch mNumPlayingTones;
@@ -53,23 +46,19 @@
/**
* Creates a new InCallTonePlayer.
*
- * @param audioModeProvider the {@link AudioModeProvider} used to determine through which stream
- * to play tones.
* @param toneGeneratorFactory the {@link ToneGeneratorFactory} used to create
* {@link ToneGenerator}s.
* @param executor the {@link PausableExecutor} used to play tones in a background thread.
* @throws NullPointerException if audioModeProvider, toneGeneratorFactory, or executor are
* {@code null}.
*/
- public InCallTonePlayer(AudioModeProvider audioModeProvider,
- ToneGeneratorFactory toneGeneratorFactory, PausableExecutor executor) {
- mAudioModeProvider = Preconditions.checkNotNull(audioModeProvider);
+ public InCallTonePlayer(ToneGeneratorFactory toneGeneratorFactory, PausableExecutor executor) {
mToneGeneratorFactory = Preconditions.checkNotNull(toneGeneratorFactory);
mExecutor = Preconditions.checkNotNull(executor);
}
/**
- * @return {@code true} if a tone is currently playing, {@code false} otherwise
+ * @return {@code true} if a tone is currently playing, {@code false} otherwise.
*/
public boolean isPlayingTone() {
return mNumPlayingTones != null && mNumPlayingTones.getCount() > 0;
@@ -79,8 +68,8 @@
* Plays the given tone in a background thread.
*
* @param tone the tone to play.
- * @throws IllegalStateException if a tone is already playing
- * @throws IllegalArgumentException if the tone is invalid
+ * @throws IllegalStateException if a tone is already playing.
+ * @throws IllegalArgumentException if the tone is invalid.
*/
public void play(int tone) {
if (isPlayingTone()) {
@@ -97,26 +86,24 @@
}
private ToneGeneratorInfo getToneGeneratorInfo(int tone) {
- int stream = getPlaybackStream();
switch (tone) {
case TONE_CALL_WAITING:
+ /*
+ * Call waiting tones play until they're stopped either by the user accepting or
+ * declining the call so the tone length is set at what's effectively forever. The
+ * tone is played at a high priority volume and through STREAM_VOICE_CALL since it's
+ * call related and using that stream will route it through bluetooth devices
+ * appropriately.
+ */
return new ToneGeneratorInfo(ToneGenerator.TONE_SUP_CALL_WAITING,
VOLUME_RELATIVE_HIGH_PRIORITY,
Integer.MAX_VALUE,
- stream);
+ AudioManager.STREAM_VOICE_CALL);
default:
throw new IllegalArgumentException("Bad tone: " + tone);
}
}
- private int getPlaybackStream() {
- if (mAudioModeProvider.getAudioMode() == CallAudioState.ROUTE_BLUETOOTH) {
- // TODO (maxwelb): b/26932998 play through bluetooth
- // return AudioManager.STREAM_BLUETOOTH_SCO;
- }
- return AudioManager.STREAM_VOICE_CALL;
- }
-
private void playOnBackgroundThread(ToneGeneratorInfo info) {
ToneGenerator toneGenerator = null;
try {
diff --git a/InCallUI/tests/src/com/android/incallui/ringtone/InCallTonePlayerTest.java b/InCallUI/tests/src/com/android/incallui/ringtone/InCallTonePlayerTest.java
index 59611f7..bde5c50 100644
--- a/InCallUI/tests/src/com/android/incallui/ringtone/InCallTonePlayerTest.java
+++ b/InCallUI/tests/src/com/android/incallui/ringtone/InCallTonePlayerTest.java
@@ -21,7 +21,6 @@
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
-import com.android.incallui.AudioModeProvider;
import com.android.incallui.async.PausableExecutor;
import com.android.incallui.async.SingleProdThreadExecutor;
@@ -32,7 +31,6 @@
@SmallTest
public class InCallTonePlayerTest extends AndroidTestCase {
- @Mock private AudioModeProvider mAudioModeProvider;
@Mock private ToneGeneratorFactory mToneGeneratorFactory;
@Mock private ToneGenerator mToneGenerator;
private InCallTonePlayer mInCallTonePlayer;
@@ -52,8 +50,7 @@
Mockito.when(mToneGeneratorFactory.newInCallToneGenerator(Mockito.anyInt(),
Mockito.anyInt())).thenReturn(mToneGenerator);
mExecutor = new SingleProdThreadExecutor();
- mInCallTonePlayer = new InCallTonePlayer(mAudioModeProvider, mToneGeneratorFactory,
- mExecutor);
+ mInCallTonePlayer = new InCallTonePlayer(mToneGeneratorFactory, mExecutor);
}
@Override
@@ -92,10 +89,6 @@
} catch (IllegalStateException e) {}
}
- public void testPlay_BlueToothStream() {
- // TODO (maxwelb): b/26932998 play through bluetooth
- }
-
public void testPlay_VoiceCallStream() throws InterruptedException {
mInCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING);
mExecutor.awaitMilestoneForTesting();
diff --git a/src/com/android/dialer/calllog/MissedCallNotifier.java b/src/com/android/dialer/calllog/MissedCallNotifier.java
index c422dd5..98d02d0 100644
--- a/src/com/android/dialer/calllog/MissedCallNotifier.java
+++ b/src/com/android/dialer/calllog/MissedCallNotifier.java
@@ -33,6 +33,7 @@
import com.android.dialer.R;
import com.android.dialer.calllog.CallLogNotificationsHelper.NewCall;
import com.android.dialer.contactinfo.ContactPhotoLoader;
+import com.android.dialer.compat.UserManagerCompat;
import com.android.dialer.list.ListsFragment;
import com.android.dialer.util.DialerUtils;
import com.android.dialer.util.IntentUtil;
@@ -153,8 +154,8 @@
// sensitive notification information.
.setPublicVersion(publicBuilder.build());
- // Add additional actions when there is only 1 missed call, like call-back and SMS.
- if (count == 1) {
+ // Add additional actions when there is only 1 missed call and the user isn't locked
+ if (UserManagerCompat.isUserUnlocked(mContext) && count == 1) {
if (!TextUtils.isEmpty(number)
&& !TextUtils.equals(
number, mContext.getString(R.string.handle_restricted))) {
@@ -181,21 +182,24 @@
AsyncTask.execute(new Runnable() {
@Override
public void run() {
- // Clear the list of new missed calls from the call log.
- ContentValues values = new ContentValues();
- values.put(Calls.NEW, 0);
- values.put(Calls.IS_READ, 1);
- StringBuilder where = new StringBuilder();
- where.append(Calls.NEW);
- where.append(" = 1 AND ");
- where.append(Calls.TYPE);
- where.append(" = ?");
- try {
- mContext.getContentResolver().update(Calls.CONTENT_URI, values,
- where.toString(), new String[]{ Integer.toString(Calls.
- MISSED_TYPE) });
- } catch (IllegalArgumentException e) {
- Log.w(TAG, "ContactsProvider update command failed", e);
+ // Call log is only accessible when unlocked. If that's the case, clear the list of
+ // new missed calls from the call log.
+ if (UserManagerCompat.isUserUnlocked(mContext)) {
+ ContentValues values = new ContentValues();
+ values.put(Calls.NEW, 0);
+ values.put(Calls.IS_READ, 1);
+ StringBuilder where = new StringBuilder();
+ where.append(Calls.NEW);
+ where.append(" = 1 AND ");
+ where.append(Calls.TYPE);
+ where.append(" = ?");
+ try {
+ mContext.getContentResolver().update(Calls.CONTENT_URI, values,
+ where.toString(), new String[]{Integer.toString(Calls.
+ MISSED_TYPE)});
+ } catch (IllegalArgumentException e) {
+ Log.w(TAG, "ContactsProvider update command failed", e);
+ }
}
getNotificationMgr().cancel(NOTIFICATION_TAG, NOTIFICATION_ID);
}