Merge "Fix TTS for Zen mode voice activity." into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ef0b43625c
@@ -6246,22 +6246,25 @@
|
||||
<!-- [CHAR LIMIT=60] Zen mode settings: End time option: Summary text value format when end time = next day -->
|
||||
<string name="zen_mode_end_time_next_day_summary_format"><xliff:g id="formatted_time" example="7:00 AM">%s</xliff:g> next day</string>
|
||||
|
||||
<!-- [CHAR LIMIT=NONE] Zen mode voice - spoken summary: alarms only duration indefinite. -->
|
||||
<string name="zen_mode_summary_alarams_only_indefinite">Change to alarms only indefinitely</string>
|
||||
<!-- [CHAR LIMIT=NONE] Zen mode summary spoken when changing mode by voice: switch to alarms only forever. -->
|
||||
<string name="zen_mode_summary_alarms_only_indefinite">Change to alarms only indefinitely</string>
|
||||
|
||||
<!-- [CHAR LIMIT=NONE] Zen mode voice- spoken summary: alarms only duration minutes. -->
|
||||
<!-- [CHAR LIMIT=NONE] Zen mode summary spoken when changing mode by voice: switch to alarms only for < 60 minutes. -->
|
||||
<plurals name="zen_mode_summary_alarms_only_by_minute">
|
||||
<item quantity="one">Change to alarms only for one minute until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g></item>
|
||||
<item quantity="other">Change to alarms only for <xliff:g id="duration" example="2">%1$d</xliff:g> minutes (until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g>)</item>
|
||||
</plurals>
|
||||
|
||||
<!-- [CHAR LIMIT=NONE] Zen mode voice- spoken summary: alarms only duration hours. -->
|
||||
<!-- [CHAR LIMIT=NONE] Zen mode summary spoken when changing mode by voice: switch to alarms only for N hours. -->
|
||||
<plurals name="zen_mode_summary_alarms_only_by_hour">
|
||||
<item quantity="one">Change to alarms only for one hour until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g></item>
|
||||
<item quantity="other">Change to alarms only for <xliff:g id="duration" example="2">%1$d</xliff:g> hours until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g></item>
|
||||
</plurals>
|
||||
|
||||
<!-- [CHAR LIMIT=NONE] Zen mode voice - spoken summary: off. -->
|
||||
<!-- [CHAR LIMIT=NONE] Zen mode summary spoken when changing mode by voice: switch to alarms only until a specific time. -->
|
||||
<string name="zen_mode_summary_alarms_only_by_time">Change to alarms only until <xliff:g id="formattedTime" example="10:00 PM">%1$s</xliff:g></string>
|
||||
|
||||
<!-- [CHAR LIMIT=NONE] Zen mode summary spoken when changing mode by voice: Turn on all notifications. -->
|
||||
<string name="zen_mode_summary_always">Change to always interrupt</string>
|
||||
|
||||
<!-- [CHAR LIMIT=20] Notifications settings: Apps section header -->
|
||||
|
@@ -58,7 +58,6 @@ public class ZenModeVoiceActivity extends VoiceSettingsActivity {
|
||||
mode = Global.ZEN_MODE_ALARMS;
|
||||
}
|
||||
setZenModeConfig(mode, condition);
|
||||
notifySuccess(getChangeSummary(mode, minutes));
|
||||
|
||||
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||
if (audioManager != null) {
|
||||
@@ -67,10 +66,12 @@ public class ZenModeVoiceActivity extends VoiceSettingsActivity {
|
||||
AudioManager.ADJUST_SAME,
|
||||
AudioManager.FLAG_SHOW_UI);
|
||||
}
|
||||
notifySuccess(getChangeSummary(mode, minutes));
|
||||
} else {
|
||||
Log.v(TAG, "Missing extra android.provider.Settings.EXTRA_DO_NOT_DISTURB_MODE_ENABLED");
|
||||
finish();
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setZenModeConfig(int mode, Condition condition) {
|
||||
@@ -88,12 +89,14 @@ public class ZenModeVoiceActivity extends VoiceSettingsActivity {
|
||||
int indefinite = -1;
|
||||
int byMinute = -1;
|
||||
int byHour = -1;
|
||||
int byTime = -1;
|
||||
|
||||
switch (mode) {
|
||||
case Global.ZEN_MODE_ALARMS:
|
||||
indefinite = R.string.zen_mode_summary_alarams_only_indefinite;
|
||||
indefinite = R.string.zen_mode_summary_alarms_only_indefinite;
|
||||
byMinute = R.plurals.zen_mode_summary_alarms_only_by_minute;
|
||||
byHour = R.plurals.zen_mode_summary_alarms_only_by_hour;
|
||||
byTime = R.string.zen_mode_summary_alarms_only_by_time;
|
||||
break;
|
||||
case Global.ZEN_MODE_OFF:
|
||||
indefinite = R.string.zen_mode_summary_always;
|
||||
@@ -112,6 +115,8 @@ public class ZenModeVoiceActivity extends VoiceSettingsActivity {
|
||||
|
||||
if (minutes < 60) {
|
||||
return res.getQuantityString(byMinute, minutes, minutes, formattedTime);
|
||||
} else if (minutes % 60 != 0) {
|
||||
return res.getString(byTime, formattedTime);
|
||||
} else {
|
||||
int hours = minutes / 60;
|
||||
return res.getQuantityString(byHour, hours, hours, formattedTime);
|
||||
|
@@ -65,7 +65,12 @@ abstract public class VoiceSettingsActivity extends Activity {
|
||||
*/
|
||||
protected void notifySuccess(CharSequence prompt) {
|
||||
if (getVoiceInteractor() != null) {
|
||||
getVoiceInteractor().submitRequest(new CompleteVoiceRequest(prompt, null));
|
||||
getVoiceInteractor().submitRequest(new CompleteVoiceRequest(prompt, null) {
|
||||
@Override
|
||||
public void onCompleteResult(Bundle options) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user