Snapshot 81cfc41a448a57d0b3e16b817dc074e91ae94188

Change-Id: Ia1661589783f7d51557ff902c3260c341958c310
diff --git a/res/values-am/strings.xml b/res/values-am/strings.xml
index f37d647..be68d5e 100644
--- a/res/values-am/strings.xml
+++ b/res/values-am/strings.xml
@@ -6,7 +6,7 @@
     <string name="inbound_me_profile_title" msgid="6146013785225412693">"NFC የተቀበላቸው ዕውቂያዎች"</string>
     <string name="inbound_me_profile_text" msgid="2342757196108092923">"ይሄን ሰው እንደ ዕውቅያ ለማከል ነካ አድርግ፡፡"</string>
     <string name="outbound_me_profile_title" msgid="2523625031572784769">"NFC ልውውጥ ተጠናቋል"</string>
-    <string name="outbound_me_profile_text" msgid="5594998841143667989">"ለዚህ ሰው የአንተን ዕውቅያ መረጃ ለመስጠት መታ አድርግ"</string>
+    <string name="outbound_me_profile_text" msgid="5594998841143667989">"ለእዚህ ሰው የአንተን ዕውቅያ መረጃ ለመስጠት መታ አድርግ"</string>
     <string name="accessibility_nfc_enabled" msgid="7796246979948787735">"NFC ነቅቷል፡፡"</string>
     <string name="touch" msgid="4727218133711188355">"ለማብራት ንካ"</string>
     <string name="beam_progress" msgid="7453634884807323920">"ገቢ ሞገድ..."</string>
diff --git a/res/values-ar/strings.xml b/res/values-ar/strings.xml
index d7ec39f..5eceaf8 100644
--- a/res/values-ar/strings.xml
+++ b/res/values-ar/strings.xml
@@ -8,14 +8,14 @@
     <string name="outbound_me_profile_title" msgid="2523625031572784769">"اكتمل تفاعل NFC"</string>
     <string name="outbound_me_profile_text" msgid="5594998841143667989">"المس لمنح هذا الشخص معلومات اتصالك."</string>
     <string name="accessibility_nfc_enabled" msgid="7796246979948787735">"تم تمكين NFC."</string>
-    <string name="touch" msgid="4727218133711188355">"المس لرسم شعاع"</string>
-    <string name="beam_progress" msgid="7453634884807323920">"شعاع وارد..."</string>
-    <string name="beam_complete" msgid="477026736424637435">"اكتمل الشعاع"</string>
-    <string name="beam_failed" msgid="5116241718189888630">"لم يكتمل الشعاع"</string>
-    <string name="beam_canceled" msgid="5425192751826544741">"تم إلغاء الشعاع"</string>
+    <string name="touch" msgid="4727218133711188355">"المس لتبادل البيانات"</string>
+    <string name="beam_progress" msgid="7453634884807323920">"بيانات واردة..."</string>
+    <string name="beam_complete" msgid="477026736424637435">"اكتمل تبادل البيانات"</string>
+    <string name="beam_failed" msgid="5116241718189888630">"لم يكتمل تبادل البيانات"</string>
+    <string name="beam_canceled" msgid="5425192751826544741">"تم إلغاء تبادل البيانات"</string>
     <string name="cancel" msgid="61873902552555096">"إلغاء"</string>
     <string name="beam_touch_to_view" msgid="7853129156831642630">"المس ليتم العرض"</string>
-    <string name="beam_handover_not_supported" msgid="4083165921751489015">"جهاز المستلم لا يوفر نقل ملفات كبيرة عبر الشعاع."</string>
+    <string name="beam_handover_not_supported" msgid="4083165921751489015">"جهاز المستلم لا يوفر نقل ملفات كبيرة عبر تبادل البيانات."</string>
     <string name="connecting_headset" msgid="3929250919225573008">"جارٍ الاتصال..."</string>
     <string name="connected_headset" msgid="4047751837023241955">"متصل"</string>
     <string name="connect_headset_failed" msgid="7500801585498094863">"تعذر الاتصال"</string>
diff --git a/res/values-hi/strings.xml b/res/values-hi/strings.xml
index 56f5e5f..218703a 100644
--- a/res/values-hi/strings.xml
+++ b/res/values-hi/strings.xml
@@ -15,8 +15,7 @@
     <string name="beam_canceled" msgid="5425192751826544741">"बीम रद्द"</string>
     <string name="cancel" msgid="61873902552555096">"रद्द करें"</string>
     <string name="beam_touch_to_view" msgid="7853129156831642630">"देखने के लिए स्‍पर्श करें"</string>
-    <!-- no translation found for beam_handover_not_supported (4083165921751489015) -->
-    <skip />
+    <string name="beam_handover_not_supported" msgid="4083165921751489015">"प्राप्तकर्ता का उपकरण, बीम द्वारा बड़ी फ़ाइल के स्थानांतरण का समर्थन नहीं करता."</string>
     <string name="connecting_headset" msgid="3929250919225573008">"कनेक्ट हो रहा है"</string>
     <string name="connected_headset" msgid="4047751837023241955">"कनेक्ट है"</string>
     <string name="connect_headset_failed" msgid="7500801585498094863">"कनेक्‍ट नहीं किया जा सका"</string>
diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml
index fed4fbf..d940775 100644
--- a/res/values-pt/strings.xml
+++ b/res/values-pt/strings.xml
@@ -8,14 +8,14 @@
     <string name="outbound_me_profile_title" msgid="2523625031572784769">"Interação de NFC completa"</string>
     <string name="outbound_me_profile_text" msgid="5594998841143667989">"Toque para fornecer suas informações de contato para essa pessoa"</string>
     <string name="accessibility_nfc_enabled" msgid="7796246979948787735">"NFC habilitado."</string>
-    <string name="touch" msgid="4727218133711188355">"Toque para iluminar"</string>
-    <string name="beam_progress" msgid="7453634884807323920">"Feixe de entrada..."</string>
-    <string name="beam_complete" msgid="477026736424637435">"Irradiação concluída"</string>
-    <string name="beam_failed" msgid="5116241718189888630">"O feixe não foi concluído"</string>
-    <string name="beam_canceled" msgid="5425192751826544741">"Feixe cancelado"</string>
+    <string name="touch" msgid="4727218133711188355">"Toque para enviar"</string>
+    <string name="beam_progress" msgid="7453634884807323920">"Beam chegando..."</string>
+    <string name="beam_complete" msgid="477026736424637435">"Envio concluído"</string>
+    <string name="beam_failed" msgid="5116241718189888630">"O envio não foi concluído"</string>
+    <string name="beam_canceled" msgid="5425192751826544741">"Envio cancelado"</string>
     <string name="cancel" msgid="61873902552555096">"Cancelar"</string>
     <string name="beam_touch_to_view" msgid="7853129156831642630">"Toque para visualizar"</string>
-    <string name="beam_handover_not_supported" msgid="4083165921751489015">"O dispositivo receptor não suporta a transferência de arquivos grandes através do feixe."</string>
+    <string name="beam_handover_not_supported" msgid="4083165921751489015">"O dispositivo receptor não suporta a transferência de arquivos grandes por meio do Android Beam."</string>
     <string name="connecting_headset" msgid="3929250919225573008">"Conectando"</string>
     <string name="connected_headset" msgid="4047751837023241955">"Conectado"</string>
     <string name="connect_headset_failed" msgid="7500801585498094863">"Não foi possível conectar"</string>
diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml
index ce71a2b..b5188c5 100644
--- a/res/values-ro/strings.xml
+++ b/res/values-ro/strings.xml
@@ -11,26 +11,19 @@
     <string name="touch" msgid="4727218133711188355">"Atingeţi pentru transmitere"</string>
     <string name="beam_progress" msgid="7453634884807323920">"Transmitere primită..."</string>
     <string name="beam_complete" msgid="477026736424637435">"Transmitere încheiată"</string>
-    <!-- no translation found for beam_failed (5116241718189888630) -->
-    <skip />
-    <!-- no translation found for beam_canceled (5425192751826544741) -->
-    <skip />
-    <!-- no translation found for cancel (61873902552555096) -->
-    <skip />
+    <string name="beam_failed" msgid="5116241718189888630">"Transmiterea nu este finalizată"</string>
+    <string name="beam_canceled" msgid="5425192751826544741">"Transmitere anulată"</string>
+    <string name="cancel" msgid="61873902552555096">"Anulaţi"</string>
     <string name="beam_touch_to_view" msgid="7853129156831642630">"Atingeţi pentru a afişa"</string>
-    <!-- no translation found for beam_handover_not_supported (4083165921751489015) -->
-    <skip />
+    <string name="beam_handover_not_supported" msgid="4083165921751489015">"Dispozitivul destinatarului nu acceptă transferul fişierelor mari prin fascicul."</string>
     <string name="connecting_headset" msgid="3929250919225573008">"Se conectează"</string>
     <string name="connected_headset" msgid="4047751837023241955">"Conectat"</string>
-    <!-- no translation found for connect_headset_failed (7500801585498094863) -->
-    <skip />
+    <string name="connect_headset_failed" msgid="7500801585498094863">"Conectarea nu s-a putut realiza."</string>
     <string name="disconnecting_headset" msgid="868262189044372780">"Se deconectează"</string>
     <string name="disconnected_headset" msgid="4066109452701733916">"Deconectat"</string>
     <string name="pairing_headset" msgid="6443461444755646137">"Se împerechează"</string>
-    <!-- no translation found for pairing_headset_failed (6509629663883514688) -->
-    <skip />
-    <!-- no translation found for failed_to_enable_bt (7229153323594758077) -->
-    <skip />
+    <string name="pairing_headset_failed" msgid="6509629663883514688">"Împerecherea a eşuat"</string>
+    <string name="failed_to_enable_bt" msgid="7229153323594758077">"Activarea Bluetooth a eşuat"</string>
     <string name="confirm_pairing" msgid="4112568077038265363">"Sigur doriţi să împerecheaţi dispozitivul Bluetooth <xliff:g id="DEVICE_NAME">%1$s</xliff:g>?"</string>
     <string name="pair_yes" msgid="3525614878559994448">"Da"</string>
     <string name="pair_no" msgid="5022308368904055020">"Nu"</string>
diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml
index a337161..f089dc2 100644
--- a/res/values-sw/strings.xml
+++ b/res/values-sw/strings.xml
@@ -5,7 +5,7 @@
     <string name="nfcUserLabel" msgid="7708535817084357357">"NFC"</string>
     <string name="inbound_me_profile_title" msgid="6146013785225412693">"Anwani imepokewa kupitia NFC"</string>
     <string name="inbound_me_profile_text" msgid="2342757196108092923">"Gusa ili kuongeza mtu huyu kama mwasiliani"</string>
-    <string name="outbound_me_profile_title" msgid="2523625031572784769">"NFC imekamilisha kuingiliana"</string>
+    <string name="outbound_me_profile_title" msgid="2523625031572784769">"NFC imemaliza kushirikiana"</string>
     <string name="outbound_me_profile_text" msgid="5594998841143667989">"Gusa ili kumpa mtu huyu maelezo yako ya mawasiliano."</string>
     <string name="accessibility_nfc_enabled" msgid="7796246979948787735">"NFC imewezeshwa."</string>
     <string name="touch" msgid="4727218133711188355">"Gusa kwa boriti"</string>
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index d63f84f..3b41efd 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -1472,8 +1472,9 @@
     }
 
     class WatchDogThread extends Thread {
-        boolean mWatchDogCanceled = false;
+        final Object mCancelWaiter = new Object();
         final int mTimeout;
+        boolean mCanceled = false;
 
         public WatchDogThread(String threadName, int timeout) {
             super(threadName);
@@ -1482,24 +1483,27 @@
 
         @Override
         public void run() {
-            boolean slept = false;
-            while (!slept) {
-                try {
-                    Thread.sleep(mTimeout);
-                    slept = true;
-                } catch (InterruptedException e) { }
-            }
-            synchronized (this) {
-                if (!mWatchDogCanceled) {
-                    // Trigger watch-dog
-                    Log.e(TAG, "Watchdog fired: name=" + getName() + " threadId=" +
-                            getId() + " timeout=" + mTimeout);
-                    mDeviceHost.doAbort();
+            try {
+                synchronized (mCancelWaiter) {
+                    mCancelWaiter.wait(mTimeout);
+                    if (mCanceled) {
+                        return;
+                    }
                 }
+            } catch (InterruptedException e) {
+                // Should not happen; fall-through to abort.
+                Log.w(TAG, "Watchdog thread interruped.");
+                interrupt();
             }
+            Log.e(TAG, "Watchdog triggered, aborting.");
+            mDeviceHost.doAbort();
         }
+
         public synchronized void cancel() {
-            mWatchDogCanceled = true;
+            synchronized (mCancelWaiter) {
+                mCanceled = true;
+                mCancelWaiter.notify();
+            }
         }
     }