Handle SYNC_VOICEMAIL intent for OMTP VVM

Bug:26799077
Change-Id: Ie385d8c8fff5ac94e5beb7acdff7e278418eaa2c
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index a75e46d..0bf46fb 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -663,6 +663,13 @@
                    android:mimeType="vnd.android.cursor.item/voicemail" />
           </intent-filter>
        </receiver>
+        <receiver
+            android:name="com.android.phone.vvm.omtp.sync.OmtpVvmSyncReceiver"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.SYNC_VOICEMAIL"/>
+            </intent-filter>
+        </receiver>
        <receiver
            android:name="com.android.phone.vvm.omtp.sync.VoicemailProviderChangeReceiver"
            android:exported="true">
diff --git a/src/com/android/phone/vvm/omtp/sync/OmtpVvmSyncReceiver.java b/src/com/android/phone/vvm/omtp/sync/OmtpVvmSyncReceiver.java
new file mode 100644
index 0000000..f0d21d1
--- /dev/null
+++ b/src/com/android/phone/vvm/omtp/sync/OmtpVvmSyncReceiver.java
@@ -0,0 +1,38 @@
+/*
+ * 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.phone.vvm.omtp.sync;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.provider.VoicemailContract;
+import android.util.Log;
+
+public class OmtpVvmSyncReceiver extends BroadcastReceiver {
+
+    private static final String TAG = "OmtpVvmSyncReceiver";
+
+    @Override
+    public void onReceive(final Context context, Intent intent) {
+        if (VoicemailContract.ACTION_SYNC_VOICEMAIL.equals(intent.getAction())) {
+            Log.v(TAG, "Sync intent received");
+            Intent syncIntent = OmtpVvmSyncService
+                    .getSyncIntent(context, OmtpVvmSyncService.SYNC_FULL_SYNC, null, true);
+            context.startService(syncIntent);
+        }
+    }
+}