Merge "Modify docs to reflect operational changes in overrideConfig" into qt-dev
diff --git a/api/current.txt b/api/current.txt
index b434776..dc249eb 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -13791,7 +13791,7 @@
method public void drawCircle(float, float, float, @NonNull android.graphics.Paint);
method public void drawColor(@ColorInt int);
method public void drawColor(@ColorLong long);
- method @Deprecated public void drawColor(@ColorInt int, @NonNull android.graphics.PorterDuff.Mode);
+ method public void drawColor(@ColorInt int, @NonNull android.graphics.PorterDuff.Mode);
method public void drawColor(@ColorInt int, @NonNull android.graphics.BlendMode);
method public void drawColor(@ColorLong long, @NonNull android.graphics.BlendMode);
method public void drawDoubleRoundRect(@NonNull android.graphics.RectF, float, float, @NonNull android.graphics.RectF, float, float, @NonNull android.graphics.Paint);
@@ -14108,7 +14108,7 @@
public class ComposeShader extends android.graphics.Shader {
ctor @Deprecated public ComposeShader(@NonNull android.graphics.Shader, @NonNull android.graphics.Shader, @NonNull android.graphics.Xfermode);
- ctor @Deprecated public ComposeShader(@NonNull android.graphics.Shader, @NonNull android.graphics.Shader, @NonNull android.graphics.PorterDuff.Mode);
+ ctor public ComposeShader(@NonNull android.graphics.Shader, @NonNull android.graphics.Shader, @NonNull android.graphics.PorterDuff.Mode);
ctor public ComposeShader(@NonNull android.graphics.Shader, @NonNull android.graphics.Shader, @NonNull android.graphics.BlendMode);
}
@@ -14497,7 +14497,7 @@
method @Px public float getUnderlinePosition();
method @Px public float getUnderlineThickness();
method @Px public float getWordSpacing();
- method @Deprecated public android.graphics.Xfermode getXfermode();
+ method public android.graphics.Xfermode getXfermode();
method public boolean hasGlyph(String);
method public final boolean isAntiAlias();
method public final boolean isDither();
@@ -14554,7 +14554,7 @@
method public android.graphics.Typeface setTypeface(android.graphics.Typeface);
method public void setUnderlineText(boolean);
method public void setWordSpacing(@Px float);
- method @Deprecated public android.graphics.Xfermode setXfermode(android.graphics.Xfermode);
+ method public android.graphics.Xfermode setXfermode(android.graphics.Xfermode);
field public static final int ANTI_ALIAS_FLAG = 1; // 0x1
field public static final int CURSOR_AFTER = 0; // 0x0
field public static final int CURSOR_AT = 4; // 0x4
@@ -14803,37 +14803,37 @@
field public float y;
}
- @Deprecated public class PorterDuff {
- ctor @Deprecated public PorterDuff();
+ public class PorterDuff {
+ ctor public PorterDuff();
}
- @Deprecated public enum PorterDuff.Mode {
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode ADD;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode CLEAR;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode DARKEN;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode DST;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode DST_ATOP;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode DST_IN;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode DST_OUT;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode DST_OVER;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode LIGHTEN;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode MULTIPLY;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode OVERLAY;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode SCREEN;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode SRC;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode SRC_ATOP;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode SRC_IN;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode SRC_OUT;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode SRC_OVER;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode XOR;
+ public enum PorterDuff.Mode {
+ enum_constant public static final android.graphics.PorterDuff.Mode ADD;
+ enum_constant public static final android.graphics.PorterDuff.Mode CLEAR;
+ enum_constant public static final android.graphics.PorterDuff.Mode DARKEN;
+ enum_constant public static final android.graphics.PorterDuff.Mode DST;
+ enum_constant public static final android.graphics.PorterDuff.Mode DST_ATOP;
+ enum_constant public static final android.graphics.PorterDuff.Mode DST_IN;
+ enum_constant public static final android.graphics.PorterDuff.Mode DST_OUT;
+ enum_constant public static final android.graphics.PorterDuff.Mode DST_OVER;
+ enum_constant public static final android.graphics.PorterDuff.Mode LIGHTEN;
+ enum_constant public static final android.graphics.PorterDuff.Mode MULTIPLY;
+ enum_constant public static final android.graphics.PorterDuff.Mode OVERLAY;
+ enum_constant public static final android.graphics.PorterDuff.Mode SCREEN;
+ enum_constant public static final android.graphics.PorterDuff.Mode SRC;
+ enum_constant public static final android.graphics.PorterDuff.Mode SRC_ATOP;
+ enum_constant public static final android.graphics.PorterDuff.Mode SRC_IN;
+ enum_constant public static final android.graphics.PorterDuff.Mode SRC_OUT;
+ enum_constant public static final android.graphics.PorterDuff.Mode SRC_OVER;
+ enum_constant public static final android.graphics.PorterDuff.Mode XOR;
}
- @Deprecated public class PorterDuffColorFilter extends android.graphics.ColorFilter {
- ctor @Deprecated public PorterDuffColorFilter(@ColorInt int, @NonNull android.graphics.PorterDuff.Mode);
+ public class PorterDuffColorFilter extends android.graphics.ColorFilter {
+ ctor public PorterDuffColorFilter(@ColorInt int, @NonNull android.graphics.PorterDuff.Mode);
}
- @Deprecated public class PorterDuffXfermode extends android.graphics.Xfermode {
- ctor @Deprecated public PorterDuffXfermode(android.graphics.PorterDuff.Mode);
+ public class PorterDuffXfermode extends android.graphics.Xfermode {
+ ctor public PorterDuffXfermode(android.graphics.PorterDuff.Mode);
}
public interface PostProcessor {
@@ -15394,9 +15394,9 @@
method public final boolean setLevel(@IntRange(from=0, to=10000) int);
method public boolean setState(@NonNull int[]);
method public void setTint(@ColorInt int);
+ method public void setTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setTintList(@Nullable android.content.res.ColorStateList);
- method @Deprecated public void setTintMode(@Nullable android.graphics.PorterDuff.Mode);
- method public void setTintMode(@Nullable android.graphics.BlendMode);
+ method public void setTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public boolean setVisible(boolean, boolean);
method public void unscheduleSelf(@NonNull Runnable);
}
@@ -15553,9 +15553,9 @@
method public void loadDrawableAsync(android.content.Context, android.os.Message);
method public void loadDrawableAsync(android.content.Context, android.graphics.drawable.Icon.OnDrawableLoadedListener, android.os.Handler);
method public android.graphics.drawable.Icon setTint(@ColorInt int);
+ method @NonNull public android.graphics.drawable.Icon setTintBlendMode(@NonNull android.graphics.BlendMode);
method public android.graphics.drawable.Icon setTintList(android.content.res.ColorStateList);
- method @Deprecated @NonNull public android.graphics.drawable.Icon setTintMode(@NonNull android.graphics.PorterDuff.Mode);
- method @NonNull public android.graphics.drawable.Icon setTintMode(@NonNull android.graphics.BlendMode);
+ method @NonNull public android.graphics.drawable.Icon setTintMode(@NonNull android.graphics.PorterDuff.Mode);
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.graphics.drawable.Icon> CREATOR;
field public static final int TYPE_ADAPTIVE_BITMAP = 5; // 0x5
@@ -49453,7 +49453,7 @@
method public android.graphics.drawable.Drawable getIcon();
method @Nullable public default android.graphics.BlendMode getIconTintBlendMode();
method @Nullable public default android.content.res.ColorStateList getIconTintList();
- method @Deprecated @Nullable public default android.graphics.PorterDuff.Mode getIconTintMode();
+ method @Nullable public default android.graphics.PorterDuff.Mode getIconTintMode();
method public android.content.Intent getIntent();
method public int getItemId();
method public android.view.ContextMenu.ContextMenuInfo getMenuInfo();
@@ -49481,9 +49481,9 @@
method public android.view.MenuItem setEnabled(boolean);
method public android.view.MenuItem setIcon(android.graphics.drawable.Drawable);
method public android.view.MenuItem setIcon(@DrawableRes int);
+ method @NonNull public default android.view.MenuItem setIconTintBlendMode(@Nullable android.graphics.BlendMode);
method public default android.view.MenuItem setIconTintList(@Nullable android.content.res.ColorStateList);
- method @Deprecated @NonNull public default android.view.MenuItem setIconTintMode(@Nullable android.graphics.PorterDuff.Mode);
- method @NonNull public default android.view.MenuItem setIconTintMode(@Nullable android.graphics.BlendMode);
+ method @NonNull public default android.view.MenuItem setIconTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public android.view.MenuItem setIntent(android.content.Intent);
method public android.view.MenuItem setNumericShortcut(char);
method public default android.view.MenuItem setNumericShortcut(char, int);
@@ -50136,9 +50136,9 @@
method public int getAutofillType();
method @Nullable public android.view.autofill.AutofillValue getAutofillValue();
method public android.graphics.drawable.Drawable getBackground();
- method @Nullable public android.graphics.BlendMode getBackgroundBlendMode();
+ method @Nullable public android.graphics.BlendMode getBackgroundTintBlendMode();
method @Nullable public android.content.res.ColorStateList getBackgroundTintList();
- method @Deprecated @Nullable public android.graphics.PorterDuff.Mode getBackgroundTintMode();
+ method @Nullable public android.graphics.PorterDuff.Mode getBackgroundTintMode();
method @android.view.ViewDebug.ExportedProperty(category="layout") public int getBaseline();
method @android.view.ViewDebug.CapturedViewProperty public final int getBottom();
method protected float getBottomFadingEdgeStrength();
@@ -50169,10 +50169,10 @@
method public java.util.ArrayList<android.view.View> getFocusables(int);
method public void getFocusedRect(android.graphics.Rect);
method public android.graphics.drawable.Drawable getForeground();
- method @Nullable public android.graphics.BlendMode getForegroundBlendMode();
method public int getForegroundGravity();
+ method @Nullable public android.graphics.BlendMode getForegroundTintBlendMode();
method @Nullable public android.content.res.ColorStateList getForegroundTintList();
- method @Deprecated @Nullable public android.graphics.PorterDuff.Mode getForegroundTintMode();
+ method @Nullable public android.graphics.PorterDuff.Mode getForegroundTintMode();
method public boolean getGlobalVisibleRect(android.graphics.Rect, android.graphics.Point);
method public final boolean getGlobalVisibleRect(android.graphics.Rect);
method public android.os.Handler getHandler();
@@ -50484,9 +50484,9 @@
method public void setBackgroundColor(@ColorInt int);
method @Deprecated public void setBackgroundDrawable(android.graphics.drawable.Drawable);
method public void setBackgroundResource(@DrawableRes int);
+ method public void setBackgroundTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setBackgroundTintList(@Nullable android.content.res.ColorStateList);
- method @Deprecated public void setBackgroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
- method public void setBackgroundTintMode(@Nullable android.graphics.BlendMode);
+ method public void setBackgroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public final void setBottom(int);
method public void setCameraDistance(float);
method public void setClickable(boolean);
@@ -50512,9 +50512,9 @@
method public void setForceDarkAllowed(boolean);
method public void setForeground(android.graphics.drawable.Drawable);
method public void setForegroundGravity(int);
+ method public void setForegroundTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setForegroundTintList(@Nullable android.content.res.ColorStateList);
- method @Deprecated public void setForegroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
- method public void setForegroundTintMode(@Nullable android.graphics.BlendMode);
+ method public void setForegroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setHapticFeedbackEnabled(boolean);
method public void setHasTransientState(boolean);
method public void setHorizontalFadingEdgeEnabled(boolean);
@@ -54850,18 +54850,22 @@
method public boolean getSplitTrack();
method public android.graphics.drawable.Drawable getThumb();
method public int getThumbOffset();
+ method @Nullable public android.graphics.BlendMode getThumbTintBlendMode();
method @Nullable public android.content.res.ColorStateList getThumbTintList();
method @Nullable public android.graphics.PorterDuff.Mode getThumbTintMode();
method public android.graphics.drawable.Drawable getTickMark();
+ method @Nullable public android.graphics.BlendMode getTickMarkTintBlendMode();
method @Nullable public android.content.res.ColorStateList getTickMarkTintList();
method @Nullable public android.graphics.PorterDuff.Mode getTickMarkTintMode();
method public void setKeyProgressIncrement(int);
method public void setSplitTrack(boolean);
method public void setThumb(android.graphics.drawable.Drawable);
method public void setThumbOffset(int);
+ method public void setThumbTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setThumbTintList(@Nullable android.content.res.ColorStateList);
method public void setThumbTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setTickMark(android.graphics.drawable.Drawable);
+ method public void setTickMarkTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setTickMarkTintList(@Nullable android.content.res.ColorStateList);
method public void setTickMarkTintMode(@Nullable android.graphics.PorterDuff.Mode);
}
@@ -55260,11 +55264,13 @@
ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int);
ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int, int);
method public android.graphics.drawable.Drawable getCheckMarkDrawable();
+ method @Nullable public android.graphics.BlendMode getCheckMarkTintBlendMode();
method @Nullable public android.content.res.ColorStateList getCheckMarkTintList();
method @Nullable public android.graphics.PorterDuff.Mode getCheckMarkTintMode();
method @android.view.ViewDebug.ExportedProperty public boolean isChecked();
method public void setCheckMarkDrawable(@DrawableRes int);
method public void setCheckMarkDrawable(@Nullable android.graphics.drawable.Drawable);
+ method public void setCheckMarkTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setCheckMarkTintList(@Nullable android.content.res.ColorStateList);
method public void setCheckMarkTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setChecked(boolean);
@@ -55299,11 +55305,13 @@
ctor public CompoundButton(android.content.Context, android.util.AttributeSet, int);
ctor public CompoundButton(android.content.Context, android.util.AttributeSet, int, int);
method @Nullable public android.graphics.drawable.Drawable getButtonDrawable();
+ method @Nullable public android.graphics.BlendMode getButtonTintBlendMode();
method @Nullable public android.content.res.ColorStateList getButtonTintList();
method @Nullable public android.graphics.PorterDuff.Mode getButtonTintMode();
method @android.view.ViewDebug.ExportedProperty public boolean isChecked();
method public void setButtonDrawable(@DrawableRes int);
method public void setButtonDrawable(@Nullable android.graphics.drawable.Drawable);
+ method public void setButtonTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setButtonTintList(@Nullable android.content.res.ColorStateList);
method public void setButtonTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setChecked(boolean);
@@ -55792,6 +55800,7 @@
method public android.graphics.drawable.Drawable getDrawable();
method public int getImageAlpha();
method public android.graphics.Matrix getImageMatrix();
+ method @Nullable public android.graphics.BlendMode getImageTintBlendMode();
method @Nullable public android.content.res.ColorStateList getImageTintList();
method @Nullable public android.graphics.PorterDuff.Mode getImageTintMode();
method public int getMaxHeight();
@@ -55815,6 +55824,7 @@
method public void setImageMatrix(android.graphics.Matrix);
method public void setImageResource(@DrawableRes int);
method public void setImageState(int[], boolean);
+ method public void setImageTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setImageTintList(@Nullable android.content.res.ColorStateList);
method public void setImageTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setImageURI(@Nullable android.net.Uri);
@@ -56268,6 +56278,7 @@
ctor public ProgressBar(android.content.Context, android.util.AttributeSet, int, int);
method @Nullable public android.graphics.drawable.Drawable getCurrentDrawable();
method public android.graphics.drawable.Drawable getIndeterminateDrawable();
+ method @Nullable public android.graphics.BlendMode getIndeterminateTintBlendMode();
method @Nullable public android.content.res.ColorStateList getIndeterminateTintList();
method @Nullable public android.graphics.PorterDuff.Mode getIndeterminateTintMode();
method public android.view.animation.Interpolator getInterpolator();
@@ -56278,12 +56289,15 @@
method @Px public int getMinHeight();
method @Px public int getMinWidth();
method @android.view.ViewDebug.ExportedProperty(category="progress") public int getProgress();
+ method @Nullable public android.graphics.BlendMode getProgressBackgroundTintBlendMode();
method @Nullable public android.content.res.ColorStateList getProgressBackgroundTintList();
method @Nullable public android.graphics.PorterDuff.Mode getProgressBackgroundTintMode();
method public android.graphics.drawable.Drawable getProgressDrawable();
+ method @Nullable public android.graphics.BlendMode getProgressTintBlendMode();
method @Nullable public android.content.res.ColorStateList getProgressTintList();
method @Nullable public android.graphics.PorterDuff.Mode getProgressTintMode();
method @android.view.ViewDebug.ExportedProperty(category="progress") public int getSecondaryProgress();
+ method @Nullable public android.graphics.BlendMode getSecondaryProgressTintBlendMode();
method @Nullable public android.content.res.ColorStateList getSecondaryProgressTintList();
method @Nullable public android.graphics.PorterDuff.Mode getSecondaryProgressTintMode();
method public final void incrementProgressBy(int);
@@ -56295,6 +56309,7 @@
method public void setIndeterminate(boolean);
method public void setIndeterminateDrawable(android.graphics.drawable.Drawable);
method public void setIndeterminateDrawableTiled(android.graphics.drawable.Drawable);
+ method public void setIndeterminateTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setIndeterminateTintList(@Nullable android.content.res.ColorStateList);
method public void setIndeterminateTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setInterpolator(android.content.Context, @InterpolatorRes int);
@@ -56307,13 +56322,16 @@
method public void setMinWidth(@Px int);
method public void setProgress(int);
method public void setProgress(int, boolean);
+ method public void setProgressBackgroundTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setProgressBackgroundTintList(@Nullable android.content.res.ColorStateList);
method public void setProgressBackgroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setProgressDrawable(android.graphics.drawable.Drawable);
method public void setProgressDrawableTiled(android.graphics.drawable.Drawable);
+ method public void setProgressTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setProgressTintList(@Nullable android.content.res.ColorStateList);
method public void setProgressTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setSecondaryProgress(int);
+ method public void setSecondaryProgressTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setSecondaryProgressTintList(@Nullable android.content.res.ColorStateList);
method public void setSecondaryProgressTintMode(@Nullable android.graphics.PorterDuff.Mode);
}
@@ -56862,9 +56880,11 @@
method public CharSequence getTextOn();
method public android.graphics.drawable.Drawable getThumbDrawable();
method public int getThumbTextPadding();
+ method @Nullable public android.graphics.BlendMode getThumbTintBlendMode();
method @Nullable public android.content.res.ColorStateList getThumbTintList();
method @Nullable public android.graphics.PorterDuff.Mode getThumbTintMode();
method public android.graphics.drawable.Drawable getTrackDrawable();
+ method @Nullable public android.graphics.BlendMode getTrackTintBlendMode();
method @Nullable public android.content.res.ColorStateList getTrackTintList();
method @Nullable public android.graphics.PorterDuff.Mode getTrackTintMode();
method public void onMeasure(int, int);
@@ -56880,10 +56900,12 @@
method public void setThumbDrawable(android.graphics.drawable.Drawable);
method public void setThumbResource(@DrawableRes int);
method public void setThumbTextPadding(int);
+ method public void setThumbTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setThumbTintList(@Nullable android.content.res.ColorStateList);
method public void setThumbTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setTrackDrawable(android.graphics.drawable.Drawable);
method public void setTrackResource(@DrawableRes int);
+ method public void setTrackTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setTrackTintList(@Nullable android.content.res.ColorStateList);
method public void setTrackTintMode(@Nullable android.graphics.PorterDuff.Mode);
}
@@ -57041,6 +57063,7 @@
method public int getAutoSizeTextType();
method public int getBreakStrategy();
method public int getCompoundDrawablePadding();
+ method @Nullable public android.graphics.BlendMode getCompoundDrawableTintBlendMode();
method public android.content.res.ColorStateList getCompoundDrawableTintList();
method public android.graphics.PorterDuff.Mode getCompoundDrawableTintMode();
method @NonNull public android.graphics.drawable.Drawable[] getCompoundDrawables();
@@ -57166,6 +57189,7 @@
method public void setAutoSizeTextTypeWithDefaults(int);
method public void setBreakStrategy(int);
method public void setCompoundDrawablePadding(int);
+ method public void setCompoundDrawableTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setCompoundDrawableTintList(@Nullable android.content.res.ColorStateList);
method public void setCompoundDrawableTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setCompoundDrawables(@Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable);
diff --git a/api/test-current.txt b/api/test-current.txt
index f76b383..49fa558 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -107,6 +107,7 @@
ctor public ActivityView(android.content.Context, android.util.AttributeSet);
ctor public ActivityView(android.content.Context, android.util.AttributeSet, int);
ctor public ActivityView(android.content.Context, android.util.AttributeSet, int, boolean);
+ method public int getVirtualDisplayId();
method public void onLayout(boolean, int, int, int, int);
method public void onLocationChanged();
method public void performBackPress();
@@ -345,6 +346,20 @@
method public android.graphics.Rect getSourceRectHint();
}
+ public class StatusBarManager {
+ method @NonNull @RequiresPermission(android.Manifest.permission.STATUS_BAR) public android.app.StatusBarManager.DisableInfo getDisableInfo();
+ method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void setDisabledForSetup(boolean);
+ }
+
+ public static final class StatusBarManager.DisableInfo {
+ method public boolean areAllComponentsEnabled();
+ method public boolean isNavigateToHomeDisabled();
+ method public boolean isNotificationPeekingDisabled();
+ method public boolean isRecentsDisabled();
+ method public boolean isSearchDisabled();
+ method public boolean isStatusBarExpansionDisabled();
+ }
+
public class TimePickerDialog extends android.app.AlertDialog implements android.content.DialogInterface.OnClickListener android.widget.TimePicker.OnTimeChangedListener {
method public android.widget.TimePicker getTimePicker();
}
@@ -631,6 +646,7 @@
method public void setContentCaptureOptions(@Nullable android.content.ContentCaptureOptions);
field public static final String BUGREPORT_SERVICE = "bugreport";
field public static final String ROLLBACK_SERVICE = "rollback";
+ field public static final String STATUS_BAR_SERVICE = "statusbar";
field public static final String TEST_NETWORK_SERVICE = "test_network";
}
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 5e5611b..474f25b 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -1073,9 +1073,8 @@
}
public void updateHttpProxy() {
- final ConnectivityManager cm = ConnectivityManager.from(
+ ActivityThread.updateHttpProxy(
getApplication() != null ? getApplication() : getSystemContext());
- Proxy.setHttpProxySystemProperty(cm.getDefaultProxy());
}
public void processInBackground() {
@@ -6948,6 +6947,11 @@
return thread;
}
+ public static void updateHttpProxy(@NonNull Context context) {
+ final ConnectivityManager cm = ConnectivityManager.from(context);
+ Proxy.setHttpProxySystemProperty(cm.getDefaultProxy());
+ }
+
@UnsupportedAppUsage
public final void installSystemProviders(List<ProviderInfo> providers) {
if (providers != null) {
diff --git a/core/java/android/app/ActivityView.java b/core/java/android/app/ActivityView.java
index 8ec5e3a..0ccaf62 100644
--- a/core/java/android/app/ActivityView.java
+++ b/core/java/android/app/ActivityView.java
@@ -19,6 +19,7 @@
import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL;
import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY;
import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC;
+import static android.view.Display.INVALID_DISPLAY;
import android.annotation.NonNull;
import android.annotation.TestApi;
@@ -377,6 +378,16 @@
}
/**
+ * @return the display id of the virtual display.
+ */
+ public int getVirtualDisplayId() {
+ if (mVirtualDisplay != null) {
+ return mVirtualDisplay.getDisplay().getDisplayId();
+ }
+ return INVALID_DISPLAY;
+ }
+
+ /**
* Injects a pair of down/up key events with keycode {@link KeyEvent#KEYCODE_BACK} to the
* virtual display.
*/
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java
index 9ff363d..af2d774 100644
--- a/core/java/android/app/StatusBarManager.java
+++ b/core/java/android/app/StatusBarManager.java
@@ -22,6 +22,7 @@
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.SystemService;
+import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.Binder;
@@ -366,6 +367,7 @@
* @hide
*/
@SystemApi
+ @TestApi
@RequiresPermission(android.Manifest.permission.STATUS_BAR)
public void setDisabledForSetup(boolean disabled) {
try {
@@ -390,6 +392,7 @@
* @hide
*/
@SystemApi
+ @TestApi
@RequiresPermission(android.Manifest.permission.STATUS_BAR)
@NonNull
public DisableInfo getDisableInfo() {
@@ -422,6 +425,7 @@
* @hide
*/
@SystemApi
+ @TestApi
public static final class DisableInfo {
private boolean mStatusBarExpansion;
@@ -448,6 +452,7 @@
* @hide
*/
@SystemApi
+ @TestApi
public boolean isStatusBarExpansionDisabled() {
return mStatusBarExpansion;
}
@@ -463,6 +468,7 @@
* @hide
*/
@SystemApi
+ @TestApi
public boolean isNavigateToHomeDisabled() {
return mNavigateHome;
}
@@ -478,6 +484,7 @@
* @hide
*/
@SystemApi
+ @TestApi
public boolean isNotificationPeekingDisabled() {
return mNotificationPeeking;
}
@@ -493,6 +500,7 @@
* @hide
*/
@SystemApi
+ @TestApi
public boolean isRecentsDisabled() {
return mRecents;
}
@@ -508,6 +516,7 @@
* @hide
*/
@SystemApi
+ @TestApi
public boolean isSearchDisabled() {
return mSearch;
}
@@ -523,6 +532,7 @@
* @hide
*/
@SystemApi
+ @TestApi
public boolean areAllComponentsEnabled() {
return !mStatusBarExpansion && !mNavigateHome && !mNotificationPeeking && !mRecents
&& !mSearch;
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 0ba457e..de04829 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -3678,6 +3678,7 @@
* @hide
*/
@SystemApi
+ @TestApi
public static final String STATUS_BAR_SERVICE = "statusbar";
/**
diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java
index 779790c..a51a871 100644
--- a/core/java/android/os/GraphicsEnvironment.java
+++ b/core/java/android/os/GraphicsEnvironment.java
@@ -164,6 +164,43 @@
}
/**
+ * Query to determine if ANGLE should be used
+ */
+ public static boolean shouldUseAngle(Context context, Bundle coreSettings,
+ String packageName) {
+ if (packageName.isEmpty()) {
+ Log.v(TAG, "No package name available yet, ANGLE should not be used");
+ return false;
+ }
+
+ final String devOptIn = getDriverForPkg(context, coreSettings, packageName);
+ if (DEBUG) {
+ Log.v(TAG, "ANGLE Developer option for '" + packageName + "' "
+ + "set to: '" + devOptIn + "'");
+ }
+
+ // We only want to use ANGLE if the app is whitelisted or the developer has
+ // explicitly chosen something other than default driver.
+ // The whitelist will be generated by the ANGLE APK at both boot time and
+ // ANGLE update time. It will only include apps mentioned in the rules file.
+ final boolean whitelisted = checkAngleWhitelist(context, coreSettings, packageName);
+ final boolean requested = devOptIn.equals(sDriverMap.get(OpenGlDriverChoice.ANGLE));
+ final boolean useAngle = (whitelisted || requested);
+ if (!useAngle) {
+ return false;
+ }
+
+ if (whitelisted) {
+ Log.v(TAG, "ANGLE whitelist includes " + packageName);
+ }
+ if (requested) {
+ Log.v(TAG, "ANGLE developer option for " + packageName + ": " + devOptIn);
+ }
+
+ return true;
+ }
+
+ /**
* Check whether application is debuggable
*/
private static boolean isDebuggable(Context context) {
@@ -535,6 +572,8 @@
getGlobalSettingsString(contentResolver, bundle,
Settings.Global.GLOBAL_SETTINGS_ANGLE_WHITELIST);
+ if (DEBUG) Log.v(TAG, "ANGLE whitelist: " + angleWhitelist);
+
return angleWhitelist.contains(packageName);
}
@@ -549,43 +588,11 @@
*/
public boolean setupAngle(Context context, Bundle bundle, PackageManager pm,
String packageName) {
- if (packageName.isEmpty()) {
- Log.v(TAG, "No package name available yet, skipping ANGLE setup");
+
+ if (!shouldUseAngle(context, bundle, packageName)) {
return false;
}
- final String devOptIn = getDriverForPkg(context, bundle, packageName);
- if (DEBUG) {
- Log.v(TAG, "ANGLE Developer option for '" + packageName + "' "
- + "set to: '" + devOptIn + "'");
- }
-
- // We only need to check rules if the app is whitelisted or the developer has
- // explicitly chosen something other than default driver.
- //
- // The whitelist will be generated by the ANGLE APK at both boot time and
- // ANGLE update time. It will only include apps mentioned in the rules file.
- //
- // If the user has set the developer option to something other than default,
- // we need to call setupAngleRulesApk() with the package name and the developer
- // option value (native/angle/other). Then later when we are actually trying to
- // load a driver, GraphicsEnv::shouldUseAngle() has seen the package name before
- // and can confidently answer yes/no based on the previously set developer
- // option value.
- final boolean whitelisted = checkAngleWhitelist(context, bundle, packageName);
- final boolean defaulted = devOptIn.equals(sDriverMap.get(OpenGlDriverChoice.DEFAULT));
- final boolean rulesCheck = (whitelisted || !defaulted);
- if (!rulesCheck) {
- return false;
- }
-
- if (whitelisted) {
- Log.v(TAG, "ANGLE whitelist includes " + packageName);
- }
- if (!defaulted) {
- Log.v(TAG, "ANGLE developer option for " + packageName + ": " + devOptIn);
- }
-
final String anglePkgName = getAnglePackageName(pm);
if (anglePkgName.isEmpty()) {
Log.e(TAG, "Failed to find ANGLE package.");
@@ -623,6 +630,14 @@
if (DEBUG) Log.v(TAG, "ANGLE package libs: " + paths);
+ // If the user has set the developer option to something other than default,
+ // we need to call setupAngleRulesApk() with the package name and the developer
+ // option value (native/angle/other). Then later when we are actually trying to
+ // load a driver, GraphicsEnv::getShouldUseAngle() has seen the package name before
+ // and can confidently answer yes/no based on the previously set developer
+ // option value.
+ final String devOptIn = getDriverForPkg(context, bundle, packageName);
+
if (setupAngleWithTempRulesFile(context, packageName, paths, devOptIn)) {
// We setup ANGLE with a temp rules file, so we're done here.
return true;
@@ -655,9 +670,9 @@
}
/**
- * Determine if ANGLE should be used.
+ * Determine if ANGLE will be used and setup the environment
*/
- private boolean shouldUseAngle(Context context, String packageName) {
+ private boolean setupAndUseAngle(Context context, String packageName) {
// Need to make sure we are evaluating ANGLE usage for the correct circumstances
if (!setupAngle(context, null, context.getPackageManager(), packageName)) {
Log.v(TAG, "Package '" + packageName + "' should use not ANGLE");
@@ -677,7 +692,7 @@
public void showAngleInUseDialogBox(Context context) {
final String packageName = context.getPackageName();
- if (shouldShowAngleInUseDialogBox(context) && shouldUseAngle(context, packageName)) {
+ if (shouldShowAngleInUseDialogBox(context) && setupAndUseAngle(context, packageName)) {
final Intent intent = new Intent(ACTION_ANGLE_FOR_ANDROID_TOAST_MESSAGE);
String anglePkg = getAnglePackageName(context.getPackageManager());
intent.setPackage(anglePkg);
diff --git a/core/java/android/view/MenuInflater.java b/core/java/android/view/MenuInflater.java
index 8b3b10f..b6b11ab 100644
--- a/core/java/android/view/MenuInflater.java
+++ b/core/java/android/view/MenuInflater.java
@@ -488,7 +488,7 @@
}
if (mItemIconBlendMode != null) {
- item.setIconTintMode(mItemIconBlendMode);
+ item.setIconTintBlendMode(mItemIconBlendMode);
}
if (itemIconTintList != null) {
diff --git a/core/java/android/view/MenuItem.java b/core/java/android/view/MenuItem.java
index 3785310..a2fb596 100644
--- a/core/java/android/view/MenuItem.java
+++ b/core/java/android/view/MenuItem.java
@@ -270,11 +270,8 @@
* @attr ref android.R.styleable#MenuItem_iconTintMode
* @see #setIconTintList(ColorStateList)
* @see Drawable#setTintMode(PorterDuff.Mode)
- * @see Drawable#setTintMode(BlendMode)
- *
- * @deprecated use {@link #setIconTintMode(BlendMode)} instead
+ * @see Drawable#setTintBlendMode(BlendMode)
*/
- @Deprecated
default @NonNull MenuItem setIconTintMode(@Nullable PorterDuff.Mode tintMode) {
return this;
}
@@ -289,7 +286,7 @@
* @attr ref android.R.styleable#MenuItem_iconTintMode
* @see #setIconTintList(ColorStateList)
*/
- default @NonNull MenuItem setIconTintMode(@Nullable BlendMode blendMode) {
+ default @NonNull MenuItem setIconTintBlendMode(@Nullable BlendMode blendMode) {
PorterDuff.Mode mode = BlendMode.blendModeToPorterDuffMode(blendMode);
if (mode != null) {
return setIconTintMode(mode);
@@ -304,11 +301,9 @@
* @return the blending mode used to apply the tint to this item's icon
* @attr ref android.R.styleable#MenuItem_iconTintMode
* @see #setIconTintMode(PorterDuff.Mode)
- * @see #setIconTintMode(BlendMode)
+ * @see #setIconTintBlendMode(BlendMode)
*
- * @deprecated Use {@link #getIconTintBlendMode()} instead
*/
- @Deprecated
@Nullable
public default PorterDuff.Mode getIconTintMode() { return null; }
@@ -317,7 +312,7 @@
*
* @return the blending mode used to apply the tint to this item's icon
* @attr ref android.R.styleable#MenuItem_iconTintMode
- * @see #setIconTintMode(BlendMode)
+ * @see #setIconTintBlendMode(BlendMode)
*
*/
@Nullable
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 096c988..10f9d38 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -5608,7 +5608,9 @@
break;
case R.styleable.View_foregroundTintMode:
if (targetSdkVersion >= Build.VERSION_CODES.M || this instanceof FrameLayout) {
- setForegroundTintMode(Drawable.parseBlendMode(a.getInt(attr, -1), null));
+ setForegroundTintBlendMode(
+ Drawable.parseBlendMode(a.getInt(attr, -1),
+ null));
}
break;
case R.styleable.View_foregroundTint:
@@ -22873,17 +22875,14 @@
* @attr ref android.R.styleable#View_backgroundTintMode
* @see #getBackgroundTintMode()
* @see Drawable#setTintMode(PorterDuff.Mode)
- *
- * @deprecated use @setBackgroundTintMode(BlendMode) instead
*/
- @Deprecated
public void setBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
BlendMode mode = null;
if (tintMode != null) {
mode = BlendMode.fromValue(tintMode.nativeInt);
}
- setBackgroundTintMode(mode);
+ setBackgroundTintBlendMode(mode);
}
/**
@@ -22895,9 +22894,9 @@
* {@code null} to clear tint
* @attr ref android.R.styleable#View_backgroundTintMode
* @see #getBackgroundTintMode()
- * @see Drawable#setTintMode(BlendMode)
+ * @see Drawable#setTintBlendMode(BlendMode)
*/
- public void setBackgroundTintMode(@Nullable BlendMode blendMode) {
+ public void setBackgroundTintBlendMode(@Nullable BlendMode blendMode) {
if (mBackgroundTint == null) {
mBackgroundTint = new TintInfo();
}
@@ -22915,13 +22914,11 @@
* @return the blending mode used to apply the tint to the background
* drawable
* @attr ref android.R.styleable#View_backgroundTintMode
- * @see #setBackgroundTintMode(BlendMode)
+ * @see #setBackgroundTintBlendMode(BlendMode)
*
- * @deprecated use #getBackgroundBlendMode() instead
*/
@Nullable
@InspectableProperty
- @Deprecated
public PorterDuff.Mode getBackgroundTintMode() {
PorterDuff.Mode porterDuffMode;
if (mBackgroundTint != null && mBackgroundTint.mBlendMode != null) {
@@ -22939,9 +22936,9 @@
* @return the blending mode used to apply the tint to the background
* drawable, null if no blend has previously been configured
* @attr ref android.R.styleable#View_backgroundTintMode
- * @see #setBackgroundTintMode(BlendMode)
+ * @see #setBackgroundTintBlendMode(BlendMode)
*/
- public @Nullable BlendMode getBackgroundBlendMode() {
+ public @Nullable BlendMode getBackgroundTintBlendMode() {
return mBackgroundTint != null ? mBackgroundTint.mBlendMode : null;
}
@@ -22956,7 +22953,7 @@
}
if (tintInfo.mHasTintMode) {
- mBackground.setTintMode(tintInfo.mBlendMode);
+ mBackground.setTintBlendMode(tintInfo.mBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -23141,15 +23138,13 @@
* @see #getForegroundTintMode()
* @see Drawable#setTintMode(PorterDuff.Mode)
*
- * @deprecated use #setForegroundTintMode(BlendMode)
*/
- @Deprecated
public void setForegroundTintMode(@Nullable PorterDuff.Mode tintMode) {
BlendMode mode = null;
if (tintMode != null) {
mode = BlendMode.fromValue(tintMode.nativeInt);
}
- setForegroundTintMode(mode);
+ setForegroundTintBlendMode(mode);
}
/**
@@ -23161,9 +23156,9 @@
* {@code null} to clear tint
* @attr ref android.R.styleable#View_foregroundTintMode
* @see #getForegroundTintMode()
- * @see Drawable#setTintMode(BlendMode)
+ * @see Drawable#setTintBlendMode(BlendMode)
*/
- public void setForegroundTintMode(@Nullable BlendMode blendMode) {
+ public void setForegroundTintBlendMode(@Nullable BlendMode blendMode) {
if (mForegroundInfo == null) {
mForegroundInfo = new ForegroundInfo();
}
@@ -23184,12 +23179,9 @@
* drawable
* @attr ref android.R.styleable#View_foregroundTintMode
* @see #setForegroundTintMode(PorterDuff.Mode)
- *
- * @deprecated use #getForegroundBlendMode() instead
*/
@InspectableProperty
@Nullable
- @Deprecated
public PorterDuff.Mode getForegroundTintMode() {
BlendMode blendMode = mForegroundInfo != null && mForegroundInfo.mTintInfo != null
? mForegroundInfo.mTintInfo.mBlendMode : null;
@@ -23207,10 +23199,10 @@
* @return the blending mode used to apply the tint to the foreground
* drawable
* @attr ref android.R.styleable#View_foregroundTintMode
- * @see #setForegroundTintMode(BlendMode)
+ * @see #setForegroundTintBlendMode(BlendMode)
*
*/
- public @Nullable BlendMode getForegroundBlendMode() {
+ public @Nullable BlendMode getForegroundTintBlendMode() {
return mForegroundInfo != null && mForegroundInfo.mTintInfo != null
? mForegroundInfo.mTintInfo.mBlendMode : null;
}
@@ -23227,7 +23219,7 @@
}
if (tintInfo.mHasTintMode) {
- mForegroundInfo.mDrawable.setTintMode(tintInfo.mBlendMode);
+ mForegroundInfo.mDrawable.setTintBlendMode(tintInfo.mBlendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java
index cd5f2e2..18c6abb 100644
--- a/core/java/android/widget/AbsSeekBar.java
+++ b/core/java/android/widget/AbsSeekBar.java
@@ -22,6 +22,7 @@
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.Insets;
import android.graphics.PorterDuff;
@@ -48,15 +49,15 @@
@UnsupportedAppUsage
private Drawable mThumb;
private ColorStateList mThumbTintList = null;
- private PorterDuff.Mode mThumbTintMode = null;
+ private BlendMode mThumbBlendMode = null;
private boolean mHasThumbTint = false;
- private boolean mHasThumbTintMode = false;
+ private boolean mHasThumbBlendMode = false;
private Drawable mTickMark;
private ColorStateList mTickMarkTintList = null;
- private PorterDuff.Mode mTickMarkTintMode = null;
+ private BlendMode mTickMarkBlendMode = null;
private boolean mHasTickMarkTint = false;
- private boolean mHasTickMarkTintMode = false;
+ private boolean mHasTickMarkBlendMode = false;
private int mThumbOffset;
@UnsupportedAppUsage
@@ -114,9 +115,9 @@
setThumb(thumb);
if (a.hasValue(R.styleable.SeekBar_thumbTintMode)) {
- mThumbTintMode = Drawable.parseTintMode(a.getInt(
- R.styleable.SeekBar_thumbTintMode, -1), mThumbTintMode);
- mHasThumbTintMode = true;
+ mThumbBlendMode = Drawable.parseBlendMode(a.getInt(
+ R.styleable.SeekBar_thumbTintMode, -1), mThumbBlendMode);
+ mHasThumbBlendMode = true;
}
if (a.hasValue(R.styleable.SeekBar_thumbTint)) {
@@ -128,9 +129,9 @@
setTickMark(tickMark);
if (a.hasValue(R.styleable.SeekBar_tickMarkTintMode)) {
- mTickMarkTintMode = Drawable.parseTintMode(a.getInt(
- R.styleable.SeekBar_tickMarkTintMode, -1), mTickMarkTintMode);
- mHasTickMarkTintMode = true;
+ mTickMarkBlendMode = Drawable.parseBlendMode(a.getInt(
+ R.styleable.SeekBar_tickMarkTintMode, -1), mTickMarkBlendMode);
+ mHasTickMarkBlendMode = true;
}
if (a.hasValue(R.styleable.SeekBar_tickMarkTint)) {
@@ -274,9 +275,25 @@
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setThumbTintMode(@Nullable PorterDuff.Mode tintMode) {
- mThumbTintMode = tintMode;
- mHasThumbTintMode = true;
+ setThumbTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) :
+ null);
+ }
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setThumbTintList(ColorStateList)}} to the thumb drawable. The
+ * default mode is {@link BlendMode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ *
+ * @attr ref android.R.styleable#SeekBar_thumbTintMode
+ * @see #getThumbTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setThumbTintBlendMode(@Nullable BlendMode blendMode) {
+ mThumbBlendMode = blendMode;
+ mHasThumbBlendMode = true;
applyThumbTint();
}
@@ -291,19 +308,33 @@
@InspectableProperty
@Nullable
public PorterDuff.Mode getThumbTintMode() {
- return mThumbTintMode;
+ return mThumbBlendMode != null
+ ? BlendMode.blendModeToPorterDuffMode(mThumbBlendMode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the thumb drawable,
+ * if specified.
+ *
+ * @return the blending mode used to apply the tint to the thumb drawable
+ * @attr ref android.R.styleable#SeekBar_thumbTintMode
+ * @see #setThumbTintBlendMode(BlendMode)
+ */
+ @Nullable
+ public BlendMode getThumbTintBlendMode() {
+ return mThumbBlendMode;
}
private void applyThumbTint() {
- if (mThumb != null && (mHasThumbTint || mHasThumbTintMode)) {
+ if (mThumb != null && (mHasThumbTint || mHasThumbBlendMode)) {
mThumb = mThumb.mutate();
if (mHasThumbTint) {
mThumb.setTintList(mThumbTintList);
}
- if (mHasThumbTintMode) {
- mThumb.setTintMode(mThumbTintMode);
+ if (mHasThumbBlendMode) {
+ mThumb.setTintBlendMode(mThumbBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -430,8 +461,24 @@
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setTickMarkTintMode(@Nullable PorterDuff.Mode tintMode) {
- mTickMarkTintMode = tintMode;
- mHasTickMarkTintMode = true;
+ setTickMarkTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setTickMarkTintList(ColorStateList)}} to the tick mark drawable. The
+ * default mode is {@link BlendMode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ *
+ * @attr ref android.R.styleable#SeekBar_tickMarkTintMode
+ * @see #getTickMarkTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setTickMarkTintBlendMode(@Nullable BlendMode blendMode) {
+ mTickMarkBlendMode = blendMode;
+ mHasTickMarkBlendMode = true;
applyTickMarkTint();
}
@@ -447,19 +494,34 @@
@InspectableProperty
@Nullable
public PorterDuff.Mode getTickMarkTintMode() {
- return mTickMarkTintMode;
+ return mTickMarkBlendMode != null
+ ? BlendMode.blendModeToPorterDuffMode(mTickMarkBlendMode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the tick mark drawable,
+ * if specified.
+ *
+ * @return the blending mode used to apply the tint to the tick mark drawable
+ * @attr ref android.R.styleable#SeekBar_tickMarkTintMode
+ * @see #setTickMarkTintMode(PorterDuff.Mode)
+ */
+ @InspectableProperty(attributeId = android.R.styleable.SeekBar_tickMarkTintMode)
+ @Nullable
+ public BlendMode getTickMarkTintBlendMode() {
+ return mTickMarkBlendMode;
}
private void applyTickMarkTint() {
- if (mTickMark != null && (mHasTickMarkTint || mHasTickMarkTintMode)) {
+ if (mTickMark != null && (mHasTickMarkTint || mHasTickMarkBlendMode)) {
mTickMark = mTickMark.mutate();
if (mHasTickMarkTint) {
mTickMark.setTintList(mTickMarkTintList);
}
- if (mHasTickMarkTintMode) {
- mTickMark.setTintMode(mTickMarkTintMode);
+ if (mHasTickMarkBlendMode) {
+ mTickMark.setTintBlendMode(mTickMarkBlendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java
index a211b46..8b70f41 100644
--- a/core/java/android/widget/CheckedTextView.java
+++ b/core/java/android/widget/CheckedTextView.java
@@ -23,6 +23,7 @@
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
@@ -58,7 +59,7 @@
@UnsupportedAppUsage
private Drawable mCheckMarkDrawable;
private ColorStateList mCheckMarkTintList = null;
- private PorterDuff.Mode mCheckMarkTintMode = null;
+ private BlendMode mCheckMarkBlendMode = null;
private boolean mHasCheckMarkTint = false;
private boolean mHasCheckMarkTintMode = false;
@@ -99,8 +100,9 @@
}
if (a.hasValue(R.styleable.CheckedTextView_checkMarkTintMode)) {
- mCheckMarkTintMode = Drawable.parseTintMode(a.getInt(
- R.styleable.CheckedTextView_checkMarkTintMode, -1), mCheckMarkTintMode);
+ mCheckMarkBlendMode = Drawable.parseBlendMode(a.getInt(
+ R.styleable.CheckedTextView_checkMarkTintMode, -1),
+ mCheckMarkBlendMode);
mHasCheckMarkTintMode = true;
}
@@ -259,7 +261,23 @@
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setCheckMarkTintMode(@Nullable PorterDuff.Mode tintMode) {
- mCheckMarkTintMode = tintMode;
+ setCheckMarkTintBlendMode(tintMode != null
+ ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setCheckMarkTintList(ColorStateList)} to the check mark
+ * drawable. The default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param tintMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#CheckedTextView_checkMarkTintMode
+ * @see #setCheckMarkTintList(ColorStateList)
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setCheckMarkTintBlendMode(@Nullable BlendMode tintMode) {
+ mCheckMarkBlendMode = tintMode;
mHasCheckMarkTintMode = true;
applyCheckMarkTint();
@@ -277,7 +295,23 @@
@InspectableProperty
@Nullable
public PorterDuff.Mode getCheckMarkTintMode() {
- return mCheckMarkTintMode;
+ return mCheckMarkBlendMode != null
+ ? BlendMode.blendModeToPorterDuffMode(mCheckMarkBlendMode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the check mark
+ * drawable, if specified.
+ *
+ * @return the blending mode used to apply the tint to the check mark
+ * drawable
+ * @attr ref android.R.styleable#CheckedTextView_checkMarkTintMode
+ * @see #setCheckMarkTintMode(PorterDuff.Mode)
+ */
+ @InspectableProperty(attributeId = android.R.styleable.CheckedTextView_checkMarkTintMode)
+ @Nullable
+ public BlendMode getCheckMarkTintBlendMode() {
+ return mCheckMarkBlendMode;
}
private void applyCheckMarkTint() {
@@ -289,7 +323,7 @@
}
if (mHasCheckMarkTintMode) {
- mCheckMarkDrawable.setTintMode(mCheckMarkTintMode);
+ mCheckMarkDrawable.setTintBlendMode(mCheckMarkBlendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index 80ec1c6..2674ca4 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -23,6 +23,7 @@
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
@@ -67,9 +68,9 @@
@UnsupportedAppUsage
private Drawable mButtonDrawable;
private ColorStateList mButtonTintList = null;
- private PorterDuff.Mode mButtonTintMode = null;
+ private BlendMode mButtonBlendMode = null;
private boolean mHasButtonTint = false;
- private boolean mHasButtonTintMode = false;
+ private boolean mHasButtonBlendMode = false;
@UnsupportedAppUsage
private OnCheckedChangeListener mOnCheckedChangeListener;
@@ -109,9 +110,9 @@
}
if (a.hasValue(R.styleable.CompoundButton_buttonTintMode)) {
- mButtonTintMode = Drawable.parseTintMode(a.getInt(
- R.styleable.CompoundButton_buttonTintMode, -1), mButtonTintMode);
- mHasButtonTintMode = true;
+ mButtonBlendMode = Drawable.parseBlendMode(a.getInt(
+ R.styleable.CompoundButton_buttonTintMode, -1), mButtonBlendMode);
+ mHasButtonBlendMode = true;
}
if (a.hasValue(R.styleable.CompoundButton_buttonTint)) {
@@ -337,8 +338,23 @@
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setButtonTintMode(@Nullable PorterDuff.Mode tintMode) {
- mButtonTintMode = tintMode;
- mHasButtonTintMode = true;
+ setButtonTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setButtonTintList(ColorStateList)}} to the button drawable. The
+ * default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param tintMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#CompoundButton_buttonTintMode
+ * @see #getButtonTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setButtonTintBlendMode(@Nullable BlendMode tintMode) {
+ mButtonBlendMode = tintMode;
+ mHasButtonBlendMode = true;
applyButtonTint();
}
@@ -348,22 +364,35 @@
* @attr ref android.R.styleable#CompoundButton_buttonTintMode
* @see #setButtonTintMode(PorterDuff.Mode)
*/
- @InspectableProperty
+ @InspectableProperty(name = "buttonTintMode")
@Nullable
public PorterDuff.Mode getButtonTintMode() {
- return mButtonTintMode;
+ return mButtonBlendMode != null ? BlendMode.blendModeToPorterDuffMode(mButtonBlendMode) :
+ null;
+ }
+
+ /**
+ * @return the blending mode used to apply the tint to the button drawable
+ * @attr ref android.R.styleable#CompoundButton_buttonTintMode
+ * @see #setButtonTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(name = "buttonBlendMode",
+ attributeId = R.styleable.CompoundButton_buttonTintMode)
+ @Nullable
+ public BlendMode getButtonTintBlendMode() {
+ return mButtonBlendMode;
}
private void applyButtonTint() {
- if (mButtonDrawable != null && (mHasButtonTint || mHasButtonTintMode)) {
+ if (mButtonDrawable != null && (mHasButtonTint || mHasButtonBlendMode)) {
mButtonDrawable = mButtonDrawable.mutate();
if (mHasButtonTint) {
mButtonDrawable.setTintList(mButtonTintList);
}
- if (mHasButtonTintMode) {
- mButtonDrawable.setTintMode(mButtonTintMode);
+ if (mHasButtonBlendMode) {
+ mButtonDrawable.setTintBlendMode(mButtonBlendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java
index 9ae62ef..be5d221 100644
--- a/core/java/android/widget/ImageView.java
+++ b/core/java/android/widget/ImageView.java
@@ -27,6 +27,7 @@
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.ImageDecoder;
@@ -127,9 +128,9 @@
@UnsupportedAppUsage
private BitmapDrawable mRecycleableBitmapDrawable = null;
private ColorStateList mDrawableTintList = null;
- private PorterDuff.Mode mDrawableTintMode = null;
+ private BlendMode mDrawableBlendMode = null;
private boolean mHasDrawableTint = false;
- private boolean mHasDrawableTintMode = false;
+ private boolean mHasDrawableBlendMode = false;
private int[] mState = null;
private boolean mMergeState = false;
@@ -226,14 +227,14 @@
// Prior to L, this attribute would always set a color filter with
// blending mode SRC_ATOP. Preserve that default behavior.
- mDrawableTintMode = PorterDuff.Mode.SRC_ATOP;
- mHasDrawableTintMode = true;
+ mDrawableBlendMode = BlendMode.SRC_ATOP;
+ mHasDrawableBlendMode = true;
}
if (a.hasValue(R.styleable.ImageView_tintMode)) {
- mDrawableTintMode = Drawable.parseTintMode(a.getInt(
- R.styleable.ImageView_tintMode, -1), mDrawableTintMode);
- mHasDrawableTintMode = true;
+ mDrawableBlendMode = Drawable.parseBlendMode(a.getInt(
+ R.styleable.ImageView_tintMode, -1), mDrawableBlendMode);
+ mHasDrawableBlendMode = true;
}
applyImageTint();
@@ -674,8 +675,23 @@
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setImageTintMode(@Nullable PorterDuff.Mode tintMode) {
- mDrawableTintMode = tintMode;
- mHasDrawableTintMode = true;
+ setImageTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setImageTintList(ColorStateList)}} to the image drawable. The default
+ * mode is {@link BlendMode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#ImageView_tintMode
+ * @see #getImageTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setImageTintBlendMode(@Nullable BlendMode blendMode) {
+ mDrawableBlendMode = blendMode;
+ mHasDrawableBlendMode = true;
applyImageTint();
}
@@ -689,19 +705,32 @@
@Nullable
@InspectableProperty(name = "tintMode")
public PorterDuff.Mode getImageTintMode() {
- return mDrawableTintMode;
+ return mDrawableBlendMode != null
+ ? BlendMode.blendModeToPorterDuffMode(mDrawableBlendMode) : null;
+ }
+
+ /**
+ * Gets the blending mode used to apply the tint to the image Drawable
+ * @return the blending mode used to apply the tint to the image Drawable
+ * @attr ref android.R.styleable#ImageView_tintMode
+ * @see #setImageTintBlendMode(BlendMode)
+ */
+ @Nullable
+ @InspectableProperty(name = "blendMode", attributeId = android.R.styleable.ImageView_tintMode)
+ public BlendMode getImageTintBlendMode() {
+ return mDrawableBlendMode;
}
private void applyImageTint() {
- if (mDrawable != null && (mHasDrawableTint || mHasDrawableTintMode)) {
+ if (mDrawable != null && (mHasDrawableTint || mHasDrawableBlendMode)) {
mDrawable = mDrawable.mutate();
if (mHasDrawableTint) {
mDrawable.setTintList(mDrawableTintList);
}
- if (mHasDrawableTintMode) {
- mDrawable.setTintMode(mDrawableTintMode);
+ if (mHasDrawableBlendMode) {
+ mDrawable.setTintBlendMode(mDrawableBlendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index 0b433b1..2e95743 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -25,6 +25,7 @@
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.Rect;
@@ -334,7 +335,7 @@
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mProgressTintMode = Drawable.parseTintMode(a.getInt(
+ mProgressTintInfo.mProgressBlendMode = Drawable.parseBlendMode(a.getInt(
R.styleable.ProgressBar_progressTintMode, -1), null);
mProgressTintInfo.mHasProgressTintMode = true;
}
@@ -352,7 +353,7 @@
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mProgressBackgroundTintMode = Drawable.parseTintMode(a.getInt(
+ mProgressTintInfo.mProgressBackgroundBlendMode = Drawable.parseBlendMode(a.getInt(
R.styleable.ProgressBar_progressBackgroundTintMode, -1), null);
mProgressTintInfo.mHasProgressBackgroundTintMode = true;
}
@@ -370,7 +371,7 @@
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mSecondaryProgressTintMode = Drawable.parseTintMode(
+ mProgressTintInfo.mSecondaryProgressBlendMode = Drawable.parseBlendMode(
a.getInt(R.styleable.ProgressBar_secondaryProgressTintMode, -1), null);
mProgressTintInfo.mHasSecondaryProgressTintMode = true;
}
@@ -388,7 +389,7 @@
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mIndeterminateTintMode = Drawable.parseTintMode(a.getInt(
+ mProgressTintInfo.mIndeterminateBlendMode = Drawable.parseBlendMode(a.getInt(
R.styleable.ProgressBar_indeterminateTintMode, -1), null);
mProgressTintInfo.mHasIndeterminateTintMode = true;
}
@@ -796,12 +797,29 @@
* @attr ref android.R.styleable#ProgressBar_indeterminateTintMode
* @see #setIndeterminateTintList(ColorStateList)
* @see Drawable#setTintMode(PorterDuff.Mode)
+ *
*/
public void setIndeterminateTintMode(@Nullable PorterDuff.Mode tintMode) {
+ setIndeterminateTintBlendMode(tintMode != null
+ ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setIndeterminateTintList(ColorStateList)} to the indeterminate
+ * drawable. The default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#ProgressBar_indeterminateTintMode
+ * @see #setIndeterminateTintList(ColorStateList)
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setIndeterminateTintBlendMode(@Nullable BlendMode blendMode) {
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mIndeterminateTintMode = tintMode;
+ mProgressTintInfo.mIndeterminateBlendMode = blendMode;
mProgressTintInfo.mHasIndeterminateTintMode = true;
applyIndeterminateTint();
@@ -819,7 +837,23 @@
@InspectableProperty
@Nullable
public PorterDuff.Mode getIndeterminateTintMode() {
- return mProgressTintInfo != null ? mProgressTintInfo.mIndeterminateTintMode : null;
+ BlendMode mode = getIndeterminateTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the indeterminate
+ * drawable, if specified.
+ *
+ * @return the blending mode used to apply the tint to the indeterminate
+ * drawable
+ * @attr ref android.R.styleable#ProgressBar_indeterminateTintMode
+ * @see #setIndeterminateTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(attributeId = R.styleable.ProgressBar_indeterminateTintMode)
+ @Nullable
+ public BlendMode getIndeterminateTintBlendMode() {
+ return mProgressTintInfo != null ? mProgressTintInfo.mIndeterminateBlendMode : null;
}
private void applyIndeterminateTint() {
@@ -833,7 +867,7 @@
}
if (tintInfo.mHasIndeterminateTintMode) {
- mIndeterminateDrawable.setTintMode(tintInfo.mIndeterminateTintMode);
+ mIndeterminateDrawable.setTintBlendMode(tintInfo.mIndeterminateBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -956,7 +990,7 @@
target.setTintList(mProgressTintInfo.mProgressTintList);
}
if (mProgressTintInfo.mHasProgressTintMode) {
- target.setTintMode(mProgressTintInfo.mProgressTintMode);
+ target.setTintBlendMode(mProgressTintInfo.mProgressBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -981,7 +1015,7 @@
target.setTintList(mProgressTintInfo.mProgressBackgroundTintList);
}
if (mProgressTintInfo.mHasProgressBackgroundTintMode) {
- target.setTintMode(mProgressTintInfo.mProgressBackgroundTintMode);
+ target.setTintBlendMode(mProgressTintInfo.mProgressBackgroundBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -1006,7 +1040,7 @@
target.setTintList(mProgressTintInfo.mSecondaryProgressTintList);
}
if (mProgressTintInfo.mHasSecondaryProgressTintMode) {
- target.setTintMode(mProgressTintInfo.mSecondaryProgressTintMode);
+ target.setTintBlendMode(mProgressTintInfo.mSecondaryProgressBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -1076,10 +1110,25 @@
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setProgressTintMode(@Nullable PorterDuff.Mode tintMode) {
+ setProgressTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setProgressTintList(ColorStateList)}} to the progress
+ * indicator. The default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#ProgressBar_progressTintMode
+ * @see #getProgressTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setProgressTintBlendMode(@Nullable BlendMode blendMode) {
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mProgressTintMode = tintMode;
+ mProgressTintInfo.mProgressBlendMode = blendMode;
mProgressTintInfo.mHasProgressTintMode = true;
if (mProgressDrawable != null) {
@@ -1099,7 +1148,23 @@
@InspectableProperty
@Nullable
public PorterDuff.Mode getProgressTintMode() {
- return mProgressTintInfo != null ? mProgressTintInfo.mProgressTintMode : null;
+ BlendMode mode = getProgressTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the progress
+ * drawable, if specified.
+ *
+ * @return the blending mode used to apply the tint to the progress
+ * drawable
+ * @attr ref android.R.styleable#ProgressBar_progressTintMode
+ * @see #setProgressTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(attributeId = android.R.styleable.ProgressBar_progressTintMode)
+ @Nullable
+ public BlendMode getProgressTintBlendMode() {
+ return mProgressTintInfo != null ? mProgressTintInfo.mProgressBlendMode : null;
}
/**
@@ -1160,10 +1225,26 @@
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setProgressBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
+ setProgressBackgroundTintBlendMode(tintMode != null
+ ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setProgressBackgroundTintList(ColorStateList)}} to the progress
+ * background. The default mode is {@link BlendMode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#ProgressBar_progressBackgroundTintMode
+ * @see #setProgressBackgroundTintList(ColorStateList)
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setProgressBackgroundTintBlendMode(@Nullable BlendMode blendMode) {
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mProgressBackgroundTintMode = tintMode;
+ mProgressTintInfo.mProgressBackgroundBlendMode = blendMode;
mProgressTintInfo.mHasProgressBackgroundTintMode = true;
if (mProgressDrawable != null) {
@@ -1180,7 +1261,20 @@
@InspectableProperty
@Nullable
public PorterDuff.Mode getProgressBackgroundTintMode() {
- return mProgressTintInfo != null ? mProgressTintInfo.mProgressBackgroundTintMode : null;
+ BlendMode mode = getProgressBackgroundTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * @return the blending mode used to apply the tint to the progress
+ * background
+ * @attr ref android.R.styleable#ProgressBar_progressBackgroundTintMode
+ * @see #setProgressBackgroundTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(attributeId = R.styleable.ProgressBar_progressBackgroundTintMode)
+ @Nullable
+ public BlendMode getProgressBackgroundTintBlendMode() {
+ return mProgressTintInfo != null ? mProgressTintInfo.mProgressBackgroundBlendMode : null;
}
/**
@@ -1242,10 +1336,27 @@
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setSecondaryProgressTintMode(@Nullable PorterDuff.Mode tintMode) {
+ setSecondaryProgressTintBlendMode(tintMode != null
+ ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setSecondaryProgressTintList(ColorStateList)}} to the secondary
+ * progress indicator. The default mode is
+ * {@link PorterDuff.Mode#SRC_ATOP}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#ProgressBar_secondaryProgressTintMode
+ * @see #setSecondaryProgressTintList(ColorStateList)
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setSecondaryProgressTintBlendMode(@Nullable BlendMode blendMode) {
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mSecondaryProgressTintMode = tintMode;
+ mProgressTintInfo.mSecondaryProgressBlendMode = blendMode;
mProgressTintInfo.mHasSecondaryProgressTintMode = true;
if (mProgressDrawable != null) {
@@ -1265,7 +1376,23 @@
@InspectableProperty
@Nullable
public PorterDuff.Mode getSecondaryProgressTintMode() {
- return mProgressTintInfo != null ? mProgressTintInfo.mSecondaryProgressTintMode : null;
+ BlendMode mode = getSecondaryProgressTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the secondary
+ * progress drawable, if specified.
+ *
+ * @return the blending mode used to apply the tint to the secondary
+ * progress drawable
+ * @attr ref android.R.styleable#ProgressBar_secondaryProgressTintMode
+ * @see #setSecondaryProgressTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(attributeId = android.R.styleable.ProgressBar_secondaryProgressTintMode)
+ @Nullable
+ public BlendMode getSecondaryProgressTintBlendMode() {
+ return mProgressTintInfo != null ? mProgressTintInfo.mSecondaryProgressBlendMode : null;
}
/**
@@ -2208,22 +2335,22 @@
private static class ProgressTintInfo {
ColorStateList mIndeterminateTintList;
- PorterDuff.Mode mIndeterminateTintMode;
+ BlendMode mIndeterminateBlendMode;
boolean mHasIndeterminateTint;
boolean mHasIndeterminateTintMode;
ColorStateList mProgressTintList;
- PorterDuff.Mode mProgressTintMode;
+ BlendMode mProgressBlendMode;
boolean mHasProgressTint;
boolean mHasProgressTintMode;
ColorStateList mProgressBackgroundTintList;
- PorterDuff.Mode mProgressBackgroundTintMode;
+ BlendMode mProgressBackgroundBlendMode;
boolean mHasProgressBackgroundTint;
boolean mHasProgressBackgroundTintMode;
ColorStateList mSecondaryProgressTintList;
- PorterDuff.Mode mSecondaryProgressTintMode;
+ BlendMode mSecondaryProgressBlendMode;
boolean mHasSecondaryProgressTint;
boolean mHasSecondaryProgressTintMode;
}
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index ea9cd42..d57b3bc 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -26,6 +26,7 @@
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.Insets;
import android.graphics.Paint;
@@ -98,14 +99,14 @@
@UnsupportedAppUsage
private Drawable mThumbDrawable;
private ColorStateList mThumbTintList = null;
- private PorterDuff.Mode mThumbTintMode = null;
+ private BlendMode mThumbBlendMode = null;
private boolean mHasThumbTint = false;
private boolean mHasThumbTintMode = false;
@UnsupportedAppUsage
private Drawable mTrackDrawable;
private ColorStateList mTrackTintList = null;
- private PorterDuff.Mode mTrackTintMode = null;
+ private BlendMode mTrackBlendMode = null;
private boolean mHasTrackTint = false;
private boolean mHasTrackTintMode = false;
@@ -268,10 +269,11 @@
mThumbTintList = thumbTintList;
mHasThumbTint = true;
}
- PorterDuff.Mode thumbTintMode = Drawable.parseTintMode(
- a.getInt(com.android.internal.R.styleable.Switch_thumbTintMode, -1), null);
- if (mThumbTintMode != thumbTintMode) {
- mThumbTintMode = thumbTintMode;
+ BlendMode thumbTintMode = Drawable.parseBlendMode(
+ a.getInt(com.android.internal.R.styleable.Switch_thumbTintMode, -1),
+ null);
+ if (mThumbBlendMode != thumbTintMode) {
+ mThumbBlendMode = thumbTintMode;
mHasThumbTintMode = true;
}
if (mHasThumbTint || mHasThumbTintMode) {
@@ -284,10 +286,11 @@
mTrackTintList = trackTintList;
mHasTrackTint = true;
}
- PorterDuff.Mode trackTintMode = Drawable.parseTintMode(
- a.getInt(com.android.internal.R.styleable.Switch_trackTintMode, -1), null);
- if (mTrackTintMode != trackTintMode) {
- mTrackTintMode = trackTintMode;
+ BlendMode trackTintMode = Drawable.parseBlendMode(
+ a.getInt(com.android.internal.R.styleable.Switch_trackTintMode, -1),
+ null);
+ if (mTrackBlendMode != trackTintMode) {
+ mTrackBlendMode = trackTintMode;
mHasTrackTintMode = true;
}
if (mHasTrackTint || mHasTrackTintMode) {
@@ -587,7 +590,22 @@
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setTrackTintMode(@Nullable PorterDuff.Mode tintMode) {
- mTrackTintMode = tintMode;
+ setTrackTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setTrackTintList(ColorStateList)}} to the track drawable.
+ * The default mode is {@link BlendMode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#Switch_trackTintMode
+ * @see #getTrackTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setTrackTintBlendMode(@Nullable BlendMode blendMode) {
+ mTrackBlendMode = blendMode;
mHasTrackTintMode = true;
applyTrackTint();
@@ -602,7 +620,20 @@
@InspectableProperty
@Nullable
public PorterDuff.Mode getTrackTintMode() {
- return mTrackTintMode;
+ BlendMode mode = getTrackTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * @return the blending mode used to apply the tint to the track
+ * drawable
+ * @attr ref android.R.styleable#Switch_trackTintMode
+ * @see #setTrackTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(attributeId = com.android.internal.R.styleable.Switch_trackTintMode)
+ @Nullable
+ public BlendMode getTrackTintBlendMode() {
+ return mTrackBlendMode;
}
private void applyTrackTint() {
@@ -614,7 +645,7 @@
}
if (mHasTrackTintMode) {
- mTrackDrawable.setTintMode(mTrackTintMode);
+ mTrackDrawable.setTintBlendMode(mTrackBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -713,7 +744,22 @@
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setThumbTintMode(@Nullable PorterDuff.Mode tintMode) {
- mThumbTintMode = tintMode;
+ setThumbTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setThumbTintList(ColorStateList)}} to the thumb drawable.
+ * The default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#Switch_thumbTintMode
+ * @see #getThumbTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setThumbTintBlendMode(@Nullable BlendMode blendMode) {
+ mThumbBlendMode = blendMode;
mHasThumbTintMode = true;
applyThumbTint();
@@ -728,7 +774,20 @@
@InspectableProperty
@Nullable
public PorterDuff.Mode getThumbTintMode() {
- return mThumbTintMode;
+ BlendMode mode = getThumbTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * @return the blending mode used to apply the tint to the thumb
+ * drawable
+ * @attr ref android.R.styleable#Switch_thumbTintMode
+ * @see #setThumbTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(attributeId = com.android.internal.R.styleable.Switch_thumbTintMode)
+ @Nullable
+ public BlendMode getThumbTintBlendMode() {
+ return mThumbBlendMode;
}
private void applyThumbTint() {
@@ -740,7 +799,7 @@
}
if (mHasThumbTintMode) {
- mThumbDrawable.setTintMode(mThumbTintMode);
+ mThumbDrawable.setTintBlendMode(mThumbBlendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 618b05f..17c56c3 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -55,6 +55,7 @@
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.BaseCanvas;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.Insets;
import android.graphics.Paint;
@@ -489,7 +490,7 @@
final Drawable[] mShowing = new Drawable[4];
ColorStateList mTintList;
- PorterDuff.Mode mTintMode;
+ BlendMode mBlendMode;
boolean mHasTint;
boolean mHasTintMode;
@@ -1036,7 +1037,7 @@
Drawable drawableLeft = null, drawableTop = null, drawableRight = null,
drawableBottom = null, drawableStart = null, drawableEnd = null;
ColorStateList drawableTint = null;
- PorterDuff.Mode drawableTintMode = null;
+ BlendMode drawableTintMode = null;
int drawablePadding = 0;
int ellipsize = ELLIPSIZE_NOT_SET;
boolean singleLine = false;
@@ -1139,7 +1140,8 @@
break;
case com.android.internal.R.styleable.TextView_drawableTintMode:
- drawableTintMode = Drawable.parseTintMode(a.getInt(attr, -1), drawableTintMode);
+ drawableTintMode = Drawable.parseBlendMode(a.getInt(attr, -1),
+ drawableTintMode);
break;
case com.android.internal.R.styleable.TextView_drawablePadding:
@@ -1543,7 +1545,7 @@
mDrawables.mHasTint = true;
}
if (drawableTintMode != null) {
- mDrawables.mTintMode = drawableTintMode;
+ mDrawables.mBlendMode = drawableTintMode;
mDrawables.mHasTintMode = true;
}
}
@@ -3299,10 +3301,26 @@
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setCompoundDrawableTintMode(@Nullable PorterDuff.Mode tintMode) {
+ setCompoundDrawableTintBlendMode(tintMode != null
+ ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setCompoundDrawableTintList(ColorStateList)} to the compound
+ * drawables. The default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#TextView_drawableTintMode
+ * @see #setCompoundDrawableTintList(ColorStateList)
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setCompoundDrawableTintBlendMode(@Nullable BlendMode blendMode) {
if (mDrawables == null) {
mDrawables = new Drawables(getContext());
}
- mDrawables.mTintMode = tintMode;
+ mDrawables.mBlendMode = blendMode;
mDrawables.mHasTintMode = true;
applyCompoundDrawableTint();
@@ -3316,10 +3334,27 @@
* drawables
* @attr ref android.R.styleable#TextView_drawableTintMode
* @see #setCompoundDrawableTintMode(PorterDuff.Mode)
+ *
*/
@InspectableProperty(name = "drawableTintMode")
public PorterDuff.Mode getCompoundDrawableTintMode() {
- return mDrawables != null ? mDrawables.mTintMode : null;
+ BlendMode mode = getCompoundDrawableTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the compound
+ * drawables, if specified.
+ *
+ * @return the blending mode used to apply the tint to the compound
+ * drawables
+ * @attr ref android.R.styleable#TextView_drawableTintMode
+ * @see #setCompoundDrawableTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(name = "drawableBlendMode",
+ attributeId = com.android.internal.R.styleable.TextView_drawableTintMode)
+ public @Nullable BlendMode getCompoundDrawableTintBlendMode() {
+ return mDrawables != null ? mDrawables.mBlendMode : null;
}
private void applyCompoundDrawableTint() {
@@ -3329,7 +3364,7 @@
if (mDrawables.mHasTint || mDrawables.mHasTintMode) {
final ColorStateList tintList = mDrawables.mTintList;
- final PorterDuff.Mode tintMode = mDrawables.mTintMode;
+ final BlendMode blendMode = mDrawables.mBlendMode;
final boolean hasTint = mDrawables.mHasTint;
final boolean hasTintMode = mDrawables.mHasTintMode;
final int[] state = getDrawableState();
@@ -3353,7 +3388,7 @@
}
if (hasTintMode) {
- dr.setTintMode(tintMode);
+ dr.setTintBlendMode(blendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/graphics/java/android/graphics/BaseCanvas.java b/graphics/java/android/graphics/BaseCanvas.java
index c9431e3..6e7f286 100644
--- a/graphics/java/android/graphics/BaseCanvas.java
+++ b/graphics/java/android/graphics/BaseCanvas.java
@@ -243,10 +243,6 @@
nDrawColor(mNativeCanvasWrapper, color, BlendMode.SRC_OVER.getXfermode().porterDuffMode);
}
- /**
- * @deprecated use {@link Canvas#drawColor(int, BlendMode)}
- */
- @Deprecated
public void drawColor(@ColorInt int color, @NonNull PorterDuff.Mode mode) {
nDrawColor(mNativeCanvasWrapper, color, mode.nativeInt);
}
diff --git a/graphics/java/android/graphics/BaseRecordingCanvas.java b/graphics/java/android/graphics/BaseRecordingCanvas.java
index 028b784..2f5214cb1 100644
--- a/graphics/java/android/graphics/BaseRecordingCanvas.java
+++ b/graphics/java/android/graphics/BaseRecordingCanvas.java
@@ -203,10 +203,6 @@
nDrawColor(mNativeCanvasWrapper, color, BlendMode.SRC_OVER.getXfermode().porterDuffMode);
}
- /**
- * @deprecated use {@link #drawColor(int, BlendMode)} instead
- */
- @Deprecated
@Override
public final void drawColor(@ColorInt int color, @NonNull PorterDuff.Mode mode) {
nDrawColor(mNativeCanvasWrapper, color, mode.nativeInt);
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 6f00fc90..d4d5ae7 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -1700,10 +1700,7 @@
*
* @param color the color to draw onto the canvas
* @param mode the porter-duff mode to apply to the color
- *
- * @deprecated use {@link #drawColor(int, BlendMode)} instead
*/
- @Deprecated
public void drawColor(@ColorInt int color, @NonNull PorterDuff.Mode mode) {
super.drawColor(color, mode);
}
diff --git a/graphics/java/android/graphics/ComposeShader.java b/graphics/java/android/graphics/ComposeShader.java
index 93ddb10..64ee6bf 100644
--- a/graphics/java/android/graphics/ComposeShader.java
+++ b/graphics/java/android/graphics/ComposeShader.java
@@ -39,9 +39,7 @@
* @param shaderB The colors from this shader are seen as the "src" by the mode
* @param mode The mode that combines the colors from the two shaders. If mode
* is null, then SRC_OVER is assumed.
- *
- * @deprecated use {@link #ComposeShader(Shader, Shader, BlendMode)} instead
- */
+ */
@Deprecated
public ComposeShader(@NonNull Shader shaderA, @NonNull Shader shaderB, @NonNull Xfermode mode) {
this(shaderA, shaderB, mode.porterDuffMode);
@@ -56,9 +54,7 @@
* @param shaderB The colors from this shader are seen as the "src" by the mode
* @param mode The PorterDuff mode that combines the colors from the two shaders.
*
- * @deprecated use {@link #ComposeShader(Shader, Shader, BlendMode)} instead
*/
- @Deprecated
public ComposeShader(@NonNull Shader shaderA, @NonNull Shader shaderB,
@NonNull PorterDuff.Mode mode) {
this(shaderA, shaderB, mode.nativeInt);
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index db5f065..b7316ab 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -1274,10 +1274,7 @@
* Get the paint's transfer mode object.
*
* @return the paint's transfer mode (or null)
- *
- * @deprecated use {@link #getBlendMode()} instead
*/
- @Deprecated
public Xfermode getXfermode() {
return mXfermode;
}
@@ -1308,11 +1305,7 @@
*
* @param xfermode May be null. The xfermode to be installed in the paint
* @return xfermode
- *
- * @deprecated Use {@link #setBlendMode} to apply a Xfermode directly
- * through usage of {@link BlendMode}
*/
- @Deprecated
public Xfermode setXfermode(Xfermode xfermode) {
return installXfermode(xfermode);
}
diff --git a/graphics/java/android/graphics/PorterDuff.java b/graphics/java/android/graphics/PorterDuff.java
index 459291b..bc1f66f 100644
--- a/graphics/java/android/graphics/PorterDuff.java
+++ b/graphics/java/android/graphics/PorterDuff.java
@@ -24,9 +24,8 @@
* of {@link Paint}'s {@link Paint#setXfermode(Xfermode) transfer mode}.
* All the available modes can be found in the {@link Mode} enum.</p>
*
- * @deprecated Use {@link BlendMode} with {@link Paint#setBlendMode(BlendMode)} instead
+ * Consider using {@link BlendMode} instead as it provides a wider variety of tinting options
*/
-@Deprecated
public class PorterDuff {
/**
* {@usesMathJax}
diff --git a/graphics/java/android/graphics/PorterDuffColorFilter.java b/graphics/java/android/graphics/PorterDuffColorFilter.java
index c2a8eb7..cc2d3a8 100644
--- a/graphics/java/android/graphics/PorterDuffColorFilter.java
+++ b/graphics/java/android/graphics/PorterDuffColorFilter.java
@@ -23,11 +23,7 @@
/**
* A color filter that can be used to tint the source pixels using a single
* color and a specific {@link PorterDuff Porter-Duff composite mode}.
- *
- * @deprecated Consider using {@link BlendModeColorFilter} instead as it supports a wider
- * set of blend modes than those defined in {@link PorterDuff.Mode}
*/
-@Deprecated
public class PorterDuffColorFilter extends ColorFilter {
@ColorInt
private int mColor;
diff --git a/graphics/java/android/graphics/PorterDuffXfermode.java b/graphics/java/android/graphics/PorterDuffXfermode.java
index 5b933c4..ff9ff8b 100644
--- a/graphics/java/android/graphics/PorterDuffXfermode.java
+++ b/graphics/java/android/graphics/PorterDuffXfermode.java
@@ -22,10 +22,6 @@
* documentation of the {@link PorterDuff.Mode} enum for more
* information on the available alpha compositing and blending modes.</p>
*
- * @deprecated Consider using {@link BlendMode} instead as it supports a wider
- * set of blend modes than those defined in {@link PorterDuff.Mode}
- *
- * @see Paint#setBlendMode(BlendMode)
*/
public class PorterDuffXfermode extends Xfermode {
/**
diff --git a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
index 7def322..fab96a1 100644
--- a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
+++ b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
@@ -701,13 +701,13 @@
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
final ChildDrawable[] array = mLayerState.mChildren;
final int N = mLayerState.N_CHILDREN;
for (int i = 0; i < N; i++) {
final Drawable dr = array[i].mDrawable;
if (dr != null) {
- dr.setTintMode(blendMode);
+ dr.setTintBlendMode(blendMode);
}
}
}
diff --git a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
index f45bf9b..66947da 100644
--- a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
@@ -477,8 +477,8 @@
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
- mAnimatedVectorState.mVectorDrawable.setTintMode(blendMode);
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
+ mAnimatedVectorState.mVectorDrawable.setTintBlendMode(blendMode);
}
@Override
diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java
index 6b30158..e4aa774 100644
--- a/graphics/java/android/graphics/drawable/BitmapDrawable.java
+++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java
@@ -685,7 +685,7 @@
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
final BitmapState state = mBitmapState;
if (state.mBlendMode != blendMode) {
state.mBlendMode = blendMode;
diff --git a/graphics/java/android/graphics/drawable/ColorDrawable.java b/graphics/java/android/graphics/drawable/ColorDrawable.java
index efa806a..f5fa8c5 100644
--- a/graphics/java/android/graphics/drawable/ColorDrawable.java
+++ b/graphics/java/android/graphics/drawable/ColorDrawable.java
@@ -215,7 +215,7 @@
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
mColorState.mBlendMode = blendMode;
mBlendModeColorFilter = updateBlendModeFilter(mBlendModeColorFilter, mColorState.mTint,
blendMode);
diff --git a/graphics/java/android/graphics/drawable/ColorStateListDrawable.java b/graphics/java/android/graphics/drawable/ColorStateListDrawable.java
index b94b114..35021a6 100644
--- a/graphics/java/android/graphics/drawable/ColorStateListDrawable.java
+++ b/graphics/java/android/graphics/drawable/ColorStateListDrawable.java
@@ -114,9 +114,9 @@
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
mState.mBlendMode = blendMode;
- mColorDrawable.setTintMode(blendMode);
+ mColorDrawable.setTintBlendMode(blendMode);
onStateChange(getState());
}
@@ -293,7 +293,7 @@
}
if (mState.mBlendMode != DEFAULT_BLEND_MODE) {
- mColorDrawable.setTintMode(mState.mBlendMode);
+ mColorDrawable.setTintBlendMode(mState.mBlendMode);
}
}
}
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index adc04fb0..0840986 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -213,17 +213,17 @@
protected int mSrcDensityOverride = 0;
/**
- * Flag used to break the recursive loop between setTintMode(PorterDuff.Mode) and
- * setTintMode(BlendMode) as each default implementation invokes the other in order to
+ * Flag used to break the recursive loop between setTintBlendMode(PorterDuff.Mode) and
+ * setTintBlendMode(BlendMode) as each default implementation invokes the other in order to
* support new use cases that utilize the new blending modes as well as support the legacy
- * use cases. This flag tracks that {@link #setTintMode(BlendMode)} is only invoked once
+ * use cases. This flag tracks that {@link #setTintBlendMode(BlendMode)} is only invoked once
* per invocation.
*/
private boolean mSetBlendModeInvoked = false;
/**
- * Flag used to break the recursive loop between setTintMode(PorterDuff.Mode) and
- * setTintMode(BlendMode) as each default implementation invokes the other in order to
+ * Flag used to break the recursive loop between setTintBlendMode(PorterDuff.Mode) and
+ * setTintBlendMode(BlendMode) as each default implementation invokes the other in order to
* support new use cases that utilize the new blending modes as well as support the legacy
* use cases. This flag tracks that {@link #setTintMode(Mode)} is only invoked once
* per invocation;
@@ -651,7 +651,7 @@
* @param tintColor Color to use for tinting this drawable
* @see #setTintList(ColorStateList)
* @see #setTintMode(PorterDuff.Mode)
- * @see #setTintMode(BlendMode)
+ * @see #setTintBlendMode(BlendMode)
*/
public void setTint(@ColorInt int tintColor) {
setTintList(ColorStateList.valueOf(tintColor));
@@ -673,7 +673,7 @@
* {@code null} to clear the tint
* @see #setTint(int)
* @see #setTintMode(PorterDuff.Mode)
- * @see #setTintMode(BlendMode)
+ * @see #setTintBlendMode(BlendMode)
*/
public void setTintList(@Nullable ColorStateList tint) {}
@@ -693,15 +693,12 @@
* of {@link PorterDuff.Mode#SRC_IN}
* @see #setTint(int)
* @see #setTintList(ColorStateList)
- *
- * @deprecated use {@link #setTintMode(BlendMode)} instead
*/
- @Deprecated
public void setTintMode(@Nullable PorterDuff.Mode tintMode) {
if (!mSetTintModeInvoked) {
mSetTintModeInvoked = true;
BlendMode mode = tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null;
- setTintMode(mode != null ? mode : Drawable.DEFAULT_BLEND_MODE);
+ setTintBlendMode(mode != null ? mode : Drawable.DEFAULT_BLEND_MODE);
mSetTintModeInvoked = false;
}
}
@@ -721,7 +718,7 @@
* @see #setTint(int)
* @see #setTintList(ColorStateList)
*/
- public void setTintMode(@Nullable BlendMode blendMode) {
+ public void setTintBlendMode(@Nullable BlendMode blendMode) {
if (!mSetBlendModeInvoked) {
mSetBlendModeInvoked = true;
PorterDuff.Mode mode = BlendMode.blendModeToPorterDuffMode(blendMode);
diff --git a/graphics/java/android/graphics/drawable/DrawableContainer.java b/graphics/java/android/graphics/drawable/DrawableContainer.java
index 3e0881a..090d915 100644
--- a/graphics/java/android/graphics/drawable/DrawableContainer.java
+++ b/graphics/java/android/graphics/drawable/DrawableContainer.java
@@ -196,14 +196,14 @@
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
mDrawableContainerState.mHasTintMode = true;
if (mDrawableContainerState.mBlendMode != blendMode) {
mDrawableContainerState.mBlendMode = blendMode;
if (mCurrDrawable != null) {
- mCurrDrawable.setTintMode(blendMode);
+ mCurrDrawable.setTintBlendMode(blendMode);
}
}
}
@@ -544,7 +544,7 @@
d.setTintList(mDrawableContainerState.mTintList);
}
if (mDrawableContainerState.mHasTintMode) {
- d.setTintMode(mDrawableContainerState.mBlendMode);
+ d.setTintBlendMode(mDrawableContainerState.mBlendMode);
}
}
diff --git a/graphics/java/android/graphics/drawable/DrawableWrapper.java b/graphics/java/android/graphics/drawable/DrawableWrapper.java
index d81401d..64fc704 100644
--- a/graphics/java/android/graphics/drawable/DrawableWrapper.java
+++ b/graphics/java/android/graphics/drawable/DrawableWrapper.java
@@ -324,9 +324,9 @@
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
if (mDrawable != null) {
- mDrawable.setTintMode(blendMode);
+ mDrawable.setTintBlendMode(blendMode);
}
}
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index 6948bc4..816d1fd 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -1211,7 +1211,7 @@
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
mGradientState.mBlendMode = blendMode;
mBlendModeColorFilter = updateBlendModeFilter(mBlendModeColorFilter, mGradientState.mTint,
blendMode);
diff --git a/graphics/java/android/graphics/drawable/Icon.java b/graphics/java/android/graphics/drawable/Icon.java
index 5fd18a1..3658f89 100644
--- a/graphics/java/android/graphics/drawable/Icon.java
+++ b/graphics/java/android/graphics/drawable/Icon.java
@@ -324,7 +324,7 @@
if (result != null && (mTintList != null || mBlendMode != DEFAULT_BLEND_MODE)) {
result.mutate();
result.setTintList(mTintList);
- result.setTintMode(mBlendMode);
+ result.setTintBlendMode(mBlendMode);
}
return result;
}
@@ -696,10 +696,7 @@
*
* @param mode a blending mode, as in {@link Drawable#setTintMode(PorterDuff.Mode)}, may be null
* @return this same object, for use in chained construction
- *
- * @deprecated use {@link #setTintMode(BlendMode)} instead
*/
- @Deprecated
public @NonNull Icon setTintMode(@NonNull PorterDuff.Mode mode) {
mBlendMode = BlendMode.fromValue(mode.nativeInt);
return this;
@@ -711,7 +708,7 @@
* @param mode a blending mode, as in {@link Drawable#setTintMode(PorterDuff.Mode)}, may be null
* @return this same object, for use in chained construction
*/
- public @NonNull Icon setTintMode(@NonNull BlendMode mode) {
+ public @NonNull Icon setTintBlendMode(@NonNull BlendMode mode) {
mBlendMode = mode;
return this;
}
diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java
index e2c8492..f3a1b0e 100644
--- a/graphics/java/android/graphics/drawable/LayerDrawable.java
+++ b/graphics/java/android/graphics/drawable/LayerDrawable.java
@@ -1397,13 +1397,13 @@
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
final ChildDrawable[] array = mLayerState.mChildren;
final int N = mLayerState.mNumChildren;
for (int i = 0; i < N; i++) {
final Drawable dr = array[i].mDrawable;
if (dr != null) {
- dr.setTintMode(blendMode);
+ dr.setTintBlendMode(blendMode);
}
}
}
diff --git a/graphics/java/android/graphics/drawable/NinePatchDrawable.java b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
index 4972e6a..8561d95 100644
--- a/graphics/java/android/graphics/drawable/NinePatchDrawable.java
+++ b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
@@ -349,7 +349,7 @@
}
@Override
- public void setTintMode(@Nullable BlendMode blendMode) {
+ public void setTintBlendMode(@Nullable BlendMode blendMode) {
mNinePatchState.mBlendMode = blendMode;
mBlendModeFilter = updateBlendModeFilter(mBlendModeFilter, mNinePatchState.mTint,
blendMode);
diff --git a/graphics/java/android/graphics/drawable/ShapeDrawable.java b/graphics/java/android/graphics/drawable/ShapeDrawable.java
index b5fe7f9..9774b59 100644
--- a/graphics/java/android/graphics/drawable/ShapeDrawable.java
+++ b/graphics/java/android/graphics/drawable/ShapeDrawable.java
@@ -297,7 +297,7 @@
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
mShapeState.mBlendMode = blendMode;
mBlendModeColorFilter = updateBlendModeFilter(mBlendModeColorFilter, mShapeState.mTint,
blendMode);
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java
index 43772ec..aa19b2a 100644
--- a/graphics/java/android/graphics/drawable/VectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/VectorDrawable.java
@@ -487,7 +487,7 @@
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
final VectorDrawableState state = mVectorState;
if (state.mBlendMode != blendMode) {
state.mBlendMode = blendMode;
diff --git a/packages/SettingsLib/src/com/android/settingslib/inputmethod/InputMethodAndSubtypeUtil.java b/packages/SettingsLib/src/com/android/settingslib/inputmethod/InputMethodAndSubtypeUtil.java
index 057123b..1712a6b 100644
--- a/packages/SettingsLib/src/com/android/settingslib/inputmethod/InputMethodAndSubtypeUtil.java
+++ b/packages/SettingsLib/src/com/android/settingslib/inputmethod/InputMethodAndSubtypeUtil.java
@@ -419,8 +419,8 @@
return configurationLocale;
}
- public static boolean isValidSystemNonAuxAsciiCapableIme(InputMethodInfo imi) {
- if (imi.isAuxiliaryIme() || !imi.isSystem()) {
+ public static boolean isValidNonAuxAsciiCapableIme(InputMethodInfo imi) {
+ if (imi.isAuxiliaryIme()) {
return false;
}
final int subtypeCount = imi.getSubtypeCount();
diff --git a/packages/SettingsLib/src/com/android/settingslib/inputmethod/InputMethodPreference.java b/packages/SettingsLib/src/com/android/settingslib/inputmethod/InputMethodPreference.java
index 120acd3..55b6cda 100644
--- a/packages/SettingsLib/src/com/android/settingslib/inputmethod/InputMethodPreference.java
+++ b/packages/SettingsLib/src/com/android/settingslib/inputmethod/InputMethodPreference.java
@@ -125,7 +125,7 @@
}
mInputMethodSettingValues = InputMethodSettingValuesWrapper.getInstance(context);
mHasPriorityInSorting = imi.isSystem()
- && InputMethodAndSubtypeUtil.isValidSystemNonAuxAsciiCapableIme(imi);
+ && InputMethodAndSubtypeUtil.isValidNonAuxAsciiCapableIme(imi);
setOnPreferenceClickListener(this);
setOnPreferenceChangeListener(this);
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/inputmethod/InputMethodSettingValuesWrapper.java b/packages/SettingsLib/src/com/android/settingslib/inputmethod/InputMethodSettingValuesWrapper.java
index b6786d4..13c1b82 100644
--- a/packages/SettingsLib/src/com/android/settingslib/inputmethod/InputMethodSettingValuesWrapper.java
+++ b/packages/SettingsLib/src/com/android/settingslib/inputmethod/InputMethodSettingValuesWrapper.java
@@ -77,25 +77,25 @@
return true;
}
- final int enabledValidSystemNonAuxAsciiCapableImeCount =
- getEnabledValidSystemNonAuxAsciiCapableImeCount();
+ final int enabledValidNonAuxAsciiCapableImeCount =
+ getEnabledValidNonAuxAsciiCapableImeCount();
- return enabledValidSystemNonAuxAsciiCapableImeCount <= 1
- && !(enabledValidSystemNonAuxAsciiCapableImeCount == 1 && !isEnabled)
+ return enabledValidNonAuxAsciiCapableImeCount <= 1
+ && !(enabledValidNonAuxAsciiCapableImeCount == 1 && !isEnabled)
&& imi.isSystem()
- && InputMethodAndSubtypeUtil.isValidSystemNonAuxAsciiCapableIme(imi);
+ && InputMethodAndSubtypeUtil.isValidNonAuxAsciiCapableIme(imi);
}
- private int getEnabledValidSystemNonAuxAsciiCapableImeCount() {
+ private int getEnabledValidNonAuxAsciiCapableImeCount() {
int count = 0;
final List<InputMethodInfo> enabledImis = getEnabledInputMethodList();
for (final InputMethodInfo imi : enabledImis) {
- if (InputMethodAndSubtypeUtil.isValidSystemNonAuxAsciiCapableIme(imi)) {
+ if (InputMethodAndSubtypeUtil.isValidNonAuxAsciiCapableIme(imi)) {
++count;
}
}
if (count == 0) {
- Log.w(TAG, "No \"enabledValidSystemNonAuxAsciiCapableIme\"s found.");
+ Log.w(TAG, "No \"enabledValidNonAuxAsciiCapableIme\"s found.");
}
return count;
}
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/inputmethod/InputMethodAndSubtypeUtilTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/inputmethod/InputMethodAndSubtypeUtilTest.java
index 84606b4..5171dda 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/inputmethod/InputMethodAndSubtypeUtilTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/inputmethod/InputMethodAndSubtypeUtilTest.java
@@ -192,53 +192,47 @@
}
@Test
- public void isValidSystemNonAuxAsciiCapableIme() {
- // System IME w/ no subtype
- assertThat(InputMethodAndSubtypeUtil.isValidSystemNonAuxAsciiCapableIme(
- createDummyIme(true, false)))
+ public void isValidNonAuxAsciiCapableIme() {
+ // IME w/ no subtype
+ assertThat(InputMethodAndSubtypeUtil.isValidNonAuxAsciiCapableIme(
+ createDummyIme(false)))
.isFalse();
- // System IME w/ non-Aux and non-ASCII-capable "keyboard" subtype
- assertThat(InputMethodAndSubtypeUtil.isValidSystemNonAuxAsciiCapableIme(
- createDummyIme(true, false, createDummySubtype("keyboard", false, false))))
+ // IME w/ non-Aux and non-ASCII-capable "keyboard" subtype
+ assertThat(InputMethodAndSubtypeUtil.isValidNonAuxAsciiCapableIme(
+ createDummyIme(false, createDummySubtype("keyboard", false, false))))
.isFalse();
- // System IME w/ non-Aux and ASCII-capable "keyboard" subtype
- assertThat(InputMethodAndSubtypeUtil.isValidSystemNonAuxAsciiCapableIme(
- createDummyIme(true, false, createDummySubtype("keyboard", false, true))))
+ // IME w/ non-Aux and ASCII-capable "keyboard" subtype
+ assertThat(InputMethodAndSubtypeUtil.isValidNonAuxAsciiCapableIme(
+ createDummyIme(false, createDummySubtype("keyboard", false, true))))
.isTrue();
- // System IME w/ Aux and ASCII-capable "keyboard" subtype
- assertThat(InputMethodAndSubtypeUtil.isValidSystemNonAuxAsciiCapableIme(
- createDummyIme(true, true, createDummySubtype("keyboard", true, true))))
+ // IME w/ Aux and ASCII-capable "keyboard" subtype
+ assertThat(InputMethodAndSubtypeUtil.isValidNonAuxAsciiCapableIme(
+ createDummyIme(true, createDummySubtype("keyboard", true, true))))
.isFalse();
- // System IME w/ non-Aux and ASCII-capable "voice" subtype
- assertThat(InputMethodAndSubtypeUtil.isValidSystemNonAuxAsciiCapableIme(
- createDummyIme(true, false, createDummySubtype("voice", false, true))))
+ // IME w/ non-Aux and ASCII-capable "voice" subtype
+ assertThat(InputMethodAndSubtypeUtil.isValidNonAuxAsciiCapableIme(
+ createDummyIme(false, createDummySubtype("voice", false, true))))
.isFalse();
- // System IME w/ non-Aux and non-ASCII-capable subtype + Non-Aux and ASCII-capable subtype
- assertThat(InputMethodAndSubtypeUtil.isValidSystemNonAuxAsciiCapableIme(
- createDummyIme(true, false,
+ // IME w/ non-Aux and non-ASCII-capable subtype + Non-Aux and ASCII-capable subtype
+ assertThat(InputMethodAndSubtypeUtil.isValidNonAuxAsciiCapableIme(
+ createDummyIme(false,
createDummySubtype("keyboard", false, true),
createDummySubtype("keyboard", false, false))))
.isTrue();
-
- // Non-system IME w/ non-Aux and ASCII-capable "keyboard" subtype
- assertThat(InputMethodAndSubtypeUtil.isValidSystemNonAuxAsciiCapableIme(
- createDummyIme(false, false, createDummySubtype("keyboard", false, true))))
- .isFalse();
}
- private static InputMethodInfo createDummyIme(boolean isSystem, boolean isAuxIme,
+ private static InputMethodInfo createDummyIme(boolean isAuxIme,
InputMethodSubtype... subtypes) {
final ResolveInfo ri = new ResolveInfo();
final ServiceInfo si = new ServiceInfo();
final ApplicationInfo ai = new ApplicationInfo();
ai.packageName = "com.example.android.dummyime";
ai.enabled = true;
- ai.flags |= (isSystem ? ApplicationInfo.FLAG_SYSTEM : 0);
si.applicationInfo = ai;
si.enabled = true;
si.packageName = "com.example.android.dummyime";
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index e02be38..d6906f3 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -114,7 +114,7 @@
<!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
<string name="quick_settings_tiles_stock" translatable="false">
- wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,dark,saver,work,cast,night
+ wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,dark,work,cast,night
</string>
<!-- The tiles to display in QuickSettings -->
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 97a277b..94bb1f3 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -20,6 +20,7 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
+import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
import android.service.voice.VoiceInteractionSession;
@@ -54,6 +55,14 @@
private static final String ASSIST_ICON_METADATA_NAME =
"com.android.systemui.action_assist_icon";
+ private static final String INVOCATION_TIME_MS_KEY = "invocation_time_ms";
+ public static final String INVOCATION_TYPE_KEY = "invocation_type";
+
+ public static final int INVOCATION_TYPE_GESTURE = 1;
+ public static final int INVOCATION_TYPE_ACTIVE_EDGE = 2;
+ public static final int INVOCATION_TYPE_VOICE = 3;
+ public static final int INVOCATION_TYPE_QUICK_SEARCH_BAR = 4;
+ public static final int INVOCATION_HOME_BUTTON_LONG_PRESS = 5;
private static final long TIMEOUT_SERVICE = 2500;
private static final long TIMEOUT_ACTIVITY = 1000;
@@ -171,6 +180,7 @@
? TIMEOUT_SERVICE
: TIMEOUT_ACTIVITY);
}
+ args.putLong(INVOCATION_TIME_MS_KEY, SystemClock.uptimeMillis());
startAssistInternal(args, assistComponent, isService);
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index d53c6e9..b755f28 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -16,6 +16,8 @@
package com.android.systemui.bubbles;
+import static android.view.Display.DEFAULT_DISPLAY;
+import static android.view.Display.INVALID_DISPLAY;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
@@ -535,6 +537,21 @@
return mTempRect;
}
+ /**
+ * The display id of the expanded view, if the stack is expanded and not occluded by the
+ * status bar, otherwise returns {@link Display#INVALID_DISPLAY}.
+ */
+ public int getExpandedDisplayId(Context context) {
+ boolean defaultDisplay = context.getDisplay() != null
+ && context.getDisplay().getDisplayId() == DEFAULT_DISPLAY;
+ Bubble b = mStackView.getExpandedBubble();
+ if (defaultDisplay && b != null && isStackExpanded()
+ && !mStatusBarWindowController.getPanelExpanded()) {
+ return b.expandedView.getVirtualDisplayId();
+ }
+ return INVALID_DISPLAY;
+ }
+
@VisibleForTesting
BubbleStackView getStackView() {
return mStackView;
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index 17275ad..63db361 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -20,6 +20,7 @@
import static android.util.StatsLogInternal.BUBBLE_DEVELOPER_ERROR_REPORTED__ERROR__ACTIVITY_INFO_MISSING;
import static android.util.StatsLogInternal.BUBBLE_DEVELOPER_ERROR_REPORTED__ERROR__ACTIVITY_INFO_NOT_RESIZABLE;
import static android.util.StatsLogInternal.BUBBLE_DEVELOPER_ERROR_REPORTED__ERROR__DOCUMENT_LAUNCH_NOT_ALWAYS;
+import static android.view.Display.INVALID_DISPLAY;
import android.animation.LayoutTransition;
import android.animation.ObjectAnimator;
@@ -598,6 +599,16 @@
return mBubbleIntent != null && mActivityView != null;
}
+ /**
+ * @return the display id of the virtual display.
+ */
+ public int getVirtualDisplayId() {
+ if (usingActivityView()) {
+ return mActivityView.getVirtualDisplayId();
+ }
+ return INVALID_DISPLAY;
+ }
+
private void applyRowState(ExpandableNotificationRow view) {
view.reset();
view.setHeadsUp(false);
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index 411536c..505957a 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -438,7 +438,7 @@
@Override
public void onUiModeChanged() {
mContext.getTheme().applyStyle(mContext.getThemeResId(), true);
- if (mDialog.isShowing()) {
+ if (mDialog != null && mDialog.isShowing()) {
mDialog.refreshDialog();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
index b9cacd1..1927f22 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
@@ -15,6 +15,8 @@
*/
package com.android.systemui.statusbar.phone;
+import static android.view.Display.INVALID_DISPLAY;
+
import android.content.Context;
import android.content.pm.ParceledListSlice;
import android.content.res.Resources;
@@ -46,7 +48,9 @@
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
+import com.android.systemui.Dependency;
import com.android.systemui.R;
+import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver;
import com.android.systemui.shared.system.QuickStepContract;
@@ -363,6 +367,13 @@
0 /* metaState */, KeyCharacterMap.VIRTUAL_KEYBOARD, 0 /* scancode */,
KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY,
InputDevice.SOURCE_KEYBOARD);
+
+ // Bubble controller will give us a valid display id if it should get the back event
+ BubbleController bubbleController = Dependency.get(BubbleController.class);
+ int bubbleDisplayId = bubbleController.getExpandedDisplayId(mContext);
+ if (code == KeyEvent.KEYCODE_BACK && bubbleDisplayId != INVALID_DISPLAY) {
+ ev.setDisplayId(bubbleDisplayId);
+ }
InputManager.getInstance().injectInputEvent(ev, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
index 8d71ab8..984ab05 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
@@ -523,12 +523,19 @@
}
/**
- * The bubble is shown in expanded state for the status bar.
+ * Whether the bubble is shown in expanded state for the status bar.
*/
public boolean getBubbleExpanded() {
return mCurrentState.bubbleExpanded;
}
+ /**
+ * Whether the status bar panel is expanded or not.
+ */
+ public boolean getPanelExpanded() {
+ return mCurrentState.panelExpanded;
+ }
+
public void setStateListener(OtherwisedCollapsedListener listener) {
mListener = listener;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
index 06fc745..9923ec9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
@@ -48,10 +48,12 @@
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.ImageView;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.systemui.Dependency;
import com.android.systemui.R;
+import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.plugins.statusbar.phone.NavBarButtonProvider.ButtonInterface;
import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.shared.system.NavigationBarCompat;
@@ -73,6 +75,7 @@
private final KeyButtonRipple mRipple;
private final OverviewProxyService mOverviewProxyService;
private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class);
+ private final InputManager mInputManager;
private final Runnable mCheckLongPress = new Runnable() {
public void run() {
@@ -96,6 +99,11 @@
}
public KeyButtonView(Context context, AttributeSet attrs, int defStyle) {
+ this(context, attrs, defStyle, InputManager.getInstance());
+ }
+
+ @VisibleForTesting
+ public KeyButtonView(Context context, AttributeSet attrs, int defStyle, InputManager manager) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.KeyButtonView,
@@ -117,6 +125,7 @@
mRipple = new KeyButtonRipple(context, this);
mOverviewProxyService = Dependency.get(OverviewProxyService.class);
+ mInputManager = manager;
setBackground(mRipple);
forceHasOverlappingRendering(false);
}
@@ -318,16 +327,23 @@
0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
flags | KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY,
InputDevice.SOURCE_KEYBOARD);
- //Make KeyEvent work on multi-display environment
- if (getDisplay() != null) {
- final int displayId = getDisplay().getDisplayId();
- if (displayId != INVALID_DISPLAY) {
- ev.setDisplayId(displayId);
- }
+ int displayId = INVALID_DISPLAY;
+
+ // Make KeyEvent work on multi-display environment
+ if (getDisplay() != null) {
+ displayId = getDisplay().getDisplayId();
}
- InputManager.getInstance().injectInputEvent(ev,
- InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
+ // Bubble controller will give us a valid display id if it should get the back event
+ BubbleController bubbleController = Dependency.get(BubbleController.class);
+ int bubbleDisplayId = bubbleController.getExpandedDisplayId(mContext);
+ if (mCode == KeyEvent.KEYCODE_BACK && bubbleDisplayId != INVALID_DISPLAY) {
+ displayId = bubbleDisplayId;
+ }
+ if (displayId != INVALID_DISPLAY) {
+ ev.setDisplayId(displayId);
+ }
+ mInputManager.injectInputEvent(ev, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
}
@Override
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyButtonViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyButtonViewTest.java
index 39bdf20..d16dc16 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyButtonViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyButtonViewTest.java
@@ -18,8 +18,16 @@
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.FIELD_FLAGS;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.FIELD_NAV_ACTION;
-import static org.mockito.ArgumentMatchers.argThat;
+import static junit.framework.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.hardware.input.InputManager;
import android.metrics.LogMaker;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
@@ -31,12 +39,15 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.bubbles.BubbleController;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatcher;
-import org.mockito.Mockito;
+import org.mockito.Captor;
+import org.mockito.MockitoAnnotations;
import java.util.Objects;
@@ -47,12 +58,19 @@
private KeyButtonView mKeyButtonView;
private MetricsLogger mMetricsLogger;
+ private BubbleController mBubbleController;
+ private InputManager mInputManager = mock(InputManager.class);
+ @Captor
+ private ArgumentCaptor<KeyEvent> mInputEventCaptor;
@Before
public void setup() throws Exception {
+ MockitoAnnotations.initMocks(this);
mMetricsLogger = mDependency.injectMockDependency(MetricsLogger.class);
- TestableLooper.get(this).runWithLooper(() ->
- mKeyButtonView = new KeyButtonView(mContext, null));
+ mBubbleController = mDependency.injectMockDependency(BubbleController.class);
+ TestableLooper.get(this).runWithLooper(() -> {
+ mKeyButtonView = new KeyButtonView(mContext, null, 0, mInputManager);
+ });
}
@Test
@@ -63,7 +81,7 @@
mKeyButtonView.setCode(code);
mKeyButtonView.sendEvent(action, flags);
- Mockito.verify(mMetricsLogger).write(argThat(new ArgumentMatcher<LogMaker>() {
+ verify(mMetricsLogger).write(argThat(new ArgumentMatcher<LogMaker>() {
public String mReason;
@Override
@@ -91,4 +109,18 @@
}));
}
+ @Test
+ public void testBubbleEvents_bubbleExpanded() {
+ when(mBubbleController.getExpandedDisplayId(mContext)).thenReturn(3);
+
+ int action = KeyEvent.ACTION_DOWN;
+ int flags = 0;
+ int code = KeyEvent.KEYCODE_BACK;
+ mKeyButtonView.setCode(code);
+ mKeyButtonView.sendEvent(action, flags);
+
+ verify(mInputManager, times(1)).injectInputEvent(mInputEventCaptor.capture(),
+ anyInt());
+ assertEquals(3, mInputEventCaptor.getValue().getDisplayId());
+ }
}
\ No newline at end of file
diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
index b4a1f38..5a42e78 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
@@ -313,7 +313,7 @@
// Make sure service is bound, just in case the initial connection failed somehow
mRemoteService.ensureBoundLocked();
- final ContentCaptureServerSession newSession = new ContentCaptureServerSession(
+ final ContentCaptureServerSession newSession = new ContentCaptureServerSession(mLock,
activityToken, this, componentName, clientReceiver, taskId, displayId, sessionId,
uid, flags);
if (mMaster.verbose) {
diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureServerSession.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureServerSession.java
index 1ad66d8..d38dfd4 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureServerSession.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureServerSession.java
@@ -65,11 +65,14 @@
*/
private final int mUid;
- ContentCaptureServerSession(@NonNull IBinder activityToken,
+ private final Object mLock;
+
+ ContentCaptureServerSession(@NonNull Object lock, @NonNull IBinder activityToken,
@NonNull ContentCapturePerUserService service, @NonNull ComponentName appComponentName,
@NonNull IResultReceiver sessionStateReceiver, int taskId, int displayId, int sessionId,
int uid, int flags) {
Preconditions.checkArgument(sessionId != NO_SESSION_ID);
+ mLock = lock;
mActivityToken = activityToken;
mService = service;
mId = sessionId;
@@ -77,6 +80,11 @@
mContentCaptureContext = new ContentCaptureContext(/* clientContext= */ null,
appComponentName, taskId, displayId, flags);
mSessionStateReceiver = sessionStateReceiver;
+ try {
+ sessionStateReceiver.asBinder().linkToDeath(() -> onClientDeath(), 0);
+ } catch (Exception e) {
+ Slog.w(TAG, "could not register DeathRecipient for " + activityToken);
+ }
}
/**
@@ -182,6 +190,19 @@
/* binder= */ null);
}
+ /**
+ * Called when the session client binder object died - typically when its process was killed
+ * and the activity was not properly destroyed.
+ */
+ private void onClientDeath() {
+ if (mService.isVerbose()) {
+ Slog.v(TAG, "onClientDeath(" + mActivityToken + "): removing session " + mId);
+ }
+ synchronized (mLock) {
+ removeSelfLocked(/* notifyRemoteService= */ true);
+ }
+ }
+
@GuardedBy("mLock")
public void dumpLocked(@NonNull String prefix, @NonNull PrintWriter pw) {
pw.print(prefix); pw.print("id: "); pw.print(mId); pw.println();
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index af78b76..da91187 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -2300,6 +2300,7 @@
.setCallingPid(r.callerPid)
.setCallingUid(r.callerUid)
.setMethod("TelephonyRegistry push")
+ .setLogAsInfo(true) // we don't need to log an error every time we push
.setMinSdkVersionForFine(minSdk)
.build();
@@ -2317,6 +2318,7 @@
.setCallingPid(r.callerPid)
.setCallingUid(r.callerUid)
.setMethod("TelephonyRegistry push")
+ .setLogAsInfo(true) // we don't need to log an error every time we push
.setMinSdkVersionForCoarse(minSdk)
.build();
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index c826df0..1432f57 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -693,7 +693,7 @@
return visibility;
}
- boolean isPrivileged = isPermittedForPackage(packageName, uid, accounts.userId,
+ boolean isPrivileged = isPermittedForPackage(packageName, accounts.userId,
Manifest.permission.GET_ACCOUNTS_PRIVILEGED);
// Device/Profile owner gets visibility by default.
@@ -703,8 +703,8 @@
boolean preO = isPreOApplication(packageName);
if ((signatureCheckResult != SIGNATURE_CHECK_MISMATCH)
- || (preO && checkGetAccountsPermission(packageName, uid, accounts.userId))
- || (checkReadContactsPermission(packageName, uid, accounts.userId)
+ || (preO && checkGetAccountsPermission(packageName, accounts.userId))
+ || (checkReadContactsPermission(packageName, accounts.userId)
&& accountTypeManagesContacts(account.type, accounts.userId))
|| isPrivileged) {
// Use legacy for preO apps with GET_ACCOUNTS permission or pre/postO with signature
@@ -3317,8 +3317,8 @@
options.putInt(AccountManager.KEY_CALLER_PID, pid);
// Check to see if the Password should be included to the caller.
- String callerPkg = optionsIn.getString(AccountManager.KEY_ANDROID_PACKAGE_NAME);
- boolean isPasswordForwardingAllowed = isPermitted(
+ String callerPkg = options.getString(AccountManager.KEY_ANDROID_PACKAGE_NAME);
+ boolean isPasswordForwardingAllowed = checkPermissionAndNote(
callerPkg, uid, Manifest.permission.GET_PASSWORD);
long identityToken = clearCallingIdentity();
@@ -3743,7 +3743,7 @@
// Check to see if the Password should be included to the caller.
String callerPkg = loginOptions.getString(AccountManager.KEY_ANDROID_PACKAGE_NAME);
- boolean isPasswordForwardingAllowed = isPermitted(
+ boolean isPasswordForwardingAllowed = checkPermissionAndNote(
callerPkg, uid, Manifest.permission.GET_PASSWORD);
long identityToken = clearCallingIdentity();
@@ -5318,31 +5318,36 @@
}
}
- private boolean isPermittedForPackage(String packageName, int uid, int userId,
- String... permissions) {
+ private boolean isPermittedForPackage(String packageName, int userId, String... permissions) {
final long identity = Binder.clearCallingIdentity();
try {
+ final int uid = mPackageManager.getPackageUidAsUser(packageName, userId);
IPackageManager pm = ActivityThread.getPackageManager();
for (String perm : permissions) {
if (pm.checkPermission(perm, packageName, userId)
== PackageManager.PERMISSION_GRANTED) {
// Checks runtime permission revocation.
final int opCode = AppOpsManager.permissionToOpCode(perm);
- if (opCode == AppOpsManager.OP_NONE || mAppOpsManager.noteOpNoThrow(
+ if (opCode == AppOpsManager.OP_NONE || mAppOpsManager.checkOpNoThrow(
opCode, uid, packageName) == AppOpsManager.MODE_ALLOWED) {
return true;
}
}
}
- } catch (RemoteException e) {
- /* ignore - local call */
+ } catch (NameNotFoundException | RemoteException e) {
+ // Assume permission is not granted if an error accrued.
} finally {
Binder.restoreCallingIdentity(identity);
}
return false;
}
- private boolean isPermitted(String opPackageName, int callingUid, String... permissions) {
+ /**
+ * Checks that package has at least one of given permissions and makes note of app
+ * performing the action.
+ */
+ private boolean checkPermissionAndNote(String opPackageName, int callingUid,
+ String... permissions) {
for (String perm : permissions) {
if (mContext.checkCallingOrSelfPermission(perm) == PackageManager.PERMISSION_GRANTED) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
@@ -5447,13 +5452,13 @@
// Method checks visibility for applications targeing API level below {@link
// android.os.Build.VERSION_CODES#O},
// returns true if the the app has GET_ACCOUNTS or GET_ACCOUNTS_PRIVILEGED permission.
- private boolean checkGetAccountsPermission(String packageName, int uid, int userId) {
- return isPermittedForPackage(packageName, uid, userId, Manifest.permission.GET_ACCOUNTS,
+ private boolean checkGetAccountsPermission(String packageName, int userId) {
+ return isPermittedForPackage(packageName, userId, Manifest.permission.GET_ACCOUNTS,
Manifest.permission.GET_ACCOUNTS_PRIVILEGED);
}
- private boolean checkReadContactsPermission(String packageName, int uid, int userId) {
- return isPermittedForPackage(packageName, uid, userId, Manifest.permission.READ_CONTACTS);
+ private boolean checkReadContactsPermission(String packageName, int userId) {
+ return isPermittedForPackage(packageName, userId, Manifest.permission.READ_CONTACTS);
}
// Heuristic to check that account type may be associated with some contacts data and
@@ -5473,7 +5478,7 @@
for (RegisteredServicesCache.ServiceInfo<AuthenticatorDescription> serviceInfo
: serviceInfos) {
if (accountType.equals(serviceInfo.type.type)) {
- return isPermittedForPackage(serviceInfo.type.packageName, serviceInfo.uid, userId,
+ return isPermittedForPackage(serviceInfo.type.packageName, userId,
Manifest.permission.WRITE_CONTACTS);
}
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index aad45e6..881a4ae 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -1635,9 +1635,7 @@
}
} break;
case UPDATE_HTTP_PROXY_MSG: {
- synchronized (ActivityManagerService.this) {
- mProcessList.setAllHttpProxyLocked();
- }
+ mProcessList.setAllHttpProxy();
} break;
case PROC_START_TIMEOUT_MSG: {
ProcessRecord app = (ProcessRecord)msg.obj;
@@ -1826,7 +1824,7 @@
} break;
}
}
- };
+ }
static final int COLLECT_PSS_BG_MSG = 1;
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index 316368a..1bcc4c8 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -46,6 +46,7 @@
import static com.android.server.am.ActivityManagerService.TAG_UID_OBSERVERS;
import android.app.ActivityManager;
+import android.app.ActivityThread;
import android.app.AppGlobals;
import android.app.AppProtoEnums;
import android.app.IApplicationThread;
@@ -708,7 +709,10 @@
ApplicationInfo applicationInfo) {
final boolean shouldUseGameDriver =
GraphicsEnvironment.shouldUseGameDriver(context, coreSettings, applicationInfo);
- return !shouldUseGameDriver;
+ final boolean shouldUseAngle =
+ GraphicsEnvironment.shouldUseAngle(context, coreSettings,
+ applicationInfo.packageName);
+ return !shouldUseGameDriver && !shouldUseAngle;
}
public static String makeOomAdjString(int setAdj, boolean compact) {
@@ -2486,21 +2490,25 @@
}
}
- @GuardedBy("mService")
- void setAllHttpProxyLocked() {
- for (int i = mLruProcesses.size() - 1; i >= 0; i--) {
- ProcessRecord r = mLruProcesses.get(i);
- // Don't dispatch to isolated processes as they can't access
- // ConnectivityManager and don't have network privileges anyway.
- if (r.thread != null && !r.isolated) {
- try {
- r.thread.updateHttpProxy();
- } catch (RemoteException ex) {
- Slog.w(TAG, "Failed to update http proxy for: " +
- r.info.processName);
+ void setAllHttpProxy() {
+ // Update the HTTP proxy for each application thread.
+ synchronized (mService) {
+ for (int i = mLruProcesses.size() - 1 ; i >= 0 ; i--) {
+ ProcessRecord r = mLruProcesses.get(i);
+ // Don't dispatch to isolated processes as they can't access ConnectivityManager and
+ // don't have network privileges anyway. Exclude system server and update it
+ // separately outside the AMS lock, to avoid deadlock with Connectivity Service.
+ if (r.pid != ActivityManagerService.MY_PID && r.thread != null && !r.isolated) {
+ try {
+ r.thread.updateHttpProxy();
+ } catch (RemoteException ex) {
+ Slog.w(TAG, "Failed to update http proxy for: "
+ + r.info.processName);
+ }
}
}
}
+ ActivityThread.updateHttpProxy(mService.mContext);
}
@GuardedBy("mService")
diff --git a/telephony/java/android/telephony/LocationAccessPolicy.java b/telephony/java/android/telephony/LocationAccessPolicy.java
index b9d8eb6..eb744f6 100644
--- a/telephony/java/android/telephony/LocationAccessPolicy.java
+++ b/telephony/java/android/telephony/LocationAccessPolicy.java
@@ -63,15 +63,18 @@
public final int callingPid;
public final int minSdkVersionForCoarse;
public final int minSdkVersionForFine;
+ public final boolean logAsInfo;
public final String method;
private LocationPermissionQuery(String callingPackage, int callingUid, int callingPid,
- int minSdkVersionForCoarse, int minSdkVersionForFine, String method) {
+ int minSdkVersionForCoarse, int minSdkVersionForFine, boolean logAsInfo,
+ String method) {
this.callingPackage = callingPackage;
this.callingUid = callingUid;
this.callingPid = callingPid;
this.minSdkVersionForCoarse = minSdkVersionForCoarse;
this.minSdkVersionForFine = minSdkVersionForFine;
+ this.logAsInfo = logAsInfo;
this.method = method;
}
@@ -81,6 +84,7 @@
private int mCallingPid;
private int mMinSdkVersionForCoarse = Integer.MAX_VALUE;
private int mMinSdkVersionForFine = Integer.MAX_VALUE;
+ private boolean mLogAsInfo = false;
private String mMethod;
/**
@@ -135,14 +139,27 @@
return this;
}
+ /**
+ * If called with {@code true}, log messages will only be printed at the info level.
+ */
+ public Builder setLogAsInfo(boolean logAsInfo) {
+ mLogAsInfo = logAsInfo;
+ return this;
+ }
+
public LocationPermissionQuery build() {
return new LocationPermissionQuery(mCallingPackage, mCallingUid,
- mCallingPid, mMinSdkVersionForCoarse, mMinSdkVersionForFine, mMethod);
+ mCallingPid, mMinSdkVersionForCoarse, mMinSdkVersionForFine,
+ mLogAsInfo, mMethod);
}
}
}
- private static void logError(Context context, String errorMsg) {
+ private static void logError(Context context, LocationPermissionQuery query, String errorMsg) {
+ if (query.logAsInfo) {
+ Log.i(TAG, errorMsg);
+ return;
+ }
Log.e(TAG, errorMsg);
try {
if (Build.IS_DEBUGGABLE) {
@@ -201,13 +218,13 @@
+ " because we're not enforcing API " + minSdkVersion + " yet."
+ " Please fix this app because it will break in the future. Called from "
+ query.method;
- logError(context, errorMsg);
+ logError(context, query, errorMsg);
return null;
} else if (!isAppAtLeastSdkVersion(context, query.callingPackage, minSdkVersion)) {
String errorMsg = "Allowing " + query.callingPackage + " " + locationTypeForLog
+ " because it doesn't target API " + minSdkVersion + " yet."
+ " Please fix this app. Called from " + query.method;
- logError(context, errorMsg);
+ logError(context, query, errorMsg);
return null;
} else {
// If we're not allowing it due to the above two conditions, this means that the app
diff --git a/tools/aapt2/Android.bp b/tools/aapt2/Android.bp
index aca2be1..326c88d 100644
--- a/tools/aapt2/Android.bp
+++ b/tools/aapt2/Android.bp
@@ -57,6 +57,7 @@
"libbase",
"libprotobuf-cpp-lite",
"libz",
+ "libbuildversion",
],
stl: "libc++_static",
group_static_libs: true,
diff --git a/tools/aapt2/Main.cpp b/tools/aapt2/Main.cpp
index 39eb987..213bdd2 100644
--- a/tools/aapt2/Main.cpp
+++ b/tools/aapt2/Main.cpp
@@ -46,12 +46,6 @@
namespace aapt {
-// DO NOT UPDATE, this is more of a marketing version.
-static const char* sMajorVersion = "2";
-
-// Update minor version whenever a feature or flag is added.
-static const char* sMinorVersion = "19";
-
/** Prints the version information of AAPT2. */
class VersionCommand : public Command {
public:
@@ -60,8 +54,7 @@
}
int Action(const std::vector<std::string>& /* args */) override {
- std::cerr << StringPrintf("Android Asset Packaging Tool (aapt) %s:%s", sMajorVersion,
- sMinorVersion)
+ std::cerr << StringPrintf("%s %s", util::GetToolName(), util::GetToolFingerprint().c_str())
<< std::endl;
return 0;
}
diff --git a/tools/aapt2/Resources.proto b/tools/aapt2/Resources.proto
index 12cf65b..b2fc084 100644
--- a/tools/aapt2/Resources.proto
+++ b/tools/aapt2/Resources.proto
@@ -41,6 +41,12 @@
SourcePosition position = 2;
}
+// The name and version fingerprint of a build tool.
+message ToolFingerprint {
+ string tool = 1;
+ string version = 2;
+}
+
// Top level message representing a resource table.
message ResourceTable {
// The string pool containing source paths referenced throughout the resource table. This does
@@ -52,6 +58,9 @@
// The <overlayable> declarations within the resource table.
repeated Overlayable overlayable = 3;
+
+ // The version fingerprints of the tools that built the resource table.
+ repeated ToolFingerprint tool_fingerprint = 4;
}
// A package ID in the range [0x00, 0xff].
diff --git a/tools/aapt2/format/proto/ProtoSerialize.cpp b/tools/aapt2/format/proto/ProtoSerialize.cpp
index 58e1e6e..a54822b 100644
--- a/tools/aapt2/format/proto/ProtoSerialize.cpp
+++ b/tools/aapt2/format/proto/ProtoSerialize.cpp
@@ -327,6 +327,9 @@
void SerializeTableToPb(const ResourceTable& table, pb::ResourceTable* out_table,
IDiagnostics* diag) {
StringPool source_pool;
+ pb::ToolFingerprint* pb_fingerprint = out_table->add_tool_fingerprint();
+ pb_fingerprint->set_tool(util::GetToolName());
+ pb_fingerprint->set_version(util::GetToolFingerprint());
std::vector<Overlayable*> overlayables;
for (const std::unique_ptr<ResourceTablePackage>& package : table.packages) {
diff --git a/tools/aapt2/util/Util.cpp b/tools/aapt2/util/Util.cpp
index 59b7fff..37ce65e 100644
--- a/tools/aapt2/util/Util.cpp
+++ b/tools/aapt2/util/Util.cpp
@@ -21,13 +21,15 @@
#include <string>
#include <vector>
+#include "android-base/stringprintf.h"
#include "androidfw/StringPiece.h"
-#include "utils/Unicode.h"
+#include "build/version.h"
#include "text/Unicode.h"
#include "text/Utf8Iterator.h"
#include "util/BigBuffer.h"
#include "util/Maybe.h"
+#include "utils/Unicode.h"
using ::aapt::text::Utf8Iterator;
using ::android::StringPiece;
@@ -200,6 +202,24 @@
return result;
}
+const char* GetToolName() {
+ static const char* const sToolName = "Android Asset Packaging Tool (aapt)";
+ return sToolName;
+}
+
+std::string GetToolFingerprint() {
+ // DO NOT UPDATE, this is more of a marketing version.
+ static const char* const sMajorVersion = "2";
+
+ // Update minor version whenever a feature or flag is added.
+ static const char* const sMinorVersion = "19";
+
+ // The build id of aapt2 binary.
+ static const std::string sBuildId = android::build::GetBuildNumber();
+
+ return android::base::StringPrintf("%s.%s-%s", sMajorVersion, sMinorVersion, sBuildId.c_str());
+}
+
static size_t ConsumeDigits(const char* start, const char* end) {
const char* c = start;
for (; c != end && *c >= '0' && *c <= '9'; c++) {
diff --git a/tools/aapt2/util/Util.h b/tools/aapt2/util/Util.h
index c6e8e6e..a956957 100644
--- a/tools/aapt2/util/Util.h
+++ b/tools/aapt2/util/Util.h
@@ -98,6 +98,12 @@
Maybe<std::string> GetFullyQualifiedClassName(const android::StringPiece& package,
const android::StringPiece& class_name);
+// Retrieves the formatted name of aapt2.
+const char* GetToolName();
+
+// Retrieves the build fingerprint of aapt2.
+std::string GetToolFingerprint();
+
template <typename T>
typename std::enable_if<std::is_arithmetic<T>::value, int>::type compare(const T& a, const T& b) {
if (a < b) {