summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt69
-rw-r--r--api/system-current.txt69
-rw-r--r--api/test-current.txt69
-rw-r--r--core/java/android/app/ActivityThread.java3
-rw-r--r--core/java/android/app/IWallpaperManager.aidl2
-rw-r--r--core/java/android/app/Notification.java15
-rw-r--r--core/java/android/app/WallpaperManager.java59
-rw-r--r--core/java/android/bluetooth/BluetoothGatt.java6
-rw-r--r--core/java/android/content/pm/PackageParser.java9
-rw-r--r--core/java/android/hardware/input/IInputManager.aidl2
-rw-r--r--core/java/android/hardware/input/InputManager.java6
-rw-r--r--core/java/android/provider/BlockedNumberContract.java10
-rwxr-xr-xcore/java/android/provider/Settings.java1
-rw-r--r--core/java/android/provider/VoicemailContract.java11
-rw-r--r--core/java/android/util/SparseArray.java14
-rw-r--r--core/java/android/view/InputDevice.java8
-rw-r--r--core/java/android/view/PointerIcon.java245
-rw-r--r--core/java/android/view/View.java43
-rw-r--r--core/java/android/view/ViewGroup.java57
-rw-r--r--core/java/android/view/ViewRootImpl.java39
-rw-r--r--core/java/android/view/accessibility/AccessibilityCache.java7
-rw-r--r--core/java/android/widget/Chronometer.java1
-rw-r--r--core/java/android/widget/TextView.java10
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java25
-rw-r--r--core/java/com/android/internal/os/KernelWakelockReader.java29
-rw-r--r--core/java/com/android/internal/os/ZygoteInit.java46
-rw-r--r--core/jni/android_view_PointerIcon.cpp8
-rw-r--r--core/res/res/values/attrs.xml2
-rw-r--r--core/res/res/values/attrs_manifest.xml4
-rw-r--r--core/res/res/values/public.xml2
-rw-r--r--core/tests/coretests/src/com/android/internal/os/KernelWakelockReaderTest.java147
-rw-r--r--docs/html/about/dashboards/index.jd16
-rw-r--r--docs/html/google/index.jd36
-rwxr-xr-xdocs/html/google/play/billing/billing_integrate.jd4
-rw-r--r--docs/html/guide/topics/graphics/hardware-accel.jd44
-rw-r--r--docs/html/jd_collections.js8
-rw-r--r--docs/html/jd_extras.js13
-rw-r--r--docs/html/jd_extras_en.js51
-rw-r--r--docs/html/preview/api-overview.jd4
-rw-r--r--docs/html/preview/download.jd9
-rw-r--r--docs/html/preview/features/afw.jd2
-rw-r--r--docs/html/wear/preview/features/complications.jd14
-rw-r--r--libs/input/PointerController.cpp20
-rw-r--r--libs/input/PointerController.h4
-rw-r--r--location/java/android/location/GnssStatus.java10
-rw-r--r--location/java/android/location/GpsStatus.java19
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java9
-rwxr-xr-xpackages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothAdapter.java3
-rw-r--r--packages/SystemUI/res/layout/global_screenshot.xml2
-rw-r--r--packages/SystemUI/res/layout/navigation_bar.xml8
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java26
-rw-r--r--packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java25
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java37
-rw-r--r--rs/java/android/renderscript/Allocation.java977
-rw-r--r--rs/java/android/renderscript/ScriptIntrinsicBlur.java3
-rw-r--r--services/core/Android.mk6
-rw-r--r--services/core/java/com/android/server/BluetoothManagerService.java15
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java24
-rw-r--r--services/core/java/com/android/server/am/ActivityStarter.java17
-rw-r--r--services/core/java/com/android/server/input/InputManagerService.java6
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java17
-rw-r--r--services/core/java/com/android/server/notification/NotificationUsageStats.java89
-rw-r--r--services/core/java/com/android/server/notification/RateEstimator.java54
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java2
-rw-r--r--services/core/java/com/android/server/wallpaper/WallpaperManagerService.java15
-rw-r--r--services/core/java/com/android/server/wm/DragState.java2
-rw-r--r--services/core/java/com/android/server/wm/Task.java10
-rw-r--r--services/core/java/com/android/server/wm/TaskTapPointerEventListener.java48
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java13
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java38
-rw-r--r--services/core/java/com/android/server/wm/WindowStateAnimator.java2
-rw-r--r--services/core/jni/com_android_server_input_InputManagerService.cpp14
-rw-r--r--services/core/jni/com_android_server_location_GnssLocationProvider.cpp28
-rw-r--r--services/tests/servicestests/src/com/android/server/notification/RateEstimatorTest.java118
-rw-r--r--telecomm/java/android/telecom/Call.java7
-rw-r--r--telephony/java/android/telephony/CarrierConfigManager.java5
78 files changed, 2155 insertions, 745 deletions
diff --git a/api/current.txt b/api/current.txt
index 842fa11126ce..17182dbde4ce 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -941,7 +941,7 @@ package android {
field public static final deprecated int phoneNumber = 16843111; // 0x1010167
field public static final int pivotX = 16843189; // 0x10101b5
field public static final int pivotY = 16843190; // 0x10101b6
- field public static final int pointerShape = 16844042; // 0x101050a
+ field public static final int pointerIcon = 16844042; // 0x101050a
field public static final int popupAnimationStyle = 16843465; // 0x10102c9
field public static final int popupBackground = 16843126; // 0x1010176
field public static final int popupCharacters = 16843332; // 0x1010244
@@ -5784,7 +5784,7 @@ package android.app {
method public int getWallpaperId(int);
method public android.app.WallpaperInfo getWallpaperInfo();
method public boolean hasResourceWallpaper(int);
- method public boolean isWallpaperSettingAllowed();
+ method public boolean isSetWallpaperAllowed();
method public boolean isWallpaperSupported();
method public android.graphics.drawable.Drawable peekDrawable();
method public android.graphics.drawable.Drawable peekFastDrawable();
@@ -32946,7 +32946,7 @@ package android.provider {
public class VoicemailContract {
field public static final java.lang.String ACTION_FETCH_VOICEMAIL = "android.intent.action.FETCH_VOICEMAIL";
field public static final java.lang.String ACTION_NEW_VOICEMAIL = "android.intent.action.NEW_VOICEMAIL";
- field public static final java.lang.String ACTION_SYNC_VOICEMAIL = "android.intent.action.SYNC_VOICEMAIL";
+ field public static final java.lang.String ACTION_SYNC_VOICEMAIL = "android.provider.action.SYNC_VOICEMAIL";
field public static final java.lang.String AUTHORITY = "com.android.voicemail";
field public static final java.lang.String EXTRA_SELF_CHANGE = "com.android.voicemail.extra.SELF_CHANGE";
field public static final java.lang.String PARAM_KEY_SOURCE_PACKAGE = "source_package";
@@ -32954,7 +32954,6 @@ package android.provider {
public static final class VoicemailContract.Status implements android.provider.BaseColumns {
method public static android.net.Uri buildSourceUri(java.lang.String);
- method public static void setQuota(android.content.Context, android.telecom.PhoneAccountHandle, int, int);
field public static final java.lang.String CONFIGURATION_STATE = "configuration_state";
field public static final int CONFIGURATION_STATE_CAN_BE_CONFIGURED = 2; // 0x2
field public static final int CONFIGURATION_STATE_NOT_CONFIGURED = 1; // 0x1
@@ -36006,10 +36005,11 @@ package android.telecom {
field public static final int CAPABILITY_SWAP_CONFERENCE = 8; // 0x8
field public static final int PROPERTY_CONFERENCE = 1; // 0x1
field public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 4; // 0x4
+ field public static final int PROPERTY_ENTERPRISE_CALL = 32; // 0x20
field public static final int PROPERTY_GENERIC_CONFERENCE = 2; // 0x2
field public static final int PROPERTY_HIGH_DEF_AUDIO = 16; // 0x10
field public static final int PROPERTY_WIFI = 8; // 0x8
- field public static final int PROPERTY_WORK_CALL = 32; // 0x20
+ field public static final deprecated int PROPERTY_WORK_CALL = 32; // 0x20
}
public final class CallAudioState implements android.os.Parcelable {
@@ -36710,10 +36710,10 @@ 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_CELLULAR_DATA_REQUIRED_BOOL = "vvm_cellular_data_required";
+ field public static final java.lang.String KEY_VVM_CELLULAR_DATA_REQUIRED_BOOL = "vvm_cellular_data_required_bool";
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_PREFETCH_BOOL = "vvm_prefetch";
+ field public static final java.lang.String KEY_VVM_PREFETCH_BOOL = "vvm_prefetch_bool";
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";
}
@@ -41934,35 +41934,35 @@ package android.view {
}
public final class PointerIcon implements android.os.Parcelable {
- method public static android.view.PointerIcon createCustomIcon(android.graphics.Bitmap, float, float);
+ method public static android.view.PointerIcon create(android.graphics.Bitmap, float, float);
method public int describeContents();
method public static android.view.PointerIcon getSystemIcon(android.content.Context, int);
- method public static android.view.PointerIcon loadCustomIcon(android.content.res.Resources, int);
+ method public static android.view.PointerIcon load(android.content.res.Resources, int);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.view.PointerIcon> CREATOR;
- field public static final int STYLE_ALIAS = 1010; // 0x3f2
- field public static final int STYLE_ALL_SCROLL = 1013; // 0x3f5
- field public static final int STYLE_ARROW = 1000; // 0x3e8
- field public static final int STYLE_CELL = 1006; // 0x3ee
- field public static final int STYLE_CONTEXT_MENU = 1001; // 0x3e9
- field public static final int STYLE_COPY = 1011; // 0x3f3
- field public static final int STYLE_CROSSHAIR = 1007; // 0x3ef
- field public static final int STYLE_DEFAULT = 1000; // 0x3e8
- field public static final int STYLE_GRAB = 1020; // 0x3fc
- field public static final int STYLE_GRABBING = 1021; // 0x3fd
- field public static final int STYLE_HAND = 1002; // 0x3ea
- field public static final int STYLE_HELP = 1003; // 0x3eb
- field public static final int STYLE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6
- field public static final int STYLE_NO_DROP = 1012; // 0x3f4
- field public static final int STYLE_NULL = 0; // 0x0
- field public static final int STYLE_TEXT = 1008; // 0x3f0
- field public static final int STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9
- field public static final int STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8
- field public static final int STYLE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7
- field public static final int STYLE_VERTICAL_TEXT = 1009; // 0x3f1
- field public static final int STYLE_WAIT = 1004; // 0x3ec
- field public static final int STYLE_ZOOM_IN = 1018; // 0x3fa
- field public static final int STYLE_ZOOM_OUT = 1019; // 0x3fb
+ field public static final int TYPE_ALIAS = 1010; // 0x3f2
+ field public static final int TYPE_ALL_SCROLL = 1013; // 0x3f5
+ field public static final int TYPE_ARROW = 1000; // 0x3e8
+ field public static final int TYPE_CELL = 1006; // 0x3ee
+ field public static final int TYPE_CONTEXT_MENU = 1001; // 0x3e9
+ field public static final int TYPE_COPY = 1011; // 0x3f3
+ field public static final int TYPE_CROSSHAIR = 1007; // 0x3ef
+ field public static final int TYPE_DEFAULT = 1000; // 0x3e8
+ field public static final int TYPE_GRAB = 1020; // 0x3fc
+ field public static final int TYPE_GRABBING = 1021; // 0x3fd
+ field public static final int TYPE_HAND = 1002; // 0x3ea
+ field public static final int TYPE_HELP = 1003; // 0x3eb
+ field public static final int TYPE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6
+ field public static final int TYPE_NO_DROP = 1012; // 0x3f4
+ field public static final int TYPE_NULL = 0; // 0x0
+ field public static final int TYPE_TEXT = 1008; // 0x3f0
+ field public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9
+ field public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8
+ field public static final int TYPE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7
+ field public static final int TYPE_VERTICAL_TEXT = 1009; // 0x3f1
+ field public static final int TYPE_WAIT = 1004; // 0x3ec
+ field public static final int TYPE_ZOOM_IN = 1018; // 0x3fa
+ field public static final int TYPE_ZOOM_OUT = 1019; // 0x3fb
}
public class ScaleGestureDetector {
@@ -42328,7 +42328,7 @@ package android.view {
method public android.view.ViewParent getParentForAccessibility();
method public float getPivotX();
method public float getPivotY();
- method public android.view.PointerIcon getPointerIcon(android.view.MotionEvent, float, float);
+ method public android.view.PointerIcon getPointerIcon();
method public android.content.res.Resources getResources();
method public final int getRight();
method protected float getRightFadingEdgeStrength();
@@ -42479,6 +42479,7 @@ package android.view {
method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
method public void onProvideStructure(android.view.ViewStructure);
method public void onProvideVirtualStructure(android.view.ViewStructure);
+ method public android.view.PointerIcon onResolvePointerIcon(android.view.MotionEvent, int);
method protected void onRestoreInstanceState(android.os.Parcelable);
method public void onRtlPropertiesChanged(int);
method protected android.os.Parcelable onSaveInstanceState();
@@ -42525,6 +42526,7 @@ package android.view {
method public boolean requestFocus(int, android.graphics.Rect);
method public final boolean requestFocusFromTouch();
method public void requestLayout();
+ method public void requestPointerCapture();
method public boolean requestRectangleOnScreen(android.graphics.Rect);
method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
method public final void requestUnbufferedDispatch(android.view.MotionEvent);
@@ -42615,7 +42617,6 @@ package android.view {
method public void setPaddingRelative(int, int, int, int);
method public void setPivotX(float);
method public void setPivotY(float);
- method public void setPointerCapture();
method public void setPointerIcon(android.view.PointerIcon);
method public void setPressed(boolean);
method public final void setRight(int);
diff --git a/api/system-current.txt b/api/system-current.txt
index b204d5c6cd9f..9bccb9ebc837 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1047,7 +1047,7 @@ package android {
field public static final deprecated int phoneNumber = 16843111; // 0x1010167
field public static final int pivotX = 16843189; // 0x10101b5
field public static final int pivotY = 16843190; // 0x10101b6
- field public static final int pointerShape = 16844042; // 0x101050a
+ field public static final int pointerIcon = 16844042; // 0x101050a
field public static final int popupAnimationStyle = 16843465; // 0x10102c9
field public static final int popupBackground = 16843126; // 0x1010176
field public static final int popupCharacters = 16843332; // 0x1010244
@@ -5933,7 +5933,7 @@ package android.app {
method public int getWallpaperId(int);
method public android.app.WallpaperInfo getWallpaperInfo();
method public boolean hasResourceWallpaper(int);
- method public boolean isWallpaperSettingAllowed();
+ method public boolean isSetWallpaperAllowed();
method public boolean isWallpaperSupported();
method public android.graphics.drawable.Drawable peekDrawable();
method public android.graphics.drawable.Drawable peekFastDrawable();
@@ -35652,7 +35652,7 @@ package android.provider {
public class VoicemailContract {
field public static final java.lang.String ACTION_FETCH_VOICEMAIL = "android.intent.action.FETCH_VOICEMAIL";
field public static final java.lang.String ACTION_NEW_VOICEMAIL = "android.intent.action.NEW_VOICEMAIL";
- field public static final java.lang.String ACTION_SYNC_VOICEMAIL = "android.intent.action.SYNC_VOICEMAIL";
+ field public static final java.lang.String ACTION_SYNC_VOICEMAIL = "android.provider.action.SYNC_VOICEMAIL";
field public static final java.lang.String AUTHORITY = "com.android.voicemail";
field public static final java.lang.String EXTRA_SELF_CHANGE = "com.android.voicemail.extra.SELF_CHANGE";
field public static final java.lang.String PARAM_KEY_SOURCE_PACKAGE = "source_package";
@@ -35660,7 +35660,6 @@ package android.provider {
public static final class VoicemailContract.Status implements android.provider.BaseColumns {
method public static android.net.Uri buildSourceUri(java.lang.String);
- method public static void setQuota(android.content.Context, android.telecom.PhoneAccountHandle, int, int);
field public static final java.lang.String CONFIGURATION_STATE = "configuration_state";
field public static final int CONFIGURATION_STATE_CAN_BE_CONFIGURED = 2; // 0x2
field public static final int CONFIGURATION_STATE_NOT_CONFIGURED = 1; // 0x1
@@ -38842,10 +38841,11 @@ package android.telecom {
field public static final int CAPABILITY_SWAP_CONFERENCE = 8; // 0x8
field public static final int PROPERTY_CONFERENCE = 1; // 0x1
field public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 4; // 0x4
+ field public static final int PROPERTY_ENTERPRISE_CALL = 32; // 0x20
field public static final int PROPERTY_GENERIC_CONFERENCE = 2; // 0x2
field public static final int PROPERTY_HIGH_DEF_AUDIO = 16; // 0x10
field public static final int PROPERTY_WIFI = 8; // 0x8
- field public static final int PROPERTY_WORK_CALL = 32; // 0x20
+ field public static final deprecated int PROPERTY_WORK_CALL = 32; // 0x20
}
public static abstract deprecated class Call.Listener extends android.telecom.Call.Callback {
@@ -39643,10 +39643,10 @@ 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_CELLULAR_DATA_REQUIRED_BOOL = "vvm_cellular_data_required";
+ field public static final java.lang.String KEY_VVM_CELLULAR_DATA_REQUIRED_BOOL = "vvm_cellular_data_required_bool";
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_PREFETCH_BOOL = "vvm_prefetch";
+ field public static final java.lang.String KEY_VVM_PREFETCH_BOOL = "vvm_prefetch_bool";
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";
}
@@ -44932,35 +44932,35 @@ package android.view {
}
public final class PointerIcon implements android.os.Parcelable {
- method public static android.view.PointerIcon createCustomIcon(android.graphics.Bitmap, float, float);
+ method public static android.view.PointerIcon create(android.graphics.Bitmap, float, float);
method public int describeContents();
method public static android.view.PointerIcon getSystemIcon(android.content.Context, int);
- method public static android.view.PointerIcon loadCustomIcon(android.content.res.Resources, int);
+ method public static android.view.PointerIcon load(android.content.res.Resources, int);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.view.PointerIcon> CREATOR;
- field public static final int STYLE_ALIAS = 1010; // 0x3f2
- field public static final int STYLE_ALL_SCROLL = 1013; // 0x3f5
- field public static final int STYLE_ARROW = 1000; // 0x3e8
- field public static final int STYLE_CELL = 1006; // 0x3ee
- field public static final int STYLE_CONTEXT_MENU = 1001; // 0x3e9
- field public static final int STYLE_COPY = 1011; // 0x3f3
- field public static final int STYLE_CROSSHAIR = 1007; // 0x3ef
- field public static final int STYLE_DEFAULT = 1000; // 0x3e8
- field public static final int STYLE_GRAB = 1020; // 0x3fc
- field public static final int STYLE_GRABBING = 1021; // 0x3fd
- field public static final int STYLE_HAND = 1002; // 0x3ea
- field public static final int STYLE_HELP = 1003; // 0x3eb
- field public static final int STYLE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6
- field public static final int STYLE_NO_DROP = 1012; // 0x3f4
- field public static final int STYLE_NULL = 0; // 0x0
- field public static final int STYLE_TEXT = 1008; // 0x3f0
- field public static final int STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9
- field public static final int STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8
- field public static final int STYLE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7
- field public static final int STYLE_VERTICAL_TEXT = 1009; // 0x3f1
- field public static final int STYLE_WAIT = 1004; // 0x3ec
- field public static final int STYLE_ZOOM_IN = 1018; // 0x3fa
- field public static final int STYLE_ZOOM_OUT = 1019; // 0x3fb
+ field public static final int TYPE_ALIAS = 1010; // 0x3f2
+ field public static final int TYPE_ALL_SCROLL = 1013; // 0x3f5
+ field public static final int TYPE_ARROW = 1000; // 0x3e8
+ field public static final int TYPE_CELL = 1006; // 0x3ee
+ field public static final int TYPE_CONTEXT_MENU = 1001; // 0x3e9
+ field public static final int TYPE_COPY = 1011; // 0x3f3
+ field public static final int TYPE_CROSSHAIR = 1007; // 0x3ef
+ field public static final int TYPE_DEFAULT = 1000; // 0x3e8
+ field public static final int TYPE_GRAB = 1020; // 0x3fc
+ field public static final int TYPE_GRABBING = 1021; // 0x3fd
+ field public static final int TYPE_HAND = 1002; // 0x3ea
+ field public static final int TYPE_HELP = 1003; // 0x3eb
+ field public static final int TYPE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6
+ field public static final int TYPE_NO_DROP = 1012; // 0x3f4
+ field public static final int TYPE_NULL = 0; // 0x0
+ field public static final int TYPE_TEXT = 1008; // 0x3f0
+ field public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9
+ field public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8
+ field public static final int TYPE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7
+ field public static final int TYPE_VERTICAL_TEXT = 1009; // 0x3f1
+ field public static final int TYPE_WAIT = 1004; // 0x3ec
+ field public static final int TYPE_ZOOM_IN = 1018; // 0x3fa
+ field public static final int TYPE_ZOOM_OUT = 1019; // 0x3fb
}
public class ScaleGestureDetector {
@@ -45326,7 +45326,7 @@ package android.view {
method public android.view.ViewParent getParentForAccessibility();
method public float getPivotX();
method public float getPivotY();
- method public android.view.PointerIcon getPointerIcon(android.view.MotionEvent, float, float);
+ method public android.view.PointerIcon getPointerIcon();
method public android.content.res.Resources getResources();
method public final int getRight();
method protected float getRightFadingEdgeStrength();
@@ -45477,6 +45477,7 @@ package android.view {
method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
method public void onProvideStructure(android.view.ViewStructure);
method public void onProvideVirtualStructure(android.view.ViewStructure);
+ method public android.view.PointerIcon onResolvePointerIcon(android.view.MotionEvent, int);
method protected void onRestoreInstanceState(android.os.Parcelable);
method public void onRtlPropertiesChanged(int);
method protected android.os.Parcelable onSaveInstanceState();
@@ -45523,6 +45524,7 @@ package android.view {
method public boolean requestFocus(int, android.graphics.Rect);
method public final boolean requestFocusFromTouch();
method public void requestLayout();
+ method public void requestPointerCapture();
method public boolean requestRectangleOnScreen(android.graphics.Rect);
method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
method public final void requestUnbufferedDispatch(android.view.MotionEvent);
@@ -45613,7 +45615,6 @@ package android.view {
method public void setPaddingRelative(int, int, int, int);
method public void setPivotX(float);
method public void setPivotY(float);
- method public void setPointerCapture();
method public void setPointerIcon(android.view.PointerIcon);
method public void setPressed(boolean);
method public final void setRight(int);
diff --git a/api/test-current.txt b/api/test-current.txt
index 420cd433e2ca..13a96e013670 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -941,7 +941,7 @@ package android {
field public static final deprecated int phoneNumber = 16843111; // 0x1010167
field public static final int pivotX = 16843189; // 0x10101b5
field public static final int pivotY = 16843190; // 0x10101b6
- field public static final int pointerShape = 16844042; // 0x101050a
+ field public static final int pointerIcon = 16844042; // 0x101050a
field public static final int popupAnimationStyle = 16843465; // 0x10102c9
field public static final int popupBackground = 16843126; // 0x1010176
field public static final int popupCharacters = 16843332; // 0x1010244
@@ -5790,7 +5790,7 @@ package android.app {
method public int getWallpaperId(int);
method public android.app.WallpaperInfo getWallpaperInfo();
method public boolean hasResourceWallpaper(int);
- method public boolean isWallpaperSettingAllowed();
+ method public boolean isSetWallpaperAllowed();
method public boolean isWallpaperSupported();
method public android.graphics.drawable.Drawable peekDrawable();
method public android.graphics.drawable.Drawable peekFastDrawable();
@@ -33022,7 +33022,7 @@ package android.provider {
public class VoicemailContract {
field public static final java.lang.String ACTION_FETCH_VOICEMAIL = "android.intent.action.FETCH_VOICEMAIL";
field public static final java.lang.String ACTION_NEW_VOICEMAIL = "android.intent.action.NEW_VOICEMAIL";
- field public static final java.lang.String ACTION_SYNC_VOICEMAIL = "android.intent.action.SYNC_VOICEMAIL";
+ field public static final java.lang.String ACTION_SYNC_VOICEMAIL = "android.provider.action.SYNC_VOICEMAIL";
field public static final java.lang.String AUTHORITY = "com.android.voicemail";
field public static final java.lang.String EXTRA_SELF_CHANGE = "com.android.voicemail.extra.SELF_CHANGE";
field public static final java.lang.String PARAM_KEY_SOURCE_PACKAGE = "source_package";
@@ -33030,7 +33030,6 @@ package android.provider {
public static final class VoicemailContract.Status implements android.provider.BaseColumns {
method public static android.net.Uri buildSourceUri(java.lang.String);
- method public static void setQuota(android.content.Context, android.telecom.PhoneAccountHandle, int, int);
field public static final java.lang.String CONFIGURATION_STATE = "configuration_state";
field public static final int CONFIGURATION_STATE_CAN_BE_CONFIGURED = 2; // 0x2
field public static final int CONFIGURATION_STATE_NOT_CONFIGURED = 1; // 0x1
@@ -36083,10 +36082,11 @@ package android.telecom {
field public static final int CAPABILITY_SWAP_CONFERENCE = 8; // 0x8
field public static final int PROPERTY_CONFERENCE = 1; // 0x1
field public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 4; // 0x4
+ field public static final int PROPERTY_ENTERPRISE_CALL = 32; // 0x20
field public static final int PROPERTY_GENERIC_CONFERENCE = 2; // 0x2
field public static final int PROPERTY_HIGH_DEF_AUDIO = 16; // 0x10
field public static final int PROPERTY_WIFI = 8; // 0x8
- field public static final int PROPERTY_WORK_CALL = 32; // 0x20
+ field public static final deprecated int PROPERTY_WORK_CALL = 32; // 0x20
}
public final class CallAudioState implements android.os.Parcelable {
@@ -36787,10 +36787,10 @@ 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_CELLULAR_DATA_REQUIRED_BOOL = "vvm_cellular_data_required";
+ field public static final java.lang.String KEY_VVM_CELLULAR_DATA_REQUIRED_BOOL = "vvm_cellular_data_required_bool";
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_PREFETCH_BOOL = "vvm_prefetch";
+ field public static final java.lang.String KEY_VVM_PREFETCH_BOOL = "vvm_prefetch_bool";
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";
}
@@ -42013,35 +42013,35 @@ package android.view {
}
public final class PointerIcon implements android.os.Parcelable {
- method public static android.view.PointerIcon createCustomIcon(android.graphics.Bitmap, float, float);
+ method public static android.view.PointerIcon create(android.graphics.Bitmap, float, float);
method public int describeContents();
method public static android.view.PointerIcon getSystemIcon(android.content.Context, int);
- method public static android.view.PointerIcon loadCustomIcon(android.content.res.Resources, int);
+ method public static android.view.PointerIcon load(android.content.res.Resources, int);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.view.PointerIcon> CREATOR;
- field public static final int STYLE_ALIAS = 1010; // 0x3f2
- field public static final int STYLE_ALL_SCROLL = 1013; // 0x3f5
- field public static final int STYLE_ARROW = 1000; // 0x3e8
- field public static final int STYLE_CELL = 1006; // 0x3ee
- field public static final int STYLE_CONTEXT_MENU = 1001; // 0x3e9
- field public static final int STYLE_COPY = 1011; // 0x3f3
- field public static final int STYLE_CROSSHAIR = 1007; // 0x3ef
- field public static final int STYLE_DEFAULT = 1000; // 0x3e8
- field public static final int STYLE_GRAB = 1020; // 0x3fc
- field public static final int STYLE_GRABBING = 1021; // 0x3fd
- field public static final int STYLE_HAND = 1002; // 0x3ea
- field public static final int STYLE_HELP = 1003; // 0x3eb
- field public static final int STYLE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6
- field public static final int STYLE_NO_DROP = 1012; // 0x3f4
- field public static final int STYLE_NULL = 0; // 0x0
- field public static final int STYLE_TEXT = 1008; // 0x3f0
- field public static final int STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9
- field public static final int STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8
- field public static final int STYLE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7
- field public static final int STYLE_VERTICAL_TEXT = 1009; // 0x3f1
- field public static final int STYLE_WAIT = 1004; // 0x3ec
- field public static final int STYLE_ZOOM_IN = 1018; // 0x3fa
- field public static final int STYLE_ZOOM_OUT = 1019; // 0x3fb
+ field public static final int TYPE_ALIAS = 1010; // 0x3f2
+ field public static final int TYPE_ALL_SCROLL = 1013; // 0x3f5
+ field public static final int TYPE_ARROW = 1000; // 0x3e8
+ field public static final int TYPE_CELL = 1006; // 0x3ee
+ field public static final int TYPE_CONTEXT_MENU = 1001; // 0x3e9
+ field public static final int TYPE_COPY = 1011; // 0x3f3
+ field public static final int TYPE_CROSSHAIR = 1007; // 0x3ef
+ field public static final int TYPE_DEFAULT = 1000; // 0x3e8
+ field public static final int TYPE_GRAB = 1020; // 0x3fc
+ field public static final int TYPE_GRABBING = 1021; // 0x3fd
+ field public static final int TYPE_HAND = 1002; // 0x3ea
+ field public static final int TYPE_HELP = 1003; // 0x3eb
+ field public static final int TYPE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6
+ field public static final int TYPE_NO_DROP = 1012; // 0x3f4
+ field public static final int TYPE_NULL = 0; // 0x0
+ field public static final int TYPE_TEXT = 1008; // 0x3f0
+ field public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9
+ field public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8
+ field public static final int TYPE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7
+ field public static final int TYPE_VERTICAL_TEXT = 1009; // 0x3f1
+ field public static final int TYPE_WAIT = 1004; // 0x3ec
+ field public static final int TYPE_ZOOM_IN = 1018; // 0x3fa
+ field public static final int TYPE_ZOOM_OUT = 1019; // 0x3fb
}
public class ScaleGestureDetector {
@@ -42407,7 +42407,7 @@ package android.view {
method public android.view.ViewParent getParentForAccessibility();
method public float getPivotX();
method public float getPivotY();
- method public android.view.PointerIcon getPointerIcon(android.view.MotionEvent, float, float);
+ method public android.view.PointerIcon getPointerIcon();
method public android.content.res.Resources getResources();
method public final int getRight();
method protected float getRightFadingEdgeStrength();
@@ -42558,6 +42558,7 @@ package android.view {
method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
method public void onProvideStructure(android.view.ViewStructure);
method public void onProvideVirtualStructure(android.view.ViewStructure);
+ method public android.view.PointerIcon onResolvePointerIcon(android.view.MotionEvent, int);
method protected void onRestoreInstanceState(android.os.Parcelable);
method public void onRtlPropertiesChanged(int);
method protected android.os.Parcelable onSaveInstanceState();
@@ -42604,6 +42605,7 @@ package android.view {
method public boolean requestFocus(int, android.graphics.Rect);
method public final boolean requestFocusFromTouch();
method public void requestLayout();
+ method public void requestPointerCapture();
method public boolean requestRectangleOnScreen(android.graphics.Rect);
method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
method public final void requestUnbufferedDispatch(android.view.MotionEvent);
@@ -42694,7 +42696,6 @@ package android.view {
method public void setPaddingRelative(int, int, int, int);
method public void setPivotX(float);
method public void setPivotY(float);
- method public void setPointerCapture();
method public void setPointerIcon(android.view.PointerIcon);
method public void setPressed(boolean);
method public final void setRight(int);
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index a1b7e0e5e9f4..a30a60673aa3 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -102,7 +102,6 @@ import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
import android.renderscript.RenderScriptCacheDir;
-import android.security.keystore.AndroidKeyStoreProvider;
import android.system.Os;
import android.system.OsConstants;
import android.system.ErrnoException;
@@ -5991,8 +5990,6 @@ public final class ActivityThread {
// Set the reporter for event logging in libcore
EventLogger.setReporter(new EventLoggingReporter());
- AndroidKeyStoreProvider.install();
-
// Make sure TrustedCertificateStore looks in the right place for CA certificates
final File configDir = Environment.getUserConfigDirectory(UserHandle.myUserId());
TrustedCertificateStore.setDefaultUserDirectory(configDir);
diff --git a/core/java/android/app/IWallpaperManager.aidl b/core/java/android/app/IWallpaperManager.aidl
index a42aed6fe28a..a0762b94a040 100644
--- a/core/java/android/app/IWallpaperManager.aidl
+++ b/core/java/android/app/IWallpaperManager.aidl
@@ -123,7 +123,7 @@ interface IWallpaperManager {
/**
* Check whether setting of wallpapers are allowed for the calling user.
*/
- boolean isWallpaperSettingAllowed(in String callingPackage);
+ boolean isSetWallpaperAllowed(in String callingPackage);
/*
* Backup: is the current system wallpaper image eligible for off-device backup?
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index a666e664acba..bd94a17de402 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -3369,7 +3369,7 @@ public class Notification implements Parcelable
* otherwise
*/
private boolean showsTimeOrChronometer() {
- return mN.showsTimeOrChronometer();
+ return mN.showsTime() || mN.showsChronometer();
}
private void resetStandardTemplateWithActions(RemoteViews big) {
@@ -3865,15 +3865,22 @@ public class Notification implements Parcelable
}
/**
- * @return true if the notification will show the time or the chronometer; false
- * otherwise
+ * @return true if the notification will show the time; false otherwise
* @hide
*/
- public boolean showsTimeOrChronometer() {
+ public boolean showsTime() {
return when != 0 && extras.getBoolean(EXTRA_SHOW_WHEN);
}
/**
+ * @return true if the notification will show a chronometer; false otherwise
+ * @hide
+ */
+ public boolean showsChronometer() {
+ return when != 0 && extras.getBoolean(EXTRA_SHOW_CHRONOMETER);
+ }
+
+ /**
* An object that can apply a rich notification style to a {@link Notification.Builder}
* object.
*/
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index 2b82929debe0..18f93cd4688a 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -43,6 +43,7 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
+import android.os.DeadSystemException;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
@@ -76,7 +77,7 @@ import java.util.concurrent.TimeUnit;
*
* <p> An app can check whether wallpapers are supported for the current user, by calling
* {@link #isWallpaperSupported()}, and whether setting of wallpapers is allowed, by calling
- * {@link #isWallpaperSettingAllowed()}.
+ * {@link #isSetWallpaperAllowed()}.
*/
public class WallpaperManager {
private static String TAG = "WallpaperManager";
@@ -483,7 +484,7 @@ public class WallpaperManager {
float horizontalAlignment, float verticalAlignment, @SetWallpaperFlags int which) {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return null;
+ throw new RuntimeException(new DeadSystemException());
}
if (which != FLAG_SYSTEM && which != FLAG_LOCK) {
@@ -750,7 +751,7 @@ public class WallpaperManager {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return null;
+ throw new RuntimeException(new DeadSystemException());
} else {
try {
Bundle outParams = new Bundle();
@@ -780,7 +781,7 @@ public class WallpaperManager {
try {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return null;
+ throw new RuntimeException(new DeadSystemException());
} else {
return sGlobals.mService.getWallpaperInfo();
}
@@ -793,6 +794,10 @@ public class WallpaperManager {
* Get the ID of the current wallpaper of the given kind. If there is no
* such wallpaper configured, returns a negative number.
*
+ * <p>Every time the wallpaper image is set, a new ID is assigned to it.
+ * This method allows the caller to determine whether the wallpaper imagery
+ * has changed, regardless of how that change happened.
+ *
* @param which The wallpaper whose ID is to be returned. Must be a single
* defined kind of wallpaper, either {@link #FLAG_SYSTEM} or
* {@link #FLAG_LOCK}.
@@ -812,7 +817,7 @@ public class WallpaperManager {
try {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return -1;
+ throw new RuntimeException(new DeadSystemException());
} else {
return sGlobals.mService.getWallpaperIdForUser(which, userId);
}
@@ -914,7 +919,7 @@ public class WallpaperManager {
throws IOException {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return 0;
+ throw new RuntimeException(new DeadSystemException());
}
final Bundle result = new Bundle();
final WallpaperSetCompletion completion = new WallpaperSetCompletion();
@@ -1027,7 +1032,7 @@ public class WallpaperManager {
validateRect(visibleCropHint);
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return 0;
+ throw new RuntimeException(new DeadSystemException());
}
final Bundle result = new Bundle();
final WallpaperSetCompletion completion = new WallpaperSetCompletion();
@@ -1073,7 +1078,8 @@ public class WallpaperManager {
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#SET_WALLPAPER}.
*
- * @param bitmapData A stream containing the raw data to install as a wallpaper.
+ * @param bitmapData A stream containing the raw data to install as a wallpaper. This
+ * data can be in any format handled by {@link BitmapRegionDecoder}.
*
* @throws IOException If an error occurs when attempting to set the wallpaper
* based on the provided image data.
@@ -1103,13 +1109,17 @@ public class WallpaperManager {
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#SET_WALLPAPER}.
*
- * @param bitmapData A stream containing the raw data to install as a wallpaper.
+ * @param bitmapData A stream containing the raw data to install as a wallpaper. This
+ * data can be in any format handled by {@link BitmapRegionDecoder}.
* @param visibleCropHint The rectangular subregion of the streamed image that should be
* displayed as wallpaper. Passing {@code null} for this parameter means that
* the full image should be displayed if possible given the image's and device's
* aspect ratios, etc.
* @param allowBackup {@code true} if the OS is permitted to back up this wallpaper
* image for restore to a future device; {@code false} otherwise.
+ * @return An integer ID assigned to the newly active wallpaper; or zero on failure.
+ *
+ * @see #getWallpaperId(int)
*
* @throws IOException If an error occurs when attempting to set the wallpaper
* based on the provided image data.
@@ -1125,7 +1135,8 @@ public class WallpaperManager {
* Version of {@link #setStream(InputStream, Rect, boolean)} that allows the caller
* to specify which of the supported wallpaper categories to set.
*
- * @param bitmapData A stream containing the raw data to install as a wallpaper.
+ * @param bitmapData A stream containing the raw data to install as a wallpaper. This
+ * data can be in any format handled by {@link BitmapRegionDecoder}.
* @param visibleCropHint The rectangular subregion of the streamed image that should be
* displayed as wallpaper. Passing {@code null} for this parameter means that
* the full image should be displayed if possible given the image's and device's
@@ -1133,7 +1144,9 @@ public class WallpaperManager {
* @param allowBackup {@code true} if the OS is permitted to back up this wallpaper
* image for restore to a future device; {@code false} otherwise.
* @param which Flags indicating which wallpaper(s) to configure with the new imagery.
+ * @return An integer ID assigned to the newly active wallpaper; or zero on failure.
*
+ * @see #getWallpaperId(int)
* @see #FLAG_LOCK
* @see #FLAG_SYSTEM
*
@@ -1145,7 +1158,7 @@ public class WallpaperManager {
validateRect(visibleCropHint);
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return 0;
+ throw new RuntimeException(new DeadSystemException());
}
final Bundle result = new Bundle();
final WallpaperSetCompletion completion = new WallpaperSetCompletion();
@@ -1179,7 +1192,7 @@ public class WallpaperManager {
public boolean hasResourceWallpaper(@RawRes int resid) {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return false;
+ throw new RuntimeException(new DeadSystemException());
}
try {
Resources resources = mContext.getResources();
@@ -1207,7 +1220,7 @@ public class WallpaperManager {
public int getDesiredMinimumWidth() {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return 0;
+ throw new RuntimeException(new DeadSystemException());
}
try {
return sGlobals.mService.getWidthHint();
@@ -1233,7 +1246,7 @@ public class WallpaperManager {
public int getDesiredMinimumHeight() {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return 0;
+ throw new RuntimeException(new DeadSystemException());
}
try {
return sGlobals.mService.getHeightHint();
@@ -1294,6 +1307,7 @@ public class WallpaperManager {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
+ throw new RuntimeException(new DeadSystemException());
} else {
sGlobals.mService.setDimensionHints(minimumWidth, minimumHeight,
mContext.getOpPackageName());
@@ -1316,6 +1330,7 @@ public class WallpaperManager {
try {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
+ throw new RuntimeException(new DeadSystemException());
} else {
sGlobals.mService.setDisplayPadding(padding, mContext.getOpPackageName());
}
@@ -1365,7 +1380,7 @@ public class WallpaperManager {
public void clearWallpaper(@SetWallpaperFlags int which, int userId) {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return;
+ throw new RuntimeException(new DeadSystemException());
}
try {
sGlobals.mService.clearWallpaper(mContext.getOpPackageName(), which, userId);
@@ -1386,7 +1401,7 @@ public class WallpaperManager {
public boolean setWallpaperComponent(ComponentName name) {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return false;
+ throw new RuntimeException(new DeadSystemException());
}
try {
sGlobals.mService.setWallpaperComponentChecked(name, mContext.getOpPackageName());
@@ -1466,6 +1481,7 @@ public class WallpaperManager {
public boolean isWallpaperSupported() {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
+ throw new RuntimeException(new DeadSystemException());
} else {
try {
return sGlobals.mService.isWallpaperSupported(mContext.getOpPackageName());
@@ -1473,7 +1489,6 @@ public class WallpaperManager {
throw e.rethrowFromSystemServer();
}
}
- return false;
}
/**
@@ -1483,17 +1498,17 @@ public class WallpaperManager {
*
* @see android.os.UserManager#DISALLOW_SET_WALLPAPER
*/
- public boolean isWallpaperSettingAllowed() {
+ public boolean isSetWallpaperAllowed() {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
+ throw new RuntimeException(new DeadSystemException());
} else {
try {
- return sGlobals.mService.isWallpaperSettingAllowed(mContext.getOpPackageName());
+ return sGlobals.mService.isSetWallpaperAllowed(mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
- return false;
}
/**
@@ -1621,7 +1636,7 @@ public class WallpaperManager {
public boolean setLockWallpaperCallback(IWallpaperManagerCallback callback) {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return false;
+ throw new RuntimeException(new DeadSystemException());
}
try {
@@ -1640,7 +1655,7 @@ public class WallpaperManager {
public boolean isWallpaperBackupEligible() {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
- return false;
+ throw new RuntimeException(new DeadSystemException());
}
try {
return sGlobals.mService.isWallpaperBackupEligible(mContext.getUserId());
diff --git a/core/java/android/bluetooth/BluetoothGatt.java b/core/java/android/bluetooth/BluetoothGatt.java
index b8a40dc6895a..800dd434a969 100644
--- a/core/java/android/bluetooth/BluetoothGatt.java
+++ b/core/java/android/bluetooth/BluetoothGatt.java
@@ -645,6 +645,9 @@ public final class BluetoothGatt implements BluetoothProfile {
}
mConnState = CONN_STATE_CONNECTING;
}
+
+ mAutoConnect = autoConnect;
+
if (!registerApp(callback)) {
synchronized(mStateLock) {
mConnState = CONN_STATE_IDLE;
@@ -653,8 +656,7 @@ public final class BluetoothGatt implements BluetoothProfile {
return false;
}
- // the connection will continue after successful callback registration
- mAutoConnect = autoConnect;
+ // The connection will continue in the onClientRegistered callback
return true;
}
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index abbad98ac7ce..de1284ec248f 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -3536,6 +3536,12 @@ public class PackageParser {
a.info.resizeMode = RESIZE_MODE_UNRESIZEABLE;
final boolean appDefault = (owner.applicationInfo.privateFlags
& PRIVATE_FLAG_RESIZEABLE_ACTIVITIES) != 0;
+ // This flag is used to workaround the issue with ignored resizeableActivity param when
+ // either targetSdkVersion is not set at all or <uses-sdk> tag is below <application>
+ // tag in AndroidManifest. If this param was explicitly set to 'false' we need to set
+ // corresponding resizeMode regardless of targetSdkVersion value at this point in time.
+ final boolean resizeableSetExplicitly
+ = sa.hasValue(R.styleable.AndroidManifestActivity_resizeableActivity);
final boolean resizeable = sa.getBoolean(
R.styleable.AndroidManifestActivity_resizeableActivity, appDefault);
@@ -3546,7 +3552,8 @@ public class PackageParser {
} else {
a.info.resizeMode = RESIZE_MODE_RESIZEABLE;
}
- } else if (owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.N) {
+ } else if (owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.N
+ || resizeableSetExplicitly) {
a.info.resizeMode = RESIZE_MODE_UNRESIZEABLE;
} else if (!a.info.isFixedOrientation() && (a.info.flags & FLAG_IMMERSIVE) == 0) {
a.info.resizeMode = RESIZE_MODE_FORCE_RESIZEABLE;
diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl
index c4ee3478fab4..49c106e69d9f 100644
--- a/core/java/android/hardware/input/IInputManager.aidl
+++ b/core/java/android/hardware/input/IInputManager.aidl
@@ -79,7 +79,7 @@ interface IInputManager {
void vibrate(int deviceId, in long[] pattern, int repeat, IBinder token);
void cancelVibrate(int deviceId, IBinder token);
- void setPointerIconShape(int shapeId);
+ void setPointerIconType(int typeId);
void setCustomPointerIcon(in PointerIcon icon);
void setPointerIconDetached(boolean detached);
diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java
index 8a43acb59100..a5aeae331f84 100644
--- a/core/java/android/hardware/input/InputManager.java
+++ b/core/java/android/hardware/input/InputManager.java
@@ -872,13 +872,13 @@ public final class InputManager {
* Changes the mouse pointer's icon shape into the specified id.
*
* @param iconId The id of the pointer graphic, as a value between
- * {@link PointerIcon.STYLE_ARROW} and {@link PointerIcon.STYLE_GRABBING}.
+ * {@link PointerIcon.TYPE_ARROW} and {@link PointerIcon.TYPE_GRABBING}.
*
* @hide
*/
- public void setPointerIconShape(int iconId) {
+ public void setPointerIconType(int iconId) {
try {
- mIm.setPointerIconShape(iconId);
+ mIm.setPointerIconType(iconId);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
diff --git a/core/java/android/provider/BlockedNumberContract.java b/core/java/android/provider/BlockedNumberContract.java
index 92a22d101193..fb11d00cec46 100644
--- a/core/java/android/provider/BlockedNumberContract.java
+++ b/core/java/android/provider/BlockedNumberContract.java
@@ -237,6 +237,8 @@ public class BlockedNumberContract {
*
* <p> Note that if the {@link #canCurrentUserBlockNumbers} is {@code false} for the user
* context {@code context}, this method will throw a {@link SecurityException}.
+ *
+ * @return {@code true} if the {@code phoneNumber} is blocked.
*/
@WorkerThread
public static boolean isBlocked(Context context, String phoneNumber) {
@@ -248,8 +250,6 @@ public class BlockedNumberContract {
/**
* Unblocks the {@code phoneNumber} if it is blocked.
*
- * <p> Returns the number of rows deleted in the blocked number provider as a result of unblock.
- *
* <p> This deletes all rows where the {@code phoneNumber} matches the
* {@link BlockedNumbers#COLUMN_ORIGINAL_NUMBER} column or the E164 representation of the
* {@code phoneNumber} matches the {@link BlockedNumbers#COLUMN_E164_NUMBER} column.
@@ -261,6 +261,8 @@ public class BlockedNumberContract {
*
* <p> Note that if the {@link #canCurrentUserBlockNumbers} is {@code false} for the user
* context {@code context}, this method will throw a {@link SecurityException}.
+ *
+ * @return the number of rows deleted in the blocked number provider as a result of unblock.
*/
@WorkerThread
public static int unblock(Context context, String phoneNumber) {
@@ -270,8 +272,10 @@ public class BlockedNumberContract {
}
/**
- * Returns {@code true} if blocking numbers is supported for the current user.
+ * Checks if blocking numbers is supported for the current user.
* <p> Typically, blocking numbers is only supported for one user at a time.
+ *
+ * @return {@code true} if the current user can block numbers.
*/
public static boolean canCurrentUserBlockNumbers(Context context) {
final Bundle res = context.getContentResolver().call(
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 66d487fd3105..59ec3e2f699a 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3562,6 +3562,7 @@ public final class Settings {
DTMF_TONE_TYPE_WHEN_DIALING,
HEARING_AID,
TTY_MODE,
+ MASTER_MONO,
SOUND_EFFECTS_ENABLED,
HAPTIC_FEEDBACK_ENABLED,
POWER_SOUNDS_ENABLED, // moved to global
diff --git a/core/java/android/provider/VoicemailContract.java b/core/java/android/provider/VoicemailContract.java
index 8ee9d1eaf914..6a3cc0205f18 100644
--- a/core/java/android/provider/VoicemailContract.java
+++ b/core/java/android/provider/VoicemailContract.java
@@ -104,7 +104,7 @@ public class VoicemailContract {
* Broadcast intent to request all voicemail sources to perform a sync with the remote server.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
- public static final String ACTION_SYNC_VOICEMAIL = "android.intent.action.SYNC_VOICEMAIL";
+ public static final String ACTION_SYNC_VOICEMAIL = "android.provider.action.SYNC_VOICEMAIL";
/**
* Extra included in {@link Intent#ACTION_PROVIDER_CHANGED} broadcast intents to indicate if the
@@ -514,14 +514,17 @@ public class VoicemailContract {
/**
* Amount of resource that is used by existing voicemail in the visual voicemail inbox,
- * or {@link #QUOTA_UNAVAILABLE}. Unit is not specified.
+ * or {@link #QUOTA_UNAVAILABLE} if the quota has never been updated before. This value is
+ * used to inform the client the situation on the remote server. Unit is not specified.
* <P>Type: INTEGER</P>
*/
public static final String QUOTA_OCCUPIED = "quota_occupied";
/**
* Total resource in the visual voicemail inbox that can be used, or
- * {@link #QUOTA_UNAVAILABLE}. Unit is not specified.
+ * {@link #QUOTA_UNAVAILABLE} if server either has unlimited quota or does not provide quota
+ * information. This value is used to inform the client the situation on the remote server.
+ * Unit is not specified.
* <P>Type: INTEGER</P>
*/
public static final String QUOTA_TOTAL = "quota_total";
@@ -579,6 +582,8 @@ public class VoicemailContract {
* @param accountHandle The handle for the account the source is associated with.
* @param occupied See {@link Status#QUOTA_OCCUPIED}
* @param total See {@link Status#QUOTA_TOTAL}
+ *
+ * @hide
*/
public static void setQuota(Context context, PhoneAccountHandle accountHandle, int occupied,
int total) {
diff --git a/core/java/android/util/SparseArray.java b/core/java/android/util/SparseArray.java
index dc965edd7fad..34e6f04f0404 100644
--- a/core/java/android/util/SparseArray.java
+++ b/core/java/android/util/SparseArray.java
@@ -160,6 +160,9 @@ public class SparseArray<E> implements Cloneable {
/**
* Removes the mapping at the specified index.
+ *
+ * <p>For indices outside of the range <code>0...size()-1</code>,
+ * the behavior is undefined.</p>
*/
public void removeAt(int index) {
if (mValues[index] != DELETED) {
@@ -173,6 +176,9 @@ public class SparseArray<E> implements Cloneable {
*
* @param index Index to begin at
* @param size Number of mappings to remove
+ *
+ * <p>For indices outside of the range <code>0...size()-1</code>,
+ * the behavior is undefined.</p>
*/
public void removeAtRange(int index, int size) {
final int end = Math.min(mSize, index + size);
@@ -262,6 +268,9 @@ public class SparseArray<E> implements Cloneable {
* be in ascending order, e.g., <code>keyAt(0)</code> will return the
* smallest key and <code>keyAt(size()-1)</code> will return the largest
* key.</p>
+ *
+ * <p>For indices outside of the range <code>0...size()-1</code>,
+ * the behavior is undefined.</p>
*/
public int keyAt(int index) {
if (mGarbage) {
@@ -281,6 +290,9 @@ public class SparseArray<E> implements Cloneable {
* <code>valueAt(0)</code> will return the value associated with the
* smallest key and <code>valueAt(size()-1)</code> will return the value
* associated with the largest key.</p>
+ *
+ * <p>For indices outside of the range <code>0...size()-1</code>,
+ * the behavior is undefined.</p>
*/
@SuppressWarnings("unchecked")
public E valueAt(int index) {
@@ -295,6 +307,8 @@ public class SparseArray<E> implements Cloneable {
* Given an index in the range <code>0...size()-1</code>, sets a new
* value for the <code>index</code>th key-value mapping that this
* SparseArray stores.
+ *
+ * <p>For indices outside of the range <code>0...size()-1</code>, the behavior is undefined.</p>
*/
public void setValueAt(int index, E value) {
if (mGarbage) {
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java
index 88cd7ca71a4e..e5748c1ffe52 100644
--- a/core/java/android/view/InputDevice.java
+++ b/core/java/android/view/InputDevice.java
@@ -775,12 +775,12 @@ public final class InputDevice implements Parcelable {
}
/**
- * Sets the current pointer shape.
- * @param pointerShape the id of the pointer icon.
+ * Sets the current pointer type.
+ * @param pointerType the type of the pointer icon.
* @hide
*/
- public void setPointerShape(int pointerShape) {
- InputManager.getInstance().setPointerIconShape(pointerShape);
+ public void setPointerType(int pointerType) {
+ InputManager.getInstance().setPointerIconType(pointerType);
}
/**
diff --git a/core/java/android/view/PointerIcon.java b/core/java/android/view/PointerIcon.java
index 81bb638e62fb..fc79f53b744b 100644
--- a/core/java/android/view/PointerIcon.java
+++ b/core/java/android/view/PointerIcon.java
@@ -36,112 +36,112 @@ import android.util.Log;
/**
* Represents an icon that can be used as a mouse pointer.
* <p>
- * Pointer icons can be provided either by the system using system styles,
+ * Pointer icons can be provided either by the system using system types,
* or by applications using bitmaps or application resources.
* </p>
*/
public final class PointerIcon implements Parcelable {
private static final String TAG = "PointerIcon";
- /** {@hide} Style constant: Custom icon with a user-supplied bitmap. */
- public static final int STYLE_CUSTOM = -1;
+ /** {@hide} Type constant: Custom icon with a user-supplied bitmap. */
+ public static final int TYPE_CUSTOM = -1;
- /** Style constant: Null icon. It has no bitmap. */
- public static final int STYLE_NULL = 0;
+ /** Type constant: Null icon. It has no bitmap. */
+ public static final int TYPE_NULL = 0;
- /** Style constant: no icons are specified. If all views uses this, then falls back
- * to the default style, but this is helpful to distinguish a view explicitly want
+ /** Type constant: no icons are specified. If all views uses this, then falls back
+ * to the default type, but this is helpful to distinguish a view explicitly want
* to have the default icon.
* @hide
*/
- public static final int STYLE_NOT_SPECIFIED = 1;
+ public static final int TYPE_NOT_SPECIFIED = 1;
- /** Style constant: Arrow icon. (Default mouse pointer) */
- public static final int STYLE_ARROW = 1000;
+ /** Type constant: Arrow icon. (Default mouse pointer) */
+ public static final int TYPE_ARROW = 1000;
- /** {@hide} Style constant: Spot hover icon for touchpads. */
- public static final int STYLE_SPOT_HOVER = 2000;
+ /** {@hide} Type constant: Spot hover icon for touchpads. */
+ public static final int TYPE_SPOT_HOVER = 2000;
- /** {@hide} Style constant: Spot touch icon for touchpads. */
- public static final int STYLE_SPOT_TOUCH = 2001;
+ /** {@hide} Type constant: Spot touch icon for touchpads. */
+ public static final int TYPE_SPOT_TOUCH = 2001;
- /** {@hide} Style constant: Spot anchor icon for touchpads. */
- public static final int STYLE_SPOT_ANCHOR = 2002;
+ /** {@hide} Type constant: Spot anchor icon for touchpads. */
+ public static final int TYPE_SPOT_ANCHOR = 2002;
- // Style constants for additional predefined icons for mice.
- /** Style constant: context-menu. */
- public static final int STYLE_CONTEXT_MENU = 1001;
+ // Type constants for additional predefined icons for mice.
+ /** Type constant: context-menu. */
+ public static final int TYPE_CONTEXT_MENU = 1001;
- /** Style constant: hand. */
- public static final int STYLE_HAND = 1002;
+ /** Type constant: hand. */
+ public static final int TYPE_HAND = 1002;
- /** Style constant: help. */
- public static final int STYLE_HELP = 1003;
+ /** Type constant: help. */
+ public static final int TYPE_HELP = 1003;
- /** Style constant: wait. */
- public static final int STYLE_WAIT = 1004;
+ /** Type constant: wait. */
+ public static final int TYPE_WAIT = 1004;
- /** Style constant: cell. */
- public static final int STYLE_CELL = 1006;
+ /** Type constant: cell. */
+ public static final int TYPE_CELL = 1006;
- /** Style constant: crosshair. */
- public static final int STYLE_CROSSHAIR = 1007;
+ /** Type constant: crosshair. */
+ public static final int TYPE_CROSSHAIR = 1007;
- /** Style constant: text. */
- public static final int STYLE_TEXT = 1008;
+ /** Type constant: text. */
+ public static final int TYPE_TEXT = 1008;
- /** Style constant: vertical-text. */
- public static final int STYLE_VERTICAL_TEXT = 1009;
+ /** Type constant: vertical-text. */
+ public static final int TYPE_VERTICAL_TEXT = 1009;
- /** Style constant: alias (indicating an alias of/shortcut to something is
+ /** Type constant: alias (indicating an alias of/shortcut to something is
* to be created. */
- public static final int STYLE_ALIAS = 1010;
+ public static final int TYPE_ALIAS = 1010;
- /** Style constant: copy. */
- public static final int STYLE_COPY = 1011;
+ /** Type constant: copy. */
+ public static final int TYPE_COPY = 1011;
- /** Style constant: no-drop. */
- public static final int STYLE_NO_DROP = 1012;
+ /** Type constant: no-drop. */
+ public static final int TYPE_NO_DROP = 1012;
- /** Style constant: all-scroll. */
- public static final int STYLE_ALL_SCROLL = 1013;
+ /** Type constant: all-scroll. */
+ public static final int TYPE_ALL_SCROLL = 1013;
- /** Style constant: horizontal double arrow mainly for resizing. */
- public static final int STYLE_HORIZONTAL_DOUBLE_ARROW = 1014;
+ /** Type constant: horizontal double arrow mainly for resizing. */
+ public static final int TYPE_HORIZONTAL_DOUBLE_ARROW = 1014;
- /** Style constant: vertical double arrow mainly for resizing. */
- public static final int STYLE_VERTICAL_DOUBLE_ARROW = 1015;
+ /** Type constant: vertical double arrow mainly for resizing. */
+ public static final int TYPE_VERTICAL_DOUBLE_ARROW = 1015;
- /** Style constant: diagonal double arrow -- top-right to bottom-left. */
- public static final int STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016;
+ /** Type constant: diagonal double arrow -- top-right to bottom-left. */
+ public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016;
- /** Style constant: diagonal double arrow -- top-left to bottom-right. */
- public static final int STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017;
+ /** Type constant: diagonal double arrow -- top-left to bottom-right. */
+ public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017;
- /** Style constant: zoom-in. */
- public static final int STYLE_ZOOM_IN = 1018;
+ /** Type constant: zoom-in. */
+ public static final int TYPE_ZOOM_IN = 1018;
- /** Style constant: zoom-out. */
- public static final int STYLE_ZOOM_OUT = 1019;
+ /** Type constant: zoom-out. */
+ public static final int TYPE_ZOOM_OUT = 1019;
- /** Style constant: grab. */
- public static final int STYLE_GRAB = 1020;
+ /** Type constant: grab. */
+ public static final int TYPE_GRAB = 1020;
- /** Style constant: grabbing. */
- public static final int STYLE_GRABBING = 1021;
+ /** Type constant: grabbing. */
+ public static final int TYPE_GRABBING = 1021;
- // OEM private styles should be defined starting at this range to avoid
- // conflicts with any system styles that may be defined in the future.
- private static final int STYLE_OEM_FIRST = 10000;
+ // OEM private types should be defined starting at this range to avoid
+ // conflicts with any system types that may be defined in the future.
+ private static final int TYPE_OEM_FIRST = 10000;
/** The default pointer icon. */
- public static final int STYLE_DEFAULT = STYLE_ARROW;
+ public static final int TYPE_DEFAULT = TYPE_ARROW;
- private static final PointerIcon gNullIcon = new PointerIcon(STYLE_NULL);
+ private static final PointerIcon gNullIcon = new PointerIcon(TYPE_NULL);
private static final SparseArray<PointerIcon> gSystemIcons = new SparseArray<PointerIcon>();
private static boolean sUseLargeIcons = false;
- private final int mStyle;
+ private final int mType;
private int mSystemIconResourceId;
private Bitmap mBitmap;
private float mHotSpotX;
@@ -151,8 +151,8 @@ public final class PointerIcon implements Parcelable {
private Bitmap mBitmapFrames[];
private int mDurationPerFrame;
- private PointerIcon(int style) {
- mStyle = style;
+ private PointerIcon(int type) {
+ mType = type;
}
/**
@@ -160,7 +160,7 @@ public final class PointerIcon implements Parcelable {
*
* @return The null pointer icon.
*
- * @see #STYLE_NULL
+ * @see #TYPE_NULL
* @hide
*/
public static PointerIcon getNullIcon() {
@@ -177,36 +177,36 @@ public final class PointerIcon implements Parcelable {
* @hide
*/
public static PointerIcon getDefaultIcon(@NonNull Context context) {
- return getSystemIcon(context, STYLE_DEFAULT);
+ return getSystemIcon(context, TYPE_DEFAULT);
}
/**
- * Gets a system pointer icon for the given style.
- * If style is not recognized, returns the default pointer icon.
+ * Gets a system pointer icon for the given type.
+ * If typeis not recognized, returns the default pointer icon.
*
* @param context The context.
- * @param style The pointer icon style.
+ * @param type The pointer icon type.
* @return The pointer icon.
*
* @throws IllegalArgumentException if context is null.
*/
- public static PointerIcon getSystemIcon(@NonNull Context context, int style) {
+ public static PointerIcon getSystemIcon(@NonNull Context context, int type) {
if (context == null) {
throw new IllegalArgumentException("context must not be null");
}
- if (style == STYLE_NULL) {
+ if (type == TYPE_NULL) {
return gNullIcon;
}
- PointerIcon icon = gSystemIcons.get(style);
+ PointerIcon icon = gSystemIcons.get(type);
if (icon != null) {
return icon;
}
- int styleIndex = getSystemIconStyleIndex(style);
- if (styleIndex == 0) {
- styleIndex = getSystemIconStyleIndex(STYLE_DEFAULT);
+ int typeIndex = getSystemIconTypeIndex(type);
+ if (typeIndex == 0) {
+ typeIndex = getSystemIconTypeIndex(TYPE_DEFAULT);
}
int defStyle = sUseLargeIcons ?
@@ -214,21 +214,21 @@ public final class PointerIcon implements Parcelable {
TypedArray a = context.obtainStyledAttributes(null,
com.android.internal.R.styleable.Pointer,
0, defStyle);
- int resourceId = a.getResourceId(styleIndex, -1);
+ int resourceId = a.getResourceId(typeIndex, -1);
a.recycle();
if (resourceId == -1) {
- Log.w(TAG, "Missing theme resources for pointer icon style " + style);
- return style == STYLE_DEFAULT ? gNullIcon : getSystemIcon(context, STYLE_DEFAULT);
+ Log.w(TAG, "Missing theme resources for pointer icon type " + type);
+ return type == TYPE_DEFAULT ? gNullIcon : getSystemIcon(context, TYPE_DEFAULT);
}
- icon = new PointerIcon(style);
+ icon = new PointerIcon(type);
if ((resourceId & 0xff000000) == 0x01000000) {
icon.mSystemIconResourceId = resourceId;
} else {
icon.loadResource(context, context.getResources(), resourceId);
}
- gSystemIcons.append(style, icon);
+ gSystemIcons.append(type, icon);
return icon;
}
@@ -242,7 +242,7 @@ public final class PointerIcon implements Parcelable {
}
/**
- * Creates a custom pointer from the given bitmap and hotspot information.
+ * Creates a custom pointer icon from the given bitmap and hotspot information.
*
* @param bitmap The bitmap for the icon.
* @param hotSpotX The X offset of the pointer icon hotspot in the bitmap.
@@ -254,14 +254,13 @@ public final class PointerIcon implements Parcelable {
* @throws IllegalArgumentException if bitmap is null, or if the x/y hotspot
* parameters are invalid.
*/
- public static PointerIcon createCustomIcon(
- @NonNull Bitmap bitmap, float hotSpotX, float hotSpotY) {
+ public static PointerIcon create(@NonNull Bitmap bitmap, float hotSpotX, float hotSpotY) {
if (bitmap == null) {
throw new IllegalArgumentException("bitmap must not be null");
}
validateHotSpot(bitmap, hotSpotX, hotSpotY);
- PointerIcon icon = new PointerIcon(STYLE_CUSTOM);
+ PointerIcon icon = new PointerIcon(TYPE_CUSTOM);
icon.mBitmap = bitmap;
icon.mHotSpotX = hotSpotX;
icon.mHotSpotY = hotSpotY;
@@ -289,12 +288,12 @@ public final class PointerIcon implements Parcelable {
* @throws Resources.NotFoundException if the resource was not found or the drawable
* linked in the resource was not found.
*/
- public static PointerIcon loadCustomIcon(@NonNull Resources resources, @XmlRes int resourceId) {
+ public static PointerIcon load(@NonNull Resources resources, @XmlRes int resourceId) {
if (resources == null) {
throw new IllegalArgumentException("resources must not be null");
}
- PointerIcon icon = new PointerIcon(STYLE_CUSTOM);
+ PointerIcon icon = new PointerIcon(TYPE_CUSTOM);
icon.loadResource(null, resources, resourceId);
return icon;
}
@@ -318,28 +317,28 @@ public final class PointerIcon implements Parcelable {
return this;
}
- PointerIcon result = new PointerIcon(mStyle);
+ PointerIcon result = new PointerIcon(mType);
result.mSystemIconResourceId = mSystemIconResourceId;
result.loadResource(context, context.getResources(), mSystemIconResourceId);
return result;
}
/** @hide */
- public int getStyle() {
- return mStyle;
+ public int getType() {
+ return mType;
}
public static final Parcelable.Creator<PointerIcon> CREATOR
= new Parcelable.Creator<PointerIcon>() {
public PointerIcon createFromParcel(Parcel in) {
- int style = in.readInt();
- if (style == STYLE_NULL) {
+ int type = in.readInt();
+ if (type == TYPE_NULL) {
return getNullIcon();
}
int systemIconResourceId = in.readInt();
if (systemIconResourceId != 0) {
- PointerIcon icon = new PointerIcon(style);
+ PointerIcon icon = new PointerIcon(type);
icon.mSystemIconResourceId = systemIconResourceId;
return icon;
}
@@ -347,7 +346,7 @@ public final class PointerIcon implements Parcelable {
Bitmap bitmap = Bitmap.CREATOR.createFromParcel(in);
float hotSpotX = in.readFloat();
float hotSpotY = in.readFloat();
- return PointerIcon.createCustomIcon(bitmap, hotSpotX, hotSpotY);
+ return PointerIcon.create(bitmap, hotSpotX, hotSpotY);
}
public PointerIcon[] newArray(int size) {
@@ -360,9 +359,9 @@ public final class PointerIcon implements Parcelable {
}
public void writeToParcel(Parcel out, int flags) {
- out.writeInt(mStyle);
+ out.writeInt(mType);
- if (mStyle != STYLE_NULL) {
+ if (mType != TYPE_NULL) {
out.writeInt(mSystemIconResourceId);
if (mSystemIconResourceId == 0) {
mBitmap.writeToParcel(out, flags);
@@ -383,7 +382,7 @@ public final class PointerIcon implements Parcelable {
}
PointerIcon otherIcon = (PointerIcon) other;
- if (mStyle != otherIcon.mStyle
+ if (mType != otherIcon.mType
|| mSystemIconResourceId != otherIcon.mSystemIconResourceId) {
return false;
}
@@ -477,57 +476,57 @@ public final class PointerIcon implements Parcelable {
}
}
- private static int getSystemIconStyleIndex(int style) {
- switch (style) {
- case STYLE_ARROW:
+ private static int getSystemIconTypeIndex(int type) {
+ switch (type) {
+ case TYPE_ARROW:
return com.android.internal.R.styleable.Pointer_pointerIconArrow;
- case STYLE_SPOT_HOVER:
+ case TYPE_SPOT_HOVER:
return com.android.internal.R.styleable.Pointer_pointerIconSpotHover;
- case STYLE_SPOT_TOUCH:
+ case TYPE_SPOT_TOUCH:
return com.android.internal.R.styleable.Pointer_pointerIconSpotTouch;
- case STYLE_SPOT_ANCHOR:
+ case TYPE_SPOT_ANCHOR:
return com.android.internal.R.styleable.Pointer_pointerIconSpotAnchor;
- case STYLE_HAND:
+ case TYPE_HAND:
return com.android.internal.R.styleable.Pointer_pointerIconHand;
- case STYLE_CONTEXT_MENU:
+ case TYPE_CONTEXT_MENU:
return com.android.internal.R.styleable.Pointer_pointerIconContextMenu;
- case STYLE_HELP:
+ case TYPE_HELP:
return com.android.internal.R.styleable.Pointer_pointerIconHelp;
- case STYLE_WAIT:
+ case TYPE_WAIT:
return com.android.internal.R.styleable.Pointer_pointerIconWait;
- case STYLE_CELL:
+ case TYPE_CELL:
return com.android.internal.R.styleable.Pointer_pointerIconCell;
- case STYLE_CROSSHAIR:
+ case TYPE_CROSSHAIR:
return com.android.internal.R.styleable.Pointer_pointerIconCrosshair;
- case STYLE_TEXT:
+ case TYPE_TEXT:
return com.android.internal.R.styleable.Pointer_pointerIconText;
- case STYLE_VERTICAL_TEXT:
+ case TYPE_VERTICAL_TEXT:
return com.android.internal.R.styleable.Pointer_pointerIconVerticalText;
- case STYLE_ALIAS:
+ case TYPE_ALIAS:
return com.android.internal.R.styleable.Pointer_pointerIconAlias;
- case STYLE_COPY:
+ case TYPE_COPY:
return com.android.internal.R.styleable.Pointer_pointerIconCopy;
- case STYLE_ALL_SCROLL:
+ case TYPE_ALL_SCROLL:
return com.android.internal.R.styleable.Pointer_pointerIconAllScroll;
- case STYLE_NO_DROP:
+ case TYPE_NO_DROP:
return com.android.internal.R.styleable.Pointer_pointerIconNodrop;
- case STYLE_HORIZONTAL_DOUBLE_ARROW:
+ case TYPE_HORIZONTAL_DOUBLE_ARROW:
return com.android.internal.R.styleable.Pointer_pointerIconHorizontalDoubleArrow;
- case STYLE_VERTICAL_DOUBLE_ARROW:
+ case TYPE_VERTICAL_DOUBLE_ARROW:
return com.android.internal.R.styleable.Pointer_pointerIconVerticalDoubleArrow;
- case STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW:
+ case TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW:
return com.android.internal.R.styleable.
Pointer_pointerIconTopRightDiagonalDoubleArrow;
- case STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW:
+ case TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW:
return com.android.internal.R.styleable.
Pointer_pointerIconTopLeftDiagonalDoubleArrow;
- case STYLE_ZOOM_IN:
+ case TYPE_ZOOM_IN:
return com.android.internal.R.styleable.Pointer_pointerIconZoomIn;
- case STYLE_ZOOM_OUT:
+ case TYPE_ZOOM_OUT:
return com.android.internal.R.styleable.Pointer_pointerIconZoomOut;
- case STYLE_GRAB:
+ case TYPE_GRAB:
return com.android.internal.R.styleable.Pointer_pointerIconGrab;
- case STYLE_GRABBING:
+ case TYPE_GRABBING:
return com.android.internal.R.styleable.Pointer_pointerIconGrabbing;
default:
return 0;
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 77884f6e4d77..2269282a5771 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2644,7 +2644,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
private static final int PFLAG3_POINTER_ICON_NOT_SPECIFIED = 0 << PFLAG3_POINTER_ICON_LSHIFT;
/**
- * Value indicating {@link PointerIcon.STYLE_NULL}.
+ * Value indicating {@link PointerIcon.TYPE_NULL}.
*/
private static final int PFLAG3_POINTER_ICON_NULL = 1 << PFLAG3_POINTER_ICON_LSHIFT;
@@ -4539,15 +4539,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
initializeScrollIndicators = true;
}
break;
- case R.styleable.View_pointerShape:
+ case R.styleable.View_pointerIcon:
final int resourceId = a.getResourceId(attr, 0);
if (resourceId != 0) {
- setPointerIcon(PointerIcon.loadCustomIcon(
+ setPointerIcon(PointerIcon.load(
context.getResources(), resourceId));
} else {
- final int pointerShape = a.getInt(attr, PointerIcon.STYLE_NOT_SPECIFIED);
- if (pointerShape != PointerIcon.STYLE_NOT_SPECIFIED) {
- setPointerIcon(PointerIcon.getSystemIcon(context, pointerShape));
+ final int pointerType = a.getInt(attr, PointerIcon.TYPE_NOT_SPECIFIED);
+ if (pointerType != PointerIcon.TYPE_NOT_SPECIFIED) {
+ setPointerIcon(PointerIcon.getSystemIcon(context, pointerType));
}
}
break;
@@ -21788,19 +21788,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* The default implementation does not care the location or event types, but some subclasses
* may use it (such as WebViews).
* @param event The MotionEvent from a mouse
- * @param x The x position of the event, local to the view
- * @param y The y position of the event, local to the view
+ * @param pointerIndex The index of the pointer for which to retrieve the {@link PointerIcon}.
+ * This will be between 0 and {@link MotionEvent#getPointerCount()}.
* @see PointerIcon
*/
- public PointerIcon getPointerIcon(MotionEvent event, float x, float y) {
+ public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
+ final float x = event.getX(pointerIndex);
+ final float y = event.getY(pointerIndex);
if (isDraggingScrollBar() || isOnScrollbarThumb(x, y)) {
- return PointerIcon.getSystemIcon(mContext, PointerIcon.STYLE_ARROW);
+ return PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_ARROW);
}
return mPointerIcon;
}
/**
* Set the pointer icon for the current view.
+ * Passing {@code null} will restore the pointer icon to its default value.
* @param pointerIcon A PointerIcon instance which will be shown when the mouse hovers.
*/
public void setPointerIcon(PointerIcon pointerIcon) {
@@ -21815,10 +21818,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
/**
+ * Gets the pointer icon for the current view.
+ */
+ public PointerIcon getPointerIcon() {
+ return mPointerIcon;
+ }
+
+
+ /**
* Request capturing further mouse events.
*
- * When the view captures, the mouse pointer icon will disappear and will not change its
- * position. Further mouse events will come to the capturing view, and the mouse movements
+ * When the view captures, the pointer icon will disappear and will not change its
+ * position. Further pointer events will come to the capturing view, and the pointer movements
* will can be detected through {@link MotionEvent#AXIS_RELATIVE_X} and
* {@link MotionEvent#AXIS_RELATIVE_Y}. Non-mouse events (touchscreens, or stylus) will not
* be affected.
@@ -21830,10 +21841,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @see #releasePointerCapture()
* @see #hasPointerCapture()
*/
- public void setPointerCapture() {
+ public void requestPointerCapture() {
final ViewRootImpl viewRootImpl = getViewRootImpl();
if (viewRootImpl != null) {
- viewRootImpl.setPointerCapture(this);
+ viewRootImpl.requestPointerCapture(this);
}
}
@@ -21842,7 +21853,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* Release the current capture of mouse events.
*
* If the view does not have the capture, it will do nothing.
- * @see #setPointerCapture()
+ * @see #requestPointerCapture()
* @see #hasPointerCapture()
*/
public void releasePointerCapture() {
@@ -21856,7 +21867,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* Checks the capture status of mouse events.
*
* @return true if the view has the capture.
- * @see #setPointerCapture()
+ * @see #requestPointerCapture()
* @see #hasPointerCapture()
*/
public boolean hasPointerCapture() {
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 2f23b61dd0de..3ff8d4f2e2b1 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -1712,9 +1712,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
}
@Override
- public PointerIcon getPointerIcon(MotionEvent event, float x, float y) {
+ public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
+ final float x = event.getX(pointerIndex);
+ final float y = event.getY(pointerIndex);
if (isOnScrollbarThumb(x, y) || isDraggingScrollBar()) {
- return PointerIcon.getSystemIcon(mContext, PointerIcon.STYLE_ARROW);
+ return PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_ARROW);
}
// Check what the child under the pointer says about the pointer.
final int childrenCount = mChildrenCount;
@@ -1728,7 +1730,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
final View child = getAndVerifyPreorderedView(preorderedList, children, childIndex);
final PointF point = getLocalPoint();
if (isTransformedTouchPointInView(x, y, child, point)) {
- final PointerIcon pointerIcon = child.getPointerIcon(event, point.x, point.y);
+ final PointerIcon pointerIcon =
+ dispatchResolvePointerIcon(event, pointerIndex, child);
if (pointerIcon != null) {
if (preorderedList != null) preorderedList.clear();
return pointerIcon;
@@ -1741,7 +1744,24 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
// The pointer is not a child or the child has no preferences, returning the default
// implementation.
- return super.getPointerIcon(event, x, y);
+ return super.onResolvePointerIcon(event, pointerIndex);
+ }
+
+ private PointerIcon dispatchResolvePointerIcon(MotionEvent event, int pointerIndex,
+ View child) {
+ final PointerIcon pointerIcon;
+ if (!child.hasIdentityMatrix()) {
+ MotionEvent transformedEvent = getTransformedMotionEvent(event, child);
+ pointerIcon = child.onResolvePointerIcon(transformedEvent, pointerIndex);
+ transformedEvent.recycle();
+ } else {
+ final float offsetX = mScrollX - child.mLeft;
+ final float offsetY = mScrollY - child.mTop;
+ event.offsetLocation(offsetX, offsetY);
+ pointerIcon = child.onResolvePointerIcon(event, pointerIndex);
+ event.offsetLocation(-offsetX, -offsetY);
+ }
+ return pointerIcon;
}
private int getAndVerifyPreorderedIndex(int childrenCount, int i, boolean customOrder) {
@@ -2122,17 +2142,14 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
* @return {@code true} if the child handled the event.
*/
private boolean dispatchTransformedGenericPointerEvent(MotionEvent event, View child) {
- final float offsetX = mScrollX - child.mLeft;
- final float offsetY = mScrollY - child.mTop;
-
boolean handled;
if (!child.hasIdentityMatrix()) {
- MotionEvent transformedEvent = MotionEvent.obtain(event);
- transformedEvent.offsetLocation(offsetX, offsetY);
- transformedEvent.transform(child.getInverseMatrix());
+ MotionEvent transformedEvent = getTransformedMotionEvent(event, child);
handled = child.dispatchGenericMotionEvent(transformedEvent);
transformedEvent.recycle();
} else {
+ final float offsetX = mScrollX - child.mLeft;
+ final float offsetY = mScrollY - child.mTop;
event.offsetLocation(offsetX, offsetY);
handled = child.dispatchGenericMotionEvent(event);
event.offsetLocation(-offsetX, -offsetY);
@@ -2140,6 +2157,26 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
return handled;
}
+ /**
+ * Returns a MotionEvent that's been transformed into the child's local coordinates.
+ *
+ * It's the responsibility of the caller to recycle it once they're finished with it.
+ * @param event The event to transform.
+ * @param child The view whose coordinate space is to be used.
+ * @return A copy of the the given MotionEvent, transformed into the given View's coordinate
+ * space.
+ */
+ private MotionEvent getTransformedMotionEvent(MotionEvent event, View child) {
+ final float offsetX = mScrollX - child.mLeft;
+ final float offsetY = mScrollY - child.mTop;
+ final MotionEvent transformedEvent = MotionEvent.obtain(event);
+ transformedEvent.offsetLocation(offsetX, offsetY);
+ if (!child.hasIdentityMatrix()) {
+ transformedEvent.transform(child.getInverseMatrix());
+ }
+ return transformedEvent;
+ }
+
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (mInputEventConsistencyVerifier != null) {
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 130b440dfbbd..1c6600d0b3ac 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -359,7 +359,7 @@ public final class ViewRootImpl implements ViewParent,
private long mFpsPrevTime = -1;
private int mFpsNumFrames;
- private int mPointerIconShape = PointerIcon.STYLE_NOT_SPECIFIED;
+ private int mPointerIconType = PointerIcon.TYPE_NOT_SPECIFIED;
private PointerIcon mCustomPointerIcon = null;
/**
@@ -3168,7 +3168,7 @@ public final class ViewRootImpl implements ViewParent,
}
}
- void setPointerCapture(View view) {
+ void requestPointerCapture(View view) {
if (!mAttachInfo.mHasWindowFocus) {
Log.w(mTag, "Can't set capture if it's not focused.");
return;
@@ -3178,6 +3178,7 @@ public final class ViewRootImpl implements ViewParent,
}
mCapturingView = view;
InputManager.getInstance().setPointerIconDetached(true);
+ return;
}
void releasePointerCapture(View view) {
@@ -4445,19 +4446,18 @@ public final class ViewRootImpl implements ViewParent,
}
private void maybeUpdatePointerIcon(MotionEvent event) {
- if (event.getPointerCount() == 1
- && event.isFromSource(InputDevice.SOURCE_MOUSE)) {
+ if (event.getPointerCount() == 1 && event.isFromSource(InputDevice.SOURCE_MOUSE)) {
if (event.getActionMasked() == MotionEvent.ACTION_HOVER_ENTER
|| event.getActionMasked() == MotionEvent.ACTION_HOVER_EXIT) {
- // Other apps or the window manager may change the icon shape outside of
- // this app, therefore the icon shape has to be reset on enter/exit event.
- mPointerIconShape = PointerIcon.STYLE_NOT_SPECIFIED;
+ // Other apps or the window manager may change the icon type outside of
+ // this app, therefore the icon type has to be reset on enter/exit event.
+ mPointerIconType = PointerIcon.TYPE_NOT_SPECIFIED;
}
if (event.getActionMasked() != MotionEvent.ACTION_HOVER_EXIT) {
if (!updatePointerIcon(event) &&
event.getActionMasked() == MotionEvent.ACTION_HOVER_MOVE) {
- mPointerIconShape = PointerIcon.STYLE_NOT_SPECIFIED;
+ mPointerIconType = PointerIcon.TYPE_NOT_SPECIFIED;
}
}
}
@@ -4484,13 +4484,14 @@ public final class ViewRootImpl implements ViewParent,
}
private void resetPointerIcon(MotionEvent event) {
- mPointerIconShape = PointerIcon.STYLE_NOT_SPECIFIED;
+ mPointerIconType = PointerIcon.TYPE_NOT_SPECIFIED;
updatePointerIcon(event);
}
private boolean updatePointerIcon(MotionEvent event) {
- final float x = event.getX();
- final float y = event.getY();
+ final int pointerIndex = 0;
+ final float x = event.getX(pointerIndex);
+ final float y = event.getY(pointerIndex);
if (mView == null) {
// E.g. click outside a popup to dismiss it
Slog.d(mTag, "updatePointerIcon called after view was removed");
@@ -4501,19 +4502,19 @@ public final class ViewRootImpl implements ViewParent,
Slog.d(mTag, "updatePointerIcon called with position out of bounds");
return false;
}
- final PointerIcon pointerIcon = mView.getPointerIcon(event, x, y);
- final int pointerShape = (pointerIcon != null) ?
- pointerIcon.getStyle() : PointerIcon.STYLE_DEFAULT;
+ final PointerIcon pointerIcon = mView.onResolvePointerIcon(event, pointerIndex);
+ final int pointerType = (pointerIcon != null) ?
+ pointerIcon.getType() : PointerIcon.TYPE_DEFAULT;
- if (mPointerIconShape != pointerShape) {
- mPointerIconShape = pointerShape;
- if (mPointerIconShape != PointerIcon.STYLE_CUSTOM) {
+ if (mPointerIconType != pointerType) {
+ mPointerIconType = pointerType;
+ if (mPointerIconType != PointerIcon.TYPE_CUSTOM) {
mCustomPointerIcon = null;
- InputManager.getInstance().setPointerIconShape(pointerShape);
+ InputManager.getInstance().setPointerIconType(pointerType);
return true;
}
}
- if (mPointerIconShape == PointerIcon.STYLE_CUSTOM &&
+ if (mPointerIconType == PointerIcon.TYPE_CUSTOM &&
!pointerIcon.equals(mCustomPointerIcon)) {
mCustomPointerIcon = pointerIcon;
InputManager.getInstance().setCustomPointerIcon(mCustomPointerIcon);
diff --git a/core/java/android/view/accessibility/AccessibilityCache.java b/core/java/android/view/accessibility/AccessibilityCache.java
index 1da305f09f54..28e31c4c7aa8 100644
--- a/core/java/android/view/accessibility/AccessibilityCache.java
+++ b/core/java/android/view/accessibility/AccessibilityCache.java
@@ -221,8 +221,11 @@ final class AccessibilityCache {
sortedWindows.put(window.getLayer(), window);
}
- List<AccessibilityWindowInfo> windows = new ArrayList<>(windowCount);
- for (int i = windowCount - 1; i >= 0; i--) {
+ // It's possible in transient conditions for two windows to share the same
+ // layer, which results in sortedWindows being smaller than mWindowCache
+ final int sortedWindowCount = sortedWindows.size();
+ List<AccessibilityWindowInfo> windows = new ArrayList<>(sortedWindowCount);
+ for (int i = sortedWindowCount - 1; i >= 0; i--) {
AccessibilityWindowInfo window = sortedWindows.valueAt(i);
windows.add(AccessibilityWindowInfo.obtain(window));
sortedWindows.removeAt(i);
diff --git a/core/java/android/widget/Chronometer.java b/core/java/android/widget/Chronometer.java
index 3421790894ed..d74fa8cc3081 100644
--- a/core/java/android/widget/Chronometer.java
+++ b/core/java/android/widget/Chronometer.java
@@ -130,6 +130,7 @@ public class Chronometer extends TextView {
@android.view.RemotableViewMethod
public void setCountDown(boolean countDown) {
mCountDown = countDown;
+ updateText(SystemClock.elapsedRealtime());
}
/**
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 39093079851b..a3eed70c47b6 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -6005,19 +6005,21 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
@Override
- public PointerIcon getPointerIcon(MotionEvent event, float x, float y) {
+ public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
if (mText instanceof Spannable && mLinksClickable) {
+ final float x = event.getX(pointerIndex);
+ final float y = event.getY(pointerIndex);
final int offset = getOffsetForPosition(x, y);
final ClickableSpan[] clickables = ((Spannable) mText).getSpans(offset, offset,
ClickableSpan.class);
if (clickables.length > 0) {
- return PointerIcon.getSystemIcon(mContext, PointerIcon.STYLE_HAND);
+ return PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_HAND);
}
}
if (isTextSelectable() || isTextEditable()) {
- return PointerIcon.getSystemIcon(mContext, PointerIcon.STYLE_TEXT);
+ return PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_TEXT);
}
- return super.getPointerIcon(event, x, y);
+ return super.onResolvePointerIcon(event, pointerIndex);
}
@Override
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 937fc75046cb..93dc625f8846 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -8873,8 +8873,6 @@ public class BatteryStatsImpl extends BatteryStats {
return;
}
- // Record whether we've seen a non-zero time (for debugging b/22716723).
- boolean seenNonZeroTime = false;
for (Map.Entry<String, KernelWakelockStats.Entry> ent : wakelockStats.entrySet()) {
String name = ent.getKey();
KernelWakelockStats.Entry kws = ent.getValue();
@@ -8884,27 +8882,24 @@ public class BatteryStatsImpl extends BatteryStats {
kwlt = new SamplingTimer(mClocks, mOnBatteryScreenOffTimeBase);
mKernelWakelockStats.put(name, kwlt);
}
+
kwlt.update(kws.mTotalTime, kws.mCount);
kwlt.setUpdateVersion(kws.mVersion);
-
- if (kws.mVersion != wakelockStats.kernelWakelockVersion) {
- seenNonZeroTime |= kws.mTotalTime > 0;
- }
}
int numWakelocksSetStale = 0;
- if (wakelockStats.size() != mKernelWakelockStats.size()) {
- // Set timers to stale if they didn't appear in /proc/wakelocks this time.
- for (Map.Entry<String, SamplingTimer> ent : mKernelWakelockStats.entrySet()) {
- SamplingTimer st = ent.getValue();
- if (st.getUpdateVersion() != wakelockStats.kernelWakelockVersion) {
- st.endSample();
- numWakelocksSetStale++;
- }
+ // Set timers to stale if they didn't appear in /d/wakeup_sources (or /proc/wakelocks)
+ // this time.
+ for (Map.Entry<String, SamplingTimer> ent : mKernelWakelockStats.entrySet()) {
+ SamplingTimer st = ent.getValue();
+ if (st.getUpdateVersion() != wakelockStats.kernelWakelockVersion) {
+ st.endSample();
+ numWakelocksSetStale++;
}
}
- if (!seenNonZeroTime) {
+ // Record whether we've seen a non-zero time (for debugging b/22716723).
+ if (wakelockStats.isEmpty()) {
Slog.wtf(TAG, "All kernel wakelocks had time of zero");
}
diff --git a/core/java/com/android/internal/os/KernelWakelockReader.java b/core/java/com/android/internal/os/KernelWakelockReader.java
index 6654ea5683e3..8036f257823b 100644
--- a/core/java/com/android/internal/os/KernelWakelockReader.java
+++ b/core/java/com/android/internal/os/KernelWakelockReader.java
@@ -18,6 +18,8 @@ package com.android.internal.os;
import android.os.Process;
import android.util.Slog;
+import com.android.internal.annotations.VisibleForTesting;
+
import java.io.FileInputStream;
import java.util.Iterator;
@@ -106,14 +108,14 @@ public class KernelWakelockReader {
/**
* Reads the wakelocks and updates the staleStats with the new information.
*/
- private KernelWakelockStats parseProcWakelocks(byte[] wlBuffer, int len, boolean wakeup_sources,
- final KernelWakelockStats staleStats) {
+ @VisibleForTesting
+ public KernelWakelockStats parseProcWakelocks(byte[] wlBuffer, int len, boolean wakeup_sources,
+ final KernelWakelockStats staleStats) {
String name;
int count;
long totalTime;
int startIndex;
int endIndex;
- int numUpdatedWlNames = 0;
// Advance past the first line.
int i;
@@ -126,11 +128,10 @@ public class KernelWakelockReader {
for (endIndex=startIndex;
endIndex < len && wlBuffer[endIndex] != '\n' && wlBuffer[endIndex] != '\0';
endIndex++);
- endIndex++; // endIndex is an exclusive upper bound.
// Don't go over the end of the buffer, Process.parseProcLine might
// write to wlBuffer[endIndex]
- if (endIndex >= (len - 1) ) {
- return staleStats;
+ if (endIndex > (len - 1) ) {
+ break;
}
String[] nameStringArray = mProcWakelocksName;
@@ -161,7 +162,6 @@ public class KernelWakelockReader {
if (!staleStats.containsKey(name)) {
staleStats.put(name, new KernelWakelockStats.Entry(count, totalTime,
sKernelWakelockUpdateVersion));
- numUpdatedWlNames++;
} else {
KernelWakelockStats.Entry kwlStats = staleStats.get(name);
if (kwlStats.mVersion == sKernelWakelockUpdateVersion) {
@@ -171,7 +171,6 @@ public class KernelWakelockReader {
kwlStats.mCount = count;
kwlStats.mTotalTime = totalTime;
kwlStats.mVersion = sKernelWakelockUpdateVersion;
- numUpdatedWlNames++;
}
}
} else if (!parsed) {
@@ -182,16 +181,14 @@ public class KernelWakelockReader {
Slog.wtf(TAG, "Failed to parse proc line!");
}
}
- startIndex = endIndex;
+ startIndex = endIndex + 1;
}
- if (staleStats.size() != numUpdatedWlNames) {
- // Don't report old data.
- Iterator<KernelWakelockStats.Entry> itr = staleStats.values().iterator();
- while (itr.hasNext()) {
- if (itr.next().mVersion != sKernelWakelockUpdateVersion) {
- itr.remove();
- }
+ // Don't report old data.
+ Iterator<KernelWakelockStats.Entry> itr = staleStats.values().iterator();
+ while (itr.hasNext()) {
+ if (itr.next().mVersion != sKernelWakelockUpdateVersion) {
+ itr.remove();
}
}
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index a3e41e47b267..9c960c04d491 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -22,12 +22,16 @@ import static android.system.OsConstants.S_IRWXO;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.icu.impl.CacheValue;
+import android.icu.text.DecimalFormatSymbols;
+import android.icu.util.ULocale;
import android.net.LocalServerSocket;
import android.opengl.EGL14;
import android.os.Process;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.Trace;
+import android.security.keystore.AndroidKeyStoreProvider;
import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
@@ -186,6 +190,9 @@ public class ZygoteInit {
static void preload() {
Log.d(TAG, "begin preload");
+ Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "BeginIcuCachePinning");
+ beginIcuCachePinning();
+ Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadClasses");
preloadClasses();
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
@@ -200,10 +207,34 @@ public class ZygoteInit {
// Ask the WebViewFactory to do any initialization that must run in the zygote process,
// for memory sharing purposes.
WebViewFactory.prepareWebViewInZygote();
+ endIcuCachePinning();
warmUpJcaProviders();
Log.d(TAG, "end preload");
}
+ private static void beginIcuCachePinning() {
+ // Pin ICU data in memory from this point that would normally be held by soft references.
+ // Without this, any references created immediately below or during class preloading
+ // would be collected when the Zygote GC runs in gcAndFinalize().
+ Log.i(TAG, "Installing ICU cache reference pinning...");
+
+ CacheValue.setStrength(CacheValue.Strength.STRONG);
+
+ Log.i(TAG, "Preloading ICU data...");
+ // Explicitly exercise code to cache data apps are likely to need.
+ ULocale[] localesToPin = { ULocale.ROOT, ULocale.US, ULocale.getDefault() };
+ for (ULocale uLocale : localesToPin) {
+ new DecimalFormatSymbols(uLocale);
+ }
+ }
+
+ private static void endIcuCachePinning() {
+ // All cache references created by ICU from this point will be soft.
+ CacheValue.setStrength(CacheValue.Strength.SOFT);
+
+ Log.i(TAG, "Uninstalled ICU cache reference pinning...");
+ }
+
private static void preloadSharedLibraries() {
Log.i(TAG, "Preloading shared libraries...");
System.loadLibrary("android");
@@ -223,7 +254,7 @@ public class ZygoteInit {
}
/**
- * Warm up the providers that are already registered.
+ * Register AndroidKeyStoreProvider and warm up the providers that are already registered.
*
* By doing it here we avoid that each app does it when requesting a service from the
* provider for the first time.
@@ -231,12 +262,23 @@ public class ZygoteInit {
private static void warmUpJcaProviders() {
long startTime = SystemClock.uptimeMillis();
Trace.traceBegin(
+ Trace.TRACE_TAG_DALVIK, "Starting installation of AndroidKeyStoreProvider");
+ // AndroidKeyStoreProvider.install() manipulates the list of JCA providers to insert
+ // preferred providers. Note this is not done via security.properties as the JCA providers
+ // are not on the classpath in the case of, for example, raw dalvikvm runtimes.
+ AndroidKeyStoreProvider.install();
+ Log.i(TAG, "Installed AndroidKeyStoreProvider in "
+ + (SystemClock.uptimeMillis() - startTime) + "ms.");
+ Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
+
+ startTime = SystemClock.uptimeMillis();
+ Trace.traceBegin(
Trace.TRACE_TAG_DALVIK, "Starting warm up of JCA providers");
for (Provider p : Security.getProviders()) {
p.warmUpServiceProvision();
}
Log.i(TAG, "Warmed up JCA providers in "
- + (SystemClock.uptimeMillis()-startTime) + "ms.");
+ + (SystemClock.uptimeMillis() - startTime) + "ms.");
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
}
diff --git a/core/jni/android_view_PointerIcon.cpp b/core/jni/android_view_PointerIcon.cpp
index 71be52e52e57..6b634dfbef3e 100644
--- a/core/jni/android_view_PointerIcon.cpp
+++ b/core/jni/android_view_PointerIcon.cpp
@@ -32,7 +32,7 @@ namespace android {
static struct {
jclass clazz;
- jfieldID mStyle;
+ jfieldID mType;
jfieldID mBitmap;
jfieldID mHotSpotX;
jfieldID mHotSpotY;
@@ -78,7 +78,7 @@ status_t android_view_PointerIcon_load(JNIEnv* env, jobject pointerIconObj, jobj
status_t android_view_PointerIcon_getLoadedIcon(JNIEnv* env, jobject pointerIconObj,
PointerIcon* outPointerIcon) {
- outPointerIcon->style = env->GetIntField(pointerIconObj, gPointerIconClassInfo.mStyle);
+ outPointerIcon->style = env->GetIntField(pointerIconObj, gPointerIconClassInfo.mType);
outPointerIcon->hotSpotX = env->GetFloatField(pointerIconObj, gPointerIconClassInfo.mHotSpotX);
outPointerIcon->hotSpotY = env->GetFloatField(pointerIconObj, gPointerIconClassInfo.mHotSpotY);
@@ -128,8 +128,8 @@ int register_android_view_PointerIcon(JNIEnv* env) {
gPointerIconClassInfo.mBitmap = GetFieldIDOrDie(env, gPointerIconClassInfo.clazz,
"mBitmap", "Landroid/graphics/Bitmap;");
- gPointerIconClassInfo.mStyle = GetFieldIDOrDie(env, gPointerIconClassInfo.clazz,
- "mStyle", "I");
+ gPointerIconClassInfo.mType = GetFieldIDOrDie(env, gPointerIconClassInfo.clazz,
+ "mType", "I");
gPointerIconClassInfo.mHotSpotX = GetFieldIDOrDie(env, gPointerIconClassInfo.clazz,
"mHotSpotX", "F");
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 6af9ef2271fa..d12e34c1cb10 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2796,7 +2796,7 @@ i
<flag name="end" value="0x20" />
</attr>
- <attr name="pointerShape">
+ <attr name="pointerIcon">
<!-- Null icon, pointer becomes invisible. -->
<enum name="none" value="0" />
<!-- The default icon of arrow pointer. -->
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 97b04e2380dd..6c4340ad2349 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -2281,7 +2281,7 @@
activities launched in the task. That is if the root activity of a task set minimal width,
then the system will set the same minimal width on all other activities in the task. It
will also ignore any other minimal width attributes of non-root activities. -->
- <attr name="minWidth" format="dimension" />
+ <attr name="minWidth" />
<!-- @removed -->
<attr name="minimalWidth" format="dimension" />
<!-- Minimal height of the activity.
@@ -2290,7 +2290,7 @@
activities launched in the task. That is if the root activity of a task set minimal height,
then the system will set the same minimal height on all other activities in the task. It
will also ignore any other minimal height attributes of non-root activities. -->
- <attr name="minHeight" format="dimension" />
+ <attr name="minHeight" />
<!-- @removed -->
<attr name="minimalHeight" format="dimension" />
</declare-styleable>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 3cd3d474f34c..ac4818457053 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2685,7 +2685,7 @@
<public type="attr" name="preferenceFragmentStyle" />
<public type="attr" name="canControlMagnification" />
<public type="attr" name="languageTag" />
- <public type="attr" name="pointerShape" />
+ <public type="attr" name="pointerIcon" />
<public type="attr" name="tickMark" />
<public type="attr" name="tickMarkTint" />
<public type="attr" name="tickMarkTintMode" />
diff --git a/core/tests/coretests/src/com/android/internal/os/KernelWakelockReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelWakelockReaderTest.java
new file mode 100644
index 000000000000..4e4bb350739d
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/os/KernelWakelockReaderTest.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.android.internal.os;
+
+import android.support.test.filters.SmallTest;
+
+import junit.framework.TestCase;
+
+import java.nio.charset.Charset;
+
+public class KernelWakelockReaderTest extends TestCase {
+ /**
+ * Helper class that builds the mock Kernel module file /d/wakeup_sources.
+ */
+ private static class ProcFileBuilder {
+ private final static String sHeader = "name\t\tactive_count\tevent_count\twakeup_count\t" +
+ "expire_count\tactive_since\ttotal_time\tmax_time\tlast_change\t" +
+ "prevent_suspend_time\n";
+
+ private StringBuilder mStringBuilder;
+
+ private void ensureHeader() {
+ if (mStringBuilder == null) {
+ mStringBuilder = new StringBuilder();
+ mStringBuilder.append(sHeader);
+ }
+ }
+
+ public ProcFileBuilder addLine(String name, int count, long timeMillis) {
+ ensureHeader();
+ mStringBuilder.append(name).append("\t").append(count).append("\t0\t0\t0\t0\t")
+ .append(timeMillis).append("\t0\t0\t0\n");
+ return this;
+ }
+
+ public byte[] getBytes() throws Exception {
+ ensureHeader();
+ byte[] data = mStringBuilder.toString().getBytes(Charset.forName("UTF-8"));
+
+ // The Kernel puts a \0 at the end of the data. Since each of our lines ends with \n,
+ // we override the last \n with a \0.
+ data[data.length - 1] = 0;
+ return data;
+ }
+ }
+
+ private KernelWakelockReader mReader;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ mReader = new KernelWakelockReader();
+ }
+
+ @SmallTest
+ public void testParseEmptyFile() throws Exception {
+ KernelWakelockStats staleStats = mReader.parseProcWakelocks(new byte[0], 0, true,
+ new KernelWakelockStats());
+ assertTrue(staleStats.isEmpty());
+ }
+
+ @SmallTest
+ public void testOnlyHeader() throws Exception {
+ byte[] buffer = new ProcFileBuilder().getBytes();
+ KernelWakelockStats staleStats = mReader.parseProcWakelocks(buffer, buffer.length, true,
+ new KernelWakelockStats());
+ assertTrue(staleStats.isEmpty());
+ }
+
+ @SmallTest
+ public void testOneWakelock() throws Exception {
+ byte[] buffer = new ProcFileBuilder()
+ .addLine("Wakelock", 34, 123) // Milliseconds
+ .getBytes();
+ KernelWakelockStats staleStats = mReader.parseProcWakelocks(buffer, buffer.length, true,
+ new KernelWakelockStats());
+ assertEquals(1, staleStats.size());
+ assertTrue(staleStats.containsKey("Wakelock"));
+
+ KernelWakelockStats.Entry entry = staleStats.get("Wakelock");
+ assertEquals(34, entry.mCount);
+ assertEquals(123 * 1000, entry.mTotalTime); // Microseconds
+ }
+
+ @SmallTest
+ public void testTwoWakelocks() throws Exception {
+ byte[] buffer = new ProcFileBuilder()
+ .addLine("Wakelock", 1, 10)
+ .addLine("Fakelock", 2, 20)
+ .getBytes();
+ KernelWakelockStats staleStats = mReader.parseProcWakelocks(buffer, buffer.length, true,
+ new KernelWakelockStats());
+ assertEquals(2, staleStats.size());
+ assertTrue(staleStats.containsKey("Wakelock"));
+ assertTrue(staleStats.containsKey("Fakelock"));
+ }
+
+ @SmallTest
+ public void testDuplicateWakelocksAccumulate() throws Exception {
+ byte[] buffer = new ProcFileBuilder()
+ .addLine("Wakelock", 1, 10) // Milliseconds
+ .addLine("Wakelock", 1, 10) // Milliseconds
+ .getBytes();
+ KernelWakelockStats staleStats = mReader.parseProcWakelocks(buffer, buffer.length, true,
+ new KernelWakelockStats());
+ assertEquals(1, staleStats.size());
+ assertTrue(staleStats.containsKey("Wakelock"));
+
+ KernelWakelockStats.Entry entry = staleStats.get("Wakelock");
+ assertEquals(2, entry.mCount);
+ assertEquals(20 * 1000, entry.mTotalTime); // Microseconds
+ }
+
+ @SmallTest
+ public void testWakelocksBecomeStale() throws Exception {
+ byte[] buffer = new ProcFileBuilder()
+ .addLine("Fakelock", 3, 30)
+ .getBytes();
+ KernelWakelockStats staleStats = new KernelWakelockStats();
+
+ staleStats = mReader.parseProcWakelocks(buffer, buffer.length, true, staleStats);
+ assertEquals(1, staleStats.size());
+ assertTrue(staleStats.containsKey("Fakelock"));
+
+ buffer = new ProcFileBuilder()
+ .addLine("Wakelock", 1, 10)
+ .getBytes();
+
+ staleStats = mReader.parseProcWakelocks(buffer, buffer.length, true, staleStats);
+ assertEquals(1, staleStats.size());
+ assertTrue(staleStats.containsKey("Wakelock"));
+ assertFalse(staleStats.containsKey("Fakelock"));
+ }
+}
diff --git a/docs/html/about/dashboards/index.jd b/docs/html/about/dashboards/index.jd
index 31e37bf06895..f4a03dbddfa2 100644
--- a/docs/html/about/dashboards/index.jd
+++ b/docs/html/about/dashboards/index.jd
@@ -384,7 +384,7 @@ $(document).ready(function(){
});
// create chart image
- var $chart = $('<img style="margin-left:30px" alt="" src="' + set.chart + '" />');
+ var $chart = $('<img style="margin-left:30px" alt="" data-dac-src="' + set.chart + '" />');
// stack up and insert the elements
$divtable.append($table);
@@ -451,9 +451,9 @@ $(document).ready(function(){
$table.append($tr);
// create charts
- var $sizechart = $('<img style="float:left;width:380px" alt="" src="'
+ var $sizechart = $('<img style="float:left;width:380px" alt="" data-dac-src="'
+ set.layoutchart + '" />');
- var $densitychart = $('<img style="float:left;width:380px" alt="" src="'
+ var $densitychart = $('<img style="float:left;width:380px" alt="" data-dac-src="'
+ set.densitychart + '" />');
// stack up and insert the elements
@@ -461,6 +461,16 @@ $(document).ready(function(){
$("#screens-chart").append($div);
});
+ // TODO (akassay): Remove this.
+ // I replaced the src attributes in the javascript above with data-dac-src
+ // so the value would not be molested by the DevSite parser. So this code here
+ // moves that src value into a real src attribute at runtime. This should be
+ // removed once we either move this script out of the content body or update
+ // the parser to not modify src attributes in <script> tags.
+ $('img[data-dac-src]').each(function() {
+ var src = $(this).attr('data-dac-src');
+ $(this).attr('src', src);
+ });
});
diff --git a/docs/html/google/index.jd b/docs/html/google/index.jd
index b3ceee3daf13..027ba23a6e5b 100644
--- a/docs/html/google/index.jd
+++ b/docs/html/google/index.jd
@@ -50,42 +50,6 @@ footer.hide=1
</div>
</section>
-<section class="dac-section dac-light"><div class="wrap">
- <h1 class="dac-section-title">Google APIs and services</h1>
- <div class="dac-section-subtitle">
- Add the latest Google-powered features to enrich your app,
- grow your user base, and monetize.
- </div>
- <div class="resource-widget resource-flow-layout col-16"
- data-query="collection:google/landing/services"
- data-cardSizes="6x6"
- data-maxResults="6"></div>
- <ul class="dac-section-links">
- <li class="dac-section-link"><a href="https://developers.google.com/android/">
- <span class="dac-sprite dac-auto-chevron"></span>
- More Google services for Android
- </a></li>
- </ul>
- </div>
-</section>
-
-<section class="dac-section dac-gray dac-small" id="videos"><div class="wrap">
- <h2 class="norule">Videos</h2>
- <div class="resource-widget resource-flow-layout col-16"
- data-query="collection:google/landing/videos"
- data-sortOrder="-timestamp"
- data-cardSizes="6x6"
- data-maxResults="3"></div>
- </div>
- <ul class="dac-section-links">
- <li class="dac-section-link"><a href="https://www.youtube.com/playlist?list=PLWz5rJ2EKKc9Qk1_iCZNbBp6adYnJf9Vf">
- <span class="dac-sprite dac-auto-chevron"></span>
- Playlist
- </a></li>
- </ul>
-
-</section>
-
<section class="dac-section dac-invert dac-darken-bg" style="background-image: url(/images/distribute/google-play-bg.jpg)"><div class="wrap">
<h1 class="dac-section-title">Google Play developer tools</h1>
<div class="dac-section-subtitle">
diff --git a/docs/html/google/play/billing/billing_integrate.jd b/docs/html/google/play/billing/billing_integrate.jd
index 8ffb45cb92d7..e666bc67c0af 100755
--- a/docs/html/google/play/billing/billing_integrate.jd
+++ b/docs/html/google/play/billing/billing_integrate.jd
@@ -150,8 +150,8 @@ method calls.</p>
</p>
<p>
- To give your app the necessary permission, add this line in your {@code
- Android.xml} manifest file:
+ To give your app the necessary permission, add this line in the {@code
+ AndroidManifest.xml} file:
</p>
<pre>
diff --git a/docs/html/guide/topics/graphics/hardware-accel.jd b/docs/html/guide/topics/graphics/hardware-accel.jd
index ca7255bdf6a8..b82c56b05721 100644
--- a/docs/html/guide/topics/graphics/hardware-accel.jd
+++ b/docs/html/guide/topics/graphics/hardware-accel.jd
@@ -327,30 +327,6 @@ changed.</li>
<td class="value_pos">18</td>
</tr>
<tr>
- <td class="label_pos">drawArc()</td>
- <td class="value_pos">21</td>
- </tr>
- <tr>
- <td class="label_pos">drawRoundRect()</td>
- <td class="value_pos">21</td>
- </tr>
- <tr>
- <td class="label_pos">saveLayer() with RectF dimensions</td>
- <td class="value_pos">21</td>
- </tr>
- <tr>
- <td class="label_pos">saveLayer() with float dimensions</td>
- <td class="value_pos">21</td>
- </tr>
- <tr>
- <td class="label_pos">saveLayerAlpha() with RectF dimensions</td>
- <td class="value_pos">21</td>
- </tr>
- <tr>
- <td class="label_pos">saveLayerAlpha() with float dimensions</td>
- <td class="value_pos">21</td>
- </tr>
- <tr>
<td colspan="5" class="s5">Paint</td>
</tr>
<tr>
@@ -398,26 +374,6 @@ changed.</li>
<td class="value_neg">&#10007;</td>
</tr>
<tr>
- <td class="label_pos">getFontFeatureSettings()</td>
- <td class="value_pos">21</td>
- </tr>
- <tr>
- <td class="label_pos">isElegantTextHeight()</td>
- <td class="value_pos">21</td>
- </tr>
- <tr>
- <td class="label_pos">isElegantTextHeight()</td>
- <td class="value_pos">21</td>
- </tr>
- <tr>
- <td class="label_pos">setFontFeatureSettings()</td>
- <td class="value_pos">21</td>
- </tr>
- <tr>
- <td class="label_pos">setLetterSpacing()</td>
- <td class="value_pos">21</td>
- </tr>
- <tr>
<td colspan="5" class="s5">Xfermode</td>
</tr>
<tr>
diff --git a/docs/html/jd_collections.js b/docs/html/jd_collections.js
index 26231bea68c7..4909206d64d7 100644
--- a/docs/html/jd_collections.js
+++ b/docs/html/jd_collections.js
@@ -744,6 +744,14 @@ var RESOURCE_COLLECTIONS = {
"https://developers.google.com/app-indexing/"
]
},
+ "distribute/users/knowyouruser": {
+ "title": "",
+ "resources": [
+ "distribute/essentials/optimizing-your-app.html",
+ "http://www.youtube.com/watch?v=RRelFvc6Czo",
+ "distribute/stories/games/rvappstudios-zombie.html"
+ ]
+ },
"distribute/users/promotewithads": {
"title": "",
"resources": [
diff --git a/docs/html/jd_extras.js b/docs/html/jd_extras.js
index 13a51b1a9147..546fcfe479f6 100644
--- a/docs/html/jd_extras.js
+++ b/docs/html/jd_extras.js
@@ -2251,6 +2251,19 @@ DISTRIBUTE_RESOURCES = DISTRIBUTE_RESOURCES.concat([
"lang": "en",
"group": "",
"tags": [],
+ "url": "http://www.youtube.com/watch?v=RRelFvc6Czo",
+ "timestamp": null,
+ "image": "https://i1.ytimg.com/vi/RRelFvc6Czo/maxresdefault.jpg",
+ "title": "Android Developer Story: Smule",
+ "summary": "The creators of AutoRap, Magic Piano, and Songify talk about their experiences launching on Android and the explosive global growth they've seen on Google Play.",
+ "keywords": ["success", "users"],
+ "type": "video",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [],
"url": "https://developers.google.com/analytics/solutions/mobile-implementation-guide",
"timestamp": null,
"image": "images/cards/analytics-mobile_2x.jpg",
diff --git a/docs/html/jd_extras_en.js b/docs/html/jd_extras_en.js
index 02e6a2ffa65b..c85ef7e9e1ac 100644
--- a/docs/html/jd_extras_en.js
+++ b/docs/html/jd_extras_en.js
@@ -89,7 +89,7 @@ METADATA['en'].extras = METADATA['en'].extras.concat([
},
{
"title":"Network Monitor",
- "summary":"The Network Monitor makes it possible to track when your application is making network requests. Using this tool, you can monitor how and when your app transfers data, and optimize the underlying code appropriately. By monitoring the frequency of data\u2026",
+ "summary":"Use the Network Monitor to analyze network requests, including how and when your app transfers data. Preserve battery life by optimizing network use.",
"url":"studio/profile/am-network.html",
"image":"images/tools/thumbnails/am-networkmon.png",
"type":"studio",
@@ -99,7 +99,7 @@ METADATA['en'].extras = METADATA['en'].extras.concat([
},
{
"title":"Memory Monitor",
- "summary":"Android Studio provides a Memory Monitor so you can more easily monitor app performance and memory usage to find deallocated objects, locate memory leaks, and track the amount of memory the connected device is using. The Memory Monitor reports how your\u2026",
+ "summary":"Use the Memory Monitor to evaluate memory usage and find deallocated objects, locate memory leaks, and track the amount of memory the connected device is using.",
"url":"studio/profile/am-memory.html",
"image":"images/tools/thumbnails/am-memorymon.png",
"type":"studio",
@@ -118,7 +118,7 @@ METADATA['en'].extras = METADATA['en'].extras.concat([
},
{
"title":"CPU Monitor",
- "summary":"The CPU Monitor lets you easily monitor the central processing unit (CPU) usage of your app. It displays CPU usage in real time and displays the percentage of total CPU time (including all cores) used by user and kernel mode. In user mode, the code must\u2026",
+ "summary":"Use the CPU Monitor to display CPU usage in real time and the percentage of total CPU time (including all cores) used in user and kernel mode.",
"url":"studio/profile/am-cpu.html",
"image":"images/tools/thumbnails/am-cpumon.png",
"type":"studio",
@@ -137,7 +137,7 @@ METADATA['en'].extras = METADATA['en'].extras.concat([
},
{
"title":"logcat Monitor",
- "summary":"The Android logging system provides a mechanism for collecting and viewing system debug output. logcat Monitor displays messages that you added to your app by using the Log class, as well as system messages, such as stack traces when the emulator throws\u2026",
+ "summary":"Use the logcat Monitor to view system and user-defined log messages. You can filter the messages to display just the items that interest you.",
"url":"studio/debug/am-logcat.html",
"image":"images/tools/thumbnails/am-logcatmon2.png",
"type":"studio",
@@ -147,7 +147,7 @@ METADATA['en'].extras = METADATA['en'].extras.concat([
},
{
"title":"GPU Monitor",
- "summary":"The GPU Monitor gives you a quick visual representation of how much time it takes to render the frames of a UI window. It profiles the amount of time it takes for the render thread to prepare, process, and execute the draw commands. The GPU Monitor can\u2026",
+ "summary":"Use the GPU Monitor for a visual representation of how much time it takes to render the frames of a UI window. Use this information to optimize the code that displays graphics and conserve memory.",
"url":"studio/profile/am-gpu.html",
"image":"images/tools/thumbnails/am-gpumon.png",
"type":"studio",
@@ -2213,6 +2213,19 @@ METADATA['en'].extras = METADATA['en'].extras.concat([
"lang": "en",
"group": "",
"tags": [],
+ "url": "http://www.youtube.com/watch?v=RRelFvc6Czo",
+ "timestamp": null,
+ "image": "https://i1.ytimg.com/vi/RRelFvc6Czo/maxresdefault.jpg",
+ "title": "Android Developer Story: Smule",
+ "summary": "The creators of AutoRap, Magic Piano, and Songify talk about their experiences launching on Android and the explosive global growth they've seen on Google Play.",
+ "keywords": ["success", "users"],
+ "type": "video",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [],
"url": "https://developers.google.com/analytics/solutions/mobile-implementation-guide",
"timestamp": null,
"image": "images/cards/analytics-mobile_2x.jpg",
@@ -3935,26 +3948,6 @@ METADATA['en'].collections = {
"https://www.youtube.com/watch?v=5Be2mJzP-Uw&list=PLWz5rJ2EKKc9e0d55YHgJFHXNZbGHEXJX"
]
},
- "google/landing/services": {
- "title": "",
- "resources": [
- "https://developers.google.com/analytics/devguides/collection/android/",
- "https://developers.google.com/maps/documentation/android/",
- "https://developers.google.com/identity/sign-in/android/",
- "https://developers.google.com/mobile-ads-sdk/download",
- "https://developers.google.com/cloud-messaging/gcm",
- "https://developers.google.com/app-indexing/"
- ]
- },
- "google/landing/videos": {
- "title": "",
- "resources": [
- "https://www.youtube.com/watch?v=M3Udfu6qidk&list=PLWz5rJ2EKKc9Qk1_iCZNbBp6adYnJf9Vf",
- "https://www.youtube.com/watch?v=FOn64iqlphk&list=PLWz5rJ2EKKc9Qk1_iCZNbBp6adYnJf9Vf",
- "https://www.youtube.com/watch?v=F0Kh_RnSM0w&list=PLWz5rJ2EKKc9Qk1_iCZNbBp6adYnJf9Vf",
- "https://www.youtube.com/watch?v=fvtMtfCuEpw&list=PLWz5rJ2EKKc9Qk1_iCZNbBp6adYnJf9Vf"
- ]
- },
"google/landing/googleplay": {
"title": "",
"resources": [
@@ -4405,6 +4398,14 @@ METADATA['en'].collections = {
"https://developers.google.com/app-indexing/"
]
},
+ "distribute/users/knowyouruser": {
+ "title": "",
+ "resources": [
+ "distribute/essentials/optimizing-your-app.html",
+ "http://www.youtube.com/watch?v=RRelFvc6Czo",
+ "distribute/stories/games/rvappstudios-zombie.html"
+ ]
+ },
"distribute/users/promotewithads": {
"title": "",
"resources": [
diff --git a/docs/html/preview/api-overview.jd b/docs/html/preview/api-overview.jd
index c643dc711386..ab2b5ba2314e 100644
--- a/docs/html/preview/api-overview.jd
+++ b/docs/html/preview/api-overview.jd
@@ -824,9 +824,9 @@ specify how user CAs should be trusted.</p>
<p>
For more information, read the Android Studio documents that describe how to
- <a href="{@docRoot}studio/tools/publishing/app-signing.html#release-mode">
+ <a href="{@docRoot}studio/publish/app-signing.html#release-mode">
sign an app</a> in Android Studio and how to <a href=
- "{@docRoot}studio/tools/building/configuring-gradle.html#signing"> configure
+ "{@docRoot}studio/build/build-variants.html#signing"> configure
the build file for signing apps</a> using the Android Plugin for Gradle.
</p>
diff --git a/docs/html/preview/download.jd b/docs/html/preview/download.jd
index b4f7e4696353..b5405c7c934d 100644
--- a/docs/html/preview/download.jd
+++ b/docs/html/preview/download.jd
@@ -371,6 +371,15 @@ This is the Android SDK Preview License Agreement (the “License Agreement”).
</td>
</tr>
+ <tr id="xperia">
+ <td>Sony Xperia Z3 <br> (D6603 and D6653)</td>
+ <td>Download: <a class="external-link"
+ href="http://support.sonymobile.com/xperiaz3/tools/xperia-companion/">Xperia Companion</a><br>
+ For more information, see <a class="external-link"
+ href="https://developer.sony.com/develop/smartphones-and-tablets/android-n-developer-preview/">Try Android N Developer Preview for Xperia Z3</a>.
+ </td>
+ </tr>
+
</table>
<h3 id="revertDevice">Uninstalling the Preview from a device</h3>
diff --git a/docs/html/preview/features/afw.jd b/docs/html/preview/features/afw.jd
index dc53bd977f2f..9b94c079cb92 100644
--- a/docs/html/preview/features/afw.jd
+++ b/docs/html/preview/features/afw.jd
@@ -515,7 +515,7 @@ Android N.</p>
<p>
The dialer should check for the new flag
- <code>android.telecom.Call.PROPERTY_WORK_CALL</code> to determine if a call
+ <code>android.telecom.Call.PROPERTY_ENTERPRISE_CALL</code> to determine if a call
is a work call. If a call is a work call, the dialer should indicate this,
such as by adding a work badge.
</p>
diff --git a/docs/html/wear/preview/features/complications.jd b/docs/html/wear/preview/features/complications.jd
index a0157de10ffe..d33fd2a789e5 100644
--- a/docs/html/wear/preview/features/complications.jd
+++ b/docs/html/wear/preview/features/complications.jd
@@ -370,13 +370,13 @@ METADATA_KEY_PROVIDER_CONFIG_ACTION
<table>
<tr>
- <th>
+ <th style="width:175px">
Type
</th>
- <th>
+ <th style="width:175px">
Required fields
</th>
- <th>
+ <th style="width:175px">
Optional fields
</th>
<th>
@@ -491,13 +491,13 @@ METADATA_KEY_PROVIDER_CONFIG_ACTION
<table>
<tr>
- <th>
+ <th style="width:175px">
Type
</th>
- <th>
+ <th style="width:175px">
Required fields
</th>
- <th>
+ <th style="width:175px">
Optional fields
</th>
<th>
@@ -557,7 +557,7 @@ METADATA_KEY_PROVIDER_CONFIG_ACTION
<table>
<tr>
- <th>
+ <th style="width:175px">
Field
</th>
<th>
diff --git a/libs/input/PointerController.cpp b/libs/input/PointerController.cpp
index 212c6a0d2c3c..61f78cc069c5 100644
--- a/libs/input/PointerController.cpp
+++ b/libs/input/PointerController.cpp
@@ -84,7 +84,7 @@ PointerController::PointerController(const sp<PointerControllerPolicyInterface>&
mLocked.pointerAlpha = 0.0f; // pointer is initially faded
mLocked.pointerSprite = mSpriteController->createSprite();
mLocked.pointerIconChanged = false;
- mLocked.requestedPointerShape = mPolicy->getDefaultPointerIconId();
+ mLocked.requestedPointerType= mPolicy->getDefaultPointerIconId();
mLocked.animationFrameIndex = 0;
mLocked.lastFrameUpdatedTime = 0;
@@ -459,10 +459,10 @@ void PointerController::setDisplayViewport(int32_t width, int32_t height, int32_
updatePointerLocked();
}
-void PointerController::updatePointerShape(int32_t iconId) {
+void PointerController::updatePointerIcon(int32_t iconId) {
AutoMutex _l(mLock);
- if (mLocked.requestedPointerShape != iconId) {
- mLocked.requestedPointerShape = iconId;
+ if (mLocked.requestedPointerType != iconId) {
+ mLocked.requestedPointerType = iconId;
mLocked.presentationChanged = true;
updatePointerLocked();
}
@@ -473,7 +473,7 @@ void PointerController::setCustomPointerIcon(const SpriteIcon& icon) {
const int32_t iconId = mPolicy->getCustomPointerIconId();
mLocked.additionalMouseResources[iconId] = icon;
- mLocked.requestedPointerShape = iconId;
+ mLocked.requestedPointerType = iconId;
mLocked.presentationChanged = true;
updatePointerLocked();
@@ -574,7 +574,7 @@ bool PointerController::doFadingAnimationLocked(nsecs_t timestamp) {
bool PointerController::doBitmapAnimationLocked(nsecs_t timestamp) {
std::map<int32_t, PointerAnimation>::const_iterator iter = mLocked.animationResources.find(
- mLocked.requestedPointerShape);
+ mLocked.requestedPointerType);
if (iter == mLocked.animationResources.end()) {
return false;
}
@@ -636,14 +636,14 @@ void PointerController::updatePointerLocked() {
if (mLocked.pointerIconChanged || mLocked.presentationChanged) {
if (mLocked.presentation == PRESENTATION_POINTER) {
- if (mLocked.requestedPointerShape == mPolicy->getDefaultPointerIconId()) {
+ if (mLocked.requestedPointerType== mPolicy->getDefaultPointerIconId()) {
mLocked.pointerSprite->setIcon(mLocked.pointerIcon);
} else {
std::map<int32_t, SpriteIcon>::const_iterator iter =
- mLocked.additionalMouseResources.find(mLocked.requestedPointerShape);
+ mLocked.additionalMouseResources.find(mLocked.requestedPointerType);
if (iter != mLocked.additionalMouseResources.end()) {
std::map<int32_t, PointerAnimation>::const_iterator anim_iter =
- mLocked.animationResources.find(mLocked.requestedPointerShape);
+ mLocked.animationResources.find(mLocked.requestedPointerType);
if (anim_iter != mLocked.animationResources.end()) {
mLocked.animationFrameIndex = 0;
mLocked.lastFrameUpdatedTime = systemTime(SYSTEM_TIME_MONOTONIC);
@@ -651,7 +651,7 @@ void PointerController::updatePointerLocked() {
}
mLocked.pointerSprite->setIcon(iter->second);
} else {
- ALOGW("Can't find the resource for icon id %d", mLocked.requestedPointerShape);
+ ALOGW("Can't find the resource for icon id %d", mLocked.requestedPointerType);
mLocked.pointerSprite->setIcon(mLocked.pointerIcon);
}
}
diff --git a/libs/input/PointerController.h b/libs/input/PointerController.h
index c1381f32a37f..b47139adaf90 100644
--- a/libs/input/PointerController.h
+++ b/libs/input/PointerController.h
@@ -105,7 +105,7 @@ public:
const uint32_t* spotIdToIndex, BitSet32 spotIdBits);
virtual void clearSpots();
- void updatePointerShape(int32_t iconId);
+ void updatePointerIcon(int32_t iconId);
void setCustomPointerIcon(const SpriteIcon& icon);
void setDisplayViewport(int32_t width, int32_t height, int32_t orientation);
void setInactivityTimeout(InactivityTimeout inactivityTimeout);
@@ -180,7 +180,7 @@ private:
std::map<int32_t, SpriteIcon> additionalMouseResources;
std::map<int32_t, PointerAnimation> animationResources;
- int32_t requestedPointerShape;
+ int32_t requestedPointerType;
int32_t buttonState;
diff --git a/location/java/android/location/GnssStatus.java b/location/java/android/location/GnssStatus.java
index e834c301f093..e68821b5a220 100644
--- a/location/java/android/location/GnssStatus.java
+++ b/location/java/android/location/GnssStatus.java
@@ -146,13 +146,11 @@ public final class GnssStatus {
* <ul>
* <li>GPS: 1-32</li>
* <li>SBAS: 120-151, 183-192</li>
- * <li>GLONASS:
+ * <li>GLONASS: One of: OSN, or FCN+100
* <ul>
- * <li>The least significant 8 bits, signed, are the orbital slot number (OSN) in the range
- * from 1-24, if known, or -127 if unknown</li>
- * <li>The next least signficant 8 bits, signed, are the frequency channel number (FCN) in the
- * range from -7 to +6, if known, and -127, if unknown</li>
- * <li>At least one of the two (FCN &amp; OSN) shall be set to a known value</li>
+ * <li>1-24 as the orbital slot number (OSN) (preferred, if known)</li>
+ * <li>93-106 as the frequency channel number (FCN) (-7 to +6) plus 100.
+ * i.e. encode FCN of -7 as 93, 0 as 100, and +6 as 106</li>
* </ul></li>
* <li>QZSS: 193-200</li>
* <li>Galileo: 1-36</li>
diff --git a/location/java/android/location/GpsStatus.java b/location/java/android/location/GpsStatus.java
index 038247bb691e..5561b229dd25 100644
--- a/location/java/android/location/GpsStatus.java
+++ b/location/java/android/location/GpsStatus.java
@@ -32,6 +32,8 @@ import java.util.NoSuchElementException;
@Deprecated
public final class GpsStatus {
private static final int NUM_SATELLITES = 255;
+ private static final int GLONASS_SVID_OFFSET = 64;
+ private static final int BEIDOU_SVID_OFFSET = 200;
/* These package private values are modified by the LocationManager class */
private int mTimeToFirstFix;
@@ -153,11 +155,22 @@ public final class GpsStatus {
final int constellationType =
(svidWithFlags[i] >> GnssStatus.CONSTELLATION_TYPE_SHIFT_WIDTH)
& GnssStatus.CONSTELLATION_TYPE_MASK;
- // Skip all non-GPS satellites.
- if (constellationType != GnssStatus.CONSTELLATION_GPS) {
+ int prn = svidWithFlags[i] >> GnssStatus.SVID_SHIFT_WIDTH;
+ // Other satellites passed through these APIs before GnssSvStatus was availble.
+ // GPS, SBAS & QZSS can pass through at their nominally
+ // assigned prn number (as long as it fits in the valid 0-255 range below.)
+ // Glonass, and Beidou are passed through with the defacto standard offsets
+ // Other future constellation reporting (e.g. Galileo) needs to use
+ // GnssSvStatus on (N level) HAL & Java layers.
+ if (constellationType == GnssStatus.CONSTELLATION_GLONASS) {
+ prn += GLONASS_SVID_OFFSET;
+ } else if (constellationType == GnssStatus.CONSTELLATION_BEIDOU) {
+ prn += BEIDOU_SVID_OFFSET;
+ } else if ((constellationType != GnssStatus.CONSTELLATION_GPS) &&
+ (constellationType != GnssStatus.CONSTELLATION_QZSS) &&
+ (constellationType != GnssStatus.CONSTELLATION_SBAS)) {
continue;
}
- int prn = svidWithFlags[i] >> GnssStatus.SVID_SHIFT_WIDTH;
if (prn > 0 && prn <= NUM_SATELLITES) {
GpsSatellite satellite = mSatellites.get(prn);
if (satellite == null) {
diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java
index 5e7a229fda9d..870c3439b8a9 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java
@@ -59,6 +59,7 @@ import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.OnItemTouchListener;
import android.support.v7.widget.RecyclerView.RecyclerListener;
import android.support.v7.widget.RecyclerView.ViewHolder;
+import android.text.BidiFormatter;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
@@ -787,11 +788,15 @@ public class DirectoryFragment extends Fragment
if (docs.size() == 1) {
// Deleteing 1 file xor 1 folder in cwd
+
+ // Address b/28772371, where including user strings in message can result in
+ // broken bidirectional support.
+ String displayName = BidiFormatter.getInstance().unicodeWrap(docs.get(0).displayName);
message = dirsCount == 0
? getActivity().getString(R.string.delete_filename_confirmation_message,
- docs.get(0).displayName)
+ displayName)
: getActivity().getString(R.string.delete_foldername_confirmation_message,
- docs.get(0).displayName);
+ displayName);
} else if (dirsCount == 0) {
// Deleting only files in cwd
message = Shared.getQuantityString(getActivity(),
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothAdapter.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothAdapter.java
index 9c5abf3a00dd..26836099c9de 100755
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothAdapter.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothAdapter.java
@@ -208,7 +208,7 @@ public final class LocalBluetoothAdapter {
return false;
}
- public void setBluetoothEnabled(boolean enabled) {
+ public boolean setBluetoothEnabled(boolean enabled) {
boolean success = enabled
? mAdapter.enable()
: mAdapter.disable();
@@ -225,6 +225,7 @@ public final class LocalBluetoothAdapter {
syncBluetoothState();
}
+ return success;
}
public BluetoothDevice getRemoteDevice(String address) {
diff --git a/packages/SystemUI/res/layout/global_screenshot.xml b/packages/SystemUI/res/layout/global_screenshot.xml
index c1fe1a806d11..59952e09555f 100644
--- a/packages/SystemUI/res/layout/global_screenshot.xml
+++ b/packages/SystemUI/res/layout/global_screenshot.xml
@@ -38,5 +38,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
- android:pointerShape="crosshair"/>
+ android:pointerIcon="crosshair"/>
</FrameLayout>
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index 36e937d4d3ef..8ba4c9c05ba6 100644
--- a/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/packages/SystemUI/res/layout/navigation_bar.xml
@@ -27,12 +27,6 @@
<com.android.systemui.statusbar.phone.NavigationBarInflaterView
android:id="@+id/navigation_inflater"
android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <include android:id="@+id/rot0" layout="@layout/navigation_layout" />
-
- <include android:id="@+id/rot90" layout="@layout/navigation_layout_rot90" />
-
- </com.android.systemui.statusbar.phone.NavigationBarInflaterView>
+ android:layout_height="match_parent" />
</com.android.systemui.statusbar.phone.NavigationBarView>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java
index eaf375eefdb0..61a92b468b48 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java
@@ -142,11 +142,9 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
}
}
mTileDividerIndex = mTiles.size();
- if (mOtherTiles.size() != 0) {
- mTiles.add(null);
- }
+ mTiles.add(null);
mTiles.addAll(mOtherTiles);
- mEditIndex = mTiles.indexOf(null);
+ updateDividerLocations();
notifyDataSetChanged();
}
@@ -203,6 +201,8 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
@Override
public void onBindViewHolder(final Holder holder, int position) {
if (holder.getItemViewType() == TYPE_DIVIDER) {
+ holder.itemView.setVisibility(mTileDividerIndex < mTiles.size() - 1 ? View.VISIBLE
+ : View.INVISIBLE);
return;
}
if (holder.getItemViewType() == TYPE_EDIT) {
@@ -340,9 +340,8 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
to = mTileDividerIndex;
}
} else {
- if (mTileDividerIndex == mTiles.size()) {
- notifyItemInserted(mTiles.size());
- mTiles.add(null);
+ if (mTileDividerIndex == mTiles.size() - 1) {
+ notifyItemChanged(mTileDividerIndex);
}
if (to <= mTileDividerIndex) {
to = mTileDividerIndex;
@@ -351,7 +350,7 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
} else {
if (to > mEditIndex) {
// Don't allow tiles to be dragged around when they aren't added.
- return false;
+ to = from;
}
// Allow the case where to == mEditIndex to fall through and swap which
// side the tile is currently on.
@@ -362,6 +361,9 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
CharSequence fromLabel = mTiles.get(from).state.label;
move(from, to, mTiles);
updateDividerLocations();
+ if (to == from) {
+ return true;
+ }
CharSequence announcement;
if (to >= mEditIndex) {
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EDIT_REMOVE_SPEC,
@@ -405,12 +407,11 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
}
}
if (mTiles.size() - 1 == mTileDividerIndex) {
- mTiles.remove(mTiles.size() - 1);
- notifyItemRemoved(mTiles.size());
+ notifyItemChanged(mTileDividerIndex);
}
}
- private String strip(TileInfo tileInfo) {
+ private static String strip(TileInfo tileInfo) {
String spec = tileInfo.spec;
if (spec.startsWith(CustomTile.PREFIX)) {
ComponentName component = CustomTile.getComponentFromSpec(spec);
@@ -420,8 +421,7 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
}
private <T> void move(int from, int to, List<T> list) {
- list.add(from > to ? to : to + 1, list.get(from));
- list.remove(from > to ? from + 1 : from);
+ list.add(to, list.remove(from));
notifyItemMoved(from, to);
notifyItemChanged(to);
}
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
index a220f2ed70ec..64eaeec98948 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
@@ -16,8 +16,8 @@
package com.android.systemui.stackdivider;
-import static android.view.PointerIcon.STYLE_HORIZONTAL_DOUBLE_ARROW;
-import static android.view.PointerIcon.STYLE_VERTICAL_DOUBLE_ARROW;
+import static android.view.PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW;
+import static android.view.PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -266,7 +266,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
boolean landscape = getResources().getConfiguration().orientation
== Configuration.ORIENTATION_LANDSCAPE;
mHandle.setPointerIcon(PointerIcon.getSystemIcon(getContext(),
- landscape ? STYLE_HORIZONTAL_DOUBLE_ARROW : STYLE_VERTICAL_DOUBLE_ARROW));
+ landscape ? TYPE_HORIZONTAL_DOUBLE_ARROW : TYPE_VERTICAL_DOUBLE_ARROW));
getViewTreeObserver().addOnComputeInternalInsetsListener(this);
mHandle.setAccessibilityDelegate(mHandleDelegate);
mGestureDetector = new GestureDetector(mContext, new SimpleOnGestureListener() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java
index 3363993dd289..7575dc8157b6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java
@@ -198,7 +198,7 @@ public class NotificationHeaderUtil {
}
// in case no view is visible we make sure the time is visible
int timeVisibility = !hasVisibleText
- || mRow.getStatusBarNotification().getNotification().showsTimeOrChronometer()
+ || mRow.getStatusBarNotification().getNotification().showsTime()
? View.VISIBLE : View.GONE;
time.setVisibility(timeVisibility);
View left = null;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
index 4ec36f608111..2bee816b0539 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
@@ -24,7 +24,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
-import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Space;
import com.android.systemui.R;
@@ -90,6 +89,7 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
if (mDensity != newConfig.densityDpi) {
mDensity = newConfig.densityDpi;
createInflaters();
+ inflateChildren();
clearViews();
inflateLayout(mCurrentLayout);
}
@@ -98,12 +98,25 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- mRot0 = (FrameLayout) findViewById(R.id.rot0);
- mRot90 = (FrameLayout) findViewById(R.id.rot90);
+ inflateChildren();
clearViews();
inflateLayout(getDefaultLayout());
}
+ private void inflateChildren() {
+ removeAllViews();
+ mRot0 = (FrameLayout) mLayoutInflater.inflate(R.layout.navigation_layout, this, false);
+ mRot0.setId(R.id.rot0);
+ addView(mRot0);
+ mRot90 = (FrameLayout) mLayoutInflater.inflate(R.layout.navigation_layout_rot90, this,
+ false);
+ mRot90.setId(R.id.rot90);
+ addView(mRot90);
+ if (getParent() instanceof NavigationBarView) {
+ ((NavigationBarView) getParent()).updateRotatedViews();
+ }
+ }
+
protected String getDefaultLayout() {
return mContext.getString(R.string.config_navBarLayout);
}
@@ -123,9 +136,6 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
@Override
public void onTuningChanged(String key, String newValue) {
if (NAV_BAR_VIEWS.equals(key)) {
- if (newValue == null) {
- newValue = getDefaultLayout();
- }
if (!Objects.equals(mCurrentLayout, newValue)) {
clearViews();
inflateLayout(newValue);
@@ -162,6 +172,9 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
protected void inflateLayout(String newLayout) {
mCurrentLayout = newLayout;
+ if (newLayout == null) {
+ newLayout = getDefaultLayout();
+ }
String[] sets = newLayout.split(GRAVITY_SEPARATOR, 3);
String[] start = sets[0].split(BUTTON_SEPARATOR);
String[] center = sets[1].split(BUTTON_SEPARATOR);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 4b7d56b27169..5fab79692135 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -492,17 +492,7 @@ public class NavigationBarView extends LinearLayout {
@Override
public void onFinishInflate() {
- mRotatedViews[Surface.ROTATION_0] =
- mRotatedViews[Surface.ROTATION_180] = findViewById(R.id.rot0);
-
- mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot90);
-
- mRotatedViews[Surface.ROTATION_270] = mRotatedViews[Surface.ROTATION_90];
-
- mCurrentView = mRotatedViews[Surface.ROTATION_0];
- for (int i = 0; i < mButtonDisatchers.size(); i++) {
- mButtonDisatchers.valueAt(i).setCurrentView(mCurrentView);
- }
+ updateRotatedViews();
((NavigationBarInflaterView) findViewById(R.id.navigation_inflater)).setButtonDispatchers(
mButtonDisatchers);
@@ -544,15 +534,16 @@ public class NavigationBarView extends LinearLayout {
}
}
- private void updateRecentsIcon() {
- getRecentsButton().setImageDrawable(mDockedStackExists ? mDockedIcon : mRecentIcon);
- }
+ void updateRotatedViews() {
+ mRotatedViews[Surface.ROTATION_0] =
+ mRotatedViews[Surface.ROTATION_180] = findViewById(R.id.rot0);
+ mRotatedViews[Surface.ROTATION_270] =
+ mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot90);
- public boolean isVertical() {
- return mVertical;
+ updateCurrentView();
}
- public void reorient() {
+ private void updateCurrentView() {
final int rot = mDisplay.getRotation();
for (int i=0; i<4; i++) {
mRotatedViews[i].setVisibility(View.GONE);
@@ -563,6 +554,18 @@ public class NavigationBarView extends LinearLayout {
mButtonDisatchers.valueAt(i).setCurrentView(mCurrentView);
}
updateLayoutTransitionsEnabled();
+ }
+
+ private void updateRecentsIcon() {
+ getRecentsButton().setImageDrawable(mDockedStackExists ? mDockedIcon : mRecentIcon);
+ }
+
+ public boolean isVertical() {
+ return mVertical;
+ }
+
+ public void reorient() {
+ updateCurrentView();
getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java
index c0ea1324602b..05ad1615dc81 100644
--- a/rs/java/android/renderscript/Allocation.java
+++ b/rs/java/android/renderscript/Allocation.java
@@ -297,13 +297,50 @@ public class Allocation extends BaseObj {
}
/**
- * Enable/Disable AutoPadding for Vec3 Elements.
- *
- * <p> Vec3 Elements, such as {@link Element#U8_3} are treated as Vec4 Elements
- * with the fourth vector element used as padding. Enabling the AutoPadding feature
- * will automatically add/remove the padding when you copy to/from an Allocation
- * with a Vec3 Element.
- * <p> By default: Disabled.
+ * Specifies the mapping between the Allocation's cells and an array's elements
+ * when data is copied from the Allocation to the array, or vice-versa.
+ *
+ * Only applies to an Allocation whose Element is a vector of length 3 (such as
+ * {@link Element#U8_3} or {@link Element#RGB_888}). Enabling this feature may make
+ * copying data from the Allocation to an array or vice-versa less efficient.
+ *
+ * <p> Vec3 Element cells are stored in an Allocation as Vec4 Element cells with
+ * the same {@link android.renderscript.Element.DataType}, with the fourth vector
+ * component treated as padding. When this feature is enabled, only the data components,
+ * i.e. the first 3 vector components of each cell, will be mapped between the array
+ * and the Allocation. When disabled, explicit mapping of the padding components
+ * is required, as described in the following example.
+ *
+ * <p> For example, when copying an integer array to an Allocation of two {@link
+ * Element#I32_3} cells using {@link #copyFrom(int[])}:
+ * <p> When disabled:
+ * The array must have at least 8 integers, with the first 4 integers copied
+ * to the first cell of the Allocation, and the next 4 integers copied to
+ * the second cell. The 4th and 8th integers are mapped as the padding components.
+ *
+ * <p> When enabled:
+ * The array just needs to have at least 6 integers, with the first 3 integers
+ * copied to the the first cell as data components, and the next 3 copied to
+ * the second cell. There is no mapping for the padding components.
+ *
+ * <p> Similarly, when copying a byte array to an Allocation of two {@link
+ * Element#I32_3} cells, using {@link #copyFromUnchecked(int[])}:
+ * <p> When disabled:
+ * The array must have at least 32 bytes, with the first 16 bytes copied
+ * to the first cell of the Allocation, and the next 16 bytes copied to
+ * the second cell. The 13th-16th and 29th-32nd bytes are mapped as padding
+ * components.
+ *
+ * <p> When enabled:
+ * The array just needs to have at least 24 bytes, with the first 12 bytes copied
+ * to the first cell of the Allocation, and the next 12 bytes copied to
+ * the second cell. There is no mapping for the padding components.
+ *
+ * <p> Similar to copying data to an Allocation from an array, when copying data from an
+ * Allocation to an array, the padding components for Vec3 Element cells will not be
+ * copied/mapped to the array if AutoPadding is enabled.
+ *
+ * <p> Default: Disabled.
*
* @param useAutoPadding True: enable AutoPadding; False: disable AutoPadding
*
@@ -663,12 +700,27 @@ public class Allocation extends BaseObj {
}
}
+
/**
* Copy into this Allocation from an array. This method does not guarantee
* that the Allocation is compatible with the input buffer; it copies memory
* without reinterpretation.
*
- * @param array The source data array
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
+ *
+ * @param array The source array
*/
public void copyFromUnchecked(Object array) {
try {
@@ -685,7 +737,21 @@ public class Allocation extends BaseObj {
* that the Allocation is compatible with the input buffer; it copies memory
* without reinterpretation.
*
- * @param d the source data array
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
+ *
+ * @param d the source array
*/
public void copyFromUnchecked(int[] d) {
copyFromUnchecked(d, Element.DataType.SIGNED_32, d.length);
@@ -696,7 +762,21 @@ public class Allocation extends BaseObj {
* that the Allocation is compatible with the input buffer; it copies memory
* without reinterpretation.
*
- * @param d the source data array
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
+ *
+ * @param d the source array
*/
public void copyFromUnchecked(short[] d) {
copyFromUnchecked(d, Element.DataType.SIGNED_16, d.length);
@@ -707,7 +787,21 @@ public class Allocation extends BaseObj {
* that the Allocation is compatible with the input buffer; it copies memory
* without reinterpretation.
*
- * @param d the source data array
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
+ *
+ * @param d the source array
*/
public void copyFromUnchecked(byte[] d) {
copyFromUnchecked(d, Element.DataType.SIGNED_8, d.length);
@@ -718,7 +812,21 @@ public class Allocation extends BaseObj {
* that the Allocation is compatible with the input buffer; it copies memory
* without reinterpretation.
*
- * @param d the source data array
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
+ *
+ * @param d the source array
*/
public void copyFromUnchecked(float[] d) {
copyFromUnchecked(d, Element.DataType.FLOAT_32, d.length);
@@ -731,7 +839,21 @@ public class Allocation extends BaseObj {
* android.renderscript.Element} does not match the array's
* primitive type.
*
- * @param array The source data array
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
+ *
+ * @param array The source array
*/
public void copyFrom(Object array) {
try {
@@ -746,9 +868,24 @@ public class Allocation extends BaseObj {
/**
* Copy into this Allocation from an array. This variant is type checked
* and will generate exceptions if the Allocation's {@link
- * android.renderscript.Element} is not a 32 bit integer type.
+ * android.renderscript.Element} is not a 32 bit integer nor a vector of 32 bit
+ * integers {@link android.renderscript.Element.DataType}.
*
- * @param d the source data array
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
+ *
+ * @param d the source array
*/
public void copyFrom(int[] d) {
validateIsInt32();
@@ -758,9 +895,24 @@ public class Allocation extends BaseObj {
/**
* Copy into this Allocation from an array. This variant is type checked
* and will generate exceptions if the Allocation's {@link
- * android.renderscript.Element} is not a 16 bit integer type.
+ * android.renderscript.Element} is not a 16 bit integer nor a vector of 16 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
*
- * @param d the source data array
+ * @param d the source array
*/
public void copyFrom(short[] d) {
validateIsInt16OrFloat16();
@@ -770,9 +922,24 @@ public class Allocation extends BaseObj {
/**
* Copy into this Allocation from an array. This variant is type checked
* and will generate exceptions if the Allocation's {@link
- * android.renderscript.Element} is not an 8 bit integer type.
+ * android.renderscript.Element} is not an 8 bit integer nor a vector of 8 bit
+ * integers {@link android.renderscript.Element.DataType}.
*
- * @param d the source data array
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
+ *
+ * @param d the source array
*/
public void copyFrom(byte[] d) {
validateIsInt8();
@@ -782,9 +949,24 @@ public class Allocation extends BaseObj {
/**
* Copy into this Allocation from an array. This variant is type checked
* and will generate exceptions if the Allocation's {@link
- * android.renderscript.Element} is not a 32 bit float type.
+ * android.renderscript.Element} is neither a 32 bit float nor a vector of
+ * 32 bit floats {@link android.renderscript.Element.DataType}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
*
- * @param d the source data array
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
+ *
+ * @param d the source array
*/
public void copyFrom(float[] d) {
validateIsFloat32();
@@ -970,13 +1152,28 @@ public class Allocation extends BaseObj {
}
}
+
/**
- * Copy an array into part of this Allocation. This method does not
+ * Copy an array into a 1D region of this Allocation. This method does not
* guarantee that the Allocation is compatible with the input buffer.
*
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
+ *
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param array The source data array
+ * @param array The source array
*/
public void copy1DRangeFromUnchecked(int off, int count, Object array) {
copy1DRangeFromUnchecked(off, count, array,
@@ -985,62 +1182,132 @@ public class Allocation extends BaseObj {
}
/**
- * Copy an array into part of this Allocation. This method does not
+ * Copy an array into a 1D region of this Allocation. This method does not
* guarantee that the Allocation is compatible with the input buffer.
*
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
+ *
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeFromUnchecked(int off, int count, int[] d) {
copy1DRangeFromUnchecked(off, count, (Object)d, Element.DataType.SIGNED_32, d.length);
}
/**
- * Copy an array into part of this Allocation. This method does not
+ * Copy an array into a 1D region of this Allocation. This method does not
* guarantee that the Allocation is compatible with the input buffer.
*
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
+ *
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeFromUnchecked(int off, int count, short[] d) {
copy1DRangeFromUnchecked(off, count, (Object)d, Element.DataType.SIGNED_16, d.length);
}
/**
- * Copy an array into part of this Allocation. This method does not
+ * Copy an array into a 1D region of this Allocation. This method does not
* guarantee that the Allocation is compatible with the input buffer.
*
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
+ *
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeFromUnchecked(int off, int count, byte[] d) {
copy1DRangeFromUnchecked(off, count, (Object)d, Element.DataType.SIGNED_8, d.length);
}
/**
- * Copy an array into part of this Allocation. This method does not
+ * Copy an array into a 1D region of this Allocation. This method does not
* guarantee that the Allocation is compatible with the input buffer.
*
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
+ *
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeFromUnchecked(int off, int count, float[] d) {
copy1DRangeFromUnchecked(off, count, (Object)d, Element.DataType.FLOAT_32, d.length);
}
-
/**
- * Copy an array into part of this Allocation. This variant is type checked
- * and will generate exceptions if the Allocation type does not
- * match the component type of the array passed in.
+ * Copy an array into a 1D region of this Allocation. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} does not match the component type
+ * of the array passed in.
+ *
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param array The source data array.
+ * @param array The source array.
*/
public void copy1DRangeFrom(int off, int count, Object array) {
copy1DRangeFromUnchecked(off, count, array,
@@ -1049,13 +1316,28 @@ public class Allocation extends BaseObj {
}
/**
- * Copy an array into part of this Allocation. This variant is type checked
- * and will generate exceptions if the Allocation type is not a 32 bit
- * integer type.
+ * Copy an array into a 1D region of this Allocation. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is not an 32 bit integer nor a vector of 32 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeFrom(int off, int count, int[] d) {
validateIsInt32();
@@ -1063,13 +1345,28 @@ public class Allocation extends BaseObj {
}
/**
- * Copy an array into part of this Allocation. This variant is type checked
- * and will generate exceptions if the Allocation type is not a 16 bit
- * integer type.
+ * Copy an array into a 1D region of this Allocation. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is not an 16 bit integer nor a vector of 16 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeFrom(int off, int count, short[] d) {
validateIsInt16OrFloat16();
@@ -1077,13 +1374,28 @@ public class Allocation extends BaseObj {
}
/**
- * Copy an array into part of this Allocation. This variant is type checked
- * and will generate exceptions if the Allocation type is not an 8 bit
- * integer type.
+ * Copy an array into a 1D region of this Allocation. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is not an 8 bit integer nor a vector of 8 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeFrom(int off, int count, byte[] d) {
validateIsInt8();
@@ -1091,13 +1403,28 @@ public class Allocation extends BaseObj {
}
/**
- * Copy an array into part of this Allocation. This variant is type checked
- * and will generate exceptions if the Allocation type is not a 32 bit float
- * type.
+ * Copy an array into a 1D region of this Allocation. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is neither a 32 bit float nor a vector of
+ * 32 bit floats {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array.
+ * @param d the source array.
*/
public void copy1DRangeFrom(int off, int count, float[] d) {
validateIsFloat32();
@@ -1170,7 +1497,23 @@ public class Allocation extends BaseObj {
/**
* Copy from an array into a rectangular region in this Allocation. The
- * array is assumed to be tightly packed.
+ * array is assumed to be tightly packed. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} does not match the input data type.
+ *
+ * <p> The size of the region is: w * h * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param xoff X offset of the region to update in this Allocation
* @param yoff Y offset of the region to update in this Allocation
@@ -1191,7 +1534,24 @@ public class Allocation extends BaseObj {
/**
* Copy from an array into a rectangular region in this Allocation. The
- * array is assumed to be tightly packed.
+ * array is assumed to be tightly packed. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is not an 8 bit integer nor a vector of 8 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: w * h * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param xoff X offset of the region to update in this Allocation
* @param yoff Y offset of the region to update in this Allocation
@@ -1207,7 +1567,24 @@ public class Allocation extends BaseObj {
/**
* Copy from an array into a rectangular region in this Allocation. The
- * array is assumed to be tightly packed.
+ * array is assumed to be tightly packed. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is not a 16 bit integer nor a vector of 16 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: w * h * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param xoff X offset of the region to update in this Allocation
* @param yoff Y offset of the region to update in this Allocation
@@ -1223,7 +1600,24 @@ public class Allocation extends BaseObj {
/**
* Copy from an array into a rectangular region in this Allocation. The
- * array is assumed to be tightly packed.
+ * array is assumed to be tightly packed. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is not a 32 bit integer nor a vector of 32 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: w * h * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param xoff X offset of the region to update in this Allocation
* @param yoff Y offset of the region to update in this Allocation
@@ -1239,7 +1633,24 @@ public class Allocation extends BaseObj {
/**
* Copy from an array into a rectangular region in this Allocation. The
- * array is assumed to be tightly packed.
+ * array is assumed to be tightly packed. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is neither a 32 bit float nor a vector of
+ * 32 bit floats {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: w * h * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param xoff X offset of the region to update in this Allocation
* @param yoff Y offset of the region to update in this Allocation
@@ -1362,8 +1773,24 @@ public class Allocation extends BaseObj {
}
/**
- * Copy a rectangular region from the array into the allocation.
- * The array is assumed to be tightly packed.
+ * Copy from an array into a 3D region in this Allocation. The
+ * array is assumed to be tightly packed. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} does not match the input data type.
+ *
+ * <p> The size of the region is: w * h * d * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param xoff X offset of the region to update in this Allocation
* @param yoff Y offset of the region to update in this Allocation
@@ -1453,10 +1880,23 @@ public class Allocation extends BaseObj {
}
/**
- * Copy from the Allocation into an array. The array must be at
- * least as large as the Allocation. The
- * {@link android.renderscript.Element} must match the component
- * type of the array passed in.
+ * Copy from the Allocation into an array. The method is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} does not match the input data type.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells will be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
*
* @param array The array to be set from the Allocation.
*/
@@ -1466,9 +1906,24 @@ public class Allocation extends BaseObj {
}
/**
- * Copy from the Allocation into a byte array. The array must be at least
- * as large as the Allocation. The allocation must be of an 8 bit integer
- * {@link android.renderscript.Element} type.
+ * Copy from the Allocation into a byte array. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is neither an 8 bit integer nor a vector of 8 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells will be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
*
* @param d The array to be set from the Allocation.
*/
@@ -1478,9 +1933,24 @@ public class Allocation extends BaseObj {
}
/**
- * Copy from the Allocation into a short array. The array must be at least
- * as large as the Allocation. The allocation must be of an 16 bit integer
- * {@link android.renderscript.Element} type.
+ * Copy from the Allocation into a short array. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is not a 16 bit integer nor a vector of 16 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells will be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
*
* @param d The array to be set from the Allocation.
*/
@@ -1490,9 +1960,24 @@ public class Allocation extends BaseObj {
}
/**
- * Copy from the Allocation into a int array. The array must be at least as
- * large as the Allocation. The allocation must be of an 32 bit integer
- * {@link android.renderscript.Element} type.
+ * Copy from the Allocation into a int array. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is not a 32 bit integer nor a vector of 32 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells will be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
*
* @param d The array to be set from the Allocation.
*/
@@ -1502,9 +1987,24 @@ public class Allocation extends BaseObj {
}
/**
- * Copy from the Allocation into a float array. The array must be at least
- * as large as the Allocation. The allocation must be of an 32 bit float
- * {@link android.renderscript.Element} type.
+ * Copy from the Allocation into a float array. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is neither a 32 bit float nor a vector of
+ * 32 bit floats {@link android.renderscript.Element.DataType}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the Allocation {@link
+ * #getBytesSize getBytesSize()}.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells will be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
+ * the cells must not be part of the array.
*
* @param d The array to be set from the Allocation.
*/
@@ -1607,12 +2107,26 @@ public class Allocation extends BaseObj {
}
/**
- * Copy part of this Allocation into an array. This method does not
+ * Copy a 1D region of this Allocation into an array. This method does not
* guarantee that the Allocation is compatible with the input buffer.
*
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
+ *
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param array The dest data array
+ * @param array The dest array
*/
public void copy1DRangeToUnchecked(int off, int count, Object array) {
copy1DRangeToUnchecked(off, count, array,
@@ -1621,62 +2135,132 @@ public class Allocation extends BaseObj {
}
/**
- * Copy part of this Allocation into an array. This method does not
+ * Copy a 1D region of this Allocation into an array. This method does not
* guarantee that the Allocation is compatible with the input buffer.
*
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
+ *
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeToUnchecked(int off, int count, int[] d) {
copy1DRangeToUnchecked(off, count, (Object)d, Element.DataType.SIGNED_32, d.length);
}
/**
- * Copy part of this Allocation into an array. This method does not
+ * Copy a 1D region of this Allocation into an array. This method does not
* guarantee that the Allocation is compatible with the input buffer.
*
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
+ *
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeToUnchecked(int off, int count, short[] d) {
copy1DRangeToUnchecked(off, count, (Object)d, Element.DataType.SIGNED_16, d.length);
}
/**
- * Copy part of this Allocation into an array. This method does not
+ * Copy a 1D region of this Allocation into an array. This method does not
* guarantee that the Allocation is compatible with the input buffer.
*
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
+ *
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeToUnchecked(int off, int count, byte[] d) {
copy1DRangeToUnchecked(off, count, (Object)d, Element.DataType.SIGNED_8, d.length);
}
/**
- * Copy part of this Allocation into an array. This method does not
+ * Copy a 1D region of this Allocation into an array. This method does not
* guarantee that the Allocation is compatible with the input buffer.
*
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
+ *
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeToUnchecked(int off, int count, float[] d) {
copy1DRangeToUnchecked(off, count, (Object)d, Element.DataType.FLOAT_32, d.length);
}
-
/**
- * Copy part of this Allocation into an array. This method does not
- * and will generate exceptions if the Allocation type does not
- * match the component type of the array passed in.
+ * Copy a 1D region of this Allocation into an array. This method is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} does not match the component type
+ * of the array passed in.
+ *
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param array The source data array.
+ * @param array The source array.
*/
public void copy1DRangeTo(int off, int count, Object array) {
copy1DRangeToUnchecked(off, count, array,
@@ -1685,13 +2269,28 @@ public class Allocation extends BaseObj {
}
/**
- * Copy part of this Allocation into an array. This method does not
- * and will generate exceptions if the Allocation type is not a 32 bit
- * integer type.
+ * Copy a 1D region of this Allocation into an array. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is neither a 32 bit integer nor a vector of 32 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeTo(int off, int count, int[] d) {
validateIsInt32();
@@ -1699,13 +2298,28 @@ public class Allocation extends BaseObj {
}
/**
- * Copy part of this Allocation into an array. This method does not
- * and will generate exceptions if the Allocation type is not a 16 bit
- * integer type.
+ * Copy a 1D region of this Allocation into an array. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is neither a 16 bit integer nor a vector of 16 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeTo(int off, int count, short[] d) {
validateIsInt16OrFloat16();
@@ -1713,13 +2327,28 @@ public class Allocation extends BaseObj {
}
/**
- * Copy part of this Allocation into an array. This method does not
- * and will generate exceptions if the Allocation type is not an 8 bit
- * integer type.
+ * Copy a 1D region of this Allocation into an array. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is neither an 8 bit integer nor a vector of 8 bit
+ * integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array
+ * @param d the source array
*/
public void copy1DRangeTo(int off, int count, byte[] d) {
validateIsInt8();
@@ -1727,13 +2356,28 @@ public class Allocation extends BaseObj {
}
/**
- * Copy part of this Allocation into an array. This method does not
- * and will generate exceptions if the Allocation type is not a 32 bit float
- * type.
+ * Copy a 1D region of this Allocation into an array. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} is neither a 32 bit float nor a vector of
+ * 32 bit floats {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: count * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param off The offset of the first element to be copied.
* @param count The number of elements to be copied.
- * @param d the source data array.
+ * @param d the source array.
*/
public void copy1DRangeTo(int off, int count, float[] d) {
validateIsFloat32();
@@ -1770,7 +2414,24 @@ public class Allocation extends BaseObj {
}
/**
- * Copy from a rectangular region in this Allocation into an array.
+ * Copy from a rectangular region in this Allocation into an array. This
+ * method is type checked and will generate exceptions if the Allocation's
+ * {@link android.renderscript.Element} does not match the component type
+ * of the array passed in.
+ *
+ * <p> The size of the region is: w * h * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param xoff X offset of the region to copy in this Allocation
* @param yoff Y offset of the region to copy in this Allocation
@@ -1785,7 +2446,24 @@ public class Allocation extends BaseObj {
}
/**
- * Copy from a rectangular region in this Allocation into an array.
+ * Copy from a rectangular region in this Allocation into an array. This
+ * variant is type checked and will generate exceptions if the Allocation's
+ * {@link android.renderscript.Element} is neither an 8 bit integer nor a vector
+ * of 8 bit integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: w * h * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param xoff X offset of the region to copy in this Allocation
* @param yoff Y offset of the region to copy in this Allocation
@@ -1800,7 +2478,24 @@ public class Allocation extends BaseObj {
}
/**
- * Copy from a rectangular region in this Allocation into an array.
+ * Copy from a rectangular region in this Allocation into an array. This
+ * variant is type checked and will generate exceptions if the Allocation's
+ * {@link android.renderscript.Element} is neither a 16 bit integer nor a vector
+ * of 16 bit integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: w * h * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param xoff X offset of the region to copy in this Allocation
* @param yoff Y offset of the region to copy in this Allocation
@@ -1815,7 +2510,24 @@ public class Allocation extends BaseObj {
}
/**
- * Copy from a rectangular region in this Allocation into an array.
+ * Copy from a rectangular region in this Allocation into an array. This
+ * variant is type checked and will generate exceptions if the Allocation's
+ * {@link android.renderscript.Element} is neither a 32 bit integer nor a vector
+ * of 32 bit integers {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: w * h * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param xoff X offset of the region to copy in this Allocation
* @param yoff Y offset of the region to copy in this Allocation
@@ -1830,7 +2542,24 @@ public class Allocation extends BaseObj {
}
/**
- * Copy from a rectangular region in this Allocation into an array.
+ * Copy from a rectangular region in this Allocation into an array. This
+ * variant is type checked and will generate exceptions if the Allocation's
+ * {@link android.renderscript.Element} is neither a 32 bit float nor a vector
+ * of 32 bit floats {@link android.renderscript.Element.DataType}.
+ *
+ * <p> The size of the region is: w * h * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param xoff X offset of the region to copy in this Allocation
* @param yoff Y offset of the region to copy in this Allocation
@@ -1846,7 +2575,8 @@ public class Allocation extends BaseObj {
/**
- * Copy from a rectangular region in this Allocation into an array.
+ * Copy from a 3D region in this Allocation into an array. This method does
+ * not guarantee that the Allocation is compatible with the input buffer.
* The array is assumed to be tightly packed.
*
* The data type of the array is not required to be the same as
@@ -1881,7 +2611,24 @@ public class Allocation extends BaseObj {
}
/*
- * Copy from a rectangular region in this Allocation into an array.
+ * Copy from a 3D region in this Allocation into an array. This
+ * method is type checked and will generate exceptions if the Allocation's
+ * {@link android.renderscript.Element} does not match the component type
+ * of the array passed in.
+ *
+ * <p> The size of the region is: w * h * d * {@link #getElement}.{@link
+ * Element#getBytesSize}.
+ *
+ * <p> If the Allocation does not have Vec3 Elements, then the size of the
+ * array in bytes must be at least the size of the region.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is disabled, then the size of the array in bytes must be at least the size
+ * of the region. The padding bytes for the cells must be part of the array.
+ *
+ * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
+ * is enabled, then the size of the array in bytes must be at least 3/4 the size
+ * of the region. The padding bytes for the cells must not be part of the array.
*
* @param xoff X offset of the region to copy in this Allocation
* @param yoff Y offset of the region to copy in this Allocation
@@ -2091,7 +2838,7 @@ public class Allocation extends BaseObj {
/**
* Gets or creates a ByteBuffer that contains the raw data of the current Allocation.
- * If the Allocation is created with USAGE_IO_INPUT, the returned ByteBuffer
+ * <p> If the Allocation is created with USAGE_IO_INPUT, the returned ByteBuffer
* would contain the up-to-date data as READ ONLY.
* For a 2D or 3D Allocation, the raw data maybe padded so that each row of
* the Allocation has certain alignment. The size of each row including padding,
@@ -2167,7 +2914,7 @@ public class Allocation extends BaseObj {
* Creates a new Allocation with the given {@link
* android.renderscript.Allocation}. The same data layout of
* the input Allocation will be applied.
- * If the input allocation is of usage: USAGE_IO_INPUT, the created
+ * <p> If the input allocation is of usage: USAGE_IO_INPUT, the created
* Allocation will be sharing the same BufferQueue.
*
* @param rs Context to which the allocation will belong.
diff --git a/rs/java/android/renderscript/ScriptIntrinsicBlur.java b/rs/java/android/renderscript/ScriptIntrinsicBlur.java
index 60e2b6d99b1e..11483dc52ffd 100644
--- a/rs/java/android/renderscript/ScriptIntrinsicBlur.java
+++ b/rs/java/android/renderscript/ScriptIntrinsicBlur.java
@@ -34,7 +34,8 @@ public final class ScriptIntrinsicBlur extends ScriptIntrinsic {
* Create an intrinsic for applying a blur to an allocation. The
* default radius is 5.0.
*
- * Supported elements types are {@link Element#U8_4 Element#U8}
+ * Supported elements types are {@link Element#U8},
+ * {@link Element#U8_4}.
*
* @param rs The RenderScript context
* @param e Element type for inputs and outputs
diff --git a/services/core/Android.mk b/services/core/Android.mk
index 860f60a01936..b965ce39e7d5 100644
--- a/services/core/Android.mk
+++ b/services/core/Android.mk
@@ -24,4 +24,10 @@ ifneq ($(INCREMENTAL_BUILDS),)
LOCAL_JACK_ENABLED := incremental
endif
+LOCAL_JACK_FLAGS := \
+ -D jack.transformations.boost-locked-region-priority=true \
+ -D jack.transformations.boost-locked-region-priority.classname=com.android.server.am.ActivityManagerService \
+ -D jack.transformations.boost-locked-region-priority.request=com.android.server.am.ActivityManagerService\#boostPriorityForLockedSection \
+ -D jack.transformations.boost-locked-region-priority.reset=com.android.server.am.ActivityManagerService\#resetPriorityAfterLockedSection
+
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 0a814ab579d3..5e8687a904c1 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -613,7 +613,20 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
"Need BLUETOOTH ADMIN permission");
if (DBG) {
Slog.d(TAG,"enable(): mBluetooth =" + mBluetooth +
- " mBinding = " + mBinding);
+ " mBinding = " + mBinding + " mState = " + mState);
+ }
+ // We do not honor ON requests when the adapter is already turned ON or in the process of
+ // turning ON.
+ // As a protective mechanism to make sure that the native stack gets cleaned up properly
+ // before turning it back ON we ignore requests while the bluetooth is turning OFF.
+ // Bug: b/28318203
+ if (mState == BluetoothAdapter.STATE_BLE_TURNING_OFF ||
+ mState == BluetoothAdapter.STATE_TURNING_OFF ||
+ mState == BluetoothAdapter.STATE_ON ||
+ mState == BluetoothAdapter.STATE_BLE_ON ||
+ mState == BluetoothAdapter.STATE_TURNING_ON ||
+ mState == BluetoothAdapter.STATE_BLE_TURNING_ON) {
+ return false;
}
synchronized(mReceiver) {
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index dec5e4184bff..3194d891a0e0 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -628,6 +628,30 @@ public final class ActivityManagerService extends ActivityManagerNative
return mShowDialogs && !mSleeping && !mShuttingDown;
}
+ // it's a semaphore; boost when 0->1, reset when 1->0
+ static ThreadLocal<Integer> sIsBoosted = new ThreadLocal<Integer>() {
+ @Override protected Integer initialValue() {
+ return 0;
+ }
+ };
+
+ static void boostPriorityForLockedSection() {
+ if (sIsBoosted.get() == 0) {
+ // boost to prio 118 while holding a global lock
+ Process.setThreadPriority(Process.myTid(), -2);
+ //Log.e(TAG, "PRIORITY BOOST: set priority on TID " + Process.myTid());
+ }
+ int cur = sIsBoosted.get();
+ sIsBoosted.set(cur + 1);
+ }
+
+ static void resetPriorityAfterLockedSection() {
+ sIsBoosted.set(sIsBoosted.get() - 1);
+ if (sIsBoosted.get() == 0) {
+ //Log.e(TAG, "PRIORITY BOOST: reset priority on TID " + Process.myTid());
+ Process.setThreadPriority(Process.myTid(), 0);
+ }
+ }
public class PendingAssistExtras extends Binder implements Runnable {
public final ActivityRecord activity;
public final Bundle extras;
diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java
index ad57ae2cecb3..dc4d7b1d8a05 100644
--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -1396,11 +1396,18 @@ class ActivityStarter {
final TaskRecord task = mSupervisor.anyTaskForIdLocked(mOptions.getLaunchTaskId());
intentActivity = task != null ? task.getTopActivity() : null;
} else if (putIntoExistingTask) {
- // See if there is a task to bring to the front. If this is a SINGLE_INSTANCE
- // activity, there can be one and only one instance of it in the history, and it is
- // always in its own unique task, so we do a special search.
- intentActivity = mLaunchSingleInstance ? mSupervisor.findActivityLocked(mIntent, mStartActivity.info)
- : mSupervisor.findTaskLocked(mStartActivity);
+ if (mLaunchSingleInstance) {
+ // There can be one and only one instance of single instance activity in the
+ // history, and it is always in its own unique task, so we do a special search.
+ intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info);
+ } else if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0) {
+ // For the launch adjacent case we only want to put the activity in an existing
+ // task if the activity already exists in the history.
+ intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info);
+ } else {
+ // Otherwise find the best task to put the activity in.
+ intentActivity = mSupervisor.findTaskLocked(mStartActivity);
+ }
}
return intentActivity;
}
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index b5d5486140b9..0daa8ba57d69 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -219,7 +219,7 @@ public class InputManagerService extends IInputManager.Stub
private static native void nativeReloadDeviceAliases(long ptr);
private static native String nativeDump(long ptr);
private static native void nativeMonitor(long ptr);
- private static native void nativeSetPointerIconShape(long ptr, int iconId);
+ private static native void nativeSetPointerIconType(long ptr, int iconId);
private static native void nativeReloadPointerIcons(long ptr);
private static native void nativeSetCustomPointerIcon(long ptr, PointerIcon icon);
private static native void nativeSetPointerIconDetached(long ptr, boolean detached);
@@ -1691,8 +1691,8 @@ public class InputManagerService extends IInputManager.Stub
// Binder call
@Override
- public void setPointerIconShape(int iconId) {
- nativeSetPointerIconShape(mPtr, iconId);
+ public void setPointerIconType(int iconId) {
+ nativeSetPointerIconType(mPtr, iconId);
}
// Binder call
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index fe6ecbd0a770..04be34a81579 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -92,6 +92,7 @@ import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
+import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
@@ -174,6 +175,7 @@ public class NotificationManagerService extends SystemService {
= SystemProperties.getBoolean("debug.child_notifs", true);
static final int MAX_PACKAGE_NOTIFICATIONS = 50;
+ static final float MAX_PACKAGE_ENQUEUE_RATE = 50f;
// message codes
static final int MESSAGE_TIMEOUT = 2;
@@ -216,6 +218,7 @@ public class NotificationManagerService extends SystemService {
/** notification_enqueue status value for an ignored notification. */
private static final int EVENTLOG_ENQUEUE_STATUS_IGNORED = 2;
+ private static final long MIN_PACKAGE_OVERRATE_LOG_INTERVAL = 5000; // milliseconds
private String mRankerServicePackageName;
private IActivityManager mAm;
@@ -295,6 +298,7 @@ public class NotificationManagerService extends SystemService {
private static final int MY_UID = Process.myUid();
private static final int MY_PID = Process.myPid();
private RankingHandler mRankingHandler;
+ private long mLastOverRateLogTime;
private static class Archive {
final int mBufferSize;
@@ -2500,6 +2504,18 @@ public class NotificationManagerService extends SystemService {
// package or a registered listener can enqueue. Prevents DOS attacks and deals with leaks.
if (!isSystemNotification && !isNotificationFromListener) {
synchronized (mNotificationList) {
+ final float appEnqueueRate = mUsageStats.getAppEnqueueRate(pkg);
+ if (appEnqueueRate > MAX_PACKAGE_ENQUEUE_RATE) {
+ mUsageStats.registerOverRateQuota(pkg);
+ final long now = SystemClock.elapsedRealtime();
+ if ((now - mLastOverRateLogTime) > MIN_PACKAGE_OVERRATE_LOG_INTERVAL) {
+ Slog.e(TAG, "Package enqueue rate is " + appEnqueueRate
+ + ". Shedding events. package=" + pkg);
+ mLastOverRateLogTime = now;
+ }
+ return;
+ }
+
int count = 0;
final int N = mNotificationList.size();
for (int i=0; i<N; i++) {
@@ -2510,6 +2526,7 @@ public class NotificationManagerService extends SystemService {
}
count++;
if (count >= MAX_PACKAGE_NOTIFICATIONS) {
+ mUsageStats.registerOverCountQuota(pkg);
Slog.e(TAG, "Package has already posted " + count
+ " notifications. Not showing more. package=" + pkg);
return;
diff --git a/services/core/java/com/android/server/notification/NotificationUsageStats.java b/services/core/java/com/android/server/notification/NotificationUsageStats.java
index b853417ac0b3..00d7a7b9e0cb 100644
--- a/services/core/java/com/android/server/notification/NotificationUsageStats.java
+++ b/services/core/java/com/android/server/notification/NotificationUsageStats.java
@@ -29,6 +29,7 @@ import android.os.HandlerThread;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
+import android.util.ArraySet;
import android.util.Log;
import com.android.internal.logging.MetricsLogger;
@@ -74,6 +75,7 @@ public class NotificationUsageStats {
// Guarded by synchronized(this).
private final Map<String, AggregatedStats> mStats = new HashMap<>();
private final ArrayDeque<AggregatedStats[]> mStatsArrays = new ArrayDeque<>();
+ private ArraySet<String> mStatExpiredkeys = new ArraySet<>();
private final SQLiteLog mSQLiteLog;
private final Context mContext;
private final Handler mHandler;
@@ -102,12 +104,26 @@ public class NotificationUsageStats {
/**
* Called when a notification has been posted.
*/
+ public synchronized float getAppEnqueueRate(String packageName) {
+ AggregatedStats stats = getOrCreateAggregatedStatsLocked(packageName);
+ if (stats != null) {
+ return stats.getEnqueueRate(SystemClock.elapsedRealtime());
+ } else {
+ return 0f;
+ }
+ }
+
+ /**
+ * Called when a notification has been posted.
+ */
public synchronized void registerPostedByApp(NotificationRecord notification) {
- notification.stats.posttimeElapsedMs = SystemClock.elapsedRealtime();
+ final long now = SystemClock.elapsedRealtime();
+ notification.stats.posttimeElapsedMs = now;
AggregatedStats[] aggregatedStatsArray = getAggregatedStatsLocked(notification);
for (AggregatedStats stats : aggregatedStatsArray) {
stats.numPostedByApp++;
+ stats.updateInterarrivalEstimate(now);
stats.countApiUse(notification);
}
releaseAggregatedStatsLocked(aggregatedStatsArray);
@@ -124,6 +140,7 @@ public class NotificationUsageStats {
AggregatedStats[] aggregatedStatsArray = getAggregatedStatsLocked(notification);
for (AggregatedStats stats : aggregatedStatsArray) {
stats.numUpdatedByApp++;
+ stats.updateInterarrivalEstimate(SystemClock.elapsedRealtime());
stats.countApiUse(notification);
}
releaseAggregatedStatsLocked(aggregatedStatsArray);
@@ -206,18 +223,37 @@ public class NotificationUsageStats {
releaseAggregatedStatsLocked(aggregatedStatsArray);
}
+ public synchronized void registerOverRateQuota(String packageName) {
+ AggregatedStats[] aggregatedStatsArray = getAggregatedStatsLocked(packageName);
+ for (AggregatedStats stats : aggregatedStatsArray) {
+ stats.numRateViolations++;
+ }
+ }
+
+ public synchronized void registerOverCountQuota(String packageName) {
+ AggregatedStats[] aggregatedStatsArray = getAggregatedStatsLocked(packageName);
+ for (AggregatedStats stats : aggregatedStatsArray) {
+ stats.numQuotaViolations++;
+ }
+ }
+
// Locked by this.
private AggregatedStats[] getAggregatedStatsLocked(NotificationRecord record) {
+ return getAggregatedStatsLocked(record.sbn.getPackageName());
+ }
+
+ // Locked by this.
+ private AggregatedStats[] getAggregatedStatsLocked(String packageName) {
if (!ENABLE_AGGREGATED_IN_MEMORY_STATS) {
return EMPTY_AGGREGATED_STATS;
}
- // TODO: expand to package-level counts in the future.
AggregatedStats[] array = mStatsArrays.poll();
if (array == null) {
- array = new AggregatedStats[1];
+ array = new AggregatedStats[2];
}
array[0] = getOrCreateAggregatedStatsLocked(DEVICE_GLOBAL_STATS);
+ array[1] = getOrCreateAggregatedStatsLocked(packageName);
return array;
}
@@ -236,6 +272,7 @@ public class NotificationUsageStats {
result = new AggregatedStats(mContext, key);
mStats.put(key, result);
}
+ result.mLastAccessTime = SystemClock.elapsedRealtime();
return result;
}
@@ -272,6 +309,7 @@ public class NotificationUsageStats {
as.dump(pw, indent);
}
pw.println(indent + "mStatsArrays.size(): " + mStatsArrays.size());
+ pw.println(indent + "mStats.size(): " + mStats.size());
}
if (ENABLE_SQLITE_LOG) {
mSQLiteLog.dump(pw, indent, filter);
@@ -279,12 +317,20 @@ public class NotificationUsageStats {
}
public synchronized void emit() {
- // TODO: expand to package-level counts in the future.
AggregatedStats stats = getOrCreateAggregatedStatsLocked(DEVICE_GLOBAL_STATS);
stats.emit();
- mLastEmitTime = SystemClock.elapsedRealtime();
mHandler.removeMessages(MSG_EMIT);
mHandler.sendEmptyMessageDelayed(MSG_EMIT, EMIT_PERIOD);
+ for(String key: mStats.keySet()) {
+ if (mStats.get(key).mLastAccessTime < mLastEmitTime) {
+ mStatExpiredkeys.add(key);
+ }
+ }
+ for(String key: mStatExpiredkeys) {
+ mStats.remove(key);
+ }
+ mStatExpiredkeys.clear();
+ mLastEmitTime = SystemClock.elapsedRealtime();
}
/**
@@ -326,6 +372,10 @@ public class NotificationUsageStats {
public ImportanceHistogram noisyImportance;
public ImportanceHistogram quietImportance;
public ImportanceHistogram finalImportance;
+ public RateEstimator enqueueRate;
+ public int numRateViolations;
+ public int numQuotaViolations;
+ public long mLastAccessTime;
public AggregatedStats(Context context, String key) {
this.key = key;
@@ -334,6 +384,7 @@ public class NotificationUsageStats {
noisyImportance = new ImportanceHistogram(context, "note_imp_noisy_");
quietImportance = new ImportanceHistogram(context, "note_imp_quiet_");
finalImportance = new ImportanceHistogram(context, "note_importance_");
+ enqueueRate = new RateEstimator(mCreated);
}
public AggregatedStats getPrevious() {
@@ -444,6 +495,8 @@ public class NotificationUsageStats {
maybeCount("note_text", (numWithText - previous.numWithText));
maybeCount("note_sub_text", (numWithSubText - previous.numWithSubText));
maybeCount("note_info_text", (numWithInfoText - previous.numWithInfoText));
+ maybeCount("note_over_rate", (numRateViolations - previous.numRateViolations));
+ maybeCount("note_over_quota", (numQuotaViolations - previous.numQuotaViolations));
noisyImportance.maybeCount(previous.noisyImportance);
quietImportance.maybeCount(previous.quietImportance);
finalImportance.maybeCount(previous.finalImportance);
@@ -473,6 +526,8 @@ public class NotificationUsageStats {
previous.numWithText = numWithText;
previous.numWithSubText = numWithSubText;
previous.numWithInfoText = numWithInfoText;
+ previous.numRateViolations = numRateViolations;
+ previous.numQuotaViolations = numQuotaViolations;
noisyImportance.update(previous.noisyImportance);
quietImportance.update(previous.quietImportance);
finalImportance.update(previous.finalImportance);
@@ -493,6 +548,19 @@ public class NotificationUsageStats {
return toStringWithIndent("");
}
+ /** @return the enqueue rate if there were a new enqueue event right now. */
+ public float getEnqueueRate() {
+ return getEnqueueRate(SystemClock.elapsedRealtime());
+ }
+
+ public float getEnqueueRate(long now) {
+ return enqueueRate.getRate(now);
+ }
+
+ public void updateInterarrivalEstimate(long now) {
+ enqueueRate.update(now);
+ }
+
private String toStringWithIndent(String indent) {
StringBuilder output = new StringBuilder();
output.append(indent).append("AggregatedStats{\n");
@@ -549,6 +617,8 @@ public class NotificationUsageStats {
output.append("numWithSubText=").append(numWithSubText).append("\n");
output.append(indentPlusTwo);
output.append("numWithInfoText=").append(numWithInfoText).append("\n");
+ output.append("numRateViolations=").append(numRateViolations).append("\n");
+ output.append("numQuotaViolations=").append(numQuotaViolations).append("\n");
output.append(indentPlusTwo).append(noisyImportance.toString()).append("\n");
output.append(indentPlusTwo).append(quietImportance.toString()).append("\n");
output.append(indentPlusTwo).append(finalImportance.toString()).append("\n");
@@ -586,6 +656,9 @@ public class NotificationUsageStats {
maybePut(dump, "numWithText", numWithText);
maybePut(dump, "numWithSubText", numWithSubText);
maybePut(dump, "numWithInfoText", numWithInfoText);
+ maybePut(dump, "numRateViolations", numRateViolations);
+ maybePut(dump, "numQuotaLViolations", numQuotaViolations);
+ maybePut(dump, "notificationEnqueueRate", getEnqueueRate());
noisyImportance.maybePut(dump, previous.noisyImportance);
quietImportance.maybePut(dump, previous.quietImportance);
finalImportance.maybePut(dump, previous.finalImportance);
@@ -598,6 +671,12 @@ public class NotificationUsageStats {
dump.put(name, value);
}
}
+
+ private void maybePut(JSONObject dump, String name, float value) throws JSONException {
+ if (value > 0.0) {
+ dump.put(name, value);
+ }
+ }
}
private static class ImportanceHistogram {
diff --git a/services/core/java/com/android/server/notification/RateEstimator.java b/services/core/java/com/android/server/notification/RateEstimator.java
new file mode 100644
index 000000000000..4dc30a4c98bd
--- /dev/null
+++ b/services/core/java/com/android/server/notification/RateEstimator.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2016 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.server.notification;
+
+
+/**
+ * Exponentially weighted moving average estimator for event rate.
+ *
+ * {@hide}
+ */
+public class RateEstimator {
+ private static final double RATE_ALPHA = 0.8;
+ private static final double MINIMUM_DT = 0.0005;
+ private long mLastEventTime;
+ private float mInterarrivalTime;
+
+ public RateEstimator(long now) {
+ mLastEventTime = now;
+ }
+
+ /** Update the estimate to account for an event that jsut happened. */
+ public float update(long now) {
+ mInterarrivalTime = (float) getInterarrivalEstimate(now);
+ mLastEventTime = now;
+ return (float) (1.0 / mInterarrivalTime);
+ }
+
+ /** @return the estimated rate if there were a new event right now. */
+ public float getRate(long now) {
+ return (float) (1.0 / getInterarrivalEstimate(now));
+ }
+
+ /** @return the average inter-arrival time if there were a new event right now. */
+ private double getInterarrivalEstimate(long now) {
+ // a*iat_old + (1-a)*(t_now-t_last)
+ double dt = ((double) (now - mLastEventTime)) / 1000.0;
+ dt = Math.max(dt, MINIMUM_DT);
+ return (RATE_ALPHA * mInterarrivalTime + (1.0 - RATE_ALPHA) * dt);
+ }
+}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index b30817f53cdb..b3c5743e239c 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -5411,7 +5411,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
errorIntent.setComponent(errorComponent);
errorIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT |
Intent.FLAG_RECEIVER_FOREGROUND);
- mContext.sendBroadcastAsUser(errorIntent, UserHandle.ALL);
+ mContext.sendBroadcastAsUser(errorIntent, UserHandle.CURRENT);
}
/** {@inheritDoc} */
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index 06b93293b9ba..efd238201e7a 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -1011,7 +1011,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
public void clearWallpaper(String callingPackage, int which, int userId) {
if (DEBUG) Slog.v(TAG, "clearWallpaper");
checkPermission(android.Manifest.permission.SET_WALLPAPER);
- if (!isWallpaperSupported(callingPackage) || !isWallpaperSettingAllowed(callingPackage)) {
+ if (!isWallpaperSupported(callingPackage) || !isSetWallpaperAllowed(callingPackage)) {
return;
}
userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(),
@@ -1326,11 +1326,12 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
checkPermission(android.Manifest.permission.SET_WALLPAPER);
if ((which & (FLAG_LOCK|FLAG_SYSTEM)) == 0) {
- Slog.e(TAG, "Must specify a valid wallpaper category to set");
- return null;
+ final String msg = "Must specify a valid wallpaper category to set";
+ Slog.e(TAG, msg);
+ throw new IllegalArgumentException(msg);
}
- if (!isWallpaperSupported(callingPackage) || !isWallpaperSettingAllowed(callingPackage)) {
+ if (!isWallpaperSupported(callingPackage) || !isSetWallpaperAllowed(callingPackage)) {
return null;
}
@@ -1341,7 +1342,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
if (cropHint.isEmpty()
|| cropHint.left < 0
|| cropHint.top < 0) {
- return null;
+ throw new IllegalArgumentException("Invalid crop rect supplied: " + cropHint);
}
}
@@ -1449,7 +1450,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
@Override
public void setWallpaperComponentChecked(ComponentName name, String callingPackage) {
- if (isWallpaperSupported(callingPackage) && isWallpaperSettingAllowed(callingPackage)) {
+ if (isWallpaperSupported(callingPackage) && isSetWallpaperAllowed(callingPackage)) {
setWallpaperComponent(name);
}
}
@@ -1699,7 +1700,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
}
@Override
- public boolean isWallpaperSettingAllowed(String callingPackage) {
+ public boolean isSetWallpaperAllowed(String callingPackage) {
final PackageManager pm = mContext.getPackageManager();
String[] uidPackages = pm.getPackagesForUid(Binder.getCallingUid());
boolean uidMatchPackage = Arrays.asList(uidPackages).contains(callingPackage);
diff --git a/services/core/java/com/android/server/wm/DragState.java b/services/core/java/com/android/server/wm/DragState.java
index 0539b05fa846..c4eca08bb561 100644
--- a/services/core/java/com/android/server/wm/DragState.java
+++ b/services/core/java/com/android/server/wm/DragState.java
@@ -584,7 +584,7 @@ class DragState {
void overridePointerIconLw(int touchSource) {
mTouchSource = touchSource;
if (isFromSource(InputDevice.SOURCE_MOUSE)) {
- InputManager.getInstance().setPointerIconShape(PointerIcon.STYLE_GRABBING);
+ InputManager.getInstance().setPointerIconType(PointerIcon.TYPE_GRABBING);
}
}
}
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 0d3535495aff..b4387b98e6d7 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -18,6 +18,7 @@ package com.android.server.wm;
import static android.app.ActivityManager.RESIZE_MODE_SYSTEM_SCREEN_ROTATION;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
+import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.content.pm.ActivityInfo.RESIZE_MODE_CROP_WINDOWS;
@@ -630,8 +631,9 @@ class Task implements DimLayer.DimLayerUser {
// Anyway we don't need to synchronize position and content updates for these
// windows since they aren't at the base layer and could be moved around anyway.
if (!win.computeDragResizing() && win.mAttrs.type == TYPE_BASE_APPLICATION &&
- !mStack.getBoundsAnimating() && !win.isGoneForLayoutLw()) {
- win.mResizedWhileNotDragResizing = true;
+ !mStack.getBoundsAnimating() && !win.isGoneForLayoutLw() &&
+ !inPinnedWorkspace()) {
+ win.setResizedWhileNotDragResizing(true);
}
}
if (win.isGoneForLayoutLw()) {
@@ -710,6 +712,10 @@ class Task implements DimLayer.DimLayerUser {
return mStack != null && mStack.mStackId == DOCKED_STACK_ID;
}
+ boolean inPinnedWorkspace() {
+ return mStack != null && mStack.mStackId == PINNED_STACK_ID;
+ }
+
boolean isResizeableByDockedStack() {
final DisplayContent displayContent = getDisplayContent();
return displayContent != null && displayContent.getDockedStackLocked() != null
diff --git a/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java b/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java
index 3dc512f44224..fb556d23cdd3 100644
--- a/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java
+++ b/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java
@@ -26,12 +26,12 @@ import android.view.WindowManagerPolicy.PointerEventListener;
import com.android.server.wm.WindowManagerService.H;
-import static android.view.PointerIcon.STYLE_NOT_SPECIFIED;
-import static android.view.PointerIcon.STYLE_DEFAULT;
-import static android.view.PointerIcon.STYLE_HORIZONTAL_DOUBLE_ARROW;
-import static android.view.PointerIcon.STYLE_VERTICAL_DOUBLE_ARROW;
-import static android.view.PointerIcon.STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW;
-import static android.view.PointerIcon.STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW;
+import static android.view.PointerIcon.TYPE_NOT_SPECIFIED;
+import static android.view.PointerIcon.TYPE_DEFAULT;
+import static android.view.PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW;
+import static android.view.PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW;
+import static android.view.PointerIcon.TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW;
+import static android.view.PointerIcon.TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW;
public class TaskTapPointerEventListener implements PointerEventListener {
@@ -43,7 +43,7 @@ public class TaskTapPointerEventListener implements PointerEventListener {
private boolean mTwoFingerScrolling;
private boolean mInGestureDetection;
private GestureDetector mGestureDetector;
- private int mPointerIconShape = STYLE_NOT_SPECIFIED;
+ private int mPointerIconType = TYPE_NOT_SPECIFIED;
public TaskTapPointerEventListener(WindowManagerService service,
DisplayContent displayContent) {
@@ -91,39 +91,39 @@ public class TaskTapPointerEventListener implements PointerEventListener {
final Task task = mDisplayContent.findTaskForControlPoint(x, y);
InputDevice inputDevice = motionEvent.getDevice();
if (task == null || inputDevice == null) {
- mPointerIconShape = STYLE_NOT_SPECIFIED;
+ mPointerIconType = TYPE_NOT_SPECIFIED;
break;
}
task.getDimBounds(mTmpRect);
if (!mTmpRect.isEmpty() && !mTmpRect.contains(x, y)) {
- int iconShape = STYLE_DEFAULT;
+ int iconType = TYPE_DEFAULT;
if (x < mTmpRect.left) {
- iconShape =
- (y < mTmpRect.top) ? STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW :
- (y > mTmpRect.bottom) ? STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW :
- STYLE_HORIZONTAL_DOUBLE_ARROW;
+ iconType =
+ (y < mTmpRect.top) ? TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW :
+ (y > mTmpRect.bottom) ? TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW :
+ TYPE_HORIZONTAL_DOUBLE_ARROW;
} else if (x > mTmpRect.right) {
- iconShape =
- (y < mTmpRect.top) ? STYLE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW :
- (y > mTmpRect.bottom) ? STYLE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW :
- STYLE_HORIZONTAL_DOUBLE_ARROW;
+ iconType =
+ (y < mTmpRect.top) ? TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW :
+ (y > mTmpRect.bottom) ? TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW :
+ TYPE_HORIZONTAL_DOUBLE_ARROW;
} else if (y < mTmpRect.top || y > mTmpRect.bottom) {
- iconShape = STYLE_VERTICAL_DOUBLE_ARROW;
+ iconType = TYPE_VERTICAL_DOUBLE_ARROW;
}
- if (mPointerIconShape != iconShape) {
- mPointerIconShape = iconShape;
- inputDevice.setPointerShape(iconShape);
+ if (mPointerIconType != iconType) {
+ mPointerIconType = iconType;
+ inputDevice.setPointerType(iconType);
}
} else {
- mPointerIconShape = STYLE_NOT_SPECIFIED;
+ mPointerIconType = TYPE_NOT_SPECIFIED;
}
} break;
case MotionEvent.ACTION_HOVER_EXIT:
- mPointerIconShape = STYLE_NOT_SPECIFIED;
+ mPointerIconType = TYPE_NOT_SPECIFIED;
InputDevice inputDevice = motionEvent.getDevice();
if (inputDevice != null) {
- inputDevice.setPointerShape(STYLE_DEFAULT);
+ inputDevice.setPointerType(TYPE_DEFAULT);
}
break;
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index ca8b7e55a46b..82cd0fa0c25d 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -3066,9 +3066,9 @@ public class WindowManagerService extends IWindowManager.Stub
// If we're starting a drag-resize, we'll be changing the surface size as well as
// notifying the client to render to with an offset from the surface's top-left.
- if (win.isDragResizeChanged() || win.mResizedWhileNotDragResizing) {
+ if (win.isDragResizeChanged() || win.isResizedWhileNotDragResizing()) {
win.setDragResizing();
- win.mResizedWhileNotDragResizing = false;
+ win.setResizedWhileNotDragResizing(false);
// We can only change top level windows to the full-screen surface when
// resizing (as we only have one full-screen surface). So there is no need
// to preserve and destroy windows which are attached to another, they
@@ -9272,7 +9272,7 @@ public class WindowManagerService extends IWindowManager.Stub
|| w.mOutsetsChanged
|| configChanged
|| dragResizingChanged
- || w.mResizedWhileNotDragResizing) {
+ || !w.isResizedWhileNotDragResizingReported()) {
if (DEBUG_RESIZE || DEBUG_ORIENTATION) {
Slog.v(TAG_WM, "Resize reasons for w=" + w + ": "
+ " contentInsetsChanged=" + w.mContentInsetsChanged
@@ -9286,7 +9286,8 @@ public class WindowManagerService extends IWindowManager.Stub
+ " surfaceResized=" + winAnimator.mSurfaceResized
+ " configChanged=" + configChanged
+ " dragResizingChanged=" + dragResizingChanged
- + " resizedWhileNotDragResizing=" + w.mResizedWhileNotDragResizing);
+ + " resizedWhileNotDragResizingReported="
+ + w.isResizedWhileNotDragResizingReported());
}
// If it's a dead window left on screen, and the configuration changed,
@@ -9308,7 +9309,7 @@ public class WindowManagerService extends IWindowManager.Stub
// we need to go through the process of getting informed by the
// application when it has finished drawing.
if (w.mOrientationChanging || dragResizingChanged
- || w.mResizedWhileNotDragResizing) {
+ || w.isResizedWhileNotDragResizing()) {
if (DEBUG_SURFACE_TRACE || DEBUG_ANIM || DEBUG_ORIENTATION || DEBUG_RESIZE) {
Slog.v(TAG_WM, "Orientation or resize start waiting for draw"
+ ", mDrawState=DRAW_PENDING in " + w
@@ -11098,7 +11099,7 @@ public class WindowManagerService extends IWindowManager.Stub
Slog.w(TAG_WM, "unable to restore pointer icon");
}
} else {
- InputManager.getInstance().setPointerIconShape(PointerIcon.STYLE_DEFAULT);
+ InputManager.getInstance().setPointerIconType(PointerIcon.TYPE_DEFAULT);
}
}
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 25709548254f..e5e74a663eb0 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -486,12 +486,11 @@ final class WindowState implements WindowManagerPolicy.WindowState {
*/
boolean mResizedWhileGone = false;
- /**
- * Indicates whether we got resized but drag resizing flag was false. In this case, we also
- * need to recreate the surface and defer surface bound updates in order to make sure the
- * buffer contents and the positioning/size stay in sync.
- */
- boolean mResizedWhileNotDragResizing;
+ /** @see #isResizedWhileNotDragResizing(). */
+ private boolean mResizedWhileNotDragResizing;
+
+ /** @see #isResizedWhileNotDragResizingReported(). */
+ private boolean mResizedWhileNotDragResizingReported;
WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
WindowState attachedWindow, int appOp, int seq, WindowManager.LayoutParams a,
@@ -2326,6 +2325,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
mVisibleInsetsChanged = false;
mStableInsetsChanged = false;
mOutsetsChanged = false;
+ mResizedWhileNotDragResizingReported = true;
mWinAnimator.mSurfaceResized = false;
} catch (RemoteException e) {
mOrientationChanging = false;
@@ -2428,6 +2428,32 @@ final class WindowState implements WindowManagerPolicy.WindowState {
mDragResizingChangeReported = false;
}
+ /**
+ * Set whether we got resized but drag resizing flag was false.
+ * @see #isResizedWhileNotDragResizing().
+ */
+ void setResizedWhileNotDragResizing(boolean resizedWhileNotDragResizing) {
+ mResizedWhileNotDragResizing = resizedWhileNotDragResizing;
+ mResizedWhileNotDragResizingReported = !resizedWhileNotDragResizing;
+ }
+
+ /**
+ * Indicates whether we got resized but drag resizing flag was false. In this case, we also
+ * need to recreate the surface and defer surface bound updates in order to make sure the
+ * buffer contents and the positioning/size stay in sync.
+ */
+ boolean isResizedWhileNotDragResizing() {
+ return mResizedWhileNotDragResizing;
+ }
+
+ /**
+ * @return Whether we reported "resize while not drag resizing" to the application.
+ * @see #isResizedWhileNotDragResizing()
+ */
+ boolean isResizedWhileNotDragResizingReported() {
+ return mResizedWhileNotDragResizingReported;
+ }
+
int getResizeMode() {
return mResizeMode;
}
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 54c421406ebc..aea395de6c0f 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -1408,7 +1408,7 @@ class WindowStateAnimator {
final Task task = w.getTask();
// We got resized, so block all updates until we got the new surface.
- if (w.mResizedWhileNotDragResizing && !w.isGoneForLayoutLw()) {
+ if (w.isResizedWhileNotDragResizing() && !w.isGoneForLayoutLw()) {
return;
}
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index cd485c55c816..2e82cec7e9d9 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -204,7 +204,7 @@ public:
void setShowTouches(bool enabled);
void setInteractive(bool interactive);
void reloadCalibration();
- void setPointerIconShape(int32_t iconId);
+ void setPointerIconType(int32_t iconId);
void reloadPointerIcons();
void setCustomPointerIcon(const SpriteIcon& icon);
void setPointerIconDetached(bool detached);
@@ -785,11 +785,11 @@ void NativeInputManager::reloadCalibration() {
InputReaderConfiguration::CHANGE_TOUCH_AFFINE_TRANSFORMATION);
}
-void NativeInputManager::setPointerIconShape(int32_t iconId) {
+void NativeInputManager::setPointerIconType(int32_t iconId) {
AutoMutex _l(mLock);
sp<PointerController> controller = mLocked.pointerController.promote();
if (controller != NULL) {
- controller->updatePointerShape(iconId);
+ controller->updatePointerIcon(iconId);
}
}
@@ -1462,9 +1462,9 @@ static void nativeMonitor(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) {
im->getInputManager()->getDispatcher()->monitor();
}
-static void nativeSetPointerIconShape(JNIEnv* /* env */, jclass /* clazz */, jlong ptr, jint iconId) {
+static void nativeSetPointerIconType(JNIEnv* /* env */, jclass /* clazz */, jlong ptr, jint iconId) {
NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- im->setPointerIconShape(iconId);
+ im->setPointerIconType(iconId);
}
static void nativeReloadPointerIcons(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) {
@@ -1548,8 +1548,8 @@ static const JNINativeMethod gInputManagerMethods[] = {
(void*) nativeDump },
{ "nativeMonitor", "(J)V",
(void*) nativeMonitor },
- { "nativeSetPointerIconShape", "(JI)V",
- (void*) nativeSetPointerIconShape },
+ { "nativeSetPointerIconType", "(JI)V",
+ (void*) nativeSetPointerIconType },
{ "nativeReloadPointerIcons", "(J)V",
(void*) nativeReloadPointerIcons },
{ "nativeSetCustomPointerIcon", "(JLandroid/view/PointerIcon;)V",
diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
index c5c90e02f200..e29452a17bd0 100644
--- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
@@ -72,6 +72,18 @@ static const GnssConfigurationInterface* sGnssConfigurationInterface = NULL;
#define GPS_MAX_SATELLITE_COUNT 32
#define GNSS_MAX_SATELLITE_COUNT 64
+// Let these through, with ID remapped by offset
+#define GLONASS_SVID_OFFSET 64
+#define GLONASS_SVID_COUNT 24
+#define BEIDOU_SVID_OFFSET 200
+#define BEIDOU_SVID_COUNT 35
+
+// Let these through, with no ID remapping
+#define SBAS_SVID_MIN 120
+#define SBAS_SVID_MAX 151
+#define QZSS_SVID_MIN 193
+#define QZSS_SVID_MAX 200
+
#define SVID_SHIFT_WIDTH 7
#define CONSTELLATION_TYPE_SHIFT_WIDTH 3
@@ -134,8 +146,21 @@ static void sv_status_callback(GpsSvStatus* sv_status)
for (size_t i = 0; i < sGnssSvListSize; i++) {
GnssSvInfo& info = sGnssSvList[i];
info.svid = sv_status->sv_list[i].prn;
+ // Defacto mapping from the overused API that was designed for GPS-only
if (info.svid >=1 && info.svid <= 32) {
info.constellation = GNSS_CONSTELLATION_GPS;
+ } else if (info.svid > GLONASS_SVID_OFFSET &&
+ info.svid <= GLONASS_SVID_OFFSET + GLONASS_SVID_COUNT) {
+ info.constellation = GNSS_CONSTELLATION_GLONASS;
+ info.svid -= GLONASS_SVID_OFFSET;
+ } else if (info.svid > BEIDOU_SVID_OFFSET &&
+ info.svid <= BEIDOU_SVID_OFFSET + BEIDOU_SVID_COUNT) {
+ info.constellation = GNSS_CONSTELLATION_BEIDOU;
+ info.svid -= BEIDOU_SVID_OFFSET;
+ } else if (info.svid >= SBAS_SVID_MIN && info.svid <= SBAS_SVID_MAX) {
+ info.constellation = GNSS_CONSTELLATION_SBAS;
+ } else if (info.svid >= QZSS_SVID_MIN && info.svid <= QZSS_SVID_MAX) {
+ info.constellation = GNSS_CONSTELLATION_QZSS;
} else {
ALOGD("Unknown constellation type with Svid = %d.", info.svid);
info.constellation = GNSS_CONSTELLATION_UNKNOWN;
@@ -144,7 +169,8 @@ static void sv_status_callback(GpsSvStatus* sv_status)
info.elevation = sv_status->sv_list[i].elevation;
info.azimuth = sv_status->sv_list[i].azimuth;
info.flags = GNSS_SV_FLAGS_NONE;
- if (info.svid > 0 && info.svid <= 32) {
+ // Only GPS info is valid for these fields, as these masks are just 32 bits, by GPS prn
+ if (info.constellation == GNSS_CONSTELLATION_GPS) {
int32_t this_svid_mask = (1 << (info.svid - 1));
if ((ephemeris_mask & this_svid_mask) != 0) {
info.flags |= GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA;
diff --git a/services/tests/servicestests/src/com/android/server/notification/RateEstimatorTest.java b/services/tests/servicestests/src/com/android/server/notification/RateEstimatorTest.java
new file mode 100644
index 000000000000..cc0920f506a8
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/notification/RateEstimatorTest.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2016 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.server.notification;
+
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+
+public class RateEstimatorTest extends AndroidTestCase {
+ private long mTestStartTime;
+ private RateEstimator mEstimator;
+
+ @Override
+ public void setUp() {
+ mTestStartTime = 1225731600000L;
+ mEstimator = new RateEstimator(mTestStartTime);
+ }
+
+ @SmallTest
+ public void testRunningTimeBackwardDoesntExplodeUpdate() throws Exception {
+ final float rate = mEstimator.update(mTestStartTime - 1000L);
+ assertFalse(Float.isInfinite(rate));
+ assertFalse(Float.isNaN(rate));
+ }
+
+ @SmallTest
+ public void testRunningTimeBackwardDoesntExplodeGet() throws Exception {
+ final float rate = mEstimator.getRate(mTestStartTime - 1000L);
+ assertFalse(Float.isInfinite(rate));
+ assertFalse(Float.isNaN(rate));
+ }
+
+ @SmallTest
+ public void testInstantaneousEventsDontExplodeUpdate() throws Exception {
+ final float rate = mEstimator.update(mTestStartTime);
+ assertFalse(Float.isInfinite(rate));
+ assertFalse(Float.isNaN(rate));
+ }
+
+ @SmallTest
+ public void testInstantaneousEventsDontExplodeGet() throws Exception {
+ final float rate = mEstimator.getRate(mTestStartTime);
+ assertFalse(Float.isInfinite(rate));
+ assertFalse(Float.isNaN(rate));
+ }
+
+ @SmallTest
+ public void testCompactBurstIsEstimatedUnderTwoPercent() throws Exception {
+ long eventStart = mTestStartTime + 1000; // start event a long time after initialization
+ long nextEventTime = postEvents(eventStart, 1, 5); // five events at 1000Hz
+ final float rate = mEstimator.getRate(nextEventTime);
+ assertLessThan("Rate", rate, 20f);
+ }
+
+ @SmallTest
+ public void testSustained1000HzBurstIsEstimatedOverNinetyPercent() throws Exception {
+ long eventStart = mTestStartTime + 1000; // start event a long time after initialization
+ long nextEventTime = postEvents(eventStart, 1, 100); // one hundred events at 1000Hz
+ final float rate = mEstimator.getRate(nextEventTime);
+ assertGreaterThan("Rate", rate, 900f);
+ }
+
+ @SmallTest
+ public void testSustained100HzBurstIsEstimatedOverNinetyPercent() throws Exception {
+ long eventStart = mTestStartTime + 1000; // start event a long time after initialization
+ long nextEventTime = postEvents(eventStart, 10, 100); // one hundred events at 100Hz
+ final float rate = mEstimator.getRate(nextEventTime);
+
+ assertGreaterThan("Rate", rate, 90f);
+ }
+
+ @SmallTest
+ public void testRecoverQuicklyAfterSustainedBurst() throws Exception {
+ long eventStart = mTestStartTime + 1000; // start event a long time after initialization
+ long nextEventTime = postEvents(eventStart, 10, 1000); // one hundred events at 100Hz
+ final float rate = mEstimator.getRate(nextEventTime + 5000L); // two seconds later
+ assertLessThan("Rate", rate, 2f);
+ }
+
+ @SmallTest
+ public void testEstimateShouldNotOvershoot() throws Exception {
+ long eventStart = mTestStartTime + 1000; // start event a long time after initialization
+ long nextEventTime = postEvents(eventStart, 1, 1000); // one thousand events at 1000Hz
+ final float rate = mEstimator.getRate(nextEventTime);
+ assertLessThan("Rate", rate, 1000f);
+ }
+
+ private void assertLessThan(String label, float a, float b) {
+ assertTrue(String.format("%s was %f, but should be less than %f", label, a, b), a < b);
+ }
+
+ private void assertGreaterThan(String label, float a, float b) {
+ assertTrue(String.format("%s was %f, but should be more than %f", label, a, b), a > b);
+ }
+
+ /** @returns the next event time. */
+ private long postEvents(long start, long dt, int num) {
+ long time = start;
+ for (int i = 0; i < num; i++) {
+ mEstimator.update(time);
+ time += dt;
+ }
+ return time;
+ }
+}
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 39a12070a69b..43f8739f74fd 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -287,11 +287,16 @@ public final class Call {
public static final int PROPERTY_HIGH_DEF_AUDIO = 0x00000010;
/**
- * Whether the call is associated with the work profile.
+ * @deprecated Use {@link #PROPERTY_ENTERPRISE_CALL} instead.
*/
public static final int PROPERTY_WORK_CALL = 0x00000020;
/**
+ * Whether the call is associated with the work profile.
+ */
+ public static final int PROPERTY_ENTERPRISE_CALL = 0x00000020;
+
+ /**
* When set, indicates that this {@code Call} does not actually exist locally for the
* {@link ConnectionService}.
* <p>
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 33e6cea7c77f..78efd055aa6d 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -459,12 +459,13 @@ public class CarrierConfigManager {
/**
* Whether cellular data is required to access visual voicemail.
*/
- public static final String KEY_VVM_CELLULAR_DATA_REQUIRED_BOOL = "vvm_cellular_data_required";
+ public static final String KEY_VVM_CELLULAR_DATA_REQUIRED_BOOL =
+ "vvm_cellular_data_required_bool";
/**
* Whether to prefetch audio data on new voicemail arrival, defaulted to true.
*/
- public static final String KEY_VVM_PREFETCH_BOOL = "vvm_prefetch";
+ public static final String KEY_VVM_PREFETCH_BOOL = "vvm_prefetch_bool";
/**
* The package name of the carrier's visual voicemail app to ensure that dialer visual voicemail