Cleaning up the accessibility of MultiWaveView

Change-Id: I13bd71670b38a917d62118ddef5ed6982c9eba99
diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
index 76bc535..cd1f8ba 100644
--- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
@@ -902,13 +902,13 @@
             String directionDescription = getDirectionDescription(i);
             if (!TextUtils.isEmpty(targetDescription)
                     && !TextUtils.isEmpty(directionDescription)) {
-                utterance.append(targetDescription);
-                utterance.append(" ");
-                utterance.append(directionDescription);
-                utterance.append(".");
+                String text = String.format(directionDescription, targetDescription);
+                utterance.append(text);
+            }
+            if (utterance.length() > 0) {
+                announceText(utterance.toString());
             }
         }
-        announceText(utterance.toString());
     }
 
     private void announceText(String text) {
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock.xml b/core/res/res/layout/keyguard_screen_tab_unlock.xml
index 4c8c0d1..0368530 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock.xml
@@ -131,7 +131,7 @@
 
             android:targetDrawables="@array/lockscreen_targets_with_camera"
             android:targetDescriptions="@array/lockscreen_target_descriptions_with_camera"
-            android:directionDescriptions="@array/lockscreen_direction_descriptions_with_camera"
+            android:directionDescriptions="@array/lockscreen_direction_descriptions"
             android:handleDrawable="@drawable/ic_lockscreen_handle"
             android:waveDrawable="@drawable/ic_lockscreen_outerring"
             android:outerRadius="@dimen/multiwaveview_target_placement_radius"
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
index ba55f0c0..2849376 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
@@ -136,7 +136,7 @@
 
         android:targetDrawables="@array/lockscreen_targets_with_camera"
         android:targetDescriptions="@array/lockscreen_target_descriptions_with_camera"
-        android:directionDescriptions="@array/lockscreen_direction_descriptions_with_camera"
+        android:directionDescriptions="@array/lockscreen_direction_descriptions"
         android:handleDrawable="@drawable/ic_lockscreen_handle"
         android:waveDrawable="@drawable/ic_lockscreen_outerring"
         android:outerRadius="@dimen/multiwaveview_target_placement_radius"
diff --git a/core/res/res/values-land/arrays.xml b/core/res/res/values-land/arrays.xml
index 57aafc8..68e5cfd 100644
--- a/core/res/res/values-land/arrays.xml
+++ b/core/res/res/values-land/arrays.xml
@@ -34,7 +34,7 @@
         <item>@string/description_target_soundon</item>
     </array>
 
-    <array name="lockscreen_direction_descriptions_when_silent">
+    <array name="lockscreen_direction_descriptions">
         <item>@null</item>
         <item>@string/description_direction_up</item>
         <item>@null</item>
@@ -55,13 +55,6 @@
         <item>@string/description_target_silent</item>
     </array>
 
-    <array name="lockscreen_direction_descriptions_when_soundon">
-        <item>@null</item>
-        <item>@string/description_direction_up</item>
-        <item>@null</item>
-        <item>@string/description_direction_down</item>
-    </array>
-
     <array name="lockscreen_targets_with_camera">
         <item>@null</item>
         <item>@drawable/ic_lockscreen_unlock</item>
@@ -76,11 +69,4 @@
         <item>@string/description_target_camera</item>
     </array>
 
-    <array name="lockscreen_direction_descriptions_with_camera">
-        <item>@null</item>
-        <item>@string/description_direction_up</item>
-        <item>@null</item>
-        <item>@string/description_direction_down</item>
-    </array>
-
 </resources>
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index c9043ba..8d5bd0b 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -356,7 +356,7 @@
         <item>@null</item>
     </array>
 
-    <array name="lockscreen_direction_descriptions_when_silent">
+    <array name="lockscreen_direction_descriptions">
         <item>@string/description_direction_right</item>
         <item>@null</item>
         <item>@string/description_direction_left</item>
@@ -377,13 +377,6 @@
         <item>@null</item>
     </array>
 
-    <array name="lockscreen_direction_descriptions_when_soundon">
-        <item>@string/description_direction_right</item>
-        <item>@null</item>
-        <item>@string/description_direction_left</item>
-        <item>@null</item>
-    </array>
-
     <array name="lockscreen_targets_with_camera">
         <item>@drawable/ic_lockscreen_unlock</item>
         <item>@null</item>
@@ -398,11 +391,4 @@
         <item>@null</item>
     </array>
 
-    <array name="lockscreen_direction_descriptions_with_camera">
-        <item>@string/description_direction_right</item>
-        <item>@null</item>
-        <item>@string/description_direction_left</item>
-        <item>@null</item>
-    </array>
-
 </resources>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index de10825..57b29c2 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -3135,13 +3135,13 @@
     <string name="content_description_sliding_handle">"Sliding handle. Tap and hold."</string>
 
     <!-- Description of the up direction in which one can to slide the handle in the Slide unlock screen. [CHAR LIMIT=NONE] -->
-    <string name="description_direction_up">"Up</string>
+    <string name="description_direction_up">Up for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string>
     <!-- Description of the down direction in which one can to slide the handle in the Slide unlock screen. [CHAR LIMIT=NONE] -->
-    <string name="description_direction_down">Down</string>
+    <string name="description_direction_down">Down for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string>
     <!-- Description of the left direction in which one can to slide the handle in the Slide unlock screen. [CHAR LIMIT=NONE] -->
-    <string name="description_direction_left">"Left</string>
+    <string name="description_direction_left">"Left for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string>
     <!-- Description of the right direction in which one can to slide the handle in the Slide unlock screen. [CHAR LIMIT=NONE] -->
-    <string name="description_direction_right">Right</string>
+    <string name="description_direction_right">Right for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string>
 
     <!-- Description of the unlock target in the Slide unlock screen. [CHAR LIMIT=NONE] -->
     <string name="description_target_unlock">Unlock</string>