Merge "Implement getColorFilter() on VectorDrawable" into mnc-dev
diff --git a/api/current.txt b/api/current.txt
index 1d445cf..aec29fd 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5498,7 +5498,8 @@
   }
 
   public static class VoiceInteractor.AbortVoiceRequest extends android.app.VoiceInteractor.Request {
-    ctor public VoiceInteractor.AbortVoiceRequest(java.lang.CharSequence, android.os.Bundle);
+    ctor public VoiceInteractor.AbortVoiceRequest(android.app.VoiceInteractor.Prompt, android.os.Bundle);
+    ctor public deprecated VoiceInteractor.AbortVoiceRequest(java.lang.CharSequence, android.os.Bundle);
     method public void onAbortResult(android.os.Bundle);
   }
 
@@ -5508,17 +5509,20 @@
   }
 
   public static class VoiceInteractor.CompleteVoiceRequest extends android.app.VoiceInteractor.Request {
-    ctor public VoiceInteractor.CompleteVoiceRequest(java.lang.CharSequence, android.os.Bundle);
+    ctor public VoiceInteractor.CompleteVoiceRequest(android.app.VoiceInteractor.Prompt, android.os.Bundle);
+    ctor public deprecated VoiceInteractor.CompleteVoiceRequest(java.lang.CharSequence, android.os.Bundle);
     method public void onCompleteResult(android.os.Bundle);
   }
 
   public static class VoiceInteractor.ConfirmationRequest extends android.app.VoiceInteractor.Request {
-    ctor public VoiceInteractor.ConfirmationRequest(java.lang.CharSequence, android.os.Bundle);
+    ctor public VoiceInteractor.ConfirmationRequest(android.app.VoiceInteractor.Prompt, android.os.Bundle);
+    ctor public deprecated VoiceInteractor.ConfirmationRequest(java.lang.CharSequence, android.os.Bundle);
     method public void onConfirmationResult(boolean, android.os.Bundle);
   }
 
   public static class VoiceInteractor.PickOptionRequest extends android.app.VoiceInteractor.Request {
-    ctor public VoiceInteractor.PickOptionRequest(java.lang.CharSequence, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+    ctor public VoiceInteractor.PickOptionRequest(android.app.VoiceInteractor.Prompt, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+    ctor public deprecated VoiceInteractor.PickOptionRequest(java.lang.CharSequence, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
     method public void onPickOptionResult(boolean, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
   }
 
@@ -5537,6 +5541,17 @@
     field public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.PickOptionRequest.Option> CREATOR;
   }
 
+  public static class VoiceInteractor.Prompt implements android.os.Parcelable {
+    ctor public VoiceInteractor.Prompt(java.lang.CharSequence[], java.lang.CharSequence);
+    ctor public VoiceInteractor.Prompt(java.lang.CharSequence);
+    method public int countVoicePrompts();
+    method public int describeContents();
+    method public java.lang.CharSequence getVisualPrompt();
+    method public java.lang.CharSequence getVoicePromptAt(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.Prompt> CREATOR;
+  }
+
   public static abstract class VoiceInteractor.Request {
     method public void cancel();
     method public android.app.Activity getActivity();
@@ -12191,6 +12206,7 @@
     method public int getOpacity();
     method public boolean isRunning();
     method public void registerAnimationCallback(android.graphics.drawable.Animatable2.AnimationCallback);
+    method public void reset();
     method public void setAlpha(int);
     method public void setColorFilter(android.graphics.ColorFilter);
     method public void start();
@@ -24488,10 +24504,10 @@
 
   public final class AlarmClock {
     ctor public AlarmClock();
+    field public static final java.lang.String ACTION_DISMISS_ALARM = "android.intent.action.DISMISS_ALARM";
     field public static final java.lang.String ACTION_SET_ALARM = "android.intent.action.SET_ALARM";
     field public static final java.lang.String ACTION_SET_TIMER = "android.intent.action.SET_TIMER";
     field public static final java.lang.String ACTION_SHOW_ALARMS = "android.intent.action.SHOW_ALARMS";
-    field public static final java.lang.String ACTION_DISMISS_ALARM = "android.intent.action.DISMISS_ALARM";
     field public static final java.lang.String ACTION_SNOOZE_ALARM = "android.intent.action.SNOOZE_ALARM";
     field public static final java.lang.String ALARM_SEARCH_MODE_ALL = "android.all";
     field public static final java.lang.String ALARM_SEARCH_MODE_LABEL = "android.label";
@@ -28986,7 +29002,8 @@
   }
 
   public static final class VoiceInteractionSession.AbortVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
-    method public java.lang.CharSequence getMessage();
+    method public deprecated java.lang.CharSequence getMessage();
+    method public android.app.VoiceInteractor.Prompt getVoicePrompt();
     method public void sendAbortResult(android.os.Bundle);
   }
 
@@ -28997,12 +29014,14 @@
   }
 
   public static final class VoiceInteractionSession.CompleteVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
-    method public java.lang.CharSequence getMessage();
+    method public deprecated java.lang.CharSequence getMessage();
+    method public android.app.VoiceInteractor.Prompt getVoicePrompt();
     method public void sendCompleteResult(android.os.Bundle);
   }
 
   public static final class VoiceInteractionSession.ConfirmationRequest extends android.service.voice.VoiceInteractionSession.Request {
-    method public java.lang.CharSequence getPrompt();
+    method public deprecated java.lang.CharSequence getPrompt();
+    method public android.app.VoiceInteractor.Prompt getVoicePrompt();
     method public void sendConfirmationResult(boolean, android.os.Bundle);
   }
 
@@ -29018,7 +29037,8 @@
 
   public static final class VoiceInteractionSession.PickOptionRequest extends android.service.voice.VoiceInteractionSession.Request {
     method public android.app.VoiceInteractor.PickOptionRequest.Option[] getOptions();
-    method public java.lang.CharSequence getPrompt();
+    method public deprecated java.lang.CharSequence getPrompt();
+    method public android.app.VoiceInteractor.Prompt getVoicePrompt();
     method public void sendIntermediatePickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
     method public void sendPickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
   }
@@ -30655,66 +30675,66 @@
     method public android.os.PersistableBundle getConfigForSubId(int);
     method public void reloadCarrierConfigForSubId(int);
     field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
-    field public static final java.lang.String BOOL_ADDITIONAL_CALL_SETTING = "bool_additional_call_setting";
-    field public static final java.lang.String BOOL_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG = "bool_allow_emergency_numbers_in_call_log";
-    field public static final java.lang.String BOOL_ALLOW_LOCAL_DTMF_TONES = "bool_allow_local_dtmf_tones";
-    field public static final java.lang.String BOOL_APN_EXPAND = "bool_apn_expand";
-    field public static final java.lang.String BOOL_AUTO_RETRY_ENABLED = "bool_auto_retry_enabled";
-    field public static final java.lang.String BOOL_CARRIER_SETTINGS_ENABLE = "bool_carrier_settings_enable";
-    field public static final java.lang.String BOOL_CARRIER_VOLTE_AVAILABLE = "bool_carrier_volte_available";
-    field public static final java.lang.String BOOL_CARRIER_VOLTE_PROVISIONED = "bool_carrier_volte_provisioned";
-    field public static final java.lang.String BOOL_CARRIER_VOLTE_TTY_SUPPORTED = "bool_carrier_volte_tty_supported";
-    field public static final java.lang.String BOOL_DISABLE_CDMA_ACTIVATION_CODE = "bool_disable_cdma_activation_code";
-    field public static final java.lang.String BOOL_DTMF_TYPE_ENABLED = "bool_dtmf_type_enabled";
-    field public static final java.lang.String BOOL_ENABLE_DIALER_KEY_VIBRATION = "bool_enable_dialer_key_vibration";
-    field public static final java.lang.String BOOL_HAS_IN_CALL_NOISE_SUPPRESSION = "bool_has_in_call_noise_suppression";
-    field public static final java.lang.String BOOL_HIDE_CARRIER_NETWORK_SETTINGS = "bool_hide_carrier_network_settings";
-    field public static final java.lang.String BOOL_IGNORE_SIM_NETWORK_LOCKED_EVENTS = "bool_ignore_sim_network_locked_events";
-    field public static final java.lang.String BOOL_MMS_ALIAS_ENABLED = "aliasEnabled";
-    field public static final java.lang.String BOOL_MMS_ALLOW_ATTACH_AUDIO = "allowAttachAudio";
-    field public static final java.lang.String BOOL_MMS_APPEND_TRANSACTION_ID = "enabledTransID";
-    field public static final java.lang.String BOOL_MMS_GROUP_MMS_ENABLED = "enableGroupMms";
-    field public static final java.lang.String BOOL_MMS_MMS_DELIVERY_REPORT_ENABLED = "enableMMSDeliveryReports";
-    field public static final java.lang.String BOOL_MMS_MMS_ENABLED = "enabledMMS";
-    field public static final java.lang.String BOOL_MMS_MMS_READ_REPORT_ENABLED = "enableMMSReadReports";
-    field public static final java.lang.String BOOL_MMS_MULTIPART_SMS_ENABLED = "enableMultipartSMS";
-    field public static final java.lang.String BOOL_MMS_NOTIFY_WAP_MMSC_ENABLED = "enabledNotifyWapMMSC";
-    field public static final java.lang.String BOOL_MMS_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES = "sendMultipartSmsAsSeparateMessages";
-    field public static final java.lang.String BOOL_MMS_SHOW_CELL_BROADCAST_APP_LINKS = "config_cellBroadcastAppLinks";
-    field public static final java.lang.String BOOL_MMS_SMS_DELIVERY_REPORT_ENABLED = "enableSMSDeliveryReports";
-    field public static final java.lang.String BOOL_MMS_SUPPORT_HTTP_CHARSET_HEADER = "supportHttpCharsetHeader";
-    field public static final java.lang.String BOOL_MMS_SUPPORT_MMS_CONTENT_DISPOSITION = "supportMmsContentDisposition";
-    field public static final java.lang.String BOOL_OPERATOR_SELECTION_EXPAND = "bool_operator_selection_expand";
-    field public static final java.lang.String BOOL_PREFER_2G = "bool_prefer_2g";
-    field public static final java.lang.String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma";
-    field public static final java.lang.String BOOL_SHOW_CDMA_CHOICES = "bool_show_cdma_choices";
-    field public static final java.lang.String BOOL_SHOW_ONSCREEN_DIAL_BUTTON = "bool_show_onscreen_dial_button";
-    field public static final java.lang.String BOOL_SIM_NETWORK_UNLOCK_ALLOW_DISMISS = "bool_sim_network_unlock_allow_dismiss";
-    field public static final java.lang.String BOOL_SUPPORT_PAUSE_IMS_VIDEO_CALLS = "bool_support_pause_ims_video_calls";
-    field public static final java.lang.String BOOL_SUPPORT_SWAP_AFTER_MERGE = "bool_support_swap_after_merge";
-    field public static final java.lang.String BOOL_USE_HFA_FOR_PROVISIONING = "bool_use_hfa_for_provisioning";
-    field public static final java.lang.String BOOL_USE_OTASP_FOR_PROVISIONING = "bool_use_otasp_for_provisioning";
-    field public static final java.lang.String BOOL_VOICEMAIL_NOTIFICATION_PERSISTENT = "bool_voicemail_notification_persistent";
-    field public static final java.lang.String BOOL_VOICE_PRIVACY_DISABLE = "bool_voice_privacy_disable";
-    field public static final java.lang.String BOOL_WORLD_PHONE = "bool_world_phone";
-    field public static final java.lang.String INT_MMS_ALIAS_MAX_CHARS = "aliasMaxChars";
-    field public static final java.lang.String INT_MMS_ALIAS_MIN_CHARS = "aliasMinChars";
-    field public static final java.lang.String INT_MMS_HTTP_SOCKET_TIMEOUT = "httpSocketTimeout";
-    field public static final java.lang.String INT_MMS_MAX_IMAGE_HEIGHT = "maxImageHeight";
-    field public static final java.lang.String INT_MMS_MAX_IMAGE_WIDTH = "maxImageWidth";
-    field public static final java.lang.String INT_MMS_MAX_MESSAGE_SIZE = "maxMessageSize";
-    field public static final java.lang.String INT_MMS_MESSAGE_TEXT_MAX_SIZE = "maxMessageTextSize";
-    field public static final java.lang.String INT_MMS_RECIPIENT_LIMIT = "recipientLimit";
-    field public static final java.lang.String INT_MMS_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD = "smsToMmsTextLengthThreshold";
-    field public static final java.lang.String INT_MMS_SMS_TO_MMS_TEXT_THRESHOLD = "smsToMmsTextThreshold";
-    field public static final java.lang.String INT_MMS_SUBJECT_MAX_LENGTH = "maxSubjectLength";
-    field public static final java.lang.String INT_VOLTE_REPLACEMENT_RAT = "int_volte_replacement_rat";
-    field public static final java.lang.String STRING_MMS_EMAIL_GATEWAY_NUMBER = "emailGatewayNumber";
-    field public static final java.lang.String STRING_MMS_HTTP_PARAMS = "httpParams";
-    field public static final java.lang.String STRING_MMS_NAI_SUFFIX = "naiSuffix";
-    field public static final java.lang.String STRING_MMS_UA_PROF_TAG_NAME = "uaProfTagName";
-    field public static final java.lang.String STRING_MMS_UA_PROF_URL = "uaProfUrl";
-    field public static final java.lang.String STRING_MMS_USER_AGENT = "userAgent";
+    field public static final java.lang.String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool";
+    field public static final java.lang.String KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL = "allow_emergency_numbers_in_call_log_bool";
+    field public static final java.lang.String KEY_ALLOW_LOCAL_DTMF_TONES_BOOL = "allow_local_dtmf_tones_bool";
+    field public static final java.lang.String KEY_APN_EXPAND_BOOL = "apn_expand_bool";
+    field public static final java.lang.String KEY_AUTO_RETRY_ENABLED_BOOL = "auto_retry_enabled_bool";
+    field public static final java.lang.String KEY_CARRIER_SETTINGS_ENABLE_BOOL = "carrier_settings_enable_bool";
+    field public static final java.lang.String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool";
+    field public static final java.lang.String KEY_CARRIER_VOLTE_PROVISIONED_BOOL = "carrier_volte_provisioned_bool";
+    field public static final java.lang.String KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL = "carrier_volte_tty_supported_bool";
+    field public static final java.lang.String KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL = "disable_cdma_activation_code_bool";
+    field public static final java.lang.String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool";
+    field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "key_enable_dialer_vibration_bool";
+    field public static final java.lang.String KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL = "has_in_call_noise_suppression_bool";
+    field public static final java.lang.String KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL = "hide_carrier_network_settings_bool";
+    field public static final java.lang.String KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL = "ignore_sim_network_locked_events_bool";
+    field public static final java.lang.String KEY_MMS_ALIAS_ENABLED_BOOL = "aliasEnabled";
+    field public static final java.lang.String KEY_MMS_ALIAS_MAX_CHARS_INT = "aliasMaxChars";
+    field public static final java.lang.String KEY_MMS_ALIAS_MIN_CHARS_INT = "aliasMinChars";
+    field public static final java.lang.String KEY_MMS_ALLOW_ATTACH_AUDIO_BOOL = "allowAttachAudio";
+    field public static final java.lang.String KEY_MMS_APPEND_TRANSACTION_ID_BOOL = "enabledTransID";
+    field public static final java.lang.String KEY_MMS_EMAIL_GATEWAY_NUMBER_STRING = "emailGatewayNumber";
+    field public static final java.lang.String KEY_MMS_GROUP_MMS_ENABLED_BOOL = "enableGroupMms";
+    field public static final java.lang.String KEY_MMS_HTTP_PARAMS_STRING = "httpParams";
+    field public static final java.lang.String KEY_MMS_HTTP_SOCKET_TIMEOUT_INT = "httpSocketTimeout";
+    field public static final java.lang.String KEY_MMS_MAX_IMAGE_HEIGHT_INT = "maxImageHeight";
+    field public static final java.lang.String KEY_MMS_MAX_IMAGE_WIDTH_INT = "maxImageWidth";
+    field public static final java.lang.String KEY_MMS_MAX_MESSAGE_SIZE_INT = "maxMessageSize";
+    field public static final java.lang.String KEY_MMS_MESSAGE_TEXT_MAX_SIZE_INT = "maxMessageTextSize";
+    field public static final java.lang.String KEY_MMS_MMS_DELIVERY_REPORT_ENABLED_BOOL = "enableMMSDeliveryReports";
+    field public static final java.lang.String KEY_MMS_MMS_ENABLED_BOOL = "enabledMMS";
+    field public static final java.lang.String KEY_MMS_MMS_READ_REPORT_ENABLED_BOOL = "enableMMSReadReports";
+    field public static final java.lang.String KEY_MMS_MULTIPART_SMS_ENABLED_BOOL = "enableMultipartSMS";
+    field public static final java.lang.String KEY_MMS_NAI_SUFFIX_STRING = "naiSuffix";
+    field public static final java.lang.String KEY_MMS_NOTIFY_WAP_MMSC_ENABLED_BOOL = "enabledNotifyWapMMSC";
+    field public static final java.lang.String KEY_MMS_RECIPIENT_LIMIT_INT = "recipientLimit";
+    field public static final java.lang.String KEY_MMS_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES_BOOL = "sendMultipartSmsAsSeparateMessages";
+    field public static final java.lang.String KEY_MMS_SHOW_CELL_BROADCAST_APP_LINKS_BOOL = "config_cellBroadcastAppLinks";
+    field public static final java.lang.String KEY_MMS_SMS_DELIVERY_REPORT_ENABLED_BOOL = "enableSMSDeliveryReports";
+    field public static final java.lang.String KEY_MMS_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD_INT = "smsToMmsTextLengthThreshold";
+    field public static final java.lang.String KEY_MMS_SMS_TO_MMS_TEXT_THRESHOLD_INT = "smsToMmsTextThreshold";
+    field public static final java.lang.String KEY_MMS_SUBJECT_MAX_LENGTH_INT = "maxSubjectLength";
+    field public static final java.lang.String KEY_MMS_SUPPORT_HTTP_CHARSET_HEADER_BOOL = "supportHttpCharsetHeader";
+    field public static final java.lang.String KEY_MMS_SUPPORT_MMS_CONTENT_DISPOSITION_BOOL = "supportMmsContentDisposition";
+    field public static final java.lang.String KEY_MMS_UA_PROF_TAG_NAME_STRING = "uaProfTagName";
+    field public static final java.lang.String KEY_MMS_UA_PROF_URL_STRING = "uaProfUrl";
+    field public static final java.lang.String KEY_MMS_USER_AGENT_STRING = "userAgent";
+    field public static final java.lang.String KEY_OPERATOR_SELECTION_EXPAND_BOOL = "operator_selection_expand_bool";
+    field public static final java.lang.String KEY_PREFER_2G_BOOL = "prefer_2g_bool";
+    field public static final java.lang.String KEY_SHOW_APN_SETTING_CDMA_BOOL = "show_apn_setting_cdma_bool";
+    field public static final java.lang.String KEY_SHOW_CDMA_CHOICES_BOOL = "show_cdma_choices_bool";
+    field public static final java.lang.String KEY_SHOW_ONSCREEN_DIAL_BUTTON_BOOL = "show_onscreen_dial_button_bool";
+    field public static final java.lang.String KEY_SIM_NETWORK_UNLOCK_ALLOW_DISMISS_BOOL = "sim_network_unlock_allow_dismiss_bool";
+    field public static final java.lang.String KEY_SUPPORT_PAUSE_IMS_VIDEO_CALLS_BOOL = "support_pause_ims_video_calls_bool";
+    field public static final java.lang.String KEY_SUPPORT_SWAP_AFTER_MERGE_BOOL = "support_swap_after_merge_bool";
+    field public static final java.lang.String KEY_USE_HFA_FOR_PROVISIONING_BOOL = "use_hfa_for_provisioning_bool";
+    field public static final java.lang.String KEY_USE_OTASP_FOR_PROVISIONING_BOOL = "use_otasp_for_provisioning_bool";
+    field public static final java.lang.String KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL = "voicemail_notification_persistent_bool";
+    field public static final java.lang.String KEY_VOICE_PRIVACY_DISABLE_BOOL = "voice_privacy_disable_bool";
+    field public static final java.lang.String KEY_VOLTE_REPLACEMENT_RAT_INT = "volte_replacement_rat_int";
+    field public static final java.lang.String KEY_WORLD_PHONE_BOOL = "world_phone_bool";
   }
 
   public final class CellIdentityCdma implements android.os.Parcelable {
diff --git a/api/system-current.txt b/api/system-current.txt
index ae4bae6..bcb8784 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5594,7 +5594,8 @@
   }
 
   public static class VoiceInteractor.AbortVoiceRequest extends android.app.VoiceInteractor.Request {
-    ctor public VoiceInteractor.AbortVoiceRequest(java.lang.CharSequence, android.os.Bundle);
+    ctor public VoiceInteractor.AbortVoiceRequest(android.app.VoiceInteractor.Prompt, android.os.Bundle);
+    ctor public deprecated VoiceInteractor.AbortVoiceRequest(java.lang.CharSequence, android.os.Bundle);
     method public void onAbortResult(android.os.Bundle);
   }
 
@@ -5604,17 +5605,20 @@
   }
 
   public static class VoiceInteractor.CompleteVoiceRequest extends android.app.VoiceInteractor.Request {
-    ctor public VoiceInteractor.CompleteVoiceRequest(java.lang.CharSequence, android.os.Bundle);
+    ctor public VoiceInteractor.CompleteVoiceRequest(android.app.VoiceInteractor.Prompt, android.os.Bundle);
+    ctor public deprecated VoiceInteractor.CompleteVoiceRequest(java.lang.CharSequence, android.os.Bundle);
     method public void onCompleteResult(android.os.Bundle);
   }
 
   public static class VoiceInteractor.ConfirmationRequest extends android.app.VoiceInteractor.Request {
-    ctor public VoiceInteractor.ConfirmationRequest(java.lang.CharSequence, android.os.Bundle);
+    ctor public VoiceInteractor.ConfirmationRequest(android.app.VoiceInteractor.Prompt, android.os.Bundle);
+    ctor public deprecated VoiceInteractor.ConfirmationRequest(java.lang.CharSequence, android.os.Bundle);
     method public void onConfirmationResult(boolean, android.os.Bundle);
   }
 
   public static class VoiceInteractor.PickOptionRequest extends android.app.VoiceInteractor.Request {
-    ctor public VoiceInteractor.PickOptionRequest(java.lang.CharSequence, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+    ctor public VoiceInteractor.PickOptionRequest(android.app.VoiceInteractor.Prompt, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+    ctor public deprecated VoiceInteractor.PickOptionRequest(java.lang.CharSequence, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
     method public void onPickOptionResult(boolean, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
   }
 
@@ -5633,6 +5637,17 @@
     field public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.PickOptionRequest.Option> CREATOR;
   }
 
+  public static class VoiceInteractor.Prompt implements android.os.Parcelable {
+    ctor public VoiceInteractor.Prompt(java.lang.CharSequence[], java.lang.CharSequence);
+    ctor public VoiceInteractor.Prompt(java.lang.CharSequence);
+    method public int countVoicePrompts();
+    method public int describeContents();
+    method public java.lang.CharSequence getVisualPrompt();
+    method public java.lang.CharSequence getVoicePromptAt(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.Prompt> CREATOR;
+  }
+
   public static abstract class VoiceInteractor.Request {
     method public void cancel();
     method public android.app.Activity getActivity();
@@ -12504,6 +12519,7 @@
     method public int getOpacity();
     method public boolean isRunning();
     method public void registerAnimationCallback(android.graphics.drawable.Animatable2.AnimationCallback);
+    method public void reset();
     method public void setAlpha(int);
     method public void setColorFilter(android.graphics.ColorFilter);
     method public void start();
@@ -26418,10 +26434,10 @@
 
   public final class AlarmClock {
     ctor public AlarmClock();
+    field public static final java.lang.String ACTION_DISMISS_ALARM = "android.intent.action.DISMISS_ALARM";
     field public static final java.lang.String ACTION_SET_ALARM = "android.intent.action.SET_ALARM";
     field public static final java.lang.String ACTION_SET_TIMER = "android.intent.action.SET_TIMER";
     field public static final java.lang.String ACTION_SHOW_ALARMS = "android.intent.action.SHOW_ALARMS";
-    field public static final java.lang.String ACTION_DISMISS_ALARM = "android.intent.action.DISMISS_ALARM";
     field public static final java.lang.String ACTION_SNOOZE_ALARM = "android.intent.action.SNOOZE_ALARM";
     field public static final java.lang.String ALARM_SEARCH_MODE_ALL = "android.all";
     field public static final java.lang.String ALARM_SEARCH_MODE_LABEL = "android.label";
@@ -31119,7 +31135,8 @@
   }
 
   public static final class VoiceInteractionSession.AbortVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
-    method public java.lang.CharSequence getMessage();
+    method public deprecated java.lang.CharSequence getMessage();
+    method public android.app.VoiceInteractor.Prompt getVoicePrompt();
     method public void sendAbortResult(android.os.Bundle);
   }
 
@@ -31130,12 +31147,14 @@
   }
 
   public static final class VoiceInteractionSession.CompleteVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
-    method public java.lang.CharSequence getMessage();
+    method public deprecated java.lang.CharSequence getMessage();
+    method public android.app.VoiceInteractor.Prompt getVoicePrompt();
     method public void sendCompleteResult(android.os.Bundle);
   }
 
   public static final class VoiceInteractionSession.ConfirmationRequest extends android.service.voice.VoiceInteractionSession.Request {
-    method public java.lang.CharSequence getPrompt();
+    method public deprecated java.lang.CharSequence getPrompt();
+    method public android.app.VoiceInteractor.Prompt getVoicePrompt();
     method public void sendConfirmationResult(boolean, android.os.Bundle);
   }
 
@@ -31151,7 +31170,8 @@
 
   public static final class VoiceInteractionSession.PickOptionRequest extends android.service.voice.VoiceInteractionSession.Request {
     method public android.app.VoiceInteractor.PickOptionRequest.Option[] getOptions();
-    method public java.lang.CharSequence getPrompt();
+    method public deprecated java.lang.CharSequence getPrompt();
+    method public android.app.VoiceInteractor.Prompt getVoicePrompt();
     method public void sendIntermediatePickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
     method public void sendPickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
   }
@@ -32871,66 +32891,66 @@
     method public void reloadCarrierConfigForSubId(int);
     method public void updateConfigForPhoneId(int, java.lang.String);
     field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
-    field public static final java.lang.String BOOL_ADDITIONAL_CALL_SETTING = "bool_additional_call_setting";
-    field public static final java.lang.String BOOL_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG = "bool_allow_emergency_numbers_in_call_log";
-    field public static final java.lang.String BOOL_ALLOW_LOCAL_DTMF_TONES = "bool_allow_local_dtmf_tones";
-    field public static final java.lang.String BOOL_APN_EXPAND = "bool_apn_expand";
-    field public static final java.lang.String BOOL_AUTO_RETRY_ENABLED = "bool_auto_retry_enabled";
-    field public static final java.lang.String BOOL_CARRIER_SETTINGS_ENABLE = "bool_carrier_settings_enable";
-    field public static final java.lang.String BOOL_CARRIER_VOLTE_AVAILABLE = "bool_carrier_volte_available";
-    field public static final java.lang.String BOOL_CARRIER_VOLTE_PROVISIONED = "bool_carrier_volte_provisioned";
-    field public static final java.lang.String BOOL_CARRIER_VOLTE_TTY_SUPPORTED = "bool_carrier_volte_tty_supported";
-    field public static final java.lang.String BOOL_DISABLE_CDMA_ACTIVATION_CODE = "bool_disable_cdma_activation_code";
-    field public static final java.lang.String BOOL_DTMF_TYPE_ENABLED = "bool_dtmf_type_enabled";
-    field public static final java.lang.String BOOL_ENABLE_DIALER_KEY_VIBRATION = "bool_enable_dialer_key_vibration";
-    field public static final java.lang.String BOOL_HAS_IN_CALL_NOISE_SUPPRESSION = "bool_has_in_call_noise_suppression";
-    field public static final java.lang.String BOOL_HIDE_CARRIER_NETWORK_SETTINGS = "bool_hide_carrier_network_settings";
-    field public static final java.lang.String BOOL_IGNORE_SIM_NETWORK_LOCKED_EVENTS = "bool_ignore_sim_network_locked_events";
-    field public static final java.lang.String BOOL_MMS_ALIAS_ENABLED = "aliasEnabled";
-    field public static final java.lang.String BOOL_MMS_ALLOW_ATTACH_AUDIO = "allowAttachAudio";
-    field public static final java.lang.String BOOL_MMS_APPEND_TRANSACTION_ID = "enabledTransID";
-    field public static final java.lang.String BOOL_MMS_GROUP_MMS_ENABLED = "enableGroupMms";
-    field public static final java.lang.String BOOL_MMS_MMS_DELIVERY_REPORT_ENABLED = "enableMMSDeliveryReports";
-    field public static final java.lang.String BOOL_MMS_MMS_ENABLED = "enabledMMS";
-    field public static final java.lang.String BOOL_MMS_MMS_READ_REPORT_ENABLED = "enableMMSReadReports";
-    field public static final java.lang.String BOOL_MMS_MULTIPART_SMS_ENABLED = "enableMultipartSMS";
-    field public static final java.lang.String BOOL_MMS_NOTIFY_WAP_MMSC_ENABLED = "enabledNotifyWapMMSC";
-    field public static final java.lang.String BOOL_MMS_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES = "sendMultipartSmsAsSeparateMessages";
-    field public static final java.lang.String BOOL_MMS_SHOW_CELL_BROADCAST_APP_LINKS = "config_cellBroadcastAppLinks";
-    field public static final java.lang.String BOOL_MMS_SMS_DELIVERY_REPORT_ENABLED = "enableSMSDeliveryReports";
-    field public static final java.lang.String BOOL_MMS_SUPPORT_HTTP_CHARSET_HEADER = "supportHttpCharsetHeader";
-    field public static final java.lang.String BOOL_MMS_SUPPORT_MMS_CONTENT_DISPOSITION = "supportMmsContentDisposition";
-    field public static final java.lang.String BOOL_OPERATOR_SELECTION_EXPAND = "bool_operator_selection_expand";
-    field public static final java.lang.String BOOL_PREFER_2G = "bool_prefer_2g";
-    field public static final java.lang.String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma";
-    field public static final java.lang.String BOOL_SHOW_CDMA_CHOICES = "bool_show_cdma_choices";
-    field public static final java.lang.String BOOL_SHOW_ONSCREEN_DIAL_BUTTON = "bool_show_onscreen_dial_button";
-    field public static final java.lang.String BOOL_SIM_NETWORK_UNLOCK_ALLOW_DISMISS = "bool_sim_network_unlock_allow_dismiss";
-    field public static final java.lang.String BOOL_SUPPORT_PAUSE_IMS_VIDEO_CALLS = "bool_support_pause_ims_video_calls";
-    field public static final java.lang.String BOOL_SUPPORT_SWAP_AFTER_MERGE = "bool_support_swap_after_merge";
-    field public static final java.lang.String BOOL_USE_HFA_FOR_PROVISIONING = "bool_use_hfa_for_provisioning";
-    field public static final java.lang.String BOOL_USE_OTASP_FOR_PROVISIONING = "bool_use_otasp_for_provisioning";
-    field public static final java.lang.String BOOL_VOICEMAIL_NOTIFICATION_PERSISTENT = "bool_voicemail_notification_persistent";
-    field public static final java.lang.String BOOL_VOICE_PRIVACY_DISABLE = "bool_voice_privacy_disable";
-    field public static final java.lang.String BOOL_WORLD_PHONE = "bool_world_phone";
-    field public static final java.lang.String INT_MMS_ALIAS_MAX_CHARS = "aliasMaxChars";
-    field public static final java.lang.String INT_MMS_ALIAS_MIN_CHARS = "aliasMinChars";
-    field public static final java.lang.String INT_MMS_HTTP_SOCKET_TIMEOUT = "httpSocketTimeout";
-    field public static final java.lang.String INT_MMS_MAX_IMAGE_HEIGHT = "maxImageHeight";
-    field public static final java.lang.String INT_MMS_MAX_IMAGE_WIDTH = "maxImageWidth";
-    field public static final java.lang.String INT_MMS_MAX_MESSAGE_SIZE = "maxMessageSize";
-    field public static final java.lang.String INT_MMS_MESSAGE_TEXT_MAX_SIZE = "maxMessageTextSize";
-    field public static final java.lang.String INT_MMS_RECIPIENT_LIMIT = "recipientLimit";
-    field public static final java.lang.String INT_MMS_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD = "smsToMmsTextLengthThreshold";
-    field public static final java.lang.String INT_MMS_SMS_TO_MMS_TEXT_THRESHOLD = "smsToMmsTextThreshold";
-    field public static final java.lang.String INT_MMS_SUBJECT_MAX_LENGTH = "maxSubjectLength";
-    field public static final java.lang.String INT_VOLTE_REPLACEMENT_RAT = "int_volte_replacement_rat";
-    field public static final java.lang.String STRING_MMS_EMAIL_GATEWAY_NUMBER = "emailGatewayNumber";
-    field public static final java.lang.String STRING_MMS_HTTP_PARAMS = "httpParams";
-    field public static final java.lang.String STRING_MMS_NAI_SUFFIX = "naiSuffix";
-    field public static final java.lang.String STRING_MMS_UA_PROF_TAG_NAME = "uaProfTagName";
-    field public static final java.lang.String STRING_MMS_UA_PROF_URL = "uaProfUrl";
-    field public static final java.lang.String STRING_MMS_USER_AGENT = "userAgent";
+    field public static final java.lang.String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool";
+    field public static final java.lang.String KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL = "allow_emergency_numbers_in_call_log_bool";
+    field public static final java.lang.String KEY_ALLOW_LOCAL_DTMF_TONES_BOOL = "allow_local_dtmf_tones_bool";
+    field public static final java.lang.String KEY_APN_EXPAND_BOOL = "apn_expand_bool";
+    field public static final java.lang.String KEY_AUTO_RETRY_ENABLED_BOOL = "auto_retry_enabled_bool";
+    field public static final java.lang.String KEY_CARRIER_SETTINGS_ENABLE_BOOL = "carrier_settings_enable_bool";
+    field public static final java.lang.String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool";
+    field public static final java.lang.String KEY_CARRIER_VOLTE_PROVISIONED_BOOL = "carrier_volte_provisioned_bool";
+    field public static final java.lang.String KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL = "carrier_volte_tty_supported_bool";
+    field public static final java.lang.String KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL = "disable_cdma_activation_code_bool";
+    field public static final java.lang.String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool";
+    field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "key_enable_dialer_vibration_bool";
+    field public static final java.lang.String KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL = "has_in_call_noise_suppression_bool";
+    field public static final java.lang.String KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL = "hide_carrier_network_settings_bool";
+    field public static final java.lang.String KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL = "ignore_sim_network_locked_events_bool";
+    field public static final java.lang.String KEY_MMS_ALIAS_ENABLED_BOOL = "aliasEnabled";
+    field public static final java.lang.String KEY_MMS_ALIAS_MAX_CHARS_INT = "aliasMaxChars";
+    field public static final java.lang.String KEY_MMS_ALIAS_MIN_CHARS_INT = "aliasMinChars";
+    field public static final java.lang.String KEY_MMS_ALLOW_ATTACH_AUDIO_BOOL = "allowAttachAudio";
+    field public static final java.lang.String KEY_MMS_APPEND_TRANSACTION_ID_BOOL = "enabledTransID";
+    field public static final java.lang.String KEY_MMS_EMAIL_GATEWAY_NUMBER_STRING = "emailGatewayNumber";
+    field public static final java.lang.String KEY_MMS_GROUP_MMS_ENABLED_BOOL = "enableGroupMms";
+    field public static final java.lang.String KEY_MMS_HTTP_PARAMS_STRING = "httpParams";
+    field public static final java.lang.String KEY_MMS_HTTP_SOCKET_TIMEOUT_INT = "httpSocketTimeout";
+    field public static final java.lang.String KEY_MMS_MAX_IMAGE_HEIGHT_INT = "maxImageHeight";
+    field public static final java.lang.String KEY_MMS_MAX_IMAGE_WIDTH_INT = "maxImageWidth";
+    field public static final java.lang.String KEY_MMS_MAX_MESSAGE_SIZE_INT = "maxMessageSize";
+    field public static final java.lang.String KEY_MMS_MESSAGE_TEXT_MAX_SIZE_INT = "maxMessageTextSize";
+    field public static final java.lang.String KEY_MMS_MMS_DELIVERY_REPORT_ENABLED_BOOL = "enableMMSDeliveryReports";
+    field public static final java.lang.String KEY_MMS_MMS_ENABLED_BOOL = "enabledMMS";
+    field public static final java.lang.String KEY_MMS_MMS_READ_REPORT_ENABLED_BOOL = "enableMMSReadReports";
+    field public static final java.lang.String KEY_MMS_MULTIPART_SMS_ENABLED_BOOL = "enableMultipartSMS";
+    field public static final java.lang.String KEY_MMS_NAI_SUFFIX_STRING = "naiSuffix";
+    field public static final java.lang.String KEY_MMS_NOTIFY_WAP_MMSC_ENABLED_BOOL = "enabledNotifyWapMMSC";
+    field public static final java.lang.String KEY_MMS_RECIPIENT_LIMIT_INT = "recipientLimit";
+    field public static final java.lang.String KEY_MMS_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES_BOOL = "sendMultipartSmsAsSeparateMessages";
+    field public static final java.lang.String KEY_MMS_SHOW_CELL_BROADCAST_APP_LINKS_BOOL = "config_cellBroadcastAppLinks";
+    field public static final java.lang.String KEY_MMS_SMS_DELIVERY_REPORT_ENABLED_BOOL = "enableSMSDeliveryReports";
+    field public static final java.lang.String KEY_MMS_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD_INT = "smsToMmsTextLengthThreshold";
+    field public static final java.lang.String KEY_MMS_SMS_TO_MMS_TEXT_THRESHOLD_INT = "smsToMmsTextThreshold";
+    field public static final java.lang.String KEY_MMS_SUBJECT_MAX_LENGTH_INT = "maxSubjectLength";
+    field public static final java.lang.String KEY_MMS_SUPPORT_HTTP_CHARSET_HEADER_BOOL = "supportHttpCharsetHeader";
+    field public static final java.lang.String KEY_MMS_SUPPORT_MMS_CONTENT_DISPOSITION_BOOL = "supportMmsContentDisposition";
+    field public static final java.lang.String KEY_MMS_UA_PROF_TAG_NAME_STRING = "uaProfTagName";
+    field public static final java.lang.String KEY_MMS_UA_PROF_URL_STRING = "uaProfUrl";
+    field public static final java.lang.String KEY_MMS_USER_AGENT_STRING = "userAgent";
+    field public static final java.lang.String KEY_OPERATOR_SELECTION_EXPAND_BOOL = "operator_selection_expand_bool";
+    field public static final java.lang.String KEY_PREFER_2G_BOOL = "prefer_2g_bool";
+    field public static final java.lang.String KEY_SHOW_APN_SETTING_CDMA_BOOL = "show_apn_setting_cdma_bool";
+    field public static final java.lang.String KEY_SHOW_CDMA_CHOICES_BOOL = "show_cdma_choices_bool";
+    field public static final java.lang.String KEY_SHOW_ONSCREEN_DIAL_BUTTON_BOOL = "show_onscreen_dial_button_bool";
+    field public static final java.lang.String KEY_SIM_NETWORK_UNLOCK_ALLOW_DISMISS_BOOL = "sim_network_unlock_allow_dismiss_bool";
+    field public static final java.lang.String KEY_SUPPORT_PAUSE_IMS_VIDEO_CALLS_BOOL = "support_pause_ims_video_calls_bool";
+    field public static final java.lang.String KEY_SUPPORT_SWAP_AFTER_MERGE_BOOL = "support_swap_after_merge_bool";
+    field public static final java.lang.String KEY_USE_HFA_FOR_PROVISIONING_BOOL = "use_hfa_for_provisioning_bool";
+    field public static final java.lang.String KEY_USE_OTASP_FOR_PROVISIONING_BOOL = "use_otasp_for_provisioning_bool";
+    field public static final java.lang.String KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL = "voicemail_notification_persistent_bool";
+    field public static final java.lang.String KEY_VOICE_PRIVACY_DISABLE_BOOL = "voice_privacy_disable_bool";
+    field public static final java.lang.String KEY_VOLTE_REPLACEMENT_RAT_INT = "volte_replacement_rat_int";
+    field public static final java.lang.String KEY_WORLD_PHONE_BOOL = "world_phone_bool";
   }
 
   public final class CellIdentityCdma implements android.os.Parcelable {
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 808e124..b0a7dc7 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -31,6 +31,7 @@
 import android.app.usage.ConfigurationStats;
 import android.app.usage.IUsageStatsManager;
 import android.app.usage.UsageStatsManager;
+import android.content.ComponentCallbacks2;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.IIntentReceiver;
@@ -144,6 +145,8 @@
                 "       am get-config\n" +
                 "       am set-inactive [--user <USER_ID>] <PACKAGE> true|false\n" +
                 "       am get-inactive [--user <USER_ID>] <PACKAGE>\n" +
+                "       am send-trim-memory [--user <USER_ID>] <PROCESS>\n" +
+                "               [HIDDEN|RUNNING_MODERATE|BACKGROUND|RUNNING_LOW|MODERATE|RUNNING_CRITICAL|COMPLETE]\n" +
                 "\n" +
                 "am start: start an Activity.  Options are:\n" +
                 "    -D: enable debugging\n" +
@@ -271,9 +274,9 @@
                 "\n" +
                 "am stack info: display the information about activity stack <STACK_ID>.\n" +
                 "\n" +
-                "am task lock: bring <TASK_ID> to the front and don't allow other tasks to run\n" +
+                "am task lock: bring <TASK_ID> to the front and don't allow other tasks to run.\n" +
                 "\n" +
-                "am task lock stop: end the current task lock\n" +
+                "am task lock stop: end the current task lock.\n" +
                 "\n" +
                 "am task resizeable: change if <TASK_ID> is resizeable (true) or not (false).\n" +
                 "\n" +
@@ -282,12 +285,13 @@
                 "   has the specified bounds.\n" +
                 "\n" +
                 "am get-config: retrieve the configuration and any recent configurations\n" +
-                "  of the device\n" +
+                "  of the device.\n" +
                 "\n" +
-                "am set-inactive: sets the inactive state of an app\n" +
+                "am set-inactive: sets the inactive state of an app.\n" +
                 "\n" +
-                "am get-inactive: returns the inactive state of an app\n" +
+                "am get-inactive: returns the inactive state of an app.\n" +
                 "\n" +
+                " am send-trim-memory: Send a memory trim event to a <PROCESS>.\n" +
                 "\n" +
                 "<INTENT> specifications include these flags and arguments:\n" +
                 "    [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]\n" +
@@ -399,6 +403,8 @@
             runSetInactive();
         } else if (op.equals("get-inactive")) {
             runGetInactive();
+        } else if (op.equals("send-trim-memory")) {
+            runSendTrimMemory();
         } else {
             showError("Error: unknown command '" + op + "'");
         }
@@ -2070,6 +2076,57 @@
         System.out.println("Idle=" + isIdle);
     }
 
+    private void runSendTrimMemory() throws Exception {
+        int userId = UserHandle.USER_CURRENT;
+        String opt;
+        while ((opt = nextOption()) != null) {
+            if (opt.equals("--user")) {
+                userId = parseUserArg(nextArgRequired());
+                if (userId == UserHandle.USER_ALL) {
+                    System.err.println("Error: Can't use user 'all'");
+                    return;
+                }
+            } else {
+                System.err.println("Error: Unknown option: " + opt);
+                return;
+            }
+        }
+
+        String proc = nextArgRequired();
+        String levelArg = nextArgRequired();
+        int level;
+        switch (levelArg) {
+            case "HIDDEN":
+                level = ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN;
+                break;
+            case "RUNNING_MODERATE":
+                level = ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE;
+                break;
+            case "BACKGROUND":
+                level = ComponentCallbacks2.TRIM_MEMORY_BACKGROUND;
+                break;
+            case "RUNNING_LOW":
+                level = ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW;
+                break;
+            case "MODERATE":
+                level = ComponentCallbacks2.TRIM_MEMORY_MODERATE;
+                break;
+            case "RUNNING_CRITICAL":
+                level = ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL;
+                break;
+            case "COMPLETE":
+                level = ComponentCallbacks2.TRIM_MEMORY_COMPLETE;
+                break;
+            default:
+                System.err.println("Error: Unknown level option: " + levelArg);
+                return;
+        }
+        if (!mAm.setProcessMemoryTrimLevel(proc, userId, level)) {
+            System.err.println("Error: Failure to set the level - probably Unknown Process: " +
+                               proc);
+        }
+    }
+
     /**
      * Open the given file for sending into the system process. This verifies
      * with SELinux that the system will have access to the file.
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index edebc28..3892dd9 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -462,7 +462,7 @@
     public int getMemoryClass() {
         return staticGetMemoryClass();
     }
-    
+
     /** @hide */
     static public int staticGetMemoryClass() {
         // Really brain dead right now -- just take this from the configured
@@ -473,7 +473,7 @@
         }
         return staticGetLargeMemoryClass();
     }
-    
+
     /**
      * Return the approximate per-application memory class of the current
      * device when an application is running with a large heap.  This is the
@@ -490,7 +490,7 @@
     public int getLargeMemoryClass() {
         return staticGetLargeMemoryClass();
     }
-    
+
     /** @hide */
     static public int staticGetLargeMemoryClass() {
         // Really brain dead right now -- just take this from the configured
@@ -809,7 +809,7 @@
          * The true identifier of this task, valid even if it is not running.
          */
         public int persistentId;
-        
+
         /**
          * The original Intent used to launch the task.  You can use this
          * Intent to re-launch the task (if it is no longer running) or bring
@@ -1014,7 +1014,7 @@
      * user has started and the maximum number the system can remember.
      * @param flags Information about what to return.  May be any combination
      * of {@link #RECENT_WITH_EXCLUDED} and {@link #RECENT_IGNORE_UNAVAILABLE}.
-     * 
+     *
      * @return Returns a list of RecentTaskInfo records describing each of
      * the recent tasks.
      */
@@ -1146,7 +1146,7 @@
             numActivities = source.readInt();
             numRunning = source.readInt();
         }
-        
+
         public static final Creator<RunningTaskInfo> CREATOR = new Creator<RunningTaskInfo>() {
             public RunningTaskInfo createFromParcel(Parcel source) {
                 return new RunningTaskInfo(source);
@@ -1469,100 +1469,100 @@
          * If non-zero, this is the process the service is running in.
          */
         public int pid;
-        
+
         /**
          * The UID that owns this service.
          */
         public int uid;
-        
+
         /**
          * The name of the process this service runs in.
          */
         public String process;
-        
+
         /**
          * Set to true if the service has asked to run as a foreground process.
          */
         public boolean foreground;
-        
+
         /**
          * The time when the service was first made active, either by someone
          * starting or binding to it.  This
          * is in units of {@link android.os.SystemClock#elapsedRealtime()}.
          */
         public long activeSince;
-        
+
         /**
          * Set to true if this service has been explicitly started.
          */
         public boolean started;
-        
+
         /**
          * Number of clients connected to the service.
          */
         public int clientCount;
-        
+
         /**
          * Number of times the service's process has crashed while the service
          * is running.
          */
         public int crashCount;
-        
+
         /**
          * The time when there was last activity in the service (either
          * explicit requests to start it or clients binding to it).  This
          * is in units of {@link android.os.SystemClock#uptimeMillis()}.
          */
         public long lastActivityTime;
-        
+
         /**
          * If non-zero, this service is not currently running, but scheduled to
          * restart at the given time.
          */
         public long restarting;
-        
+
         /**
          * Bit for {@link #flags}: set if this service has been
          * explicitly started.
          */
         public static final int FLAG_STARTED = 1<<0;
-        
+
         /**
          * Bit for {@link #flags}: set if the service has asked to
          * run as a foreground process.
          */
         public static final int FLAG_FOREGROUND = 1<<1;
-        
+
         /**
          * Bit for {@link #flags): set if the service is running in a
          * core system process.
          */
         public static final int FLAG_SYSTEM_PROCESS = 1<<2;
-        
+
         /**
          * Bit for {@link #flags): set if the service is running in a
          * persistent process.
          */
         public static final int FLAG_PERSISTENT_PROCESS = 1<<3;
-        
+
         /**
          * Running flags.
          */
         public int flags;
-        
+
         /**
          * For special services that are bound to by system code, this is
          * the package that holds the binding.
          */
         public String clientPackage;
-        
+
         /**
          * For special services that are bound to by system code, this is
          * a string resource providing a user-visible label for who the
          * client is.
          */
         public int clientLabel;
-        
+
         public RunningServiceInfo() {
         }
 
@@ -1603,7 +1603,7 @@
             clientPackage = source.readString();
             clientLabel = source.readInt();
         }
-        
+
         public static final Creator<RunningServiceInfo> CREATOR = new Creator<RunningServiceInfo>() {
             public RunningServiceInfo createFromParcel(Parcel source) {
                 return new RunningServiceInfo(source);
@@ -1627,7 +1627,7 @@
      * @param maxNum The maximum number of entries to return in the list.  The
      * actual number returned may be smaller, depending on how many services
      * are running.
-     * 
+     *
      * @return Returns a list of RunningServiceInfo records describing each of
      * the running tasks.
      */
@@ -1641,7 +1641,7 @@
             return null;
         }
     }
-    
+
     /**
      * Returns a PendingIntent you can start to show a control panel for the
      * given running service.  If the service does not have a control panel,
@@ -1657,7 +1657,7 @@
             return null;
         }
     }
-    
+
     /**
      * Information you can retrieve about the available memory through
      * {@link ActivityManager#getMemoryInfo}.
@@ -1684,7 +1684,7 @@
          * processes.
          */
         public long threshold;
-        
+
         /**
          * Set to true if the system considers itself to currently be in a low
          * memory situation.
@@ -1717,7 +1717,7 @@
             dest.writeLong(visibleAppThreshold);
             dest.writeLong(foregroundAppThreshold);
         }
-        
+
         public void readFromParcel(Parcel source) {
             availMem = source.readLong();
             totalMem = source.readLong();
@@ -1841,7 +1841,7 @@
      */
     public boolean clearApplicationUserData(String packageName, IPackageDataObserver observer) {
         try {
-            return ActivityManagerNative.getDefault().clearApplicationUserData(packageName, 
+            return ActivityManagerNative.getDefault().clearApplicationUserData(packageName,
                     observer, UserHandle.myUserId());
         } catch (RemoteException e) {
             return false;
@@ -1882,7 +1882,7 @@
          * The process name in which the crash or error occurred.
          */
         public String processName;
-        
+
         /**
          * The pid of this process; 0 if none
          */
@@ -1894,7 +1894,7 @@
          * the same uid).
          */
         public int uid;
-        
+
         /**
          * The activity name associated with the error, if known.  May be null.
          */
@@ -1950,8 +1950,8 @@
             longMsg = source.readString();
             stackTrace = source.readString();
         }
-        
-        public static final Creator<ProcessErrorStateInfo> CREATOR = 
+
+        public static final Creator<ProcessErrorStateInfo> CREATOR =
                 new Creator<ProcessErrorStateInfo>() {
             public ProcessErrorStateInfo createFromParcel(Parcel source) {
                 return new ProcessErrorStateInfo(source);
@@ -1965,11 +1965,11 @@
             readFromParcel(source);
         }
     }
-    
+
     /**
-     * Returns a list of any processes that are currently in an error condition.  The result 
+     * Returns a list of any processes that are currently in an error condition.  The result
      * will be null if all processes are running properly at this time.
-     * 
+     *
      * @return Returns a list of ProcessErrorStateInfo records, or null if there are no
      * current error conditions (it will not return an empty list).  This list ordering is not
      * specified.
@@ -1985,7 +1985,7 @@
     /**
      * Information you can retrieve about a running process.
      */
-    public static class RunningAppProcessInfo implements Parcelable {        
+    public static class RunningAppProcessInfo implements Parcelable {
         /**
          * The name of the process that this object is associated with
          */
@@ -1995,17 +1995,17 @@
          * The pid of this process; 0 if none
          */
         public int pid;
-        
+
         /**
          * The user id of this process.
          */
         public int uid;
-        
+
         /**
          * All packages that have been loaded into the process.
          */
         public String pkgList[];
-        
+
         /**
          * Constant for {@link #flags}: this is an app that is unable to
          * correctly save its state when going to the background,
@@ -2013,7 +2013,7 @@
          * @hide
          */
         public static final int FLAG_CANT_SAVE_STATE = 1<<0;
-        
+
         /**
          * Constant for {@link #flags}: this process is associated with a
          * persistent system app.
@@ -2048,7 +2048,7 @@
          * that the user is interacting with.
          */
         public static final int IMPORTANCE_FOREGROUND = 100;
-        
+
         /**
          * Constant for {@link #importance}: This process is running a foreground
          * service, for example to perform music playback even while the user is
@@ -2075,13 +2075,13 @@
          * other services under the system's control that it inconsiders important.
          */
         public static final int IMPORTANCE_VISIBLE = 200;
-        
+
         /**
          * Constant for {@link #importance}: This process is not something the user
          * is directly aware of, but is otherwise perceptable to them to some degree.
          */
         public static final int IMPORTANCE_PERCEPTIBLE = 130;
-        
+
         /**
          * Constant for {@link #importance}: This process is running an
          * application that can not save its state, and thus can't be killed
@@ -2089,7 +2089,7 @@
          * @hide
          */
         public static final int IMPORTANCE_CANT_SAVE_STATE = 170;
-        
+
         /**
          * Constant for {@link #importance}: This process is contains services
          * that should remain running.  These are background services apps have
@@ -2098,13 +2098,13 @@
          * stay running as long as they want to).
          */
         public static final int IMPORTANCE_SERVICE = 300;
-        
+
         /**
          * Constant for {@link #importance}: This process process contains
          * background code that is expendable.
          */
         public static final int IMPORTANCE_BACKGROUND = 400;
-        
+
         /**
          * Constant for {@link #importance}: This process is empty of any
          * actively running code.
@@ -2148,7 +2148,7 @@
          * smaller than "less important" values.
          */
         public int importance;
-        
+
         /**
          * An additional ordering within a particular {@link #importance}
          * category, providing finer-grained information about the relative
@@ -2165,7 +2165,7 @@
          * been specified for the reason for this level.
          */
         public static final int REASON_UNKNOWN = 0;
-        
+
         /**
          * Constant for {@link #importanceReasonCode}: one of the application's
          * content providers is being used by another process.  The pid of
@@ -2174,7 +2174,7 @@
          * {@link #importanceReasonComponent}.
          */
         public static final int REASON_PROVIDER_IN_USE = 1;
-        
+
         /**
          * Constant for {@link #importanceReasonCode}: one of the application's
          * content providers is being used by another process.  The pid of
@@ -2183,25 +2183,25 @@
          * {@link #importanceReasonComponent}.
          */
         public static final int REASON_SERVICE_IN_USE = 2;
-        
+
         /**
          * The reason for {@link #importance}, if any.
          */
         public int importanceReasonCode;
-        
+
         /**
          * For the specified values of {@link #importanceReasonCode}, this
          * is the process ID of the other process that is a client of this
          * process.  This will be 0 if no other process is using this one.
          */
         public int importanceReasonPid;
-        
+
         /**
          * For the specified values of {@link #importanceReasonCode}, this
          * is the name of the component that is being used in this process.
          */
         public ComponentName importanceReasonComponent;
-        
+
         /**
          * When {@link #importanceReasonPid} is non-0, this is the importance
          * of the other pid. @hide
@@ -2219,7 +2219,7 @@
             importanceReasonCode = REASON_UNKNOWN;
             processState = PROCESS_STATE_IMPORTANT_FOREGROUND;
         }
-        
+
         public RunningAppProcessInfo(String pProcessName, int pPid, String pArr[]) {
             processName = pProcessName;
             pid = pPid;
@@ -2262,7 +2262,7 @@
             processState = source.readInt();
         }
 
-        public static final Creator<RunningAppProcessInfo> CREATOR = 
+        public static final Creator<RunningAppProcessInfo> CREATOR =
             new Creator<RunningAppProcessInfo>() {
             public RunningAppProcessInfo createFromParcel(Parcel source) {
                 return new RunningAppProcessInfo(source);
@@ -2276,7 +2276,7 @@
             readFromParcel(source);
         }
     }
-    
+
     /**
      * Returns a list of application processes installed on external media
      * that are running on the device.
@@ -2297,6 +2297,23 @@
     }
 
     /**
+     * Sets the memory trim mode for a process and schedules a memory trim operation.
+     *
+     * <p><b>Note: this method is only intended for testing framework.</b></p>
+     *
+     * @return Returns true if successful.
+     * @hide
+     */
+    public boolean setProcessMemoryTrimLevel(String process, int userId, int level) {
+        try {
+            return ActivityManagerNative.getDefault().setProcessMemoryTrimLevel(process, userId,
+                    level);
+        } catch (RemoteException e) {
+            return false;
+        }
+    }
+
+    /**
      * Returns a list of application processes that are running on the device.
      *
      * <p><b>Note: this method is only intended for debugging or building
@@ -2368,7 +2385,7 @@
             return null;
         }
     }
-    
+
     /**
      * @deprecated This is now just a wrapper for
      * {@link #killBackgroundProcesses(String)}; the previous behavior here
@@ -2380,17 +2397,17 @@
     public void restartPackage(String packageName) {
         killBackgroundProcesses(packageName);
     }
-    
+
     /**
      * Have the system immediately kill all background processes associated
      * with the given package.  This is the same as the kernel killing those
      * processes to reclaim memory; the system will take care of restarting
      * these processes in the future as needed.
-     * 
+     *
      * <p>You must hold the permission
      * {@link android.Manifest.permission#KILL_BACKGROUND_PROCESSES} to be able to
      * call this method.
-     * 
+     *
      * @param packageName The name of the package whose processes are to
      * be killed.
      */
@@ -2426,14 +2443,14 @@
      * removed, etc.  In addition, a {@link Intent#ACTION_PACKAGE_RESTARTED}
      * broadcast will be sent, so that any of its registered alarms can
      * be stopped, notifications removed, etc.
-     * 
+     *
      * <p>You must hold the permission
      * {@link android.Manifest.permission#FORCE_STOP_PACKAGES} to be able to
      * call this method.
-     * 
+     *
      * @param packageName The name of the package to be stopped.
      * @param userId The user for which the running package is to be stopped.
-     * 
+     *
      * @hide This is not available to third party applications due to
      * it allowing them to break other applications by stopping their
      * services, removing their alarms, etc.
@@ -2697,7 +2714,7 @@
     }
 
     /**
-     * @param userid the user's id. Zero indicates the default user 
+     * @param userid the user's id. Zero indicates the default user.
      * @hide
      */
     public boolean switchUser(int userid) {
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index b6cec60..44e47f8 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1548,21 +1548,21 @@
             reply.writeInt(res ? 1 : 0);
             return true;
         }
-        
+
         case STOP_APP_SWITCHES_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             stopAppSwitches();
             reply.writeNoException();
             return true;
         }
-        
+
         case RESUME_APP_SWITCHES_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             resumeAppSwitches();
             reply.writeNoException();
             return true;
         }
-        
+
         case PEEK_SERVICE_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             Intent service = Intent.CREATOR.createFromParcel(data);
@@ -1572,7 +1572,7 @@
             reply.writeStrongBinder(binder);
             return true;
         }
-        
+
         case START_BACKUP_AGENT_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
@@ -1625,7 +1625,7 @@
             reply.writeNoException();
             return true;
         }
-        
+
         case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             int[] pids = data.createIntArray();
@@ -1643,7 +1643,7 @@
             reply.writeNoException();
             return true;
         }
-        
+
         case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder token = data.readStrongBinder();
@@ -1654,7 +1654,7 @@
             reply.writeNoException();
             return true;
         }
-        
+
         case IS_USER_A_MONKEY_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             boolean areThey = isUserAMonkey();
@@ -1662,7 +1662,7 @@
             reply.writeInt(areThey ? 1 : 0);
             return true;
         }
-        
+
         case SET_USER_IS_MONKEY_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             final boolean monkey = (data.readInt() == 1);
@@ -1738,7 +1738,7 @@
             reply.writeNoException();
             return true;
         }
-        
+
         case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             boolean isit = isTopActivityImmersive();
@@ -1890,7 +1890,7 @@
             reply.writeNoException();
             return true;
         }
-        
+
         case SWITCH_USER_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             int userid = data.readInt();
@@ -2550,6 +2550,17 @@
             reply.writeInt(res);
             return true;
         }
+
+        case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
+            data.enforceInterface(IActivityManager.descriptor);
+            String process = data.readString();
+            int userId = data.readInt();
+            int level = data.readInt();
+            boolean res = setProcessMemoryTrimLevel(process, userId, level);
+            reply.writeNoException();
+            reply.writeInt(res ? 1 : 0);
+            return true;
+        }
         }
 
         return super.onTransact(code, data, reply, flags);
@@ -3621,7 +3632,7 @@
         reply.recycle();
         return res;
     }
-    
+
     public ComponentName startService(IApplicationThread caller, Intent service,
             String resolvedType, int userId) throws RemoteException
     {
@@ -3724,7 +3735,7 @@
         reply.recycle();
         return res;
     }
-    
+
     public void publishService(IBinder token,
             Intent intent, IBinder service) throws RemoteException {
         Parcel data = Parcel.obtain();
@@ -3767,7 +3778,7 @@
         data.recycle();
         reply.recycle();
     }
-    
+
     public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
         Parcel data = Parcel.obtain();
         Parcel reply = Parcel.obtain();
@@ -4457,7 +4468,7 @@
         data.recycle();
         reply.recycle();
     }
-    
+
     public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
             throws RemoteException
     {
@@ -4521,7 +4532,7 @@
         data.recycle();
         return res;
     }
-    
+
     public void stopAppSwitches() throws RemoteException {
         Parcel data = Parcel.obtain();
         Parcel reply = Parcel.obtain();
@@ -4531,7 +4542,7 @@
         reply.recycle();
         data.recycle();
     }
-    
+
     public void resumeAppSwitches() throws RemoteException {
         Parcel data = Parcel.obtain();
         Parcel reply = Parcel.obtain();
@@ -4566,7 +4577,7 @@
         data.recycle();
         reply.recycle();
     }
-    
+
     public void closeSystemDialogs(String reason) throws RemoteException {
         Parcel data = Parcel.obtain();
         Parcel reply = Parcel.obtain();
@@ -4577,7 +4588,7 @@
         data.recycle();
         reply.recycle();
     }
-    
+
     public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
             throws RemoteException {
         Parcel data = Parcel.obtain();
@@ -4603,7 +4614,7 @@
         data.recycle();
         reply.recycle();
     }
-        
+
     public void overridePendingTransition(IBinder token, String packageName,
             int enterAnim, int exitAnim) throws RemoteException {
         Parcel data = Parcel.obtain();
@@ -4618,7 +4629,7 @@
         data.recycle();
         reply.recycle();
     }
-    
+
     public boolean isUserAMonkey() throws RemoteException {
         Parcel data = Parcel.obtain();
         Parcel reply = Parcel.obtain();
@@ -4874,7 +4885,7 @@
         data.recycle();
         return res;
     }
-    
+
     public int startActivities(IApplicationThread caller, String callingPackage,
             Intent[] intents, String[] resolvedTypes, IBinder resultTo,
             Bundle options, int userId) throws RemoteException {
@@ -5882,5 +5893,22 @@
         return res;
     }
 
+    @Override
+    public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
+            throws RemoteException {
+        Parcel data = Parcel.obtain();
+        Parcel reply = Parcel.obtain();
+        data.writeInterfaceToken(IActivityManager.descriptor);
+        data.writeString(process);
+        data.writeInt(userId);
+        data.writeInt(level);
+        mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
+        reply.readException();
+        int res = reply.readInt();
+        data.recycle();
+        reply.recycle();
+        return res != 0;
+    }
+
     private IBinder mRemote;
 }
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 249cdb2..2430ccd 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -242,14 +242,14 @@
 
     public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
             throws RemoteException;
-    
+
     public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException;
-    
+
     public void killBackgroundProcesses(final String packageName, int userId)
             throws RemoteException;
     public void killAllBackgroundProcesses() throws RemoteException;
     public void forceStopPackage(final String packageName, int userId) throws RemoteException;
-    
+
     // Note: probably don't want to allow applications access to these.
     public void setLockScreenShown(boolean shown) throws RemoteException;
 
@@ -263,7 +263,7 @@
         throws RemoteException;
 
     public void enterSafeMode() throws RemoteException;
-    
+
     public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
             throws RemoteException;
     public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
@@ -318,9 +318,9 @@
 
     public void killApplicationWithAppId(String pkg, int appid, String reason)
             throws RemoteException;
-    
+
     public void closeSystemDialogs(String reason) throws RemoteException;
-    
+
     public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
             throws RemoteException;
 
@@ -507,6 +507,9 @@
 
     public int getPackageProcessState(String packageName) throws RemoteException;
 
+    public boolean setProcessMemoryTrimLevel(String process, int uid, int level)
+            throws RemoteException;
+
     /*
      * Private non-Binder interfaces
      */
@@ -792,6 +795,7 @@
     // Available
     int GET_ACTIVITY_DISPLAY_ID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+184;
     int DELETE_ACTIVITY_CONTAINER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+185;
+    int SET_PROCESS_MEMORY_TRIM_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+186;
 
 
     // Start of L transactions
diff --git a/core/java/android/app/VoiceInteractor.aidl b/core/java/android/app/VoiceInteractor.aidl
index 40a4a0e..949605c 100644
--- a/core/java/android/app/VoiceInteractor.aidl
+++ b/core/java/android/app/VoiceInteractor.aidl
@@ -17,3 +17,4 @@
 package android.app;
 
 parcelable VoiceInteractor.PickOptionRequest.Option;
+parcelable VoiceInteractor.Prompt;
diff --git a/core/java/android/app/VoiceInteractor.java b/core/java/android/app/VoiceInteractor.java
index ba27c54..eccd9dc 100644
--- a/core/java/android/app/VoiceInteractor.java
+++ b/core/java/android/app/VoiceInteractor.java
@@ -16,6 +16,8 @@
 
 package android.app;
 
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.content.Context;
 import android.os.Bundle;
 import android.os.IBinder;
@@ -257,7 +259,7 @@
      * so the user can give a confirmation.
      */
     public static class ConfirmationRequest extends Request {
-        final CharSequence mPrompt;
+        final Prompt mPrompt;
         final Bundle mExtras;
 
         /**
@@ -266,11 +268,23 @@
          *     should be spoken.
          * @param extras Additional optional information or null.
          */
-        public ConfirmationRequest(CharSequence prompt, Bundle extras) {
+        public ConfirmationRequest(@Nullable Prompt prompt, @Nullable Bundle extras) {
             mPrompt = prompt;
             mExtras = extras;
         }
 
+        /**
+         * Create a new confirmation request.
+         * @param prompt Optional confirmation to speak to the user or null if nothing
+         *     should be spoken.
+         * @param extras Additional optional information or null.
+         * @deprecated Prefer the version that takes a {@link Prompt}.
+         */
+        public ConfirmationRequest(CharSequence prompt, Bundle extras) {
+            mPrompt = (prompt != null ? new Prompt(prompt) : null);
+            mExtras = extras;
+        }
+
         public void onConfirmationResult(boolean confirmed, Bundle result) {
         }
 
@@ -288,7 +302,7 @@
      * either {@link #onPickOptionResult} or {@link #onCancel()}.
      */
     public static class PickOptionRequest extends Request {
-        final CharSequence mPrompt;
+        final Prompt mPrompt;
         final Option[] mOptions;
         final Bundle mExtras;
 
@@ -417,13 +431,28 @@
          * @param options The set of {@link Option}s the user is selecting from.
          * @param extras Additional optional information or null.
          */
-        public PickOptionRequest(CharSequence prompt, Option[] options, Bundle extras) {
+        public PickOptionRequest(@Nullable Prompt prompt, Option[] options,
+                @Nullable Bundle extras) {
             mPrompt = prompt;
             mOptions = options;
             mExtras = extras;
         }
 
         /**
+         * Create a new pick option request.
+         * @param prompt Optional question to be asked of the user when the options are
+         *     presented or null if nothing should be asked.
+         * @param options The set of {@link Option}s the user is selecting from.
+         * @param extras Additional optional information or null.
+         * @deprecated Prefer the version that takes a {@link Prompt}.
+         */
+        public PickOptionRequest(CharSequence prompt, Option[] options, Bundle extras) {
+            mPrompt = (prompt != null ? new Prompt(prompt) : null);
+            mOptions = options;
+            mExtras = extras;
+        }
+
+        /**
          * Called when a single option is confirmed or narrowed to one of several options.
          * @param finished True if the voice interaction has finished making a selection, in
          *     which case {@code selections} contains the final result.  If false, this request is
@@ -451,17 +480,29 @@
      * interaction task.
      */
     public static class CompleteVoiceRequest extends Request {
-        final CharSequence mMessage;
+        final Prompt mPrompt;
         final Bundle mExtras;
 
         /**
          * Create a new completed voice interaction request.
+         * @param prompt Optional message to speak to the user about the completion status of
+         *     the task or null if nothing should be spoken.
+         * @param extras Additional optional information or null.
+         */
+        public CompleteVoiceRequest(@Nullable Prompt prompt, @Nullable Bundle extras) {
+            mPrompt = prompt;
+            mExtras = extras;
+        }
+
+        /**
+         * Create a new completed voice interaction request.
          * @param message Optional message to speak to the user about the completion status of
          *     the task or null if nothing should be spoken.
          * @param extras Additional optional information or null.
+         * @deprecated Prefer the version that takes a {@link Prompt}.
          */
         public CompleteVoiceRequest(CharSequence message, Bundle extras) {
-            mMessage = message;
+            mPrompt = (message != null ? new Prompt(message) : null);
             mExtras = extras;
         }
 
@@ -470,7 +511,7 @@
 
         IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
                 IVoiceInteractorCallback callback) throws RemoteException {
-            return interactor.startCompleteVoice(packageName, callback, mMessage, mExtras);
+            return interactor.startCompleteVoice(packageName, callback, mPrompt, mExtras);
         }
     }
 
@@ -486,17 +527,29 @@
      * interaction task.
      */
     public static class AbortVoiceRequest extends Request {
-        final CharSequence mMessage;
+        final Prompt mPrompt;
         final Bundle mExtras;
 
         /**
          * Create a new voice abort request.
+         * @param prompt Optional message to speak to the user indicating why the task could
+         *     not be completed by voice or null if nothing should be spoken.
+         * @param extras Additional optional information or null.
+         */
+        public AbortVoiceRequest(@Nullable Prompt prompt, @Nullable Bundle extras) {
+            mPrompt = prompt;
+            mExtras = extras;
+        }
+
+        /**
+         * Create a new voice abort request.
          * @param message Optional message to speak to the user indicating why the task could
          *     not be completed by voice or null if nothing should be spoken.
          * @param extras Additional optional information or null.
+         * @deprecated Prefer the version that takes a {@link Prompt}.
          */
         public AbortVoiceRequest(CharSequence message, Bundle extras) {
-            mMessage = message;
+            mPrompt = (message != null ? new Prompt(message) : null);
             mExtras = extras;
         }
 
@@ -505,7 +558,7 @@
 
         IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
                 IVoiceInteractorCallback callback) throws RemoteException {
-            return interactor.startAbortVoice(packageName, callback, mMessage, mExtras);
+            return interactor.startAbortVoice(packageName, callback, mPrompt, mExtras);
         }
     }
 
@@ -550,7 +603,101 @@
                 IVoiceInteractorCallback callback) throws RemoteException {
             return interactor.startCommand(packageName, callback, mCommand, mArgs);
         }
-   }
+    }
+
+    /**
+     * A set of voice prompts to use with the voice interaction system to confirm an action, select
+     * an option, or do similar operations. Multiple voice prompts may be provided for variety. A
+     * visual prompt must be provided, which might not match the spoken version. For example, the
+     * confirmation "Are you sure you want to purchase this item?" might use a visual label like
+     * "Purchase item".
+     */
+    public static class Prompt implements Parcelable {
+        // Mandatory voice prompt. Must contain at least one item, which must not be null.
+        private final CharSequence[] mVoicePrompts;
+
+        // Mandatory visual prompt.
+        private final CharSequence mVisualPrompt;
+
+        /**
+         * Constructs a prompt set.
+         * @param voicePrompts An array of one or more voice prompts. Must not be empty or null.
+         * @param visualPrompt A prompt to display on the screen. Must not be null.
+         */
+        public Prompt(@NonNull CharSequence[] voicePrompts, @NonNull CharSequence visualPrompt) {
+            if (voicePrompts == null) {
+                throw new NullPointerException("voicePrompts must not be null");
+            }
+            if (voicePrompts.length == 0) {
+                throw new IllegalArgumentException("voicePrompts must not be empty");
+            }
+            if (visualPrompt == null) {
+                throw new NullPointerException("visualPrompt must not be null");
+            }
+            this.mVoicePrompts = voicePrompts;
+            this.mVisualPrompt = visualPrompt;
+        }
+
+        /**
+         * Constructs a prompt set with single prompt used for all interactions. This is most useful
+         * in test apps. Non-trivial apps should prefer the detailed constructor.
+         */
+        public Prompt(@NonNull CharSequence prompt) {
+            this.mVoicePrompts = new CharSequence[] { prompt };
+            this.mVisualPrompt = prompt;
+        }
+
+        /**
+         * Returns a prompt to use for voice interactions.
+         */
+        @NonNull
+        public CharSequence getVoicePromptAt(int index) {
+            return mVoicePrompts[index];
+        }
+
+        /**
+         * Returns the number of different voice prompts.
+         */
+        public int countVoicePrompts() {
+            return mVoicePrompts.length;
+        }
+
+        /**
+         * Returns the prompt to use for visual display.
+         */
+        @NonNull
+        public CharSequence getVisualPrompt() {
+            return mVisualPrompt;
+        }
+
+        /** Constructor to support Parcelable behavior. */
+        Prompt(Parcel in) {
+            mVoicePrompts = in.readCharSequenceArray();
+            mVisualPrompt = in.readCharSequence();
+        }
+
+        @Override
+        public int describeContents() {
+            return 0;
+        }
+
+        @Override
+        public void writeToParcel(Parcel dest, int flags) {
+            dest.writeCharSequenceArray(mVoicePrompts);
+            dest.writeCharSequence(mVisualPrompt);
+        }
+
+        public static final Creator<Prompt> CREATOR
+                = new Creator<Prompt>() {
+            public Prompt createFromParcel(Parcel in) {
+                return new Prompt(in);
+            }
+
+            public Prompt[] newArray(int size) {
+                return new Prompt[size];
+            }
+        };
+    }
 
     VoiceInteractor(IVoiceInteractor interactor, Context context, Activity activity,
             Looper looper) {
@@ -631,7 +778,7 @@
     }
 
     /**
-     * Queries the supported commands available from the VoiceinteractionService.
+     * Queries the supported commands available from the VoiceInteractionService.
      * The command is a string that describes the generic operation to be performed.
      * An example might be "org.example.commands.PICK_DATE" to ask the user to pick
      * a date.  (Note: This is not an actual working example.)
diff --git a/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java b/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java
index cbc85f3..3d261dd 100644
--- a/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java
+++ b/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java
@@ -155,7 +155,7 @@
         if (mIsConstrainedHighSpeedSession) {
             if (!isConstrainedHighSpeedRequestList(requestList)) {
                 throw new IllegalArgumentException("It is only allowed to submit a constrained "
-                        + "high speed request list to a constrianed high speed session!!!");
+                        + "high speed request list to a constrained high speed session!!!");
             }
         }
     }
@@ -761,8 +761,7 @@
 
     @Override
     public boolean isConstrainedHighSpeed() {
-        // TODO: to be implemented
-        return false;
+        return mIsConstrainedHighSpeedSession;
     }
 
 }
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 0a45b8b..c9609e5 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -1940,6 +1940,15 @@
      */
     public abstract long getFlashlightOnCount(int which);
 
+    /**
+     * Returns the time in microseconds that the camera has been on while the device was
+     * running on battery.
+     *
+     * {@hide}
+     */
+    public abstract long getCameraOnTime(long elapsedRealtimeUs, int which);
+
+
     public static final int NETWORK_MOBILE_RX_DATA = 0;
     public static final int NETWORK_MOBILE_TX_DATA = 1;
     public static final int NETWORK_WIFI_RX_DATA = 2;
@@ -2735,6 +2744,9 @@
                     case OVERCOUNTED:
                         label = "over";
                         break;
+                    case CAMERA:
+                        label = "camera";
+                        break;
                     default:
                         label = "???";
                 }
@@ -3523,6 +3535,10 @@
                         pw.print(prefix); pw.print("    Over-counted: "); printmAh(pw, bs.totalPowerMah);
                         pw.println();
                         break;
+                    case CAMERA:
+                        pw.print(prefix); pw.print("    Camera: "); printmAh(pw, bs.totalPowerMah);
+                        pw.println();
+                        break;
                 }
             }
             pw.println();
diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java
index 33fef62..d5ee7e7 100644
--- a/core/java/android/service/voice/VoiceInteractionSession.java
+++ b/core/java/android/service/voice/VoiceInteractionSession.java
@@ -16,6 +16,7 @@
 
 package android.service.voice;
 
+import android.annotation.Nullable;
 import android.app.Dialog;
 import android.app.Instrumentation;
 import android.app.VoiceInteractor;
@@ -122,7 +123,7 @@
     final IVoiceInteractor mInteractor = new IVoiceInteractor.Stub() {
         @Override
         public IVoiceInteractorRequest startConfirmation(String callingPackage,
-                IVoiceInteractorCallback callback, CharSequence prompt, Bundle extras) {
+                IVoiceInteractorCallback callback, VoiceInteractor.Prompt prompt, Bundle extras) {
             ConfirmationRequest request = new ConfirmationRequest(callingPackage,
                     Binder.getCallingUid(), callback, VoiceInteractionSession.this,
                     prompt, extras);
@@ -134,7 +135,7 @@
 
         @Override
         public IVoiceInteractorRequest startPickOption(String callingPackage,
-                IVoiceInteractorCallback callback, CharSequence prompt,
+                IVoiceInteractorCallback callback, VoiceInteractor.Prompt prompt,
                 VoiceInteractor.PickOptionRequest.Option[] options, Bundle extras) {
             PickOptionRequest request = new PickOptionRequest(callingPackage,
                     Binder.getCallingUid(), callback, VoiceInteractionSession.this,
@@ -147,7 +148,7 @@
 
         @Override
         public IVoiceInteractorRequest startCompleteVoice(String callingPackage,
-                IVoiceInteractorCallback callback, CharSequence message, Bundle extras) {
+                IVoiceInteractorCallback callback, VoiceInteractor.Prompt message, Bundle extras) {
             CompleteVoiceRequest request = new CompleteVoiceRequest(callingPackage,
                     Binder.getCallingUid(), callback, VoiceInteractionSession.this,
                     message, extras);
@@ -159,7 +160,7 @@
 
         @Override
         public IVoiceInteractorRequest startAbortVoice(String callingPackage,
-                IVoiceInteractorCallback callback, CharSequence message, Bundle extras) {
+                IVoiceInteractorCallback callback, VoiceInteractor.Prompt message, Bundle extras) {
             AbortVoiceRequest request = new AbortVoiceRequest(callingPackage,
                     Binder.getCallingUid(), callback, VoiceInteractionSession.this,
                     message, extras);
@@ -404,10 +405,10 @@
      * VoiceInteractor.ConfirmationRequest}.
      */
     public static final class ConfirmationRequest extends Request {
-        final CharSequence mPrompt;
+        final VoiceInteractor.Prompt mPrompt;
 
         ConfirmationRequest(String packageName, int uid, IVoiceInteractorCallback callback,
-                VoiceInteractionSession session, CharSequence prompt, Bundle extras) {
+                VoiceInteractionSession session, VoiceInteractor.Prompt prompt, Bundle extras) {
             super(packageName, uid, callback, session, extras);
             mPrompt = prompt;
         }
@@ -417,11 +418,23 @@
          * {@link android.app.VoiceInteractor.ConfirmationRequest
          * VoiceInteractor.ConfirmationRequest}.
          */
-        public CharSequence getPrompt() {
+        @Nullable
+        public VoiceInteractor.Prompt getVoicePrompt() {
             return mPrompt;
         }
 
         /**
+         * Return the prompt informing the user of what will happen, as per
+         * {@link android.app.VoiceInteractor.ConfirmationRequest
+         * VoiceInteractor.ConfirmationRequest}.
+         * @deprecated Prefer {@link #getVoicePrompt()} which allows multiple voice prompts.
+         */
+        @Nullable
+        public CharSequence getPrompt() {
+            return (mPrompt != null ? mPrompt.getVoicePromptAt(0) : null);
+        }
+
+        /**
          * Report that the voice interactor has confirmed the operation with the user, resulting
          * in a call to
          * {@link android.app.VoiceInteractor.ConfirmationRequest#onConfirmationResult
@@ -437,11 +450,11 @@
      * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
      */
     public static final class PickOptionRequest extends Request {
-        final CharSequence mPrompt;
+        final VoiceInteractor.Prompt mPrompt;
         final VoiceInteractor.PickOptionRequest.Option[] mOptions;
 
         PickOptionRequest(String packageName, int uid, IVoiceInteractorCallback callback,
-                VoiceInteractionSession session, CharSequence prompt,
+                VoiceInteractionSession session, VoiceInteractor.Prompt prompt,
                 VoiceInteractor.PickOptionRequest.Option[] options, Bundle extras) {
             super(packageName, uid, callback, session, extras);
             mPrompt = prompt;
@@ -452,11 +465,22 @@
          * Return the prompt informing the user of what they are picking, as per
          * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
          */
-        public CharSequence getPrompt() {
+        @Nullable
+        public VoiceInteractor.Prompt getVoicePrompt() {
             return mPrompt;
         }
 
         /**
+         * Return the prompt informing the user of what they are picking, as per
+         * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
+         * @deprecated Prefer {@link #getVoicePrompt()} which allows multiple voice prompts.
+         */
+        @Nullable
+        public CharSequence getPrompt() {
+            return (mPrompt != null ? mPrompt.getVoicePromptAt(0) : null);
+        }
+
+        /**
          * Return the set of options the user is picking from, as per
          * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
          */
@@ -494,12 +518,12 @@
      * VoiceInteractor.CompleteVoiceRequest}.
      */
     public static final class CompleteVoiceRequest extends Request {
-        final CharSequence mMessage;
+        final VoiceInteractor.Prompt mPrompt;
 
         CompleteVoiceRequest(String packageName, int uid, IVoiceInteractorCallback callback,
-                VoiceInteractionSession session, CharSequence message, Bundle extras) {
+                VoiceInteractionSession session, VoiceInteractor.Prompt prompt, Bundle extras) {
             super(packageName, uid, callback, session, extras);
-            mMessage = message;
+            mPrompt = prompt;
         }
 
         /**
@@ -507,8 +531,20 @@
          * {@link android.app.VoiceInteractor.CompleteVoiceRequest
          * VoiceInteractor.CompleteVoiceRequest}.
          */
+        @Nullable
+        public VoiceInteractor.Prompt getVoicePrompt() {
+            return mPrompt;
+        }
+
+        /**
+         * Return the message informing the user of the completion, as per
+         * {@link android.app.VoiceInteractor.CompleteVoiceRequest
+         * VoiceInteractor.CompleteVoiceRequest}.
+         * @deprecated Prefer {@link #getVoicePrompt()} which allows a separate visual message.
+         */
+        @Nullable
         public CharSequence getMessage() {
-            return mMessage;
+            return (mPrompt != null ? mPrompt.getVoicePromptAt(0) : null);
         }
 
         /**
@@ -527,20 +563,31 @@
      * {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}.
      */
     public static final class AbortVoiceRequest extends Request {
-        final CharSequence mMessage;
+        final VoiceInteractor.Prompt mPrompt;
 
         AbortVoiceRequest(String packageName, int uid, IVoiceInteractorCallback callback,
-                VoiceInteractionSession session, CharSequence message, Bundle extras) {
+                VoiceInteractionSession session, VoiceInteractor.Prompt prompt, Bundle extras) {
             super(packageName, uid, callback, session, extras);
-            mMessage = message;
+            mPrompt = prompt;
         }
 
         /**
          * Return the message informing the user of the problem, as per
          * {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}.
          */
+        @Nullable
+        public VoiceInteractor.Prompt getVoicePrompt() {
+            return mPrompt;
+        }
+
+        /**
+         * Return the message informing the user of the problem, as per
+         * {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}.
+         * @deprecated Prefer {@link #getVoicePrompt()} which allows a separate visual message.
+         */
+        @Nullable
         public CharSequence getMessage() {
-            return mMessage;
+            return (mPrompt != null ? mPrompt.getVoicePromptAt(0) : null);
         }
 
         /**
@@ -1035,7 +1082,7 @@
     public void onCreate(Bundle args) {
         doOnCreate();
     }
-    
+
     /** @hide */
     public void onCreate(Bundle args, int showFlags) {
         doOnCreate();
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java
index 73a873a..6b28f89 100644
--- a/core/java/android/widget/ImageView.java
+++ b/core/java/android/widget/ImageView.java
@@ -1088,8 +1088,8 @@
             } else if (ScaleType.CENTER == mScaleType) {
                 // Center bitmap in view, no scaling.
                 mDrawMatrix = mMatrix;
-                mDrawMatrix.setTranslate((int) ((vwidth - dwidth) * 0.5f + 0.5f),
-                                         (int) ((vheight - dheight) * 0.5f + 0.5f));
+                mDrawMatrix.setTranslate(Math.round((vwidth - dwidth) * 0.5f),
+                                         Math.round((vheight - dheight) * 0.5f));
             } else if (ScaleType.CENTER_CROP == mScaleType) {
                 mDrawMatrix = mMatrix;
 
@@ -1105,7 +1105,7 @@
                 }
 
                 mDrawMatrix.setScale(scale, scale);
-                mDrawMatrix.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
+                mDrawMatrix.postTranslate(Math.round(dx), Math.round(dy));
             } else if (ScaleType.CENTER_INSIDE == mScaleType) {
                 mDrawMatrix = mMatrix;
                 float scale;
@@ -1119,8 +1119,8 @@
                             (float) vheight / (float) dheight);
                 }
                 
-                dx = (int) ((vwidth - dwidth * scale) * 0.5f + 0.5f);
-                dy = (int) ((vheight - dheight * scale) * 0.5f + 0.5f);
+                dx = Math.round((vwidth - dwidth * scale) * 0.5f);
+                dy = Math.round((vheight - dheight * scale) * 0.5f);
 
                 mDrawMatrix.setScale(scale, scale);
                 mDrawMatrix.postTranslate(dx, dy);
diff --git a/core/java/com/android/internal/app/IVoiceInteractor.aidl b/core/java/com/android/internal/app/IVoiceInteractor.aidl
index 84e9cf0..44feafb 100644
--- a/core/java/com/android/internal/app/IVoiceInteractor.aidl
+++ b/core/java/com/android/internal/app/IVoiceInteractor.aidl
@@ -27,14 +27,14 @@
  */
 interface IVoiceInteractor {
     IVoiceInteractorRequest startConfirmation(String callingPackage,
-            IVoiceInteractorCallback callback, CharSequence prompt, in Bundle extras);
+            IVoiceInteractorCallback callback, in VoiceInteractor.Prompt prompt, in Bundle extras);
     IVoiceInteractorRequest startPickOption(String callingPackage,
-            IVoiceInteractorCallback callback, CharSequence prompt,
+            IVoiceInteractorCallback callback, in VoiceInteractor.Prompt prompt,
             in VoiceInteractor.PickOptionRequest.Option[] options, in Bundle extras);
     IVoiceInteractorRequest startCompleteVoice(String callingPackage,
-            IVoiceInteractorCallback callback, CharSequence message, in Bundle extras);
+            IVoiceInteractorCallback callback, in VoiceInteractor.Prompt prompt, in Bundle extras);
     IVoiceInteractorRequest startAbortVoice(String callingPackage,
-            IVoiceInteractorCallback callback, CharSequence message, in Bundle extras);
+            IVoiceInteractorCallback callback, in VoiceInteractor.Prompt prompt, in Bundle extras);
     IVoiceInteractorRequest startCommand(String callingPackage,
             IVoiceInteractorCallback callback, String command, in Bundle extras);
     boolean[] supportsCommands(String callingPackage, in String[] commands);
diff --git a/core/java/com/android/internal/os/BatterySipper.java b/core/java/com/android/internal/os/BatterySipper.java
index 056b0aa..049d3eb 100644
--- a/core/java/com/android/internal/os/BatterySipper.java
+++ b/core/java/com/android/internal/os/BatterySipper.java
@@ -42,6 +42,8 @@
     public long wifiRunningTimeMs;
     public long cpuFgTimeMs;
     public long wakeLockTimeMs;
+    public long cameraTimeMs;
+    public long flashlightTimeMs;
 
     public long mobileRxPackets;
     public long mobileTxPackets;
@@ -67,6 +69,8 @@
     public double mobileRadioPowerMah;
     public double gpsPowerMah;
     public double sensorPowerMah;
+    public double cameraPowerMah;
+    public double flashlightPowerMah;
 
     public enum DrainType {
         IDLE,
@@ -79,7 +83,8 @@
         APP,
         USER,
         UNACCOUNTED,
-        OVERCOUNTED
+        OVERCOUNTED,
+        CAMERA
     }
 
     public BatterySipper(DrainType drainType, Uid uid, double value) {
@@ -135,6 +140,8 @@
         wifiRunningTimeMs += other.wifiRunningTimeMs;
         cpuFgTimeMs += other.cpuFgTimeMs;
         wakeLockTimeMs += other.wakeLockTimeMs;
+        cameraTimeMs += other.cameraTimeMs;
+        flashlightTimeMs += other.flashlightTimeMs;
         mobileRxPackets += other.mobileRxPackets;
         mobileTxPackets += other.mobileTxPackets;
         mobileActive += other.mobileActive;
@@ -151,6 +158,8 @@
         sensorPowerMah += other.sensorPowerMah;
         mobileRadioPowerMah += other.mobileRadioPowerMah;
         wakeLockPowerMah += other.wakeLockPowerMah;
+        cameraPowerMah += other.cameraPowerMah;
+        flashlightPowerMah += other.flashlightPowerMah;
     }
 
     /**
@@ -158,7 +167,8 @@
      * @return the sum of all the power in this BatterySipper.
      */
     public double sumPower() {
-        return totalPowerMah = usagePowerMah + wifiPowerMah + gpsPowerMah + cpuPowerMah + sensorPowerMah
-                + mobileRadioPowerMah + wakeLockPowerMah;
+        return totalPowerMah = usagePowerMah + wifiPowerMah + gpsPowerMah + cpuPowerMah +
+                sensorPowerMah + mobileRadioPowerMah + wakeLockPowerMah + cameraPowerMah +
+                flashlightPowerMah;
     }
 }
diff --git a/core/java/com/android/internal/os/BatteryStatsHelper.java b/core/java/com/android/internal/os/BatteryStatsHelper.java
index fbe87c5..e6165a1 100644
--- a/core/java/com/android/internal/os/BatteryStatsHelper.java
+++ b/core/java/com/android/internal/os/BatteryStatsHelper.java
@@ -122,6 +122,8 @@
     PowerCalculator mWifiPowerCalculator;
     PowerCalculator mBluetoothPowerCalculator;
     PowerCalculator mSensorPowerCalculator;
+    PowerCalculator mCameraPowerCalculator;
+    PowerCalculator mFlashlightPowerCalculator;
 
     public static boolean checkWifiOnly(Context context) {
         ConnectivityManager cm = (ConnectivityManager)context.getSystemService(
@@ -365,6 +367,16 @@
         }
         mSensorPowerCalculator.reset();
 
+        if (mCameraPowerCalculator == null) {
+            mCameraPowerCalculator = new CameraPowerCalculator(mPowerProfile);
+        }
+        mCameraPowerCalculator.reset();
+
+        if (mFlashlightPowerCalculator == null) {
+            mFlashlightPowerCalculator = new FlashlightPowerCalculator(mPowerProfile);
+        }
+        mFlashlightPowerCalculator.reset();
+
         mStatsType = statsType;
         mRawUptime = rawUptimeUs;
         mRawRealtime = rawRealtimeUs;
@@ -480,6 +492,8 @@
             mWifiPowerCalculator.calculateApp(app, u, mRawRealtime, mRawUptime, mStatsType);
             mBluetoothPowerCalculator.calculateApp(app, u, mRawRealtime, mRawUptime, mStatsType);
             mSensorPowerCalculator.calculateApp(app, u, mRawRealtime, mRawUptime, mStatsType);
+            mCameraPowerCalculator.calculateApp(app, u, mRawRealtime, mRawUptime, mStatsType);
+            mFlashlightPowerCalculator.calculateApp(app, u, mRawRealtime, mRawUptime, mStatsType);
 
             final double totalPower = app.sumPower();
             if (DEBUG && totalPower != 0) {
@@ -619,15 +633,6 @@
         }
     }
 
-    private void addFlashlightUsage() {
-        long flashlightOnTimeMs = mStats.getFlashlightOnTime(mRawRealtime, mStatsType) / 1000;
-        double flashlightPower = flashlightOnTimeMs
-                * mPowerProfile.getAveragePower(PowerProfile.POWER_FLASHLIGHT) / (60*60*1000);
-        if (flashlightPower != 0) {
-            addEntry(BatterySipper.DrainType.FLASHLIGHT, flashlightOnTimeMs, flashlightPower);
-        }
-    }
-
     private void addUserUsage() {
         for (int i = 0; i < mUserSippers.size(); i++) {
             final int userId = mUserSippers.keyAt(i);
@@ -643,7 +648,6 @@
         addUserUsage();
         addPhoneUsage();
         addScreenUsage();
-        addFlashlightUsage();
         addWiFiUsage();
         addBluetoothUsage();
         addIdleUsage(); // Not including cellular idle power
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 62745d4..25228d0 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -272,18 +272,19 @@
     final HistoryStepDetails mCurHistoryStepDetails = new HistoryStepDetails();
     final HistoryStepDetails mReadHistoryStepDetails = new HistoryStepDetails();
     final HistoryStepDetails mTmpHistoryStepDetails = new HistoryStepDetails();
+
     /**
-     * Total time (in 1/100 sec) spent executing in user code.
+     * Total time (in milliseconds) spent executing in user code.
      */
     long mLastStepCpuUserTime;
     long mCurStepCpuUserTime;
     /**
-     * Total time (in 1/100 sec) spent executing in kernel code.
+     * Total time (in milliseconds) spent executing in kernel code.
      */
     long mLastStepCpuSystemTime;
     long mCurStepCpuSystemTime;
     /**
-     * Times from /proc/stat
+     * Times from /proc/stat (but measured in milliseconds).
      */
     long mLastStepStatUserTime;
     long mLastStepStatSystemTime;
@@ -4337,15 +4338,22 @@
         return 0;
     }
 
-    @Override public long getFlashlightOnTime(long elapsedRealtimeUs, int which) {
+    @Override
+    public long getFlashlightOnTime(long elapsedRealtimeUs, int which) {
         return mFlashlightOnTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
     }
 
-    @Override public long getFlashlightOnCount(int which) {
+    @Override
+    public long getFlashlightOnCount(int which) {
         return mFlashlightOnTimer.getCountLocked(which);
     }
 
     @Override
+    public long getCameraOnTime(long elapsedRealtimeUs, int which) {
+        return mCameraOnTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
+    }
+
+    @Override
     public long getNetworkActivityBytes(int type, int which) {
         if (type >= 0 && type < mNetworkByteActivityCounters.length) {
             return mNetworkByteActivityCounters[type].getCountLocked(which);
diff --git a/core/java/com/android/internal/os/CameraPowerCalculator.java b/core/java/com/android/internal/os/CameraPowerCalculator.java
new file mode 100644
index 0000000..3273080
--- /dev/null
+++ b/core/java/com/android/internal/os/CameraPowerCalculator.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2015 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.internal.os;
+
+import android.os.BatteryStats;
+
+/**
+ * Power calculator for the camera subsystem, excluding the flashlight.
+ *
+ * Note: Power draw for the flash unit should be included in the FlashlightPowerCalculator.
+ */
+public class CameraPowerCalculator extends PowerCalculator {
+    private final double mCameraPowerOnAvg;
+
+    public CameraPowerCalculator(PowerProfile profile) {
+        mCameraPowerOnAvg = profile.getAveragePower(PowerProfile.POWER_CAMERA);
+    }
+
+    @Override
+    public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs,
+                             long rawUptimeUs, int statsType) {
+
+        // Calculate camera power usage.  Right now, this is a (very) rough estimate based on the
+        // average power usage for a typical camera application.
+        final BatteryStats.Timer timer = u.getCameraTurnedOnTimer();
+        if (timer != null) {
+            final long totalTime = timer.getTotalTimeLocked(rawRealtimeUs, statsType) / 1000;
+            app.cameraTimeMs = totalTime;
+            app.cameraPowerMah = (totalTime * mCameraPowerOnAvg) / (1000*60*60);
+        } else {
+            app.cameraTimeMs = 0;
+            app.cameraPowerMah = 0;
+        }
+    }
+}
diff --git a/core/java/com/android/internal/os/FlashlightPowerCalculator.java b/core/java/com/android/internal/os/FlashlightPowerCalculator.java
new file mode 100644
index 0000000..fef66ff
--- /dev/null
+++ b/core/java/com/android/internal/os/FlashlightPowerCalculator.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 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.internal.os;
+
+import android.os.BatteryStats;
+
+/**
+ * Power calculator for the flashlight.
+ */
+public class FlashlightPowerCalculator extends PowerCalculator {
+    private final double mFlashlightPowerOnAvg;
+
+    public FlashlightPowerCalculator(PowerProfile profile) {
+        mFlashlightPowerOnAvg = profile.getAveragePower(PowerProfile.POWER_FLASHLIGHT);
+    }
+
+    @Override
+    public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs,
+                             long rawUptimeUs, int statsType) {
+
+        // Calculate flashlight power usage.  Right now, this is based on the average power draw
+        // of the flash unit when kept on over a short period of time.
+        final BatteryStats.Timer timer = u.getFlashlightTurnedOnTimer();
+        if (timer != null) {
+            final long totalTime = timer.getTotalTimeLocked(rawRealtimeUs, statsType) / 1000;
+            app.flashlightTimeMs = totalTime;
+            app.flashlightPowerMah = (totalTime * mFlashlightPowerOnAvg) / (1000*60*60);
+        } else {
+            app.flashlightTimeMs = 0;
+            app.flashlightPowerMah = 0;
+        }
+    }
+}
diff --git a/core/java/com/android/internal/os/PowerProfile.java b/core/java/com/android/internal/os/PowerProfile.java
index 1efa5651..4ede8dda 100644
--- a/core/java/com/android/internal/os/PowerProfile.java
+++ b/core/java/com/android/internal/os/PowerProfile.java
@@ -152,10 +152,17 @@
     public static final String POWER_VIDEO = "dsp.video";
 
     /**
-     * Power consumption when camera flashlight is on.
+     * Average power consumption when camera flashlight is on.
      */
     public static final String POWER_FLASHLIGHT = "camera.flashlight";
 
+    /**
+     * Average power consumption when the camera is on over all standard use cases.
+     *
+     * TODO: Add more fine-grained camera power metrics.
+     */
+    public static final String POWER_CAMERA = "camera.avg";
+
     public static final String POWER_CPU_SPEEDS = "cpu.speeds";
 
     /**
diff --git a/core/java/com/android/internal/os/ProcessCpuTracker.java b/core/java/com/android/internal/os/ProcessCpuTracker.java
index 8393e2a..bf97f1f 100644
--- a/core/java/com/android/internal/os/ProcessCpuTracker.java
+++ b/core/java/com/android/internal/os/ProcessCpuTracker.java
@@ -139,6 +139,8 @@
     private float mLoad5 = 0;
     private float mLoad15 = 0;
 
+    // All times are in milliseconds. They are converted from jiffies to milliseconds
+    // when extracted from the kernel.
     private long mCurrentSampleTime;
     private long mLastSampleTime;
 
@@ -191,12 +193,34 @@
         // filter out kernel processes.
         public long vsize;
 
+        /**
+         * Time in milliseconds.
+         */
         public long base_uptime;
+
+        /**
+         * Time in milliseconds.
+         */
         public long rel_uptime;
 
+        /**
+         * Time in milliseconds.
+         */
         public long base_utime;
+
+        /**
+         * Time in milliseconds.
+         */
         public long base_stime;
+
+        /**
+         * Time in milliseconds.
+         */
         public int rel_utime;
+
+        /**
+         * Time in milliseconds.
+         */
         public int rel_stime;
 
         public long base_minfaults;
@@ -558,7 +582,7 @@
     }
 
     /**
-     * Returns the total time (in clock ticks, or 1/100 sec) spent executing in
+     * Returns the total time (in milliseconds) spent executing in
      * both user and system code.  Safe to call without lock held.
      */
     public long getCpuTimeForPid(int pid) {
@@ -575,26 +599,44 @@
         }
     }
 
+    /**
+     * @return time in milliseconds.
+     */
     final public int getLastUserTime() {
         return mRelUserTime;
     }
 
+    /**
+     * @return time in milliseconds.
+     */
     final public int getLastSystemTime() {
         return mRelSystemTime;
     }
 
+    /**
+     * @return time in milliseconds.
+     */
     final public int getLastIoWaitTime() {
         return mRelIoWaitTime;
     }
 
+    /**
+     * @return time in milliseconds.
+     */
     final public int getLastIrqTime() {
         return mRelIrqTime;
     }
 
+    /**
+     * @return time in milliseconds.
+     */
     final public int getLastSoftIrqTime() {
         return mRelSoftIrqTime;
     }
 
+    /**
+     * @return time in milliseconds.
+     */
     final public int getLastIdleTime() {
         return mRelIdleTime;
     }
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index 5ed4f70..971da77 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -508,7 +508,7 @@
         String args[] = {
             "--setuid=1000",
             "--setgid=1000",
-            "--setgroups=1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1018,1032,3001,3002,3003,3006,3007",
+            "--setgroups=1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1018,1021,1032,3001,3002,3003,3006,3007",
             "--capabilities=" + capabilities + "," + capabilities,
             "--nice-name=system_server",
             "--runtime-args",
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 625ab59..a2f8918 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -688,7 +688,7 @@
     <string name="permdesc_subscribedFeedsRead">Allows the app to get details about the currently synced feeds.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permlab_sendSms">send SMS messages</string>
+    <string name="permlab_sendSms">send and view SMS messages</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permdesc_sendSms">Allows the app to send SMS messages.
      This may result in unexpected charges. Malicious apps may cost you money by
diff --git a/core/res/res/xml/power_profile.xml b/core/res/res/xml/power_profile.xml
index 3215e17..28d99d8 100644
--- a/core/res/res/xml/power_profile.xml
+++ b/core/res/res/xml/power_profile.xml
@@ -37,6 +37,8 @@
   <item name="wifi.scan">0.1</item>  <!-- WIFI network scanning, ~100mA -->
   <item name="dsp.audio">0.1</item> <!-- ~10mA -->
   <item name="dsp.video">0.1</item> <!-- ~50mA -->
+  <item name="camera.flashlight">0.1</item> <!-- Avg. power for camera flash, ~160mA -->
+  <item name="camera.avg">0.1</item> <!-- Avg. power use of camera in standard usecases, ~550mA -->
   <item name="radio.active">0.1</item> <!-- ~200mA -->
   <item name="radio.scanning">0.1</item> <!-- cellular radio scanning for signal, ~10mA -->
   <item name="gps.on">0.1</item> <!-- ~50mA -->
diff --git a/docs/html/training/wearables/apps/always-on.jd b/docs/html/training/wearables/apps/always-on.jd
index 5bb6064..d384974 100644
--- a/docs/html/training/wearables/apps/always-on.jd
+++ b/docs/html/training/wearables/apps/always-on.jd
@@ -30,6 +30,11 @@
 so you should carefully consider that impact when adding this feature to your app.
 </p>
 
+<div class="video-wrapper-left">
+<iframe src="https://www.youtube.com/embed/7m6Z9d0fDaM" frameborder="0"
+allowfullscreen></iframe>
+</div>
+
 <p>Android Wear devices running Android version 5.1 or higher allow apps to remain in the
 foreground while saving battery power. Android Wear apps can control what’s displayed on the
 wearable device screen while the device is in a low-power ambient mode. Wear apps that run in both
diff --git a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
index 96f86b4..1ae10d3 100644
--- a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
@@ -578,6 +578,15 @@
         return mAnimatorSet.isStarted();
     }
 
+    /**
+     * Resets the AnimatedVectorDrawable to the start state as specified in the animators.
+     */
+    public void reset() {
+        // TODO: Use reverse or seek to implement reset, when AnimatorSet supports them.
+        start();
+        mAnimatorSet.cancel();
+    }
+
     @Override
     public void start() {
         ensureAnimatorSet();
diff --git a/media/java/android/media/tv/ITvInputSessionWrapper.java b/media/java/android/media/tv/ITvInputSessionWrapper.java
index fed0ddf..5ad1bce 100644
--- a/media/java/android/media/tv/ITvInputSessionWrapper.java
+++ b/media/java/android/media/tv/ITvInputSessionWrapper.java
@@ -285,8 +285,7 @@
 
     @Override
     public void timeShiftSeekTo(long timeMs) {
-        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_TIME_SHIFT_SEEK_TO,
-                Long.valueOf(timeMs)));
+        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_TIME_SHIFT_SEEK_TO, timeMs));
     }
 
     @Override
@@ -298,7 +297,7 @@
     @Override
     public void timeShiftEnablePositionTracking(boolean enable) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageO(
-                DO_TIME_SHIFT_ENABLE_POSITION_TRACKING, Boolean.valueOf(enable)));
+                DO_TIME_SHIFT_ENABLE_POSITION_TRACKING, enable));
     }
 
     private final class TvInputEventReceiver extends InputEventReceiver {
diff --git a/media/java/android/media/tv/TvContract.java b/media/java/android/media/tv/TvContract.java
index f5a6f2b..91b1a49 100644
--- a/media/java/android/media/tv/TvContract.java
+++ b/media/java/android/media/tv/TvContract.java
@@ -485,8 +485,7 @@
         /** The video resolution for ultra high-definition. */
         public static final String VIDEO_RESOLUTION_UHD = "VIDEO_RESOLUTION_UHD";
 
-        private static final Map<String, String> VIDEO_FORMAT_TO_RESOLUTION_MAP =
-                new HashMap<String, String>();
+        private static final Map<String, String> VIDEO_FORMAT_TO_RESOLUTION_MAP = new HashMap<>();
 
         static {
             VIDEO_FORMAT_TO_RESOLUTION_MAP.put(VIDEO_FORMAT_480I, VIDEO_RESOLUTION_SD);
@@ -1128,7 +1127,7 @@
             /** The genre for Tech/Science. */
             public static final String TECH_SCIENCE = "TECH_SCIENCE";
 
-            private static final ArraySet<String> CANONICAL_GENRES = new ArraySet<String>();
+            private static final ArraySet<String> CANONICAL_GENRES = new ArraySet<>();
             static {
                 CANONICAL_GENRES.add(FAMILY_KIDS);
                 CANONICAL_GENRES.add(SPORTS);
diff --git a/media/java/android/media/tv/TvInputInfo.java b/media/java/android/media/tv/TvInputInfo.java
index 46d33b4..4b1fa13 100644
--- a/media/java/android/media/tv/TvInputInfo.java
+++ b/media/java/android/media/tv/TvInputInfo.java
@@ -626,7 +626,7 @@
         public static Set<String> getHiddenTvInputIds(Context context, int userId) {
             String hiddenIdsString = Settings.Secure.getStringForUser(
                     context.getContentResolver(), Settings.Secure.TV_INPUT_HIDDEN_INPUTS, userId);
-            Set<String> set = new HashSet<String>();
+            Set<String> set = new HashSet<>();
             if (TextUtils.isEmpty(hiddenIdsString)) {
                 return set;
             }
@@ -648,7 +648,7 @@
         public static Map<String, String> getCustomLabels(Context context, int userId) {
             String labelsString = Settings.Secure.getStringForUser(
                     context.getContentResolver(), Settings.Secure.TV_INPUT_CUSTOM_LABELS, userId);
-            Map<String, String> map = new HashMap<String, String>();
+            Map<String, String> map = new HashMap<>();
             if (TextUtils.isEmpty(labelsString)) {
                 return map;
             }
diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java
index 7fc19f1..01de898 100644
--- a/media/java/android/media/tv/TvInputManager.java
+++ b/media/java/android/media/tv/TvInputManager.java
@@ -221,16 +221,15 @@
     private final Object mLock = new Object();
 
     // @GuardedBy("mLock")
-    private final List<TvInputCallbackRecord> mCallbackRecords =
-            new LinkedList<TvInputCallbackRecord>();
+    private final List<TvInputCallbackRecord> mCallbackRecords = new LinkedList<>();
 
     // A mapping from TV input ID to the state of corresponding input.
     // @GuardedBy("mLock")
-    private final Map<String, Integer> mStateMap = new ArrayMap<String, Integer>();
+    private final Map<String, Integer> mStateMap = new ArrayMap<>();
 
     // A mapping from the sequence number of a session to its SessionCallbackRecord.
     private final SparseArray<SessionCallbackRecord> mSessionCallbackRecordMap =
-            new SparseArray<SessionCallbackRecord>();
+            new SparseArray<>();
 
     // A sequence number for the next session to be created. Should be protected by a lock
     // {@code mSessionCallbackRecordMap}.
@@ -238,8 +237,6 @@
 
     private final ITvInputClient mClient;
 
-    private final ITvInputManagerCallback mManagerCallback;
-
     private final int mUserId;
 
     /**
@@ -879,7 +876,7 @@
                 }
             }
         };
-        mManagerCallback = new ITvInputManagerCallback.Stub() {
+        ITvInputManagerCallback managerCallback = new ITvInputManagerCallback.Stub() {
             @Override
             public void onInputStateChanged(String inputId, int state) {
                 synchronized (mLock) {
@@ -921,7 +918,7 @@
         };
         try {
             if (mService != null) {
-                mService.registerCallback(mManagerCallback, mUserId);
+                mService.registerCallback(managerCallback, mUserId);
                 List<TvInputInfo> infos = mService.getTvInputList(mUserId);
                 synchronized (mLock) {
                     for (TvInputInfo info : infos) {
@@ -985,7 +982,7 @@
                 Log.w(TAG, "Unrecognized input ID: " + inputId);
                 return INPUT_STATE_DISCONNECTED;
             }
-            return state.intValue();
+            return state;
         }
     }
 
@@ -1076,7 +1073,7 @@
     @SystemApi
     public List<TvContentRating> getBlockedRatings() {
         try {
-            List<TvContentRating> ratings = new ArrayList<TvContentRating>();
+            List<TvContentRating> ratings = new ArrayList<>();
             for (String rating : mService.getBlockedRatings(mUserId)) {
                 ratings.add(TvContentRating.unflattenFromString(rating));
             }
@@ -1334,8 +1331,8 @@
         // protect pending input events and the input channel.
         private final InputEventHandler mHandler = new InputEventHandler(Looper.getMainLooper());
 
-        private final Pool<PendingEvent> mPendingEventPool = new SimplePool<PendingEvent>(20);
-        private final SparseArray<PendingEvent> mPendingEvents = new SparseArray<PendingEvent>(20);
+        private final Pool<PendingEvent> mPendingEventPool = new SimplePool<>(20);
+        private final SparseArray<PendingEvent> mPendingEvents = new SparseArray<>(20);
         private final SparseArray<SessionCallbackRecord> mSessionCallbackRecordMap;
 
         private IBinder mToken;
@@ -1344,11 +1341,11 @@
 
         private final Object mMetadataLock = new Object();
         // @GuardedBy("mMetadataLock")
-        private final List<TvTrackInfo> mAudioTracks = new ArrayList<TvTrackInfo>();
+        private final List<TvTrackInfo> mAudioTracks = new ArrayList<>();
         // @GuardedBy("mMetadataLock")
-        private final List<TvTrackInfo> mVideoTracks = new ArrayList<TvTrackInfo>();
+        private final List<TvTrackInfo> mVideoTracks = new ArrayList<>();
         // @GuardedBy("mMetadataLock")
-        private final List<TvTrackInfo> mSubtitleTracks = new ArrayList<TvTrackInfo>();
+        private final List<TvTrackInfo> mSubtitleTracks = new ArrayList<>();
         // @GuardedBy("mMetadataLock")
         private String mSelectedAudioTrackId;
         // @GuardedBy("mMetadataLock")
@@ -1589,17 +1586,17 @@
                     if (mAudioTracks == null) {
                         return null;
                     }
-                    return new ArrayList<TvTrackInfo>(mAudioTracks);
+                    return new ArrayList<>(mAudioTracks);
                 } else if (type == TvTrackInfo.TYPE_VIDEO) {
                     if (mVideoTracks == null) {
                         return null;
                     }
-                    return new ArrayList<TvTrackInfo>(mVideoTracks);
+                    return new ArrayList<>(mVideoTracks);
                 } else if (type == TvTrackInfo.TYPE_SUBTITLE) {
                     if (mSubtitleTracks == null) {
                         return null;
                     }
-                    return new ArrayList<TvTrackInfo>(mSubtitleTracks);
+                    return new ArrayList<>(mSubtitleTracks);
                 }
             }
             throw new IllegalArgumentException("invalid type: " + type);
diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java
index f75d601..50a215c 100644
--- a/media/java/android/media/tv/TvInputService.java
+++ b/media/java/android/media/tv/TvInputService.java
@@ -97,7 +97,7 @@
      */
     private final Handler mServiceHandler = new ServiceHandler();
     private final RemoteCallbackList<ITvInputServiceCallback> mCallbacks =
-            new RemoteCallbackList<ITvInputServiceCallback>();
+            new RemoteCallbackList<>();
 
     private TvInputManager mTvInputManager;
 
@@ -377,7 +377,7 @@
          * @throws IllegalArgumentException if {@code tracks} contains redundant tracks.
          */
         public void notifyTracksChanged(final List<TvTrackInfo> tracks) {
-            Set<String> trackIdSet = new HashSet<String>();
+            Set<String> trackIdSet = new HashSet<>();
             for (TvTrackInfo track : tracks) {
                 String trackId = track.getId();
                 if (trackIdSet.contains(trackId)) {
diff --git a/packages/PrintSpooler/res/values-zh-rCN/donottranslate.xml b/packages/PrintSpooler/res/values-zh-rCN/donottranslate.xml
deleted file mode 100644
index f069da3..0000000
--- a/packages/PrintSpooler/res/values-zh-rCN/donottranslate.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2013 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.
--->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <string name="mediasize_default">PRC_9</string>
-    <string name="mediasize_standard">@string/mediasize_standard_china</string>
-
-</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 08659e9..79af706 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -20,6 +20,7 @@
 import android.provider.Settings;
 import android.util.Log;
 import android.view.Gravity;
+import android.view.HapticFeedbackConstants;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -296,13 +297,7 @@
     }
 
     private void vibrate() {
-        if (Settings.System.getIntForUser(mContext.getContentResolver(),
-                Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, UserHandle.USER_CURRENT) != 0) {
-            Resources res = mContext.getResources();
-            Vibrator vibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
-            vibrator.vibrate(res.getInteger(R.integer.config_search_panel_view_vibration_duration),
-                    VIBRATION_ATTRIBUTES);
-        }
+        mView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
     }
 
     public boolean isAssistantIntentAvailable() {
diff --git a/rs/java/android/renderscript/ScriptGroup.java b/rs/java/android/renderscript/ScriptGroup.java
index d1a12f9..82d9a2f 100644
--- a/rs/java/android/renderscript/ScriptGroup.java
+++ b/rs/java/android/renderscript/ScriptGroup.java
@@ -131,28 +131,16 @@
 
             int i;
             for (i = 0; i < args.length; i++) {
-                Object obj = args[i];
                 fieldIDs[i] = 0;
-                if (obj instanceof Input) {
-                    Input unbound = (Input)obj;
-                    unbound.addReference(this, i);
-                } else {
-                    retrieveValueAndDependenceInfo(rs, i, args[i], values, sizes,
-                                                   depClosures, depFieldIDs);
-                }
+                retrieveValueAndDependenceInfo(rs, i, null, args[i],
+                                               values, sizes, depClosures, depFieldIDs);
             }
-
             for (Map.Entry<Script.FieldID, Object> entry : globals.entrySet()) {
                 Object obj = entry.getValue();
                 Script.FieldID fieldID = entry.getKey();
                 fieldIDs[i] = fieldID.getID(rs);
-                if (obj instanceof Input) {
-                    Input unbound = (Input)obj;
-                    unbound.addReference(this, fieldID);
-                } else {
-                    retrieveValueAndDependenceInfo(rs, i, obj, values,
-                                                   sizes, depClosures, depFieldIDs);
-                }
+                retrieveValueAndDependenceInfo(rs, i, fieldID, obj,
+                                               values, sizes, depClosures, depFieldIDs);
                 i++;
             }
 
@@ -184,13 +172,8 @@
                 Object obj = entry.getValue();
                 Script.FieldID fieldID = entry.getKey();
                 fieldIDs[i] = fieldID.getID(rs);
-                if (obj instanceof Input) {
-                    Input unbound = (Input)obj;
-                    unbound.addReference(this, fieldID);
-                } else {
-                    retrieveValueAndDependenceInfo(rs, i, obj, values,
-                                                   sizes, depClosures, depFieldIDs);
-                }
+                retrieveValueAndDependenceInfo(rs, i, fieldID, obj, values,
+                                               sizes, depClosures, depFieldIDs);
                 i++;
             }
 
@@ -200,9 +183,8 @@
             setID(id);
         }
 
-        private static
-                void retrieveValueAndDependenceInfo(RenderScript rs,
-                                                    int index, Object obj,
+        private void retrieveValueAndDependenceInfo(RenderScript rs,
+                                                    int index, Script.FieldID fid, Object obj,
                                                     long[] values, int[] sizes,
                                                     long[] depClosures,
                                                     long[] depFieldIDs) {
@@ -213,20 +195,25 @@
                 depClosures[index] = f.getClosure().getID(rs);
                 Script.FieldID fieldID = f.getFieldID();
                 depFieldIDs[index] = fieldID != null ? fieldID.getID(rs) : 0;
-                if (obj == null) {
-                    // Value is originally created by the owner closure
-                    values[index] = 0;
-                    sizes[index] = 0;
-                    return;
-                }
             } else {
                 depClosures[index] = 0;
                 depFieldIDs[index] = 0;
             }
 
-            ValueAndSize vs = new ValueAndSize(rs, obj);
-            values[index] = vs.value;
-            sizes[index] = vs.size;
+            if (obj instanceof Input) {
+                Input unbound = (Input)obj;
+                if (index < mArgs.length) {
+                    unbound.addReference(this, index);
+                } else {
+                    unbound.addReference(this, fid);
+                }
+                values[index] = 0;
+                sizes[index] = 0;
+            } else {
+                ValueAndSize vs = new ValueAndSize(rs, obj);
+                values[index] = vs.value;
+                sizes[index] = vs.size;
+            }
         }
 
         /**
@@ -258,7 +245,11 @@
                 // without an associated value (reference). So this is not working for
                 // cross-module (cross-script) linking in this case where a field not
                 // explicitly bound.
-                f = new Future(this, field, mBindings.get(field));
+                Object obj = mBindings.get(field);
+                if (obj instanceof Future) {
+                    obj = ((Future)obj).getValue();
+                }
+                f = new Future(this, field, obj);
                 mGlobalFuture.put(field, f);
             }
 
@@ -266,12 +257,18 @@
         }
 
         void setArg(int index, Object obj) {
+            if (obj instanceof Future) {
+                obj = ((Future)obj).getValue();
+            }
             mArgs[index] = obj;
             ValueAndSize vs = new ValueAndSize(mRS, obj);
             mRS.nClosureSetArg(getID(mRS), index, vs.value, vs.size);
         }
 
         void setGlobal(Script.FieldID fieldID, Object obj) {
+            if (obj instanceof Future) {
+                obj = ((Future)obj).getValue();
+            }
             mBindings.put(fieldID, obj);
             ValueAndSize vs = new ValueAndSize(mRS, obj);
             mRS.nClosureSetGlobal(getID(mRS), fieldID.getID(mRS), vs.value, vs.size);
@@ -344,6 +341,7 @@
         // -1 means unset. Legal values are 0 .. n-1, where n is the number of
         // arguments for the referencing closure.
         List<Pair<Closure, Integer>> mArgIndex;
+        Object mValue;
 
         Input() {
             mFieldID = new ArrayList<Pair<Closure, Script.FieldID>>();
@@ -359,6 +357,7 @@
         }
 
         void set(Object value) {
+            mValue = value;
             for (Pair<Closure, Integer> p : mArgIndex) {
                 Closure closure = p.first;
                 int index = p.second.intValue();
@@ -370,6 +369,8 @@
                 closure.setGlobal(fieldID, value);
             }
         }
+
+        Object get() { return mValue; }
     }
 
     private String mName;
@@ -434,7 +435,11 @@
         Object[] outputObjs = new Object[mOutputs2.length];
         int i = 0;
         for (Future f : mOutputs2) {
-            outputObjs[i++] = f.getValue();
+            Object output = f.getValue();
+            if (output instanceof Input) {
+                output = ((Input)output).get();
+            }
+            outputObjs[i++] = output;
         }
         return outputObjs;
     }
@@ -592,7 +597,8 @@
                 Node n = mNodes.get(ct);
                 if (n.mInputs.size() == 0) {
                     if (n.mOutputs.size() == 0 && mNodes.size() > 1) {
-                        throw new RSInvalidStateException("Groups cannot contain unconnected scripts");
+                        String msg = "Groups cannot contain unconnected scripts";
+                        throw new RSInvalidStateException(msg);
                     }
                     validateDAGRecurse(n, ct+1);
                 }
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index 63bbf24..af83a53 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -4411,6 +4411,8 @@
      * to perform one app backup per scheduled job execution, and to reschedule the job
      * with zero latency as long as conditions remain right and we still have work to do.
      *
+     * <p>This is the "start a full backup operation" entry point called by the scheduled job.
+     *
      * @return Whether ongoing work will continue.  The return value here will be passed
      *         along as the return value to the scheduled job's onStartJob() callback.
      */
@@ -4430,6 +4432,14 @@
             return false;
         }
 
+        // Don't run the backup if we're in battery saver mode, but reschedule
+        // to try again in the not-so-distant future.
+        if (mPowerManager.isPowerSaveMode()) {
+            if (DEBUG) Slog.i(TAG, "Deferring scheduled full backups in battery saver mode");
+            FullBackupJob.schedule(mContext, KeyValueBackupJob.BATCH_INTERVAL);
+            return false;
+        }
+
         if (DEBUG_SCHEDULING) {
             Slog.i(TAG, "Beginning scheduled full backup operation");
         }
@@ -8515,18 +8525,23 @@
     public void backupNow() {
         mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, "backupNow");
 
-        if (DEBUG) Slog.v(TAG, "Scheduling immediate backup pass");
-        synchronized (mQueueLock) {
-            // Fire the intent that kicks off the whole shebang...
-            try {
-                mRunBackupIntent.send();
-            } catch (PendingIntent.CanceledException e) {
-                // should never happen
-                Slog.e(TAG, "run-backup intent cancelled!");
-            }
+        if (mPowerManager.isPowerSaveMode()) {
+            if (DEBUG) Slog.v(TAG, "Not running backup while in battery save mode");
+            KeyValueBackupJob.schedule(mContext);   // try again in several hours
+        } else {
+            if (DEBUG) Slog.v(TAG, "Scheduling immediate backup pass");
+            synchronized (mQueueLock) {
+                // Fire the intent that kicks off the whole shebang...
+                try {
+                    mRunBackupIntent.send();
+                } catch (PendingIntent.CanceledException e) {
+                    // should never happen
+                    Slog.e(TAG, "run-backup intent cancelled!");
+                }
 
-            // ...and cancel any pending scheduled job, because we've just superseded it
-            KeyValueBackupJob.cancel(mContext);
+                // ...and cancel any pending scheduled job, because we've just superseded it
+                KeyValueBackupJob.cancel(mContext);
+            }
         }
     }
 
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 64e30e5..efc38e2 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -3613,6 +3613,26 @@
         return procState;
     }
 
+    @Override
+    public boolean setProcessMemoryTrimLevel(String process, int userId, int level) {
+        ProcessRecord app = getProcessRecordLocked(process, userId, true);
+        if (app == null) {
+            return false;
+        }
+        if (app.trimMemoryLevel < level && app.thread != null &&
+                (level < ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN ||
+                        app.trimMemoryLevel >= ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN)) {
+            try {
+                app.thread.scheduleTrimMemory(level);
+                app.trimMemoryLevel = level;
+                return true;
+            } catch (RemoteException e) {
+                // Fallthrough to failure case.
+            }
+        }
+        return false;
+    }
+
     private void dispatchProcessesChanged() {
         int N;
         synchronized (this) {
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index cd4f826..72383a8 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -625,12 +625,6 @@
         @Override
         public void onNotificationVisibilityChanged(
                 String[] newlyVisibleKeys, String[] noLongerVisibleKeys) {
-            // Using ';' as separator since eventlogs uses ',' to separate
-            // args.
-            // TODO remove this: b/21248682
-            EventLogTags.writeNotificationVisibilityChanged(
-                    TextUtils.join(";", newlyVisibleKeys),
-                    TextUtils.join(";", noLongerVisibleKeys));
             synchronized (mNotificationList) {
                 for (String key : newlyVisibleKeys) {
                     NotificationRecord r = mNotificationsByKey.get(key);
diff --git a/services/core/java/com/android/server/tv/TvInputHardwareManager.java b/services/core/java/com/android/server/tv/TvInputHardwareManager.java
index ac8ad30..444969f 100644
--- a/services/core/java/com/android/server/tv/TvInputHardwareManager.java
+++ b/services/core/java/com/android/server/tv/TvInputHardwareManager.java
@@ -88,7 +88,6 @@
     private final Map<String, TvInputInfo> mInputMap = new ArrayMap<>();
 
     private final AudioManager mAudioManager;
-    private IHdmiControlService mHdmiControlService;
     private final IHdmiHotplugEventListener mHdmiHotplugEventListener =
             new HdmiHotplugEventListener();
     private final IHdmiDeviceEventListener mHdmiDeviceEventListener = new HdmiDeviceEventListener();
@@ -121,15 +120,15 @@
 
     public void onBootPhase(int phase) {
         if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
-            mHdmiControlService = IHdmiControlService.Stub.asInterface(ServiceManager.getService(
-                    Context.HDMI_CONTROL_SERVICE));
-            if (mHdmiControlService != null) {
+            IHdmiControlService hdmiControlService = IHdmiControlService.Stub.asInterface(
+                    ServiceManager.getService(Context.HDMI_CONTROL_SERVICE));
+            if (hdmiControlService != null) {
                 try {
-                    mHdmiControlService.addHotplugEventListener(mHdmiHotplugEventListener);
-                    mHdmiControlService.addDeviceEventListener(mHdmiDeviceEventListener);
-                    mHdmiControlService.addSystemAudioModeChangeListener(
+                    hdmiControlService.addHotplugEventListener(mHdmiHotplugEventListener);
+                    hdmiControlService.addDeviceEventListener(mHdmiDeviceEventListener);
+                    hdmiControlService.addSystemAudioModeChangeListener(
                             mHdmiSystemAudioModeChangeListener);
-                    mHdmiDeviceList.addAll(mHdmiControlService.getInputDevices());
+                    mHdmiDeviceList.addAll(hdmiControlService.getInputDevices());
                 } catch (RemoteException e) {
                     Slog.w(TAG, "Error registering listeners to HdmiControlService:", e);
                 }
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java
index 60bbc48..5995e9c 100644
--- a/services/core/java/com/android/server/wm/AppTransition.java
+++ b/services/core/java/com/android/server/wm/AppTransition.java
@@ -34,11 +34,11 @@
 import android.view.animation.ClipRectLRAnimation;
 import android.view.animation.ClipRectTBAnimation;
 import android.view.animation.Interpolator;
-import android.view.animation.LinearInterpolator;
+import android.view.animation.PathInterpolator;
 import android.view.animation.ScaleAnimation;
 import android.view.animation.TranslateAnimation;
-import android.view.animation.TranslateXAnimation;
 import android.view.animation.TranslateYAnimation;
+
 import com.android.internal.util.DumpUtils.Dump;
 import com.android.server.AttributeCache;
 import com.android.server.wm.WindowManagerService.H;
@@ -47,28 +47,28 @@
 import java.util.ArrayList;
 
 import static android.view.WindowManagerInternal.AppTransitionListener;
-import static com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation;
-import static com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation;
 import static com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation;
 import static com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation;
-import static com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation;
-import static com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation;
-import static com.android.internal.R.styleable.WindowAnimation_launchTaskBehindTargetAnimation;
+import static com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation;
+import static com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation;
 import static com.android.internal.R.styleable.WindowAnimation_launchTaskBehindSourceAnimation;
+import static com.android.internal.R.styleable.WindowAnimation_launchTaskBehindTargetAnimation;
 import static com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation;
 import static com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation;
-import static com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation;
-import static com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation;
+import static com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation;
+import static com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation;
 import static com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation;
 import static com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation;
-import static com.android.internal.R.styleable.WindowAnimation_wallpaperOpenEnterAnimation;
-import static com.android.internal.R.styleable.WindowAnimation_wallpaperOpenExitAnimation;
+import static com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation;
+import static com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation;
 import static com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation;
 import static com.android.internal.R.styleable.WindowAnimation_wallpaperCloseExitAnimation;
-import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenEnterAnimation;
-import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenExitAnimation;
 import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseEnterAnimation;
 import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseExitAnimation;
+import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenEnterAnimation;
+import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenExitAnimation;
+import static com.android.internal.R.styleable.WindowAnimation_wallpaperOpenEnterAnimation;
+import static com.android.internal.R.styleable.WindowAnimation_wallpaperOpenExitAnimation;
 
 // State management of app transitions.  When we are preparing for a
 // transition, mNextAppTransition will be the kind of transition to
@@ -80,7 +80,7 @@
     private static final boolean DEBUG_APP_TRANSITIONS =
             WindowManagerService.DEBUG_APP_TRANSITIONS;
     private static final boolean DEBUG_ANIM = WindowManagerService.DEBUG_ANIM;
-
+    private static final int CLIP_REVEAL_TRANSLATION_Y_DP = 8;
 
     /** Not set up for a transition. */
     public static final int TRANSIT_UNSET = -1;
@@ -121,13 +121,13 @@
     public static final int TRANSIT_TASK_IN_PLACE = 17;
 
     /** Fraction of animation at which the recents thumbnail stays completely transparent */
-    private static final float RECENTS_THUMBNAIL_FADEIN_FRACTION = 0.7f;
+    private static final float RECENTS_THUMBNAIL_FADEIN_FRACTION = 0.5f;
     /** Fraction of animation at which the recents thumbnail becomes completely transparent */
-    private static final float RECENTS_THUMBNAIL_FADEOUT_FRACTION = 0.3f;
+    private static final float RECENTS_THUMBNAIL_FADEOUT_FRACTION = 0.5f;
 
-    private static final int DEFAULT_APP_TRANSITION_DURATION = 250;
-    private static final int THUMBNAIL_APP_TRANSITION_DURATION = 325;
-    private static final int THUMBNAIL_APP_TRANSITION_ALPHA_DURATION = 325;
+    private static final int DEFAULT_APP_TRANSITION_DURATION = 336;
+    private static final int THUMBNAIL_APP_TRANSITION_DURATION = 336;
+    private static final int THUMBNAIL_APP_TRANSITION_ALPHA_DURATION = 336;
 
     private final Context mContext;
     private final Handler mH;
@@ -179,8 +179,14 @@
     private final Interpolator mThumbnailFadeInInterpolator;
     private final Interpolator mThumbnailFadeOutInterpolator;
     private final Interpolator mLinearOutSlowInInterpolator;
-    private final Interpolator mFastOutSlowInInterpolator;
-    private final LinearInterpolator mLinearInterpolator;
+    private final Interpolator mFastOutLinearInInterpolator;
+    private final Interpolator mClipHorizontalInterpolator = new PathInterpolator(0, 0, 0.4f, 1f);
+
+    /** Interpolator to be used for animations that respond directly to a touch */
+    private final Interpolator mTouchResponseInterpolator =
+            new PathInterpolator(0.3f, 0f, 0.1f, 1f);
+
+    private final int mClipRevealTranslationY;
 
     private int mCurrentUserId = 0;
 
@@ -191,9 +197,8 @@
         mH = h;
         mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
                 com.android.internal.R.interpolator.linear_out_slow_in);
-        mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
-                com.android.internal.R.interpolator.fast_out_slow_in);
-        mLinearInterpolator = new LinearInterpolator();
+        mFastOutLinearInInterpolator = AnimationUtils.loadInterpolator(context,
+                com.android.internal.R.interpolator.fast_out_linear_in);
         mConfigShortAnimTime = context.getResources().getInteger(
                 com.android.internal.R.integer.config_shortAnimTime);
         mDecelerateInterpolator = AnimationUtils.loadInterpolator(context,
@@ -205,8 +210,9 @@
                 if (input < RECENTS_THUMBNAIL_FADEIN_FRACTION) {
                     return 0f;
                 }
-                return (input - RECENTS_THUMBNAIL_FADEIN_FRACTION) /
+                float t = (input - RECENTS_THUMBNAIL_FADEIN_FRACTION) /
                         (1f - RECENTS_THUMBNAIL_FADEIN_FRACTION);
+                return mFastOutLinearInInterpolator.getInterpolation(t);
             }
         };
         mThumbnailFadeOutInterpolator = new Interpolator() {
@@ -214,11 +220,14 @@
             public float getInterpolation(float input) {
                 // Linear response for first fraction, then complete after that.
                 if (input < RECENTS_THUMBNAIL_FADEOUT_FRACTION) {
-                    return input / RECENTS_THUMBNAIL_FADEOUT_FRACTION;
+                    float t = input / RECENTS_THUMBNAIL_FADEOUT_FRACTION;
+                    return mLinearOutSlowInInterpolator.getInterpolation(t);
                 }
                 return 1f;
             }
         };
+        mClipRevealTranslationY = (int) (CLIP_REVEAL_TRANSLATION_Y_DP
+                * mContext.getResources().getDisplayMetrics().density);
     }
 
     boolean isTransitionSet() {
@@ -507,47 +516,47 @@
         if (enter) {
             // Reveal will expand and move faster in horizontal direction
 
-            // Start from upper left of start and move to final position
             final int appWidth = appFrame.width();
             final int appHeight = appFrame.height();
 
-            // Start from size of launch icon, expand to full width/height
+            float t = 0f;
+            if (appHeight > 0) {
+                t = (float) mNextAppTransitionStartY / appHeight;
+            }
+            int translationY = mClipRevealTranslationY
+                    + (int)(appHeight / 7f * t);
+
+            int centerX = mNextAppTransitionStartX + mNextAppTransitionStartWidth / 2;
+            int centerY = mNextAppTransitionStartY + mNextAppTransitionStartHeight / 2;
+
+            // Clip third of the from size of launch icon, expand to full width/height
             Animation clipAnimLR = new ClipRectLRAnimation(
-                    (appWidth - mNextAppTransitionStartWidth) / 2,
-                    (appWidth + mNextAppTransitionStartWidth) / 2, 0, appWidth);
-            clipAnimLR.setInterpolator(mLinearOutSlowInInterpolator);
-            clipAnimLR.setDuration(DEFAULT_APP_TRANSITION_DURATION);
+                    centerX - mNextAppTransitionStartWidth / 3,
+                    centerX + mNextAppTransitionStartWidth / 3,
+                    0, appWidth);
+            clipAnimLR.setInterpolator(mClipHorizontalInterpolator);
+            clipAnimLR.setDuration((long) (DEFAULT_APP_TRANSITION_DURATION / 2.5f));
             Animation clipAnimTB = new ClipRectTBAnimation(
-                    (appHeight - mNextAppTransitionStartHeight) / 2,
-                    (appHeight + mNextAppTransitionStartHeight) / 2, 0, appHeight);
-            clipAnimTB.setInterpolator(mFastOutSlowInInterpolator);
+                    centerY - mNextAppTransitionStartHeight / 3 - translationY,
+                    centerY + mNextAppTransitionStartHeight / 3 - translationY,
+                    0, appHeight);
+            clipAnimTB.setInterpolator(mTouchResponseInterpolator);
             clipAnimTB.setDuration(DEFAULT_APP_TRANSITION_DURATION);
 
-            // Start from middle of launch icon area, move to 0, 0
-            int startMiddleX = mNextAppTransitionStartX +
-                    (mNextAppTransitionStartWidth - appWidth) / 2 - appFrame.left;
-            int startMiddleY = mNextAppTransitionStartY +
-                    (mNextAppTransitionStartHeight - appHeight) / 2 - appFrame.top;
-
-            TranslateXAnimation translateX = new TranslateXAnimation(
-                    Animation.ABSOLUTE, startMiddleX, Animation.ABSOLUTE, 0);
-            translateX.setInterpolator(mLinearOutSlowInInterpolator);
-            translateX.setDuration(DEFAULT_APP_TRANSITION_DURATION);
             TranslateYAnimation translateY = new TranslateYAnimation(
-                    Animation.ABSOLUTE, startMiddleY, Animation.ABSOLUTE, 0);
-            translateY.setInterpolator(mFastOutSlowInInterpolator);
+                    Animation.ABSOLUTE, translationY, Animation.ABSOLUTE, 0);
+            translateY.setInterpolator(mLinearOutSlowInInterpolator);
             translateY.setDuration(DEFAULT_APP_TRANSITION_DURATION);
 
             // Quick fade-in from icon to app window
-            final int alphaDuration = 100;
-            AlphaAnimation alpha = new AlphaAnimation(0.1f, 1);
+            final int alphaDuration = DEFAULT_APP_TRANSITION_DURATION / 4;
+            AlphaAnimation alpha = new AlphaAnimation(0.5f, 1);
             alpha.setDuration(alphaDuration);
-            alpha.setInterpolator(mLinearInterpolator);
+            alpha.setInterpolator(mLinearOutSlowInInterpolator);
 
             AnimationSet set = new AnimationSet(false);
             set.addAnimation(clipAnimLR);
             set.addAnimation(clipAnimTB);
-            set.addAnimation(translateX);
             set.addAnimation(translateY);
             set.addAnimation(alpha);
             set.initialize(appWidth, appHeight, appWidth, appHeight);
@@ -657,14 +666,14 @@
             Animation scale = new ScaleAnimation(1f, scaleW, 1f, scaleW,
                     mNextAppTransitionStartX + (thumbWidth / 2f),
                     mNextAppTransitionStartY + (thumbHeight / 2f));
-            scale.setInterpolator(mFastOutSlowInInterpolator);
+            scale.setInterpolator(mTouchResponseInterpolator);
             scale.setDuration(THUMBNAIL_APP_TRANSITION_DURATION);
             Animation alpha = new AlphaAnimation(1, 0);
             alpha.setInterpolator(mThumbnailFadeOutInterpolator);
             alpha.setDuration(THUMBNAIL_APP_TRANSITION_ALPHA_DURATION);
             Animation translate = new TranslateAnimation(0, 0, 0, -unscaledStartY +
                     mNextAppTransitionInsets.top);
-            translate.setInterpolator(mFastOutSlowInInterpolator);
+            translate.setInterpolator(mTouchResponseInterpolator);
             translate.setDuration(THUMBNAIL_APP_TRANSITION_DURATION);
 
             // This AnimationSet uses the Interpolators assigned above.
@@ -678,14 +687,14 @@
             Animation scale = new ScaleAnimation(scaleW, 1f, scaleW, 1f,
                     mNextAppTransitionStartX + (thumbWidth / 2f),
                     mNextAppTransitionStartY + (thumbHeight / 2f));
-            scale.setInterpolator(mFastOutSlowInInterpolator);
+            scale.setInterpolator(mTouchResponseInterpolator);
             scale.setDuration(THUMBNAIL_APP_TRANSITION_DURATION);
             Animation alpha = new AlphaAnimation(0f, 1f);
             alpha.setInterpolator(mThumbnailFadeInInterpolator);
             alpha.setDuration(THUMBNAIL_APP_TRANSITION_ALPHA_DURATION);
             Animation translate = new TranslateAnimation(0, 0, -unscaledStartY +
                     mNextAppTransitionInsets.top, 0);
-            translate.setInterpolator(mFastOutSlowInInterpolator);
+            translate.setInterpolator(mTouchResponseInterpolator);
             translate.setDuration(THUMBNAIL_APP_TRANSITION_DURATION);
 
             // This AnimationSet uses the Interpolators assigned above.
@@ -697,7 +706,7 @@
 
         }
         return prepareThumbnailAnimationWithDuration(a, appWidth, appHeight, 0,
-                mFastOutSlowInInterpolator);
+                mTouchResponseInterpolator);
     }
 
     /**
@@ -833,7 +842,7 @@
         int duration = Math.max(THUMBNAIL_APP_TRANSITION_ALPHA_DURATION,
                 THUMBNAIL_APP_TRANSITION_DURATION);
         return prepareThumbnailAnimationWithDuration(a, appWidth, appHeight, duration,
-                mFastOutSlowInInterpolator);
+                mTouchResponseInterpolator);
     }
 
     /**
@@ -941,6 +950,16 @@
         return prepareThumbnailAnimation(a, appWidth, appHeight, transit);
     }
 
+    /**
+     * @return true if and only if the first frame of the transition can be skipped, i.e. the first
+     *         frame of the transition doesn't change the visuals on screen, so we can start
+     *         directly with the second one
+     */
+    boolean canSkipFirstFrame() {
+        return mNextAppTransitionType != NEXT_TRANSIT_TYPE_CUSTOM
+                && mNextAppTransitionType != NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE
+                && mNextAppTransitionType != NEXT_TRANSIT_TYPE_CLIP_REVEAL;
+    }
 
     Animation loadAnimation(WindowManager.LayoutParams lp, int transit, boolean enter,
             int appWidth, int appHeight, int orientation, Rect containingFrame, Rect contentInsets,
diff --git a/services/core/java/com/android/server/wm/AppWindowAnimator.java b/services/core/java/com/android/server/wm/AppWindowAnimator.java
index 2e89385..df7b23d 100644
--- a/services/core/java/com/android/server/wm/AppWindowAnimator.java
+++ b/services/core/java/com/android/server/wm/AppWindowAnimator.java
@@ -24,6 +24,7 @@
 import android.graphics.Matrix;
 import android.util.Slog;
 import android.util.TimeUtils;
+import android.view.Choreographer;
 import android.view.Display;
 import android.view.SurfaceControl;
 import android.view.WindowManagerPolicy;
@@ -89,6 +90,8 @@
      *  See {@link #transferCurrentAnimation}*/
     boolean usingTransferredAnimation = false;
 
+    private boolean mSkipFirstFrame = false;
+
     static final Animation sDummyAnimation = new DummyAnimation();
 
     public AppWindowAnimator(final AppWindowToken atoken) {
@@ -97,7 +100,7 @@
         mAnimator = atoken.mAnimator;
     }
 
-    public void setAnimation(Animation anim, int width, int height) {
+    public void setAnimation(Animation anim, int width, int height, boolean skipFirstFrame) {
         if (WindowManagerService.localLOGV) Slog.v(TAG, "Setting animation in " + mAppToken
                 + ": " + anim + " wxh=" + width + "x" + height
                 + " isVisible=" + mAppToken.isVisible());
@@ -125,6 +128,8 @@
         transformation.setAlpha(mAppToken.isVisible() ? 1 : 0);
         hasTransformation = true;
 
+        this.mSkipFirstFrame = skipFirstFrame;
+
         if (!mAppToken.appFullscreen) {
             anim.setBackgroundColor(0);
         }
@@ -271,6 +276,18 @@
         return hasMoreFrames;
     }
 
+    private long getStartTimeCorrection() {
+        if (mSkipFirstFrame) {
+
+            // If the transition is an animation in which the first frame doesn't change the screen
+            // contents at all, we can just skip it and start at the second frame. So we shift the
+            // start time of the animation forward by minus the frame duration.
+            return -Choreographer.getInstance().getFrameIntervalNanos() / TimeUtils.NANOS_PER_MS;
+        } else {
+            return 0;
+        }
+    }
+
     // This must be called while inside a transaction.
     boolean stepAnimationLocked(long currentTime, final int displayId) {
         if (mService.okToDisplay()) {
@@ -292,12 +309,14 @@
                         " @ " + currentTime + " scale="
                         + mService.getTransitionAnimationScaleLocked()
                         + " allDrawn=" + mAppToken.allDrawn + " animating=" + animating);
-                    animation.setStartTime(currentTime);
+                    long correction = getStartTimeCorrection();
+                    animation.setStartTime(currentTime + correction);
                     animating = true;
                     if (thumbnail != null) {
                         thumbnail.show();
-                        thumbnailAnimation.setStartTime(currentTime);
+                        thumbnailAnimation.setStartTime(currentTime + correction);
                     }
+                    mSkipFirstFrame = false;
                 }
                 if (stepAnimation(currentTime)) {
                     // animation isn't over, step any thumbnail and that's
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 6b5c224..38e2765 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -3489,7 +3489,8 @@
                     }
                     Slog.v(TAG, "Loaded animation " + a + " for " + atoken, e);
                 }
-                atoken.mAppAnimator.setAnimation(a, width, height);
+                atoken.mAppAnimator.setAnimation(a, width, height,
+                        mAppTransition.canSkipFirstFrame());
             }
         } else {
             atoken.mAppAnimator.clearAnimation();
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 353bb5f..ccfaca7 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -62,7 +62,7 @@
      * effectively disable the "Sim network lock" feature.
      */
     public static final String
-            BOOL_IGNORE_SIM_NETWORK_LOCKED_EVENTS = "bool_ignore_sim_network_locked_events";
+            KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL = "ignore_sim_network_locked_events_bool";
 
     /**
      * Flag indicating whether the Phone app should provide a "Dismiss" button on the SIM network
@@ -72,10 +72,10 @@
      * you don't know the PIN.)
      */
     public static final String
-            BOOL_SIM_NETWORK_UNLOCK_ALLOW_DISMISS = "bool_sim_network_unlock_allow_dismiss";
+            KEY_SIM_NETWORK_UNLOCK_ALLOW_DISMISS_BOOL = "sim_network_unlock_allow_dismiss_bool";
 
     /** Flag indicating if the phone is a world phone */
-    public static final String BOOL_WORLD_PHONE = "bool_world_phone";
+    public static final String KEY_WORLD_PHONE_BOOL = "world_phone_bool";
 
     /**
      * If true, enable vibration (haptic feedback) for key presses in the EmergencyDialer activity.
@@ -84,30 +84,30 @@
      * from config.xml under apps/Contacts.
      */
     public static final String
-            BOOL_ENABLE_DIALER_KEY_VIBRATION = "bool_enable_dialer_key_vibration";
+            KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "key_enable_dialer_vibration_bool";
 
     /** Flag indicating if dtmf tone type is enabled */
-    public static final String BOOL_DTMF_TYPE_ENABLED = "bool_dtmf_type_enabled";
+    public static final String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool";
 
     /** Flag indicating if auto retry is enabled */
-    public static final String BOOL_AUTO_RETRY_ENABLED = "bool_auto_retry_enabled";
+    public static final String KEY_AUTO_RETRY_ENABLED_BOOL = "auto_retry_enabled_bool";
 
     /**
      * Determine whether we want to play local DTMF tones in a call, or just let the radio/BP handle
      * playing of the tones.
      */
-    public static final String BOOL_ALLOW_LOCAL_DTMF_TONES = "bool_allow_local_dtmf_tones";
+    public static final String KEY_ALLOW_LOCAL_DTMF_TONES_BOOL = "allow_local_dtmf_tones_bool";
 
     /**
      * If true, show an onscreen "Dial" button in the dialer. In practice this is used on all
      * platforms, even the ones with hard SEND/END keys, but for maximum flexibility it's controlled
      * by a flag here (which can be overridden on a per-product basis.)
      */
-    public static final String BOOL_SHOW_ONSCREEN_DIAL_BUTTON = "bool_show_onscreen_dial_button";
+    public static final String KEY_SHOW_ONSCREEN_DIAL_BUTTON_BOOL = "show_onscreen_dial_button_bool";
 
     /** Determines if device implements a noise suppression device for in call audio. */
     public static final String
-            BOOL_HAS_IN_CALL_NOISE_SUPPRESSION = "bool_has_in_call_noise_suppression";
+            KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL = "has_in_call_noise_suppression_bool";
 
     /**
      * Determines if the current device should allow emergency numbers to be logged in the Call Log.
@@ -121,29 +121,29 @@
      * emergency numbers.
      */
     public static final String
-            BOOL_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG = "bool_allow_emergency_numbers_in_call_log";
+            KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL = "allow_emergency_numbers_in_call_log_bool";
 
     /** If true, removes the Voice Privacy option from Call Settings */
-    public static final String BOOL_VOICE_PRIVACY_DISABLE = "bool_voice_privacy_disable";
+    public static final String KEY_VOICE_PRIVACY_DISABLE_BOOL = "voice_privacy_disable_bool";
 
     /** Control whether users can reach the carrier portions of Cellular Network Settings. */
     public static final String
-            BOOL_HIDE_CARRIER_NETWORK_SETTINGS = "bool_hide_carrier_network_settings";
+            KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL = "hide_carrier_network_settings_bool";
 
     /** Control whether users can edit APNs in Settings. */
-    public static final String BOOL_APN_EXPAND = "bool_apn_expand";
+    public static final String KEY_APN_EXPAND_BOOL = "apn_expand_bool";
 
     /** Control whether users can choose a network operator. */
-    public static final String BOOL_OPERATOR_SELECTION_EXPAND = "bool_operator_selection_expand";
+    public static final String KEY_OPERATOR_SELECTION_EXPAND_BOOL = "operator_selection_expand_bool";
 
     /** Used in Cellular Network Settings for preferred network type. */
-    public static final String BOOL_PREFER_2G = "bool_prefer_2g";
+    public static final String KEY_PREFER_2G_BOOL = "prefer_2g_bool";
 
     /** Show cdma network mode choices 1x, 3G, global etc. */
-    public static final String BOOL_SHOW_CDMA_CHOICES = "bool_show_cdma_choices";
+    public static final String KEY_SHOW_CDMA_CHOICES_BOOL = "show_cdma_choices_bool";
 
     /** CDMA activation goes through HFA */
-    public static final String BOOL_USE_HFA_FOR_PROVISIONING = "bool_use_hfa_for_provisioning";
+    public static final String KEY_USE_HFA_FOR_PROVISIONING_BOOL = "use_hfa_for_provisioning_bool";
 
     /**
      * CDMA activation goes through OTASP.
@@ -151,51 +151,51 @@
      * TODO: This should be combined with config_use_hfa_for_provisioning and implemented as an enum
      * (NONE, HFA, OTASP).
      */
-    public static final String BOOL_USE_OTASP_FOR_PROVISIONING = "bool_use_otasp_for_provisioning";
+    public static final String KEY_USE_OTASP_FOR_PROVISIONING_BOOL = "use_otasp_for_provisioning_bool";
 
     /** Display carrier settings menu if true */
-    public static final String BOOL_CARRIER_SETTINGS_ENABLE = "bool_carrier_settings_enable";
+    public static final String KEY_CARRIER_SETTINGS_ENABLE_BOOL = "carrier_settings_enable_bool";
 
     /** Does not display additional call seting for IMS phone based on GSM Phone */
-    public static final String BOOL_ADDITIONAL_CALL_SETTING = "bool_additional_call_setting";
+    public static final String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool";
 
     /** Show APN Settings for some CDMA carriers */
-    public static final String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma";
+    public static final String KEY_SHOW_APN_SETTING_CDMA_BOOL = "show_apn_setting_cdma_bool";
 
     /** After a CDMA conference call is merged, the swap button should be displayed. */
-    public static final String BOOL_SUPPORT_SWAP_AFTER_MERGE = "bool_support_swap_after_merge";
+    public static final String KEY_SUPPORT_SWAP_AFTER_MERGE_BOOL = "support_swap_after_merge_bool";
 
     /**
      * Determine whether the voicemail notification is persistent in the notification bar. If true,
      * the voicemail notifications cannot be dismissed from the notification bar.
      */
     public static final String
-            BOOL_VOICEMAIL_NOTIFICATION_PERSISTENT = "bool_voicemail_notification_persistent";
+            KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL = "voicemail_notification_persistent_bool";
 
     /** For IMS video over LTE calls, determines whether video pause signalling is supported. */
     public static final String
-            BOOL_SUPPORT_PAUSE_IMS_VIDEO_CALLS = "bool_support_pause_ims_video_calls";
+            KEY_SUPPORT_PAUSE_IMS_VIDEO_CALLS_BOOL = "support_pause_ims_video_calls_bool";
 
     /**
      * Disables dialing "*228" (OTASP provisioning) on CDMA carriers where it is not supported or is
      * potentially harmful by locking the SIM to 3G.
      */
     public static final String
-            BOOL_DISABLE_CDMA_ACTIVATION_CODE = "bool_disable_cdma_activation_code";
+            KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL = "disable_cdma_activation_code_bool";
 
     /**
      * Flag specifying whether VoLTE should be available for carrier, independent of carrier
      * provisioning. If false: hard disabled. If true: then depends on carrier provisioning,
      * availability, etc.
      */
-    public static final String BOOL_CARRIER_VOLTE_AVAILABLE = "bool_carrier_volte_available";
+    public static final String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool";
 
     /** Flag specifying whether VoLTE availability is based on provisioning. */
-    public static final String BOOL_CARRIER_VOLTE_PROVISIONED = "bool_carrier_volte_provisioned";
+    public static final String KEY_CARRIER_VOLTE_PROVISIONED_BOOL = "carrier_volte_provisioned_bool";
 
     /** Flag specifying whether VoLTE TTY is supported. */
-    public static final String BOOL_CARRIER_VOLTE_TTY_SUPPORTED
-            = "bool_carrier_volte_tty_supported";
+    public static final String KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL
+            = "carrier_volte_tty_supported_bool";
 
     /**
      * If Voice Radio Technology is RIL_RADIO_TECHNOLOGY_LTE:14 or RIL_RADIO_TECHNOLOGY_UNKNOWN:0
@@ -203,7 +203,7 @@
      * RIL_RADIO_TECHNOLOGY_UNKNOWN:0 means there is no replacement value and that the default
      * assumption for phone type (GSM) should be used.
      */
-    public static final String INT_VOLTE_REPLACEMENT_RAT = "int_volte_replacement_rat";
+    public static final String KEY_VOLTE_REPLACEMENT_RAT_INT = "volte_replacement_rat_int";
 
     /* The following 3 fields are related to carrier visual voicemail. */
 
@@ -212,14 +212,14 @@
      *
      * @hide
      */
-    public static final String STRING_VVM_DESTINATION_NUMBER = "string_vvm_destination_number";
+    public static final String KEY_VVM_DESTINATION_NUMBER_STRING = "vvm_destination_number_string";
 
     /**
      * The port through which the MO sms messages are sent through.
      *
      * @hide
      */
-    public static final String INT_VVM_PORT_NUMBER = "int_vvm_port_number";
+    public static final String KEY_VVM_PORT_NUMBER_INT = "vvm_port_number_int";
 
     /**
      * The type of visual voicemail protocol the carrier adheres to. See {@link TelephonyManager}
@@ -227,7 +227,7 @@
      *
      * @hide
      */
-    public static final String STRING_VVM_TYPE = "string_vvm_type";
+    public static final String KEY_VVM_TYPE_STRING = "vvm_type_string";
 
     /**
      * The package name of the carrier's visual voicemail app to ensure that dialer visual voicemail
@@ -235,112 +235,113 @@
      *
      * @hide
      */
-    public static final String STRING_CARRIER_VVM_PACKAGE_NAME = "string_carrier_vvm_package_name";
+    public static final String KEY_CARRIER_VVM_PACKAGE_NAME_STRING = "carrier_vvm_package_name_string";
 
     // These variables are used by the MMS service and exposed through another API, {@link
     // SmsManager}. The variable names and string values are copied from there.
-    public static final String BOOL_MMS_ALIAS_ENABLED = "aliasEnabled";
-    public static final String BOOL_MMS_ALLOW_ATTACH_AUDIO = "allowAttachAudio";
-    public static final String BOOL_MMS_APPEND_TRANSACTION_ID = "enabledTransID";
-    public static final String BOOL_MMS_GROUP_MMS_ENABLED = "enableGroupMms";
-    public static final String BOOL_MMS_MMS_DELIVERY_REPORT_ENABLED = "enableMMSDeliveryReports";
-    public static final String BOOL_MMS_MMS_ENABLED = "enabledMMS";
-    public static final String BOOL_MMS_MMS_READ_REPORT_ENABLED = "enableMMSReadReports";
-    public static final String BOOL_MMS_MULTIPART_SMS_ENABLED = "enableMultipartSMS";
-    public static final String BOOL_MMS_NOTIFY_WAP_MMSC_ENABLED = "enabledNotifyWapMMSC";
-    public static final String BOOL_MMS_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES = "sendMultipartSmsAsSeparateMessages";
-    public static final String BOOL_MMS_SHOW_CELL_BROADCAST_APP_LINKS = "config_cellBroadcastAppLinks";
-    public static final String BOOL_MMS_SMS_DELIVERY_REPORT_ENABLED = "enableSMSDeliveryReports";
-    public static final String BOOL_MMS_SUPPORT_HTTP_CHARSET_HEADER = "supportHttpCharsetHeader";
-    public static final String BOOL_MMS_SUPPORT_MMS_CONTENT_DISPOSITION = "supportMmsContentDisposition";
-    public static final String INT_MMS_ALIAS_MAX_CHARS = "aliasMaxChars";
-    public static final String INT_MMS_ALIAS_MIN_CHARS = "aliasMinChars";
-    public static final String INT_MMS_HTTP_SOCKET_TIMEOUT = "httpSocketTimeout";
-    public static final String INT_MMS_MAX_IMAGE_HEIGHT = "maxImageHeight";
-    public static final String INT_MMS_MAX_IMAGE_WIDTH = "maxImageWidth";
-    public static final String INT_MMS_MAX_MESSAGE_SIZE = "maxMessageSize";
-    public static final String INT_MMS_MESSAGE_TEXT_MAX_SIZE = "maxMessageTextSize";
-    public static final String INT_MMS_RECIPIENT_LIMIT = "recipientLimit";
-    public static final String INT_MMS_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD = "smsToMmsTextLengthThreshold";
-    public static final String INT_MMS_SMS_TO_MMS_TEXT_THRESHOLD = "smsToMmsTextThreshold";
-    public static final String INT_MMS_SUBJECT_MAX_LENGTH = "maxSubjectLength";
-    public static final String STRING_MMS_EMAIL_GATEWAY_NUMBER = "emailGatewayNumber";
-    public static final String STRING_MMS_HTTP_PARAMS = "httpParams";
-    public static final String STRING_MMS_NAI_SUFFIX = "naiSuffix";
-    public static final String STRING_MMS_UA_PROF_TAG_NAME = "uaProfTagName";
-    public static final String STRING_MMS_UA_PROF_URL = "uaProfUrl";
-    public static final String STRING_MMS_USER_AGENT = "userAgent";
+    public static final String KEY_MMS_ALIAS_ENABLED_BOOL = "aliasEnabled";
+    public static final String KEY_MMS_ALLOW_ATTACH_AUDIO_BOOL = "allowAttachAudio";
+    public static final String KEY_MMS_APPEND_TRANSACTION_ID_BOOL = "enabledTransID";
+    public static final String KEY_MMS_GROUP_MMS_ENABLED_BOOL = "enableGroupMms";
+    public static final String KEY_MMS_MMS_DELIVERY_REPORT_ENABLED_BOOL = "enableMMSDeliveryReports";
+    public static final String KEY_MMS_MMS_ENABLED_BOOL = "enabledMMS";
+    public static final String KEY_MMS_MMS_READ_REPORT_ENABLED_BOOL = "enableMMSReadReports";
+    public static final String KEY_MMS_MULTIPART_SMS_ENABLED_BOOL = "enableMultipartSMS";
+    public static final String KEY_MMS_NOTIFY_WAP_MMSC_ENABLED_BOOL = "enabledNotifyWapMMSC";
+    public static final String KEY_MMS_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES_BOOL = "sendMultipartSmsAsSeparateMessages";
+    public static final String KEY_MMS_SHOW_CELL_BROADCAST_APP_LINKS_BOOL = "config_cellBroadcastAppLinks";
+    public static final String KEY_MMS_SMS_DELIVERY_REPORT_ENABLED_BOOL = "enableSMSDeliveryReports";
+    public static final String KEY_MMS_SUPPORT_HTTP_CHARSET_HEADER_BOOL = "supportHttpCharsetHeader";
+    public static final String KEY_MMS_SUPPORT_MMS_CONTENT_DISPOSITION_BOOL = "supportMmsContentDisposition";
+    public static final String KEY_MMS_ALIAS_MAX_CHARS_INT = "aliasMaxChars";
+    public static final String KEY_MMS_ALIAS_MIN_CHARS_INT = "aliasMinChars";
+    public static final String KEY_MMS_HTTP_SOCKET_TIMEOUT_INT = "httpSocketTimeout";
+    public static final String KEY_MMS_MAX_IMAGE_HEIGHT_INT = "maxImageHeight";
+    public static final String KEY_MMS_MAX_IMAGE_WIDTH_INT = "maxImageWidth";
+    public static final String KEY_MMS_MAX_MESSAGE_SIZE_INT = "maxMessageSize";
+    public static final String KEY_MMS_MESSAGE_TEXT_MAX_SIZE_INT = "maxMessageTextSize";
+    public static final String KEY_MMS_RECIPIENT_LIMIT_INT = "recipientLimit";
+    public static final String KEY_MMS_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD_INT = "smsToMmsTextLengthThreshold";
+    public static final String KEY_MMS_SMS_TO_MMS_TEXT_THRESHOLD_INT = "smsToMmsTextThreshold";
+    public static final String KEY_MMS_SUBJECT_MAX_LENGTH_INT = "maxSubjectLength";
+    public static final String KEY_MMS_EMAIL_GATEWAY_NUMBER_STRING = "emailGatewayNumber";
+    public static final String KEY_MMS_HTTP_PARAMS_STRING = "httpParams";
+    public static final String KEY_MMS_NAI_SUFFIX_STRING = "naiSuffix";
+    public static final String KEY_MMS_UA_PROF_TAG_NAME_STRING = "uaProfTagName";
+    public static final String KEY_MMS_UA_PROF_URL_STRING = "uaProfUrl";
+    public static final String KEY_MMS_USER_AGENT_STRING = "userAgent";
 
     /** The default value for every variable. */
     private final static PersistableBundle sDefaults;
 
     static {
         sDefaults = new PersistableBundle();
-        sDefaults.putBoolean(BOOL_ADDITIONAL_CALL_SETTING, true);
-        sDefaults.putBoolean(BOOL_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG, false);
-        sDefaults.putBoolean(BOOL_ALLOW_LOCAL_DTMF_TONES, true);
-        sDefaults.putBoolean(BOOL_APN_EXPAND, true);
-        sDefaults.putBoolean(BOOL_AUTO_RETRY_ENABLED, false);
-        sDefaults.putBoolean(BOOL_CARRIER_SETTINGS_ENABLE, false);
-        sDefaults.putBoolean(BOOL_CARRIER_VOLTE_AVAILABLE, false);
-        sDefaults.putBoolean(BOOL_CARRIER_VOLTE_PROVISIONED, false);
-        sDefaults.putBoolean(BOOL_CARRIER_VOLTE_TTY_SUPPORTED, true);
-        sDefaults.putBoolean(BOOL_DISABLE_CDMA_ACTIVATION_CODE, false);
-        sDefaults.putBoolean(BOOL_DTMF_TYPE_ENABLED, false);
-        sDefaults.putBoolean(BOOL_ENABLE_DIALER_KEY_VIBRATION, true);
-        sDefaults.putBoolean(BOOL_HAS_IN_CALL_NOISE_SUPPRESSION, false);
-        sDefaults.putBoolean(BOOL_HIDE_CARRIER_NETWORK_SETTINGS, false);
-        sDefaults.putBoolean(BOOL_IGNORE_SIM_NETWORK_LOCKED_EVENTS, false);
-        sDefaults.putBoolean(BOOL_OPERATOR_SELECTION_EXPAND, true);
-        sDefaults.putBoolean(BOOL_PREFER_2G, true);
-        sDefaults.putBoolean(BOOL_SHOW_APN_SETTING_CDMA, false);
-        sDefaults.putBoolean(BOOL_SHOW_CDMA_CHOICES, false);
-        sDefaults.putBoolean(BOOL_SHOW_ONSCREEN_DIAL_BUTTON, true);
-        sDefaults.putBoolean(BOOL_SIM_NETWORK_UNLOCK_ALLOW_DISMISS, true);
-        sDefaults.putBoolean(BOOL_SUPPORT_PAUSE_IMS_VIDEO_CALLS, true);
-        sDefaults.putBoolean(BOOL_SUPPORT_SWAP_AFTER_MERGE, true);
-        sDefaults.putBoolean(BOOL_USE_HFA_FOR_PROVISIONING, false);
-        sDefaults.putBoolean(BOOL_USE_OTASP_FOR_PROVISIONING, false);
-        sDefaults.putBoolean(BOOL_VOICEMAIL_NOTIFICATION_PERSISTENT, false);
-        sDefaults.putBoolean(BOOL_VOICE_PRIVACY_DISABLE, false);
-        sDefaults.putBoolean(BOOL_WORLD_PHONE, false);
-        sDefaults.putInt(INT_VOLTE_REPLACEMENT_RAT, 0);
-        sDefaults.putInt(INT_VVM_PORT_NUMBER, 0);
-        sDefaults.putString(STRING_VVM_DESTINATION_NUMBER, "");
-        sDefaults.putString(STRING_VVM_TYPE, "");
+        sDefaults.putBoolean(KEY_ADDITIONAL_CALL_SETTING_BOOL, true);
+        sDefaults.putBoolean(KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL, false);
+        sDefaults.putBoolean(KEY_ALLOW_LOCAL_DTMF_TONES_BOOL, true);
+        sDefaults.putBoolean(KEY_APN_EXPAND_BOOL, true);
+        sDefaults.putBoolean(KEY_AUTO_RETRY_ENABLED_BOOL, false);
+        sDefaults.putBoolean(KEY_CARRIER_SETTINGS_ENABLE_BOOL, false);
+        sDefaults.putBoolean(KEY_CARRIER_VOLTE_AVAILABLE_BOOL, false);
+        sDefaults.putBoolean(KEY_CARRIER_VOLTE_PROVISIONED_BOOL, false);
+        sDefaults.putBoolean(KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL, true);
+        sDefaults.putBoolean(KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL, false);
+        sDefaults.putBoolean(KEY_DTMF_TYPE_ENABLED_BOOL, false);
+        sDefaults.putBoolean(KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL, true);
+        sDefaults.putBoolean(KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL, false);
+        sDefaults.putBoolean(KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL, false);
+        sDefaults.putBoolean(KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL, false);
+        sDefaults.putBoolean(KEY_OPERATOR_SELECTION_EXPAND_BOOL, true);
+        sDefaults.putBoolean(KEY_PREFER_2G_BOOL, true);
+        sDefaults.putBoolean(KEY_SHOW_APN_SETTING_CDMA_BOOL, false);
+        sDefaults.putBoolean(KEY_SHOW_CDMA_CHOICES_BOOL, false);
+        sDefaults.putBoolean(KEY_SHOW_ONSCREEN_DIAL_BUTTON_BOOL, true);
+        sDefaults.putBoolean(KEY_SIM_NETWORK_UNLOCK_ALLOW_DISMISS_BOOL, true);
+        sDefaults.putBoolean(KEY_SUPPORT_PAUSE_IMS_VIDEO_CALLS_BOOL, true);
+        sDefaults.putBoolean(KEY_SUPPORT_SWAP_AFTER_MERGE_BOOL, true);
+        sDefaults.putBoolean(KEY_USE_HFA_FOR_PROVISIONING_BOOL, false);
+        sDefaults.putBoolean(KEY_USE_OTASP_FOR_PROVISIONING_BOOL, false);
+        sDefaults.putBoolean(KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL, false);
+        sDefaults.putBoolean(KEY_VOICE_PRIVACY_DISABLE_BOOL, false);
+        sDefaults.putBoolean(KEY_WORLD_PHONE_BOOL, false);
+        sDefaults.putInt(KEY_VOLTE_REPLACEMENT_RAT_INT, 0);
+        sDefaults.putString(KEY_VVM_DESTINATION_NUMBER_STRING, "");
+        sDefaults.putInt(KEY_VVM_PORT_NUMBER_INT, 0);
+        sDefaults.putString(KEY_VVM_TYPE_STRING, "");
+        sDefaults.putString(KEY_CARRIER_VVM_PACKAGE_NAME_STRING, "");
 
         // MMS defaults
-        sDefaults.putBoolean(BOOL_MMS_ALIAS_ENABLED, false);
-        sDefaults.putBoolean(BOOL_MMS_ALLOW_ATTACH_AUDIO, true);
-        sDefaults.putBoolean(BOOL_MMS_APPEND_TRANSACTION_ID, false);
-        sDefaults.putBoolean(BOOL_MMS_GROUP_MMS_ENABLED, true);
-        sDefaults.putBoolean(BOOL_MMS_MMS_DELIVERY_REPORT_ENABLED, false);
-        sDefaults.putBoolean(BOOL_MMS_MMS_ENABLED, true);
-        sDefaults.putBoolean(BOOL_MMS_MMS_READ_REPORT_ENABLED, false);
-        sDefaults.putBoolean(BOOL_MMS_MULTIPART_SMS_ENABLED, true);
-        sDefaults.putBoolean(BOOL_MMS_NOTIFY_WAP_MMSC_ENABLED, false);
-        sDefaults.putBoolean(BOOL_MMS_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES, false);
-        sDefaults.putBoolean(BOOL_MMS_SHOW_CELL_BROADCAST_APP_LINKS, true);
-        sDefaults.putBoolean(BOOL_MMS_SMS_DELIVERY_REPORT_ENABLED, true);
-        sDefaults.putBoolean(BOOL_MMS_SUPPORT_HTTP_CHARSET_HEADER, false);
-        sDefaults.putBoolean(BOOL_MMS_SUPPORT_MMS_CONTENT_DISPOSITION, true);
-        sDefaults.putInt(INT_MMS_ALIAS_MAX_CHARS, 48);
-        sDefaults.putInt(INT_MMS_ALIAS_MIN_CHARS, 2);
-        sDefaults.putInt(INT_MMS_HTTP_SOCKET_TIMEOUT, 60 * 1000);
-        sDefaults.putInt(INT_MMS_MAX_IMAGE_HEIGHT, 480);
-        sDefaults.putInt(INT_MMS_MAX_IMAGE_WIDTH, 640);
-        sDefaults.putInt(INT_MMS_MAX_MESSAGE_SIZE, 300 * 1024);
-        sDefaults.putInt(INT_MMS_MESSAGE_TEXT_MAX_SIZE, -1);
-        sDefaults.putInt(INT_MMS_RECIPIENT_LIMIT, Integer.MAX_VALUE);
-        sDefaults.putInt(INT_MMS_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD, -1);
-        sDefaults.putInt(INT_MMS_SMS_TO_MMS_TEXT_THRESHOLD, -1);
-        sDefaults.putInt(INT_MMS_SUBJECT_MAX_LENGTH, 40);
-        sDefaults.putString(STRING_MMS_EMAIL_GATEWAY_NUMBER, "");
-        sDefaults.putString(STRING_MMS_HTTP_PARAMS, "");
-        sDefaults.putString(STRING_MMS_NAI_SUFFIX, "");
-        sDefaults.putString(STRING_MMS_UA_PROF_TAG_NAME, "x-wap-profile");
-        sDefaults.putString(STRING_MMS_UA_PROF_URL, "");
-        sDefaults.putString(STRING_MMS_USER_AGENT, "");
+        sDefaults.putBoolean(KEY_MMS_ALIAS_ENABLED_BOOL, false);
+        sDefaults.putBoolean(KEY_MMS_ALLOW_ATTACH_AUDIO_BOOL, true);
+        sDefaults.putBoolean(KEY_MMS_APPEND_TRANSACTION_ID_BOOL, false);
+        sDefaults.putBoolean(KEY_MMS_GROUP_MMS_ENABLED_BOOL, true);
+        sDefaults.putBoolean(KEY_MMS_MMS_DELIVERY_REPORT_ENABLED_BOOL, false);
+        sDefaults.putBoolean(KEY_MMS_MMS_ENABLED_BOOL, true);
+        sDefaults.putBoolean(KEY_MMS_MMS_READ_REPORT_ENABLED_BOOL, false);
+        sDefaults.putBoolean(KEY_MMS_MULTIPART_SMS_ENABLED_BOOL, true);
+        sDefaults.putBoolean(KEY_MMS_NOTIFY_WAP_MMSC_ENABLED_BOOL, false);
+        sDefaults.putBoolean(KEY_MMS_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES_BOOL, false);
+        sDefaults.putBoolean(KEY_MMS_SHOW_CELL_BROADCAST_APP_LINKS_BOOL, true);
+        sDefaults.putBoolean(KEY_MMS_SMS_DELIVERY_REPORT_ENABLED_BOOL, true);
+        sDefaults.putBoolean(KEY_MMS_SUPPORT_HTTP_CHARSET_HEADER_BOOL, false);
+        sDefaults.putBoolean(KEY_MMS_SUPPORT_MMS_CONTENT_DISPOSITION_BOOL, true);
+        sDefaults.putInt(KEY_MMS_ALIAS_MAX_CHARS_INT, 48);
+        sDefaults.putInt(KEY_MMS_ALIAS_MIN_CHARS_INT, 2);
+        sDefaults.putInt(KEY_MMS_HTTP_SOCKET_TIMEOUT_INT, 60 * 1000);
+        sDefaults.putInt(KEY_MMS_MAX_IMAGE_HEIGHT_INT, 480);
+        sDefaults.putInt(KEY_MMS_MAX_IMAGE_WIDTH_INT, 640);
+        sDefaults.putInt(KEY_MMS_MAX_MESSAGE_SIZE_INT, 300 * 1024);
+        sDefaults.putInt(KEY_MMS_MESSAGE_TEXT_MAX_SIZE_INT, -1);
+        sDefaults.putInt(KEY_MMS_RECIPIENT_LIMIT_INT, Integer.MAX_VALUE);
+        sDefaults.putInt(KEY_MMS_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD_INT, -1);
+        sDefaults.putInt(KEY_MMS_SMS_TO_MMS_TEXT_THRESHOLD_INT, -1);
+        sDefaults.putInt(KEY_MMS_SUBJECT_MAX_LENGTH_INT, 40);
+        sDefaults.putString(KEY_MMS_EMAIL_GATEWAY_NUMBER_STRING, "");
+        sDefaults.putString(KEY_MMS_HTTP_PARAMS_STRING, "");
+        sDefaults.putString(KEY_MMS_NAI_SUFFIX_STRING, "");
+        sDefaults.putString(KEY_MMS_UA_PROF_TAG_NAME_STRING, "x-wap-profile");
+        sDefaults.putString(KEY_MMS_UA_PROF_URL_STRING, "");
+        sDefaults.putString(KEY_MMS_USER_AGENT_STRING, "");
     }
 
     /**
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 33e52bf..193285f 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -387,7 +387,9 @@
     public SubscriptionInfo getActiveSubscriptionInfo(int subId) {
         if (VDBG) logd("[getActiveSubscriptionInfo]+ subId=" + subId);
         if (!isValidSubscriptionId(subId)) {
-            logd("[getActiveSubscriptionInfo]- invalid subId");
+            if (DBG) {
+                logd("[getActiveSubscriptionInfo]- invalid subId");
+            }
             return null;
         }
 
@@ -751,7 +753,9 @@
      */
     public static int getSlotId(int subId) {
         if (!isValidSubscriptionId(subId)) {
-            logd("[getSlotId]- fail");
+            if (DBG) {
+                logd("[getSlotId]- fail");
+            }
         }
 
         int result = INVALID_SIM_SLOT_INDEX;
@@ -793,7 +797,9 @@
     /** @hide */
     public static int getPhoneId(int subId) {
         if (!isValidSubscriptionId(subId)) {
-            logd("[getPhoneId]- fail");
+            if (DBG) {
+                logd("[getPhoneId]- fail");
+            }
             return INVALID_PHONE_INDEX;
         }
 
diff --git a/wifi/java/android/net/wifi/RttManager.java b/wifi/java/android/net/wifi/RttManager.java
index 7ced126..503e4a2 100644
--- a/wifi/java/android/net/wifi/RttManager.java
+++ b/wifi/java/android/net/wifi/RttManager.java
@@ -829,7 +829,8 @@
             Log.e(TAG, "Request " + index + ": two side RTT is not supported");
             return false;
         }  else if(params.bssid == null || params.bssid.isEmpty()) {
-            Log.e(TAG,"No BSSID is input");
+            Log.e(TAG,"No BSSID in params");
+            return false;
         } else if ( params.numberBurst != 0 ) {
             Log.e(TAG, "Request " + index + ": Illegal number of burst: " + params.numberBurst);
             return false;