summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt23
-rw-r--r--api/system-current.txt23
-rw-r--r--api/test-current.txt23
-rw-r--r--core/java/android/accessibilityservice/AccessibilityService.java8
-rw-r--r--core/java/android/content/res/ComplexColor.java1
-rw-r--r--core/java/android/content/res/GradientColor.java1
-rw-r--r--core/java/android/content/res/Resources.java3
-rw-r--r--core/java/android/content/res/TypedArray.java1
-rw-r--r--core/java/android/text/util/Linkify.java203
-rw-r--r--core/java/android/widget/RemoteViews.java23
-rw-r--r--core/tests/coretests/res/layout/remote_views_test.xml32
-rw-r--r--core/tests/coretests/src/android/view/RemoteViewsTest.java127
-rw-r--r--graphics/java/android/graphics/drawable/VectorDrawable.java11
-rw-r--r--libs/hwui/BakedOpState.cpp10
-rw-r--r--libs/hwui/BakedOpState.h19
-rw-r--r--libs/hwui/FrameBuilder.cpp4
-rw-r--r--libs/hwui/FrameBuilder.h4
-rw-r--r--libs/hwui/RecordedOp.h13
-rw-r--r--libs/hwui/RecordingCanvas.cpp26
-rw-r--r--libs/hwui/tests/unit/RecordingCanvasTests.cpp3
-rw-r--r--media/java/android/media/AudioDeviceCallback.java2
-rw-r--r--packages/Keyguard/res/values/strings.xml2
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java2
-rw-r--r--services/backup/java/com/android/server/backup/BackupManagerService.java30
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java10
-rw-r--r--telephony/java/android/telephony/CarrierConfigManager.java21
-rw-r--r--telephony/java/com/android/internal/telephony/RILConstants.java8
-rw-r--r--tools/aapt/Bundle.h2
-rw-r--r--tools/aapt/Images.cpp26
29 files changed, 474 insertions, 187 deletions
diff --git a/api/current.txt b/api/current.txt
index 4c069cd1afa1..936ca882ce14 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -10101,27 +10101,22 @@ package android.content.res {
method public final long skip(long) throws java.io.IOException;
}
- public class ColorStateList extends android.content.res.ComplexColor implements android.os.Parcelable {
+ public class ColorStateList implements android.os.Parcelable {
ctor public ColorStateList(int[][], int[]);
method public static deprecated android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public static android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public int describeContents();
+ method public int getChangingConfigurations();
method public int getColorForState(int[], int);
method public int getDefaultColor();
method public boolean isOpaque();
+ method public boolean isStateful();
method public static android.content.res.ColorStateList valueOf(int);
method public android.content.res.ColorStateList withAlpha(int);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.content.res.ColorStateList> CREATOR;
}
- public abstract class ComplexColor {
- ctor public ComplexColor();
- method public int getChangingConfigurations();
- method public abstract int getDefaultColor();
- method public boolean isStateful();
- }
-
public final class Configuration implements java.lang.Comparable android.os.Parcelable {
ctor public Configuration();
ctor public Configuration(android.content.res.Configuration);
@@ -10225,11 +10220,6 @@ package android.content.res {
field public int uiMode;
}
- public class GradientColor extends android.content.res.ComplexColor {
- method public static android.content.res.GradientColor createFromXml(android.content.res.Resources, android.content.res.XmlResourceParser, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
- method public int getDefaultColor();
- }
-
public class ObbInfo implements android.os.Parcelable {
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
@@ -10289,7 +10279,6 @@ package android.content.res {
method public void getValue(java.lang.String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
method public void getValueForDensity(int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
method public android.content.res.XmlResourceParser getXml(int) throws android.content.res.Resources.NotFoundException;
- method public android.content.res.ComplexColor loadComplexColor(android.util.TypedValue, int, android.content.res.Resources.Theme);
method public final android.content.res.Resources.Theme newTheme();
method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, int[]);
method public android.content.res.TypedArray obtainTypedArray(int) throws android.content.res.Resources.NotFoundException;
@@ -10325,7 +10314,6 @@ package android.content.res {
method public int getChangingConfigurations();
method public int getColor(int, int);
method public android.content.res.ColorStateList getColorStateList(int);
- method public android.content.res.ComplexColor getComplexColor(int);
method public float getDimension(int, float);
method public int getDimensionPixelOffset(int, int);
method public int getDimensionPixelSize(int, int);
@@ -36719,11 +36707,10 @@ package android.telephony {
method public void notifyConfigChanged(int);
method public deprecated void notifyConfigChangedForSubId(int);
field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
- field public static final java.lang.String BOOL_ALLOW_EMERGENCY_VIDEO_CALLS = "bool_allow_emergency_video_calls";
- field public static final java.lang.String BOOL_ALLOW_VIDEO_PAUSE = "bool_allow_video_pause";
field public static final java.lang.String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool";
field public static final java.lang.String KEY_ALLOW_ADDING_APNS_BOOL = "allow_adding_apns_bool";
field public static final java.lang.String KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL = "allow_emergency_numbers_in_call_log_bool";
+ field public static final java.lang.String KEY_ALLOW_EMERGENCY_VIDEO_CALLS_BOOL = "allow_emergency_video_calls_bool";
field public static final java.lang.String KEY_ALLOW_LOCAL_DTMF_TONES_BOOL = "allow_local_dtmf_tones_bool";
field public static final java.lang.String KEY_ALLOW_NON_EMERGENCY_CALLS_IN_ECM_BOOL = "allow_non_emergency_calls_in_ecm_bool";
field public static final java.lang.String KEY_ALWAYS_SHOW_EMERGENCY_ALERT_ONOFF_BOOL = "always_show_emergency_alert_onoff_bool";
@@ -39766,8 +39753,10 @@ package android.text.util {
method public static final boolean addLinks(android.widget.TextView, int);
method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String);
method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String, android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
+ method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String, java.lang.String[], android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String);
method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String, android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
+ method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String, java.lang.String[], android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
field public static final int ALL = 15; // 0xf
field public static final int EMAIL_ADDRESSES = 2; // 0x2
field public static final int MAP_ADDRESSES = 8; // 0x8
diff --git a/api/system-current.txt b/api/system-current.txt
index 1ed7ac2ec6be..f8863e53d8ba 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -10499,27 +10499,22 @@ package android.content.res {
method public final long skip(long) throws java.io.IOException;
}
- public class ColorStateList extends android.content.res.ComplexColor implements android.os.Parcelable {
+ public class ColorStateList implements android.os.Parcelable {
ctor public ColorStateList(int[][], int[]);
method public static deprecated android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public static android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public int describeContents();
+ method public int getChangingConfigurations();
method public int getColorForState(int[], int);
method public int getDefaultColor();
method public boolean isOpaque();
+ method public boolean isStateful();
method public static android.content.res.ColorStateList valueOf(int);
method public android.content.res.ColorStateList withAlpha(int);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.content.res.ColorStateList> CREATOR;
}
- public abstract class ComplexColor {
- ctor public ComplexColor();
- method public int getChangingConfigurations();
- method public abstract int getDefaultColor();
- method public boolean isStateful();
- }
-
public final class Configuration implements java.lang.Comparable android.os.Parcelable {
ctor public Configuration();
ctor public Configuration(android.content.res.Configuration);
@@ -10623,11 +10618,6 @@ package android.content.res {
field public int uiMode;
}
- public class GradientColor extends android.content.res.ComplexColor {
- method public static android.content.res.GradientColor createFromXml(android.content.res.Resources, android.content.res.XmlResourceParser, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
- method public int getDefaultColor();
- }
-
public class ObbInfo implements android.os.Parcelable {
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
@@ -10687,7 +10677,6 @@ package android.content.res {
method public void getValue(java.lang.String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
method public void getValueForDensity(int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
method public android.content.res.XmlResourceParser getXml(int) throws android.content.res.Resources.NotFoundException;
- method public android.content.res.ComplexColor loadComplexColor(android.util.TypedValue, int, android.content.res.Resources.Theme);
method public final android.content.res.Resources.Theme newTheme();
method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, int[]);
method public android.content.res.TypedArray obtainTypedArray(int) throws android.content.res.Resources.NotFoundException;
@@ -10723,7 +10712,6 @@ package android.content.res {
method public int getChangingConfigurations();
method public int getColor(int, int);
method public android.content.res.ColorStateList getColorStateList(int);
- method public android.content.res.ComplexColor getComplexColor(int);
method public float getDimension(int, float);
method public int getDimensionPixelOffset(int, int);
method public int getDimensionPixelSize(int, int);
@@ -39380,11 +39368,10 @@ package android.telephony {
method public deprecated void notifyConfigChangedForSubId(int);
method public void updateConfigForPhoneId(int, java.lang.String);
field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
- field public static final java.lang.String BOOL_ALLOW_EMERGENCY_VIDEO_CALLS = "bool_allow_emergency_video_calls";
- field public static final java.lang.String BOOL_ALLOW_VIDEO_PAUSE = "bool_allow_video_pause";
field public static final java.lang.String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool";
field public static final java.lang.String KEY_ALLOW_ADDING_APNS_BOOL = "allow_adding_apns_bool";
field public static final java.lang.String KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL = "allow_emergency_numbers_in_call_log_bool";
+ field public static final java.lang.String KEY_ALLOW_EMERGENCY_VIDEO_CALLS_BOOL = "allow_emergency_video_calls_bool";
field public static final java.lang.String KEY_ALLOW_LOCAL_DTMF_TONES_BOOL = "allow_local_dtmf_tones_bool";
field public static final java.lang.String KEY_ALLOW_NON_EMERGENCY_CALLS_IN_ECM_BOOL = "allow_non_emergency_calls_in_ecm_bool";
field public static final java.lang.String KEY_ALWAYS_SHOW_EMERGENCY_ALERT_ONOFF_BOOL = "always_show_emergency_alert_onoff_bool";
@@ -42491,8 +42478,10 @@ package android.text.util {
method public static final boolean addLinks(android.widget.TextView, int);
method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String);
method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String, android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
+ method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String, java.lang.String[], android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String);
method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String, android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
+ method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String, java.lang.String[], android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
field public static final int ALL = 15; // 0xf
field public static final int EMAIL_ADDRESSES = 2; // 0x2
field public static final int MAP_ADDRESSES = 8; // 0x8
diff --git a/api/test-current.txt b/api/test-current.txt
index c0f551a83039..6327dc2200d1 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -10111,27 +10111,22 @@ package android.content.res {
method public final long skip(long) throws java.io.IOException;
}
- public class ColorStateList extends android.content.res.ComplexColor implements android.os.Parcelable {
+ public class ColorStateList implements android.os.Parcelable {
ctor public ColorStateList(int[][], int[]);
method public static deprecated android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public static android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public int describeContents();
+ method public int getChangingConfigurations();
method public int getColorForState(int[], int);
method public int getDefaultColor();
method public boolean isOpaque();
+ method public boolean isStateful();
method public static android.content.res.ColorStateList valueOf(int);
method public android.content.res.ColorStateList withAlpha(int);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.content.res.ColorStateList> CREATOR;
}
- public abstract class ComplexColor {
- ctor public ComplexColor();
- method public int getChangingConfigurations();
- method public abstract int getDefaultColor();
- method public boolean isStateful();
- }
-
public final class Configuration implements java.lang.Comparable android.os.Parcelable {
ctor public Configuration();
ctor public Configuration(android.content.res.Configuration);
@@ -10235,11 +10230,6 @@ package android.content.res {
field public int uiMode;
}
- public class GradientColor extends android.content.res.ComplexColor {
- method public static android.content.res.GradientColor createFromXml(android.content.res.Resources, android.content.res.XmlResourceParser, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
- method public int getDefaultColor();
- }
-
public class ObbInfo implements android.os.Parcelable {
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
@@ -10299,7 +10289,6 @@ package android.content.res {
method public void getValue(java.lang.String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
method public void getValueForDensity(int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
method public android.content.res.XmlResourceParser getXml(int) throws android.content.res.Resources.NotFoundException;
- method public android.content.res.ComplexColor loadComplexColor(android.util.TypedValue, int, android.content.res.Resources.Theme);
method public final android.content.res.Resources.Theme newTheme();
method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, int[]);
method public android.content.res.TypedArray obtainTypedArray(int) throws android.content.res.Resources.NotFoundException;
@@ -10335,7 +10324,6 @@ package android.content.res {
method public int getChangingConfigurations();
method public int getColor(int, int);
method public android.content.res.ColorStateList getColorStateList(int);
- method public android.content.res.ComplexColor getComplexColor(int);
method public float getDimension(int, float);
method public int getDimensionPixelOffset(int, int);
method public int getDimensionPixelSize(int, int);
@@ -36790,11 +36778,10 @@ package android.telephony {
method public void notifyConfigChanged(int);
method public deprecated void notifyConfigChangedForSubId(int);
field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
- field public static final java.lang.String BOOL_ALLOW_EMERGENCY_VIDEO_CALLS = "bool_allow_emergency_video_calls";
- field public static final java.lang.String BOOL_ALLOW_VIDEO_PAUSE = "bool_allow_video_pause";
field public static final java.lang.String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool";
field public static final java.lang.String KEY_ALLOW_ADDING_APNS_BOOL = "allow_adding_apns_bool";
field public static final java.lang.String KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL = "allow_emergency_numbers_in_call_log_bool";
+ field public static final java.lang.String KEY_ALLOW_EMERGENCY_VIDEO_CALLS_BOOL = "allow_emergency_video_calls_bool";
field public static final java.lang.String KEY_ALLOW_LOCAL_DTMF_TONES_BOOL = "allow_local_dtmf_tones_bool";
field public static final java.lang.String KEY_ALLOW_NON_EMERGENCY_CALLS_IN_ECM_BOOL = "allow_non_emergency_calls_in_ecm_bool";
field public static final java.lang.String KEY_ALWAYS_SHOW_EMERGENCY_ALERT_ONOFF_BOOL = "always_show_emergency_alert_onoff_bool";
@@ -39839,8 +39826,10 @@ package android.text.util {
method public static final boolean addLinks(android.widget.TextView, int);
method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String);
method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String, android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
+ method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String, java.lang.String[], android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String);
method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String, android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
+ method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String, java.lang.String[], android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
field public static final int ALL = 15; // 0xf
field public static final int EMAIL_ADDRESSES = 2; // 0x2
field public static final int MAP_ADDRESSES = 8; // 0x8
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java
index ddc5b0c7eb08..bf823f8d960f 100644
--- a/core/java/android/accessibilityservice/AccessibilityService.java
+++ b/core/java/android/accessibilityservice/AccessibilityService.java
@@ -406,7 +406,9 @@ public abstract class AccessibilityService extends Service {
/**
* Callback for {@link android.view.accessibility.AccessibilityEvent}s.
*
- * @param event An event.
+ * @param event The new event. This event is owned by the caller and cannot be used after
+ * this method returns. Services wishing to use the event after this method returns should
+ * make a copy.
*/
public abstract void onAccessibilityEvent(AccessibilityEvent event);
@@ -493,7 +495,9 @@ public abstract class AccessibilityService extends Service {
* functionality.
* <p>
*
- * @param event The event to be processed.
+ * @param event The event to be processed. This event is owned by the caller and cannot be used
+ * after this method returns. Services wishing to use the event after this method returns should
+ * make a copy.
* @return If true then the event will be consumed and not delivered to
* applications, otherwise it will be delivered as usual.
*/
diff --git a/core/java/android/content/res/ComplexColor.java b/core/java/android/content/res/ComplexColor.java
index b297764629cf..58c6fc5174d3 100644
--- a/core/java/android/content/res/ComplexColor.java
+++ b/core/java/android/content/res/ComplexColor.java
@@ -23,6 +23,7 @@ import android.graphics.Color;
/**
* Defines an abstract class for the complex color information, like
* {@link android.content.res.ColorStateList} or {@link android.content.res.GradientColor}
+ * @hide
*/
public abstract class ComplexColor {
private int mChangingConfigurations;
diff --git a/core/java/android/content/res/GradientColor.java b/core/java/android/content/res/GradientColor.java
index f29656abe6c3..c49c4b28a413 100644
--- a/core/java/android/content/res/GradientColor.java
+++ b/core/java/android/content/res/GradientColor.java
@@ -68,6 +68,7 @@ import java.lang.annotation.RetentionPolicy;
*
* Also note if any color "item" element is defined, then startColor, centerColor and endColor will
* be ignored.
+ * @hide
*/
public class GradientColor extends ComplexColor {
private static final String TAG = "GradientColor";
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index fb706fcb3c94..387fda717e48 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -999,6 +999,9 @@ public class Resources {
return mResourcesImpl.loadColorStateList(this, value, id, theme);
}
+ /**
+ * @hide
+ */
@Nullable
public ComplexColor loadComplexColor(@NonNull TypedValue value, int id, @Nullable Theme theme) {
return mResourcesImpl.loadComplexColor(this, value, id, theme);
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java
index f6ac0bac125a..92134ee01de8 100644
--- a/core/java/android/content/res/TypedArray.java
+++ b/core/java/android/content/res/TypedArray.java
@@ -475,6 +475,7 @@ public class TypedArray {
* been recycled.
* @throws UnsupportedOperationException if the attribute is defined but is
* not an integer color, color state list or GradientColor.
+ * @hide
*/
@Nullable
public ComplexColor getComplexColor(@StyleableRes int index) {
diff --git a/core/java/android/text/util/Linkify.java b/core/java/android/text/util/Linkify.java
index bd376ead2334..ca037a229b0a 100644
--- a/core/java/android/text/util/Linkify.java
+++ b/core/java/android/text/util/Linkify.java
@@ -16,6 +16,9 @@
package android.text.util;
+import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.telephony.PhoneNumberUtils;
import android.text.method.LinkMovementMethod;
import android.text.method.MovementMethod;
@@ -29,6 +32,8 @@ import android.widget.TextView;
import java.io.UnsupportedEncodingException;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
@@ -41,19 +46,21 @@ import com.android.i18n.phonenumbers.PhoneNumberMatch;
import com.android.i18n.phonenumbers.PhoneNumberUtil;
import com.android.i18n.phonenumbers.PhoneNumberUtil.Leniency;
+import libcore.util.EmptyArray;
+
/**
* Linkify take a piece of text and a regular expression and turns all of the
* regex matches in the text into clickable links. This is particularly
- * useful for matching things like email addresses, web urls, etc. and making
+ * useful for matching things like email addresses, web URLs, etc. and making
* them actionable.
*
- * Alone with the pattern that is to be matched, a url scheme prefix is also
+ * Alone with the pattern that is to be matched, a URL scheme prefix is also
* required. Any pattern match that does not begin with the supplied scheme
- * will have the scheme prepended to the matched text when the clickable url
- * is created. For instance, if you are matching web urls you would supply
- * the scheme <code>http://</code>. If the pattern matches example.com, which
- * does not have a url scheme prefix, the supplied scheme will be prepended to
- * create <code>http://example.com</code> when the clickable url link is
+ * will have the scheme prepended to the matched text when the clickable URL
+ * is created. For instance, if you are matching web URLs you would supply
+ * the scheme <code>http://</code>. If the pattern matches example.com, which
+ * does not have a URL scheme prefix, the supplied scheme will be prepended to
+ * create <code>http://example.com</code> when the clickable URL link is
* created.
*/
@@ -97,6 +104,11 @@ public class Linkify {
*/
private static final int PHONE_NUMBER_MINIMUM_DIGITS = 5;
+ /** @hide */
+ @IntDef(flag = true, value = { WEB_URLS, EMAIL_ADDRESSES, PHONE_NUMBERS, MAP_ADDRESSES, ALL })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface LinkifyMask {}
+
/**
* Filters out web URL matches that occur after an at-sign (@). This is
* to prevent turning the domain name in an email address into a web link.
@@ -152,10 +164,10 @@ public class Linkify {
* MatchFilter enables client code to have more control over
* what is allowed to match and become a link, and what is not.
*
- * For example: when matching web urls you would like things like
+ * For example: when matching web URLs you would like things like
* http://www.example.com to match, as well as just example.com itelf.
* However, you would not want to match against the domain in
- * support@example.com. So, when matching against a web url pattern you
+ * support@example.com. So, when matching against a web URL pattern you
* might also include a MatchFilter that disallows the match if it is
* immediately preceded by an at-sign (@).
*/
@@ -203,8 +215,13 @@ public class Linkify {
* If the mask is nonzero, it also removes any existing URLSpans
* attached to the Spannable, to avoid problems if you call it
* repeatedly on the same text.
+ *
+ * @param text Spannable whose text is to be marked-up with links
+ * @param mask Mask to define which kinds of links will be searched.
+ *
+ * @return True if at least one link is found and applied.
*/
- public static final boolean addLinks(Spannable text, int mask) {
+ public static final boolean addLinks(@NonNull Spannable text, @LinkifyMask int mask) {
if (mask == 0) {
return false;
}
@@ -255,8 +272,13 @@ public class Linkify {
* the link types indicated in the mask into clickable links. If matches
* are found the movement method for the TextView is set to
* LinkMovementMethod.
+ *
+ * @param text TextView whose text is to be marked-up with links
+ * @param mask Mask to define which kinds of links will be searched.
+ *
+ * @return True if at least one link is found and applied.
*/
- public static final boolean addLinks(TextView text, int mask) {
+ public static final boolean addLinks(@NonNull TextView text, @LinkifyMask int mask) {
if (mask == 0) {
return false;
}
@@ -284,7 +306,7 @@ public class Linkify {
}
}
- private static final void addLinkMovementMethod(TextView t) {
+ private static final void addLinkMovementMethod(@NonNull TextView t) {
MovementMethod m = t.getMovementMethod();
if ((m == null) || !(m instanceof LinkMovementMethod)) {
@@ -302,12 +324,12 @@ public class Linkify {
*
* @param text TextView whose text is to be marked-up with links
* @param pattern Regex pattern to be used for finding links
- * @param scheme Url scheme string (eg <code>http://</code> to be
- * prepended to the url of links that do not have
- * a scheme specified in the link text
+ * @param scheme URL scheme string (eg <code>http://</code>) to be
+ * prepended to the links that do not start with this scheme.
*/
- public static final void addLinks(TextView text, Pattern pattern, String scheme) {
- addLinks(text, pattern, scheme, null, null);
+ public static final void addLinks(@NonNull TextView text, @NonNull Pattern pattern,
+ @Nullable String scheme) {
+ addLinks(text, pattern, scheme, null, null, null);
}
/**
@@ -317,20 +339,45 @@ public class Linkify {
* to LinkMovementMethod.
*
* @param text TextView whose text is to be marked-up with links
- * @param p Regex pattern to be used for finding links
- * @param scheme Url scheme string (eg <code>http://</code> to be
- * prepended to the url of links that do not have
- * a scheme specified in the link text
+ * @param pattern Regex pattern to be used for finding links
+ * @param scheme URL scheme string (eg <code>http://</code>) to be
+ * prepended to the links that do not start with this scheme.
* @param matchFilter The filter that is used to allow the client code
* additional control over which pattern matches are
* to be converted into links.
*/
- public static final void addLinks(TextView text, Pattern p, String scheme,
- MatchFilter matchFilter, TransformFilter transformFilter) {
- SpannableString s = SpannableString.valueOf(text.getText());
+ public static final void addLinks(@NonNull TextView text, @NonNull Pattern pattern,
+ @Nullable String scheme, @Nullable MatchFilter matchFilter,
+ @Nullable TransformFilter transformFilter) {
+ addLinks(text, pattern, scheme, null, matchFilter, transformFilter);
+ }
- if (addLinks(s, p, scheme, matchFilter, transformFilter)) {
- text.setText(s);
+ /**
+ * Applies a regex to the text of a TextView turning the matches into
+ * links. If links are found then UrlSpans are applied to the link
+ * text match areas, and the movement method for the text is changed
+ * to LinkMovementMethod.
+ *
+ * @param text TextView whose text is to be marked-up with links.
+ * @param pattern Regex pattern to be used for finding links.
+ * @param defaultScheme The default scheme to be prepended to links if the link does not
+ * start with one of the <code>schemes</code> given.
+ * @param schemes Array of schemes (eg <code>http://</code>) to check if the link found
+ * contains a scheme. Passing a null or empty value means prepend defaultScheme
+ * to all links.
+ * @param matchFilter The filter that is used to allow the client code additional control
+ * over which pattern matches are to be converted into links.
+ * @param transformFilter Filter to allow the client code to update the link found.
+ */
+ public static final void addLinks(@NonNull TextView text, @NonNull Pattern pattern,
+ @Nullable String defaultScheme, @Nullable String[] schemes,
+ @Nullable MatchFilter matchFilter, @Nullable TransformFilter transformFilter) {
+ SpannableString spannable = SpannableString.valueOf(text.getText());
+
+ boolean linksAdded = addLinks(spannable, pattern, defaultScheme, schemes, matchFilter,
+ transformFilter);
+ if (linksAdded) {
+ text.setText(spannable);
addLinkMovementMethod(text);
}
}
@@ -339,37 +386,72 @@ public class Linkify {
* Applies a regex to a Spannable turning the matches into
* links.
*
- * @param text Spannable whose text is to be marked-up with
- * links
+ * @param text Spannable whose text is to be marked-up with links
* @param pattern Regex pattern to be used for finding links
- * @param scheme Url scheme string (eg <code>http://</code> to be
- * prepended to the url of links that do not have
- * a scheme specified in the link text
+ * @param scheme URL scheme string (eg <code>http://</code>) to be
+ * prepended to the links that do not start with this scheme.
*/
- public static final boolean addLinks(Spannable text, Pattern pattern, String scheme) {
- return addLinks(text, pattern, scheme, null, null);
+ public static final boolean addLinks(@NonNull Spannable text, @NonNull Pattern pattern,
+ @Nullable String scheme) {
+ return addLinks(text, pattern, scheme, null, null, null);
}
/**
- * Applies a regex to a Spannable turning the matches into
- * links.
+ * Applies a regex to a Spannable turning the matches into
+ * links.
*
- * @param s Spannable whose text is to be marked-up with
- * links
- * @param p Regex pattern to be used for finding links
- * @param scheme Url scheme string (eg <code>http://</code> to be
- * prepended to the url of links that do not have
- * a scheme specified in the link text
- * @param matchFilter The filter that is used to allow the client code
- * additional control over which pattern matches are
- * to be converted into links.
+ * @param spannable Spannable whose text is to be marked-up with links
+ * @param pattern Regex pattern to be used for finding links
+ * @param scheme URL scheme string (eg <code>http://</code>) to be
+ * prepended to the links that do not start with this scheme.
+ * @param matchFilter The filter that is used to allow the client code
+ * additional control over which pattern matches are
+ * to be converted into links.
+ * @param transformFilter Filter to allow the client code to update the link found.
+ *
+ * @return True if at least one link is found and applied.
+ */
+ public static final boolean addLinks(@NonNull Spannable spannable, @NonNull Pattern pattern,
+ @Nullable String scheme, @Nullable MatchFilter matchFilter,
+ @Nullable TransformFilter transformFilter) {
+ return addLinks(spannable, pattern, scheme, null, matchFilter,
+ transformFilter);
+ }
+
+ /**
+ * Applies a regex to a Spannable turning the matches into links.
+ *
+ * @param spannable Spannable whose text is to be marked-up with links.
+ * @param pattern Regex pattern to be used for finding links.
+ * @param defaultScheme The default scheme to be prepended to links if the link does not
+ * start with one of the <code>schemes</code> given.
+ * @param schemes Array of schemes (eg <code>http://</code>) to check if the link found
+ * contains a scheme. Passing a null or empty value means prepend defaultScheme
+ * to all links.
+ * @param matchFilter The filter that is used to allow the client code additional control
+ * over which pattern matches are to be converted into links.
+ * @param transformFilter Filter to allow the client code to update the link found.
+ *
+ * @return True if at least one link is found and applied.
*/
- public static final boolean addLinks(Spannable s, Pattern p,
- String scheme, MatchFilter matchFilter,
- TransformFilter transformFilter) {
+ public static final boolean addLinks(@NonNull Spannable spannable, @NonNull Pattern pattern,
+ @Nullable String defaultScheme, @Nullable String[] schemes,
+ @Nullable MatchFilter matchFilter, @Nullable TransformFilter transformFilter) {
+ final String[] schemesCopy;
+ if (defaultScheme == null) defaultScheme = "";
+ if (schemes == null || schemes.length < 1) {
+ schemes = EmptyArray.STRING;
+ }
+
+ schemesCopy = new String[schemes.length + 1];
+ schemesCopy[0] = defaultScheme.toLowerCase(Locale.ROOT);
+ for (int index = 0; index < schemes.length; index++) {
+ String scheme = schemes[index];
+ schemesCopy[index + 1] = (scheme == null) ? "" : scheme.toLowerCase(Locale.ROOT);
+ }
+
boolean hasMatches = false;
- String prefix = (scheme == null) ? "" : scheme.toLowerCase(Locale.ROOT);
- Matcher m = p.matcher(s);
+ Matcher m = pattern.matcher(spannable);
while (m.find()) {
int start = m.start();
@@ -377,14 +459,13 @@ public class Linkify {
boolean allowed = true;
if (matchFilter != null) {
- allowed = matchFilter.acceptMatch(s, start, end);
+ allowed = matchFilter.acceptMatch(spannable, start, end);
}
if (allowed) {
- String url = makeUrl(m.group(0), new String[] { prefix },
- m, transformFilter);
+ String url = makeUrl(m.group(0), schemesCopy, m, transformFilter);
- applyLink(url, start, end, s);
+ applyLink(url, start, end, spannable);
hasMatches = true;
}
}
@@ -398,22 +479,20 @@ public class Linkify {
text.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
- private static final String makeUrl(String url, String[] prefixes,
- Matcher m, TransformFilter filter) {
+ private static final String makeUrl(@NonNull String url, @NonNull String[] prefixes,
+ Matcher matcher, @Nullable TransformFilter filter) {
if (filter != null) {
- url = filter.transformUrl(m, url);
+ url = filter.transformUrl(matcher, url);
}
boolean hasPrefix = false;
-
+
for (int i = 0; i < prefixes.length; i++) {
- if (url.regionMatches(true, 0, prefixes[i], 0,
- prefixes[i].length())) {
+ if (url.regionMatches(true, 0, prefixes[i], 0, prefixes[i].length())) {
hasPrefix = true;
// Fix capitalization if necessary
- if (!url.regionMatches(false, 0, prefixes[i], 0,
- prefixes[i].length())) {
+ if (!url.regionMatches(false, 0, prefixes[i], 0, prefixes[i].length())) {
url = prefixes[i] + url.substring(prefixes[i].length());
}
@@ -421,7 +500,7 @@ public class Linkify {
}
}
- if (!hasPrefix) {
+ if (!hasPrefix && prefixes.length > 0) {
url = prefixes[0] + url;
}
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 063288e2adfc..8bd63dfc2075 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -60,6 +60,7 @@ import android.widget.AdapterView.OnItemClickListener;
import libcore.util.Objects;
import com.android.internal.R;
+import com.android.internal.util.Preconditions;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -1096,6 +1097,13 @@ public class RemoteViews implements Parcelable, Filter {
memoryCounter.addBitmapMemory(mBitmaps.get(i));
}
}
+
+ @Override
+ protected BitmapCache clone() {
+ BitmapCache bitmapCache = new BitmapCache();
+ bitmapCache.mBitmaps.addAll(mBitmaps);
+ return bitmapCache;
+ }
}
private class BitmapReflectionAction extends Action {
@@ -2227,10 +2235,21 @@ public class RemoteViews implements Parcelable, Filter {
public RemoteViews clone() {
+ Preconditions.checkState(mIsRoot, "RemoteView has been attached to another RemoteView. "
+ + "May only clone the root of a RemoteView hierarchy.");
+
Parcel p = Parcel.obtain();
+
+ // Do not parcel the Bitmap cache - doing so creates an expensive copy of all bitmaps.
+ // Instead pretend we're not owning the cache while parceling.
+ mIsRoot = false;
writeToParcel(p, 0);
p.setDataPosition(0);
- RemoteViews rv = new RemoteViews(p);
+ mIsRoot = true;
+
+ RemoteViews rv = new RemoteViews(p, mBitmapCache.clone());
+ rv.mIsRoot = true;
+
p.recycle();
return rv;
}
@@ -2240,7 +2259,7 @@ public class RemoteViews implements Parcelable, Filter {
}
/**
- * Reutrns the layout id of the root layout associated with this RemoteViews. In the case
+ * Returns the layout id of the root layout associated with this RemoteViews. In the case
* that the RemoteViews has both a landscape and portrait root, this will return the layout
* id associated with the portrait layout.
*
diff --git a/core/tests/coretests/res/layout/remote_views_test.xml b/core/tests/coretests/res/layout/remote_views_test.xml
new file mode 100644
index 000000000000..c5f7a47c1e96
--- /dev/null
+++ b/core/tests/coretests/res/layout/remote_views_test.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/layout"
+ android:orientation="vertical">
+
+ <TextView android:id="@+id/text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+ <ImageView android:id="@+id/image"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+</LinearLayout>
diff --git a/core/tests/coretests/src/android/view/RemoteViewsTest.java b/core/tests/coretests/src/android/view/RemoteViewsTest.java
new file mode 100644
index 000000000000..9c4fd7047334
--- /dev/null
+++ b/core/tests/coretests/src/android/view/RemoteViewsTest.java
@@ -0,0 +1,127 @@
+/*
+ * 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 android.view;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RemoteViews;
+import android.widget.TextView;
+
+import com.android.frameworks.coretests.R;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+/**
+ * Tests for RemoteViews.
+ */
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class RemoteViewsTest {
+
+ @Rule
+ public final ExpectedException exception = ExpectedException.none();
+
+ private Context mContext;
+ private String mPackage;
+ private LinearLayout mContainer;
+
+ @Before
+ public void setup() {
+ mContext = InstrumentationRegistry.getContext();
+ mPackage = mPackage;
+ mContainer = new LinearLayout(mContext);
+ }
+
+ @Test
+ public void clone_doesNotCopyBitmap() {
+ RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test);
+ Bitmap bitmap = Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888);
+
+ original.setImageViewBitmap(R.id.image, bitmap);
+ RemoteViews clone = original.clone();
+ View inflated = clone.apply(mContext, mContainer);
+
+ Drawable drawable = ((ImageView) inflated.findViewById(R.id.image)).getDrawable();
+ assertSame(bitmap, ((BitmapDrawable)drawable).getBitmap());
+ }
+
+ @Test
+ public void clone_originalCanStillBeApplied() {
+ RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test);
+
+ RemoteViews clone = original.clone();
+
+ clone.apply(mContext, mContainer);
+ }
+
+ @Test
+ public void clone_clones() {
+ RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test);
+
+ RemoteViews clone = original.clone();
+ original.setTextViewText(R.id.text, "test");
+ View inflated = clone.apply(mContext, mContainer);
+
+ TextView textView = (TextView) inflated.findViewById(R.id.text);
+ assertEquals("", textView.getText());
+ }
+
+ @Test
+ public void clone_child_fails() {
+ RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test);
+ RemoteViews child = new RemoteViews(mPackage, R.layout.remote_views_test);
+
+ original.addView(R.id.layout, child);
+
+ exception.expect(IllegalStateException.class);
+ RemoteViews clone = child.clone();
+ }
+
+ @Test
+ public void clone_repeatedly() {
+ RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test);
+
+ original.clone();
+ original.clone();
+
+ original.apply(mContext, mContainer);
+ }
+
+ @Test
+ public void clone_chained() {
+ RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test);
+
+ RemoteViews clone = original.clone().clone();
+
+ clone.apply(mContext, mContainer);
+ }
+
+}
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java
index bd069ffeddad..e75fb9870e0b 100644
--- a/graphics/java/android/graphics/drawable/VectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/VectorDrawable.java
@@ -53,8 +53,15 @@ import java.util.HashMap;
import java.util.Stack;
/**
- * This lets you create a drawable based on an XML vector graphic. It can be
- * defined in an XML file with the <code>&lt;vector></code> element.
+ * This lets you create a drawable based on an XML vector graphic.
+ * <p/>
+ * <strong>Note:</strong> To optimize for the re-drawing performance, one bitmap cache is created
+ * for each VectorDrawable. Therefore, referring to the same VectorDrawable means sharing the same
+ * bitmap cache. If these references don't agree upon on the same size, the bitmap will be recreated
+ * and redrawn every time size is changed. In other words, if a VectorDrawable is used for
+ * different sizes, it is more efficient to create multiple VectorDrawables, one for each size.
+ * <p/>
+ * VectorDrawable can be defined in an XML file with the <code>&lt;vector></code> element.
* <p/>
* The vector drawable has the following elements:
* <p/>
diff --git a/libs/hwui/BakedOpState.cpp b/libs/hwui/BakedOpState.cpp
index 26653f77daeb..859036543b4a 100644
--- a/libs/hwui/BakedOpState.cpp
+++ b/libs/hwui/BakedOpState.cpp
@@ -82,6 +82,16 @@ ResolvedRenderState::ResolvedRenderState(LinearAllocator& allocator, Snapshot& s
}
}
+ResolvedRenderState::ResolvedRenderState(LinearAllocator& allocator, Snapshot& snapshot,
+ const Matrix4& localTransform, const ClipBase* localClip) {
+ transform.loadMultiply(*snapshot.transform, localTransform);
+ clipState = snapshot.mutateClipArea().serializeIntersectedClip(allocator,
+ localClip, *(snapshot.transform));
+ clippedBounds = clipState->rect;
+ clipSideFlags = OpClipSideFlags::Full;
+ localProjectionPathMask = nullptr;
+}
+
ResolvedRenderState::ResolvedRenderState(LinearAllocator& allocator, Snapshot& snapshot)
: transform(*snapshot.transform)
, clipState(snapshot.mutateClipArea().serializeClip(allocator))
diff --git a/libs/hwui/BakedOpState.h b/libs/hwui/BakedOpState.h
index ffe2901782a9..4e3cb8a15e24 100644
--- a/libs/hwui/BakedOpState.h
+++ b/libs/hwui/BakedOpState.h
@@ -55,6 +55,10 @@ public:
ResolvedRenderState(LinearAllocator& allocator, Snapshot& snapshot,
const RecordedOp& recordedOp, bool expandForStroke);
+ // Constructor for unbounded ops *with* transform/clip
+ ResolvedRenderState(LinearAllocator& allocator, Snapshot& snapshot,
+ const Matrix4& localTransform, const ClipBase* localClip);
+
// Constructor for unbounded ops without transform/clip (namely shadows)
ResolvedRenderState(LinearAllocator& allocator, Snapshot& snapshot);
@@ -111,8 +115,14 @@ public:
return bakedState;
}
+ static BakedOpState* tryConstructUnbounded(LinearAllocator& allocator,
+ Snapshot& snapshot, const RecordedOp& recordedOp) {
+ if (CC_UNLIKELY(snapshot.getRenderTargetClip().isEmpty())) return nullptr;
+ return allocator.create_trivial<BakedOpState>(allocator, snapshot, recordedOp);
+ }
+
enum class StrokeBehavior {
- // stroking is forced, regardless of style on paint
+ // stroking is forced, regardless of style on paint (such as for lines)
Forced,
// stroking is defined by style on paint
StyleDefined,
@@ -167,6 +177,13 @@ private:
, roundRectClipState(snapshot.roundRectClipState)
, op(&recordedOp) {}
+ // TODO: fix this brittleness
+ BakedOpState(LinearAllocator& allocator, Snapshot& snapshot, const RecordedOp& recordedOp)
+ : computedState(allocator, snapshot, recordedOp.localMatrix, recordedOp.localClip)
+ , alpha(snapshot.alpha)
+ , roundRectClipState(snapshot.roundRectClipState)
+ , op(&recordedOp) {}
+
BakedOpState(LinearAllocator& allocator, Snapshot& snapshot, const ShadowOp* shadowOpPtr)
: computedState(allocator, snapshot)
, alpha(snapshot.alpha)
diff --git a/libs/hwui/FrameBuilder.cpp b/libs/hwui/FrameBuilder.cpp
index 50b21a40d7c3..fc396825029f 100644
--- a/libs/hwui/FrameBuilder.cpp
+++ b/libs/hwui/FrameBuilder.cpp
@@ -574,7 +574,7 @@ void FrameBuilder::deferCirclePropsOp(const CirclePropsOp& op) {
}
void FrameBuilder::deferFunctorOp(const FunctorOp& op) {
- BakedOpState* bakedState = tryBakeOpState(op);
+ BakedOpState* bakedState = tryBakeUnboundedOpState(op);
if (!bakedState) return; // quick rejected
currentLayer().deferUnmergeableOp(mAllocator, bakedState, OpBatchType::Functor);
}
@@ -663,7 +663,7 @@ void FrameBuilder::deferTextOp(const TextOp& op) {
}
void FrameBuilder::deferTextOnPathOp(const TextOnPathOp& op) {
- BakedOpState* bakedState = tryBakeOpState(op);
+ BakedOpState* bakedState = tryBakeUnboundedOpState(op);
if (!bakedState) return; // quick rejected
currentLayer().deferUnmergeableOp(mAllocator, bakedState, textBatchId(*(op.paint)));
}
diff --git a/libs/hwui/FrameBuilder.h b/libs/hwui/FrameBuilder.h
index f44306a931bf..8a00d336dc08 100644
--- a/libs/hwui/FrameBuilder.h
+++ b/libs/hwui/FrameBuilder.h
@@ -173,6 +173,10 @@ private:
BakedOpState* tryBakeOpState(const RecordedOp& recordedOp) {
return BakedOpState::tryConstruct(mAllocator, *mCanvasState.writableSnapshot(), recordedOp);
}
+ BakedOpState* tryBakeUnboundedOpState(const RecordedOp& recordedOp) {
+ return BakedOpState::tryConstructUnbounded(mAllocator, *mCanvasState.writableSnapshot(), recordedOp);
+ }
+
// should always be surrounded by a save/restore pair, and not called if DisplayList is null
void deferNodePropsAndOps(RenderNode& node);
diff --git a/libs/hwui/RecordedOp.h b/libs/hwui/RecordedOp.h
index c37458d31029..96a57b6a8efe 100644
--- a/libs/hwui/RecordedOp.h
+++ b/libs/hwui/RecordedOp.h
@@ -257,8 +257,10 @@ struct CirclePropsOp : RecordedOp {
};
struct FunctorOp : RecordedOp {
- FunctorOp(BASE_PARAMS_PAINTLESS, Functor* functor)
- : SUPER_PAINTLESS(FunctorOp)
+ // Note: undefined record-time bounds, since this op fills the clip
+ // TODO: explicitly define bounds
+ FunctorOp(const Matrix4& localMatrix, const ClipBase* localClip, Functor* functor)
+ : RecordedOp(RecordedOpId::FunctorOp, Rect(), localMatrix, localClip, nullptr)
, functor(functor) {}
Functor* functor;
};
@@ -385,9 +387,10 @@ struct TextOp : RecordedOp {
};
struct TextOnPathOp : RecordedOp {
- TextOnPathOp(BASE_PARAMS, const glyph_t* glyphs, int glyphCount,
- const SkPath* path, float hOffset, float vOffset)
- : SUPER(TextOnPathOp)
+ // TODO: explicitly define bounds
+ TextOnPathOp(const Matrix4& localMatrix, const ClipBase* localClip, const SkPaint* paint,
+ const glyph_t* glyphs, int glyphCount, const SkPath* path, float hOffset, float vOffset)
+ : RecordedOp(RecordedOpId::TextOnPathOp, Rect(), localMatrix, localClip, paint)
, glyphs(glyphs)
, glyphCount(glyphCount)
, path(path)
diff --git a/libs/hwui/RecordingCanvas.cpp b/libs/hwui/RecordingCanvas.cpp
index 11eb825a56b0..1546baf88691 100644
--- a/libs/hwui/RecordingCanvas.cpp
+++ b/libs/hwui/RecordingCanvas.cpp
@@ -24,14 +24,6 @@
namespace android {
namespace uirenderer {
-#define MIL_PIX 1000000
-static Rect sUnreasonablyLargeBounds(-MIL_PIX, -MIL_PIX, MIL_PIX, MIL_PIX);
-
-static const Rect& getConservativeOpBounds(const ClipBase* clip) {
- // if op is clipped, that rect can be used, but otherwise just use a conservatively large rect
- return clip ? clip->rect : sUnreasonablyLargeBounds;
-}
-
RecordingCanvas::RecordingCanvas(size_t width, size_t height)
: mState(*this)
, mResourceCache(ResourceCache::getInstance()) {
@@ -249,12 +241,10 @@ void RecordingCanvas::drawColor(int color, SkXfermode::Mode mode) {
}
void RecordingCanvas::drawPaint(const SkPaint& paint) {
- const ClipBase* clip = getRecordedClip();
- addOp(alloc().create_trivial<RectOp>(
- getConservativeOpBounds(clip),
- Matrix4::identity(),
- clip,
- refPaint(&paint)));
+ SkRect bounds;
+ if (getClipBounds(&bounds)) {
+ drawRect(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom, paint);
+ }
}
static Rect calcBoundsOfPoints(const float* points, int floatCount) {
@@ -544,11 +534,9 @@ void RecordingCanvas::drawTextOnPath(const uint16_t* glyphs, int glyphCount, con
float hOffset, float vOffset, const SkPaint& paint) {
if (!glyphs || glyphCount <= 0 || PaintUtils::paintWillNotDrawText(paint)) return;
glyphs = refBuffer<glyph_t>(glyphs, glyphCount);
- auto clip = getRecordedClip();
addOp(alloc().create_trivial<TextOnPathOp>(
- getConservativeOpBounds(clip), // TODO: explicitly define bounds
*(mState.currentSnapshot()->transform),
- clip,
+ getRecordedClip(),
refPaint(&paint), glyphs, glyphCount, refPath(&path), hOffset, vOffset));
}
@@ -599,11 +587,9 @@ void RecordingCanvas::drawLayer(DeferredLayerUpdater* layerHandle) {
void RecordingCanvas::callDrawGLFunction(Functor* functor) {
mDisplayList->functors.push_back(functor);
- auto clip = getRecordedClip();
addOp(alloc().create_trivial<FunctorOp>(
- getConservativeOpBounds(clip),
*(mState.currentSnapshot()->transform),
- clip,
+ getRecordedClip(),
functor));
}
diff --git a/libs/hwui/tests/unit/RecordingCanvasTests.cpp b/libs/hwui/tests/unit/RecordingCanvasTests.cpp
index 5e613fd50c3e..e6d84c6681f1 100644
--- a/libs/hwui/tests/unit/RecordingCanvasTests.cpp
+++ b/libs/hwui/tests/unit/RecordingCanvasTests.cpp
@@ -223,8 +223,7 @@ TEST(RecordingCanvas, drawColor) {
auto op = *(dl->getOps()[0]);
EXPECT_EQ(RecordedOpId::RectOp, op.opId);
EXPECT_EQ(nullptr, op.localClip);
- EXPECT_TRUE(op.unmappedBounds.contains(Rect(-1000, -1000, 1000, 1000)))
- << "no clip, unmappedBounds should resolve to be much larger than DL bounds";
+ EXPECT_TRUE(op.unmappedBounds.contains(Rect(200, 200))) << "Expect recording/clip bounds";
}
TEST(RecordingCanvas, backgroundAndImage) {
diff --git a/media/java/android/media/AudioDeviceCallback.java b/media/java/android/media/AudioDeviceCallback.java
index d9f0037ce206..a5b1d2402183 100644
--- a/media/java/android/media/AudioDeviceCallback.java
+++ b/media/java/android/media/AudioDeviceCallback.java
@@ -19,7 +19,7 @@ package android.media;
/**
* AudioDeviceCallback defines the mechanism by which applications can receive notifications
* of audio device connection and disconnection events.
- * @see AudioManager#registerAudioDeviceCallback.
+ * @see AudioManager#registerAudioDeviceCallback(AudioDeviceCallback, android.os.Handler handler).
*/
public abstract class AudioDeviceCallback {
/**
diff --git a/packages/Keyguard/res/values/strings.xml b/packages/Keyguard/res/values/strings.xml
index 746457fa4e7b..61966b2ee1a4 100644
--- a/packages/Keyguard/res/values/strings.xml
+++ b/packages/Keyguard/res/values/strings.xml
@@ -302,7 +302,7 @@
<string name="keyguard_carrier_default">No service.</string>
<!-- Content description of the switch input method button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
- <string name="accessibility_ime_switch_button" msgid="5032926134740456424">Switch input method button.</string>
+ <string name="accessibility_ime_switch_button" msgid="5032926134740456424">Switch input method</string>
<!-- Description of airplane mode -->
<string name="airplane_mode">Airplane mode</string>
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 9ce81ed2f10c..c810e6c89c9f 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -4086,7 +4086,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
}
public boolean isHandlingAccessibilityEvents() {
- return !mBoundServices.isEmpty() || !mBoundServices.isEmpty();
+ return !mBoundServices.isEmpty() || !mBindingServices.isEmpty();
}
public void onSwitchToAnotherUser() {
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index cd4d107d5a98..b737ae2c3ee4 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -2918,9 +2918,15 @@ public class BackupManagerService {
mBackupRunning = false;
if (mStatus == BackupTransport.TRANSPORT_NOT_INITIALIZED) {
// Make sure we back up everything and perform the one-time init
- clearMetadata();
if (MORE_DEBUG) Slog.d(TAG, "Server requires init; rerunning");
addBackupTrace("init required; rerunning");
+ try {
+ mPendingInits.add(mTransport.transportDirName());
+ } catch (Exception e) {
+ Slog.w(TAG, "Failed to query transport name heading for init", e);
+ // swallow it and proceed; we don't rely on this
+ }
+ clearMetadata();
backupNow();
}
}
@@ -4451,13 +4457,21 @@ public class BackupManagerService {
}
}
- // We still could fail in backup runner thread, getting result from there.
- int backupRunnerResult = backupRunner.getBackupResultBlocking();
- if (backupPackageStatus != BackupTransport.TRANSPORT_ERROR
- && backupRunnerResult != BackupTransport.TRANSPORT_OK) {
- // If there was an error in runner thread and
- // not TRANSPORT_ERROR here, overwrite it.
- backupPackageStatus = backupRunnerResult;
+ // TRANSPORT_ERROR here means that we've hit an error that the runner
+ // doesn't know about, so it's still moving data but we're pulling the
+ // rug out from under it. Don't ask for its result: we already know better
+ // and we'll hang if we block waiting for it, since it relies on us to
+ // read back the data it's writing into the engine. Just proceed with
+ // a graceful failure. The runner/engine mechanism will tear itself
+ // down cleanly when we close the pipes from this end.
+ if (backupPackageStatus != BackupTransport.TRANSPORT_ERROR) {
+ // We still could fail in backup runner thread, getting result from there.
+ int backupRunnerResult = backupRunner.getBackupResultBlocking();
+ if (backupRunnerResult != BackupTransport.TRANSPORT_OK) {
+ // If there was an error in runner thread and
+ // not TRANSPORT_ERROR here, overwrite it.
+ backupPackageStatus = backupRunnerResult;
+ }
}
if (MORE_DEBUG) {
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 5fd196b4eb5b..a3622b58cb4d 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -387,6 +387,15 @@ public class UserManagerService extends IUserManager.Stub {
synchronized (mRestrictionsLock) {
applyUserRestrictionsLR(UserHandle.USER_SYSTEM);
}
+
+ UserInfo currentGuestUser = findCurrentGuestUser();
+ if (currentGuestUser != null && !hasUserRestriction(
+ UserManager.DISALLOW_CONFIG_WIFI, currentGuestUser.id)) {
+ // If a guest user currently exists, apply the DISALLOW_CONFIG_WIFI option
+ // to it, in case this guest was created in a previous version where this
+ // user restriction was not a default guest restriction.
+ setUserRestriction(UserManager.DISALLOW_CONFIG_WIFI, true, currentGuestUser.id);
+ }
}
@Override
@@ -828,6 +837,7 @@ public class UserManagerService extends IUserManager.Stub {
private void initDefaultGuestRestrictions() {
synchronized (mGuestRestrictions) {
if (mGuestRestrictions.isEmpty()) {
+ mGuestRestrictions.putBoolean(UserManager.DISALLOW_CONFIG_WIFI, true);
mGuestRestrictions.putBoolean(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, true);
mGuestRestrictions.putBoolean(UserManager.DISALLOW_OUTGOING_CALLS, true);
mGuestRestrictions.putBoolean(UserManager.DISALLOW_SMS, true);
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 86518b57c430..c69a360aeb5e 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -590,21 +590,8 @@ public class CarrierConfigManager {
* When {@code true}, video calls to emergency numbers will be allowed. When {@code false},
* video calls to emergency numbers will be initiated as audio-only calls instead.
*/
- @SystemApi
- public static final String BOOL_ALLOW_EMERGENCY_VIDEO_CALLS =
- "bool_allow_emergency_video_calls";
-
- /**
- * Flag indicating whether the carrier supports video pause signaling. When {@code true}, the
- * carrier supports use of the {@link android.telecom.VideoProfile#STATE_PAUSED} video state
- * to pause transmission of video when the In-Call app is sent to the background.
- * When {@code false}, video pause signaling is not supported. {@code True} by default unless
- * a carrier configuration overrides the default.
- */
- @SystemApi
- public static final String BOOL_ALLOW_VIDEO_PAUSE =
- "bool_allow_video_pause";
-
+ public static final String KEY_ALLOW_EMERGENCY_VIDEO_CALLS_BOOL =
+ "allow_emergency_video_calls_bool";
/**
* Flag indicating whether the carrier supports RCS presence indication for video calls. When
@@ -617,7 +604,6 @@ public class CarrierConfigManager {
* and can choose to hide or show the video calling icon based on whether a contact supports
* video.
*/
- @SystemApi
public static final String KEY_USE_RCS_PRESENCE_BOOL = "use_rcs_presence_bool";
/**
@@ -715,8 +701,7 @@ public class CarrierConfigManager {
sDefaults.putBoolean(KEY_EDITABLE_ENHANCED_4G_LTE_BOOL, true);
sDefaults.putBoolean(KEY_HIDE_IMS_APN_BOOL, false);
sDefaults.putBoolean(KEY_HIDE_PREFERRED_NETWORK_TYPE_BOOL, false);
- sDefaults.putBoolean(BOOL_ALLOW_EMERGENCY_VIDEO_CALLS, false);
- sDefaults.putBoolean(BOOL_ALLOW_VIDEO_PAUSE, true);
+ sDefaults.putBoolean(KEY_ALLOW_EMERGENCY_VIDEO_CALLS_BOOL, false);
sDefaults.putBoolean(KEY_EDITABLE_WFC_MODE_BOOL, true);
// MMS defaults
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index 4f0e036e04ca..8aa0e3406ee3 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -81,8 +81,7 @@ public interface RILConstants {
int INTERNAL_ERR = 38; /* Hit unexpected vendor internal error scenario */
int SYSTEM_ERR = 39; /* Hit platform or system error */
int MODEM_ERR = 40; /* Hit unexpected modem error */
- int INVALID_STATE = 41; /* Can not process the request as vendor RIL is in
- invalid state. */
+ int INVALID_STATE = 41; /* Unexpected request for the current state */
int NO_RESOURCES = 42; /* Not sufficient resource to process the request */
int SIM_ERR = 43; /* Received error from SIM card */
int INVALID_ARGUMENTS = 44; /* Received invalid arguments in request */
@@ -103,6 +102,11 @@ public interface RILConstants {
int NO_SUCH_ENTRY = 59; /* No such entry present to perform the request */
int NETWORK_NOT_READY = 60; /* Network is not ready to perform the request */
int NOT_PROVISIONED = 61; /* Device doesnot have this value provisioned */
+ int NO_SUBSCRIPTION = 62; /* Device doesnot have subscription */
+ int NO_NETWORK_FOUND = 63; /* Network cannot be found */
+ int DEVICE_IN_USE = 64; /* Operation cannot be performed because the device
+ is currently in use */
+ int ABORTED = 65; /* Operation aborted */
// Below is list of OEM specific error codes which can by used by OEMs in case they don't want to
// reveal particular replacement for Generic failure
int OEM_ERROR_1 = 501;
diff --git a/tools/aapt/Bundle.h b/tools/aapt/Bundle.h
index c4495509614e..ca06ac440731 100644
--- a/tools/aapt/Bundle.h
+++ b/tools/aapt/Bundle.h
@@ -249,7 +249,7 @@ public:
* above. SDK levels that have a non-numeric identifier are assumed
* to be newer than any SDK level that has a number designated.
*/
- bool isMinSdkAtLeast(int desired) {
+ bool isMinSdkAtLeast(int desired) const {
/* If the application specifies a minSdkVersion in the manifest
* then use that. Otherwise, check what the user specified on
* the command line. If neither, it's not available since
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
index 40466bd25451..9939c188cdd9 100644
--- a/tools/aapt/Images.cpp
+++ b/tools/aapt/Images.cpp
@@ -1134,10 +1134,9 @@ static void analyze_image(const char *imageName, image_info &imageInfo, int gray
}
}
-
static void write_png(const char* imageName,
png_structp write_ptr, png_infop write_info,
- image_info& imageInfo, int grayscaleTolerance)
+ image_info& imageInfo, const Bundle* bundle)
{
png_uint_32 width, height;
int color_type;
@@ -1174,9 +1173,26 @@ static void write_png(const char* imageName,
bool hasTransparency;
int paletteEntries, alphaPaletteEntries;
+ int grayscaleTolerance = bundle->getGrayscaleTolerance();
analyze_image(imageName, imageInfo, grayscaleTolerance, rgbPalette, alphaPalette,
&paletteEntries, &alphaPaletteEntries, &hasTransparency, &color_type, outRows);
+ // Legacy versions of aapt would always encode 9patch PNGs as RGBA. This had the unintended
+ // benefit of working around a bug decoding paletted images in Android 4.1.
+ // https://code.google.com/p/android/issues/detail?id=34619
+ //
+ // If SDK_JELLY_BEAN is supported, we need to avoid a paletted encoding in order to not expose
+ // this bug.
+ if (!bundle->isMinSdkAtLeast(SDK_JELLY_BEAN_MR1)) {
+ if (imageInfo.is9Patch && PNG_COLOR_TYPE_PALETTE == color_type) {
+ if (hasTransparency) {
+ color_type = PNG_COLOR_TYPE_RGB_ALPHA;
+ } else {
+ color_type = PNG_COLOR_TYPE_RGB;
+ }
+ }
+ }
+
if (kIsDebug) {
switch (color_type) {
case PNG_COLOR_TYPE_PALETTE:
@@ -1332,8 +1348,7 @@ static bool write_png_protected(png_structp write_ptr, String8& printableName, p
return false;
}
- write_png(printableName.string(), write_ptr, write_info, *imageInfo,
- bundle->getGrayscaleTolerance());
+ write_png(printableName.string(), write_ptr, write_info, *imageInfo, bundle);
return true;
}
@@ -1543,8 +1558,7 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con
}
// Actually write out to the new png
- write_png(dest.string(), write_ptr, write_info, imageInfo,
- bundle->getGrayscaleTolerance());
+ write_png(dest.string(), write_ptr, write_info, imageInfo, bundle);
if (bundle->getVerbose()) {
// Find the size of our new file