Merge "Add back button to dialpad in callui" into nyc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ac5d042..cbe4e1b 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -321,7 +321,7 @@
                  android:encryptionAware="true" >
             <meta-data android:name="android.telecom.IN_CALL_SERVICE_UI" android:value="true" />
             <meta-data android:name="android.telecom.IN_CALL_SERVICE_RINGING"
-                android:value="true"/>
+                android:value="false"/>
             <intent-filter>
                 <action android:name="android.telecom.InCallService"/>
             </intent-filter>
diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
index 1a4ec09..315c0d0 100644
--- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java
+++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
@@ -315,7 +315,9 @@
             audioAttributes.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC);
             audioAttributes.setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE);
             notification.audioAttributes = audioAttributes.build();
-            notification.vibrate = VIBRATE_PATTERN;
+            if (mDialerRingtoneManager.shouldVibrate(mContext.getContentResolver())) {
+                notification.vibrate = VIBRATE_PATTERN;
+            }
         }
         if (mDialerRingtoneManager.shouldPlayCallWaitingTone(callState)) {
             Log.v(this, "Playing call waiting tone");
diff --git a/InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java b/InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java
index 38b37a2..39844e5 100644
--- a/InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java
+++ b/InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java
@@ -18,7 +18,9 @@
 
 import com.google.common.base.Preconditions;
 
+import android.content.ContentResolver;
 import android.net.Uri;
+import android.provider.Settings;
 import android.support.annotation.Nullable;
 
 import com.android.contacts.common.compat.CompatUtils;
@@ -37,7 +39,7 @@
      * Flag used to determine if the Dialer is responsible for playing ringtones for incoming calls.
      * Once we're ready to enable Dialer Ringing, these flags should be removed.
      */
-    private static final boolean IS_DIALER_RINGING_ENABLED = true;
+    private static final boolean IS_DIALER_RINGING_ENABLED = false;
     private Boolean mIsDialerRingingEnabledForTesting;
 
     private final InCallTonePlayer mInCallTonePlayer;
@@ -70,6 +72,17 @@
     }
 
     /**
+     * Determines if an incoming call should vibrate as well as ring.
+     *
+     * @param resolver {@link ContentResolver} used to look up the
+     * {@link Settings.System#VIBRATE_WHEN_RINGING} setting.
+     * @return {@code true} if the call should vibrate, {@code false} otherwise.
+     */
+    public boolean shouldVibrate(ContentResolver resolver) {
+        return Settings.System.getInt(resolver, Settings.System.VIBRATE_WHEN_RINGING, 0) != 0;
+    }
+
+    /**
      * The incoming callState is never set as {@link State#CALL_WAITING} because
      * {@link Call#translateState(int)} doesn't account for that case, check for it here
      */
diff --git a/res/drawable-hdpi/ic_archive_white_24dp.png b/res/drawable-hdpi/ic_archive_white_24dp.png
new file mode 100644
index 0000000..bb72e89
--- /dev/null
+++ b/res/drawable-hdpi/ic_archive_white_24dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_archive_white_24dp.png b/res/drawable-mdpi/ic_archive_white_24dp.png
new file mode 100644
index 0000000..f6aa3f9
--- /dev/null
+++ b/res/drawable-mdpi/ic_archive_white_24dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_archive_white_24dp.png b/res/drawable-xhdpi/ic_archive_white_24dp.png
new file mode 100644
index 0000000..3513bd9
--- /dev/null
+++ b/res/drawable-xhdpi/ic_archive_white_24dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_archive_white_24dp.png b/res/drawable-xxhdpi/ic_archive_white_24dp.png
new file mode 100644
index 0000000..00e04e4
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_archive_white_24dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_archive_white_24dp.png b/res/drawable-xxxhdpi/ic_archive_white_24dp.png
new file mode 100644
index 0000000..34cd3fd
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_archive_white_24dp.png
Binary files differ
diff --git a/res/layout/voicemail_playback_layout.xml b/res/layout/voicemail_playback_layout.xml
index bb7fe34..64a68bd 100644
--- a/res/layout/voicemail_playback_layout.xml
+++ b/res/layout/voicemail_playback_layout.xml
@@ -97,6 +97,17 @@
                     android:tint="@color/voicemail_icon_tint"
                     android:contentDescription="@string/call_log_trash_voicemail" />
 
+                <Space
+                    android:layout_width="0dp"
+                    android:layout_height="0dp"
+                    android:layout_weight="1" />
+
+                <ImageButton android:id="@+id/archive_voicemail"
+                    style="@style/VoicemailPlaybackLayoutButtonStyle"
+                    android:src="@drawable/ic_archive_white_24dp"
+                    android:tint="@color/voicemail_icon_tint"
+                    android:contentDescription="@string/call_log_archive_voicemail" />
+
             </LinearLayout>
 
         </LinearLayout>
diff --git a/res/menu/dialtacts_options.xml b/res/menu/dialtacts_options.xml
index 8a9e25f..8e31026 100644
--- a/res/menu/dialtacts_options.xml
+++ b/res/menu/dialtacts_options.xml
@@ -20,6 +20,9 @@
         android:icon="@drawable/ic_menu_history_lt"
         android:title="@string/action_menu_call_history_description" />
     <item
+        android:id="@+id/menu_archive"
+        android:title="@string/voicemail_archive_activity_title" />
+    <item
         android:id="@+id/menu_import_export"
         android:title="@string/menu_import_export" />
     <item
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 34fd2e5..734dde8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -84,12 +84,21 @@
     <!-- Menu item used to delete a voicemail. [CHAR LIMIT=30] -->
     <string name="call_log_trash_voicemail">Delete voicemail</string>
 
+    <!-- Menu item used to archive a voicemail. [CHAR LIMIT=30] -->
+    <string name="call_log_archive_voicemail">Archive voicemail</string>
+
     <!-- Text for snackbar to undo a voicemail delete. [CHAR LIMIT=30] -->
     <string name="snackbar_voicemail_deleted">Voicemail deleted</string>
 
+    <!-- Text for snackbar to undo a voicemail archive. [CHAR LIMIT=30] -->
+    <string name="snackbar_voicemail_archived">Voicemail archived</string>
+
     <!-- Text for undo button in snackbar for voicemail deletion. [CHAR LIMIT=10] -->
     <string name="snackbar_voicemail_deleted_undo">UNDO</string>
 
+    <!-- Text for going to archive button in snackbar for voicemail archive. [CHAR LIMIT=10] -->
+    <string name="snackbar_voicemail_archived_goto">GOTO ARCHIVE</string>
+
     <!-- Title of the confirmation dialog for clearing the call log. [CHAR LIMIT=37]  -->
     <string name="clearCallLogConfirmation_title">Clear call history?</string>
 
@@ -158,6 +167,9 @@
     <!-- Message to display whilst we are waiting for the content to be fetched. [CHAR LIMIT=40] -->
     <string name="voicemail_fetching_content">Loading voicemail\u2026</string>
 
+    <!-- Message to display whilst we are waiting for the content to be archived. [CHAR LIMIT=40] -->
+    <string name="voicemail_archiving_content">Archiving voicemail\u2026</string>
+
     <!-- Message to display if we fail to get content within a suitable time period. [CHAR LIMIT=40] -->
     <string name="voicemail_fetching_timout">Couldn\'t load voicemail</string>
 
@@ -531,12 +543,18 @@
     <!-- Text displayed when the list of voicemails is empty -->
     <string name="call_log_voicemail_empty">Your voicemail inbox is empty.</string>
 
+    <!-- Text displayed when the list of voicemail archives is empty -->
+    <string name="voicemail_archive_empty">Your voicemail archive is empty.</string>
+
     <!--  Menu option to show favorite contacts only -->
     <string name="show_favorites_only">Show favorites only</string>
 
     <!--  Title of activity that displays a list of all calls -->
     <string name="call_log_activity_title">Call History</string>
 
+    <!--  Title of activity that displays a list of all archived voicemails -->
+    <string name="voicemail_archive_activity_title">Voicemail Archive</string>
+
     <!-- Title for the call log tab containing the list of all voicemails and calls
          [CHAR LIMIT=30] -->
     <string name="call_log_all_title">All</string>
@@ -917,6 +935,9 @@
     <!-- Error toast message for when send to voicemail import fails. [CHAR LIMIT=40] -->
     <string name="send_to_voicemail_import_failed">Import failed</string>
 
+    <!-- Error toast message for when voicemail archive fails. [CHAR LIMIT=40] -->
+    <string name="voicemail_archive_failed">Failed to archive voicemail.</string>
+
     <!-- String describing the delete icon on a blocked number list item.
         When tapped, it will show a dialog confirming the unblocking of the number.
         [CHAR LIMIT=NONE]-->