diff options
179 files changed, 4306 insertions, 1557 deletions
diff --git a/api/current.txt b/api/current.txt index 7c22e4e7826d..73a252bfd9da 100644 --- a/api/current.txt +++ b/api/current.txt @@ -2112,22 +2112,6 @@ package android { field public static final int Theme_Light_Panel = 16973914; // 0x103005a field public static final int Theme_Light_WallpaperSettings = 16973922; // 0x1030062 field public static final int Theme_Material = 16974372; // 0x1030224 - field public static final int Theme_Material_DayNight = 16974548; // 0x10302d4 - field public static final int Theme_Material_DayNight_DarkActionBar = 16974549; // 0x10302d5 - field public static final int Theme_Material_DayNight_Dialog = 16974550; // 0x10302d6 - field public static final int Theme_Material_DayNight_DialogWhenLarge = 16974556; // 0x10302dc - field public static final int Theme_Material_DayNight_DialogWhenLarge_DarkActionBar = 16974568; // 0x10302e8 - field public static final int Theme_Material_DayNight_DialogWhenLarge_NoActionBar = 16974557; // 0x10302dd - field public static final int Theme_Material_DayNight_Dialog_Alert = 16974551; // 0x10302d7 - field public static final int Theme_Material_DayNight_Dialog_MinWidth = 16974552; // 0x10302d8 - field public static final int Theme_Material_DayNight_Dialog_NoActionBar = 16974553; // 0x10302d9 - field public static final int Theme_Material_DayNight_Dialog_NoActionBar_MinWidth = 16974554; // 0x10302da - field public static final int Theme_Material_DayNight_Dialog_Presentation = 16974555; // 0x10302db - field public static final int Theme_Material_DayNight_NoActionBar = 16974558; // 0x10302de - field public static final int Theme_Material_DayNight_NoActionBar_Fullscreen = 16974559; // 0x10302df - field public static final int Theme_Material_DayNight_NoActionBar_Overscan = 16974560; // 0x10302e0 - field public static final int Theme_Material_DayNight_NoActionBar_TranslucentDecor = 16974561; // 0x10302e1 - field public static final int Theme_Material_DayNight_Panel = 16974562; // 0x10302e2 field public static final int Theme_Material_Dialog = 16974373; // 0x1030225 field public static final int Theme_Material_DialogWhenLarge = 16974379; // 0x103022b field public static final int Theme_Material_DialogWhenLarge_NoActionBar = 16974380; // 0x103022c @@ -2141,7 +2125,6 @@ package android { field public static final int Theme_Material_Light_DarkActionBar = 16974392; // 0x1030238 field public static final int Theme_Material_Light_Dialog = 16974393; // 0x1030239 field public static final int Theme_Material_Light_DialogWhenLarge = 16974399; // 0x103023f - field public static final int Theme_Material_Light_DialogWhenLarge_DarkActionBar = 16974567; // 0x10302e7 field public static final int Theme_Material_Light_DialogWhenLarge_NoActionBar = 16974400; // 0x1030240 field public static final int Theme_Material_Light_Dialog_Alert = 16974394; // 0x103023a field public static final int Theme_Material_Light_Dialog_MinWidth = 16974395; // 0x103023b @@ -2597,6 +2580,21 @@ package android { field public static final int Widget_Toolbar = 16974311; // 0x10301e7 field public static final int Widget_Toolbar_Button_Navigation = 16974312; // 0x10301e8 field public static final int Widget_WebView = 16973875; // 0x1030033 + field public static final int __reserved10 = 16974550; // 0x10302d6 + field public static final int __reserved11 = 16974551; // 0x10302d7 + field public static final int __reserved12 = 16974552; // 0x10302d8 + field public static final int __reserved13 = 16974553; // 0x10302d9 + field public static final int __reserved14 = 16974554; // 0x10302da + field public static final int __reserved15 = 16974555; // 0x10302db + field public static final int __reserved16 = 16974556; // 0x10302dc + field public static final int __reserved17 = 16974557; // 0x10302dd + field public static final int __reserved18 = 16974558; // 0x10302de + field public static final int __reserved19 = 16974559; // 0x10302df + field public static final int __reserved20 = 16974560; // 0x10302e0 + field public static final int __reserved21 = 16974561; // 0x10302e1 + field public static final int __reserved22 = 16974562; // 0x10302e2 + field public static final int __reserved8 = 16974548; // 0x10302d4 + field public static final int __reserved9 = 16974549; // 0x10302d5 } public static final class R.transition { @@ -5852,7 +5850,6 @@ package android.app.admin { field public static final java.lang.String EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED = "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED"; field public static final java.lang.String EXTRA_PROVISIONING_LOCALE = "android.app.extra.PROVISIONING_LOCALE"; field public static final java.lang.String EXTRA_PROVISIONING_LOCAL_TIME = "android.app.extra.PROVISIONING_LOCAL_TIME"; - field public static final java.lang.String EXTRA_PROVISIONING_RESET_PROTECTION_PARAMETERS = "android.app.extra.PROVISIONING_RESET_PROTECTION_PARAMETERS"; field public static final java.lang.String EXTRA_PROVISIONING_SKIP_ENCRYPTION = "android.app.extra.PROVISIONING_SKIP_ENCRYPTION"; field public static final java.lang.String EXTRA_PROVISIONING_TIME_ZONE = "android.app.extra.PROVISIONING_TIME_ZONE"; field public static final java.lang.String EXTRA_PROVISIONING_WIFI_HIDDEN = "android.app.extra.PROVISIONING_WIFI_HIDDEN"; @@ -15866,6 +15863,10 @@ package android.media { ctor public MediaDrmException(java.lang.String); } + public class MediaDrmResetException extends java.lang.IllegalStateException { + ctor public MediaDrmResetException(java.lang.String); + } + public final class MediaExtractor { ctor public MediaExtractor(); method public boolean advance(); @@ -27923,8 +27924,6 @@ package android.renderscript { public static final class ScriptGroup.Binding { ctor public ScriptGroup.Binding(android.renderscript.Script.FieldID, java.lang.Object); - method public android.renderscript.Script.FieldID getField(); - method public java.lang.Object getValue(); } public static final deprecated class ScriptGroup.Builder { @@ -28075,18 +28074,6 @@ package android.renderscript { field public static final int UPPER = 121; // 0x79 } - public static abstract class ScriptIntrinsicBLAS.Diag implements java.lang.annotation.Annotation { - } - - public static abstract class ScriptIntrinsicBLAS.Side implements java.lang.annotation.Annotation { - } - - public static abstract class ScriptIntrinsicBLAS.Transpose implements java.lang.annotation.Annotation { - } - - public static abstract class ScriptIntrinsicBLAS.Uplo implements java.lang.annotation.Annotation { - } - public class ScriptIntrinsicBlend extends android.renderscript.ScriptIntrinsic { method public static android.renderscript.ScriptIntrinsicBlend create(android.renderscript.RenderScript, android.renderscript.Element); method public void forEachAdd(android.renderscript.Allocation, android.renderscript.Allocation); @@ -30625,9 +30612,11 @@ package android.telephony { 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_CARRIER_VVM_PACKAGE_NAME_STRING = "carrier_vvm_package_name_string"; field public static final java.lang.String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool"; field public static final java.lang.String KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY = "cdma_nonroaming_networks_string_array"; field public static final java.lang.String KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY = "cdma_roaming_networks_string_array"; + field public static final java.lang.String KEY_CSP_ENABLED_BOOL = "csp_enabled_bool"; field public static final java.lang.String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string"; 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"; @@ -30682,6 +30671,9 @@ package android.telephony { 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_UI_BOOL = "voice_privacy_disable_ui_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_VVM_DESTINATION_NUMBER_STRING = "vvm_destination_number_string"; + field public static final java.lang.String KEY_VVM_PORT_NUMBER_INT = "vvm_port_number_int"; + field public static final java.lang.String KEY_VVM_TYPE_STRING = "vvm_type_string"; field public static final java.lang.String KEY_WORLD_PHONE_BOOL = "world_phone_bool"; } @@ -31245,6 +31237,8 @@ package android.telephony { field public static final int SIM_STATE_PUK_REQUIRED = 3; // 0x3 field public static final int SIM_STATE_READY = 5; // 0x5 field public static final int SIM_STATE_UNKNOWN = 0; // 0x0 + field public static final java.lang.String VVM_TYPE_CVVM = "vvm_type_cvvm"; + field public static final java.lang.String VVM_TYPE_OMTP = "vvm_type_omtp"; } } @@ -34574,6 +34568,7 @@ package android.view { method public abstract void invalidate(); method public void invalidateContentRect(); method public boolean isTitleOptional(); + method public void onWindowFocusChanged(boolean); method public abstract void setCustomView(android.view.View); method public abstract void setSubtitle(java.lang.CharSequence); method public abstract void setSubtitle(int); @@ -36818,6 +36813,8 @@ package android.view { method public boolean onRequestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); method public boolean onStartNestedScroll(android.view.View, android.view.View, int); method public void onStopNestedScroll(android.view.View); + method public void onViewAdded(android.view.View); + method public void onViewRemoved(android.view.View); method public void recomputeViewAttributes(android.view.View); method public void removeAllViews(); method public void removeAllViewsInLayout(); diff --git a/api/system-current.txt b/api/system-current.txt index 67d3635ab6de..9cfdf5fcc738 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -96,6 +96,7 @@ package android { field public static final java.lang.String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES"; field public static final java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS"; field public static final java.lang.String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS"; + field public static final java.lang.String GET_PACKAGE_IMPORTANCE = "android.permission.GET_PACKAGE_IMPORTANCE"; field public static final java.lang.String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE"; field public static final deprecated java.lang.String GET_TASKS = "android.permission.GET_TASKS"; field public static final java.lang.String GET_TOP_ACTIVITY_INFO = "android.permission.GET_TOP_ACTIVITY_INFO"; @@ -2194,22 +2195,6 @@ package android { field public static final int Theme_Light_Panel = 16973914; // 0x103005a field public static final int Theme_Light_WallpaperSettings = 16973922; // 0x1030062 field public static final int Theme_Material = 16974372; // 0x1030224 - field public static final int Theme_Material_DayNight = 16974548; // 0x10302d4 - field public static final int Theme_Material_DayNight_DarkActionBar = 16974549; // 0x10302d5 - field public static final int Theme_Material_DayNight_Dialog = 16974550; // 0x10302d6 - field public static final int Theme_Material_DayNight_DialogWhenLarge = 16974556; // 0x10302dc - field public static final int Theme_Material_DayNight_DialogWhenLarge_DarkActionBar = 16974568; // 0x10302e8 - field public static final int Theme_Material_DayNight_DialogWhenLarge_NoActionBar = 16974557; // 0x10302dd - field public static final int Theme_Material_DayNight_Dialog_Alert = 16974551; // 0x10302d7 - field public static final int Theme_Material_DayNight_Dialog_MinWidth = 16974552; // 0x10302d8 - field public static final int Theme_Material_DayNight_Dialog_NoActionBar = 16974553; // 0x10302d9 - field public static final int Theme_Material_DayNight_Dialog_NoActionBar_MinWidth = 16974554; // 0x10302da - field public static final int Theme_Material_DayNight_Dialog_Presentation = 16974555; // 0x10302db - field public static final int Theme_Material_DayNight_NoActionBar = 16974558; // 0x10302de - field public static final int Theme_Material_DayNight_NoActionBar_Fullscreen = 16974559; // 0x10302df - field public static final int Theme_Material_DayNight_NoActionBar_Overscan = 16974560; // 0x10302e0 - field public static final int Theme_Material_DayNight_NoActionBar_TranslucentDecor = 16974561; // 0x10302e1 - field public static final int Theme_Material_DayNight_Panel = 16974562; // 0x10302e2 field public static final int Theme_Material_Dialog = 16974373; // 0x1030225 field public static final int Theme_Material_DialogWhenLarge = 16974379; // 0x103022b field public static final int Theme_Material_DialogWhenLarge_NoActionBar = 16974380; // 0x103022c @@ -2223,7 +2208,6 @@ package android { field public static final int Theme_Material_Light_DarkActionBar = 16974392; // 0x1030238 field public static final int Theme_Material_Light_Dialog = 16974393; // 0x1030239 field public static final int Theme_Material_Light_DialogWhenLarge = 16974399; // 0x103023f - field public static final int Theme_Material_Light_DialogWhenLarge_DarkActionBar = 16974567; // 0x10302e7 field public static final int Theme_Material_Light_DialogWhenLarge_NoActionBar = 16974400; // 0x1030240 field public static final int Theme_Material_Light_Dialog_Alert = 16974394; // 0x103023a field public static final int Theme_Material_Light_Dialog_MinWidth = 16974395; // 0x103023b @@ -2679,6 +2663,21 @@ package android { field public static final int Widget_Toolbar = 16974311; // 0x10301e7 field public static final int Widget_Toolbar_Button_Navigation = 16974312; // 0x10301e8 field public static final int Widget_WebView = 16973875; // 0x1030033 + field public static final int __reserved10 = 16974550; // 0x10302d6 + field public static final int __reserved11 = 16974551; // 0x10302d7 + field public static final int __reserved12 = 16974552; // 0x10302d8 + field public static final int __reserved13 = 16974553; // 0x10302d9 + field public static final int __reserved14 = 16974554; // 0x10302da + field public static final int __reserved15 = 16974555; // 0x10302db + field public static final int __reserved16 = 16974556; // 0x10302dc + field public static final int __reserved17 = 16974557; // 0x10302dd + field public static final int __reserved18 = 16974558; // 0x10302de + field public static final int __reserved19 = 16974559; // 0x10302df + field public static final int __reserved20 = 16974560; // 0x10302e0 + field public static final int __reserved21 = 16974561; // 0x10302e1 + field public static final int __reserved22 = 16974562; // 0x10302e2 + field public static final int __reserved8 = 16974548; // 0x10302d4 + field public static final int __reserved9 = 16974549; // 0x10302d5 } public static final class R.transition { @@ -5969,7 +5968,6 @@ package android.app.admin { field public static final java.lang.String EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED = "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED"; field public static final java.lang.String EXTRA_PROVISIONING_LOCALE = "android.app.extra.PROVISIONING_LOCALE"; field public static final java.lang.String EXTRA_PROVISIONING_LOCAL_TIME = "android.app.extra.PROVISIONING_LOCAL_TIME"; - field public static final java.lang.String EXTRA_PROVISIONING_RESET_PROTECTION_PARAMETERS = "android.app.extra.PROVISIONING_RESET_PROTECTION_PARAMETERS"; field public static final java.lang.String EXTRA_PROVISIONING_SKIP_ENCRYPTION = "android.app.extra.PROVISIONING_SKIP_ENCRYPTION"; field public static final java.lang.String EXTRA_PROVISIONING_TIME_ZONE = "android.app.extra.PROVISIONING_TIME_ZONE"; field public static final java.lang.String EXTRA_PROVISIONING_WIFI_HIDDEN = "android.app.extra.PROVISIONING_WIFI_HIDDEN"; @@ -17120,6 +17118,10 @@ package android.media { ctor public MediaDrmException(java.lang.String); } + public class MediaDrmResetException extends java.lang.IllegalStateException { + ctor public MediaDrmResetException(java.lang.String); + } + public final class MediaExtractor { ctor public MediaExtractor(); method public boolean advance(); @@ -29970,8 +29972,6 @@ package android.renderscript { public static final class ScriptGroup.Binding { ctor public ScriptGroup.Binding(android.renderscript.Script.FieldID, java.lang.Object); - method public android.renderscript.Script.FieldID getField(); - method public java.lang.Object getValue(); } public static final deprecated class ScriptGroup.Builder { @@ -30122,18 +30122,6 @@ package android.renderscript { field public static final int UPPER = 121; // 0x79 } - public static abstract class ScriptIntrinsicBLAS.Diag implements java.lang.annotation.Annotation { - } - - public static abstract class ScriptIntrinsicBLAS.Side implements java.lang.annotation.Annotation { - } - - public static abstract class ScriptIntrinsicBLAS.Transpose implements java.lang.annotation.Annotation { - } - - public static abstract class ScriptIntrinsicBLAS.Uplo implements java.lang.annotation.Annotation { - } - public class ScriptIntrinsicBlend extends android.renderscript.ScriptIntrinsic { method public static android.renderscript.ScriptIntrinsicBlend create(android.renderscript.RenderScript, android.renderscript.Element); method public void forEachAdd(android.renderscript.Allocation, android.renderscript.Allocation); @@ -30918,7 +30906,6 @@ package android.service.persistentdata { method public abstract byte[] read() throws android.os.RemoteException; method public abstract void setOemUnlockEnabled(boolean) throws android.os.RemoteException; method public abstract void wipe() throws android.os.RemoteException; - method public abstract void wipeIfAllowed(android.os.Bundle, android.app.PendingIntent) throws android.os.RemoteException; method public abstract int write(byte[]) throws android.os.RemoteException; } @@ -30930,14 +30917,7 @@ package android.service.persistentdata { method public byte[] read(); method public void setOemUnlockEnabled(boolean); method public void wipe(); - method public void wipeIfAllowed(android.os.Bundle, android.app.PendingIntent); method public int write(byte[]); - field public static final java.lang.String ACTION_WIPE_IF_ALLOWED = "android.service.persistentdata.action.WIPE_IF_ALLOWED"; - field public static final java.lang.String EXTRA_WIPE_IF_ALLOWED_CALLBACK = "android.service.persistentdata.extra.WIPE_IF_ALLOWED_CALLBACK"; - field public static final int STATUS_ERROR_NETWORK_ERROR = 2; // 0x2 - field public static final int STATUS_ERROR_NOT_COMPLIANT = 3; // 0x3 - field public static final int STATUS_ERROR_REMOTE_EXCEPTION = 1; // 0x1 - field public static final int STATUS_SUCCESS = 0; // 0x0 } } @@ -32855,9 +32835,11 @@ package android.telephony { 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_CARRIER_VVM_PACKAGE_NAME_STRING = "carrier_vvm_package_name_string"; field public static final java.lang.String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool"; field public static final java.lang.String KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY = "cdma_nonroaming_networks_string_array"; field public static final java.lang.String KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY = "cdma_roaming_networks_string_array"; + field public static final java.lang.String KEY_CSP_ENABLED_BOOL = "csp_enabled_bool"; field public static final java.lang.String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string"; 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"; @@ -32912,6 +32894,9 @@ package android.telephony { 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_UI_BOOL = "voice_privacy_disable_ui_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_VVM_DESTINATION_NUMBER_STRING = "vvm_destination_number_string"; + field public static final java.lang.String KEY_VVM_PORT_NUMBER_INT = "vvm_port_number_int"; + field public static final java.lang.String KEY_VVM_TYPE_STRING = "vvm_type_string"; field public static final java.lang.String KEY_WORLD_PHONE_BOOL = "world_phone_bool"; } @@ -33524,6 +33509,8 @@ package android.telephony { field public static final int SIM_STATE_PUK_REQUIRED = 3; // 0x3 field public static final int SIM_STATE_READY = 5; // 0x5 field public static final int SIM_STATE_UNKNOWN = 0; // 0x0 + field public static final java.lang.String VVM_TYPE_CVVM = "vvm_type_cvvm"; + field public static final java.lang.String VVM_TYPE_OMTP = "vvm_type_omtp"; } } @@ -36862,6 +36849,7 @@ package android.view { method public abstract void invalidate(); method public void invalidateContentRect(); method public boolean isTitleOptional(); + method public void onWindowFocusChanged(boolean); method public abstract void setCustomView(android.view.View); method public abstract void setSubtitle(java.lang.CharSequence); method public abstract void setSubtitle(int); @@ -39106,6 +39094,8 @@ package android.view { method public boolean onRequestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent); method public boolean onStartNestedScroll(android.view.View, android.view.View, int); method public void onStopNestedScroll(android.view.View); + method public void onViewAdded(android.view.View); + method public void onViewRemoved(android.view.View); method public void recomputeViewAttributes(android.view.View); method public void removeAllViews(); method public void removeAllViewsInLayout(); diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index 146138007138..e17808744408 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -35,6 +35,9 @@ import android.os.RemoteException; import android.os.IBinder; import android.os.Parcel; import android.os.ParcelFileDescriptor; +import android.os.TransactionTooLargeException; +import android.util.Log; + import com.android.internal.app.IVoiceInteractor; import com.android.internal.content.ReferrerIntent; @@ -921,8 +924,13 @@ class ApplicationThreadProxy implements IApplicationThread { info.writeToParcel(data, 0); compatInfo.writeToParcel(data, 0); data.writeInt(processState); - mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null, - IBinder.FLAG_ONEWAY); + try { + mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null, + IBinder.FLAG_ONEWAY); + } catch (TransactionTooLargeException e) { + Log.e("CREATE_SERVICE", "Binder failure starting service; service=" + info); + throw e; + } data.recycle(); } diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 33a47b24b79d..5a0d246afc64 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -1371,6 +1371,9 @@ public class Notification implements Parcelable when = parcel.readLong(); if (parcel.readInt() != 0) { mSmallIcon = Icon.CREATOR.createFromParcel(parcel); + if (mSmallIcon.getType() == Icon.TYPE_RESOURCE) { + icon = mSmallIcon.getResId(); + } } number = parcel.readInt(); if (parcel.readInt() != 0) { @@ -1588,13 +1591,17 @@ public class Notification implements Parcelable } /** - * Flatten this notification from a parcel. + * Flatten this notification into a parcel. */ public void writeToParcel(Parcel parcel, int flags) { parcel.writeInt(1); parcel.writeLong(when); + if (mSmallIcon == null && icon != 0) { + // you snuck an icon in here without using the builder; let's try to keep it + mSmallIcon = Icon.createWithResource("", icon); + } if (mSmallIcon != null) { parcel.writeInt(1); mSmallIcon.writeToParcel(parcel, 0); @@ -2791,7 +2798,10 @@ public class Notification implements Parcelable return this; } - private void setFlag(int mask, boolean value) { + /** + * @hide + */ + public void setFlag(int mask, boolean value) { if (value) { mFlags |= mask; } else { diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index 0904e216d081..605c00613087 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -25,6 +25,7 @@ import android.content.Context; import android.content.pm.ParceledListSlice; import android.graphics.drawable.Icon; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; @@ -216,6 +217,12 @@ public class NotificationManager } } fixLegacySmallIcon(notification, pkg); + if (mContext.getApplicationInfo().targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1) { + if (notification.getSmallIcon() == null) { + throw new IllegalArgumentException("Invalid notification (no valid small icon): " + + notification); + } + } if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")"); Notification stripped = notification.clone(); Builder.stripForDelivery(stripped); diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index ed2008611b6a..b9862ca1d926 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -552,19 +552,6 @@ public class DevicePolicyManager { = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_SIGNATURE_CHECKSUM"; /** - * A {@link android.os.Parcelable} extra of type {@link android.os.PersistableBundle} that - * holds data needed by the system to wipe factory reset protection. The data needed to wipe - * the device depend on the installed factory reset protection implementation. For example, - * if an account is needed to unlock a device, this extra may contain data used to - * authenticate that account. - * - * <p>Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts device owner - * provisioning via an NFC bump. - */ - public static final String EXTRA_PROVISIONING_RESET_PROTECTION_PARAMETERS - = "android.app.extra.PROVISIONING_RESET_PROTECTION_PARAMETERS"; - - /** * This MIME type is used for starting the Device Owner provisioning that does not require * provisioning features introduced in Android API level * {@link android.os.Build.VERSION_CODES#MNC} or later levels. diff --git a/core/java/android/app/usage/UsageStatsManagerInternal.java b/core/java/android/app/usage/UsageStatsManagerInternal.java index 7bcc0385c13a..8a31390dbf26 100644 --- a/core/java/android/app/usage/UsageStatsManagerInternal.java +++ b/core/java/android/app/usage/UsageStatsManagerInternal.java @@ -54,6 +54,14 @@ public abstract class UsageStatsManagerInternal { public abstract void reportConfigurationChange(Configuration config, int userId); /** + * Reports that a content provider has been accessed by a foreground app. + * @param name The authority of the content provider + * @param pkgName The package name of the content provider + * @param userId The user in which the content provider was accessed. + */ + public abstract void reportContentProviderUsage(String name, String pkgName, int userId); + + /** * Prepares the UsageStatsService for shutdown. */ public abstract void prepareShutdown(); diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index 057001ca3ff3..d37dda049b6c 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -48,6 +48,7 @@ import android.util.Log; import dalvik.system.CloseGuard; +import com.android.internal.util.ArrayUtils; import com.android.internal.util.Preconditions; import java.io.File; @@ -57,6 +58,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Random; @@ -1936,6 +1938,19 @@ public abstract class ContentResolver { } /** + * @hide + * Returns the package names of syncadapters that match a given user and authority. + */ + public static String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, + int userId) { + try { + return getContentService().getSyncAdapterPackagesForAuthorityAsUser(authority, userId); + } catch (RemoteException e) { + } + return ArrayUtils.emptyArray(String.class); + } + + /** * Check if the provider should be synced when a network tickle is received * <p>This method requires the caller to hold the permission * {@link android.Manifest.permission#READ_SYNC_SETTINGS}. diff --git a/core/java/android/content/IContentService.aidl b/core/java/android/content/IContentService.aidl index 9998f08ff54c..8b471a04f25b 100644 --- a/core/java/android/content/IContentService.aidl +++ b/core/java/android/content/IContentService.aidl @@ -143,6 +143,8 @@ interface IContentService { SyncAdapterType[] getSyncAdapterTypes(); SyncAdapterType[] getSyncAdapterTypesAsUser(int userId); + String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int userId); + /** * Returns true if there is currently a operation for the given account/authority or service * actively being processed. diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java index 08c52365c750..d83dfc5eb54f 100644 --- a/core/java/android/content/IntentFilter.java +++ b/core/java/android/content/IntentFilter.java @@ -1480,7 +1480,11 @@ public class IntentFilter implements Parcelable { * Write the contents of the IntentFilter as an XML stream. */ public void writeToXml(XmlSerializer serializer) throws IOException { - serializer.attribute(null, AUTO_VERIFY_STR, Boolean.toString(getAutoVerify())); + + if (getAutoVerify()) { + serializer.attribute(null, AUTO_VERIFY_STR, Boolean.toString(true)); + } + int N = countActions(); for (int i=0; i<N; i++) { serializer.startTag(null, ACTION_STR); diff --git a/core/java/android/content/SyncAdaptersCache.java b/core/java/android/content/SyncAdaptersCache.java index 8bb3ee7f178b..6704b75dff7f 100644 --- a/core/java/android/content/SyncAdaptersCache.java +++ b/core/java/android/content/SyncAdaptersCache.java @@ -20,12 +20,19 @@ import android.content.pm.RegisteredServicesCache; import android.content.pm.XmlSerializerAndParser; import android.content.res.Resources; import android.content.res.TypedArray; +import android.util.ArrayMap; import android.util.AttributeSet; +import android.util.SparseArray; + +import com.android.internal.annotations.GuardedBy; + import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; /** * A cache of services that export the {@link android.content.ISyncAdapter} interface. @@ -39,6 +46,10 @@ public class SyncAdaptersCache extends RegisteredServicesCache<SyncAdapterType> private static final String ATTRIBUTES_NAME = "sync-adapter"; private static final MySerializer sSerializer = new MySerializer(); + @GuardedBy("mServicesLock") + private SparseArray<ArrayMap<String,String[]>> mAuthorityToSyncAdapters + = new SparseArray<>(); + public SyncAdaptersCache(Context context) { super(context, SERVICE_INTERFACE, SERVICE_META_DATA, ATTRIBUTES_NAME, sSerializer); } @@ -76,6 +87,57 @@ public class SyncAdaptersCache extends RegisteredServicesCache<SyncAdapterType> } } + @Override + protected void onServicesChangedLocked(int userId) { + synchronized (mServicesLock) { + ArrayMap<String,String[]> adapterMap = mAuthorityToSyncAdapters.get(userId); + if (adapterMap != null) { + adapterMap.clear(); + } + } + + super.onServicesChangedLocked(userId); + } + + public String[] getSyncAdapterPackagesForAuthority(String authority, int userId) { + synchronized (mServicesLock) { + ArrayMap<String,String[]> adapterMap = mAuthorityToSyncAdapters.get(userId); + if (adapterMap == null) { + adapterMap = new ArrayMap<>(); + mAuthorityToSyncAdapters.put(userId, adapterMap); + } + // If the mapping exists, return it + if (adapterMap.containsKey(authority)) { + return adapterMap.get(authority); + } + // Create the mapping and cache it + String[] syncAdapterPackages; + final Collection<RegisteredServicesCache.ServiceInfo<SyncAdapterType>> serviceInfos; + serviceInfos = getAllServices(userId); + ArrayList<String> packages = new ArrayList<>(); + for (RegisteredServicesCache.ServiceInfo<SyncAdapterType> serviceInfo : serviceInfos) { + if (authority.equals(serviceInfo.type.authority) + && serviceInfo.componentName != null) { + packages.add(serviceInfo.componentName.getPackageName()); + } + } + syncAdapterPackages = new String[packages.size()]; + packages.toArray(syncAdapterPackages); + adapterMap.put(authority, syncAdapterPackages); + + return syncAdapterPackages; + } + } + + @Override + protected void onUserRemoved(int userId) { + synchronized (mServicesLock) { + mAuthorityToSyncAdapters.remove(userId); + } + + super.onUserRemoved(userId); + } + static class MySerializer implements XmlSerializerAndParser<SyncAdapterType> { public void writeAsXml(SyncAdapterType item, XmlSerializer out) throws IOException { out.attribute(null, "authority", item.authority); diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index bd50ca03b5ae..dd1c5c2ab58f 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -2900,7 +2900,7 @@ public abstract class PackageManager { * * @return A List<ResolveInfo> containing one entry for each matching * Receiver. These are ordered from first to last in priority. If - * there are no matching receivers, an empty list is returned. + * there are no matching receivers, an empty list or {@code null} is returned. * * @see #MATCH_DEFAULT_ONLY * @see #GET_INTENT_FILTERS @@ -2936,7 +2936,7 @@ public abstract class PackageManager { * ServiceInfo. These are ordered from best to worst match -- that * is, the first item in the list is what is returned by * resolveService(). If there are no matching services, an empty - * list is returned. + * list or {@code null} is returned. * * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER @@ -2955,7 +2955,7 @@ public abstract class PackageManager { * ServiceInfo. These are ordered from best to worst match -- that * is, the first item in the list is what is returned by * resolveService(). If there are no matching services, an empty - * list is returned. + * list or {@code null} is returned. * * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER @@ -2977,7 +2977,7 @@ public abstract class PackageManager { * @param flags Additional option flags. * @return A List<ResolveInfo> containing one entry for each matching * ProviderInfo. These are ordered from best to worst match. If - * there are no matching providers, an empty list is returned. + * there are no matching providers, an empty list or {@code null} is returned. * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER */ diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java index 0bd2a3b84f06..b293e2a83400 100644 --- a/core/java/android/content/pm/RegisteredServicesCache.java +++ b/core/java/android/content/pm/RegisteredServicesCache.java @@ -84,7 +84,7 @@ public abstract class RegisteredServicesCache<V> { private final String mAttributesName; private final XmlSerializerAndParser<V> mSerializerAndParser; - private final Object mServicesLock = new Object(); + protected final Object mServicesLock = new Object(); @GuardedBy("mServicesLock") private final SparseArray<UserServices<V>> mUserServices = new SparseArray<UserServices<V>>(2); @@ -232,6 +232,7 @@ public abstract class RegisteredServicesCache<V> { synchronized (mServicesLock) { final UserServices<V> user = findOrCreateUserLocked(userId); user.services = null; + onServicesChangedLocked(userId); } } @@ -489,11 +490,16 @@ public abstract class RegisteredServicesCache<V> { } } if (changed) { + onServicesChangedLocked(userId); writePersistentServicesLocked(user, userId); } } } + protected void onServicesChangedLocked(int userId) { + // Feel free to override + } + /** * Returns true if the list of changed uids is null (wildcard) or the specified uid * is contained in the list of changed uids. @@ -687,7 +693,9 @@ public abstract class RegisteredServicesCache<V> { @VisibleForTesting protected void onUserRemoved(int userId) { - mUserServices.remove(userId); + synchronized (mServicesLock) { + mUserServices.remove(userId); + } } @VisibleForTesting diff --git a/core/java/android/content/pm/ResolveInfo.java b/core/java/android/content/pm/ResolveInfo.java index 649fdb46367e..7bab35ce7e8e 100644 --- a/core/java/android/content/pm/ResolveInfo.java +++ b/core/java/android/content/pm/ResolveInfo.java @@ -45,7 +45,7 @@ public class ResolveInfo implements Parcelable { * {@link #providerInfo} will be non-null. */ public ActivityInfo activityInfo; - + /** * The service that corresponds to this resolution match, if this resolution * is for a service. Exactly one of {@link #activityInfo}, @@ -64,21 +64,21 @@ public class ResolveInfo implements Parcelable { * The IntentFilter that was matched for this ResolveInfo. */ public IntentFilter filter; - + /** * The declared priority of this match. Comes from the "priority" * attribute or, if not set, defaults to 0. Higher values are a higher * priority. */ public int priority; - + /** * Order of result according to the user's preference. If the user * has not set a preference for this result, the value is 0; higher * values are a higher priority. */ public int preferredOrder; - + /** * The system's evaluation of how well the activity matches the * IntentFilter. This is a match constant, a combination of @@ -86,7 +86,7 @@ public class ResolveInfo implements Parcelable { * and {@link IntentFilter#MATCH_ADJUSTMENT_MASK IntentFiler.MATCH_ADJUSTMENT_MASK}. */ public int match; - + /** * Only set when returned by * {@link PackageManager#queryIntentActivityOptions}, this tells you @@ -94,29 +94,30 @@ public class ResolveInfo implements Parcelable { * first in the list, < 0 means it came from the generic Intent query. */ public int specificIndex = -1; - + /** * This filter has specified the Intent.CATEGORY_DEFAULT, meaning it * would like to be considered a default action that the user can * perform on this data. */ public boolean isDefault; - + /** * A string resource identifier (in the package's resources) of this * match's label. From the "label" attribute or, if not set, 0. */ public int labelRes; - + /** * The actual string retrieve from <var>labelRes</var> or null if none * was provided. */ public CharSequence nonLocalizedLabel; - + /** * A drawable resource identifier (in the package's resources) of this - * match's icon. From the "icon" attribute or, if not set, 0. + * match's icon. From the "icon" attribute or, if not set, 0. It is + * set only if the icon can be obtained by resource id alone. */ public int icon; @@ -134,11 +135,21 @@ public class ResolveInfo implements Parcelable { public int targetUserId; /** + * Set to true if the icon cannot be obtained by resource ids alone. + * It is set to true for ResolveInfos from the managed profile: They need to + * have their icon badged, so it cannot be obtained by resource ids alone. * @hide */ public boolean noResourceId; /** + * Same as {@link #icon} but it will always correspond to "icon" attribute + * regardless of {@link #noResourceId} value. + * @hide + */ + public int iconResourceId; + + /** * @hide Target comes from system process? */ public boolean system; @@ -159,10 +170,10 @@ public class ResolveInfo implements Parcelable { * Retrieve the current textual label associated with this resolution. This * will call back on the given PackageManager to load the label from * the application. - * + * * @param pm A PackageManager from which the label can be loaded; usually * the PackageManager from which you originally retrieved this item. - * + * * @return Returns a CharSequence containing the resolutions's label. If the * item does not have a label, its name is returned. */ @@ -191,33 +202,30 @@ public class ResolveInfo implements Parcelable { if (data != null) data = data.toString().trim(); return data; } - + /** * Retrieve the current graphical icon associated with this resolution. This * will call back on the given PackageManager to load the icon from * the application. - * + * * @param pm A PackageManager from which the icon can be loaded; usually * the PackageManager from which you originally retrieved this item. - * + * * @return Returns a Drawable containing the resolution's icon. If the * item does not have an icon, the default activity icon is returned. */ public Drawable loadIcon(PackageManager pm) { - Drawable dr; - if (resolvePackageName != null && icon != 0) { - dr = pm.getDrawable(resolvePackageName, icon, null); - if (dr != null) { - return dr; - } + Drawable dr = null; + if (resolvePackageName != null && iconResourceId != 0) { + dr = pm.getDrawable(resolvePackageName, iconResourceId, null); } ComponentInfo ci = getComponentInfo(); - ApplicationInfo ai = ci.applicationInfo; - if (icon != 0) { - dr = pm.getDrawable(ci.packageName, icon, ai); - if (dr != null) { - return dr; - } + if (dr == null && iconResourceId != 0) { + ApplicationInfo ai = ci.applicationInfo; + dr = pm.getDrawable(ci.packageName, iconResourceId, ai); + } + if (dr != null) { + return pm.getUserBadgedIcon(dr, new UserHandle(UserHandle.myUserId())); } return ci.loadIcon(pm); } @@ -231,7 +239,7 @@ public class ResolveInfo implements Parcelable { * @return The icon associated with this match. */ final int getIconResourceInternal() { - if (icon != 0) return icon; + if (iconResourceId != 0) return iconResourceId; final ComponentInfo ci = getComponentInfo(); if (ci != null) { return ci.getIconResource(); @@ -298,6 +306,8 @@ public class ResolveInfo implements Parcelable { nonLocalizedLabel = orig.nonLocalizedLabel; icon = orig.icon; resolvePackageName = orig.resolvePackageName; + noResourceId = orig.noResourceId; + iconResourceId = orig.iconResourceId; system = orig.system; targetUserId = orig.targetUserId; handleAllWebDataURI = orig.handleAllWebDataURI; @@ -362,6 +372,7 @@ public class ResolveInfo implements Parcelable { dest.writeInt(targetUserId); dest.writeInt(system ? 1 : 0); dest.writeInt(noResourceId ? 1 : 0); + dest.writeInt(iconResourceId); dest.writeInt(handleAllWebDataURI ? 1 : 0); } @@ -408,9 +419,10 @@ public class ResolveInfo implements Parcelable { targetUserId = source.readInt(); system = source.readInt() != 0; noResourceId = source.readInt() != 0; + iconResourceId = source.readInt(); handleAllWebDataURI = source.readInt() != 0; } - + public static class DisplayNameComparator implements Comparator<ResolveInfo> { public DisplayNameComparator(PackageManager pm) { diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java index f8db6d9e3010..c656fb8b8352 100644 --- a/core/java/android/hardware/camera2/CameraMetadata.java +++ b/core/java/android/hardware/camera2/CameraMetadata.java @@ -667,7 +667,7 @@ public abstract class CameraMetadata<TKey> { * {@link android.hardware.camera2.params.StreamConfigurationMap#getHighSpeedVideoSizes }. * The fps range can be controlled via {@link CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE android.control.aeTargetFpsRange}.</p> * <p>In this capability, the camera device will override aeMode, awbMode, and afMode to - * ON, ON, and CONTINUOUS_VIDEO, respectively. All post-processing block mode + * ON, AUTO, and CONTINUOUS_VIDEO, respectively. All post-processing block mode * controls will be overridden to be FAST. Therefore, no manual control of capture * and post-processing parameters is possible. All other controls operate the * same as when {@link CaptureRequest#CONTROL_MODE android.control.mode} == AUTO. This means that all other @@ -1666,9 +1666,9 @@ public abstract class CameraMetadata<TKey> { * <p>Enabling this disables control.aeMode, control.awbMode and * control.afMode controls; the camera device will ignore * those settings while USE_SCENE_MODE is active (except for - * FACE_PRIORITY scene mode). Other control entries are still - * active. This setting can only be used if scene mode is - * supported (i.e. {@link CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES android.control.availableSceneModes} + * FACE_PRIORITY scene mode). Other control entries are still active. + * This setting can only be used if scene mode is supported (i.e. + * {@link CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES android.control.availableSceneModes} * contain some modes other than DISABLED).</p> * * @see CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES @@ -1940,6 +1940,40 @@ public abstract class CameraMetadata<TKey> { */ public static final int CONTROL_SCENE_MODE_HDR = 18; + /** + * <p>Same as FACE_PRIORITY scene mode, except that the camera + * device will choose higher sensivity values ({@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}) + * under low light conditions.</p> + * <p>The camera device may be tuned to expose the images in a reduced + * sensitivity range to produce the best quality images. For example, + * if the {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange} gives range of [100, 1600], + * the camera device auto-exposure routine tuning process may limit the actual + * exposure sensivity range to [100, 1200] to ensure that the noise level isn't + * exessive to compromise the image quality. Under this situation, the image under + * low light may be under-exposed when the sensor max exposure time (bounded by the + * {@link CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE android.control.aeTargetFpsRange} when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is one of the + * ON_* modes) and effecitve max sensitivity are reached. This scene mode allows the + * camera device auto-exposure routine to increase the sensitivity up to the max + * sensitivity specified by {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange} when the scene is too + * dark and the max exposure time is reached. The captured images may be noisier + * compared with the images captured in normal FACE_PRIORITY mode, therefore, it is + * recommended that the application only use this scene mode when it is capable of + * reducing the noise level of the captured images.</p> + * <p>Unlike the other scene modes, {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}, + * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, and {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} + * remain active when FACE_PRIORITY_LOW_LIGHT is set.</p> + * + * @see CaptureRequest#CONTROL_AE_MODE + * @see CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE + * @see CaptureRequest#CONTROL_AF_MODE + * @see CaptureRequest#CONTROL_AWB_MODE + * @see CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE + * @see CaptureRequest#SENSOR_SENSITIVITY + * @see CaptureRequest#CONTROL_SCENE_MODE + * @hide + */ + public static final int CONTROL_SCENE_MODE_FACE_PRIORITY_LOW_LIGHT = 19; + // // Enumeration values for CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE // diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index bc625dd31168..9fa66879629d 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -1448,9 +1448,9 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> * <p>Scene modes are custom camera modes optimized for a certain set of conditions and * capture settings.</p> * <p>This is the mode that that is active when - * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code>. Aside from FACE_PRIORITY, - * these modes will disable {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}, - * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, and {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} while in use.</p> + * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code>. Aside from FACE_PRIORITY, these modes will + * disable {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}, {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, and {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} + * while in use.</p> * <p>The interpretation and implementation of these scene modes is left * to the implementor of the camera device. Their behavior will not be * consistent across all devices, and any given device may only implement diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index da216aaa4418..b1fb615821c7 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -1960,9 +1960,9 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { * <p>Scene modes are custom camera modes optimized for a certain set of conditions and * capture settings.</p> * <p>This is the mode that that is active when - * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code>. Aside from FACE_PRIORITY, - * these modes will disable {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}, - * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, and {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} while in use.</p> + * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code>. Aside from FACE_PRIORITY, these modes will + * disable {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}, {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, and {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} + * while in use.</p> * <p>The interpretation and implementation of these scene modes is left * to the implementor of the camera device. Their behavior will not be * consistent across all devices, and any given device may only implement diff --git a/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java b/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java index f928a55597da..bc80fc114772 100644 --- a/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java +++ b/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java @@ -630,8 +630,6 @@ public class SurfaceTextureRenderer { holder.width = surfaceSize.getWidth(); holder.height = surfaceSize.getHeight(); if (LegacyCameraDevice.needsConversion(s)) { - // Always override to YV12 output for YUV surface formats. - LegacyCameraDevice.setSurfaceFormat(s, ImageFormat.YV12); mConversionSurfaces.add(holder); } else { mSurfaces.add(holder); diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index d165240e2394..593f80462533 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -65,7 +65,7 @@ public abstract class BatteryStats implements Parcelable { * A constant indicating a window wake lock timer. */ public static final int WAKE_TYPE_WINDOW = 2; - + /** * A constant indicating a sensor timer. */ @@ -142,6 +142,11 @@ public abstract class BatteryStats implements Parcelable { public static final int CAMERA_TURNED_ON = 17; /** + * A constant indicating a doze wake lock timer. + */ + public static final int WAKE_TYPE_DOZE = 18; + + /** * Include all of the data in the stats, including previously saved data. */ public static final int STATS_SINCE_CHARGED = 0; @@ -1165,25 +1170,23 @@ public abstract class BatteryStats implements Parcelable { public static final int EVENT_USER_FOREGROUND = 0x0008; // Event for connectivity changed. public static final int EVENT_CONNECTIVITY_CHANGED = 0x0009; - // Event for significant motion taking us out of idle mode. - public static final int EVENT_SIGNIFICANT_MOTION = 0x000a; // Event for becoming active taking us out of idle mode. - public static final int EVENT_ACTIVE = 0x000b; + public static final int EVENT_ACTIVE = 0x000a; // Event for a package being installed. - public static final int EVENT_PACKAGE_INSTALLED = 0x000c; + public static final int EVENT_PACKAGE_INSTALLED = 0x000b; // Event for a package being uninstalled. - public static final int EVENT_PACKAGE_UNINSTALLED = 0x000d; + public static final int EVENT_PACKAGE_UNINSTALLED = 0x000c; // Event for a package being uninstalled. - public static final int EVENT_ALARM = 0x000e; + public static final int EVENT_ALARM = 0x000d; // Record that we have decided we need to collect new stats data. - public static final int EVENT_COLLECT_EXTERNAL_STATS = 0x000f; + public static final int EVENT_COLLECT_EXTERNAL_STATS = 0x000e; // Event for a package becoming inactive due to being unused for a period of time. - public static final int EVENT_PACKAGE_INACTIVE = 0x0010; + public static final int EVENT_PACKAGE_INACTIVE = 0x000f; // Event for a package becoming active due to an interaction. - public static final int EVENT_PACKAGE_ACTIVE = 0x0011; + public static final int EVENT_PACKAGE_ACTIVE = 0x0010; // Number of event types. - public static final int EVENT_COUNT = 0x0012; + public static final int EVENT_COUNT = 0x0011; // Mask to extract out only the type part of the event. public static final int EVENT_TYPE_MASK = ~(EVENT_FLAG_START|EVENT_FLAG_FINISH); @@ -1840,12 +1843,12 @@ public abstract class BatteryStats implements Parcelable { public static final String[] HISTORY_EVENT_NAMES = new String[] { "null", "proc", "fg", "top", "sync", "wake_lock_in", "job", "user", "userfg", "conn", - "motion", "active", "pkginst", "pkgunin", "alarm", "stats", "inactive", "active" + "active", "pkginst", "pkgunin", "alarm", "stats", "inactive", "active" }; public static final String[] HISTORY_EVENT_CHECKIN_NAMES = new String[] { "Enl", "Epr", "Efg", "Etp", "Esy", "Ewl", "Ejb", "Eur", "Euf", "Ecn", - "Esm", "Eac", "Epi", "Epu", "Eal", "Est", "Eai", "Eaa" + "Eac", "Epi", "Epu", "Eal", "Est", "Eai", "Eaa" }; /** @@ -3836,6 +3839,7 @@ public abstract class BatteryStats implements Parcelable { final ArrayMap<String, ? extends BatteryStats.Uid.Wakelock> wakelocks = u.getWakelockStats(); long totalFullWakelock = 0, totalPartialWakelock = 0, totalWindowWakelock = 0; + long totalDozeWakelock = 0; int countWakelock = 0; for (int iw=wakelocks.size()-1; iw>=0; iw--) { final Uid.Wakelock wl = wakelocks.valueAt(iw); @@ -3850,19 +3854,21 @@ public abstract class BatteryStats implements Parcelable { "partial", which, linePrefix); linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), rawRealtime, "window", which, linePrefix); - if (true || !linePrefix.equals(": ")) { - sb.append(" realtime"); - // Only print out wake locks that were held - pw.println(sb.toString()); - uidActivity = true; - countWakelock++; - } + linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_DOZE), rawRealtime, + "doze", which, linePrefix); + sb.append(" realtime"); + pw.println(sb.toString()); + uidActivity = true; + countWakelock++; + totalFullWakelock += computeWakeLock(wl.getWakeTime(WAKE_TYPE_FULL), rawRealtime, which); totalPartialWakelock += computeWakeLock(wl.getWakeTime(WAKE_TYPE_PARTIAL), rawRealtime, which); totalWindowWakelock += computeWakeLock(wl.getWakeTime(WAKE_TYPE_WINDOW), rawRealtime, which); + totalDozeWakelock += computeWakeLock(wl.getWakeTime(WAKE_TYPE_DOZE), + rawRealtime, which); } if (countWakelock > 1) { if (totalFullWakelock != 0 || totalPartialWakelock != 0 @@ -3892,6 +3898,14 @@ public abstract class BatteryStats implements Parcelable { formatTimeMs(sb, totalWindowWakelock); sb.append("window"); } + if (totalDozeWakelock != 0) { + if (needComma) { + sb.append(","); + } + needComma = true; + formatTimeMs(sb, totalDozeWakelock); + sb.append("doze"); + } sb.append(" realtime"); pw.println(sb.toString()); } @@ -4017,8 +4031,10 @@ public abstract class BatteryStats implements Parcelable { if (userCpuTimeUs > 0 || systemCpuTimeUs > 0) { sb.setLength(0); sb.append(prefix); - sb.append(" Total cpu time: "); - formatTimeMs(sb, (userCpuTimeUs + systemCpuTimeUs) / 1000); + sb.append(" Total cpu time: u="); + formatTimeMs(sb, userCpuTimeUs / 1000); + sb.append("s="); + formatTimeMs(sb, systemCpuTimeUs / 1000); pw.println(sb.toString()); } diff --git a/core/java/android/os/IDeviceIdleController.aidl b/core/java/android/os/IDeviceIdleController.aidl index 268295dc40c0..fe4aa13fe968 100644 --- a/core/java/android/os/IDeviceIdleController.aidl +++ b/core/java/android/os/IDeviceIdleController.aidl @@ -28,4 +28,5 @@ interface IDeviceIdleController { int[] getAppIdTempWhitelist(); boolean isPowerSaveWhitelistApp(String name); void addPowerSaveTempWhitelistApp(String name, long duration, int userId); + void exitIdle(String reason); } diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index dbb51464cb87..f9c50f320dbb 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -635,8 +635,8 @@ public class Process { if ((debugFlags & Zygote.DEBUG_ENABLE_JIT) != 0) { argsForZygote.add("--enable-jit"); } - if ((debugFlags & Zygote.DEBUG_GENERATE_CFI) != 0) { - argsForZygote.add("--generate-cfi"); + if ((debugFlags & Zygote.DEBUG_GENERATE_DEBUG_INFO) != 0) { + argsForZygote.add("--generate-debug-info"); } if ((debugFlags & Zygote.DEBUG_ENABLE_ASSERT) != 0) { argsForZygote.add("--enable-assert"); diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java index 7d57233b3149..23555d6d998d 100644 --- a/core/java/android/provider/CallLog.java +++ b/core/java/android/provider/CallLog.java @@ -518,11 +518,6 @@ public class CallLog { if (callType == MISSED_TYPE) { values.put(IS_READ, Integer.valueOf(0)); } - if (ci != null) { - values.put(CACHED_NAME, ci.name); - values.put(CACHED_NUMBER_TYPE, ci.numberType); - values.put(CACHED_NUMBER_LABEL, ci.numberLabel); - } if ((ci != null) && (ci.contactIdOrZero > 0)) { // Update usage information for the number associated with the contact ID. diff --git a/core/java/android/security/keymaster/KeymasterDefs.java b/core/java/android/security/keymaster/KeymasterDefs.java index 3fb93c4be250..62c28ac14255 100644 --- a/core/java/android/security/keymaster/KeymasterDefs.java +++ b/core/java/android/security/keymaster/KeymasterDefs.java @@ -81,8 +81,8 @@ public final class KeymasterDefs { public static final int KM_TAG_ASSOCIATED_DATA = KM_BYTES | 1000; public static final int KM_TAG_NONCE = KM_BYTES | 1001; - public static final int KM_TAG_AUTH_TOKEN = KM_BYTES | 1003; - public static final int KM_TAG_MAC_LENGTH = KM_INT | 1004; + public static final int KM_TAG_AUTH_TOKEN = KM_BYTES | 1002; + public static final int KM_TAG_MAC_LENGTH = KM_INT | 1003; // Algorithm values. public static final int KM_ALGORITHM_RSA = 1; @@ -191,8 +191,9 @@ public final class KeymasterDefs { public static final int KM_ERROR_MISSING_NONCE = -51; public static final int KM_ERROR_INVALID_NONCE = -52; public static final int KM_ERROR_MISSING_MAC_LENGTH = -53; - public static final int KM_ERROR_RESCOPABLE_KEY_NOT_USABLE = -54; + public static final int KM_ERROR_KEY_RATE_LIMIT_EXCEEDED = -54; public static final int KM_ERROR_CALLER_NONCE_PROHIBITED = -55; + public static final int KM_ERROR_KEY_MAX_OPS_EXCEEDED = -56; public static final int KM_ERROR_UNIMPLEMENTED = -100; public static final int KM_ERROR_VERSION_MISMATCH = -101; public static final int KM_ERROR_UNKNOWN_ERROR = -1000; diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index 8c6cd09a8144..0309d24c8e56 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -41,6 +41,7 @@ import android.util.ArrayMap; import android.util.ArraySet; import android.util.Log; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -463,15 +464,28 @@ public abstract class NotificationListenerService extends Service { ParceledListSlice<StatusBarNotification> parceledList = getNotificationInterface() .getActiveNotificationsFromListener(mWrapper, keys, trim); List<StatusBarNotification> list = parceledList.getList(); - + ArrayList<StatusBarNotification> corruptNotifications = null; int N = list.size(); for (int i = 0; i < N; i++) { - Notification notification = list.get(i).getNotification(); - Builder.rebuild(getContext(), notification); - // convert icon metadata to legacy format for older clients - createLegacyIconExtras(notification); + StatusBarNotification sbn = list.get(i); + Notification notification = sbn.getNotification(); + try { + Builder.rebuild(getContext(), notification); + // convert icon metadata to legacy format for older clients + createLegacyIconExtras(notification); + } catch (IllegalArgumentException e) { + if (corruptNotifications == null) { + corruptNotifications = new ArrayList<>(N); + } + corruptNotifications.add(sbn); + Log.w(TAG, "onNotificationPosted: can't rebuild notification from " + + sbn.getPackageName()); + } } - return list.toArray(new StatusBarNotification[N]); + if (corruptNotifications != null) { + list.removeAll(corruptNotifications); + } + return list.toArray(new StatusBarNotification[list.size()]); } catch (android.os.RemoteException ex) { Log.v(TAG, "Unable to contact notification manager", ex); } @@ -671,16 +685,28 @@ public abstract class NotificationListenerService extends Service { Log.w(TAG, "onNotificationPosted: Error receiving StatusBarNotification", e); return; } - Notification.Builder.rebuild(getContext(), sbn.getNotification()); - // convert icon metadata to legacy format for older clients - createLegacyIconExtras(sbn.getNotification()); + try { + Notification.Builder.rebuild(getContext(), sbn.getNotification()); + // convert icon metadata to legacy format for older clients + createLegacyIconExtras(sbn.getNotification()); + } catch (IllegalArgumentException e) { + // drop corrupt notification + sbn = null; + Log.w(TAG, "onNotificationPosted: can't rebuild notification from " + + sbn.getPackageName()); + } // protect subclass from concurrent modifications of (@link mNotificationKeys}. synchronized (mWrapper) { applyUpdate(update); try { - NotificationListenerService.this.onNotificationPosted(sbn, mRankingMap); + if (sbn != null) { + NotificationListenerService.this.onNotificationPosted(sbn, mRankingMap); + } else { + // still pass along the ranking map, it may contain other information + NotificationListenerService.this.onNotificationRankingUpdate(mRankingMap); + } } catch (Throwable t) { Log.w(TAG, "Error running onNotificationPosted", t); } diff --git a/core/java/android/service/persistentdata/IPersistentDataBlockService.aidl b/core/java/android/service/persistentdata/IPersistentDataBlockService.aidl index 0071a33bbb23..52db22397b65 100644 --- a/core/java/android/service/persistentdata/IPersistentDataBlockService.aidl +++ b/core/java/android/service/persistentdata/IPersistentDataBlockService.aidl @@ -16,8 +16,6 @@ package android.service.persistentdata; -import android.app.PendingIntent; -import android.os.Bundle; import android.os.ParcelFileDescriptor; /** @@ -32,7 +30,6 @@ interface IPersistentDataBlockService { int write(in byte[] data); byte[] read(); void wipe(); - void wipeIfAllowed(in Bundle bundle, in PendingIntent pi); int getDataBlockSize(); long getMaximumDataBlockSize(); diff --git a/core/java/android/service/persistentdata/PersistentDataBlockManager.java b/core/java/android/service/persistentdata/PersistentDataBlockManager.java index 31570c6887a1..0ffdf68c4b30 100644 --- a/core/java/android/service/persistentdata/PersistentDataBlockManager.java +++ b/core/java/android/service/persistentdata/PersistentDataBlockManager.java @@ -17,8 +17,6 @@ package android.service.persistentdata; import android.annotation.SystemApi; -import android.app.PendingIntent; -import android.os.Bundle; import android.os.RemoteException; import android.util.Slog; @@ -43,56 +41,6 @@ import android.util.Slog; @SystemApi public class PersistentDataBlockManager { private static final String TAG = PersistentDataBlockManager.class.getSimpleName(); - - /** - * Broadcast action that will be called when the {@link #wipeIfAllowed(Bundle,PendingIntent)} - * method is called. A broadcast with this action will be sent to the package allowed to write - * to the persistent data block. Packages receiving this broadcasts should respond by using the - * {@link android.app.PendingIntent} sent in the {@link #EXTRA_WIPE_IF_ALLOWED_CALLBACK} extra. - */ - public static final String ACTION_WIPE_IF_ALLOWED - = "android.service.persistentdata.action.WIPE_IF_ALLOWED"; - - /** - * A {@link android.os.Parcelable} extra of type {@link android.app.PendingIntent} used to - * response to {@link #wipeIfAllowed(Bundle,PendingIntent)}. This extra will set in broadcasts - * with an action of {@link #ACTION_WIPE_IF_ALLOWED}. - */ - public static final String EXTRA_WIPE_IF_ALLOWED_CALLBACK - = "android.service.persistentdata.extra.WIPE_IF_ALLOWED_CALLBACK"; - - /** - * Result code indicating that the data block was wiped. - * - * <p>This value is set as result code of the {@link android.app.PendingIntent} argument to - * {@link #wipeIfAllowed(Bundle,PendingIntent)} - */ - public static final int STATUS_SUCCESS = 0; - - /** - * Result code indicating that a remote exception was received while processing the request. - * - * <p>This value is set as result code of the {@link android.app.PendingIntent} argument to - * {@link #wipeIfAllowed(Bundle,PendingIntent)} - */ - public static final int STATUS_ERROR_REMOTE_EXCEPTION = 1; - - /** - * Result code indicating that a network error occurred while processing the request. - * - * <p>This value is set as result code of the {@link android.app.PendingIntent} argument to - * {@link #wipeIfAllowed(Bundle,PendingIntent)} - */ - public static final int STATUS_ERROR_NETWORK_ERROR = 2; - - /** - * Result code indicating that the data block could not be cleared with the provided data. - * - * <p>This value is set as result code of the {@link android.app.PendingIntent} argument to - * {@link #wipeIfAllowed(Bundle,PendingIntent)} - */ - public static final int STATUS_ERROR_NOT_COMPLIANT = 3; - private IPersistentDataBlockService sService; public PersistentDataBlockManager(IPersistentDataBlockService service) { @@ -170,28 +118,6 @@ public class PersistentDataBlockManager { } /** - * Attempt to wipe the data block by sending a broadcast to the package allowed to modify the - * datablock. The allowed package can refuse to wipe the data block based on the contents of - * the specified bundle. This bundle may contain data used by the allowed package to wipe the - * partition such as account credentials or an authorization token. - * @param bundle data used to wipe the data block. The contents of this bundle depend on the - * allowed package receiving the data. - * @param pi intent called when attempt finished. The result code of this intent will be set - * to one of {@link #STATUS_SUCCESS}, {@link #STATUS_ERROR_REMOTE_EXCEPTION}, - * {@link #STATUS_ERROR_NETWORK_ERROR}, or {@link #STATUS_ERROR_NOT_COMPLIANT}. - */ - public void wipeIfAllowed(Bundle bundle, PendingIntent pi) { - if (pi == null) { - throw new NullPointerException(); - } - try { - sService.wipeIfAllowed(bundle, pi); - } catch (RemoteException e) { - onError("wiping persistent partition"); - } - } - - /** * Writes a byte enabling or disabling the ability to "OEM unlock" the device. */ public void setOemUnlockEnabled(boolean enabled) { diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java index 98c684c4ead2..39dd29b671a6 100644 --- a/core/java/android/service/voice/VoiceInteractionSession.java +++ b/core/java/android/service/voice/VoiceInteractionSession.java @@ -1097,7 +1097,8 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall WindowManager.LayoutParams.TYPE_VOICE_INTERACTION, Gravity.BOTTOM, true); mWindow.getWindow().addFlags( WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED | - WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); + WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | + WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR); initViews(); mWindow.getWindow().setLayout(MATCH_PARENT, MATCH_PARENT); mWindow.setToken(mToken); diff --git a/core/java/android/view/ActionMode.java b/core/java/android/view/ActionMode.java index 80dcecce8bc2..ea979c8b4621 100644 --- a/core/java/android/view/ActionMode.java +++ b/core/java/android/view/ActionMode.java @@ -261,6 +261,16 @@ public abstract class ActionMode { public abstract MenuInflater getMenuInflater(); /** + * Called when the window containing the view that started this action mode gains or loses + * focus. + * + * @param hasWindowFocus True if the window containing the view that started this action mode + * now has focus, false otherwise. + * + */ + public void onWindowFocusChanged(boolean hasWindowFocus) {} + + /** * Returns whether the UI presenting this action mode can take focus or not. * This is used by internal components within the framework that would otherwise * present an action mode UI that requires focus, such as an EditText as a custom view. diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 73cfd8c38131..2e2ba881425a 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -4148,24 +4148,38 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager mOnHierarchyChangeListener = listener; } - /** - * @hide - */ - protected void onViewAdded(View child) { + void dispatchViewAdded(View child) { + onViewAdded(child); if (mOnHierarchyChangeListener != null) { mOnHierarchyChangeListener.onChildViewAdded(this, child); } } /** - * @hide + * Called when a new child is added to this ViewGroup. Overrides should always + * call super.onViewAdded. + * + * @param child the added child view */ - protected void onViewRemoved(View child) { + public void onViewAdded(View child) { + } + + void dispatchViewRemoved(View child) { + onViewRemoved(child); if (mOnHierarchyChangeListener != null) { mOnHierarchyChangeListener.onChildViewRemoved(this, child); } } + /** + * Called when a child view is removed from this ViewGroup. Overrides should always + * call super.onViewRemoved. + * + * @param child the removed child view + */ + public void onViewRemoved(View child) { + } + private void clearCachedLayoutMode() { if (!hasBooleanFlag(FLAG_LAYOUT_MODE_WAS_EXPLICITLY_SET)) { mLayoutMode = LAYOUT_MODE_UNDEFINED; @@ -4292,7 +4306,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager child.resetRtlProperties(); } - onViewAdded(child); + dispatchViewAdded(child); if ((child.mViewFlags & DUPLICATE_PARENT_STATE) == DUPLICATE_PARENT_STATE) { mGroupFlags |= FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE; @@ -4554,7 +4568,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } } - onViewRemoved(view); + dispatchViewRemoved(view); if (view.getVisibility() != View.GONE) { notifySubtreeAccessibilityStateChangedIfNeeded(); @@ -4646,7 +4660,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager needGlobalAttributesUpdate(false); - onViewRemoved(view); + dispatchViewRemoved(view); } removeFromArray(start, count); @@ -4729,7 +4743,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager childHasTransientStateChanged(view, false); } - onViewRemoved(view); + dispatchViewRemoved(view); view.mParent = null; children[i] = null; @@ -4788,7 +4802,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager childHasTransientStateChanged(child, false); } - onViewRemoved(child); + dispatchViewRemoved(child); } /** diff --git a/core/java/android/view/accessibility/AccessibilityInteractionClient.java b/core/java/android/view/accessibility/AccessibilityInteractionClient.java index db78ec5776c2..b49cbc6245ba 100644 --- a/core/java/android/view/accessibility/AccessibilityInteractionClient.java +++ b/core/java/android/view/accessibility/AccessibilityInteractionClient.java @@ -186,7 +186,9 @@ public final class AccessibilityInteractionClient if (DEBUG) { Log.i(LOG_TAG, "Window cache miss"); } + final long identityToken = Binder.clearCallingIdentity(); window = connection.getWindow(accessibilityWindowId); + Binder.restoreCallingIdentity(identityToken); if (window != null) { sAccessibilityCache.addWindow(window); return window; @@ -222,7 +224,9 @@ public final class AccessibilityInteractionClient if (DEBUG) { Log.i(LOG_TAG, "Windows cache miss"); } + final long identityToken = Binder.clearCallingIdentity(); windows = connection.getWindows(); + Binder.restoreCallingIdentity(identityToken); if (windows != null) { final int windowCount = windows.size(); for (int i = 0; i < windowCount; i++) { @@ -282,9 +286,11 @@ public final class AccessibilityInteractionClient } } final int interactionId = mInteractionIdCounter.getAndIncrement(); + final long identityToken = Binder.clearCallingIdentity(); final boolean success = connection.findAccessibilityNodeInfoByAccessibilityId( accessibilityWindowId, accessibilityNodeId, interactionId, this, prefetchFlags, Thread.currentThread().getId()); + Binder.restoreCallingIdentity(identityToken); // If the scale is zero the call has failed. if (success) { List<AccessibilityNodeInfo> infos = getFindAccessibilityNodeInfosResultAndClear( @@ -328,9 +334,11 @@ public final class AccessibilityInteractionClient IAccessibilityServiceConnection connection = getConnection(connectionId); if (connection != null) { final int interactionId = mInteractionIdCounter.getAndIncrement(); + final long identityToken = Binder.clearCallingIdentity(); final boolean success = connection.findAccessibilityNodeInfosByViewId( accessibilityWindowId, accessibilityNodeId, viewId, interactionId, this, Thread.currentThread().getId()); + Binder.restoreCallingIdentity(identityToken); if (success) { List<AccessibilityNodeInfo> infos = getFindAccessibilityNodeInfosResultAndClear( interactionId); @@ -374,9 +382,11 @@ public final class AccessibilityInteractionClient IAccessibilityServiceConnection connection = getConnection(connectionId); if (connection != null) { final int interactionId = mInteractionIdCounter.getAndIncrement(); + final long identityToken = Binder.clearCallingIdentity(); final boolean success = connection.findAccessibilityNodeInfosByText( accessibilityWindowId, accessibilityNodeId, text, interactionId, this, Thread.currentThread().getId()); + Binder.restoreCallingIdentity(identityToken); if (success) { List<AccessibilityNodeInfo> infos = getFindAccessibilityNodeInfosResultAndClear( interactionId); @@ -419,9 +429,11 @@ public final class AccessibilityInteractionClient IAccessibilityServiceConnection connection = getConnection(connectionId); if (connection != null) { final int interactionId = mInteractionIdCounter.getAndIncrement(); + final long identityToken = Binder.clearCallingIdentity(); final boolean success = connection.findFocus(accessibilityWindowId, accessibilityNodeId, focusType, interactionId, this, Thread.currentThread().getId()); + Binder.restoreCallingIdentity(identityToken); if (success) { AccessibilityNodeInfo info = getFindAccessibilityNodeInfoResultAndClear( interactionId); @@ -461,9 +473,11 @@ public final class AccessibilityInteractionClient IAccessibilityServiceConnection connection = getConnection(connectionId); if (connection != null) { final int interactionId = mInteractionIdCounter.getAndIncrement(); + final long identityToken = Binder.clearCallingIdentity(); final boolean success = connection.focusSearch(accessibilityWindowId, accessibilityNodeId, direction, interactionId, this, Thread.currentThread().getId()); + Binder.restoreCallingIdentity(identityToken); if (success) { AccessibilityNodeInfo info = getFindAccessibilityNodeInfoResultAndClear( interactionId); @@ -502,9 +516,11 @@ public final class AccessibilityInteractionClient IAccessibilityServiceConnection connection = getConnection(connectionId); if (connection != null) { final int interactionId = mInteractionIdCounter.getAndIncrement(); + final long identityToken = Binder.clearCallingIdentity(); final boolean success = connection.performAccessibilityAction( accessibilityWindowId, accessibilityNodeId, action, arguments, interactionId, this, Thread.currentThread().getId()); + Binder.restoreCallingIdentity(identityToken); if (success) { return getPerformAccessibilityActionResultAndClear(interactionId); } diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java index 2f5c9e2d2d45..7db88af5f71e 100644 --- a/core/java/android/webkit/WebViewClient.java +++ b/core/java/android/webkit/WebViewClient.java @@ -298,14 +298,27 @@ public class WebViewClient { * Notify the host application to handle a SSL client certificate * request. The host application is responsible for showing the UI * if desired and providing the keys. There are three ways to - * respond: proceed(), cancel() or ignore(). Webview remembers the - * response if proceed() or cancel() is called and does not - * call onReceivedClientCertRequest() again for the same host and port - * pair. Webview does not remember the response if ignore() is called. + * respond: proceed(), cancel() or ignore(). Webview stores the response + * in memory (for the life of the application) if proceed() or cancel() is + * called and does not call onReceivedClientCertRequest() again for the + * same host and port pair. Webview does not store the response if ignore() + * is called. * * This method is called on the UI thread. During the callback, the * connection is suspended. * + * For most use cases, the application program should implement the + * {@link android.security.KeyChainAliasCallback} interface and pass it to + * {@link android.security.KeyChain.choosePrivateKeyAlias} to start an + * activity for the user to choose the proper alias. The keychain activity will + * provide the alias through the callback method in the implemented interface. Next + * the application should create an async task to call + * {@link android.security.KeyChain.getPrivateKey} to receive the key. + * + * An example implementation of client certificates can be seen at + * <A href="https://android.googlesource.com/platform/packages/apps/Browser/+/android-5.1.1_r1/src/com/android/browser/Tab.java"> + * AOSP Browser</a> + * * The default behavior is to cancel, returning no client certificate. * * @param view The WebView that is initiating the callback diff --git a/core/java/android/webkit/WebViewFactory.java b/core/java/android/webkit/WebViewFactory.java index b4ef58afb94d..3b9aca8883e3 100644 --- a/core/java/android/webkit/WebViewFactory.java +++ b/core/java/android/webkit/WebViewFactory.java @@ -96,49 +96,27 @@ public final class WebViewFactory { public MissingWebViewPackageException(Exception e) { super(e); } } - /** @hide */ - public static String[] getWebViewPackageNames() { - return AppGlobals.getInitialApplication().getResources().getStringArray( - com.android.internal.R.array.config_webViewPackageNames); - } - - // TODO (gsennton) remove when committing webview xts test change public static String getWebViewPackageName() { - String[] webViewPackageNames = getWebViewPackageNames(); - return webViewPackageNames[webViewPackageNames.length-1]; + return AppGlobals.getInitialApplication().getString( + com.android.internal.R.string.config_webViewPackageName); } - /** - * Return the package info of the first package in the webview priority list that contains - * webview. - * - * @hide - */ - public static PackageInfo findPreferredWebViewPackage() { + private static PackageInfo fetchPackageInfo() { PackageManager pm = AppGlobals.getInitialApplication().getPackageManager(); - - for (String packageName : getWebViewPackageNames()) { - try { - PackageInfo packageInfo = pm.getPackageInfo(packageName, - PackageManager.GET_META_DATA); - ApplicationInfo applicationInfo = packageInfo.applicationInfo; - - // If the correct flag is set the package contains webview. - if (getWebViewLibrary(applicationInfo) != null) { - return packageInfo; - } - } catch (PackageManager.NameNotFoundException e) { - } + try { + return pm.getPackageInfo(getWebViewPackageName(), PackageManager.GET_META_DATA); + } catch (PackageManager.NameNotFoundException e) { + throw new MissingWebViewPackageException(e); } - throw new MissingWebViewPackageException("Could not find a loadable WebView package"); } // throws MissingWebViewPackageException private static ApplicationInfo getWebViewApplicationInfo() { - if (sPackageInfo == null) - return findPreferredWebViewPackage().applicationInfo; - else + if (sPackageInfo == null) { + return fetchPackageInfo().applicationInfo; + } else { return sPackageInfo.applicationInfo; + } } private static String getWebViewLibrary(ApplicationInfo ai) { @@ -153,10 +131,10 @@ public final class WebViewFactory { /** * Load the native library for the given package name iff that package - * name is the same as the one providing the current webview. + * name is the same as the one providing the webview. */ public static int loadWebViewNativeLibraryFromPackage(String packageName) { - sPackageInfo = findPreferredWebViewPackage(); + sPackageInfo = fetchPackageInfo(); if (packageName != null && packageName.equals(sPackageInfo.packageName)) { return loadNativeLibrary(); } @@ -202,7 +180,7 @@ public final class WebViewFactory { private static Class<WebViewFactoryProvider> getProviderClass() { try { // First fetch the package info so we can log the webview package version. - sPackageInfo = findPreferredWebViewPackage(); + sPackageInfo = fetchPackageInfo(); Log.i(LOGTAG, "Loading " + sPackageInfo.packageName + " version " + sPackageInfo.versionName + " (code " + sPackageInfo.versionCode + ")"); @@ -241,8 +219,8 @@ public final class WebViewFactory { try { // Construct a package context to load the Java code into the current app. Context webViewContext = initialApplication.createPackageContext( - sPackageInfo.packageName, - Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY); + sPackageInfo.packageName, + Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY); initialApplication.getAssets().addAssetPath( webViewContext.getApplicationInfo().sourceDir); ClassLoader clazzLoader = webViewContext.getClassLoader(); diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 6454b57d6619..a96bf71d91ef 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -3113,9 +3113,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } private boolean performStylusButtonPressAction(MotionEvent ev) { - if (ev.getToolType(0) == MotionEvent.TOOL_TYPE_STYLUS - && ev.isButtonPressed(MotionEvent.BUTTON_SECONDARY) - && mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL && mChoiceActionMode == null) { + if (mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL && mChoiceActionMode == null) { final View child = getChildAt(mMotionPosition - mFirstPosition); if (child != null) { final int longPressPosition = mMotionPosition; @@ -3785,7 +3783,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } if (mTouchMode == TOUCH_MODE_DOWN && mMotionPosition != INVALID_POSITION - && (performButtonActionOnTouchDown(ev) || performStylusButtonPressAction(ev))) { + && performButtonActionOnTouchDown(ev)) { removeCallbacks(mPendingCheckForTap); } } @@ -3828,11 +3826,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mTouchMode = TOUCH_MODE_DONE_WAITING; updateSelectorState(); } else if (motionView != null) { - if (performStylusButtonPressAction(ev)) { - removeCallbacks(mPendingCheckForTap); - removeCallbacks(mPendingCheckForLongPress); - } - // Still within bounds, update the hotspot. final float[] point = mTmpPoint; point[0] = x; @@ -4072,7 +4065,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te public boolean onGenericMotionEvent(MotionEvent event) { if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (event.getAction()) { - case MotionEvent.ACTION_SCROLL: { + case MotionEvent.ACTION_SCROLL: if (mTouchMode == TOUCH_MODE_REST) { final float vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL); if (vscroll != 0) { @@ -4082,9 +4075,22 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } } } - } + break; + + case MotionEvent.ACTION_BUTTON_PRESS: + int actionButton = event.getActionButton(); + if ((actionButton == MotionEvent.BUTTON_STYLUS_PRIMARY + || actionButton == MotionEvent.BUTTON_SECONDARY) + && (mTouchMode == TOUCH_MODE_DOWN || mTouchMode == TOUCH_MODE_TAP)) { + if (performStylusButtonPressAction(event)) { + removeCallbacks(mPendingCheckForLongPress); + removeCallbacks(mPendingCheckForTap); + } + } + break; } } + return super.onGenericMotionEvent(event); } diff --git a/core/java/android/widget/Chronometer.java b/core/java/android/widget/Chronometer.java index a15080e60331..ebb54ff39d06 100644 --- a/core/java/android/widget/Chronometer.java +++ b/core/java/android/widget/Chronometer.java @@ -17,6 +17,7 @@ package android.widget; import android.content.Context; +import android.content.res.Resources; import android.content.res.TypedArray; import android.os.Handler; import android.os.Message; @@ -24,6 +25,7 @@ import android.os.SystemClock; import android.text.format.DateUtils; import android.util.AttributeSet; import android.util.Log; +import android.view.accessibility.AccessibilityEvent; import android.widget.RemoteViews.RemoteView; import java.util.Formatter; @@ -58,6 +60,7 @@ public class Chronometer extends TextView { } private long mBase; + private long mNow; // the currently displayed time private boolean mVisible; private boolean mStarted; private boolean mRunning; @@ -224,6 +227,7 @@ public class Chronometer extends TextView { } private synchronized void updateText(long now) { + mNow = now; long seconds = now - mBase; seconds /= 1000; String text = DateUtils.formatElapsedTime(mRecycle, seconds); @@ -279,6 +283,60 @@ public class Chronometer extends TextView { } } + private static final int MIN_IN_SEC = 60; + private static final int HOUR_IN_SEC = MIN_IN_SEC*60; + private static String formatDuration(long ms) { + final Resources res = Resources.getSystem(); + final StringBuilder text = new StringBuilder(); + + int duration = (int) (ms / DateUtils.SECOND_IN_MILLIS); + if (duration < 0) { + duration = -duration; + } + + int h = 0; + int m = 0; + + if (duration >= HOUR_IN_SEC) { + h = duration / HOUR_IN_SEC; + duration -= h * HOUR_IN_SEC; + } + if (duration >= MIN_IN_SEC) { + m = duration / MIN_IN_SEC; + duration -= m * MIN_IN_SEC; + } + int s = duration; + + try { + if (h > 0) { + text.append(res.getQuantityString( + com.android.internal.R.plurals.duration_hours, h, h)); + } + if (m > 0) { + if (text.length() > 0) { + text.append(' '); + } + text.append(res.getQuantityString( + com.android.internal.R.plurals.duration_minutes, m, m)); + } + + if (text.length() > 0) { + text.append(' '); + } + text.append(res.getQuantityString( + com.android.internal.R.plurals.duration_seconds, s, s)); + } catch (Resources.NotFoundException e) { + // Ignore; plurals throws an exception for an untranslated quantity for a given locale. + return null; + } + return text.toString(); + } + + @Override + public CharSequence getContentDescription() { + return formatDuration(mNow - mBase); + } + @Override public CharSequence getAccessibilityClassName() { return Chronometer.class.getName(); diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 238d6c49fbe8..9ca59f1ab055 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -4157,6 +4157,11 @@ public class Editor { offset = adjustedOffset; } positionCursor = true; + } else if (adjustedOffset < mPreviousOffset) { + // Handle has jumped to the start of the word, and the user is moving + // their finger towards the handle, the delta should be updated. + mTouchWordDelta = mTextView.convertToLocalHorizontalCoordinate(x) + - layout.getPrimaryHorizontal(mPreviousOffset); } } @@ -4291,6 +4296,11 @@ public class Editor { offset = adjustedOffset; } positionCursor = true; + } else if (adjustedOffset > mPreviousOffset) { + // Handle has jumped to the end of the word, and the user is moving + // their finger towards the handle, the delta should be updated. + mTouchWordDelta = layout.getPrimaryHorizontal(mPreviousOffset) + - mTextView.convertToLocalHorizontalCoordinate(x); } } diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java index 6cc4bda43510..258424a2e574 100644 --- a/core/java/android/widget/GridLayout.java +++ b/core/java/android/widget/GridLayout.java @@ -935,22 +935,14 @@ public class GridLayout extends ViewGroup { super.onDebugDraw(canvas); } - // Add/remove - - /** - * @hide - */ @Override - protected void onViewAdded(View child) { + public void onViewAdded(View child) { super.onViewAdded(child); invalidateStructure(); } - /** - * @hide - */ @Override - protected void onViewRemoved(View child) { + public void onViewRemoved(View child) { super.onViewRemoved(child); invalidateStructure(); } diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java index afc683ad439e..534bfad94e91 100644 --- a/core/java/android/widget/ListPopupWindow.java +++ b/core/java/android/widget/ListPopupWindow.java @@ -105,7 +105,7 @@ public class ListPopupWindow { private final ListSelectorHider mHideSelector = new ListSelectorHider(); private Runnable mShowDropDownRunnable; - private Handler mHandler = new Handler(); + private final Handler mHandler; private Rect mTempRect = new Rect(); @@ -212,6 +212,7 @@ public class ListPopupWindow { */ public ListPopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { mContext = context; + mHandler = new Handler(context.getMainLooper()); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ListPopupWindow, defStyleAttr, defStyleRes); diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index 339038eddf3f..affc5daa35f7 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -522,7 +522,7 @@ public class RelativeLayout extends ViewGroup { View baselineView = null; LayoutParams baselineParams = null; for (int i = 0; i < count; i++) { - final View child = views[i]; + final View child = getChildAt(i); if (child.getVisibility() != GONE) { final LayoutParams childParams = (LayoutParams) child.getLayoutParams(); if (baselineView == null || baselineParams == null @@ -548,9 +548,9 @@ public class RelativeLayout extends ViewGroup { if (offsetHorizontalAxis) { for (int i = 0; i < count; i++) { - final View child = views[i]; + View child = getChildAt(i); if (child.getVisibility() != GONE) { - final LayoutParams params = (LayoutParams) child.getLayoutParams(); + LayoutParams params = (LayoutParams) child.getLayoutParams(); final int[] rules = params.getRules(layoutDirection); if (rules[CENTER_IN_PARENT] != 0 || rules[CENTER_HORIZONTAL] != 0) { centerHorizontal(child, params, width); @@ -578,9 +578,9 @@ public class RelativeLayout extends ViewGroup { if (offsetVerticalAxis) { for (int i = 0; i < count; i++) { - final View child = views[i]; + View child = getChildAt(i); if (child.getVisibility() != GONE) { - final LayoutParams params = (LayoutParams) child.getLayoutParams(); + LayoutParams params = (LayoutParams) child.getLayoutParams(); final int[] rules = params.getRules(layoutDirection); if (rules[CENTER_IN_PARENT] != 0 || rules[CENTER_VERTICAL] != 0) { centerVertical(child, params, height); @@ -607,9 +607,9 @@ public class RelativeLayout extends ViewGroup { final int verticalOffset = contentBounds.top - top; if (horizontalOffset != 0 || verticalOffset != 0) { for (int i = 0; i < count; i++) { - final View child = views[i]; + View child = getChildAt(i); if (child.getVisibility() != GONE && child != ignore) { - final LayoutParams params = (LayoutParams) child.getLayoutParams(); + LayoutParams params = (LayoutParams) child.getLayoutParams(); if (horizontalGravity) { params.mLeft += horizontalOffset; params.mRight += horizontalOffset; @@ -626,9 +626,9 @@ public class RelativeLayout extends ViewGroup { if (isLayoutRtl()) { final int offsetWidth = myWidth - width; for (int i = 0; i < count; i++) { - final View child = views[i]; + View child = getChildAt(i); if (child.getVisibility() != GONE) { - final LayoutParams params = (LayoutParams) child.getLayoutParams(); + LayoutParams params = (LayoutParams) child.getLayoutParams(); params.mLeft -= offsetWidth; params.mRight -= offsetWidth; } diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java index c1ec6e6907cd..2a13c7646eac 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -613,15 +613,17 @@ public class ChooserActivity extends ResolverActivity { ri.activityInfo = ai; UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE); - if (userManager.isManagedProfile()) { - ri.noResourceId = true; - } if (ii instanceof LabeledIntent) { LabeledIntent li = (LabeledIntent)ii; ri.resolvePackageName = li.getSourcePackage(); ri.labelRes = li.getLabelResource(); ri.nonLocalizedLabel = li.getNonLocalizedLabel(); ri.icon = li.getIconResource(); + ri.iconResourceId = ri.icon; + } + if (userManager.isManagedProfile()) { + ri.noResourceId = true; + ri.icon = 0; } mCallerTargets.add(new DisplayResolveInfo(ii, ri, ri.loadLabel(pm), null, ii)); diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl index 929cacd553f6..6f0cec60bd46 100644 --- a/core/java/com/android/internal/app/IBatteryStats.aidl +++ b/core/java/com/android/internal/app/IBatteryStats.aidl @@ -116,7 +116,7 @@ interface IBatteryStats { void noteWifiRadioPowerState(int powerState, long timestampNs); void noteNetworkInterfaceType(String iface, int type); void noteNetworkStatsEnabled(); - void noteDeviceIdleMode(boolean enabled, boolean fromActive, boolean fromMotion); + void noteDeviceIdleMode(boolean enabled, String activeReason, int activeUid); void setBatteryState(int status, int health, int plugType, int level, int temp, int volt); long getAwakeTimeBattery(); long getAwakeTimePlugged(); diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index 39c86f99c55b..e14f0584a0b8 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -1186,15 +1186,17 @@ public class ResolverActivity extends Activity { ri.activityInfo = ai; UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE); - if (userManager.isManagedProfile()) { - ri.noResourceId = true; - } if (ii instanceof LabeledIntent) { LabeledIntent li = (LabeledIntent)ii; ri.resolvePackageName = li.getSourcePackage(); ri.labelRes = li.getLabelResource(); ri.nonLocalizedLabel = li.getNonLocalizedLabel(); ri.icon = li.getIconResource(); + ri.iconResourceId = ri.icon; + } + if (userManager.isManagedProfile()) { + ri.noResourceId = true; + ri.icon = 0; } addResolveInfo(new DisplayResolveInfo(ii, ri, ri.loadLabel(getPackageManager()), null, ii)); diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java index 230d96dc6f58..03f2e3a49910 100644 --- a/core/java/com/android/internal/logging/MetricsLogger.java +++ b/core/java/com/android/internal/logging/MetricsLogger.java @@ -26,6 +26,13 @@ import android.view.View; * @hide */ public class MetricsLogger implements MetricsConstants { + public static final int VOLUME_DIALOG = 207; + public static final int VOLUME_DIALOG_DETAILS = 208; + public static final int ACTION_VOLUME_SLIDER = 209; + public static final int ACTION_VOLUME_STREAM = 210; + public static final int ACTION_VOLUME_KEY = 211; + public static final int ACTION_VOLUME_ICON = 212; + public static final int ACTION_RINGER_MODE = 213; // Temporary constants go here, to await migration to MetricsConstants. public static void visible(Context context, int category) throws IllegalArgumentException { diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index 07d1fc8624de..83ce5f6c6aae 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -95,7 +95,8 @@ import java.util.concurrent.locks.ReentrantLock; public final class BatteryStatsImpl extends BatteryStats { private static final String TAG = "BatteryStatsImpl"; private static final boolean DEBUG = false; - private static final boolean DEBUG_ENERGY = false; + public static final boolean DEBUG_ENERGY = false; + private static final boolean DEBUG_ENERGY_CPU = DEBUG_ENERGY || false; private static final boolean DEBUG_HISTORY = false; private static final boolean USE_OLD_HISTORY = false; // for debugging. @@ -105,7 +106,7 @@ public final class BatteryStatsImpl extends BatteryStats { private static final int MAGIC = 0xBA757475; // 'BATSTATS' // Current on-disk Parcel version - private static final int VERSION = 127 + (USE_OLD_HISTORY ? 1000 : 0); + private static final int VERSION = 129 + (USE_OLD_HISTORY ? 1000 : 0); // Maximum number of items we will record in the history. private static final int MAX_HISTORY_ITEMS = 2000; @@ -151,6 +152,9 @@ public final class BatteryStatsImpl extends BatteryStats { BatteryCallback cb = mCallback; switch (msg.what) { case MSG_UPDATE_WAKELOCKS: + synchronized (BatteryStatsImpl.this) { + updateCpuTimeLocked(); + } if (cb != null) { cb.batteryNeedsCpuUpdate(); } @@ -178,6 +182,7 @@ public final class BatteryStatsImpl extends BatteryStats { public interface ExternalStatsSync { void scheduleSync(String reason); + void scheduleWifiSync(String reason); } public final MyHandler mHandler; @@ -203,6 +208,7 @@ public final class BatteryStatsImpl extends BatteryStats { final ArrayList<StopwatchTimer> mPartialTimers = new ArrayList<>(); final ArrayList<StopwatchTimer> mFullTimers = new ArrayList<>(); final ArrayList<StopwatchTimer> mWindowTimers = new ArrayList<>(); + final ArrayList<StopwatchTimer> mDozeTimers = new ArrayList<>(); final SparseArray<ArrayList<StopwatchTimer>> mSensorTimers = new SparseArray<>(); final ArrayList<StopwatchTimer> mWifiRunningTimers = new ArrayList<>(); final ArrayList<StopwatchTimer> mFullWifiLockTimers = new ArrayList<>(); @@ -2503,12 +2509,11 @@ public final class BatteryStatsImpl extends BatteryStats { boolean unpluggedScreenOff = unplugged && screenOff; if (unpluggedScreenOff != mOnBatteryScreenOffTimeBase.isRunning()) { updateKernelWakelocksLocked(); - requestWakelockCpuUpdate(); - if (!unpluggedScreenOff) { - // We are switching to no longer tracking wake locks, but we want - // the next CPU update we receive to take them in to account. - mDistributeWakelockCpu = true; + if (DEBUG_ENERGY_CPU) { + Slog.d(TAG, "Updating cpu time because screen is now " + + (unpluggedScreenOff ? "off" : "on")); } + updateCpuTimeLocked(); mOnBatteryScreenOffTimeBase.setRunning(unpluggedScreenOff, uptime, realtime); } } @@ -2772,10 +2777,14 @@ public final class BatteryStatsImpl extends BatteryStats { mWakeLockNesting++; } if (uid >= 0) { - //if (uid == 0) { - // Slog.wtf(TAG, "Acquiring wake lock from root: " + name); - //} - requestWakelockCpuUpdate(); + if (mOnBatteryScreenOffTimeBase.isRunning()) { + // We only update the cpu time when a wake lock is acquired if the screen is off. + // If the screen is on, we don't distribute the power amongst partial wakelocks. + if (DEBUG_ENERGY_CPU) { + Slog.d(TAG, "Updating cpu time because of +wake_lock"); + } + requestWakelockCpuUpdate(); + } getUidStatsLocked(uid).noteStartWakeLocked(pid, name, type, elapsedRealtime); } } @@ -2805,7 +2814,12 @@ public final class BatteryStatsImpl extends BatteryStats { } } if (uid >= 0) { - requestWakelockCpuUpdate(); + if (mOnBatteryScreenOffTimeBase.isRunning()) { + if (DEBUG_ENERGY_CPU) { + Slog.d(TAG, "Updating cpu time because of -wake_lock"); + } + requestWakelockCpuUpdate(); + } getUidStatsLocked(uid).noteStopWakeLocked(pid, name, type, elapsedRealtime); } } @@ -2874,46 +2888,14 @@ public final class BatteryStatsImpl extends BatteryStats { addHistoryRecordLocked(elapsedRealtime, uptime); } - public int startAddingCpuLocked() { + public boolean startAddingCpuLocked() { mHandler.removeMessages(MSG_UPDATE_WAKELOCKS); - - if (!mOnBatteryInternal) { - return -1; - } - - final int N = mPartialTimers.size(); - if (N == 0) { - mLastPartialTimers.clear(); - mDistributeWakelockCpu = false; - return 0; - } - - if (!mOnBatteryScreenOffTimeBase.isRunning() && !mDistributeWakelockCpu) { - return 0; - } - - mDistributeWakelockCpu = false; - - // How many timers should consume CPU? Only want to include ones - // that have already been in the list. - for (int i=0; i<N; i++) { - StopwatchTimer st = mPartialTimers.get(i); - if (st.mInList) { - Uid uid = st.mUid; - // We don't include the system UID, because it so often - // holds wake locks at one request or another of an app. - if (uid != null && uid.mUid != Process.SYSTEM_UID) { - return 50; - } - } - } - - return 0; + return mOnBatteryInternal; } - public void finishAddingCpuLocked(int perc, int remainUTime, int remainSTtime, - int totalUTime, int totalSTime, int statUserTime, int statSystemTime, - int statIOWaitTime, int statIrqTime, int statSoftIrqTime, int statIdleTime) { + public void finishAddingCpuLocked(int totalUTime, int totalSTime, int statUserTime, + int statSystemTime, int statIOWaitTime, int statIrqTime, + int statSoftIrqTime, int statIdleTime) { if (DEBUG) Slog.d(TAG, "Adding cpu: tuser=" + totalUTime + " tsys=" + totalSTime + " user=" + statUserTime + " sys=" + statSystemTime + " io=" + statIOWaitTime + " irq=" + statIrqTime @@ -2926,70 +2908,6 @@ public final class BatteryStatsImpl extends BatteryStats { mCurStepStatIrqTime += statIrqTime; mCurStepStatSoftIrqTime += statSoftIrqTime; mCurStepStatIdleTime += statIdleTime; - - final int N = mPartialTimers.size(); - if (perc != 0) { - int num = 0; - for (int i=0; i<N; i++) { - StopwatchTimer st = mPartialTimers.get(i); - if (st.mInList) { - Uid uid = st.mUid; - // We don't include the system UID, because it so often - // holds wake locks at one request or another of an app. - if (uid != null && uid.mUid != Process.SYSTEM_UID) { - num++; - } - } - } - if (num != 0) { - for (int i=0; i<N; i++) { - StopwatchTimer st = mPartialTimers.get(i); - if (st.mInList) { - Uid uid = st.mUid; - if (uid != null && uid.mUid != Process.SYSTEM_UID) { - int myUTime = remainUTime/num; - int mySTime = remainSTtime/num; - remainUTime -= myUTime; - remainSTtime -= mySTime; - num--; - Uid.Proc proc = uid.getProcessStatsLocked("*wakelock*"); - proc.addCpuTimeLocked(myUTime, mySTime); - } - } - } - } - - // Just in case, collect any lost CPU time. - if (remainUTime != 0 || remainSTtime != 0) { - Uid uid = getUidStatsLocked(Process.SYSTEM_UID); - if (uid != null) { - Uid.Proc proc = uid.getProcessStatsLocked("*lost*"); - proc.addCpuTimeLocked(remainUTime, remainSTtime); - } - } - } - - final int NL = mLastPartialTimers.size(); - boolean diff = N != NL; - for (int i=0; i<NL && !diff; i++) { - diff |= mPartialTimers.get(i) != mLastPartialTimers.get(i); - } - if (!diff) { - for (int i=0; i<NL; i++) { - mPartialTimers.get(i).mInList = true; - } - return; - } - - for (int i=0; i<NL; i++) { - mLastPartialTimers.get(i).mInList = false; - } - mLastPartialTimers.clear(); - for (int i=0; i<N; i++) { - StopwatchTimer st = mPartialTimers.get(i); - st.mInList = true; - mLastPartialTimers.add(st); - } } public void noteProcessDiedLocked(int uid, int pid) { @@ -3271,11 +3189,11 @@ public final class BatteryStatsImpl extends BatteryStats { } } - public void noteDeviceIdleModeLocked(boolean enabled, boolean fromActive, boolean fromMotion) { + public void noteDeviceIdleModeLocked(boolean enabled, String activeReason, int activeUid) { final long elapsedRealtime = SystemClock.elapsedRealtime(); final long uptime = SystemClock.uptimeMillis(); boolean nowIdling = enabled; - if (mDeviceIdling && !enabled && !fromActive && !fromMotion) { + if (mDeviceIdling && !enabled && activeReason == null) { // We don't go out of general idling mode until explicitly taken out of // device idle through going active or significant motion. nowIdling = true; @@ -3293,14 +3211,8 @@ public final class BatteryStatsImpl extends BatteryStats { } if (mDeviceIdleModeEnabled != enabled) { mDeviceIdleModeEnabled = enabled; - if (fromMotion) { - addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_SIGNIFICANT_MOTION, - "", 0); - } - if (fromActive) { - addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_ACTIVE, - "", 0); - } + addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_ACTIVE, + activeReason != null ? activeReason : "", activeUid); if (enabled) { mHistoryCur.states2 |= HistoryItem.STATE2_DEVICE_IDLE_FLAG; if (DEBUG_HISTORY) Slog.v(TAG, "Device idle mode enabled to: " @@ -3580,7 +3492,7 @@ public final class BatteryStatsImpl extends BatteryStats { addHistoryRecordLocked(elapsedRealtime, uptime); mWifiOn = true; mWifiOnTimer.startRunningLocked(elapsedRealtime); - scheduleSyncExternalStatsLocked("wifi-off"); + scheduleSyncExternalWifiStatsLocked("wifi-off"); } } @@ -3594,7 +3506,7 @@ public final class BatteryStatsImpl extends BatteryStats { addHistoryRecordLocked(elapsedRealtime, uptime); mWifiOn = false; mWifiOnTimer.stopRunningLocked(elapsedRealtime); - scheduleSyncExternalStatsLocked("wifi-on"); + scheduleSyncExternalWifiStatsLocked("wifi-on"); } } @@ -3846,7 +3758,7 @@ public final class BatteryStatsImpl extends BatteryStats { int uid = mapUid(ws.get(i)); getUidStatsLocked(uid).noteWifiRunningLocked(elapsedRealtime); } - scheduleSyncExternalStatsLocked("wifi-running"); + scheduleSyncExternalWifiStatsLocked("wifi-running"); } else { Log.w(TAG, "noteWifiRunningLocked -- called while WIFI running"); } @@ -3885,7 +3797,7 @@ public final class BatteryStatsImpl extends BatteryStats { int uid = mapUid(ws.get(i)); getUidStatsLocked(uid).noteWifiStoppedLocked(elapsedRealtime); } - scheduleSyncExternalStatsLocked("wifi-stopped"); + scheduleSyncExternalWifiStatsLocked("wifi-stopped"); } else { Log.w(TAG, "noteWifiStoppedLocked -- called while WIFI not running"); } @@ -3900,7 +3812,7 @@ public final class BatteryStatsImpl extends BatteryStats { } mWifiState = wifiState; mWifiStateTimer[wifiState].startRunningLocked(elapsedRealtime); - scheduleSyncExternalStatsLocked("wifi-state"); + scheduleSyncExternalWifiStatsLocked("wifi-state"); } } @@ -5737,6 +5649,11 @@ public final class BatteryStatsImpl extends BatteryStats { StopwatchTimer mTimerWindow; /** + * How long (in ms) this uid has had a doze wake lock. + */ + StopwatchTimer mTimerDoze; + + /** * Reads a possibly null Timer from a Parcel. The timer is associated with the * proper timer pool from the given BatteryStatsImpl object. * @@ -5763,6 +5680,9 @@ public final class BatteryStatsImpl extends BatteryStats { if (mTimerWindow != null) { wlactive |= !mTimerWindow.reset(false); } + if (mTimerDoze != null) { + wlactive |= !mTimerDoze.reset(false); + } if (!wlactive) { if (mTimerFull != null) { mTimerFull.detach(); @@ -5776,6 +5696,10 @@ public final class BatteryStatsImpl extends BatteryStats { mTimerWindow.detach(); mTimerWindow = null; } + if (mTimerDoze != null) { + mTimerDoze.detach(); + mTimerDoze = null; + } } return !wlactive; } @@ -5783,16 +5707,16 @@ public final class BatteryStatsImpl extends BatteryStats { void readFromParcelLocked(TimeBase timeBase, TimeBase screenOffTimeBase, Parcel in) { mTimerPartial = readTimerFromParcel(WAKE_TYPE_PARTIAL, mPartialTimers, screenOffTimeBase, in); - mTimerFull = readTimerFromParcel(WAKE_TYPE_FULL, - mFullTimers, timeBase, in); - mTimerWindow = readTimerFromParcel(WAKE_TYPE_WINDOW, - mWindowTimers, timeBase, in); + mTimerFull = readTimerFromParcel(WAKE_TYPE_FULL, mFullTimers, timeBase, in); + mTimerWindow = readTimerFromParcel(WAKE_TYPE_WINDOW, mWindowTimers, timeBase, in); + mTimerDoze = readTimerFromParcel(WAKE_TYPE_DOZE, mDozeTimers, timeBase, in); } void writeToParcelLocked(Parcel out, long elapsedRealtimeUs) { Timer.writeTimerToParcel(out, mTimerPartial, elapsedRealtimeUs); Timer.writeTimerToParcel(out, mTimerFull, elapsedRealtimeUs); Timer.writeTimerToParcel(out, mTimerWindow, elapsedRealtimeUs); + Timer.writeTimerToParcel(out, mTimerDoze, elapsedRealtimeUs); } @Override @@ -5801,6 +5725,7 @@ public final class BatteryStatsImpl extends BatteryStats { case WAKE_TYPE_FULL: return mTimerFull; case WAKE_TYPE_PARTIAL: return mTimerPartial; case WAKE_TYPE_WINDOW: return mTimerWindow; + case WAKE_TYPE_DOZE: return mTimerDoze; default: throw new IllegalArgumentException("type = " + type); } } @@ -5832,6 +5757,13 @@ public final class BatteryStatsImpl extends BatteryStats { mTimerWindow = t; } return t; + case WAKE_TYPE_DOZE: + t = mTimerDoze; + if (t == null) { + t = new StopwatchTimer(Uid.this, WAKE_TYPE_DOZE, + mDozeTimers, mOnBatteryTimeBase); + mTimerDoze = t; + } default: throw new IllegalArgumentException("type=" + type); } @@ -6688,6 +6620,9 @@ public final class BatteryStatsImpl extends BatteryStats { if (in.readInt() != 0) { wl.getStopwatchTimer(WAKE_TYPE_WINDOW).readSummaryFromParcelLocked(in); } + if (in.readInt() != 0) { + wl.getStopwatchTimer(WAKE_TYPE_DOZE).readSummaryFromParcelLocked(in); + } } public StopwatchTimer getSensorTimerLocked(int sensor, boolean create) { @@ -7632,6 +7567,10 @@ public final class BatteryStatsImpl extends BatteryStats { * @param info The energy information from the WiFi controller. */ public void updateWifiStateLocked(@Nullable final WifiActivityEnergyInfo info) { + if (DEBUG_ENERGY) { + Slog.d(TAG, "Updating wifi stats"); + } + final long elapsedRealtimeMs = SystemClock.elapsedRealtime(); NetworkStats delta = null; try { @@ -7829,6 +7768,10 @@ public final class BatteryStatsImpl extends BatteryStats { * Distribute Cell radio energy info and network traffic to apps. */ public void updateMobileRadioStateLocked(final long elapsedRealtimeMs) { + if (DEBUG_ENERGY) { + Slog.d(TAG, "Updating mobile radio stats"); + } + NetworkStats delta = null; try { if (!ArrayUtils.isEmpty(mMobileIfaces)) { @@ -7901,6 +7844,10 @@ public final class BatteryStatsImpl extends BatteryStats { * @param info The energy information from the bluetooth controller. */ public void updateBluetoothStateLocked(@Nullable final BluetoothActivityEnergyInfo info) { + if (DEBUG_ENERGY) { + Slog.d(TAG, "Updating bluetooth stats"); + } + if (info != null && mOnBatteryInternal) { mHasBluetoothEnergyReporting = true; mBluetoothActivityCounters[CONTROLLER_RX_TIME].addCountLocked( @@ -7959,30 +7906,196 @@ public final class BatteryStatsImpl extends BatteryStats { } } + // We use an anonymous class to access these variables, + // so they can't live on the stack or they'd have to be + // final MutableLong objects (more allocations). + // Used in updateCpuTimeLocked(). + long mTempTotalCpuUserTimeUs; + long mTempTotalCpuSystemTimeUs; + /** - * Read and distribute CPU usage across apps. + * Read and distribute CPU usage across apps. If their are partial wakelocks being held + * and we are on battery with screen off, we give more of the cpu time to those apps holding + * wakelocks. If the screen is on, we just assign the actual cpu time an app used. */ - public void updateCpuTimeLocked(boolean firstTime) { + public void updateCpuTimeLocked() { + if (DEBUG_ENERGY_CPU) { + Slog.d(TAG, "!Cpu updating!"); + } + + // Holding a wakelock costs more than just using the cpu. + // Currently, we assign only half the cpu time to an app that is running but + // not holding a wakelock. The apps holding wakelocks get the rest of the blame. + // If no app is holding a wakelock, then the distribution is normal. + final int wakelockWeight = 50; + + // Read the time spent at various cpu frequencies. final int cpuSpeedSteps = getCpuSpeedSteps(); final long[] cpuSpeeds = mKernelCpuSpeedReader.readDelta(); - KernelUidCpuTimeReader.Callback callback = null; - if (mOnBatteryInternal && !firstTime) { - callback = new KernelUidCpuTimeReader.Callback() { - @Override - public void onUidCpuTime(int uid, long userTimeUs, long systemTimeUs) { - final Uid u = getUidStatsLocked(mapUid(uid)); - u.mUserCpuTime.addCountLocked(userTimeUs); - u.mSystemCpuTime.addCountLocked(systemTimeUs); - for (int i = 0; i < cpuSpeedSteps; i++) { - if (u.mSpeedBins[i] == null) { - u.mSpeedBins[i] = new LongSamplingCounter(mOnBatteryTimeBase); + + int numWakelocks = 0; + + // Calculate how many wakelocks we have to distribute amongst. The system is excluded. + // Only distribute cpu power to wakelocks if the screen is off and we're on battery. + final int numPartialTimers = mPartialTimers.size(); + if (mOnBatteryScreenOffTimeBase.isRunning()) { + for (int i = 0; i < numPartialTimers; i++) { + final StopwatchTimer timer = mPartialTimers.get(i); + if (timer.mInList && timer.mUid != null && timer.mUid.mUid != Process.SYSTEM_UID) { + // Since the collection and blaming of wakelocks can be scheduled to run after + // some delay, the mPartialTimers list may have new entries. We can't blame + // the newly added timer for past cpu time, so we only consider timers that + // were present for one round of collection. Once a timer has gone through + // a round of collection, its mInList field is set to true. + numWakelocks++; + } + } + } + + final int numWakelocksF = numWakelocks; + mTempTotalCpuUserTimeUs = 0; + mTempTotalCpuSystemTimeUs = 0; + + // Read the CPU data for each UID. This will internally generate a snapshot so next time + // we read, we get a delta. If we are to distribute the cpu time, then do so. Otherwise + // we just ignore the data. + final long startTimeMs = SystemClock.elapsedRealtime(); + mKernelUidCpuTimeReader.readDelta(!mOnBatteryInternal ? null : + new KernelUidCpuTimeReader.Callback() { + @Override + public void onUidCpuTime(int uid, long userTimeUs, long systemTimeUs) { + final Uid u = getUidStatsLocked(mapUid(uid)); + + // Accumulate the total system and user time. + mTempTotalCpuUserTimeUs += userTimeUs; + mTempTotalCpuSystemTimeUs += systemTimeUs; + + StringBuilder sb = null; + if (DEBUG_ENERGY_CPU) { + sb = new StringBuilder(); + sb.append(" got time for uid=").append(u.mUid).append(": u="); + TimeUtils.formatDuration(userTimeUs / 1000, sb); + sb.append(" s="); + TimeUtils.formatDuration(systemTimeUs / 1000, sb); + sb.append("\n"); + } + + if (numWakelocksF > 0) { + // We have wakelocks being held, so only give a portion of the + // time to the process. The rest will be distributed among wakelock + // holders. + userTimeUs = (userTimeUs * wakelockWeight) / 100; + systemTimeUs = (systemTimeUs * wakelockWeight) / 100; + } + + if (sb != null) { + sb.append(" adding to uid=").append(u.mUid).append(": u="); + TimeUtils.formatDuration(userTimeUs / 1000, sb); + sb.append(" s="); + TimeUtils.formatDuration(systemTimeUs / 1000, sb); + Slog.d(TAG, sb.toString()); + } + + u.mUserCpuTime.addCountLocked(userTimeUs); + u.mSystemCpuTime.addCountLocked(systemTimeUs); + + // Add the cpu speeds to this UID. These are used as a ratio + // for computing the power this UID used. + for (int i = 0; i < cpuSpeedSteps; i++) { + if (u.mSpeedBins[i] == null) { + u.mSpeedBins[i] = new LongSamplingCounter(mOnBatteryTimeBase); + } + u.mSpeedBins[i].addCountLocked(cpuSpeeds[i]); } - u.mSpeedBins[i].addCountLocked(cpuSpeeds[i]); } + }); + + if (DEBUG_ENERGY_CPU) { + Slog.d(TAG, "Reading cpu stats took " + (SystemClock.elapsedRealtime() - startTimeMs) + + " ms"); + } + + if (mOnBatteryInternal && numWakelocks > 0) { + // Distribute a portion of the total cpu time to wakelock holders. + mTempTotalCpuUserTimeUs = (mTempTotalCpuUserTimeUs * (100 - wakelockWeight)) / 100; + mTempTotalCpuSystemTimeUs = + (mTempTotalCpuSystemTimeUs * (100 - wakelockWeight)) / 100; + + for (int i = 0; i < numPartialTimers; i++) { + final StopwatchTimer timer = mPartialTimers.get(i); + + // The system does not share any blame, as it is usually holding the wakelock + // on behalf of an app. + if (timer.mInList && timer.mUid != null && timer.mUid.mUid != Process.SYSTEM_UID) { + int userTimeUs = (int) (mTempTotalCpuUserTimeUs / numWakelocks); + int systemTimeUs = (int) (mTempTotalCpuSystemTimeUs / numWakelocks); + + if (DEBUG_ENERGY_CPU) { + StringBuilder sb = new StringBuilder(); + sb.append(" Distributing wakelock uid=").append(timer.mUid.mUid) + .append(": u="); + TimeUtils.formatDuration(userTimeUs / 1000, sb); + sb.append(" s="); + TimeUtils.formatDuration(systemTimeUs / 1000, sb); + Slog.d(TAG, sb.toString()); + } + + timer.mUid.mUserCpuTime.addCountLocked(userTimeUs); + timer.mUid.mSystemCpuTime.addCountLocked(systemTimeUs); + + final Uid.Proc proc = timer.mUid.getProcessStatsLocked("*wakelock*"); + proc.addCpuTimeLocked(userTimeUs, systemTimeUs); + + mTempTotalCpuUserTimeUs -= userTimeUs; + mTempTotalCpuSystemTimeUs -= systemTimeUs; + numWakelocks--; } - }; + } + + if (mTempTotalCpuUserTimeUs > 0 || mTempTotalCpuSystemTimeUs > 0) { + // Anything left over is given to the system. + if (DEBUG_ENERGY_CPU) { + StringBuilder sb = new StringBuilder(); + sb.append(" Distributing lost time to system: u="); + TimeUtils.formatDuration(mTempTotalCpuUserTimeUs / 1000, sb); + sb.append(" s="); + TimeUtils.formatDuration(mTempTotalCpuSystemTimeUs / 1000, sb); + Slog.d(TAG, sb.toString()); + } + + final Uid u = getUidStatsLocked(Process.SYSTEM_UID); + u.mUserCpuTime.addCountLocked(mTempTotalCpuUserTimeUs); + u.mSystemCpuTime.addCountLocked(mTempTotalCpuSystemTimeUs); + + final Uid.Proc proc = u.getProcessStatsLocked("*lost*"); + proc.addCpuTimeLocked((int) mTempTotalCpuUserTimeUs, + (int) mTempTotalCpuSystemTimeUs); + } + } + + // See if there is a difference in wakelocks between this collection and the last + // collection. + if (ArrayUtils.referenceEquals(mPartialTimers, mLastPartialTimers)) { + // No difference, so each timer is now considered for the next collection. + for (int i = 0; i < numPartialTimers; i++) { + mPartialTimers.get(i).mInList = true; + } + } else { + // The lists are different, meaning we added (or removed a timer) since the last + // collection. + final int numLastPartialTimers = mLastPartialTimers.size(); + for (int i = 0; i < numLastPartialTimers; i++) { + mLastPartialTimers.get(i).mInList = false; + } + mLastPartialTimers.clear(); + + // Mark the current timers as gone through a collection. + for (int i = 0; i < numPartialTimers; i++) { + final StopwatchTimer timer = mPartialTimers.get(i); + timer.mInList = true; + mLastPartialTimers.add(timer); + } } - mKernelUidCpuTimeReader.readDelta(callback); } boolean setChargingLocked(boolean charging) { @@ -8157,6 +8270,12 @@ public final class BatteryStatsImpl extends BatteryStats { } } + private void scheduleSyncExternalWifiStatsLocked(String reason) { + if (mExternalSync != null) { + mExternalSync.scheduleWifiSync(reason); + } + } + // This should probably be exposed in the API, though it's not critical public static final int BATTERY_PLUGGED_NONE = 0; @@ -9491,6 +9610,12 @@ public final class BatteryStatsImpl extends BatteryStats { } else { out.writeInt(0); } + if (wl.mTimerDoze != null) { + out.writeInt(1); + wl.mTimerDoze.writeSummaryFromParcelLocked(out, NOWREAL_SYS); + } else { + out.writeInt(0); + } } final ArrayMap<String, StopwatchTimer> syncStats = u.mSyncStats.getMap(); diff --git a/core/java/com/android/internal/os/KernelUidCpuTimeReader.java b/core/java/com/android/internal/os/KernelUidCpuTimeReader.java index b2363786029c..62926d170632 100644 --- a/core/java/com/android/internal/os/KernelUidCpuTimeReader.java +++ b/core/java/com/android/internal/os/KernelUidCpuTimeReader.java @@ -16,9 +16,11 @@ package com.android.internal.os; import android.annotation.Nullable; +import android.os.SystemClock; import android.text.TextUtils; import android.util.Slog; import android.util.SparseLongArray; +import android.util.TimeUtils; import java.io.BufferedReader; import java.io.FileReader; @@ -49,6 +51,7 @@ public class KernelUidCpuTimeReader { private SparseLongArray mLastUserTimeUs = new SparseLongArray(); private SparseLongArray mLastSystemTimeUs = new SparseLongArray(); + private long mLastTimeRead = 0; /** * Reads the proc file, calling into the callback with a delta of time for each UID. @@ -57,6 +60,7 @@ public class KernelUidCpuTimeReader { * a fresh delta. */ public void readDelta(@Nullable Callback callback) { + long now = SystemClock.elapsedRealtime(); try (BufferedReader reader = new BufferedReader(new FileReader(sProcFile))) { TextUtils.SimpleStringSplitter splitter = new TextUtils.SimpleStringSplitter(' '); String line; @@ -75,10 +79,32 @@ public class KernelUidCpuTimeReader { userTimeDeltaUs -= mLastUserTimeUs.valueAt(index); systemTimeDeltaUs -= mLastSystemTimeUs.valueAt(index); - if (userTimeDeltaUs < 0 || systemTimeDeltaUs < 0) { - // The UID must have been removed from accounting, then added back. - userTimeDeltaUs = userTimeUs; - systemTimeDeltaUs = systemTimeUs; + final long timeDiffMs = (now - mLastTimeRead) * 1000; + if (userTimeDeltaUs < 0 || systemTimeDeltaUs < 0 || + userTimeDeltaUs > timeDiffMs || systemTimeDeltaUs > timeDiffMs ) { + StringBuilder sb = new StringBuilder("Malformed cpu data!\n"); + sb.append("Time between reads: "); + TimeUtils.formatDuration(timeDiffMs, sb); + sb.append("ms\n"); + sb.append("Previous times: u="); + TimeUtils.formatDuration(mLastUserTimeUs.valueAt(index) / 1000, sb); + sb.append("ms s="); + TimeUtils.formatDuration(mLastSystemTimeUs.valueAt(index) / 1000, sb); + sb.append("ms\n"); + sb.append("Current times: u="); + TimeUtils.formatDuration(userTimeUs / 1000, sb); + sb.append("ms s="); + TimeUtils.formatDuration(systemTimeUs / 1000, sb); + sb.append("ms\n"); + sb.append("Delta for UID=").append(uid).append(": u="); + TimeUtils.formatDuration(userTimeDeltaUs / 1000, sb); + sb.append("ms s="); + TimeUtils.formatDuration(systemTimeDeltaUs / 1000, sb); + sb.append("ms"); + Slog.wtf(TAG, sb.toString()); + + userTimeDeltaUs = 0; + systemTimeDeltaUs = 0; } } @@ -92,6 +118,7 @@ public class KernelUidCpuTimeReader { } catch (IOException e) { Slog.e(TAG, "Failed to read uid_cputime", e); } + mLastTimeRead = now; } /** diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java index 4f6d78187578..c97fdf46cda9 100644 --- a/core/java/com/android/internal/os/Zygote.java +++ b/core/java/com/android/internal/os/Zygote.java @@ -41,8 +41,8 @@ public final class Zygote { public static final int DEBUG_ENABLE_JNI_LOGGING = 1 << 4; /** enable the JIT compiler */ public static final int DEBUG_ENABLE_JIT = 1 << 5; - /** Force generation of CFI code */ - public static final int DEBUG_GENERATE_CFI = 1 << 6; + /** Force generation of native debugging information. */ + public static final int DEBUG_GENERATE_DEBUG_INFO = 1 << 6; /** No external storage should be mounted. */ public static final int MOUNT_EXTERNAL_NONE = 0; diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java index 1a0345bcac04..fa870b9ddedf 100644 --- a/core/java/com/android/internal/os/ZygoteConnection.java +++ b/core/java/com/android/internal/os/ZygoteConnection.java @@ -322,7 +322,7 @@ class ZygoteConnection { /** * From --enable-debugger, --enable-checkjni, --enable-assert, - * --enable-safemode, --enable-jit, --generate-cfi and --enable-jni-logging. + * --enable-safemode, --enable-jit, --generate-debug-info and --enable-jni-logging. */ int debugFlags; @@ -434,8 +434,8 @@ class ZygoteConnection { debugFlags |= Zygote.DEBUG_ENABLE_CHECKJNI; } else if (arg.equals("--enable-jit")) { debugFlags |= Zygote.DEBUG_ENABLE_JIT; - } else if (arg.equals("--generate-cfi")) { - debugFlags |= Zygote.DEBUG_GENERATE_CFI; + } else if (arg.equals("--generate-debug-info")) { + debugFlags |= Zygote.DEBUG_GENERATE_DEBUG_INFO; } else if (arg.equals("--enable-jni-logging")) { debugFlags |= Zygote.DEBUG_ENABLE_JNI_LOGGING; } else if (arg.equals("--enable-assert")) { diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 66f6079b47e9..15ed5bd0b539 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -3223,12 +3223,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { cb.onWindowFocusChanged(hasWindowFocus); } - if (mFloatingToolbar != null) { - if (hasWindowFocus) { - mFloatingToolbar.show(); - } else { - mFloatingToolbar.dismiss(); - } + if (mPrimaryActionMode != null) { + mPrimaryActionMode.onWindowFocusChanged(hasWindowFocus); + } + if (mFloatingActionMode != null) { + mFloatingActionMode.onWindowFocusChanged(hasWindowFocus); } } @@ -3441,8 +3440,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { mFloatingActionMode = mode; mFloatingToolbar = new FloatingToolbar(mContext, PhoneWindow.this); ((FloatingActionMode) mFloatingActionMode).setFloatingToolbar(mFloatingToolbar); - mFloatingActionMode.invalidate(); - mFloatingToolbar.show(); + mFloatingActionMode.invalidate(); // Will show the floating toolbar if necessary. mFloatingActionModeOriginatingView.getViewTreeObserver() .addOnPreDrawListener(mFloatingToolbarPreDrawListener); } diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index 9f99f6235787..0732addb7356 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -64,5 +64,7 @@ oneway interface IStatusBar * bar caused by this app transition in millis */ void appTransitionStarting(long statusBarAnimationsStartTime, long statusBarAnimationsDuration); + + void showAssistDisclosure(); } diff --git a/core/java/com/android/internal/statusbar/StatusBarIcon.java b/core/java/com/android/internal/statusbar/StatusBarIcon.java index 4693d4b7c840..1d626235c4d2 100644 --- a/core/java/com/android/internal/statusbar/StatusBarIcon.java +++ b/core/java/com/android/internal/statusbar/StatusBarIcon.java @@ -20,17 +20,27 @@ import android.graphics.drawable.Icon; import android.os.Parcel; import android.os.Parcelable; import android.os.UserHandle; +import android.text.TextUtils; public class StatusBarIcon implements Parcelable { public UserHandle user; + public String pkg; public Icon icon; public int iconLevel; public boolean visible = true; public int number; public CharSequence contentDescription; - public StatusBarIcon(UserHandle user, Icon icon, int iconLevel, int number, + public StatusBarIcon(UserHandle user, String resPackage, Icon icon, int iconLevel, int number, CharSequence contentDescription) { + if (icon.getType() == Icon.TYPE_RESOURCE + && TextUtils.isEmpty(icon.getResPackage())) { + // This is an odd situation where someone's managed to hand us an icon without a + // package inside, probably by mashing an int res into a Notification object. + // Now that we have the correct package name handy, let's fix it. + icon = Icon.createWithResource(resPackage, icon.getResId()); + } + this.pkg = resPackage; this.user = user; this.icon = icon; this.iconLevel = iconLevel; @@ -41,21 +51,23 @@ public class StatusBarIcon implements Parcelable { public StatusBarIcon(String iconPackage, UserHandle user, int iconId, int iconLevel, int number, CharSequence contentDescription) { - this(user, Icon.createWithResource(iconPackage, iconId), + this(user, iconPackage, Icon.createWithResource(iconPackage, iconId), iconLevel, number, contentDescription); } @Override public String toString() { - return "StatusBarIcon(icon=" + this.icon + return "StatusBarIcon(icon=" + icon + + ((iconLevel != 0)?(" level=" + iconLevel):"") + + (visible?" visible":"") + " user=" + user.getIdentifier() - + " level=" + this.iconLevel + " visible=" + visible - + " num=" + this.number + " )"; + + ((number != 0)?(" num=" + number):"") + + " )"; } @Override public StatusBarIcon clone() { - StatusBarIcon that = new StatusBarIcon(this.user, this.icon, + StatusBarIcon that = new StatusBarIcon(this.user, this.pkg, this.icon, this.iconLevel, this.number, this.contentDescription); that.visible = this.visible; return that; @@ -70,6 +82,7 @@ public class StatusBarIcon implements Parcelable { public void readFromParcel(Parcel in) { this.icon = (Icon) in.readParcelable(null); + this.pkg = in.readString(); this.user = (UserHandle) in.readParcelable(null); this.iconLevel = in.readInt(); this.visible = in.readInt() != 0; @@ -79,6 +92,7 @@ public class StatusBarIcon implements Parcelable { public void writeToParcel(Parcel out, int flags) { out.writeParcelable(this.icon, 0); + out.writeString(this.pkg); out.writeParcelable(this.user, 0); out.writeInt(this.iconLevel); out.writeInt(this.visible ? 1 : 0); diff --git a/core/java/com/android/internal/util/ArrayUtils.java b/core/java/com/android/internal/util/ArrayUtils.java index 62e724aba553..9d0636a744d8 100644 --- a/core/java/com/android/internal/util/ArrayUtils.java +++ b/core/java/com/android/internal/util/ArrayUtils.java @@ -387,4 +387,26 @@ public class ArrayUtils { public static <T> boolean contains(ArrayList<T> cur, T val) { return (cur != null) ? cur.contains(val) : false; } + + /** + * Returns true if the two ArrayLists are equal with respect to the objects they contain. + * The objects must be in the same order and be reference equal (== not .equals()). + */ + public static <T> boolean referenceEquals(ArrayList<T> a, ArrayList<T> b) { + if (a == b) { + return true; + } + + final int sizeA = a.size(); + final int sizeB = b.size(); + if (a == null || b == null || sizeA != sizeB) { + return false; + } + + boolean diff = false; + for (int i = 0; i < sizeA && !diff; i++) { + diff |= a.get(i) != b.get(i); + } + return !diff; + } } diff --git a/core/java/com/android/internal/view/FloatingActionMode.java b/core/java/com/android/internal/view/FloatingActionMode.java index 784b256728ca..863506b0a63a 100644 --- a/core/java/com/android/internal/view/FloatingActionMode.java +++ b/core/java/com/android/internal/view/FloatingActionMode.java @@ -197,6 +197,13 @@ public class FloatingActionMode extends ActionMode { } @Override + public void onWindowFocusChanged(boolean hasWindowFocus) { + checkToolbarInitialized(); + mFloatingToolbarVisibilityHelper.setWindowFocused(hasWindowFocus); + mFloatingToolbarVisibilityHelper.updateToolbarVisibility(); + } + + @Override public void finish() { checkToolbarInitialized(); reset(); @@ -237,6 +244,7 @@ public class FloatingActionMode extends ActionMode { } private void reset() { + mFloatingToolbar.dismiss(); mFloatingToolbarVisibilityHelper.deactivate(); mOriginatingView.removeCallbacks(mMovingOff); mOriginatingView.removeCallbacks(mHideOff); @@ -253,6 +261,7 @@ public class FloatingActionMode extends ActionMode { private boolean mHideRequested; private boolean mMoving; private boolean mOutOfBounds; + private boolean mWindowFocused = true; private boolean mActive; @@ -264,6 +273,7 @@ public class FloatingActionMode extends ActionMode { mHideRequested = false; mMoving = false; mOutOfBounds = false; + mWindowFocused = true; mActive = true; } @@ -285,12 +295,16 @@ public class FloatingActionMode extends ActionMode { mOutOfBounds = outOfBounds; } + public void setWindowFocused(boolean windowFocused) { + mWindowFocused = windowFocused; + } + public void updateToolbarVisibility() { if (!mActive) { return; } - if (mHideRequested || mMoving || mOutOfBounds) { + if (mHideRequested || mMoving || mOutOfBounds || !mWindowFocused) { mToolbar.hide(); } else { mToolbar.show(); diff --git a/core/java/com/android/internal/view/IInputConnectionWrapper.java b/core/java/com/android/internal/view/IInputConnectionWrapper.java index e19b2b60be5d..85ec29c4634c 100644 --- a/core/java/com/android/internal/view/IInputConnectionWrapper.java +++ b/core/java/com/android/internal/view/IInputConnectionWrapper.java @@ -409,8 +409,8 @@ public class IInputConnectionWrapper extends IInputContext.Stub { } case DO_REPORT_FULLSCREEN_MODE: { InputConnection ic = mInputConnection.get(); - if (ic == null || !isActive()) { - Log.w(TAG, "showStatusIcon on inactive InputConnection"); + if (ic == null) { + Log.w(TAG, "reportFullscreenMode on inexistent InputConnection"); return; } ic.reportFullscreenMode(msg.arg1 == 1); diff --git a/core/java/com/android/internal/widget/FloatingToolbar.java b/core/java/com/android/internal/widget/FloatingToolbar.java index 65f2f53f8987..523663c0e6e4 100644 --- a/core/java/com/android/internal/widget/FloatingToolbar.java +++ b/core/java/com/android/internal/widget/FloatingToolbar.java @@ -546,25 +546,25 @@ public final class FloatingToolbar { private void refreshCoordinatesAndOverflowDirection(Rect contentRect) { refreshViewPort(); - int availableHeightAboveContent = - contentRect.top - mViewPort.top - 2 * mMarginVertical; - int availableHeightBelowContent = - mViewPort.bottom - contentRect.bottom - 2 * mMarginVertical; - int availableHeightThroughContent = - mViewPort.bottom - contentRect.top + getToolbarHeightWithVerticalMargin(); - int x = contentRect.centerX() - getWidth() / 2; // Update x so that the toolbar isn't rendered behind the nav bar in landscape. x = Math.max(0, Math.min(x, mViewPort.right - getWidth())); int y; + + int availableHeightAboveContent = contentRect.top - mViewPort.top; + int availableHeightBelowContent = mViewPort.bottom - contentRect.bottom; + if (mOverflowPanel == null) { // There is no overflow. - if (availableHeightAboveContent > getToolbarHeightWithVerticalMargin()) { + if (availableHeightAboveContent >= getToolbarHeightWithVerticalMargin()) { // There is enough space at the top of the content. y = contentRect.top - getToolbarHeightWithVerticalMargin(); - } else if (availableHeightBelowContent > getToolbarHeightWithVerticalMargin()) { + } else if (availableHeightBelowContent >= getToolbarHeightWithVerticalMargin()) { // There is enough space at the bottom of the content. y = contentRect.bottom; + } else if (availableHeightBelowContent >= getEstimatedToolbarHeight(getContext())) { + // Just enough space to fit the toolbar with no vertical margins. + y = contentRect.bottom - mMarginVertical; } else { // Not enough space. Prefer to position as high as possible. y = Math.max( @@ -572,32 +572,47 @@ public final class FloatingToolbar { contentRect.top - getToolbarHeightWithVerticalMargin()); } } else { // There is an overflow. - if (availableHeightAboveContent > mOverflowPanel.getMinimumHeight()) { + int margin = 2 * mMarginVertical; + int minimumOverflowHeightWithMargin = mOverflowPanel.getMinimumHeight() + margin; + int availableHeightThroughContentDown = + mViewPort.bottom - contentRect.top + getToolbarHeightWithVerticalMargin(); + int availableHeightThroughContentUp = + contentRect.bottom - mViewPort.top + getToolbarHeightWithVerticalMargin(); + + if (availableHeightAboveContent >= minimumOverflowHeightWithMargin) { // There is enough space at the top of the content rect for the overflow. // Position above and open upwards. - updateOverflowHeight(availableHeightAboveContent); + updateOverflowHeight(availableHeightAboveContent - margin); y = contentRect.top - getHeight(); mOverflowDirection = OVERFLOW_DIRECTION_UP; - } else if (availableHeightAboveContent > getToolbarHeightWithVerticalMargin() - && availableHeightThroughContent > mOverflowPanel.getMinimumHeight()) { + } else if (availableHeightAboveContent >= getToolbarHeightWithVerticalMargin() + && availableHeightThroughContentDown >= minimumOverflowHeightWithMargin) { // There is enough space at the top of the content rect for the main panel // but not the overflow. // Position above but open downwards. - updateOverflowHeight(availableHeightThroughContent); + updateOverflowHeight(availableHeightThroughContentDown - margin); y = contentRect.top - getToolbarHeightWithVerticalMargin(); mOverflowDirection = OVERFLOW_DIRECTION_DOWN; - } else if (availableHeightBelowContent > mOverflowPanel.getMinimumHeight()) { + } else if (availableHeightBelowContent >= minimumOverflowHeightWithMargin) { // There is enough space at the bottom of the content rect for the overflow. // Position below and open downwards. - updateOverflowHeight(availableHeightBelowContent); + updateOverflowHeight(availableHeightBelowContent - margin); y = contentRect.bottom; mOverflowDirection = OVERFLOW_DIRECTION_DOWN; + } else if (availableHeightBelowContent >= getToolbarHeightWithVerticalMargin() + && mViewPort.height() >= minimumOverflowHeightWithMargin) { + // There is enough space at the bottom of the content rect for the main panel + // but not the overflow. + // Position below but open upwards. + updateOverflowHeight(availableHeightThroughContentUp - margin); + y = contentRect.bottom + getToolbarHeightWithVerticalMargin() - getHeight(); + mOverflowDirection = OVERFLOW_DIRECTION_UP; } else { // Not enough space. - // Position at the bottom of the view port and open upwards. - updateOverflowHeight(mViewPort.height()); - y = mViewPort.bottom - getHeight(); - mOverflowDirection = OVERFLOW_DIRECTION_UP; + // Position at the top of the view port and open downwards. + updateOverflowHeight(mViewPort.height() - margin); + y = mViewPort.top; + mOverflowDirection = OVERFLOW_DIRECTION_DOWN; } mOverflowPanel.setOverflowDirection(mOverflowDirection); } @@ -1422,7 +1437,6 @@ public final class FloatingToolbar { PopupWindow popupWindow = new PopupWindow(popupContentHolder); popupWindow.setWindowLayoutType( WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL); - popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED); popupWindow.setAnimationStyle(0); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); content.setLayoutParams(new ViewGroup.LayoutParams( diff --git a/core/java/com/android/internal/widget/ResolverDrawerLayout.java b/core/java/com/android/internal/widget/ResolverDrawerLayout.java index be727f17ce9e..585cbc943788 100644 --- a/core/java/com/android/internal/widget/ResolverDrawerLayout.java +++ b/core/java/com/android/internal/widget/ResolverDrawerLayout.java @@ -127,6 +127,8 @@ public class ResolverDrawerLayout extends ViewGroup { final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity(); + + setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); } public void setSmallCollapsed(boolean smallCollapsed) { @@ -593,11 +595,6 @@ public class ResolverDrawerLayout extends ViewGroup { } @Override - public CharSequence getAccessibilityClassName() { - return ResolverDrawerLayout.class.getName(); - } - - @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if (isEnabled()) { diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 7c2b28dcc2b1..2c35a8be98c2 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -876,16 +876,16 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) "-Xzygote-max-boot-retry="); /* - * When running with debug.gencfi, add --include-cfi to the compiler options so that the boot - * image, if it is compiled on device, will include CFI info, as well as other compilations - * started by the runtime. + * When running with debug.generate-debug-info, add --generate-debug-info to + * the compiler options so that the boot image, if it is compiled on device, + * will include native debugging information. */ - property_get("debug.gencfi", propBuf, ""); + property_get("debug.generate-debug-info", propBuf, ""); if (strcmp(propBuf, "true") == 0) { addOption("-Xcompiler-option"); - addOption("--include-cfi"); + addOption("--generate-debug-info"); addOption("-Ximage-compiler-option"); - addOption("--include-cfi"); + addOption("--generate-debug-info"); } initArgs.version = JNI_VERSION_1_4; diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp index 9f2181f0a791..91b3278c2e2b 100644 --- a/core/jni/android_media_AudioSystem.cpp +++ b/core/jni/android_media_AudioSystem.cpp @@ -856,7 +856,8 @@ static jint convertAudioPortFromNative(JNIEnv *env, bool useInMask; size_t numPositionMasks = 0; size_t numIndexMasks = 0; - size_t numUniqueFormats; + size_t numUniqueFormats = 0; + ALOGV("convertAudioPortFromNative id %d role %d type %d name %s", nAudioPort->id, nAudioPort->role, nAudioPort->type, nAudioPort->name); @@ -907,12 +908,13 @@ static jint convertAudioPortFromNative(JNIEnv *env, } // formats - cFormats = new int[nAudioPort->num_formats]; - numUniqueFormats = 0; - for (size_t index = 0; index < nAudioPort->num_formats; index++) { - int format = audioFormatFromNative(nAudioPort->formats[index]); - if (!hasFormat(cFormats, numUniqueFormats, format)) { - cFormats[numUniqueFormats++] = format; + if (nAudioPort->num_formats != 0) { + cFormats = new int[nAudioPort->num_formats]; + for (size_t index = 0; index < nAudioPort->num_formats; index++) { + int format = audioFormatFromNative(nAudioPort->formats[index]); + if (!hasFormat(cFormats, numUniqueFormats, format)) { + cFormats[numUniqueFormats++] = format; + } } } jFormats = env->NewIntArray(numUniqueFormats); @@ -920,7 +922,9 @@ static jint convertAudioPortFromNative(JNIEnv *env, jStatus = (jint)AUDIO_JAVA_ERROR; goto exit; } - env->SetIntArrayRegion(jFormats, 0, numUniqueFormats, cFormats); + if (numUniqueFormats != 0) { + env->SetIntArrayRegion(jFormats, 0, numUniqueFormats, cFormats); + } // gains jGains = env->NewObjectArray(nAudioPort->num_gains, diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 65c064b0c5cb..c2e8c8b19da3 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -242,6 +242,7 @@ <protected-broadcast android:name="android.intent.action.DATA_CONNECTION_CONNECTED_TO_PROVISIONING_APN" /> <protected-broadcast android:name="com.android.server.WifiManager.action.START_SCAN" /> + <protected-broadcast android:name="com.android.server.WifiManager.action.START_PNO" /> <protected-broadcast android:name="com.android.server.WifiManager.action.DELAYED_DRIVER_STOP" /> <protected-broadcast android:name="android.net.wifi.WIFI_STATE_CHANGED" /> <protected-broadcast android:name="android.net.wifi.WIFI_AP_STATE_CHANGED" /> @@ -316,8 +317,6 @@ <protected-broadcast android:name="android.intent.action.ACTION_SET_RADIO_CAPABILITY_FAILED" /> <protected-broadcast android:name="android.internal.policy.action.BURN_IN_PROTECTION" /> - <protected-broadcast android:name="android.service.persistentdata.action.WIPE_IF_ALLOWED" /> - <protected-broadcast android:name="android.app.action.SYSTEM_UPDATE_POLICY_CHANGED" /> <!-- ====================================================================== --> <!-- RUNTIME PERMISSIONS --> @@ -1342,6 +1341,11 @@ android:description="@string/permdesc_killBackgroundProcesses" android:protectionLevel="normal" /> + <!-- @SystemApi @hide Allows an application to retrieve a package's importance. + This permission is not available to third party applications. --> + <permission android:name="android.permission.GET_PACKAGE_IMPORTANCE" + android:protectionLevel="signature|system" /> + <!-- ================================== --> <!-- Permissions affecting the display of other applications --> <!-- ================================== --> @@ -2435,8 +2439,7 @@ android:backupAgent="com.android.server.backup.SystemBackupAgent" android:killAfterRestore="false" android:icon="@drawable/ic_launcher_android" - android:supportsRtl="true" - android:theme="@style/Theme.Material.DayNight.DarkActionBar"> + android:supportsRtl="true"> <activity android:name="com.android.internal.app.ChooserActivity" android:theme="@style/Theme.DeviceDefault.Resolver" android:finishOnCloseSystemDialogs="true" @@ -2469,7 +2472,7 @@ android:label="@string/managed_profile_label"> </activity-alias> <activity android:name="com.android.internal.app.HeavyWeightSwitcherActivity" - android:theme="@style/Theme.Material.DayNight.Dialog" + android:theme="@style/Theme.Material.Light.Dialog" android:label="@string/heavy_weight_switcher_title" android:finishOnCloseSystemDialogs="true" android:excludeFromRecents="true" @@ -2502,7 +2505,7 @@ <activity android:name="android.accounts.ChooseAccountActivity" android:excludeFromRecents="true" android:exported="true" - android:theme="@style/Theme.Material.DayNight.Dialog" + android:theme="@style/Theme.Material.Light.Dialog" android:label="@string/choose_account_label" android:process=":ui"> </activity> @@ -2510,14 +2513,14 @@ <activity android:name="android.accounts.ChooseTypeAndAccountActivity" android:excludeFromRecents="true" android:exported="true" - android:theme="@style/Theme.Material.DayNight.Dialog" + android:theme="@style/Theme.Material.Light.Dialog" android:label="@string/choose_account_label" android:process=":ui"> </activity> <activity android:name="android.accounts.ChooseAccountTypeActivity" android:excludeFromRecents="true" - android:theme="@style/Theme.Material.DayNight.Dialog" + android:theme="@style/Theme.Material.Light.Dialog" android:label="@string/choose_account_label" android:process=":ui"> </activity> @@ -2525,19 +2528,19 @@ <activity android:name="android.accounts.CantAddAccountActivity" android:excludeFromRecents="true" android:exported="true" - android:theme="@style/Theme.Material.DayNight.Dialog.NoActionBar" + android:theme="@style/Theme.Material.Light.Dialog.NoActionBar" android:process=":ui"> </activity> <activity android:name="android.accounts.GrantCredentialsPermissionActivity" android:excludeFromRecents="true" android:exported="true" - android:theme="@style/Theme.Material.DayNight.DialogWhenLarge" + android:theme="@style/Theme.Material.Light.DialogWhenLarge" android:process=":ui"> </activity> <activity android:name="android.content.SyncActivityTooManyDeletes" - android:theme="@style/Theme.Material.DayNight.Dialog" + android:theme="@style/Theme.Material.Light.Dialog" android:label="@string/sync_too_many_deletes" android:process=":ui"> </activity> @@ -2557,7 +2560,7 @@ </activity> <activity android:name="com.android.internal.app.NetInitiatedActivity" - android:theme="@style/Theme.Material.DayNight.Dialog.Alert" + android:theme="@style/Theme.Material.Light.Dialog.Alert" android:excludeFromRecents="true" android:process=":ui"> </activity> diff --git a/core/res/res/values-mcc302-mnc220/config.xml b/core/res/res/values-mcc302-mnc220/config.xml index 9147cbf661c4..09a63aac27fd 100644 --- a/core/res/res/values-mcc302-mnc220/config.xml +++ b/core/res/res/values-mcc302-mnc220/config.xml @@ -38,7 +38,8 @@ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" --> <string-array translatable="false" name="config_tether_apndata"> <item>[ApnSettingV3]TELUS ISP,isp.telus.com,,,,,,,,,302,220,,DUN,,,true,0,,,,,,,gid,54</item> - <item>[ApnSettingV3]Tethered PC Mobile,isp.mb.com,,,,,,,,,302,220,,DUN,,,true,0,,,,,,,gid,50</item> + <item>[ApnSettingV3]Tethered Mobile Internet,isp.mb.com,,,,,,,,,302,220,,DUN,,,true,0,,,,,,,gid,50</item> + <item>[ApnSettingV3]Tethered Public Mobile,isp.mb.com,,,,,,,,,302,220,,DUN,,,true,0,,,,,,,gid,4D4F</item> </string-array> </resources> diff --git a/core/res/res/values-mcc302-mnc720/config.xml b/core/res/res/values-mcc302-mnc720/config.xml index a83107aab650..dcfa5c546156 100644 --- a/core/res/res/values-mcc302-mnc720/config.xml +++ b/core/res/res/values-mcc302-mnc720/config.xml @@ -29,6 +29,8 @@ <string-array translatable="false" name="config_tether_apndata"> <item>Rogers LTE Tethering,ltedata.apn,,,,,,,,,302,720,,DUN</item> <item>[ApnSettingV3]chatr Tethering,chatrisp.apn,,,,,,,,,302,720,,DUN,,,true,0,,,,,,,imsi,302720x94</item> + <item>[ApnSettingV3]Tbaytel Tethering,ltedata.apn,,,,,,,,,302,720,,DUN,IPV4V6,IP,true,0,,,,,,,gid,BA</item> + <item>[ApnSettingV3]Cityfone Tethering,ltedata.apn,,,,,,,,,302,720,,DUN,IPV4V6,IP,true,0,,,,,,,spn,CITYFONE</item> </string-array> <!-- Configure mobile network MTU. Carrier specific value is set here. diff --git a/core/res/res/values-night/themes_material_daynight.xml b/core/res/res/values-night/themes_material_daynight.xml deleted file mode 100644 index b34458295ba3..000000000000 --- a/core/res/res/values-night/themes_material_daynight.xml +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> - -<!-- -=============================================================== - PLEASE READ -=============================================================== - -The Material themes must not be modified in order to pass CTS. -Many related themes and styles depend on other values defined in this file. -If you would like to provide custom themes and styles for your device, -please see themes_device_defaults.xml. - -=============================================================== - PLEASE READ -=============================================================== - --> -<resources> - - <!-- Material theme (day/night version) for activities. --> - <style name="Theme.Material.DayNight" parent="Theme.Material" /> - - <!-- Variant of Material.DayNight that has a solid (opaque) action bar - with an inverse color profile. The dark action bar sharply stands out against - the light content (when applicable). --> - <style name="Theme.Material.DayNight.DarkActionBar" parent="Theme.Material" /> - - <!-- Variant of Material.DayNight with no action bar. --> - <style name="Theme.Material.DayNight.NoActionBar" parent="Theme.Material.NoActionBar" /> - - <!-- Variant of Material.DayNight that has no title bar and fills - the entire screen. This theme - sets {@link android.R.attr#windowFullscreen} to true. --> - <style name="Theme.Material.DayNight.NoActionBar.Fullscreen" parent="Theme.Material.NoActionBar.Fullscreen" /> - - <!-- Variant of Material.DayNight that has no title bar and fills - the entire screen and extends into the display overscan region. This theme - sets {@link android.R.attr#windowFullscreen} and {@link android.R.attr#windowOverscan} - to true. --> - <style name="Theme.Material.DayNight.NoActionBar.Overscan" parent="Theme.Material.NoActionBar.Overscan" /> - - <!-- Variant of Material.DayNight that has no title bar and translucent - system decor. This theme sets {@link android.R.attr#windowTranslucentStatus} and - {@link android.R.attr#windowTranslucentNavigation} to true. --> - <style name="Theme.Material.DayNight.NoActionBar.TranslucentDecor" parent="Theme.Material.NoActionBar.TranslucentDecor" /> - - <!-- Default Material.DayNight theme for panel windows. This removes all extraneous - window decorations, so you basically have an empty rectangle in which - to place your content. It makes the window floating, with a transparent - background, and turns off dimming behind the window. --> - <style name="Theme.Material.DayNight.Panel" parent="Theme.Material.Panel" /> - - <!-- Material theme (day/night version) for dialog windows and activities, - which is used by the {@link android.app.Dialog} class. This changes - the window to be floating (not fill the entire screen), and puts a - frame around its contents. You can set this theme on an activity if - you would like to make an activity that looks like a Dialog. --> - <style name="Theme.Material.DayNight.Dialog" parent="Theme.Material.DayNight.BaseDialog" /> - <style name="Theme.Material.DayNight.BaseDialog" parent="Theme.Material.BaseDialog" /> - - <!-- Variant of Theme.Material.DayNight.Dialog that has a nice minimum width for - a regular dialog. --> - <style name="Theme.Material.DayNight.Dialog.MinWidth" parent="Theme.Material.Dialog.MinWidth" /> - - <!-- Variant of Theme.Material.DayNight.Dialog that does not include a title bar. --> - <style name="Theme.Material.DayNight.Dialog.NoActionBar" parent="Theme.Material.Dialog.NoActionBar" /> - - <!-- Variant of Theme.Material.DayNight.Dialog.NoActionBar that has a nice minimum width for - a regular dialog. --> - <style name="Theme.Material.DayNight.Dialog.NoActionBar.MinWidth" parent="Theme.Material.Dialog.NoActionBar.MinWidth" /> - - <!-- Variant of Theme.Material.DayNight.Dialog that has a fixed size. --> - <style name="Theme.Material.DayNight.Dialog.FixedSize" parent="Theme.Material.Dialog.FixedSize" /> - - <!-- Variant of Theme.Material.DayNight.Dialog.NoActionBar that has a fixed size. --> - <style name="Theme.Material.DayNight.Dialog.NoActionBar.FixedSize" parent="Theme.Material.Dialog.NoActionBar.FixedSize" /> - - <!-- Theme for a window that will be displayed either full-screen on - smaller screens (small, normal) or as a dialog on larger screens - (large, xlarge). --> - <style name="Theme.Material.DayNight.DialogWhenLarge" parent="Theme.Material.DialogWhenLarge" /> - - <!-- Theme for a window with a dark action bar that will be displayed - either full-screen on smaller screens (small, normal) or as a dialog - on larger screens (large, xlarge). --> - <style name="Theme.Material.DayNight.DialogWhenLarge.DarkActionBar" parent="Theme.Material.DialogWhenLarge" /> - - <!-- Theme for a window without an action bar that will be displayed either full-screen - on smaller screens (small, normal) or as a dialog on larger screens - (large, xlarge). --> - <style name="Theme.Material.DayNight.DialogWhenLarge.NoActionBar" parent="Theme.Material.DialogWhenLarge.NoActionBar" /> - - <!-- Theme for a presentation window on a secondary display. --> - <style name="Theme.Material.DayNight.Dialog.Presentation" parent="Theme.Material.Dialog.Presentation" /> - - <!-- Material user theme for alert dialog windows, which is used by the - {@link android.app.AlertDialog} class. --> - <style name="Theme.Material.DayNight.Dialog.Alert" parent="Theme.Material.DayNight.Dialog.BaseAlert" /> - <style name="Theme.Material.DayNight.Dialog.BaseAlert" parent="Theme.Material.Dialog.BaseAlert" /> - - <style name="Theme.Material.DayNight.SearchBar" parent="Theme.Material.SearchBar" /> - <style name="Theme.Material.DayNight.CompactMenu" parent="Theme.Material.CompactMenu" /> - -</resources> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 7272ae304384..424a0b7d219d 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2031,10 +2031,8 @@ string that's stored in 8-bit unpacked format) characters.--> <bool translatable="false" name="config_sms_decode_gsm_8bit_data">false</bool> - <!-- List of package names (ordered by preference) providing WebView implementations. --> - <string-array name="config_webViewPackageNames" translatable="false"> - <item>com.android.webview</item> - </string-array> + <!-- Package name providing WebView implementation. --> + <string name="config_webViewPackageName" translatable="false">com.android.webview</string> <!-- If EMS is not supported, framework breaks down EMS into single segment SMS and adds page info " x/y". This config is used to set which carrier doesn't diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 65fa36b854b8..ab798bbb24b6 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2631,27 +2631,41 @@ <public type="attr" name="fullBackupContent" /> <public type="style" name="Widget.Material.Button.Colored" /> - <public type="style" name="Theme.Material.DayNight" /> - <public type="style" name="Theme.Material.DayNight.DarkActionBar" /> - <public type="style" name="Theme.Material.DayNight.Dialog" /> - <public type="style" name="Theme.Material.DayNight.Dialog.Alert" /> - <public type="style" name="Theme.Material.DayNight.Dialog.MinWidth" /> - <public type="style" name="Theme.Material.DayNight.Dialog.NoActionBar" /> - <public type="style" name="Theme.Material.DayNight.Dialog.NoActionBar.MinWidth" /> - <public type="style" name="Theme.Material.DayNight.Dialog.Presentation" /> - <public type="style" name="Theme.Material.DayNight.DialogWhenLarge" /> - <public type="style" name="Theme.Material.DayNight.DialogWhenLarge.NoActionBar" /> - <public type="style" name="Theme.Material.DayNight.NoActionBar" /> - <public type="style" name="Theme.Material.DayNight.NoActionBar.Fullscreen" /> - <public type="style" name="Theme.Material.DayNight.NoActionBar.Overscan" /> - <public type="style" name="Theme.Material.DayNight.NoActionBar.TranslucentDecor" /> - <public type="style" name="Theme.Material.DayNight.Panel" /> + + <style name="__reserved8" /> + <public type="style" name="__reserved8" /> + <style name="__reserved9" /> + <public type="style" name="__reserved9" /> + <style name="__reserved10" /> + <public type="style" name="__reserved10" /> + <style name="__reserved11" /> + <public type="style" name="__reserved11" /> + <style name="__reserved12" /> + <public type="style" name="__reserved12" /> + <style name="__reserved13" /> + <public type="style" name="__reserved13" /> + <style name="__reserved14" /> + <public type="style" name="__reserved14" /> + <style name="__reserved15" /> + <public type="style" name="__reserved15" /> + <style name="__reserved16" /> + <public type="style" name="__reserved16" /> + <style name="__reserved17" /> + <public type="style" name="__reserved17" /> + <style name="__reserved18" /> + <public type="style" name="__reserved18" /> + <style name="__reserved19" /> + <public type="style" name="__reserved19" /> + <style name="__reserved20" /> + <public type="style" name="__reserved20" /> + <style name="__reserved21" /> + <public type="style" name="__reserved21" /> + <style name="__reserved22" /> + <public type="style" name="__reserved22" /> <public type="style" name="Theme.Material.Light.LightStatusBar" /> <public type="style" name="ThemeOverlay.Material.Dialog" /> <public type="style" name="TextAppearance.Material.Widget.Button.Inverse" /> <public type="style" name="ThemeOverlay.Material.Dialog.Alert" /> - <public type="style" name="Theme.Material.Light.DialogWhenLarge.DarkActionBar" /> - <public type="style" name="Theme.Material.DayNight.DialogWhenLarge.DarkActionBar" /> <public type="id" name="pasteAsPlainText" /> <public type="id" name="undo" /> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 4160e0e5c3eb..295251c55718 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2018,7 +2018,7 @@ <java-symbol type="attr" name="actionModeWebSearchDrawable" /> <java-symbol type="string" name="websearch" /> <java-symbol type="drawable" name="ic_media_video_poster" /> - <java-symbol type="array" name="config_webViewPackageNames" /> + <java-symbol type="string" name="config_webViewPackageName" /> <!-- From SubtitleView --> <java-symbol type="dimen" name="subtitle_corner_radius" /> diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml index 295b453fb0b7..9d3a7ef3e9fd 100644 --- a/core/res/res/values/themes_material.xml +++ b/core/res/res/values/themes_material.xml @@ -1281,7 +1281,7 @@ please see themes_device_defaults.xml. </style> <!-- Default theme for Settings and activities launched from Settings. --> - <style name="Theme.Material.Settings" parent="Theme.Material.DayNight.DarkActionBar"> + <style name="Theme.Material.Settings" parent="Theme.Material.Light.DarkActionBar"> <item name="colorPrimary">@color/material_blue_grey_900</item> <item name="colorPrimaryDark">@color/material_blue_grey_950</item> @@ -1291,7 +1291,7 @@ please see themes_device_defaults.xml. </style> <!-- Default theme for Settings and activities launched from Settings. --> - <style name="Theme.Material.Settings.NoActionBar" parent="Theme.Material.DayNight.NoActionBar"> + <style name="Theme.Material.Settings.NoActionBar" parent="Theme.Material.Light.NoActionBar"> <item name="colorPrimary">@color/material_blue_grey_900</item> <item name="colorPrimaryDark">@color/material_blue_grey_950</item> @@ -1299,42 +1299,40 @@ please see themes_device_defaults.xml. <item name="searchDialogTheme">@style/Theme.Material.Settings.SearchBar</item> <item name="panelMenuListTheme">@style/Theme.Material.Settings.CompactMenu</item> </style> - - <style name="Theme.Material.Settings.BaseDialog" parent="Theme.Material.DayNight.BaseDialog"> + <style name="Theme.Material.Settings.BaseDialog" parent="Theme.Material.Light.BaseDialog"> <item name="colorPrimary">@color/material_blue_grey_900</item> <item name="colorPrimaryDark">@color/material_blue_grey_950</item> </style> <style name="Theme.Material.Settings.Dialog" parent="Theme.Material.Settings.BaseDialog" /> - <style name="Theme.Material.Settings.Dialog.BaseAlert" parent="Theme.Material.DayNight.Dialog.BaseAlert"> + <style name="Theme.Material.Settings.Dialog.BaseAlert" parent="Theme.Material.Light.Dialog.BaseAlert"> <item name="colorPrimary">@color/material_blue_grey_900</item> <item name="colorPrimaryDark">@color/material_blue_grey_950</item> </style> <style name="Theme.Material.Settings.Dialog.Alert" parent="Theme.Material.Settings.Dialog.BaseAlert" /> - <style name="Theme.Material.Settings.DialogWhenLarge" parent="Theme.Material.DayNight.DialogWhenLarge.DarkActionBar"> + <style name="Theme.Material.Settings.DialogWhenLarge" parent="Theme.Material.Light.DialogWhenLarge.DarkActionBar"> <item name="colorPrimary">@color/material_blue_grey_900</item> <item name="colorPrimaryDark">@color/material_blue_grey_950</item> </style> - <style name="Theme.Material.Settings.DialogWhenLarge.NoActionBar" parent="Theme.Material.DayNight.DialogWhenLarge.NoActionBar"> + <style name="Theme.Material.Settings.DialogWhenLarge.NoActionBar" parent="Theme.Material.Light.DialogWhenLarge.NoActionBar"> <item name="colorPrimary">@color/material_blue_grey_900</item> <item name="colorPrimaryDark">@color/material_blue_grey_950</item> </style> - - <style name="Theme.Material.Settings.Dialog.Presentation" parent="Theme.Material.DayNight.Dialog.Presentation"> + <style name="Theme.Material.Settings.Dialog.Presentation" parent="Theme.Material.Light.Dialog.Presentation"> <item name="colorPrimary">@color/material_blue_grey_900</item> <item name="colorPrimaryDark">@color/material_blue_grey_950</item> </style> - <style name="Theme.Material.Settings.SearchBar" parent="Theme.Material.DayNight.SearchBar"> + <style name="Theme.Material.Settings.SearchBar" parent="Theme.Material.Light.SearchBar"> <item name="colorPrimary">@color/material_blue_grey_900</item> <item name="colorPrimaryDark">@color/material_blue_grey_950</item> </style> - <style name="Theme.Material.Settings.CompactMenu" parent="Theme.Material.DayNight.CompactMenu"> + <style name="Theme.Material.Settings.CompactMenu" parent="Theme.Material.Light.CompactMenu"> <item name="colorPrimary">@color/material_blue_grey_900</item> <item name="colorPrimaryDark">@color/material_blue_grey_950</item> </style> diff --git a/core/res/res/values/themes_material_daynight.xml b/core/res/res/values/themes_material_daynight.xml deleted file mode 100644 index 4ecca6be0b70..000000000000 --- a/core/res/res/values/themes_material_daynight.xml +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> - -<!-- -=============================================================== - PLEASE READ -=============================================================== - -The Material themes must not be modified in order to pass CTS. -Many related themes and styles depend on other values defined in this file. -If you would like to provide custom themes and styles for your device, -please see themes_device_defaults.xml. - -=============================================================== - PLEASE READ -=============================================================== - --> -<resources> - - <!-- Material theme (day/night vesion) for activities. --> - <style name="Theme.Material.DayNight" parent="Theme.Material.Light" /> - - <!-- Variant of Material.DayNight that has a solid (opaque) action bar - with an inverse color profile. The dark action bar sharply stands out against - the light content (when applicable). --> - <style name="Theme.Material.DayNight.DarkActionBar" parent="Theme.Material.Light.DarkActionBar" /> - - <!-- Variant of Material.DayNight with no action bar. --> - <style name="Theme.Material.DayNight.NoActionBar" parent="Theme.Material.Light.NoActionBar" /> - - <!-- Variant of Material.DayNight that has no title bar and fills - the entire screen. This theme - sets {@link android.R.attr#windowFullscreen} to true. --> - <style name="Theme.Material.DayNight.NoActionBar.Fullscreen" parent="Theme.Material.Light.NoActionBar.Fullscreen" /> - - <!-- Variant of Material.DayNight that has no title bar and fills - the entire screen and extends into the display overscan region. This theme - sets {@link android.R.attr#windowFullscreen} and {@link android.R.attr#windowOverscan} - to true. --> - <style name="Theme.Material.DayNight.NoActionBar.Overscan" parent="Theme.Material.Light.NoActionBar.Overscan" /> - - <!-- Variant of Material.DayNight that has no title bar and translucent - system decor. This theme sets {@link android.R.attr#windowTranslucentStatus} and - {@link android.R.attr#windowTranslucentNavigation} to true. --> - <style name="Theme.Material.DayNight.NoActionBar.TranslucentDecor" parent="Theme.Material.Light.NoActionBar.TranslucentDecor" /> - - <!-- Default Material.DayNight theme for panel windows. This removes all extraneous - window decorations, so you basically have an empty rectangle in which - to place your content. It makes the window floating, with a transparent - background, and turns off dimming behind the window. --> - <style name="Theme.Material.DayNight.Panel" parent="Theme.Material.Light.Panel" /> - - <!-- Material theme (day/night vesion) for dialog windows and activities, - which is used by the {@link android.app.Dialog} class. This changes - the window to be floating (not fill the entire screen), and puts a - frame around its contents. You can set this theme on an activity if - you would like to make an activity that looks like a Dialog. --> - <style name="Theme.Material.DayNight.Dialog" parent="Theme.Material.DayNight.BaseDialog" /> - <style name="Theme.Material.DayNight.BaseDialog" parent="Theme.Material.Light.BaseDialog" /> - - <!-- Variant of Theme.Material.DayNight.Dialog that has a nice minimum width for - a regular dialog. --> - <style name="Theme.Material.DayNight.Dialog.MinWidth" parent="Theme.Material.Light.Dialog.MinWidth" /> - - <!-- Variant of Theme.Material.DayNight.Dialog that does not include a title bar. --> - <style name="Theme.Material.DayNight.Dialog.NoActionBar" parent="Theme.Material.Light.Dialog.NoActionBar" /> - - <!-- Variant of Theme.Material.DayNight.Dialog.NoActionBar that has a nice minimum width for - a regular dialog. --> - <style name="Theme.Material.DayNight.Dialog.NoActionBar.MinWidth" parent="Theme.Material.Light.Dialog.NoActionBar.MinWidth" /> - - <!-- Variant of Theme.Material.DayNight.Dialog that has a fixed size. --> - <style name="Theme.Material.DayNight.Dialog.FixedSize" parent="Theme.Material.Light.Dialog.FixedSize" /> - - <!-- Variant of Theme.Material.DayNight.Dialog.NoActionBar that has a fixed size. --> - <style name="Theme.Material.DayNight.Dialog.NoActionBar.FixedSize" parent="Theme.Material.Light.Dialog.NoActionBar.FixedSize" /> - - <!-- Theme for a window that will be displayed either full-screen on - smaller screens (small, normal) or as a dialog on larger screens - (large, xlarge). --> - <style name="Theme.Material.DayNight.DialogWhenLarge" parent="Theme.Material.Light.DialogWhenLarge" /> - - <!-- Theme for a window with a dark action bar that will be displayed - either full-screen on smaller screens (small, normal) or as a dialog - on larger screens (large, xlarge). --> - <style name="Theme.Material.DayNight.DialogWhenLarge.DarkActionBar" parent="Theme.Material.Light.DialogWhenLarge.DarkActionBar" /> - - <!-- Theme for a window without an action bar that will be displayed either full-screen - on smaller screens (small, normal) or as a dialog on larger screens - (large, xlarge). --> - <style name="Theme.Material.DayNight.DialogWhenLarge.NoActionBar" parent="Theme.Material.Light.DialogWhenLarge.NoActionBar" /> - - <!-- Theme for a presentation window on a secondary display. --> - <style name="Theme.Material.DayNight.Dialog.Presentation" parent="Theme.Material.Light.Dialog.Presentation" /> - - <!-- Material user theme for alert dialog windows, which is used by the - {@link android.app.AlertDialog} class. --> - <style name="Theme.Material.DayNight.Dialog.Alert" parent="Theme.Material.DayNight.Dialog.BaseAlert" /> - <style name="Theme.Material.DayNight.Dialog.BaseAlert" parent="Theme.Material.Light.Dialog.BaseAlert" /> - - <style name="Theme.Material.DayNight.SearchBar" parent="Theme.Material.Light.SearchBar" /> - <style name="Theme.Material.DayNight.CompactMenu" parent="Theme.Material.Light.CompactMenu" /> - -</resources> diff --git a/docs/html/design/wear/context.jd b/docs/html/design/wear/context.jd index 688806fbd645..7a0baf80533b 100644 --- a/docs/html/design/wear/context.jd +++ b/docs/html/design/wear/context.jd @@ -2,19 +2,19 @@ page.title=Context Awareness on Android Wear @jd:body <style> -div.slide-wrapper { +.slide-wrapper { width:780px; overflow:visible; } -div.slide { +.slide { width:370px; float:left; margin:0 20px 0 0; } -div.slide p { +.slide p { height:40px; } -div.slide img { +.slide img { height: 208px; } </style> @@ -140,8 +140,8 @@ app.</p> <div class="slide"> <h2>Location-based Query</h2> -<p>Ask things like, "Are there any picnic tables free at the park?" and get answers from -people who are there.</p> +<p>Ask questions like, "Are there any picnic tables free at the park?" and get answers in real-time +from people in the area.</p> <img src="{@docRoot}design/media/wear/ContextualExample.015.png" alt="" srcset="{@docRoot}design/media/wear/ContextualExample.015.png 1x, {@docRoot}design/media/wear/ContextualExample.015_2x.png 2x" /> @@ -149,4 +149,6 @@ people who are there.</p> -</div>
\ No newline at end of file +</div> + +<p style="clear:both;height:0"> </p>
\ No newline at end of file diff --git a/docs/html/design/wear/creative-vision.jd b/docs/html/design/wear/creative-vision.jd index 09552409b3d9..36a87eb33028 100644 --- a/docs/html/design/wear/creative-vision.jd +++ b/docs/html/design/wear/creative-vision.jd @@ -25,34 +25,29 @@ Wear experiences are:</p> <div class="page-vision"> - <img src="{@docRoot}design/media/wear/vision_traffic.png" width="147" height="147" /> - <h2 id="Launched">Launched automatically</h2> + <img src="{@docRoot}design/media/wear/vision_traffic.png" width="147" height="147" /> <p>Most people are used to launching apps by clicking an icon. Android Wear is different. Wearable apps are aware of the user’s context - time, location, physical activity, and so on. The apps use this information to insert cards into the stream when they become relevant. This makes Android Wear timely, relevant and very specific.</p> </div> <div class="page-vision"> - <img src="{@docRoot}design/media/wear/vision_navigation.png" width="147" height="147" /> - <h2 id="Glanceable">Glanceable</h2> + <img src="{@docRoot}design/media/wear/vision_navigation.png" width="147" height="147" /> <p>A classic wrist watch is designed to let you see the time in a split second and get on with what you were doing. Designing for Android Wear is no different. The less time it takes to use your software, the more time the user can be present in whatever they are doing. Android wear is fast, sharp, and immediate.</p> </div> <div class="page-vision"> - <img src="{@docRoot}design/media/wear/vision_voice.png" width="147" height="147" style="border: 1px solid #ddd;" /> - <h2 id="SuggestDemand">All about suggest and demand</h2> + <img src="{@docRoot}design/media/wear/vision_voice.png" width="147" height="147" style="border: 1px solid #ddd;" /> <p>Android Wear is like a great personal assistant: it knows you and your preferences, it only interrupts you when absolutely necessary, and it’s always on hand to provide a ready answer. Android Wear is helpful, respectful, and responsive.</p> </div> <div class="page-vision"> - <img src="{@docRoot}design/media/wear/vision_music.png" width="147" height="147" /> - <h2 id="Interaction">Zero or low interaction</h2> + <img src="{@docRoot}design/media/wear/vision_music.png" width="147" height="147" /> <p>Staying true to the strengths afforded by a smaller form factor, Android Wear focuses on simple interactions, only requiring input by the user when absolutely necessary. Most inputs are based around touch swipes or voice, and inputs requiring fine-grained finger movements are avoided. Android Wear is gestural, simple, and fast.</p> </div> <p>By providing a smart connection to the rest of the world while respecting the user’s attention, Android Wear feels personal and global, simple and smart, unobtrusive and ever-ready. Applications that represent these principles will feel most at home in the overall Android Wear experience.</p> <p>Third party apps extend Android Wear to be more specialized and helpful throughout the day. Installing apps are a way for the user to tell the Android Wear how to do that.</p> - diff --git a/docs/html/design/wear/patterns.jd b/docs/html/design/wear/patterns.jd index e56ac2db8a72..0436cf594402 100644 --- a/docs/html/design/wear/patterns.jd +++ b/docs/html/design/wear/patterns.jd @@ -46,11 +46,9 @@ page.title=UI Patterns for Android Wear <h2 id="Dismissing" style="clear:both">Dismissing cards</h2> - <img src="{@docRoot}design/media/wear/dismiss_cards.png" height="147"> - <p>Swiping from left to right on a card causes it to be dismissed from the stream. Dismissed cards may return when they next have relevant information. State is synced between the Android Wear context stream and the notifications on the Android handheld device, so dismissing from one causes an automatic dismissal from the other.</p> - +<img src="{@docRoot}design/media/wear/dismiss_cards.png" height="147"> <h2 id="Actions" style="clear:both">Action buttons</h2> @@ -162,12 +160,11 @@ to check-in to.</p> <h2 id="Selection" style="clear:both">Selection List</h2> - <img src="{@docRoot}design/media/wear/selection_list.png" width="147" height="147" style="float:right;margin:0 0 20px 40px;border:1px solid #ddd"> + <img src="{@docRoot}design/media/wear/selection_list.png" width="147" height="147" style="float:left;margin:0 0 20px 40px;border:1px solid #ddd"> <p>Choosing an item from a list is a common interaction. The Selection List pattern (available as the <a href="{@docRoot}training/wearables/apps/layouts.html#UiLibrary"><code>WearableListView</code></a> component) creates a simple list optimized for ease of use on a small screen where the focused item snaps to the center of the screen and a single tap selects. This widget is recommended as a common pattern for selecting items. It is used throughout the system UI, including in the list that can be accessed by swiping up on the cue card.</p> - <p>Of course, it is possible for Android Wear apps to extend themselves beyond the familiarities of these patterns. For a deeper look at the options available, see the <a href="{@docRoot}design/wear/structure.html">App Structure</a> guide.</p> <a class="notice-developers left" href="{@docRoot}training/wearables/ui/lists.html"> @@ -176,3 +173,5 @@ href="{@docRoot}training/wearables/apps/layouts.html#UiLibrary"><code>WearableLi <p>Creating Lists</p> </div> </a> + +<p style="clear:both;height:0"> </p> diff --git a/docs/html/design/wear/style.jd b/docs/html/design/wear/style.jd index bb559fe9246a..75bd65f76317 100644 --- a/docs/html/design/wear/style.jd +++ b/docs/html/design/wear/style.jd @@ -48,19 +48,18 @@ href="{@docRoot}training/wearables/apps/layouts.html#UiLibrary"><code>WatchViewS </div> - - <img src="{@docRoot}design/media/wear/low_info_card.png" width="147" height="147" - style="float:right;margin:29px 0 20px 40px"> - <h2 id="InfoDensity" style="margin-top:0" >Low Information Density</h2> +<img src="{@docRoot}design/media/wear/low_info_card.png" width="147" height="147" +style="float:left;margin:5px 20px 20px 0"> + <p>Cards should be designed to be glanceable in a split second, just like reading the time on a traditional watch. In most cases a pairing of an icon and value, or a title and short caption should be enough to convey a meaningful message. Note that the background photo should also be used to convey information; backgrounds that change to reflect and support the primary message in the card work great. For example, in the case illustrated to the right, a suitable background image is chosen to reflect the severity of current traffic conditions. This is not just a nice piece of attention to detail; the background actually reinforces the message and makes the content more glanceable.</p> -<img src="{@docRoot}design/media/wear/separate_info_cards.jpg" height="147" - style="float:right;margin:29px 0 20px 40px"> <h2 id="Chunks">Separate Information into Chunks</h2> +<img src="{@docRoot}design/media/wear/separate_info_cards.jpg" height="147" + style="float:right;margin:5px 0 20px 20px"> <p>In cases where additional information is absolutely necessary, don’t crowd out a card layout to the point where glanceability is affected. Instead, add an additional <a href="{@docRoot}design/wear/patterns.html#Pages">page</a> (or multiple pages, if needed) to the right of the main card in the stream to which the user can swipe for more information. See also <a href="{@docRoot}design/wear/patterns.html#Continuing">Continuing activities on phone</a>.</p> @@ -73,21 +72,19 @@ href="{@docRoot}design/wear/patterns.html#Continuing">Continuing activities on p -<img src="{@docRoot}design/media/wear/clear_bold_type.jpg" height="147" - style="float:left;margin:19px 40px 20px 0"> - <h2 id="Typography" >Use Clear, Bold Typography</h2> +<img src="{@docRoot}design/media/wear/clear_bold_type.jpg" height="147" + style="float:left;margin:5px 20px 20px 0"> <p>The system font is Roboto Condensed, with Regular and Light variants. Text should adhere to the size and color recommendations (see the UI Toolkit in the <a href="{@docRoot}design/downloads/index.html#Wear">Downloads</a> page). In general, text should be displayed as large as possible. Your goal should be to convey maximum information with minimum fuss.</p> <h2 id="Branding" style="clear:both" >Use Consistent Branding and Color</h2> -<p>The app icon is used to identify and brand your application. The icon is optional but when present always appears in the same location, overhanging the top right edge of the card. Note that app icons or branding should not be displayed in the background photo, which is reserved to display an image relevant to the information on the card.</p> - - <img src="{@docRoot}design/media/wear/copywrite.png" height="147" - style="float:left;margin:19px 40px 20px 0"> + style="float:right;margin:0 20px 0 20px"> + +<p style="margin-bottom: 60px">The app icon is used to identify and brand your application. The icon is optional but when present always appears in the same location, overhanging the top right edge of the card. Note that app icons or branding should not be displayed in the background photo, which is reserved to display an image relevant to the information on the card.</p> <h2 id="Copywrite" >Copywrite Sparingly</h2> @@ -98,18 +95,11 @@ href="{@docRoot}design/wear/patterns.html#Continuing">Continuing activities on p <p>Wearables are personal devices by nature, but they are not completely private. If your notification serves content that may be particularly sensitive or embarrassing (such as notifications from a dating app or a medical status report), consider not displaying all of the information in a peek card. A notification could place the sensitive information on a second page that must be swiped to, or an application could show different amounts of detail in peek and focused card positions.</p> - - <img src="{@docRoot}design/media/wear/confirmation.png" height="147" - style="float:left;margin:29px 40px 20px 0"> - - <h2 id="ConfirmAnim">Confirmation Animations</h2> -<p>If your app allows the user to perform an action, it is necessary to provide positive feedback. Show a generic confirmation animation or create your own. A confirmation animation is an opportunity to express your app’s character and insert a moment of delight for your user. Keep animations short (less than 1000ms) and simple. Animating the confirmation icon is an effective way of transitioning the user to a new state after completing an action.</p> - - - - - +<img src="{@docRoot}design/media/wear/confirmation.png" height="147" + style="float:left;margin:5px 20px 20px 0"> +<p>If your app allows the user to perform an action, it is necessary to provide positive feedback. Show a generic confirmation animation or create your own. A confirmation animation is an opportunity to express your app’s character and insert a moment of delight for your user. Keep animations short (less than 1000ms) and simple. Animating the confirmation icon is an effective way of transitioning the user to a new state after completing an action.</p> +<p style="clear:both;height:0"> </p>
\ No newline at end of file diff --git a/docs/html/design/wear/watchfaces.jd b/docs/html/design/wear/watchfaces.jd index 2def05bfa01c..e01852346b03 100644 --- a/docs/html/design/wear/watchfaces.jd +++ b/docs/html/design/wear/watchfaces.jd @@ -4,7 +4,7 @@ page.title=Watch Faces for Android Wear <!-- developer docs box --> <a class="notice-developers right" href="{@docRoot}training/wearables/watch-faces/index.html" - style="clear:left;margin-bottom:90px"> + style="clear:left"> <div> <h3>Developer Docs</h3> <p>Creating Watch Faces</p> @@ -22,7 +22,7 @@ ambient modes, and consider how system user interface elements will interact wit <p>Follow the guidelines in this page to design your custom watch faces.</p> <!-- H2 creative vision --> -<div style="float:right;margin-top:-100px;margin-bottom:20px;margin-left:20px"> +<div style="float:right;margin-bottom:20px;margin-left:20px"> <img src="{@docRoot}design/media/wear/Render_Next.png" width="200" height="195" alt="" style="margin-right:5px"/><br/> <img src="{@docRoot}design/media/wear/Render_Interactive.png" @@ -137,44 +137,39 @@ You can configure your watch face to display different ambient designs depending of screen available on the device. Consider the best design for your watch faces on all screens.</p> -<div class="cols" style="margin-top:20px"> -<div class="col-9"> - <h3>Reduced color space</h3> - <p>Some displays use a reduced color space in ambient mode to save power.</p> - <p>One reduced color space power saving method is to use a "low-bit" mode. In low-bit mode, - the available colors are limited to black, white, blue, red, magenta, green, cyan, and yellow. - When designing for low-bit ambient mode, use a black or a white background. For OLED screens, - you must use a black background. Non-background pixels must be less than 10 percent of total - pixels. You can use low-bit color for up to 5 percent of pixels on screens that support it. - You should also disable antialiasing in your paint styles for this mode. Make sure to test - your design on devices with low-bit ambient mode.</p> - <p>Other displays save power in ambient mode by not producing any color. When designing for - displays which do not use color in ambient mode, the background may be either black or - white.</p> -</div> -<div class="col-4"> +<div style="float:right;margin-bottom:20px;margin-left:20px"> <img src="{@docRoot}design/media/wear/Render_LowBit.png" width="200" height="" alt="" style="margin-top:45px;margin-left:13px"> </div> -</div> +<h3>Reduced color space</h3> -<div class="cols" style="margin-top:20px"> -<div class="col-9"> - <h3>Burn protection techniques</h3> - <p>When designing for OLED screens, you should consider power efficiency and the screen - burn-in effect. When these screens are in ambient mode, the system shifts the contents of - the screen periodically by a few pixels to avoid pixel burn-in. Do not use large blocks of - pixels in your ambient mode designs and keep 95% of the pixels black. Replace solid shapes in - your regular ambient mode designs with outlined shapes in burn-protected ambient mode. Also - replace filled images with pixel patterns. For analog watch face designs, hollow out the center - where the hands meet to avoid pixel burn-in in this mode.</p> -</div> -<div class="col-4"> +<p>Some displays use a reduced color space in ambient mode to save power.</p> +<p>One reduced color space power saving method is to use a "low-bit" mode. In low-bit mode, +the available colors are limited to black, white, blue, red, magenta, green, cyan, and yellow. +When designing for low-bit ambient mode, use a black or a white background. For OLED screens, +you must use a black background. Non-background pixels must be less than 10 percent of total +pixels. You can use low-bit color for up to 5 percent of pixels on screens that support it. +You should also disable antialiasing in your paint styles for this mode. Make sure to test +your design on devices with low-bit ambient mode.</p> +<p>Other displays save power in ambient mode by not producing any color. When designing for +displays which do not use color in ambient mode, the background may be either black or +white.</p> + + +<h3>Burn protection techniques</h3> + +<div style="float:right;margin-bottom:20px;margin-left:20px"> <img src="{@docRoot}design/media/wear/Render_1Bit.png" width="200" height="" alt="" style="margin-top:-10px;margin-left:13px"> </div> -</div> +<p>When designing for OLED screens, you should consider power efficiency and the screen +burn-in effect. When these screens are in ambient mode, the system shifts the contents of +the screen periodically by a few pixels to avoid pixel burn-in. Do not use large blocks of +pixels in your ambient mode designs and keep 95% of the pixels black. Replace solid shapes in +your regular ambient mode designs with outlined shapes in burn-protected ambient mode. Also +replace filled images with pixel patterns. For analog watch face designs, hollow out the center +where the hands meet to avoid pixel burn-in in this mode.</p> <h2 id="SystemUI">Accomodate System UI Elements</h2> @@ -183,9 +178,11 @@ screens.</p> user the status of the wearable and show notifications from services on the user's phone. Try to keep critical elements in your watch face designs from being obscured by the UI elements.</p> -<div class="cols" style="margin-top:20px"> -<div class="col-9"> - <h3>Cards</h3> +<div style="float:right;margin-bottom:20px;margin-left:20px"> + <img src="{@docRoot}design/media/wear/CardsRender_Build.png" width="200" + height="" alt="" style="margin-top:20px;margin-left:13px"> +</div> +<h3>Cards</h3> <p>Cards are the notification system that bridges information between the wearable and a mobile device. Cards are also how most applications communicate with users. The user will be notified on the wearable about items such as emails and messages. As a watch face developer, @@ -201,16 +198,13 @@ variable peek card is that it displays more notification information. Faces with the bottom half of the face should leverage the small peek card instead.</p> <p>The system notifies your watch face when the bounds of a peek card change, so you can rearrange the elements in your design if necessary.</p> -</div> -<div class="col-4"> - <img src="{@docRoot}design/media/wear/CardsRender_Build.png" width="200" - height="" alt="" style="margin-top:20px;margin-left:13px"> -</div> -</div> -<div class="cols" style="margin-top:20px"> -<div class="col-9"> - <h3>Indicators</h3> + +<div style="float:right;margin-bottom:20px;margin-left:20px"> + <img src="{@docRoot}design/media/wear/Indicators_Cropped.png" width="200" + height="" alt="" style="margin-top:0px;margin-left:13px"> +</div> +<h3>Indicators</h3> <p>Indicators tell the user the status of the wearable, such as charging and airplane mode. When designing a watch face, consider how the indicator will fall over the watch face.</p> <p>The indicators can be placed in several fixed locations on the wearable. If you have a @@ -218,16 +212,12 @@ large peek card, the indicators should go on the top or on the center of the scr position the status icons or the hotword on the bottom of the screen, the system forces small peek cards. If the edge of the watch face contains strong visual elements, such as ticks or numbers, place the indicators on the center of the screen.</p> -</div> -<div class="col-4"> - <img src="{@docRoot}design/media/wear/Indicators_Cropped.png" width="200" + +<div style="float:right;margin-bottom:20px;margin-left:20px"> + <img src="{@docRoot}design/media/wear/Hotword_Cropped.png" width="200" height="" alt="" style="margin-top:0px;margin-left:13px"> </div> -</div> - -<div class="cols" style="margin-top:20px"> -<div class="col-9"> - <h3>The hotword</h3> +<h3>The hotword</h3> <p>The hotword is the phrase "OK Google", which tells the user that they can interact with the watch using voice commands. When a user turns on the wearable, the hotword appears on the screen for a few seconds.</p> @@ -236,12 +226,6 @@ this element is not as critical. You should still avoid covering up elements of watch face. Finally, background protection for the hotword and the indicators should be turned on unless your design is tailored to have these elements appear on top of them, for example using dark solid colors with no patterns.</p> -</div> -<div class="col-4"> - <img src="{@docRoot}design/media/wear/Hotword_Cropped.png" width="200" - height="" alt="" style="margin-top:0px;margin-left:13px"> -</div> -</div> <p>For more information about measurements and positioning of system UI elements, see <a href="#SpecsAssets">Specifications and Assets</a>.</p> @@ -253,24 +237,27 @@ using dark solid colors with no patterns.</p> <p>Your watch face can show users contextually relevant data and react to it by changing styles and colors in your design.</p> -<div class="cols" style="margin-top:20px"> -<div class="col-9"> - <h3>What do you want your user to know?</h3> +<h3>What do you want your user to know?</h3> + +<div style="float:right;margin-bottom:20px;margin-left:20px"> + <img src="{@docRoot}design/media/wear/Render_Saturn.png" width="200" + height="" alt="" style="margin-top:-10px;margin-left:13px"> +</div> + <p>The first step in designing a data-integrated watch face is to define a conceptual user outcome based on available data. First, generate a strong concept or outcome you believe is supported by real user needs. What do you want your users to know after they have glanced at your design? Once you have identified your outcome, you need to determine how to obtain the required data.</p> -</div> -<div class="col-4"> - <img src="{@docRoot}design/media/wear/Render_Saturn.png" width="200" + +<div style="clear:both;"/> + +<div style="float:right;margin-bottom:20px;margin-left:20px"> + <img src="{@docRoot}design/media/wear/Render_Episode.png" width="200" height="" alt="" style="margin-top:-10px;margin-left:13px"> </div> -</div> -<div class="cols" style="margin-top:20px"> -<div class="col-9"> - <h3>A watch dial is a timeline; add data to it</h3> +<h3>A watch dial is a timeline; add data to it</h3> <p>Your watch face concept may include use of data beyond time, such as weather, calendar and fitness data. Consider the inclusion of data integration creatively. Avoid simply overlaying a time-based watch face with extra data. Rather, think about how the data can @@ -278,16 +265,13 @@ be expressed through the lens of time. For example, instead of designing a weath watch face as a clock with an indication of the current temperature in degrees overlayed, you might design a watch face that describes how the temperature will change over the course of the day.</p> -</div> -<div class="col-4"> - <img src="{@docRoot}design/media/wear/Render_Episode.png" width="200" + +<div style="float:right;margin-bottom:20px;margin-left:20px"> + <img src="{@docRoot}design/media/wear/Render_Albumem.png" width="200" height="" alt="" style="margin-top:-10px;margin-left:13px"> </div> -</div> -<div class="cols" style="margin-top:20px"> -<div class="col-9"> - <h3>Stick to one message</h3> +<h3>Stick to one message</h3> <p>Once you have solidified your conceptual direction or desired outcome, you will need to begin visualizing your watch face. The strongest watch face designs are highly glanceable and deliver a singular expression of data. In order to identify your singular message, you @@ -295,12 +279,6 @@ must identify the most important supporting data point. For instance, instead of an entire month of calendar events, you might decide to display only the next upcoming event. By a process of reduction, you should arrive at a powerful singular expression of data to include in your design.</p> -</div> -<div class="col-4"> - <img src="{@docRoot}design/media/wear/Render_Albumem.png" width="200" - height="" alt="" style="margin-top:-10px;margin-left:13px"> -</div> -</div> <h3>Begin with some insight and test as you go</h3> <p>Make sure your approach begins with insight into the needs and expectations of your users. diff --git a/docs/html/sdk/index.jd b/docs/html/sdk/index.jd index 9a8345067c5d..7b1169f8e34b 100644 --- a/docs/html/sdk/index.jd +++ b/docs/html/sdk/index.jd @@ -30,21 +30,22 @@ studio.win_notools_exe_checksum=ae09797db2537afb572a00b7eacc292bb66d539e -sdk.linux_download=android-sdk_r24.3.2-linux.tgz -sdk.linux_bytes=309138263 -sdk.linux_checksum=4a10e62c5d88fd6c2a69db12348cbe168228b98f +sdk.linux_download=android-sdk_r24.3.3-linux.tgz +sdk.linux_bytes=309109716 +sdk.linux_checksum=cd4cab76c2e3d926b3495c26ec56c831ba77d0d0 -sdk.mac_download=android-sdk_r24.3.2-macosx.zip -sdk.mac_bytes=98329772 -sdk.mac_checksum=8609b92e26e9bd5796f771138c6b222b6c0cb474 +sdk.mac_download=android-sdk_r24.3.3-macosx.zip +sdk.mac_bytes=98330824 +sdk.mac_checksum=41f0f3e76d6868018740e654aefb04fd765c357d -sdk.win_download=android-sdk_r24.3.2-windows.zip -sdk.win_bytes=187488291 -sdk.win_checksum=bcfe3c41ea7e33a29ad6f358adbdf977008be80a +sdk.win_download=android-sdk_r24.3.3-windows.zip +sdk.win_bytes=187480692 +sdk.win_checksum=b6a4899efbf20fc593042f1515446c6630ba502e -sdk.win_installer=installer_r24.3.2-windows.exe -sdk.win_installer_bytes=139471724 -sdk.win_installer_checksum=8f9d0ae9fdb37973ed62d6e93975ff375beb5542 + +sdk.win_installer=installer_r24.3.3-windows.exe +sdk.win_installer_bytes=139463749 +sdk.win_installer_checksum=bbdae40a7665e55b3cdb1fbae865986e6cd3df14 diff --git a/docs/html/tools/building/building-cmdline.jd b/docs/html/tools/building/building-cmdline.jd index 0e4c8b2631e1..bf3e873cb8bc 100644 --- a/docs/html/tools/building/building-cmdline.jd +++ b/docs/html/tools/building/building-cmdline.jd @@ -353,13 +353,6 @@ adb -d install <em>path/to/your/app</em>.apk to publish your application, you <strong>must</strong> sign the application with your own private key, rather than the debug key generated by the SDK tools.</p> - <p>Android Studio helps you get started quickly by signing your .apk files with a debug key, - prior to installing them on an emulator or development device. This means that you can quickly - run your application from Android Studio without having to generate your own private key. No - specific action on your part is needed, provided ADT has access to Keytool. However, please note - that if you intend to publish your application, you <strong>must</strong> sign the application - with your own private key, rather than the debug key generated by the SDK tools.</p> - <p>Please read <a href="{@docRoot}tools/publishing/app-signing.html">Signing Your Applications</a>, which provides a thorough guide to application signing on Android and what it means to you as an Android application developer. The document also includes a guide to publishing diff --git a/docs/html/tools/sdk/tools-notes.jd b/docs/html/tools/sdk/tools-notes.jd index 326fbe29fe6a..934b262b67a6 100644 --- a/docs/html/tools/sdk/tools-notes.jd +++ b/docs/html/tools/sdk/tools-notes.jd @@ -25,6 +25,36 @@ href="http://tools.android.com/knownissues">http://tools.android.com/knownissues <div class="toggle-content opened"> <p><a href="#" onclick="return toggleContent(this)"> <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img" + alt=""/>SDK Tools, Revision 24.3.3</a> <em>(June 2015)</em> + </p> + + <div class="toggle-content-toggleme"> + + <dl> + <dt>Dependencies:</dt> + + <dd> + <ul> + <li>Android SDK Platform-tools revision 19 or later.</li> + </ul> + </dd> + + <dt>General Notes:</dt> + <dd> + <ul> + <li>Fixed issues with using Ant build tasks with the Eclipse ADT build structure. </li> + <li>Fixed the emulator boot problem on Mac OS X 10.8.5.</li> + </ul> + </dd> + </div> +</div> + + + + +<div class="toggle-content closed"> + <p><a href="#" onclick="return toggleContent(this)"> + <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" alt=""/>SDK Tools, Revision 24.3.2</a> <em>(June 2015)</em> </p> diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java index 6090cf0b8add..5e62aeac6054 100644 --- a/graphics/java/android/graphics/drawable/Drawable.java +++ b/graphics/java/android/graphics/drawable/Drawable.java @@ -433,7 +433,7 @@ public abstract class Drawable { /** * Set the layout direction for this drawable. Should be a resolved - * layout direction, as the Drawable as no capacity to do the resolution on + * layout direction, as the Drawable has no capacity to do the resolution on * its own. * * @param layoutDirection the resolved layout direction for the drawable, diff --git a/graphics/java/android/graphics/drawable/Icon.java b/graphics/java/android/graphics/drawable/Icon.java index 7b4329a519b7..85db6a1e006e 100644 --- a/graphics/java/android/graphics/drawable/Icon.java +++ b/graphics/java/android/graphics/drawable/Icon.java @@ -29,6 +29,7 @@ import android.os.Handler; import android.os.Message; import android.os.Parcel; import android.os.Parcelable; +import android.text.TextUtils; import android.util.Log; import java.io.DataInputStream; @@ -258,16 +259,21 @@ public final class Icon implements Parcelable { return new BitmapDrawable(context.getResources(), getBitmap()); case TYPE_RESOURCE: if (getResources() == null) { - if (getResPackage() == null || "android".equals(getResPackage())) { + // figure out where to load resources from + String resPackage = getResPackage(); + if (TextUtils.isEmpty(resPackage)) { + // if none is specified, try the given context + resPackage = context.getPackageName(); + } + if ("android".equals(resPackage)) { mObj1 = Resources.getSystem(); } else { final PackageManager pm = context.getPackageManager(); try { - mObj1 = pm.getResourcesForApplication(getResPackage()); + mObj1 = pm.getResourcesForApplication(resPackage); } catch (PackageManager.NameNotFoundException e) { - Log.e(TAG, String.format("Unable to find pkg=%s", - getResPackage()), - e); + Log.e(TAG, String.format("Unable to find pkg=%s for icon %s", + resPackage, this), e); break; } } @@ -320,12 +326,15 @@ public final class Icon implements Parcelable { */ public Drawable loadDrawableAsUser(Context context, int userId) { if (mType == TYPE_RESOURCE) { - if (getResources() == null - && getResPackage() != null - && !(getResPackage().equals("android"))) { + String resPackage = getResPackage(); + if (TextUtils.isEmpty(resPackage)) { + resPackage = context.getPackageName(); + } + if (getResources() == null && !(getResPackage().equals("android"))) { final PackageManager pm = context.getPackageManager(); try { - mObj1 = pm.getResourcesForApplicationAsUser(getResPackage(), userId); + // assign getResources() as the correct user + mObj1 = pm.getResourcesForApplicationAsUser(resPackage, userId); } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, String.format("Unable to find pkg=%s user=%d", getResPackage(), @@ -410,6 +419,9 @@ public final class Icon implements Parcelable { * @param resId ID of the drawable resource */ public static Icon createWithResource(Context context, @DrawableRes int resId) { + if (context == null) { + throw new IllegalArgumentException("Context must not be null."); + } final Icon rep = new Icon(TYPE_RESOURCE); rep.mInt1 = resId; rep.mString1 = context.getPackageName(); diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java index 134451b41890..636983375f8f 100644 --- a/graphics/java/android/graphics/drawable/RippleDrawable.java +++ b/graphics/java/android/graphics/drawable/RippleDrawable.java @@ -423,6 +423,7 @@ public class RippleDrawable extends LayerDrawable { if (super.setDrawableByLayerId(id, drawable)) { if (id == R.id.mask) { mMask = drawable; + mHasValidMask = false; } return true; diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl index a3ea89653380..f3d755ce34e8 100644 --- a/location/java/android/location/ILocationManager.aidl +++ b/location/java/android/location/ILocationManager.aidl @@ -75,6 +75,7 @@ interface ILocationManager String getBestProvider(in Criteria criteria, boolean enabledOnly); boolean providerMeetsCriteria(String provider, in Criteria criteria); ProviderProperties getProviderProperties(String provider); + String getNetworkProviderPackage(); boolean isProviderEnabled(String provider); void addTestProvider(String name, in ProviderProperties properties, String opPackageName); diff --git a/media/java/android/media/MediaDrm.java b/media/java/android/media/MediaDrm.java index 9acfee2d2309..ab61e2bfcbd3 100644 --- a/media/java/android/media/MediaDrm.java +++ b/media/java/android/media/MediaDrm.java @@ -89,10 +89,23 @@ import android.util.Log; * encrypted content, the samples returned from the extractor remain encrypted, they * are only decrypted when the samples are delivered to the decoder. * <p> - * MediaDrm methods throw {@link java.lang.IllegalStateException} - * when a method is called on a MediaDrm object that is in an invalid or inoperable - * state. This is typically due to incorrect application API usage, but may also - * be due to an unrecoverable failure in the DRM plugin or security hardware. + * MediaDrm methods throw {@link android.media.MediaDrm.MediaDrmStateException} + * when a method is called on a MediaDrm object that has had an unrecoverable failure + * in the DRM plugin or security hardware. + * {@link android.media.MediaDrm.MediaDrmStateException} extends + * {@link java.lang.IllegalStateException} with the addition of a developer-readable + * diagnostic information string associated with the exception. + * <p> + * In the event of a mediaserver process crash or restart while a MediaDrm object + * is active, MediaDrm methods may throw {@link android.media.MediaDrmResetException}. + * To recover, the app must release the MediaDrm object, then create and initialize + * a new one. + * <p> + * As {@link android.media.MediaDrmResetException} and + * {@link android.media.MediaDrm.MediaDrmStateException} both extend + * {@link java.lang.IllegalStateException}, they should be in an earlier catch() + * block than {@link java.lang.IllegalStateException} if handled separately. + * <p> * <a name="Callbacks"></a> * <h3>Callbacks</h3> * <p>Applications should register for informational events in order diff --git a/media/java/android/media/MediaDrmResetException.java b/media/java/android/media/MediaDrmResetException.java new file mode 100644 index 000000000000..3b2da1e8bd25 --- /dev/null +++ b/media/java/android/media/MediaDrmResetException.java @@ -0,0 +1,28 @@ +/* + * Copyright 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 android.media; + +/** + * This exception is thrown when the MediaDrm instance has become unusable + * due to a restart of the mediaserver process. To continue, the app must + * release the MediaDrm object, then create and initialize a new one. + */ +public class MediaDrmResetException extends IllegalStateException { + public MediaDrmResetException(String detailMessage) { + super(detailMessage); + } +} diff --git a/media/java/android/media/midi/MidiDevice.java b/media/java/android/media/midi/MidiDevice.java index 7998a924c1ac..93fb6d2960da 100644 --- a/media/java/android/media/midi/MidiDevice.java +++ b/media/java/android/media/midi/MidiDevice.java @@ -50,21 +50,43 @@ public final class MidiDevice implements Closeable { * Close this object to terminate the connection. */ public class MidiConnection implements Closeable { - private final IBinder mToken; - private final MidiInputPort mInputPort; - - MidiConnection(IBinder token, MidiInputPort inputPort) { - mToken = token; - mInputPort = inputPort; + private final IMidiDeviceServer mInputPortDeviceServer; + private final IBinder mInputPortToken; + private final IBinder mOutputPortToken; + private final CloseGuard mGuard = CloseGuard.get(); + private boolean mIsClosed; + + MidiConnection(IBinder outputPortToken, MidiInputPort inputPort) { + mInputPortDeviceServer = inputPort.getDeviceServer(); + mInputPortToken = inputPort.getToken(); + mOutputPortToken = outputPortToken; + mGuard.open("close"); } @Override public void close() throws IOException { + synchronized (mGuard) { + if (mIsClosed) return; + mGuard.close(); + try { + // close input port + mInputPortDeviceServer.closePort(mInputPortToken); + // close output port + mDeviceServer.closePort(mOutputPortToken); + } catch (RemoteException e) { + Log.e(TAG, "RemoteException in MidiConnection.close"); + } + mIsClosed = true; + } + } + + @Override + protected void finalize() throws Throwable { try { - mDeviceServer.closePort(mToken); - IoUtils.closeQuietly(mInputPort); - } catch (RemoteException e) { - Log.e(TAG, "RemoteException in MidiConnection.close"); + mGuard.warnIfOpen(); + close(); + } finally { + super.finalize(); } } } diff --git a/media/java/android/media/midi/MidiDeviceServer.java b/media/java/android/media/midi/MidiDeviceServer.java index 1212b647d0d1..19ff62460155 100644 --- a/media/java/android/media/midi/MidiDeviceServer.java +++ b/media/java/android/media/midi/MidiDeviceServer.java @@ -257,7 +257,14 @@ public final class MidiDeviceServer implements Closeable { public void connectPorts(IBinder token, ParcelFileDescriptor pfd, int outputPortNumber) { MidiInputPort inputPort = new MidiInputPort(pfd, outputPortNumber); - mOutputPortDispatchers[outputPortNumber].getSender().connect(inputPort); + MidiDispatcher dispatcher = mOutputPortDispatchers[outputPortNumber]; + synchronized (dispatcher) { + dispatcher.getSender().connect(inputPort); + int openCount = dispatcher.getReceiverCount(); + mOutputPortOpenCount[outputPortNumber] = openCount; + updateDeviceStatus(); + } + mInputPorts.add(inputPort); OutputPortClient client = new OutputPortClient(token, inputPort); synchronized (mPortClients) { diff --git a/media/java/android/media/midi/MidiInputPort.java b/media/java/android/media/midi/MidiInputPort.java index af5a86ca8bd8..db41b10a7d59 100644 --- a/media/java/android/media/midi/MidiInputPort.java +++ b/media/java/android/media/midi/MidiInputPort.java @@ -103,17 +103,33 @@ public final class MidiInputPort extends MidiReceiver implements Closeable { // used by MidiDevice.connectInputPort() to connect our socket directly to another device /* package */ ParcelFileDescriptor claimFileDescriptor() { - synchronized (mBuffer) { - ParcelFileDescriptor pfd = mParcelFileDescriptor; - if (pfd != null) { + synchronized (mGuard) { + ParcelFileDescriptor pfd; + synchronized (mBuffer) { + pfd = mParcelFileDescriptor; + if (pfd == null) return null; IoUtils.closeQuietly(mOutputStream); mParcelFileDescriptor = null; mOutputStream = null; } + + // Set mIsClosed = true so we will not call mDeviceServer.closePort() in close(). + // MidiDevice.MidiConnection.close() will do the cleanup instead. + mIsClosed = true; return pfd; } } + // used by MidiDevice.MidiConnection to close this port after the connection is closed + /* package */ IBinder getToken() { + return mToken; + } + + // used by MidiDevice.MidiConnection to close this port after the connection is closed + /* package */ IMidiDeviceServer getDeviceServer() { + return mDeviceServer; + } + @Override public void close() throws IOException { synchronized (mGuard) { diff --git a/media/jni/android_media_ImageReader.cpp b/media/jni/android_media_ImageReader.cpp index 635fa11c6b44..0034b07762a8 100644 --- a/media/jni/android_media_ImageReader.cpp +++ b/media/jni/android_media_ImageReader.cpp @@ -1240,8 +1240,11 @@ static jint Image_getFormat(JNIEnv* env, jobject thiz, jint readerFormat) return static_cast<jint>(PublicFormat::PRIVATE); } else { CpuConsumer::LockedBuffer* buffer = Image_getLockedBuffer(env, thiz); + int readerHalFormat = android_view_Surface_mapPublicFormatToHalFormat( + static_cast<PublicFormat>(readerFormat)); + int32_t fmt = applyFormatOverrides(buffer->flexFormat, readerHalFormat); PublicFormat publicFmt = android_view_Surface_mapHalFormatDataspaceToPublicFormat( - buffer->flexFormat, buffer->dataSpace); + fmt, buffer->dataSpace); return static_cast<jint>(publicFmt); } } diff --git a/media/jni/android_media_ImageWriter.cpp b/media/jni/android_media_ImageWriter.cpp index 634ba64dcf79..ba7634cd3276 100644 --- a/media/jni/android_media_ImageWriter.cpp +++ b/media/jni/android_media_ImageWriter.cpp @@ -361,8 +361,7 @@ static void ImageWriter_close(JNIEnv* env, jobject thiz, jlong nativeCtx) { ALOGV("%s:", __FUNCTION__); JNIImageWriterContext* const ctx = reinterpret_cast<JNIImageWriterContext *>(nativeCtx); if (ctx == NULL || thiz == NULL) { - jniThrowException(env, "java/lang/IllegalStateException", - "ImageWriterContext is not initialized"); + // ImageWriter is already closed. return; } diff --git a/media/jni/android_media_MediaDrm.cpp b/media/jni/android_media_MediaDrm.cpp index d456dc1080d2..9ec0312d0f2a 100644 --- a/media/jni/android_media_MediaDrm.cpp +++ b/media/jni/android_media_MediaDrm.cpp @@ -308,6 +308,10 @@ static bool throwExceptionAsNecessary( } else if (err == ERROR_DRM_DEVICE_REVOKED) { jniThrowException(env, "android/media/DeniedByServerException", msg); return true; + } else if (err == DEAD_OBJECT) { + jniThrowException(env, "android/media/MediaDrmResetException", + "mediaserver died"); + return true; } else if (err != OK) { String8 errbuf; if (drmMessage != NULL) { diff --git a/media/jni/audioeffect/android_media_AudioEffect.cpp b/media/jni/audioeffect/android_media_AudioEffect.cpp index fdc586b8a175..aba4bbeb1e70 100644 --- a/media/jni/audioeffect/android_media_AudioEffect.cpp +++ b/media/jni/audioeffect/android_media_AudioEffect.cpp @@ -472,6 +472,8 @@ static void android_media_AudioEffect_native_release(JNIEnv *env, jobject thiz) if (lpJniStorage) { ALOGV("deleting pJniStorage: %p\n", lpJniStorage); + env->DeleteGlobalRef(lpJniStorage->mCallbackData.audioEffect_class); + env->DeleteGlobalRef(lpJniStorage->mCallbackData.audioEffect_ref); delete lpJniStorage; } } diff --git a/media/jni/audioeffect/android_media_Visualizer.cpp b/media/jni/audioeffect/android_media_Visualizer.cpp index 6098b4a47fa9..05570195752b 100644 --- a/media/jni/audioeffect/android_media_Visualizer.cpp +++ b/media/jni/audioeffect/android_media_Visualizer.cpp @@ -450,6 +450,8 @@ static void android_media_visualizer_native_release(JNIEnv *env, jobject thiz) if (lpJniStorage) { ALOGV("deleting pJniStorage: %p\n", lpJniStorage); + env->DeleteGlobalRef(lpJniStorage->mCallbackData.visualizer_class); + env->DeleteGlobalRef(lpJniStorage->mCallbackData.visualizer_ref); delete lpJniStorage; } } diff --git a/packages/DocumentsUI/res/values-sw720dp/styles.xml b/packages/DocumentsUI/res/values-sw720dp/styles.xml index 0b03a94f294d..d7c031e143ca 100644 --- a/packages/DocumentsUI/res/values-sw720dp/styles.xml +++ b/packages/DocumentsUI/res/values-sw720dp/styles.xml @@ -16,7 +16,7 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="DialogWhenReallyLarge" parent="@*android:style/Theme.Material.DayNight.Dialog"> + <style name="DialogWhenReallyLarge" parent="@*android:style/Theme.DeviceDefault.Light.Dialog"> <!-- We do not specify width of window here because the max size of floating window specified by windowFixedWidthis is limited. --> <item name="*android:windowFixedHeightMajor">80%</item> diff --git a/packages/DocumentsUI/res/values/styles.xml b/packages/DocumentsUI/res/values/styles.xml index 6d741aae8786..8c4b77707fc1 100644 --- a/packages/DocumentsUI/res/values/styles.xml +++ b/packages/DocumentsUI/res/values/styles.xml @@ -16,7 +16,7 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="DialogWhenReallyLarge" parent="@android:style/Theme.Material.DayNight.DarkActionBar" /> + <style name="DialogWhenReallyLarge" parent="@android:style/Theme.DeviceDefault.Light.DarkActionBar" /> <style name="DocumentsTheme" parent="@style/DialogWhenReallyLarge"> <item name="android:actionBarWidgetTheme">@null</item> diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java index aa99a7bfeb72..0c6837fcc60c 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java @@ -216,6 +216,19 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout return mCallback; } + @Override + public void showPromptReason(int reason) { + if (reason != PROMPT_REASON_NONE) { + int promtReasonStringRes = getPromtReasonStringRes(reason); + if (promtReasonStringRes != 0) { + mSecurityMessageDisplay.setMessage(promtReasonStringRes, + true /* important */); + } + } + } + + protected abstract int getPromtReasonStringRes(int reason); + // Cause a VIRTUAL_KEY vibration public void doHapticKeyClick() { if (mEnableHaptics) { diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java index cd4b24a9e178..ff4e8154d0f5 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java @@ -160,6 +160,17 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback { } /** + * Show a string explaining why the security view needs to be solved. + * + * @param reason a flag indicating which string should be shown, see + * {@link KeyguardSecurityView#PROMPT_REASON_NONE} + * and {@link KeyguardSecurityView#PROMPT_REASON_RESTART} + */ + public void showPromptReason(int reason) { + mSecurityContainer.showPromptReason(reason); + } + + /** * Dismisses the keyguard by going to the next screen or making it gone. * * @return True if the keyguard is done. diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java index c9ad7286d9f6..2db87b330077 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java @@ -111,6 +111,16 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView } @Override + protected int getPromtReasonStringRes(int reason) { + switch (reason) { + case PROMPT_REASON_RESTART: + return R.string.kg_prompt_reason_restart_password; + default: + return 0; + } + } + + @Override public void onPause() { super.onPause(); mImm.hideSoftInputFromWindow(getWindowToken(), 0); diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java index 1bd0bb4dcec5..59a8ad576ebb 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java @@ -85,10 +85,9 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit } }; private Rect mTempRect = new Rect(); - private SecurityMessageDisplay mSecurityMessageDisplay; + private KeyguardMessageArea mSecurityMessageDisplay; private View mEcaView; private ViewGroup mContainer; - private KeyguardMessageArea mHelpMessage; private int mDisappearYTranslation; enum FooterMode { @@ -141,10 +140,10 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit // vibrate mode will be the same for the life of this screen mLockPatternView.setTactileFeedbackEnabled(mLockPatternUtils.isTactileFeedbackEnabled()); - mSecurityMessageDisplay = KeyguardMessageArea.findSecurityMessageDisplay(this); + mSecurityMessageDisplay = + (KeyguardMessageArea) KeyguardMessageArea.findSecurityMessageDisplay(this); mEcaView = findViewById(R.id.keyguard_selector_fade_container); mContainer = (ViewGroup) findViewById(R.id.container); - mHelpMessage = (KeyguardMessageArea) findViewById(R.id.keyguard_message_area); EmergencyButton button = (EmergencyButton) findViewById(R.id.emergency_call_button); if (button != null) { @@ -320,6 +319,17 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit } @Override + public void showPromptReason(int reason) { + switch (reason) { + case PROMPT_REASON_RESTART: + mSecurityMessageDisplay.setMessage(R.string.kg_prompt_reason_restart_pattern, + true /* important */); + break; + default: + } + } + + @Override public void startAppearAnimation() { enableClipping(false); setAlpha(1f); @@ -337,8 +347,8 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit } }, this); - if (!TextUtils.isEmpty(mHelpMessage.getText())) { - mAppearAnimationUtils.createAnimation(mHelpMessage, 0, + if (!TextUtils.isEmpty(mSecurityMessageDisplay.getText())) { + mAppearAnimationUtils.createAnimation(mSecurityMessageDisplay, 0, AppearAnimationUtils.DEFAULT_APPEAR_DURATION, mAppearAnimationUtils.getStartTranslation(), true /* appearing */, @@ -366,8 +376,8 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit } } }, KeyguardPatternView.this); - if (!TextUtils.isEmpty(mHelpMessage.getText())) { - mDisappearAnimationUtils.createAnimation(mHelpMessage, 0, + if (!TextUtils.isEmpty(mSecurityMessageDisplay.getText())) { + mDisappearAnimationUtils.createAnimation(mSecurityMessageDisplay, 0, 200, - mDisappearAnimationUtils.getStartTranslation() * 3, false /* appearing */, diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPinBasedInputView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPinBasedInputView.java index 23834a31923c..07947b182d46 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPinBasedInputView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPinBasedInputView.java @@ -93,6 +93,16 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView return super.onKeyDown(keyCode, event); } + @Override + protected int getPromtReasonStringRes(int reason) { + switch (reason) { + case PROMPT_REASON_RESTART: + return R.string.kg_prompt_reason_restart_pin; + default: + return 0; + } + } + private void performClick(View view) { view.performClick(); } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java index d17b25a6a87c..f529ac0f3497 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -509,6 +509,13 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe } @Override + public void showPromptReason(int reason) { + if (mCurrentSecuritySelection != SecurityMode.None) { + getSecurityView(mCurrentSecuritySelection).showPromptReason(reason); + } + } + + @Override public void showUsabilityHint() { mSecurityViewFlipper.showUsabilityHint(); } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java index 5b5023602010..5658a7492d93 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityView.java @@ -21,6 +21,9 @@ public interface KeyguardSecurityView { static public final int SCREEN_ON = 1; static public final int VIEW_REVEALED = 2; + int PROMPT_REASON_NONE = 0; + int PROMPT_REASON_RESTART = 1; + /** * Interface back to keyguard to tell it when security * @param callback @@ -66,6 +69,14 @@ public interface KeyguardSecurityView { KeyguardSecurityCallback getCallback(); /** + * Show a string explaining why the security view needs to be solved. + * + * @param reason a flag indicating which string should be shown, see {@link #PROMPT_REASON_NONE} + * and {@link #PROMPT_REASON_RESTART} + */ + void showPromptReason(int reason); + + /** * Instruct the view to show usability hints, if any. * */ diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java index 54467f3863cf..a0ff21b1fd51 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityViewFlipper.java @@ -131,6 +131,14 @@ public class KeyguardSecurityViewFlipper extends ViewFlipper implements Keyguard } @Override + public void showPromptReason(int reason) { + KeyguardSecurityView ksv = getSecurityView(); + if (ksv != null) { + ksv.showPromptReason(reason); + } + } + + @Override public void showUsabilityHint() { KeyguardSecurityView ksv = getSecurityView(); if (ksv != null) { diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java index f4acff8beb2b..aeac91215be6 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java @@ -95,6 +95,12 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView { } } + @Override + protected int getPromtReasonStringRes(int reason) { + // No message on SIM Pin + return 0; + } + private String getPinPasswordErrorMessage(int attemptsRemaining) { String displayMessage; diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java index b85d96608f2c..af882395ee79 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java @@ -140,6 +140,12 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView { } } + @Override + protected int getPromtReasonStringRes(int reason) { + // No message on SIM Puk + return 0; + } + private String getPukPasswordErrorMessage(int attemptsRemaining) { String displayMessage; diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java index 273f166888e6..022338dab34c 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -804,8 +804,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private void startListeningForFingerprint() { if (DEBUG) Log.v(TAG, "startListeningForFingerprint()"); int userId = ActivityManager.getCurrentUser(); - if (mFpm != null && mFpm.isHardwareDetected() && !isFingerprintDisabled(userId) - && mFpm.getEnrolledFingerprints(userId).size() > 0) { + if (isUnlockWithFingerPrintPossible(userId)) { if (mFingerprintCancelSignal != null) { mFingerprintCancelSignal.cancel(); } @@ -815,6 +814,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } } + public boolean isUnlockWithFingerPrintPossible(int userId) { + return mFpm != null && mFpm.isHardwareDetected() && !isFingerprintDisabled(userId) + && mFpm.getEnrolledFingerprints(userId).size() > 0; + } + private void stopListeningForFingerprint() { if (DEBUG) Log.v(TAG, "stopListeningForFingerprint()"); if (isFingerprintDetectionRunning()) { diff --git a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java index f5c809a61db1..ff463c6c8312 100644 --- a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java +++ b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java @@ -81,4 +81,12 @@ public interface ViewMediatorCallback { * @return true if the screen is on */ boolean isScreenOn(); + + /** + * @return one of the reasons why the bouncer needs to be shown right now and the user can't use + * his normal unlock method like fingerprint or trust agents. See + * {@link KeyguardSecurityView#PROMPT_REASON_NONE} + * and {@link KeyguardSecurityView#PROMPT_REASON_RESTART}. + */ + int getBouncerPromptReason(); } diff --git a/packages/PrintSpooler/res/values/themes.xml b/packages/PrintSpooler/res/values/themes.xml index 05de5b79a6f9..11fa99117c8b 100644 --- a/packages/PrintSpooler/res/values/themes.xml +++ b/packages/PrintSpooler/res/values/themes.xml @@ -17,6 +17,9 @@ <resources> <style name="PrintActivity" parent="@android:style/Theme.DeviceDefault"> + <item name="android:colorPrimary">@*android:color/material_blue_grey_900</item> + <item name="android:colorPrimaryDark">@*android:color/material_blue_grey_950</item> + <item name="android:colorAccent">@*android:color/material_deep_teal_500</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowContentOverlay">@null</item> diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java index b0429ef43cf9..249eaa5d44d3 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java @@ -808,7 +808,7 @@ public final class CachedBluetoothDevice implements Comparable<CachedBluetoothDe // The pairing dialog now warns of phone-book access for paired devices. // No separate prompt is displayed after pairing. if (getPhonebookPermissionChoice() == CachedBluetoothDevice.ACCESS_UNKNOWN) { - setPhonebookPermissionChoice(CachedBluetoothDevice.ACCESS_ALLOWED); + setPhonebookPermissionChoice(CachedBluetoothDevice.ACCESS_REJECTED); } } } diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml index 640fb2922f29..9832b45d8ab3 100644 --- a/packages/Shell/AndroidManifest.xml +++ b/packages/Shell/AndroidManifest.xml @@ -128,7 +128,7 @@ <activity android:name=".BugreportWarningActivity" - android:theme="@*android:style/Theme.Material.DayNight.Dialog.Alert" + android:theme="@*android:style/Theme.DeviceDefault.Light.Dialog.Alert" android:finishOnCloseSystemDialogs="true" android:excludeFromRecents="true" android:exported="false" /> diff --git a/packages/Shell/src/com/android/shell/BugreportReceiver.java b/packages/Shell/src/com/android/shell/BugreportReceiver.java index 13747ed99820..0c84fa148e7f 100644 --- a/packages/Shell/src/com/android/shell/BugreportReceiver.java +++ b/packages/Shell/src/com/android/shell/BugreportReceiver.java @@ -27,6 +27,7 @@ import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; import android.net.Uri; import android.os.AsyncTask; import android.os.FileUtils; @@ -77,21 +78,12 @@ public class BugreportReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { + final Configuration conf = context.getResources().getConfiguration(); final File bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT); final File screenshotFile = getFileExtra(intent, EXTRA_SCREENSHOT); - // Files are kept on private storage, so turn into Uris that we can - // grant temporary permissions for. - final Uri bugreportUri = FileProvider.getUriForFile(context, AUTHORITY, bugreportFile); - final Uri screenshotUri = FileProvider.getUriForFile(context, AUTHORITY, screenshotFile); - - boolean isPlainText = bugreportFile.getName().toLowerCase().endsWith(".txt"); - if (!isPlainText) { - // Already zipped, send it right away. - sendBugreportNotification(context, bugreportFile, screenshotFile); - } else { - // Asynchronously zip the file first, then send it. - sendZippedBugreportNotification(context, bugreportFile, screenshotFile); + if ((conf.uiMode & Configuration.UI_MODE_TYPE_MASK) != Configuration.UI_MODE_TYPE_WATCH) { + triggerLocalNotification(context, bugreportFile, screenshotFile); } // Clean up older bugreports in background @@ -107,6 +99,29 @@ public class BugreportReceiver extends BroadcastReceiver { }.execute(); } + /** + * Responsible for triggering a notification that allows the user to start a + * "share" intent with the bug report. On watches we have other methods to allow the user to + * start this intent (usually by triggering it on another connected device); we don't need to + * display the notification in this case. + */ + private void triggerLocalNotification(final Context context, final File bugreportFile, + final File screenshotFile) { + // Files are kept on private storage, so turn into Uris that we can + // grant temporary permissions for. + final Uri bugreportUri = FileProvider.getUriForFile(context, AUTHORITY, bugreportFile); + final Uri screenshotUri = FileProvider.getUriForFile(context, AUTHORITY, screenshotFile); + + boolean isPlainText = bugreportFile.getName().toLowerCase().endsWith(".txt"); + if (!isPlainText) { + // Already zipped, send it right away. + sendBugreportNotification(context, bugreportFile, screenshotFile); + } else { + // Asynchronously zip the file first, then send it. + sendZippedBugreportNotification(context, bugreportFile, screenshotFile); + } + } + private static Intent buildWarningIntent(Context context, Intent sendIntent) { final Intent intent = new Intent(context, BugreportWarningActivity.class); intent.putExtra(Intent.EXTRA_INTENT, sendIntent); diff --git a/packages/SystemUI/res/drawable/managed_profile_toast_background.xml b/packages/SystemUI/res/drawable/managed_profile_toast_background.xml deleted file mode 100644 index 5c77b9a1f660..000000000000 --- a/packages/SystemUI/res/drawable/managed_profile_toast_background.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -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. ---> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <corners android:radius="2dp" /> - <solid android:color="@color/managed_profile_toast_background" /> -</shape> diff --git a/packages/SystemUI/res/layout/managed_profile_toast.xml b/packages/SystemUI/res/layout/managed_profile_toast.xml deleted file mode 100644 index 5a01ca7f16a6..000000000000 --- a/packages/SystemUI/res/layout/managed_profile_toast.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - 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. ---> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingLeft="32dp" - android:paddingRight="32dp" - android:background="@drawable/managed_profile_toast_background"> - <ImageView - android:layout_width="32dp" - android:layout_height="32dp" - android:layout_gravity="center_horizontal" - android:layout_marginBottom="16dp" - android:src="@drawable/stat_sys_managed_profile_status"/> - <TextView android:text="@string/managed_profile_foreground_toast" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@android:color/white" - android:textSize="14sp" - android:layout_gravity="center_horizontal" /> -</LinearLayout> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 9a96939f700d..0dcbe884b30f 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -143,6 +143,4 @@ <color name="volume_icon_color">#ffffffff</color> <color name="volume_settings_icon_color">#7fffffff</color> <color name="volume_slider_inactive">#FFB0BEC5</color><!-- blue grey 200 --> - - <color name="managed_profile_toast_background">#E5000000</color><!-- 90% black --> </resources> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index b0e71f916f20..869b03a8a7b5 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -575,4 +575,13 @@ <!-- Standard image button size for volume dialog buttons --> <dimen name="volume_button_size">48dp</dimen> + + <!-- Padding between icon and text for managed profile toast --> + <dimen name="managed_profile_toast_padding">4dp</dimen> + + <!-- Thickness of the assist disclosure beams --> + <dimen name="assist_disclosure_thickness">4dp</dimen> + + <!-- Thickness of the shadows of the assist disclosure beams --> + <dimen name="assist_disclosure_shadow_thickness">1.5dp</dimen> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java b/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java new file mode 100644 index 000000000000..234a6992f49e --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java @@ -0,0 +1,251 @@ +/* + * 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.systemui.assist; + +import com.android.systemui.R; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.AnimatorSet; +import android.animation.ValueAnimator; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.PixelFormat; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffXfermode; +import android.os.Handler; +import android.view.View; +import android.view.WindowManager; +import android.view.animation.AnimationUtils; + +/** + * Visually discloses that contextual data was provided to an assistant. + */ +public class AssistDisclosure { + private final Context mContext; + private final WindowManager mWm; + private final Handler mHandler; + + private AssistDisclosureView mView; + private boolean mViewAdded; + + public AssistDisclosure(Context context, Handler handler) { + mContext = context; + mHandler = handler; + mWm = mContext.getSystemService(WindowManager.class); + } + + public void postShow() { + mHandler.removeCallbacks(mShowRunnable); + mHandler.post(mShowRunnable); + } + + private void show() { + if (mView == null) { + mView = new AssistDisclosureView(mContext); + } + if (!mViewAdded) { + WindowManager.LayoutParams lp = new WindowManager.LayoutParams( + WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY, + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE + | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED + | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN + | WindowManager.LayoutParams.FLAG_FULLSCREEN + | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, + PixelFormat.TRANSLUCENT); + lp.setTitle("AssistDisclosure"); + + mWm.addView(mView, lp); + mViewAdded = true; + } + } + + private void hide() { + if (mViewAdded) { + mWm.removeView(mView); + mViewAdded = false; + } + } + + private Runnable mShowRunnable = new Runnable() { + @Override + public void run() { + show(); + } + }; + + private class AssistDisclosureView extends View + implements ValueAnimator.AnimatorUpdateListener { + + public static final int TRACING_ANIMATION_DURATION = 300; + public static final int ALPHA_ANIMATION_DURATION = 200; + + private float mThickness; + private float mShadowThickness; + private final Paint mPaint = new Paint(); + private final Paint mShadowPaint = new Paint(); + + private final ValueAnimator mTracingAnimator; + private final ValueAnimator mAlphaAnimator; + private final AnimatorSet mAnimator; + + private float mTracingProgress = 0; + private int mAlpha = 255; + + public AssistDisclosureView(Context context) { + super(context); + + mTracingAnimator = ValueAnimator.ofFloat(0, 1).setDuration(TRACING_ANIMATION_DURATION); + mTracingAnimator.addUpdateListener(this); + mTracingAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, + android.R.interpolator.fast_out_slow_in)); + mAlphaAnimator = ValueAnimator.ofInt(255, 0).setDuration(ALPHA_ANIMATION_DURATION); + mAlphaAnimator.addUpdateListener(this); + mAlphaAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, + android.R.interpolator.fast_out_linear_in)); + mAnimator = new AnimatorSet(); + mAnimator.play(mTracingAnimator).before(mAlphaAnimator); + mAnimator.addListener(new AnimatorListenerAdapter() { + boolean mCancelled; + + @Override + public void onAnimationStart(Animator animation) { + mCancelled = false; + } + + @Override + public void onAnimationCancel(Animator animation) { + mCancelled = true; + } + + @Override + public void onAnimationEnd(Animator animation) { + if (!mCancelled) { + hide(); + } + } + }); + + PorterDuffXfermode srcMode = new PorterDuffXfermode(PorterDuff.Mode.SRC); + mPaint.setColor(Color.WHITE); + mPaint.setXfermode(srcMode); + mShadowPaint.setColor(Color.DKGRAY); + mShadowPaint.setXfermode(srcMode); + + mThickness = getResources().getDimension(R.dimen.assist_disclosure_thickness); + mShadowThickness = getResources().getDimension( + R.dimen.assist_disclosure_shadow_thickness); + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + + startAnimation(); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + + mAnimator.cancel(); + + mTracingProgress = 0; + mAlpha = 255; + } + + private void startAnimation() { + mAnimator.cancel(); + mAnimator.start(); + } + + @Override + protected void onDraw(Canvas canvas) { + mPaint.setAlpha(mAlpha); + mShadowPaint.setAlpha(mAlpha / 4); + + drawGeometry(canvas, mShadowPaint, mShadowThickness); + drawGeometry(canvas, mPaint, 0); + } + + private void drawGeometry(Canvas canvas, Paint paint, float padding) { + final int width = getWidth(); + final int height = getHeight(); + float thickness = mThickness; + final float pixelProgress = mTracingProgress * (width + height - 2 * thickness); + + float bottomProgress = Math.min(pixelProgress, width / 2f); + if (bottomProgress > 0) { + drawBeam(canvas, + width / 2f - bottomProgress, + height - thickness, + width / 2f + bottomProgress, + height, paint, padding); + } + + float sideProgress = Math.min(pixelProgress - bottomProgress, height - thickness); + if (sideProgress > 0) { + drawBeam(canvas, + 0, + (height - thickness) - sideProgress, + thickness, + height - thickness, paint, padding); + drawBeam(canvas, + width - thickness, + (height - thickness) - sideProgress, + width, + height - thickness, paint, padding); + } + + float topProgress = Math.min(pixelProgress - bottomProgress - sideProgress, + width / 2 - thickness); + if (sideProgress > 0 && topProgress > 0) { + drawBeam(canvas, + thickness, + 0, + thickness + topProgress, + thickness, paint, padding); + drawBeam(canvas, + (width - thickness) - topProgress, + 0, + width - thickness, + thickness, paint, padding); + } + } + + private void drawBeam(Canvas canvas, float left, float top, float right, float bottom, + Paint paint, float padding) { + canvas.drawRect(left - padding, + top - padding, + right + padding, + bottom + padding, + paint); + } + + @Override + public void onAnimationUpdate(ValueAnimator animation) { + if (animation == mAlphaAnimator) { + mAlpha = (int) mAlphaAnimator.getAnimatedValue(); + } else if (animation == mTracingAnimator) { + mTracingProgress = (float) mTracingAnimator.getAnimatedValue(); + } + invalidate(); + } + } +} diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index 445ecb659a63..674356b0f866 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -55,6 +55,8 @@ public class AssistManager { private final Context mContext; private final WindowManager mWindowManager; + private final AssistDisclosure mAssistDisclosure; + private AssistOrbContainer mView; private final PhoneStatusBar mBar; private final AssistUtils mAssistUtils; @@ -100,6 +102,7 @@ public class AssistManager { Settings.Secure.getUriFor(Settings.Secure.ASSISTANT), false, mAssistSettingsObserver); mAssistSettingsObserver.onChange(false); + mAssistDisclosure = new AssistDisclosure(context, new Handler()); } public void onConfigurationChanged() { @@ -187,8 +190,11 @@ public class AssistManager { mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL | CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL); + boolean structureEnabled = Settings.Secure.getIntForUser(mContext.getContentResolver(), + Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1, UserHandle.USER_CURRENT) != 0; + final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) - .getAssistIntent(mContext, true, UserHandle.USER_CURRENT); + .getAssistIntent(mContext, structureEnabled, UserHandle.USER_CURRENT); if (intent == null) { return; } @@ -196,6 +202,10 @@ public class AssistManager { intent.setComponent(mAssistComponent); } + if (structureEnabled) { + showDisclosure(); + } + try { final ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, R.anim.search_launch_enter, R.anim.search_launch_exit); @@ -297,4 +307,8 @@ public class AssistManager { pw.println("AssistManager state:"); pw.print(" mAssistComponent="); pw.println(mAssistComponent); } + + public void showDisclosure() { + mAssistDisclosure.postShow(); + } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index c06b34fa1ffb..80761d80fa99 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -62,6 +62,7 @@ import com.android.internal.telephony.IccCardConstants; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardConstants; import com.android.keyguard.KeyguardDisplayManager; +import com.android.keyguard.KeyguardSecurityView; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.ViewMediatorCallback; @@ -526,6 +527,17 @@ public class KeyguardViewMediator extends SystemUI { public boolean isScreenOn() { return mDeviceInteractive; } + + @Override + public int getBouncerPromptReason() { + int currentUser = ActivityManager.getCurrentUser(); + if ((mUpdateMonitor.getUserTrustIsManaged(currentUser) + || mUpdateMonitor.isUnlockWithFingerPrintPossible(currentUser)) + && !mTrustManager.hasUserAuthenticatedSinceBoot(currentUser)) { + return KeyguardSecurityView.PROMPT_REASON_RESTART; + } + return KeyguardSecurityView.PROMPT_REASON_NONE; + } }; public void userActivity() { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 9761cd19e195..4b1453d09ed8 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -390,7 +390,7 @@ public class QSPanel extends ViewGroup { mDetailSettingsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - mHost.startSettingsActivity(settingsIntent); + mHost.startActivityDismissingKeyguard(settingsIntent); } }); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java index 72bb136bcc99..38fade21390f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java @@ -306,7 +306,7 @@ public abstract class QSTile<TState extends State> implements Listenable { } public interface Host { - void startSettingsActivity(Intent intent); + void startActivityDismissingKeyguard(Intent intent); void warn(String message, Throwable t); void collapsePanels(); Looper getLooper(); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index a9e8b383a8a0..07406b98f8be 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -82,7 +82,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> { if (mDataController.isMobileDataSupported()) { showDetail(true); } else { - mHost.startSettingsActivity(CELLULAR_SETTINGS); + mHost.startActivityDismissingKeyguard(CELLULAR_SETTINGS); } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java index f97f519cafc2..1b74eb6cd3be 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java @@ -263,7 +263,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> { private final ZenModePanel.Callback mZenModePanelCallback = new ZenModePanel.Callback() { @Override public void onPrioritySettings() { - mHost.startSettingsActivity(ZEN_PRIORITY_SETTINGS); + mHost.startActivityDismissingKeyguard(ZEN_PRIORITY_SETTINGS); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java index 19f4df6ba06c..f7f7acb8a072 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/IntentTile.java @@ -96,7 +96,11 @@ public class IntentTile extends QSTile<QSTile.State> { private void sendIntent(String type, PendingIntent pi, String uri) { try { if (pi != null) { - pi.send(); + if (pi.isActivity()) { + getHost().startActivityDismissingKeyguard(pi.getIntent()); + } else { + pi.send(); + } } else if (uri != null) { final Intent intent = Intent.parseUri(uri, Intent.URI_INTENT_SCHEME); mContext.sendBroadcastAsUser(intent, new UserHandle(mCurrentUserId)); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java index 9bc5b75632f7..c33ef7caeeab 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -104,7 +104,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> { @Override protected void handleSecondaryClick() { if (!mWifiController.canConfigWifi()) { - mHost.startSettingsActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); + mHost.startActivityDismissingKeyguard(new Intent(Settings.ACTION_WIFI_SETTINGS)); return; } if (!mState.enabled) { @@ -290,7 +290,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> { @Override public void onSettingsActivityTriggered(Intent settingsIntent) { - mHost.startSettingsActivity(settingsIntent); + mHost.startActivityDismissingKeyguard(settingsIntent); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 79761ec79028..295fdc81e775 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -41,6 +41,7 @@ import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; +import android.graphics.drawable.Icon; import android.os.AsyncTask; import android.os.Build; import android.os.Handler; @@ -392,13 +393,16 @@ public abstract class BaseStatusBar extends SystemUI implements if (recentTask != null && recentTask.size() > 0) { UserInfo user = mUserManager.getUserInfo(recentTask.get(0).userId); if (user != null && user.isManagedProfile()) { - LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( - Context.LAYOUT_INFLATER_SERVICE); - View layout = inflater.inflate(R.layout.managed_profile_toast, null); - Toast toast = new Toast(mContext); - toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); - toast.setDuration(Toast.LENGTH_SHORT); - toast.setView(layout); + Toast toast = Toast.makeText(mContext, + R.string.managed_profile_foreground_toast, + Toast.LENGTH_SHORT); + TextView text = (TextView) toast.getView().findViewById( + android.R.id.message); + text.setCompoundDrawablesRelativeWithIntrinsicBounds( + R.drawable.stat_sys_managed_profile_status, 0, 0, 0); + int paddingPx = mContext.getResources().getDimensionPixelSize( + R.dimen.managed_profile_toast_padding); + text.setCompoundDrawablePadding(paddingPx); toast.show(); } } @@ -1396,6 +1400,7 @@ public abstract class BaseStatusBar extends SystemUI implements final StatusBarIcon ic = new StatusBarIcon( entry.notification.getUser(), + entry.notification.getPackageName(), entry.notification.getNotification().getSmallIcon(), entry.notification.getNotification().iconLevel, entry.notification.getNotification().number, @@ -1682,10 +1687,11 @@ public abstract class BaseStatusBar extends SystemUI implements final StatusBarIcon ic = new StatusBarIcon( sbn.getUser(), - n.getSmallIcon(), - n.iconLevel, - n.number, - n.tickerText); + sbn.getPackageName(), + n.getSmallIcon(), + n.iconLevel, + n.number, + n.tickerText); if (!iconView.set(ic)) { handleNotificationError(sbn, "Couldn't create icon: " + ic); return null; @@ -1825,6 +1831,7 @@ public abstract class BaseStatusBar extends SystemUI implements // Update the icon final StatusBarIcon ic = new StatusBarIcon( notification.getUser(), + notification.getPackageName(), n.getSmallIcon(), n.iconLevel, n.number, @@ -1847,6 +1854,7 @@ public abstract class BaseStatusBar extends SystemUI implements if (DEBUG) Log.d(TAG, "not reusing notification for key: " + key); final StatusBarIcon ic = new StatusBarIcon( notification.getUser(), + notification.getPackageName(), n.getSmallIcon(), n.iconLevel, n.number, @@ -2093,4 +2101,11 @@ public abstract class BaseStatusBar extends SystemUI implements } return mStatusBarKeyguardViewManager.isSecure(); } + + @Override + public void showAssistDisclosure() { + if (mAssistManager != null) { + mAssistManager.showDisclosure(); + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index 80fdd288781e..0deff08367f0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -61,6 +61,7 @@ public class CommandQueue extends IStatusBar.Stub { private static final int MSG_APP_TRANSITION_PENDING = 19 << MSG_SHIFT; private static final int MSG_APP_TRANSITION_CANCELLED = 20 << MSG_SHIFT; private static final int MSG_APP_TRANSITION_STARTING = 21 << MSG_SHIFT; + private static final int MSG_ASSIST_DISCLOSURE = 22 << MSG_SHIFT; public static final int FLAG_EXCLUDE_NONE = 0; public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0; @@ -104,6 +105,7 @@ public class CommandQueue extends IStatusBar.Stub { public void appTransitionPending(); public void appTransitionCancelled(); public void appTransitionStarting(long startTime, long duration); + public void showAssistDisclosure(); } public CommandQueue(Callbacks callbacks, StatusBarIconList list) { @@ -274,6 +276,13 @@ public class CommandQueue extends IStatusBar.Stub { } } + public void showAssistDisclosure() { + synchronized (mList) { + mHandler.removeMessages(MSG_ASSIST_DISCLOSURE); + mHandler.obtainMessage(MSG_ASSIST_DISCLOSURE).sendToTarget(); + } + } + private final class H extends Handler { public void handleMessage(Message msg) { final int what = msg.what & MSG_MASK; @@ -366,6 +375,9 @@ public class CommandQueue extends IStatusBar.Stub { Pair<Long, Long> data = (Pair<Long, Long>) msg.obj; mCallbacks.appTransitionStarting(data.first, data.second); break; + case MSG_ASSIST_DISCLOSURE: + mCallbacks.showAssistDisclosure(); + break; } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java index dbabe3f61025..aedae521a7d4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java @@ -125,16 +125,22 @@ public class NotificationData { @Override public int compare(Entry a, Entry b) { - String mediaNotification = mEnvironment.getCurrentMediaNotificationKey(); - boolean aMedia = a.key.equals(mediaNotification); - boolean bMedia = b.key.equals(mediaNotification); - final StatusBarNotification na = a.notification; final StatusBarNotification nb = b.notification; + final int aPriority = na.getNotification().priority; + final int bPriority = nb.getNotification().priority; + + String mediaNotification = mEnvironment.getCurrentMediaNotificationKey(); + + // PRIORITY_MIN media streams are allowed to drift to the bottom + final boolean aMedia = a.key.equals(mediaNotification) + && aPriority > Notification.PRIORITY_MIN; + final boolean bMedia = b.key.equals(mediaNotification) + && bPriority > Notification.PRIORITY_MIN; - boolean aSystemMax = na.getNotification().priority >= Notification.PRIORITY_MAX && + boolean aSystemMax = aPriority >= Notification.PRIORITY_MAX && isSystemNotification(na); - boolean bSystemMax = nb.getNotification().priority >= Notification.PRIORITY_MAX && + boolean bSystemMax = bPriority >= Notification.PRIORITY_MAX && isSystemNotification(nb); int d = nb.getScore() - na.getScore(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java index 26d1c867ab08..fcdd4b7cd24b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java @@ -124,6 +124,9 @@ public class DemoStatusIcons extends LinearLayout implements DemoMode { private void updateSlot(String slot, String iconPkg, int iconId) { if (!mDemoMode) return; + if (iconPkg == null) { + iconPkg = mContext.getPackageName(); + } int removeIndex = -1; for (int i = 0; i < getChildCount(); i++) { StatusBarIconView v = (StatusBarIconView) getChildAt(i); @@ -143,10 +146,10 @@ public class DemoStatusIcons extends LinearLayout implements DemoMode { if (iconId == 0) { if (removeIndex != -1) { removeViewAt(removeIndex); - return; } + return; } - StatusBarIcon icon = new StatusBarIcon(iconPkg, UserHandle.CURRENT, iconId, 0, 0, "Demo"); + StatusBarIcon icon = new StatusBarIcon(iconPkg, UserHandle.OWNER, iconId, 0, 0, "Demo"); StatusBarIconView v = new StatusBarIconView(getContext(), null, null); v.setTag(slot); v.set(icon); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 3737d0581761..a3bb1296dccd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -26,6 +26,7 @@ import android.view.accessibility.AccessibilityEvent; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardHostView; +import com.android.keyguard.KeyguardSecurityView; import com.android.keyguard.R; import com.android.keyguard.ViewMediatorCallback; @@ -46,6 +47,7 @@ public class KeyguardBouncer { private ViewGroup mRoot; private boolean mShowingSoon; private Choreographer mChoreographer = Choreographer.getInstance(); + private int mBouncerPromptReason; public KeyguardBouncer(Context context, ViewMediatorCallback callback, LockPatternUtils lockPatternUtils, StatusBarWindowManager windowManager, @@ -68,6 +70,8 @@ public class KeyguardBouncer { return; } + mBouncerPromptReason = mCallback.getBouncerPromptReason(); + // Try to dismiss the Keyguard. If no security pattern is set, this will dismiss the whole // Keyguard. If we need to authenticate, show the bouncer. if (!mKeyguardView.dismiss()) { @@ -84,12 +88,24 @@ public class KeyguardBouncer { public void run() { mRoot.setVisibility(View.VISIBLE); mKeyguardView.onResume(); + showPromptReason(mBouncerPromptReason); mKeyguardView.startAppearAnimation(); mShowingSoon = false; mKeyguardView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); } }; + /** + * Show a string explaining why the security view needs to be solved. + * + * @param reason a flag indicating which string should be shown, see + * {@link KeyguardSecurityView#PROMPT_REASON_NONE} + * and {@link KeyguardSecurityView#PROMPT_REASON_RESTART} + */ + public void showPromptReason(int reason) { + mKeyguardView.showPromptReason(reason); + } + private void cancelShowRunnable() { mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, mShowRunnable, null); mShowingSoon = false; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 495f0fda8007..c30cb34592cb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -491,7 +491,7 @@ public class NotificationPanelView extends PanelView implements } public void closeQs() { - cancelAnimation(); + cancelQsAnimation(); setQsExpansion(mQsMinExpansionHeight); } @@ -508,7 +508,7 @@ public class NotificationPanelView extends PanelView implements } public void openQs() { - cancelAnimation(); + cancelQsAnimation(); if (mQsExpansionEnabled) { setQsExpansion(mQsMaxExpansionHeight); } @@ -921,7 +921,7 @@ public class NotificationPanelView extends PanelView implements @Override public void onOverscrollTopChanged(float amount, boolean isRubberbanded) { - cancelAnimation(); + cancelQsAnimation(); if (!mQsExpansionEnabled) { amount = 0f; } @@ -953,7 +953,8 @@ public class NotificationPanelView extends PanelView implements } private void onQsExpansionStarted(int overscrollAmount) { - cancelAnimation(); + cancelQsAnimation(); + cancelHeightAnimator(); // Reset scroll position and apply that position to the expanded height. float height = mQsExpansionHeight - mScrollView.getScrollY() - overscrollAmount; @@ -1391,7 +1392,7 @@ public class NotificationPanelView extends PanelView implements return mVelocityTracker.getYVelocity(); } - private void cancelAnimation() { + private void cancelQsAnimation() { if (mQsExpansionAnimator != null) { mQsExpansionAnimator.cancel(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index 9d4997c48a66..094d5f0b7601 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -535,7 +535,7 @@ public abstract class PanelView extends FrameLayout { */ protected abstract boolean isInContentBounds(float x, float y); - private void cancelHeightAnimator() { + protected void cancelHeightAnimator() { if (mHeightAnimator != null) { mHeightAnimator.cancel(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 69198ed6d6bf..ade40e507173 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -3101,16 +3101,16 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, || (mDisabled1 & StatusBarManager.DISABLE_SEARCH) != 0; } - public void postStartSettingsActivity(final Intent intent, int delay) { + public void postStartActivityDismissingKeyguard(final Intent intent, int delay) { mHandler.postDelayed(new Runnable() { @Override public void run() { - handleStartSettingsActivity(intent, true /*onlyProvisioned*/); + handleStartActivityDismissingKeyguard(intent, true /*onlyProvisioned*/); } }, delay); } - private void handleStartSettingsActivity(Intent intent, boolean onlyProvisioned) { + private void handleStartActivityDismissingKeyguard(Intent intent, boolean onlyProvisioned) { startActivityDismissingKeyguard(intent, onlyProvisioned, true /* dismissShade */); } @@ -3460,6 +3460,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mKeyguardIndicationController.setVisible(true); mNotificationPanel.resetViews(); mKeyguardUserSwitcher.setKeyguard(true, fromShadeLocked); + mStatusBarView.removePendingHideExpandedRunnables(); } else { mKeyguardIndicationController.setVisible(false); mKeyguardUserSwitcher.setKeyguard(false, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java index dfd280aa09b6..6a469243c565 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java @@ -42,6 +42,12 @@ public class PhoneStatusBarView extends PanelBar { private ScrimController mScrimController; private float mMinFraction; private float mPanelFraction; + private Runnable mHideExpandedRunnable = new Runnable() { + @Override + public void run() { + mBar.makeExpandedInvisible(); + } + }; public PhoneStatusBarView(Context context, AttributeSet attrs) { super(context, attrs); @@ -118,15 +124,14 @@ public class PhoneStatusBarView extends PanelBar { + Log.getStackTraceString(new Throwable())); } // Close the status bar in the next frame so we can show the end of the animation. - postOnAnimation(new Runnable() { - @Override - public void run() { - mBar.makeExpandedInvisible(); - } - }); + postOnAnimation(mHideExpandedRunnable); mLastFullyOpenedPanel = null; } + public void removePendingHideExpandedRunnables() { + removeCallbacks(mHideExpandedRunnable); + } + @Override public void onPanelFullyOpened(PanelView openPanel) { super.onPanelFullyOpened(openPanel); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java index 25a93ddfd819..12434ac2af5b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java @@ -129,8 +129,8 @@ public class QSTileHost implements QSTile.Host, Tunable { } @Override - public void startSettingsActivity(final Intent intent) { - mStatusBar.postStartSettingsActivity(intent, 0); + public void startActivityDismissingKeyguard(final Intent intent) { + mStatusBar.postStartActivityDismissingKeyguard(intent, 0); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java index 0eb719767979..d1e4963f18ec 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java @@ -116,7 +116,7 @@ public class AccessPointControllerImpl // Unknown network, need to add it. if (ap.getSecurity() != AccessPoint.SECURITY_NONE) { Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS); - intent.putExtra(EXTRA_START_CONNECT_SSID, ap.getSsid()); + intent.putExtra(EXTRA_START_CONNECT_SSID, ap.getSsidStr()); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); fireSettingsIntentCallback(intent); return true; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java index 3cc92978d393..daa84ad80ccf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java @@ -154,6 +154,12 @@ public class BluetoothControllerImpl implements BluetoothController, BluetoothCa } private void updateConnected() { + // Make sure our connection state is up to date. + int state = mLocalBluetoothManager.getBluetoothAdapter().getConnectionState(); + if (state != mConnectionState) { + mConnectionState = state; + mHandler.sendEmptyMessage(H.MSG_STATE_CHANGED); + } if (mLastDevice != null && mLastDevice.isConnected()) { // Our current device is still valid. return; @@ -203,9 +209,9 @@ public class BluetoothControllerImpl implements BluetoothController, BluetoothCa @Override public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) { - mConnectionState = state; mLastDevice = cachedDevice; updateConnected(); + mConnectionState = state; mHandler.sendEmptyMessage(H.MSG_STATE_CHANGED); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index 18b582040db1..1ba87dad7af5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -408,7 +408,7 @@ public class NetworkControllerImpl extends BroadcastReceiver boolean hasNoSims = mHasMobileDataFeature && mMobileSignalControllers.size() == 0; if (hasNoSims != mHasNoSims) { mHasNoSims = hasNoSims; - notifyListeners(); + mCallbackHandler.setNoSims(mHasNoSims); } } @@ -660,8 +660,8 @@ public class NetworkControllerImpl extends BroadcastReceiver } String nosim = args.getString("nosim"); if (nosim != null) { - boolean show = nosim.equals("show"); - mCallbackHandler.setNoSims(show); + mHasNoSims = nosim.equals("show"); + mCallbackHandler.setNoSims(mHasNoSims); } String mobile = args.getString("mobile"); if (mobile != null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 1bf4547c61db..57007321f7d1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -228,6 +228,7 @@ public class NotificationStackScrollLayout extends ViewGroup private ScrimController mScrimController; private boolean mForceNoOverlappingRendering; private NotificationOverflowContainer mOverflowContainer; + private final ArrayList<Pair<ExpandableNotificationRow, Boolean>> mTmpList = new ArrayList<>(); public NotificationStackScrollLayout(Context context) { this(context, null); @@ -1608,7 +1609,7 @@ public class NotificationStackScrollLayout extends ViewGroup } @Override - protected void onViewRemoved(View child) { + public void onViewRemoved(View child) { super.onViewRemoved(child); // we only call our internal methods if this is actually a removal and not just a // notification which becomes a child notification @@ -1651,8 +1652,7 @@ public class NotificationStackScrollLayout extends ViewGroup * @return Whether an animation was generated. */ private boolean generateRemoveAnimation(View child) { - if (mAddedHeadsUpChildren.contains(child)) { - removeChildFromHeadsUpChangeAnimations(child); + if (removeRemovedChildFromHeadsUpChangeAnimations(child)) { mAddedHeadsUpChildren.remove(child); return false; } @@ -1671,15 +1671,27 @@ public class NotificationStackScrollLayout extends ViewGroup return false; } - private void removeChildFromHeadsUpChangeAnimations(View child) { - ArrayList<Pair<ExpandableNotificationRow, Boolean> > toRemove = new ArrayList<>(); + /** + * Remove a removed child view from the heads up animations if it was just added there + * + * @return whether any child was removed from the list to animate + */ + private boolean removeRemovedChildFromHeadsUpChangeAnimations(View child) { + boolean hasAddEvent = false; for (Pair<ExpandableNotificationRow, Boolean> eventPair : mHeadsUpChangeAnimations) { ExpandableNotificationRow row = eventPair.first; + boolean isHeadsUp = eventPair.second; if (child == row) { - toRemove.add(eventPair); + mTmpList.add(eventPair); + hasAddEvent |= isHeadsUp; } } - mHeadsUpChangeAnimations.removeAll(toRemove); + if (hasAddEvent) { + // This child was just added lets remove all events. + mHeadsUpChangeAnimations.removeAll(mTmpList); + } + mTmpList.clear(); + return hasAddEvent; } /** @@ -1745,7 +1757,7 @@ public class NotificationStackScrollLayout extends ViewGroup } @Override - protected void onViewAdded(View child) { + public void onViewAdded(View child) { super.onViewAdded(child); onViewAddedInternal(child); } diff --git a/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java index d9f05986efd1..ca6aaeba8c0a 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java @@ -131,11 +131,14 @@ public class DemoModeFragment extends PreferenceFragment implements OnPreference intent.putExtra("mobile", "show"); intent.putExtra("sims", "1"); intent.putExtra("nosim", "false"); - intent.putExtra("fully", "true"); intent.putExtra("level", "4"); intent.putExtra("datatypel", ""); getContext().sendBroadcast(intent); + // Need to send this after so that the sim controller already exists. + intent.putExtra("fully", "true"); + getContext().sendBroadcast(intent); + intent.putExtra(DemoMode.EXTRA_COMMAND, DemoMode.COMMAND_BATTERY); intent.putExtra("level", "100"); intent.putExtra("plugged", "false"); diff --git a/packages/SystemUI/src/com/android/systemui/volume/Events.java b/packages/SystemUI/src/com/android/systemui/volume/Events.java index 12dca94614ab..893c9395f23f 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/Events.java +++ b/packages/SystemUI/src/com/android/systemui/volume/Events.java @@ -16,11 +16,13 @@ package com.android.systemui.volume; +import android.content.Context; import android.media.AudioManager; import android.media.AudioSystem; import android.provider.Settings.Global; import android.util.Log; +import com.android.internal.logging.MetricsLogger; import com.android.systemui.volume.VolumeDialogController.State; import java.util.Arrays; @@ -47,6 +49,7 @@ public class Events { public static final int EVENT_ZEN_MODE_CHANGED = 13; // (mode|int) public static final int EVENT_SUPPRESSOR_CHANGED = 14; // (component|string) (name|string) public static final int EVENT_MUTE_CHANGED = 15; // (stream|int) (muted|bool) + public static final int EVENT_TOUCH_LEVEL_DONE = 16; // (stream|int) (level|bool) private static final String[] EVENT_TAGS = { "show_dialog", @@ -65,6 +68,7 @@ public class Events { "zen_mode_changed", "suppressor_changed", "mute_changed", + "touch_level_done", }; public static final int DISMISS_REASON_UNKNOWN = 0; @@ -100,36 +104,59 @@ public class Events { public static Callback sCallback; - public static void writeEvent(int tag, Object... list) { + public static void writeEvent(Context context, int tag, Object... list) { final long time = System.currentTimeMillis(); final StringBuilder sb = new StringBuilder("writeEvent ").append(EVENT_TAGS[tag]); if (list != null && list.length > 0) { sb.append(" "); switch (tag) { case EVENT_SHOW_DIALOG: + MetricsLogger.visible(context, MetricsLogger.VOLUME_DIALOG); + MetricsLogger.histogram(context, "volume_from_keyguard", + (Boolean) list[1] ? 1 : 0); sb.append(SHOW_REASONS[(Integer) list[0]]).append(" keyguard=").append(list[1]); break; case EVENT_EXPAND: + MetricsLogger.visibility(context, MetricsLogger.VOLUME_DIALOG_DETAILS, + (Boolean) list[0]); sb.append(list[0]); break; case EVENT_DISMISS_DIALOG: + MetricsLogger.hidden(context, MetricsLogger.VOLUME_DIALOG); sb.append(DISMISS_REASONS[(Integer) list[0]]); break; case EVENT_ACTIVE_STREAM_CHANGED: + MetricsLogger.action(context, MetricsLogger.ACTION_VOLUME_STREAM, + (Integer) list[0]); sb.append(AudioSystem.streamToString((Integer) list[0])); break; case EVENT_ICON_CLICK: + MetricsLogger.action(context, MetricsLogger.ACTION_VOLUME_ICON, + (Integer) list[1]); sb.append(AudioSystem.streamToString((Integer) list[0])).append(' ') .append(iconStateToString((Integer) list[1])); break; + case EVENT_TOUCH_LEVEL_DONE: + MetricsLogger.action(context, MetricsLogger.ACTION_VOLUME_SLIDER, + (Integer) list[1]); + // fall through case EVENT_TOUCH_LEVEL_CHANGED: case EVENT_LEVEL_CHANGED: case EVENT_MUTE_CHANGED: sb.append(AudioSystem.streamToString((Integer) list[0])).append(' ') .append(list[1]); break; - case EVENT_INTERNAL_RINGER_MODE_CHANGED: + case EVENT_KEY: + MetricsLogger.action(context, MetricsLogger.ACTION_VOLUME_KEY, + (Integer) list[1]); + sb.append(AudioSystem.streamToString((Integer) list[0])).append(' ') + .append(list[1]); + break; case EVENT_EXTERNAL_RINGER_MODE_CHANGED: + MetricsLogger.action(context, MetricsLogger.ACTION_RINGER_MODE, + (Integer) list[0]); + // fall through + case EVENT_INTERNAL_RINGER_MODE_CHANGED: sb.append(ringerModeToString((Integer) list[0])); break; case EVENT_ZEN_MODE_CHANGED: diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java index aa891b6faf67..5b2eb848afa8 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java @@ -369,7 +369,7 @@ public class VolumeDialog { row.icon.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - Events.writeEvent(Events.EVENT_ICON_CLICK, row.stream, row.iconState); + Events.writeEvent(mContext, Events.EVENT_ICON_CLICK, row.stream, row.iconState); mController.setActiveStream(row.stream); if (row.stream == AudioManager.STREAM_RING) { final boolean hasVibrator = mController.hasVibrator(); @@ -417,7 +417,7 @@ public class VolumeDialog { if (mShowing) return; mShowing = true; mDialog.show(); - Events.writeEvent(Events.EVENT_SHOW_DIALOG, reason, mKeyguard.isKeyguardLocked()); + Events.writeEvent(mContext, Events.EVENT_SHOW_DIALOG, reason, mKeyguard.isKeyguardLocked()); mController.notifyVisible(true); } @@ -444,7 +444,7 @@ public class VolumeDialog { if (!mShowing) return; mShowing = false; mDialog.dismiss(); - Events.writeEvent(Events.EVENT_DISMISS_DIALOG, reason); + Events.writeEvent(mContext, Events.EVENT_DISMISS_DIALOG, reason); setExpandedH(false); mController.notifyVisible(false); synchronized (mSafetyWarningLock) { @@ -834,7 +834,7 @@ public class VolumeDialog { public void onClick(View v) { if (mExpanding) return; final boolean newExpand = !mExpanded; - Events.writeEvent(Events.EVENT_EXPAND, v); + Events.writeEvent(mContext, Events.EVENT_EXPAND, newExpand); setExpandedH(newExpand); } }; @@ -845,7 +845,7 @@ public class VolumeDialog { mSettingsButton.postDelayed(new Runnable() { @Override public void run() { - Events.writeEvent(Events.EVENT_SETTINGS_CLICK); + Events.writeEvent(mContext, Events.EVENT_SETTINGS_CLICK); if (mCallback != null) { mCallback.onSettingsClicked(); } @@ -933,7 +933,8 @@ public class VolumeDialog { if (mRow.requestedLevel != userLevel) { mController.setStreamVolume(mRow.stream, userLevel); mRow.requestedLevel = userLevel; - Events.writeEvent(Events.EVENT_TOUCH_LEVEL_CHANGED, mRow.stream, userLevel); + Events.writeEvent(mContext, Events.EVENT_TOUCH_LEVEL_CHANGED, mRow.stream, + userLevel); } } } @@ -951,6 +952,7 @@ public class VolumeDialog { mRow.tracking = false; mRow.userAttempt = SystemClock.uptimeMillis(); int userLevel = getImpliedLevel(seekBar, seekBar.getProgress()); + Events.writeEvent(mContext, Events.EVENT_TOUCH_LEVEL_DONE, mRow.stream, userLevel); if (mRow.ss.level != userLevel) { mHandler.sendMessageDelayed(mHandler.obtainMessage(H.RECHECK, mRow), USER_ATTEMPT_GRACE_PERIOD); diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogController.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogController.java index c6d9e466c2a4..9a59a2af9886 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogController.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogController.java @@ -104,7 +104,7 @@ public class VolumeDialogController { public VolumeDialogController(Context context, ComponentName component) { mContext = context.getApplicationContext(); - Events.writeEvent(Events.EVENT_COLLECTION_STARTED); + Events.writeEvent(mContext, Events.EVENT_COLLECTION_STARTED); mComponent = component; mWorkerThread = new HandlerThread(VolumeDialogController.class.getSimpleName()); mWorkerThread.start(); @@ -168,7 +168,7 @@ public class VolumeDialogController { if (D.BUG) Log.d(TAG, "destroy"); if (mDestroyed) return; mDestroyed = true; - Events.writeEvent(Events.EVENT_COLLECTION_STOPPED); + Events.writeEvent(mContext, Events.EVENT_COLLECTION_STOPPED); mMediaSessions.destroy(); mObserver.destroy(); mReceiver.destroy(); @@ -293,7 +293,8 @@ public class VolumeDialogController { if (showUI) { changed |= updateActiveStreamW(stream); } - changed |= updateStreamLevelW(stream, mAudio.getLastAudibleStreamVolume(stream)); + int lastAudibleStreamVolume = mAudio.getLastAudibleStreamVolume(stream); + changed |= updateStreamLevelW(stream, lastAudibleStreamVolume); changed |= checkRoutedToBluetoothW(showUI ? AudioManager.STREAM_MUSIC : stream); if (changed) { mCallbacks.onStateChanged(mState); @@ -308,14 +309,14 @@ public class VolumeDialogController { mCallbacks.onShowSilentHint(); } if (changed && fromKey) { - Events.writeEvent(Events.EVENT_KEY); + Events.writeEvent(mContext, Events.EVENT_KEY, stream, lastAudibleStreamVolume); } } private boolean updateActiveStreamW(int activeStream) { if (activeStream == mState.activeStream) return false; mState.activeStream = activeStream; - Events.writeEvent(Events.EVENT_ACTIVE_STREAM_CHANGED, activeStream); + Events.writeEvent(mContext, Events.EVENT_ACTIVE_STREAM_CHANGED, activeStream); if (D.BUG) Log.d(TAG, "updateActiveStreamW " + activeStream); final int s = activeStream < DYNAMIC_STREAM_START_INDEX ? activeStream : -1; if (D.BUG) Log.d(TAG, "forceVolumeControlStream " + s); @@ -364,7 +365,7 @@ public class VolumeDialogController { if (ss.level == level) return false; ss.level = level; if (isLogWorthy(stream)) { - Events.writeEvent(Events.EVENT_LEVEL_CHANGED, stream, level); + Events.writeEvent(mContext, Events.EVENT_LEVEL_CHANGED, stream, level); } return true; } @@ -387,7 +388,7 @@ public class VolumeDialogController { if (ss.muted == muted) return false; ss.muted = muted; if (isLogWorthy(stream)) { - Events.writeEvent(Events.EVENT_MUTE_CHANGED, stream, muted); + Events.writeEvent(mContext, Events.EVENT_MUTE_CHANGED, stream, muted); } if (muted && isRinger(stream)) { updateRingerModeInternalW(mAudio.getRingerModeInternal()); @@ -410,7 +411,7 @@ public class VolumeDialogController { if (Objects.equals(mState.effectsSuppressor, effectsSuppressor)) return false; mState.effectsSuppressor = effectsSuppressor; mState.effectsSuppressorName = getApplicationName(mContext, mState.effectsSuppressor); - Events.writeEvent(Events.EVENT_SUPPRESSOR_CHANGED, mState.effectsSuppressor, + Events.writeEvent(mContext, Events.EVENT_SUPPRESSOR_CHANGED, mState.effectsSuppressor, mState.effectsSuppressorName); return true; } @@ -434,21 +435,21 @@ public class VolumeDialogController { Settings.Global.ZEN_MODE, Settings.Global.ZEN_MODE_OFF); if (mState.zenMode == zen) return false; mState.zenMode = zen; - Events.writeEvent(Events.EVENT_ZEN_MODE_CHANGED, zen); + Events.writeEvent(mContext, Events.EVENT_ZEN_MODE_CHANGED, zen); return true; } private boolean updateRingerModeExternalW(int rm) { if (rm == mState.ringerModeExternal) return false; mState.ringerModeExternal = rm; - Events.writeEvent(Events.EVENT_EXTERNAL_RINGER_MODE_CHANGED, rm); + Events.writeEvent(mContext, Events.EVENT_EXTERNAL_RINGER_MODE_CHANGED, rm); return true; } private boolean updateRingerModeInternalW(int rm) { if (rm == mState.ringerModeInternal) return false; mState.ringerModeInternal = rm; - Events.writeEvent(Events.EVENT_INTERNAL_RINGER_MODE_CHANGED, rm); + Events.writeEvent(mContext, Events.EVENT_INTERNAL_RINGER_MODE_CHANGED, rm); return true; } diff --git a/packages/VpnDialogs/AndroidManifest.xml b/packages/VpnDialogs/AndroidManifest.xml index 32e1e6de687f..375c5d8aeda9 100644 --- a/packages/VpnDialogs/AndroidManifest.xml +++ b/packages/VpnDialogs/AndroidManifest.xml @@ -24,7 +24,7 @@ <application android:label="VpnDialogs" android:allowBackup="false" > <activity android:name=".ConfirmDialog" - android:theme="@*android:style/Theme.Material.DayNight.Dialog.Alert"> + android:theme="@*android:style/Theme.DeviceDefault.Light.Dialog.Alert"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.DEFAULT"/> @@ -32,7 +32,7 @@ </activity> <activity android:name=".ManageDialog" - android:theme="@*android:style/Theme.Material.DayNight.Dialog.Alert" + android:theme="@*android:style/Theme.DeviceDefault.Light.Dialog.Alert" android:noHistory="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> diff --git a/packages/WallpaperCropper/res/values/styles.xml b/packages/WallpaperCropper/res/values/styles.xml index e438c84027db..a34b25a8dc31 100644 --- a/packages/WallpaperCropper/res/values/styles.xml +++ b/packages/WallpaperCropper/res/values/styles.xml @@ -15,13 +15,13 @@ --> <resources> - <style name="Theme.WallpaperCropper" parent="@android:style/Theme.Material.DayNight"> + <style name="Theme.WallpaperCropper" parent="@android:style/Theme.DeviceDefault"> <item name="android:actionBarStyle">@style/WallpaperCropperActionBar</item> <item name="android:windowFullscreen">true</item> <item name="android:windowActionBarOverlay">true</item> </style> - <style name="WallpaperCropperActionBar" parent="@android:style/Widget.Material.ActionBar"> + <style name="WallpaperCropperActionBar" parent="android:style/Widget.DeviceDefault.ActionBar"> <item name="android:displayOptions">showCustom</item> <item name="android:background">#88000000</item> </style> diff --git a/rs/java/android/renderscript/ScriptGroup.java b/rs/java/android/renderscript/ScriptGroup.java index 82d9a2f4403f..9000d4d9c50c 100644 --- a/rs/java/android/renderscript/ScriptGroup.java +++ b/rs/java/android/renderscript/ScriptGroup.java @@ -851,13 +851,13 @@ public final class ScriptGroup extends BaseObj { * Returns the field ID */ - public Script.FieldID getField() { return mField; } + Script.FieldID getField() { return mField; } /** * Returns the value */ - public Object getValue() { return mValue; } + Object getValue() { return mValue; } } /** diff --git a/rs/java/android/renderscript/ScriptIntrinsicBLAS.java b/rs/java/android/renderscript/ScriptIntrinsicBLAS.java index f7e81b01cf64..aa72fba6cd69 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicBLAS.java +++ b/rs/java/android/renderscript/ScriptIntrinsicBLAS.java @@ -22,7 +22,12 @@ import java.lang.annotation.RetentionPolicy; /** * - * BLAS + * ScriptIntrinsicBLAS class provides high performance RenderScript APIs to BLAS. + * + * The BLAS (Basic Linear Algebra Subprograms) are routines that provide standard + * building blocks for performing basic vector and matrix operations. + * + * For detailed description of BLAS, please refer to http://www.netlib.org/blas/ * **/ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { @@ -179,24 +184,40 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { private static final int RsBlas_bnnm = 1000; /** + * Create an intrinsic to access BLAS subroutines. + * + * @param rs The RenderScript context + * @return ScriptIntrinsicBLAS */ public static ScriptIntrinsicBLAS create(RenderScript rs) { long id = rs.nScriptIntrinsicCreate(13, Element.U32(rs).getID(rs)); return new ScriptIntrinsicBLAS(id, rs); } + /** + * @hide + */ @IntDef({NO_TRANSPOSE, TRANSPOSE, CONJ_TRANSPOSE}) @Retention(RetentionPolicy.SOURCE) public @interface Transpose {} + /** + * @hide + */ @IntDef({UPPER, LOWER}) @Retention(RetentionPolicy.SOURCE) public @interface Uplo {} + /** + * @hide + */ @IntDef({NON_UNIT, UNIT}) @Retention(RetentionPolicy.SOURCE) public @interface Diag {} + /** + * @hide + */ @IntDef({LEFT, RIGHT}) @Retention(RetentionPolicy.SOURCE) public @interface Side {} @@ -280,24 +301,88 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { throw new RSRuntimeException("Incorrect vector dimensions for GEMV"); } } + + /** + * SGEMV performs one of the matrix-vector operations + * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/db/d58/sgemv_8f.html + * + * @param TransA The type of transpose applied to matrix A. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void SGEMV(@Transpose int TransA, float alpha, Allocation A, Allocation X, int incX, float beta, Allocation Y, int incY) { validateGEMV(Element.F32(mRS), TransA, A, X, incX, Y, incY); int M = A.getType().getY(); int N = A.getType().getX(); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sgemv, TransA, 0, 0, 0, 0, M, N, 0, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * DGEMV performs one of the matrix-vector operations + * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/dc/da8/dgemv_8f.html + * + * @param TransA The type of transpose applied to matrix A. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void DGEMV(@Transpose int TransA, double alpha, Allocation A, Allocation X, int incX, double beta, Allocation Y, int incY) { validateGEMV(Element.F64(mRS), TransA, A, X, incX, Y, incY); int M = A.getType().getY(); int N = A.getType().getX(); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dgemv, TransA, 0, 0, 0, 0, M, N, 0, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * CGEMV performs one of the matrix-vector operations + * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y or y := alpha*A**H*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d4/d8a/cgemv_8f.html + * + * @param TransA The type of transpose applied to matrix A. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void CGEMV(@Transpose int TransA, Float2 alpha, Allocation A, Allocation X, int incX, Float2 beta, Allocation Y, int incY) { validateGEMV(Element.F32_2(mRS), TransA, A, X, incX, Y, incY); int M = A.getType().getY(); int N = A.getType().getX(); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cgemv, TransA, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * ZGEMV performs one of the matrix-vector operations + * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y or y := alpha*A**H*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/db/d40/zgemv_8f.html + * + * @param TransA The type of transpose applied to matrix A. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void ZGEMV(@Transpose int TransA, Double2 alpha, Allocation A, Allocation X, int incX, Double2 beta, Allocation Y, int incY) { validateGEMV(Element.F64_2(mRS), TransA, A, X, incX, Y, incY); int M = A.getType().getY(); @@ -305,6 +390,30 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zgemv, TransA, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0); } + /** + * SGBMV performs one of the matrix-vector operations + * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d6/d46/sgbmv_8f.html + * + * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N), + * but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an + * example showing how to convert the original matrix 'a' to row-based band matrix 'b'. + * for i in range(0, m): + * for j in range(max(0, i-kl), min(i+ku+1, n)): + * b[i, j-i+kl] = a[i, j] + * + * @param TransA The type of transpose applied to matrix A. + * @param KL The number of sub-diagonals of the matrix A. + * @param KU The number of super-diagonals of the matrix A. + * @param alpha The scalar alpha. + * @param A The input allocation contains the band matrix A, supported elements type {@link Element#F32}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void SGBMV(@Transpose int TransA, int KL, int KU, float alpha, Allocation A, Allocation X, int incX, float beta, Allocation Y, int incY) { // GBMV has the same validation requirements as GEMV + KL and KU >= 0 validateGEMV(Element.F32(mRS), TransA, A, X, incX, Y, incY); @@ -315,6 +424,31 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { int N = A.getType().getX(); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sgbmv, TransA, 0, 0, 0, 0, M, N, 0, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, KL, KU); } + + /** + * DGBMV performs one of the matrix-vector operations + * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d2/d3f/dgbmv_8f.html + * + * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N), + * but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an + * example showing how to convert the original matrix 'a' to row-based band matrix 'b'. + * for i in range(0, m): + * for j in range(max(0, i-kl), min(i+ku+1, n)): + * b[i, j-i+kl] = a[i, j] + * + * @param TransA The type of transpose applied to matrix A. + * @param KL The number of sub-diagonals of the matrix A. + * @param KU The number of super-diagonals of the matrix A. + * @param alpha The scalar alpha. + * @param A The input allocation contains the band matrix A, supported elements type {@link Element#F64}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void DGBMV(@Transpose int TransA, int KL, int KU, double alpha, Allocation A, Allocation X, int incX, double beta, Allocation Y, int incY) { // GBMV has the same validation requirements as GEMV + KL and KU >= 0 validateGEMV(Element.F64(mRS), TransA, A, X, incX, Y, incY); @@ -325,6 +459,31 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { int N = A.getType().getX(); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dgbmv, TransA, 0, 0, 0, 0, M, N, 0, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, KL, KU); } + + /** + * CGBMV performs one of the matrix-vector operations + * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y or y := alpha*A**H*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d0/d75/cgbmv_8f.html + * + * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N), + * but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an + * example showing how to convert the original matrix 'a' to row-based band matrix 'b'. + * for i in range(0, m): + * for j in range(max(0, i-kl), min(i+ku+1, n)): + * b[i, j-i+kl] = a[i, j] + * + * @param TransA The type of transpose applied to matrix A. + * @param KL The number of sub-diagonals of the matrix A. + * @param KU The number of super-diagonals of the matrix A. + * @param alpha The scalar alpha. + * @param A The input allocation contains the band matrix A, supported elements type {@link Element#F32_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void CGBMV(@Transpose int TransA, int KL, int KU, Float2 alpha, Allocation A, Allocation X, int incX, Float2 beta, Allocation Y, int incY) { // GBMV has the same validation requirements as GEMV + KL and KU >= 0 validateGEMV(Element.F32_2(mRS), TransA, A, X, incX, Y, incY); @@ -335,6 +494,31 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { int N = A.getType().getX(); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cgbmv, TransA, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, KL, KU); } + + /** + * ZGBMV performs one of the matrix-vector operations + * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y or y := alpha*A**H*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d9/d46/zgbmv_8f.html + * + * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N), + * but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an + * example showing how to convert the original matrix 'a' to row-based band matrix 'b'. + * for i in range(0, m): + * for j in range(max(0, i-kl), min(i+ku+1, n)): + * b[i, j-i+kl] = a[i, j] + * + * @param TransA The type of transpose applied to matrix A. + * @param KL The number of sub-diagonals of the matrix A. + * @param KU The number of super-diagonals of the matrix A. + * @param alpha The scalar alpha. + * @param A The input allocation contains the band matrix A, supported elements type {@link Element#F64_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void ZGBMV(@Transpose int TransA, int KL, int KU, Double2 alpha, Allocation A, Allocation X, int incX, Double2 beta, Allocation Y, int incY) { // GBMV has the same validation requirements as GEMV + KL and KU >= 0 validateGEMV(Element.F64_2(mRS), TransA, A, X, incX, Y, incY); @@ -403,27 +587,103 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { return N; } + /** + * STRMV performs one of the matrix-vector operations + * x := A*x or x := A**T*x + * + * Details: http://www.netlib.org/lapack/explore-html/de/d45/strmv_8f.html + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void STRMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation A, Allocation X, int incX) { validateTRMV(Element.F32(mRS), Uplo, TransA, Diag, A, X, incX); int N = A.getType().getY(); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_strmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0); } + + /** + * DTRMV performs one of the matrix-vector operations + * x := A*x or x := A**T*x + * + * Details: http://www.netlib.org/lapack/explore-html/dc/d7e/dtrmv_8f.html + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void DTRMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation A, Allocation X, int incX) { validateTRMV(Element.F64(mRS), Uplo, TransA, Diag, A, X, incX); int N = A.getType().getY(); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtrmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0); } + + /** + * CTRMV performs one of the matrix-vector operations + * x := A*x or x := A**T*x or x := A**H*x + * + * Details: http://www.netlib.org/lapack/explore-html/df/d78/ctrmv_8f.html + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void CTRMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation A, Allocation X, int incX) { validateTRMV(Element.F32_2(mRS), Uplo, TransA, Diag, A, X, incX); int N = A.getType().getY(); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctrmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0); } + + /** + * ZTRMV performs one of the matrix-vector operations + * x := A*x or x := A**T*x or x := A**H*x + * + * Details: http://www.netlib.org/lapack/explore-html/d0/dd1/ztrmv_8f.html + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void ZTRMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation A, Allocation X, int incX) { validateTRMV(Element.F64_2(mRS), Uplo, TransA, Diag, A, X, incX); int N = A.getType().getY(); mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_ztrmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0); } + /** + * STBMV performs one of the matrix-vector operations + * x := A*x or x := A**T*x + * + * Details: http://www.netlib.org/lapack/explore-html/d6/d7d/stbmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), + * but only the region N*(K+1) will be referenced. The following subroutine can is an + * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. + * for i in range(0, n): + * for j in range(i, min(i+k+1, n)): + * b[i, j-i] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param K The number of off-diagonals of the matrix A + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void STBMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, int K, Allocation A, Allocation X, int incX) { // TBMV has the same requirements as TRMV + K >= 0 if (K < 0) { @@ -433,6 +693,28 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { int N = A.getType().getY(); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_stbmv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0); } + + /** + * DTBMV performs one of the matrix-vector operations + * x := A*x or x := A**T*x + * + * Details: http://www.netlib.org/lapack/explore-html/df/d29/dtbmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), + * but only the region N*(K+1) will be referenced. The following subroutine can is an + * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. + * for i in range(0, n): + * for j in range(i, min(i+k+1, n)): + * b[i, j-i] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param K The number of off-diagonals of the matrix A + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void DTBMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, int K, Allocation A, Allocation X, int incX) { // TBMV has the same requirements as TRMV + K >= 0 if (K < 0) { @@ -442,6 +724,28 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { int N = A.getType().getY(); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtbmv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0); } + + /** + * CTBMV performs one of the matrix-vector operations + * x := A*x or x := A**T*x or x := A**H*x + * + * Details: http://www.netlib.org/lapack/explore-html/d3/dcd/ctbmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), + * but only the region N*(K+1) will be referenced. The following subroutine can is an + * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. + * for i in range(0, n): + * for j in range(i, min(i+k+1, n)): + * b[i, j-i] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param K The number of off-diagonals of the matrix A + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void CTBMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, int K, Allocation A, Allocation X, int incX) { // TBMV has the same requirements as TRMV + K >= 0 if (K < 0) { @@ -451,6 +755,28 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { int N = A.getType().getY(); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctbmv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0); } + + /** + * ZTBMV performs one of the matrix-vector operations + * x := A*x or x := A**T*x or x := A**H*x + * + * Details: http://www.netlib.org/lapack/explore-html/d3/d39/ztbmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), + * but only the region N*(K+1) will be referenced. The following subroutine can is an + * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. + * for i in range(0, n): + * for j in range(i, min(i+k+1, n)): + * b[i, j-i] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param K The number of off-diagonals of the matrix A + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void ZTBMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, int K, Allocation A, Allocation X, int incX) { // TBMV has the same requirements as TRMV + K >= 0 if (K < 0) { @@ -460,22 +786,124 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { int N = A.getType().getY(); mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_ztbmv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0); } + + /** + * STPMV performs one of the matrix-vector operations + * x := A*x or x := A**T*x + * + * Details: http://www.netlib.org/lapack/explore-html/db/db1/stpmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F32}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void STPMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation Ap, Allocation X, int incX) { int N = validateTPMV(Element.F32(mRS), Uplo, TransA, Diag, Ap, X, incX); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_stpmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0); } + + /** + * DTPMV performs one of the matrix-vector operations + * x := A*x or x := A**T*x + * + * Details: http://www.netlib.org/lapack/explore-html/dc/dcd/dtpmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F64}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void DTPMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation Ap, Allocation X, int incX) { int N = validateTPMV(Element.F64(mRS), Uplo, TransA, Diag, Ap, X, incX); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtpmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0); } + + /** + * CTPMV performs one of the matrix-vector operations + * x := A*x or x := A**T*x or x := A**H*x + * + * Details: http://www.netlib.org/lapack/explore-html/d4/dbb/ctpmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F32_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void CTPMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation Ap, Allocation X, int incX) { int N = validateTPMV(Element.F32_2(mRS), Uplo, TransA, Diag, Ap, X, incX); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctpmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0); } + + /** + * ZTPMV performs one of the matrix-vector operations + * x := A*x or x := A**T*x or x := A**H*x + * + * Details: http://www.netlib.org/lapack/explore-html/d2/d9e/ztpmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F64_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void ZTPMV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation Ap, Allocation X, int incX) { int N = validateTPMV(Element.F64_2(mRS), Uplo, TransA, Diag, Ap, X, incX); mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_ztpmv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0); } + + /** + * STRSV solves one of the systems of equations + * A*x = b or A**T*x = b + * + * Details: http://www.netlib.org/lapack/explore-html/d0/d2a/strsv_8f.html + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void STRSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation A, Allocation X, int incX) { // TRSV is the same as TRMV validateTRMV(Element.F32(mRS), Uplo, TransA, Diag, A, X, incX); @@ -483,6 +911,20 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_strsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0); } + + /** + * DTRSV solves one of the systems of equations + * A*x = b or A**T*x = b + * + * Details: http://www.netlib.org/lapack/explore-html/d6/d96/dtrsv_8f.html + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void DTRSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation A, Allocation X, int incX) { // TRSV is the same as TRMV validateTRMV(Element.F64(mRS), Uplo, TransA, Diag, A, X, incX); @@ -490,6 +932,20 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtrsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0); } + + /** + * CTRSV solves one of the systems of equations + * A*x = b or A**T*x = b or A**H*x = b + * + * Details: http://www.netlib.org/lapack/explore-html/d4/dc8/ctrsv_8f.html + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void CTRSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation A, Allocation X, int incX) { // TRSV is the same as TRMV validateTRMV(Element.F32_2(mRS), Uplo, TransA, Diag, A, X, incX); @@ -497,6 +953,20 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctrsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0); } + + /** + * ZTRSV solves one of the systems of equations + * A*x = b or A**T*x = b or A**H*x = b + * + * Details: http://www.netlib.org/lapack/explore-html/d1/d2f/ztrsv_8f.html + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void ZTRSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation A, Allocation X, int incX) { // TRSV is the same as TRMV validateTRMV(Element.F64_2(mRS), Uplo, TransA, Diag, A, X, incX); @@ -504,6 +974,28 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_ztrsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0); } + + /** + * STBSV solves one of the systems of equations + * A*x = b or A**T*x = b + * + * Details: http://www.netlib.org/lapack/explore-html/d0/d1f/stbsv_8f.html + * + * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), + * but only the region N*(K+1) will be referenced. The following subroutine can is an + * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. + * for i in range(0, n): + * for j in range(i, min(i+k+1, n)): + * b[i, j-i] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param K The number of off-diagonals of the matrix A + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void STBSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, int K, Allocation A, Allocation X, int incX) { // TBSV is the same as TRMV + K >= 0 validateTRMV(Element.F32(mRS), Uplo, TransA, Diag, A, X, incX); @@ -513,6 +1005,28 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_stbsv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0); } + + /** + * DTBSV solves one of the systems of equations + * A*x = b or A**T*x = b + * + * Details: http://www.netlib.org/lapack/explore-html/d4/dcf/dtbsv_8f.html + * + * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), + * but only the region N*(K+1) will be referenced. The following subroutine can is an + * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. + * for i in range(0, n): + * for j in range(i, min(i+k+1, n)): + * b[i, j-i] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param K The number of off-diagonals of the matrix A + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void DTBSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, int K, Allocation A, Allocation X, int incX) { // TBSV is the same as TRMV + K >= 0 validateTRMV(Element.F64(mRS), Uplo, TransA, Diag, A, X, incX); @@ -522,6 +1036,28 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtbsv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, A.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0); } + + /** + * CTBSV solves one of the systems of equations + * A*x = b or A**T*x = b or A**H*x = b + * + * Details: http://www.netlib.org/lapack/explore-html/d9/d5f/ctbsv_8f.html + * + * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), + * but only the region N*(K+1) will be referenced. The following subroutine can is an + * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. + * for i in range(0, n): + * for j in range(i, min(i+k+1, n)): + * b[i, j-i] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param K The number of off-diagonals of the matrix A + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void CTBSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, int K, Allocation A, Allocation X, int incX) { // TBSV is the same as TRMV + K >= 0 validateTRMV(Element.F32_2(mRS), Uplo, TransA, Diag, A, X, incX); @@ -531,6 +1067,28 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctbsv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0); } + + /** + * ZTBSV solves one of the systems of equations + * A*x = b or A**T*x = b or A**H*x = b + * + * Details: http://www.netlib.org/lapack/explore-html/d4/d5a/ztbsv_8f.html + * + * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), + * but only the region N*(K+1) will be referenced. The following subroutine can is an + * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. + * for i in range(0, n): + * for j in range(i, min(i+k+1, n)): + * b[i, j-i] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param K The number of off-diagonals of the matrix A + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void ZTBSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, int K, Allocation A, Allocation X, int incX) { // TBSV is the same as TRMV + K >= 0 validateTRMV(Element.F64_2(mRS), Uplo, TransA, Diag, A, X, incX); @@ -540,21 +1098,109 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_ztbsv, TransA, 0, 0, Uplo, Diag, 0, N, K, 0, 0, A.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0); } + + /** + * STPSV solves one of the systems of equations + * A*x = b or A**T*x = b + * + * Details: http://www.netlib.org/lapack/explore-html/d0/d7c/stpsv_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F32}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void STPSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation Ap, Allocation X, int incX) { // TPSV is same as TPMV int N = validateTPMV(Element.F32(mRS), Uplo, TransA, Diag, Ap, X, incX); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_stpsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0); } + + /** + * DTPSV solves one of the systems of equations + * A*x = b or A**T*x = b + * + * Details: http://www.netlib.org/lapack/explore-html/d9/d84/dtpsv_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F64}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void DTPSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation Ap, Allocation X, int incX) { // TPSV is same as TPMV int N = validateTPMV(Element.F64(mRS), Uplo, TransA, Diag, Ap, X, incX); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtpsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, incX, 0, 0, 0); } + + /** + * CTPSV solves one of the systems of equations + * A*x = b or A**T*x = b or A**H*x = b + * + * Details: http://www.netlib.org/lapack/explore-html/d8/d56/ctpsv_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F32_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void CTPSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation Ap, Allocation X, int incX) { // TPSV is same as TPMV int N = validateTPMV(Element.F32_2(mRS), Uplo, TransA, Diag, Ap, X, incX); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctpsv, TransA, 0, 0, Uplo, Diag, 0, N, 0, 0, 0, Ap.getID(mRS), X.getID(mRS), 0, 0, 0, incX, 0, 0, 0); } + + /** + * ZTPSV solves one of the systems of equations + * A*x = b or A**T*x = b or A**H*x = b + * + * Details: http://www.netlib.org/lapack/explore-html/da/d57/ztpsv_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param Ap The input allocation contains packed matrix A, supported elements type {@link Element#F64_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + */ public void ZTPSV(@Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Allocation Ap, Allocation X, int incX) { // TPSV is same as TPMV int N = validateTPMV(Element.F64_2(mRS), Uplo, TransA, Diag, Ap, X, incX); @@ -768,10 +1414,49 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { return N; } + /** + * SSYMV performs the matrix-vector operation + * y := alpha*A*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d2/d94/ssymv_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void SSYMV(@Uplo int Uplo, float alpha, Allocation A, Allocation X, int incX, float beta, Allocation Y, int incY) { int N = validateSYMV(Element.F32(mRS), Uplo, A, X, Y, incX, incY); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssymv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * SSBMV performs the matrix-vector operation + * y := alpha*A*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d3/da1/ssbmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), + * but only the region N*(K+1) will be referenced. The following subroutine can is an + * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. + * for i in range(0, n): + * for j in range(i, min(i+k+1, n)): + * b[i, j-i] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied. + * @param K The number of off-diagonals of the matrix A + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void SSBMV(@Uplo int Uplo, int K, float alpha, Allocation A, Allocation X, int incX, float beta, Allocation Y, int incY) { // SBMV is the same as SYMV + K >= 0 if (K < 0) { @@ -780,36 +1465,186 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { int N = validateSYMV(Element.F32(mRS), Uplo, A, X, Y, incX, incY); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssbmv, 0, 0, 0, Uplo, 0, 0, N, K, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * SSPMV performs the matrix-vector operation + * y := alpha*A*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d8/d68/sspmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form. + * @param alpha The scalar alpha. + * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void SSPMV(@Uplo int Uplo, float alpha, Allocation Ap, Allocation X, int incX, float beta, Allocation Y, int incY) { int N = validateSPMV(Element.F32(mRS), Uplo, Ap, X, incX, Y, incY); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sspmv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, Ap.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * SGER performs the rank 1 operation + * A := alpha*x*y**T + A + * + * Details: http://www.netlib.org/lapack/explore-html/db/d5c/sger_8f.html + * + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + */ public void SGER(float alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) { int M = A.getType().getY(); int N = A.getType().getX(); validateGER(Element.F32(mRS), X, incX, Y, incY, A); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sger, 0, 0, 0, 0, 0, M, N, 0, alpha, X.getID(mRS), Y.getID(mRS), 0.f, A.getID(mRS), incX, incY, 0, 0); } + + /** + * SSYR performs the rank 1 operation + * A := alpha*x*x**T + A + * + * Details: http://www.netlib.org/lapack/explore-html/d6/dac/ssyr_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + */ public void SSYR(@Uplo int Uplo, float alpha, Allocation X, int incX, Allocation A) { int N = validateSYR(Element.F32(mRS), Uplo, X, incX, A); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssyr, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), A.getID(mRS), 0.f, 0, incX, 0, 0, 0); } + + /** + * SSPR performs the rank 1 operation + * A := alpha*x*x**T + A + * + * Details: http://www.netlib.org/lapack/explore-html/d2/d9b/sspr_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F32}. + */ public void SSPR(@Uplo int Uplo, float alpha, Allocation X, int incX, Allocation Ap) { int N = validateSPR(Element.F32(mRS), Uplo, X, incX, Ap); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sspr, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), Ap.getID(mRS), 0.f, 0, incX, 0, 0, 0); } + + /** + * SSYR2 performs the symmetric rank 2 operation + * A := alpha*x*y**T + alpha*y*x**T + A + * + * Details: http://www.netlib.org/lapack/explore-html/db/d99/ssyr2_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + */ public void SSYR2(@Uplo int Uplo, float alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) { int N = validateSYR2(Element.F32(mRS), Uplo, X, incX, Y, incY, A); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssyr2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), Y.getID(mRS), 0, A.getID(mRS), incX, incY, 0, 0); } + + /** + * SSPR2 performs the symmetric rank 2 operation + * A := alpha*x*y**T + alpha*y*x**T + A + * + * Details: http://www.netlib.org/lapack/explore-html/db/d3e/sspr2_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F32}. + */ public void SSPR2(@Uplo int Uplo, float alpha, Allocation X, int incX, Allocation Y, int incY, Allocation Ap) { int N = validateSPR2(Element.F32(mRS), Uplo, X, incX, Y, incY, Ap); mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sspr2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), Y.getID(mRS), 0, Ap.getID(mRS), incX, incY, 0, 0); } + + /** + * DSYMV performs the matrix-vector operation + * y := alpha*A*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d8/dbe/dsymv_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void DSYMV(@Uplo int Uplo, double alpha, Allocation A, Allocation X, int incX, double beta, Allocation Y, int incY) { int N = validateSYMV(Element.F64(mRS), Uplo, A, X, Y, incX, incY); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsymv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * DSBMV performs the matrix-vector operation + * y := alpha*A*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d8/d1e/dsbmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), + * but only the region N*(K+1) will be referenced. The following subroutine can is an + * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. + * for i in range(0, n): + * for j in range(i, min(i+k+1, n)): + * b[i, j-i] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied. + * @param K The number of off-diagonals of the matrix A + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void DSBMV(@Uplo int Uplo, int K, double alpha, Allocation A, Allocation X, int incX, double beta, Allocation Y, int incY) { // SBMV is the same as SYMV + K >= 0 if (K < 0) { @@ -818,28 +1653,138 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { int N = validateSYMV(Element.F64(mRS), Uplo, A, X, Y, incX, incY); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsbmv, 0, 0, 0, Uplo, 0, 0, N, K, alpha, A.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * DSPMV performs the matrix-vector operation + * y := alpha*A*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d4/d85/dspmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form. + * @param alpha The scalar alpha. + * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void DSPMV(@Uplo int Uplo, double alpha, Allocation Ap, Allocation X, int incX, double beta, Allocation Y, int incY) { int N = validateSPMV(Element.F64(mRS), Uplo, Ap, X, incX, Y, incY); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dspmv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, Ap.getID(mRS), X.getID(mRS), beta, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * DGER performs the rank 1 operation + * A := alpha*x*y**T + A + * + * Details: http://www.netlib.org/lapack/explore-html/dc/da8/dger_8f.html + * + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + */ public void DGER(double alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) { int M = A.getType().getY(); int N = A.getType().getX(); validateGER(Element.F64(mRS), X, incX, Y, incY, A); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dger, 0, 0, 0, 0, 0, M, N, 0, alpha, X.getID(mRS), Y.getID(mRS), 0.f, A.getID(mRS), incX, incY, 0, 0); } + + /** + * DSYR performs the rank 1 operation + * A := alpha*x*x**T + A + * + * Details: http://www.netlib.org/lapack/explore-html/d3/d60/dsyr_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + */ public void DSYR(@Uplo int Uplo, double alpha, Allocation X, int incX, Allocation A) { int N = validateSYR(Element.F64(mRS), Uplo, X, incX, A); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsyr, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), A.getID(mRS), 0.f, 0, incX, 0, 0, 0); } + + /** + * DSPR performs the rank 1 operation + * A := alpha*x*x**T + A + * + * Details: http://www.netlib.org/lapack/explore-html/dd/dba/dspr_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F64}. + */ public void DSPR(@Uplo int Uplo, double alpha, Allocation X, int incX, Allocation Ap) { int N = validateSPR(Element.F64(mRS), Uplo, X, incX, Ap); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dspr, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), Ap.getID(mRS), 0.f, 0, incX, 0, 0, 0); } + + /** + * DSYR2 performs the symmetric rank 2 operation + * A := alpha*x*y**T + alpha*y*x**T + A + * + * Details: http://www.netlib.org/lapack/explore-html/de/d41/dsyr2_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + */ public void DSYR2(@Uplo int Uplo, double alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) { int N = validateSYR2(Element.F64(mRS), Uplo, X, incX, Y, incY, A); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsyr2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), Y.getID(mRS), 0, A.getID(mRS), incX, incY, 0, 0); } + + /** + * DSPR2 performs the symmetric rank 2 operation + * A := alpha*x*y**T + alpha*y*x**T + A + * + * Details: http://www.netlib.org/lapack/explore-html/dd/d9e/dspr2_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F64}. + */ public void DSPR2(@Uplo int Uplo, double alpha, Allocation X, int incX, Allocation Y, int incY, Allocation Ap) { int N = validateSPR2(Element.F64(mRS), Uplo, X, incX, Y, incY, Ap); mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dspr2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, X.getID(mRS), Y.getID(mRS), 0, Ap.getID(mRS), incX, incY, 0, 0); @@ -876,11 +1821,50 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } + /** + * CHEMV performs the matrix-vector operation + * y := alpha*A*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d7/d51/chemv_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void CHEMV(@Uplo int Uplo, Float2 alpha, Allocation A, Allocation X, int incX, Float2 beta, Allocation Y, int incY) { // HEMV is the same as SYR2 validation-wise int N = validateSYR2(Element.F32_2(mRS), Uplo, X, incX, Y, incY, A); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_chemv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * CHBMV performs the matrix-vector operation + * y := alpha*A*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/db/dc2/chbmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), + * but only the region N*(K+1) will be referenced. The following subroutine can is an + * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. + * for i in range(0, n): + * for j in range(i, min(i+k+1, n)): + * b[i, j-i] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied. + * @param K The number of off-diagonals of the matrix A + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void CHBMV(@Uplo int Uplo, int K, Float2 alpha, Allocation A, Allocation X, int incX, Float2 beta, Allocation Y, int incY) { // HBMV is the same as SYR2 validation-wise int N = validateSYR2(Element.F32_2(mRS), Uplo, X, incX, Y, incY, A); @@ -889,17 +1873,69 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_chbmv, 0, 0, 0, Uplo, 0, 0, N, K, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * CHPMV performs the matrix-vector operation + * y := alpha*A*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d2/d06/chpmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form. + * @param alpha The scalar alpha. + * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void CHPMV(@Uplo int Uplo, Float2 alpha, Allocation Ap, Allocation X, int incX, Float2 beta, Allocation Y, int incY) { // HPMV is the same as SPR2 int N = validateSPR2(Element.F32_2(mRS), Uplo, X, incX, Y, incY, Ap); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_chpmv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, Ap.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * CGERU performs the rank 1 operation + * A := alpha*x*y**T + A + * + * Details: http://www.netlib.org/lapack/explore-html/db/d5f/cgeru_8f.html + * + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + */ public void CGERU(Float2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) { validateGERU(Element.F32_2(mRS), X, incX, Y, incY, A); int M = A.getType().getY(); int N = A.getType().getX(); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cgeru, 0, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, A.getID(mRS), incX, incY, 0, 0); } + + /** + * CGERC performs the rank 1 operation + * A := alpha*x*y**H + A + * + * Details: http://www.netlib.org/lapack/explore-html/dd/d84/cgerc_8f.html + * + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + */ public void CGERC(Float2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) { // same as GERU validateGERU(Element.F32_2(mRS), X, incX, Y, incY, A); @@ -907,31 +1943,143 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { int N = A.getType().getX(); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cgerc, 0, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, A.getID(mRS), incX, incY, 0, 0); } + + /** + * CHER performs the rank 1 operation + * A := alpha*x*x**H + A + * + * Details: http://www.netlib.org/lapack/explore-html/d3/d6d/cher_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + */ public void CHER(@Uplo int Uplo, float alpha, Allocation X, int incX, Allocation A) { // same as SYR int N = validateSYR(Element.F32_2(mRS), Uplo, X, incX, A); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cher, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, 0, X.getID(mRS), 0, 0, 0, A.getID(mRS), incX, 0, 0, 0); } + + /** + * CHPR performs the rank 1 operation + * A := alpha*x*x**H + A + * + * Details: http://www.netlib.org/lapack/explore-html/db/dcd/chpr_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + */ public void CHPR(@Uplo int Uplo, float alpha, Allocation X, int incX, Allocation Ap) { // equivalent to SPR for validation int N = validateSPR(Element.F32_2(mRS), Uplo, X, incX, Ap); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_chpr, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, 0, X.getID(mRS), 0, 0, 0, Ap.getID(mRS), incX, 0, 0, 0); } + + /** + * CHER2 performs the symmetric rank 2 operation + * A := alpha*x*y**H + alpha*y*x**H + A + * + * Details: http://www.netlib.org/lapack/explore-html/db/d87/cher2_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + */ public void CHER2(@Uplo int Uplo, Float2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) { // same as SYR2 int N = validateSYR2(Element.F32_2(mRS), Uplo, X, incX, Y, incY, A); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cher2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, A.getID(mRS), incX, incY, 0, 0); } + + /** + * CHPR2 performs the symmetric rank 2 operation + * A := alpha*x*y**H + alpha*y*x**H + A + * + * Details: http://www.netlib.org/lapack/explore-html/d6/d44/chpr2_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F32_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F32_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + */ public void CHPR2(@Uplo int Uplo, Float2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation Ap) { // same as SPR2 int N = validateSPR2(Element.F32_2(mRS), Uplo, X, incX, Y, incY, Ap); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_chpr2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, Ap.getID(mRS), incX, incY, 0, 0); } + + /** + * ZHEMV performs the matrix-vector operation + * y := alpha*A*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d0/ddd/zhemv_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void ZHEMV(@Uplo int Uplo, Double2 alpha, Allocation A, Allocation X, int incX, Double2 beta, Allocation Y, int incY) { // HEMV is the same as SYR2 validation-wise int N = validateSYR2(Element.F64_2(mRS), Uplo, X, incX, Y, incY, A); mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zhemv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * ZHBMV performs the matrix-vector operation + * y := alpha*A*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d3/d1a/zhbmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), + * but only the region N*(K+1) will be referenced. The following subroutine can is an + * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. + * for i in range(0, n): + * for j in range(i, min(i+k+1, n)): + * b[i, j-i] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied. + * @param K The number of off-diagonals of the matrix A + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void ZHBMV(@Uplo int Uplo, int K, Double2 alpha, Allocation A, Allocation X, int incX, Double2 beta, Allocation Y, int incY) { // HBMV is the same as SYR2 validation-wise int N = validateSYR2(Element.F64_2(mRS), Uplo, X, incX, Y, incY, A); @@ -940,17 +2088,69 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zhbmv, 0, 0, 0, Uplo, 0, 0, N, K, alpha.x, alpha.y, A.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * ZHPMV performs the matrix-vector operation + * y := alpha*A*x + beta*y + * + * Details: http://www.netlib.org/lapack/explore-html/d0/d60/zhpmv_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form. + * @param alpha The scalar alpha. + * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param beta The scalar beta. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + */ public void ZHPMV(@Uplo int Uplo, Double2 alpha, Allocation Ap, Allocation X, int incX, Double2 beta, Allocation Y, int incY) { // HPMV is the same as SPR2 int N = validateSPR2(Element.F64_2(mRS), Uplo, X, incX, Y, incY, Ap); mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zhpmv, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, Ap.getID(mRS), X.getID(mRS), beta.x, beta.y, Y.getID(mRS), incX, incY, 0, 0); } + + /** + * ZGERU performs the rank 1 operation + * A := alpha*x*y**T + A + * + * Details: http://www.netlib.org/lapack/explore-html/d7/d12/zgeru_8f.html + * + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + */ public void ZGERU(Double2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) { validateGERU(Element.F64_2(mRS), X, incX, Y, incY, A); int M = A.getType().getY(); int N = A.getType().getX(); mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zgeru, 0, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, A.getID(mRS), incX, incY, 0, 0); } + + /** + * ZGERC performs the rank 1 operation + * A := alpha*x*y**H + A + * + * Details: http://www.netlib.org/lapack/explore-html/d3/dad/zgerc_8f.html + * + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + */ public void ZGERC(Double2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) { // same as GERU validateGERU(Element.F64_2(mRS), X, incX, Y, incY, A); @@ -958,21 +2158,93 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { int N = A.getType().getX(); mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zgerc, 0, 0, 0, 0, 0, M, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, A.getID(mRS), incX, incY, 0, 0); } + + /** + * ZHER performs the rank 1 operation + * A := alpha*x*x**H + A + * + * Details: http://www.netlib.org/lapack/explore-html/de/d0e/zher_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + */ public void ZHER(@Uplo int Uplo, double alpha, Allocation X, int incX, Allocation A) { // same as SYR int N = validateSYR(Element.F64_2(mRS), Uplo, X, incX, A); mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zher, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, 0, X.getID(mRS), 0, 0, 0, A.getID(mRS), incX, 0, 0, 0); } + + /** + * ZHPR performs the rank 1 operation + * A := alpha*x*x**H + A + * + * Details: http://www.netlib.org/lapack/explore-html/de/de1/zhpr_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + */ public void ZHPR(@Uplo int Uplo, double alpha, Allocation X, int incX, Allocation Ap) { // equivalent to SPR for validation int N = validateSPR(Element.F64_2(mRS), Uplo, X, incX, Ap); mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zhpr, 0, 0, 0, Uplo, 0, 0, N, 0, alpha, 0, X.getID(mRS), 0, 0, 0, Ap.getID(mRS), incX, 0, 0, 0); } + + /** + * ZHER2 performs the symmetric rank 2 operation + * A := alpha*x*y**H + alpha*y*x**H + A + * + * Details: http://www.netlib.org/lapack/explore-html/da/d8a/zher2_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + */ public void ZHER2(@Uplo int Uplo, Double2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation A) { // same as SYR2 int N = validateSYR2(Element.F64_2(mRS), Uplo, X, incX, Y, incY, A); mRS.nScriptIntrinsicBLAS_Z(getID(mRS), RsBlas_zher2, 0, 0, 0, Uplo, 0, 0, N, 0, alpha.x, alpha.y, X.getID(mRS), Y.getID(mRS), 0, 0, A.getID(mRS), incX, incY, 0, 0); } + + /** + * ZHPR2 performs the symmetric rank 2 operation + * A := alpha*x*y**H + alpha*y*x**H + A + * + * Details: http://www.netlib.org/lapack/explore-html/d5/d52/zhpr2_8f.html + * + * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, + * The following subroutine can is an example showing how to convert a UPPER trianglar matrix + * 'a' to packed matrix 'b'. + * k = 0 + * for i in range(0, n): + * for j in range(i, n): + * b[k++] = a[i, j] + * + * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. + * @param alpha The scalar alpha. + * @param X The input allocation contains vector x, supported elements type {@link Element#F64_2}. + * @param incX The increment for the elements of vector x, must be larger than zero. + * @param Y The input allocation contains vector y, supported elements type {@link Element#F64_2}. + * @param incY The increment for the elements of vector y, must be larger than zero. + * @param Ap The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + */ public void ZHPR2(@Uplo int Uplo, Double2 alpha, Allocation X, int incX, Allocation Y, int incY, Allocation Ap) { // same as SPR2 int N = validateSPR2(Element.F64_2(mRS), Uplo, X, incX, Y, incY, Ap); @@ -1051,6 +2323,20 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } + /** + * SGEMM performs one of the matrix-matrix operations + * C := alpha*op(A)*op(B) + beta*C where op(X) is one of op(X) = X or op(X) = X**T + * + * Details: http://www.netlib.org/lapack/explore-html/d4/de2/sgemm_8f.html + * + * @param TransA The type of transpose applied to matrix A. + * @param TransB The type of transpose applied to matrix B. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F32}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F32}. + */ public void SGEMM(@Transpose int TransA, @Transpose int TransB, float alpha, Allocation A, Allocation B, float beta, Allocation C) { validateTranspose(TransA); @@ -1073,6 +2359,21 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_sgemm, TransA, TransB, 0, 0, 0, M, N, K, alpha, A.getID(mRS), B.getID(mRS), beta, C.getID(mRS), 0, 0, 0, 0); } + + /** + * DGEMM performs one of the matrix-matrix operations + * C := alpha*op(A)*op(B) + beta*C where op(X) is one of op(X) = X or op(X) = X**T + * + * Details: http://www.netlib.org/lapack/explore-html/d7/d2b/dgemm_8f.html + * + * @param TransA The type of transpose applied to matrix A. + * @param TransB The type of transpose applied to matrix B. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F64}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F64}. + */ public void DGEMM(@Transpose int TransA, @Transpose int TransB, double alpha, Allocation A, Allocation B, double beta, Allocation C) { validateTranspose(TransA); @@ -1094,6 +2395,21 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dgemm, TransA, TransB, 0, 0, 0, M, N, K, alpha, A.getID(mRS), B.getID(mRS), beta, C.getID(mRS), 0, 0, 0, 0); } + + /** + * CGEMM performs one of the matrix-matrix operations + * C := alpha*op(A)*op(B) + beta*C where op(X) is one of op(X) = X or op(X) = X**T or op(X) = X**H + * + * Details: http://www.netlib.org/lapack/explore-html/d6/d5b/cgemm_8f.html + * + * @param TransA The type of transpose applied to matrix A. + * @param TransB The type of transpose applied to matrix B. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}. + */ public void CGEMM(@Transpose int TransA, @Transpose int TransB, Float2 alpha, Allocation A, Allocation B, Float2 beta, Allocation C) { validateTranspose(TransA); @@ -1116,6 +2432,20 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0); } + /** + * ZGEMM performs one of the matrix-matrix operations + * C := alpha*op(A)*op(B) + beta*C where op(X) is one of op(X) = X or op(X) = X**T or op(X) = X**H + * + * Details: http://www.netlib.org/lapack/explore-html/d7/d76/zgemm_8f.html + * + * @param TransA The type of transpose applied to matrix A. + * @param TransB The type of transpose applied to matrix B. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2 + * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2 + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2 + */ public void ZGEMM(@Transpose int TransA, @Transpose int TransB, Double2 alpha, Allocation A, Allocation B, Double2 beta, Allocation C) { validateTranspose(TransA); @@ -1138,6 +2468,20 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0); } + /** + * SSYMM performs one of the matrix-matrix operations + * C := alpha*A*B + beta*C or C := alpha*B*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/d7/d42/ssymm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F32}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F32}. + */ public void SSYMM(@Side int Side, @Uplo int Uplo, float alpha, Allocation A, Allocation B, float beta, Allocation C) { validateSide(Side); @@ -1150,6 +2494,21 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssymm, 0, 0, Side, Uplo, 0, C.getType().getY(), C.getType().getX(), 0, alpha, A.getID(mRS), B.getID(mRS), beta, C.getID(mRS), 0, 0, 0, 0); } + + /** + * DSYMM performs one of the matrix-matrix operations + * C := alpha*A*B + beta*C or C := alpha*B*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/d8/db0/dsymm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F64}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F64}. + */ public void DSYMM(@Side int Side, @Uplo int Uplo, double alpha, Allocation A, Allocation B, double beta, Allocation C) { validateSide(Side); @@ -1161,6 +2520,21 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsymm, 0, 0, Side, Uplo, 0, C.getType().getY(), C.getType().getX(), 0, alpha, A.getID(mRS), B.getID(mRS), beta, C.getID(mRS), 0, 0, 0, 0); } + + /** + * CSYMM performs one of the matrix-matrix operations + * C := alpha*A*B + beta*C or C := alpha*B*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/db/d59/csymm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}. + */ public void CSYMM(@Side int Side, @Uplo int Uplo, Float2 alpha, Allocation A, Allocation B, Float2 beta, Allocation C) { validateSide(Side); @@ -1172,6 +2546,21 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_csymm, 0, 0, Side, Uplo, 0, C.getType().getY(), C.getType().getX(), 0, alpha.x, alpha.y, A.getID(mRS), B.getID(mRS), beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0); } + + /** + * ZSYMM performs one of the matrix-matrix operations + * C := alpha*A*B + beta*C or C := alpha*B*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/df/d51/zsymm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2}. + */ public void ZSYMM(@Side int Side, @Uplo int Uplo, Double2 alpha, Allocation A, Allocation B, Double2 beta, Allocation C) { validateSide(Side); @@ -1184,6 +2573,19 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0); } + /** + * SSYRK performs one of the symmetric rank k operations + * C := alpha*A*A**T + beta*C or C := alpha*A**T*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/d0/d40/ssyrk_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. + * @param Trans The type of transpose applied to the operation. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F32}. + */ public void SSYRK(@Uplo int Uplo, @Transpose int Trans, float alpha, Allocation A, float beta, Allocation C) { validateTranspose(Trans); validateUplo(Uplo); @@ -1198,6 +2600,19 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssyrk, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), K, alpha, A.getID(mRS), 0, beta, C.getID(mRS), 0, 0, 0, 0); } + /** + * DSYRK performs one of the symmetric rank k operations + * C := alpha*A*A**T + beta*C or C := alpha*A**T*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/dc/d05/dsyrk_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. + * @param Trans The type of transpose applied to the operation. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F64}. + */ public void DSYRK(@Uplo int Uplo, @Transpose int Trans, double alpha, Allocation A, double beta, Allocation C) { validateTranspose(Trans); validateUplo(Uplo); @@ -1210,6 +2625,20 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsyrk, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), K, alpha, A.getID(mRS), 0, beta, C.getID(mRS), 0, 0, 0, 0); } + + /** + * CSYRK performs one of the symmetric rank k operations + * C := alpha*A*A**T + beta*C or C := alpha*A**T*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/d3/d6a/csyrk_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. + * @param Trans The type of transpose applied to the operation. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}. + */ public void CSYRK(@Uplo int Uplo, @Transpose int Trans, Float2 alpha, Allocation A, Float2 beta, Allocation C) { validateTranspose(Trans); validateUplo(Uplo); @@ -1223,6 +2652,20 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_csyrk, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), K, alpha.x, alpha.y, A.getID(mRS), 0, beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0); } + + /** + * ZSYRK performs one of the symmetric rank k operations + * C := alpha*A*A**T + beta*C or C := alpha*A**T*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/de/d54/zsyrk_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. + * @param Trans The type of transpose applied to the operation. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2}. + */ public void ZSYRK(@Uplo int Uplo, @Transpose int Trans, Double2 alpha, Allocation A, Double2 beta, Allocation C) { validateTranspose(Trans); validateUplo(Uplo); @@ -1262,6 +2705,21 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { throw new RSRuntimeException("Invalid A and B in SYR2K"); } } + + /** + * SSYR2K performs one of the symmetric rank 2k operations + * C := alpha*A*B**T + alpha*B*A**T + beta*C or C := alpha*A**T*B + alpha*B**T*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/df/d3d/ssyr2k_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. + * @param Trans The type of transpose applied to the operation. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F32}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F32}. + */ public void SSYR2K(@Uplo int Uplo, @Transpose int Trans, float alpha, Allocation A, Allocation B, float beta, Allocation C) { validateUplo(Uplo); validateSYR2K(Element.F32(mRS), Trans, A, B, C); @@ -1273,6 +2731,21 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_ssyr2k, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), K, alpha, A.getID(mRS), B.getID(mRS), beta, C.getID(mRS), 0, 0, 0, 0); } + + /** + * DSYR2K performs one of the symmetric rank 2k operations + * C := alpha*A*B**T + alpha*B*A**T + beta*C or C := alpha*A**T*B + alpha*B**T*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/d1/dec/dsyr2k_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. + * @param Trans The type of transpose applied to the operation. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F64}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F64}. + */ public void DSYR2K(@Uplo int Uplo, @Transpose int Trans, double alpha, Allocation A, Allocation B, double beta, Allocation C) { validateUplo(Uplo); validateSYR2K(Element.F64(mRS), Trans, A, B, C); @@ -1284,6 +2757,21 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dsyr2k, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), K, alpha, A.getID(mRS), B.getID(mRS), beta, C.getID(mRS), 0, 0, 0, 0); } + + /** + * CSYR2K performs one of the symmetric rank 2k operations + * C := alpha*A*B**T + alpha*B*A**T + beta*C or C := alpha*A**T*B + alpha*B**T*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/de/d7e/csyr2k_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. + * @param Trans The type of transpose applied to the operation. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}. + */ public void CSYR2K(@Uplo int Uplo, @Transpose int Trans, Float2 alpha, Allocation A, Allocation B, Float2 beta, Allocation C) { validateUplo(Uplo); validateSYR2K(Element.F32_2(mRS), Trans, A, B, C); @@ -1295,6 +2783,21 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_csyr2k, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), K, alpha.x, alpha.y, A.getID(mRS), B.getID(mRS), beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0); } + + /** + * ZSYR2K performs one of the symmetric rank 2k operations + * C := alpha*A*B**T + alpha*B*A**T + beta*C or C := alpha*A**T*B + alpha*B**T*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/df/d20/zsyr2k_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. + * @param Trans The type of transpose applied to the operation. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2}. + */ public void ZSYR2K(@Uplo int Uplo, @Transpose int Trans, Double2 alpha, Allocation A, Allocation B, Double2 beta, Allocation C) { validateUplo(Uplo); validateSYR2K(Element.F64_2(mRS), Trans, A, B, C); @@ -1334,6 +2837,22 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } } } + + /** + * STRMM performs one of the matrix-matrix operations + * B := alpha*op(A)*B or B := alpha*B*op(A) + * op(A) is one of op(A) = A or op(A) = A**T + * + * Details: http://www.netlib.org/lapack/explore-html/df/d01/strmm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether matrix A is upper or lower triangular. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F32}. + */ public void STRMM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, float alpha, Allocation A, Allocation B) { validateUplo(Uplo); validateDiag(Diag); @@ -1341,6 +2860,22 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_strmm, TransA, 0, Side, Uplo, Diag, B.getType().getY(), B.getType().getX(), 0, alpha, A.getID(mRS), B.getID(mRS), 0.f, 0, 0, 0, 0, 0); } + + /** + * DTRMM performs one of the matrix-matrix operations + * B := alpha*op(A)*B or B := alpha*B*op(A) + * op(A) is one of op(A) = A or op(A) = A**T + * + * Details: http://www.netlib.org/lapack/explore-html/dd/d19/dtrmm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether matrix A is upper or lower triangular. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F64}. + */ public void DTRMM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, double alpha, Allocation A, Allocation B) { validateUplo(Uplo); validateDiag(Diag); @@ -1348,6 +2883,22 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtrmm, TransA, 0, Side, Uplo, Diag, B.getType().getY(), B.getType().getX(), 0, alpha, A.getID(mRS), B.getID(mRS), 0, 0, 0, 0, 0, 0); } + + /** + * CTRMM performs one of the matrix-matrix operations + * B := alpha*op(A)*B or B := alpha*B*op(A) + * op(A) is one of op(A) = A or op(A) = A**T or op(A) = A**H + * + * Details: http://www.netlib.org/lapack/explore-html/d4/d9b/ctrmm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether matrix A is upper or lower triangular. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}. + */ public void CTRMM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Float2 alpha, Allocation A, Allocation B) { validateUplo(Uplo); validateDiag(Diag); @@ -1355,6 +2906,22 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctrmm, TransA, 0, Side, Uplo, Diag, B.getType().getY(), B.getType().getX(), 0, alpha.x, alpha.y, A.getID(mRS), B.getID(mRS), 0, 0, 0, 0, 0, 0, 0); } + + /** + * ZTRMM performs one of the matrix-matrix operations + * B := alpha*op(A)*B or B := alpha*B*op(A) + * op(A) is one of op(A) = A or op(A) = A**T or op(A) = A**H + * + * Details: http://www.netlib.org/lapack/explore-html/d8/de1/ztrmm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether matrix A is upper or lower triangular. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2}. + */ public void ZTRMM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Double2 alpha, Allocation A, Allocation B) { validateUplo(Uplo); validateDiag(Diag); @@ -1392,6 +2959,22 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } } } + + /** + * STRSM solves one of the matrix equations + * op(A)*X := alpha*B or X*op(A) := alpha*B + * op(A) is one of op(A) = A or op(A) = A**T + * + * Details: http://www.netlib.org/lapack/explore-html/d2/d8b/strsm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether matrix A is upper or lower triangular. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F32}. + */ public void STRSM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, float alpha, Allocation A, Allocation B) { validateUplo(Uplo); validateDiag(Diag); @@ -1399,6 +2982,22 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Single(getID(mRS), RsBlas_strsm, TransA, 0, Side, Uplo, Diag, B.getType().getY(), B.getType().getX(), 0, alpha, A.getID(mRS), B.getID(mRS), 0, 0, 0, 0, 0, 0); } + + /** + * DTRSM solves one of the matrix equations + * op(A)*X := alpha*B or X*op(A) := alpha*B + * op(A) is one of op(A) = A or op(A) = A**T + * + * Details: http://www.netlib.org/lapack/explore-html/de/da7/dtrsm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether matrix A is upper or lower triangular. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F64}. + */ public void DTRSM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, double alpha, Allocation A, Allocation B) { validateUplo(Uplo); validateDiag(Diag); @@ -1406,6 +3005,22 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Double(getID(mRS), RsBlas_dtrsm, TransA, 0, Side, Uplo, Diag, B.getType().getY(), B.getType().getX(), 0, alpha, A.getID(mRS), B.getID(mRS), 0, 0, 0, 0, 0, 0); } + + /** + * CTRSM solves one of the matrix equations + * op(A)*X := alpha*B or X*op(A) := alpha*B + * op(A) is one of op(A) = A or op(A) = A**T or op(A) = A**H + * + * Details: http://www.netlib.org/lapack/explore-html/de/d30/ctrsm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether matrix A is upper or lower triangular. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}. + */ public void CTRSM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Float2 alpha, Allocation A, Allocation B) { validateUplo(Uplo); validateDiag(Diag); @@ -1413,6 +3028,22 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_ctrsm, TransA, 0, Side, Uplo, Diag, B.getType().getY(), B.getType().getX(), 0, alpha.x, alpha.y, A.getID(mRS), B.getID(mRS), 0, 0, 0, 0, 0, 0, 0); } + + /** + * ZTRSM solves one of the matrix equations + * op(A)*X := alpha*B or X*op(A) := alpha*B + * op(A) is one of op(A) = A or op(A) = A**T or op(A) = A**H + * + * Details: http://www.netlib.org/lapack/explore-html/d1/d39/ztrsm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether matrix A is upper or lower triangular. + * @param TransA The type of transpose applied to matrix A. + * @param Diag Specifies whether or not A is unit triangular. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2}. + */ public void ZTRSM(@Side int Side, @Uplo int Uplo, @Transpose int TransA, @Diag int Diag, Double2 alpha, Allocation A, Allocation B) { validateUplo(Uplo); validateDiag(Diag); @@ -1444,12 +3075,42 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { throw new RSRuntimeException("Called HEMM with mismatched B and C"); } } + + /** + * CHEMM performs one of the matrix-matrix operations + * C := alpha*A*B + beta*C or C := alpha*B*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/d3/d66/chemm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}. + */ public void CHEMM(@Side int Side, @Uplo int Uplo, Float2 alpha, Allocation A, Allocation B, Float2 beta, Allocation C) { validateUplo(Uplo); validateHEMM(Element.F32_2(mRS), Side, A, B, C); mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_chemm, 0, 0, Side, Uplo, 0, C.getType().getY(), C.getType().getX(), 0, alpha.x, alpha.y, A.getID(mRS), B.getID(mRS), beta.x, beta.y, C.getID(mRS), 0, 0, 0, 0); } + + /** + * ZHEMM performs one of the matrix-matrix operations + * C := alpha*A*B + beta*C or C := alpha*B*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/d6/d3e/zhemm_8f.html + * + * @param Side Specifies whether the symmetric matrix A appears on the left or right. + * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2}. + */ public void ZHEMM(@Side int Side, @Uplo int Uplo, Double2 alpha, Allocation A, Allocation B, Double2 beta, Allocation C) { validateUplo(Uplo); validateHEMM(Element.F64_2(mRS), Side, A, B, C); @@ -1477,6 +3138,20 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } } } + + /** + * CHERK performs one of the hermitian rank k operations + * C := alpha*A*A**H + beta*C or C := alpha*A**H*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/d8/d52/cherk_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. + * @param Trans The type of transpose applied to the operation. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}. + */ public void CHERK(@Uplo int Uplo, @Transpose int Trans, float alpha, Allocation A, float beta, Allocation C) { validateUplo(Uplo); validateHERK(Element.F32_2(mRS), Trans, A, C); @@ -1489,6 +3164,20 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cherk, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), k, alpha, 0, A.getID(mRS), 0, beta, 0, C.getID(mRS), 0, 0, 0, 0); } + + /** + * ZHERK performs one of the hermitian rank k operations + * C := alpha*A*A**H + beta*C or C := alpha*A**H*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/d1/db1/zherk_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. + * @param Trans The type of transpose applied to the operation. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2}. + */ public void ZHERK(@Uplo int Uplo, @Transpose int Trans, double alpha, Allocation A, double beta, Allocation C) { validateUplo(Uplo); validateHERK(Element.F64_2(mRS), Trans, A, C); @@ -1526,6 +3215,21 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { throw new RSRuntimeException("Called HER2K with invalid A and B matrices"); } } + + /** + * CHER2K performs one of the hermitian rank 2k operations + * C := alpha*A*B**H + conjg( alpha )*B*A**H + beta*C or C := alpha*A**H*B + conjg( alpha )*B**H*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/d1/d82/cher2k_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. + * @param Trans The type of transpose applied to the operation. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F32_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F32_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F32_2}. + */ public void CHER2K(@Uplo int Uplo, @Transpose int Trans, Float2 alpha, Allocation A, Allocation B, float beta, Allocation C) { validateUplo(Uplo); validateHER2K(Element.F32_2(mRS), Trans, A, B, C); @@ -1538,6 +3242,21 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { mRS.nScriptIntrinsicBLAS_Complex(getID(mRS), RsBlas_cher2k, Trans, 0, 0, Uplo, 0, 0, C.getType().getX(), k, alpha.x, alpha.y, A.getID(mRS), B.getID(mRS), beta, 0, C.getID(mRS), 0, 0, 0, 0); } + + /** + * ZHER2K performs one of the hermitian rank 2k operations + * C := alpha*A*B**H + conjg( alpha )*B*A**H + beta*C or C := alpha*A**H*B + conjg( alpha )*B**H*A + beta*C + * + * Details: http://www.netlib.org/lapack/explore-html/d7/dfa/zher2k_8f.html + * + * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. + * @param Trans The type of transpose applied to the operation. + * @param alpha The scalar alpha. + * @param A The input allocation contains matrix A, supported elements type {@link Element#F64_2}. + * @param B The input allocation contains matrix B, supported elements type {@link Element#F64_2}. + * @param beta The scalar beta. + * @param C The input allocation contains matrix C, supported elements type {@link Element#F64_2}. + */ public void ZHER2K(@Uplo int Uplo, @Transpose int Trans, Double2 alpha, Allocation A, Allocation B, double beta, Allocation C) { validateUplo(Uplo); validateHER2K(Element.F64_2(mRS), Trans, A, B, C); @@ -1553,9 +3272,19 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { /** - * - * 8-bit GEMM-like operation for neural networks - * + * 8-bit GEMM-like operation for neural networks: C = B.transposed() * A + * Calculations are done in 1.10.21 fixed-point format for the final output, + * just before there's a shift down to drop the fractional parts. The output + * values are gated to 0 to 255 to fit in a byte, but the 10-bit format + * gives some headroom to avoid wrapping around on small overflows. + * + * @param A The input allocation contains matrix A, supported elements type {@link Element#U8}. + * @param a_offset The offset for all values in matrix A, e.g A[i,j] = A[i,j] - a_offset. + * @param B The input allocation contains matrix B, supported elements type {@link Element#U8}. + * @param b_offset The offset for all values in matrix B, e.g B[i,j] = B[i,j] - b_offset. + * @param C The input allocation contains matrix C, supported elements type {@link Element#U8}. + * @param c_offset The offset for all values in matrix C. + * @param c_mult The multiplier for all values in matrix C, e.g C[i,j] = (C[i,j] + c_offset) * c_mult. **/ public void BNNM(Allocation A, int a_offset, Allocation B, int b_offset, Allocation C, int c_offset, int c_mult) { validateL3(Element.U8(mRS), NO_TRANSPOSE, TRANSPOSE, 0, A, B, C); diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java index b737de3cd64e..30680ed1a0f3 100644 --- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java @@ -1298,7 +1298,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku synchronized (mLock) { ensureGroupStateLoadedLocked(userId); - ArrayList<AppWidgetProviderInfo> result = null; + ArrayList<AppWidgetProviderInfo> result = new ArrayList<AppWidgetProviderInfo>(); final int providerCount = mProviders.size(); for (int i = 0; i < providerCount; i++) { @@ -1315,9 +1315,6 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku if (providerProfileId == profileId && mSecurityPolicy.isProviderInCallerOrInProfileAndWhitelListed( provider.id.componentName.getPackageName(), providerProfileId)) { - if (result == null) { - result = new ArrayList<>(); - } result.add(cloneIfLocalBinder(info)); } } diff --git a/services/core/java/com/android/server/DeviceIdleController.java b/services/core/java/com/android/server/DeviceIdleController.java index 8dd087a135ff..82b334a3c25c 100644 --- a/services/core/java/com/android/server/DeviceIdleController.java +++ b/services/core/java/com/android/server/DeviceIdleController.java @@ -45,6 +45,7 @@ import android.os.Looper; import android.os.Message; import android.os.PowerManager; import android.os.PowerManagerInternal; +import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; @@ -487,7 +488,7 @@ public class DeviceIdleController extends SystemService mLocalPowerManager.setDeviceIdleMode(true); try { mNetworkPolicyManager.setDeviceIdleMode(true); - mBatteryStats.noteDeviceIdleMode(true, false, false); + mBatteryStats.noteDeviceIdleMode(true, null, Process.myUid()); } catch (RemoteException e) { } getContext().sendBroadcastAsUser(mIdleIntent, UserHandle.ALL); @@ -496,18 +497,19 @@ public class DeviceIdleController extends SystemService mLocalPowerManager.setDeviceIdleMode(false); try { mNetworkPolicyManager.setDeviceIdleMode(false); - mBatteryStats.noteDeviceIdleMode(false, false, false); + mBatteryStats.noteDeviceIdleMode(false, null, Process.myUid()); } catch (RemoteException e) { } getContext().sendBroadcastAsUser(mIdleIntent, UserHandle.ALL); } break; case MSG_REPORT_ACTIVE: { - boolean fromMotion = msg.arg1 != 0; + String activeReason = (String)msg.obj; + int activeUid = msg.arg1; boolean needBroadcast = msg.arg2 != 0; mLocalPowerManager.setDeviceIdleMode(false); try { mNetworkPolicyManager.setDeviceIdleMode(false); - mBatteryStats.noteDeviceIdleMode(false, !fromMotion, fromMotion); + mBatteryStats.noteDeviceIdleMode(false, activeReason, activeUid); } catch (RemoteException e) { } if (needBroadcast) { @@ -578,6 +580,12 @@ public class DeviceIdleController extends SystemService } } + @Override public void exitIdle(String reason) { + getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, + null); + exitIdleInternal(reason); + } + @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { DeviceIdleController.this.dump(fd, pw, args); } @@ -818,6 +826,12 @@ public class DeviceIdleController extends SystemService } } + public void exitIdleInternal(String reason) { + synchronized (this) { + becomeActiveLocked(reason, Binder.getCallingUid()); + } + } + void updateDisplayLocked() { mCurDisplay = mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY); // We consider any situation where the display is showing something to be it on, @@ -830,7 +844,7 @@ public class DeviceIdleController extends SystemService becomeInactiveIfAppropriateLocked(); } else if (screenOn) { mScreenOn = true; - becomeActiveLocked("screen"); + becomeActiveLocked("screen", Process.myUid()); } } @@ -841,21 +855,21 @@ public class DeviceIdleController extends SystemService becomeInactiveIfAppropriateLocked(); } else if (charging) { mCharging = charging; - becomeActiveLocked("charging"); + becomeActiveLocked("charging", Process.myUid()); } } - void scheduleReportActiveLocked(boolean fromMotion) { - Message msg = mHandler.obtainMessage(MSG_REPORT_ACTIVE, fromMotion ? 1 : 0, - mState == STATE_IDLE ? 1 : 0); + void scheduleReportActiveLocked(String activeReason, int activeUid) { + Message msg = mHandler.obtainMessage(MSG_REPORT_ACTIVE, activeUid, + mState == STATE_IDLE ? 1 : 0, activeReason); mHandler.sendMessage(msg); } - void becomeActiveLocked(String reason) { - if (DEBUG) Slog.i(TAG, "becomeActiveLocked, reason = " + reason); + void becomeActiveLocked(String activeReason, int activeUid) { + if (DEBUG) Slog.i(TAG, "becomeActiveLocked, reason = " + activeReason); if (mState != STATE_ACTIVE) { - EventLogTags.writeDeviceIdle(STATE_ACTIVE, reason); - scheduleReportActiveLocked(false); + EventLogTags.writeDeviceIdle(STATE_ACTIVE, activeReason); + scheduleReportActiveLocked(activeReason, activeUid); mState = STATE_ACTIVE; mInactiveTimeout = mConstants.INACTIVE_TIMEOUT; mNextIdlePendingDelay = 0; @@ -896,7 +910,7 @@ public class DeviceIdleController extends SystemService if ((now+mConstants.MIN_TIME_TO_ALARM) > mAlarmManager.getNextWakeFromIdleTime()) { // Whoops, there is an upcoming alarm. We don't actually want to go idle. if (mState != STATE_ACTIVE) { - becomeActiveLocked("alarm"); + becomeActiveLocked("alarm", Process.myUid()); } return; } @@ -954,7 +968,7 @@ public class DeviceIdleController extends SystemService // state to wait again for no motion. Note that we only monitor for significant // motion after moving out of the inactive state, so no need to worry about that. if (mState != STATE_ACTIVE) { - scheduleReportActiveLocked(true); + scheduleReportActiveLocked("motion", Process.myUid()); mState = STATE_ACTIVE; mInactiveTimeout = mConstants.MOTION_INACTIVE_TIMEOUT; EventLogTags.writeDeviceIdle(mState, "motion"); @@ -1240,7 +1254,7 @@ public class DeviceIdleController extends SystemService synchronized (this) { if (!mIdleDisabled) { mIdleDisabled = true; - becomeActiveLocked("disabled"); + becomeActiveLocked("disabled", Process.myUid()); pw.println("Idle mode disabled"); } } diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java index c76fc1c2a123..743aafbbeea9 100644 --- a/services/core/java/com/android/server/LocationManagerService.java +++ b/services/core/java/com/android/server/LocationManagerService.java @@ -1958,6 +1958,27 @@ public class LocationManagerService extends ILocationManager.Stub { return p.getProperties(); } + /** + * @return null if the provider does not exist + * @throws SecurityException if the provider is not allowed to be + * accessed by the caller + */ + @Override + public String getNetworkProviderPackage() { + LocationProviderInterface p; + synchronized (mLock) { + if (mProvidersByName.get(LocationManager.NETWORK_PROVIDER) == null) { + return null; + } + p = mProvidersByName.get(LocationManager.NETWORK_PROVIDER); + } + + if (p instanceof LocationProviderProxy) { + return ((LocationProviderProxy) p).getConnectedPackageName(); + } + return null; + } + @Override public boolean isProviderEnabled(String provider) { // Fused provider is accessed indirectly via criteria rather than the provider-based APIs, diff --git a/services/core/java/com/android/server/PersistentDataBlockService.java b/services/core/java/com/android/server/PersistentDataBlockService.java index 56f9942cb784..94316fe826e0 100644 --- a/services/core/java/com/android/server/PersistentDataBlockService.java +++ b/services/core/java/com/android/server/PersistentDataBlockService.java @@ -18,18 +18,14 @@ package com.android.server; import android.Manifest; import android.app.ActivityManager; -import android.app.PendingIntent; import android.content.Context; -import android.content.Intent; import android.content.pm.PackageManager; import android.os.Binder; -import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; import android.service.persistentdata.IPersistentDataBlockService; -import android.service.persistentdata.PersistentDataBlockManager; import android.util.Slog; import com.android.internal.R; @@ -432,29 +428,6 @@ public class PersistentDataBlockService extends SystemService { } @Override - public void wipeIfAllowed(Bundle bundle, PendingIntent pi) { - // Should only be called by owner - if (UserHandle.getCallingUserId() != UserHandle.USER_OWNER) { - throw new SecurityException("Only the Owner is allowed to wipe"); - } - // Caller must be able to query the the state of the PersistentDataBlock - enforcePersistentDataBlockAccess(); - String allowedPackage = mContext.getResources() - .getString(R.string.config_persistentDataPackageName); - Intent intent = new Intent(); - intent.setPackage(allowedPackage); - intent.setAction(PersistentDataBlockManager.ACTION_WIPE_IF_ALLOWED); - intent.putExtras(bundle); - intent.putExtra(PersistentDataBlockManager.EXTRA_WIPE_IF_ALLOWED_CALLBACK, pi); - long id = Binder.clearCallingIdentity(); - try { - mContext.sendBroadcastAsUser(intent, UserHandle.OWNER); - } finally { - restoreCallingIdentity(id); - } - } - - @Override public void setOemUnlockEnabled(boolean enabled) { // do not allow monkey to flip the flag if (ActivityManager.isUserAMonkey()) { diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index c4f460e66feb..c0c401d636bd 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -676,9 +676,9 @@ public final class ActivityManagerService extends ActivityManagerNative final SparseArray<UidRecord> mActiveUids = new SparseArray<>(); /** - * Which uses have been started, so are allowed to run code. + * Which users have been started, so are allowed to run code. */ - final SparseArray<UserStartedState> mStartedUsers = new SparseArray<>(); + final SparseArray<UserState> mStartedUsers = new SparseArray<>(); /** * LRU list of history of current users. Most recently current is at the end. @@ -1781,15 +1781,15 @@ public final class ActivityManagerService extends ActivityManagerNative break; } case REPORT_USER_SWITCH_MSG: { - dispatchUserSwitch((UserStartedState) msg.obj, msg.arg1, msg.arg2); + dispatchUserSwitch((UserState) msg.obj, msg.arg1, msg.arg2); break; } case CONTINUE_USER_SWITCH_MSG: { - continueUserSwitch((UserStartedState) msg.obj, msg.arg1, msg.arg2); + continueUserSwitch((UserState) msg.obj, msg.arg1, msg.arg2); break; } case USER_SWITCH_TIMEOUT_MSG: { - timeoutUserSwitch((UserStartedState) msg.obj, msg.arg1, msg.arg2); + timeoutUserSwitch((UserState) msg.obj, msg.arg1, msg.arg2); break; } case IMMERSIVE_MODE_LOCK_MSG: { @@ -2309,7 +2309,7 @@ public final class ActivityManagerService extends ActivityManagerNative mGrantFile = new AtomicFile(new File(systemDir, "urigrants.xml")); // User 0 is the first and only user that runs at boot. - mStartedUsers.put(UserHandle.USER_OWNER, new UserStartedState(UserHandle.OWNER, true)); + mStartedUsers.put(UserHandle.USER_OWNER, new UserState(UserHandle.OWNER, true)); mUserLru.add(UserHandle.USER_OWNER); updateStartedUserArrayLocked(); @@ -2488,10 +2488,7 @@ public final class ActivityManagerService extends ActivityManagerNative synchronized(bstats) { synchronized(mPidsSelfLocked) { if (haveNewCpuStats) { - final int perc = bstats.startAddingCpuLocked(); - if (perc >= 0) { - int remainUTime = 0; - int remainSTime = 0; + if (bstats.startAddingCpuLocked()) { int totalUTime = 0; int totalSTime = 0; final int N = mProcessCpuTracker.countStats(); @@ -2501,10 +2498,6 @@ public final class ActivityManagerService extends ActivityManagerNative continue; } ProcessRecord pr = mPidsSelfLocked.get(st.pid); - int otherUTime = (st.rel_utime*perc)/100; - int otherSTime = (st.rel_stime*perc)/100; - remainUTime += otherUTime; - remainSTime += otherSTime; totalUTime += st.rel_utime; totalSTime += st.rel_stime; if (pr != null) { @@ -2513,8 +2506,7 @@ public final class ActivityManagerService extends ActivityManagerNative pr.curProcBatteryStats = ps = bstats.getProcessStatsLocked( pr.info.uid, pr.processName); } - ps.addCpuTimeLocked(st.rel_utime - otherUTime, - st.rel_stime - otherSTime); + ps.addCpuTimeLocked(st.rel_utime, st.rel_stime); pr.curCpuTime += st.rel_utime + st.rel_stime; } else { BatteryStatsImpl.Uid.Proc ps = st.batteryStats; @@ -2522,8 +2514,7 @@ public final class ActivityManagerService extends ActivityManagerNative st.batteryStats = ps = bstats.getProcessStatsLocked( bstats.mapUid(st.uid), st.name); } - ps.addCpuTimeLocked(st.rel_utime - otherUTime, - st.rel_stime - otherSTime); + ps.addCpuTimeLocked(st.rel_utime, st.rel_stime); } } final int userTime = mProcessCpuTracker.getLastUserTime(); @@ -2532,9 +2523,8 @@ public final class ActivityManagerService extends ActivityManagerNative final int irqTime = mProcessCpuTracker.getLastIrqTime(); final int softIrqTime = mProcessCpuTracker.getLastSoftIrqTime(); final int idleTime = mProcessCpuTracker.getLastIdleTime(); - bstats.finishAddingCpuLocked(perc, remainUTime, - remainSTime, totalUTime, totalSTime, userTime, systemTime, - iowaitTime, irqTime, softIrqTime, idleTime); + bstats.finishAddingCpuLocked(totalUTime, totalSTime, userTime, + systemTime, iowaitTime, irqTime, softIrqTime, idleTime); } } } @@ -3274,9 +3264,9 @@ public final class ActivityManagerService extends ActivityManagerNative debugFlags |= Zygote.DEBUG_ENABLE_JIT; } } - String genCFIDebugProperty = SystemProperties.get("debug.gencfi"); - if ("true".equals(genCFIDebugProperty)) { - debugFlags |= Zygote.DEBUG_GENERATE_CFI; + String genDebugInfoProperty = SystemProperties.get("debug.generate-debug-info"); + if ("true".equals(genDebugInfoProperty)) { + debugFlags |= Zygote.DEBUG_GENERATE_DEBUG_INFO; } if ("1".equals(SystemProperties.get("debug.jni.logging"))) { debugFlags |= Zygote.DEBUG_ENABLE_JNI_LOGGING; @@ -3589,6 +3579,8 @@ public final class ActivityManagerService extends ActivityManagerNative @Override public int getPackageProcessState(String packageName) { + enforceCallingPermission(android.Manifest.permission.GET_PACKAGE_IMPORTANCE, + "getPackageProcessState"); int procState = ActivityManager.PROCESS_STATE_NONEXISTENT; synchronized (this) { for (int i=mLruProcesses.size()-1; i>=0; i--) { @@ -6313,9 +6305,9 @@ public final class ActivityManagerService extends ActivityManagerNative SystemProperties.set("dev.bootcomplete", "1"); } for (int i=0; i<mStartedUsers.size(); i++) { - UserStartedState uss = mStartedUsers.valueAt(i); - if (uss.mState == UserStartedState.STATE_BOOTING) { - uss.mState = UserStartedState.STATE_RUNNING; + UserState uss = mStartedUsers.valueAt(i); + if (uss.mState == UserState.STATE_BOOTING) { + uss.mState = UserState.STATE_RUNNING; final int userId = mStartedUsers.keyAt(i); Intent intent = new Intent(Intent.ACTION_BOOT_COMPLETED, null); intent.putExtra(Intent.EXTRA_USER_HANDLE, userId); @@ -8278,7 +8270,7 @@ public final class ActivityManagerService extends ActivityManagerNative try { if (AppGlobals.getPackageManager().isUidPrivileged(callingUid)) { allowed = true; - Slog.w(TAG, caller + ": caller " + callingUid + if (DEBUG_TASKS) Slog.w(TAG, caller + ": caller " + callingUid + " is using old GET_TASKS but privileged; allowing"); } } catch (RemoteException e) { @@ -8286,7 +8278,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } if (!allowed) { - Slog.w(TAG, caller + ": caller " + callingUid + if (DEBUG_TASKS) Slog.w(TAG, caller + ": caller " + callingUid + " does not hold REAL_GET_TASKS; limiting output"); } return allowed; @@ -9442,6 +9434,7 @@ public final class ActivityManagerService extends ActivityManagerNative } checkTime(startTime, "getContentProviderImpl: before updateOomAdj"); boolean success = updateOomAdjLocked(cpr.proc); + maybeUpdateProviderUsageStatsLocked(r, cpr.info.packageName, name); checkTime(startTime, "getContentProviderImpl: after updateOomAdj"); if (DEBUG_PROVIDER) Slog.i(TAG_PROVIDER, "Adjust success: " + success); // NOTE: there is still a race here where a signal could be @@ -9831,6 +9824,8 @@ public final class ActivityManagerService extends ActivityManagerNative dst.notifyAll(); } updateOomAdjLocked(r); + maybeUpdateProviderUsageStatsLocked(r, src.info.packageName, + src.info.authority); } } @@ -13343,7 +13338,7 @@ public final class ActivityManagerService extends ActivityManagerNative needSep = false; pw.println(" mStartedUsers:"); for (int i=0; i<mStartedUsers.size(); i++) { - UserStartedState uss = mStartedUsers.valueAt(i); + UserState uss = mStartedUsers.valueAt(i); pw.print(" User #"); pw.print(uss.mHandle.getIdentifier()); pw.print(": "); uss.dump("", pw); } @@ -18615,6 +18610,22 @@ public final class ActivityManagerService extends ActivityManagerNative uidRec.pendingChange.processState = uidRec.setProcState; } + private void maybeUpdateProviderUsageStatsLocked(ProcessRecord app, String providerPkgName, + String authority) { + if (app == null) return; + if (app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND) { + UserState userState = mStartedUsers.get(app.userId); + if (userState == null) return; + final long now = SystemClock.elapsedRealtime(); + Long lastReported = userState.mProviderLastReportedFg.get(authority); + if (lastReported == null || lastReported < now - 60 * 1000L) { + mUsageStatsService.reportContentProviderUsage( + authority, providerPkgName, app.userId); + userState.mProviderLastReportedFg.put(authority, now); + } + } + } + private void maybeUpdateUsageStatsLocked(ProcessRecord app) { if (DEBUG_USAGE_STATS) { Slog.d(TAG, "Checking proc [" + Arrays.toString(app.getPackageList()) @@ -19602,7 +19613,7 @@ public final class ActivityManagerService extends ActivityManagerNative // If the user we are switching to is not currently started, then // we need to start it now. if (mStartedUsers.get(userId) == null) { - mStartedUsers.put(userId, new UserStartedState(new UserHandle(userId), false)); + mStartedUsers.put(userId, new UserState(new UserHandle(userId), false)); updateStartedUserArrayLocked(); needStart = true; } @@ -19627,26 +19638,26 @@ public final class ActivityManagerService extends ActivityManagerNative mUserLru.add(currentUserIdInt); } - final UserStartedState uss = mStartedUsers.get(userId); + final UserState uss = mStartedUsers.get(userId); // Make sure user is in the started state. If it is currently // stopping, we need to knock that off. - if (uss.mState == UserStartedState.STATE_STOPPING) { + if (uss.mState == UserState.STATE_STOPPING) { // If we are stopping, we haven't sent ACTION_SHUTDOWN, // so we can just fairly silently bring the user back from // the almost-dead. - uss.mState = UserStartedState.STATE_RUNNING; + uss.mState = UserState.STATE_RUNNING; updateStartedUserArrayLocked(); needStart = true; - } else if (uss.mState == UserStartedState.STATE_SHUTDOWN) { + } else if (uss.mState == UserState.STATE_SHUTDOWN) { // This means ACTION_SHUTDOWN has been sent, so we will // need to treat this as a new boot of the user. - uss.mState = UserStartedState.STATE_BOOTING; + uss.mState = UserState.STATE_BOOTING; updateStartedUserArrayLocked(); needStart = true; } - if (uss.mState == UserStartedState.STATE_BOOTING) { + if (uss.mState == UserState.STATE_BOOTING) { // Booting up a new user, need to tell system services about it. // Note that this is on the same handler as scheduling of broadcasts, // which is important because it needs to go first. @@ -19784,7 +19795,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } - void dispatchUserSwitch(final UserStartedState uss, final int oldUserId, + void dispatchUserSwitch(final UserState uss, final int oldUserId, final int newUserId) { final int N = mUserSwitchObservers.beginBroadcast(); if (N > 0) { @@ -19821,21 +19832,21 @@ public final class ActivityManagerService extends ActivityManagerNative mUserSwitchObservers.finishBroadcast(); } - void timeoutUserSwitch(UserStartedState uss, int oldUserId, int newUserId) { + void timeoutUserSwitch(UserState uss, int oldUserId, int newUserId) { synchronized (this) { Slog.w(TAG, "User switch timeout: from " + oldUserId + " to " + newUserId); sendContinueUserSwitchLocked(uss, oldUserId, newUserId); } } - void sendContinueUserSwitchLocked(UserStartedState uss, int oldUserId, int newUserId) { + void sendContinueUserSwitchLocked(UserState uss, int oldUserId, int newUserId) { mCurUserSwitchCallback = null; mHandler.removeMessages(USER_SWITCH_TIMEOUT_MSG); mHandler.sendMessage(mHandler.obtainMessage(CONTINUE_USER_SWITCH_MSG, oldUserId, newUserId, uss)); } - void onUserInitialized(UserStartedState uss, boolean foreground, int oldUserId, int newUserId) { + void onUserInitialized(UserState uss, boolean foreground, int oldUserId, int newUserId) { synchronized (this) { if (foreground) { moveUserToForeground(uss, oldUserId, newUserId); @@ -19845,7 +19856,7 @@ public final class ActivityManagerService extends ActivityManagerNative completeSwitchAndInitalize(uss, newUserId, true, false); } - void moveUserToForeground(UserStartedState uss, int oldUserId, int newUserId) { + void moveUserToForeground(UserState uss, int oldUserId, int newUserId) { boolean homeInFront = mStackSupervisor.switchUserLocked(newUserId, uss); if (homeInFront) { startHomeActivityLocked(newUserId, "moveUserToFroreground"); @@ -19857,11 +19868,11 @@ public final class ActivityManagerService extends ActivityManagerNative sendUserSwitchBroadcastsLocked(oldUserId, newUserId); } - void continueUserSwitch(UserStartedState uss, int oldUserId, int newUserId) { + void continueUserSwitch(UserState uss, int oldUserId, int newUserId) { completeSwitchAndInitalize(uss, newUserId, false, true); } - void completeSwitchAndInitalize(UserStartedState uss, int newUserId, + void completeSwitchAndInitalize(UserState uss, int newUserId, boolean clearInitializing, boolean clearSwitching) { boolean unfrozen = false; synchronized (this) { @@ -19898,10 +19909,10 @@ public final class ActivityManagerService extends ActivityManagerNative final int num = mUserLru.size(); for (int i = 0; i < num; i++) { Integer oldUserId = mUserLru.get(i); - UserStartedState oldUss = mStartedUsers.get(oldUserId); + UserState oldUss = mStartedUsers.get(oldUserId); if (oldUserId == UserHandle.USER_OWNER || oldUserId == mCurrentUserId - || oldUss.mState == UserStartedState.STATE_STOPPING - || oldUss.mState == UserStartedState.STATE_SHUTDOWN) { + || oldUss.mState == UserState.STATE_STOPPING + || oldUss.mState == UserState.STATE_SHUTDOWN) { continue; } UserInfo userInfo = mUserManager.getUserInfo(oldUserId); @@ -19942,11 +19953,11 @@ public final class ActivityManagerService extends ActivityManagerNative } } - void finishUserBoot(UserStartedState uss) { + void finishUserBoot(UserState uss) { synchronized (this) { - if (uss.mState == UserStartedState.STATE_BOOTING + if (uss.mState == UserState.STATE_BOOTING && mStartedUsers.get(uss.mHandle.getIdentifier()) == uss) { - uss.mState = UserStartedState.STATE_RUNNING; + uss.mState = UserState.STATE_RUNNING; final int userId = uss.mHandle.getIdentifier(); Intent intent = new Intent(Intent.ACTION_BOOT_COMPLETED, null); intent.putExtra(Intent.EXTRA_USER_HANDLE, userId); @@ -19959,7 +19970,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } - void finishUserSwitch(UserStartedState uss) { + void finishUserSwitch(UserState uss) { synchronized (this) { finishUserBoot(uss); @@ -19969,15 +19980,15 @@ public final class ActivityManagerService extends ActivityManagerNative int i = 0; while (num > MAX_RUNNING_USERS && i < mUserLru.size()) { Integer oldUserId = mUserLru.get(i); - UserStartedState oldUss = mStartedUsers.get(oldUserId); + UserState oldUss = mStartedUsers.get(oldUserId); if (oldUss == null) { // Shouldn't happen, but be sane if it does. mUserLru.remove(i); num--; continue; } - if (oldUss.mState == UserStartedState.STATE_STOPPING - || oldUss.mState == UserStartedState.STATE_SHUTDOWN) { + if (oldUss.mState == UserState.STATE_STOPPING + || oldUss.mState == UserState.STATE_SHUTDOWN) { // This user is already stopping, doesn't count. num--; i++; @@ -20022,7 +20033,7 @@ public final class ActivityManagerService extends ActivityManagerNative return ActivityManager.USER_OP_IS_CURRENT; } - final UserStartedState uss = mStartedUsers.get(userId); + final UserState uss = mStartedUsers.get(userId); if (uss == null) { // User is not started, nothing to do... but we do need to // callback if requested. @@ -20044,9 +20055,9 @@ public final class ActivityManagerService extends ActivityManagerNative uss.mStopCallbacks.add(callback); } - if (uss.mState != UserStartedState.STATE_STOPPING - && uss.mState != UserStartedState.STATE_SHUTDOWN) { - uss.mState = UserStartedState.STATE_STOPPING; + if (uss.mState != UserState.STATE_STOPPING + && uss.mState != UserState.STATE_SHUTDOWN) { + uss.mState = UserState.STATE_STOPPING; updateStartedUserArrayLocked(); long ident = Binder.clearCallingIdentity(); @@ -20074,11 +20085,11 @@ public final class ActivityManagerService extends ActivityManagerNative Bundle extras, boolean ordered, boolean sticky, int sendingUser) { // On to the next. synchronized (ActivityManagerService.this) { - if (uss.mState != UserStartedState.STATE_STOPPING) { + if (uss.mState != UserState.STATE_STOPPING) { // Whoops, we are being started back up. Abort, abort! return; } - uss.mState = UserStartedState.STATE_SHUTDOWN; + uss.mState = UserState.STATE_SHUTDOWN; } mBatteryStatsService.noteEvent( BatteryStats.HistoryItem.EVENT_USER_RUNNING_FINISH, @@ -20102,7 +20113,7 @@ public final class ActivityManagerService extends ActivityManagerNative return ActivityManager.USER_OP_SUCCESS; } - void finishUserStop(UserStartedState uss) { + void finishUserStop(UserState uss) { final int userId = uss.mHandle.getIdentifier(); boolean stopped; ArrayList<IStopUserCallback> callbacks; @@ -20110,7 +20121,7 @@ public final class ActivityManagerService extends ActivityManagerNative callbacks = new ArrayList<IStopUserCallback>(uss.mStopCallbacks); if (mStartedUsers.get(userId) != uss) { stopped = false; - } else if (uss.mState != UserStartedState.STATE_SHUTDOWN) { + } else if (uss.mState != UserState.STATE_SHUTDOWN) { stopped = false; } else { stopped = true; @@ -20184,15 +20195,15 @@ public final class ActivityManagerService extends ActivityManagerNative } boolean isUserRunningLocked(int userId, boolean orStopped) { - UserStartedState state = mStartedUsers.get(userId); + UserState state = mStartedUsers.get(userId); if (state == null) { return false; } if (orStopped) { return true; } - return state.mState != UserStartedState.STATE_STOPPING - && state.mState != UserStartedState.STATE_SHUTDOWN; + return state.mState != UserState.STATE_STOPPING + && state.mState != UserState.STATE_SHUTDOWN; } @Override @@ -20214,19 +20225,19 @@ public final class ActivityManagerService extends ActivityManagerNative private void updateStartedUserArrayLocked() { int num = 0; for (int i=0; i<mStartedUsers.size(); i++) { - UserStartedState uss = mStartedUsers.valueAt(i); + UserState uss = mStartedUsers.valueAt(i); // This list does not include stopping users. - if (uss.mState != UserStartedState.STATE_STOPPING - && uss.mState != UserStartedState.STATE_SHUTDOWN) { + if (uss.mState != UserState.STATE_STOPPING + && uss.mState != UserState.STATE_SHUTDOWN) { num++; } } mStartedUserArray = new int[num]; num = 0; for (int i=0; i<mStartedUsers.size(); i++) { - UserStartedState uss = mStartedUsers.valueAt(i); - if (uss.mState != UserStartedState.STATE_STOPPING - && uss.mState != UserStartedState.STATE_SHUTDOWN) { + UserState uss = mStartedUsers.valueAt(i); + if (uss.mState != UserState.STATE_STOPPING + && uss.mState != UserState.STATE_SHUTDOWN) { mStartedUserArray[num] = mStartedUsers.keyAt(i); num++; } diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index eb5af9e56d5c..0714d36eb5ed 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -1326,7 +1326,12 @@ final class ActivityStack { if (r != starting) { mStackSupervisor.startSpecificActivityLocked( r, noStackActivityResumed, false); - noStackActivityResumed = false; + if (activityNdx >= activities.size()) { + // Record may be removed if its process needs to restart. + activityNdx = activities.size() - 1; + } else { + noStackActivityResumed = false; + } } } else if (r.visible) { diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 9e33f2a99607..c54a96daa19c 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -233,10 +233,10 @@ public final class ActivityStackSupervisor implements DisplayListener { final ArrayList<ActivityRecord> mGoingToSleepActivities = new ArrayList<>(); /** Used on user changes */ - final ArrayList<UserStartedState> mStartingUsers = new ArrayList<>(); + final ArrayList<UserState> mStartingUsers = new ArrayList<>(); /** Used to queue up any background users being started */ - final ArrayList<UserStartedState> mStartingBackgroundUsers = new ArrayList<>(); + final ArrayList<UserState> mStartingBackgroundUsers = new ArrayList<>(); /** Set to indicate whether to issue an onUserLeaving callback when a newly launched activity * is being brought in front of us. */ @@ -1915,7 +1915,12 @@ public final class ActivityStackSupervisor implements DisplayListener { ActivityRecord intentActivity = !launchSingleInstance ? findTaskLocked(r) : findActivityLocked(intent, r.info); if (intentActivity != null) { - if (isLockTaskModeViolation(intentActivity.task)) { + // When the flags NEW_TASK and CLEAR_TASK are set, then the task gets reused + // but still needs to be a lock task mode violation since the task gets + // cleared out and the device would otherwise leave the locked task. + if (isLockTaskModeViolation(intentActivity.task, + (launchFlags & (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK)) + == (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK))) { showLockTaskToast(); Slog.e(TAG, "startActivityUnchecked: Attempt to violate Lock Task Mode"); return ActivityManager.START_RETURN_LOCK_TASK_MODE_VIOLATION; @@ -2371,7 +2376,7 @@ public final class ActivityStackSupervisor implements DisplayListener { ArrayList<ActivityRecord> stops = null; ArrayList<ActivityRecord> finishes = null; - ArrayList<UserStartedState> startingUsers = null; + ArrayList<UserState> startingUsers = null; int NS = 0; int NF = 0; boolean booting = false; @@ -2468,7 +2473,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } // Complete starting up of background users if (mStartingBackgroundUsers.size() > 0) { - startingUsers = new ArrayList<UserStartedState>(mStartingBackgroundUsers); + startingUsers = new ArrayList<UserState>(mStartingBackgroundUsers); mStartingBackgroundUsers.clear(); for (int i = 0; i < startingUsers.size(); i++) { mService.finishUserBoot(startingUsers.get(i)); @@ -3230,7 +3235,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } } - boolean switchUserLocked(int userId, UserStartedState uss) { + boolean switchUserLocked(int userId, UserState uss) { mUserStackInFront.put(mCurrentUser, mFocusedStack.getStackId()); final int restoreStackId = mUserStackInFront.get(userId, HOME_STACK_ID); mCurrentUser = userId; @@ -3271,7 +3276,7 @@ public final class ActivityStackSupervisor implements DisplayListener { * @param userId The user being started in the background * @param uss The state object for the user. */ - public void startBackgroundUserLocked(int userId, UserStartedState uss) { + public void startBackgroundUserLocked(int userId, UserState uss) { mStartingBackgroundUsers.add(uss); } @@ -3780,7 +3785,11 @@ public final class ActivityStackSupervisor implements DisplayListener { } boolean isLockTaskModeViolation(TaskRecord task) { - if (getLockedTaskLocked() == task) { + return isLockTaskModeViolation(task, false); + } + + boolean isLockTaskModeViolation(TaskRecord task, boolean isNewClearTask) { + if (getLockedTaskLocked() == task && !isNewClearTask) { return false; } final int lockTaskAuth = task.mLockTaskAuth; diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java index c973386e4bb8..3854e5160fc6 100644 --- a/services/core/java/com/android/server/am/BatteryStatsService.java +++ b/services/core/java/com/android/server/am/BatteryStatsService.java @@ -42,6 +42,7 @@ import android.telephony.SignalStrength; import android.telephony.TelephonyManager; import android.util.Slog; +import android.util.TimeUtils; import com.android.internal.annotations.GuardedBy; import com.android.internal.app.IBatteryStats; import com.android.internal.os.BatteryStatsHelper; @@ -64,16 +65,22 @@ public final class BatteryStatsService extends IBatteryStats.Stub implements PowerManagerInternal.LowPowerModeListener { static final String TAG = "BatteryStatsService"; - private boolean mFirstExternalStatsUpdate = true; static IBatteryStats sService; final BatteryStatsImpl mStats; final BatteryStatsHandler mHandler; Context mContext; PowerManagerInternal mPowerManagerInternal; + final int UPDATE_CPU = 0x01; + final int UPDATE_WIFI = 0x02; + final int UPDATE_RADIO = 0x04; + final int UPDATE_BT = 0x08; + final int UPDATE_ALL = UPDATE_CPU | UPDATE_WIFI | UPDATE_RADIO | UPDATE_BT; + class BatteryStatsHandler extends Handler implements BatteryStatsImpl.ExternalStatsSync { public static final int MSG_SYNC_EXTERNAL_STATS = 1; public static final int MSG_WRITE_TO_DISK = 2; + private int mUpdateFlags = 0; public BatteryStatsHandler(Looper looper) { super(looper); @@ -83,11 +90,17 @@ public final class BatteryStatsService extends IBatteryStats.Stub public void handleMessage(Message msg) { switch (msg.what) { case MSG_SYNC_EXTERNAL_STATS: - updateExternalStats((String)msg.obj, false); + final int updateFlags; + synchronized (this) { + removeMessages(MSG_SYNC_EXTERNAL_STATS); + updateFlags = mUpdateFlags; + mUpdateFlags = 0; + } + updateExternalStats((String)msg.obj, updateFlags); break; case MSG_WRITE_TO_DISK: - updateExternalStats("write", true); + updateExternalStats("write", UPDATE_ALL); synchronized (mStats) { mStats.writeAsyncLocked(); } @@ -97,9 +110,20 @@ public final class BatteryStatsService extends IBatteryStats.Stub @Override public void scheduleSync(String reason) { - if (!hasMessages(MSG_SYNC_EXTERNAL_STATS)) { - Message msg = Message.obtain(this, MSG_SYNC_EXTERNAL_STATS, reason); - sendMessage(msg); + scheduleSyncImpl(reason, UPDATE_ALL); + } + + @Override + public void scheduleWifiSync(String reason) { + scheduleSyncImpl(reason, UPDATE_WIFI); + } + + private void scheduleSyncImpl(String reason, int updateFlags) { + synchronized (this) { + if (mUpdateFlags == 0) { + sendMessage(Message.obtain(this, MSG_SYNC_EXTERNAL_STATS, reason)); + } + mUpdateFlags |= updateFlags; } } } @@ -137,7 +161,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub public void shutdown() { Slog.w("BatteryStats", "Writing battery stats before shutdown..."); - updateExternalStats("shutdown", true); + updateExternalStats("shutdown", UPDATE_ALL); synchronized (mStats) { mStats.shutdownLocked(); } @@ -237,7 +261,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub //Slog.i("foo", "SENDING BATTERY INFO:"); //mStats.dumpLocked(new LogPrinter(Log.INFO, "foo", Log.LOG_ID_SYSTEM)); Parcel out = Parcel.obtain(); - updateExternalStats("get-stats", true); + updateExternalStats("get-stats", UPDATE_ALL); synchronized (mStats) { mStats.writeToParcel(out, 0); } @@ -252,7 +276,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub //Slog.i("foo", "SENDING BATTERY INFO:"); //mStats.dumpLocked(new LogPrinter(Log.INFO, "foo", Log.LOG_ID_SYSTEM)); Parcel out = Parcel.obtain(); - updateExternalStats("get-stats", true); + updateExternalStats("get-stats", UPDATE_ALL); synchronized (mStats) { mStats.writeToParcel(out, 0); } @@ -603,8 +627,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub // There was a change in WiFi power state. // Collect data now for the past activity. - mHandler.scheduleSync("wifi-data"); synchronized (mStats) { + if (mStats.isOnBattery()) { + mHandler.scheduleWifiSync("wifi-data"); + } mStats.noteWifiRadioPowerState(powerState, tsNanos); } } @@ -767,10 +793,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub } @Override - public void noteDeviceIdleMode(boolean enabled, boolean fromActive, boolean fromMotion) { + public void noteDeviceIdleMode(boolean enabled, String activeReason, int activeUid) { enforceCallingPermission(); synchronized (mStats) { - mStats.noteDeviceIdleModeLocked(enabled, fromActive, fromMotion); + mStats.noteDeviceIdleModeLocked(enabled, activeReason, activeUid); } } @@ -807,7 +833,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub // Sync external stats first as the battery has changed states. If we don't sync // immediately here, we may not collect the relevant data later. - updateExternalStats("battery-state", false); + updateExternalStats("battery-state", UPDATE_ALL); synchronized (mStats) { mStats.setBatteryStateLocked(status, health, plugType, level, temp, volt); } @@ -961,9 +987,9 @@ public final class BatteryStatsService extends IBatteryStats.Stub pw.println("Battery stats reset."); noOutput = true; } - updateExternalStats("dump", true); + updateExternalStats("dump", UPDATE_ALL); } else if ("--write".equals(arg)) { - updateExternalStats("dump", true); + updateExternalStats("dump", UPDATE_ALL); synchronized (mStats) { mStats.writeSyncLocked(); pw.println("Battery stats written."); @@ -1027,7 +1053,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub flags |= BatteryStats.DUMP_DEVICE_WIFI_ONLY; } // Fetch data from external sources and update the BatteryStatsImpl object with them. - updateExternalStats("dump", true); + updateExternalStats("dump", UPDATE_ALL); } finally { Binder.restoreCallingIdentity(ident); } @@ -1119,6 +1145,12 @@ public final class BatteryStatsService extends IBatteryStats.Stub return null; } + final long timePeriodMs = info.mTimestamp - mLastInfo.mTimestamp; + final long lastIdleMs = mLastInfo.mControllerIdleTimeMs; + final long lastTxMs = mLastInfo.mControllerTxTimeMs; + final long lastRxMs = mLastInfo.mControllerRxTimeMs; + final long lastEnergy = mLastInfo.mControllerEnergyUsed; + // We will modify the last info object to be the delta, and store the new // WifiActivityEnergyInfo object as our last one. final WifiActivityEnergyInfo result = mLastInfo; @@ -1126,19 +1158,16 @@ public final class BatteryStatsService extends IBatteryStats.Stub result.mStackState = info.getStackState(); // These times seem to be the most reliable. - result.mControllerTxTimeMs = - info.mControllerTxTimeMs - mLastInfo.mControllerTxTimeMs; - result.mControllerRxTimeMs = - info.mControllerRxTimeMs - mLastInfo.mControllerRxTimeMs; + result.mControllerTxTimeMs = info.mControllerTxTimeMs - lastTxMs; + result.mControllerRxTimeMs = info.mControllerRxTimeMs - lastRxMs; // WiFi calculates the idle time as a difference from the on time and the various // Rx + Tx times. There seems to be some missing time there because this sometimes // becomes negative. Just cap it at 0 and move on. // b/21613534 - result.mControllerIdleTimeMs = - Math.max(0, info.mControllerIdleTimeMs - mLastInfo.mControllerIdleTimeMs); + result.mControllerIdleTimeMs = Math.max(0, info.mControllerIdleTimeMs - lastIdleMs); result.mControllerEnergyUsed = - Math.max(0, info.mControllerEnergyUsed - mLastInfo.mControllerEnergyUsed); + Math.max(0, info.mControllerEnergyUsed - lastEnergy); if (result.mControllerTxTimeMs < 0 || result.mControllerRxTimeMs < 0) { @@ -1151,6 +1180,34 @@ public final class BatteryStatsService extends IBatteryStats.Stub Slog.v(TAG, "WiFi energy data was reset, new WiFi energy data is " + result); } + + final long totalTimeMs = result.mControllerIdleTimeMs + result.mControllerRxTimeMs + + result.mControllerTxTimeMs; + if (totalTimeMs > timePeriodMs) { + StringBuilder sb = new StringBuilder(); + sb.append("Total time "); + TimeUtils.formatDuration(totalTimeMs, sb); + sb.append(" is longer than sample period "); + TimeUtils.formatDuration(timePeriodMs, sb); + sb.append(".\n"); + sb.append("Previous WiFi snapshot: ").append("idle="); + TimeUtils.formatDuration(lastIdleMs, sb); + sb.append(" rx="); + TimeUtils.formatDuration(lastRxMs, sb); + sb.append(" tx="); + TimeUtils.formatDuration(lastTxMs, sb); + sb.append(" e=").append(lastEnergy); + sb.append("\n"); + sb.append("Current WiFi snapshot: ").append("idle="); + TimeUtils.formatDuration(info.mControllerIdleTimeMs, sb); + sb.append(" rx="); + TimeUtils.formatDuration(info.mControllerRxTimeMs, sb); + sb.append(" tx="); + TimeUtils.formatDuration(info.mControllerTxTimeMs, sb); + sb.append(" e=").append(info.mControllerEnergyUsed); + Slog.wtf(TAG, sb.toString()); + } + mLastInfo = info; return result; } @@ -1184,15 +1241,12 @@ public final class BatteryStatsService extends IBatteryStats.Stub * We first grab a lock specific to this method, then once all the data has been collected, * we grab the mStats lock and update the data. * - * TODO(adamlesinski): When we start distributing bluetooth data to apps, we'll want to - * separate these external stats so that they can be collected individually and on different - * intervals. - * * @param reason The reason why this collection was requested. Useful for debugging. - * @param force If false, some stats may decide not to be collected for efficiency as their - * results aren't needed immediately. When true, collect all stats unconditionally. + * @param updateFlags Which external stats to update. Can be a combination of + * {@link #UPDATE_CPU}, {@link #UPDATE_RADIO}, {@link #UPDATE_WIFI}, + * and {@link #UPDATE_BT}. */ - void updateExternalStats(String reason, boolean force) { + void updateExternalStats(final String reason, final int updateFlags) { synchronized (mExternalStatsLock) { if (mContext == null) { // We haven't started yet (which means the BatteryStatsImpl object has @@ -1200,34 +1254,46 @@ public final class BatteryStatsService extends IBatteryStats.Stub return; } - final WifiActivityEnergyInfo wifiEnergyInfo = pullWifiEnergyInfoLocked(); - final BluetoothActivityEnergyInfo bluetoothEnergyInfo; - if (force) { + if (BatteryStatsImpl.DEBUG_ENERGY) { + Slog.d(TAG, "Updating external stats: reason=" + reason); + } + + WifiActivityEnergyInfo wifiEnergyInfo = null; + if ((updateFlags & UPDATE_WIFI) != 0) { + wifiEnergyInfo = pullWifiEnergyInfoLocked(); + } + + BluetoothActivityEnergyInfo bluetoothEnergyInfo = null; + if ((updateFlags & UPDATE_BT) != 0) { // We only pull bluetooth stats when we have to, as we are not distributing its // use amongst apps and the sampling frequency does not matter. bluetoothEnergyInfo = pullBluetoothEnergyInfoLocked(); - } else { - bluetoothEnergyInfo = null; } synchronized (mStats) { + final long elapsedRealtime = SystemClock.elapsedRealtime(); + final long uptime = SystemClock.uptimeMillis(); if (mStats.mRecordAllHistory) { - final long elapsedRealtime = SystemClock.elapsedRealtime(); - final long uptime = SystemClock.uptimeMillis(); mStats.addHistoryEventLocked(elapsedRealtime, uptime, BatteryStats.HistoryItem.EVENT_COLLECT_EXTERNAL_STATS, reason, 0); } - mStats.updateCpuTimeLocked(mFirstExternalStatsUpdate); - mStats.updateKernelWakelocksLocked(); - mStats.updateMobileRadioStateLocked(SystemClock.elapsedRealtime()); - mStats.updateWifiStateLocked(wifiEnergyInfo); - mStats.updateBluetoothStateLocked(bluetoothEnergyInfo); - } - if (mFirstExternalStatsUpdate) { - // We have read the stats for the first time, which means we have a baseline - // from which to calculate delta. - mFirstExternalStatsUpdate = false; + if ((updateFlags & UPDATE_CPU) != 0) { + mStats.updateCpuTimeLocked(); + mStats.updateKernelWakelocksLocked(); + } + + if ((updateFlags & UPDATE_RADIO) != 0) { + mStats.updateMobileRadioStateLocked(elapsedRealtime); + } + + if ((updateFlags & UPDATE_WIFI) != 0) { + mStats.updateWifiStateLocked(wifiEnergyInfo); + } + + if ((updateFlags & UPDATE_BT) != 0) { + mStats.updateBluetoothStateLocked(bluetoothEnergyInfo); + } } } } diff --git a/services/core/java/com/android/server/am/ServiceRecord.java b/services/core/java/com/android/server/am/ServiceRecord.java index 236af375ffae..87cb40ea3e9f 100644 --- a/services/core/java/com/android/server/am/ServiceRecord.java +++ b/services/core/java/com/android/server/am/ServiceRecord.java @@ -445,6 +445,11 @@ final class ServiceRecord extends Binder { // icon, but this used to be able to slip through, so for // those dirty apps we will create a notification clearly // blaming the app. + Slog.v(TAG, "Attempted to start a foreground service (" + + name + + ") with a broken notification (no icon: " + + localForegroundNoti + + ")"); CharSequence appName = appInfo.loadLabel( ams.mContext.getPackageManager()); @@ -461,6 +466,12 @@ final class ServiceRecord extends Binder { // it's ugly, but it clearly identifies the app notiBuilder.setSmallIcon(appInfo.icon); + // mark as foreground + notiBuilder.setFlag(Notification.FLAG_FOREGROUND_SERVICE, true); + + // we are doing the app a kindness here + notiBuilder.setPriority(Notification.PRIORITY_MIN); + Intent runningIntent = new Intent( Settings.ACTION_APPLICATION_DETAILS_SETTINGS); runningIntent.setData(Uri.fromParts("package", @@ -498,6 +509,8 @@ final class ServiceRecord extends Binder { nm.enqueueNotification(localPackageName, localPackageName, appUid, appPid, null, localForegroundId, localForegroundNoti, outId, userId); + + foregroundNoti = localForegroundNoti; // save it for amending next time } catch (RuntimeException e) { Slog.w(TAG, "Error showing notification for service", e); // If it gave us a garbage notification, it doesn't diff --git a/services/core/java/com/android/server/am/UserStartedState.java b/services/core/java/com/android/server/am/UserState.java index d3e73d5222a4..b3d82bca2de8 100644 --- a/services/core/java/com/android/server/am/UserStartedState.java +++ b/services/core/java/com/android/server/am/UserState.java @@ -21,8 +21,9 @@ import java.util.ArrayList; import android.app.IStopUserCallback; import android.os.UserHandle; +import android.util.ArrayMap; -public final class UserStartedState { +public final class UserState { // User is first coming up. public final static int STATE_BOOTING = 0; // User is in the normal running state. @@ -40,7 +41,13 @@ public final class UserStartedState { public boolean switching; public boolean initializing; - public UserStartedState(UserHandle handle, boolean initial) { + /** + * The last time that a provider was reported to usage stats as being brought to important + * foreground procstate. + */ + public final ArrayMap<String,Long> mProviderLastReportedFg = new ArrayMap<>(); + + public UserState(UserHandle handle, boolean initial) { mHandle = handle; } diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index d39b25f39c83..47d3bde7a5e1 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -1542,11 +1542,7 @@ public class AudioService extends IAudioService.Stub { // UI update and Broadcast Intent private void sendVolumeUpdate(int streamType, int oldIndex, int index, int flags) { - if (!isPlatformVoice() && (streamType == AudioSystem.STREAM_RING)) { - streamType = AudioSystem.STREAM_NOTIFICATION; - } else { - streamType = mStreamVolumeAlias[streamType]; - } + streamType = mStreamVolumeAlias[streamType]; if (streamType == AudioSystem.STREAM_MUSIC) { flags = updateFlagsForSystemAudio(flags); diff --git a/services/core/java/com/android/server/audio/MediaFocusControl.java b/services/core/java/com/android/server/audio/MediaFocusControl.java index 4ccb5ad777d2..f72b5987d7ac 100644 --- a/services/core/java/com/android/server/audio/MediaFocusControl.java +++ b/services/core/java/com/android/server/audio/MediaFocusControl.java @@ -46,10 +46,12 @@ import android.os.Binder; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; +import android.os.IDeviceIdleController; import android.os.Looper; import android.os.Message; import android.os.PowerManager; import android.os.RemoteException; +import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; import android.speech.RecognizerIntent; @@ -1086,6 +1088,14 @@ public class MediaFocusControl implements OnFinished { voiceIntent = new Intent(android.speech.RecognizerIntent.ACTION_WEB_SEARCH); Log.i(TAG, "voice-based interactions: about to use ACTION_WEB_SEARCH"); } else { + IDeviceIdleController dic = IDeviceIdleController.Stub.asInterface( + ServiceManager.getService(Context.DEVICE_IDLE_CONTROLLER)); + if (dic != null) { + try { + dic.exitIdle("voice-search"); + } catch (RemoteException e) { + } + } voiceIntent = new Intent(RecognizerIntent.ACTION_VOICE_SEARCH_HANDS_FREE); voiceIntent.putExtra(RecognizerIntent.EXTRA_SECURE, isLocked && mKeyguardManager.isKeyguardSecure()); diff --git a/services/core/java/com/android/server/content/ContentService.java b/services/core/java/com/android/server/content/ContentService.java index ea461e52947f..93ed2ee0c7a2 100644 --- a/services/core/java/com/android/server/content/ContentService.java +++ b/services/core/java/com/android/server/content/ContentService.java @@ -506,6 +506,21 @@ public final class ContentService extends IContentService.Stub { } @Override + public String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int userId) { + enforceCrossUserPermission(userId, + "no permission to read sync settings for user " + userId); + // This makes it so that future permission checks will be in the context of this + // process rather than the caller's process. We will restore this before returning. + final long identityToken = clearCallingIdentity(); + try { + SyncManager syncManager = getSyncManager(); + return syncManager.getSyncAdapterPackagesForAuthorityAsUser(authority, userId); + } finally { + restoreCallingIdentity(identityToken); + } + } + + @Override public boolean getSyncAutomatically(Account account, String providerName) { return getSyncAutomaticallyAsUser(account, providerName, UserHandle.getCallingUserId()); } diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java index 2eb879791667..cd9c7fe0b9bb 100644 --- a/services/core/java/com/android/server/content/SyncManager.java +++ b/services/core/java/com/android/server/content/SyncManager.java @@ -908,6 +908,10 @@ public class SyncManager { return types; } + public String[] getSyncAdapterPackagesForAuthorityAsUser(String authority, int userId) { + return mSyncAdapters.getSyncAdapterPackagesForAuthority(authority, userId); + } + private void sendSyncAlarmMessage() { if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "sending MESSAGE_SYNC_ALARM"); mSyncHandler.sendEmptyMessage(SyncHandler.MESSAGE_SYNC_ALARM); diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 06e27fc55f31..e7fddb96249e 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -1586,6 +1586,11 @@ public class PackageManagerService extends IPackageManager.Stub { grantRequestedRuntimePermissionsForUser(pkg, someUserId); } } + + // We could have touched GID membership, so flush out packages.list + synchronized (mPackages) { + mSettings.writePackageListLPr(); + } } private void grantRequestedRuntimePermissionsForUser(PackageParser.Package pkg, int userId) { @@ -7719,7 +7724,7 @@ public class PackageManagerService extends IPackageManager.Stub { } } } - + if (pkgInfo != null) { grantPermissionsLPw(pkgInfo, (flags&UPDATE_PERMISSIONS_REPLACE_PKG) != 0, changingPkg); } @@ -7999,7 +8004,7 @@ public class PackageManagerService extends IPackageManager.Stub { // Persist the runtime permissions state for users with changes. for (int userId : changedRuntimePermissionUserIds) { - mSettings.writeRuntimePermissionsForUserLPr(userId, true); + mSettings.writeRuntimePermissionsForUserLPr(userId, false); } } @@ -8248,6 +8253,7 @@ public class PackageManagerService extends IPackageManager.Stub { } else { res.icon = info.icon; } + res.iconResourceId = info.icon; res.system = res.activityInfo.applicationInfo.isSystemApp(); return res; } @@ -12494,6 +12500,8 @@ public class PackageManagerService extends IPackageManager.Stub { if (clearPackagePreferredActivitiesLPw(packageName, removeUser)) { scheduleWritePackageRestrictionsLocked(removeUser); } + revokeRuntimePermissionsAndClearAllFlagsLocked(ps.getPermissionsState(), + removeUser); } return true; } @@ -12700,13 +12708,37 @@ public class PackageManagerService extends IPackageManager.Stub { | PackageManager.FLAG_PERMISSION_USER_FIXED | PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRADE; + revokeRuntimePermissionsAndClearFlagsLocked(permissionsState, userId, userSetFlags); + } + + /** + * Revokes granted runtime permissions and clears all flags. + * + * @param permissionsState The permission state to reset. + * @param userId The device user for which to do a reset. + */ + private void revokeRuntimePermissionsAndClearAllFlagsLocked( + PermissionsState permissionsState, int userId) { + revokeRuntimePermissionsAndClearFlagsLocked(permissionsState, userId, + PackageManager.MASK_PERMISSION_FLAGS); + } + + /** + * Revokes granted runtime permissions and clears certain flags. + * + * @param permissionsState The permission state to reset. + * @param userId The device user for which to do a reset. + * @param flags The flags that is going to be reset. + */ + private void revokeRuntimePermissionsAndClearFlagsLocked( + PermissionsState permissionsState, int userId, int flags) { boolean needsWrite = false; for (PermissionState state : permissionsState.getRuntimePermissionStates(userId)) { BasePermission bp = mSettings.mPermissions.get(state.getName()); if (bp != null) { permissionsState.revokeRuntimePermission(bp, userId); - permissionsState.updatePermissionFlags(bp, userId, userSetFlags, 0); + permissionsState.updatePermissionFlags(bp, userId, flags, 0); needsWrite = true; } } @@ -14085,7 +14117,9 @@ public class PackageManagerService extends IPackageManager.Stub { } } - if (!checkin && dumpState.isDumping(DumpState.DUMP_DOMAIN_PREFERRED)) { + if (!checkin + && dumpState.isDumping(DumpState.DUMP_DOMAIN_PREFERRED) + && packageName == null) { pw.println(); int count = mSettings.mPackages.size(); if (count == 0) { diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java index cd50946567a7..4b36581df06f 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -2098,7 +2098,7 @@ final class Settings { } final ApplicationInfo ai = pkg.pkg.applicationInfo; - final String dataPath = ai.dataDir; + final String dataPath = new File(ai.dataDir).getCanonicalPath(); final boolean isDebug = (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; final int[] gids = pkg.getPermissionsState().computeGids(userIds); diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index dbcfa19153c8..bd545dfaaa8a 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -56,6 +56,7 @@ import android.os.Debug; import android.os.FactoryTest; import android.os.Handler; import android.os.IBinder; +import android.os.IDeviceIdleController; import android.os.Looper; import android.os.Message; import android.os.Messenger; @@ -2734,6 +2735,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (!keyguardOn) { voiceIntent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH); } else { + IDeviceIdleController dic = IDeviceIdleController.Stub.asInterface( + ServiceManager.getService(Context.DEVICE_IDLE_CONTROLLER)); + if (dic != null) { + try { + dic.exitIdle("voice-search"); + } catch (RemoteException e) { + } + } voiceIntent = new Intent(RecognizerIntent.ACTION_VOICE_SEARCH_HANDS_FREE); voiceIntent.putExtra(RecognizerIntent.EXTRA_SECURE, true); } @@ -3739,13 +3748,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { attrs.gravity = Gravity.BOTTOM; mDockLayer = win.getSurfaceLayer(); } else if (attrs.type == TYPE_VOICE_INTERACTION) { - pf.left = df.left = of.left = cf.left = vf.left = mUnrestrictedScreenLeft; + pf.left = df.left = of.left = mUnrestrictedScreenLeft; pf.top = df.top = of.top = mUnrestrictedScreenTop; - pf.right = df.right = of.right = cf.right = vf.right = mUnrestrictedScreenLeft - + mUnrestrictedScreenWidth; - pf.bottom = df.bottom = of.bottom = cf.bottom = mUnrestrictedScreenTop - + mUnrestrictedScreenHeight; + pf.right = df.right = of.right = mUnrestrictedScreenLeft + mUnrestrictedScreenWidth; + pf.bottom = df.bottom = of.bottom = mUnrestrictedScreenTop + mUnrestrictedScreenHeight; cf.bottom = vf.bottom = mStableBottom; + // Note: In Phone landscape mode, the button bar should also be excluded. + cf.right = vf.right = mStableRight; + cf.left = vf.left = mStableLeft; cf.top = vf.top = mStableTop; } else if (win == mStatusBar) { pf.left = df.left = of.left = mUnrestrictedScreenLeft; @@ -5191,6 +5201,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { } void launchVoiceAssistWithWakeLock(boolean keyguardActive) { + IDeviceIdleController dic = IDeviceIdleController.Stub.asInterface( + ServiceManager.getService(Context.DEVICE_IDLE_CONTROLLER)); + if (dic != null) { + try { + dic.exitIdle("voice-search"); + } catch (RemoteException e) { + } + } Intent voiceIntent = new Intent(RecognizerIntent.ACTION_VOICE_SEARCH_HANDS_FREE); voiceIntent.putExtra(RecognizerIntent.EXTRA_SECURE, keyguardActive); diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java b/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java index 58c3ea1f619c..469240349d64 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java @@ -24,4 +24,5 @@ public interface StatusBarManagerInternal { void notificationLightPulse(int argb, int onMillis, int offMillis); void notificationLightOff(); void showScreenPinningRequest(); + void showAssistDisclosure(); } diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java index 5669f30757d9..a7543790cc10 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java @@ -154,6 +154,16 @@ public class StatusBarManagerService extends IStatusBarService.Stub { } } } + + @Override + public void showAssistDisclosure() { + if (mBar != null) { + try { + mBar.showAssistDisclosure(); + } catch (RemoteException e) { + } + } + } }; // ================================================================================ diff --git a/services/core/java/com/android/server/webkit/WebViewUpdateService.java b/services/core/java/com/android/server/webkit/WebViewUpdateService.java index ac79b36f7005..d4c5f8716c0e 100644 --- a/services/core/java/com/android/server/webkit/WebViewUpdateService.java +++ b/services/core/java/com/android/server/webkit/WebViewUpdateService.java @@ -40,8 +40,6 @@ public class WebViewUpdateService extends SystemService { private boolean mRelroReady32Bit = false; private boolean mRelroReady64Bit = false; - private String oldWebViewPackageName = null; - private BroadcastReceiver mWebViewUpdatedReceiver; public WebViewUpdateService(Context context) { @@ -53,22 +51,9 @@ public class WebViewUpdateService extends SystemService { mWebViewUpdatedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - - for (String packageName : WebViewFactory.getWebViewPackageNames()) { - String webviewPackage = "package:" + packageName; - - if (webviewPackage.equals(intent.getDataString())) { - String usedPackageName = - WebViewFactory.findPreferredWebViewPackage().packageName; - // Only trigger update actions if the updated package is the one that - // will be used, or the one that was in use before the update. - if (packageName.equals(usedPackageName) || - packageName.equals(oldWebViewPackageName)) { - onWebViewUpdateInstalled(); - oldWebViewPackageName = usedPackageName; - } - return; - } + String webviewPackage = "package:" + WebViewFactory.getWebViewPackageName(); + if (webviewPackage.equals(intent.getDataString())) { + onWebViewUpdateInstalled(); } } }; diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 5064d8fd3a1e..f1331e94bd42 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -1383,10 +1383,21 @@ class WindowStateAnimator { // Adjust for surface insets. final LayoutParams attrs = w.getAttrs(); - width += attrs.surfaceInsets.left + attrs.surfaceInsets.right; - height += attrs.surfaceInsets.top + attrs.surfaceInsets.bottom; - left -= attrs.surfaceInsets.left; - top -= attrs.surfaceInsets.top; + final int displayId = w.getDisplayId(); + float scale = 1.0f; + // Magnification is supported only for the default display. + if (mService.mAccessibilityController != null && displayId == Display.DEFAULT_DISPLAY) { + MagnificationSpec spec = + mService.mAccessibilityController.getMagnificationSpecForWindowLocked(w); + if (spec != null && !spec.isNop()) { + scale = spec.scale; + } + } + + width += scale * (attrs.surfaceInsets.left + attrs.surfaceInsets.right); + height += scale * (attrs.surfaceInsets.top + attrs.surfaceInsets.bottom); + left -= scale * attrs.surfaceInsets.left; + top -= scale * attrs.surfaceInsets.top; final boolean surfaceMoved = mSurfaceX != left || mSurfaceY != top; if (surfaceMoved) { diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 29c65dbea8a6..76226b4bcd45 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -292,7 +292,7 @@ public final class SystemServer { private void createSystemContext() { ActivityThread activityThread = ActivityThread.systemMain(); mSystemContext = activityThread.getSystemContext(); - mSystemContext.setTheme(android.R.style.Theme_Material_DayNight_DarkActionBar); + mSystemContext.setTheme(android.R.style.Theme_DeviceDefault_Light_DarkActionBar); } /** diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java index 3767fce183d9..3b7ed9130605 100644 --- a/services/usage/java/com/android/server/usage/UsageStatsService.java +++ b/services/usage/java/com/android/server/usage/UsageStatsService.java @@ -31,9 +31,12 @@ import android.app.usage.UsageStatsManagerInternal.AppIdleStateChangeListener; import android.appwidget.AppWidgetManager; import android.content.BroadcastReceiver; import android.content.ComponentName; +import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.SyncAdapterType; +import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ParceledListSlice; @@ -69,6 +72,7 @@ import android.view.Display; import com.android.internal.annotations.GuardedBy; import com.android.internal.app.IBatteryStats; import com.android.internal.os.BackgroundThread; +import com.android.internal.os.SomeArgs; import com.android.internal.util.IndentingPrintWriter; import com.android.server.DeviceIdleController; import com.android.server.SystemService; @@ -117,6 +121,7 @@ public class UsageStatsService extends SystemService implements static final int MSG_CHECK_IDLE_STATES = 5; static final int MSG_CHECK_PAROLE_TIMEOUT = 6; static final int MSG_PAROLE_END_TIMEOUT = 7; + static final int MSG_REPORT_CONTENT_PROVIDER_USAGE = 8; private final Object mLock = new Object(); Handler mHandler; @@ -583,6 +588,29 @@ public class UsageStatsService extends SystemService implements } } + void reportContentProviderUsage(String authority, String providerPkgName, int userId) { + // Get sync adapters for the authority + String[] packages = ContentResolver.getSyncAdapterPackagesForAuthorityAsUser( + authority, userId); + for (String packageName: packages) { + // Only force the sync adapters to active if the provider is not in the same package and + // the sync adapter is a system package. + try { + PackageInfo pi = AppGlobals.getPackageManager().getPackageInfo( + packageName, 0, userId); + if (pi == null || pi.applicationInfo == null + || !pi.applicationInfo.isSystemApp()) { + continue; + } + if (!packageName.equals(providerPkgName)) { + forceIdleState(packageName, userId, false); + } + } catch (RemoteException re) { + // Shouldn't happen + } + } + } + /** * Forces the app's beginIdleTime and lastUsedTime to reflect idle or active. If idle, * then it rolls back the beginIdleTime and lastUsedTime to a point in time that's behind @@ -605,7 +633,7 @@ public class UsageStatsService extends SystemService implements timeNow - (idle ? mAppIdleWallclockThresholdMillis : 0) - 5000); // Inform listeners if necessary if (previouslyIdle != idle) { - // Slog.d(TAG, "Informing listeners of out-of-idle " + event.mPackage); + // Slog.d(TAG, "Informing listeners of out-of-idle " + packageName); mHandler.sendMessage(mHandler.obtainMessage(MSG_INFORM_LISTENERS, userId, /* idle = */ idle ? 1 : 0, packageName)); if (!idle) { @@ -916,6 +944,14 @@ public class UsageStatsService extends SystemService implements setAppIdleParoled(false); break; + case MSG_REPORT_CONTENT_PROVIDER_USAGE: + SomeArgs args = (SomeArgs) msg.obj; + reportContentProviderUsage((String) args.arg1, // authority name + (String) args.arg2, // package name + (int) args.arg3); // userId + args.recycle(); + break; + default: super.handleMessage(msg); break; @@ -1177,6 +1213,16 @@ public class UsageStatsService extends SystemService implements } @Override + public void reportContentProviderUsage(String name, String packageName, int userId) { + SomeArgs args = SomeArgs.obtain(); + args.arg1 = name; + args.arg2 = packageName; + args.arg3 = userId; + mHandler.obtainMessage(MSG_REPORT_CONTENT_PROVIDER_USAGE, args) + .sendToTarget(); + } + + @Override public boolean isAppIdle(String packageName, int userId) { return UsageStatsService.this.isAppIdleFiltered(packageName, userId, -1); } diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java index acd484dac0c8..af0ddbe82ca4 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java @@ -139,7 +139,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne IVoiceInteractionSessionShowCallback showCallback) { if (mActiveSession == null) { mActiveSession = new VoiceInteractionSessionConnection(mLock, mSessionComponentName, - mUser, mContext, this, mInfo.getServiceInfo().applicationInfo.uid); + mUser, mContext, this, mInfo.getServiceInfo().applicationInfo.uid, mHandler); } return mActiveSession.showLocked(args, flags, showCallback); } diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java index 47a230afb72a..cc6a9c52d8a5 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java @@ -32,6 +32,7 @@ import android.graphics.Bitmap; import android.net.Uri; import android.os.Binder; import android.os.Bundle; +import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; @@ -48,6 +49,8 @@ import com.android.internal.app.IAssistScreenshotReceiver; import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.internal.app.IVoiceInteractor; import com.android.internal.os.IResultReceiver; +import com.android.server.LocalServices; +import com.android.server.statusbar.StatusBarManagerInternal; import java.io.PrintWriter; import java.util.ArrayList; @@ -63,6 +66,7 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { final Context mContext; final Callback mCallback; final int mCallingUid; + final Handler mHandler; final IActivityManager mAm; final IWindowManager mIWindowManager; final AppOpsManager mAppOps; @@ -141,13 +145,14 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { }; public VoiceInteractionSessionConnection(Object lock, ComponentName component, int user, - Context context, Callback callback, int callingUid) { + Context context, Callback callback, int callingUid, Handler handler) { mLock = lock; mSessionComponentName = component; mUser = user; mContext = context; mCallback = callback; mCallingUid = callingUid; + mHandler = handler; mAm = ActivityManagerNative.getDefault(); mIWindowManager = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); @@ -193,11 +198,13 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { mShowArgs = args; mShowFlags = flags; mHaveAssistData = false; + boolean needDisclosure = false; if ((flags& VoiceInteractionSession.SHOW_WITH_ASSIST) != 0) { if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ASSIST_STRUCTURE, mCallingUid, mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED && allDataEnabled) { try { + needDisclosure = true; mAm.requestAssistContextExtras(ActivityManager.ASSIST_CONTEXT_FULL, mAssistReceiver); } catch (RemoteException e) { @@ -215,6 +222,7 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED && allDataEnabled) { try { + needDisclosure = true; mIWindowManager.requestAssistScreenshot(mScreenshotReceiver); } catch (RemoteException e) { } @@ -225,6 +233,9 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { } else { mScreenshot = null; } + if (needDisclosure) { + mHandler.post(mShowAssistDisclosureRunnable); + } if (mSession != null) { try { mSession.show(mShowArgs, mShowFlags, showCallback); @@ -483,4 +494,15 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { pw.print(prefix); pw.print("mAssistData="); pw.println(mAssistData); } } + + private Runnable mShowAssistDisclosureRunnable = new Runnable() { + @Override + public void run() { + StatusBarManagerInternal statusBarInternal = LocalServices.getService( + StatusBarManagerInternal.class); + if (statusBarInternal != null) { + statusBarInternal.showAssistDisclosure(); + } + } + }; }; diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 0cd8c191203e..a0669e405851 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -477,39 +477,6 @@ public class TelecomManager { } /** - * Sets the SIM call manager to the specified phone account. - * - * @param accountHandle The phone account handle of the account to set as the sim call manager. - * @hide - */ - public void setSimCallManager(PhoneAccountHandle accountHandle) { - try { - if (isServiceConnected()) { - getTelecomService().setSimCallManager(accountHandle); - } - } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelecomService#setSimCallManager"); - } - } - - /** - * Returns the list of registered SIM call managers. - * - * @return List of registered SIM call managers. - * @hide - */ - public List<PhoneAccountHandle> getSimCallManagers() { - try { - if (isServiceConnected()) { - return getTelecomService().getSimCallManagers(mContext.getOpPackageName()); - } - } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelecomService#getSimCallManagers"); - } - return new ArrayList<>(); - } - - /** * Returns the current connection manager. Apps must be prepared for this method to return * {@code null}, indicating that there currently exists no user-chosen default * {@code PhoneAccount}. diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index ea6a74aa6d90..fb0f6dafee71 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -93,16 +93,6 @@ interface ITelecomService { PhoneAccountHandle getSimCallManager(); /** - * @see TelecomServiceImpl#setSimCallManager - */ - void setSimCallManager(in PhoneAccountHandle account); - - /** - * @see TelecomServiceImpl#getSimCallManagers - */ - List<PhoneAccountHandle> getSimCallManagers(String callingPackage); - - /** * @see TelecomServiceImpl#registerPhoneAccount */ void registerPhoneAccount(in PhoneAccount metadata); diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 0eb94b8c1e30..fa0af961fc5d 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -249,32 +249,24 @@ public class CarrierConfigManager { /* The following 3 fields are related to carrier visual voicemail. */ /** - * The carrier number MO sms messages are sent to. - * - * @hide + * The carrier number mobile outgoing (MO) sms messages are sent to. */ 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 + * The port through which the mobile outgoing (MO) sms messages are sent through. */ 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} * for possible values. For example {@link TelephonyManager#VVM_TYPE_OMTP}. - * - * @hide */ 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 * and carrier visual voicemail are not active at the same time. - * - * @hide */ public static final String KEY_CARRIER_VVM_PACKAGE_NAME_STRING = "carrier_vvm_package_name_string"; @@ -306,6 +298,14 @@ public class CarrierConfigManager { public static final String KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_VAL_STRING = "ci_action_on_sys_update_extra_val_string"; + /** + * If this is true, the SIM card (through Customer Service Profile EF file) will be able to + * prevent manual operator selection. If false, this SIM setting will be ignored and manual + * operator selection will always be available. See CPHS4_2.WW6, CPHS B.4.7.1 for more + * information + */ + public static final String KEY_CSP_ENABLED_BOOL = "csp_enabled_bool"; + // 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 KEY_MMS_ALIAS_ENABLED_BOOL = "aliasEnabled"; @@ -385,6 +385,7 @@ public class CarrierConfigManager { sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING, ""); sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING, ""); sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_VAL_STRING, ""); + sDefaults.putBoolean(KEY_CSP_ENABLED_BOOL, false); sDefaults.putStringArray(KEY_GSM_ROAMING_NETWORKS_STRING_ARRAY, null); sDefaults.putStringArray(KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY, null); @@ -430,6 +431,9 @@ public class CarrierConfigManager { * specific SIM card. If an invalid subId is used, the returned config will contain default * values. * + * <p>Requires Permission: + * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} + * * @param subId the subscription ID, normally obtained from {@link SubscriptionManager}. * @return A {@link PersistableBundle} containing the config for the given subId, or default * values for an invalid subId. @@ -451,6 +455,9 @@ public class CarrierConfigManager { /** * Gets the configuration values for the default subscription. * + * <p>Requires Permission: + * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} + * * @see #getConfigForSubId */ @Nullable @@ -465,6 +472,8 @@ public class CarrierConfigManager { * This should be called by a carrier service app if it wants to update config at an arbitrary * moment. * </p> + * <p>Requires that the calling app has carrier privileges. + * @see #hasCarrierPrivileges * <p> * This method returns before the reload has completed, and * {@link android.service.carrier.CarrierService#onLoadConfig} will be called from an diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index e085d8902740..fa1ed54e1a56 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -1124,13 +1124,14 @@ public class SubscriptionManager { * {@hide} */ public static int getSimStateForSlotIdx(int slotIdx) { - int simState; + int simState = TelephonyManager.SIM_STATE_UNKNOWN; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); - simState = iSub.getSimStateForSlotIdx(slotIdx); + if (iSub != null) { + simState = iSub.getSimStateForSlotIdx(slotIdx); + } } catch (RemoteException ex) { - simState = TelephonyManager.SIM_STATE_UNKNOWN; } logd("getSimStateForSubscriber: simState=" + simState + " slotIdx=" + slotIdx); return simState; @@ -1144,7 +1145,9 @@ public class SubscriptionManager { public boolean isActiveSubId(int subId) { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); - return iSub.isActiveSubId(subId); + if (iSub != null) { + return iSub.isActiveSubId(subId); + } } catch (RemoteException ex) { } return false; diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 8291a3051dec..f77d268addd1 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -616,15 +616,11 @@ public class TelephonyManager { /** * The OMTP protocol. - * - * @hide */ public static final String VVM_TYPE_OMTP = "vvm_type_omtp"; /** - * A flavor of OMTP protocol for Comverse. - * - * @hide + * A flavor of OMTP protocol with a different mobile originated (MO) format */ public static final String VVM_TYPE_CVVM = "vvm_type_cvvm"; @@ -2143,7 +2139,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.getMergedSubscriberIds(); + return telephony.getMergedSubscriberIds(mContext.getOpPackageName()); } catch (RemoteException ex) { } catch (NullPointerException ex) { } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index c253b4f22407..44754abe5010 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -795,7 +795,7 @@ interface ITelephony { */ String getLine1AlphaTagForDisplay(int subId, String callingPackage); - String[] getMergedSubscriberIds(); + String[] getMergedSubscriberIds(String callingPackage); /** * Override the operator branding for the current ICCID. diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable04.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable04.xml index d282fc9eba8b..0f3fb95f5d46 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable04.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable04.xml @@ -13,37 +13,41 @@ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="64dp" - android:height="64dp" - android:viewportWidth="7.30625" - android:viewportHeight="12.25" - android:autoMirrored="true"> + android:autoMirrored="true" + android:height="64dp" + android:viewportHeight="12.25" + android:viewportWidth="7.30625" + android:width="64dp" > <group> <clip-path - android:name="clip1" - android:pathData=" + android:name="clip1" + android:pathData=" M 3.65, 6.125 m-.001, 0 a .001,.001 0 1,0 .002,0 - a .001,.001 0 1,0-.002,0z"/> + a .001,.001 0 1,0-.002,0z" /> + <path - android:name="one" - android:pathData="M 1.215625,9.5l 1.9375,0.0 0.0-6.671875-2.109375,0.421875 0.0-1.078125 + android:name="one" + android:fillColor="#ff88ff" + android:pathData="M 1.215625,9.5l 1.9375,0.0 0.0-6.671875-2.109375,0.421875 0.0-1.078125 l 2.09375-0.421875 1.1874998,0.0 0.0,7.75 1.9375,0.0 0.0,1.0 - l-5.046875,0.0 0.0-1.0Z" - android:fillColor="#ff88ff"/> - + l-5.046875,0.0 0.0-1.0Z" /> + </group> + <group> <clip-path - android:name="clip2" - android:pathData=" + android:name="clip2" + android:pathData=" M 3.65, 6.125 m-6, 0 a 6,6 0 1,0 12,0 - a 6,6 0 1,0-12,0z"/> + a 6,6 0 1,0-12,0z" /> + <path - android:name="two" - android:pathData="M 2.534375,9.6875l 4.140625,0.0 0.0,1.0-5.5625,0.0 0.0-1.0q 0.671875-0.6875 1.828125-1.859375 + android:name="two" + android:fillColor="#ff88ff" + android:pathData="M 2.534375,9.6875l 4.140625,0.0 0.0,1.0-5.5625,0.0 0.0-1.0q 0.671875-0.6875 1.828125-1.859375 q 1.1718752-1.1875 1.4687502-1.53125 0.578125-0.625 0.796875-1.0625 q 0.234375-0.453125 0.234375-0.875 0.0-0.703125-0.5-1.140625 q-0.484375-0.4375-1.2656252-0.4375-0.5625,0.0-1.1875,0.1875 @@ -51,7 +55,7 @@ q 0.625-0.15625 1.140625-0.15625 1.3593752,0.0 2.1718752,0.6875 q 0.8125,0.671875 0.8125,1.8125 0.0,0.53125-0.203125,1.015625 q-0.203125,0.484375-0.734375,1.140625-0.15625,0.171875-0.9375,0.984375 - q-0.78125024,0.8125-2.2187502,2.265625Z" - android:fillColor="#ff88ff"/> + q-0.78125024,0.8125-2.2187502,2.265625Z" /> </group> -</vector> + +</vector>
\ No newline at end of file diff --git a/tools/aapt2/BinaryResourceParser.cpp b/tools/aapt2/BinaryResourceParser.cpp index 3559f435329b..4f1947ab8364 100644 --- a/tools/aapt2/BinaryResourceParser.cpp +++ b/tools/aapt2/BinaryResourceParser.cpp @@ -116,9 +116,11 @@ private: BinaryResourceParser::BinaryResourceParser(const std::shared_ptr<ResourceTable>& table, const std::shared_ptr<IResolver>& resolver, const Source& source, + const std::u16string& defaultPackage, const void* data, size_t len) : - mTable(table), mResolver(resolver), mSource(source), mData(data), mDataLen(len) { + mTable(table), mResolver(resolver), mSource(source), mDefaultPackage(defaultPackage), + mData(data), mDataLen(len) { } bool BinaryResourceParser::parse() { @@ -177,6 +179,9 @@ bool BinaryResourceParser::getSymbol(const void* data, ResourceNameRef* outSymbo if (!type) { return false; } + if (outSymbol->package.empty()) { + outSymbol->package = mTable->getPackage(); + } outSymbol->type = *type; // Since we scan the symbol table in order, we can start looking for the @@ -350,7 +355,22 @@ bool BinaryResourceParser::parsePackage(const ResChunk_header* chunk) { size_t len = strnlen16(reinterpret_cast<const char16_t*>(packageHeader->name), sizeof(packageHeader->name) / sizeof(packageHeader->name[0])); - mTable->setPackage(StringPiece16(reinterpret_cast<const char16_t*>(packageHeader->name), len)); + if (mTable->getPackage().empty() && len == 0) { + mTable->setPackage(mDefaultPackage); + } else if (len > 0) { + StringPiece16 thisPackage(reinterpret_cast<const char16_t*>(packageHeader->name), len); + if (mTable->getPackage().empty()) { + mTable->setPackage(thisPackage); + } else if (thisPackage != mTable->getPackage()) { + Logger::error(mSource) + << "incompatible packages: " + << mTable->getPackage() + << " vs. " + << thisPackage + << std::endl; + return false; + } + } ResChunkPullParser parser(getChunkData(packageHeader->header), getChunkDataLen(packageHeader->header)); diff --git a/tools/aapt2/BinaryResourceParser.h b/tools/aapt2/BinaryResourceParser.h index 32876cda04fc..3aab301ec199 100644 --- a/tools/aapt2/BinaryResourceParser.h +++ b/tools/aapt2/BinaryResourceParser.h @@ -45,6 +45,7 @@ public: BinaryResourceParser(const std::shared_ptr<ResourceTable>& table, const std::shared_ptr<IResolver>& resolver, const Source& source, + const std::u16string& defaultPackage, const void* data, size_t len); BinaryResourceParser(const BinaryResourceParser&) = delete; // No copy. @@ -97,12 +98,12 @@ private: const Source mSource; + // The package name of the resource table. + std::u16string mDefaultPackage; + const void* mData; const size_t mDataLen; - // The package name of the resource table. - std::u16string mPackage; - // The array of symbol entries. Each element points to an offset // in the table and an index into the symbol table string pool. const SymbolTable_entry* mSymbolEntries = nullptr; diff --git a/tools/aapt2/Linker.cpp b/tools/aapt2/Linker.cpp index f3f04a5f60d0..c37cc932cd3b 100644 --- a/tools/aapt2/Linker.cpp +++ b/tools/aapt2/Linker.cpp @@ -160,7 +160,7 @@ const Attribute* Linker::doResolveAttribute(Reference& attribute, const SourceLi void Linker::visit(Reference& reference, ValueVisitorArgs& a) { Args& args = static_cast<Args&>(a); - if (!reference.name.isValid()) { + if (reference.name.entry.empty()) { // We can't have a completely bad reference. if (!reference.id.isValid()) { Logger::error() << "srsly? " << args.referrer << std::endl; diff --git a/tools/aapt2/Main.cpp b/tools/aapt2/Main.cpp index 41c229d535e1..54a7329359f1 100644 --- a/tools/aapt2/Main.cpp +++ b/tools/aapt2/Main.cpp @@ -756,8 +756,8 @@ bool link(const AaptOptions& options, const std::shared_ptr<ResourceTable>& outT zipFile->uncompress(entry)); assert(uncompressedData); - BinaryResourceParser parser(table, resolver, source, uncompressedData.get(), - entry->getUncompressedLen()); + BinaryResourceParser parser(table, resolver, source, options.appInfo.package, + uncompressedData.get(), entry->getUncompressedLen()); if (!parser.parse()) { return false; } @@ -1085,50 +1085,47 @@ static AaptOptions prepareArgs(int argc, char** argv) { } bool isStaticLib = false; + if (options.phase == AaptOptions::Phase::Link) { + flag::requiredFlag("--manifest", "AndroidManifest.xml of your app", + [&options](const StringPiece& arg) { + options.manifest = Source{ arg.toString() }; + }); + + flag::optionalFlag("-I", "add an Android APK to link against", + [&options](const StringPiece& arg) { + options.libraries.push_back(Source{ arg.toString() }); + }); + + flag::optionalFlag("--java", "directory in which to generate R.java", + [&options](const StringPiece& arg) { + options.generateJavaClass = Source{ arg.toString() }; + }); + + flag::optionalFlag("--proguard", "file in which to output proguard rules", + [&options](const StringPiece& arg) { + options.generateProguardRules = Source{ arg.toString() }; + }); + + flag::optionalSwitch("--static-lib", "generate a static Android library", true, + &isStaticLib); + + flag::optionalFlag("--binding", "Output directory for binding XML files", + [&options](const StringPiece& arg) { + options.bindingOutput = Source{ arg.toString() }; + }); + flag::optionalSwitch("--no-version", "Disables automatic style and layout versioning", + false, &options.versionStylesAndLayouts); + } + if (options.phase == AaptOptions::Phase::Compile || options.phase == AaptOptions::Phase::Link) { - if (options.phase == AaptOptions::Phase::Compile) { - flag::requiredFlag("--package", "Android package name", - [&options](const StringPiece& arg) { - options.appInfo.package = util::utf8ToUtf16(arg); - }); - } else if (options.phase == AaptOptions::Phase::Link) { - flag::requiredFlag("--manifest", "AndroidManifest.xml of your app", - [&options](const StringPiece& arg) { - options.manifest = Source{ arg.toString() }; - }); - - flag::optionalFlag("-I", "add an Android APK to link against", - [&options](const StringPiece& arg) { - options.libraries.push_back(Source{ arg.toString() }); - }); - - flag::optionalFlag("--java", "directory in which to generate R.java", - [&options](const StringPiece& arg) { - options.generateJavaClass = Source{ arg.toString() }; - }); - - flag::optionalFlag("--proguard", "file in which to output proguard rules", - [&options](const StringPiece& arg) { - options.generateProguardRules = Source{ arg.toString() }; - }); - - flag::optionalSwitch("--static-lib", "generate a static Android library", true, - &isStaticLib); - - flag::optionalFlag("--binding", "Output directory for binding XML files", - [&options](const StringPiece& arg) { - options.bindingOutput = Source{ arg.toString() }; - }); - flag::optionalSwitch("--no-version", "Disables automatic style and layout versioning", - false, &options.versionStylesAndLayouts); - } - // Common flags for all steps. flag::requiredFlag("-o", "Output path", [&options](const StringPiece& arg) { options.output = Source{ arg.toString() }; }); - } else if (options.phase == AaptOptions::Phase::DumpStyleGraph) { + } + + if (options.phase == AaptOptions::Phase::DumpStyleGraph) { flag::requiredFlag("--style", "Name of the style to dump", [&options](const StringPiece& arg, std::string* outError) -> bool { Reference styleReference; @@ -1191,7 +1188,7 @@ static bool doDump(const AaptOptions& options) { zipFile->uncompress(entry)); assert(uncompressedData); - BinaryResourceParser parser(table, resolver, source, uncompressedData.get(), + BinaryResourceParser parser(table, resolver, source, {}, uncompressedData.get(), entry->getUncompressedLen()); if (!parser.parse()) { return false; @@ -1223,16 +1220,17 @@ int main(int argc, char** argv) { if (!loadAppInfo(options.manifest, &options.appInfo)) { return false; } - } - // Verify we have some common options set. - if (options.appInfo.package.empty()) { - Logger::error() << "no package name specified." << std::endl; - return false; + if (options.appInfo.package.empty()) { + Logger::error() << "no package name specified." << std::endl; + return false; + } } // Every phase needs a resource table. std::shared_ptr<ResourceTable> table = std::make_shared<ResourceTable>(); + + // The package name is empty when in the compile phase. table->setPackage(options.appInfo.package); if (options.appInfo.package == u"android") { table->setPackageId(0x01); diff --git a/tools/aapt2/TableFlattener.cpp b/tools/aapt2/TableFlattener.cpp index 539c48f7930b..b7c04f06cff5 100644 --- a/tools/aapt2/TableFlattener.cpp +++ b/tools/aapt2/TableFlattener.cpp @@ -79,7 +79,7 @@ public: // Write the key. if (!Res_INTERNALID(key.id.id) && !key.id.isValid()) { - assert(key.name.isValid()); + assert(!key.name.entry.empty()); mSymbols->push_back(std::make_pair(ResourceNameRef(key.name), mOut->size() - sizeof(*outMapEntry))); } @@ -284,13 +284,6 @@ bool TableFlattener::flattenValue(BigBuffer* out, const FlatEntry& flatEntry, bool TableFlattener::flatten(BigBuffer* out, const ResourceTable& table) { const size_t beginning = out->size(); - if (table.getPackage().size() == 0) { - Logger::error() - << "ResourceTable has no package name." - << std::endl; - return false; - } - if (table.getPackageId() == ResourceTable::kUnsetPackageId) { Logger::error() << "ResourceTable has no package ID set." diff --git a/tools/aapt2/data/Makefile b/tools/aapt2/data/Makefile index 3387135d4947..91ff5fee6477 100644 --- a/tools/aapt2/data/Makefile +++ b/tools/aapt2/data/Makefile @@ -50,7 +50,7 @@ $(info PRIVATE_INTERMEDIATE_TABLES = $(PRIVATE_INTERMEDIATE_TABLES)) # returns: out/values-v4.apk: res/values-v4/styles.xml res/values-v4/colors.xml define make-collect-rule $(LOCAL_OUT)/$1.apk: $(filter $(LOCAL_RESOURCE_DIR)/$1/%,$(PRIVATE_RESOURCES)) - $(AAPT) compile --package $(LOCAL_PACKAGE) -o $$@ $$^ + $(AAPT) compile -o $$@ $$^ endef # Collect: out/values-v4.apk <- res/values-v4/styles.xml res/values-v4/colors.xml diff --git a/tools/aapt2/data/lib/Makefile b/tools/aapt2/data/lib/Makefile index 372c2251b33a..741be9a0e75a 100644 --- a/tools/aapt2/data/lib/Makefile +++ b/tools/aapt2/data/lib/Makefile @@ -48,7 +48,7 @@ $(info PRIVATE_INTERMEDIATE_TABLES = $(PRIVATE_INTERMEDIATE_TABLES)) # returns: out/values-v4.apk: res/values-v4/styles.xml res/values-v4/colors.xml define make-collect-rule $(LOCAL_OUT)/$1.apk: $(filter $(LOCAL_RESOURCE_DIR)/$1/%,$(PRIVATE_RESOURCES)) - $(AAPT) compile --package $(LOCAL_PACKAGE) -o $$@ $$^ + $(AAPT) compile -o $$@ $$^ endef # Collect: out/values-v4.apk <- res/values-v4/styles.xml res/values-v4/colors.xml |