Merge "Revise layout/style of VoicemailPlaybackLayout." into mnc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 86bf4ff..cf69358 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -18,6 +18,11 @@
     package="com.android.dialer"
     coreApp="true">
 
+    <uses-sdk
+        android:minSdkVersion="MNC"
+        android:targetSdkVersion="MNC" />
+
+
     <uses-permission android:name="android.permission.CALL_PHONE" />
     <uses-permission android:name="android.permission.READ_CONTACTS" />
     <uses-permission android:name="android.permission.WRITE_CONTACTS" />
diff --git a/res/drawable/call_log_action_border.xml b/res/drawable/call_log_action_border.xml
deleted file mode 100644
index fbb3559..0000000
--- a/res/drawable/call_log_action_border.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2015 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
-  -->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:left="-1dp" android:right="-1dp" android:bottom="-1dp">
-        <shape android:shape="rectangle">
-            <stroke android:width="1dp" android:color="@color/call_log_action_divider" />
-        </shape>
-    </item>
-</layer-list>
diff --git a/res/layout/call_log_list_item_actions.xml b/res/layout/call_log_list_item_actions.xml
index 4d3fb75..b427206 100644
--- a/res/layout/call_log_list_item_actions.xml
+++ b/res/layout/call_log_list_item_actions.xml
@@ -28,6 +28,11 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content" />
 
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:background="@color/call_log_action_divider" />
+
     <LinearLayout
         android:id="@+id/call_action"
         style="@style/CallLogActionStyle">
@@ -91,7 +96,7 @@
 
         <ImageView
             style="@style/CallLogActionIconStyle"
-            android:src="@drawable/ic_textsms_24dp" />
+            android:src="@drawable/ic_message_24dp" />
 
         <TextView
             style="@style/CallLogActionTextStyle"
@@ -105,7 +110,7 @@
 
         <ImageView
             style="@style/CallLogActionIconStyle"
-            android:src="@drawable/ic_more_horiz_24dp" />
+            android:src="@drawable/ic_info_outline_24dp" />
 
         <TextView
             style="@style/CallLogActionTextStyle"
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 987ef48..957fabf 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -161,8 +161,7 @@
     <style name="CallLogActionStyle">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">@dimen/call_log_action_height</item>
-        <item name="android:background">@drawable/call_log_action_border</item>
-        <item name="android:foreground">?android:attr/selectableItemBackground</item>
+        <item name="android:background">?android:attr/selectableItemBackground</item>
         <item name="android:orientation">horizontal</item>
         <item name="android:gravity">center_vertical</item>
     </style>
diff --git a/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java b/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java
index 17c573f..6c0ecf7 100644
--- a/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java
+++ b/src/com/android/dialer/list/DialerPhoneNumberListAdapter.java
@@ -160,7 +160,7 @@
                 break;
             case SHORTCUT_SEND_SMS_MESSAGE:
                 text = resources.getString(R.string.search_shortcut_send_sms_message);
-                drawableId = R.drawable.ic_textsms_24dp;
+                drawableId = R.drawable.ic_message_24dp;
                 break;
             case SHORTCUT_MAKE_VIDEO_CALL:
                 text = resources.getString(R.string.search_shortcut_make_video_call);
diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
index 4cd8c4d..d0fe2e4 100644
--- a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
+++ b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
@@ -33,6 +33,7 @@
 import android.provider.VoicemailContract;
 import android.util.Log;
 import android.view.View;
+import android.view.WindowManager.LayoutParams;
 import android.widget.SeekBar;
 
 import com.android.dialer.R;
@@ -285,6 +286,7 @@
             mMediaPlayer = null;
         }
 
+        mActivity.getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
         disableProximitySensor(false /* waitForFarState */);
     }
 
@@ -337,6 +339,10 @@
     }
 
     private boolean queryHasContent(Uri voicemailUri) {
+        if (voicemailUri == null) {
+            return false;
+        }
+
         ContentResolver contentResolver = mContext.getContentResolver();
         Cursor cursor = contentResolver.query(
                 voicemailUri, HAS_CONTENT_PROJECTION, null, null, null);
@@ -578,7 +584,11 @@
 
         Log.d(TAG, "Resumed playback at " + mPosition + ".");
         mView.onPlaybackStarted(mDuration.get(), getScheduledExecutorServiceInstance());
-        enableProximitySensor();
+        if (isSpeakerphoneOn()) {
+            mActivity.getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
+        } else {
+            enableProximitySensor();
+        }
     }
 
     /**
@@ -600,6 +610,8 @@
 
         mView.onPlaybackStopped();
         mAudioManager.abandonAudioFocus(this);
+
+        mActivity.getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
         disableProximitySensor(true /* waitForFarState */);
     }
 
@@ -621,11 +633,8 @@
     }
 
     private void enableProximitySensor() {
-        // Disable until proximity sensor behavior in onPause is fixed: b/21932251.
-
-        /*
         if (mProximityWakeLock == null || isSpeakerphoneOn() || !mIsPrepared
-                || !mMediaPlayer.isPlaying()) {
+                || mMediaPlayer == null || !mMediaPlayer.isPlaying()) {
             return;
         }
 
@@ -635,7 +644,6 @@
         } else {
             Log.i(TAG, "Proximity wake lock already acquired");
         }
-        */
     }
 
     private void disableProximitySensor(boolean waitForFarState) {
@@ -653,10 +661,15 @@
 
     public void setSpeakerphoneOn(boolean on) {
         mAudioManager.setSpeakerphoneOn(on);
+
         if (on) {
             disableProximitySensor(false /* waitForFarState */);
+            if (mIsPrepared && mMediaPlayer != null && mMediaPlayer.isPlaying()) {
+                mActivity.getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
+            }
         } else {
             enableProximitySensor();
+            mActivity.getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
         }
     }