Merge "Replace deprecated Truth isSameAs with isSameInstanceAs" into androidx-master-dev
am: 334d34ed92
Change-Id: Ic16e97fb20c61fc14dd8f3dee1f2e13e41bc794c
diff --git a/LICENSE.txt b/LICENSE.txt
index f433b1a..e454a52 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -175,3 +175,4 @@
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
+
diff --git a/appcompat/resources/api/1.1.0-alpha05.txt b/appcompat/resources/api/1.1.0-alpha05.txt
index 990b059..7f67297 100644
--- a/appcompat/resources/api/1.1.0-alpha05.txt
+++ b/appcompat/resources/api/1.1.0-alpha05.txt
@@ -28,6 +28,7 @@
method public void setDither(boolean);
method public void setEnterFadeDuration(int);
method public void setExitFadeDuration(int);
+ method public void setTintMode(android.graphics.PorterDuff.Mode);
method public void unscheduleDrawable(android.graphics.drawable.Drawable, Runnable);
}
diff --git a/appcompat/resources/api/1.1.0-beta00.txt b/appcompat/resources/api/1.1.0-beta00.txt
new file mode 100644
index 0000000..7f67297
--- /dev/null
+++ b/appcompat/resources/api/1.1.0-beta00.txt
@@ -0,0 +1,36 @@
+// Signature format: 3.0
+package androidx.appcompat.content.res {
+
+ public final class AppCompatResources {
+ method public static android.content.res.ColorStateList! getColorStateList(android.content.Context, @ColorRes int);
+ method public static android.graphics.drawable.Drawable? getDrawable(android.content.Context, @DrawableRes int);
+ }
+
+}
+
+package androidx.appcompat.graphics.drawable {
+
+ public class AnimatedStateListDrawableCompat extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback androidx.core.graphics.drawable.TintAwareDrawable {
+ ctor public AnimatedStateListDrawableCompat();
+ method public void addState(int[], android.graphics.drawable.Drawable, int);
+ method public void addState(int[]!, android.graphics.drawable.Drawable!);
+ method public <T extends android.graphics.drawable.Drawable & android.graphics.drawable.Animatable> void addTransition(int, int, T, boolean);
+ method public static androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat? create(android.content.Context, @DrawableRes int, android.content.res.Resources.Theme?);
+ method public static androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat! createFromXmlInner(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme?) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method public void draw(android.graphics.Canvas);
+ method public final android.graphics.drawable.Drawable.ConstantState! getConstantState();
+ method public int getOpacity();
+ method public void inflate(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme?) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method public void invalidateDrawable(android.graphics.drawable.Drawable);
+ method public void scheduleDrawable(android.graphics.drawable.Drawable, Runnable, long);
+ method public void setAlpha(int);
+ method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setDither(boolean);
+ method public void setEnterFadeDuration(int);
+ method public void setExitFadeDuration(int);
+ method public void setTintMode(android.graphics.PorterDuff.Mode);
+ method public void unscheduleDrawable(android.graphics.drawable.Drawable, Runnable);
+ }
+
+}
+
diff --git a/appcompat/resources/src/main/java/androidx/appcompat/widget/DrawableUtils.java b/appcompat/resources/src/main/java/androidx/appcompat/widget/DrawableUtils.java
index 1e788d5..8c5a0a6 100644
--- a/appcompat/resources/src/main/java/androidx/appcompat/widget/DrawableUtils.java
+++ b/appcompat/resources/src/main/java/androidx/appcompat/widget/DrawableUtils.java
@@ -70,6 +70,15 @@
* use reflection. Since the {@code Insets} class is hidden also, we return a Rect instead.
*/
public static Rect getOpticalBounds(Drawable drawable) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ final android.graphics.Insets insets = drawable.getOpticalInsets();
+ final Rect result = new Rect();
+ result.left = insets.left;
+ result.right = insets.right;
+ result.top = insets.top;
+ result.bottom = insets.bottom;
+ return result;
+ }
if (sInsetsClazz != null) {
try {
// If the Drawable is wrapped, we need to manually unwrap it and process
diff --git a/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatTextViewTest.java b/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatTextViewTest.java
index 9b4e2ad..c127558 100644
--- a/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatTextViewTest.java
+++ b/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatTextViewTest.java
@@ -41,6 +41,7 @@
import android.os.Build;
import android.os.LocaleList;
import android.text.Layout;
+import android.text.PrecomputedText;
import android.view.View;
import android.view.ViewGroup;
import android.view.textclassifier.TextClassificationManager;
@@ -576,6 +577,9 @@
// setText may wrap the given text with SpannedString. Check the contents by casting
// to String.
assertEquals(SAMPLE_TEXT_1, tv.getText().toString());
+ if (Build.VERSION.SDK_INT >= 29) {
+ assertTrue(tv.getText() instanceof PrecomputedText);
+ }
}
});
}
@@ -593,6 +597,9 @@
tv.measure(UNLIMITED_MEASURE_SPEC, UNLIMITED_MEASURE_SPEC);
assertNotEquals(0.0f, tv.getMeasuredWidth());
assertEquals(SAMPLE_TEXT_1, tv.getText().toString());
+ if (Build.VERSION.SDK_INT >= 29) {
+ assertTrue(tv.getText() instanceof PrecomputedText);
+ }
}
});
executor.doExecution(0);
@@ -622,6 +629,9 @@
// setText may wrap the given text with SpannedString. Check the contents by casting
// to String.
assertEquals(SAMPLE_TEXT_2, tv.getText().toString());
+ if (Build.VERSION.SDK_INT >= 29) {
+ assertTrue(tv.getText() instanceof PrecomputedText);
+ }
}
});
executor.doExecution(0); // Do execution of 1st runnable.
@@ -634,6 +644,9 @@
// setText may wrap the given text with SpannedString. Check the contents by casting
// to String.
assertEquals(SAMPLE_TEXT_2, tv.getText().toString());
+ if (Build.VERSION.SDK_INT >= 29) {
+ assertTrue(tv.getText() instanceof PrecomputedText);
+ }
}
});
}
diff --git a/appcompat/src/main/java/androidx/appcompat/widget/ActivityChooserView.java b/appcompat/src/main/java/androidx/appcompat/widget/ActivityChooserView.java
index a350c0d..8f9962792 100644
--- a/appcompat/src/main/java/androidx/appcompat/widget/ActivityChooserView.java
+++ b/appcompat/src/main/java/androidx/appcompat/widget/ActivityChooserView.java
@@ -28,6 +28,7 @@
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@@ -222,6 +223,10 @@
TypedArray attributesArray = context.obtainStyledAttributes(attrs,
R.styleable.ActivityChooserView, defStyle, 0);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.ActivityChooserView, attrs, attributesArray, defStyle, 0);
+ }
mInitialActivityCount = attributesArray.getInt(
R.styleable.ActivityChooserView_initialActivityCount,
diff --git a/appcompat/src/main/java/androidx/appcompat/widget/AppCompatTextViewAutoSizeHelper.java b/appcompat/src/main/java/androidx/appcompat/widget/AppCompatTextViewAutoSizeHelper.java
index e2a8f9b..0f730ba 100644
--- a/appcompat/src/main/java/androidx/appcompat/widget/AppCompatTextViewAutoSizeHelper.java
+++ b/appcompat/src/main/java/androidx/appcompat/widget/AppCompatTextViewAutoSizeHelper.java
@@ -552,8 +552,9 @@
return;
}
- final boolean horizontallyScrolling = invokeAndReturnWithDefault(
- mTextView, "getHorizontallyScrolling", false);
+ final boolean horizontallyScrolling = Build.VERSION.SDK_INT >= 29
+ ? mTextView.isHorizontallyScrollable()
+ : invokeAndReturnWithDefault(mTextView, "getHorizontallyScrolling", false);
final int availableWidth = horizontallyScrolling
? VERY_WIDE
: mTextView.getMeasuredWidth() - mTextView.getTotalPaddingLeft()
@@ -735,9 +736,10 @@
try {
// Can use the StaticLayout.Builder (along with TextView params added in or after
// API 23) to construct the layout.
- final TextDirectionHeuristic textDirectionHeuristic = invokeAndReturnWithDefault(
- mTextView, "getTextDirectionHeuristic",
- TextDirectionHeuristics.FIRSTSTRONG_LTR);
+ final TextDirectionHeuristic textDirectionHeuristic = Build.VERSION.SDK_INT >= 29
+ ? mTextView.getTextDirectionHeuristic()
+ : invokeAndReturnWithDefault(mTextView, "getTextDirectionHeuristic",
+ TextDirectionHeuristics.FIRSTSTRONG_LTR);
layoutBuilder.setTextDirection(textDirectionHeuristic);
} catch (ClassCastException e) {
// On some devices this exception happens, details: b/127137059.
diff --git a/appcompat/src/main/java/androidx/appcompat/widget/ButtonBarLayout.java b/appcompat/src/main/java/androidx/appcompat/widget/ButtonBarLayout.java
index 40e7748..22b3993 100644
--- a/appcompat/src/main/java/androidx/appcompat/widget/ButtonBarLayout.java
+++ b/appcompat/src/main/java/androidx/appcompat/widget/ButtonBarLayout.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.content.res.TypedArray;
+import android.os.Build;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
@@ -49,6 +50,9 @@
public ButtonBarLayout(Context context, AttributeSet attrs) {
super(context, attrs);
final TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.ButtonBarLayout);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(context, R.styleable.ButtonBarLayout, attrs, ta, 0, 0);
+ }
mAllowStacking = ta.getBoolean(R.styleable.ButtonBarLayout_allowStacking, true);
ta.recycle();
}
diff --git a/appcompat/src/main/java/androidx/appcompat/widget/ListPopupWindow.java b/appcompat/src/main/java/androidx/appcompat/widget/ListPopupWindow.java
index 056213e..fe4ccd8 100644
--- a/appcompat/src/main/java/androidx/appcompat/widget/ListPopupWindow.java
+++ b/appcompat/src/main/java/androidx/appcompat/widget/ListPopupWindow.java
@@ -23,6 +23,7 @@
import android.database.DataSetObserver;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.os.Handler;
import android.util.AttributeSet;
import android.util.Log;
@@ -75,29 +76,35 @@
*/
static final int EXPAND_LIST_TIMEOUT = 250;
- private static Method sClipToWindowEnabledMethod;
+ private static Method sSetClipToWindowEnabledMethod;
private static Method sGetMaxAvailableHeightMethod;
private static Method sSetEpicenterBoundsMethod;
static {
- try {
- sClipToWindowEnabledMethod = PopupWindow.class.getDeclaredMethod(
- "setClipToScreenEnabled", boolean.class);
- } catch (NoSuchMethodException e) {
- Log.i(TAG, "Could not find method setClipToScreenEnabled() on PopupWindow. Oh well.");
+ if (Build.VERSION.SDK_INT <= 28) {
+ try {
+ sSetClipToWindowEnabledMethod = PopupWindow.class.getDeclaredMethod(
+ "setClipToScreenEnabled", boolean.class);
+ } catch (NoSuchMethodException e) {
+ Log.i(TAG,
+ "Could not find method setClipToScreenEnabled() on PopupWindow. Oh well.");
+ }
+ try {
+ sSetEpicenterBoundsMethod = PopupWindow.class.getDeclaredMethod(
+ "setEpicenterBounds", Rect.class);
+ } catch (NoSuchMethodException e) {
+ Log.i(TAG,
+ "Could not find method setEpicenterBounds(Rect) on PopupWindow. Oh well.");
+ }
}
- try {
- sGetMaxAvailableHeightMethod = PopupWindow.class.getDeclaredMethod(
- "getMaxAvailableHeight", View.class, int.class, boolean.class);
- } catch (NoSuchMethodException e) {
- Log.i(TAG, "Could not find method getMaxAvailableHeight(View, int, boolean)"
- + " on PopupWindow. Oh well.");
- }
- try {
- sSetEpicenterBoundsMethod = PopupWindow.class.getDeclaredMethod(
- "setEpicenterBounds", Rect.class);
- } catch (NoSuchMethodException e) {
- Log.i(TAG, "Could not find method setEpicenterBounds(Rect) on PopupWindow. Oh well.");
+ if (Build.VERSION.SDK_INT <= 23) {
+ try {
+ sGetMaxAvailableHeightMethod = PopupWindow.class.getDeclaredMethod(
+ "getMaxAvailableHeight", View.class, int.class, boolean.class);
+ } catch (NoSuchMethodException e) {
+ Log.i(TAG, "Could not find method getMaxAvailableHeight(View, int, boolean)"
+ + " on PopupWindow. Oh well.");
+ }
}
}
@@ -734,12 +741,16 @@
if (mOverlapAnchorSet) {
PopupWindowCompat.setOverlapAnchor(mPopup, mOverlapAnchor);
}
- if (sSetEpicenterBoundsMethod != null) {
- try {
- sSetEpicenterBoundsMethod.invoke(mPopup, mEpicenterBounds);
- } catch (Exception e) {
- Log.e(TAG, "Could not invoke setEpicenterBounds on PopupWindow", e);
+ if (Build.VERSION.SDK_INT <= 28) {
+ if (sSetEpicenterBoundsMethod != null) {
+ try {
+ sSetEpicenterBoundsMethod.invoke(mPopup, mEpicenterBounds);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not invoke setEpicenterBounds on PopupWindow", e);
+ }
}
+ } else {
+ mPopup.setEpicenterBounds(mEpicenterBounds);
}
PopupWindowCompat.showAsDropDown(mPopup, getAnchorView(), mDropDownHorizontalOffset,
mDropDownVerticalOffset, mDropDownGravity);
@@ -1418,25 +1429,33 @@
}
private void setPopupClipToScreenEnabled(boolean clip) {
- if (sClipToWindowEnabledMethod != null) {
- try {
- sClipToWindowEnabledMethod.invoke(mPopup, clip);
- } catch (Exception e) {
- Log.i(TAG, "Could not call setClipToScreenEnabled() on PopupWindow. Oh well.");
+ if (Build.VERSION.SDK_INT <= 28) {
+ if (sSetClipToWindowEnabledMethod != null) {
+ try {
+ sSetClipToWindowEnabledMethod.invoke(mPopup, clip);
+ } catch (Exception e) {
+ Log.i(TAG, "Could not call setClipToScreenEnabled() on PopupWindow. Oh well.");
+ }
}
+ } else {
+ mPopup.setIsClippedToScreen(clip);
}
}
private int getMaxAvailableHeight(View anchor, int yOffset, boolean ignoreBottomDecorations) {
- if (sGetMaxAvailableHeightMethod != null) {
- try {
- return (int) sGetMaxAvailableHeightMethod.invoke(mPopup, anchor, yOffset,
- ignoreBottomDecorations);
- } catch (Exception e) {
- Log.i(TAG, "Could not call getMaxAvailableHeightMethod(View, int, boolean)"
- + " on PopupWindow. Using the public version.");
+ if (Build.VERSION.SDK_INT <= 23) {
+ if (sGetMaxAvailableHeightMethod != null) {
+ try {
+ return (int) sGetMaxAvailableHeightMethod.invoke(mPopup, anchor, yOffset,
+ ignoreBottomDecorations);
+ } catch (Exception e) {
+ Log.i(TAG, "Could not call getMaxAvailableHeightMethod(View, int, boolean)"
+ + " on PopupWindow. Using the public version.");
+ }
}
+ return mPopup.getMaxAvailableHeight(anchor, yOffset);
+ } else {
+ return mPopup.getMaxAvailableHeight(anchor, yOffset, ignoreBottomDecorations);
}
- return mPopup.getMaxAvailableHeight(anchor, yOffset);
}
}
diff --git a/appcompat/src/main/java/androidx/appcompat/widget/MenuPopupWindow.java b/appcompat/src/main/java/androidx/appcompat/widget/MenuPopupWindow.java
index aa8295a..8a80b87 100644
--- a/appcompat/src/main/java/androidx/appcompat/widget/MenuPopupWindow.java
+++ b/appcompat/src/main/java/androidx/appcompat/widget/MenuPopupWindow.java
@@ -57,8 +57,10 @@
static {
try {
- sSetTouchModalMethod = PopupWindow.class.getDeclaredMethod(
- "setTouchModal", boolean.class);
+ if (Build.VERSION.SDK_INT <= 28) {
+ sSetTouchModalMethod = PopupWindow.class.getDeclaredMethod(
+ "setTouchModal", boolean.class);
+ }
} catch (NoSuchMethodException e) {
Log.i(TAG, "Could not find method setTouchModal() on PopupWindow. Oh well.");
}
@@ -98,12 +100,16 @@
* other windows behind it.
*/
public void setTouchModal(final boolean touchModal) {
- if (sSetTouchModalMethod != null) {
- try {
- sSetTouchModalMethod.invoke(mPopup, touchModal);
- } catch (Exception e) {
- Log.i(TAG, "Could not invoke setTouchModal() on PopupWindow. Oh well.");
+ if (Build.VERSION.SDK_INT <= 28) {
+ if (sSetTouchModalMethod != null) {
+ try {
+ sSetTouchModalMethod.invoke(mPopup, touchModal);
+ } catch (Exception e) {
+ Log.i(TAG, "Could not invoke setTouchModal() on PopupWindow. Oh well.");
+ }
}
+ } else {
+ mPopup.setTouchModal(touchModal);
}
}
diff --git a/appcompat/src/main/java/androidx/appcompat/widget/SearchView.java b/appcompat/src/main/java/androidx/appcompat/widget/SearchView.java
index 98d9795..4d0ae54 100644
--- a/appcompat/src/main/java/androidx/appcompat/widget/SearchView.java
+++ b/appcompat/src/main/java/androidx/appcompat/widget/SearchView.java
@@ -34,6 +34,7 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
+import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -1693,8 +1694,12 @@
}
void forceSuggestionQuery() {
- HIDDEN_METHOD_INVOKER.doBeforeTextChanged(mSearchSrcTextView);
- HIDDEN_METHOD_INVOKER.doAfterTextChanged(mSearchSrcTextView);
+ if (Build.VERSION.SDK_INT >= 29) {
+ mSearchSrcTextView.refreshAutoCompleteResults();
+ } else {
+ HIDDEN_METHOD_INVOKER.doBeforeTextChanged(mSearchSrcTextView);
+ HIDDEN_METHOD_INVOKER.doAfterTextChanged(mSearchSrcTextView);
+ }
}
static boolean isLandscapeMode(Context context) {
@@ -2020,7 +2025,6 @@
private static class AutoCompleteTextViewReflector {
private Method doBeforeTextChanged, doAfterTextChanged;
private Method ensureImeVisible;
- private Method showSoftInputUnchecked;
AutoCompleteTextViewReflector() {
try {
diff --git a/biometric/api/1.0.0-alpha04.txt b/biometric/api/1.0.0-alpha04.txt
index f517f0f..51a912e 100644
--- a/biometric/api/1.0.0-alpha04.txt
+++ b/biometric/api/1.0.0-alpha04.txt
@@ -13,6 +13,7 @@
field public static final int ERROR_LOCKOUT_PERMANENT = 9; // 0x9
field public static final int ERROR_NEGATIVE_BUTTON = 13; // 0xd
field public static final int ERROR_NO_BIOMETRICS = 11; // 0xb
+ field public static final int ERROR_NO_DEVICE_CREDENTIAL = 14; // 0xe
field public static final int ERROR_NO_SPACE = 4; // 0x4
field public static final int ERROR_TIMEOUT = 3; // 0x3
field public static final int ERROR_UNABLE_TO_PROCESS = 2; // 0x2
@@ -45,12 +46,16 @@
method public CharSequence getNegativeButtonText();
method public CharSequence? getSubtitle();
method public CharSequence getTitle();
+ method public boolean isConfirmationRequired();
+ method public boolean isDeviceCredentialAllowed();
}
public static class BiometricPrompt.PromptInfo.Builder {
ctor public BiometricPrompt.PromptInfo.Builder();
method public androidx.biometric.BiometricPrompt.PromptInfo build();
+ method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setConfirmationRequired(boolean);
method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setDescription(CharSequence?);
+ method @RequiresApi(29) public androidx.biometric.BiometricPrompt.PromptInfo.Builder setDeviceCredentialAllowed(boolean);
method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setNegativeButtonText(CharSequence);
method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setSubtitle(CharSequence?);
method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setTitle(CharSequence);
diff --git a/biometric/api/1.0.0-alpha05.txt b/biometric/api/1.0.0-alpha05.txt
index f517f0f..51a912e 100644
--- a/biometric/api/1.0.0-alpha05.txt
+++ b/biometric/api/1.0.0-alpha05.txt
@@ -13,6 +13,7 @@
field public static final int ERROR_LOCKOUT_PERMANENT = 9; // 0x9
field public static final int ERROR_NEGATIVE_BUTTON = 13; // 0xd
field public static final int ERROR_NO_BIOMETRICS = 11; // 0xb
+ field public static final int ERROR_NO_DEVICE_CREDENTIAL = 14; // 0xe
field public static final int ERROR_NO_SPACE = 4; // 0x4
field public static final int ERROR_TIMEOUT = 3; // 0x3
field public static final int ERROR_UNABLE_TO_PROCESS = 2; // 0x2
@@ -45,12 +46,16 @@
method public CharSequence getNegativeButtonText();
method public CharSequence? getSubtitle();
method public CharSequence getTitle();
+ method public boolean isConfirmationRequired();
+ method public boolean isDeviceCredentialAllowed();
}
public static class BiometricPrompt.PromptInfo.Builder {
ctor public BiometricPrompt.PromptInfo.Builder();
method public androidx.biometric.BiometricPrompt.PromptInfo build();
+ method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setConfirmationRequired(boolean);
method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setDescription(CharSequence?);
+ method @RequiresApi(29) public androidx.biometric.BiometricPrompt.PromptInfo.Builder setDeviceCredentialAllowed(boolean);
method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setNegativeButtonText(CharSequence);
method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setSubtitle(CharSequence?);
method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setTitle(CharSequence);
diff --git a/biometric/api/current.txt b/biometric/api/current.txt
index f517f0f..51a912e 100644
--- a/biometric/api/current.txt
+++ b/biometric/api/current.txt
@@ -13,6 +13,7 @@
field public static final int ERROR_LOCKOUT_PERMANENT = 9; // 0x9
field public static final int ERROR_NEGATIVE_BUTTON = 13; // 0xd
field public static final int ERROR_NO_BIOMETRICS = 11; // 0xb
+ field public static final int ERROR_NO_DEVICE_CREDENTIAL = 14; // 0xe
field public static final int ERROR_NO_SPACE = 4; // 0x4
field public static final int ERROR_TIMEOUT = 3; // 0x3
field public static final int ERROR_UNABLE_TO_PROCESS = 2; // 0x2
@@ -45,12 +46,16 @@
method public CharSequence getNegativeButtonText();
method public CharSequence? getSubtitle();
method public CharSequence getTitle();
+ method public boolean isConfirmationRequired();
+ method public boolean isDeviceCredentialAllowed();
}
public static class BiometricPrompt.PromptInfo.Builder {
ctor public BiometricPrompt.PromptInfo.Builder();
method public androidx.biometric.BiometricPrompt.PromptInfo build();
+ method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setConfirmationRequired(boolean);
method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setDescription(CharSequence?);
+ method @RequiresApi(29) public androidx.biometric.BiometricPrompt.PromptInfo.Builder setDeviceCredentialAllowed(boolean);
method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setNegativeButtonText(CharSequence);
method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setSubtitle(CharSequence?);
method public androidx.biometric.BiometricPrompt.PromptInfo.Builder setTitle(CharSequence);
diff --git a/biometric/src/main/java/androidx/biometric/BiometricConstants.java b/biometric/src/main/java/androidx/biometric/BiometricConstants.java
index f4384b0..7824178 100644
--- a/biometric/src/main/java/androidx/biometric/BiometricConstants.java
+++ b/biometric/src/main/java/androidx/biometric/BiometricConstants.java
@@ -107,6 +107,11 @@
int ERROR_NEGATIVE_BUTTON = 13;
/**
+ * The device does not have pin, pattern, or password set up.
+ */
+ int ERROR_NO_DEVICE_CREDENTIAL = 14;
+
+ /**
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
diff --git a/biometric/src/main/java/androidx/biometric/BiometricFragment.java b/biometric/src/main/java/androidx/biometric/BiometricFragment.java
index 5622c89..36d702b 100644
--- a/biometric/src/main/java/androidx/biometric/BiometricFragment.java
+++ b/biometric/src/main/java/androidx/biometric/BiometricFragment.java
@@ -18,10 +18,13 @@
import android.annotation.SuppressLint;
import android.content.DialogInterface;
+import android.os.Build;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.Handler;
import android.os.Looper;
+import android.text.TextUtils;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -62,6 +65,7 @@
private boolean mShowing;
private android.hardware.biometrics.BiometricPrompt mBiometricPrompt;
private CancellationSignal mCancellationSignal;
+ private boolean mStartRespectingCancel;
// Do not rely on the application's executor when calling into the framework's code.
private final Handler mHandler = new Handler(Looper.getMainLooper());
private final Executor mExecutor = new Executor() {
@@ -170,6 +174,13 @@
* Cancel the authentication.
*/
protected void cancel() {
+ // TODO(b/128747871): Change to == Q
+ if (Build.VERSION.SDK_INT >= 29 && isDeviceCredentialAllowed()) {
+ if (!mStartRespectingCancel) {
+ Log.w(TAG, "Ignoring fast cancel signal");
+ return;
+ }
+ }
if (mCancellationSignal != null) {
mCancellationSignal.cancel();
}
@@ -201,19 +212,50 @@
mBundle = bundle;
}
+ public boolean isDeviceCredentialAllowed() {
+ return mBundle.getBoolean(BiometricPrompt.KEY_ALLOW_DEVICE_CREDENTIAL, false);
+ }
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Start the actual authentication when the fragment is attached.
if (!mShowing) {
mNegativeButtonText = mBundle.getCharSequence(BiometricPrompt.KEY_NEGATIVE_TEXT);
- mBiometricPrompt = new android.hardware.biometrics.BiometricPrompt.Builder(getContext())
- .setTitle(mBundle.getCharSequence(BiometricPrompt.KEY_TITLE))
+ final android.hardware.biometrics.BiometricPrompt.Builder builder =
+ new android.hardware.biometrics.BiometricPrompt.Builder(getContext());
+ builder.setTitle(mBundle.getCharSequence(BiometricPrompt.KEY_TITLE))
.setSubtitle(mBundle.getCharSequence(BiometricPrompt.KEY_SUBTITLE))
- .setDescription(mBundle.getCharSequence(BiometricPrompt.KEY_DESCRIPTION))
- .setNegativeButton(mBundle.getCharSequence(BiometricPrompt.KEY_NEGATIVE_TEXT),
- mClientExecutor, mNegativeButtonListener)
- .build();
+ .setDescription(mBundle.getCharSequence(BiometricPrompt.KEY_DESCRIPTION));
+ // The negative text could be empty if setDeviceCredentialAllowed is true.
+ if (!TextUtils.isEmpty(mBundle.getCharSequence(BiometricPrompt.KEY_NEGATIVE_TEXT))) {
+ builder.setNegativeButton(
+ mBundle.getCharSequence(BiometricPrompt.KEY_NEGATIVE_TEXT),
+ mClientExecutor, mNegativeButtonListener);
+ }
+
+ if (Build.VERSION.SDK_INT >= 29) {
+ builder.setConfirmationRequired(
+ mBundle.getBoolean((BiometricPrompt.KEY_REQUIRE_CONFIRMATION), true));
+ builder.setDeviceCredentialAllowed(
+ mBundle.getBoolean(BiometricPrompt.KEY_ALLOW_DEVICE_CREDENTIAL));
+ }
+
+ if (Build.VERSION.SDK_INT >= 29) { // TODO(b/128747871): Change to == Q
+ if (mBundle.getBoolean(BiometricPrompt.KEY_ALLOW_DEVICE_CREDENTIAL, false)) {
+ mStartRespectingCancel = false;
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ // Hack almost over 9000, ignore cancel signal in Q if it's within the
+ // first quarter second.
+ mStartRespectingCancel = true;
+ }
+ }, 250 /* ms */);
+ }
+ }
+
+ mBiometricPrompt = builder.build();
mCancellationSignal = new CancellationSignal();
if (mCryptoObject == null) {
mBiometricPrompt.authenticate(mCancellationSignal, mExecutor,
diff --git a/biometric/src/main/java/androidx/biometric/BiometricPrompt.java b/biometric/src/main/java/androidx/biometric/BiometricPrompt.java
index 37ad62e..9891305 100644
--- a/biometric/src/main/java/androidx/biometric/BiometricPrompt.java
+++ b/biometric/src/main/java/androidx/biometric/BiometricPrompt.java
@@ -28,6 +28,7 @@
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
@@ -64,6 +65,8 @@
static final String KEY_SUBTITLE = "subtitle";
static final String KEY_DESCRIPTION = "description";
static final String KEY_NEGATIVE_TEXT = "negative_text";
+ static final String KEY_REQUIRE_CONFIRMATION = "require_confirmation";
+ static final String KEY_ALLOW_DEVICE_CREDENTIAL = "allow_device_credential";
@Retention(SOURCE)
@IntDef({BiometricConstants.ERROR_HW_UNAVAILABLE,
@@ -77,7 +80,8 @@
BiometricConstants.ERROR_USER_CANCELED,
BiometricConstants.ERROR_NO_BIOMETRICS,
BiometricConstants.ERROR_HW_NOT_PRESENT,
- BiometricConstants.ERROR_NEGATIVE_BUTTON})
+ BiometricConstants.ERROR_NEGATIVE_BUTTON,
+ BiometricConstants.ERROR_NO_DEVICE_CREDENTIAL})
@interface BiometricError {}
/**
@@ -241,6 +245,52 @@
}
/**
+ * Optional: A hint to the system to require user confirmation after a biometric has
+ * been authenticated. For example, implicit modalities like Face and
+ * Iris authentication are passive, meaning they don't require an explicit user action
+ * to complete. When set to 'false', the user action (e.g. pressing a button)
+ * will not be required. BiometricPrompt will require confirmation by default.
+ *
+ * A typical use case for not requiring confirmation would be for low-risk transactions,
+ * such as re-authenticating a recently authenticated application. A typical use case
+ * for requiring confirmation would be for authorizing a purchase.
+ *
+ * Note that this is a hint to the system. The system may choose to ignore the flag. For
+ * example, if the user disables implicit authentication in Settings, or if it does not
+ * apply to a modality (e.g. Fingerprint). When ignored, the system will default to
+ * requiring confirmation.
+ *
+ * This method only applies to Q and above.
+ */
+ @NonNull
+ public Builder setConfirmationRequired(boolean requireConfirmation) {
+ mBundle.putBoolean(KEY_REQUIRE_CONFIRMATION, requireConfirmation);
+ return this;
+ }
+
+ /**
+ * The user will first be prompted to authenticate with biometrics, but also given the
+ * option to authenticate with their device PIN, pattern, or password. Developers should
+ * first check {@link android.app.KeyguardManager#isDeviceSecure()} before enabling
+ * this. If the device is not secure, {@link BiometricPrompt#ERROR_NO_DEVICE_CREDENTIAL}
+ * will be returned in
+ * {@link AuthenticationCallback#onAuthenticationError(int, CharSequence)}}
+ *
+ * Note that {@link Builder#setNegativeButtonText(CharSequence)} should not be set
+ * if this is set to true.
+ *
+ * @param enable When true, the prompt will fall back to ask for the user's device
+ * credentials (PIN, pattern, or password).
+ * @return
+ */
+ @RequiresApi(29)
+ @NonNull
+ public Builder setDeviceCredentialAllowed(boolean enable) {
+ mBundle.putBoolean(KEY_ALLOW_DEVICE_CREDENTIAL, enable);
+ return this;
+ }
+
+ /**
* Creates a {@link BiometricPrompt}.
* @return a {@link BiometricPrompt}
* @throws IllegalArgumentException if any of the required fields are not set.
@@ -249,12 +299,17 @@
public PromptInfo build() {
final CharSequence title = mBundle.getCharSequence(KEY_TITLE);
final CharSequence negative = mBundle.getCharSequence(KEY_NEGATIVE_TEXT);
+ boolean allowDeviceCredential = mBundle.getBoolean(KEY_ALLOW_DEVICE_CREDENTIAL);
if (TextUtils.isEmpty(title)) {
throw new IllegalArgumentException("Title must be set and non-empty");
- } else if (TextUtils.isEmpty(negative)) {
- throw new IllegalArgumentException("Negative button text must be set and "
- + "non-empty");
+ }
+ if (TextUtils.isEmpty(negative) && !allowDeviceCredential) {
+ throw new IllegalArgumentException("Negative text must be set and non-empty");
+ }
+ if (!TextUtils.isEmpty(negative) && allowDeviceCredential) {
+ throw new IllegalArgumentException("Can't have both negative button behavior"
+ + " and device credential enabled");
}
return new PromptInfo(mBundle);
}
@@ -301,6 +356,22 @@
public CharSequence getNegativeButtonText() {
return mBundle.getCharSequence(KEY_NEGATIVE_TEXT);
}
+
+ /**
+ * @return See {@link Builder#setConfirmationRequired(boolean)}.
+ */
+ @Nullable
+ public boolean isConfirmationRequired() {
+ return mBundle.getBoolean(KEY_REQUIRE_CONFIRMATION);
+ }
+
+ /**
+ * @return See {@link Builder#setDeviceCredentialAllowed(boolean)}.
+ */
+ @Nullable
+ public boolean isDeviceCredentialAllowed() {
+ return mBundle.getBoolean(KEY_ALLOW_DEVICE_CREDENTIAL);
+ }
}
// Passed in from the client.
@@ -315,6 +386,11 @@
// Created internally for devices P and above.
BiometricFragment mBiometricFragment;
+ // In Q, we must ignore the first onPause if setDeviceCredentialAllowed is true, since
+ // the Q implementation launches ConfirmDeviceCredentialActivity which is an activity and
+ // puts the client app onPause.
+ boolean mPausedOnce;
+
/**
* A shim to interface with the framework API and simplify the support library's API.
* The support library sends onAuthenticationError when the negative button is pressed.
@@ -358,11 +434,7 @@
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
void onPause() {
if (!mFragmentActivity.isChangingConfigurations()) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
- if (mBiometricFragment != null) {
- mBiometricFragment.cancel();
- }
- } else {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
// May be null if no authentication is occurring.
if (mFingerprintDialogFragment != null) {
mFingerprintDialogFragment.dismiss();
@@ -371,6 +443,26 @@
mFingerprintHelperFragment.cancel(
FingerprintHelperFragment.USER_CANCELED_FROM_NONE);
}
+ } else if (Build.VERSION.SDK_INT >= 29) { // TODO: Change to == Q
+ // TODO(b/123378871): Change == to >= if this bug is not resolved in R.
+ // Ignore the first onPause if setDeviceCredentialAllowed is true, since
+ // the Q implementation launches ConfirmDeviceCredentialActivity which is an
+ // activity and puts the client app onPause.
+ if (mBiometricFragment != null) {
+ if (mBiometricFragment.isDeviceCredentialAllowed()) {
+ if (!mPausedOnce) {
+ mPausedOnce = true;
+ } else {
+ mBiometricFragment.cancel();
+ }
+ } else {
+ mBiometricFragment.cancel();
+ }
+ }
+ } else {
+ if (mBiometricFragment != null) {
+ mBiometricFragment.cancel();
+ }
}
}
}
@@ -448,6 +540,8 @@
throw new IllegalArgumentException("PromptInfo can not be null");
} else if (crypto == null) {
throw new IllegalArgumentException("CryptoObject can not be null");
+ } else if (info.getBundle().getBoolean(KEY_ALLOW_DEVICE_CREDENTIAL)) {
+ throw new IllegalArgumentException("Device credential not supported with crypto");
}
authenticateInternal(info, crypto);
}
@@ -470,6 +564,7 @@
final FragmentManager fragmentManager = mFragmentActivity.getSupportFragmentManager();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ mPausedOnce = false;
BiometricFragment biometricFragment =
(BiometricFragment) fragmentManager.findFragmentByTag(
diff --git a/buildSrc/lint-checks/src/main/java/androidx/build/lint/ObsoleteBuildCompatUsageDetector.kt b/buildSrc/lint-checks/src/main/java/androidx/build/lint/ObsoleteBuildCompatUsageDetector.kt
index 9869d75..61c2ae2 100644
--- a/buildSrc/lint-checks/src/main/java/androidx/build/lint/ObsoleteBuildCompatUsageDetector.kt
+++ b/buildSrc/lint-checks/src/main/java/androidx/build/lint/ObsoleteBuildCompatUsageDetector.kt
@@ -32,7 +32,8 @@
"isAtLeastNMR1" to 25,
"isAtLeastO" to 26,
"isAtLeastOMR1" to 27,
- "isAtLeastP" to 28
+ "isAtLeastP" to 28,
+ "isAtLeastQ" to 29
)
override fun getApplicableMethodNames() = methodsToApiLevels.keys.toList()
diff --git a/buildSrc/lint-checks/src/test/java/androidx/build/lint/ObsoleteBuildCompatUsageDetectorTest.kt b/buildSrc/lint-checks/src/test/java/androidx/build/lint/ObsoleteBuildCompatUsageDetectorTest.kt
index 40f5b85..30bc8ee 100644
--- a/buildSrc/lint-checks/src/test/java/androidx/build/lint/ObsoleteBuildCompatUsageDetectorTest.kt
+++ b/buildSrc/lint-checks/src/test/java/androidx/build/lint/ObsoleteBuildCompatUsageDetectorTest.kt
@@ -213,8 +213,8 @@
+ if (Build.VERSION.SDK_INT >= 28) {
"""
check(input.trimIndent())
- .expect(expected.trimIndent())
- .expectFixDiffs(expectedDiff.trimIndent())
+ .expect(expected.trimIndent())
+ .expectFixDiffs(expectedDiff.trimIndent())
}
@Test fun isAtLeastQ() {
@@ -229,6 +229,20 @@
}
}
"""
- check(input.trimIndent()).expectClean()
+ val expected = """
+ src/foo/Example.java:5: Error: Using deprecated BuildCompat methods [ObsoleteBuildCompat]
+ if (BuildCompat.isAtLeastQ()) {
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ 1 errors, 0 warnings
+ """
+ val expectedDiff = """
+ Fix for src/foo/Example.java line 5: Use SDK_INT >= 29:
+ @@ -5 +5
+ - if (BuildCompat.isAtLeastQ()) {
+ + if (Build.VERSION.SDK_INT >= 29) {
+ """
+ check(input.trimIndent())
+ .expect(expected.trimIndent())
+ .expectFixDiffs(expectedDiff.trimIndent())
}
}
diff --git a/buildSrc/src/main/kotlin/androidx/build/DiffAndDocs.kt b/buildSrc/src/main/kotlin/androidx/build/DiffAndDocs.kt
index ea5a7ce..3541d7a 100644
--- a/buildSrc/src/main/kotlin/androidx/build/DiffAndDocs.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/DiffAndDocs.kt
@@ -73,6 +73,12 @@
val doclavaConfiguration = root.configurations.create("doclava")
doclavaConfiguration.dependencies.add(root.dependencies.create(DOCLAVA_DEPENDENCY))
+ // Pulls in the :fakeannotations project, which provides modified annotations required to
+ // generate SDK API stubs in Doclava from Metalava-generated platform SDK stubs.
+ val annotationConfiguration = root.configurations.create("annotation")
+ annotationConfiguration.dependencies.add(root.dependencies.project(
+ mapOf("path" to ":fakeannotations")))
+
// tools.jar required for com.sun.javadoc
// TODO this breaks the ability to use JDK 9+ for compilation.
doclavaConfiguration.dependencies.add(root.dependencies.create(root.files(
@@ -81,7 +87,8 @@
rules = additionalRules + TIP_OF_TREE
docsProject = root.findProject(":docs-fake")
anchorTask = root.tasks.register("anchorDocsTask")
- val generateSdkApiTask = createGenerateSdkApiTask(root, doclavaConfiguration)
+ val generateSdkApiTask = createGenerateSdkApiTask(root, doclavaConfiguration,
+ annotationConfiguration)
val now = LocalDateTime.now()
// The diff output assumes that each library is of the same version,
// but our libraries may each be of different versions
@@ -392,13 +399,21 @@
* <p>
* This is useful for federating docs against the platform SDK when no API XML file is available.
*/
-private fun createGenerateSdkApiTask(project: Project, doclavaConfig: Configuration): DoclavaTask =
+private fun createGenerateSdkApiTask(
+ project: Project,
+ doclavaConfig: Configuration,
+ annotationConfig: Configuration
+): DoclavaTask =
project.tasks.createWithConfig("generateSdkApi", DoclavaTask::class.java) {
dependsOn(doclavaConfig)
+ dependsOn(annotationConfig)
description = "Generates API files for the current SDK."
setDocletpath(doclavaConfig.resolve())
destinationDir = project.docsDir()
+ // Strip the androidx.annotation classes injected by Metalava. They are not accessible.
classpath = androidJarFile(project)
+ .filter { it.path.contains("androidx/annotation") }
+ .plus(project.files(annotationConfig.resolve()))
source(project.zipTree(androidSrcJarFile(project))
.matching(PatternSet().include("**/*.java")))
exclude("**/overview.html") // TODO https://issuetracker.google.com/issues/116699307
diff --git a/buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt b/buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt
index 797565f..6cf3964 100644
--- a/buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt
@@ -53,7 +53,7 @@
prebuilts(LibraryGroups.CORE, "core-ktx", "1.1.0-beta01")
prebuilts(LibraryGroups.CURSORADAPTER, "1.0.0")
prebuilts(LibraryGroups.CUSTOMVIEW, "1.0.0")
- prebuilts(LibraryGroups.DOCUMENTFILE, "1.0.0")
+ ignore(LibraryGroups.DOCUMENTFILE.group)
prebuilts(LibraryGroups.DRAWERLAYOUT, "1.0.0")
prebuilts(LibraryGroups.DYNAMICANIMATION, "dynamicanimation-ktx", "1.0.0-alpha02")
prebuilts(LibraryGroups.DYNAMICANIMATION, "1.1.0-alpha01")
diff --git a/buildSrc/src/main/kotlin/androidx/build/SupportConfig.kt b/buildSrc/src/main/kotlin/androidx/build/SupportConfig.kt
index 5a45ac0..3968c94 100644
--- a/buildSrc/src/main/kotlin/androidx/build/SupportConfig.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/SupportConfig.kt
@@ -27,20 +27,24 @@
/**
* The Android SDK version to use for compilation.
- *
+ * <p>
* Either an integer value or a pre-release platform code, prefixed with "android-" (ex.
* "android-28" or "android-Q") as you would see within the SDK's platforms directory.
*/
- const val COMPILE_SDK_VERSION = "android-28"
+ const val COMPILE_SDK_VERSION = "android-29"
/**
* The Android SDK version to use for targetSdkVersion meta-data.
- *
+ * <p>
* Either an integer value (ex. 28), a pre-release platform code (ex. "Q") as you would see
* within the SDK's platforms directory as android-<version>, or a released platform version
* code as you would see within Build.VERSIONS.VERSION_CODE (ex. "HONEYCOMB" or "P").
+ * <p>
+ * <strong>Note:</strong> This must be set to an integer value or released platform version in
+ * order for tests to run on devices running released versions of the Android OS. If this is
+ * set to a pre-release version, tests will only be able to run on pre-release devices.
*/
- const val TARGET_SDK_VERSION = "28"
+ const val TARGET_SDK_VERSION = 28
fun getKeystore(project: Project): File {
val supportRoot = (project.rootProject.property("ext") as ExtraPropertiesExtension)
diff --git a/camera/camera2/src/main/java/androidx/camera/camera2/impl/Camera.java b/camera/camera2/src/main/java/androidx/camera/camera2/impl/Camera.java
index 0ecf8f8..39ca4a0 100644
--- a/camera/camera2/src/main/java/androidx/camera/camera2/impl/Camera.java
+++ b/camera/camera2/src/main/java/androidx/camera/camera2/impl/Camera.java
@@ -46,7 +46,6 @@
import androidx.camera.core.SessionConfig.ValidatingBuilder;
import androidx.camera.core.UseCase;
import androidx.camera.core.UseCaseAttachState;
-import androidx.core.os.BuildCompat;
import java.util.ArrayList;
import java.util.Collection;
@@ -520,7 +519,7 @@
Log.w(TAG, "Check legacy device failed.", e);
}
- if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M && !BuildCompat.isAtLeastQ()
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M && Build.VERSION.SDK_INT < 29
&& isLegacyDevice) {
// To configure surface again before close camera. This step would
// disconnect
diff --git a/car/core/src/main/java/androidx/car/drawer/CarDrawerAdapter.java b/car/core/src/main/java/androidx/car/drawer/CarDrawerAdapter.java
index 3bafda9..0605865 100644
--- a/car/core/src/main/java/androidx/car/drawer/CarDrawerAdapter.java
+++ b/car/core/src/main/java/androidx/car/drawer/CarDrawerAdapter.java
@@ -99,6 +99,7 @@
void onTitleChanged(@Nullable CharSequence newTitle);
}
+ @SuppressWarnings("deprecation")
protected CarDrawerAdapter(Context context, boolean showDisabledListOnEmpty) {
mShowDisabledListOnEmpty = showDisabledListOnEmpty;
diff --git a/cardview/build.gradle b/cardview/build.gradle
index 99ddcbb..8b99e2a 100644
--- a/cardview/build.gradle
+++ b/cardview/build.gradle
@@ -8,6 +8,7 @@
dependencies {
api("androidx.annotation:annotation:1.1.0-rc01")
+ implementation(project(":core"))
}
android {
diff --git a/cardview/src/main/java/androidx/cardview/widget/CardView.java b/cardview/src/main/java/androidx/cardview/widget/CardView.java
index bfaa546..affa679 100644
--- a/cardview/src/main/java/androidx/cardview/widget/CardView.java
+++ b/cardview/src/main/java/androidx/cardview/widget/CardView.java
@@ -122,6 +122,10 @@
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CardView, defStyleAttr,
R.style.CardView);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.CardView, attrs, a, defStyleAttr, R.style.CardView);
+ }
ColorStateList backgroundColor;
if (a.hasValue(R.styleable.CardView_cardBackgroundColor)) {
backgroundColor = a.getColorStateList(R.styleable.CardView_cardBackgroundColor);
diff --git a/compose/plugins/cli-tests/src/test/java/androidx/compose/plugins/kotlin/FcsModelCodeGenTests.kt b/compose/plugins/cli-tests/src/test/java/androidx/compose/plugins/kotlin/FcsModelCodeGenTests.kt
index a3d161f..8ce6c9e 100644
--- a/compose/plugins/cli-tests/src/test/java/androidx/compose/plugins/kotlin/FcsModelCodeGenTests.kt
+++ b/compose/plugins/cli-tests/src/test/java/androidx/compose/plugins/kotlin/FcsModelCodeGenTests.kt
@@ -201,9 +201,7 @@
}
}
- val president = FrameManager.unframed { FcsPersonC("${
- PRESIDENT_NAME_1
- }", $PRESIDENT_AGE_1) }
+ val president = FrameManager.unframed { FcsPersonC("$PRESIDENT_NAME_1", $PRESIDENT_AGE_1) }
""", { mapOf("name" to name, "age" to age) }, """
president.name = name
president.age = age
@@ -245,9 +243,7 @@
}
}
- val president = FrameManager.framed { FcsPersonD("$PRESIDENT_NAME_1", ${
- PRESIDENT_AGE_1
- }).apply { age = $PRESIDENT_AGE_1 } }
+ val president = FrameManager.framed { FcsPersonD("$PRESIDENT_NAME_1", $PRESIDENT_AGE_1).apply { age = $PRESIDENT_AGE_1 } }
""", { mapOf("name" to name, "age" to age) }, """
president.name = name
president.age = age
diff --git a/compose/plugins/cli-tests/src/test/java/androidx/compose/plugins/kotlin/GenerateWrapperViewTest.kt b/compose/plugins/cli-tests/src/test/java/androidx/compose/plugins/kotlin/GenerateWrapperViewTest.kt
index eeefeaa..bead928 100644
--- a/compose/plugins/cli-tests/src/test/java/androidx/compose/plugins/kotlin/GenerateWrapperViewTest.kt
+++ b/compose/plugins/cli-tests/src/test/java/androidx/compose/plugins/kotlin/GenerateWrapperViewTest.kt
@@ -54,7 +54,7 @@
if (wrapperClass == null) return
TestCase.assertEquals(
"Wrapper view subclasses LinearLayout", "android.widget.LinearLayout",
- wrapperClass.superclass!!.name
+ wrapperClass.superclass?.name
)
val setFoo = wrapperClass.declaredMethods.find { it.name == "setFoo" }
TestCase.assertNotNull("has a setter method for properties", setFoo)
diff --git a/compose/plugins/cli-tests/src/test/java/androidx/compose/plugins/kotlin/KtxModelCodeGenTests.kt b/compose/plugins/cli-tests/src/test/java/androidx/compose/plugins/kotlin/KtxModelCodeGenTests.kt
index c0722d1..8ee3a3b 100644
--- a/compose/plugins/cli-tests/src/test/java/androidx/compose/plugins/kotlin/KtxModelCodeGenTests.kt
+++ b/compose/plugins/cli-tests/src/test/java/androidx/compose/plugins/kotlin/KtxModelCodeGenTests.kt
@@ -254,9 +254,7 @@
</Observe>
}
- val president = FrameManager.framed { PersonD("$PRESIDENT_NAME_1", ${
- PRESIDENT_AGE_1
- }).apply { age = $PRESIDENT_AGE_1 } }
+ val president = FrameManager.framed { PersonD("$PRESIDENT_NAME_1", $PRESIDENT_AGE_1).apply { age = $PRESIDENT_AGE_1 } }
""", { mapOf("name" to name, "age" to age) }, """
president.name = name
president.age = age
diff --git a/coordinatorlayout/src/main/java/androidx/coordinatorlayout/widget/CoordinatorLayout.java b/coordinatorlayout/src/main/java/androidx/coordinatorlayout/widget/CoordinatorLayout.java
index b4019f7..ff25749 100644
--- a/coordinatorlayout/src/main/java/androidx/coordinatorlayout/widget/CoordinatorLayout.java
+++ b/coordinatorlayout/src/main/java/androidx/coordinatorlayout/widget/CoordinatorLayout.java
@@ -220,6 +220,17 @@
0, R.style.Widget_Support_CoordinatorLayout)
: context.obtainStyledAttributes(attrs, R.styleable.CoordinatorLayout,
defStyleAttr, 0);
+ if (Build.VERSION.SDK_INT >= 29) {
+ if (defStyleAttr == 0) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.CoordinatorLayout, attrs, a, 0,
+ R.style.Widget_Support_CoordinatorLayout);
+ } else {
+ saveAttributeDataForStyleable(
+ context, R.styleable.CoordinatorLayout, attrs, a, defStyleAttr, 0);
+ }
+ }
+
final int keylineArrayRes = a.getResourceId(R.styleable.CoordinatorLayout_keylines, 0);
if (keylineArrayRes != 0) {
final Resources res = context.getResources();
diff --git a/core/api/1.1.0-alpha03.txt b/core/api/1.1.0-alpha03.txt
index cdd40ca..43c05b2 100644
--- a/core/api/1.1.0-alpha03.txt
+++ b/core/api/1.1.0-alpha03.txt
@@ -2354,6 +2354,7 @@
method public boolean isScrollable();
method public boolean isSelected();
method public boolean isShowingHintText();
+ method public boolean isTextEntryKey();
method public boolean isVisibleToUser();
method public static androidx.core.view.accessibility.AccessibilityNodeInfoCompat! obtain(android.view.View!);
method public static androidx.core.view.accessibility.AccessibilityNodeInfoCompat! obtain(android.view.View!, int);
@@ -2413,6 +2414,7 @@
method public void setSource(android.view.View!);
method public void setSource(android.view.View!, int);
method public void setText(CharSequence!);
+ method public void setTextEntryKey(boolean);
method public void setTextSelection(int, int);
method public void setTooltipText(CharSequence?);
method public void setTraversalAfter(android.view.View!);
@@ -2486,6 +2488,10 @@
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_MOVE_WINDOW;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_HTML_ELEMENT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_DOWN;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_LEFT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_RIGHT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_UP;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PASTE;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_HTML_ELEMENT;
diff --git a/core/api/1.1.0-alpha04.txt b/core/api/1.1.0-alpha04.txt
index e9cfd20..1852227 100644
--- a/core/api/1.1.0-alpha04.txt
+++ b/core/api/1.1.0-alpha04.txt
@@ -2337,6 +2337,7 @@
method public int getTextSelectionEnd();
method public int getTextSelectionStart();
method public CharSequence? getTooltipText();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat? getTouchDelegateInfo();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalAfter();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalBefore();
method public String! getViewIdResourceName();
@@ -2362,6 +2363,7 @@
method public boolean isScrollable();
method public boolean isSelected();
method public boolean isShowingHintText();
+ method public boolean isTextEntryKey();
method public boolean isVisibleToUser();
method public static androidx.core.view.accessibility.AccessibilityNodeInfoCompat! obtain(android.view.View!);
method public static androidx.core.view.accessibility.AccessibilityNodeInfoCompat! obtain(android.view.View!, int);
@@ -2421,8 +2423,10 @@
method public void setSource(android.view.View!);
method public void setSource(android.view.View!, int);
method public void setText(CharSequence!);
+ method public void setTextEntryKey(boolean);
method public void setTextSelection(int, int);
method public void setTooltipText(CharSequence?);
+ method public void setTouchDelegateInfo(androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat);
method public void setTraversalAfter(android.view.View!);
method public void setTraversalAfter(android.view.View!, int);
method public void setTraversalBefore(android.view.View!);
@@ -2494,6 +2498,10 @@
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_MOVE_WINDOW;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_HTML_ELEMENT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_DOWN;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_LEFT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_RIGHT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_UP;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PASTE;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_HTML_ELEMENT;
@@ -2546,6 +2554,13 @@
field public static final int RANGE_TYPE_PERCENT = 2; // 0x2
}
+ public static final class AccessibilityNodeInfoCompat.TouchDelegateInfoCompat {
+ ctor public AccessibilityNodeInfoCompat.TouchDelegateInfoCompat(java.util.Map<android.graphics.Region,android.view.View>);
+ method public android.graphics.Region? getRegionAt(@IntRange(from=0) int);
+ method @IntRange(from=0) public int getRegionCount();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat? getTargetForRegion(android.graphics.Region);
+ }
+
public class AccessibilityNodeProviderCompat {
ctor public AccessibilityNodeProviderCompat();
ctor public AccessibilityNodeProviderCompat(Object!);
diff --git a/core/api/1.1.0-alpha05.txt b/core/api/1.1.0-alpha05.txt
index 0ece2e3..5855002 100644
--- a/core/api/1.1.0-alpha05.txt
+++ b/core/api/1.1.0-alpha05.txt
@@ -2338,6 +2338,7 @@
method public int getTextSelectionEnd();
method public int getTextSelectionStart();
method public CharSequence? getTooltipText();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat? getTouchDelegateInfo();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalAfter();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalBefore();
method public String! getViewIdResourceName();
@@ -2363,6 +2364,7 @@
method public boolean isScrollable();
method public boolean isSelected();
method public boolean isShowingHintText();
+ method public boolean isTextEntryKey();
method public boolean isVisibleToUser();
method public static androidx.core.view.accessibility.AccessibilityNodeInfoCompat! obtain(android.view.View!);
method public static androidx.core.view.accessibility.AccessibilityNodeInfoCompat! obtain(android.view.View!, int);
@@ -2422,8 +2424,10 @@
method public void setSource(android.view.View!);
method public void setSource(android.view.View!, int);
method public void setText(CharSequence!);
+ method public void setTextEntryKey(boolean);
method public void setTextSelection(int, int);
method public void setTooltipText(CharSequence?);
+ method public void setTouchDelegateInfo(androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat);
method public void setTraversalAfter(android.view.View!);
method public void setTraversalAfter(android.view.View!, int);
method public void setTraversalBefore(android.view.View!);
@@ -2495,6 +2499,10 @@
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_MOVE_WINDOW;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_HTML_ELEMENT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_DOWN;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_LEFT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_RIGHT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_UP;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PASTE;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_HTML_ELEMENT;
@@ -2547,6 +2555,13 @@
field public static final int RANGE_TYPE_PERCENT = 2; // 0x2
}
+ public static final class AccessibilityNodeInfoCompat.TouchDelegateInfoCompat {
+ ctor public AccessibilityNodeInfoCompat.TouchDelegateInfoCompat(java.util.Map<android.graphics.Region,android.view.View>);
+ method public android.graphics.Region? getRegionAt(@IntRange(from=0) int);
+ method @IntRange(from=0) public int getRegionCount();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat? getTargetForRegion(android.graphics.Region);
+ }
+
public class AccessibilityNodeProviderCompat {
ctor public AccessibilityNodeProviderCompat();
ctor public AccessibilityNodeProviderCompat(Object!);
diff --git a/core/api/1.1.0-alpha06.txt b/core/api/1.1.0-alpha06.txt
index 0b7ff5c..3b9d352 100644
--- a/core/api/1.1.0-alpha06.txt
+++ b/core/api/1.1.0-alpha06.txt
@@ -180,7 +180,9 @@
ctor @Deprecated public NotificationCompat();
method public static androidx.core.app.NotificationCompat.Action! getAction(android.app.Notification!, int);
method public static int getActionCount(android.app.Notification!);
+ method public static boolean getAllowSystemGeneratedContextualActions(android.app.Notification!);
method public static int getBadgeIconType(android.app.Notification!);
+ method public static androidx.core.app.NotificationCompat.BubbleMetadata? getBubbleMetadata(android.app.Notification!);
method public static String! getCategory(android.app.Notification!);
method public static String! getChannelId(android.app.Notification!);
method @RequiresApi(19) public static CharSequence! getContentTitle(android.app.Notification!);
@@ -282,6 +284,7 @@
method @androidx.core.app.NotificationCompat.Action.SemanticAction public int getSemanticAction();
method public boolean getShowsUserInterface();
method public CharSequence! getTitle();
+ method public boolean isContextual();
field public static final int SEMANTIC_ACTION_ARCHIVE = 5; // 0x5
field public static final int SEMANTIC_ACTION_CALL = 10; // 0xa
field public static final int SEMANTIC_ACTION_DELETE = 4; // 0x4
@@ -307,6 +310,7 @@
method public androidx.core.app.NotificationCompat.Action.Builder! extend(androidx.core.app.NotificationCompat.Action.Extender!);
method public android.os.Bundle! getExtras();
method public androidx.core.app.NotificationCompat.Action.Builder! setAllowGeneratedReplies(boolean);
+ method public androidx.core.app.NotificationCompat.Action.Builder setContextual(boolean);
method public androidx.core.app.NotificationCompat.Action.Builder! setSemanticAction(@androidx.core.app.NotificationCompat.Action.SemanticAction int);
method public androidx.core.app.NotificationCompat.Action.Builder! setShowsUserInterface(boolean);
}
@@ -354,6 +358,30 @@
method public androidx.core.app.NotificationCompat.BigTextStyle! setSummaryText(CharSequence!);
}
+ public static final class NotificationCompat.BubbleMetadata {
+ method @RequiresApi(29) protected static androidx.core.app.NotificationCompat.BubbleMetadata! fromPlatform(android.app.Notification.BubbleMetadata!);
+ method public boolean getAutoExpandBubble();
+ method public android.app.PendingIntent? getDeleteIntent();
+ method @Dimension(unit=androidx.annotation.Dimension.DP) public int getDesiredHeight();
+ method @DimenRes public int getDesiredHeightResId();
+ method public androidx.core.graphics.drawable.IconCompat getIcon();
+ method public android.app.PendingIntent getIntent();
+ method public boolean getSuppressInitialNotification();
+ method @RequiresApi(29) protected static android.app.Notification.BubbleMetadata! toPlatform(androidx.core.app.NotificationCompat.BubbleMetadata!);
+ }
+
+ public static final class NotificationCompat.BubbleMetadata.Builder {
+ ctor public NotificationCompat.BubbleMetadata.Builder();
+ method public androidx.core.app.NotificationCompat.BubbleMetadata build();
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setAutoExpandBubble(boolean);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDeleteIntent(android.app.PendingIntent?);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDesiredHeight(@Dimension(unit=androidx.annotation.Dimension.DP) int);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDesiredHeightResId(@DimenRes int);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setIcon(androidx.core.graphics.drawable.IconCompat);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setIntent(android.app.PendingIntent);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setSuppressInitialNotification(boolean);
+ }
+
public static class NotificationCompat.Builder {
ctor public NotificationCompat.Builder(android.content.Context, String);
ctor @Deprecated public NotificationCompat.Builder(android.content.Context!);
@@ -368,8 +396,10 @@
method public android.os.Bundle! getExtras();
method @Deprecated public android.app.Notification! getNotification();
method protected static CharSequence! limitCharSequenceLength(CharSequence!);
+ method public androidx.core.app.NotificationCompat.Builder setAllowSystemGeneratedContextualActions(boolean);
method public androidx.core.app.NotificationCompat.Builder! setAutoCancel(boolean);
method public androidx.core.app.NotificationCompat.Builder! setBadgeIconType(int);
+ method public androidx.core.app.NotificationCompat.Builder setBubbleMetadata(androidx.core.app.NotificationCompat.BubbleMetadata?);
method public androidx.core.app.NotificationCompat.Builder! setCategory(String!);
method public androidx.core.app.NotificationCompat.Builder! setChannelId(String);
method public androidx.core.app.NotificationCompat.Builder! setColor(@ColorInt int);
@@ -655,6 +685,7 @@
method public java.util.Set<java.lang.String>! getAllowedDataTypes();
method public CharSequence[]! getChoices();
method public static java.util.Map<java.lang.String,android.net.Uri>! getDataResultsFromIntent(android.content.Intent!, String!);
+ method public int getEditChoicesBeforeSending();
method public android.os.Bundle! getExtras();
method public CharSequence! getLabel();
method public String! getResultKey();
@@ -662,6 +693,9 @@
method public static int getResultsSource(android.content.Intent);
method public boolean isDataOnly();
method public static void setResultsSource(android.content.Intent, int);
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_AUTO = 0; // 0x0
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_DISABLED = 1; // 0x1
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_ENABLED = 2; // 0x2
field public static final String EXTRA_RESULTS_DATA = "android.remoteinput.resultsData";
field public static final String RESULTS_CLIP_LABEL = "android.remoteinput.results";
field public static final int SOURCE_CHOICE = 1; // 0x1
@@ -676,6 +710,7 @@
method public androidx.core.app.RemoteInput.Builder setAllowDataType(String, boolean);
method public androidx.core.app.RemoteInput.Builder setAllowFreeFormInput(boolean);
method public androidx.core.app.RemoteInput.Builder setChoices(CharSequence[]?);
+ method public androidx.core.app.RemoteInput.Builder setEditChoicesBeforeSending(int);
method public androidx.core.app.RemoteInput.Builder setLabel(CharSequence?);
}
@@ -969,6 +1004,38 @@
method public static void setHasMipMap(android.graphics.Bitmap, boolean);
}
+ public enum BlendModeCompat {
+ enum_constant public static final androidx.core.graphics.BlendModeCompat CLEAR;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR_BURN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR_DODGE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DARKEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DIFFERENCE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_ATOP;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_IN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_OUT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_OVER;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat EXCLUSION;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat HARD_LIGHT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat HUE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat LIGHTEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat LUMINOSITY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat MODULATE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat MULTIPLY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat OVERLAY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat PLUS;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SATURATION;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SCREEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SOFT_LIGHT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_ATOP;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_IN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_OUT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_OVER;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat XOR;
+ }
+
public final class ColorUtils {
method @ColorInt public static int HSLToColor(float[]);
method @ColorInt public static int LABToColor(@FloatRange(from=0.0f, to=100) double, @FloatRange(from=0xffffff80, to=127) double, @FloatRange(from=0xffffff80, to=127) double);
@@ -993,8 +1060,20 @@
method @ColorInt public static int setAlphaComponent(@ColorInt int, @IntRange(from=0, to=255) int);
}
+ public final class Insets {
+ method public static androidx.core.graphics.Insets of(int, int, int, int);
+ method public static androidx.core.graphics.Insets of(android.graphics.Rect);
+ field public static final androidx.core.graphics.Insets NONE;
+ field public final int bottom;
+ field public final int left;
+ field public final int right;
+ field public final int top;
+ }
+
public final class PaintCompat {
method public static boolean hasGlyph(android.graphics.Paint, String);
+ method public static boolean setBlendMode(android.graphics.Paint, androidx.core.graphics.BlendModeCompat?);
+ method public static boolean setBlendModeColorFilter(android.graphics.Paint, @ColorInt int, androidx.core.graphics.BlendModeCompat?);
}
public final class PathSegment {
@@ -1962,6 +2041,7 @@
method @Deprecated public static float getScaleX(android.view.View!);
method @Deprecated public static float getScaleY(android.view.View!);
method public static int getScrollIndicators(android.view.View);
+ method public static java.util.List<android.graphics.Rect> getSystemGestureExclusionRects(android.view.View);
method public static String? getTransitionName(android.view.View);
method @Deprecated public static float getTranslationX(android.view.View!);
method @Deprecated public static float getTranslationY(android.view.View!);
@@ -2050,6 +2130,7 @@
method @UiThread public static void setScreenReaderFocusable(android.view.View!, boolean);
method public static void setScrollIndicators(android.view.View, int);
method public static void setScrollIndicators(android.view.View, int, int);
+ method public static void setSystemGestureExclusionRects(android.view.View, java.util.List<android.graphics.Rect>);
method public static void setTooltipText(android.view.View, CharSequence?);
method public static void setTransitionName(android.view.View, String!);
method @Deprecated public static void setTranslationX(android.view.View!, float);
@@ -2211,14 +2292,19 @@
method public androidx.core.view.WindowInsetsCompat! consumeStableInsets();
method public androidx.core.view.WindowInsetsCompat! consumeSystemWindowInsets();
method public androidx.core.view.DisplayCutoutCompat? getDisplayCutout();
+ method public androidx.core.graphics.Insets getMandatorySystemGestureInsets();
method public int getStableInsetBottom();
method public int getStableInsetLeft();
method public int getStableInsetRight();
method public int getStableInsetTop();
+ method public androidx.core.graphics.Insets getStableInsets();
+ method public androidx.core.graphics.Insets getSystemGestureInsets();
method public int getSystemWindowInsetBottom();
method public int getSystemWindowInsetLeft();
method public int getSystemWindowInsetRight();
method public int getSystemWindowInsetTop();
+ method public androidx.core.graphics.Insets getSystemWindowInsets();
+ method public androidx.core.graphics.Insets getTappableElementInsets();
method public boolean hasInsets();
method public boolean hasStableInsets();
method public boolean hasSystemWindowInsets();
@@ -2310,7 +2396,7 @@
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! focusSearch(int);
method public java.util.List<androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat>! getActionList();
method public int getActions();
- method public void getBoundsInParent(android.graphics.Rect!);
+ method @Deprecated public void getBoundsInParent(android.graphics.Rect!);
method public void getBoundsInScreen(android.graphics.Rect!);
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getChild(int);
method public int getChildCount();
@@ -2338,6 +2424,7 @@
method public int getTextSelectionEnd();
method public int getTextSelectionStart();
method public CharSequence? getTooltipText();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat? getTouchDelegateInfo();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalAfter();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalBefore();
method public String! getViewIdResourceName();
@@ -2377,7 +2464,7 @@
method public boolean removeChild(android.view.View!);
method public boolean removeChild(android.view.View!, int);
method public void setAccessibilityFocused(boolean);
- method public void setBoundsInParent(android.graphics.Rect!);
+ method @Deprecated public void setBoundsInParent(android.graphics.Rect!);
method public void setBoundsInScreen(android.graphics.Rect!);
method public void setCanOpenPopup(boolean);
method public void setCheckable(boolean);
@@ -2426,6 +2513,7 @@
method public void setTextEntryKey(boolean);
method public void setTextSelection(int, int);
method public void setTooltipText(CharSequence?);
+ method public void setTouchDelegateInfo(androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat);
method public void setTraversalAfter(android.view.View!);
method public void setTraversalAfter(android.view.View!, int);
method public void setTraversalBefore(android.view.View!);
@@ -2497,6 +2585,10 @@
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_MOVE_WINDOW;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_HTML_ELEMENT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_DOWN;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_LEFT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_RIGHT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_UP;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PASTE;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_HTML_ELEMENT;
@@ -2549,6 +2641,13 @@
field public static final int RANGE_TYPE_PERCENT = 2; // 0x2
}
+ public static final class AccessibilityNodeInfoCompat.TouchDelegateInfoCompat {
+ ctor public AccessibilityNodeInfoCompat.TouchDelegateInfoCompat(java.util.Map<android.graphics.Region,android.view.View>);
+ method public android.graphics.Region? getRegionAt(@IntRange(from=0) int);
+ method @IntRange(from=0) public int getRegionCount();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat? getTargetForRegion(android.graphics.Region);
+ }
+
public class AccessibilityNodeProviderCompat {
ctor public AccessibilityNodeProviderCompat();
ctor public AccessibilityNodeProviderCompat(Object!);
diff --git a/core/api/1.1.0-alpha07.txt b/core/api/1.1.0-alpha07.txt
index 5f94ab8..c615799 100644
--- a/core/api/1.1.0-alpha07.txt
+++ b/core/api/1.1.0-alpha07.txt
@@ -180,7 +180,9 @@
ctor @Deprecated public NotificationCompat();
method public static androidx.core.app.NotificationCompat.Action! getAction(android.app.Notification!, int);
method public static int getActionCount(android.app.Notification!);
+ method public static boolean getAllowSystemGeneratedContextualActions(android.app.Notification!);
method public static int getBadgeIconType(android.app.Notification!);
+ method public static androidx.core.app.NotificationCompat.BubbleMetadata? getBubbleMetadata(android.app.Notification!);
method public static String! getCategory(android.app.Notification!);
method public static String! getChannelId(android.app.Notification!);
method @RequiresApi(19) public static CharSequence! getContentTitle(android.app.Notification!);
@@ -282,6 +284,7 @@
method @androidx.core.app.NotificationCompat.Action.SemanticAction public int getSemanticAction();
method public boolean getShowsUserInterface();
method public CharSequence! getTitle();
+ method public boolean isContextual();
field public static final int SEMANTIC_ACTION_ARCHIVE = 5; // 0x5
field public static final int SEMANTIC_ACTION_CALL = 10; // 0xa
field public static final int SEMANTIC_ACTION_DELETE = 4; // 0x4
@@ -307,6 +310,7 @@
method public androidx.core.app.NotificationCompat.Action.Builder! extend(androidx.core.app.NotificationCompat.Action.Extender!);
method public android.os.Bundle! getExtras();
method public androidx.core.app.NotificationCompat.Action.Builder! setAllowGeneratedReplies(boolean);
+ method public androidx.core.app.NotificationCompat.Action.Builder setContextual(boolean);
method public androidx.core.app.NotificationCompat.Action.Builder! setSemanticAction(@androidx.core.app.NotificationCompat.Action.SemanticAction int);
method public androidx.core.app.NotificationCompat.Action.Builder! setShowsUserInterface(boolean);
}
@@ -354,6 +358,30 @@
method public androidx.core.app.NotificationCompat.BigTextStyle! setSummaryText(CharSequence!);
}
+ public static final class NotificationCompat.BubbleMetadata {
+ method @RequiresApi(29) protected static androidx.core.app.NotificationCompat.BubbleMetadata! fromPlatform(android.app.Notification.BubbleMetadata!);
+ method public boolean getAutoExpandBubble();
+ method public android.app.PendingIntent? getDeleteIntent();
+ method @Dimension(unit=androidx.annotation.Dimension.DP) public int getDesiredHeight();
+ method @DimenRes public int getDesiredHeightResId();
+ method public androidx.core.graphics.drawable.IconCompat getIcon();
+ method public android.app.PendingIntent getIntent();
+ method public boolean getSuppressInitialNotification();
+ method @RequiresApi(29) protected static android.app.Notification.BubbleMetadata! toPlatform(androidx.core.app.NotificationCompat.BubbleMetadata!);
+ }
+
+ public static final class NotificationCompat.BubbleMetadata.Builder {
+ ctor public NotificationCompat.BubbleMetadata.Builder();
+ method public androidx.core.app.NotificationCompat.BubbleMetadata build();
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setAutoExpandBubble(boolean);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDeleteIntent(android.app.PendingIntent?);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDesiredHeight(@Dimension(unit=androidx.annotation.Dimension.DP) int);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDesiredHeightResId(@DimenRes int);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setIcon(androidx.core.graphics.drawable.IconCompat);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setIntent(android.app.PendingIntent);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setSuppressInitialNotification(boolean);
+ }
+
public static class NotificationCompat.Builder {
ctor public NotificationCompat.Builder(android.content.Context, String);
ctor @Deprecated public NotificationCompat.Builder(android.content.Context!);
@@ -368,8 +396,10 @@
method public android.os.Bundle! getExtras();
method @Deprecated public android.app.Notification! getNotification();
method protected static CharSequence! limitCharSequenceLength(CharSequence!);
+ method public androidx.core.app.NotificationCompat.Builder setAllowSystemGeneratedContextualActions(boolean);
method public androidx.core.app.NotificationCompat.Builder! setAutoCancel(boolean);
method public androidx.core.app.NotificationCompat.Builder! setBadgeIconType(int);
+ method public androidx.core.app.NotificationCompat.Builder setBubbleMetadata(androidx.core.app.NotificationCompat.BubbleMetadata?);
method public androidx.core.app.NotificationCompat.Builder! setCategory(String!);
method public androidx.core.app.NotificationCompat.Builder! setChannelId(String);
method public androidx.core.app.NotificationCompat.Builder! setColor(@ColorInt int);
@@ -655,6 +685,7 @@
method public java.util.Set<java.lang.String>! getAllowedDataTypes();
method public CharSequence[]! getChoices();
method public static java.util.Map<java.lang.String,android.net.Uri>! getDataResultsFromIntent(android.content.Intent!, String!);
+ method public int getEditChoicesBeforeSending();
method public android.os.Bundle! getExtras();
method public CharSequence! getLabel();
method public String! getResultKey();
@@ -662,6 +693,9 @@
method public static int getResultsSource(android.content.Intent);
method public boolean isDataOnly();
method public static void setResultsSource(android.content.Intent, int);
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_AUTO = 0; // 0x0
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_DISABLED = 1; // 0x1
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_ENABLED = 2; // 0x2
field public static final String EXTRA_RESULTS_DATA = "android.remoteinput.resultsData";
field public static final String RESULTS_CLIP_LABEL = "android.remoteinput.results";
field public static final int SOURCE_CHOICE = 1; // 0x1
@@ -676,6 +710,7 @@
method public androidx.core.app.RemoteInput.Builder setAllowDataType(String, boolean);
method public androidx.core.app.RemoteInput.Builder setAllowFreeFormInput(boolean);
method public androidx.core.app.RemoteInput.Builder setChoices(CharSequence[]?);
+ method public androidx.core.app.RemoteInput.Builder setEditChoicesBeforeSending(int);
method public androidx.core.app.RemoteInput.Builder setLabel(CharSequence?);
}
@@ -969,6 +1004,38 @@
method public static void setHasMipMap(android.graphics.Bitmap, boolean);
}
+ public enum BlendModeCompat {
+ enum_constant public static final androidx.core.graphics.BlendModeCompat CLEAR;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR_BURN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR_DODGE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DARKEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DIFFERENCE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_ATOP;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_IN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_OUT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_OVER;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat EXCLUSION;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat HARD_LIGHT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat HUE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat LIGHTEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat LUMINOSITY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat MODULATE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat MULTIPLY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat OVERLAY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat PLUS;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SATURATION;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SCREEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SOFT_LIGHT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_ATOP;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_IN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_OUT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_OVER;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat XOR;
+ }
+
public final class ColorUtils {
method @ColorInt public static int HSLToColor(float[]);
method @ColorInt public static int LABToColor(@FloatRange(from=0.0f, to=100) double, @FloatRange(from=0xffffff80, to=127) double, @FloatRange(from=0xffffff80, to=127) double);
@@ -993,8 +1060,20 @@
method @ColorInt public static int setAlphaComponent(@ColorInt int, @IntRange(from=0, to=255) int);
}
+ public final class Insets {
+ method public static androidx.core.graphics.Insets of(int, int, int, int);
+ method public static androidx.core.graphics.Insets of(android.graphics.Rect);
+ field public static final androidx.core.graphics.Insets NONE;
+ field public final int bottom;
+ field public final int left;
+ field public final int right;
+ field public final int top;
+ }
+
public final class PaintCompat {
method public static boolean hasGlyph(android.graphics.Paint, String);
+ method public static boolean setBlendMode(android.graphics.Paint, androidx.core.graphics.BlendModeCompat?);
+ method public static boolean setBlendModeColorFilter(android.graphics.Paint, @ColorInt int, androidx.core.graphics.BlendModeCompat?);
}
public final class PathSegment {
@@ -1188,7 +1267,7 @@
method @Deprecated public static boolean isAtLeastO();
method @Deprecated public static boolean isAtLeastOMR1();
method @Deprecated public static boolean isAtLeastP();
- method public static boolean isAtLeastQ();
+ method @Deprecated public static boolean isAtLeastQ();
}
public final class CancellationSignal {
@@ -1962,6 +2041,7 @@
method @Deprecated public static float getScaleX(android.view.View!);
method @Deprecated public static float getScaleY(android.view.View!);
method public static int getScrollIndicators(android.view.View);
+ method public static java.util.List<android.graphics.Rect> getSystemGestureExclusionRects(android.view.View);
method public static String? getTransitionName(android.view.View);
method @Deprecated public static float getTranslationX(android.view.View!);
method @Deprecated public static float getTranslationY(android.view.View!);
@@ -2050,6 +2130,7 @@
method @UiThread public static void setScreenReaderFocusable(android.view.View!, boolean);
method public static void setScrollIndicators(android.view.View, int);
method public static void setScrollIndicators(android.view.View, int, int);
+ method public static void setSystemGestureExclusionRects(android.view.View, java.util.List<android.graphics.Rect>);
method public static void setTooltipText(android.view.View, CharSequence?);
method public static void setTransitionName(android.view.View, String!);
method @Deprecated public static void setTranslationX(android.view.View!, float);
@@ -2211,14 +2292,19 @@
method public androidx.core.view.WindowInsetsCompat! consumeStableInsets();
method public androidx.core.view.WindowInsetsCompat! consumeSystemWindowInsets();
method public androidx.core.view.DisplayCutoutCompat? getDisplayCutout();
+ method public androidx.core.graphics.Insets getMandatorySystemGestureInsets();
method public int getStableInsetBottom();
method public int getStableInsetLeft();
method public int getStableInsetRight();
method public int getStableInsetTop();
+ method public androidx.core.graphics.Insets getStableInsets();
+ method public androidx.core.graphics.Insets getSystemGestureInsets();
method public int getSystemWindowInsetBottom();
method public int getSystemWindowInsetLeft();
method public int getSystemWindowInsetRight();
method public int getSystemWindowInsetTop();
+ method public androidx.core.graphics.Insets getSystemWindowInsets();
+ method public androidx.core.graphics.Insets getTappableElementInsets();
method public boolean hasInsets();
method public boolean hasStableInsets();
method public boolean hasSystemWindowInsets();
@@ -2310,7 +2396,7 @@
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! focusSearch(int);
method public java.util.List<androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat>! getActionList();
method public int getActions();
- method public void getBoundsInParent(android.graphics.Rect!);
+ method @Deprecated public void getBoundsInParent(android.graphics.Rect!);
method public void getBoundsInScreen(android.graphics.Rect!);
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getChild(int);
method public int getChildCount();
@@ -2338,6 +2424,7 @@
method public int getTextSelectionEnd();
method public int getTextSelectionStart();
method public CharSequence? getTooltipText();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat? getTouchDelegateInfo();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalAfter();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalBefore();
method public String! getViewIdResourceName();
@@ -2377,7 +2464,7 @@
method public boolean removeChild(android.view.View!);
method public boolean removeChild(android.view.View!, int);
method public void setAccessibilityFocused(boolean);
- method public void setBoundsInParent(android.graphics.Rect!);
+ method @Deprecated public void setBoundsInParent(android.graphics.Rect!);
method public void setBoundsInScreen(android.graphics.Rect!);
method public void setCanOpenPopup(boolean);
method public void setCheckable(boolean);
@@ -2426,6 +2513,7 @@
method public void setTextEntryKey(boolean);
method public void setTextSelection(int, int);
method public void setTooltipText(CharSequence?);
+ method public void setTouchDelegateInfo(androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat);
method public void setTraversalAfter(android.view.View!);
method public void setTraversalAfter(android.view.View!, int);
method public void setTraversalBefore(android.view.View!);
@@ -2497,6 +2585,10 @@
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_MOVE_WINDOW;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_HTML_ELEMENT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_DOWN;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_LEFT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_RIGHT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_UP;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PASTE;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_HTML_ELEMENT;
@@ -2549,6 +2641,13 @@
field public static final int RANGE_TYPE_PERCENT = 2; // 0x2
}
+ public static final class AccessibilityNodeInfoCompat.TouchDelegateInfoCompat {
+ ctor public AccessibilityNodeInfoCompat.TouchDelegateInfoCompat(java.util.Map<android.graphics.Region,android.view.View>);
+ method public android.graphics.Region? getRegionAt(@IntRange(from=0) int);
+ method @IntRange(from=0) public int getRegionCount();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat? getTargetForRegion(android.graphics.Region);
+ }
+
public class AccessibilityNodeProviderCompat {
ctor public AccessibilityNodeProviderCompat();
ctor public AccessibilityNodeProviderCompat(Object!);
diff --git a/core/api/1.1.0-beta01.txt b/core/api/1.1.0-beta01.txt
index 5f94ab8..6430814 100644
--- a/core/api/1.1.0-beta01.txt
+++ b/core/api/1.1.0-beta01.txt
@@ -180,7 +180,9 @@
ctor @Deprecated public NotificationCompat();
method public static androidx.core.app.NotificationCompat.Action! getAction(android.app.Notification!, int);
method public static int getActionCount(android.app.Notification!);
+ method public static boolean getAllowSystemGeneratedContextualActions(android.app.Notification!);
method public static int getBadgeIconType(android.app.Notification!);
+ method public static androidx.core.app.NotificationCompat.BubbleMetadata? getBubbleMetadata(android.app.Notification);
method public static String! getCategory(android.app.Notification!);
method public static String! getChannelId(android.app.Notification!);
method @RequiresApi(19) public static CharSequence! getContentTitle(android.app.Notification!);
@@ -248,6 +250,7 @@
field public static final String EXTRA_TITLE = "android.title";
field public static final String EXTRA_TITLE_BIG = "android.title.big";
field public static final int FLAG_AUTO_CANCEL = 16; // 0x10
+ field public static final int FLAG_BUBBLE = 4096; // 0x1000
field public static final int FLAG_FOREGROUND_SERVICE = 64; // 0x40
field public static final int FLAG_GROUP_SUMMARY = 512; // 0x200
field @Deprecated public static final int FLAG_HIGH_PRIORITY = 128; // 0x80
@@ -282,6 +285,7 @@
method @androidx.core.app.NotificationCompat.Action.SemanticAction public int getSemanticAction();
method public boolean getShowsUserInterface();
method public CharSequence! getTitle();
+ method public boolean isContextual();
field public static final int SEMANTIC_ACTION_ARCHIVE = 5; // 0x5
field public static final int SEMANTIC_ACTION_CALL = 10; // 0xa
field public static final int SEMANTIC_ACTION_DELETE = 4; // 0x4
@@ -307,6 +311,7 @@
method public androidx.core.app.NotificationCompat.Action.Builder! extend(androidx.core.app.NotificationCompat.Action.Extender!);
method public android.os.Bundle! getExtras();
method public androidx.core.app.NotificationCompat.Action.Builder! setAllowGeneratedReplies(boolean);
+ method public androidx.core.app.NotificationCompat.Action.Builder setContextual(boolean);
method public androidx.core.app.NotificationCompat.Action.Builder! setSemanticAction(@androidx.core.app.NotificationCompat.Action.SemanticAction int);
method public androidx.core.app.NotificationCompat.Action.Builder! setShowsUserInterface(boolean);
}
@@ -354,6 +359,30 @@
method public androidx.core.app.NotificationCompat.BigTextStyle! setSummaryText(CharSequence!);
}
+ public static final class NotificationCompat.BubbleMetadata {
+ method @RequiresApi(29) public static androidx.core.app.NotificationCompat.BubbleMetadata? fromPlatform(android.app.Notification.BubbleMetadata?);
+ method public boolean getAutoExpandBubble();
+ method public android.app.PendingIntent? getDeleteIntent();
+ method @Dimension(unit=androidx.annotation.Dimension.DP) public int getDesiredHeight();
+ method @DimenRes public int getDesiredHeightResId();
+ method public androidx.core.graphics.drawable.IconCompat getIcon();
+ method public android.app.PendingIntent getIntent();
+ method public boolean isNotificationSuppressed();
+ method @RequiresApi(29) public static android.app.Notification.BubbleMetadata? toPlatform(androidx.core.app.NotificationCompat.BubbleMetadata?);
+ }
+
+ public static final class NotificationCompat.BubbleMetadata.Builder {
+ ctor public NotificationCompat.BubbleMetadata.Builder();
+ method public androidx.core.app.NotificationCompat.BubbleMetadata build();
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setAutoExpandBubble(boolean);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDeleteIntent(android.app.PendingIntent?);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDesiredHeight(@Dimension(unit=androidx.annotation.Dimension.DP) int);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDesiredHeightResId(@DimenRes int);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setIcon(androidx.core.graphics.drawable.IconCompat);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setIntent(android.app.PendingIntent);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setSuppressNotification(boolean);
+ }
+
public static class NotificationCompat.Builder {
ctor public NotificationCompat.Builder(android.content.Context, String);
ctor @Deprecated public NotificationCompat.Builder(android.content.Context!);
@@ -368,8 +397,10 @@
method public android.os.Bundle! getExtras();
method @Deprecated public android.app.Notification! getNotification();
method protected static CharSequence! limitCharSequenceLength(CharSequence!);
+ method public androidx.core.app.NotificationCompat.Builder setAllowSystemGeneratedContextualActions(boolean);
method public androidx.core.app.NotificationCompat.Builder! setAutoCancel(boolean);
method public androidx.core.app.NotificationCompat.Builder! setBadgeIconType(int);
+ method public androidx.core.app.NotificationCompat.Builder setBubbleMetadata(androidx.core.app.NotificationCompat.BubbleMetadata?);
method public androidx.core.app.NotificationCompat.Builder! setCategory(String!);
method public androidx.core.app.NotificationCompat.Builder! setChannelId(String);
method public androidx.core.app.NotificationCompat.Builder! setColor(@ColorInt int);
@@ -655,6 +686,7 @@
method public java.util.Set<java.lang.String>! getAllowedDataTypes();
method public CharSequence[]! getChoices();
method public static java.util.Map<java.lang.String,android.net.Uri>! getDataResultsFromIntent(android.content.Intent!, String!);
+ method public int getEditChoicesBeforeSending();
method public android.os.Bundle! getExtras();
method public CharSequence! getLabel();
method public String! getResultKey();
@@ -662,6 +694,9 @@
method public static int getResultsSource(android.content.Intent);
method public boolean isDataOnly();
method public static void setResultsSource(android.content.Intent, int);
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_AUTO = 0; // 0x0
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_DISABLED = 1; // 0x1
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_ENABLED = 2; // 0x2
field public static final String EXTRA_RESULTS_DATA = "android.remoteinput.resultsData";
field public static final String RESULTS_CLIP_LABEL = "android.remoteinput.results";
field public static final int SOURCE_CHOICE = 1; // 0x1
@@ -676,6 +711,7 @@
method public androidx.core.app.RemoteInput.Builder setAllowDataType(String, boolean);
method public androidx.core.app.RemoteInput.Builder setAllowFreeFormInput(boolean);
method public androidx.core.app.RemoteInput.Builder setChoices(CharSequence[]?);
+ method public androidx.core.app.RemoteInput.Builder setEditChoicesBeforeSending(int);
method public androidx.core.app.RemoteInput.Builder setLabel(CharSequence?);
}
@@ -969,6 +1005,38 @@
method public static void setHasMipMap(android.graphics.Bitmap, boolean);
}
+ public enum BlendModeCompat {
+ enum_constant public static final androidx.core.graphics.BlendModeCompat CLEAR;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR_BURN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR_DODGE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DARKEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DIFFERENCE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_ATOP;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_IN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_OUT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_OVER;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat EXCLUSION;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat HARD_LIGHT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat HUE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat LIGHTEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat LUMINOSITY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat MODULATE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat MULTIPLY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat OVERLAY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat PLUS;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SATURATION;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SCREEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SOFT_LIGHT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_ATOP;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_IN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_OUT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_OVER;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat XOR;
+ }
+
public final class ColorUtils {
method @ColorInt public static int HSLToColor(float[]);
method @ColorInt public static int LABToColor(@FloatRange(from=0.0f, to=100) double, @FloatRange(from=0xffffff80, to=127) double, @FloatRange(from=0xffffff80, to=127) double);
@@ -993,8 +1061,20 @@
method @ColorInt public static int setAlphaComponent(@ColorInt int, @IntRange(from=0, to=255) int);
}
+ public final class Insets {
+ method public static androidx.core.graphics.Insets of(int, int, int, int);
+ method public static androidx.core.graphics.Insets of(android.graphics.Rect);
+ field public static final androidx.core.graphics.Insets NONE;
+ field public final int bottom;
+ field public final int left;
+ field public final int right;
+ field public final int top;
+ }
+
public final class PaintCompat {
method public static boolean hasGlyph(android.graphics.Paint, String);
+ method public static boolean setBlendMode(android.graphics.Paint, androidx.core.graphics.BlendModeCompat?);
+ method public static boolean setBlendModeColorFilter(android.graphics.Paint, @ColorInt int, androidx.core.graphics.BlendModeCompat?);
}
public final class PathSegment {
@@ -1188,7 +1268,7 @@
method @Deprecated public static boolean isAtLeastO();
method @Deprecated public static boolean isAtLeastOMR1();
method @Deprecated public static boolean isAtLeastP();
- method public static boolean isAtLeastQ();
+ method @Deprecated public static boolean isAtLeastQ();
}
public final class CancellationSignal {
@@ -1962,6 +2042,7 @@
method @Deprecated public static float getScaleX(android.view.View!);
method @Deprecated public static float getScaleY(android.view.View!);
method public static int getScrollIndicators(android.view.View);
+ method public static java.util.List<android.graphics.Rect> getSystemGestureExclusionRects(android.view.View);
method public static String? getTransitionName(android.view.View);
method @Deprecated public static float getTranslationX(android.view.View!);
method @Deprecated public static float getTranslationY(android.view.View!);
@@ -2050,6 +2131,7 @@
method @UiThread public static void setScreenReaderFocusable(android.view.View!, boolean);
method public static void setScrollIndicators(android.view.View, int);
method public static void setScrollIndicators(android.view.View, int, int);
+ method public static void setSystemGestureExclusionRects(android.view.View, java.util.List<android.graphics.Rect>);
method public static void setTooltipText(android.view.View, CharSequence?);
method public static void setTransitionName(android.view.View, String!);
method @Deprecated public static void setTranslationX(android.view.View!, float);
@@ -2211,14 +2293,19 @@
method public androidx.core.view.WindowInsetsCompat! consumeStableInsets();
method public androidx.core.view.WindowInsetsCompat! consumeSystemWindowInsets();
method public androidx.core.view.DisplayCutoutCompat? getDisplayCutout();
+ method public androidx.core.graphics.Insets getMandatorySystemGestureInsets();
method public int getStableInsetBottom();
method public int getStableInsetLeft();
method public int getStableInsetRight();
method public int getStableInsetTop();
+ method public androidx.core.graphics.Insets getStableInsets();
+ method public androidx.core.graphics.Insets getSystemGestureInsets();
method public int getSystemWindowInsetBottom();
method public int getSystemWindowInsetLeft();
method public int getSystemWindowInsetRight();
method public int getSystemWindowInsetTop();
+ method public androidx.core.graphics.Insets getSystemWindowInsets();
+ method public androidx.core.graphics.Insets getTappableElementInsets();
method public boolean hasInsets();
method public boolean hasStableInsets();
method public boolean hasSystemWindowInsets();
@@ -2310,7 +2397,7 @@
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! focusSearch(int);
method public java.util.List<androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat>! getActionList();
method public int getActions();
- method public void getBoundsInParent(android.graphics.Rect!);
+ method @Deprecated public void getBoundsInParent(android.graphics.Rect!);
method public void getBoundsInScreen(android.graphics.Rect!);
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getChild(int);
method public int getChildCount();
@@ -2338,6 +2425,7 @@
method public int getTextSelectionEnd();
method public int getTextSelectionStart();
method public CharSequence? getTooltipText();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat? getTouchDelegateInfo();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalAfter();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalBefore();
method public String! getViewIdResourceName();
@@ -2377,7 +2465,7 @@
method public boolean removeChild(android.view.View!);
method public boolean removeChild(android.view.View!, int);
method public void setAccessibilityFocused(boolean);
- method public void setBoundsInParent(android.graphics.Rect!);
+ method @Deprecated public void setBoundsInParent(android.graphics.Rect!);
method public void setBoundsInScreen(android.graphics.Rect!);
method public void setCanOpenPopup(boolean);
method public void setCheckable(boolean);
@@ -2426,6 +2514,7 @@
method public void setTextEntryKey(boolean);
method public void setTextSelection(int, int);
method public void setTooltipText(CharSequence?);
+ method public void setTouchDelegateInfo(androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat);
method public void setTraversalAfter(android.view.View!);
method public void setTraversalAfter(android.view.View!, int);
method public void setTraversalBefore(android.view.View!);
@@ -2497,6 +2586,10 @@
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_MOVE_WINDOW;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_HTML_ELEMENT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_DOWN;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_LEFT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_RIGHT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_UP;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PASTE;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_HTML_ELEMENT;
@@ -2549,6 +2642,13 @@
field public static final int RANGE_TYPE_PERCENT = 2; // 0x2
}
+ public static final class AccessibilityNodeInfoCompat.TouchDelegateInfoCompat {
+ ctor public AccessibilityNodeInfoCompat.TouchDelegateInfoCompat(java.util.Map<android.graphics.Region,android.view.View>);
+ method public android.graphics.Region? getRegionAt(@IntRange(from=0) int);
+ method @IntRange(from=0) public int getRegionCount();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat? getTargetForRegion(android.graphics.Region);
+ }
+
public class AccessibilityNodeProviderCompat {
ctor public AccessibilityNodeProviderCompat();
ctor public AccessibilityNodeProviderCompat(Object!);
diff --git a/core/api/1.1.0-beta02.txt b/core/api/1.1.0-beta02.txt
index 5f94ab8..6430814 100644
--- a/core/api/1.1.0-beta02.txt
+++ b/core/api/1.1.0-beta02.txt
@@ -180,7 +180,9 @@
ctor @Deprecated public NotificationCompat();
method public static androidx.core.app.NotificationCompat.Action! getAction(android.app.Notification!, int);
method public static int getActionCount(android.app.Notification!);
+ method public static boolean getAllowSystemGeneratedContextualActions(android.app.Notification!);
method public static int getBadgeIconType(android.app.Notification!);
+ method public static androidx.core.app.NotificationCompat.BubbleMetadata? getBubbleMetadata(android.app.Notification);
method public static String! getCategory(android.app.Notification!);
method public static String! getChannelId(android.app.Notification!);
method @RequiresApi(19) public static CharSequence! getContentTitle(android.app.Notification!);
@@ -248,6 +250,7 @@
field public static final String EXTRA_TITLE = "android.title";
field public static final String EXTRA_TITLE_BIG = "android.title.big";
field public static final int FLAG_AUTO_CANCEL = 16; // 0x10
+ field public static final int FLAG_BUBBLE = 4096; // 0x1000
field public static final int FLAG_FOREGROUND_SERVICE = 64; // 0x40
field public static final int FLAG_GROUP_SUMMARY = 512; // 0x200
field @Deprecated public static final int FLAG_HIGH_PRIORITY = 128; // 0x80
@@ -282,6 +285,7 @@
method @androidx.core.app.NotificationCompat.Action.SemanticAction public int getSemanticAction();
method public boolean getShowsUserInterface();
method public CharSequence! getTitle();
+ method public boolean isContextual();
field public static final int SEMANTIC_ACTION_ARCHIVE = 5; // 0x5
field public static final int SEMANTIC_ACTION_CALL = 10; // 0xa
field public static final int SEMANTIC_ACTION_DELETE = 4; // 0x4
@@ -307,6 +311,7 @@
method public androidx.core.app.NotificationCompat.Action.Builder! extend(androidx.core.app.NotificationCompat.Action.Extender!);
method public android.os.Bundle! getExtras();
method public androidx.core.app.NotificationCompat.Action.Builder! setAllowGeneratedReplies(boolean);
+ method public androidx.core.app.NotificationCompat.Action.Builder setContextual(boolean);
method public androidx.core.app.NotificationCompat.Action.Builder! setSemanticAction(@androidx.core.app.NotificationCompat.Action.SemanticAction int);
method public androidx.core.app.NotificationCompat.Action.Builder! setShowsUserInterface(boolean);
}
@@ -354,6 +359,30 @@
method public androidx.core.app.NotificationCompat.BigTextStyle! setSummaryText(CharSequence!);
}
+ public static final class NotificationCompat.BubbleMetadata {
+ method @RequiresApi(29) public static androidx.core.app.NotificationCompat.BubbleMetadata? fromPlatform(android.app.Notification.BubbleMetadata?);
+ method public boolean getAutoExpandBubble();
+ method public android.app.PendingIntent? getDeleteIntent();
+ method @Dimension(unit=androidx.annotation.Dimension.DP) public int getDesiredHeight();
+ method @DimenRes public int getDesiredHeightResId();
+ method public androidx.core.graphics.drawable.IconCompat getIcon();
+ method public android.app.PendingIntent getIntent();
+ method public boolean isNotificationSuppressed();
+ method @RequiresApi(29) public static android.app.Notification.BubbleMetadata? toPlatform(androidx.core.app.NotificationCompat.BubbleMetadata?);
+ }
+
+ public static final class NotificationCompat.BubbleMetadata.Builder {
+ ctor public NotificationCompat.BubbleMetadata.Builder();
+ method public androidx.core.app.NotificationCompat.BubbleMetadata build();
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setAutoExpandBubble(boolean);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDeleteIntent(android.app.PendingIntent?);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDesiredHeight(@Dimension(unit=androidx.annotation.Dimension.DP) int);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDesiredHeightResId(@DimenRes int);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setIcon(androidx.core.graphics.drawable.IconCompat);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setIntent(android.app.PendingIntent);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setSuppressNotification(boolean);
+ }
+
public static class NotificationCompat.Builder {
ctor public NotificationCompat.Builder(android.content.Context, String);
ctor @Deprecated public NotificationCompat.Builder(android.content.Context!);
@@ -368,8 +397,10 @@
method public android.os.Bundle! getExtras();
method @Deprecated public android.app.Notification! getNotification();
method protected static CharSequence! limitCharSequenceLength(CharSequence!);
+ method public androidx.core.app.NotificationCompat.Builder setAllowSystemGeneratedContextualActions(boolean);
method public androidx.core.app.NotificationCompat.Builder! setAutoCancel(boolean);
method public androidx.core.app.NotificationCompat.Builder! setBadgeIconType(int);
+ method public androidx.core.app.NotificationCompat.Builder setBubbleMetadata(androidx.core.app.NotificationCompat.BubbleMetadata?);
method public androidx.core.app.NotificationCompat.Builder! setCategory(String!);
method public androidx.core.app.NotificationCompat.Builder! setChannelId(String);
method public androidx.core.app.NotificationCompat.Builder! setColor(@ColorInt int);
@@ -655,6 +686,7 @@
method public java.util.Set<java.lang.String>! getAllowedDataTypes();
method public CharSequence[]! getChoices();
method public static java.util.Map<java.lang.String,android.net.Uri>! getDataResultsFromIntent(android.content.Intent!, String!);
+ method public int getEditChoicesBeforeSending();
method public android.os.Bundle! getExtras();
method public CharSequence! getLabel();
method public String! getResultKey();
@@ -662,6 +694,9 @@
method public static int getResultsSource(android.content.Intent);
method public boolean isDataOnly();
method public static void setResultsSource(android.content.Intent, int);
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_AUTO = 0; // 0x0
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_DISABLED = 1; // 0x1
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_ENABLED = 2; // 0x2
field public static final String EXTRA_RESULTS_DATA = "android.remoteinput.resultsData";
field public static final String RESULTS_CLIP_LABEL = "android.remoteinput.results";
field public static final int SOURCE_CHOICE = 1; // 0x1
@@ -676,6 +711,7 @@
method public androidx.core.app.RemoteInput.Builder setAllowDataType(String, boolean);
method public androidx.core.app.RemoteInput.Builder setAllowFreeFormInput(boolean);
method public androidx.core.app.RemoteInput.Builder setChoices(CharSequence[]?);
+ method public androidx.core.app.RemoteInput.Builder setEditChoicesBeforeSending(int);
method public androidx.core.app.RemoteInput.Builder setLabel(CharSequence?);
}
@@ -969,6 +1005,38 @@
method public static void setHasMipMap(android.graphics.Bitmap, boolean);
}
+ public enum BlendModeCompat {
+ enum_constant public static final androidx.core.graphics.BlendModeCompat CLEAR;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR_BURN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR_DODGE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DARKEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DIFFERENCE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_ATOP;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_IN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_OUT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_OVER;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat EXCLUSION;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat HARD_LIGHT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat HUE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat LIGHTEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat LUMINOSITY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat MODULATE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat MULTIPLY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat OVERLAY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat PLUS;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SATURATION;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SCREEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SOFT_LIGHT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_ATOP;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_IN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_OUT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_OVER;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat XOR;
+ }
+
public final class ColorUtils {
method @ColorInt public static int HSLToColor(float[]);
method @ColorInt public static int LABToColor(@FloatRange(from=0.0f, to=100) double, @FloatRange(from=0xffffff80, to=127) double, @FloatRange(from=0xffffff80, to=127) double);
@@ -993,8 +1061,20 @@
method @ColorInt public static int setAlphaComponent(@ColorInt int, @IntRange(from=0, to=255) int);
}
+ public final class Insets {
+ method public static androidx.core.graphics.Insets of(int, int, int, int);
+ method public static androidx.core.graphics.Insets of(android.graphics.Rect);
+ field public static final androidx.core.graphics.Insets NONE;
+ field public final int bottom;
+ field public final int left;
+ field public final int right;
+ field public final int top;
+ }
+
public final class PaintCompat {
method public static boolean hasGlyph(android.graphics.Paint, String);
+ method public static boolean setBlendMode(android.graphics.Paint, androidx.core.graphics.BlendModeCompat?);
+ method public static boolean setBlendModeColorFilter(android.graphics.Paint, @ColorInt int, androidx.core.graphics.BlendModeCompat?);
}
public final class PathSegment {
@@ -1188,7 +1268,7 @@
method @Deprecated public static boolean isAtLeastO();
method @Deprecated public static boolean isAtLeastOMR1();
method @Deprecated public static boolean isAtLeastP();
- method public static boolean isAtLeastQ();
+ method @Deprecated public static boolean isAtLeastQ();
}
public final class CancellationSignal {
@@ -1962,6 +2042,7 @@
method @Deprecated public static float getScaleX(android.view.View!);
method @Deprecated public static float getScaleY(android.view.View!);
method public static int getScrollIndicators(android.view.View);
+ method public static java.util.List<android.graphics.Rect> getSystemGestureExclusionRects(android.view.View);
method public static String? getTransitionName(android.view.View);
method @Deprecated public static float getTranslationX(android.view.View!);
method @Deprecated public static float getTranslationY(android.view.View!);
@@ -2050,6 +2131,7 @@
method @UiThread public static void setScreenReaderFocusable(android.view.View!, boolean);
method public static void setScrollIndicators(android.view.View, int);
method public static void setScrollIndicators(android.view.View, int, int);
+ method public static void setSystemGestureExclusionRects(android.view.View, java.util.List<android.graphics.Rect>);
method public static void setTooltipText(android.view.View, CharSequence?);
method public static void setTransitionName(android.view.View, String!);
method @Deprecated public static void setTranslationX(android.view.View!, float);
@@ -2211,14 +2293,19 @@
method public androidx.core.view.WindowInsetsCompat! consumeStableInsets();
method public androidx.core.view.WindowInsetsCompat! consumeSystemWindowInsets();
method public androidx.core.view.DisplayCutoutCompat? getDisplayCutout();
+ method public androidx.core.graphics.Insets getMandatorySystemGestureInsets();
method public int getStableInsetBottom();
method public int getStableInsetLeft();
method public int getStableInsetRight();
method public int getStableInsetTop();
+ method public androidx.core.graphics.Insets getStableInsets();
+ method public androidx.core.graphics.Insets getSystemGestureInsets();
method public int getSystemWindowInsetBottom();
method public int getSystemWindowInsetLeft();
method public int getSystemWindowInsetRight();
method public int getSystemWindowInsetTop();
+ method public androidx.core.graphics.Insets getSystemWindowInsets();
+ method public androidx.core.graphics.Insets getTappableElementInsets();
method public boolean hasInsets();
method public boolean hasStableInsets();
method public boolean hasSystemWindowInsets();
@@ -2310,7 +2397,7 @@
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! focusSearch(int);
method public java.util.List<androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat>! getActionList();
method public int getActions();
- method public void getBoundsInParent(android.graphics.Rect!);
+ method @Deprecated public void getBoundsInParent(android.graphics.Rect!);
method public void getBoundsInScreen(android.graphics.Rect!);
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getChild(int);
method public int getChildCount();
@@ -2338,6 +2425,7 @@
method public int getTextSelectionEnd();
method public int getTextSelectionStart();
method public CharSequence? getTooltipText();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat? getTouchDelegateInfo();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalAfter();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalBefore();
method public String! getViewIdResourceName();
@@ -2377,7 +2465,7 @@
method public boolean removeChild(android.view.View!);
method public boolean removeChild(android.view.View!, int);
method public void setAccessibilityFocused(boolean);
- method public void setBoundsInParent(android.graphics.Rect!);
+ method @Deprecated public void setBoundsInParent(android.graphics.Rect!);
method public void setBoundsInScreen(android.graphics.Rect!);
method public void setCanOpenPopup(boolean);
method public void setCheckable(boolean);
@@ -2426,6 +2514,7 @@
method public void setTextEntryKey(boolean);
method public void setTextSelection(int, int);
method public void setTooltipText(CharSequence?);
+ method public void setTouchDelegateInfo(androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat);
method public void setTraversalAfter(android.view.View!);
method public void setTraversalAfter(android.view.View!, int);
method public void setTraversalBefore(android.view.View!);
@@ -2497,6 +2586,10 @@
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_MOVE_WINDOW;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_HTML_ELEMENT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_DOWN;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_LEFT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_RIGHT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_UP;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PASTE;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_HTML_ELEMENT;
@@ -2549,6 +2642,13 @@
field public static final int RANGE_TYPE_PERCENT = 2; // 0x2
}
+ public static final class AccessibilityNodeInfoCompat.TouchDelegateInfoCompat {
+ ctor public AccessibilityNodeInfoCompat.TouchDelegateInfoCompat(java.util.Map<android.graphics.Region,android.view.View>);
+ method public android.graphics.Region? getRegionAt(@IntRange(from=0) int);
+ method @IntRange(from=0) public int getRegionCount();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat? getTargetForRegion(android.graphics.Region);
+ }
+
public class AccessibilityNodeProviderCompat {
ctor public AccessibilityNodeProviderCompat();
ctor public AccessibilityNodeProviderCompat(Object!);
diff --git a/core/api/current.txt b/core/api/current.txt
index 5f94ab8..6430814 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -180,7 +180,9 @@
ctor @Deprecated public NotificationCompat();
method public static androidx.core.app.NotificationCompat.Action! getAction(android.app.Notification!, int);
method public static int getActionCount(android.app.Notification!);
+ method public static boolean getAllowSystemGeneratedContextualActions(android.app.Notification!);
method public static int getBadgeIconType(android.app.Notification!);
+ method public static androidx.core.app.NotificationCompat.BubbleMetadata? getBubbleMetadata(android.app.Notification);
method public static String! getCategory(android.app.Notification!);
method public static String! getChannelId(android.app.Notification!);
method @RequiresApi(19) public static CharSequence! getContentTitle(android.app.Notification!);
@@ -248,6 +250,7 @@
field public static final String EXTRA_TITLE = "android.title";
field public static final String EXTRA_TITLE_BIG = "android.title.big";
field public static final int FLAG_AUTO_CANCEL = 16; // 0x10
+ field public static final int FLAG_BUBBLE = 4096; // 0x1000
field public static final int FLAG_FOREGROUND_SERVICE = 64; // 0x40
field public static final int FLAG_GROUP_SUMMARY = 512; // 0x200
field @Deprecated public static final int FLAG_HIGH_PRIORITY = 128; // 0x80
@@ -282,6 +285,7 @@
method @androidx.core.app.NotificationCompat.Action.SemanticAction public int getSemanticAction();
method public boolean getShowsUserInterface();
method public CharSequence! getTitle();
+ method public boolean isContextual();
field public static final int SEMANTIC_ACTION_ARCHIVE = 5; // 0x5
field public static final int SEMANTIC_ACTION_CALL = 10; // 0xa
field public static final int SEMANTIC_ACTION_DELETE = 4; // 0x4
@@ -307,6 +311,7 @@
method public androidx.core.app.NotificationCompat.Action.Builder! extend(androidx.core.app.NotificationCompat.Action.Extender!);
method public android.os.Bundle! getExtras();
method public androidx.core.app.NotificationCompat.Action.Builder! setAllowGeneratedReplies(boolean);
+ method public androidx.core.app.NotificationCompat.Action.Builder setContextual(boolean);
method public androidx.core.app.NotificationCompat.Action.Builder! setSemanticAction(@androidx.core.app.NotificationCompat.Action.SemanticAction int);
method public androidx.core.app.NotificationCompat.Action.Builder! setShowsUserInterface(boolean);
}
@@ -354,6 +359,30 @@
method public androidx.core.app.NotificationCompat.BigTextStyle! setSummaryText(CharSequence!);
}
+ public static final class NotificationCompat.BubbleMetadata {
+ method @RequiresApi(29) public static androidx.core.app.NotificationCompat.BubbleMetadata? fromPlatform(android.app.Notification.BubbleMetadata?);
+ method public boolean getAutoExpandBubble();
+ method public android.app.PendingIntent? getDeleteIntent();
+ method @Dimension(unit=androidx.annotation.Dimension.DP) public int getDesiredHeight();
+ method @DimenRes public int getDesiredHeightResId();
+ method public androidx.core.graphics.drawable.IconCompat getIcon();
+ method public android.app.PendingIntent getIntent();
+ method public boolean isNotificationSuppressed();
+ method @RequiresApi(29) public static android.app.Notification.BubbleMetadata? toPlatform(androidx.core.app.NotificationCompat.BubbleMetadata?);
+ }
+
+ public static final class NotificationCompat.BubbleMetadata.Builder {
+ ctor public NotificationCompat.BubbleMetadata.Builder();
+ method public androidx.core.app.NotificationCompat.BubbleMetadata build();
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setAutoExpandBubble(boolean);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDeleteIntent(android.app.PendingIntent?);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDesiredHeight(@Dimension(unit=androidx.annotation.Dimension.DP) int);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setDesiredHeightResId(@DimenRes int);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setIcon(androidx.core.graphics.drawable.IconCompat);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setIntent(android.app.PendingIntent);
+ method public androidx.core.app.NotificationCompat.BubbleMetadata.Builder setSuppressNotification(boolean);
+ }
+
public static class NotificationCompat.Builder {
ctor public NotificationCompat.Builder(android.content.Context, String);
ctor @Deprecated public NotificationCompat.Builder(android.content.Context!);
@@ -368,8 +397,10 @@
method public android.os.Bundle! getExtras();
method @Deprecated public android.app.Notification! getNotification();
method protected static CharSequence! limitCharSequenceLength(CharSequence!);
+ method public androidx.core.app.NotificationCompat.Builder setAllowSystemGeneratedContextualActions(boolean);
method public androidx.core.app.NotificationCompat.Builder! setAutoCancel(boolean);
method public androidx.core.app.NotificationCompat.Builder! setBadgeIconType(int);
+ method public androidx.core.app.NotificationCompat.Builder setBubbleMetadata(androidx.core.app.NotificationCompat.BubbleMetadata?);
method public androidx.core.app.NotificationCompat.Builder! setCategory(String!);
method public androidx.core.app.NotificationCompat.Builder! setChannelId(String);
method public androidx.core.app.NotificationCompat.Builder! setColor(@ColorInt int);
@@ -655,6 +686,7 @@
method public java.util.Set<java.lang.String>! getAllowedDataTypes();
method public CharSequence[]! getChoices();
method public static java.util.Map<java.lang.String,android.net.Uri>! getDataResultsFromIntent(android.content.Intent!, String!);
+ method public int getEditChoicesBeforeSending();
method public android.os.Bundle! getExtras();
method public CharSequence! getLabel();
method public String! getResultKey();
@@ -662,6 +694,9 @@
method public static int getResultsSource(android.content.Intent);
method public boolean isDataOnly();
method public static void setResultsSource(android.content.Intent, int);
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_AUTO = 0; // 0x0
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_DISABLED = 1; // 0x1
+ field public static final int EDIT_CHOICES_BEFORE_SENDING_ENABLED = 2; // 0x2
field public static final String EXTRA_RESULTS_DATA = "android.remoteinput.resultsData";
field public static final String RESULTS_CLIP_LABEL = "android.remoteinput.results";
field public static final int SOURCE_CHOICE = 1; // 0x1
@@ -676,6 +711,7 @@
method public androidx.core.app.RemoteInput.Builder setAllowDataType(String, boolean);
method public androidx.core.app.RemoteInput.Builder setAllowFreeFormInput(boolean);
method public androidx.core.app.RemoteInput.Builder setChoices(CharSequence[]?);
+ method public androidx.core.app.RemoteInput.Builder setEditChoicesBeforeSending(int);
method public androidx.core.app.RemoteInput.Builder setLabel(CharSequence?);
}
@@ -969,6 +1005,38 @@
method public static void setHasMipMap(android.graphics.Bitmap, boolean);
}
+ public enum BlendModeCompat {
+ enum_constant public static final androidx.core.graphics.BlendModeCompat CLEAR;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR_BURN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat COLOR_DODGE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DARKEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DIFFERENCE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_ATOP;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_IN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_OUT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat DST_OVER;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat EXCLUSION;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat HARD_LIGHT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat HUE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat LIGHTEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat LUMINOSITY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat MODULATE;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat MULTIPLY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat OVERLAY;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat PLUS;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SATURATION;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SCREEN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SOFT_LIGHT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_ATOP;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_IN;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_OUT;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat SRC_OVER;
+ enum_constant public static final androidx.core.graphics.BlendModeCompat XOR;
+ }
+
public final class ColorUtils {
method @ColorInt public static int HSLToColor(float[]);
method @ColorInt public static int LABToColor(@FloatRange(from=0.0f, to=100) double, @FloatRange(from=0xffffff80, to=127) double, @FloatRange(from=0xffffff80, to=127) double);
@@ -993,8 +1061,20 @@
method @ColorInt public static int setAlphaComponent(@ColorInt int, @IntRange(from=0, to=255) int);
}
+ public final class Insets {
+ method public static androidx.core.graphics.Insets of(int, int, int, int);
+ method public static androidx.core.graphics.Insets of(android.graphics.Rect);
+ field public static final androidx.core.graphics.Insets NONE;
+ field public final int bottom;
+ field public final int left;
+ field public final int right;
+ field public final int top;
+ }
+
public final class PaintCompat {
method public static boolean hasGlyph(android.graphics.Paint, String);
+ method public static boolean setBlendMode(android.graphics.Paint, androidx.core.graphics.BlendModeCompat?);
+ method public static boolean setBlendModeColorFilter(android.graphics.Paint, @ColorInt int, androidx.core.graphics.BlendModeCompat?);
}
public final class PathSegment {
@@ -1188,7 +1268,7 @@
method @Deprecated public static boolean isAtLeastO();
method @Deprecated public static boolean isAtLeastOMR1();
method @Deprecated public static boolean isAtLeastP();
- method public static boolean isAtLeastQ();
+ method @Deprecated public static boolean isAtLeastQ();
}
public final class CancellationSignal {
@@ -1962,6 +2042,7 @@
method @Deprecated public static float getScaleX(android.view.View!);
method @Deprecated public static float getScaleY(android.view.View!);
method public static int getScrollIndicators(android.view.View);
+ method public static java.util.List<android.graphics.Rect> getSystemGestureExclusionRects(android.view.View);
method public static String? getTransitionName(android.view.View);
method @Deprecated public static float getTranslationX(android.view.View!);
method @Deprecated public static float getTranslationY(android.view.View!);
@@ -2050,6 +2131,7 @@
method @UiThread public static void setScreenReaderFocusable(android.view.View!, boolean);
method public static void setScrollIndicators(android.view.View, int);
method public static void setScrollIndicators(android.view.View, int, int);
+ method public static void setSystemGestureExclusionRects(android.view.View, java.util.List<android.graphics.Rect>);
method public static void setTooltipText(android.view.View, CharSequence?);
method public static void setTransitionName(android.view.View, String!);
method @Deprecated public static void setTranslationX(android.view.View!, float);
@@ -2211,14 +2293,19 @@
method public androidx.core.view.WindowInsetsCompat! consumeStableInsets();
method public androidx.core.view.WindowInsetsCompat! consumeSystemWindowInsets();
method public androidx.core.view.DisplayCutoutCompat? getDisplayCutout();
+ method public androidx.core.graphics.Insets getMandatorySystemGestureInsets();
method public int getStableInsetBottom();
method public int getStableInsetLeft();
method public int getStableInsetRight();
method public int getStableInsetTop();
+ method public androidx.core.graphics.Insets getStableInsets();
+ method public androidx.core.graphics.Insets getSystemGestureInsets();
method public int getSystemWindowInsetBottom();
method public int getSystemWindowInsetLeft();
method public int getSystemWindowInsetRight();
method public int getSystemWindowInsetTop();
+ method public androidx.core.graphics.Insets getSystemWindowInsets();
+ method public androidx.core.graphics.Insets getTappableElementInsets();
method public boolean hasInsets();
method public boolean hasStableInsets();
method public boolean hasSystemWindowInsets();
@@ -2310,7 +2397,7 @@
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! focusSearch(int);
method public java.util.List<androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat>! getActionList();
method public int getActions();
- method public void getBoundsInParent(android.graphics.Rect!);
+ method @Deprecated public void getBoundsInParent(android.graphics.Rect!);
method public void getBoundsInScreen(android.graphics.Rect!);
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getChild(int);
method public int getChildCount();
@@ -2338,6 +2425,7 @@
method public int getTextSelectionEnd();
method public int getTextSelectionStart();
method public CharSequence? getTooltipText();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat? getTouchDelegateInfo();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalAfter();
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat! getTraversalBefore();
method public String! getViewIdResourceName();
@@ -2377,7 +2465,7 @@
method public boolean removeChild(android.view.View!);
method public boolean removeChild(android.view.View!, int);
method public void setAccessibilityFocused(boolean);
- method public void setBoundsInParent(android.graphics.Rect!);
+ method @Deprecated public void setBoundsInParent(android.graphics.Rect!);
method public void setBoundsInScreen(android.graphics.Rect!);
method public void setCanOpenPopup(boolean);
method public void setCheckable(boolean);
@@ -2426,6 +2514,7 @@
method public void setTextEntryKey(boolean);
method public void setTextSelection(int, int);
method public void setTooltipText(CharSequence?);
+ method public void setTouchDelegateInfo(androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat);
method public void setTraversalAfter(android.view.View!);
method public void setTraversalAfter(android.view.View!, int);
method public void setTraversalBefore(android.view.View!);
@@ -2497,6 +2586,10 @@
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_MOVE_WINDOW;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_NEXT_HTML_ELEMENT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_DOWN;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_LEFT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_RIGHT;
+ field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PAGE_UP;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PASTE;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY;
field public static final androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat! ACTION_PREVIOUS_HTML_ELEMENT;
@@ -2549,6 +2642,13 @@
field public static final int RANGE_TYPE_PERCENT = 2; // 0x2
}
+ public static final class AccessibilityNodeInfoCompat.TouchDelegateInfoCompat {
+ ctor public AccessibilityNodeInfoCompat.TouchDelegateInfoCompat(java.util.Map<android.graphics.Region,android.view.View>);
+ method public android.graphics.Region? getRegionAt(@IntRange(from=0) int);
+ method @IntRange(from=0) public int getRegionCount();
+ method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat? getTargetForRegion(android.graphics.Region);
+ }
+
public class AccessibilityNodeProviderCompat {
ctor public AccessibilityNodeProviderCompat();
ctor public AccessibilityNodeProviderCompat(Object!);
diff --git a/core/api/restricted_1.1.0-alpha05.txt b/core/api/restricted_1.1.0-alpha05.txt
index 5baf105..87a5dd5 100644
--- a/core/api/restricted_1.1.0-alpha05.txt
+++ b/core/api/restricted_1.1.0-alpha05.txt
@@ -255,6 +255,15 @@
method public android.graphics.Typeface? createFromResourcesFontFile(android.content.Context!, android.content.res.Resources!, int, String!, int);
}
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) @RequiresApi(29) public class TypefaceCompatApi29Impl {
+ ctor public TypefaceCompatApi29Impl();
+ method public android.graphics.Typeface? createFromFontFamilyFilesResourceEntry(android.content.Context!, androidx.core.content.res.FontResourcesParserCompat.FontFamilyFilesResourceEntry!, android.content.res.Resources!, int);
+ method public android.graphics.Typeface? createFromFontInfo(android.content.Context!, android.os.CancellationSignal?, androidx.core.provider.FontsContractCompat.FontInfo[], int);
+ method protected android.graphics.Typeface! createFromInputStream(android.content.Context!, java.io.InputStream!);
+ method public android.graphics.Typeface? createFromResourcesFontFile(android.content.Context!, android.content.res.Resources!, int, String!, int);
+ method protected androidx.core.provider.FontsContractCompat.FontInfo! findBestInfo(androidx.core.provider.FontsContractCompat.FontInfo[]!, int);
+ }
+
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class TypefaceCompatUtil {
method public static void closeQuietly(java.io.Closeable!);
method @RequiresApi(19) public static java.nio.ByteBuffer? copyToDirectBuffer(android.content.Context!, android.content.res.Resources!, int);
diff --git a/core/api/restricted_1.1.0-alpha06.txt b/core/api/restricted_1.1.0-alpha06.txt
index 9e62cfa..2703a22 100644
--- a/core/api/restricted_1.1.0-alpha06.txt
+++ b/core/api/restricted_1.1.0-alpha06.txt
@@ -51,8 +51,13 @@
@IntDef({androidx.core.app.NotificationCompat.BADGE_ICON_NONE, androidx.core.app.NotificationCompat.BADGE_ICON_SMALL, androidx.core.app.NotificationCompat.BADGE_ICON_LARGE}) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface NotificationCompat.BadgeIconType {
}
+ public static final class NotificationCompat.BubbleMetadata.Builder {
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.core.app.NotificationCompat.BubbleMetadata.Builder! setFlag(int, boolean);
+ }
+
public static class NotificationCompat.Builder {
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getBigContentView();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.core.app.NotificationCompat.BubbleMetadata! getBubbleMetadata();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public int getColor();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getContentView();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getHeadsUpContentView();
@@ -101,6 +106,9 @@
field @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public CharSequence! mTitle;
}
+ @IntDef({androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO, androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_DISABLED, androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_ENABLED}) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface RemoteInput.EditChoicesBeforeSending {
+ }
+
@IntDef({androidx.core.app.RemoteInput.SOURCE_FREE_FORM_INPUT, androidx.core.app.RemoteInput.SOURCE_CHOICE}) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface RemoteInput.Source {
}
@@ -229,6 +237,10 @@
package androidx.core.graphics {
+ public final class Insets {
+ method @RequiresApi(api=29) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static androidx.core.graphics.Insets wrap(android.graphics.Insets);
+ }
+
public class TypefaceCompat {
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static android.graphics.Typeface? createFromFontInfo(android.content.Context, android.os.CancellationSignal?, androidx.core.provider.FontsContractCompat.FontInfo[], int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static android.graphics.Typeface? createFromResourcesFamilyXml(android.content.Context, androidx.core.content.res.FontResourcesParserCompat.FamilyResourceEntry, android.content.res.Resources, int, int, androidx.core.content.res.ResourcesCompat.FontCallback?, android.os.Handler?, boolean);
@@ -265,6 +277,15 @@
method public android.graphics.Typeface? createFromResourcesFontFile(android.content.Context!, android.content.res.Resources!, int, String!, int);
}
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) @RequiresApi(29) public class TypefaceCompatApi29Impl {
+ ctor public TypefaceCompatApi29Impl();
+ method public android.graphics.Typeface? createFromFontFamilyFilesResourceEntry(android.content.Context!, androidx.core.content.res.FontResourcesParserCompat.FontFamilyFilesResourceEntry!, android.content.res.Resources!, int);
+ method public android.graphics.Typeface? createFromFontInfo(android.content.Context!, android.os.CancellationSignal?, androidx.core.provider.FontsContractCompat.FontInfo[], int);
+ method protected android.graphics.Typeface! createFromInputStream(android.content.Context!, java.io.InputStream!);
+ method public android.graphics.Typeface? createFromResourcesFontFile(android.content.Context!, android.content.res.Resources!, int, String!, int);
+ method protected androidx.core.provider.FontsContractCompat.FontInfo! findBestInfo(androidx.core.provider.FontsContractCompat.FontInfo[]!, int);
+ }
+
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class TypefaceCompatUtil {
method public static void closeQuietly(java.io.Closeable!);
method @RequiresApi(19) public static java.nio.ByteBuffer? copyToDirectBuffer(android.content.Context!, android.content.res.Resources!, int);
diff --git a/core/api/restricted_1.1.0-alpha07.txt b/core/api/restricted_1.1.0-alpha07.txt
index 42f68c4..342f675 100644
--- a/core/api/restricted_1.1.0-alpha07.txt
+++ b/core/api/restricted_1.1.0-alpha07.txt
@@ -51,8 +51,13 @@
@IntDef({androidx.core.app.NotificationCompat.BADGE_ICON_NONE, androidx.core.app.NotificationCompat.BADGE_ICON_SMALL, androidx.core.app.NotificationCompat.BADGE_ICON_LARGE}) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface NotificationCompat.BadgeIconType {
}
+ public static final class NotificationCompat.BubbleMetadata.Builder {
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.core.app.NotificationCompat.BubbleMetadata.Builder! setFlag(int, boolean);
+ }
+
public static class NotificationCompat.Builder {
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getBigContentView();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.core.app.NotificationCompat.BubbleMetadata! getBubbleMetadata();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public int getColor();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getContentView();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getHeadsUpContentView();
@@ -101,6 +106,9 @@
field @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public CharSequence! mTitle;
}
+ @IntDef({androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO, androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_DISABLED, androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_ENABLED}) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface RemoteInput.EditChoicesBeforeSending {
+ }
+
@IntDef({androidx.core.app.RemoteInput.SOURCE_FREE_FORM_INPUT, androidx.core.app.RemoteInput.SOURCE_CHOICE}) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface RemoteInput.Source {
}
@@ -229,6 +237,10 @@
package androidx.core.graphics {
+ public final class Insets {
+ method @RequiresApi(api=29) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static androidx.core.graphics.Insets wrap(android.graphics.Insets);
+ }
+
public class TypefaceCompat {
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static android.graphics.Typeface? createFromFontInfo(android.content.Context, android.os.CancellationSignal?, androidx.core.provider.FontsContractCompat.FontInfo[], int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static android.graphics.Typeface? createFromResourcesFamilyXml(android.content.Context, androidx.core.content.res.FontResourcesParserCompat.FamilyResourceEntry, android.content.res.Resources, int, int, androidx.core.content.res.ResourcesCompat.FontCallback?, android.os.Handler?, boolean);
@@ -265,6 +277,15 @@
method public android.graphics.Typeface? createFromResourcesFontFile(android.content.Context!, android.content.res.Resources!, int, String!, int);
}
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) @RequiresApi(29) public class TypefaceCompatApi29Impl {
+ ctor public TypefaceCompatApi29Impl();
+ method public android.graphics.Typeface? createFromFontFamilyFilesResourceEntry(android.content.Context!, androidx.core.content.res.FontResourcesParserCompat.FontFamilyFilesResourceEntry!, android.content.res.Resources!, int);
+ method public android.graphics.Typeface? createFromFontInfo(android.content.Context!, android.os.CancellationSignal?, androidx.core.provider.FontsContractCompat.FontInfo[], int);
+ method protected android.graphics.Typeface! createFromInputStream(android.content.Context!, java.io.InputStream!);
+ method public android.graphics.Typeface? createFromResourcesFontFile(android.content.Context!, android.content.res.Resources!, int, String!, int);
+ method protected androidx.core.provider.FontsContractCompat.FontInfo! findBestInfo(androidx.core.provider.FontsContractCompat.FontInfo[]!, int);
+ }
+
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class TypefaceCompatUtil {
method public static void closeQuietly(java.io.Closeable!);
method @RequiresApi(19) public static java.nio.ByteBuffer? copyToDirectBuffer(android.content.Context!, android.content.res.Resources!, int);
diff --git a/core/api/restricted_1.1.0-beta01.txt b/core/api/restricted_1.1.0-beta01.txt
index 42f68c4..2f9f4ad4 100644
--- a/core/api/restricted_1.1.0-beta01.txt
+++ b/core/api/restricted_1.1.0-beta01.txt
@@ -53,6 +53,7 @@
public static class NotificationCompat.Builder {
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getBigContentView();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.core.app.NotificationCompat.BubbleMetadata? getBubbleMetadata();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public int getColor();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getContentView();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getHeadsUpContentView();
@@ -101,6 +102,9 @@
field @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public CharSequence! mTitle;
}
+ @IntDef({androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO, androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_DISABLED, androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_ENABLED}) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface RemoteInput.EditChoicesBeforeSending {
+ }
+
@IntDef({androidx.core.app.RemoteInput.SOURCE_FREE_FORM_INPUT, androidx.core.app.RemoteInput.SOURCE_CHOICE}) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface RemoteInput.Source {
}
@@ -229,6 +233,10 @@
package androidx.core.graphics {
+ public final class Insets {
+ method @RequiresApi(api=29) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static androidx.core.graphics.Insets wrap(android.graphics.Insets);
+ }
+
public class TypefaceCompat {
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static android.graphics.Typeface? createFromFontInfo(android.content.Context, android.os.CancellationSignal?, androidx.core.provider.FontsContractCompat.FontInfo[], int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static android.graphics.Typeface? createFromResourcesFamilyXml(android.content.Context, androidx.core.content.res.FontResourcesParserCompat.FamilyResourceEntry, android.content.res.Resources, int, int, androidx.core.content.res.ResourcesCompat.FontCallback?, android.os.Handler?, boolean);
@@ -265,6 +273,15 @@
method public android.graphics.Typeface? createFromResourcesFontFile(android.content.Context!, android.content.res.Resources!, int, String!, int);
}
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) @RequiresApi(29) public class TypefaceCompatApi29Impl {
+ ctor public TypefaceCompatApi29Impl();
+ method public android.graphics.Typeface? createFromFontFamilyFilesResourceEntry(android.content.Context!, androidx.core.content.res.FontResourcesParserCompat.FontFamilyFilesResourceEntry!, android.content.res.Resources!, int);
+ method public android.graphics.Typeface? createFromFontInfo(android.content.Context!, android.os.CancellationSignal?, androidx.core.provider.FontsContractCompat.FontInfo[], int);
+ method protected android.graphics.Typeface! createFromInputStream(android.content.Context!, java.io.InputStream!);
+ method public android.graphics.Typeface? createFromResourcesFontFile(android.content.Context!, android.content.res.Resources!, int, String!, int);
+ method protected androidx.core.provider.FontsContractCompat.FontInfo! findBestInfo(androidx.core.provider.FontsContractCompat.FontInfo[]!, int);
+ }
+
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class TypefaceCompatUtil {
method public static void closeQuietly(java.io.Closeable!);
method @RequiresApi(19) public static java.nio.ByteBuffer? copyToDirectBuffer(android.content.Context!, android.content.res.Resources!, int);
diff --git a/core/api/restricted_1.1.0-beta02.txt b/core/api/restricted_1.1.0-beta02.txt
index 42f68c4..2f9f4ad4 100644
--- a/core/api/restricted_1.1.0-beta02.txt
+++ b/core/api/restricted_1.1.0-beta02.txt
@@ -53,6 +53,7 @@
public static class NotificationCompat.Builder {
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getBigContentView();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.core.app.NotificationCompat.BubbleMetadata? getBubbleMetadata();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public int getColor();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getContentView();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getHeadsUpContentView();
@@ -101,6 +102,9 @@
field @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public CharSequence! mTitle;
}
+ @IntDef({androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO, androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_DISABLED, androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_ENABLED}) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface RemoteInput.EditChoicesBeforeSending {
+ }
+
@IntDef({androidx.core.app.RemoteInput.SOURCE_FREE_FORM_INPUT, androidx.core.app.RemoteInput.SOURCE_CHOICE}) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface RemoteInput.Source {
}
@@ -229,6 +233,10 @@
package androidx.core.graphics {
+ public final class Insets {
+ method @RequiresApi(api=29) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static androidx.core.graphics.Insets wrap(android.graphics.Insets);
+ }
+
public class TypefaceCompat {
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static android.graphics.Typeface? createFromFontInfo(android.content.Context, android.os.CancellationSignal?, androidx.core.provider.FontsContractCompat.FontInfo[], int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static android.graphics.Typeface? createFromResourcesFamilyXml(android.content.Context, androidx.core.content.res.FontResourcesParserCompat.FamilyResourceEntry, android.content.res.Resources, int, int, androidx.core.content.res.ResourcesCompat.FontCallback?, android.os.Handler?, boolean);
@@ -265,6 +273,15 @@
method public android.graphics.Typeface? createFromResourcesFontFile(android.content.Context!, android.content.res.Resources!, int, String!, int);
}
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) @RequiresApi(29) public class TypefaceCompatApi29Impl {
+ ctor public TypefaceCompatApi29Impl();
+ method public android.graphics.Typeface? createFromFontFamilyFilesResourceEntry(android.content.Context!, androidx.core.content.res.FontResourcesParserCompat.FontFamilyFilesResourceEntry!, android.content.res.Resources!, int);
+ method public android.graphics.Typeface? createFromFontInfo(android.content.Context!, android.os.CancellationSignal?, androidx.core.provider.FontsContractCompat.FontInfo[], int);
+ method protected android.graphics.Typeface! createFromInputStream(android.content.Context!, java.io.InputStream!);
+ method public android.graphics.Typeface? createFromResourcesFontFile(android.content.Context!, android.content.res.Resources!, int, String!, int);
+ method protected androidx.core.provider.FontsContractCompat.FontInfo! findBestInfo(androidx.core.provider.FontsContractCompat.FontInfo[]!, int);
+ }
+
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class TypefaceCompatUtil {
method public static void closeQuietly(java.io.Closeable!);
method @RequiresApi(19) public static java.nio.ByteBuffer? copyToDirectBuffer(android.content.Context!, android.content.res.Resources!, int);
diff --git a/core/api/restricted_current.txt b/core/api/restricted_current.txt
index 42f68c4..2f9f4ad4 100644
--- a/core/api/restricted_current.txt
+++ b/core/api/restricted_current.txt
@@ -53,6 +53,7 @@
public static class NotificationCompat.Builder {
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getBigContentView();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.core.app.NotificationCompat.BubbleMetadata? getBubbleMetadata();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public int getColor();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getContentView();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.widget.RemoteViews! getHeadsUpContentView();
@@ -101,6 +102,9 @@
field @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public CharSequence! mTitle;
}
+ @IntDef({androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO, androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_DISABLED, androidx.core.app.RemoteInput.EDIT_CHOICES_BEFORE_SENDING_ENABLED}) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface RemoteInput.EditChoicesBeforeSending {
+ }
+
@IntDef({androidx.core.app.RemoteInput.SOURCE_FREE_FORM_INPUT, androidx.core.app.RemoteInput.SOURCE_CHOICE}) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface RemoteInput.Source {
}
@@ -229,6 +233,10 @@
package androidx.core.graphics {
+ public final class Insets {
+ method @RequiresApi(api=29) @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static androidx.core.graphics.Insets wrap(android.graphics.Insets);
+ }
+
public class TypefaceCompat {
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static android.graphics.Typeface? createFromFontInfo(android.content.Context, android.os.CancellationSignal?, androidx.core.provider.FontsContractCompat.FontInfo[], int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static android.graphics.Typeface? createFromResourcesFamilyXml(android.content.Context, androidx.core.content.res.FontResourcesParserCompat.FamilyResourceEntry, android.content.res.Resources, int, int, androidx.core.content.res.ResourcesCompat.FontCallback?, android.os.Handler?, boolean);
@@ -265,6 +273,15 @@
method public android.graphics.Typeface? createFromResourcesFontFile(android.content.Context!, android.content.res.Resources!, int, String!, int);
}
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) @RequiresApi(29) public class TypefaceCompatApi29Impl {
+ ctor public TypefaceCompatApi29Impl();
+ method public android.graphics.Typeface? createFromFontFamilyFilesResourceEntry(android.content.Context!, androidx.core.content.res.FontResourcesParserCompat.FontFamilyFilesResourceEntry!, android.content.res.Resources!, int);
+ method public android.graphics.Typeface? createFromFontInfo(android.content.Context!, android.os.CancellationSignal?, androidx.core.provider.FontsContractCompat.FontInfo[], int);
+ method protected android.graphics.Typeface! createFromInputStream(android.content.Context!, java.io.InputStream!);
+ method public android.graphics.Typeface? createFromResourcesFontFile(android.content.Context!, android.content.res.Resources!, int, String!, int);
+ method protected androidx.core.provider.FontsContractCompat.FontInfo! findBestInfo(androidx.core.provider.FontsContractCompat.FontInfo[]!, int);
+ }
+
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class TypefaceCompatUtil {
method public static void closeQuietly(java.io.Closeable!);
method @RequiresApi(19) public static java.nio.ByteBuffer? copyToDirectBuffer(android.content.Context!, android.content.res.Resources!, int);
diff --git a/core/ktx/api/1.1.0-alpha06.txt b/core/ktx/api/1.1.0-alpha06.txt
index 63739d2..b1a4163 100644
--- a/core/ktx/api/1.1.0-alpha06.txt
+++ b/core/ktx/api/1.1.0-alpha06.txt
@@ -169,6 +169,12 @@
method public static inline float[] values(android.graphics.Matrix);
}
+ public final class PaintKt {
+ ctor public PaintKt();
+ method public static inline boolean setBlendMode(android.graphics.Paint, androidx.core.graphics.BlendModeCompat? blendModeCompat);
+ method public static inline boolean setBlendModeColorFilter(android.graphics.Paint, @ColorInt int color, androidx.core.graphics.BlendModeCompat? blendModeCompat);
+ }
+
public final class PathKt {
ctor public PathKt();
method @RequiresApi(19) public static inline infix android.graphics.Path and(android.graphics.Path, android.graphics.Path p);
diff --git a/core/ktx/api/1.1.0-alpha07.txt b/core/ktx/api/1.1.0-alpha07.txt
index 63739d2..b1a4163 100644
--- a/core/ktx/api/1.1.0-alpha07.txt
+++ b/core/ktx/api/1.1.0-alpha07.txt
@@ -169,6 +169,12 @@
method public static inline float[] values(android.graphics.Matrix);
}
+ public final class PaintKt {
+ ctor public PaintKt();
+ method public static inline boolean setBlendMode(android.graphics.Paint, androidx.core.graphics.BlendModeCompat? blendModeCompat);
+ method public static inline boolean setBlendModeColorFilter(android.graphics.Paint, @ColorInt int color, androidx.core.graphics.BlendModeCompat? blendModeCompat);
+ }
+
public final class PathKt {
ctor public PathKt();
method @RequiresApi(19) public static inline infix android.graphics.Path and(android.graphics.Path, android.graphics.Path p);
diff --git a/core/ktx/api/1.1.0-beta01.txt b/core/ktx/api/1.1.0-beta01.txt
index 63739d2..b1a4163 100644
--- a/core/ktx/api/1.1.0-beta01.txt
+++ b/core/ktx/api/1.1.0-beta01.txt
@@ -169,6 +169,12 @@
method public static inline float[] values(android.graphics.Matrix);
}
+ public final class PaintKt {
+ ctor public PaintKt();
+ method public static inline boolean setBlendMode(android.graphics.Paint, androidx.core.graphics.BlendModeCompat? blendModeCompat);
+ method public static inline boolean setBlendModeColorFilter(android.graphics.Paint, @ColorInt int color, androidx.core.graphics.BlendModeCompat? blendModeCompat);
+ }
+
public final class PathKt {
ctor public PathKt();
method @RequiresApi(19) public static inline infix android.graphics.Path and(android.graphics.Path, android.graphics.Path p);
diff --git a/core/ktx/api/1.1.0-beta02.txt b/core/ktx/api/1.1.0-beta02.txt
index 63739d2..b1a4163 100644
--- a/core/ktx/api/1.1.0-beta02.txt
+++ b/core/ktx/api/1.1.0-beta02.txt
@@ -169,6 +169,12 @@
method public static inline float[] values(android.graphics.Matrix);
}
+ public final class PaintKt {
+ ctor public PaintKt();
+ method public static inline boolean setBlendMode(android.graphics.Paint, androidx.core.graphics.BlendModeCompat? blendModeCompat);
+ method public static inline boolean setBlendModeColorFilter(android.graphics.Paint, @ColorInt int color, androidx.core.graphics.BlendModeCompat? blendModeCompat);
+ }
+
public final class PathKt {
ctor public PathKt();
method @RequiresApi(19) public static inline infix android.graphics.Path and(android.graphics.Path, android.graphics.Path p);
diff --git a/core/ktx/api/current.txt b/core/ktx/api/current.txt
index 63739d2..b1a4163 100644
--- a/core/ktx/api/current.txt
+++ b/core/ktx/api/current.txt
@@ -169,6 +169,12 @@
method public static inline float[] values(android.graphics.Matrix);
}
+ public final class PaintKt {
+ ctor public PaintKt();
+ method public static inline boolean setBlendMode(android.graphics.Paint, androidx.core.graphics.BlendModeCompat? blendModeCompat);
+ method public static inline boolean setBlendModeColorFilter(android.graphics.Paint, @ColorInt int color, androidx.core.graphics.BlendModeCompat? blendModeCompat);
+ }
+
public final class PathKt {
ctor public PathKt();
method @RequiresApi(19) public static inline infix android.graphics.Path and(android.graphics.Path, android.graphics.Path p);
diff --git a/core/ktx/src/main/java/androidx/core/graphics/Paint.kt b/core/ktx/src/main/java/androidx/core/graphics/Paint.kt
new file mode 100644
index 0000000..7bdab4f
--- /dev/null
+++ b/core/ktx/src/main/java/androidx/core/graphics/Paint.kt
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+@file:Suppress("NOTHING_TO_INLINE")
+
+package androidx.core.graphics
+
+import android.graphics.Paint
+import androidx.annotation.ColorInt
+
+/**
+ * Convenience method to configure the BlendMode of a Paint in a backward
+ * compatible way. This method is a no-op for BlendModes that have no equivalent
+ * on older API levels
+ */
+inline fun Paint.setBlendMode(blendModeCompat: BlendModeCompat?): Boolean {
+ return PaintCompat.setBlendMode(this, blendModeCompat)
+}
+
+/**
+ * Convenience method to configure the BlendModeColorFilter of a Paint in a backward
+ * compatible way. This method falls back on PorterDuffColorFilter for API levels that
+ * do not support BlendModeColorFilter. This method is a no-op if the BlendMode provided is
+ * not supported on a given API level.
+ *
+ * Passing in null for the BlendModeCompat parameter will remove the previously configured
+ * ColorFilter on the Paint
+ */
+inline fun Paint.setBlendModeColorFilter(
+ @ColorInt color: Int,
+ blendModeCompat: BlendModeCompat?
+): Boolean {
+ return PaintCompat.setBlendModeColorFilter(this, color, blendModeCompat)
+}
\ No newline at end of file
diff --git a/core/ktx/src/main/java/androidx/core/net/Uri.kt b/core/ktx/src/main/java/androidx/core/net/Uri.kt
index 7db5ccc..f1f9b1d 100644
--- a/core/ktx/src/main/java/androidx/core/net/Uri.kt
+++ b/core/ktx/src/main/java/androidx/core/net/Uri.kt
@@ -38,5 +38,5 @@
/** Creates a [File] from the given [Uri]. */
fun Uri.toFile(): File {
require(scheme == "file") { "Uri lacks 'file' scheme: $this" }
- return File(path)
+ return File(path!!)
}
diff --git a/core/src/androidTest/java/androidx/core/app/NotificationCompatTest.java b/core/src/androidTest/java/androidx/core/app/NotificationCompatTest.java
index 4d674d9..f818a303 100644
--- a/core/src/androidTest/java/androidx/core/app/NotificationCompatTest.java
+++ b/core/src/androidTest/java/androidx/core/app/NotificationCompatTest.java
@@ -35,7 +35,9 @@
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
+import android.app.PendingIntent;
import android.content.Context;
+import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.media.AudioAttributes;
@@ -173,7 +175,8 @@
@Test
public void testNotificationActionBuilder_copiesRemoteInputs() throws Throwable {
NotificationCompat.Action a = newActionBuilder()
- .addRemoteInput(new RemoteInput("a", "b", null, false, null, null)).build();
+ .addRemoteInput(new RemoteInput("a", "b", null, false,
+ RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO, null, null)).build();
NotificationCompat.Action aCopy = new NotificationCompat.Action.Builder(a).build();
@@ -259,6 +262,26 @@
assertFalse(result.getShowsUserInterface());
}
+ @SdkSuppress(minSdkVersion = 20)
+ @Test
+ public void testGetActionCompatFromAction_withRemoteInputs_doesntCrash() {
+ NotificationCompat.Action action = newActionBuilder()
+ .addRemoteInput(new RemoteInput(
+ "a",
+ "b",
+ null /* choices */,
+ false /* allowFreeFormTextInput */,
+ RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO,
+ null /* extras */,
+ null /* allowedDataTypes */)).build();
+ Notification notification = newNotificationBuilder().addAction(action).build();
+
+ NotificationCompat.Action result =
+ NotificationCompat.getActionCompatFromAction(notification.actions[0]);
+
+ assertEquals(1, result.getRemoteInputs().length);
+ }
+
@SdkSuppress(minSdkVersion = 17)
@Test
public void testNotificationWearableExtenderAction_setAllowGeneratedRepliesTrue()
@@ -944,6 +967,173 @@
assertEquals("example title", NotificationCompat.getContentTitle(notification));
}
+ @Test
+ public void action_builder_defaultNotContextual() {
+ NotificationCompat.Action action =
+ new NotificationCompat.Action.Builder(0, "Test Title", null)
+ .build();
+ assertFalse(action.isContextual());
+ }
+
+ @Test
+ public void action_builder_setContextual() {
+ // Without a PendingIntent the Action.Builder class throws an NPE when building a contextual
+ // action.
+ PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(), 0);
+ NotificationCompat.Action action =
+ new NotificationCompat.Action.Builder(0, "Test Title", pendingIntent)
+ .setContextual(true)
+ .build();
+ assertTrue(action.isContextual());
+ }
+
+ @Test
+ public void action_builder_contextual_invalidIntentCausesNpe() {
+ NotificationCompat.Action.Builder builder =
+ new NotificationCompat.Action.Builder(0, "Test Title", null)
+ .setContextual(true);
+ try {
+ builder.build();
+ fail("Creating a contextual Action with a null PendingIntent should cause a "
+ + " NullPointerException");
+ } catch (NullPointerException e) {
+ // Expected
+ }
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = 28) // TODO(gsennton): this test only applies to Q+ devices.
+ public void action_contextual_toAndFromNotification() {
+ if (Build.VERSION.SDK_INT < 29) return;
+ // Without a PendingIntent the Action.Builder class throws an NPE when building a contextual
+ // action.
+ PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(), 0);
+ NotificationCompat.Action action =
+ new NotificationCompat.Action.Builder(0, "Test Title", pendingIntent)
+ .setContextual(true)
+ .build();
+ Notification notification = newNotificationBuilder().addAction(action).build();
+ NotificationCompat.Action result = NotificationCompat.getAction(notification, 0);
+
+ assertTrue(result.isContextual());
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.P) // TODO(gsennton): This only works on Q+
+ public void getAllowSystemGeneratedContextualActions_trueByDefault() {
+ if (Build.VERSION.SDK_INT < 29) return;
+ Notification notification =
+ new NotificationCompat.Builder(mContext, "test channel").build();
+ assertTrue(NotificationCompat.getAllowSystemGeneratedContextualActions(notification));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.P) // TODO(gsennton): This only works on Q+
+ public void getAllowSystemGeneratedContextualActions() {
+ if (Build.VERSION.SDK_INT < 29) return;
+ Notification notification = new NotificationCompat.Builder(mContext, "test channel")
+ .setAllowSystemGeneratedContextualActions(false)
+ .build();
+ assertFalse(NotificationCompat.getAllowSystemGeneratedContextualActions(notification));
+ }
+
+ @Test
+ public void setBubbleMetadata() {
+ IconCompat icon = IconCompat.createWithAdaptiveBitmap(BitmapFactory.decodeResource(
+ mContext.getResources(),
+ R.drawable.notification_bg_normal));
+
+ PendingIntent intent =
+ PendingIntent.getActivity(mContext, 0, new Intent(), 0);
+
+ PendingIntent deleteIntent =
+ PendingIntent.getActivity(mContext, 1, new Intent(), 0);
+
+ NotificationCompat.BubbleMetadata originalBubble =
+ new NotificationCompat.BubbleMetadata.Builder()
+ .setAutoExpandBubble(true)
+ .setDeleteIntent(deleteIntent)
+ .setDesiredHeight(600)
+ .setIcon(icon)
+ .setIntent(intent)
+ .setSuppressNotification(true)
+ .build();
+
+ Notification notification = new NotificationCompat.Builder(mContext, "test channel")
+ .setBubbleMetadata(originalBubble)
+ .build();
+
+ NotificationCompat.BubbleMetadata roundtripBubble =
+ NotificationCompat.getBubbleMetadata(notification);
+
+ // Bubbles are only supported on Q and above; on P and earlier, simply verify that the above
+ // code does not crash.
+ if (Build.VERSION.SDK_INT < 29) {
+ return;
+ }
+
+ // TODO: Check notification itself.
+
+ assertNotNull(roundtripBubble);
+
+ assertEquals(originalBubble.getAutoExpandBubble(), roundtripBubble.getAutoExpandBubble());
+ assertEquals(originalBubble.getDeleteIntent(), roundtripBubble.getDeleteIntent());
+ assertEquals(originalBubble.getDesiredHeight(), roundtripBubble.getDesiredHeight());
+ // TODO: Check getIcon().
+ /* assertEquals(originalBubble.getIcon().toIcon(), roundtripBubble.getIcon().toIcon()); */
+ assertEquals(originalBubble.getIntent(), roundtripBubble.getIntent());
+ assertEquals(
+ originalBubble.isNotificationSuppressed(),
+ roundtripBubble.isNotificationSuppressed());
+ }
+
+ @Test
+ public void setBubbleMetadataDesiredHeightResId() {
+ IconCompat icon = IconCompat.createWithAdaptiveBitmap(BitmapFactory.decodeResource(
+ mContext.getResources(),
+ R.drawable.notification_bg_normal));
+
+ PendingIntent intent =
+ PendingIntent.getActivity(mContext, 0, new Intent(), 0);
+
+ NotificationCompat.BubbleMetadata originalBubble =
+ new NotificationCompat.BubbleMetadata.Builder()
+ .setDesiredHeightResId(R.dimen.compat_notification_large_icon_max_height)
+ .setIcon(icon)
+ .setIntent(intent)
+ .build();
+
+ Notification notification = new NotificationCompat.Builder(mContext, "test channel")
+ .setBubbleMetadata(originalBubble)
+ .build();
+
+ NotificationCompat.BubbleMetadata roundtripBubble =
+ NotificationCompat.getBubbleMetadata(notification);
+
+ // Bubbles are only supported on Q and above; on P and earlier, simply verify that the above
+ // code does not crash.
+ if (Build.VERSION.SDK_INT < 29) {
+ return;
+ }
+
+ // TODO: Check notification itself.
+
+ assertNotNull(roundtripBubble);
+
+ assertEquals(
+ originalBubble.getDesiredHeightResId(),
+ roundtripBubble.getDesiredHeightResId());
+ }
+
+ @Test
+ public void setBubbleMetadataToNull() {
+ Notification notification = new NotificationCompat.Builder(mContext, "test channel")
+ .setBubbleMetadata(null)
+ .build();
+
+ assertNull(NotificationCompat.getBubbleMetadata(notification));
+ }
+
// Add the @Test annotation to enable this test. This test is disabled by default as it's not a
// unit test. This will simply create 4 MessagingStyle notifications so a developer may see what
// the end result will look like on a physical device (or emulator).
diff --git a/core/src/androidTest/java/androidx/core/app/RemoteInputTest.java b/core/src/androidTest/java/androidx/core/app/RemoteInputTest.java
index 16004b1..0a15761 100644
--- a/core/src/androidTest/java/androidx/core/app/RemoteInputTest.java
+++ b/core/src/androidTest/java/androidx/core/app/RemoteInputTest.java
@@ -20,6 +20,7 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import android.content.Intent;
import android.net.Uri;
@@ -53,6 +54,8 @@
assertTrue(input.isDataOnly());
assertFalse(input.getAllowFreeFormInput());
assertTrue(input.getChoices() == null || input.getChoices().length == 0);
+ assertEquals(RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO,
+ input.getEditChoicesBeforeSending());
assertEquals(1, input.getAllowedDataTypes().size());
assertTrue(input.getAllowedDataTypes().contains(MIME_TYPE));
}
@@ -64,6 +67,8 @@
assertFalse(input.isDataOnly());
assertTrue(input.getAllowFreeFormInput());
assertTrue(input.getChoices() == null || input.getChoices().length == 0);
+ assertEquals(RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO,
+ input.getEditChoicesBeforeSending());
assertTrue(input.getAllowedDataTypes() == null || input.getAllowedDataTypes().isEmpty());
}
@@ -74,6 +79,8 @@
assertFalse(input.isDataOnly());
assertFalse(input.getAllowFreeFormInput());
assertTrue(input.getChoices() != null && input.getChoices().length > 0);
+ assertEquals(RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO,
+ input.getEditChoicesBeforeSending());
assertTrue(input.getAllowedDataTypes() == null || input.getAllowedDataTypes().isEmpty());
}
@@ -91,10 +98,38 @@
assertFalse(input.isDataOnly());
assertTrue(input.getAllowFreeFormInput());
assertTrue(input.getChoices() != null && input.getChoices().length > 0);
+ assertEquals(RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO,
+ input.getEditChoicesBeforeSending());
assertEquals(1, input.getAllowedDataTypes().size());
assertTrue(input.getAllowedDataTypes().contains(MIME_TYPE));
}
+ public void testRemoteInputBuilder_setEditChoicesBeforeSending() throws Throwable {
+ RemoteInput input =
+ new RemoteInput.Builder(RESULT_KEY)
+ .setChoices(new CharSequence[]{"first", "second"})
+ .setEditChoicesBeforeSending(
+ RemoteInput.EDIT_CHOICES_BEFORE_SENDING_ENABLED)
+ .build();
+ assertEquals(RemoteInput.EDIT_CHOICES_BEFORE_SENDING_ENABLED,
+ input.getEditChoicesBeforeSending());
+ }
+
+ public void testRemoteInputBuilder_setEditChoicesBeforeSendingRequiresFreeInput()
+ throws Throwable {
+ RemoteInput.Builder builder =
+ new RemoteInput.Builder(RESULT_KEY)
+ .setEditChoicesBeforeSending(
+ RemoteInput.EDIT_CHOICES_BEFORE_SENDING_ENABLED)
+ .setAllowFreeFormInput(false);
+ try {
+ builder.build();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // expected.
+ }
+ }
+
@SdkSuppress(minSdkVersion = 17)
@Test
public void testRemoteInputBuilder_addAndGetDataResultsFromIntent() throws Throwable {
diff --git a/core/src/androidTest/java/androidx/core/content/pm/ShortcutInfoCompatTest.java b/core/src/androidTest/java/androidx/core/content/pm/ShortcutInfoCompatTest.java
index 66a741f..516759c 100644
--- a/core/src/androidTest/java/androidx/core/content/pm/ShortcutInfoCompatTest.java
+++ b/core/src/androidTest/java/androidx/core/content/pm/ShortcutInfoCompatTest.java
@@ -213,24 +213,19 @@
@Test
@SdkSuppress(minSdkVersion = 26)
- public void testToShortcutInfo_extrasBundle() {
+ public void testToShortcutInfo() {
String longLabel = "Test long label";
ComponentName activity = new ComponentName("Package name", "Class name");
String disabledMessage = "Test disabled message";
Set<String> categories = new HashSet<>();
categories.add("cat1");
categories.add("cat2");
- Person[] persons = {
- new Person.Builder().setName("P1").build(),
- new Person.Builder().setName("P2").build()};
ShortcutInfoCompat compat = mBuilder
.setActivity(activity)
.setCategories(categories)
.setDisabledMessage(disabledMessage)
.setLongLabel(longLabel)
- .setPersons(persons)
- .setLongLived()
.build();
ShortcutInfo shortcut = compat.toShortcutInfo();
@@ -243,6 +238,21 @@
assertEquals(disabledMessage, shortcut.getDisabledMessage());
assertEquals(activity, shortcut.getActivity());
assertEquals(categories, shortcut.getCategories());
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = 26, maxSdkVersion = 28)
+ public void testToShortcutInfo_extrasBundle() {
+ Person[] persons = {
+ new Person.Builder().setName("P1").build(),
+ new Person.Builder().setName("P2").build()};
+
+ ShortcutInfoCompat compat = mBuilder
+ .setPersons(persons)
+ .setLongLived()
+ .build();
+
+ ShortcutInfo shortcut = compat.toShortcutInfo();
assertNotNull(shortcut.getExtras());
assertTrue(ShortcutInfoCompat.getLongLivedFromExtra(shortcut.getExtras()));
diff --git a/core/src/androidTest/java/androidx/core/graphics/PaintTest.java b/core/src/androidTest/java/androidx/core/graphics/PaintTest.java
new file mode 100644
index 0000000..b4b3b46
--- /dev/null
+++ b/core/src/androidTest/java/androidx/core/graphics/PaintTest.java
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.core.graphics;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import android.graphics.BlendMode;
+import android.graphics.BlendModeColorFilter;
+import android.graphics.Color;
+import android.graphics.ColorFilter;
+import android.graphics.Paint;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
+import android.graphics.PorterDuffXfermode;
+import android.graphics.Xfermode;
+import android.os.Build;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SdkSuppress;
+import androidx.test.filters.SmallTest;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class PaintTest {
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.Q)
+ public void testBlendModeCompatMatchesPlatform() {
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.CLEAR, BlendMode.CLEAR);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.SRC, BlendMode.SRC);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.DST, BlendMode.DST);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.SRC_OVER, BlendMode.SRC_OVER);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.DST_OVER, BlendMode.DST_OVER);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.SRC_IN, BlendMode.SRC_IN);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.DST_IN, BlendMode.DST_IN);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.SRC_OUT, BlendMode.SRC_OUT);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.DST_OUT, BlendMode.DST_OUT);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.SRC_ATOP, BlendMode.SRC_ATOP);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.DST_ATOP, BlendMode.DST_ATOP);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.XOR, BlendMode.XOR);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.PLUS, BlendMode.PLUS);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.MODULATE, BlendMode.MODULATE);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.SCREEN, BlendMode.SCREEN);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.OVERLAY, BlendMode.OVERLAY);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.DARKEN, BlendMode.DARKEN);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.LIGHTEN, BlendMode.LIGHTEN);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.COLOR_DODGE, BlendMode.COLOR_DODGE);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.COLOR_BURN, BlendMode.COLOR_BURN);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.HARD_LIGHT, BlendMode.HARD_LIGHT);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.SOFT_LIGHT, BlendMode.SOFT_LIGHT);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.DIFFERENCE, BlendMode.DIFFERENCE);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.EXCLUSION, BlendMode.EXCLUSION);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.MULTIPLY, BlendMode.MULTIPLY);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.HUE, BlendMode.HUE);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.SATURATION, BlendMode.SATURATION);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.COLOR, BlendMode.COLOR);
+ TestHelper.verifyBlendModeMatchesCompat(BlendModeCompat.LUMINOSITY, BlendMode.LUMINOSITY);
+ }
+
+ @Test
+ @SdkSuppress(maxSdkVersion = Build.VERSION_CODES.P)
+ public void testBlendModeCompatMatchesPorterDuff() {
+ verifyPorterDuffMatchesCompat(BlendModeCompat.CLEAR, PorterDuff.Mode.CLEAR);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.SRC, PorterDuff.Mode.SRC);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.DST, PorterDuff.Mode.DST);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.SRC_OVER, PorterDuff.Mode.SRC_OVER);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.DST_OVER, PorterDuff.Mode.DST_OVER);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.SRC_IN, PorterDuff.Mode.SRC_IN);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.DST_IN, PorterDuff.Mode.DST_IN);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.SRC_OUT, PorterDuff.Mode.SRC_OUT);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.DST_OUT, PorterDuff.Mode.DST_OUT);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.SRC_ATOP, PorterDuff.Mode.SRC_ATOP);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.DST_ATOP, PorterDuff.Mode.DST_ATOP);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.XOR, PorterDuff.Mode.XOR);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.PLUS, PorterDuff.Mode.ADD);
+ // b/73224934 PorterDuff Multiply maps to Skia Modulate
+ verifyPorterDuffMatchesCompat(BlendModeCompat.MODULATE, PorterDuff.Mode.MULTIPLY);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.SCREEN, PorterDuff.Mode.SCREEN);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.OVERLAY, PorterDuff.Mode.OVERLAY);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.DARKEN, PorterDuff.Mode.DARKEN);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.LIGHTEN, PorterDuff.Mode.LIGHTEN);
+ // Not supported before Q
+ verifyPorterDuffMatchesCompat(BlendModeCompat.COLOR_DODGE, null);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.COLOR_BURN, null);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.HARD_LIGHT, null);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.SOFT_LIGHT, null);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.DIFFERENCE, null);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.EXCLUSION, null);
+ // Technically BlendMode.MULTIPLY should map to PorterDuff.Mode.MULTIPLY
+ // However b/73224934 PorterDuff Multiply maps to Skia Modulate
+ verifyPorterDuffMatchesCompat(BlendModeCompat.MULTIPLY, null);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.HUE, null);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.SATURATION, null);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.COLOR, null);
+ verifyPorterDuffMatchesCompat(BlendModeCompat.LUMINOSITY, null);
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.Q)
+ public void testNullBlendModeRemovesBlendModeColorFilter() {
+ Paint p = new Paint();
+ assertTrue(PaintCompat.setBlendModeColorFilter(p, Color.RED, BlendModeCompat.CLEAR));
+ ColorFilter filter = p.getColorFilter();
+ assertTrue(filter instanceof BlendModeColorFilter);
+
+ PaintCompat.setBlendModeColorFilter(p, 0, null);
+ assertNull(p.getColorFilter());
+ }
+
+ @Test
+ @SdkSuppress(maxSdkVersion = Build.VERSION_CODES.P)
+ public void testNullBlendModeRemovesPorterDuffColorFilter() {
+ Paint p = new Paint();
+ assertTrue(PaintCompat.setBlendModeColorFilter(p, Color.RED, BlendModeCompat.CLEAR));
+ ColorFilter filter = p.getColorFilter();
+ assertTrue(filter instanceof PorterDuffColorFilter);
+
+ PaintCompat.setBlendModeColorFilter(p, 0, null);
+ assertNull(p.getColorFilter());
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.Q)
+ public void testNullBlendModeRemovesBlendMode() {
+ Paint p = new Paint();
+ assertTrue(PaintCompat.setBlendMode(p, BlendModeCompat.CLEAR));
+ assertEquals(BlendMode.CLEAR, p.getBlendMode());
+
+ assertTrue(PaintCompat.setBlendMode(p, null));
+ assertNull(p.getBlendMode());
+ }
+
+
+ @Test
+ @SdkSuppress(maxSdkVersion = Build.VERSION_CODES.P)
+ public void testNullBlendModeRemovesXfermode() {
+ Paint p = new Paint();
+ assertTrue(PaintCompat.setBlendMode(p, BlendModeCompat.CLEAR));
+ verifyPorterDuffMatchesCompat(BlendModeCompat.CLEAR, PorterDuff.Mode.CLEAR);
+
+ verifyPorterDuffMatchesCompat(null, null);
+ }
+
+ /**
+ * Helper test class to hide usages of new APIs and avoid ClassNotFoundExceptions
+ * in tests
+ */
+ private static class TestHelper {
+ private static void verifyBlendModeMatchesCompat(@NonNull BlendModeCompat compat,
+ @NonNull BlendMode blendMode) {
+ Paint p = new Paint();
+ PaintCompat.setBlendMode(p, compat);
+ assertEquals(blendMode, p.getBlendMode());
+ }
+ }
+
+ /**
+ * Helper method to verify that the provided {@link BlendModeCompat} instance
+ * matches the given {@link PorterDuff.Mode} which may be null if there is no
+ * equivalent PorterDuff.Mode for the BlendMode
+ */
+ private void verifyPorterDuffMatchesCompat(@Nullable BlendModeCompat compat,
+ @Nullable PorterDuff.Mode mode) {
+ Paint p = new Paint();
+ boolean result = PaintCompat.setBlendMode(p, compat);
+ if (compat != null && mode == null) {
+ // If there is not a compatible PorterDuff mode for this BlendMode, configuration
+ // of the blend mode should return false
+ assertTrue(!result);
+ } else if (compat != null) {
+ // .. otherwise if there is a corresponding PorterDuff mode with the given BlendMode
+ // then the assignment should complete successfully
+ assertTrue(result);
+ } else if (mode == null) {
+ // If null is provided, then the assignment should complete successfully and the
+ // default blending algorithm will be utilized on the paint
+ assertTrue(result);
+ }
+
+ // Fields on PorterDuffXfermode are private, so verify the mapping helper method is correct
+ // and the resultant Xfermode returned from Paint#getXfermode is an instance of
+ // PorterDuffXferMode
+ Xfermode xfermode = p.getXfermode();
+ if (compat != null) {
+ assertEquals(mode, PaintCompat.obtainPorterDuffFromCompat(compat));
+ }
+
+ if (mode != null) {
+ assertTrue(xfermode instanceof PorterDuffXfermode);
+ } else {
+ assertNull(xfermode);
+ }
+ }
+}
diff --git a/core/src/androidTest/java/androidx/core/view/ViewCompatTest.java b/core/src/androidTest/java/androidx/core/view/ViewCompatTest.java
index 1a70d65..3f1937e 100644
--- a/core/src/androidTest/java/androidx/core/view/ViewCompatTest.java
+++ b/core/src/androidTest/java/androidx/core/view/ViewCompatTest.java
@@ -30,6 +30,8 @@
import android.app.Activity;
import android.content.Context;
+import android.graphics.Rect;
+import android.os.Build;
import android.support.v4.BaseInstrumentationTestCase;
import android.view.Display;
import android.view.View;
@@ -44,7 +46,9 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
@RunWith(AndroidJUnit4.class)
@@ -241,6 +245,24 @@
ViewCompat.requireViewById(container, View.NO_ID);
}
+ @Test
+ public void testSystemGestureExclusionRects() {
+ final View container = mActivityTestRule.getActivity().findViewById(R.id.container);
+
+ final List<Rect> expected = new ArrayList<>();
+ expected.add(new Rect(0, 0, 25, 25));
+ final List<Rect> rects = new ArrayList<>(expected);
+
+ ViewCompat.setSystemGestureExclusionRects(container, rects);
+ final List<Rect> returnedRects = ViewCompat.getSystemGestureExclusionRects(container);
+
+ if (Build.VERSION.SDK_INT >= 29) {
+ assertEquals("round trip for expected rects", expected, returnedRects);
+ } else {
+ assertTrue("empty list for old device", returnedRects.isEmpty());
+ }
+ }
+
private static boolean isViewIdGenerated(int id) {
return (id & 0xFF000000) == 0 && (id & 0x00FFFFFF) != 0;
}
diff --git a/core/src/androidTest/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompatTest.java b/core/src/androidTest/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompatTest.java
index 6b7746e..6f851a2 100644
--- a/core/src/androidTest/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompatTest.java
+++ b/core/src/androidTest/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompatTest.java
@@ -17,13 +17,18 @@
package androidx.core.view.accessibility;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
+import android.graphics.Region;
import android.os.Build;
+import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat;
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.TouchDelegateInfoCompat;
+import androidx.test.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SdkSuppress;
import androidx.test.filters.SmallTest;
@@ -32,6 +37,9 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.HashMap;
+import java.util.Map;
+
@SmallTest
@RunWith(AndroidJUnit4.class)
public class AccessibilityNodeInfoCompatTest {
@@ -107,6 +115,16 @@
@SdkSuppress(minSdkVersion = 19)
@Test
+ public void testGetSetTextEntryKey() {
+ AccessibilityNodeInfoCompat nodeCompat = obtainedWrappedNodeCompat();
+ nodeCompat.setTextEntryKey(true);
+ assertThat(nodeCompat.isTextEntryKey(), is(true));
+ nodeCompat.setTextEntryKey(false);
+ assertThat(nodeCompat.isTextEntryKey(), is(false));
+ }
+
+ @SdkSuppress(minSdkVersion = 19)
+ @Test
public void testAccessibilityActionsNotNull() {
try {
AccessibilityActionCompat actionCompat;
@@ -148,6 +166,30 @@
}
}
+ @Test
+ public void testTouchDelegateInfo() {
+ final Map<Region, View> targetMap = new HashMap<>(1);
+ final Region region = new Region(1, 1, 10, 10);
+ targetMap.put(region, new View(InstrumentationRegistry.getContext()));
+ final TouchDelegateInfoCompat delegateInfo = new TouchDelegateInfoCompat(targetMap);
+ final AccessibilityNodeInfoCompat accessibilityNodeInfoCompat =
+ obtainedWrappedNodeCompat();
+ accessibilityNodeInfoCompat.setTouchDelegateInfo(delegateInfo);
+ final TouchDelegateInfoCompat touchDelegateInfoResult =
+ accessibilityNodeInfoCompat.getTouchDelegateInfo();
+ if (Build.VERSION.SDK_INT >= 29) {
+ assertThat(touchDelegateInfoResult.getRegionCount(), is(1));
+ assertThat(touchDelegateInfoResult.getRegionAt(0), is(region));
+ // getTargetForRegion return null, since we are not a11y service
+ assertThat(touchDelegateInfoResult.getTargetForRegion(region), is(nullValue()));
+ } else {
+ assertThat(touchDelegateInfoResult, is(nullValue()));
+ assertThat(delegateInfo.getRegionCount(), is(0));
+ assertThat(delegateInfo.getRegionAt(0), is(nullValue()));
+ assertThat(delegateInfo.getTargetForRegion(region), is(nullValue()));
+ }
+ }
+
private AccessibilityNodeInfoCompat obtainedWrappedNodeCompat() {
AccessibilityNodeInfo accessibilityNodeInfo = AccessibilityNodeInfo.obtain();
return AccessibilityNodeInfoCompat.wrap(accessibilityNodeInfo);
diff --git a/core/src/main/java/androidx/core/app/NotificationCompat.java b/core/src/main/java/androidx/core/app/NotificationCompat.java
index 17053d9..6d2889a 100644
--- a/core/src/main/java/androidx/core/app/NotificationCompat.java
+++ b/core/src/main/java/androidx/core/app/NotificationCompat.java
@@ -16,10 +16,14 @@
package androidx.core.app;
+import static android.graphics.drawable.Icon.TYPE_BITMAP;
+
+import static androidx.annotation.Dimension.DP;
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX;
import static java.lang.annotation.RetentionPolicy.SOURCE;
+import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Notification;
import android.app.PendingIntent;
@@ -50,12 +54,15 @@
import android.widget.RemoteViews;
import androidx.annotation.ColorInt;
+import androidx.annotation.DimenRes;
+import androidx.annotation.Dimension;
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.R;
+import androidx.core.graphics.drawable.IconCompat;
import androidx.core.text.BidiFormatter;
import androidx.core.view.GravityCompat;
@@ -187,6 +194,16 @@
public static final int FLAG_GROUP_SUMMARY = 0x00000200;
/**
+ * Bit set in the Notification flags field if this notification is showing as a bubble.
+ *
+ * Applications cannot set this flag directly; they should instead call
+ * {@link NotificationCompat.Builder#setBubbleMetadata(BubbleMetadata)} to request that a
+ * notification be displayed as a bubble, and then check this flag to see whether that request
+ * was honored by the system.
+ */
+ public static final int FLAG_BUBBLE = 0x00001000;
+
+ /**
* Default notification priority for {@link NotificationCompat.Builder#setPriority(int)}.
* If your application does not prioritize its own notifications,
* use this value for all notifications.
@@ -715,6 +732,8 @@
String mShortcutId;
long mTimeout;
@GroupAlertBehavior int mGroupAlertBehavior = GROUP_ALERT_ALL;
+ boolean mAllowSystemGeneratedContextualActions;
+ BubbleMetadata mBubbleMetadata;
Notification mNotification = new Notification();
/**
@@ -745,6 +764,7 @@
mNotification.audioStreamType = Notification.STREAM_DEFAULT;
mPriority = PRIORITY_DEFAULT;
mPeople = new ArrayList<String>();
+ mAllowSystemGeneratedContextualActions = true;
}
/**
@@ -1566,6 +1586,22 @@
}
/**
+ * Sets the {@link BubbleMetadata} that will be used to display app content in a floating
+ * window over the existing foreground activity.
+ *
+ * <p>This data will be ignored unless the notification is posted to a channel that
+ * allows {@link android.app.NotificationChannel#canBubble() bubbles}.</p>
+ *
+ * <p>Notifications allowed to bubble that have valid bubble metadata will display in
+ * collapsed state outside of the notification shade on unlocked devices. When a user
+ * interacts with the collapsed state, the bubble intent will be invoked and displayed.</p>
+ */
+ public @NonNull Builder setBubbleMetadata(@Nullable BubbleMetadata data) {
+ mBubbleMetadata = data;
+ return this;
+ }
+
+ /**
* Apply an extender to this notification builder. Extenders may be used to add
* metadata or change options on this builder.
*/
@@ -1575,6 +1611,16 @@
}
/**
+ * Determines whether the platform can generate contextual actions for a notification.
+ * By default this is true.
+ */
+ @NonNull
+ public Builder setAllowSystemGeneratedContextualActions(boolean allowed) {
+ mAllowSystemGeneratedContextualActions = allowed;
+ return this;
+ }
+
+ /**
* @deprecated Use {@link #build()} instead.
*/
@Deprecated
@@ -1651,6 +1697,16 @@
public int getColor() {
return mColor;
}
+
+ /**
+ * @return the {@link BubbleMetadata} of the notification
+ *
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public @Nullable BubbleMetadata getBubbleMetadata() {
+ return mBubbleMetadata;
+ }
}
/**
@@ -3013,12 +3069,19 @@
R.layout.notification_template_custom_big, false /* fitIn1U */);
remoteViews.removeAllViews(R.id.actions);
boolean actionsVisible = false;
- if (showActions && mBuilder.mActions != null) {
- int numActions = Math.min(mBuilder.mActions.size(), MAX_ACTION_BUTTONS);
+
+ // In the UI contextual actions appear separately from the standard actions, so we
+ // filter them out here.
+ List<NotificationCompat.Action> nonContextualActions =
+ getNonContextualActions(mBuilder.mActions);
+
+ if (showActions && nonContextualActions != null) {
+ int numActions = Math.min(nonContextualActions.size(), MAX_ACTION_BUTTONS);
if (numActions > 0) {
actionsVisible = true;
for (int i = 0; i < numActions; i++) {
- final RemoteViews button = generateActionButton(mBuilder.mActions.get(i));
+ final RemoteViews button =
+ generateActionButton(nonContextualActions.get(i));
remoteViews.addView(R.id.actions, button);
}
}
@@ -3030,6 +3093,18 @@
return remoteViews;
}
+ private static List<NotificationCompat.Action> getNonContextualActions(
+ List<NotificationCompat.Action> actions) {
+ if (actions == null) return null;
+ List<NotificationCompat.Action> nonContextualActions = new ArrayList<>();
+ for (NotificationCompat.Action action : actions) {
+ if (!action.isContextual()) {
+ nonContextualActions.add(action);
+ }
+ }
+ return nonContextualActions;
+ }
+
private RemoteViews generateActionButton(NotificationCompat.Action action) {
final boolean tombstone = (action.actionIntent == null);
RemoteViews button = new RemoteViews(mBuilder.mContext.getPackageName(),
@@ -3143,6 +3218,7 @@
boolean mShowsUserInterface = true;
private final @SemanticAction int mSemanticAction;
+ private final boolean mIsContextual;
/**
* Small icon representing the action.
@@ -3159,13 +3235,14 @@
public PendingIntent actionIntent;
public Action(int icon, CharSequence title, PendingIntent intent) {
- this(icon, title, intent, new Bundle(), null, null, true, SEMANTIC_ACTION_NONE, true);
+ this(icon, title, intent, new Bundle(), null, null, true, SEMANTIC_ACTION_NONE, true,
+ false /* isContextual */);
}
Action(int icon, CharSequence title, PendingIntent intent, Bundle extras,
RemoteInput[] remoteInputs, RemoteInput[] dataOnlyRemoteInputs,
boolean allowGeneratedReplies, @SemanticAction int semanticAction,
- boolean showsUserInterface) {
+ boolean showsUserInterface, boolean isContextual) {
this.icon = icon;
this.title = NotificationCompat.Builder.limitCharSequenceLength(title);
this.actionIntent = intent;
@@ -3175,6 +3252,7 @@
this.mAllowGeneratedReplies = allowGeneratedReplies;
this.mSemanticAction = semanticAction;
this.mShowsUserInterface = showsUserInterface;
+ this.mIsContextual = isContextual;
}
public int getIcon() {
@@ -3225,6 +3303,15 @@
}
/**
+ * Returns whether this is a contextual Action, i.e. whether the action is dependent on the
+ * notification message body. An example of a contextual action could be an action opening a
+ * map application with an address shown in the notification.
+ */
+ public boolean isContextual() {
+ return mIsContextual;
+ }
+
+ /**
* Get the list of inputs to be collected from the user that ONLY accept data when this
* action is sent. These remote inputs are guaranteed to return true on a call to
* {@link RemoteInput#isDataOnly}.
@@ -3258,6 +3345,7 @@
private ArrayList<RemoteInput> mRemoteInputs;
private @SemanticAction int mSemanticAction;
private boolean mShowsUserInterface = true;
+ private boolean mIsContextual;
/**
* Construct a new builder for {@link Action} object.
@@ -3266,7 +3354,8 @@
* @param intent the {@link PendingIntent} to fire when users trigger this action
*/
public Builder(int icon, CharSequence title, PendingIntent intent) {
- this(icon, title, intent, new Bundle(), null, true, SEMANTIC_ACTION_NONE, true);
+ this(icon, title, intent, new Bundle(), null, true, SEMANTIC_ACTION_NONE, true,
+ false /* isContextual */);
}
/**
@@ -3277,12 +3366,14 @@
public Builder(Action action) {
this(action.icon, action.title, action.actionIntent, new Bundle(action.mExtras),
action.getRemoteInputs(), action.getAllowGeneratedReplies(),
- action.getSemanticAction(), action.mShowsUserInterface);
+ action.getSemanticAction(), action.mShowsUserInterface,
+ action.isContextual());
}
private Builder(int icon, CharSequence title, PendingIntent intent, Bundle extras,
RemoteInput[] remoteInputs, boolean allowGeneratedReplies,
- @SemanticAction int semanticAction, boolean showsUserInterface) {
+ @SemanticAction int semanticAction, boolean showsUserInterface,
+ boolean isContextual) {
mIcon = icon;
mTitle = NotificationCompat.Builder.limitCharSequenceLength(title);
mIntent = intent;
@@ -3292,6 +3383,7 @@
mAllowGeneratedReplies = allowGeneratedReplies;
mSemanticAction = semanticAction;
mShowsUserInterface = showsUserInterface;
+ mIsContextual = isContextual;
}
/**
@@ -3360,6 +3452,17 @@
}
/**
+ * Sets whether this {@link Action} is a contextual action, i.e. whether the action is
+ * dependent on the notification message body. An example of a contextual action could
+ * be an action opening a map application with an address shown in the notification.
+ */
+ @NonNull
+ public Builder setContextual(boolean isContextual) {
+ mIsContextual = isContextual;
+ return this;
+ }
+
+ /**
* Set whether or not this {@link Action}'s {@link PendingIntent} will open a user
* interface.
* @param showsUserInterface {@code true} if this {@link Action}'s {@link PendingIntent}
@@ -3382,11 +3485,28 @@
}
/**
+ * Throws an NPE if we are building a contextual action missing one of the fields
+ * necessary to display the action.
+ */
+ private void checkContextualActionNullFields() {
+ if (!mIsContextual) return;
+
+ if (mIntent == null) {
+ throw new NullPointerException(
+ "Contextual Actions must contain a valid PendingIntent");
+ }
+ }
+
+ /**
* Combine all of the options that have been set and return a new {@link Action}
* object.
* @return the built action
+ * @throws {@ref NullPointerException} if this is a contextual Action and its Intent is
+ * null.
*/
public Action build() {
+ checkContextualActionNullFields();
+
List<RemoteInput> dataOnlyInputs = new ArrayList<>();
List<RemoteInput> textInputs = new ArrayList<>();
if (mRemoteInputs != null) {
@@ -3404,7 +3524,7 @@
? null : textInputs.toArray(new RemoteInput[textInputs.size()]);
return new Action(mIcon, mTitle, mIntent, mExtras, textInputsArr,
dataOnlyInputsArr, mAllowGeneratedReplies, mSemanticAction,
- mShowsUserInterface);
+ mShowsUserInterface, mIsContextual);
}
}
@@ -4795,6 +4915,9 @@
remoteInput.getLabel(),
remoteInput.getChoices(),
remoteInput.getAllowFreeFormInput(),
+ Build.VERSION.SDK_INT >= 29
+ ? remoteInput.getEditChoicesBeforeSending()
+ : RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO,
remoteInput.getExtras(),
null /* allowedDataTypes */)
: null;
@@ -5102,6 +5225,367 @@
/**
+ * Encapsulates the information needed to display a notification as a bubble.
+ *
+ * <p>A bubble is used to display app content in a floating window over the existing
+ * foreground activity. A bubble has a collapsed state represented by an icon,
+ * {@link BubbleMetadata.Builder#setIcon(IconCompat)} and an expanded state which is populated
+ * via {@link BubbleMetadata.Builder#setIntent(PendingIntent)}.</p>
+ *
+ * <b>Notifications with a valid and allowed bubble will display in collapsed state
+ * outside of the notification shade on unlocked devices. When a user interacts with the
+ * collapsed bubble, the bubble intent will be invoked and displayed.</b>
+ *
+ * @see NotificationCompat.Builder#setBubbleMetadata(BubbleMetadata)
+ */
+ public static final class BubbleMetadata {
+
+ private PendingIntent mPendingIntent;
+ private PendingIntent mDeleteIntent;
+ private IconCompat mIcon;
+ private int mDesiredHeight;
+ @DimenRes
+ private int mDesiredHeightResId;
+ private int mFlags;
+
+ /**
+ * If set and the app creating the bubble is in the foreground, the bubble will be posted
+ * in its expanded state, with the contents of {@link #getIntent()} in a floating window.
+ *
+ * <p>If the app creating the bubble is not in the foreground this flag has no effect.</p>
+ *
+ * <p>Generally this flag should only be set if the user has performed an action to request
+ * or create a bubble.</p>
+ */
+ private static final int FLAG_AUTO_EXPAND_BUBBLE = 0x00000001;
+
+ /**
+ * If set and the app creating the bubble is in the foreground, the bubble will be posted
+ * <b>without</b> the associated notification in the notification shade.
+ *
+ * <p>If the app posting the bubble is not in the foreground this flag has no effect.</p>
+ *
+ * <p>Generally this flag should only be set if the user has performed an action to request
+ * or create a bubble, or if the user has seen the content in the notification and the
+ * notification is no longer relevant.</p>
+ */
+ private static final int FLAG_SUPPRESS_NOTIFICATION = 0x00000002;
+
+ private BubbleMetadata(PendingIntent expandIntent, PendingIntent deleteIntent,
+ IconCompat icon, int height, @DimenRes int heightResId, int flags) {
+ mPendingIntent = expandIntent;
+ mIcon = icon;
+ mDesiredHeight = height;
+ mDesiredHeightResId = heightResId;
+ mDeleteIntent = deleteIntent;
+ mFlags = flags;
+ }
+
+ /**
+ * @return the pending intent used to populate the floating window for this bubble.
+ */
+ @NonNull
+ public PendingIntent getIntent() {
+ return mPendingIntent;
+ }
+
+ /**
+ * @return the pending intent to send when the bubble is dismissed by a user, if one exists.
+ */
+ @Nullable
+ public PendingIntent getDeleteIntent() {
+ return mDeleteIntent;
+ }
+
+ /**
+ * @return the icon that will be displayed for this bubble when it is collapsed.
+ */
+ @NonNull
+ public IconCompat getIcon() {
+ return mIcon;
+ }
+
+ /**
+ * @return the ideal height, in DPs, for the floating window that app content defined by
+ * {@link #getIntent()} for this bubble. A value of 0 indicates a desired height has not
+ * been set.
+ */
+ @Dimension(unit = DP)
+ public int getDesiredHeight() {
+ return mDesiredHeight;
+ }
+
+ /**
+ * @return the resId of ideal height for the floating window that app content defined by
+ * {@link #getIntent()} for this bubble. A value of 0 indicates a res value has not
+ * been provided for the desired height.
+ */
+ @DimenRes
+ public int getDesiredHeightResId() {
+ return mDesiredHeightResId;
+ }
+
+ /**
+ * @return whether this bubble should auto expand when it is posted.
+ *
+ * @see BubbleMetadata.Builder#setAutoExpandBubble(boolean)
+ */
+ public boolean getAutoExpandBubble() {
+ return (mFlags & FLAG_AUTO_EXPAND_BUBBLE) != 0;
+ }
+
+ /**
+ * @return whether this bubble should suppress the notification when it is posted.
+ *
+ * @see BubbleMetadata.Builder#setSuppressNotification(boolean)
+ */
+ public boolean isNotificationSuppressed() {
+ return (mFlags & FLAG_SUPPRESS_NOTIFICATION) != 0;
+ }
+
+ /**
+ * Converts a {@link NotificationCompat.BubbleMetadata} to a platform-level
+ * {@link Notification.BubbleMetadata}.
+ *
+ * @param compatMetadata the NotificationCompat.BubbleMetadata to convert
+ * @return a {@link Notification.BubbleMetadata} containing the same data if compatMetadata
+ * is non-null, otherwise null.
+ */
+ @RequiresApi(29)
+ public static @Nullable android.app.Notification.BubbleMetadata toPlatform(
+ @Nullable BubbleMetadata compatMetadata) {
+ if (compatMetadata == null) {
+ return null;
+ }
+
+ android.app.Notification.BubbleMetadata.Builder platformMetadataBuilder =
+ new android.app.Notification.BubbleMetadata.Builder()
+ .setAutoExpandBubble(compatMetadata.getAutoExpandBubble())
+ .setDeleteIntent(compatMetadata.getDeleteIntent())
+ .setIcon(compatMetadata.getIcon().toIcon())
+ .setIntent(compatMetadata.getIntent())
+ .setSuppressNotification(
+ compatMetadata.isNotificationSuppressed());
+
+ if (compatMetadata.getDesiredHeight() != 0) {
+ platformMetadataBuilder.setDesiredHeight(compatMetadata.getDesiredHeight());
+ }
+
+ if (compatMetadata.getDesiredHeightResId() != 0) {
+ platformMetadataBuilder.setDesiredHeightResId(
+ compatMetadata.getDesiredHeightResId());
+ }
+
+ return platformMetadataBuilder.build();
+ }
+
+ /**
+ * Converts a platform-level {@link Notification.BubbleMetadata} to a
+ * {@link NotificationCompat.BubbleMetadata}.
+ *
+ * @param platformMetadata the {@link Notification.BubbleMetadata} to convert
+ * @return a {@link NotificationCompat.BubbleMetadata} containing the same data if
+ * platformMetadata is non-null, otherwise null.
+ */
+ @RequiresApi(29)
+ public static @Nullable BubbleMetadata fromPlatform(
+ @Nullable android.app.Notification.BubbleMetadata platformMetadata) {
+ if (platformMetadata == null) {
+ return null;
+ }
+
+ BubbleMetadata.Builder compatBuilder = new BubbleMetadata.Builder()
+ .setAutoExpandBubble(platformMetadata.getAutoExpandBubble())
+ .setDeleteIntent(platformMetadata.getDeleteIntent())
+ .setIcon(IconCompat.createFromIcon(platformMetadata.getIcon()))
+ .setIntent(platformMetadata.getIntent())
+ .setSuppressNotification(
+ platformMetadata.isNotificationSuppressed());
+
+ if (platformMetadata.getDesiredHeight() != 0) {
+ compatBuilder.setDesiredHeight(platformMetadata.getDesiredHeight());
+ }
+
+ if (platformMetadata.getDesiredHeightResId() != 0) {
+ compatBuilder.setDesiredHeightResId(platformMetadata.getDesiredHeightResId());
+ }
+
+ return compatBuilder.build();
+ }
+
+ private void setFlags(int flags) {
+ mFlags = flags;
+ }
+
+ /**
+ * Builder to construct a {@link BubbleMetadata} object.
+ */
+ public static final class Builder {
+
+ private PendingIntent mPendingIntent;
+ private IconCompat mIcon;
+ private int mDesiredHeight;
+ @DimenRes private int mDesiredHeightResId;
+ private int mFlags;
+ private PendingIntent mDeleteIntent;
+
+ /**
+ * Constructs a new builder object.
+ */
+ public Builder() {
+ }
+
+ /**
+ * Sets the intent that will be used when the bubble is expanded. This will display the
+ * app content in a floating window over the existing foreground activity.
+ */
+ @NonNull
+ public BubbleMetadata.Builder setIntent(@NonNull PendingIntent intent) {
+ if (intent == null) {
+ throw new IllegalArgumentException("Bubble requires non-null pending intent");
+ }
+ mPendingIntent = intent;
+ return this;
+ }
+ /**
+ * Sets the icon that will represent the bubble when it is collapsed.
+ *
+ * <p>An icon is required and should be representative of the content within the bubble.
+ * If your app produces multiple bubbles, the image should be unique for each of them.
+ * </p>
+ *
+ * <p>The shape of a bubble icon is adaptive and can match the device theme.
+ *
+ * If your icon is bitmap-based, you should create it using
+ * {@link IconCompat#createWithAdaptiveBitmap(Bitmap)}, otherwise this method will
+ * throw.
+ *
+ * If your icon is not bitmap-based, you should expect that the icon will be tinted.
+ * </p>
+ */
+ @NonNull
+ public BubbleMetadata.Builder setIcon(@NonNull IconCompat icon) {
+ if (icon == null) {
+ throw new IllegalArgumentException("Bubbles require non-null icon");
+ }
+ if (icon.getType() == TYPE_BITMAP) {
+ throw new IllegalArgumentException("When using bitmap based icons, Bubbles "
+ + "require TYPE_ADAPTIVE_BITMAP, please use"
+ + " IconCompat#createWithAdaptiveBitmap instead");
+ }
+ mIcon = icon;
+ return this;
+ }
+
+ /**
+ * Sets the desired height in DPs for the app content defined by
+ * {@link #setIntent(PendingIntent)}, this height may not be respected if there is not
+ * enough space on the screen or if the provided height is too small to be useful.
+ * <p>
+ * If {@link #setDesiredHeightResId(int)} was previously called on this builder, the
+ * previous value set will be cleared after calling this method, and this value will
+ * be used instead.
+ */
+ @NonNull
+ public BubbleMetadata.Builder setDesiredHeight(@Dimension(unit = DP) int height) {
+ mDesiredHeight = Math.max(height, 0);
+ mDesiredHeightResId = 0;
+ return this;
+ }
+
+
+ /**
+ * Sets the desired height via resId for the app content defined by
+ * {@link #setIntent(PendingIntent)}, this height may not be respected if there is not
+ * enough space on the screen or if the provided height is too small to be useful.
+ * <p>
+ * If {@link #setDesiredHeight(int)} was previously called on this builder, the
+ * previous value set will be cleared after calling this method, and this value will
+ * be used instead.
+ */
+ @NonNull
+ public BubbleMetadata.Builder setDesiredHeightResId(@DimenRes int heightResId) {
+ mDesiredHeightResId = heightResId;
+ mDesiredHeight = 0;
+ return this;
+ }
+
+ /**
+ * If set and the app creating the bubble is in the foreground, the bubble will be
+ * posted in its expanded state, with the contents of {@link #getIntent()} in a
+ * floating window.
+ *
+ * <p>If the app creating the bubble is not in the foreground this flag has no effect.
+ * </p>
+ *
+ * <p>Generally this flag should only be set if the user has performed an action to
+ * request or create a bubble.</p>
+ */
+ @NonNull
+ public BubbleMetadata.Builder setAutoExpandBubble(boolean shouldExpand) {
+ setFlag(FLAG_AUTO_EXPAND_BUBBLE, shouldExpand);
+ return this;
+ }
+
+ /**
+ * If set and the app posting the bubble is in the foreground, the bubble will be
+ * posted <b>without</b> the associated notification in the notification shade.
+ *
+ * <p>If the app posting the bubble is not in the foreground this flag has no effect.
+ * </p>
+ *
+ * <p>Generally this flag should only be set if the user has performed an action to
+ * request or create a bubble, or if the user has seen the content in the notification
+ * and the notification is no longer relevant.</p>
+ */
+ @NonNull
+ public BubbleMetadata.Builder setSuppressNotification(
+ boolean shouldSuppressNotif) {
+ setFlag(FLAG_SUPPRESS_NOTIFICATION, shouldSuppressNotif);
+ return this;
+ }
+
+ /**
+ * Sets an optional intent to send when this bubble is explicitly removed by the user.
+ */
+ @NonNull
+ public BubbleMetadata.Builder setDeleteIntent(@Nullable PendingIntent deleteIntent) {
+ mDeleteIntent = deleteIntent;
+ return this;
+ }
+
+ /**
+ * Creates the {@link BubbleMetadata} defined by this builder.
+ * <p>Will throw {@link IllegalStateException} if required fields have not been set
+ * on this builder.</p>
+ */
+ @NonNull
+ @SuppressLint("SyntheticAccessor")
+ public BubbleMetadata build() {
+ if (mPendingIntent == null) {
+ throw new IllegalStateException("Must supply pending intent to bubble");
+ }
+ if (mIcon == null) {
+ throw new IllegalStateException("Must supply an icon for the bubble");
+ }
+ BubbleMetadata data = new BubbleMetadata(mPendingIntent, mDeleteIntent,
+ mIcon, mDesiredHeight, mDesiredHeightResId, mFlags);
+ return data;
+ }
+
+ private BubbleMetadata.Builder setFlag(int mask, boolean value) {
+ if (value) {
+ mFlags |= mask;
+ } else {
+ mFlags &= ~mask;
+ }
+ return this;
+ }
+ }
+ }
+
+
+ /**
* Get an array of Notification objects from a parcelable array bundle field.
* Update the bundle to have a typed array so fetches in the future don't need
* to do an array copy.
@@ -5175,6 +5659,22 @@
}
}
+ /**
+ * Get the {@link BubbleMetadata} for a notification that will be used to display app content in
+ * a floating window over the existing foreground activity.
+ *
+ * @param notification the notification to inspect
+ *
+ * @return the BubbleMetadata if available and set, otherwise null
+ */
+ public static @Nullable BubbleMetadata getBubbleMetadata(@NonNull Notification notification) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return BubbleMetadata.fromPlatform(notification.getBubbleMetadata());
+ } else {
+ return null;
+ }
+ }
+
@RequiresApi(20)
static Action getActionCompatFromAction(Notification.Action action) {
final RemoteInput[] remoteInputs;
@@ -5185,8 +5685,16 @@
remoteInputs = new RemoteInput[srcArray.length];
for (int i = 0; i < srcArray.length; i++) {
android.app.RemoteInput src = srcArray[i];
- remoteInputs[i] = new RemoteInput(src.getResultKey(), src.getLabel(),
- src.getChoices(), src.getAllowFreeFormInput(), src.getExtras(), null);
+ remoteInputs[i] = new RemoteInput(
+ src.getResultKey(),
+ src.getLabel(),
+ src.getChoices(),
+ src.getAllowFreeFormInput(),
+ Build.VERSION.SDK_INT >= 29
+ ? src.getEditChoicesBeforeSending()
+ : RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO,
+ src.getExtras(),
+ null);
}
}
@@ -5211,9 +5719,11 @@
Action.EXTRA_SEMANTIC_ACTION, Action.SEMANTIC_ACTION_NONE);
}
+ final boolean isContextual = Build.VERSION.SDK_INT >= 29 ? action.isContextual() : false;
+
return new Action(action.icon, action.title, action.actionIntent,
action.getExtras(), remoteInputs, null, allowGeneratedReplies,
- semanticAction, showsUserInterface);
+ semanticAction, showsUserInterface, isContextual);
}
/** Returns the invisible actions contained within the given notification. */
@@ -5397,6 +5907,18 @@
}
}
+ /**
+ * Returns whether the platform is allowed (by the app developer) to generate contextual actions
+ * for this notification.
+ */
+ public static boolean getAllowSystemGeneratedContextualActions(Notification notification) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return notification.getAllowSystemGeneratedContextualActions();
+ } else {
+ return false;
+ }
+ }
+
/** @deprecated This type should not be instantiated as it contains only static methods. */
@Deprecated
@SuppressWarnings("PrivateConstructorForUtilityClass")
diff --git a/core/src/main/java/androidx/core/app/NotificationCompatBuilder.java b/core/src/main/java/androidx/core/app/NotificationCompatBuilder.java
index ca2a3b7..1642870 100644
--- a/core/src/main/java/androidx/core/app/NotificationCompatBuilder.java
+++ b/core/src/main/java/androidx/core/app/NotificationCompatBuilder.java
@@ -205,6 +205,13 @@
.setVibrate(null);
}
}
+ if (Build.VERSION.SDK_INT >= 29) {
+ mBuilder.setAllowSystemGeneratedContextualActions(
+ b.mAllowSystemGeneratedContextualActions);
+ // TODO: Consider roundtripping NotificationCompat.BubbleMetadata on pre-Q platforms.
+ mBuilder.setBubbleMetadata(
+ NotificationCompat.BubbleMetadata.toPlatform(b.mBubbleMetadata));
+ }
}
@Override
@@ -279,6 +286,10 @@
actionBuilder.setSemanticAction(action.getSemanticAction());
}
+ if (Build.VERSION.SDK_INT >= 29) {
+ actionBuilder.setContextual(action.isContextual());
+ }
+
actionExtras.putBoolean(NotificationCompat.Action.EXTRA_SHOWS_USER_INTERFACE,
action.getShowsUserInterface());
actionBuilder.addExtras(actionExtras);
@@ -289,6 +300,7 @@
}
}
+ @SuppressWarnings("deprecation")
protected Notification buildInternal() {
if (Build.VERSION.SDK_INT >= 26) {
return mBuilder.build();
@@ -409,7 +421,6 @@
}
return notification;
} else {
- //noinspection deprecation
return mBuilder.getNotification();
}
}
diff --git a/core/src/main/java/androidx/core/app/NotificationCompatJellybean.java b/core/src/main/java/androidx/core/app/NotificationCompatJellybean.java
index 3192381..4d07e31 100644
--- a/core/src/main/java/androidx/core/app/NotificationCompatJellybean.java
+++ b/core/src/main/java/androidx/core/app/NotificationCompatJellybean.java
@@ -132,7 +132,7 @@
}
return new NotificationCompat.Action(icon, title, actionIntent, extras, remoteInputs,
dataOnlyRemoteInputs, allowGeneratedReplies,
- NotificationCompat.Action.SEMANTIC_ACTION_NONE, true);
+ NotificationCompat.Action.SEMANTIC_ACTION_NONE, true, false /* isContextual */);
}
public static Bundle writeActionAndGetExtras(
@@ -241,7 +241,8 @@
fromBundleArray(getBundleArrayFromBundle(bundle, KEY_DATA_ONLY_REMOTE_INPUTS)),
allowGeneratedReplies,
bundle.getInt(KEY_SEMANTIC_ACTION),
- bundle.getBoolean(KEY_SHOWS_USER_INTERFACE));
+ bundle.getBoolean(KEY_SHOWS_USER_INTERFACE),
+ false /* is_contextual is only supported for Q+ devices */);
}
static Bundle getBundleForAction(NotificationCompat.Action action) {
@@ -277,6 +278,7 @@
data.getCharSequence(KEY_LABEL),
data.getCharSequenceArray(KEY_CHOICES),
data.getBoolean(KEY_ALLOW_FREE_FORM_INPUT),
+ RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO, // Tap-to-edit is only supported on Q+
data.getBundle(KEY_EXTRAS),
allowedDataTypes);
}
diff --git a/core/src/main/java/androidx/core/app/RemoteInput.java b/core/src/main/java/androidx/core/app/RemoteInput.java
index e579efd..3bf4d4d 100644
--- a/core/src/main/java/androidx/core/app/RemoteInput.java
+++ b/core/src/main/java/androidx/core/app/RemoteInput.java
@@ -67,21 +67,45 @@
/** The user selected one of the choices from {@link #getChoices}. */
public static final int SOURCE_CHOICE = 1;
+ /** @hide */
+ @IntDef(value = {EDIT_CHOICES_BEFORE_SENDING_AUTO, EDIT_CHOICES_BEFORE_SENDING_DISABLED,
+ EDIT_CHOICES_BEFORE_SENDING_ENABLED})
+ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface EditChoicesBeforeSending {}
+
+ /** The platform will determine whether choices will be edited before being sent to the app. */
+ public static final int EDIT_CHOICES_BEFORE_SENDING_AUTO = 0;
+
+ /** Tapping on a choice should send the input immediately, without letting the user edit it. */
+ public static final int EDIT_CHOICES_BEFORE_SENDING_DISABLED = 1;
+
+ /** Tapping on a choice should let the user edit the input before it is sent to the app. */
+ public static final int EDIT_CHOICES_BEFORE_SENDING_ENABLED = 2;
+
private final String mResultKey;
private final CharSequence mLabel;
private final CharSequence[] mChoices;
private final boolean mAllowFreeFormTextInput;
+ @EditChoicesBeforeSending private final int mEditChoicesBeforeSending;
private final Bundle mExtras;
private final Set<String> mAllowedDataTypes;
RemoteInput(String resultKey, CharSequence label, CharSequence[] choices,
- boolean allowFreeFormTextInput, Bundle extras, Set<String> allowedDataTypes) {
+ boolean allowFreeFormTextInput, @EditChoicesBeforeSending int editChoicesBeforeSending,
+ Bundle extras, Set<String> allowedDataTypes) {
this.mResultKey = resultKey;
this.mLabel = label;
this.mChoices = choices;
this.mAllowFreeFormTextInput = allowFreeFormTextInput;
+ this.mEditChoicesBeforeSending = editChoicesBeforeSending;
this.mExtras = extras;
this.mAllowedDataTypes = allowedDataTypes;
+ if (getEditChoicesBeforeSending() == EDIT_CHOICES_BEFORE_SENDING_ENABLED
+ && !getAllowFreeFormInput()) {
+ throw new IllegalArgumentException(
+ "setEditChoicesBeforeSending requires setAllowFreeFormInput");
+ }
}
/**
@@ -133,6 +157,14 @@
}
/**
+ * Gets whether tapping on a choice should let the user edit the input before it is sent to the
+ * app.
+ */
+ @EditChoicesBeforeSending public int getEditChoicesBeforeSending() {
+ return mEditChoicesBeforeSending;
+ }
+
+ /**
* Get additional metadata carried around with this remote input.
*/
public Bundle getExtras() {
@@ -149,6 +181,8 @@
private CharSequence mLabel;
private CharSequence[] mChoices;
private boolean mAllowFreeFormTextInput = true;
+ @EditChoicesBeforeSending
+ private int mEditChoicesBeforeSending = EDIT_CHOICES_BEFORE_SENDING_AUTO;
/**
* Create a builder object for {@link androidx.core.app.RemoteInput} objects.
@@ -229,6 +263,19 @@
}
/**
+ * Specifies whether tapping on a choice should let the user edit the input before it is
+ * sent to the app. The default is {@link #EDIT_CHOICES_BEFORE_SENDING_AUTO}.
+ *
+ * It cannot be used if {@link #setAllowFreeFormInput} has been set to false.
+ */
+ @NonNull
+ public Builder setEditChoicesBeforeSending(
+ @EditChoicesBeforeSending int editChoicesBeforeSending) {
+ mEditChoicesBeforeSending = editChoicesBeforeSending;
+ return this;
+ }
+
+ /**
* Merge additional metadata into this builder.
*
* <p>Values within the Bundle will replace existing extras values in this Builder.
@@ -264,6 +311,7 @@
mLabel,
mChoices,
mAllowFreeFormTextInput,
+ mEditChoicesBeforeSending,
mExtras,
mAllowedDataTypes);
}
@@ -510,12 +558,16 @@
@RequiresApi(20)
static android.app.RemoteInput fromCompat(RemoteInput src) {
- return new android.app.RemoteInput.Builder(src.getResultKey())
- .setLabel(src.getLabel())
- .setChoices(src.getChoices())
- .setAllowFreeFormInput(src.getAllowFreeFormInput())
- .addExtras(src.getExtras())
- .build();
+ android.app.RemoteInput.Builder builder =
+ new android.app.RemoteInput.Builder(src.getResultKey())
+ .setLabel(src.getLabel())
+ .setChoices(src.getChoices())
+ .setAllowFreeFormInput(src.getAllowFreeFormInput())
+ .addExtras(src.getExtras());
+ if (Build.VERSION.SDK_INT >= 29) {
+ builder.setEditChoicesBeforeSending(src.getEditChoicesBeforeSending());
+ }
+ return builder.build();
}
@RequiresApi(16)
diff --git a/core/src/main/java/androidx/core/content/pm/ShortcutInfoCompat.java b/core/src/main/java/androidx/core/content/pm/ShortcutInfoCompat.java
index 9c903f0..e37207d 100644
--- a/core/src/main/java/androidx/core/content/pm/ShortcutInfoCompat.java
+++ b/core/src/main/java/androidx/core/content/pm/ShortcutInfoCompat.java
@@ -23,6 +23,7 @@
import android.content.pm.PackageManager;
import android.content.pm.ShortcutInfo;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.os.PersistableBundle;
import android.text.TextUtils;
@@ -91,7 +92,22 @@
if (mCategories != null) {
builder.setCategories(mCategories);
}
- builder.setExtras(buildExtrasBundle());
+
+ if (Build.VERSION.SDK_INT >= 29) {
+ if (mPersons != null && mPersons.length > 0) {
+ android.app.Person[] persons = new android.app.Person[mPersons.length];
+ for (int i = 0; i < persons.length; i++) {
+ persons[i] = mPersons[i].toAndroidPerson();
+ }
+ builder.setPersons(persons);
+ }
+ builder.setLongLived(mIsLongLived);
+ } else {
+ // ShortcutInfo.Builder#setPersons(...) and ShortcutInfo.Builder#setLongLived(...) are
+ // introduced in API 29. On older API versions, we store mPersons and mIsLongLived in
+ // the extras field of ShortcutInfo for backwards compatibility.
+ builder.setExtras(buildLegacyExtrasBundle());
+ }
return builder.build();
}
@@ -100,7 +116,7 @@
*/
@RequiresApi(22)
@RestrictTo(LIBRARY_GROUP_PREFIX)
- private PersistableBundle buildExtrasBundle() {
+ private PersistableBundle buildLegacyExtrasBundle() {
PersistableBundle bundle = new PersistableBundle();
if (mPersons != null && mPersons.length > 0) {
bundle.putInt(EXTRA_PERSON_COUNT, mPersons.length);
diff --git a/core/src/main/java/androidx/core/graphics/BlendModeCompat.java b/core/src/main/java/androidx/core/graphics/BlendModeCompat.java
new file mode 100644
index 0000000..6a00c3f
--- /dev/null
+++ b/core/src/main/java/androidx/core/graphics/BlendModeCompat.java
@@ -0,0 +1,406 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.core.graphics;
+
+/**
+ * Compat version of {@link android.graphics.BlendMode}, usages of {@link BlendModeCompat} will
+ * map to {@link android.graphics.PorterDuff.Mode} wherever possible
+ */
+public enum BlendModeCompat {
+
+ /**
+ * {@usesMathJax}
+ *
+ * Destination pixels covered by the source are cleared to 0.
+ *
+ * <p>\(\alpha_{out} = 0\)</p>
+ * <p>\(C_{out} = 0\)</p>
+ */
+ CLEAR,
+
+ /**
+ * {@usesMathJax}
+ *
+ * The source pixels replace the destination pixels.
+ *
+ * <p>\(\alpha_{out} = \alpha_{src}\)</p>
+ * <p>\(C_{out} = C_{src}\)</p>
+ */
+ SRC,
+
+ /**
+ * {@usesMathJax}
+ *
+ * The source pixels are discarded, leaving the destination intact.
+ *
+ * <p>\(\alpha_{out} = \alpha_{dst}\)</p>
+ * <p>\(C_{out} = C_{dst}\)</p>
+ */
+ DST,
+
+ /**
+ * {@usesMathJax}
+ *
+ * The source pixels are drawn over the destination pixels.
+ *
+ * <p>\(\alpha_{out} = \alpha_{src} + (1 - \alpha_{src}) * \alpha_{dst}\)</p>
+ * <p>\(C_{out} = C_{src} + (1 - \alpha_{src}) * C_{dst}\)</p>
+ */
+ SRC_OVER,
+
+ /**
+ * {@usesMathJax}
+ *
+ * The source pixels are drawn behind the destination pixels.
+ *
+ * <p>\(\alpha_{out} = \alpha_{dst} + (1 - \alpha_{dst}) * \alpha_{src}\)</p>
+ * <p>\(C_{out} = C_{dst} + (1 - \alpha_{dst}) * C_{src}\)</p>
+ */
+ DST_OVER,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Keeps the source pixels that cover the destination pixels,
+ * discards the remaining source and destination pixels.
+ *
+ * <p>\(\alpha_{out} = \alpha_{src} * \alpha_{dst}\)</p>
+ * <p>\(C_{out} = C_{src} * \alpha_{dst}\)</p>
+ */
+ SRC_IN,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Keeps the destination pixels that cover source pixels,
+ * discards the remaining source and destination pixels.
+ * <p>\(\alpha_{out} = \alpha_{src} * \alpha_{dst}\)</p>
+ * <p>\(C_{out} = C_{dst} * \alpha_{src}\)</p>
+ */
+ DST_IN,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Keeps the source pixels that do not cover destination pixels.
+ * Discards source pixels that cover destination pixels. Discards all
+ * destination pixels.
+ *
+ * <p>\(\alpha_{out} = (1 - \alpha_{dst}) * \alpha_{src}\)</p>
+ * <p>\(C_{out} = (1 - \alpha_{dst}) * C_{src}\)</p>
+ */
+ SRC_OUT,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Keeps the destination pixels that are not covered by source pixels.
+ * Discards destination pixels that are covered by source pixels. Discards all
+ * source pixels.
+ *
+ * <p>\(\alpha_{out} = (1 - \alpha_{src}) * \alpha_{dst}\)</p>
+ * <p>\(C_{out} = (1 - \alpha_{src}) * C_{dst}\)</p>
+ */
+ DST_OUT,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Discards the source pixels that do not cover destination pixels.
+ * Draws remaining source pixels over destination pixels.
+ *
+ * <p>\(\alpha_{out} = \alpha_{dst}\)</p>
+ * <p>\(C_{out} = \alpha_{dst} * C_{src} + (1 - \alpha_{src}) * C_{dst}\)</p>
+ */
+ SRC_ATOP,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Discards the destination pixels that are not covered by source pixels.
+ * Draws remaining destination pixels over source pixels.
+ *
+ * <p>\(\alpha_{out} = \alpha_{src}\)</p>
+ * <p>\(C_{out} = \alpha_{src} * C_{dst} + (1 - \alpha_{dst}) * C_{src}\)</p>
+ */
+ DST_ATOP,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Discards the source and destination pixels where source pixels
+ * cover destination pixels. Draws remaining source pixels.
+ *
+ * <p>
+ * \(\alpha_{out} = (1 - \alpha_{dst}) * \alpha_{src} + (1 - \alpha_{src}) * \alpha_{dst}\)
+ * </p>
+ * <p>\(C_{out} = (1 - \alpha_{dst}) * C_{src} + (1 - \alpha_{src}) * C_{dst}\)</p>
+ */
+ XOR,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Adds the source pixels to the destination pixels and saturates
+ * the result.
+ *
+ * <p>\(\alpha_{out} = max(0, min(\alpha_{src} + \alpha_{dst}, 1))\)</p>
+ * <p>\(C_{out} = max(0, min(C_{src} + C_{dst}, 1))\)</p>
+ */
+ PLUS,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Multiplies the source and destination pixels.
+ *
+ * <p>\(\alpha_{out} = \alpha_{src} * \alpha_{dst}\)</p>
+ * <p>\(C_{out} = C_{src} * C_{dst}\)</p>
+ *
+ */
+ MODULATE,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Adds the source and destination pixels, then subtracts the
+ * source pixels multiplied by the destination.
+ * <p>\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)</p>
+ * <p>\(C_{out} = C_{src} + C_{dst} - C_{src} * C_{dst}\)</p>
+ */
+ SCREEN,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Multiplies or screens the source and destination depending on the
+ * destination color.
+ *
+ * <p>\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)</p>
+ * <p>\(\begin{equation}
+ * C_{out} = \begin{cases} 2 * C_{src} * C_{dst} & 2 * C_{dst} \lt \alpha_{dst} \\
+ * \alpha_{src} * \alpha_{dst} - 2 (\alpha_{dst} - C_{src}) (\alpha_{src} - C_{dst}) &
+ * otherwise \end{cases}
+ * \end{equation}\)</p>
+ */
+ OVERLAY,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Retains the smallest component of the source and
+ * destination pixels.
+ * <p>\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)</p>
+ * <p>
+ * \(C_{out} =
+ * (1 - \alpha_{dst}) * C_{src} + (1 - \alpha_{src}) * C_{dst} + min(C_{src}, C_{dst})\)
+ * </p>
+ */
+ DARKEN,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Retains the largest component of the source and
+ * destination pixel.
+ * <p>\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)</p>
+ * <p>
+ * \(C_{out} =
+ * (1 - \alpha_{dst}) * C_{src} + (1 - \alpha_{src}) * C_{dst} + max(C_{src}, C_{dst})\)
+ * </p>
+ */
+ LIGHTEN,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Makes destination brighter to reflect source.
+ * \(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)
+ * </p>
+ * <p>
+ * \begin{equation}
+ * C_{out} =
+ * \begin{cases}
+ * C_{src} * (1 - \alpha_{dst}) & C_{dst} = 0 \\
+ * C_{src} + \alpha_{dst}*(1 - \alpha_{src}) & C_{src} = \alpha_{src} \\
+ * \alpha_{src} * min(\alpha_{dst}, C_{dst} * \alpha_{src}/(\alpha_{src} - C_{src}))
+ * + C_{src} *(1 - \alpha_{dst} + \alpha_{dst}*(1 - \alpha_{src}) & otherwise
+ * \end{cases}
+ * \end{equation}
+ * </p>
+ */
+ COLOR_DODGE,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Makes destination darker to reflect source.
+ *
+ * <p>
+ * \(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)
+ * </p>
+ * <p>
+ * \begin{equation}
+ * C_{out} =
+ * \begin{cases}
+ * C_{dst} + C_{src}*(1 - \alpha_{dst}) & C_{dst} = \alpha_{dst} \\
+ * \alpha_{dst}*(1 - \alpha_{src}) & C_{src} = 0 \\
+ * \alpha_{src}*(\alpha_{dst} - min(\alpha_{dst}, (\alpha_{dst}
+ * - C_{dst})*\alpha_{src}/C_{src}))
+ * + C_{src} * (1 - \alpha_{dst}) + \alpha_{dst}*(1-\alpha_{src}) & otherwise
+ * \end{cases}
+ * \end{equation}
+ * </p>
+ */
+ COLOR_BURN,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Makes destination lighter or darker, depending on source.
+ * <p>
+ * \(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)
+ * </p>
+ * <p>
+ * \begin{equation}
+ * C_{out} =
+ * \begin{cases}
+ * 2*C_{src}*C_{dst} & C_{src}*(1-\alpha_{dst}) + C_{dst}*(1-\alpha_{src}) + 2*C_{src}
+ * \leq \alpha_{src} \\
+ * \alpha_{src}*\alpha_{dst}- 2*(\alpha_{dst} - C_{dst})*(\alpha_{src} - C_{src})
+ * & otherwise
+ * \end{cases}
+ * \end{equation}
+ * </p>
+ */
+ HARD_LIGHT,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Makes destination lighter or darker, depending on source.
+ * <p>
+ * Where
+ * \begin{equation}
+ * m =
+ * \begin{cases}
+ * C_{dst} / \alpha_{dst} & \alpha_{dst} \gt 0 \\
+ * 0 & otherwise
+ * \end{cases}
+ * \end{equation}
+ * </p>
+ * <p>
+ * \begin{equation}
+ * g =
+ * \begin{cases}
+ * (16 * m * m + 4 * m) * (m - 1) + 7 * m & 4 * C_{dst} \leq \alpha_{dst} \\
+ * \sqrt m - m & otherwise
+ * \end{cases}
+ * \end{equation}
+ * </p>
+ * <p>
+ * \begin{equation}
+ * f =
+ * \begin{cases}
+ * C_{dst} * (\alpha_{src} + (2 * C_{src} - \alpha_{src}) * (1 - m))
+ * & 2 * C_{src} \leq \alpha_{src} \\
+ * C_{dst} * \alpha_{src} + \alpha_{dst} * (2 * C_{src} - \alpha_{src}) * g
+ * & otherwise
+ * \end{cases}
+ * \end{equation}
+ * </p>
+ * <p>
+ * \begin{equation}
+ * \alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}
+ * \end{equation}
+ * \begin{equation}
+ * C_{out} = C_{src} / \alpha_{dst} + C_{dst} / \alpha_{src} + f
+ * \end{equation}
+ * </p>
+ */
+ SOFT_LIGHT,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Subtracts darker from lighter with higher contrast.
+ * <p>
+ * \begin{equation}
+ * \alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}
+ * \end{equation}
+ * </p>
+ * <p>
+ * \begin{equation}
+ * C_{out} = C_{src} + C_{dst} - 2 * min(C_{src}
+ * * \alpha_{dst}, C_{dst} * \alpha_{src})
+ * \end{equation}
+ * </p>
+ */
+ DIFFERENCE,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Subtracts darker from lighter with lower contrast.
+ * <p>
+ * \begin{equation}
+ * \alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}
+ * \end{equation}
+ * </p>
+ * <p>
+ * \begin{equation}
+ * C_{out} = C_{src} + C_{dst} - 2 * C_{src} * C_{dst}
+ * \end{equation}
+ * </p>
+ */
+ EXCLUSION,
+
+ /**
+ * {@usesMathJax}
+ *
+ * Multiplies the source and destination pixels.
+ * <p>\(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)</p>
+ * <p>\(C_{out} =
+ * C_{src} * (1 - \alpha_{dst}) + C_{dst} * (1 - \alpha_{src}) + (C_{src} * C_{dst})\)
+ * </p>
+ */
+ MULTIPLY,
+
+ /**
+ * Replaces hue of destination with hue of source, leaving saturation
+ * and luminosity unchanged.
+ */
+ HUE,
+
+ /**
+ * Replaces saturation of destination saturation hue of source, leaving hue and
+ * luminosity unchanged.
+ */
+ SATURATION,
+
+ /**
+ * Replaces hue and saturation of destination with hue and saturation of source,
+ * leaving luminosity unchanged.
+ */
+ COLOR,
+
+ /**
+ * Replaces luminosity of destination with luminosity of source, leaving hue and
+ * saturation unchanged.
+ */
+ LUMINOSITY
+}
diff --git a/core/src/main/java/androidx/core/graphics/Insets.java b/core/src/main/java/androidx/core/graphics/Insets.java
new file mode 100644
index 0000000..6eadbc4
--- /dev/null
+++ b/core/src/main/java/androidx/core/graphics/Insets.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.core.graphics;
+
+import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX;
+
+import android.graphics.Rect;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.RequiresApi;
+import androidx.annotation.RestrictTo;
+
+/**
+ * An Insets instance holds four integer offsets which describe changes to the four
+ * edges of a Rectangle. By convention, positive values move edges towards the
+ * centre of the rectangle.
+ * <p>
+ * Insets are immutable so may be treated as values.
+ */
+public final class Insets {
+ @NonNull
+ public static final Insets NONE = new Insets(0, 0, 0, 0);
+
+ public final int left;
+ public final int top;
+ public final int right;
+ public final int bottom;
+
+ private Insets(int left, int top, int right, int bottom) {
+ this.left = left;
+ this.top = top;
+ this.right = right;
+ this.bottom = bottom;
+ }
+
+ // Factory methods
+
+ /**
+ * Return an Insets instance with the appropriate values.
+ *
+ * @param left the left inset
+ * @param top the top inset
+ * @param right the right inset
+ * @param bottom the bottom inset
+ * @return Insets instance with the appropriate values
+ */
+ @NonNull
+ public static Insets of(int left, int top, int right, int bottom) {
+ if (left == 0 && top == 0 && right == 0 && bottom == 0) {
+ return NONE;
+ }
+ return new Insets(left, top, right, bottom);
+ }
+
+ /**
+ * Return an Insets instance with the appropriate values.
+ *
+ * @param r the rectangle from which to take the values
+ * @return an Insets instance with the appropriate values
+ */
+ @NonNull
+ public static Insets of(@NonNull Rect r) {
+ return of(r.left, r.top, r.right, r.bottom);
+ }
+
+ /**
+ * Two Insets instances are equal iff they belong to the same class and their fields are
+ * pairwise equal.
+ *
+ * @param o the object to compare this instance with.
+ * @return true iff this object is equal {@code o}
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Insets insets = (Insets) o;
+
+ if (bottom != insets.bottom) return false;
+ if (left != insets.left) return false;
+ if (right != insets.right) return false;
+ if (top != insets.top) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = left;
+ result = 31 * result + top;
+ result = 31 * result + right;
+ result = 31 * result + bottom;
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "Insets{left=" + left + ", top=" + top
+ + ", right=" + right + ", bottom=" + bottom + '}';
+ }
+
+ /**
+ * @hide
+ */
+ @RequiresApi(api = 29)
+ @NonNull
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public static Insets wrap(@NonNull android.graphics.Insets insets) {
+ return Insets.of(insets.left, insets.top, insets.right, insets.bottom);
+ }
+}
diff --git a/core/src/main/java/androidx/core/graphics/PaintCompat.java b/core/src/main/java/androidx/core/graphics/PaintCompat.java
index 7caa3e5..0add3b7 100644
--- a/core/src/main/java/androidx/core/graphics/PaintCompat.java
+++ b/core/src/main/java/androidx/core/graphics/PaintCompat.java
@@ -16,11 +16,20 @@
package androidx.core.graphics;
+import android.graphics.BlendMode;
+import android.graphics.BlendModeColorFilter;
import android.graphics.Paint;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
+import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.os.Build;
+import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
+import androidx.annotation.VisibleForTesting;
import androidx.core.util.Pair;
/**
@@ -104,6 +113,193 @@
return !rects.first.equals(rects.second);
}
+ /**
+ * Configure the corresponding BlendMode on the given paint. If the Android platform supports
+ * the blend mode natively, it will fall back on the framework implementation of either
+ * BlendMode or PorterDuff mode. If it is not supported then this method is a no-op
+ * @param paint target Paint to which the BlendMode will be applied
+ * @param blendMode BlendMode to configure on the paint if it is supported by the platform
+ * version. A value of null removes the BlendMode from the Paint and restores
+ * it to the default
+ * @return true if the specified BlendMode as applied successfully, false if the platform
+ * version does not support this BlendMode. If the BlendMode is not supported, this falls
+ * back to the default BlendMode
+ */
+ public static boolean setBlendMode(@NonNull Paint paint, @Nullable BlendModeCompat blendMode) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ paint.setBlendMode(blendMode != null ? obtainBlendModeFromCompat(blendMode) : null);
+ // All blend modes supported in Q
+ return true;
+ } else if (blendMode != null) {
+ PorterDuff.Mode mode = obtainPorterDuffFromCompat(blendMode);
+ paint.setXfermode(mode != null ? new PorterDuffXfermode(mode) : null);
+ // If the BlendMode has an equivalent PorterDuff mode, return true,
+ // otherwise return false
+ return mode != null;
+ } else {
+ // Configuration of a null BlendMode falls back to the default which is supported in
+ // all platform levels
+ paint.setXfermode(null);
+ return true;
+ }
+ }
+
+ /**
+ * Configure the tintable color filter on the given paint. If the Android platform supports
+ * the blend mode natively, it will fall back on the framework implementation of either
+ * BlendModeColorFilter or PorterDuffColorFilter. If it is not supported then this method is
+ * a no-op
+ * @param paint target Paint to which the ColorFilter will be applied
+ * @param color color which to apply the blend mode with
+ * @param blendModeCompat BlendMode to configure on the color filter if it is supported by the
+ * platform. A value of null removes the ColorFilter from the paint
+ * @return true if the color filter was applied successfully with the provided BlendMode, false
+ * if the platform version does not support this BlendMode. if the BlendMode is not supported
+ * the ColorFilter is removed from the Paint
+ */
+ public static boolean setBlendModeColorFilter(@NonNull Paint paint, @ColorInt int color,
+ @Nullable BlendModeCompat blendModeCompat) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ BlendMode blendMode = obtainBlendModeFromCompat(blendModeCompat);
+ if (blendMode != null) {
+ paint.setColorFilter(new BlendModeColorFilter(color, blendMode));
+ } else {
+ paint.setColorFilter(null);
+ }
+ // All blend modes supported in Q
+ return true;
+ } else if (blendModeCompat != null) {
+ PorterDuff.Mode porterDuffMode = obtainPorterDuffFromCompat(blendModeCompat);
+ paint.setColorFilter(porterDuffMode != null
+ ? new PorterDuffColorFilter(color, porterDuffMode) : null);
+ // If the BlendMode has an equivalent PorterDuff mode, apply the corresponding
+ // PorterDuffColorFilter, otherwise remove the existing ColorFilter
+ return porterDuffMode != null;
+ } else {
+ // Passing in null removes the ColorFilter on the paint
+ paint.setColorFilter(null);
+ return true;
+ }
+ }
+
+ @RequiresApi(29)
+ @VisibleForTesting
+ /* package */ static @Nullable BlendMode obtainBlendModeFromCompat(
+ @NonNull BlendModeCompat blendModeCompat) {
+ switch (blendModeCompat) {
+ case CLEAR:
+ return BlendMode.CLEAR;
+ case SRC:
+ return BlendMode.SRC;
+ case DST:
+ return BlendMode.DST;
+ case SRC_OVER:
+ return BlendMode.SRC_OVER;
+ case DST_OVER:
+ return BlendMode.SRC_OVER;
+ case SRC_IN:
+ return BlendMode.SRC_IN;
+ case DST_IN:
+ return BlendMode.DST_IN;
+ case SRC_OUT:
+ return BlendMode.SRC_OUT;
+ case DST_OUT:
+ return BlendMode.DST_OUT;
+ case SRC_ATOP:
+ return BlendMode.SRC_ATOP;
+ case DST_ATOP:
+ return BlendMode.DST_ATOP;
+ case XOR:
+ return BlendMode.XOR;
+ case PLUS:
+ return BlendMode.PLUS;
+ case MODULATE:
+ return BlendMode.MODULATE;
+ case SCREEN:
+ return BlendMode.SCREEN;
+ case OVERLAY:
+ return BlendMode.OVERLAY;
+ case DARKEN:
+ return BlendMode.DARKEN;
+ case LIGHTEN:
+ return BlendMode.LIGHTEN;
+ case COLOR_DODGE:
+ return BlendMode.COLOR_DODGE;
+ case COLOR_BURN:
+ return BlendMode.COLOR_BURN;
+ case HARD_LIGHT:
+ return BlendMode.HARD_LIGHT;
+ case SOFT_LIGHT:
+ return BlendMode.SOFT_LIGHT;
+ case DIFFERENCE:
+ return BlendMode.DIFFERENCE;
+ case EXCLUSION:
+ return BlendMode.EXCLUSION;
+ case MULTIPLY:
+ return BlendMode.MULTIPLY;
+ case HUE:
+ return BlendMode.HUE;
+ case SATURATION:
+ return BlendMode.SATURATION;
+ case COLOR:
+ return BlendMode.COLOR;
+ case LUMINOSITY:
+ return BlendMode.LUMINOSITY;
+ default:
+ return null;
+ }
+ }
+
+ @VisibleForTesting
+ /* package */ static @Nullable PorterDuff.Mode obtainPorterDuffFromCompat(
+ @Nullable BlendModeCompat blendModeCompat) {
+ if (blendModeCompat != null) {
+ switch (blendModeCompat) {
+ case CLEAR:
+ return PorterDuff.Mode.CLEAR;
+ case SRC:
+ return PorterDuff.Mode.SRC;
+ case DST:
+ return PorterDuff.Mode.DST;
+ case SRC_OVER:
+ return PorterDuff.Mode.SRC_OVER;
+ case DST_OVER:
+ return PorterDuff.Mode.DST_OVER;
+ case SRC_IN:
+ return PorterDuff.Mode.SRC_IN;
+ case DST_IN:
+ return PorterDuff.Mode.DST_IN;
+ case SRC_OUT:
+ return PorterDuff.Mode.SRC_OUT;
+ case DST_OUT:
+ return PorterDuff.Mode.DST_OUT;
+ case SRC_ATOP:
+ return PorterDuff.Mode.SRC_ATOP;
+ case DST_ATOP:
+ return PorterDuff.Mode.DST_ATOP;
+ case XOR:
+ return PorterDuff.Mode.XOR;
+ case PLUS:
+ return PorterDuff.Mode.ADD;
+ // b/73224934 PorterDuff Multiply maps to Skia Modulate
+ case MODULATE:
+ return PorterDuff.Mode.MULTIPLY;
+ case SCREEN:
+ return PorterDuff.Mode.SCREEN;
+ case OVERLAY:
+ return PorterDuff.Mode.OVERLAY;
+ case DARKEN:
+ return PorterDuff.Mode.DARKEN;
+ case LIGHTEN:
+ return PorterDuff.Mode.LIGHTEN;
+ default:
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+
private static Pair<Rect, Rect> obtainEmptyRects() {
Pair<Rect, Rect> rects = sRectThreadLocal.get();
if (rects == null) {
diff --git a/core/src/main/java/androidx/core/graphics/TypefaceCompat.java b/core/src/main/java/androidx/core/graphics/TypefaceCompat.java
index a55a4134..8811f03 100644
--- a/core/src/main/java/androidx/core/graphics/TypefaceCompat.java
+++ b/core/src/main/java/androidx/core/graphics/TypefaceCompat.java
@@ -18,6 +18,7 @@
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Typeface;
@@ -40,10 +41,13 @@
/**
* Helper for accessing features in {@link Typeface}.
*/
+@SuppressLint("NewApi") // TODO: Remove this suppression once Q SDK is released.
public class TypefaceCompat {
private static final TypefaceCompatBaseImpl sTypefaceCompatImpl;
static {
- if (Build.VERSION.SDK_INT >= 28) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ sTypefaceCompatImpl = new TypefaceCompatApi29Impl();
+ } else if (Build.VERSION.SDK_INT >= 28) {
sTypefaceCompatImpl = new TypefaceCompatApi28Impl();
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
sTypefaceCompatImpl = new TypefaceCompatApi26Impl();
diff --git a/core/src/main/java/androidx/core/graphics/TypefaceCompatApi29Impl.java b/core/src/main/java/androidx/core/graphics/TypefaceCompatApi29Impl.java
new file mode 100644
index 0000000..c05d0ae
--- /dev/null
+++ b/core/src/main/java/androidx/core/graphics/TypefaceCompatApi29Impl.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.core.graphics;
+
+import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Typeface;
+import android.graphics.fonts.Font;
+import android.graphics.fonts.FontFamily;
+import android.graphics.fonts.FontStyle;
+import android.os.CancellationSignal;
+import android.os.ParcelFileDescriptor;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
+import androidx.annotation.RestrictTo;
+import androidx.core.content.res.FontResourcesParserCompat;
+import androidx.core.provider.FontsContractCompat;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/** @hide */
+@RestrictTo(LIBRARY_GROUP)
+@RequiresApi(29)
+public class TypefaceCompatApi29Impl extends TypefaceCompatBaseImpl {
+ @Override
+ protected FontsContractCompat.FontInfo findBestInfo(FontsContractCompat.FontInfo[] fonts,
+ int style) {
+ throw new RuntimeException("Do not use this function in API 29 or later.");
+ }
+
+ // Caller must close the stream.
+ @Override
+ protected Typeface createFromInputStream(Context context, InputStream is) {
+ throw new RuntimeException("Do not use this function in API 29 or later.");
+ }
+
+ @Nullable
+ @Override
+ public Typeface createFromFontInfo(Context context,
+ @Nullable CancellationSignal cancellationSignal,
+ @NonNull FontsContractCompat.FontInfo[] fonts, int style) {
+ FontFamily.Builder familyBuilder = null;
+ final ContentResolver resolver = context.getContentResolver();
+ for (FontsContractCompat.FontInfo font : fonts) {
+ try (ParcelFileDescriptor pfd = resolver.openFileDescriptor(font.getUri(), "r",
+ cancellationSignal)) {
+ if (pfd == null) {
+ continue; // keep adding succeeded fonts.
+ }
+ final Font platformFont = new Font.Builder(pfd)
+ .setWeight(font.getWeight())
+ .setSlant(font.isItalic() ? FontStyle.FONT_SLANT_ITALIC
+ : FontStyle.FONT_SLANT_UPRIGHT)
+ .setTtcIndex(font.getTtcIndex())
+ .build(); // TODO: font variation settings?
+ if (familyBuilder == null) {
+ familyBuilder = new FontFamily.Builder(platformFont);
+ } else {
+ familyBuilder.addFont(platformFont);
+ }
+ } catch (IOException e) {
+ // keep adding succeeded fonts.
+ }
+ }
+ if (familyBuilder == null) {
+ return null; // No font is added. Give up.
+ }
+ final FontStyle defaultStyle = new FontStyle(
+ (style & Typeface.BOLD) != 0 ? FontStyle.FONT_WEIGHT_BOLD
+ : FontStyle.FONT_WEIGHT_NORMAL,
+ (style & Typeface.ITALIC) != 0 ? FontStyle.FONT_SLANT_ITALIC
+ : FontStyle.FONT_SLANT_UPRIGHT
+ );
+ return new Typeface.CustomFallbackBuilder(familyBuilder.build())
+ .setStyle(defaultStyle)
+ .build();
+ }
+
+ @Nullable
+ @Override
+ public Typeface createFromFontFamilyFilesResourceEntry(Context context,
+ FontResourcesParserCompat.FontFamilyFilesResourceEntry familyEntry, Resources resources,
+ int style) {
+ FontFamily.Builder familyBuilder = null;
+ for (FontResourcesParserCompat.FontFileResourceEntry entry : familyEntry.getEntries()) {
+ try {
+ final Font platformFont = new Font.Builder(resources, entry.getResourceId())
+ .setWeight(entry.getWeight())
+ .setSlant(entry.isItalic() ? FontStyle.FONT_SLANT_ITALIC
+ : FontStyle.FONT_SLANT_UPRIGHT)
+ .setTtcIndex(entry.getTtcIndex())
+ .setFontVariationSettings(entry.getVariationSettings())
+ .build();
+ if (familyBuilder == null) {
+ familyBuilder = new FontFamily.Builder(platformFont);
+ } else {
+ familyBuilder.addFont(platformFont);
+ }
+ } catch (IOException e) {
+ // keep adding succeeded fonts
+ }
+ }
+ if (familyBuilder == null) {
+ return null; // No font is added. Give up
+ }
+ final FontStyle defaultStyle = new FontStyle(
+ (style & Typeface.BOLD) != 0 ? FontStyle.FONT_WEIGHT_BOLD
+ : FontStyle.FONT_WEIGHT_NORMAL,
+ (style & Typeface.ITALIC) != 0 ? FontStyle.FONT_SLANT_ITALIC
+ : FontStyle.FONT_SLANT_UPRIGHT
+ );
+ return new Typeface.CustomFallbackBuilder(familyBuilder.build())
+ .setStyle(defaultStyle)
+ .build();
+ }
+
+ /**
+ * Used by Resources to load a font resource of type font file.
+ */
+ @Nullable
+ @Override
+ public Typeface createFromResourcesFontFile(
+ Context context, Resources resources, int id, String path, int style) {
+ FontFamily family = null;
+ try {
+ family = new FontFamily.Builder(new Font.Builder(resources, id).build()).build();
+ } catch (IOException e) {
+ return null;
+ }
+ final FontStyle defaultStyle = new FontStyle(
+ (style & Typeface.BOLD) != 0 ? FontStyle.FONT_WEIGHT_BOLD
+ : FontStyle.FONT_WEIGHT_NORMAL,
+ (style & Typeface.ITALIC) != 0 ? FontStyle.FONT_SLANT_ITALIC
+ : FontStyle.FONT_SLANT_UPRIGHT
+ );
+ return new Typeface.CustomFallbackBuilder(family).setStyle(defaultStyle).build();
+ }
+
+}
diff --git a/core/src/main/java/androidx/core/os/BuildCompat.java b/core/src/main/java/androidx/core/os/BuildCompat.java
index 97578a4..4b0a60b 100644
--- a/core/src/main/java/androidx/core/os/BuildCompat.java
+++ b/core/src/main/java/androidx/core/os/BuildCompat.java
@@ -94,16 +94,13 @@
/**
* Checks if the device is running on a pre-release version of Android Q or newer.
* <p>
- * <strong>Note:</strong> This method will return {@code false} on devices running release
- * versions of Android. When Android Q is finalized for release, this method will be deprecated
- * and all calls should be replaced with {@code Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q}.
- *
* @return {@code true} if Q APIs are available for use, {@code false} otherwise
+ * @deprecated Android Q is a finalized release and this method is no longer necessary. It
+ * will be removed in a future release of the Support Library. Instead, use
+ * {@code Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q}.
*/
- // TODO Inline usages, update ObsoleteBuildCompatUsageDetector, and deprecate once Q is final.
+ @Deprecated
public static boolean isAtLeastQ() {
- return VERSION.CODENAME.length() == 1
- && VERSION.CODENAME.charAt(0) >= 'Q'
- && VERSION.CODENAME.charAt(0) <= 'Z';
+ return VERSION.SDK_INT >= 29;
}
}
diff --git a/core/src/main/java/androidx/core/text/PrecomputedTextCompat.java b/core/src/main/java/androidx/core/text/PrecomputedTextCompat.java
index 66d1a3e..c165b45e 100644
--- a/core/src/main/java/androidx/core/text/PrecomputedTextCompat.java
+++ b/core/src/main/java/androidx/core/text/PrecomputedTextCompat.java
@@ -18,6 +18,7 @@
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX;
+import android.annotation.SuppressLint;
import android.os.Build;
import android.text.Layout;
import android.text.PrecomputedText;
@@ -191,9 +192,18 @@
}
}
+ @SuppressLint("NewApi") // TODO: Remove once Q SDK is released
Params(@NonNull TextPaint paint, @NonNull TextDirectionHeuristic textDir,
int strategy, int frequency) {
- mWrapped = null;
+ if (Build.VERSION.SDK_INT >= 29) {
+ mWrapped = new PrecomputedText.Params.Builder(paint)
+ .setBreakStrategy(strategy)
+ .setHyphenationFrequency(frequency)
+ .setTextDirection(textDir)
+ .build();
+ } else {
+ mWrapped = null;
+ }
mPaint = paint;
mTextDir = textDir;
mBreakStrategy = strategy;
@@ -206,7 +216,7 @@
mTextDir = wrapped.getTextDirection();
mBreakStrategy = wrapped.getBreakStrategy();
mHyphenationFrequency = wrapped.getHyphenationFrequency();
- mWrapped = null;
+ mWrapped = (Build.VERSION.SDK_INT >= 29) ? wrapped : null;
}
/**
@@ -262,11 +272,6 @@
*/
@RestrictTo(LIBRARY_GROUP_PREFIX)
public boolean equalsWithoutTextDirection(@NonNull Params other) {
-
- if (mWrapped != null) {
- return mWrapped.equals(other.mWrapped);
- }
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (mBreakStrategy != other.getBreakStrategy()) {
return false;
@@ -422,6 +427,7 @@
* @param params parameters that define how text will be precomputed
* @return A {@link PrecomputedText}
*/
+ @SuppressLint("NewApi") // TODO: Remove once Q SDK is released
public static PrecomputedTextCompat create(@NonNull CharSequence text, @NonNull Params params) {
Preconditions.checkNotNull(text);
Preconditions.checkNotNull(params);
@@ -429,6 +435,11 @@
try {
TraceCompat.beginSection("PrecomputedText");
+ if (Build.VERSION.SDK_INT >= 29 && params.mWrapped != null) {
+ return new PrecomputedTextCompat(
+ PrecomputedText.create(text, params.mWrapped), params);
+ }
+
ArrayList<Integer> ends = new ArrayList<>();
int paraEnd = 0;
@@ -488,7 +499,7 @@
mText = precomputed;
mParams = params;
mParagraphEnds = null;
- mWrapped = null;
+ mWrapped = (Build.VERSION.SDK_INT >= 29) ? precomputed : null;
}
/**
@@ -515,24 +526,39 @@
/**
* Returns the count of paragraphs.
*/
+ @SuppressLint("NewApi") // TODO: Remove once Q SDK is released
public @IntRange(from = 0) int getParagraphCount() {
- return mParagraphEnds.length;
+ if (Build.VERSION.SDK_INT >= 29) {
+ return mWrapped.getParagraphCount();
+ } else {
+ return mParagraphEnds.length;
+ }
}
/**
* Returns the paragraph start offset of the text.
*/
+ @SuppressLint("NewApi") // TODO: Remove once Q SDK is released
public @IntRange(from = 0) int getParagraphStart(@IntRange(from = 0) int paraIndex) {
Preconditions.checkArgumentInRange(paraIndex, 0, getParagraphCount(), "paraIndex");
- return paraIndex == 0 ? 0 : mParagraphEnds[paraIndex - 1];
+ if (Build.VERSION.SDK_INT >= 29) {
+ return mWrapped.getParagraphStart(paraIndex);
+ } else {
+ return paraIndex == 0 ? 0 : mParagraphEnds[paraIndex - 1];
+ }
}
/**
* Returns the paragraph end offset of the text.
*/
+ @SuppressLint("NewApi") // TODO: Remove once Q SDK is released
public @IntRange(from = 0) int getParagraphEnd(@IntRange(from = 0) int paraIndex) {
Preconditions.checkArgumentInRange(paraIndex, 0, getParagraphCount(), "paraIndex");
- return mParagraphEnds[paraIndex];
+ if (Build.VERSION.SDK_INT >= 29) {
+ return mWrapped.getParagraphEnd(paraIndex);
+ } else {
+ return mParagraphEnds[paraIndex];
+ }
}
/**
@@ -646,25 +672,35 @@
/**
* @throws IllegalArgumentException if {@link MetricAffectingSpan} is specified.
*/
+ @SuppressLint("NewApi") // TODO: Remove once Q SDK is released
@Override
public void setSpan(Object what, int start, int end, int flags) {
if (what instanceof MetricAffectingSpan) {
throw new IllegalArgumentException(
"MetricAffectingSpan can not be set to PrecomputedText.");
}
- mText.setSpan(what, start, end, flags);
+ if (Build.VERSION.SDK_INT >= 29) {
+ mWrapped.setSpan(what, start, end, flags);
+ } else {
+ mText.setSpan(what, start, end, flags);
+ }
}
/**
* @throws IllegalArgumentException if {@link MetricAffectingSpan} is specified.
*/
+ @SuppressLint("NewApi") // TODO: Remove once Q SDK is released
@Override
public void removeSpan(Object what) {
if (what instanceof MetricAffectingSpan) {
throw new IllegalArgumentException(
"MetricAffectingSpan can not be removed from PrecomputedText.");
}
- mText.removeSpan(what);
+ if (Build.VERSION.SDK_INT >= 29) {
+ mWrapped.removeSpan(what);
+ } else {
+ mText.removeSpan(what);
+ }
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -672,9 +708,15 @@
//
// Just proxy for underlying mText if appropriate.
+ @SuppressLint("NewApi") // TODO: Remove once Q SDK is released
@Override
public <T> T[] getSpans(int start, int end, Class<T> type) {
- return mText.getSpans(start, end, type);
+ if (Build.VERSION.SDK_INT >= 29) {
+ return mWrapped.getSpans(start, end, type);
+ } else {
+ return mText.getSpans(start, end, type);
+ }
+
}
@Override
diff --git a/core/src/main/java/androidx/core/view/ViewCompat.java b/core/src/main/java/androidx/core/view/ViewCompat.java
index fc3c39e..bf5e710 100644
--- a/core/src/main/java/androidx/core/view/ViewCompat.java
+++ b/core/src/main/java/androidx/core/view/ViewCompat.java
@@ -74,6 +74,7 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
@@ -904,6 +905,15 @@
private static @Nullable View.AccessibilityDelegate
getAccessibilityDelegateInternal(@NonNull View v) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return v.getAccessibilityDelegate();
+ } else {
+ return getAccessibilityDelegateThroughReflection(v);
+ }
+ }
+
+ private static @Nullable View.AccessibilityDelegate getAccessibilityDelegateThroughReflection(
+ @NonNull View v) {
if (sAccessibilityDelegateCheckFailed) {
return null; // View implementation might have changed.
}
@@ -2486,6 +2496,40 @@
}
/**
+ * Sets a list of areas within this view's post-layout coordinate space where the system
+ * should not intercept touch or other pointing device gestures. <em>This method should
+ * be called by {@link View#onLayout(boolean, int, int, int, int)} or
+ * {@link View#onDraw(Canvas)}.</em>
+ * <p>
+ * On devices running API 28 and below, this method has no effect.
+ *
+ * @param rects A list of precision gesture regions that this view needs to function correctly
+ * @see View#setSystemGestureExclusionRects
+ */
+ public static void setSystemGestureExclusionRects(@NonNull View view,
+ @NonNull List<Rect> rects) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ view.setSystemGestureExclusionRects(rects);
+ }
+ }
+
+ /**
+ * Retrieve the list of areas within this view's post-layout coordinate space where the system
+ * should not intercept touch or other pointing device gestures.
+ * <p>
+ * On devices running API 28 and below, this method always returns an empty list.
+ *
+ * @see View#getSystemGestureExclusionRects
+ */
+ @NonNull
+ public static List<Rect> getSystemGestureExclusionRects(@NonNull View view) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return view.getSystemGestureExclusionRects();
+ }
+ return Collections.emptyList();
+ }
+
+ /**
* Controls whether the entire hierarchy under this view will save its
* state when a state saving traversal occurs from its parent.
*
diff --git a/core/src/main/java/androidx/core/view/ViewPropertyAnimatorCompat.java b/core/src/main/java/androidx/core/view/ViewPropertyAnimatorCompat.java
index 8963c2b..b645fb59 100644
--- a/core/src/main/java/androidx/core/view/ViewPropertyAnimatorCompat.java
+++ b/core/src/main/java/androidx/core/view/ViewPropertyAnimatorCompat.java
@@ -18,6 +18,7 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
+import android.annotation.SuppressLint;
import android.os.Build;
import android.view.View;
import android.view.animation.Interpolator;
@@ -69,6 +70,7 @@
}
@Override
+ @SuppressLint("WrongConstant")
public void onAnimationEnd(View view) {
if (mVpa.mOldLayerType > -1) {
view.setLayerType(mVpa.mOldLayerType, null);
@@ -672,6 +674,7 @@
* @see View#setLayerType(int, android.graphics.Paint)
* @return This object, allowing calls to methods in this class to be chained.
*/
+ @SuppressLint("WrongConstant")
public ViewPropertyAnimatorCompat withLayer() {
View view;
if ((view = mView.get()) != null) {
diff --git a/core/src/main/java/androidx/core/view/WindowInsetsCompat.java b/core/src/main/java/androidx/core/view/WindowInsetsCompat.java
index 4623ca3..d0f200d 100644
--- a/core/src/main/java/androidx/core/view/WindowInsetsCompat.java
+++ b/core/src/main/java/androidx/core/view/WindowInsetsCompat.java
@@ -19,8 +19,13 @@
import static android.os.Build.VERSION.SDK_INT;
import android.graphics.Rect;
+import android.os.Build;
import android.view.WindowInsets;
+
+import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.core.graphics.Insets;
+import androidx.core.util.ObjectsCompat;
/**
* Describes a set of insets for window content.
@@ -372,6 +377,119 @@
}
}
+ /**
+ * Returns the system window insets in pixels.
+ *
+ * <p>The system window inset represents the area of a full-screen window that is
+ * partially or fully obscured by the status bar, navigation bar, IME or other system windows.
+ * </p>
+ *
+ * @return The system window insets
+ * @see #getSystemWindowInsetLeft()
+ * @see #getSystemWindowInsetTop()
+ * @see #getSystemWindowInsetRight()
+ * @see #getSystemWindowInsetBottom()
+ */
+ @NonNull
+ public Insets getSystemWindowInsets() {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return Insets.wrap(((WindowInsets) mInsets).getSystemWindowInsets());
+ } else {
+ // Else we'll create a copy from the getters
+ return Insets.of(getSystemWindowInsetLeft(), getSystemWindowInsetTop(),
+ getSystemWindowInsetRight(), getSystemWindowInsetBottom());
+ }
+ }
+
+ /**
+ * Returns the stable insets in pixels.
+ *
+ * <p>The stable inset represents the area of a full-screen window that <b>may</b> be
+ * partially or fully obscured by the system UI elements. This value does not change
+ * based on the visibility state of those elements; for example, if the status bar is
+ * normally shown, but temporarily hidden, the stable inset will still provide the inset
+ * associated with the status bar being shown.</p>
+ *
+ * @return The stable insets
+ * @see #getStableInsetLeft()
+ * @see #getStableInsetTop()
+ * @see #getStableInsetRight()
+ * @see #getStableInsetBottom()
+ */
+ @NonNull
+ public Insets getStableInsets() {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return Insets.wrap(((WindowInsets) mInsets).getStableInsets());
+ } else {
+ // Else we'll create a copy from the getters
+ return Insets.of(getStableInsetLeft(), getStableInsetTop(),
+ getStableInsetRight(), getStableInsetBottom());
+ }
+ }
+
+ /**
+ * Returns the mandatory system gesture insets.
+ *
+ * <p>The mandatory system gesture insets represent the area of a window where mandatory system
+ * gestures have priority and may consume some or all touch input, e.g. due to the a system bar
+ * occupying it, or it being reserved for touch-only gestures.
+ *
+ * @see WindowInsets#getMandatorySystemGestureInsets
+ */
+ @NonNull
+ public Insets getMandatorySystemGestureInsets() {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return Insets.wrap(((WindowInsets) mInsets).getMandatorySystemGestureInsets());
+ } else {
+ // Before Q, the mandatory system gesture insets == system window insets
+ return getSystemWindowInsets();
+ }
+ }
+
+ /**
+ * Returns the tappable element insets.
+ *
+ * <p>The tappable element insets represent how much tappable elements <b>must at least</b> be
+ * inset to remain both tappable and visually unobstructed by persistent system windows.
+ *
+ * <p>This may be smaller than {@link #getSystemWindowInsets()} if the system window is
+ * largely transparent and lets through simple taps (but not necessarily more complex gestures).
+ *
+ * @see WindowInsets#getTappableElementInsets
+ */
+ @NonNull
+ public Insets getTappableElementInsets() {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return Insets.wrap(((WindowInsets) mInsets).getTappableElementInsets());
+ } else {
+ // Before Q, the tappable elements insets == system window insets
+ return getSystemWindowInsets();
+ }
+ }
+
+ /**
+ * Returns the system gesture insets.
+ *
+ * <p>The system gesture insets represent the area of a window where system gestures have
+ * priority and may consume some or all touch input, e.g. due to the a system bar
+ * occupying it, or it being reserved for touch-only gestures.
+ *
+ * <p>An app can declare priority over system gestures with
+ * {@link android.view.View#setSystemGestureExclusionRects} outside of the
+ * {@link #getMandatorySystemGestureInsets() mandatory system gesture insets}.
+ *
+ * @see WindowInsets#getSystemGestureInsets
+ */
+ @NonNull
+ public Insets getSystemGestureInsets() {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return Insets.wrap(((WindowInsets) mInsets).getSystemGestureInsets());
+ } else {
+ // Before Q, the system gesture insets == system window insets
+ return getSystemWindowInsets();
+ }
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -381,7 +499,7 @@
return false;
}
WindowInsetsCompat other = (WindowInsetsCompat) o;
- return mInsets == null ? other.mInsets == null : mInsets.equals(other.mInsets);
+ return ObjectsCompat.equals(mInsets, other.mInsets);
}
@Override
diff --git a/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java b/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java
index 10ca476..7146983 100644
--- a/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java
+++ b/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java
@@ -19,6 +19,7 @@
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX;
import android.graphics.Rect;
+import android.graphics.Region;
import android.os.Build;
import android.os.Bundle;
import android.text.InputType;
@@ -31,7 +32,9 @@
import android.util.SparseArray;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.accessibility.AccessibilityNodeInfo.TouchDelegateInfo;
+import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
@@ -51,6 +54,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
/**
* Helper for accessing {@link android.view.accessibility.AccessibilityNodeInfo} in a backwards
@@ -449,6 +453,42 @@
android.R.id.accessibilityActionScrollRight, null, null, null);
/**
+ * Action to move to the page above.
+ */
+ @NonNull
+ public static final AccessibilityActionCompat ACTION_PAGE_UP =
+ new AccessibilityActionCompat(Build.VERSION.SDK_INT >= 29
+ ? AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_UP : null,
+ android.R.id.accessibilityActionPageUp, null, null, null);
+
+ /**
+ * Action to move to the page below.
+ */
+ @NonNull
+ public static final AccessibilityActionCompat ACTION_PAGE_DOWN =
+ new AccessibilityActionCompat(Build.VERSION.SDK_INT >= 29
+ ? AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_DOWN : null,
+ android.R.id.accessibilityActionPageDown, null, null, null);
+
+ /**
+ * Action to move to the page left.
+ */
+ @NonNull
+ public static final AccessibilityActionCompat ACTION_PAGE_LEFT =
+ new AccessibilityActionCompat(Build.VERSION.SDK_INT >= 29
+ ? AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_LEFT : null,
+ android.R.id.accessibilityActionPageLeft, null, null, null);
+
+ /**
+ * Action to move to the page right.
+ */
+ @NonNull
+ public static final AccessibilityActionCompat ACTION_PAGE_RIGHT =
+ new AccessibilityActionCompat(Build.VERSION.SDK_INT >= 29
+ ? AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT : null,
+ android.R.id.accessibilityActionPageRight, null, null, null);
+
+ /**
* Action that context clicks the node.
*/
public static final AccessibilityActionCompat ACTION_CONTEXT_CLICK =
@@ -997,6 +1037,97 @@
}
}
+ /**
+ * Class with information of touch delegated views and regions.
+ */
+ public static final class TouchDelegateInfoCompat {
+ final TouchDelegateInfo mInfo;
+
+ /**
+ * Create a new instance of {@link TouchDelegateInfoCompat}.
+ *
+ * @param targetMap A map from regions (in view coordinates) to delegated views.
+ */
+ public TouchDelegateInfoCompat(@NonNull Map<Region, View> targetMap) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ mInfo = new TouchDelegateInfo(targetMap);
+ } else {
+ mInfo = null;
+ }
+ }
+
+ TouchDelegateInfoCompat(@NonNull TouchDelegateInfo info) {
+ mInfo = info;
+ }
+
+ /**
+ * Returns the number of touch delegate target region.
+ * <p>
+ * Compatibility:
+ * <ul>
+ * <li>API < 29: Always returns {@code 0}</li>
+ * </ul>
+ *
+ * @return Number of touch delegate target region.
+ */
+ public @IntRange(from = 0) int getRegionCount() {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return mInfo.getRegionCount();
+ }
+ return 0;
+ }
+
+ /**
+ * Return the {@link Region} at the given index.
+ * <p>
+ * Compatibility:
+ * <ul>
+ * <li>API < 29: Always returns {@code null}</li>
+ * </ul>
+ *
+ * @param index The desired index, must be between 0 and {@link #getRegionCount()}-1.
+ * @return Returns the {@link Region} stored at the given index.
+ */
+ @Nullable
+ public Region getRegionAt(@IntRange(from = 0) int index) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return mInfo.getRegionAt(index);
+ }
+ return null;
+ }
+
+ /**
+ * Return the target {@link AccessibilityNodeInfoCompat} for the given {@link Region}.
+ * <p>
+ * <strong>Note:</strong> This api can only be called from
+ * {@link android.accessibilityservice.AccessibilityService}.
+ * </p>
+ * <p>
+ * <strong>Note:</strong> It is a client responsibility to recycle the
+ * received info by calling {@link AccessibilityNodeInfo#recycle()}
+ * to avoid creating of multiple instances.
+ * </p>
+ * <p>
+ * Compatibility:
+ * <ul>
+ * <li>API < 29: Always returns {@code null}</li>
+ * </ul>
+ *
+ * @param region The region retrieved from {@link #getRegionAt(int)}.
+ * @return The target node associates with the given region.
+ */
+ @Nullable
+ public AccessibilityNodeInfoCompat getTargetForRegion(@NonNull Region region) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ AccessibilityNodeInfo info = mInfo.getTargetForRegion(region);
+ if (info != null) {
+ return AccessibilityNodeInfoCompat.wrap(info);
+ }
+ }
+ return null;
+ }
+ }
+
private static final String ROLE_DESCRIPTION_KEY =
"AccessibilityNodeInfo.roleDescription";
@@ -1990,16 +2121,28 @@
}
/**
- * Gets the node bounds in parent coordinates.
+ * Gets the node bounds in the viewParent's coordinates.
+ * {@link #getParent()} does not represent the source's viewParent.
+ * Instead it represents the result of {@link View#getParentForAccessibility()},
+ * which returns the closest ancestor where {@link View#isImportantForAccessibility()} is true.
+ * So this method is not reliable.
*
* @param outBounds The output node bounds.
+ *
+ * @deprecated Use {@link #getBoundsInScreen(Rect)} instead.
*/
+ @Deprecated
public void getBoundsInParent(Rect outBounds) {
mInfo.getBoundsInParent(outBounds);
}
/**
- * Sets the node bounds in parent coordinates.
+ * Sets the node bounds in the viewParent's coordinates.
+ * {@link #getParent()} does not represent the source's viewParent.
+ * Instead it represents the result of {@link View#getParentForAccessibility()},
+ * which returns the closest ancestor where {@link View#isImportantForAccessibility()} is true.
+ * So this method is not reliable.
+ *
* <p>
* <strong>Note:</strong> Cannot be called from an
* {@link android.accessibilityservice.AccessibilityService}. This class is
@@ -2008,7 +2151,10 @@
*
* @param bounds The node bounds.
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Accessibility services should not care about these bounds.
*/
+ @Deprecated
public void setBoundsInParent(Rect bounds) {
mInfo.setBoundsInParent(bounds);
}
@@ -3659,13 +3805,15 @@
}
}
-
/**
* Returns whether node represents a text entry key that is part of a keyboard or keypad.
*
* @return {@code true} if the node is a text entry key, {@code false} otherwise.
*/
public boolean isTextEntryKey() {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return mInfo.isTextEntryKey();
+ }
return getBooleanProperty(BOOLEAN_PROPERTY_IS_TEXT_ENTRY_KEY);
}
@@ -3681,7 +3829,11 @@
* @param isTextEntryKey {@code true} if the node is a text entry key, {@code false} otherwise.
*/
public void setTextEntryKey(boolean isTextEntryKey) {
- setBooleanProperty(BOOLEAN_PROPERTY_IS_TEXT_ENTRY_KEY, isTextEntryKey);
+ if (Build.VERSION.SDK_INT >= 29) {
+ mInfo.setTextEntryKey(isTextEntryKey);
+ } else {
+ setBooleanProperty(BOOLEAN_PROPERTY_IS_TEXT_ENTRY_KEY, isTextEntryKey);
+ }
}
/**
@@ -3743,6 +3895,55 @@
}
}
+ /**
+ * Get the {@link TouchDelegateInfoCompat} for touch delegate behavior with the represented
+ * view. It is possible for the same node to be pointed to by several regions. Use
+ * {@link TouchDelegateInfoCompat#getRegionAt(int)} to get touch delegate target
+ * {@link Region}, and {@link TouchDelegateInfoCompat#getTargetForRegion(Region)}
+ * for {@link AccessibilityNodeInfoCompat} from the given region.
+ * <p>
+ * Compatibility:
+ * <ul>
+ * <li>API < 29: Always returns {@code null}</li>
+ * </ul>
+ *
+ * @return {@link TouchDelegateInfoCompat} or {@code null} if there are no touch delegates
+ * in this node.
+ */
+ @Nullable
+ public TouchDelegateInfoCompat getTouchDelegateInfo() {
+ if (Build.VERSION.SDK_INT >= 29) {
+ TouchDelegateInfo delegateInfo = mInfo.getTouchDelegateInfo();
+ if (delegateInfo != null) {
+ return new TouchDelegateInfoCompat(delegateInfo);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Set touch delegate info if the represented view has a {@link android.view.TouchDelegate}.
+ * <p>
+ * <strong>Note:</strong> Cannot be called from an
+ * {@link android.accessibilityservice.AccessibilityService}.
+ * This class is made immutable before being delivered to an
+ * AccessibilityService.
+ * </p>
+ * <p>
+ * Compatibility:
+ * <ul>
+ * <li>API < 29: No-op</li>
+ * </ul>
+ *
+ * @param delegatedInfo {@link TouchDelegateInfoCompat}
+ * @throws IllegalStateException If called from an AccessibilityService.
+ */
+ public void setTouchDelegateInfo(@NonNull TouchDelegateInfoCompat delegatedInfo) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ mInfo.setTouchDelegateInfo(delegatedInfo.mInfo);
+ }
+ }
+
@Override
public int hashCode() {
return (mInfo == null) ? 0 : mInfo.hashCode();
diff --git a/core/src/main/java/androidx/core/widget/TextViewCompat.java b/core/src/main/java/androidx/core/widget/TextViewCompat.java
index 9597110..5f9637a 100644
--- a/core/src/main/java/androidx/core/widget/TextViewCompat.java
+++ b/core/src/main/java/androidx/core/widget/TextViewCompat.java
@@ -881,11 +881,17 @@
public static void setPrecomputedText(@NonNull TextView textView,
@NonNull PrecomputedTextCompat precomputed) {
- PrecomputedTextCompat.Params param = TextViewCompat.getTextMetricsParams(textView);
- if (!param.equalsWithoutTextDirection(precomputed.getParams())) {
- throw new IllegalArgumentException("Given text can not be applied to TextView.");
+ if (Build.VERSION.SDK_INT >= 29) {
+ // Framework can not understand PrecomptedTextCompat. Pass underlying PrecomputedText.
+ // Parameter check is also done by framework.
+ textView.setText(precomputed.getPrecomputedText());
+ } else {
+ PrecomputedTextCompat.Params param = TextViewCompat.getTextMetricsParams(textView);
+ if (!param.equalsWithoutTextDirection(precomputed.getParams())) {
+ throw new IllegalArgumentException("Given text can not be applied to TextView.");
+ }
+ textView.setText(precomputed);
}
- textView.setText(precomputed);
}
/**
diff --git a/development/studio/idea.properties b/development/studio/idea.properties
index 47930b3..91a1949 100644
--- a/development/studio/idea.properties
+++ b/development/studio/idea.properties
@@ -5,12 +5,12 @@
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE config folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
-idea.config.path=${user.home}/.AndroidStudioAndroidX/config
+idea.config.path=${user.home}/.AndroidStudioAndroidXPlatform/config
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
-idea.system.path=${user.home}/.AndroidStudioAndroidX/system
+idea.system.path=${user.home}/.AndroidStudioAndroidXPlatform/system
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to user installed plugins folder. Make sure you're using forward slashes.
diff --git a/documentfile/src/main/java/androidx/documentfile/provider/DocumentFile.java b/documentfile/src/main/java/androidx/documentfile/provider/DocumentFile.java
index 1ad8df4..93545bc 100644
--- a/documentfile/src/main/java/androidx/documentfile/provider/DocumentFile.java
+++ b/documentfile/src/main/java/androidx/documentfile/provider/DocumentFile.java
@@ -16,8 +16,8 @@
package androidx.documentfile.provider;
-import android.content.ContentResolver;
import android.content.Context;
+import android.content.ContentResolver;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
diff --git a/documentfile/src/main/java/androidx/documentfile/provider/SingleDocumentFile.java b/documentfile/src/main/java/androidx/documentfile/provider/SingleDocumentFile.java
index 7cd4b8c..94545cd 100644
--- a/documentfile/src/main/java/androidx/documentfile/provider/SingleDocumentFile.java
+++ b/documentfile/src/main/java/androidx/documentfile/provider/SingleDocumentFile.java
@@ -97,6 +97,7 @@
}
@Override
+ @SuppressWarnings("deprecation")
public boolean delete() {
try {
return DocumentsContract.deleteDocument(mContext.getContentResolver(), mUri);
diff --git a/documentfile/src/main/java/androidx/documentfile/provider/TreeDocumentFile.java b/documentfile/src/main/java/androidx/documentfile/provider/TreeDocumentFile.java
index 9cc20d6..65017b7 100644
--- a/documentfile/src/main/java/androidx/documentfile/provider/TreeDocumentFile.java
+++ b/documentfile/src/main/java/androidx/documentfile/provider/TreeDocumentFile.java
@@ -47,6 +47,7 @@
}
@Nullable
+ @SuppressWarnings("deprecation")
private static Uri createFile(Context context, Uri self, String mimeType,
String displayName) {
try {
@@ -118,6 +119,7 @@
}
@Override
+ @SuppressWarnings("deprecation")
public boolean delete() {
try {
return DocumentsContract.deleteDocument(mContext.getContentResolver(), mUri);
@@ -174,6 +176,7 @@
}
@Override
+ @SuppressWarnings("deprecation")
public boolean renameTo(String displayName) {
try {
final Uri result = DocumentsContract.renameDocument(
diff --git a/drawerlayout/build.gradle b/drawerlayout/build.gradle
index e609ab0..02b1002 100644
--- a/drawerlayout/build.gradle
+++ b/drawerlayout/build.gradle
@@ -1,6 +1,8 @@
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
+import static androidx.build.dependencies.DependenciesKt.*
+
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -10,6 +12,18 @@
api("androidx.annotation:annotation:1.1.0-rc01")
api(project(":core"))
api(project(":customview"))
+
+ androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
+ androidTestImplementation(ANDROIDX_TEST_CORE)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(TRUTH)
+ androidTestImplementation(ESPRESSO_CORE, libs.exclude_for_espresso)
+ androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation project(':internal-testutils'), {
+ exclude group: 'androidx.appcompat', module: 'appcompat'
+ }
}
androidx {
diff --git a/drawerlayout/src/androidTest/AndroidManifest.xml b/drawerlayout/src/androidTest/AndroidManifest.xml
new file mode 100644
index 0000000..2c86c12
--- /dev/null
+++ b/drawerlayout/src/androidTest/AndroidManifest.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.v7.appcompat.test">
+ <uses-sdk android:targetSdkVersion="${target-sdk-version}"/>
+
+ <application
+ android:supportsRtl="true">
+ <activity android:name="androidx.drawerlayout.app.DrawerLayoutTestActivity"/>
+ </application>
+</manifest>
diff --git a/drawerlayout/src/androidTest/java/androidx/drawerlayout/app/DrawerLayoutTest.java b/drawerlayout/src/androidTest/java/androidx/drawerlayout/app/DrawerLayoutTest.java
new file mode 100644
index 0000000..58f375d
--- /dev/null
+++ b/drawerlayout/src/androidTest/java/androidx/drawerlayout/app/DrawerLayoutTest.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.drawerlayout.app;
+
+
+import static androidx.drawerlayout.testutils.DrawerLayoutActions.closeDrawer;
+import static androidx.drawerlayout.testutils.DrawerLayoutActions.openDrawer;
+import static androidx.test.espresso.Espresso.onView;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.graphics.Rect;
+import android.os.Build;
+import android.view.View;
+
+import androidx.core.view.GravityCompat;
+import androidx.core.view.ViewCompat;
+import androidx.drawerlayout.test.R;
+import androidx.drawerlayout.widget.DrawerLayout;
+import androidx.test.espresso.NoMatchingViewException;
+import androidx.test.espresso.ViewAssertion;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.List;
+
+@RunWith(AndroidJUnit4.class)
+public class DrawerLayoutTest {
+ @Rule
+ public final ActivityTestRule<DrawerLayoutTestActivity> mActivityTestRule =
+ new ActivityTestRule<>(DrawerLayoutTestActivity.class);
+
+ private DrawerLayout mDrawerLayout;
+
+ private View mDrawer;
+
+ private View mContentView;
+
+ @Before
+ public void setUp() {
+ final DrawerLayoutTestActivity activity = mActivityTestRule.getActivity();
+ mDrawerLayout = activity.findViewById(R.id.drawer_layout);
+ mDrawer = mDrawerLayout.findViewById(R.id.drawer);
+ mContentView = mDrawerLayout.findViewById(R.id.content);
+
+ // Close the drawer to reset the state for the next test
+ onView(withId(R.id.drawer_layout)).perform(closeDrawer(GravityCompat.START));
+ }
+
+ @Test
+ @SmallTest
+ public void testSystemGestureExclusionRects() {
+ if (Build.VERSION.SDK_INT < 29) {
+ // Not expected on old device
+ return;
+ }
+
+ onView(withId(R.id.drawer_layout)).check(new ViewAssertion() {
+ @Override
+ public void check(View view, NoMatchingViewException noViewFoundException) {
+ final List<Rect> exclusionRects = ViewCompat.getSystemGestureExclusionRects(view);
+ assertTrue("view is laid out", view.isLaidOut());
+ assertFalse("exclusion rects empty", exclusionRects.isEmpty());
+ for (Rect rect : exclusionRects) {
+ assertFalse("rect " + rect + " is empty", rect.isEmpty());
+ assertEquals("rect height (" + rect.height() + ") == view height ("
+ + view.getHeight() + ")", view.getHeight(), rect.height());
+ }
+ }
+ });
+
+ onView(withId(R.id.drawer_layout)).perform(openDrawer(mDrawer));
+
+ assertTrue("open drawer exclusion rects empty",
+ ViewCompat.getSystemGestureExclusionRects(mDrawerLayout).isEmpty());
+
+ onView(withId(R.id.drawer_layout)).perform(closeDrawer(mDrawer));
+
+ final List<Rect> reclosed = ViewCompat.getSystemGestureExclusionRects(mDrawerLayout);
+ assertFalse("re-closed drawer has exclusion rects", reclosed.isEmpty());
+ for (Rect rect : reclosed) {
+ assertFalse("re-closed drawer exclusion rect should not be empty", rect.isEmpty());
+ assertEquals("re-closed drawer rect correct height",
+ mDrawerLayout.getHeight(), rect.height());
+ }
+ }
+}
diff --git a/drawerlayout/src/androidTest/java/androidx/drawerlayout/app/DrawerLayoutTestActivity.java b/drawerlayout/src/androidTest/java/androidx/drawerlayout/app/DrawerLayoutTestActivity.java
new file mode 100644
index 0000000..a9cd5eb
--- /dev/null
+++ b/drawerlayout/src/androidTest/java/androidx/drawerlayout/app/DrawerLayoutTestActivity.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.drawerlayout.app;
+
+import android.os.Bundle;
+
+import androidx.core.app.ComponentActivity;
+import androidx.drawerlayout.test.R;
+
+public class DrawerLayoutTestActivity extends ComponentActivity {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.drawer_layout_test_activity);
+ }
+}
diff --git a/drawerlayout/src/androidTest/java/androidx/drawerlayout/testutils/DrawerLayoutActions.java b/drawerlayout/src/androidTest/java/androidx/drawerlayout/testutils/DrawerLayoutActions.java
new file mode 100644
index 0000000..b9f735a
--- /dev/null
+++ b/drawerlayout/src/androidTest/java/androidx/drawerlayout/testutils/DrawerLayoutActions.java
@@ -0,0 +1,350 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.drawerlayout.testutils;
+
+import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom;
+
+import android.view.View;
+
+import androidx.annotation.Nullable;
+import androidx.drawerlayout.widget.DrawerLayout;
+import androidx.test.espresso.Espresso;
+import androidx.test.espresso.IdlingResource;
+import androidx.test.espresso.UiController;
+import androidx.test.espresso.ViewAction;
+
+import org.hamcrest.Matcher;
+
+public class DrawerLayoutActions {
+ /**
+ * Drawer listener that serves as Espresso's {@link IdlingResource} and notifies the registered
+ * callback when the drawer gets to STATE_IDLE state.
+ */
+ private static class CustomDrawerListener
+ implements DrawerLayout.DrawerListener, IdlingResource {
+ private int mCurrState = DrawerLayout.STATE_IDLE;
+
+ @Nullable
+ private IdlingResource.ResourceCallback mCallback;
+
+ private boolean mNeedsIdle = false;
+
+ @Override
+ public void registerIdleTransitionCallback(ResourceCallback resourceCallback) {
+ mCallback = resourceCallback;
+ }
+
+ @Override
+ public String getName() {
+ return "Drawer listener";
+ }
+
+ @Override
+ public boolean isIdleNow() {
+ if (!mNeedsIdle) {
+ return true;
+ } else {
+ return mCurrState == DrawerLayout.STATE_IDLE;
+ }
+ }
+
+ @Override
+ public void onDrawerClosed(View drawer) {
+ if (mCurrState == DrawerLayout.STATE_IDLE) {
+ if (mCallback != null) {
+ mCallback.onTransitionToIdle();
+ }
+ }
+ }
+
+ @Override
+ public void onDrawerOpened(View drawer) {
+ if (mCurrState == DrawerLayout.STATE_IDLE) {
+ if (mCallback != null) {
+ mCallback.onTransitionToIdle();
+ }
+ }
+ }
+
+ @Override
+ public void onDrawerSlide(View drawer, float slideOffset) {
+ }
+
+ @Override
+ public void onDrawerStateChanged(int state) {
+ mCurrState = state;
+ if (state == DrawerLayout.STATE_IDLE) {
+ if (mCallback != null) {
+ mCallback.onTransitionToIdle();
+ }
+ }
+ }
+ }
+
+ private abstract static class WrappedViewAction implements ViewAction {
+ }
+
+ public static ViewAction wrap(final ViewAction baseAction) {
+ if (baseAction instanceof WrappedViewAction) {
+ throw new IllegalArgumentException("Don't wrap and already wrapped action");
+ }
+
+ return new WrappedViewAction() {
+ @Override
+ public Matcher<View> getConstraints() {
+ return baseAction.getConstraints();
+ }
+
+ @Override
+ public String getDescription() {
+ return baseAction.getDescription();
+ }
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ final DrawerLayout drawer = (DrawerLayout) view;
+ // Add a custom tracker listener
+ final CustomDrawerListener customListener = new CustomDrawerListener();
+ drawer.addDrawerListener(customListener);
+
+ // Note that we're running the following block in a try-finally construct. This
+ // is needed since some of the wrapped actions are going to throw (expected)
+ // exceptions. If that happens, we still need to clean up after ourselves to
+ // leave the system (Espesso) in a good state.
+ try {
+ // Register our listener as idling resource so that Espresso waits until the
+ // wrapped action results in the drawer getting to the STATE_IDLE state
+ Espresso.registerIdlingResources(customListener);
+ baseAction.perform(uiController, view);
+ customListener.mNeedsIdle = true;
+ uiController.loopMainThreadUntilIdle();
+ customListener.mNeedsIdle = false;
+ } finally {
+ // Unregister our idling resource
+ Espresso.unregisterIdlingResources(customListener);
+ // And remove our tracker listener from DrawerLayout
+ drawer.removeDrawerListener(customListener);
+ }
+ }
+ };
+ }
+
+ /**
+ * Opens the drawer at the specified edge gravity.
+ */
+ public static ViewAction openDrawer(final int drawerEdgeGravity, final boolean animate) {
+ return wrap(new ViewAction() {
+ @Override
+ public Matcher<View> getConstraints() {
+ return isAssignableFrom(DrawerLayout.class);
+ }
+
+ @Override
+ public String getDescription() {
+ return "Opens the drawer";
+ }
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ uiController.loopMainThreadUntilIdle();
+
+ DrawerLayout drawerLayout = (DrawerLayout) view;
+ drawerLayout.openDrawer(drawerEdgeGravity, animate);
+ }
+ });
+ }
+
+ /**
+ * Opens the drawer at the specified edge gravity.
+ */
+ public static ViewAction openDrawer(final int drawerEdgeGravity) {
+ return wrap(new ViewAction() {
+ @Override
+ public Matcher<View> getConstraints() {
+ return isAssignableFrom(DrawerLayout.class);
+ }
+
+ @Override
+ public String getDescription() {
+ return "Opens the drawer";
+ }
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ uiController.loopMainThreadUntilIdle();
+
+ DrawerLayout drawerLayout = (DrawerLayout) view;
+ drawerLayout.openDrawer(drawerEdgeGravity);
+ }
+ });
+ }
+
+ /**
+ * Opens the drawer.
+ */
+ public static ViewAction openDrawer(final View drawerView) {
+ return wrap(new ViewAction() {
+ @Override
+ public Matcher<View> getConstraints() {
+ return isAssignableFrom(DrawerLayout.class);
+ }
+
+ @Override
+ public String getDescription() {
+ return "Opens the drawer";
+ }
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ uiController.loopMainThreadUntilIdle();
+
+ DrawerLayout drawerLayout = (DrawerLayout) view;
+ drawerLayout.openDrawer(drawerView);
+ }
+ });
+ }
+
+ /**
+ * Closes the drawer at the specified edge gravity.
+ */
+ public static ViewAction closeDrawer(final int drawerEdgeGravity) {
+ return wrap(new ViewAction() {
+ @Override
+ public Matcher<View> getConstraints() {
+ return isAssignableFrom(DrawerLayout.class);
+ }
+
+ @Override
+ public String getDescription() {
+ return "Closes the drawer";
+ }
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ uiController.loopMainThreadUntilIdle();
+
+ DrawerLayout drawerLayout = (DrawerLayout) view;
+ drawerLayout.closeDrawer(drawerEdgeGravity);
+ }
+ });
+ }
+
+ /**
+ * Closes the drawer at the specified edge gravity.
+ */
+ public static ViewAction closeDrawer(final int drawerEdgeGravity, final boolean animate) {
+ return wrap(new ViewAction() {
+ @Override
+ public Matcher<View> getConstraints() {
+ return isAssignableFrom(DrawerLayout.class);
+ }
+
+ @Override
+ public String getDescription() {
+ return "Closes the drawer";
+ }
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ uiController.loopMainThreadUntilIdle();
+
+ DrawerLayout drawerLayout = (DrawerLayout) view;
+ drawerLayout.closeDrawer(drawerEdgeGravity, animate);
+ }
+ });
+ }
+
+ /**
+ * Closes the drawer.
+ */
+ public static ViewAction closeDrawer(final View drawerView) {
+ return wrap(new ViewAction() {
+ @Override
+ public Matcher<View> getConstraints() {
+ return isAssignableFrom(DrawerLayout.class);
+ }
+
+ @Override
+ public String getDescription() {
+ return "Closes the drawer";
+ }
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ uiController.loopMainThreadUntilIdle();
+
+ DrawerLayout drawerLayout = (DrawerLayout) view;
+ drawerLayout.closeDrawer(drawerView);
+ }
+ });
+ }
+
+ /**
+ * Sets the lock mode for the drawer at the specified edge gravity.
+ */
+ public static ViewAction setDrawerLockMode(final int lockMode, final int drawerEdgeGravity) {
+ return wrap(new ViewAction() {
+ @Override
+ public Matcher<View> getConstraints() {
+ return isAssignableFrom(DrawerLayout.class);
+ }
+
+ @Override
+ public String getDescription() {
+ return "Sets drawer lock mode";
+ }
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ uiController.loopMainThreadUntilIdle();
+
+ DrawerLayout drawerLayout = (DrawerLayout) view;
+ drawerLayout.setDrawerLockMode(lockMode, drawerEdgeGravity);
+
+ uiController.loopMainThreadUntilIdle();
+ }
+ });
+ }
+
+ /**
+ * Sets the lock mode for the drawer.
+ */
+ public static ViewAction setDrawerLockMode(final int lockMode, final View drawerView) {
+ return wrap(new ViewAction() {
+ @Override
+ public Matcher<View> getConstraints() {
+ return isAssignableFrom(DrawerLayout.class);
+ }
+
+ @Override
+ public String getDescription() {
+ return "Sets drawer lock mode";
+ }
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ uiController.loopMainThreadUntilIdle();
+
+ DrawerLayout drawerLayout = (DrawerLayout) view;
+ drawerLayout.setDrawerLockMode(lockMode, drawerView);
+
+ uiController.loopMainThreadUntilIdle();
+ }
+ });
+ }
+}
+
diff --git a/drawerlayout/src/androidTest/res/layout/drawer_layout_test_activity.xml b/drawerlayout/src/androidTest/res/layout/drawer_layout_test_activity.xml
new file mode 100644
index 0000000..b90f445
--- /dev/null
+++ b/drawerlayout/src/androidTest/res/layout/drawer_layout_test_activity.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<androidx.drawerlayout.widget.DrawerLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/drawer_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <FrameLayout
+ android:id="@+id/content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+ <FrameLayout
+ android:id="@+id/drawer"
+ android:layout_width="300dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="left" />
+</androidx.drawerlayout.widget.DrawerLayout>
diff --git a/drawerlayout/src/main/java/androidx/drawerlayout/widget/DrawerLayout.java b/drawerlayout/src/main/java/androidx/drawerlayout/widget/DrawerLayout.java
index 8e75e29..d8392e2 100644
--- a/drawerlayout/src/main/java/androidx/drawerlayout/widget/DrawerLayout.java
+++ b/drawerlayout/src/main/java/androidx/drawerlayout/widget/DrawerLayout.java
@@ -63,6 +63,7 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
/**
@@ -248,6 +249,8 @@
private Rect mChildHitRect;
private Matrix mChildInvertedMatrix;
+ private static boolean sSupplyGestureExclusion = Build.VERSION.SDK_INT >= 29;
+
/**
* Listener for monitoring events about drawers.
*/
@@ -847,6 +850,25 @@
}
}
}
+
+ if (sSupplyGestureExclusion) {
+ final List<Rect> rects = new ArrayList<>();
+ final int childCount = getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ final View child = getChildAt(i);
+ if (isContentView(child) || isDrawerOpen(child)) {
+ continue;
+ }
+
+ if (checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) {
+ rects.add(new Rect(0, 0, mLeftDragger.getEdgeSize(), getHeight()));
+ } else {
+ final int width = getWidth();
+ rects.add(new Rect(width - mRightDragger.getEdgeSize(), 0, width, getHeight()));
+ }
+ }
+ ViewCompat.setSystemGestureExclusionRects(this, rects);
+ }
}
void dispatchOnDrawerClosed(View drawerView) {
@@ -1027,6 +1049,8 @@
}
@SuppressLint("WrongConstant")
+ // Remove deprecation suppression once b/120984242 is resolved.
+ @SuppressWarnings("deprecation")
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
@@ -1209,7 +1233,9 @@
protected void onLayout(boolean changed, int l, int t, int r, int b) {
mInLayout = true;
final int width = r - l;
+ final int layoutHeight = b - t;
final int childCount = getChildCount();
+ List<Rect> gestureExclusionRects = null;
for (int i = 0; i < childCount; i++) {
final View child = getChildAt(i);
@@ -1232,9 +1258,23 @@
if (checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) {
childLeft = -childWidth + (int) (childWidth * lp.onScreen);
newOffset = (float) (childWidth + childLeft) / childWidth;
+ if (sSupplyGestureExclusion && !isDrawerOpen(child)) {
+ if (gestureExclusionRects == null) {
+ gestureExclusionRects = new ArrayList<>();
+ }
+ gestureExclusionRects.add(
+ new Rect(0, 0, mLeftDragger.getEdgeSize(), layoutHeight));
+ }
} else { // Right; onMeasure checked for us.
childLeft = width - (int) (childWidth * lp.onScreen);
newOffset = (float) (width - childLeft) / childWidth;
+ if (sSupplyGestureExclusion && !isDrawerOpen(child)) {
+ if (gestureExclusionRects == null) {
+ gestureExclusionRects = new ArrayList<>();
+ }
+ gestureExclusionRects.add(new Rect(
+ width - mRightDragger.getEdgeSize(), 0, width, layoutHeight));
+ }
}
final boolean changeOffset = newOffset != lp.onScreen;
@@ -1285,6 +1325,12 @@
}
}
}
+ // Always set exclusion rects; set an empty list if we had no drawer views.
+ if (gestureExclusionRects != null) {
+ ViewCompat.setSystemGestureExclusionRects(this, gestureExclusionRects);
+ } else {
+ ViewCompat.setSystemGestureExclusionRects(this, Collections.<Rect>emptyList());
+ }
mInLayout = false;
mFirstLayout = false;
}
@@ -1313,6 +1359,8 @@
}
}
+ // Remove deprecation suppression once b/120984242 is resolved.
+ @SuppressWarnings("deprecation")
private static boolean hasOpaqueBackground(View v) {
final Drawable bg = v.getBackground();
if (bg != null) {
diff --git a/emoji/core/src/main/java/androidx/emoji/widget/EmojiExtractTextLayout.java b/emoji/core/src/main/java/androidx/emoji/widget/EmojiExtractTextLayout.java
index b9d6d1b..4322404 100644
--- a/emoji/core/src/main/java/androidx/emoji/widget/EmojiExtractTextLayout.java
+++ b/emoji/core/src/main/java/androidx/emoji/widget/EmojiExtractTextLayout.java
@@ -114,6 +114,11 @@
if (attrs != null) {
final TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.EmojiExtractTextLayout, defStyleAttr, defStyleRes);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.EmojiExtractTextLayout, attrs, a, defStyleAttr,
+ defStyleRes);
+ }
final int replaceStrategy = a.getInteger(
R.styleable.EmojiExtractTextLayout_emojiReplaceStrategy,
EmojiCompat.REPLACE_STRATEGY_DEFAULT);
diff --git a/fakeannotations/build.gradle b/fakeannotations/build.gradle
new file mode 100644
index 0000000..3302c21
--- /dev/null
+++ b/fakeannotations/build.gradle
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+apply plugin: 'java-library'
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+}
+
+sourceCompatibility = "7"
+targetCompatibility = "7"
diff --git a/fakeannotations/src/main/java/androidx/annotation/NonNull.java b/fakeannotations/src/main/java/androidx/annotation/NonNull.java
new file mode 100644
index 0000000..fd3692c
--- /dev/null
+++ b/fakeannotations/src/main/java/androidx/annotation/NonNull.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
+/**
+ * Denotes that a parameter, field or method return value can never be null.
+ * <p>
+ * This is a marker annotation and it has no specific attributes.
+ *
+ * @paramDoc This value must never be {@code null}.
+ * @returnDoc This value will never be {@code null}.
+ * @hide
+ */
+@Retention(SOURCE)
+@Target({METHOD, PARAMETER, FIELD})
+public @interface NonNull {
+}
diff --git a/fakeannotations/src/main/java/androidx/annotation/Nullable.java b/fakeannotations/src/main/java/androidx/annotation/Nullable.java
new file mode 100644
index 0000000..776aea7
--- /dev/null
+++ b/fakeannotations/src/main/java/androidx/annotation/Nullable.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
+/**
+ * Denotes that a parameter, field or method return value can be null.
+ * <p>
+ * When decorating a method call parameter, this denotes that the parameter can
+ * legitimately be null and the method will gracefully deal with it. Typically
+ * used on optional parameters.
+ * <p>
+ * When decorating a method, this denotes the method might legitimately return
+ * null.
+ * <p>
+ * This is a marker annotation and it has no specific attributes.
+ *
+ * @paramDoc This value may be {@code null}.
+ * @returnDoc This value may be {@code null}.
+ * @hide
+ */
+@Retention(SOURCE)
+@Target({METHOD, PARAMETER, FIELD})
+public @interface Nullable {
+}
diff --git a/fakeannotations/src/main/java/androidx/annotation/RecentlyNonNull.java b/fakeannotations/src/main/java/androidx/annotation/RecentlyNonNull.java
new file mode 100644
index 0000000..194aab1
--- /dev/null
+++ b/fakeannotations/src/main/java/androidx/annotation/RecentlyNonNull.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.annotation;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.CLASS;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Retention(CLASS)
+@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE})
+public @interface RecentlyNonNull {
+}
diff --git a/fakeannotations/src/main/java/androidx/annotation/RecentlyNullable.java b/fakeannotations/src/main/java/androidx/annotation/RecentlyNullable.java
new file mode 100644
index 0000000..4ccdf93
--- /dev/null
+++ b/fakeannotations/src/main/java/androidx/annotation/RecentlyNullable.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.annotation;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.CLASS;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Retention(CLASS)
+@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE})
+public @interface RecentlyNullable {
+}
diff --git a/fragment/api/1.1.0-alpha03.txt b/fragment/api/1.1.0-alpha03.txt
index 8b5c94f..239fc9e3 100644
--- a/fragment/api/1.1.0-alpha03.txt
+++ b/fragment/api/1.1.0-alpha03.txt
@@ -163,6 +163,7 @@
method @CallSuper public void onMultiWindowModeChanged(boolean);
method @CallSuper public void onPictureInPictureModeChanged(boolean);
method protected void onResumeFragments();
+ method public void onStateNotSaved();
method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
diff --git a/fragment/api/1.1.0-alpha04.txt b/fragment/api/1.1.0-alpha04.txt
index 0883047..58f4d6e 100644
--- a/fragment/api/1.1.0-alpha04.txt
+++ b/fragment/api/1.1.0-alpha04.txt
@@ -164,6 +164,7 @@
method @CallSuper public void onMultiWindowModeChanged(boolean);
method @CallSuper public void onPictureInPictureModeChanged(boolean);
method protected void onResumeFragments();
+ method public void onStateNotSaved();
method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
diff --git a/fragment/api/1.1.0-alpha05.txt b/fragment/api/1.1.0-alpha05.txt
index e586a2f..47ba5f4 100644
--- a/fragment/api/1.1.0-alpha05.txt
+++ b/fragment/api/1.1.0-alpha05.txt
@@ -164,6 +164,7 @@
method @CallSuper public void onMultiWindowModeChanged(boolean);
method @CallSuper public void onPictureInPictureModeChanged(boolean);
method protected void onResumeFragments();
+ method public void onStateNotSaved();
method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
diff --git a/fragment/api/1.1.0-alpha06.txt b/fragment/api/1.1.0-alpha06.txt
index a5c77ae..6e285e8 100644
--- a/fragment/api/1.1.0-alpha06.txt
+++ b/fragment/api/1.1.0-alpha06.txt
@@ -165,6 +165,7 @@
method @CallSuper public void onMultiWindowModeChanged(boolean);
method @CallSuper public void onPictureInPictureModeChanged(boolean);
method protected void onResumeFragments();
+ method public void onStateNotSaved();
method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
diff --git a/fragment/api/1.1.0-alpha07.txt b/fragment/api/1.1.0-alpha07.txt
index e0def8d..ac8ecc1 100644
--- a/fragment/api/1.1.0-alpha07.txt
+++ b/fragment/api/1.1.0-alpha07.txt
@@ -166,6 +166,7 @@
method @CallSuper public void onMultiWindowModeChanged(boolean);
method @CallSuper public void onPictureInPictureModeChanged(boolean);
method protected void onResumeFragments();
+ method public void onStateNotSaved();
method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
diff --git a/fragment/api/1.1.0-alpha08.txt b/fragment/api/1.1.0-alpha08.txt
index 97f531b..4311fc2 100644
--- a/fragment/api/1.1.0-alpha08.txt
+++ b/fragment/api/1.1.0-alpha08.txt
@@ -166,6 +166,7 @@
method @CallSuper public void onMultiWindowModeChanged(boolean);
method @CallSuper public void onPictureInPictureModeChanged(boolean);
method protected void onResumeFragments();
+ method public void onStateNotSaved();
method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
diff --git a/fragment/api/1.1.0-alpha09.txt b/fragment/api/1.1.0-alpha09.txt
index 432303b..47d4d91 100644
--- a/fragment/api/1.1.0-alpha09.txt
+++ b/fragment/api/1.1.0-alpha09.txt
@@ -167,6 +167,7 @@
method @CallSuper public void onMultiWindowModeChanged(boolean);
method @CallSuper public void onPictureInPictureModeChanged(boolean);
method protected void onResumeFragments();
+ method public void onStateNotSaved();
method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
diff --git a/fragment/api/current.txt b/fragment/api/current.txt
index 432303b..47d4d91 100644
--- a/fragment/api/current.txt
+++ b/fragment/api/current.txt
@@ -167,6 +167,7 @@
method @CallSuper public void onMultiWindowModeChanged(boolean);
method @CallSuper public void onPictureInPictureModeChanged(boolean);
method protected void onResumeFragments();
+ method public void onStateNotSaved();
method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
diff --git a/fragment/testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioDialogFragmentTest.kt b/fragment/testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioDialogFragmentTest.kt
index 9f1b36d..da620ea 100644
--- a/fragment/testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioDialogFragmentTest.kt
+++ b/fragment/testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioDialogFragmentTest.kt
@@ -16,7 +16,7 @@
package androidx.fragment.app.testing
-import androidx.core.os.BuildCompat.isAtLeastQ
+import android.os.Build
import androidx.lifecycle.Lifecycle.State
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
@@ -68,7 +68,7 @@
onFragment { fragment ->
assertThat(fragment.lifecycle.currentState).isEqualTo(State.CREATED)
assertThat(fragment.dialog).isNotNull()
- if (isAtLeastQ()) {
+ if (Build.VERSION.SDK_INT >= 29) {
assertThat(fragment.requireDialog().isShowing).isFalse()
} else {
// Dialog#isShowing should've returned false but it returns true due to a
@@ -119,7 +119,7 @@
onFragment { fragment ->
assertThat(fragment.lifecycle.currentState).isEqualTo(State.CREATED)
assertThat(fragment.dialog).isNotNull()
- if (isAtLeastQ()) {
+ if (Build.VERSION.SDK_INT >= 29) {
assertThat(fragment.requireDialog().isShowing).isFalse()
} else {
// Dialog#isShowing should've returned false but it returns true due to a
@@ -174,7 +174,7 @@
onFragment { fragment ->
assertThat(fragment.lifecycle.currentState).isEqualTo(State.CREATED)
assertThat(fragment.dialog).isNotNull()
- if (isAtLeastQ()) {
+ if (Build.VERSION.SDK_INT >= 29) {
assertThat(fragment.requireDialog().isShowing).isFalse()
} else {
// Dialog#isShowing should've returned false but it returns true due to a
@@ -244,7 +244,7 @@
onFragment { fragment ->
assertThat(fragment.lifecycle.currentState).isEqualTo(State.CREATED)
assertThat(fragment.dialog).isNotNull()
- if (isAtLeastQ()) {
+ if (Build.VERSION.SDK_INT >= 29) {
assertThat(fragment.requireDialog().isShowing).isFalse()
} else {
// Dialog#isShowing should've returned false but it returns true due to a
diff --git a/gradle.properties b/gradle.properties
index c788833..5d0e134 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
-org.gradle.jvmargs=-Xmx8g
+org.gradle.jvmargs=-Xmx8g -XX:MaxPermSize=8g
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.parallel=true
diff --git a/graphics/drawable/animated/api/1.1.0-alpha01.txt b/graphics/drawable/animated/api/1.1.0-alpha01.txt
index 7542e29..70c9c23 100644
--- a/graphics/drawable/animated/api/1.1.0-alpha01.txt
+++ b/graphics/drawable/animated/api/1.1.0-alpha01.txt
@@ -25,6 +25,7 @@
method public static void registerAnimationCallback(android.graphics.drawable.Drawable!, androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback!);
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
method public void start();
method public void stop();
method public boolean unregisterAnimationCallback(androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback);
diff --git a/graphics/drawable/animated/api/1.1.0-alpha02.txt b/graphics/drawable/animated/api/1.1.0-alpha02.txt
index 7542e29..8ad4321 100644
--- a/graphics/drawable/animated/api/1.1.0-alpha02.txt
+++ b/graphics/drawable/animated/api/1.1.0-alpha02.txt
@@ -25,6 +25,8 @@
method public static void registerAnimationCallback(android.graphics.drawable.Drawable!, androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback!);
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
+ method public void setTintMode(android.graphics.PorterDuff.Mode!);
method public void start();
method public void stop();
method public boolean unregisterAnimationCallback(androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback);
diff --git a/graphics/drawable/animated/api/1.1.0-alpha03.txt b/graphics/drawable/animated/api/1.1.0-alpha03.txt
index 7542e29..70c9c23 100644
--- a/graphics/drawable/animated/api/1.1.0-alpha03.txt
+++ b/graphics/drawable/animated/api/1.1.0-alpha03.txt
@@ -25,6 +25,7 @@
method public static void registerAnimationCallback(android.graphics.drawable.Drawable!, androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback!);
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
method public void start();
method public void stop();
method public boolean unregisterAnimationCallback(androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback);
diff --git a/graphics/drawable/animated/api/1.1.0-beta00.txt b/graphics/drawable/animated/api/1.1.0-beta00.txt
new file mode 100644
index 0000000..8ad4321
--- /dev/null
+++ b/graphics/drawable/animated/api/1.1.0-beta00.txt
@@ -0,0 +1,37 @@
+// Signature format: 3.0
+package androidx.vectordrawable.graphics.drawable {
+
+ public interface Animatable2Compat extends android.graphics.drawable.Animatable {
+ method public void clearAnimationCallbacks();
+ method public void registerAnimationCallback(androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback);
+ method public boolean unregisterAnimationCallback(androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback);
+ }
+
+ public abstract static class Animatable2Compat.AnimationCallback {
+ ctor public Animatable2Compat.AnimationCallback();
+ method public void onAnimationEnd(android.graphics.drawable.Drawable!);
+ method public void onAnimationStart(android.graphics.drawable.Drawable!);
+ }
+
+ public class AnimatedVectorDrawableCompat extends android.graphics.drawable.Drawable implements androidx.vectordrawable.graphics.drawable.Animatable2Compat androidx.core.graphics.drawable.TintAwareDrawable {
+ method public void clearAnimationCallbacks();
+ method public static void clearAnimationCallbacks(android.graphics.drawable.Drawable!);
+ method public static androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat? create(android.content.Context, @DrawableRes int);
+ method public static androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat! createFromXmlInner(android.content.Context!, android.content.res.Resources!, org.xmlpull.v1.XmlPullParser!, android.util.AttributeSet!, android.content.res.Resources.Theme!) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method public void draw(android.graphics.Canvas!);
+ method public int getOpacity();
+ method public boolean isRunning();
+ method public void registerAnimationCallback(androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback);
+ method public static void registerAnimationCallback(android.graphics.drawable.Drawable!, androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback!);
+ method public void setAlpha(int);
+ method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
+ method public void setTintMode(android.graphics.PorterDuff.Mode!);
+ method public void start();
+ method public void stop();
+ method public boolean unregisterAnimationCallback(androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback);
+ method public static boolean unregisterAnimationCallback(android.graphics.drawable.Drawable!, androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback!);
+ }
+
+}
+
diff --git a/graphics/drawable/animated/api/1.1.0-beta01.txt b/graphics/drawable/animated/api/1.1.0-beta01.txt
index 7542e29..70c9c23 100644
--- a/graphics/drawable/animated/api/1.1.0-beta01.txt
+++ b/graphics/drawable/animated/api/1.1.0-beta01.txt
@@ -25,6 +25,7 @@
method public static void registerAnimationCallback(android.graphics.drawable.Drawable!, androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback!);
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
method public void start();
method public void stop();
method public boolean unregisterAnimationCallback(androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback);
diff --git a/graphics/drawable/animated/api/1.1.0-beta02.txt b/graphics/drawable/animated/api/1.1.0-beta02.txt
index 7542e29..70c9c23 100644
--- a/graphics/drawable/animated/api/1.1.0-beta02.txt
+++ b/graphics/drawable/animated/api/1.1.0-beta02.txt
@@ -25,6 +25,7 @@
method public static void registerAnimationCallback(android.graphics.drawable.Drawable!, androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback!);
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
method public void start();
method public void stop();
method public boolean unregisterAnimationCallback(androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback);
diff --git a/graphics/drawable/animated/api/current.txt b/graphics/drawable/animated/api/current.txt
index 7542e29..70c9c23 100644
--- a/graphics/drawable/animated/api/current.txt
+++ b/graphics/drawable/animated/api/current.txt
@@ -25,6 +25,7 @@
method public static void registerAnimationCallback(android.graphics.drawable.Drawable!, androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback!);
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
method public void start();
method public void stop();
method public boolean unregisterAnimationCallback(androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback);
diff --git a/graphics/drawable/animated/api/restricted_1.1.0-alpha02.txt b/graphics/drawable/animated/api/restricted_1.1.0-alpha02.txt
index ceab395..11970ce 100644
--- a/graphics/drawable/animated/api/restricted_1.1.0-alpha02.txt
+++ b/graphics/drawable/animated/api/restricted_1.1.0-alpha02.txt
@@ -1,6 +1,10 @@
// Signature format: 3.0
package androidx.vectordrawable.graphics.drawable {
+ public class AnimatedVectorDrawableCompat extends android.graphics.drawable.Drawable implements androidx.vectordrawable.graphics.drawable.Animatable2Compat androidx.core.graphics.drawable.TintAwareDrawable {
+ method public void setTintMode(android.graphics.PorterDuff.Mode!);
+ }
+
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class AnimationUtilsCompat {
method public static android.view.animation.Interpolator! loadInterpolator(android.content.Context!, int) throws android.content.res.Resources.NotFoundException;
}
diff --git a/graphics/drawable/animated/api/restricted_1.1.0-beta00.txt b/graphics/drawable/animated/api/restricted_1.1.0-beta00.txt
new file mode 100644
index 0000000..11970ce
--- /dev/null
+++ b/graphics/drawable/animated/api/restricted_1.1.0-beta00.txt
@@ -0,0 +1,33 @@
+// Signature format: 3.0
+package androidx.vectordrawable.graphics.drawable {
+
+ public class AnimatedVectorDrawableCompat extends android.graphics.drawable.Drawable implements androidx.vectordrawable.graphics.drawable.Animatable2Compat androidx.core.graphics.drawable.TintAwareDrawable {
+ method public void setTintMode(android.graphics.PorterDuff.Mode!);
+ }
+
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class AnimationUtilsCompat {
+ method public static android.view.animation.Interpolator! loadInterpolator(android.content.Context!, int) throws android.content.res.Resources.NotFoundException;
+ }
+
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class AnimatorInflaterCompat {
+ method public static android.animation.Animator! loadAnimator(android.content.Context!, @AnimatorRes int) throws android.content.res.Resources.NotFoundException;
+ method public static android.animation.Animator! loadAnimator(android.content.Context!, android.content.res.Resources!, android.content.res.Resources.Theme!, @AnimatorRes int) throws android.content.res.Resources.NotFoundException;
+ method public static android.animation.Animator! loadAnimator(android.content.Context!, android.content.res.Resources!, android.content.res.Resources.Theme!, @AnimatorRes int, float) throws android.content.res.Resources.NotFoundException;
+ }
+
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ArgbEvaluator implements android.animation.TypeEvaluator {
+ ctor public ArgbEvaluator();
+ method public Object! evaluate(float, Object!, Object!);
+ method public static androidx.vectordrawable.graphics.drawable.ArgbEvaluator! getInstance();
+ }
+
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class PathInterpolatorCompat implements android.view.animation.Interpolator {
+ ctor public PathInterpolatorCompat(android.content.Context!, android.util.AttributeSet!, org.xmlpull.v1.XmlPullParser!);
+ ctor public PathInterpolatorCompat(android.content.res.Resources!, android.content.res.Resources.Theme!, android.util.AttributeSet!, org.xmlpull.v1.XmlPullParser!);
+ method public float getInterpolation(float);
+ field public static final double EPSILON = 1.0E-5;
+ field public static final int MAX_NUM_POINTS = 3000; // 0xbb8
+ }
+
+}
+
diff --git a/graphics/drawable/animated/src/main/java/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat.java b/graphics/drawable/animated/src/main/java/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat.java
index b0c84bd..7dd9e1d 100644
--- a/graphics/drawable/animated/src/main/java/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat.java
+++ b/graphics/drawable/animated/src/main/java/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat.java
@@ -397,6 +397,8 @@
return mAnimatedVectorState.mVectorDrawable.isStateful();
}
+ // Remove deprecation suppression once b/120984759 is resolved
+ @SuppressWarnings("deprecation")
@Override
public int getOpacity() {
if (mDelegateDrawable != null) {
diff --git a/graphics/drawable/static/api/1.1.0-alpha01.txt b/graphics/drawable/static/api/1.1.0-alpha01.txt
index 3fda85b..34cf297 100644
--- a/graphics/drawable/static/api/1.1.0-alpha01.txt
+++ b/graphics/drawable/static/api/1.1.0-alpha01.txt
@@ -8,6 +8,7 @@
method public int getOpacity();
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
}
}
diff --git a/graphics/drawable/static/api/1.1.0-alpha02.txt b/graphics/drawable/static/api/1.1.0-alpha02.txt
index 3fda85b..fb0b767 100644
--- a/graphics/drawable/static/api/1.1.0-alpha02.txt
+++ b/graphics/drawable/static/api/1.1.0-alpha02.txt
@@ -8,6 +8,8 @@
method public int getOpacity();
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
+ method public void setTintMode(android.graphics.PorterDuff.Mode!);
}
}
diff --git a/graphics/drawable/static/api/1.1.0-alpha03.txt b/graphics/drawable/static/api/1.1.0-alpha03.txt
index 3fda85b..34cf297 100644
--- a/graphics/drawable/static/api/1.1.0-alpha03.txt
+++ b/graphics/drawable/static/api/1.1.0-alpha03.txt
@@ -8,6 +8,7 @@
method public int getOpacity();
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
}
}
diff --git a/graphics/drawable/static/api/1.1.0-beta00.txt b/graphics/drawable/static/api/1.1.0-beta00.txt
new file mode 100644
index 0000000..fb0b767
--- /dev/null
+++ b/graphics/drawable/static/api/1.1.0-beta00.txt
@@ -0,0 +1,16 @@
+// Signature format: 3.0
+package androidx.vectordrawable.graphics.drawable {
+
+ public class VectorDrawableCompat extends android.graphics.drawable.Drawable implements androidx.core.graphics.drawable.TintAwareDrawable {
+ method public static androidx.vectordrawable.graphics.drawable.VectorDrawableCompat? create(android.content.res.Resources, @DrawableRes int, android.content.res.Resources.Theme?);
+ method public static androidx.vectordrawable.graphics.drawable.VectorDrawableCompat! createFromXmlInner(android.content.res.Resources!, org.xmlpull.v1.XmlPullParser!, android.util.AttributeSet!, android.content.res.Resources.Theme!) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method public void draw(android.graphics.Canvas!);
+ method public int getOpacity();
+ method public void setAlpha(int);
+ method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
+ method public void setTintMode(android.graphics.PorterDuff.Mode!);
+ }
+
+}
+
diff --git a/graphics/drawable/static/api/1.1.0-beta01.txt b/graphics/drawable/static/api/1.1.0-beta01.txt
index 3fda85b..34cf297 100644
--- a/graphics/drawable/static/api/1.1.0-beta01.txt
+++ b/graphics/drawable/static/api/1.1.0-beta01.txt
@@ -8,6 +8,7 @@
method public int getOpacity();
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
}
}
diff --git a/graphics/drawable/static/api/1.1.0-beta02.txt b/graphics/drawable/static/api/1.1.0-beta02.txt
index 3fda85b..34cf297 100644
--- a/graphics/drawable/static/api/1.1.0-beta02.txt
+++ b/graphics/drawable/static/api/1.1.0-beta02.txt
@@ -8,6 +8,7 @@
method public int getOpacity();
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
}
}
diff --git a/graphics/drawable/static/api/current.txt b/graphics/drawable/static/api/current.txt
index 3fda85b..34cf297 100644
--- a/graphics/drawable/static/api/current.txt
+++ b/graphics/drawable/static/api/current.txt
@@ -8,6 +8,7 @@
method public int getOpacity();
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter!);
+ method public void setColorFilter(int, android.graphics.PorterDuff.Mode!);
}
}
diff --git a/graphics/drawable/static/api/restricted_1.1.0-alpha02.txt b/graphics/drawable/static/api/restricted_1.1.0-alpha02.txt
index dadafcd..f3fcded 100644
--- a/graphics/drawable/static/api/restricted_1.1.0-alpha02.txt
+++ b/graphics/drawable/static/api/restricted_1.1.0-alpha02.txt
@@ -3,6 +3,7 @@
public class VectorDrawableCompat extends android.graphics.drawable.Drawable implements androidx.core.graphics.drawable.TintAwareDrawable {
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public float getPixelSize();
+ method public void setTintMode(android.graphics.PorterDuff.Mode!);
}
}
diff --git a/graphics/drawable/static/api/restricted_1.1.0-beta00.txt b/graphics/drawable/static/api/restricted_1.1.0-beta00.txt
new file mode 100644
index 0000000..f3fcded
--- /dev/null
+++ b/graphics/drawable/static/api/restricted_1.1.0-beta00.txt
@@ -0,0 +1,10 @@
+// Signature format: 3.0
+package androidx.vectordrawable.graphics.drawable {
+
+ public class VectorDrawableCompat extends android.graphics.drawable.Drawable implements androidx.core.graphics.drawable.TintAwareDrawable {
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public float getPixelSize();
+ method public void setTintMode(android.graphics.PorterDuff.Mode!);
+ }
+
+}
+
diff --git a/gridlayout/src/main/java/androidx/gridlayout/widget/GridLayout.java b/gridlayout/src/main/java/androidx/gridlayout/widget/GridLayout.java
index c99c799..f8a920d 100644
--- a/gridlayout/src/main/java/androidx/gridlayout/widget/GridLayout.java
+++ b/gridlayout/src/main/java/androidx/gridlayout/widget/GridLayout.java
@@ -33,6 +33,7 @@
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
+import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.util.LogPrinter;
@@ -271,6 +272,9 @@
super(context, attrs, defStyle);
mDefaultGap = context.getResources().getDimensionPixelOffset(R.dimen.default_gap);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.GridLayout);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(context, R.styleable.GridLayout, attrs, a, defStyle, 0);
+ }
try {
setRowCount(a.getInt(ROW_COUNT, DEFAULT_COUNT));
setColumnCount(a.getInt(COLUMN_COUNT, DEFAULT_COUNT));
diff --git a/leanback-preference/api/1.1.0-alpha01.txt b/leanback-preference/api/1.1.0-alpha01.txt
index 79e53fb..2ff4b27 100644
--- a/leanback-preference/api/1.1.0-alpha01.txt
+++ b/leanback-preference/api/1.1.0-alpha01.txt
@@ -21,6 +21,8 @@
method @Deprecated public static androidx.leanback.preference.LeanbackListPreferenceDialogFragment! newInstanceMulti(String!);
method @Deprecated public static androidx.leanback.preference.LeanbackListPreferenceDialogFragment! newInstanceSingle(String!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView.Adapter! onCreateAdapter();
+ method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
}
@Deprecated public class LeanbackListPreferenceDialogFragment.AdapterMulti extends androidx.recyclerview.widget.RecyclerView.Adapter<androidx.leanback.preference.LeanbackListPreferenceDialogFragment.ViewHolder> implements androidx.leanback.preference.LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener {
@@ -67,6 +69,7 @@
@Deprecated public class LeanbackPreferenceDialogFragment extends android.app.Fragment {
ctor @Deprecated public LeanbackPreferenceDialogFragment();
method @Deprecated public androidx.preference.DialogPreference! getPreference();
+ method @Deprecated public void onCreate(android.os.Bundle!);
field @Deprecated public static final String ARG_KEY = "key";
}
@@ -88,8 +91,12 @@
@Deprecated public abstract class LeanbackSettingsFragment extends android.app.Fragment implements androidx.preference.PreferenceFragment.OnPreferenceDisplayDialogCallback androidx.preference.PreferenceFragment.OnPreferenceStartFragmentCallback androidx.preference.PreferenceFragment.OnPreferenceStartScreenCallback {
ctor @Deprecated public LeanbackSettingsFragment();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onPause();
method @Deprecated public boolean onPreferenceDisplayDialog(androidx.preference.PreferenceFragment, androidx.preference.Preference!);
method @Deprecated public abstract void onPreferenceStartInitialScreen();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onViewCreated(android.view.View!, android.os.Bundle!);
method @Deprecated public void startImmersiveFragment(android.app.Fragment);
method @Deprecated public void startPreferenceFragment(android.app.Fragment);
}
diff --git a/leanback-preference/api/1.1.0-alpha02.txt b/leanback-preference/api/1.1.0-alpha02.txt
index 5d40456..7d55268 100644
--- a/leanback-preference/api/1.1.0-alpha02.txt
+++ b/leanback-preference/api/1.1.0-alpha02.txt
@@ -22,6 +22,8 @@
method @Deprecated public static androidx.leanback.preference.LeanbackListPreferenceDialogFragment! newInstanceMulti(String!);
method @Deprecated public static androidx.leanback.preference.LeanbackListPreferenceDialogFragment! newInstanceSingle(String!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView.Adapter! onCreateAdapter();
+ method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
}
@Deprecated public class LeanbackListPreferenceDialogFragment.AdapterMulti extends androidx.recyclerview.widget.RecyclerView.Adapter<androidx.leanback.preference.LeanbackListPreferenceDialogFragment.ViewHolder> implements androidx.leanback.preference.LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener {
@@ -68,6 +70,7 @@
@Deprecated public class LeanbackPreferenceDialogFragment extends android.app.Fragment {
ctor @Deprecated public LeanbackPreferenceDialogFragment();
method @Deprecated public androidx.preference.DialogPreference! getPreference();
+ method @Deprecated public void onCreate(android.os.Bundle!);
field @Deprecated public static final String ARG_KEY = "key";
}
@@ -89,8 +92,12 @@
@Deprecated public abstract class LeanbackSettingsFragment extends android.app.Fragment implements androidx.preference.PreferenceFragment.OnPreferenceDisplayDialogCallback androidx.preference.PreferenceFragment.OnPreferenceStartFragmentCallback androidx.preference.PreferenceFragment.OnPreferenceStartScreenCallback {
ctor @Deprecated public LeanbackSettingsFragment();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onPause();
method @Deprecated public boolean onPreferenceDisplayDialog(androidx.preference.PreferenceFragment, androidx.preference.Preference!);
method @Deprecated public abstract void onPreferenceStartInitialScreen();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onViewCreated(android.view.View!, android.os.Bundle!);
method @Deprecated public void startImmersiveFragment(android.app.Fragment);
method @Deprecated public void startPreferenceFragment(android.app.Fragment);
}
diff --git a/leanback-preference/api/1.1.0-alpha03.txt b/leanback-preference/api/1.1.0-alpha03.txt
index 5d40456..7d55268 100644
--- a/leanback-preference/api/1.1.0-alpha03.txt
+++ b/leanback-preference/api/1.1.0-alpha03.txt
@@ -22,6 +22,8 @@
method @Deprecated public static androidx.leanback.preference.LeanbackListPreferenceDialogFragment! newInstanceMulti(String!);
method @Deprecated public static androidx.leanback.preference.LeanbackListPreferenceDialogFragment! newInstanceSingle(String!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView.Adapter! onCreateAdapter();
+ method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
}
@Deprecated public class LeanbackListPreferenceDialogFragment.AdapterMulti extends androidx.recyclerview.widget.RecyclerView.Adapter<androidx.leanback.preference.LeanbackListPreferenceDialogFragment.ViewHolder> implements androidx.leanback.preference.LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener {
@@ -68,6 +70,7 @@
@Deprecated public class LeanbackPreferenceDialogFragment extends android.app.Fragment {
ctor @Deprecated public LeanbackPreferenceDialogFragment();
method @Deprecated public androidx.preference.DialogPreference! getPreference();
+ method @Deprecated public void onCreate(android.os.Bundle!);
field @Deprecated public static final String ARG_KEY = "key";
}
@@ -89,8 +92,12 @@
@Deprecated public abstract class LeanbackSettingsFragment extends android.app.Fragment implements androidx.preference.PreferenceFragment.OnPreferenceDisplayDialogCallback androidx.preference.PreferenceFragment.OnPreferenceStartFragmentCallback androidx.preference.PreferenceFragment.OnPreferenceStartScreenCallback {
ctor @Deprecated public LeanbackSettingsFragment();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onPause();
method @Deprecated public boolean onPreferenceDisplayDialog(androidx.preference.PreferenceFragment, androidx.preference.Preference!);
method @Deprecated public abstract void onPreferenceStartInitialScreen();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onViewCreated(android.view.View!, android.os.Bundle!);
method @Deprecated public void startImmersiveFragment(android.app.Fragment);
method @Deprecated public void startPreferenceFragment(android.app.Fragment);
}
diff --git a/leanback-preference/api/current.txt b/leanback-preference/api/current.txt
index 5d40456..7d55268 100644
--- a/leanback-preference/api/current.txt
+++ b/leanback-preference/api/current.txt
@@ -22,6 +22,8 @@
method @Deprecated public static androidx.leanback.preference.LeanbackListPreferenceDialogFragment! newInstanceMulti(String!);
method @Deprecated public static androidx.leanback.preference.LeanbackListPreferenceDialogFragment! newInstanceSingle(String!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView.Adapter! onCreateAdapter();
+ method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
}
@Deprecated public class LeanbackListPreferenceDialogFragment.AdapterMulti extends androidx.recyclerview.widget.RecyclerView.Adapter<androidx.leanback.preference.LeanbackListPreferenceDialogFragment.ViewHolder> implements androidx.leanback.preference.LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener {
@@ -68,6 +70,7 @@
@Deprecated public class LeanbackPreferenceDialogFragment extends android.app.Fragment {
ctor @Deprecated public LeanbackPreferenceDialogFragment();
method @Deprecated public androidx.preference.DialogPreference! getPreference();
+ method @Deprecated public void onCreate(android.os.Bundle!);
field @Deprecated public static final String ARG_KEY = "key";
}
@@ -89,8 +92,12 @@
@Deprecated public abstract class LeanbackSettingsFragment extends android.app.Fragment implements androidx.preference.PreferenceFragment.OnPreferenceDisplayDialogCallback androidx.preference.PreferenceFragment.OnPreferenceStartFragmentCallback androidx.preference.PreferenceFragment.OnPreferenceStartScreenCallback {
ctor @Deprecated public LeanbackSettingsFragment();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onPause();
method @Deprecated public boolean onPreferenceDisplayDialog(androidx.preference.PreferenceFragment, androidx.preference.Preference!);
method @Deprecated public abstract void onPreferenceStartInitialScreen();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onViewCreated(android.view.View!, android.os.Bundle!);
method @Deprecated public void startImmersiveFragment(android.app.Fragment);
method @Deprecated public void startPreferenceFragment(android.app.Fragment);
}
diff --git a/leanback-preference/api/restricted_1.1.0-alpha02.txt b/leanback-preference/api/restricted_1.1.0-alpha02.txt
index c559029..9e56499 100644
--- a/leanback-preference/api/restricted_1.1.0-alpha02.txt
+++ b/leanback-preference/api/restricted_1.1.0-alpha02.txt
@@ -7,6 +7,7 @@
@Deprecated @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static class LeanbackSettingsFragment.DummyFragment extends android.app.Fragment {
ctor @Deprecated public LeanbackSettingsFragment.DummyFragment();
+ method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
}
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class LeanbackSettingsRootView extends android.widget.FrameLayout {
diff --git a/leanback-preference/api/restricted_1.1.0-alpha03.txt b/leanback-preference/api/restricted_1.1.0-alpha03.txt
index c559029..9e56499 100644
--- a/leanback-preference/api/restricted_1.1.0-alpha03.txt
+++ b/leanback-preference/api/restricted_1.1.0-alpha03.txt
@@ -7,6 +7,7 @@
@Deprecated @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static class LeanbackSettingsFragment.DummyFragment extends android.app.Fragment {
ctor @Deprecated public LeanbackSettingsFragment.DummyFragment();
+ method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
}
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class LeanbackSettingsRootView extends android.widget.FrameLayout {
diff --git a/leanback-preference/api/restricted_current.txt b/leanback-preference/api/restricted_current.txt
index c559029..9e56499 100644
--- a/leanback-preference/api/restricted_current.txt
+++ b/leanback-preference/api/restricted_current.txt
@@ -7,6 +7,7 @@
@Deprecated @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static class LeanbackSettingsFragment.DummyFragment extends android.app.Fragment {
ctor @Deprecated public LeanbackSettingsFragment.DummyFragment();
+ method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
}
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class LeanbackSettingsRootView extends android.widget.FrameLayout {
diff --git a/leanback/api/1.1.0-alpha01.txt b/leanback/api/1.1.0-alpha01.txt
index 9dab078..6bf9dcc 100644
--- a/leanback/api/1.1.0-alpha01.txt
+++ b/leanback/api/1.1.0-alpha01.txt
@@ -24,6 +24,7 @@
@Deprecated public class BaseFragment extends androidx.leanback.app.BrandedFragment {
method @Deprecated protected Object! createEntranceTransition();
method @Deprecated public final androidx.leanback.app.ProgressBarManager! getProgressBarManager();
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated protected void onEntranceTransitionEnd();
method @Deprecated protected void onEntranceTransitionPrepare();
method @Deprecated protected void onEntranceTransitionStart();
@@ -53,7 +54,13 @@
method @Deprecated public androidx.leanback.widget.TitleViewAdapter! getTitleViewAdapter();
method @Deprecated public void installTitleView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated public final boolean isShowingTitle();
+ method @Deprecated public void onDestroyView();
method @Deprecated public android.view.View! onInflateTitleView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onPause();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onStart();
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public void setBadgeDrawable(android.graphics.drawable.Drawable!);
method @Deprecated public void setOnSearchClickedListener(android.view.View.OnClickListener!);
method @Deprecated public void setSearchAffordanceColor(int);
@@ -104,6 +111,9 @@
method @Deprecated public boolean isInHeadersTransition();
method @Deprecated public boolean isShowingHeaders();
method @Deprecated public androidx.leanback.app.HeadersFragment! onCreateHeadersFragment();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroy();
+ method @Deprecated public void onStop();
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setBrandColor(@ColorInt int);
method @Deprecated public void setBrowseTransitionListener(androidx.leanback.app.BrowseFragment.BrowseTransitionListener!);
@@ -289,8 +299,10 @@
method @Deprecated public androidx.leanback.widget.DetailsParallax! getParallax();
method @Deprecated public androidx.leanback.app.RowsFragment! getRowsFragment();
method @Deprecated protected android.view.View! inflateTitle(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated protected void onSetDetailsOverviewRowStatus(androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter!, androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder!, int, int, int);
method @Deprecated protected void onSetRowStatus(androidx.leanback.widget.RowPresenter!, androidx.leanback.widget.RowPresenter.ViewHolder!, int, int, int);
+ method @Deprecated public void onStop();
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.BaseOnItemViewClickedListener!);
method @Deprecated public void setOnItemViewSelectedListener(androidx.leanback.widget.BaseOnItemViewSelectedListener!);
@@ -369,6 +381,7 @@
method @Deprecated public android.graphics.drawable.Drawable! getImageDrawable();
method @Deprecated public CharSequence! getMessage();
method @Deprecated public boolean isBackgroundTranslucent();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated public void setBackgroundDrawable(android.graphics.drawable.Drawable!);
method @Deprecated public void setButtonClickListener(android.view.View.OnClickListener!);
method @Deprecated public void setButtonText(String!);
@@ -425,6 +438,7 @@
method @Deprecated public void notifyActionChanged(int);
method @Deprecated public void notifyButtonActionChanged(int);
method @Deprecated protected void onAddSharedElementTransition(android.app.FragmentTransaction!, androidx.leanback.app.GuidedStepFragment!);
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated public void onCreateActions(java.util.List<androidx.leanback.widget.GuidedAction>, android.os.Bundle!);
method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! onCreateActionsStylist();
method @Deprecated public android.view.View! onCreateBackgroundView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
@@ -432,6 +446,8 @@
method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! onCreateButtonActionsStylist();
method @Deprecated public androidx.leanback.widget.GuidanceStylist.Guidance onCreateGuidance(android.os.Bundle!);
method @Deprecated public androidx.leanback.widget.GuidanceStylist! onCreateGuidanceStylist();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
method @Deprecated public void onGuidedActionClicked(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void onGuidedActionEditCanceled(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void onGuidedActionEdited(androidx.leanback.widget.GuidedAction!);
@@ -439,6 +455,8 @@
method @Deprecated public void onGuidedActionFocused(androidx.leanback.widget.GuidedAction!);
method @Deprecated protected void onProvideFragmentTransitions();
method @Deprecated public int onProvideTheme();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
method @Deprecated public boolean onSubGuidedActionClicked(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void openInEditMode(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void popBackStackToGuidedStepFragment(Class!, int);
@@ -525,9 +543,13 @@
method @Deprecated public int getSelectedPosition();
method @Deprecated public final androidx.leanback.widget.VerticalGridView! getVerticalGridView();
method @Deprecated public boolean isScrolling();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
method @Deprecated public void onTransitionEnd();
method @Deprecated public boolean onTransitionPrepare();
method @Deprecated public void onTransitionStart();
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public final void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setAlignment(int);
method @Deprecated public void setOnHeaderClickedListener(androidx.leanback.app.HeadersFragment.OnHeaderClickedListener!);
@@ -597,10 +619,13 @@
method @Deprecated protected abstract android.view.View? onCreateForegroundView(android.view.LayoutInflater!, android.view.ViewGroup!);
method @Deprecated protected android.animation.Animator? onCreateLogoAnimation();
method @Deprecated protected android.animation.Animator! onCreateTitleAnimator();
+ method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated protected void onFinishFragment();
method @Deprecated protected void onLogoAnimationFinished();
method @Deprecated protected void onPageChanged(int, int);
method @Deprecated public int onProvideTheme();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public void setArrowBackgroundColor(@ColorInt int);
method @Deprecated public void setArrowColor(@ColorInt int);
method @Deprecated public void setDescriptionViewTextColor(@ColorInt int);
@@ -664,8 +689,17 @@
method @Deprecated public boolean isShowOrHideControlsOverlayOnUserInteraction();
method @Deprecated public void notifyPlaybackRowChanged();
method @Deprecated protected void onBufferingStateChanged(boolean);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroy();
+ method @Deprecated public void onDestroyView();
method @Deprecated protected void onError(int, CharSequence!);
+ method @Deprecated public void onPause();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onStart();
+ method @Deprecated public void onStop();
method @Deprecated protected void onVideoSizeChanged(int, int);
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setBackgroundType(int);
method @Deprecated public void setControlsOverlayAutoHideEnabled(boolean);
@@ -765,9 +799,14 @@
method @Deprecated public int getSelectedPosition();
method @Deprecated public final androidx.leanback.widget.VerticalGridView! getVerticalGridView();
method @Deprecated public boolean isScrolling();
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
method @Deprecated public void onTransitionEnd();
method @Deprecated public boolean onTransitionPrepare();
method @Deprecated public void onTransitionStart();
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public final void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setAlignment(int);
method @Deprecated public void setEntranceTransitionState(boolean);
@@ -838,6 +877,13 @@
method @Deprecated public androidx.leanback.app.RowsFragment! getRowsFragment();
method @Deprecated public String! getTitle();
method @Deprecated public static androidx.leanback.app.SearchFragment! newInstance(String!);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroy();
+ method @Deprecated public void onPause();
+ method @Deprecated public void onRequestPermissionsResult(int, String[]!, int[]!);
+ method @Deprecated public void onResume();
+ method @Deprecated public void onStart();
method @Deprecated public void setBadgeDrawable(android.graphics.drawable.Drawable!);
method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.OnItemViewClickedListener!);
method @Deprecated public void setOnItemViewSelectedListener(androidx.leanback.widget.OnItemViewSelectedListener!);
@@ -891,6 +937,7 @@
method @Deprecated public androidx.leanback.widget.ObjectAdapter! getAdapter();
method @Deprecated public androidx.leanback.widget.VerticalGridPresenter! getGridPresenter();
method @Deprecated public androidx.leanback.widget.OnItemViewClickedListener! getOnItemViewClickedListener();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setGridPresenter(androidx.leanback.widget.VerticalGridPresenter!);
method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.OnItemViewClickedListener!);
diff --git a/leanback/api/1.1.0-alpha02.txt b/leanback/api/1.1.0-alpha02.txt
index 417c806..c06fadf 100644
--- a/leanback/api/1.1.0-alpha02.txt
+++ b/leanback/api/1.1.0-alpha02.txt
@@ -24,6 +24,7 @@
@Deprecated public class BaseFragment extends androidx.leanback.app.BrandedFragment {
method @Deprecated protected Object! createEntranceTransition();
method @Deprecated public final androidx.leanback.app.ProgressBarManager! getProgressBarManager();
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated protected void onEntranceTransitionEnd();
method @Deprecated protected void onEntranceTransitionPrepare();
method @Deprecated protected void onEntranceTransitionStart();
@@ -53,7 +54,13 @@
method @Deprecated public androidx.leanback.widget.TitleViewAdapter! getTitleViewAdapter();
method @Deprecated public void installTitleView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated public final boolean isShowingTitle();
+ method @Deprecated public void onDestroyView();
method @Deprecated public android.view.View! onInflateTitleView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onPause();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onStart();
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public void setBadgeDrawable(android.graphics.drawable.Drawable!);
method @Deprecated public void setOnSearchClickedListener(android.view.View.OnClickListener!);
method @Deprecated public void setSearchAffordanceColor(int);
@@ -104,6 +111,9 @@
method @Deprecated public boolean isInHeadersTransition();
method @Deprecated public boolean isShowingHeaders();
method @Deprecated public androidx.leanback.app.HeadersFragment! onCreateHeadersFragment();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroy();
+ method @Deprecated public void onStop();
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setBrandColor(@ColorInt int);
method @Deprecated public void setBrowseTransitionListener(androidx.leanback.app.BrowseFragment.BrowseTransitionListener!);
@@ -289,8 +299,10 @@
method @Deprecated public androidx.leanback.widget.DetailsParallax! getParallax();
method @Deprecated public androidx.leanback.app.RowsFragment! getRowsFragment();
method @Deprecated protected android.view.View! inflateTitle(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated protected void onSetDetailsOverviewRowStatus(androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter!, androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder!, int, int, int);
method @Deprecated protected void onSetRowStatus(androidx.leanback.widget.RowPresenter!, androidx.leanback.widget.RowPresenter.ViewHolder!, int, int, int);
+ method @Deprecated public void onStop();
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.BaseOnItemViewClickedListener!);
method @Deprecated public void setOnItemViewSelectedListener(androidx.leanback.widget.BaseOnItemViewSelectedListener!);
@@ -369,6 +381,7 @@
method @Deprecated public android.graphics.drawable.Drawable! getImageDrawable();
method @Deprecated public CharSequence! getMessage();
method @Deprecated public boolean isBackgroundTranslucent();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated public void setBackgroundDrawable(android.graphics.drawable.Drawable!);
method @Deprecated public void setButtonClickListener(android.view.View.OnClickListener!);
method @Deprecated public void setButtonText(String!);
@@ -425,6 +438,7 @@
method @Deprecated public void notifyActionChanged(int);
method @Deprecated public void notifyButtonActionChanged(int);
method @Deprecated protected void onAddSharedElementTransition(android.app.FragmentTransaction!, androidx.leanback.app.GuidedStepFragment!);
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated public void onCreateActions(java.util.List<androidx.leanback.widget.GuidedAction>, android.os.Bundle!);
method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! onCreateActionsStylist();
method @Deprecated public android.view.View! onCreateBackgroundView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
@@ -432,6 +446,8 @@
method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! onCreateButtonActionsStylist();
method @Deprecated public androidx.leanback.widget.GuidanceStylist.Guidance onCreateGuidance(android.os.Bundle!);
method @Deprecated public androidx.leanback.widget.GuidanceStylist! onCreateGuidanceStylist();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
method @Deprecated public void onGuidedActionClicked(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void onGuidedActionEditCanceled(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void onGuidedActionEdited(androidx.leanback.widget.GuidedAction!);
@@ -439,6 +455,8 @@
method @Deprecated public void onGuidedActionFocused(androidx.leanback.widget.GuidedAction!);
method @Deprecated protected void onProvideFragmentTransitions();
method @Deprecated public int onProvideTheme();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
method @Deprecated public boolean onSubGuidedActionClicked(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void openInEditMode(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void popBackStackToGuidedStepFragment(Class!, int);
@@ -525,9 +543,13 @@
method @Deprecated public int getSelectedPosition();
method @Deprecated public final androidx.leanback.widget.VerticalGridView! getVerticalGridView();
method @Deprecated public boolean isScrolling();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
method @Deprecated public void onTransitionEnd();
method @Deprecated public boolean onTransitionPrepare();
method @Deprecated public void onTransitionStart();
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public final void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setAlignment(int);
method @Deprecated public void setOnHeaderClickedListener(androidx.leanback.app.HeadersFragment.OnHeaderClickedListener!);
@@ -597,10 +619,13 @@
method @Deprecated protected abstract android.view.View? onCreateForegroundView(android.view.LayoutInflater!, android.view.ViewGroup!);
method @Deprecated protected android.animation.Animator? onCreateLogoAnimation();
method @Deprecated protected android.animation.Animator! onCreateTitleAnimator();
+ method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated protected void onFinishFragment();
method @Deprecated protected void onLogoAnimationFinished();
method @Deprecated protected void onPageChanged(int, int);
method @Deprecated public int onProvideTheme();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public void setArrowBackgroundColor(@ColorInt int);
method @Deprecated public void setArrowColor(@ColorInt int);
method @Deprecated public void setDescriptionViewTextColor(@ColorInt int);
@@ -664,8 +689,17 @@
method @Deprecated public boolean isShowOrHideControlsOverlayOnUserInteraction();
method @Deprecated public void notifyPlaybackRowChanged();
method @Deprecated protected void onBufferingStateChanged(boolean);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroy();
+ method @Deprecated public void onDestroyView();
method @Deprecated protected void onError(int, CharSequence!);
+ method @Deprecated public void onPause();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onStart();
+ method @Deprecated public void onStop();
method @Deprecated protected void onVideoSizeChanged(int, int);
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setBackgroundType(int);
method @Deprecated public void setControlsOverlayAutoHideEnabled(boolean);
@@ -765,9 +799,13 @@
method @Deprecated public int getSelectedPosition();
method @Deprecated public final androidx.leanback.widget.VerticalGridView! getVerticalGridView();
method @Deprecated public boolean isScrolling();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
method @Deprecated public void onTransitionEnd();
method @Deprecated public boolean onTransitionPrepare();
method @Deprecated public void onTransitionStart();
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public final void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setAlignment(int);
method @Deprecated public void setEntranceTransitionState(boolean);
@@ -838,6 +876,13 @@
method @Deprecated public androidx.leanback.app.RowsFragment! getRowsFragment();
method @Deprecated public String! getTitle();
method @Deprecated public static androidx.leanback.app.SearchFragment! newInstance(String!);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroy();
+ method @Deprecated public void onPause();
+ method @Deprecated public void onRequestPermissionsResult(int, String[]!, int[]!);
+ method @Deprecated public void onResume();
+ method @Deprecated public void onStart();
method @Deprecated public void setBadgeDrawable(android.graphics.drawable.Drawable!);
method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.OnItemViewClickedListener!);
method @Deprecated public void setOnItemViewSelectedListener(androidx.leanback.widget.OnItemViewSelectedListener!);
@@ -891,6 +936,7 @@
method @Deprecated public androidx.leanback.widget.ObjectAdapter! getAdapter();
method @Deprecated public androidx.leanback.widget.VerticalGridPresenter! getGridPresenter();
method @Deprecated public androidx.leanback.widget.OnItemViewClickedListener! getOnItemViewClickedListener();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setGridPresenter(androidx.leanback.widget.VerticalGridPresenter!);
method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.OnItemViewClickedListener!);
diff --git a/leanback/api/1.1.0-alpha03.txt b/leanback/api/1.1.0-alpha03.txt
index 417c806..c06fadf 100644
--- a/leanback/api/1.1.0-alpha03.txt
+++ b/leanback/api/1.1.0-alpha03.txt
@@ -24,6 +24,7 @@
@Deprecated public class BaseFragment extends androidx.leanback.app.BrandedFragment {
method @Deprecated protected Object! createEntranceTransition();
method @Deprecated public final androidx.leanback.app.ProgressBarManager! getProgressBarManager();
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated protected void onEntranceTransitionEnd();
method @Deprecated protected void onEntranceTransitionPrepare();
method @Deprecated protected void onEntranceTransitionStart();
@@ -53,7 +54,13 @@
method @Deprecated public androidx.leanback.widget.TitleViewAdapter! getTitleViewAdapter();
method @Deprecated public void installTitleView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated public final boolean isShowingTitle();
+ method @Deprecated public void onDestroyView();
method @Deprecated public android.view.View! onInflateTitleView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onPause();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onStart();
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public void setBadgeDrawable(android.graphics.drawable.Drawable!);
method @Deprecated public void setOnSearchClickedListener(android.view.View.OnClickListener!);
method @Deprecated public void setSearchAffordanceColor(int);
@@ -104,6 +111,9 @@
method @Deprecated public boolean isInHeadersTransition();
method @Deprecated public boolean isShowingHeaders();
method @Deprecated public androidx.leanback.app.HeadersFragment! onCreateHeadersFragment();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroy();
+ method @Deprecated public void onStop();
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setBrandColor(@ColorInt int);
method @Deprecated public void setBrowseTransitionListener(androidx.leanback.app.BrowseFragment.BrowseTransitionListener!);
@@ -289,8 +299,10 @@
method @Deprecated public androidx.leanback.widget.DetailsParallax! getParallax();
method @Deprecated public androidx.leanback.app.RowsFragment! getRowsFragment();
method @Deprecated protected android.view.View! inflateTitle(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated protected void onSetDetailsOverviewRowStatus(androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter!, androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder!, int, int, int);
method @Deprecated protected void onSetRowStatus(androidx.leanback.widget.RowPresenter!, androidx.leanback.widget.RowPresenter.ViewHolder!, int, int, int);
+ method @Deprecated public void onStop();
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.BaseOnItemViewClickedListener!);
method @Deprecated public void setOnItemViewSelectedListener(androidx.leanback.widget.BaseOnItemViewSelectedListener!);
@@ -369,6 +381,7 @@
method @Deprecated public android.graphics.drawable.Drawable! getImageDrawable();
method @Deprecated public CharSequence! getMessage();
method @Deprecated public boolean isBackgroundTranslucent();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated public void setBackgroundDrawable(android.graphics.drawable.Drawable!);
method @Deprecated public void setButtonClickListener(android.view.View.OnClickListener!);
method @Deprecated public void setButtonText(String!);
@@ -425,6 +438,7 @@
method @Deprecated public void notifyActionChanged(int);
method @Deprecated public void notifyButtonActionChanged(int);
method @Deprecated protected void onAddSharedElementTransition(android.app.FragmentTransaction!, androidx.leanback.app.GuidedStepFragment!);
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated public void onCreateActions(java.util.List<androidx.leanback.widget.GuidedAction>, android.os.Bundle!);
method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! onCreateActionsStylist();
method @Deprecated public android.view.View! onCreateBackgroundView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
@@ -432,6 +446,8 @@
method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! onCreateButtonActionsStylist();
method @Deprecated public androidx.leanback.widget.GuidanceStylist.Guidance onCreateGuidance(android.os.Bundle!);
method @Deprecated public androidx.leanback.widget.GuidanceStylist! onCreateGuidanceStylist();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
method @Deprecated public void onGuidedActionClicked(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void onGuidedActionEditCanceled(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void onGuidedActionEdited(androidx.leanback.widget.GuidedAction!);
@@ -439,6 +455,8 @@
method @Deprecated public void onGuidedActionFocused(androidx.leanback.widget.GuidedAction!);
method @Deprecated protected void onProvideFragmentTransitions();
method @Deprecated public int onProvideTheme();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
method @Deprecated public boolean onSubGuidedActionClicked(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void openInEditMode(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void popBackStackToGuidedStepFragment(Class!, int);
@@ -525,9 +543,13 @@
method @Deprecated public int getSelectedPosition();
method @Deprecated public final androidx.leanback.widget.VerticalGridView! getVerticalGridView();
method @Deprecated public boolean isScrolling();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
method @Deprecated public void onTransitionEnd();
method @Deprecated public boolean onTransitionPrepare();
method @Deprecated public void onTransitionStart();
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public final void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setAlignment(int);
method @Deprecated public void setOnHeaderClickedListener(androidx.leanback.app.HeadersFragment.OnHeaderClickedListener!);
@@ -597,10 +619,13 @@
method @Deprecated protected abstract android.view.View? onCreateForegroundView(android.view.LayoutInflater!, android.view.ViewGroup!);
method @Deprecated protected android.animation.Animator? onCreateLogoAnimation();
method @Deprecated protected android.animation.Animator! onCreateTitleAnimator();
+ method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated protected void onFinishFragment();
method @Deprecated protected void onLogoAnimationFinished();
method @Deprecated protected void onPageChanged(int, int);
method @Deprecated public int onProvideTheme();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public void setArrowBackgroundColor(@ColorInt int);
method @Deprecated public void setArrowColor(@ColorInt int);
method @Deprecated public void setDescriptionViewTextColor(@ColorInt int);
@@ -664,8 +689,17 @@
method @Deprecated public boolean isShowOrHideControlsOverlayOnUserInteraction();
method @Deprecated public void notifyPlaybackRowChanged();
method @Deprecated protected void onBufferingStateChanged(boolean);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroy();
+ method @Deprecated public void onDestroyView();
method @Deprecated protected void onError(int, CharSequence!);
+ method @Deprecated public void onPause();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onStart();
+ method @Deprecated public void onStop();
method @Deprecated protected void onVideoSizeChanged(int, int);
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setBackgroundType(int);
method @Deprecated public void setControlsOverlayAutoHideEnabled(boolean);
@@ -765,9 +799,13 @@
method @Deprecated public int getSelectedPosition();
method @Deprecated public final androidx.leanback.widget.VerticalGridView! getVerticalGridView();
method @Deprecated public boolean isScrolling();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
method @Deprecated public void onTransitionEnd();
method @Deprecated public boolean onTransitionPrepare();
method @Deprecated public void onTransitionStart();
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public final void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setAlignment(int);
method @Deprecated public void setEntranceTransitionState(boolean);
@@ -838,6 +876,13 @@
method @Deprecated public androidx.leanback.app.RowsFragment! getRowsFragment();
method @Deprecated public String! getTitle();
method @Deprecated public static androidx.leanback.app.SearchFragment! newInstance(String!);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroy();
+ method @Deprecated public void onPause();
+ method @Deprecated public void onRequestPermissionsResult(int, String[]!, int[]!);
+ method @Deprecated public void onResume();
+ method @Deprecated public void onStart();
method @Deprecated public void setBadgeDrawable(android.graphics.drawable.Drawable!);
method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.OnItemViewClickedListener!);
method @Deprecated public void setOnItemViewSelectedListener(androidx.leanback.widget.OnItemViewSelectedListener!);
@@ -891,6 +936,7 @@
method @Deprecated public androidx.leanback.widget.ObjectAdapter! getAdapter();
method @Deprecated public androidx.leanback.widget.VerticalGridPresenter! getGridPresenter();
method @Deprecated public androidx.leanback.widget.OnItemViewClickedListener! getOnItemViewClickedListener();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setGridPresenter(androidx.leanback.widget.VerticalGridPresenter!);
method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.OnItemViewClickedListener!);
diff --git a/leanback/api/current.txt b/leanback/api/current.txt
index 417c806..c06fadf 100644
--- a/leanback/api/current.txt
+++ b/leanback/api/current.txt
@@ -24,6 +24,7 @@
@Deprecated public class BaseFragment extends androidx.leanback.app.BrandedFragment {
method @Deprecated protected Object! createEntranceTransition();
method @Deprecated public final androidx.leanback.app.ProgressBarManager! getProgressBarManager();
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated protected void onEntranceTransitionEnd();
method @Deprecated protected void onEntranceTransitionPrepare();
method @Deprecated protected void onEntranceTransitionStart();
@@ -53,7 +54,13 @@
method @Deprecated public androidx.leanback.widget.TitleViewAdapter! getTitleViewAdapter();
method @Deprecated public void installTitleView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated public final boolean isShowingTitle();
+ method @Deprecated public void onDestroyView();
method @Deprecated public android.view.View! onInflateTitleView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onPause();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onStart();
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public void setBadgeDrawable(android.graphics.drawable.Drawable!);
method @Deprecated public void setOnSearchClickedListener(android.view.View.OnClickListener!);
method @Deprecated public void setSearchAffordanceColor(int);
@@ -104,6 +111,9 @@
method @Deprecated public boolean isInHeadersTransition();
method @Deprecated public boolean isShowingHeaders();
method @Deprecated public androidx.leanback.app.HeadersFragment! onCreateHeadersFragment();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroy();
+ method @Deprecated public void onStop();
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setBrandColor(@ColorInt int);
method @Deprecated public void setBrowseTransitionListener(androidx.leanback.app.BrowseFragment.BrowseTransitionListener!);
@@ -289,8 +299,10 @@
method @Deprecated public androidx.leanback.widget.DetailsParallax! getParallax();
method @Deprecated public androidx.leanback.app.RowsFragment! getRowsFragment();
method @Deprecated protected android.view.View! inflateTitle(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated protected void onSetDetailsOverviewRowStatus(androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter!, androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder!, int, int, int);
method @Deprecated protected void onSetRowStatus(androidx.leanback.widget.RowPresenter!, androidx.leanback.widget.RowPresenter.ViewHolder!, int, int, int);
+ method @Deprecated public void onStop();
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.BaseOnItemViewClickedListener!);
method @Deprecated public void setOnItemViewSelectedListener(androidx.leanback.widget.BaseOnItemViewSelectedListener!);
@@ -369,6 +381,7 @@
method @Deprecated public android.graphics.drawable.Drawable! getImageDrawable();
method @Deprecated public CharSequence! getMessage();
method @Deprecated public boolean isBackgroundTranslucent();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated public void setBackgroundDrawable(android.graphics.drawable.Drawable!);
method @Deprecated public void setButtonClickListener(android.view.View.OnClickListener!);
method @Deprecated public void setButtonText(String!);
@@ -425,6 +438,7 @@
method @Deprecated public void notifyActionChanged(int);
method @Deprecated public void notifyButtonActionChanged(int);
method @Deprecated protected void onAddSharedElementTransition(android.app.FragmentTransaction!, androidx.leanback.app.GuidedStepFragment!);
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated public void onCreateActions(java.util.List<androidx.leanback.widget.GuidedAction>, android.os.Bundle!);
method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! onCreateActionsStylist();
method @Deprecated public android.view.View! onCreateBackgroundView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
@@ -432,6 +446,8 @@
method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! onCreateButtonActionsStylist();
method @Deprecated public androidx.leanback.widget.GuidanceStylist.Guidance onCreateGuidance(android.os.Bundle!);
method @Deprecated public androidx.leanback.widget.GuidanceStylist! onCreateGuidanceStylist();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
method @Deprecated public void onGuidedActionClicked(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void onGuidedActionEditCanceled(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void onGuidedActionEdited(androidx.leanback.widget.GuidedAction!);
@@ -439,6 +455,8 @@
method @Deprecated public void onGuidedActionFocused(androidx.leanback.widget.GuidedAction!);
method @Deprecated protected void onProvideFragmentTransitions();
method @Deprecated public int onProvideTheme();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
method @Deprecated public boolean onSubGuidedActionClicked(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void openInEditMode(androidx.leanback.widget.GuidedAction!);
method @Deprecated public void popBackStackToGuidedStepFragment(Class!, int);
@@ -525,9 +543,13 @@
method @Deprecated public int getSelectedPosition();
method @Deprecated public final androidx.leanback.widget.VerticalGridView! getVerticalGridView();
method @Deprecated public boolean isScrolling();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
method @Deprecated public void onTransitionEnd();
method @Deprecated public boolean onTransitionPrepare();
method @Deprecated public void onTransitionStart();
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public final void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setAlignment(int);
method @Deprecated public void setOnHeaderClickedListener(androidx.leanback.app.HeadersFragment.OnHeaderClickedListener!);
@@ -597,10 +619,13 @@
method @Deprecated protected abstract android.view.View? onCreateForegroundView(android.view.LayoutInflater!, android.view.ViewGroup!);
method @Deprecated protected android.animation.Animator? onCreateLogoAnimation();
method @Deprecated protected android.animation.Animator! onCreateTitleAnimator();
+ method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated protected void onFinishFragment();
method @Deprecated protected void onLogoAnimationFinished();
method @Deprecated protected void onPageChanged(int, int);
method @Deprecated public int onProvideTheme();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public void setArrowBackgroundColor(@ColorInt int);
method @Deprecated public void setArrowColor(@ColorInt int);
method @Deprecated public void setDescriptionViewTextColor(@ColorInt int);
@@ -664,8 +689,17 @@
method @Deprecated public boolean isShowOrHideControlsOverlayOnUserInteraction();
method @Deprecated public void notifyPlaybackRowChanged();
method @Deprecated protected void onBufferingStateChanged(boolean);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroy();
+ method @Deprecated public void onDestroyView();
method @Deprecated protected void onError(int, CharSequence!);
+ method @Deprecated public void onPause();
+ method @Deprecated public void onResume();
+ method @Deprecated public void onStart();
+ method @Deprecated public void onStop();
method @Deprecated protected void onVideoSizeChanged(int, int);
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setBackgroundType(int);
method @Deprecated public void setControlsOverlayAutoHideEnabled(boolean);
@@ -765,9 +799,13 @@
method @Deprecated public int getSelectedPosition();
method @Deprecated public final androidx.leanback.widget.VerticalGridView! getVerticalGridView();
method @Deprecated public boolean isScrolling();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
method @Deprecated public void onTransitionEnd();
method @Deprecated public boolean onTransitionPrepare();
method @Deprecated public void onTransitionStart();
+ method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
method @Deprecated public final void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setAlignment(int);
method @Deprecated public void setEntranceTransitionState(boolean);
@@ -838,6 +876,13 @@
method @Deprecated public androidx.leanback.app.RowsFragment! getRowsFragment();
method @Deprecated public String! getTitle();
method @Deprecated public static androidx.leanback.app.SearchFragment! newInstance(String!);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroy();
+ method @Deprecated public void onPause();
+ method @Deprecated public void onRequestPermissionsResult(int, String[]!, int[]!);
+ method @Deprecated public void onResume();
+ method @Deprecated public void onStart();
method @Deprecated public void setBadgeDrawable(android.graphics.drawable.Drawable!);
method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.OnItemViewClickedListener!);
method @Deprecated public void setOnItemViewSelectedListener(androidx.leanback.widget.OnItemViewSelectedListener!);
@@ -891,6 +936,7 @@
method @Deprecated public androidx.leanback.widget.ObjectAdapter! getAdapter();
method @Deprecated public androidx.leanback.widget.VerticalGridPresenter! getGridPresenter();
method @Deprecated public androidx.leanback.widget.OnItemViewClickedListener! getOnItemViewClickedListener();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
method @Deprecated public void setGridPresenter(androidx.leanback.widget.VerticalGridPresenter!);
method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.OnItemViewClickedListener!);
diff --git a/leanback/api/restricted_1.1.0-alpha02.txt b/leanback/api/restricted_1.1.0-alpha02.txt
index d54d9cd..b60f71d 100644
--- a/leanback/api/restricted_1.1.0-alpha02.txt
+++ b/leanback/api/restricted_1.1.0-alpha02.txt
@@ -17,6 +17,10 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final class BackgroundFragment extends android.app.Fragment {
ctor public BackgroundFragment();
+ method public void onDestroy();
+ method public void onResume();
+ method public void onStart();
+ method public void onStop();
}
@Deprecated public class GuidedStepFragment extends android.app.Fragment implements androidx.leanback.widget.GuidedActionAdapter.FocusListener {
@@ -28,6 +32,7 @@
@Deprecated @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static class GuidedStepFragment.DummyFragment extends android.app.Fragment {
ctor @Deprecated public GuidedStepFragment.DummyFragment();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
}
public class GuidedStepSupportFragment extends androidx.fragment.app.Fragment implements androidx.leanback.widget.GuidedActionAdapter.FocusListener {
diff --git a/leanback/api/restricted_1.1.0-alpha03.txt b/leanback/api/restricted_1.1.0-alpha03.txt
index d54d9cd..b60f71d 100644
--- a/leanback/api/restricted_1.1.0-alpha03.txt
+++ b/leanback/api/restricted_1.1.0-alpha03.txt
@@ -17,6 +17,10 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final class BackgroundFragment extends android.app.Fragment {
ctor public BackgroundFragment();
+ method public void onDestroy();
+ method public void onResume();
+ method public void onStart();
+ method public void onStop();
}
@Deprecated public class GuidedStepFragment extends android.app.Fragment implements androidx.leanback.widget.GuidedActionAdapter.FocusListener {
@@ -28,6 +32,7 @@
@Deprecated @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static class GuidedStepFragment.DummyFragment extends android.app.Fragment {
ctor @Deprecated public GuidedStepFragment.DummyFragment();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
}
public class GuidedStepSupportFragment extends androidx.fragment.app.Fragment implements androidx.leanback.widget.GuidedActionAdapter.FocusListener {
diff --git a/leanback/api/restricted_current.txt b/leanback/api/restricted_current.txt
index d54d9cd..b60f71d 100644
--- a/leanback/api/restricted_current.txt
+++ b/leanback/api/restricted_current.txt
@@ -17,6 +17,10 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final class BackgroundFragment extends android.app.Fragment {
ctor public BackgroundFragment();
+ method public void onDestroy();
+ method public void onResume();
+ method public void onStart();
+ method public void onStop();
}
@Deprecated public class GuidedStepFragment extends android.app.Fragment implements androidx.leanback.widget.GuidedActionAdapter.FocusListener {
@@ -28,6 +32,7 @@
@Deprecated @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static class GuidedStepFragment.DummyFragment extends android.app.Fragment {
ctor @Deprecated public GuidedStepFragment.DummyFragment();
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
}
public class GuidedStepSupportFragment extends androidx.fragment.app.Fragment implements androidx.leanback.widget.GuidedActionAdapter.FocusListener {
diff --git a/leanback/src/main/java/androidx/leanback/widget/HorizontalGridView.java b/leanback/src/main/java/androidx/leanback/widget/HorizontalGridView.java
index 53f77ae..1dae4bb 100644
--- a/leanback/src/main/java/androidx/leanback/widget/HorizontalGridView.java
+++ b/leanback/src/main/java/androidx/leanback/widget/HorizontalGridView.java
@@ -24,6 +24,7 @@
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.Shader;
+import android.os.Build;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
@@ -81,6 +82,10 @@
protected void initAttributes(Context context, AttributeSet attrs) {
initBaseGridViewAttributes(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.lbHorizontalGridView);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.lbHorizontalGridView, attrs, a, 0, 0);
+ }
setRowHeight(a);
setNumRows(a.getInt(R.styleable.lbHorizontalGridView_numberOfRows, 1));
a.recycle();
diff --git a/leanback/src/main/java/androidx/leanback/widget/ImageCardView.java b/leanback/src/main/java/androidx/leanback/widget/ImageCardView.java
index 7286b19..a164ca2 100644
--- a/leanback/src/main/java/androidx/leanback/widget/ImageCardView.java
+++ b/leanback/src/main/java/androidx/leanback/widget/ImageCardView.java
@@ -17,6 +17,7 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
@@ -170,6 +171,11 @@
inflater.inflate(R.layout.lb_image_card_view, this);
TypedArray cardAttrs = getContext().obtainStyledAttributes(attrs,
R.styleable.lbImageCardView, defStyleAttr, defStyle);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ getContext(), R.styleable.lbImageCardView, attrs, cardAttrs, defStyleAttr,
+ defStyle);
+ }
int cardType = cardAttrs
.getInt(R.styleable.lbImageCardView_lbImageCardViewType, CARD_TYPE_FLAG_IMAGE_ONLY);
diff --git a/leanback/src/main/java/androidx/leanback/widget/PagingIndicator.java b/leanback/src/main/java/androidx/leanback/widget/PagingIndicator.java
index dafc41b..07b9c1d 100644
--- a/leanback/src/main/java/androidx/leanback/widget/PagingIndicator.java
+++ b/leanback/src/main/java/androidx/leanback/widget/PagingIndicator.java
@@ -34,6 +34,7 @@
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
+import android.os.Build;
import android.util.AttributeSet;
import android.util.Property;
import android.view.View;
@@ -143,6 +144,10 @@
Resources res = getResources();
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.PagingIndicator,
defStyle, 0);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.PagingIndicator, attrs, typedArray, defStyle, 0);
+ }
mDotRadius = getDimensionFromTypedArray(typedArray, R.styleable.PagingIndicator_lbDotRadius,
R.dimen.lb_page_indicator_dot_radius);
mDotDiameter = mDotRadius * 2;
diff --git a/leanback/src/main/java/androidx/leanback/widget/SearchOrbView.java b/leanback/src/main/java/androidx/leanback/widget/SearchOrbView.java
index 6cd17bb..ee10c4b 100644
--- a/leanback/src/main/java/androidx/leanback/widget/SearchOrbView.java
+++ b/leanback/src/main/java/androidx/leanback/widget/SearchOrbView.java
@@ -25,6 +25,7 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
+import android.os.Build;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@@ -184,6 +185,10 @@
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.lbSearchOrbView,
defStyleAttr, 0);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.lbSearchOrbView, attrs, a, defStyleAttr, 0);
+ }
Drawable img = a.getDrawable(R.styleable.lbSearchOrbView_searchOrbIcon);
if (img == null) {
diff --git a/leanback/src/main/java/androidx/leanback/widget/VerticalGridView.java b/leanback/src/main/java/androidx/leanback/widget/VerticalGridView.java
index 844e8a8..021b1c6 100644
--- a/leanback/src/main/java/androidx/leanback/widget/VerticalGridView.java
+++ b/leanback/src/main/java/androidx/leanback/widget/VerticalGridView.java
@@ -15,6 +15,7 @@
import android.content.Context;
import android.content.res.TypedArray;
+import android.os.Build;
import android.util.AttributeSet;
import android.util.TypedValue;
@@ -57,6 +58,10 @@
protected void initAttributes(Context context, AttributeSet attrs) {
initBaseGridViewAttributes(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.lbVerticalGridView);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.lbVerticalGridView, attrs, a, 0, 0);
+ }
setColumnWidth(a);
setNumColumns(a.getInt(R.styleable.lbVerticalGridView_numberOfColumns, 1));
a.recycle();
diff --git a/leanback/src/main/java/androidx/leanback/widget/picker/DatePicker.java b/leanback/src/main/java/androidx/leanback/widget/picker/DatePicker.java
index 48850f1..a5f8aaf 100644
--- a/leanback/src/main/java/androidx/leanback/widget/picker/DatePicker.java
+++ b/leanback/src/main/java/androidx/leanback/widget/picker/DatePicker.java
@@ -16,6 +16,7 @@
import android.content.Context;
import android.content.res.TypedArray;
+import android.os.Build;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
@@ -75,6 +76,10 @@
final TypedArray attributesArray = context.obtainStyledAttributes(attrs,
R.styleable.lbDatePicker);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.lbDatePicker, attrs, attributesArray, 0, 0);
+ }
String minDate;
String maxDate;
String datePickerFormat;
diff --git a/leanback/src/main/java/androidx/leanback/widget/picker/Picker.java b/leanback/src/main/java/androidx/leanback/widget/picker/Picker.java
index b302f7b..c367f35 100644
--- a/leanback/src/main/java/androidx/leanback/widget/picker/Picker.java
+++ b/leanback/src/main/java/androidx/leanback/widget/picker/Picker.java
@@ -17,6 +17,7 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
+import android.os.Build;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
@@ -193,6 +194,10 @@
super(context, attrs, defStyleAttr);
final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.lbPicker, defStyleAttr, 0);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.lbPicker, attrs, a, defStyleAttr, 0);
+ }
mPickerItemLayoutId = a.getResourceId(R.styleable.lbPicker_pickerItemLayout,
R.layout.lb_picker_item);
mPickerItemTextViewId = a.getResourceId(R.styleable.lbPicker_pickerItemTextViewId, 0);
diff --git a/leanback/src/main/java/androidx/leanback/widget/picker/PinPicker.java b/leanback/src/main/java/androidx/leanback/widget/picker/PinPicker.java
index 2c1505d..07aa670 100644
--- a/leanback/src/main/java/androidx/leanback/widget/picker/PinPicker.java
+++ b/leanback/src/main/java/androidx/leanback/widget/picker/PinPicker.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.content.res.TypedArray;
+import android.os.Build;
import android.util.AttributeSet;
import android.view.KeyEvent;
@@ -44,6 +45,10 @@
super(context, attrs, defStyleAttr);
final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.lbPinPicker, defStyleAttr, 0);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.lbPinPicker, attrs, a, defStyleAttr, 0);
+ }
try {
setSeparator(" ");
setNumberOfColumns(a.getInt(R.styleable.lbPinPicker_columnCount, DEFAULT_COLUMN_COUNT));
diff --git a/leanback/src/main/java/androidx/leanback/widget/picker/TimePicker.java b/leanback/src/main/java/androidx/leanback/widget/picker/TimePicker.java
index ec01225..85c683f 100644
--- a/leanback/src/main/java/androidx/leanback/widget/picker/TimePicker.java
+++ b/leanback/src/main/java/androidx/leanback/widget/picker/TimePicker.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.content.res.TypedArray;
+import android.os.Build;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.util.AttributeSet;
@@ -107,6 +108,10 @@
final TypedArray attributesArray = context.obtainStyledAttributes(attrs,
R.styleable.lbTimePicker);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.lbTimePicker, attrs, attributesArray, 0, 0);
+ }
boolean useCurrentTime;
try {
diff --git a/lifecycle/runtime/api/restricted_2.1.0-alpha03.txt b/lifecycle/runtime/api/restricted_2.1.0-alpha03.txt
index c79f82d..49e4512 100644
--- a/lifecycle/runtime/api/restricted_2.1.0-alpha03.txt
+++ b/lifecycle/runtime/api/restricted_2.1.0-alpha03.txt
@@ -4,6 +4,12 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ReportFragment extends android.app.Fragment {
ctor public ReportFragment();
method public static void injectIfNeededIn(android.app.Activity!);
+ method public void onActivityCreated(android.os.Bundle!);
+ method public void onDestroy();
+ method public void onPause();
+ method public void onResume();
+ method public void onStart();
+ method public void onStop();
}
}
diff --git a/lifecycle/runtime/api/restricted_2.1.0-alpha04.txt b/lifecycle/runtime/api/restricted_2.1.0-alpha04.txt
index c79f82d..49e4512 100644
--- a/lifecycle/runtime/api/restricted_2.1.0-alpha04.txt
+++ b/lifecycle/runtime/api/restricted_2.1.0-alpha04.txt
@@ -4,6 +4,12 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ReportFragment extends android.app.Fragment {
ctor public ReportFragment();
method public static void injectIfNeededIn(android.app.Activity!);
+ method public void onActivityCreated(android.os.Bundle!);
+ method public void onDestroy();
+ method public void onPause();
+ method public void onResume();
+ method public void onStart();
+ method public void onStop();
}
}
diff --git a/lifecycle/runtime/api/restricted_2.1.0-alpha05.txt b/lifecycle/runtime/api/restricted_2.1.0-alpha05.txt
index c79f82d..49e4512 100644
--- a/lifecycle/runtime/api/restricted_2.1.0-alpha05.txt
+++ b/lifecycle/runtime/api/restricted_2.1.0-alpha05.txt
@@ -4,6 +4,12 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ReportFragment extends android.app.Fragment {
ctor public ReportFragment();
method public static void injectIfNeededIn(android.app.Activity!);
+ method public void onActivityCreated(android.os.Bundle!);
+ method public void onDestroy();
+ method public void onPause();
+ method public void onResume();
+ method public void onStart();
+ method public void onStop();
}
}
diff --git a/lifecycle/runtime/api/restricted_2.1.0-beta00.txt b/lifecycle/runtime/api/restricted_2.1.0-beta00.txt
index c79f82d..49e4512 100644
--- a/lifecycle/runtime/api/restricted_2.1.0-beta00.txt
+++ b/lifecycle/runtime/api/restricted_2.1.0-beta00.txt
@@ -4,6 +4,12 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ReportFragment extends android.app.Fragment {
ctor public ReportFragment();
method public static void injectIfNeededIn(android.app.Activity!);
+ method public void onActivityCreated(android.os.Bundle!);
+ method public void onDestroy();
+ method public void onPause();
+ method public void onResume();
+ method public void onStart();
+ method public void onStop();
}
}
diff --git a/lifecycle/runtime/api/restricted_2.1.0-beta01.txt b/lifecycle/runtime/api/restricted_2.1.0-beta01.txt
index c79f82d..49e4512 100644
--- a/lifecycle/runtime/api/restricted_2.1.0-beta01.txt
+++ b/lifecycle/runtime/api/restricted_2.1.0-beta01.txt
@@ -4,6 +4,12 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ReportFragment extends android.app.Fragment {
ctor public ReportFragment();
method public static void injectIfNeededIn(android.app.Activity!);
+ method public void onActivityCreated(android.os.Bundle!);
+ method public void onDestroy();
+ method public void onPause();
+ method public void onResume();
+ method public void onStart();
+ method public void onStop();
}
}
diff --git a/lifecycle/runtime/api/restricted_2.1.0-beta02.txt b/lifecycle/runtime/api/restricted_2.1.0-beta02.txt
index c79f82d..49e4512 100644
--- a/lifecycle/runtime/api/restricted_2.1.0-beta02.txt
+++ b/lifecycle/runtime/api/restricted_2.1.0-beta02.txt
@@ -4,6 +4,12 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ReportFragment extends android.app.Fragment {
ctor public ReportFragment();
method public static void injectIfNeededIn(android.app.Activity!);
+ method public void onActivityCreated(android.os.Bundle!);
+ method public void onDestroy();
+ method public void onPause();
+ method public void onResume();
+ method public void onStart();
+ method public void onStop();
}
}
diff --git a/lifecycle/runtime/api/restricted_2.2.0-alpha01.txt b/lifecycle/runtime/api/restricted_2.2.0-alpha01.txt
index c79f82d..49e4512 100644
--- a/lifecycle/runtime/api/restricted_2.2.0-alpha01.txt
+++ b/lifecycle/runtime/api/restricted_2.2.0-alpha01.txt
@@ -4,6 +4,12 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ReportFragment extends android.app.Fragment {
ctor public ReportFragment();
method public static void injectIfNeededIn(android.app.Activity!);
+ method public void onActivityCreated(android.os.Bundle!);
+ method public void onDestroy();
+ method public void onPause();
+ method public void onResume();
+ method public void onStart();
+ method public void onStop();
}
}
diff --git a/lifecycle/runtime/api/restricted_2.2.0-alpha02.txt b/lifecycle/runtime/api/restricted_2.2.0-alpha02.txt
index c79f82d..49e4512 100644
--- a/lifecycle/runtime/api/restricted_2.2.0-alpha02.txt
+++ b/lifecycle/runtime/api/restricted_2.2.0-alpha02.txt
@@ -4,6 +4,12 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ReportFragment extends android.app.Fragment {
ctor public ReportFragment();
method public static void injectIfNeededIn(android.app.Activity!);
+ method public void onActivityCreated(android.os.Bundle!);
+ method public void onDestroy();
+ method public void onPause();
+ method public void onResume();
+ method public void onStart();
+ method public void onStop();
}
}
diff --git a/lifecycle/runtime/api/restricted_current.txt b/lifecycle/runtime/api/restricted_current.txt
index c79f82d..49e4512 100644
--- a/lifecycle/runtime/api/restricted_current.txt
+++ b/lifecycle/runtime/api/restricted_current.txt
@@ -4,6 +4,12 @@
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ReportFragment extends android.app.Fragment {
ctor public ReportFragment();
method public static void injectIfNeededIn(android.app.Activity!);
+ method public void onActivityCreated(android.os.Bundle!);
+ method public void onDestroy();
+ method public void onPause();
+ method public void onResume();
+ method public void onStart();
+ method public void onStop();
}
}
diff --git a/media/api/1.1.0-alpha05.txt b/media/api/1.1.0-alpha05.txt
index 7526b4a..7a53671f 100644
--- a/media/api/1.1.0-alpha05.txt
+++ b/media/api/1.1.0-alpha05.txt
@@ -285,6 +285,7 @@
method public abstract void sendCustomAction(android.support.v4.media.session.PlaybackStateCompat.CustomAction!, android.os.Bundle!);
method public abstract void sendCustomAction(String!, android.os.Bundle!);
method public abstract void setCaptioningEnabled(boolean);
+ method public void setPlaybackSpeed(float);
method public abstract void setRating(android.support.v4.media.RatingCompat!);
method public abstract void setRating(android.support.v4.media.RatingCompat!, android.os.Bundle!);
method public abstract void setRepeatMode(int);
@@ -363,6 +364,7 @@
method public void onRewind();
method public void onSeekTo(long);
method public void onSetCaptioningEnabled(boolean);
+ method public void onSetPlaybackSpeed(float);
method public void onSetRating(android.support.v4.media.RatingCompat!);
method public void onSetRating(android.support.v4.media.RatingCompat!, android.os.Bundle!);
method public void onSetRepeatMode(int);
diff --git a/media/api/1.1.0-alpha06.txt b/media/api/1.1.0-alpha06.txt
index 7526b4a..7a53671f 100644
--- a/media/api/1.1.0-alpha06.txt
+++ b/media/api/1.1.0-alpha06.txt
@@ -285,6 +285,7 @@
method public abstract void sendCustomAction(android.support.v4.media.session.PlaybackStateCompat.CustomAction!, android.os.Bundle!);
method public abstract void sendCustomAction(String!, android.os.Bundle!);
method public abstract void setCaptioningEnabled(boolean);
+ method public void setPlaybackSpeed(float);
method public abstract void setRating(android.support.v4.media.RatingCompat!);
method public abstract void setRating(android.support.v4.media.RatingCompat!, android.os.Bundle!);
method public abstract void setRepeatMode(int);
@@ -363,6 +364,7 @@
method public void onRewind();
method public void onSeekTo(long);
method public void onSetCaptioningEnabled(boolean);
+ method public void onSetPlaybackSpeed(float);
method public void onSetRating(android.support.v4.media.RatingCompat!);
method public void onSetRating(android.support.v4.media.RatingCompat!, android.os.Bundle!);
method public void onSetRepeatMode(int);
diff --git a/media/api/1.1.0-beta00.txt b/media/api/1.1.0-beta00.txt
new file mode 100644
index 0000000..7a53671f
--- /dev/null
+++ b/media/api/1.1.0-beta00.txt
@@ -0,0 +1,704 @@
+// Signature format: 3.0
+package android.support.v4.media {
+
+ public final class MediaBrowserCompat {
+ ctor public MediaBrowserCompat(android.content.Context!, android.content.ComponentName!, android.support.v4.media.MediaBrowserCompat.ConnectionCallback!, android.os.Bundle!);
+ method public void connect();
+ method public void disconnect();
+ method public android.os.Bundle? getExtras();
+ method public void getItem(String, android.support.v4.media.MediaBrowserCompat.ItemCallback);
+ method public String getRoot();
+ method public android.content.ComponentName getServiceComponent();
+ method public android.support.v4.media.session.MediaSessionCompat.Token getSessionToken();
+ method public boolean isConnected();
+ method public void search(String, android.os.Bundle!, android.support.v4.media.MediaBrowserCompat.SearchCallback);
+ method public void sendCustomAction(String, android.os.Bundle!, android.support.v4.media.MediaBrowserCompat.CustomActionCallback?);
+ method public void subscribe(String, android.support.v4.media.MediaBrowserCompat.SubscriptionCallback);
+ method public void subscribe(String, android.os.Bundle, android.support.v4.media.MediaBrowserCompat.SubscriptionCallback);
+ method public void unsubscribe(String);
+ method public void unsubscribe(String, android.support.v4.media.MediaBrowserCompat.SubscriptionCallback);
+ field public static final String CUSTOM_ACTION_DOWNLOAD = "android.support.v4.media.action.DOWNLOAD";
+ field public static final String CUSTOM_ACTION_REMOVE_DOWNLOADED_FILE = "android.support.v4.media.action.REMOVE_DOWNLOADED_FILE";
+ field public static final String EXTRA_DOWNLOAD_PROGRESS = "android.media.browse.extra.DOWNLOAD_PROGRESS";
+ field public static final String EXTRA_MEDIA_ID = "android.media.browse.extra.MEDIA_ID";
+ field public static final String EXTRA_PAGE = "android.media.browse.extra.PAGE";
+ field public static final String EXTRA_PAGE_SIZE = "android.media.browse.extra.PAGE_SIZE";
+ }
+
+ public static class MediaBrowserCompat.ConnectionCallback {
+ ctor public MediaBrowserCompat.ConnectionCallback();
+ method public void onConnected();
+ method public void onConnectionFailed();
+ method public void onConnectionSuspended();
+ }
+
+ public abstract static class MediaBrowserCompat.CustomActionCallback {
+ ctor public MediaBrowserCompat.CustomActionCallback();
+ method public void onError(String!, android.os.Bundle!, android.os.Bundle!);
+ method public void onProgressUpdate(String!, android.os.Bundle!, android.os.Bundle!);
+ method public void onResult(String!, android.os.Bundle!, android.os.Bundle!);
+ }
+
+ public abstract static class MediaBrowserCompat.ItemCallback {
+ ctor public MediaBrowserCompat.ItemCallback();
+ method public void onError(String);
+ method public void onItemLoaded(android.support.v4.media.MediaBrowserCompat.MediaItem!);
+ }
+
+ public static class MediaBrowserCompat.MediaItem implements android.os.Parcelable {
+ ctor public MediaBrowserCompat.MediaItem(android.support.v4.media.MediaDescriptionCompat, int);
+ method public int describeContents();
+ method public static android.support.v4.media.MediaBrowserCompat.MediaItem! fromMediaItem(Object!);
+ method public static java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>! fromMediaItemList(java.util.List<?>!);
+ method public android.support.v4.media.MediaDescriptionCompat getDescription();
+ method public int getFlags();
+ method public String? getMediaId();
+ method public boolean isBrowsable();
+ method public boolean isPlayable();
+ method public void writeToParcel(android.os.Parcel!, int);
+ field public static final android.os.Parcelable.Creator<android.support.v4.media.MediaBrowserCompat.MediaItem>! CREATOR;
+ field public static final int FLAG_BROWSABLE = 1; // 0x1
+ field public static final int FLAG_PLAYABLE = 2; // 0x2
+ }
+
+ public abstract static class MediaBrowserCompat.SearchCallback {
+ ctor public MediaBrowserCompat.SearchCallback();
+ method public void onError(String, android.os.Bundle!);
+ method public void onSearchResult(String, android.os.Bundle!, java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>);
+ }
+
+ public abstract static class MediaBrowserCompat.SubscriptionCallback {
+ ctor public MediaBrowserCompat.SubscriptionCallback();
+ method public void onChildrenLoaded(String, java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>);
+ method public void onChildrenLoaded(String, java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>, android.os.Bundle);
+ method public void onError(String);
+ method public void onError(String, android.os.Bundle);
+ }
+
+ public final class MediaDescriptionCompat implements android.os.Parcelable {
+ method public int describeContents();
+ method public static android.support.v4.media.MediaDescriptionCompat! fromMediaDescription(Object!);
+ method public CharSequence? getDescription();
+ method public android.os.Bundle? getExtras();
+ method public android.graphics.Bitmap? getIconBitmap();
+ method public android.net.Uri? getIconUri();
+ method public Object! getMediaDescription();
+ method public String? getMediaId();
+ method public android.net.Uri? getMediaUri();
+ method public CharSequence? getSubtitle();
+ method public CharSequence? getTitle();
+ method public void writeToParcel(android.os.Parcel!, int);
+ field public static final long BT_FOLDER_TYPE_ALBUMS = 2L; // 0x2L
+ field public static final long BT_FOLDER_TYPE_ARTISTS = 3L; // 0x3L
+ field public static final long BT_FOLDER_TYPE_GENRES = 4L; // 0x4L
+ field public static final long BT_FOLDER_TYPE_MIXED = 0L; // 0x0L
+ field public static final long BT_FOLDER_TYPE_PLAYLISTS = 5L; // 0x5L
+ field public static final long BT_FOLDER_TYPE_TITLES = 1L; // 0x1L
+ field public static final long BT_FOLDER_TYPE_YEARS = 6L; // 0x6L
+ field public static final android.os.Parcelable.Creator<android.support.v4.media.MediaDescriptionCompat>! CREATOR;
+ field public static final String EXTRA_BT_FOLDER_TYPE = "android.media.extra.BT_FOLDER_TYPE";
+ field public static final String EXTRA_DOWNLOAD_STATUS = "android.media.extra.DOWNLOAD_STATUS";
+ field public static final long STATUS_DOWNLOADED = 2L; // 0x2L
+ field public static final long STATUS_DOWNLOADING = 1L; // 0x1L
+ field public static final long STATUS_NOT_DOWNLOADED = 0L; // 0x0L
+ }
+
+ public static final class MediaDescriptionCompat.Builder {
+ ctor public MediaDescriptionCompat.Builder();
+ method public android.support.v4.media.MediaDescriptionCompat! build();
+ method public android.support.v4.media.MediaDescriptionCompat.Builder! setDescription(CharSequence?);
+ method public android.support.v4.media.MediaDescriptionCompat.Builder! setExtras(android.os.Bundle?);
+ method public android.support.v4.media.MediaDescriptionCompat.Builder! setIconBitmap(android.graphics.Bitmap?);
+ method public android.support.v4.media.MediaDescriptionCompat.Builder! setIconUri(android.net.Uri?);
+ method public android.support.v4.media.MediaDescriptionCompat.Builder! setMediaId(String?);
+ method public android.support.v4.media.MediaDescriptionCompat.Builder! setMediaUri(android.net.Uri?);
+ method public android.support.v4.media.MediaDescriptionCompat.Builder! setSubtitle(CharSequence?);
+ method public android.support.v4.media.MediaDescriptionCompat.Builder! setTitle(CharSequence?);
+ }
+
+ public final class MediaMetadataCompat implements android.os.Parcelable {
+ method public boolean containsKey(String!);
+ method public int describeContents();
+ method public static android.support.v4.media.MediaMetadataCompat! fromMediaMetadata(Object!);
+ method public android.graphics.Bitmap! getBitmap(String!);
+ method public android.os.Bundle! getBundle();
+ method public android.support.v4.media.MediaDescriptionCompat! getDescription();
+ method public long getLong(String!);
+ method public Object! getMediaMetadata();
+ method public android.support.v4.media.RatingCompat! getRating(String!);
+ method public String! getString(String!);
+ method public CharSequence! getText(String!);
+ method public java.util.Set<java.lang.String>! keySet();
+ method public int size();
+ method public void writeToParcel(android.os.Parcel!, int);
+ field public static final android.os.Parcelable.Creator<android.support.v4.media.MediaMetadataCompat>! CREATOR;
+ field public static final String METADATA_KEY_ADVERTISEMENT = "android.media.metadata.ADVERTISEMENT";
+ field public static final String METADATA_KEY_ALBUM = "android.media.metadata.ALBUM";
+ field public static final String METADATA_KEY_ALBUM_ART = "android.media.metadata.ALBUM_ART";
+ field public static final String METADATA_KEY_ALBUM_ARTIST = "android.media.metadata.ALBUM_ARTIST";
+ field public static final String METADATA_KEY_ALBUM_ART_URI = "android.media.metadata.ALBUM_ART_URI";
+ field public static final String METADATA_KEY_ART = "android.media.metadata.ART";
+ field public static final String METADATA_KEY_ARTIST = "android.media.metadata.ARTIST";
+ field public static final String METADATA_KEY_ART_URI = "android.media.metadata.ART_URI";
+ field public static final String METADATA_KEY_AUTHOR = "android.media.metadata.AUTHOR";
+ field public static final String METADATA_KEY_BT_FOLDER_TYPE = "android.media.metadata.BT_FOLDER_TYPE";
+ field public static final String METADATA_KEY_COMPILATION = "android.media.metadata.COMPILATION";
+ field public static final String METADATA_KEY_COMPOSER = "android.media.metadata.COMPOSER";
+ field public static final String METADATA_KEY_DATE = "android.media.metadata.DATE";
+ field public static final String METADATA_KEY_DISC_NUMBER = "android.media.metadata.DISC_NUMBER";
+ field public static final String METADATA_KEY_DISPLAY_DESCRIPTION = "android.media.metadata.DISPLAY_DESCRIPTION";
+ field public static final String METADATA_KEY_DISPLAY_ICON = "android.media.metadata.DISPLAY_ICON";
+ field public static final String METADATA_KEY_DISPLAY_ICON_URI = "android.media.metadata.DISPLAY_ICON_URI";
+ field public static final String METADATA_KEY_DISPLAY_SUBTITLE = "android.media.metadata.DISPLAY_SUBTITLE";
+ field public static final String METADATA_KEY_DISPLAY_TITLE = "android.media.metadata.DISPLAY_TITLE";
+ field public static final String METADATA_KEY_DOWNLOAD_STATUS = "android.media.metadata.DOWNLOAD_STATUS";
+ field public static final String METADATA_KEY_DURATION = "android.media.metadata.DURATION";
+ field public static final String METADATA_KEY_GENRE = "android.media.metadata.GENRE";
+ field public static final String METADATA_KEY_MEDIA_ID = "android.media.metadata.MEDIA_ID";
+ field public static final String METADATA_KEY_MEDIA_URI = "android.media.metadata.MEDIA_URI";
+ field public static final String METADATA_KEY_NUM_TRACKS = "android.media.metadata.NUM_TRACKS";
+ field public static final String METADATA_KEY_RATING = "android.media.metadata.RATING";
+ field public static final String METADATA_KEY_TITLE = "android.media.metadata.TITLE";
+ field public static final String METADATA_KEY_TRACK_NUMBER = "android.media.metadata.TRACK_NUMBER";
+ field public static final String METADATA_KEY_USER_RATING = "android.media.metadata.USER_RATING";
+ field public static final String METADATA_KEY_WRITER = "android.media.metadata.WRITER";
+ field public static final String METADATA_KEY_YEAR = "android.media.metadata.YEAR";
+ }
+
+ public static final class MediaMetadataCompat.Builder {
+ ctor public MediaMetadataCompat.Builder();
+ ctor public MediaMetadataCompat.Builder(android.support.v4.media.MediaMetadataCompat!);
+ method public android.support.v4.media.MediaMetadataCompat! build();
+ method public android.support.v4.media.MediaMetadataCompat.Builder! putBitmap(String!, android.graphics.Bitmap!);
+ method public android.support.v4.media.MediaMetadataCompat.Builder! putLong(String!, long);
+ method public android.support.v4.media.MediaMetadataCompat.Builder! putRating(String!, android.support.v4.media.RatingCompat!);
+ method public android.support.v4.media.MediaMetadataCompat.Builder! putString(String!, String!);
+ method public android.support.v4.media.MediaMetadataCompat.Builder! putText(String!, CharSequence!);
+ }
+
+ public final class RatingCompat implements android.os.Parcelable {
+ method public int describeContents();
+ method public static android.support.v4.media.RatingCompat! fromRating(Object!);
+ method public float getPercentRating();
+ method public Object! getRating();
+ method public int getRatingStyle();
+ method public float getStarRating();
+ method public boolean hasHeart();
+ method public boolean isRated();
+ method public boolean isThumbUp();
+ method public static android.support.v4.media.RatingCompat! newHeartRating(boolean);
+ method public static android.support.v4.media.RatingCompat! newPercentageRating(float);
+ method public static android.support.v4.media.RatingCompat! newStarRating(int, float);
+ method public static android.support.v4.media.RatingCompat! newThumbRating(boolean);
+ method public static android.support.v4.media.RatingCompat! newUnratedRating(int);
+ method public void writeToParcel(android.os.Parcel!, int);
+ field public static final android.os.Parcelable.Creator<android.support.v4.media.RatingCompat>! CREATOR;
+ field public static final int RATING_3_STARS = 3; // 0x3
+ field public static final int RATING_4_STARS = 4; // 0x4
+ field public static final int RATING_5_STARS = 5; // 0x5
+ field public static final int RATING_HEART = 1; // 0x1
+ field public static final int RATING_NONE = 0; // 0x0
+ field public static final int RATING_PERCENTAGE = 6; // 0x6
+ field public static final int RATING_THUMB_UP_DOWN = 2; // 0x2
+ }
+
+}
+
+package android.support.v4.media.session {
+
+ public final class MediaControllerCompat {
+ ctor public MediaControllerCompat(android.content.Context!, android.support.v4.media.session.MediaSessionCompat);
+ ctor public MediaControllerCompat(android.content.Context!, android.support.v4.media.session.MediaSessionCompat.Token) throws android.os.RemoteException;
+ method public void addQueueItem(android.support.v4.media.MediaDescriptionCompat!);
+ method public void addQueueItem(android.support.v4.media.MediaDescriptionCompat!, int);
+ method public void adjustVolume(int, int);
+ method public boolean dispatchMediaButtonEvent(android.view.KeyEvent!);
+ method public android.os.Bundle! getExtras();
+ method public long getFlags();
+ method public static android.support.v4.media.session.MediaControllerCompat! getMediaController(android.app.Activity);
+ method public Object! getMediaController();
+ method public android.support.v4.media.MediaMetadataCompat! getMetadata();
+ method public String! getPackageName();
+ method public android.support.v4.media.session.MediaControllerCompat.PlaybackInfo! getPlaybackInfo();
+ method public android.support.v4.media.session.PlaybackStateCompat! getPlaybackState();
+ method public java.util.List<android.support.v4.media.session.MediaSessionCompat.QueueItem>! getQueue();
+ method public CharSequence! getQueueTitle();
+ method public int getRatingType();
+ method public int getRepeatMode();
+ method public android.app.PendingIntent! getSessionActivity();
+ method public android.support.v4.media.session.MediaSessionCompat.Token! getSessionToken();
+ method public int getShuffleMode();
+ method public android.support.v4.media.session.MediaControllerCompat.TransportControls! getTransportControls();
+ method public boolean isCaptioningEnabled();
+ method public boolean isSessionReady();
+ method public void registerCallback(android.support.v4.media.session.MediaControllerCompat.Callback);
+ method public void registerCallback(android.support.v4.media.session.MediaControllerCompat.Callback, android.os.Handler!);
+ method public void removeQueueItem(android.support.v4.media.MediaDescriptionCompat!);
+ method @Deprecated public void removeQueueItemAt(int);
+ method public void sendCommand(String, android.os.Bundle?, android.os.ResultReceiver?);
+ method public static void setMediaController(android.app.Activity, android.support.v4.media.session.MediaControllerCompat!);
+ method public void setVolumeTo(int, int);
+ method public void unregisterCallback(android.support.v4.media.session.MediaControllerCompat.Callback);
+ }
+
+ public abstract static class MediaControllerCompat.Callback implements android.os.IBinder.DeathRecipient {
+ ctor public MediaControllerCompat.Callback();
+ method public void binderDied();
+ method public void onAudioInfoChanged(android.support.v4.media.session.MediaControllerCompat.PlaybackInfo!);
+ method public void onCaptioningEnabledChanged(boolean);
+ method public void onExtrasChanged(android.os.Bundle!);
+ method public void onMetadataChanged(android.support.v4.media.MediaMetadataCompat!);
+ method public void onPlaybackStateChanged(android.support.v4.media.session.PlaybackStateCompat!);
+ method public void onQueueChanged(java.util.List<android.support.v4.media.session.MediaSessionCompat.QueueItem>!);
+ method public void onQueueTitleChanged(CharSequence!);
+ method public void onRepeatModeChanged(int);
+ method public void onSessionDestroyed();
+ method public void onSessionEvent(String!, android.os.Bundle!);
+ method public void onSessionReady();
+ method public void onShuffleModeChanged(int);
+ }
+
+ public static final class MediaControllerCompat.PlaybackInfo {
+ method public androidx.media.AudioAttributesCompat getAudioAttributes();
+ method @Deprecated public int getAudioStream();
+ method public int getCurrentVolume();
+ method public int getMaxVolume();
+ method public int getPlaybackType();
+ method public int getVolumeControl();
+ field public static final int PLAYBACK_TYPE_LOCAL = 1; // 0x1
+ field public static final int PLAYBACK_TYPE_REMOTE = 2; // 0x2
+ }
+
+ public abstract static class MediaControllerCompat.TransportControls {
+ method public abstract void fastForward();
+ method public abstract void pause();
+ method public abstract void play();
+ method public abstract void playFromMediaId(String!, android.os.Bundle!);
+ method public abstract void playFromSearch(String!, android.os.Bundle!);
+ method public abstract void playFromUri(android.net.Uri!, android.os.Bundle!);
+ method public abstract void prepare();
+ method public abstract void prepareFromMediaId(String!, android.os.Bundle!);
+ method public abstract void prepareFromSearch(String!, android.os.Bundle!);
+ method public abstract void prepareFromUri(android.net.Uri!, android.os.Bundle!);
+ method public abstract void rewind();
+ method public abstract void seekTo(long);
+ method public abstract void sendCustomAction(android.support.v4.media.session.PlaybackStateCompat.CustomAction!, android.os.Bundle!);
+ method public abstract void sendCustomAction(String!, android.os.Bundle!);
+ method public abstract void setCaptioningEnabled(boolean);
+ method public void setPlaybackSpeed(float);
+ method public abstract void setRating(android.support.v4.media.RatingCompat!);
+ method public abstract void setRating(android.support.v4.media.RatingCompat!, android.os.Bundle!);
+ method public abstract void setRepeatMode(int);
+ method public abstract void setShuffleMode(int);
+ method public abstract void skipToNext();
+ method public abstract void skipToPrevious();
+ method public abstract void skipToQueueItem(long);
+ method public abstract void stop();
+ field public static final String EXTRA_LEGACY_STREAM_TYPE = "android.media.session.extra.LEGACY_STREAM_TYPE";
+ }
+
+ public class MediaSessionCompat {
+ ctor public MediaSessionCompat(android.content.Context, String);
+ ctor public MediaSessionCompat(android.content.Context, String, android.content.ComponentName?, android.app.PendingIntent?);
+ method public void addOnActiveChangeListener(android.support.v4.media.session.MediaSessionCompat.OnActiveChangeListener!);
+ method public static android.support.v4.media.session.MediaSessionCompat! fromMediaSession(android.content.Context!, Object!);
+ method public android.support.v4.media.session.MediaControllerCompat! getController();
+ method public final androidx.media.MediaSessionManager.RemoteUserInfo getCurrentControllerInfo();
+ method public Object! getMediaSession();
+ method public Object! getRemoteControlClient();
+ method public android.support.v4.media.session.MediaSessionCompat.Token! getSessionToken();
+ method public boolean isActive();
+ method public void release();
+ method public void removeOnActiveChangeListener(android.support.v4.media.session.MediaSessionCompat.OnActiveChangeListener!);
+ method public void sendSessionEvent(String!, android.os.Bundle!);
+ method public void setActive(boolean);
+ method public void setCallback(android.support.v4.media.session.MediaSessionCompat.Callback!);
+ method public void setCallback(android.support.v4.media.session.MediaSessionCompat.Callback!, android.os.Handler!);
+ method public void setCaptioningEnabled(boolean);
+ method public void setExtras(android.os.Bundle!);
+ method public void setFlags(int);
+ method public void setMediaButtonReceiver(android.app.PendingIntent!);
+ method public void setMetadata(android.support.v4.media.MediaMetadataCompat!);
+ method public void setPlaybackState(android.support.v4.media.session.PlaybackStateCompat!);
+ method public void setPlaybackToLocal(int);
+ method public void setPlaybackToRemote(androidx.media.VolumeProviderCompat!);
+ method public void setQueue(java.util.List<android.support.v4.media.session.MediaSessionCompat.QueueItem>!);
+ method public void setQueueTitle(CharSequence!);
+ method public void setRatingType(int);
+ method public void setRepeatMode(int);
+ method public void setSessionActivity(android.app.PendingIntent!);
+ method public void setShuffleMode(int);
+ field public static final String ACTION_FLAG_AS_INAPPROPRIATE = "android.support.v4.media.session.action.FLAG_AS_INAPPROPRIATE";
+ field public static final String ACTION_FOLLOW = "android.support.v4.media.session.action.FOLLOW";
+ field public static final String ACTION_SKIP_AD = "android.support.v4.media.session.action.SKIP_AD";
+ field public static final String ACTION_UNFOLLOW = "android.support.v4.media.session.action.UNFOLLOW";
+ field public static final String ARGUMENT_MEDIA_ATTRIBUTE = "android.support.v4.media.session.ARGUMENT_MEDIA_ATTRIBUTE";
+ field public static final String ARGUMENT_MEDIA_ATTRIBUTE_VALUE = "android.support.v4.media.session.ARGUMENT_MEDIA_ATTRIBUTE_VALUE";
+ field @Deprecated public static final int FLAG_HANDLES_MEDIA_BUTTONS = 1; // 0x1
+ field public static final int FLAG_HANDLES_QUEUE_COMMANDS = 4; // 0x4
+ field @Deprecated public static final int FLAG_HANDLES_TRANSPORT_CONTROLS = 2; // 0x2
+ field public static final int MEDIA_ATTRIBUTE_ALBUM = 1; // 0x1
+ field public static final int MEDIA_ATTRIBUTE_ARTIST = 0; // 0x0
+ field public static final int MEDIA_ATTRIBUTE_PLAYLIST = 2; // 0x2
+ }
+
+ public abstract static class MediaSessionCompat.Callback {
+ ctor public MediaSessionCompat.Callback();
+ method public void onAddQueueItem(android.support.v4.media.MediaDescriptionCompat!);
+ method public void onAddQueueItem(android.support.v4.media.MediaDescriptionCompat!, int);
+ method public void onCommand(String!, android.os.Bundle!, android.os.ResultReceiver!);
+ method public void onCustomAction(String!, android.os.Bundle!);
+ method public void onFastForward();
+ method public boolean onMediaButtonEvent(android.content.Intent!);
+ method public void onPause();
+ method public void onPlay();
+ method public void onPlayFromMediaId(String!, android.os.Bundle!);
+ method public void onPlayFromSearch(String!, android.os.Bundle!);
+ method public void onPlayFromUri(android.net.Uri!, android.os.Bundle!);
+ method public void onPrepare();
+ method public void onPrepareFromMediaId(String!, android.os.Bundle!);
+ method public void onPrepareFromSearch(String!, android.os.Bundle!);
+ method public void onPrepareFromUri(android.net.Uri!, android.os.Bundle!);
+ method public void onRemoveQueueItem(android.support.v4.media.MediaDescriptionCompat!);
+ method @Deprecated public void onRemoveQueueItemAt(int);
+ method public void onRewind();
+ method public void onSeekTo(long);
+ method public void onSetCaptioningEnabled(boolean);
+ method public void onSetPlaybackSpeed(float);
+ method public void onSetRating(android.support.v4.media.RatingCompat!);
+ method public void onSetRating(android.support.v4.media.RatingCompat!, android.os.Bundle!);
+ method public void onSetRepeatMode(int);
+ method public void onSetShuffleMode(int);
+ method public void onSkipToNext();
+ method public void onSkipToPrevious();
+ method public void onSkipToQueueItem(long);
+ method public void onStop();
+ }
+
+ public static interface MediaSessionCompat.OnActiveChangeListener {
+ method public void onActiveChanged();
+ }
+
+ public static final class MediaSessionCompat.QueueItem implements android.os.Parcelable {
+ ctor public MediaSessionCompat.QueueItem(android.support.v4.media.MediaDescriptionCompat!, long);
+ method public int describeContents();
+ method public static android.support.v4.media.session.MediaSessionCompat.QueueItem! fromQueueItem(Object!);
+ method public static java.util.List<android.support.v4.media.session.MediaSessionCompat.QueueItem>! fromQueueItemList(java.util.List<?>!);
+ method public android.support.v4.media.MediaDescriptionCompat! getDescription();
+ method public long getQueueId();
+ method public Object! getQueueItem();
+ method public void writeToParcel(android.os.Parcel!, int);
+ field public static final android.os.Parcelable.Creator<android.support.v4.media.session.MediaSessionCompat.QueueItem>! CREATOR;
+ field public static final int UNKNOWN_ID = -1; // 0xffffffff
+ }
+
+ public static final class MediaSessionCompat.Token implements android.os.Parcelable {
+ method public int describeContents();
+ method public static android.support.v4.media.session.MediaSessionCompat.Token! fromToken(Object!);
+ method public Object! getToken();
+ method public void writeToParcel(android.os.Parcel!, int);
+ field public static final android.os.Parcelable.Creator<android.support.v4.media.session.MediaSessionCompat.Token>! CREATOR;
+ }
+
+ public class ParcelableVolumeInfo implements android.os.Parcelable {
+ ctor public ParcelableVolumeInfo(int, int, int, int, int);
+ ctor public ParcelableVolumeInfo(android.os.Parcel!);
+ method public int describeContents();
+ method public void writeToParcel(android.os.Parcel!, int);
+ field public static final android.os.Parcelable.Creator<android.support.v4.media.session.ParcelableVolumeInfo>! CREATOR;
+ field public int audioStream;
+ field public int controlType;
+ field public int currentVolume;
+ field public int maxVolume;
+ field public int volumeType;
+ }
+
+ public final class PlaybackStateCompat implements android.os.Parcelable {
+ method public int describeContents();
+ method public static android.support.v4.media.session.PlaybackStateCompat! fromPlaybackState(Object!);
+ method public long getActions();
+ method public long getActiveQueueItemId();
+ method public long getBufferedPosition();
+ method public java.util.List<android.support.v4.media.session.PlaybackStateCompat.CustomAction>! getCustomActions();
+ method public int getErrorCode();
+ method public CharSequence! getErrorMessage();
+ method public android.os.Bundle? getExtras();
+ method public long getLastPositionUpdateTime();
+ method public float getPlaybackSpeed();
+ method public Object! getPlaybackState();
+ method public long getPosition();
+ method public int getState();
+ method public static int toKeyCode(long);
+ method public void writeToParcel(android.os.Parcel!, int);
+ field public static final long ACTION_FAST_FORWARD = 64L; // 0x40L
+ field public static final long ACTION_PAUSE = 2L; // 0x2L
+ field public static final long ACTION_PLAY = 4L; // 0x4L
+ field public static final long ACTION_PLAY_FROM_MEDIA_ID = 1024L; // 0x400L
+ field public static final long ACTION_PLAY_FROM_SEARCH = 2048L; // 0x800L
+ field public static final long ACTION_PLAY_FROM_URI = 8192L; // 0x2000L
+ field public static final long ACTION_PLAY_PAUSE = 512L; // 0x200L
+ field public static final long ACTION_PREPARE = 16384L; // 0x4000L
+ field public static final long ACTION_PREPARE_FROM_MEDIA_ID = 32768L; // 0x8000L
+ field public static final long ACTION_PREPARE_FROM_SEARCH = 65536L; // 0x10000L
+ field public static final long ACTION_PREPARE_FROM_URI = 131072L; // 0x20000L
+ field public static final long ACTION_REWIND = 8L; // 0x8L
+ field public static final long ACTION_SEEK_TO = 256L; // 0x100L
+ field public static final long ACTION_SET_CAPTIONING_ENABLED = 1048576L; // 0x100000L
+ field public static final long ACTION_SET_RATING = 128L; // 0x80L
+ field public static final long ACTION_SET_REPEAT_MODE = 262144L; // 0x40000L
+ field public static final long ACTION_SET_SHUFFLE_MODE = 2097152L; // 0x200000L
+ field @Deprecated public static final long ACTION_SET_SHUFFLE_MODE_ENABLED = 524288L; // 0x80000L
+ field public static final long ACTION_SKIP_TO_NEXT = 32L; // 0x20L
+ field public static final long ACTION_SKIP_TO_PREVIOUS = 16L; // 0x10L
+ field public static final long ACTION_SKIP_TO_QUEUE_ITEM = 4096L; // 0x1000L
+ field public static final long ACTION_STOP = 1L; // 0x1L
+ field public static final android.os.Parcelable.Creator<android.support.v4.media.session.PlaybackStateCompat>! CREATOR;
+ field public static final int ERROR_CODE_ACTION_ABORTED = 10; // 0xa
+ field public static final int ERROR_CODE_APP_ERROR = 1; // 0x1
+ field public static final int ERROR_CODE_AUTHENTICATION_EXPIRED = 3; // 0x3
+ field public static final int ERROR_CODE_CONCURRENT_STREAM_LIMIT = 5; // 0x5
+ field public static final int ERROR_CODE_CONTENT_ALREADY_PLAYING = 8; // 0x8
+ field public static final int ERROR_CODE_END_OF_QUEUE = 11; // 0xb
+ field public static final int ERROR_CODE_NOT_AVAILABLE_IN_REGION = 7; // 0x7
+ field public static final int ERROR_CODE_NOT_SUPPORTED = 2; // 0x2
+ field public static final int ERROR_CODE_PARENTAL_CONTROL_RESTRICTED = 6; // 0x6
+ field public static final int ERROR_CODE_PREMIUM_ACCOUNT_REQUIRED = 4; // 0x4
+ field public static final int ERROR_CODE_SKIP_LIMIT_REACHED = 9; // 0x9
+ field public static final int ERROR_CODE_UNKNOWN_ERROR = 0; // 0x0
+ field public static final long PLAYBACK_POSITION_UNKNOWN = -1L; // 0xffffffffffffffffL
+ field public static final int REPEAT_MODE_ALL = 2; // 0x2
+ field public static final int REPEAT_MODE_GROUP = 3; // 0x3
+ field public static final int REPEAT_MODE_INVALID = -1; // 0xffffffff
+ field public static final int REPEAT_MODE_NONE = 0; // 0x0
+ field public static final int REPEAT_MODE_ONE = 1; // 0x1
+ field public static final int SHUFFLE_MODE_ALL = 1; // 0x1
+ field public static final int SHUFFLE_MODE_GROUP = 2; // 0x2
+ field public static final int SHUFFLE_MODE_INVALID = -1; // 0xffffffff
+ field public static final int SHUFFLE_MODE_NONE = 0; // 0x0
+ field public static final int STATE_BUFFERING = 6; // 0x6
+ field public static final int STATE_CONNECTING = 8; // 0x8
+ field public static final int STATE_ERROR = 7; // 0x7
+ field public static final int STATE_FAST_FORWARDING = 4; // 0x4
+ field public static final int STATE_NONE = 0; // 0x0
+ field public static final int STATE_PAUSED = 2; // 0x2
+ field public static final int STATE_PLAYING = 3; // 0x3
+ field public static final int STATE_REWINDING = 5; // 0x5
+ field public static final int STATE_SKIPPING_TO_NEXT = 10; // 0xa
+ field public static final int STATE_SKIPPING_TO_PREVIOUS = 9; // 0x9
+ field public static final int STATE_SKIPPING_TO_QUEUE_ITEM = 11; // 0xb
+ field public static final int STATE_STOPPED = 1; // 0x1
+ }
+
+ public static final class PlaybackStateCompat.Builder {
+ ctor public PlaybackStateCompat.Builder();
+ ctor public PlaybackStateCompat.Builder(android.support.v4.media.session.PlaybackStateCompat!);
+ method public android.support.v4.media.session.PlaybackStateCompat.Builder! addCustomAction(String!, String!, int);
+ method public android.support.v4.media.session.PlaybackStateCompat.Builder! addCustomAction(android.support.v4.media.session.PlaybackStateCompat.CustomAction!);
+ method public android.support.v4.media.session.PlaybackStateCompat! build();
+ method public android.support.v4.media.session.PlaybackStateCompat.Builder! setActions(long);
+ method public android.support.v4.media.session.PlaybackStateCompat.Builder! setActiveQueueItemId(long);
+ method public android.support.v4.media.session.PlaybackStateCompat.Builder! setBufferedPosition(long);
+ method @Deprecated public android.support.v4.media.session.PlaybackStateCompat.Builder! setErrorMessage(CharSequence!);
+ method public android.support.v4.media.session.PlaybackStateCompat.Builder! setErrorMessage(int, CharSequence!);
+ method public android.support.v4.media.session.PlaybackStateCompat.Builder! setExtras(android.os.Bundle!);
+ method public android.support.v4.media.session.PlaybackStateCompat.Builder! setState(int, long, float);
+ method public android.support.v4.media.session.PlaybackStateCompat.Builder! setState(int, long, float, long);
+ }
+
+ public static final class PlaybackStateCompat.CustomAction implements android.os.Parcelable {
+ method public int describeContents();
+ method public static android.support.v4.media.session.PlaybackStateCompat.CustomAction! fromCustomAction(Object!);
+ method public String! getAction();
+ method public Object! getCustomAction();
+ method public android.os.Bundle! getExtras();
+ method public int getIcon();
+ method public CharSequence! getName();
+ method public void writeToParcel(android.os.Parcel!, int);
+ field public static final android.os.Parcelable.Creator<android.support.v4.media.session.PlaybackStateCompat.CustomAction>! CREATOR;
+ }
+
+ public static final class PlaybackStateCompat.CustomAction.Builder {
+ ctor public PlaybackStateCompat.CustomAction.Builder(String!, CharSequence!, int);
+ method public android.support.v4.media.session.PlaybackStateCompat.CustomAction! build();
+ method public android.support.v4.media.session.PlaybackStateCompat.CustomAction.Builder! setExtras(android.os.Bundle!);
+ }
+
+}
+
+package androidx.media {
+
+ public class AudioAttributesCompat implements androidx.versionedparcelable.VersionedParcelable {
+ method public int getContentType();
+ method public int getFlags();
+ method public int getLegacyStreamType();
+ method public int getUsage();
+ method public int getVolumeControlStream();
+ method public Object? unwrap();
+ method public static androidx.media.AudioAttributesCompat? wrap(Object);
+ field public static final int CONTENT_TYPE_MOVIE = 3; // 0x3
+ field public static final int CONTENT_TYPE_MUSIC = 2; // 0x2
+ field public static final int CONTENT_TYPE_SONIFICATION = 4; // 0x4
+ field public static final int CONTENT_TYPE_SPEECH = 1; // 0x1
+ field public static final int CONTENT_TYPE_UNKNOWN = 0; // 0x0
+ field public static final int FLAG_AUDIBILITY_ENFORCED = 1; // 0x1
+ field public static final int FLAG_HW_AV_SYNC = 16; // 0x10
+ field public static final int USAGE_ALARM = 4; // 0x4
+ field public static final int USAGE_ASSISTANCE_ACCESSIBILITY = 11; // 0xb
+ field public static final int USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12; // 0xc
+ field public static final int USAGE_ASSISTANCE_SONIFICATION = 13; // 0xd
+ field public static final int USAGE_ASSISTANT = 16; // 0x10
+ field public static final int USAGE_GAME = 14; // 0xe
+ field public static final int USAGE_MEDIA = 1; // 0x1
+ field public static final int USAGE_NOTIFICATION = 5; // 0x5
+ field public static final int USAGE_NOTIFICATION_COMMUNICATION_DELAYED = 9; // 0x9
+ field public static final int USAGE_NOTIFICATION_COMMUNICATION_INSTANT = 8; // 0x8
+ field public static final int USAGE_NOTIFICATION_COMMUNICATION_REQUEST = 7; // 0x7
+ field public static final int USAGE_NOTIFICATION_EVENT = 10; // 0xa
+ field public static final int USAGE_NOTIFICATION_RINGTONE = 6; // 0x6
+ field public static final int USAGE_UNKNOWN = 0; // 0x0
+ field public static final int USAGE_VOICE_COMMUNICATION = 2; // 0x2
+ field public static final int USAGE_VOICE_COMMUNICATION_SIGNALLING = 3; // 0x3
+ }
+
+ public static class AudioAttributesCompat.Builder {
+ ctor public AudioAttributesCompat.Builder();
+ ctor public AudioAttributesCompat.Builder(androidx.media.AudioAttributesCompat!);
+ method public androidx.media.AudioAttributesCompat! build();
+ method public androidx.media.AudioAttributesCompat.Builder! setContentType(int);
+ method public androidx.media.AudioAttributesCompat.Builder! setFlags(int);
+ method public androidx.media.AudioAttributesCompat.Builder! setLegacyStreamType(int);
+ method public androidx.media.AudioAttributesCompat.Builder! setUsage(int);
+ }
+
+ public class AudioFocusRequestCompat {
+ method public androidx.media.AudioAttributesCompat getAudioAttributesCompat();
+ method public android.os.Handler getFocusChangeHandler();
+ method public int getFocusGain();
+ method public android.media.AudioManager.OnAudioFocusChangeListener getOnAudioFocusChangeListener();
+ method public boolean willPauseWhenDucked();
+ }
+
+ public static final class AudioFocusRequestCompat.Builder {
+ ctor public AudioFocusRequestCompat.Builder(int);
+ ctor public AudioFocusRequestCompat.Builder(androidx.media.AudioFocusRequestCompat);
+ method public androidx.media.AudioFocusRequestCompat! build();
+ method public androidx.media.AudioFocusRequestCompat.Builder setAudioAttributes(androidx.media.AudioAttributesCompat);
+ method public androidx.media.AudioFocusRequestCompat.Builder setFocusGain(int);
+ method public androidx.media.AudioFocusRequestCompat.Builder setOnAudioFocusChangeListener(android.media.AudioManager.OnAudioFocusChangeListener);
+ method public androidx.media.AudioFocusRequestCompat.Builder setOnAudioFocusChangeListener(android.media.AudioManager.OnAudioFocusChangeListener, android.os.Handler);
+ method public androidx.media.AudioFocusRequestCompat.Builder setWillPauseWhenDucked(boolean);
+ }
+
+ public final class AudioManagerCompat {
+ method public static int abandonAudioFocusRequest(android.media.AudioManager, androidx.media.AudioFocusRequestCompat);
+ method public static int requestAudioFocus(android.media.AudioManager, androidx.media.AudioFocusRequestCompat);
+ field public static final int AUDIOFOCUS_GAIN = 1; // 0x1
+ field public static final int AUDIOFOCUS_GAIN_TRANSIENT = 2; // 0x2
+ field public static final int AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE = 4; // 0x4
+ field public static final int AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK = 3; // 0x3
+ }
+
+ public abstract class MediaBrowserServiceCompat extends android.app.Service {
+ ctor public MediaBrowserServiceCompat();
+ method public void dump(java.io.FileDescriptor!, java.io.PrintWriter!, String[]!);
+ method public final android.os.Bundle! getBrowserRootHints();
+ method public final androidx.media.MediaSessionManager.RemoteUserInfo getCurrentBrowserInfo();
+ method public android.support.v4.media.session.MediaSessionCompat.Token? getSessionToken();
+ method public void notifyChildrenChanged(String);
+ method public void notifyChildrenChanged(String, android.os.Bundle);
+ method public android.os.IBinder! onBind(android.content.Intent!);
+ method public void onCustomAction(String, android.os.Bundle!, androidx.media.MediaBrowserServiceCompat.Result<android.os.Bundle>);
+ method public abstract androidx.media.MediaBrowserServiceCompat.BrowserRoot? onGetRoot(String, int, android.os.Bundle?);
+ method public abstract void onLoadChildren(String, androidx.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>);
+ method public void onLoadChildren(String, androidx.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>, android.os.Bundle);
+ method public void onLoadItem(String!, androidx.media.MediaBrowserServiceCompat.Result<android.support.v4.media.MediaBrowserCompat.MediaItem>);
+ method public void onSearch(String, android.os.Bundle!, androidx.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>);
+ method public void setSessionToken(android.support.v4.media.session.MediaSessionCompat.Token!);
+ field public static final String SERVICE_INTERFACE = "android.media.browse.MediaBrowserService";
+ }
+
+ public static final class MediaBrowserServiceCompat.BrowserRoot {
+ ctor public MediaBrowserServiceCompat.BrowserRoot(String, android.os.Bundle?);
+ method public android.os.Bundle! getExtras();
+ method public String! getRootId();
+ field public static final String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE";
+ field public static final String EXTRA_RECENT = "android.service.media.extra.RECENT";
+ field public static final String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED";
+ field @Deprecated public static final String EXTRA_SUGGESTION_KEYWORDS = "android.service.media.extra.SUGGESTION_KEYWORDS";
+ }
+
+ public static class MediaBrowserServiceCompat.Result<T> {
+ method public void detach();
+ method public void sendError(android.os.Bundle!);
+ method public void sendProgressUpdate(android.os.Bundle!);
+ method public void sendResult(T!);
+ }
+
+ public final class MediaSessionManager {
+ method public static androidx.media.MediaSessionManager getSessionManager(android.content.Context);
+ method public boolean isTrustedForMediaControl(androidx.media.MediaSessionManager.RemoteUserInfo);
+ }
+
+ public static final class MediaSessionManager.RemoteUserInfo {
+ ctor public MediaSessionManager.RemoteUserInfo(String, int, int);
+ method public String getPackageName();
+ method public int getPid();
+ method public int getUid();
+ field public static final String LEGACY_CONTROLLER = "android.media.session.MediaController";
+ }
+
+ public abstract class VolumeProviderCompat {
+ ctor public VolumeProviderCompat(int, int, int);
+ method public final int getCurrentVolume();
+ method public final int getMaxVolume();
+ method public final int getVolumeControl();
+ method public Object! getVolumeProvider();
+ method public void onAdjustVolume(int);
+ method public void onSetVolumeTo(int);
+ method public void setCallback(androidx.media.VolumeProviderCompat.Callback!);
+ method public final void setCurrentVolume(int);
+ field public static final int VOLUME_CONTROL_ABSOLUTE = 2; // 0x2
+ field public static final int VOLUME_CONTROL_FIXED = 0; // 0x0
+ field public static final int VOLUME_CONTROL_RELATIVE = 1; // 0x1
+ }
+
+ public abstract static class VolumeProviderCompat.Callback {
+ ctor public VolumeProviderCompat.Callback();
+ method public abstract void onVolumeChanged(androidx.media.VolumeProviderCompat!);
+ }
+
+}
+
+package androidx.media.app {
+
+ public class NotificationCompat {
+ }
+
+ public static class NotificationCompat.DecoratedMediaCustomViewStyle extends androidx.media.app.NotificationCompat.MediaStyle {
+ ctor public NotificationCompat.DecoratedMediaCustomViewStyle();
+ }
+
+ public static class NotificationCompat.MediaStyle extends androidx.core.app.NotificationCompat.Style {
+ ctor public NotificationCompat.MediaStyle();
+ ctor public NotificationCompat.MediaStyle(androidx.core.app.NotificationCompat.Builder!);
+ method public static android.support.v4.media.session.MediaSessionCompat.Token! getMediaSession(android.app.Notification!);
+ method public androidx.media.app.NotificationCompat.MediaStyle! setCancelButtonIntent(android.app.PendingIntent!);
+ method public androidx.media.app.NotificationCompat.MediaStyle! setMediaSession(android.support.v4.media.session.MediaSessionCompat.Token!);
+ method public androidx.media.app.NotificationCompat.MediaStyle! setShowActionsInCompactView(int...!);
+ method public androidx.media.app.NotificationCompat.MediaStyle! setShowCancelButton(boolean);
+ }
+
+}
+
+package androidx.media.session {
+
+ public class MediaButtonReceiver extends android.content.BroadcastReceiver {
+ ctor public MediaButtonReceiver();
+ method public static android.app.PendingIntent! buildMediaButtonPendingIntent(android.content.Context!, long);
+ method public static android.app.PendingIntent! buildMediaButtonPendingIntent(android.content.Context!, android.content.ComponentName!, long);
+ method public static android.view.KeyEvent! handleIntent(android.support.v4.media.session.MediaSessionCompat!, android.content.Intent!);
+ method public void onReceive(android.content.Context!, android.content.Intent!);
+ }
+
+}
+
diff --git a/media/api/1.1.0-beta01.txt b/media/api/1.1.0-beta01.txt
index 7526b4a..7a53671f 100644
--- a/media/api/1.1.0-beta01.txt
+++ b/media/api/1.1.0-beta01.txt
@@ -285,6 +285,7 @@
method public abstract void sendCustomAction(android.support.v4.media.session.PlaybackStateCompat.CustomAction!, android.os.Bundle!);
method public abstract void sendCustomAction(String!, android.os.Bundle!);
method public abstract void setCaptioningEnabled(boolean);
+ method public void setPlaybackSpeed(float);
method public abstract void setRating(android.support.v4.media.RatingCompat!);
method public abstract void setRating(android.support.v4.media.RatingCompat!, android.os.Bundle!);
method public abstract void setRepeatMode(int);
@@ -363,6 +364,7 @@
method public void onRewind();
method public void onSeekTo(long);
method public void onSetCaptioningEnabled(boolean);
+ method public void onSetPlaybackSpeed(float);
method public void onSetRating(android.support.v4.media.RatingCompat!);
method public void onSetRating(android.support.v4.media.RatingCompat!, android.os.Bundle!);
method public void onSetRepeatMode(int);
diff --git a/media/api/1.1.0-beta02.txt b/media/api/1.1.0-beta02.txt
index 7526b4a..7a53671f 100644
--- a/media/api/1.1.0-beta02.txt
+++ b/media/api/1.1.0-beta02.txt
@@ -285,6 +285,7 @@
method public abstract void sendCustomAction(android.support.v4.media.session.PlaybackStateCompat.CustomAction!, android.os.Bundle!);
method public abstract void sendCustomAction(String!, android.os.Bundle!);
method public abstract void setCaptioningEnabled(boolean);
+ method public void setPlaybackSpeed(float);
method public abstract void setRating(android.support.v4.media.RatingCompat!);
method public abstract void setRating(android.support.v4.media.RatingCompat!, android.os.Bundle!);
method public abstract void setRepeatMode(int);
@@ -363,6 +364,7 @@
method public void onRewind();
method public void onSeekTo(long);
method public void onSetCaptioningEnabled(boolean);
+ method public void onSetPlaybackSpeed(float);
method public void onSetRating(android.support.v4.media.RatingCompat!);
method public void onSetRating(android.support.v4.media.RatingCompat!, android.os.Bundle!);
method public void onSetRepeatMode(int);
diff --git a/media/api/current.txt b/media/api/current.txt
index 7526b4a..7a53671f 100644
--- a/media/api/current.txt
+++ b/media/api/current.txt
@@ -285,6 +285,7 @@
method public abstract void sendCustomAction(android.support.v4.media.session.PlaybackStateCompat.CustomAction!, android.os.Bundle!);
method public abstract void sendCustomAction(String!, android.os.Bundle!);
method public abstract void setCaptioningEnabled(boolean);
+ method public void setPlaybackSpeed(float);
method public abstract void setRating(android.support.v4.media.RatingCompat!);
method public abstract void setRating(android.support.v4.media.RatingCompat!, android.os.Bundle!);
method public abstract void setRepeatMode(int);
@@ -363,6 +364,7 @@
method public void onRewind();
method public void onSeekTo(long);
method public void onSetCaptioningEnabled(boolean);
+ method public void onSetPlaybackSpeed(float);
method public void onSetRating(android.support.v4.media.RatingCompat!);
method public void onSetRating(android.support.v4.media.RatingCompat!, android.os.Bundle!);
method public void onSetRepeatMode(int);
diff --git a/media/src/main/java/android/support/v4/media/session/MediaControllerCompat.java b/media/src/main/java/android/support/v4/media/session/MediaControllerCompat.java
index 3028715..3e428a0 100644
--- a/media/src/main/java/android/support/v4/media/session/MediaControllerCompat.java
+++ b/media/src/main/java/android/support/v4/media/session/MediaControllerCompat.java
@@ -1325,9 +1325,7 @@
*
* @param speed The playback speed
* @throws IllegalArgumentException if the {@code speed} is equal to zero.
- * @hide
*/
- @RestrictTo(LIBRARY_GROUP_PREFIX)
public void setPlaybackSpeed(float speed) {}
/**
@@ -2502,6 +2500,10 @@
if (speed == 0.0f) {
throw new IllegalArgumentException("speed must not be zero");
}
+ if (Build.VERSION.SDK_INT >= 29) {
+ mControlsFwk.setPlaybackSpeed(speed);
+ return;
+ }
Bundle bundle = new Bundle();
bundle.putFloat(MediaSessionCompat.ACTION_ARGUMENT_PLAYBACK_SPEED, speed);
sendCustomAction(MediaSessionCompat.ACTION_SET_PLAYBACK_SPEED, bundle);
diff --git a/media/src/main/java/android/support/v4/media/session/MediaSessionCompat.java b/media/src/main/java/android/support/v4/media/session/MediaSessionCompat.java
index 0b54400..7e181c9 100644
--- a/media/src/main/java/android/support/v4/media/session/MediaSessionCompat.java
+++ b/media/src/main/java/android/support/v4/media/session/MediaSessionCompat.java
@@ -1321,9 +1321,7 @@
* @param speed the playback speed
* @see #setPlaybackState(PlaybackStateCompat)
* @see PlaybackStateCompat.Builder#setState(int, long, float)
- * @hide
*/
- @RestrictTo(LIBRARY_GROUP_PREFIX)
public void onSetPlaybackSpeed(float speed) {
}
@@ -1717,6 +1715,14 @@
Callback.this.onPrepareFromUri(uri, extras);
clearCurrentControllerInfo();
}
+
+ @RequiresApi(29)
+ @Override
+ public void onSetPlaybackSpeed(float speed) {
+ setCurrentControllerInfo();
+ Callback.this.onSetPlaybackSpeed(speed);
+ clearCurrentControllerInfo();
+ }
}
}
diff --git a/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteButton.java b/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteButton.java
index 47e0a65..53efb50 100644
--- a/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteButton.java
+++ b/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteButton.java
@@ -29,6 +29,7 @@
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.os.AsyncTask;
+import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
@@ -150,6 +151,10 @@
context = getContext();
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.MediaRouteButton, defStyleAttr, 0);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.MediaRouteButton, attrs, a, defStyleAttr, 0);
+ }
if (isInEditMode()) {
mRouter = null;
mCallback = null;
diff --git a/navigation/safe-args-gradle-plugin/build.gradle b/navigation/safe-args-gradle-plugin/build.gradle
index a68a18a..101ee5d 100644
--- a/navigation/safe-args-gradle-plugin/build.gradle
+++ b/navigation/safe-args-gradle-plugin/build.gradle
@@ -48,7 +48,7 @@
task generateSdkResource() {
inputs.property("prebuiltsRoot", prebuiltsRoot)
- inputs.property("compileSdkVersion", SupportConfig.TARGET_SDK_VERSION)
+ inputs.property("compileSdkVersion", SupportConfig.COMPILE_SDK_VERSION)
inputs.property("buildToolsVersion", SupportConfig.BUILD_TOOLS_VERSION)
inputs.property("minSdkVersion", SupportConfig.DEFAULT_MIN_SDK_VERSION)
inputs.property("debugKeystore", debugKeystore)
@@ -60,7 +60,7 @@
// so we don't use it and write a file manually
new File(generatedResources, "sdk.prop").withWriter('UTF-8') { writer ->
writer.write("prebuiltsRepo=$prebuiltsRoot\n")
- writer.write("compileSdkVersion=$SupportConfig.TARGET_SDK_VERSION\n")
+ writer.write("compileSdkVersion=\"$SupportConfig.COMPILE_SDK_VERSION\"\n")
writer.write("buildToolsVersion=$SupportConfig.BUILD_TOOLS_VERSION\n")
writer.write("minSdkVersion=$SupportConfig.DEFAULT_MIN_SDK_VERSION\n")
writer.write("debugKeystore=$debugKeystore\n")
diff --git a/preference/api/1.1.0-alpha03.txt b/preference/api/1.1.0-alpha03.txt
index d3b0755..611d611 100644
--- a/preference/api/1.1.0-alpha03.txt
+++ b/preference/api/1.1.0-alpha03.txt
@@ -290,9 +290,13 @@
method @Deprecated public androidx.preference.DialogPreference! getPreference();
method @Deprecated protected void onBindDialogView(android.view.View!);
method @Deprecated public void onClick(android.content.DialogInterface!, int);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.app.Dialog onCreateDialog(android.os.Bundle!);
method @Deprecated protected android.view.View! onCreateDialogView(android.content.Context!);
method @Deprecated public abstract void onDialogClosed(boolean);
+ method @Deprecated public void onDismiss(android.content.DialogInterface!);
method @Deprecated protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle);
field @Deprecated protected static final String ARG_KEY = "key";
}
@@ -314,13 +318,20 @@
method @Deprecated public final androidx.recyclerview.widget.RecyclerView! getListView();
method @Deprecated public androidx.preference.PreferenceManager! getPreferenceManager();
method @Deprecated public androidx.preference.PreferenceScreen! getPreferenceScreen();
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated protected androidx.recyclerview.widget.RecyclerView.Adapter! onCreateAdapter(androidx.preference.PreferenceScreen!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView.LayoutManager! onCreateLayoutManager();
method @Deprecated public abstract void onCreatePreferences(android.os.Bundle!, String!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView! onCreateRecyclerView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
method @Deprecated public void onDisplayPreferenceDialog(androidx.preference.Preference!);
method @Deprecated public void onNavigateToScreen(androidx.preference.PreferenceScreen!);
method @Deprecated public boolean onPreferenceTreeClick(androidx.preference.Preference!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onStart();
+ method @Deprecated public void onStop();
+ method @Deprecated public void onViewCreated(android.view.View!, android.os.Bundle!);
method @Deprecated public void scrollToPreference(String!);
method @Deprecated public void scrollToPreference(androidx.preference.Preference!);
method @Deprecated public void setDivider(android.graphics.drawable.Drawable!);
diff --git a/preference/api/1.1.0-alpha04.txt b/preference/api/1.1.0-alpha04.txt
index 0edd4f7b..b23276b 100644
--- a/preference/api/1.1.0-alpha04.txt
+++ b/preference/api/1.1.0-alpha04.txt
@@ -290,9 +290,13 @@
method @Deprecated public androidx.preference.DialogPreference! getPreference();
method @Deprecated protected void onBindDialogView(android.view.View!);
method @Deprecated public void onClick(android.content.DialogInterface!, int);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.app.Dialog onCreateDialog(android.os.Bundle!);
method @Deprecated protected android.view.View! onCreateDialogView(android.content.Context!);
method @Deprecated public abstract void onDialogClosed(boolean);
+ method @Deprecated public void onDismiss(android.content.DialogInterface!);
method @Deprecated protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle);
field @Deprecated protected static final String ARG_KEY = "key";
}
@@ -314,13 +318,20 @@
method @Deprecated public final androidx.recyclerview.widget.RecyclerView! getListView();
method @Deprecated public androidx.preference.PreferenceManager! getPreferenceManager();
method @Deprecated public androidx.preference.PreferenceScreen! getPreferenceScreen();
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated protected androidx.recyclerview.widget.RecyclerView.Adapter! onCreateAdapter(androidx.preference.PreferenceScreen!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView.LayoutManager! onCreateLayoutManager();
method @Deprecated public abstract void onCreatePreferences(android.os.Bundle!, String!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView! onCreateRecyclerView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
method @Deprecated public void onDisplayPreferenceDialog(androidx.preference.Preference!);
method @Deprecated public void onNavigateToScreen(androidx.preference.PreferenceScreen!);
method @Deprecated public boolean onPreferenceTreeClick(androidx.preference.Preference!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onStart();
+ method @Deprecated public void onStop();
+ method @Deprecated public void onViewCreated(android.view.View!, android.os.Bundle!);
method @Deprecated public void scrollToPreference(String!);
method @Deprecated public void scrollToPreference(androidx.preference.Preference!);
method @Deprecated public void setDivider(android.graphics.drawable.Drawable!);
diff --git a/preference/api/1.1.0-alpha05.txt b/preference/api/1.1.0-alpha05.txt
index 0edd4f7b..b23276b 100644
--- a/preference/api/1.1.0-alpha05.txt
+++ b/preference/api/1.1.0-alpha05.txt
@@ -290,9 +290,13 @@
method @Deprecated public androidx.preference.DialogPreference! getPreference();
method @Deprecated protected void onBindDialogView(android.view.View!);
method @Deprecated public void onClick(android.content.DialogInterface!, int);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.app.Dialog onCreateDialog(android.os.Bundle!);
method @Deprecated protected android.view.View! onCreateDialogView(android.content.Context!);
method @Deprecated public abstract void onDialogClosed(boolean);
+ method @Deprecated public void onDismiss(android.content.DialogInterface!);
method @Deprecated protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle);
field @Deprecated protected static final String ARG_KEY = "key";
}
@@ -314,13 +318,20 @@
method @Deprecated public final androidx.recyclerview.widget.RecyclerView! getListView();
method @Deprecated public androidx.preference.PreferenceManager! getPreferenceManager();
method @Deprecated public androidx.preference.PreferenceScreen! getPreferenceScreen();
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated protected androidx.recyclerview.widget.RecyclerView.Adapter! onCreateAdapter(androidx.preference.PreferenceScreen!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView.LayoutManager! onCreateLayoutManager();
method @Deprecated public abstract void onCreatePreferences(android.os.Bundle!, String!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView! onCreateRecyclerView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
method @Deprecated public void onDisplayPreferenceDialog(androidx.preference.Preference!);
method @Deprecated public void onNavigateToScreen(androidx.preference.PreferenceScreen!);
method @Deprecated public boolean onPreferenceTreeClick(androidx.preference.Preference!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onStart();
+ method @Deprecated public void onStop();
+ method @Deprecated public void onViewCreated(android.view.View!, android.os.Bundle!);
method @Deprecated public void scrollToPreference(String!);
method @Deprecated public void scrollToPreference(androidx.preference.Preference!);
method @Deprecated public void setDivider(android.graphics.drawable.Drawable!);
diff --git a/preference/api/1.1.0-alpha06.txt b/preference/api/1.1.0-alpha06.txt
index 5afea33..299375c 100644
--- a/preference/api/1.1.0-alpha06.txt
+++ b/preference/api/1.1.0-alpha06.txt
@@ -289,9 +289,13 @@
method @Deprecated public androidx.preference.DialogPreference! getPreference();
method @Deprecated protected void onBindDialogView(android.view.View!);
method @Deprecated public void onClick(android.content.DialogInterface!, int);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.app.Dialog onCreateDialog(android.os.Bundle!);
method @Deprecated protected android.view.View! onCreateDialogView(android.content.Context!);
method @Deprecated public abstract void onDialogClosed(boolean);
+ method @Deprecated public void onDismiss(android.content.DialogInterface!);
method @Deprecated protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle);
field @Deprecated protected static final String ARG_KEY = "key";
}
@@ -313,13 +317,20 @@
method @Deprecated public final androidx.recyclerview.widget.RecyclerView! getListView();
method @Deprecated public androidx.preference.PreferenceManager! getPreferenceManager();
method @Deprecated public androidx.preference.PreferenceScreen! getPreferenceScreen();
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated protected androidx.recyclerview.widget.RecyclerView.Adapter! onCreateAdapter(androidx.preference.PreferenceScreen!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView.LayoutManager! onCreateLayoutManager();
method @Deprecated public abstract void onCreatePreferences(android.os.Bundle!, String!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView! onCreateRecyclerView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
method @Deprecated public void onDisplayPreferenceDialog(androidx.preference.Preference!);
method @Deprecated public void onNavigateToScreen(androidx.preference.PreferenceScreen!);
method @Deprecated public boolean onPreferenceTreeClick(androidx.preference.Preference!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onStart();
+ method @Deprecated public void onStop();
+ method @Deprecated public void onViewCreated(android.view.View!, android.os.Bundle!);
method @Deprecated public void scrollToPreference(String!);
method @Deprecated public void scrollToPreference(androidx.preference.Preference!);
method @Deprecated public void setDivider(android.graphics.drawable.Drawable!);
diff --git a/preference/api/1.1.0-beta00.txt b/preference/api/1.1.0-beta00.txt
new file mode 100644
index 0000000..b23276b
--- /dev/null
+++ b/preference/api/1.1.0-beta00.txt
@@ -0,0 +1,554 @@
+// Signature format: 3.0
+package androidx.preference {
+
+ public class CheckBoxPreference extends androidx.preference.TwoStatePreference {
+ ctor public CheckBoxPreference(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public CheckBoxPreference(android.content.Context!, android.util.AttributeSet!, int, int);
+ ctor public CheckBoxPreference(android.content.Context!, android.util.AttributeSet!);
+ ctor public CheckBoxPreference(android.content.Context!);
+ }
+
+ public abstract class DialogPreference extends androidx.preference.Preference {
+ ctor public DialogPreference(android.content.Context!, android.util.AttributeSet!, int, int);
+ ctor public DialogPreference(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public DialogPreference(android.content.Context!, android.util.AttributeSet!);
+ ctor public DialogPreference(android.content.Context!);
+ method public android.graphics.drawable.Drawable! getDialogIcon();
+ method public int getDialogLayoutResource();
+ method public CharSequence! getDialogMessage();
+ method public CharSequence! getDialogTitle();
+ method public CharSequence! getNegativeButtonText();
+ method public CharSequence! getPositiveButtonText();
+ method public void setDialogIcon(android.graphics.drawable.Drawable!);
+ method public void setDialogIcon(int);
+ method public void setDialogLayoutResource(int);
+ method public void setDialogMessage(CharSequence!);
+ method public void setDialogMessage(int);
+ method public void setDialogTitle(CharSequence!);
+ method public void setDialogTitle(int);
+ method public void setNegativeButtonText(CharSequence!);
+ method public void setNegativeButtonText(int);
+ method public void setPositiveButtonText(CharSequence!);
+ method public void setPositiveButtonText(int);
+ }
+
+ public static interface DialogPreference.TargetFragment {
+ method public <T extends androidx.preference.Preference> T? findPreference(CharSequence);
+ }
+
+ public class DropDownPreference extends androidx.preference.ListPreference {
+ ctor public DropDownPreference(android.content.Context!);
+ ctor public DropDownPreference(android.content.Context!, android.util.AttributeSet!);
+ ctor public DropDownPreference(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public DropDownPreference(android.content.Context!, android.util.AttributeSet!, int, int);
+ method protected android.widget.ArrayAdapter! createAdapter();
+ }
+
+ public class EditTextPreference extends androidx.preference.DialogPreference {
+ ctor public EditTextPreference(android.content.Context!, android.util.AttributeSet!, int, int);
+ ctor public EditTextPreference(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public EditTextPreference(android.content.Context!, android.util.AttributeSet!);
+ ctor public EditTextPreference(android.content.Context!);
+ method public androidx.preference.EditTextPreference.OnBindEditTextListener? getOnBindEditTextListener();
+ method public String! getText();
+ method public void setOnBindEditTextListener(androidx.preference.EditTextPreference.OnBindEditTextListener?);
+ method public void setText(String!);
+ }
+
+ public static interface EditTextPreference.OnBindEditTextListener {
+ method public void onBindEditText(android.widget.EditText);
+ }
+
+ public static final class EditTextPreference.SimpleSummaryProvider implements androidx.preference.Preference.SummaryProvider<androidx.preference.EditTextPreference> {
+ method public static androidx.preference.EditTextPreference.SimpleSummaryProvider! getInstance();
+ method public CharSequence! provideSummary(androidx.preference.EditTextPreference!);
+ }
+
+ @Deprecated public class EditTextPreferenceDialogFragment extends androidx.preference.PreferenceDialogFragment {
+ ctor @Deprecated public EditTextPreferenceDialogFragment();
+ method @Deprecated public static androidx.preference.EditTextPreferenceDialogFragment! newInstance(String!);
+ method @Deprecated protected void onBindDialogView(android.view.View!);
+ method @Deprecated public void onDialogClosed(boolean);
+ }
+
+ public class EditTextPreferenceDialogFragmentCompat extends androidx.preference.PreferenceDialogFragmentCompat {
+ ctor public EditTextPreferenceDialogFragmentCompat();
+ method public static androidx.preference.EditTextPreferenceDialogFragmentCompat! newInstance(String!);
+ method public void onDialogClosed(boolean);
+ }
+
+ public class ListPreference extends androidx.preference.DialogPreference {
+ ctor public ListPreference(android.content.Context!, android.util.AttributeSet!, int, int);
+ ctor public ListPreference(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public ListPreference(android.content.Context!, android.util.AttributeSet!);
+ ctor public ListPreference(android.content.Context!);
+ method public int findIndexOfValue(String!);
+ method public CharSequence[]! getEntries();
+ method public CharSequence! getEntry();
+ method public CharSequence[]! getEntryValues();
+ method public String! getValue();
+ method public void setEntries(CharSequence[]!);
+ method public void setEntries(@ArrayRes int);
+ method public void setEntryValues(CharSequence[]!);
+ method public void setEntryValues(@ArrayRes int);
+ method public void setValue(String!);
+ method public void setValueIndex(int);
+ }
+
+ public static final class ListPreference.SimpleSummaryProvider implements androidx.preference.Preference.SummaryProvider<androidx.preference.ListPreference> {
+ method public static androidx.preference.ListPreference.SimpleSummaryProvider! getInstance();
+ method public CharSequence! provideSummary(androidx.preference.ListPreference!);
+ }
+
+ @Deprecated public class ListPreferenceDialogFragment extends androidx.preference.PreferenceDialogFragment {
+ ctor @Deprecated public ListPreferenceDialogFragment();
+ method @Deprecated public static androidx.preference.ListPreferenceDialogFragment! newInstance(String!);
+ method @Deprecated public void onDialogClosed(boolean);
+ method @Deprecated protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder!);
+ }
+
+ public class ListPreferenceDialogFragmentCompat extends androidx.preference.PreferenceDialogFragmentCompat {
+ ctor public ListPreferenceDialogFragmentCompat();
+ method public static androidx.preference.ListPreferenceDialogFragmentCompat! newInstance(String!);
+ method public void onDialogClosed(boolean);
+ }
+
+ public class MultiSelectListPreference extends androidx.preference.DialogPreference {
+ ctor public MultiSelectListPreference(android.content.Context!, android.util.AttributeSet!, int, int);
+ ctor public MultiSelectListPreference(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public MultiSelectListPreference(android.content.Context!, android.util.AttributeSet!);
+ ctor public MultiSelectListPreference(android.content.Context!);
+ method public int findIndexOfValue(String!);
+ method public CharSequence[]! getEntries();
+ method public CharSequence[]! getEntryValues();
+ method protected boolean[]! getSelectedItems();
+ method public java.util.Set<java.lang.String>! getValues();
+ method public void setEntries(CharSequence[]!);
+ method public void setEntries(@ArrayRes int);
+ method public void setEntryValues(CharSequence[]!);
+ method public void setEntryValues(@ArrayRes int);
+ method public void setValues(java.util.Set<java.lang.String>!);
+ }
+
+ @Deprecated public class MultiSelectListPreferenceDialogFragment extends androidx.preference.PreferenceDialogFragment {
+ ctor @Deprecated public MultiSelectListPreferenceDialogFragment();
+ method @Deprecated public static androidx.preference.MultiSelectListPreferenceDialogFragment! newInstance(String!);
+ method @Deprecated public void onDialogClosed(boolean);
+ method @Deprecated protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder!);
+ }
+
+ public class MultiSelectListPreferenceDialogFragmentCompat extends androidx.preference.PreferenceDialogFragmentCompat {
+ ctor public MultiSelectListPreferenceDialogFragmentCompat();
+ method public static androidx.preference.MultiSelectListPreferenceDialogFragmentCompat! newInstance(String!);
+ method public void onDialogClosed(boolean);
+ }
+
+ public class Preference implements java.lang.Comparable<androidx.preference.Preference> {
+ ctor public Preference(android.content.Context!, android.util.AttributeSet!, int, int);
+ ctor public Preference(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public Preference(android.content.Context!, android.util.AttributeSet!);
+ ctor public Preference(android.content.Context!);
+ method public boolean callChangeListener(Object!);
+ method public int compareTo(androidx.preference.Preference);
+ method protected <T extends androidx.preference.Preference> T? findPreferenceInHierarchy(String);
+ method public android.content.Context! getContext();
+ method public String! getDependency();
+ method public android.os.Bundle! getExtras();
+ method public String! getFragment();
+ method public android.graphics.drawable.Drawable! getIcon();
+ method public android.content.Intent! getIntent();
+ method public String! getKey();
+ method public final int getLayoutResource();
+ method public androidx.preference.Preference.OnPreferenceChangeListener! getOnPreferenceChangeListener();
+ method public androidx.preference.Preference.OnPreferenceClickListener! getOnPreferenceClickListener();
+ method public int getOrder();
+ method public androidx.preference.PreferenceGroup? getParent();
+ method protected boolean getPersistedBoolean(boolean);
+ method protected float getPersistedFloat(float);
+ method protected int getPersistedInt(int);
+ method protected long getPersistedLong(long);
+ method protected String! getPersistedString(String!);
+ method public java.util.Set<java.lang.String>! getPersistedStringSet(java.util.Set<java.lang.String>!);
+ method public androidx.preference.PreferenceDataStore? getPreferenceDataStore();
+ method public androidx.preference.PreferenceManager! getPreferenceManager();
+ method public android.content.SharedPreferences! getSharedPreferences();
+ method public boolean getShouldDisableView();
+ method public CharSequence! getSummary();
+ method public final androidx.preference.Preference.SummaryProvider? getSummaryProvider();
+ method public CharSequence! getTitle();
+ method public final int getWidgetLayoutResource();
+ method public boolean hasKey();
+ method public boolean isCopyingEnabled();
+ method public boolean isEnabled();
+ method public boolean isIconSpaceReserved();
+ method public boolean isPersistent();
+ method public boolean isSelectable();
+ method public final boolean isShown();
+ method public boolean isSingleLineTitle();
+ method public final boolean isVisible();
+ method protected void notifyChanged();
+ method public void notifyDependencyChange(boolean);
+ method protected void notifyHierarchyChanged();
+ method public void onAttached();
+ method protected void onAttachedToHierarchy(androidx.preference.PreferenceManager!);
+ method public void onBindViewHolder(androidx.preference.PreferenceViewHolder!);
+ method protected void onClick();
+ method public void onDependencyChanged(androidx.preference.Preference!, boolean);
+ method public void onDetached();
+ method protected Object! onGetDefaultValue(android.content.res.TypedArray!, int);
+ method @CallSuper public void onInitializeAccessibilityNodeInfo(androidx.core.view.accessibility.AccessibilityNodeInfoCompat!);
+ method public void onParentChanged(androidx.preference.Preference!, boolean);
+ method protected void onPrepareForRemoval();
+ method protected void onRestoreInstanceState(android.os.Parcelable!);
+ method protected android.os.Parcelable! onSaveInstanceState();
+ method @Deprecated protected void onSetInitialValue(boolean, Object!);
+ method protected void onSetInitialValue(Object?);
+ method public android.os.Bundle! peekExtras();
+ method protected boolean persistBoolean(boolean);
+ method protected boolean persistFloat(float);
+ method protected boolean persistInt(int);
+ method protected boolean persistLong(long);
+ method protected boolean persistString(String!);
+ method public boolean persistStringSet(java.util.Set<java.lang.String>!);
+ method public void restoreHierarchyState(android.os.Bundle!);
+ method public void saveHierarchyState(android.os.Bundle!);
+ method public void setCopyingEnabled(boolean);
+ method public void setDefaultValue(Object!);
+ method public void setDependency(String!);
+ method public void setEnabled(boolean);
+ method public void setFragment(String!);
+ method public void setIcon(android.graphics.drawable.Drawable!);
+ method public void setIcon(int);
+ method public void setIconSpaceReserved(boolean);
+ method public void setIntent(android.content.Intent!);
+ method public void setKey(String!);
+ method public void setLayoutResource(int);
+ method public void setOnPreferenceChangeListener(androidx.preference.Preference.OnPreferenceChangeListener!);
+ method public void setOnPreferenceClickListener(androidx.preference.Preference.OnPreferenceClickListener!);
+ method public void setOrder(int);
+ method public void setPersistent(boolean);
+ method public void setPreferenceDataStore(androidx.preference.PreferenceDataStore!);
+ method public void setSelectable(boolean);
+ method public void setShouldDisableView(boolean);
+ method public void setSingleLineTitle(boolean);
+ method public void setSummary(CharSequence!);
+ method public void setSummary(int);
+ method public final void setSummaryProvider(androidx.preference.Preference.SummaryProvider?);
+ method public void setTitle(CharSequence!);
+ method public void setTitle(int);
+ method public void setViewId(int);
+ method public final void setVisible(boolean);
+ method public void setWidgetLayoutResource(int);
+ method public boolean shouldDisableDependents();
+ method protected boolean shouldPersist();
+ field public static final int DEFAULT_ORDER = 2147483647; // 0x7fffffff
+ }
+
+ public static class Preference.BaseSavedState extends android.view.AbsSavedState {
+ ctor public Preference.BaseSavedState(android.os.Parcel!);
+ ctor public Preference.BaseSavedState(android.os.Parcelable!);
+ field public static final android.os.Parcelable.Creator<androidx.preference.Preference.BaseSavedState>! CREATOR;
+ }
+
+ public static interface Preference.OnPreferenceChangeListener {
+ method public boolean onPreferenceChange(androidx.preference.Preference!, Object!);
+ }
+
+ public static interface Preference.OnPreferenceClickListener {
+ method public boolean onPreferenceClick(androidx.preference.Preference!);
+ }
+
+ public static interface Preference.SummaryProvider<T extends androidx.preference.Preference> {
+ method public CharSequence! provideSummary(T!);
+ }
+
+ public class PreferenceCategory extends androidx.preference.PreferenceGroup {
+ ctor public PreferenceCategory(android.content.Context!, android.util.AttributeSet!, int, int);
+ ctor public PreferenceCategory(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public PreferenceCategory(android.content.Context!, android.util.AttributeSet!);
+ ctor public PreferenceCategory(android.content.Context!);
+ }
+
+ public abstract class PreferenceDataStore {
+ ctor public PreferenceDataStore();
+ method public boolean getBoolean(String!, boolean);
+ method public float getFloat(String!, float);
+ method public int getInt(String!, int);
+ method public long getLong(String!, long);
+ method public String? getString(String!, String?);
+ method public java.util.Set<java.lang.String>? getStringSet(String!, java.util.Set<java.lang.String>?);
+ method public void putBoolean(String!, boolean);
+ method public void putFloat(String!, float);
+ method public void putInt(String!, int);
+ method public void putLong(String!, long);
+ method public void putString(String!, String?);
+ method public void putStringSet(String!, java.util.Set<java.lang.String>?);
+ }
+
+ @Deprecated public abstract class PreferenceDialogFragment extends android.app.DialogFragment implements android.content.DialogInterface.OnClickListener {
+ ctor @Deprecated public PreferenceDialogFragment();
+ method @Deprecated public androidx.preference.DialogPreference! getPreference();
+ method @Deprecated protected void onBindDialogView(android.view.View!);
+ method @Deprecated public void onClick(android.content.DialogInterface!, int);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.app.Dialog onCreateDialog(android.os.Bundle!);
+ method @Deprecated protected android.view.View! onCreateDialogView(android.content.Context!);
+ method @Deprecated public abstract void onDialogClosed(boolean);
+ method @Deprecated public void onDismiss(android.content.DialogInterface!);
+ method @Deprecated protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle);
+ field @Deprecated protected static final String ARG_KEY = "key";
+ }
+
+ public abstract class PreferenceDialogFragmentCompat extends androidx.fragment.app.DialogFragment implements android.content.DialogInterface.OnClickListener {
+ ctor public PreferenceDialogFragmentCompat();
+ method public androidx.preference.DialogPreference! getPreference();
+ method protected void onBindDialogView(android.view.View!);
+ method public void onClick(android.content.DialogInterface!, int);
+ method protected android.view.View! onCreateDialogView(android.content.Context!);
+ method public abstract void onDialogClosed(boolean);
+ method protected void onPrepareDialogBuilder(androidx.appcompat.app.AlertDialog.Builder!);
+ field protected static final String ARG_KEY = "key";
+ }
+
+ @Deprecated public abstract class PreferenceFragment extends android.app.Fragment implements androidx.preference.DialogPreference.TargetFragment androidx.preference.PreferenceManager.OnDisplayPreferenceDialogListener androidx.preference.PreferenceManager.OnNavigateToScreenListener androidx.preference.PreferenceManager.OnPreferenceTreeClickListener {
+ ctor @Deprecated public PreferenceFragment();
+ method @Deprecated public void addPreferencesFromResource(@XmlRes int);
+ method @Deprecated public <T extends androidx.preference.Preference> T! findPreference(CharSequence!);
+ method @Deprecated public final androidx.recyclerview.widget.RecyclerView! getListView();
+ method @Deprecated public androidx.preference.PreferenceManager! getPreferenceManager();
+ method @Deprecated public androidx.preference.PreferenceScreen! getPreferenceScreen();
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated protected androidx.recyclerview.widget.RecyclerView.Adapter! onCreateAdapter(androidx.preference.PreferenceScreen!);
+ method @Deprecated public androidx.recyclerview.widget.RecyclerView.LayoutManager! onCreateLayoutManager();
+ method @Deprecated public abstract void onCreatePreferences(android.os.Bundle!, String!);
+ method @Deprecated public androidx.recyclerview.widget.RecyclerView! onCreateRecyclerView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
+ method @Deprecated public void onDisplayPreferenceDialog(androidx.preference.Preference!);
+ method @Deprecated public void onNavigateToScreen(androidx.preference.PreferenceScreen!);
+ method @Deprecated public boolean onPreferenceTreeClick(androidx.preference.Preference!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onStart();
+ method @Deprecated public void onStop();
+ method @Deprecated public void onViewCreated(android.view.View!, android.os.Bundle!);
+ method @Deprecated public void scrollToPreference(String!);
+ method @Deprecated public void scrollToPreference(androidx.preference.Preference!);
+ method @Deprecated public void setDivider(android.graphics.drawable.Drawable!);
+ method @Deprecated public void setDividerHeight(int);
+ method @Deprecated public void setPreferenceScreen(androidx.preference.PreferenceScreen!);
+ method @Deprecated public void setPreferencesFromResource(@XmlRes int, String?);
+ field @Deprecated public static final String ARG_PREFERENCE_ROOT = "androidx.preference.PreferenceFragmentCompat.PREFERENCE_ROOT";
+ }
+
+ @Deprecated public static interface PreferenceFragment.OnPreferenceDisplayDialogCallback {
+ method @Deprecated public boolean onPreferenceDisplayDialog(androidx.preference.PreferenceFragment, androidx.preference.Preference!);
+ }
+
+ @Deprecated public static interface PreferenceFragment.OnPreferenceStartFragmentCallback {
+ method @Deprecated public boolean onPreferenceStartFragment(androidx.preference.PreferenceFragment!, androidx.preference.Preference!);
+ }
+
+ @Deprecated public static interface PreferenceFragment.OnPreferenceStartScreenCallback {
+ method @Deprecated public boolean onPreferenceStartScreen(androidx.preference.PreferenceFragment!, androidx.preference.PreferenceScreen!);
+ }
+
+ public abstract class PreferenceFragmentCompat extends androidx.fragment.app.Fragment implements androidx.preference.DialogPreference.TargetFragment androidx.preference.PreferenceManager.OnDisplayPreferenceDialogListener androidx.preference.PreferenceManager.OnNavigateToScreenListener androidx.preference.PreferenceManager.OnPreferenceTreeClickListener {
+ ctor public PreferenceFragmentCompat();
+ method public void addPreferencesFromResource(@XmlRes int);
+ method public <T extends androidx.preference.Preference> T? findPreference(CharSequence);
+ method public final androidx.recyclerview.widget.RecyclerView! getListView();
+ method public androidx.preference.PreferenceManager! getPreferenceManager();
+ method public androidx.preference.PreferenceScreen! getPreferenceScreen();
+ method protected androidx.recyclerview.widget.RecyclerView.Adapter! onCreateAdapter(androidx.preference.PreferenceScreen!);
+ method public androidx.recyclerview.widget.RecyclerView.LayoutManager! onCreateLayoutManager();
+ method public abstract void onCreatePreferences(android.os.Bundle!, String!);
+ method public androidx.recyclerview.widget.RecyclerView! onCreateRecyclerView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method public void onDisplayPreferenceDialog(androidx.preference.Preference!);
+ method public void onNavigateToScreen(androidx.preference.PreferenceScreen!);
+ method public boolean onPreferenceTreeClick(androidx.preference.Preference!);
+ method public void scrollToPreference(String!);
+ method public void scrollToPreference(androidx.preference.Preference!);
+ method public void setDivider(android.graphics.drawable.Drawable!);
+ method public void setDividerHeight(int);
+ method public void setPreferenceScreen(androidx.preference.PreferenceScreen!);
+ method public void setPreferencesFromResource(@XmlRes int, String?);
+ field public static final String ARG_PREFERENCE_ROOT = "androidx.preference.PreferenceFragmentCompat.PREFERENCE_ROOT";
+ }
+
+ public static interface PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback {
+ method public boolean onPreferenceDisplayDialog(androidx.preference.PreferenceFragmentCompat, androidx.preference.Preference!);
+ }
+
+ public static interface PreferenceFragmentCompat.OnPreferenceStartFragmentCallback {
+ method public boolean onPreferenceStartFragment(androidx.preference.PreferenceFragmentCompat!, androidx.preference.Preference!);
+ }
+
+ public static interface PreferenceFragmentCompat.OnPreferenceStartScreenCallback {
+ method public boolean onPreferenceStartScreen(androidx.preference.PreferenceFragmentCompat!, androidx.preference.PreferenceScreen!);
+ }
+
+ public abstract class PreferenceGroup extends androidx.preference.Preference {
+ ctor public PreferenceGroup(android.content.Context!, android.util.AttributeSet!, int, int);
+ ctor public PreferenceGroup(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public PreferenceGroup(android.content.Context!, android.util.AttributeSet!);
+ method public void addItemFromInflater(androidx.preference.Preference!);
+ method public boolean addPreference(androidx.preference.Preference!);
+ method protected void dispatchRestoreInstanceState(android.os.Bundle!);
+ method protected void dispatchSaveInstanceState(android.os.Bundle!);
+ method public <T extends androidx.preference.Preference> T? findPreference(CharSequence);
+ method public int getInitialExpandedChildrenCount();
+ method public androidx.preference.Preference! getPreference(int);
+ method public int getPreferenceCount();
+ method protected boolean isOnSameScreenAsChildren();
+ method public boolean isOrderingAsAdded();
+ method protected boolean onPrepareAddPreference(androidx.preference.Preference!);
+ method public void removeAll();
+ method public boolean removePreference(androidx.preference.Preference!);
+ method public boolean removePreferenceRecursively(CharSequence);
+ method public void setInitialExpandedChildrenCount(int);
+ method public void setOrderingAsAdded(boolean);
+ }
+
+ public static interface PreferenceGroup.PreferencePositionCallback {
+ method public int getPreferenceAdapterPosition(String!);
+ method public int getPreferenceAdapterPosition(androidx.preference.Preference!);
+ }
+
+ public class PreferenceManager {
+ method public androidx.preference.PreferenceScreen! createPreferenceScreen(android.content.Context!);
+ method public <T extends androidx.preference.Preference> T? findPreference(CharSequence);
+ method public android.content.Context! getContext();
+ method public static android.content.SharedPreferences! getDefaultSharedPreferences(android.content.Context!);
+ method public androidx.preference.PreferenceManager.OnDisplayPreferenceDialogListener! getOnDisplayPreferenceDialogListener();
+ method public androidx.preference.PreferenceManager.OnNavigateToScreenListener! getOnNavigateToScreenListener();
+ method public androidx.preference.PreferenceManager.OnPreferenceTreeClickListener! getOnPreferenceTreeClickListener();
+ method public androidx.preference.PreferenceManager.PreferenceComparisonCallback! getPreferenceComparisonCallback();
+ method public androidx.preference.PreferenceDataStore? getPreferenceDataStore();
+ method public androidx.preference.PreferenceScreen! getPreferenceScreen();
+ method public android.content.SharedPreferences! getSharedPreferences();
+ method public int getSharedPreferencesMode();
+ method public String! getSharedPreferencesName();
+ method public boolean isStorageDefault();
+ method public boolean isStorageDeviceProtected();
+ method public static void setDefaultValues(android.content.Context!, int, boolean);
+ method public static void setDefaultValues(android.content.Context!, String!, int, int, boolean);
+ method public void setOnDisplayPreferenceDialogListener(androidx.preference.PreferenceManager.OnDisplayPreferenceDialogListener!);
+ method public void setOnNavigateToScreenListener(androidx.preference.PreferenceManager.OnNavigateToScreenListener!);
+ method public void setOnPreferenceTreeClickListener(androidx.preference.PreferenceManager.OnPreferenceTreeClickListener!);
+ method public void setPreferenceComparisonCallback(androidx.preference.PreferenceManager.PreferenceComparisonCallback!);
+ method public void setPreferenceDataStore(androidx.preference.PreferenceDataStore!);
+ method public boolean setPreferences(androidx.preference.PreferenceScreen!);
+ method public void setSharedPreferencesMode(int);
+ method public void setSharedPreferencesName(String!);
+ method public void setStorageDefault();
+ method public void setStorageDeviceProtected();
+ method public void showDialog(androidx.preference.Preference!);
+ field public static final String KEY_HAS_SET_DEFAULT_VALUES = "_has_set_default_values";
+ }
+
+ public static interface PreferenceManager.OnDisplayPreferenceDialogListener {
+ method public void onDisplayPreferenceDialog(androidx.preference.Preference!);
+ }
+
+ public static interface PreferenceManager.OnNavigateToScreenListener {
+ method public void onNavigateToScreen(androidx.preference.PreferenceScreen!);
+ }
+
+ public static interface PreferenceManager.OnPreferenceTreeClickListener {
+ method public boolean onPreferenceTreeClick(androidx.preference.Preference!);
+ }
+
+ public abstract static class PreferenceManager.PreferenceComparisonCallback {
+ ctor public PreferenceManager.PreferenceComparisonCallback();
+ method public abstract boolean arePreferenceContentsTheSame(androidx.preference.Preference!, androidx.preference.Preference!);
+ method public abstract boolean arePreferenceItemsTheSame(androidx.preference.Preference!, androidx.preference.Preference!);
+ }
+
+ public static class PreferenceManager.SimplePreferenceComparisonCallback extends androidx.preference.PreferenceManager.PreferenceComparisonCallback {
+ ctor public PreferenceManager.SimplePreferenceComparisonCallback();
+ method public boolean arePreferenceContentsTheSame(androidx.preference.Preference!, androidx.preference.Preference!);
+ method public boolean arePreferenceItemsTheSame(androidx.preference.Preference!, androidx.preference.Preference!);
+ }
+
+ public final class PreferenceScreen extends androidx.preference.PreferenceGroup {
+ method public void setShouldUseGeneratedIds(boolean);
+ method public boolean shouldUseGeneratedIds();
+ }
+
+ public class PreferenceViewHolder extends androidx.recyclerview.widget.RecyclerView.ViewHolder {
+ method public android.view.View! findViewById(@IdRes int);
+ method public boolean isDividerAllowedAbove();
+ method public boolean isDividerAllowedBelow();
+ method public void setDividerAllowedAbove(boolean);
+ method public void setDividerAllowedBelow(boolean);
+ }
+
+ public class SeekBarPreference extends androidx.preference.Preference {
+ ctor public SeekBarPreference(android.content.Context!, android.util.AttributeSet!, int, int);
+ ctor public SeekBarPreference(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public SeekBarPreference(android.content.Context!, android.util.AttributeSet!);
+ ctor public SeekBarPreference(android.content.Context!);
+ method public int getMax();
+ method public int getMin();
+ method public final int getSeekBarIncrement();
+ method public boolean getShowSeekBarValue();
+ method public boolean getUpdatesContinuously();
+ method public int getValue();
+ method public boolean isAdjustable();
+ method public void setAdjustable(boolean);
+ method public final void setMax(int);
+ method public void setMin(int);
+ method public final void setSeekBarIncrement(int);
+ method public void setShowSeekBarValue(boolean);
+ method public void setUpdatesContinuously(boolean);
+ method public void setValue(int);
+ }
+
+ public class SwitchPreference extends androidx.preference.TwoStatePreference {
+ ctor public SwitchPreference(android.content.Context!, android.util.AttributeSet!, int, int);
+ ctor public SwitchPreference(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public SwitchPreference(android.content.Context!, android.util.AttributeSet!);
+ ctor public SwitchPreference(android.content.Context!);
+ method public CharSequence! getSwitchTextOff();
+ method public CharSequence! getSwitchTextOn();
+ method public void setSwitchTextOff(CharSequence!);
+ method public void setSwitchTextOff(int);
+ method public void setSwitchTextOn(CharSequence!);
+ method public void setSwitchTextOn(int);
+ }
+
+ public class SwitchPreferenceCompat extends androidx.preference.TwoStatePreference {
+ ctor public SwitchPreferenceCompat(android.content.Context!, android.util.AttributeSet!, int, int);
+ ctor public SwitchPreferenceCompat(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public SwitchPreferenceCompat(android.content.Context!, android.util.AttributeSet!);
+ ctor public SwitchPreferenceCompat(android.content.Context!);
+ method public CharSequence! getSwitchTextOff();
+ method public CharSequence! getSwitchTextOn();
+ method public void setSwitchTextOff(CharSequence!);
+ method public void setSwitchTextOff(int);
+ method public void setSwitchTextOn(CharSequence!);
+ method public void setSwitchTextOn(int);
+ }
+
+ public abstract class TwoStatePreference extends androidx.preference.Preference {
+ ctor public TwoStatePreference(android.content.Context!, android.util.AttributeSet!, int, int);
+ ctor public TwoStatePreference(android.content.Context!, android.util.AttributeSet!, int);
+ ctor public TwoStatePreference(android.content.Context!, android.util.AttributeSet!);
+ ctor public TwoStatePreference(android.content.Context!);
+ method public boolean getDisableDependentsState();
+ method public CharSequence! getSummaryOff();
+ method public CharSequence! getSummaryOn();
+ method public boolean isChecked();
+ method public void setChecked(boolean);
+ method public void setDisableDependentsState(boolean);
+ method public void setSummaryOff(CharSequence!);
+ method public void setSummaryOff(int);
+ method public void setSummaryOn(CharSequence!);
+ method public void setSummaryOn(int);
+ method protected void syncSummaryView(androidx.preference.PreferenceViewHolder!);
+ field protected boolean mChecked;
+ }
+
+}
+
diff --git a/preference/api/current.txt b/preference/api/current.txt
index 5afea33..299375c 100644
--- a/preference/api/current.txt
+++ b/preference/api/current.txt
@@ -289,9 +289,13 @@
method @Deprecated public androidx.preference.DialogPreference! getPreference();
method @Deprecated protected void onBindDialogView(android.view.View!);
method @Deprecated public void onClick(android.content.DialogInterface!, int);
+ method @Deprecated public void onCreate(android.os.Bundle!);
+ method @Deprecated public android.app.Dialog onCreateDialog(android.os.Bundle!);
method @Deprecated protected android.view.View! onCreateDialogView(android.content.Context!);
method @Deprecated public abstract void onDialogClosed(boolean);
+ method @Deprecated public void onDismiss(android.content.DialogInterface!);
method @Deprecated protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle);
field @Deprecated protected static final String ARG_KEY = "key";
}
@@ -313,13 +317,20 @@
method @Deprecated public final androidx.recyclerview.widget.RecyclerView! getListView();
method @Deprecated public androidx.preference.PreferenceManager! getPreferenceManager();
method @Deprecated public androidx.preference.PreferenceScreen! getPreferenceScreen();
+ method @Deprecated public void onCreate(android.os.Bundle!);
method @Deprecated protected androidx.recyclerview.widget.RecyclerView.Adapter! onCreateAdapter(androidx.preference.PreferenceScreen!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView.LayoutManager! onCreateLayoutManager();
method @Deprecated public abstract void onCreatePreferences(android.os.Bundle!, String!);
method @Deprecated public androidx.recyclerview.widget.RecyclerView! onCreateRecyclerView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+ method @Deprecated public void onDestroyView();
method @Deprecated public void onDisplayPreferenceDialog(androidx.preference.Preference!);
method @Deprecated public void onNavigateToScreen(androidx.preference.PreferenceScreen!);
method @Deprecated public boolean onPreferenceTreeClick(androidx.preference.Preference!);
+ method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
+ method @Deprecated public void onStart();
+ method @Deprecated public void onStop();
+ method @Deprecated public void onViewCreated(android.view.View!, android.os.Bundle!);
method @Deprecated public void scrollToPreference(String!);
method @Deprecated public void scrollToPreference(androidx.preference.Preference!);
method @Deprecated public void setDivider(android.graphics.drawable.Drawable!);
diff --git a/preference/res/values-en-rCA/strings.xml b/preference/res/values-en-rCA/strings.xml
index c8d1681..16cf6b7 100644
--- a/preference/res/values-en-rCA/strings.xml
+++ b/preference/res/values-en-rCA/strings.xml
@@ -5,4 +5,6 @@
<string name="v7_preference_off" msgid="5138405918326871307">"OFF"</string>
<string name="expand_button_title" msgid="1234962710353108940">"Advanced"</string>
<string name="summary_collapsed_preference_list" msgid="5190123168583152844">"<xliff:g id="CURRENT_ITEMS">%1$s</xliff:g>, <xliff:g id="ADDED_ITEMS">%2$s</xliff:g>"</string>
+ <string name="copy" msgid="3209159573327985035">"Copy"</string>
+ <string name="preference_copied" msgid="7961817945132860002">"\'<xliff:g id="SUMMARY">%1$s</xliff:g>\' copied to clipboard."</string>
</resources>
diff --git a/preference/res/values-en-rXC/strings.xml b/preference/res/values-en-rXC/strings.xml
index 96219e7..cb60d80 100644
--- a/preference/res/values-en-rXC/strings.xml
+++ b/preference/res/values-en-rXC/strings.xml
@@ -5,4 +5,6 @@
<string name="v7_preference_off" msgid="5138405918326871307">"OFF"</string>
<string name="expand_button_title" msgid="1234962710353108940">"Advanced"</string>
<string name="summary_collapsed_preference_list" msgid="5190123168583152844">"<xliff:g id="CURRENT_ITEMS">%1$s</xliff:g>, <xliff:g id="ADDED_ITEMS">%2$s</xliff:g>"</string>
+ <string name="copy" msgid="3209159573327985035">"Copy"</string>
+ <string name="preference_copied" msgid="7961817945132860002">"\"<xliff:g id="SUMMARY">%1$s</xliff:g>\" copied to clipboard."</string>
</resources>
diff --git a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java
index 51374b5..477b765 100644
--- a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java
+++ b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java
@@ -691,6 +691,10 @@
int defStyleRes = 0;
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RecyclerView,
defStyle, defStyleRes);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.RecyclerView, attrs, a, defStyle, defStyleRes);
+ }
String layoutManagerName = a.getString(R.styleable.RecyclerView_layoutManager);
int descendantFocusability = a.getInt(
R.styleable.RecyclerView_android_descendantFocusability, -1);
@@ -716,6 +720,10 @@
if (Build.VERSION.SDK_INT >= 21) {
a = context.obtainStyledAttributes(attrs, NESTED_SCROLLING_ATTRS,
defStyle, defStyleRes);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, NESTED_SCROLLING_ATTRS, attrs, a, defStyle, defStyleRes);
+ }
nestedScrollingEnabled = a.getBoolean(0, true);
a.recycle();
}
diff --git a/samples/BiometricDemos/src/main/java/com/example/android/biometric/BiometricPromptDemo.java b/samples/BiometricDemos/src/main/java/com/example/android/biometric/BiometricPromptDemo.java
index 0a30f48..a72da9a 100644
--- a/samples/BiometricDemos/src/main/java/com/example/android/biometric/BiometricPromptDemo.java
+++ b/samples/BiometricDemos/src/main/java/com/example/android/biometric/BiometricPromptDemo.java
@@ -16,6 +16,7 @@
package com.example.android.biometric;
+import android.hardware.biometrics.BiometricManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -28,6 +29,7 @@
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
+import android.widget.RadioGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
@@ -66,25 +68,30 @@
private static final String TAG = "BiometricPromptDemo";
- private static final String KEY_SAVED_USE_CRYPTO = "saved_use_crypto_state";
- private static final String KEY_SAVED_RADIO = "saved_radio_state";
- private static final String KEY_SAVED_FAILURES = "saved_failures_state";
private static final String KEY_COUNTER = "saved_counter";
private static final String DEFAULT_KEY_NAME = "default_key";
+ private static final String BIOMETRIC_SUCCESS_MESSAGE = "BIOMETRIC_SUCCESS_MESSAGE";
+ private static final String BIOMETRIC_ERROR_HW_UNAVAILABLE_MESSAGE =
+ "BIOMETRIC_ERROR_HW_UNAVAILABLE";
+ private static final String BIOMETRIC_ERROR_NONE_ENROLLED_MESSAGE =
+ "BIOMETRIC_ERROR_NONE_ENROLLED";
+ private static final String BIOMETRIC_ERROR_UNKNOWN = "Error unknown return result";
+
private static final int MODE_NONE = 0;
private static final int MODE_PERSIST_ACROSS_CONFIGURATION_CHANGES = 1;
private static final int MODE_CANCEL_ON_CONFIGURATION_CHANGE = 2;
private static final int MODE_CANCEL_AFTER_THREE_FAILURES = 3;
- private int mMode = MODE_NONE;
- private boolean mUseCrypto;
-
private Handler mHandler = new Handler(Looper.getMainLooper());
private KeyStore mKeyStore;
private BiometricPrompt mBiometricPrompt;
+ private CheckBox mUseCryptoCheckbox;
+ private CheckBox mConfirmationRequiredCheckbox;
+ private CheckBox mDeviceCredentialAllowedCheckbox;
+
private int mCounter;
private int mNumberFailedAttempts;
@@ -128,7 +135,7 @@
mNumberFailedAttempts++;
// Cancel authentication after 3 failed attempts to test the cancel() method.
- if (mMode == MODE_CANCEL_AFTER_THREE_FAILURES && mNumberFailedAttempts == 3) {
+ if (getMode() == MODE_CANCEL_AFTER_THREE_FAILURES && mNumberFailedAttempts == 3) {
mBiometricPrompt.cancelAuthentication();
}
}
@@ -139,9 +146,6 @@
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
- mUseCrypto = savedInstanceState.getBoolean(KEY_SAVED_USE_CRYPTO);
- mMode = savedInstanceState.getInt(KEY_SAVED_RADIO);
- mNumberFailedAttempts = savedInstanceState.getInt(KEY_SAVED_FAILURES);
mCounter = savedInstanceState.getInt(KEY_COUNTER);
}
@@ -150,7 +154,12 @@
final Button buttonCreateKeys;
buttonCreateKeys = findViewById(R.id.button_enable_biometric_with_crypto);
final Button buttonAuthenticate;
+ final Button canAuthenticate;
buttonAuthenticate = findViewById(R.id.button_authenticate);
+ canAuthenticate = findViewById(R.id.can_authenticate);
+ mUseCryptoCheckbox = findViewById(R.id.checkbox_use_crypto);
+ mConfirmationRequiredCheckbox = findViewById(R.id.checkbox_require_confirmation);
+ mDeviceCredentialAllowedCheckbox = findViewById(R.id.checkbox_enable_fallback);
try {
mKeyStore = KeyStore.getInstance("AndroidKeyStore");
@@ -158,7 +167,7 @@
throw new RuntimeException("Failed to get an instance of KeyStore", e);
}
- if (!mUseCrypto) {
+ if (!useCrypto()) {
buttonCreateKeys.setVisibility(View.GONE);
} else {
buttonCreateKeys.setVisibility(View.VISIBLE);
@@ -168,11 +177,43 @@
buttonCreateKeys.setOnClickListener(v -> enableBiometricWithCrypto());
}
buttonAuthenticate.setOnClickListener(v -> startAuthentication());
+
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
+ mConfirmationRequiredCheckbox.setEnabled(false);
+ mConfirmationRequiredCheckbox.setChecked(false);
+ }
+ if (Build.VERSION.SDK_INT >= 29) {
+ canAuthenticate.setOnClickListener(v -> {
+ BiometricManager bm = getApplicationContext().getSystemService(
+ BiometricManager.class);
+ String message;
+ switch (bm.canAuthenticate()) {
+ case BiometricManager.BIOMETRIC_SUCCESS:
+ message = BIOMETRIC_SUCCESS_MESSAGE;
+ break;
+ case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
+ message = BIOMETRIC_ERROR_HW_UNAVAILABLE_MESSAGE;
+ break;
+ case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
+ message = BIOMETRIC_ERROR_NONE_ENROLLED_MESSAGE;
+ break;
+ default:
+ message = BIOMETRIC_ERROR_UNKNOWN;
+ }
+ Toast.makeText(getApplicationContext(), "canAuthenticate : " + message,
+ Toast.LENGTH_SHORT).show();
+ });
+ } else {
+ mDeviceCredentialAllowedCheckbox.setEnabled(false);
+ mDeviceCredentialAllowedCheckbox.setChecked(false);
+ canAuthenticate.setVisibility(View.GONE);
+ }
+
}
@Override
protected void onPause() {
- if (mMode == MODE_CANCEL_ON_CONFIGURATION_CHANGE) {
+ if (getMode() == MODE_CANCEL_ON_CONFIGURATION_CHANGE) {
mBiometricPrompt.cancelAuthentication();
}
super.onPause();
@@ -192,53 +233,9 @@
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- outState.putBoolean(KEY_SAVED_USE_CRYPTO, mUseCrypto);
- outState.putInt(KEY_SAVED_RADIO, mMode);
- outState.putInt(KEY_SAVED_FAILURES, mNumberFailedAttempts);
outState.putInt(KEY_COUNTER, mCounter);
}
- /**
- * Callback when the radio buttons are clicked.
- * @param view
- */
- public void onRadioButtonClicked(View view) {
- mNumberFailedAttempts = 0;
-
- switch(view.getId()) {
- case R.id.radio_persist_across_configuration_changes:
- mMode = MODE_PERSIST_ACROSS_CONFIGURATION_CHANGES;
- break;
- case R.id.radio_cancel_on_configuration_change:
- mMode = MODE_CANCEL_ON_CONFIGURATION_CHANGE;
- break;
- case R.id.radio_cancel_after_three_failures:
- mMode = MODE_CANCEL_AFTER_THREE_FAILURES;
- break;
- }
- }
-
- /**
- * Callback when the checkbox is clicked.
- * @param view
- */
- public void onCheckboxClicked(View view) {
- boolean checked = ((CheckBox) view).isChecked();
-
- switch(view.getId()) {
- case R.id.checkbox_use_crypto:
- if (checked) {
- findViewById(R.id.button_enable_biometric_with_crypto)
- .setVisibility(View.VISIBLE);
- } else {
- findViewById(R.id.button_enable_biometric_with_crypto)
- .setVisibility(View.GONE);
- }
- mUseCrypto = checked;
- break;
- }
- }
-
@RequiresApi(Build.VERSION_CODES.M)
private void enableBiometricWithCrypto() {
// Create the key, this is usually done when the user allows Biometric
@@ -252,25 +249,34 @@
}
private void startAuthentication() {
- if (mMode == MODE_NONE) {
+ if (getMode() == MODE_NONE) {
Toast.makeText(getApplicationContext(), "Select a test first", Toast.LENGTH_SHORT)
.show();
return;
}
// Build the biometric prompt info
- BiometricPrompt.PromptInfo info =
- new BiometricPrompt.PromptInfo.Builder()
- .setTitle("Title " + mCounter)
- .setSubtitle("Subtitle " + mCounter)
- .setDescription(
- "Lorem ipsum dolor sit amet, consecte etur adipisicing elit. "
- + mCounter)
- .setNegativeButtonText("Negative Button " + mCounter)
- .build();
+ BiometricPrompt.PromptInfo.Builder builder = new BiometricPrompt.PromptInfo.Builder()
+ .setTitle("Title " + mCounter)
+ .setSubtitle("Subtitle " + mCounter)
+ .setDescription(
+ "Lorem ipsum dolor sit amet, consecte etur adipisicing elit. "
+ + mCounter)
+ .setConfirmationRequired(mConfirmationRequiredCheckbox.isChecked());
+
+ if (Build.VERSION.SDK_INT >= 29) {
+ if (mDeviceCredentialAllowedCheckbox.isChecked()) {
+ builder.setDeviceCredentialAllowed(true);
+ } else {
+ builder.setNegativeButtonText("Negative Button " + mCounter);
+ }
+ } else {
+ builder.setNegativeButtonText("Negative Button " + mCounter);
+ }
+ BiometricPrompt.PromptInfo info = builder.build();
mCounter++;
- if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M && mUseCrypto) {
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M && useCrypto()) {
try {
// Initialize the cipher. The cipher will be unlocked by KeyStore after the user has
// authenticated via biometrics.
@@ -357,4 +363,26 @@
throw new RuntimeException(e);
}
}
+
+ private boolean useCrypto() {
+ return mUseCryptoCheckbox.isChecked();
+ }
+
+ /**
+ * @return The currently selected configuration.
+ */
+ private int getMode() {
+ int id = ((RadioGroup) findViewById(R.id.radio_group)).getCheckedRadioButtonId();
+ switch (id) {
+ case R.id.radio_persist_across_configuration_changes:
+ return MODE_PERSIST_ACROSS_CONFIGURATION_CHANGES;
+ case R.id.radio_cancel_on_configuration_change:
+ return MODE_CANCEL_ON_CONFIGURATION_CHANGE;
+ case R.id.radio_cancel_after_three_failures:
+ return MODE_CANCEL_AFTER_THREE_FAILURES;
+ default:
+ return MODE_NONE;
+ }
+ }
+
}
diff --git a/samples/BiometricDemos/src/main/res/layout/fragment_activity.xml b/samples/BiometricDemos/src/main/res/layout/fragment_activity.xml
index 6d2c318..4853e972 100644
--- a/samples/BiometricDemos/src/main/res/layout/fragment_activity.xml
+++ b/samples/BiometricDemos/src/main/res/layout/fragment_activity.xml
@@ -28,19 +28,44 @@
android:text="@string/button_enable_biometric_with_crypto"/>
<Button
+ android:id="@+id/can_authenticate"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/button_can_authenticate"/>
+
+ <Button
android:id="@+id/button_authenticate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/button_authenticate"/>
- <CheckBox
- android:id="@+id/checkbox_use_crypto"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/checkbox_text_use_crypto"
- android:>
+ <LinearLayout android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <CheckBox
+ android:id="@+id/checkbox_use_crypto"
+ android:layout_weight="1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/checkbox_text_use_crypto"/>
+ <CheckBox
+ android:id="@+id/checkbox_require_confirmation"
+ android:layout_weight="1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/checkbox_text_require_confirmation"
+ android:checked="true"/>
+ <CheckBox
+ android:id="@+id/checkbox_enable_fallback"
+ android:layout_weight="1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/checkbox_text_allow_device_credential"/>
+ </LinearLayout>
+
<RadioGroup
+ android:id="@+id/radio_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
@@ -48,22 +73,19 @@
android:id="@+id/radio_persist_across_configuration_changes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/radio_text_persist_across_configuration_changes"
- android:>
+ android:text="@string/radio_text_persist_across_configuration_changes" />
<RadioButton
android:id="@+id/radio_cancel_on_configuration_change"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/radio_text_cancel_on_configuration_change"
- android:>
+ android:text="@string/radio_text_cancel_on_configuration_change" />
<RadioButton
android:id="@+id/radio_cancel_after_three_failures"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/radio_text_cancel_after_three_failures"
- android:>
+ android:text="@string/radio_text_cancel_after_three_failures" />
</RadioGroup>
diff --git a/samples/BiometricDemos/src/main/res/values/strings.xml b/samples/BiometricDemos/src/main/res/values/strings.xml
index e945842..5d0f03e 100644
--- a/samples/BiometricDemos/src/main/res/values/strings.xml
+++ b/samples/BiometricDemos/src/main/res/values/strings.xml
@@ -20,8 +20,11 @@
<string name="button_enable_biometric_with_crypto">Create keys (for crypto)</string>
<string name="button_authenticate">Authenticate</string>
+ <string name="button_can_authenticate">Can Authenticate</string>
<string name="checkbox_text_use_crypto">Use crypto</string>
+ <string name="checkbox_text_require_confirmation">Require confirmation</string>
+ <string name="checkbox_text_allow_device_credential">Allow Device Credential</string>
<string name="radio_text_persist_across_configuration_changes">Persist across configuration changes</string>
<string name="radio_text_cancel_on_configuration_change">Cancel when configuration changes</string>
diff --git a/settings.gradle b/settings.gradle
index bd8bb58..015a9ea 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -86,6 +86,7 @@
includeProject(":fragment", "fragment")
includeProject(":fragment-ktx", "fragment/ktx")
includeProject(":fragment-testing", "fragment/testing")
+includeProject(":fakeannotations", "fakeannotations")
includeProject(":gridlayout", "gridlayout")
includeProject(":heifwriter", "heifwriter")
includeProject(":interpolator", "interpolator")
diff --git a/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java b/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java
index 88df164..50429c5 100644
--- a/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java
+++ b/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java
@@ -22,7 +22,6 @@
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
-import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
@@ -400,6 +399,8 @@
}
}
+ @SuppressWarnings("deprecation")
+ // Remove suppression once b/120984816 is addressed.
private static boolean viewIsOpaque(View v) {
if (v.isOpaque()) {
return true;
@@ -962,6 +963,7 @@
dispatchOnPanelSlide(mSlideableView);
}
+ @SuppressWarnings("deprecation")
private void dimChildView(View v, float mag, int fadeColor) {
final LayoutParams lp = (LayoutParams) v.getLayoutParams();
@@ -972,7 +974,8 @@
if (lp.dimPaint == null) {
lp.dimPaint = new Paint();
}
- lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_OVER));
+ lp.dimPaint.setColorFilter(new android.graphics.PorterDuffColorFilter(
+ color, PorterDuff.Mode.SRC_OVER));
if (v.getLayerType() != View.LAYER_TYPE_HARDWARE) {
v.setLayerType(View.LAYER_TYPE_HARDWARE, lp.dimPaint);
}
diff --git a/swiperefreshlayout/src/main/java/androidx/swiperefreshlayout/widget/CircularProgressDrawable.java b/swiperefreshlayout/src/main/java/androidx/swiperefreshlayout/widget/CircularProgressDrawable.java
index d397f84..1aeeeb9 100644
--- a/swiperefreshlayout/src/main/java/androidx/swiperefreshlayout/widget/CircularProgressDrawable.java
+++ b/swiperefreshlayout/src/main/java/androidx/swiperefreshlayout/widget/CircularProgressDrawable.java
@@ -429,6 +429,8 @@
}
@Override
+ @SuppressWarnings("deprecation")
+ // Remove suppression was b/120985527 is addressed.
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
diff --git a/testutils/src/main/java/androidx/testutils/LocaleTestUtils.kt b/testutils/src/main/java/androidx/testutils/LocaleTestUtils.kt
index e2e4c4e..90a4e4f 100644
--- a/testutils/src/main/java/androidx/testutils/LocaleTestUtils.kt
+++ b/testutils/src/main/java/androidx/testutils/LocaleTestUtils.kt
@@ -201,7 +201,7 @@
val newConfig = Configuration(resources.configuration)
when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ->
- newConfig.locales = locales.unwrap() as LocaleList
+ newConfig.setLocales(locales.unwrap() as LocaleList)
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ->
newConfig.setLocale(locales.get(0))
else ->
diff --git a/textclassifier/api/1.0.0-alpha03.txt b/textclassifier/api/1.0.0-alpha03.txt
index c37c7d2..a002b70 100644
--- a/textclassifier/api/1.0.0-alpha03.txt
+++ b/textclassifier/api/1.0.0-alpha03.txt
@@ -104,18 +104,18 @@
public static final class TextClassifier.EntityConfig {
method public static androidx.textclassifier.TextClassifier.EntityConfig createFromBundle(android.os.Bundle);
method public java.util.Collection<java.lang.String> getHints();
- method public java.util.Collection<java.lang.String>! resolveEntityTypes(java.util.Collection<java.lang.String>?);
- method public boolean shouldIncludeDefaultEntityTypes();
+ method public java.util.Collection<java.lang.String>! resolveTypes(java.util.Collection<java.lang.String>?);
+ method public boolean shouldIncludeTypesFromTextClassifier();
method public android.os.Bundle toBundle();
}
public static final class TextClassifier.EntityConfig.Builder {
ctor public TextClassifier.EntityConfig.Builder();
method public androidx.textclassifier.TextClassifier.EntityConfig build();
- method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! setExcludedEntityTypes(java.util.Collection<java.lang.String>?);
+ method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! includeTypesFromTextClassifier(boolean);
+ method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! setExcludedTypes(java.util.Collection<java.lang.String>?);
method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! setHints(java.util.Collection<java.lang.String>?);
- method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! setIncludeDefaultEntityTypes(boolean);
- method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! setIncludedEntityTypes(java.util.Collection<java.lang.String>?);
+ method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! setIncludedTypes(java.util.Collection<java.lang.String>?);
}
public final class TextLinks {
diff --git a/textclassifier/api/current.txt b/textclassifier/api/current.txt
index c37c7d2..a002b70 100644
--- a/textclassifier/api/current.txt
+++ b/textclassifier/api/current.txt
@@ -104,18 +104,18 @@
public static final class TextClassifier.EntityConfig {
method public static androidx.textclassifier.TextClassifier.EntityConfig createFromBundle(android.os.Bundle);
method public java.util.Collection<java.lang.String> getHints();
- method public java.util.Collection<java.lang.String>! resolveEntityTypes(java.util.Collection<java.lang.String>?);
- method public boolean shouldIncludeDefaultEntityTypes();
+ method public java.util.Collection<java.lang.String>! resolveTypes(java.util.Collection<java.lang.String>?);
+ method public boolean shouldIncludeTypesFromTextClassifier();
method public android.os.Bundle toBundle();
}
public static final class TextClassifier.EntityConfig.Builder {
ctor public TextClassifier.EntityConfig.Builder();
method public androidx.textclassifier.TextClassifier.EntityConfig build();
- method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! setExcludedEntityTypes(java.util.Collection<java.lang.String>?);
+ method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! includeTypesFromTextClassifier(boolean);
+ method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! setExcludedTypes(java.util.Collection<java.lang.String>?);
method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! setHints(java.util.Collection<java.lang.String>?);
- method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! setIncludeDefaultEntityTypes(boolean);
- method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! setIncludedEntityTypes(java.util.Collection<java.lang.String>?);
+ method public androidx.textclassifier.TextClassifier.EntityConfig.Builder! setIncludedTypes(java.util.Collection<java.lang.String>?);
}
public final class TextLinks {
diff --git a/textclassifier/src/androidTest/java/androidx/textclassifier/LegacyTextClassifierTest.java b/textclassifier/src/androidTest/java/androidx/textclassifier/LegacyTextClassifierTest.java
index c8de61e..3ebbd8c 100644
--- a/textclassifier/src/androidTest/java/androidx/textclassifier/LegacyTextClassifierTest.java
+++ b/textclassifier/src/androidTest/java/androidx/textclassifier/LegacyTextClassifierTest.java
@@ -270,7 +270,7 @@
private TextLinks.Request createTextLinksRequest(String text, List<String> entityTypes) {
TextClassifier.EntityConfig entityConfig =
new TextClassifier.EntityConfig.Builder()
- .setIncludedEntityTypes(entityTypes)
+ .setIncludedTypes(entityTypes)
.build();
return new TextLinks.Request.Builder(text).setEntityConfig(entityConfig).build();
}
diff --git a/textclassifier/src/androidTest/java/androidx/textclassifier/TextClassifierTest.java b/textclassifier/src/androidTest/java/androidx/textclassifier/TextClassifierTest.java
index 5b00ad0..0b962c8 100644
--- a/textclassifier/src/androidTest/java/androidx/textclassifier/TextClassifierTest.java
+++ b/textclassifier/src/androidTest/java/androidx/textclassifier/TextClassifierTest.java
@@ -27,6 +27,7 @@
import org.junit.runner.RunWith;
import java.util.Arrays;
+import java.util.Collections;
/** Instrumentation unit tests for {@link TextClassifier}. */
@SmallTest
@@ -42,8 +43,8 @@
TextClassifier.EntityConfig.createFromBundle(entityConfig.toBundle());
assertThat(entityConfig.getHints()).containsExactly("a", "b");
- assertThat(entityConfig.shouldIncludeDefaultEntityTypes()).isTrue();
- assertThat(entityConfigFromBundle.resolveEntityTypes(Arrays.asList("default")))
+ assertThat(entityConfig.shouldIncludeTypesFromTextClassifier()).isTrue();
+ assertThat(entityConfigFromBundle.resolveTypes(Arrays.asList("default")))
.containsExactly("default");
}
@@ -51,32 +52,32 @@
public void testEntityConfig_withIncludedExcludedAndHints() {
TextClassifier.EntityConfig entityConfig = new Builder()
.setHints(Arrays.asList("hints"))
- .setIncludedEntityTypes(Arrays.asList("included", "overlap"))
- .setExcludedEntityTypes(Arrays.asList("excluded", "overlap"))
+ .setIncludedTypes(Arrays.asList("included", "overlap"))
+ .setExcludedTypes(Arrays.asList("excluded", "overlap"))
.build();
TextClassifier.EntityConfig entityConfigFromBundle =
TextClassifier.EntityConfig.createFromBundle(entityConfig.toBundle());
assertThat(entityConfigFromBundle.getHints()).containsExactly("hints");
- assertThat(entityConfigFromBundle.shouldIncludeDefaultEntityTypes()).isTrue();
- assertThat(entityConfigFromBundle.resolveEntityTypes(Arrays.asList("default", "excluded")))
+ assertThat(entityConfigFromBundle.shouldIncludeTypesFromTextClassifier()).isTrue();
+ assertThat(entityConfigFromBundle.resolveTypes(Arrays.asList("default", "excluded")))
.containsExactly("default", "included");
}
@Test
public void testEntityConfig_setUseDefaultEntityTypes() {
TextClassifier.EntityConfig entityConfig = new Builder()
- .setIncludeDefaultEntityTypes(false)
- .setIncludedEntityTypes(Arrays.asList("included"))
+ .includeTypesFromTextClassifier(false)
+ .setIncludedTypes(Arrays.asList("included"))
.build();
TextClassifier.EntityConfig entityConfigFromBundle =
TextClassifier.EntityConfig.createFromBundle(entityConfig.toBundle());
assertThat(entityConfig.getHints()).isEmpty();
- assertThat(entityConfig.shouldIncludeDefaultEntityTypes()).isFalse();
- assertThat(entityConfigFromBundle.resolveEntityTypes(
+ assertThat(entityConfig.shouldIncludeTypesFromTextClassifier()).isFalse();
+ assertThat(entityConfigFromBundle.resolveTypes(
Arrays.asList("default"))).containsExactly("included");
}
@@ -84,9 +85,9 @@
@SdkSuppress(minSdkVersion = 28)
public void testEntityConfig_toPlatform_explicit() {
TextClassifier.EntityConfig entityConfig = new Builder()
- .setIncludeDefaultEntityTypes(false)
- .setIncludedEntityTypes(Arrays.asList("included", "excluded"))
- .setExcludedEntityTypes(Arrays.asList("excluded"))
+ .includeTypesFromTextClassifier(false)
+ .setIncludedTypes(Arrays.asList("included", "excluded"))
+ .setExcludedTypes(Arrays.asList("excluded"))
.build();
android.view.textclassifier.TextClassifier.EntityConfig platformEntityConfig =
@@ -101,8 +102,8 @@
@SdkSuppress(minSdkVersion = 28)
public void testEntityConfig_toPlatform_withDefault() {
TextClassifier.EntityConfig entityConfig = new Builder()
- .setIncludedEntityTypes(Arrays.asList("included", "excluded"))
- .setExcludedEntityTypes(Arrays.asList("excluded"))
+ .setIncludedTypes(Arrays.asList("included", "excluded"))
+ .setExcludedTypes(Arrays.asList("excluded"))
.setHints(Arrays.asList("hint"))
.build();
@@ -113,4 +114,95 @@
assertThat(platformEntityConfig.resolveEntityListModifications(Arrays.asList("extra")))
.containsExactly("included", "extra");
}
+
+ @Test
+ @SdkSuppress(minSdkVersion = 28)
+ public void testEntityConfig_fromPlatform_createWithHints() {
+ android.view.textclassifier.TextClassifier.EntityConfig platformEntityConfig =
+ android.view.textclassifier.TextClassifier.EntityConfig.createWithHints(
+ Collections.singletonList("hints"));
+
+ TextClassifier.EntityConfig entityConfig =
+ TextClassifier.EntityConfig.fromPlatform(platformEntityConfig);
+
+
+ assertThat(entityConfig.getHints()).containsExactly("hints");
+ assertThat(entityConfig.shouldIncludeTypesFromTextClassifier()).isTrue();
+ assertThat(entityConfig.resolveTypes(Collections.singleton("default")))
+ .containsExactly("default");
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = 28)
+ public void testEntityConfig_fromPlatform_createWithExplicitEntityList() {
+ android.view.textclassifier.TextClassifier.EntityConfig platformEntityConfig =
+ android.view.textclassifier.TextClassifier.EntityConfig
+ .createWithExplicitEntityList(
+ Collections.singletonList("explicit"));
+
+ TextClassifier.EntityConfig entityConfig =
+ TextClassifier.EntityConfig.fromPlatform(platformEntityConfig);
+
+
+ assertThat(entityConfig.getHints()).isEmpty();
+ assertThat(entityConfig.shouldIncludeTypesFromTextClassifier()).isFalse();
+ assertThat(entityConfig.resolveTypes(Collections.singleton("default")))
+ .containsExactly("explicit");
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = 28)
+ public void testEntityConfig_fromPlatform_create() {
+ android.view.textclassifier.TextClassifier.EntityConfig platformEntityConfig =
+ android.view.textclassifier.TextClassifier.EntityConfig.create(
+ Collections.singleton("hints"),
+ Collections.singleton("included"),
+ Collections.singleton("excluded"));
+
+ TextClassifier.EntityConfig entityConfig =
+ TextClassifier.EntityConfig.fromPlatform(platformEntityConfig);
+
+ assertThat(entityConfig.getHints()).containsExactly("hints");
+ assertThat(entityConfig.shouldIncludeTypesFromTextClassifier()).isTrue();
+ assertThat(entityConfig.resolveTypes(Arrays.asList("default", "excluded")))
+ .containsExactly("default", "included");
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = 29)
+ public void testEntityConfig_fromPlatform_builder() {
+ android.view.textclassifier.TextClassifier.EntityConfig platformEntityConfig =
+ new android.view.textclassifier.TextClassifier.EntityConfig.Builder()
+ .setIncludedTypes(Collections.singleton("included"))
+ .setExcludedTypes(Collections.singleton("excluded"))
+ .setHints(Collections.singleton("hints"))
+ .build();
+
+ TextClassifier.EntityConfig entityConfig =
+ TextClassifier.EntityConfig.fromPlatform(platformEntityConfig);
+
+ assertThat(entityConfig.getHints()).containsExactly("hints");
+ assertThat(entityConfig.shouldIncludeTypesFromTextClassifier()).isTrue();
+ assertThat(entityConfig.resolveTypes(Arrays.asList("default", "excluded")))
+ .containsExactly("default", "included");
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = 28)
+ public void testEntityConfig_fromPlatform_bundle() {
+ android.view.textclassifier.TextClassifier.EntityConfig platformEntityConfig =
+ android.view.textclassifier.TextClassifier.EntityConfig.create(
+ Collections.singleton("hints"),
+ Collections.singleton("included"),
+ Collections.singleton("excluded"));
+
+ TextClassifier.EntityConfig entityConfig =
+ TextClassifier.EntityConfig.createFromBundle(
+ TextClassifier.EntityConfig.fromPlatform(platformEntityConfig).toBundle());
+
+ assertThat(entityConfig.getHints()).containsExactly("hints");
+ assertThat(entityConfig.shouldIncludeTypesFromTextClassifier()).isTrue();
+ assertThat(entityConfig.resolveTypes(Arrays.asList("default", "excluded")))
+ .containsExactly("default", "included");
+ }
}
diff --git a/textclassifier/src/androidTest/java/androidx/textclassifier/TextLinksTest.java b/textclassifier/src/androidTest/java/androidx/textclassifier/TextLinksTest.java
index 2d428ca..74fa984 100644
--- a/textclassifier/src/androidTest/java/androidx/textclassifier/TextLinksTest.java
+++ b/textclassifier/src/androidTest/java/androidx/textclassifier/TextLinksTest.java
@@ -27,6 +27,7 @@
import android.content.Context;
import android.os.Bundle;
+import android.os.LocaleList;
import android.text.Spannable;
import android.text.SpannableString;
@@ -117,7 +118,7 @@
assertEquals(FULL_TEXT, result.getText());
assertEquals(LANGUAGE_TAGS, result.getDefaultLocales().toLanguageTags());
assertThat(result.getEntityConfig().getHints()).containsExactly("hints");
- assertThat(result.getEntityConfig().resolveEntityTypes(
+ assertThat(result.getEntityConfig().resolveTypes(
Arrays.asList("default", "excluded")))
.containsExactly("included", "default");
assertThat(result.getReferenceTime()).isEqualTo(REFERENCE_TIME);
@@ -150,6 +151,28 @@
@Test
@SdkSuppress(minSdkVersion = 28)
+ public void testFromPlatformRequest() {
+ android.view.textclassifier.TextClassifier.EntityConfig entityConfig =
+ android.view.textclassifier.TextClassifier.EntityConfig.create(
+ Collections.singleton("hints"),
+ Collections.singleton("include"),
+ Collections.singleton("exclude"));
+ android.view.textclassifier.TextLinks.Request platformRequest =
+ new android.view.textclassifier.TextLinks.Request.Builder(FULL_TEXT)
+ .setDefaultLocales(LocaleList.forLanguageTags(LANGUAGE_TAGS))
+ .setEntityConfig(entityConfig)
+ .build();
+
+ TextLinks.Request request = TextLinks.Request.fromPlatform(platformRequest);
+ assertThat(request.getText()).isEqualTo(FULL_TEXT);
+ assertThat(request.getDefaultLocales().toLanguageTags()).isEqualTo(LANGUAGE_TAGS);
+ assertThat(request.getEntityConfig().getHints()).containsExactly("hints");
+ assertThat(request.getEntityConfig().resolveTypes(Arrays.asList("default", "exclude")))
+ .containsExactly("include", "default");
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = 28)
public void testConvertFromPlatformTextLinks() {
final android.view.textclassifier.TextLinks platformTextLinks =
new android.view.textclassifier.TextLinks.Builder(FULL_TEXT.toString())
@@ -162,6 +185,21 @@
}
@Test
+ @SdkSuppress(minSdkVersion = 28)
+ public void testConvertToPlatformTextLinks() {
+ final TextLinks textLinks =
+ new TextLinks.Builder(FULL_TEXT.toString())
+ .addLink(0, 4, getEntityScores(0.f, 0.f, 1.f))
+ .addLink(5, 12, getEntityScores(.8f, .1f, .5f))
+ .build();
+
+ android.view.textclassifier.TextLinks platformTextLinks = textLinks.toPlatform();
+ TextLinks recovered = TextLinks.fromPlatform(platformTextLinks, FULL_TEXT);
+
+ assertTextLinks(recovered);
+ }
+
+ @Test
public void testApply_spannable_no_link() {
SpannableString text = new SpannableString(FULL_TEXT);
TextLinks textLinks = new TextLinks.Builder(text).build();
@@ -204,8 +242,8 @@
private TextLinks.Request.Builder createTextLinksRequest() {
EntityConfig entityConfig = new EntityConfig.Builder()
- .setIncludedEntityTypes(Arrays.asList("included"))
- .setExcludedEntityTypes(Arrays.asList("excluded"))
+ .setIncludedTypes(Arrays.asList("included"))
+ .setExcludedTypes(Arrays.asList("excluded"))
.setHints(Arrays.asList("hints"))
.build();
diff --git a/textclassifier/src/main/java/androidx/textclassifier/LegacyTextClassifier.java b/textclassifier/src/main/java/androidx/textclassifier/LegacyTextClassifier.java
index 387b8b9..7191aa1 100644
--- a/textclassifier/src/main/java/androidx/textclassifier/LegacyTextClassifier.java
+++ b/textclassifier/src/main/java/androidx/textclassifier/LegacyTextClassifier.java
@@ -120,7 +120,7 @@
/** @inheritDoc */
public TextLinks generateLinks(@NonNull TextLinks.Request request) {
final Collection<String> entityTypes = request.getEntityConfig()
- .resolveEntityTypes(DEFAULT_ENTITY_TYPES);
+ .resolveTypes(DEFAULT_ENTITY_TYPES);
final String requestText = request.getText().toString();
final TextLinks.Builder builder = new TextLinks.Builder(requestText);
for (String entityType : entityTypes) {
diff --git a/textclassifier/src/main/java/androidx/textclassifier/PlatformEntityConfigWrapper.java b/textclassifier/src/main/java/androidx/textclassifier/PlatformEntityConfigWrapper.java
new file mode 100644
index 0000000..ffed95b
--- /dev/null
+++ b/textclassifier/src/main/java/androidx/textclassifier/PlatformEntityConfigWrapper.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.textclassifier;
+
+import android.os.Build;
+import android.os.Bundle;
+import android.view.textclassifier.TextClassifier;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
+import androidx.core.util.Preconditions;
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Wraps {@link TextClassifier.EntityConfig}.
+ */
+@RequiresApi(28)
+final class PlatformEntityConfigWrapper {
+ private static final String KEY_PLATFORM_ENTITY_CONFIG = "platform_entity_config";
+
+ private final BaseImpl mImpl;
+
+ PlatformEntityConfigWrapper(@NonNull TextClassifier.EntityConfig platformEntityConfig) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ mImpl = new Api29Impl(platformEntityConfig);
+ } else {
+ mImpl = new BaseImpl(platformEntityConfig);
+ }
+ }
+
+ Collection<String> resolveEntityTypes(
+ @Nullable Collection<String> defaultEntityTypes) {
+ return mImpl.resolveEntityTypes(defaultEntityTypes);
+ }
+
+ @NonNull
+ Collection<String> getHints() {
+ return mImpl.getHints();
+ }
+
+ boolean shouldIncludeDefaultEntityTypes() {
+ return mImpl.shouldIncludeDefaultEntityTypes();
+ }
+
+ @NonNull
+ Bundle toBundle() {
+ Bundle bundle = new Bundle();
+ bundle.putParcelable(KEY_PLATFORM_ENTITY_CONFIG, mImpl.mPlatformEntityConfig);
+ return bundle;
+ }
+
+ @Nullable
+ static PlatformEntityConfigWrapper createFromBundle(@Nullable Bundle bundle) {
+ if (bundle == null) {
+ return null;
+ }
+ TextClassifier.EntityConfig entityConfig = bundle.getParcelable(KEY_PLATFORM_ENTITY_CONFIG);
+ if (entityConfig == null) {
+ return null;
+ }
+ return new PlatformEntityConfigWrapper(entityConfig);
+ }
+
+ @RequiresApi(28)
+ private static class BaseImpl {
+ TextClassifier.EntityConfig mPlatformEntityConfig;
+
+ BaseImpl(@NonNull TextClassifier.EntityConfig platformEntityConfig) {
+ mPlatformEntityConfig = Preconditions.checkNotNull(platformEntityConfig);
+ }
+
+ Collection<String> resolveEntityTypes(
+ @Nullable Collection<String> defaultEntityTypes) {
+ return mPlatformEntityConfig.resolveEntityListModifications(
+ defaultEntityTypes == null
+ ? Collections.<String>emptyList()
+ : defaultEntityTypes);
+ }
+
+ @NonNull
+ Collection<String> getHints() {
+ return mPlatformEntityConfig.getHints();
+ }
+
+ boolean shouldIncludeDefaultEntityTypes() {
+ return !mPlatformEntityConfig.getHints().isEmpty();
+ }
+ }
+
+ @RequiresApi(29)
+ private static final class Api29Impl extends BaseImpl {
+
+ Api29Impl(@NonNull TextClassifier.EntityConfig platformEntityConfig) {
+ super(platformEntityConfig);
+ }
+
+ @Override
+ boolean shouldIncludeDefaultEntityTypes() {
+ return mPlatformEntityConfig.shouldIncludeTypesFromTextClassifier();
+ }
+ }
+}
diff --git a/textclassifier/src/main/java/androidx/textclassifier/TextClassifier.java b/textclassifier/src/main/java/androidx/textclassifier/TextClassifier.java
index 0c4e828..30665df 100644
--- a/textclassifier/src/main/java/androidx/textclassifier/TextClassifier.java
+++ b/textclassifier/src/main/java/androidx/textclassifier/TextClassifier.java
@@ -16,6 +16,7 @@
package androidx.textclassifier;
+import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
@@ -33,6 +34,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.List;
import java.util.Set;
/**
@@ -242,44 +244,59 @@
private static final String EXTRA_INCLUDED_ENTITY_TYPES = "included";
private static final String EXTRA_INCLUDE_ENTITY_TYPES_FROM_TC =
"include_entity_types_from_tc";
+ private static final String EXTRA_PLATFORM_ENTITY_CONFIG = "platform_entity_config";
- private final Collection<String> mHints;
- private final Collection<String> mExcludedEntityTypes;
- private final Collection<String> mIncludedEntityTypes;
- private final boolean mIncludeDefaultEntityTypes;
+ private final List<String> mHints;
+ private final List<String> mExcludedTypes;
+ private final List<String> mIncludedTypes;
+ private final boolean mIncludeTypesFromTextClassifier;
+ private final PlatformEntityConfigWrapper mPlatformEntityConfigWrapper;
EntityConfig(
- Collection<String> includedEntityTypes,
- Collection<String> excludedEntityTypes,
+ Collection<String> includedTypes,
+ Collection<String> excludedTypes,
Collection<String> hints,
- boolean includeDefaultEntityTypes) {
- mIncludedEntityTypes = includedEntityTypes == null
- ? Collections.<String>emptyList() : new ArraySet<>(includedEntityTypes);
- mExcludedEntityTypes = excludedEntityTypes == null
- ? Collections.<String>emptyList() : new ArraySet<>(excludedEntityTypes);
+ boolean includeTypesFromTextClassifier,
+ @Nullable PlatformEntityConfigWrapper platformEntityConfigWrapper) {
+ mIncludedTypes = includedTypes == null
+ ? Collections.<String>emptyList() : new ArrayList<>(includedTypes);
+ mExcludedTypes = excludedTypes == null
+ ? Collections.<String>emptyList() : new ArrayList<>(excludedTypes);
mHints = hints == null
? Collections.<String>emptyList()
- : Collections.unmodifiableCollection(new ArraySet<>(hints));
- mIncludeDefaultEntityTypes = includeDefaultEntityTypes;
+ : new ArrayList<>(hints);
+ mIncludeTypesFromTextClassifier = includeTypesFromTextClassifier;
+ mPlatformEntityConfigWrapper = platformEntityConfigWrapper;
+ }
+
+ /**
+ * Creates an androidX {@link EntityConfig} object by wrapping the platform
+ * {@link android.view.textclassifier.TextClassifier.EntityConfig} object.
+ */
+ private EntityConfig(@NonNull PlatformEntityConfigWrapper platformEntityConfigWrapper) {
+ this(null, null, null, false, Preconditions.checkNotNull(platformEntityConfigWrapper));
}
/**
* Returns a final list of entity types that the text classifier should look for.
* <p>NOTE: This method is intended for use by text classifier.
*
- * @param defaultEntityTypes entity types the text classifier thinks should be included
+ * @param typesFromTextClassifier entity types the text classifier thinks should be included
* before factoring in the included/excluded entity types given
* by the client.
*/
- public Collection<String> resolveEntityTypes(
- @Nullable Collection<String> defaultEntityTypes) {
- Set<String> entityTypes = new ArraySet<>();
- if (mIncludeDefaultEntityTypes && defaultEntityTypes != null) {
- entityTypes.addAll(defaultEntityTypes);
+ public Collection<String> resolveTypes(
+ @Nullable Collection<String> typesFromTextClassifier) {
+ if (mPlatformEntityConfigWrapper != null && Build.VERSION.SDK_INT >= 28) {
+ return mPlatformEntityConfigWrapper.resolveEntityTypes(typesFromTextClassifier);
}
- entityTypes.addAll(mIncludedEntityTypes);
- entityTypes.removeAll(mExcludedEntityTypes);
- return Collections.unmodifiableCollection(entityTypes);
+ Set<String> types = new ArraySet<>();
+ if (mIncludeTypesFromTextClassifier && typesFromTextClassifier != null) {
+ types.addAll(typesFromTextClassifier);
+ }
+ types.addAll(mIncludedTypes);
+ types.removeAll(mExcludedTypes);
+ return Collections.unmodifiableCollection(types);
}
/**
@@ -289,20 +306,26 @@
*/
@NonNull
public Collection<String> getHints() {
+ if (mPlatformEntityConfigWrapper != null && Build.VERSION.SDK_INT >= 28) {
+ return mPlatformEntityConfigWrapper.getHints();
+ }
return mHints;
}
/**
* Return whether the client allows the text classifier to include its own list of default
* entity types. If this functions returns {@code true}, text classifier can consider
- * to specify its own list in {@link #resolveEntityTypes(Collection)}.
+ * to specify its own list in {@link #resolveTypes(Collection)}.
*
* <p>NOTE: This method is intended for use by text classifier.
*
- * @see #resolveEntityTypes(Collection)
+ * @see #resolveTypes(Collection)
*/
- public boolean shouldIncludeDefaultEntityTypes() {
- return mIncludeDefaultEntityTypes;
+ public boolean shouldIncludeTypesFromTextClassifier() {
+ if (mPlatformEntityConfigWrapper != null && Build.VERSION.SDK_INT >= 28) {
+ return mPlatformEntityConfigWrapper.shouldIncludeDefaultEntityTypes();
+ }
+ return mIncludeTypesFromTextClassifier;
}
/**
@@ -313,12 +336,13 @@
public Bundle toBundle() {
final Bundle bundle = new Bundle();
bundle.putStringArrayList(EXTRA_HINTS, new ArrayList<>(mHints));
- bundle.putStringArrayList(EXTRA_INCLUDED_ENTITY_TYPES,
- new ArrayList<>(mIncludedEntityTypes));
- bundle.putStringArrayList(EXTRA_EXCLUDED_ENTITY_TYPES,
- new ArrayList<>(mExcludedEntityTypes));
- bundle.putBoolean(EXTRA_INCLUDE_ENTITY_TYPES_FROM_TC,
- mIncludeDefaultEntityTypes);
+ bundle.putStringArrayList(EXTRA_INCLUDED_ENTITY_TYPES, new ArrayList<>(mIncludedTypes));
+ bundle.putStringArrayList(EXTRA_EXCLUDED_ENTITY_TYPES, new ArrayList<>(mExcludedTypes));
+ bundle.putBoolean(EXTRA_INCLUDE_ENTITY_TYPES_FROM_TC, mIncludeTypesFromTextClassifier);
+ if (mPlatformEntityConfigWrapper != null && Build.VERSION.SDK_INT >= 28) {
+ bundle.putParcelable(
+ EXTRA_PLATFORM_ENTITY_CONFIG, mPlatformEntityConfigWrapper.toBundle());
+ }
return bundle;
}
@@ -327,11 +351,65 @@
*/
@NonNull
public static EntityConfig createFromBundle(@NonNull Bundle bundle) {
+ PlatformEntityConfigWrapper platformEntityConfigWrapper = null;
+ if (Build.VERSION.SDK_INT >= 28) {
+ platformEntityConfigWrapper = PlatformEntityConfigWrapper.createFromBundle(
+ bundle.getBundle(EXTRA_PLATFORM_ENTITY_CONFIG));
+ }
return new EntityConfig(
bundle.getStringArrayList(EXTRA_INCLUDED_ENTITY_TYPES),
bundle.getStringArrayList(EXTRA_EXCLUDED_ENTITY_TYPES),
bundle.getStringArrayList(EXTRA_HINTS),
- bundle.getBoolean(EXTRA_INCLUDE_ENTITY_TYPES_FROM_TC));
+ bundle.getBoolean(EXTRA_INCLUDE_ENTITY_TYPES_FROM_TC),
+ platformEntityConfigWrapper);
+ }
+
+ /** @hide */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ @RequiresApi(28)
+ @NonNull
+ public android.view.textclassifier.TextClassifier.EntityConfig toPlatform() {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return toPlatformQ();
+ }
+ return toPlatformP();
+ }
+
+ @RequiresApi(28)
+ private android.view.textclassifier.TextClassifier.EntityConfig toPlatformP() {
+ if (mIncludeTypesFromTextClassifier) {
+ return android.view.textclassifier.TextClassifier.EntityConfig.create(
+ mHints,
+ mIncludedTypes,
+ mExcludedTypes
+ );
+ }
+ Set<String> entitiesSet = new ArraySet<>(mIncludedTypes);
+ entitiesSet.removeAll(mExcludedTypes);
+ return android.view.textclassifier.TextClassifier.EntityConfig
+ .createWithExplicitEntityList(new ArrayList<>(entitiesSet));
+ }
+
+ @RequiresApi(29)
+ private android.view.textclassifier.TextClassifier.EntityConfig toPlatformQ() {
+ return new android.view.textclassifier.TextClassifier.EntityConfig.Builder()
+ .setIncludedTypes(mIncludedTypes)
+ .setExcludedTypes(mExcludedTypes)
+ .setHints(mHints)
+ .includeTypesFromTextClassifier(mIncludeTypesFromTextClassifier)
+ .build();
+ }
+
+ /** @hide */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ @RequiresApi(28)
+ @Nullable
+ public static EntityConfig fromPlatform(
+ @Nullable android.view.textclassifier.TextClassifier.EntityConfig entityConfig) {
+ if (entityConfig == null) {
+ return null;
+ }
+ return new EntityConfig(new PlatformEntityConfigWrapper(entityConfig));
}
/**
@@ -341,26 +419,24 @@
@Nullable
private Collection<String> mHints;
@Nullable
- private Collection<String> mExcludedEntityTypes;
+ private Collection<String> mExcludedTypes;
@Nullable
- private Collection<String> mIncludedEntityTypes;
- private boolean mIncludeDefaultEntityTypes = true;
+ private Collection<String> mIncludedTypes;
+ private boolean mIncludeTypesFromTextClassifier = true;
/**
* Sets a collection of entity types that are explicitly included.
*/
- public Builder setIncludedEntityTypes(
- @Nullable Collection<String> includedEntityTypes) {
- mIncludedEntityTypes = includedEntityTypes;
+ public Builder setIncludedTypes(@Nullable Collection<String> includedTypes) {
+ mIncludedTypes = includedTypes;
return this;
}
/**
* Sets a collection of entity types that are explicitly excluded.
*/
- public Builder setExcludedEntityTypes(
- @Nullable Collection<String> excludedEntityTypes) {
- mExcludedEntityTypes = excludedEntityTypes;
+ public Builder setExcludedTypes(@Nullable Collection<String> excludedTypes) {
+ mExcludedTypes = excludedTypes;
return this;
}
@@ -380,8 +456,8 @@
* Specifies to include the default entity types suggested by the text classifier. By
* default, it is included.
*/
- public Builder setIncludeDefaultEntityTypes(boolean includeDefaultEntityTypes) {
- mIncludeDefaultEntityTypes = includeDefaultEntityTypes;
+ public Builder includeTypesFromTextClassifier(boolean includeTypesFromTextClassifier) {
+ mIncludeTypesFromTextClassifier = includeTypesFromTextClassifier;
return this;
}
@@ -392,29 +468,12 @@
@NonNull
public EntityConfig build() {
return new EntityConfig(
- mIncludedEntityTypes,
- mExcludedEntityTypes,
+ mIncludedTypes,
+ mExcludedTypes,
mHints,
- mIncludeDefaultEntityTypes);
+ mIncludeTypesFromTextClassifier,
+ null);
}
}
-
- /** @hide */
- @RestrictTo(RestrictTo.Scope.LIBRARY)
- @RequiresApi(28)
- @NonNull
- public android.view.textclassifier.TextClassifier.EntityConfig toPlatform() {
- if (mIncludeDefaultEntityTypes) {
- return android.view.textclassifier.TextClassifier.EntityConfig.create(
- mHints,
- mIncludedEntityTypes,
- mExcludedEntityTypes
- );
- }
- Set<String> entitiesSet = new ArraySet<>(mIncludedEntityTypes);
- entitiesSet.removeAll(mExcludedEntityTypes);
- return android.view.textclassifier.TextClassifier.EntityConfig
- .createWithExplicitEntityList(new ArrayList<>(entitiesSet));
- }
}
}
diff --git a/textclassifier/src/main/java/androidx/textclassifier/TextLinks.java b/textclassifier/src/main/java/androidx/textclassifier/TextLinks.java
index 53c4ce6..6df0585 100644
--- a/textclassifier/src/main/java/androidx/textclassifier/TextLinks.java
+++ b/textclassifier/src/main/java/androidx/textclassifier/TextLinks.java
@@ -309,6 +309,11 @@
return bundle;
}
+ @NonNull
+ EntityConfidence getEntityScores() {
+ return mEntityScores;
+ }
+
/**
* Extracts a TextLink from a bundle that was added using {@link #toBundle()}.
*/
@@ -520,6 +525,19 @@
.setEntityConfig(toPlatformEntityConfig(getEntityConfig()))
.build();
}
+
+ /** @hide */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ @RequiresApi(28)
+ @NonNull
+ static TextLinks.Request fromPlatform(
+ @NonNull android.view.textclassifier.TextLinks.Request request) {
+ return new TextLinks.Request.Builder(request.getText())
+ .setDefaultLocales(ConvertUtils.wrapLocalList(request.getDefaultLocales()))
+ .setEntityConfig(
+ TextClassifier.EntityConfig.fromPlatform(request.getEntityConfig()))
+ .build();
+ }
}
/**
@@ -833,4 +851,20 @@
}
return builder.build();
}
+
+ /** @hide */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ @RequiresApi(28)
+ @NonNull
+ android.view.textclassifier.TextLinks toPlatform() {
+ android.view.textclassifier.TextLinks.Builder builder =
+ new android.view.textclassifier.TextLinks.Builder((String) getText());
+ for (TextLink textLink : getLinks()) {
+ builder.addLink(
+ textLink.getStart(),
+ textLink.getEnd(),
+ textLink.getEntityScores().getConfidenceMap());
+ }
+ return builder.build();
+ }
}
diff --git a/transition/api/1.2.0-qpreview01.txt b/transition/api/1.2.0-qpreview01.txt
new file mode 100644
index 0000000..86a584c
--- /dev/null
+++ b/transition/api/1.2.0-qpreview01.txt
@@ -0,0 +1,283 @@
+// Signature format: 3.0
+package androidx.transition {
+
+ public class ArcMotion extends androidx.transition.PathMotion {
+ ctor public ArcMotion();
+ ctor public ArcMotion(android.content.Context!, android.util.AttributeSet!);
+ method public float getMaximumAngle();
+ method public float getMinimumHorizontalAngle();
+ method public float getMinimumVerticalAngle();
+ method public android.graphics.Path! getPath(float, float, float, float);
+ method public void setMaximumAngle(float);
+ method public void setMinimumHorizontalAngle(float);
+ method public void setMinimumVerticalAngle(float);
+ }
+
+ public class AutoTransition extends androidx.transition.TransitionSet {
+ ctor public AutoTransition();
+ ctor public AutoTransition(android.content.Context!, android.util.AttributeSet!);
+ }
+
+ public class ChangeBounds extends androidx.transition.Transition {
+ ctor public ChangeBounds();
+ ctor public ChangeBounds(android.content.Context!, android.util.AttributeSet!);
+ method public void captureEndValues(androidx.transition.TransitionValues);
+ method public void captureStartValues(androidx.transition.TransitionValues);
+ method public boolean getResizeClip();
+ method public void setResizeClip(boolean);
+ }
+
+ public class ChangeClipBounds extends androidx.transition.Transition {
+ ctor public ChangeClipBounds();
+ ctor public ChangeClipBounds(android.content.Context!, android.util.AttributeSet!);
+ method public void captureEndValues(androidx.transition.TransitionValues);
+ method public void captureStartValues(androidx.transition.TransitionValues);
+ }
+
+ public class ChangeImageTransform extends androidx.transition.Transition {
+ ctor public ChangeImageTransform();
+ ctor public ChangeImageTransform(android.content.Context!, android.util.AttributeSet!);
+ method public void captureEndValues(androidx.transition.TransitionValues);
+ method public void captureStartValues(androidx.transition.TransitionValues);
+ }
+
+ public class ChangeScroll extends androidx.transition.Transition {
+ ctor public ChangeScroll();
+ ctor public ChangeScroll(android.content.Context!, android.util.AttributeSet!);
+ method public void captureEndValues(androidx.transition.TransitionValues);
+ method public void captureStartValues(androidx.transition.TransitionValues);
+ }
+
+ public class ChangeTransform extends androidx.transition.Transition {
+ ctor public ChangeTransform();
+ ctor public ChangeTransform(android.content.Context!, android.util.AttributeSet!);
+ method public void captureEndValues(androidx.transition.TransitionValues);
+ method public void captureStartValues(androidx.transition.TransitionValues);
+ method public boolean getReparent();
+ method public boolean getReparentWithOverlay();
+ method public void setReparent(boolean);
+ method public void setReparentWithOverlay(boolean);
+ }
+
+ public class CircularPropagation extends androidx.transition.VisibilityPropagation {
+ ctor public CircularPropagation();
+ method public long getStartDelay(android.view.ViewGroup!, androidx.transition.Transition!, androidx.transition.TransitionValues!, androidx.transition.TransitionValues!);
+ method public void setPropagationSpeed(float);
+ }
+
+ public class Explode extends androidx.transition.Visibility {
+ ctor public Explode();
+ ctor public Explode(android.content.Context!, android.util.AttributeSet!);
+ }
+
+ public class Fade extends androidx.transition.Visibility {
+ ctor public Fade(int);
+ ctor public Fade();
+ ctor public Fade(android.content.Context!, android.util.AttributeSet!);
+ field public static final int IN = 1; // 0x1
+ field public static final int OUT = 2; // 0x2
+ }
+
+ public abstract class PathMotion {
+ ctor public PathMotion();
+ ctor public PathMotion(android.content.Context!, android.util.AttributeSet!);
+ method public abstract android.graphics.Path! getPath(float, float, float, float);
+ }
+
+ public class PatternPathMotion extends androidx.transition.PathMotion {
+ ctor public PatternPathMotion();
+ ctor public PatternPathMotion(android.content.Context!, android.util.AttributeSet!);
+ ctor public PatternPathMotion(android.graphics.Path!);
+ method public android.graphics.Path! getPath(float, float, float, float);
+ method public android.graphics.Path! getPatternPath();
+ method public void setPatternPath(android.graphics.Path!);
+ }
+
+ public class Scene {
+ ctor public Scene(android.view.ViewGroup);
+ ctor public Scene(android.view.ViewGroup, android.view.View);
+ method public void enter();
+ method public void exit();
+ method public static androidx.transition.Scene? getCurrentScene(android.view.ViewGroup);
+ method public static androidx.transition.Scene getSceneForLayout(android.view.ViewGroup, @LayoutRes int, android.content.Context);
+ method public android.view.ViewGroup getSceneRoot();
+ method public void setEnterAction(Runnable?);
+ method public void setExitAction(Runnable?);
+ }
+
+ public class SidePropagation extends androidx.transition.VisibilityPropagation {
+ ctor public SidePropagation();
+ method public long getStartDelay(android.view.ViewGroup!, androidx.transition.Transition!, androidx.transition.TransitionValues!, androidx.transition.TransitionValues!);
+ method public void setPropagationSpeed(float);
+ method public void setSide(int);
+ }
+
+ public class Slide extends androidx.transition.Visibility {
+ ctor public Slide();
+ ctor public Slide(int);
+ ctor public Slide(android.content.Context!, android.util.AttributeSet!);
+ method public int getSlideEdge();
+ method public void setSlideEdge(int);
+ }
+
+ public abstract class Transition implements java.lang.Cloneable {
+ ctor public Transition();
+ ctor public Transition(android.content.Context!, android.util.AttributeSet!);
+ method public androidx.transition.Transition addListener(androidx.transition.Transition.TransitionListener);
+ method public androidx.transition.Transition addTarget(android.view.View);
+ method public androidx.transition.Transition addTarget(@IdRes int);
+ method public androidx.transition.Transition addTarget(String);
+ method public androidx.transition.Transition addTarget(Class);
+ method public abstract void captureEndValues(androidx.transition.TransitionValues);
+ method public abstract void captureStartValues(androidx.transition.TransitionValues);
+ method public androidx.transition.Transition! clone();
+ method public android.animation.Animator? createAnimator(android.view.ViewGroup, androidx.transition.TransitionValues?, androidx.transition.TransitionValues?);
+ method public androidx.transition.Transition excludeChildren(android.view.View, boolean);
+ method public androidx.transition.Transition excludeChildren(@IdRes int, boolean);
+ method public androidx.transition.Transition excludeChildren(Class, boolean);
+ method public androidx.transition.Transition excludeTarget(android.view.View, boolean);
+ method public androidx.transition.Transition excludeTarget(@IdRes int, boolean);
+ method public androidx.transition.Transition excludeTarget(String, boolean);
+ method public androidx.transition.Transition excludeTarget(Class, boolean);
+ method public long getDuration();
+ method public android.graphics.Rect? getEpicenter();
+ method public androidx.transition.Transition.EpicenterCallback? getEpicenterCallback();
+ method public android.animation.TimeInterpolator? getInterpolator();
+ method public String getName();
+ method public androidx.transition.PathMotion getPathMotion();
+ method public androidx.transition.TransitionPropagation? getPropagation();
+ method public long getStartDelay();
+ method public java.util.List<java.lang.Integer> getTargetIds();
+ method public java.util.List<java.lang.String>? getTargetNames();
+ method public java.util.List<java.lang.Class>? getTargetTypes();
+ method public java.util.List<android.view.View> getTargets();
+ method public String[]? getTransitionProperties();
+ method public androidx.transition.TransitionValues? getTransitionValues(android.view.View, boolean);
+ method public boolean isTransitionRequired(androidx.transition.TransitionValues?, androidx.transition.TransitionValues?);
+ method public androidx.transition.Transition removeListener(androidx.transition.Transition.TransitionListener);
+ method public androidx.transition.Transition removeTarget(android.view.View);
+ method public androidx.transition.Transition removeTarget(@IdRes int);
+ method public androidx.transition.Transition removeTarget(String);
+ method public androidx.transition.Transition removeTarget(Class);
+ method public androidx.transition.Transition setDuration(long);
+ method public void setEpicenterCallback(androidx.transition.Transition.EpicenterCallback?);
+ method public androidx.transition.Transition setInterpolator(android.animation.TimeInterpolator?);
+ method public void setMatchOrder(int...!);
+ method public void setPathMotion(androidx.transition.PathMotion?);
+ method public void setPropagation(androidx.transition.TransitionPropagation?);
+ method public androidx.transition.Transition setStartDelay(long);
+ field public static final int MATCH_ID = 3; // 0x3
+ field public static final int MATCH_INSTANCE = 1; // 0x1
+ field public static final int MATCH_ITEM_ID = 4; // 0x4
+ field public static final int MATCH_NAME = 2; // 0x2
+ }
+
+ public abstract static class Transition.EpicenterCallback {
+ ctor public Transition.EpicenterCallback();
+ method public abstract android.graphics.Rect! onGetEpicenter(androidx.transition.Transition);
+ }
+
+ public static interface Transition.TransitionListener {
+ method public void onTransitionCancel(androidx.transition.Transition);
+ method public void onTransitionEnd(androidx.transition.Transition);
+ method public void onTransitionPause(androidx.transition.Transition);
+ method public void onTransitionResume(androidx.transition.Transition);
+ method public void onTransitionStart(androidx.transition.Transition);
+ }
+
+ public class TransitionInflater {
+ method public static androidx.transition.TransitionInflater! from(android.content.Context!);
+ method public androidx.transition.Transition! inflateTransition(int);
+ method public androidx.transition.TransitionManager! inflateTransitionManager(int, android.view.ViewGroup!);
+ }
+
+ public class TransitionListenerAdapter implements androidx.transition.Transition.TransitionListener {
+ ctor public TransitionListenerAdapter();
+ method public void onTransitionCancel(androidx.transition.Transition);
+ method public void onTransitionEnd(androidx.transition.Transition);
+ method public void onTransitionPause(androidx.transition.Transition);
+ method public void onTransitionResume(androidx.transition.Transition);
+ method public void onTransitionStart(androidx.transition.Transition);
+ }
+
+ public class TransitionManager {
+ ctor public TransitionManager();
+ method public static void beginDelayedTransition(android.view.ViewGroup);
+ method public static void beginDelayedTransition(android.view.ViewGroup, androidx.transition.Transition?);
+ method public static void endTransitions(android.view.ViewGroup!);
+ method public static void go(androidx.transition.Scene);
+ method public static void go(androidx.transition.Scene, androidx.transition.Transition?);
+ method public void setTransition(androidx.transition.Scene, androidx.transition.Transition?);
+ method public void setTransition(androidx.transition.Scene, androidx.transition.Scene, androidx.transition.Transition?);
+ method public void transitionTo(androidx.transition.Scene);
+ }
+
+ public abstract class TransitionPropagation {
+ ctor public TransitionPropagation();
+ method public abstract void captureValues(androidx.transition.TransitionValues!);
+ method public abstract String[]! getPropagationProperties();
+ method public abstract long getStartDelay(android.view.ViewGroup!, androidx.transition.Transition!, androidx.transition.TransitionValues!, androidx.transition.TransitionValues!);
+ }
+
+ public class TransitionSet extends androidx.transition.Transition {
+ ctor public TransitionSet();
+ ctor public TransitionSet(android.content.Context!, android.util.AttributeSet!);
+ method public androidx.transition.TransitionSet addListener(androidx.transition.Transition.TransitionListener);
+ method public androidx.transition.TransitionSet addTarget(android.view.View);
+ method public androidx.transition.TransitionSet addTarget(@IdRes int);
+ method public androidx.transition.TransitionSet addTarget(String);
+ method public androidx.transition.TransitionSet addTarget(Class);
+ method public androidx.transition.TransitionSet addTransition(androidx.transition.Transition);
+ method public void captureEndValues(androidx.transition.TransitionValues);
+ method public void captureStartValues(androidx.transition.TransitionValues);
+ method public int getOrdering();
+ method public androidx.transition.Transition? getTransitionAt(int);
+ method public int getTransitionCount();
+ method public androidx.transition.TransitionSet removeListener(androidx.transition.Transition.TransitionListener);
+ method public androidx.transition.TransitionSet removeTarget(@IdRes int);
+ method public androidx.transition.TransitionSet removeTarget(android.view.View);
+ method public androidx.transition.TransitionSet removeTarget(Class);
+ method public androidx.transition.TransitionSet removeTarget(String);
+ method public androidx.transition.TransitionSet removeTransition(androidx.transition.Transition);
+ method public androidx.transition.TransitionSet setDuration(long);
+ method public androidx.transition.TransitionSet setInterpolator(android.animation.TimeInterpolator?);
+ method public androidx.transition.TransitionSet setOrdering(int);
+ method public androidx.transition.TransitionSet setStartDelay(long);
+ field public static final int ORDERING_SEQUENTIAL = 1; // 0x1
+ field public static final int ORDERING_TOGETHER = 0; // 0x0
+ }
+
+ public class TransitionValues {
+ ctor @Deprecated public TransitionValues();
+ ctor public TransitionValues(android.view.View);
+ field public final java.util.Map<java.lang.String,java.lang.Object>! values;
+ field public android.view.View! view;
+ }
+
+ public abstract class Visibility extends androidx.transition.Transition {
+ ctor public Visibility();
+ ctor public Visibility(android.content.Context!, android.util.AttributeSet!);
+ method public void captureEndValues(androidx.transition.TransitionValues);
+ method public void captureStartValues(androidx.transition.TransitionValues);
+ method public int getMode();
+ method public boolean isVisible(androidx.transition.TransitionValues!);
+ method public android.animation.Animator! onAppear(android.view.ViewGroup!, androidx.transition.TransitionValues!, int, androidx.transition.TransitionValues!, int);
+ method public android.animation.Animator! onAppear(android.view.ViewGroup!, android.view.View!, androidx.transition.TransitionValues!, androidx.transition.TransitionValues!);
+ method public android.animation.Animator! onDisappear(android.view.ViewGroup!, androidx.transition.TransitionValues!, int, androidx.transition.TransitionValues!, int);
+ method public android.animation.Animator! onDisappear(android.view.ViewGroup!, android.view.View!, androidx.transition.TransitionValues!, androidx.transition.TransitionValues!);
+ method public void setMode(int);
+ field public static final int MODE_IN = 1; // 0x1
+ field public static final int MODE_OUT = 2; // 0x2
+ }
+
+ public abstract class VisibilityPropagation extends androidx.transition.TransitionPropagation {
+ ctor public VisibilityPropagation();
+ method public void captureValues(androidx.transition.TransitionValues!);
+ method public String[]! getPropagationProperties();
+ method public int getViewVisibility(androidx.transition.TransitionValues!);
+ method public int getViewX(androidx.transition.TransitionValues!);
+ method public int getViewY(androidx.transition.TransitionValues!);
+ }
+
+}
+
diff --git a/transition/api/res-1.2.0-qpreview01.txt b/transition/api/res-1.2.0-qpreview01.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/transition/api/res-1.2.0-qpreview01.txt
diff --git a/transition/src/main/java/androidx/transition/CanvasUtils.java b/transition/src/main/java/androidx/transition/CanvasUtils.java
index 4e6ac36..e225b33 100644
--- a/transition/src/main/java/androidx/transition/CanvasUtils.java
+++ b/transition/src/main/java/androidx/transition/CanvasUtils.java
@@ -38,7 +38,14 @@
static void enableZ(@NonNull Canvas canvas, boolean enable) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// no shadows yet added into a platform
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ } else if (Build.VERSION.SDK_INT >= 29) {
+ if (enable) {
+ canvas.enableZ();
+ } else {
+ canvas.disableZ();
+ }
+ } else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.P) {
+ // not on P's greylist, can't use reflection
throw new IllegalStateException("This method doesn't work on Pie!");
} else {
if (!sOrderMethodsFetched) {
diff --git a/transition/src/main/java/androidx/transition/GhostViewUtils.java b/transition/src/main/java/androidx/transition/GhostViewUtils.java
index ed202ec..f572740 100644
--- a/transition/src/main/java/androidx/transition/GhostViewUtils.java
+++ b/transition/src/main/java/androidx/transition/GhostViewUtils.java
@@ -29,7 +29,8 @@
@Nullable
static GhostView addGhost(@NonNull View view, @NonNull ViewGroup viewGroup,
@Nullable Matrix matrix) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ if (Build.VERSION.SDK_INT == Build.VERSION_CODES.P) {
+ // Use the platform implementation on P as we can't backport the shadows drawing.
return GhostViewPlatform.addGhost(view, viewGroup, matrix);
} else {
return GhostViewPort.addGhost(view, viewGroup, matrix);
@@ -37,7 +38,8 @@
}
static void removeGhost(View view) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ if (Build.VERSION.SDK_INT == Build.VERSION_CODES.P) {
+ // Use the platform implementation on P as we can't backport the shadows drawing.
GhostViewPlatform.removeGhost(view);
} else {
GhostViewPort.removeGhost(view);
diff --git a/transition/src/main/java/androidx/transition/ImageViewUtils.java b/transition/src/main/java/androidx/transition/ImageViewUtils.java
index 9559c75..9332478 100644
--- a/transition/src/main/java/androidx/transition/ImageViewUtils.java
+++ b/transition/src/main/java/androidx/transition/ImageViewUtils.java
@@ -16,21 +16,24 @@
package androidx.transition;
+import android.annotation.SuppressLint;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.os.Build;
-import android.util.Log;
import android.widget.ImageView;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
+
import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
class ImageViewUtils {
- private static final String TAG = "ImageViewUtils";
- private static Method sAnimateTransformMethod;
- private static boolean sAnimateTransformMethodFetched;
+ /**
+ * False when linking of the hidden animateTransform method has previously failed.
+ */
+ private static boolean sTryHiddenAnimateTransform = true;
private static Field sDrawMatrixField;
private static boolean sDrawMatrixFieldFetched;
@@ -38,10 +41,13 @@
/**
* Sets the matrix to animate the content of the image view.
*/
- static void animateTransform(ImageView view, Matrix matrix) {
- if (matrix == null) {
- // There is a bug in ImageView.animateTransform() prior to the current development
- // version of Android so paddings are ignored when matrix is null.
+ @SuppressLint("NewApi") // TODO: Remove this suppression once Q SDK is released.
+ static void animateTransform(@NonNull ImageView view, @Nullable Matrix matrix) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ view.animateTransform(matrix);
+ } else if (matrix == null) {
+ // There is a bug in ImageView.animateTransform() prior to Q so paddings are
+ // ignored when matrix is null.
Drawable drawable = view.getDrawable();
if (drawable != null) {
int vwidth = view.getWidth() - view.getPaddingLeft() - view.getPaddingRight();
@@ -50,16 +56,7 @@
view.invalidate();
}
} else if (Build.VERSION.SDK_INT >= 21) {
- fetchAnimateTransformMethod();
- if (sAnimateTransformMethod != null) {
- try {
- sAnimateTransformMethod.invoke(view, matrix);
- } catch (IllegalAccessException e) {
- // Do nothing
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e.getCause());
- }
- }
+ hiddenAnimateTransform(view, matrix);
} else {
Drawable drawable = view.getDrawable();
if (drawable != null) {
@@ -86,16 +83,17 @@
}
}
- private static void fetchAnimateTransformMethod() {
- if (!sAnimateTransformMethodFetched) {
+ @RequiresApi(21)
+ @SuppressLint("NewApi") // Lint doesn't know about the hidden method.
+ private static void hiddenAnimateTransform(@NonNull ImageView view, @Nullable Matrix matrix) {
+ if (sTryHiddenAnimateTransform) {
+ // Since this was an @hide method made public, we can link directly against it with
+ // a try/catch for its absence instead of doing the same through reflection.
try {
- sAnimateTransformMethod = ImageView.class.getDeclaredMethod("animateTransform",
- Matrix.class);
- sAnimateTransformMethod.setAccessible(true);
- } catch (NoSuchMethodException e) {
- Log.i(TAG, "Failed to retrieve animateTransform method", e);
+ view.animateTransform(matrix);
+ } catch (NoSuchMethodError e) {
+ sTryHiddenAnimateTransform = false;
}
- sAnimateTransformMethodFetched = true;
}
}
diff --git a/transition/src/main/java/androidx/transition/ViewGroupUtils.java b/transition/src/main/java/androidx/transition/ViewGroupUtils.java
index 566c0cb..63bf693 100644
--- a/transition/src/main/java/androidx/transition/ViewGroupUtils.java
+++ b/transition/src/main/java/androidx/transition/ViewGroupUtils.java
@@ -16,10 +16,12 @@
package androidx.transition;
+import android.annotation.SuppressLint;
import android.os.Build;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
+import androidx.annotation.RequiresApi;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -29,6 +31,11 @@
*/
class ViewGroupUtils {
+ /**
+ * False when linking of the hidden suppressLayout method has previously failed.
+ */
+ private static boolean sTryHiddenSuppressLayout = true;
+
private static Method sGetChildDrawingOrderMethod;
private static boolean sGetChildDrawingOrderMethodFetched;
@@ -45,38 +52,60 @@
/**
* Provides access to the hidden ViewGroup#suppressLayout method.
*/
+ @SuppressLint("NewApi") // TODO: Remove this suppression once Q SDK is released.
static void suppressLayout(@NonNull ViewGroup group, boolean suppress) {
- if (Build.VERSION.SDK_INT >= 18) {
- ViewGroupUtilsApi18.suppressLayout(group, suppress);
+ if (Build.VERSION.SDK_INT >= 29) {
+ group.suppressLayout(suppress);
+ } else if (Build.VERSION.SDK_INT >= 18) {
+ hiddenSuppressLayout(group, suppress);
} else {
ViewGroupUtilsApi14.suppressLayout(group, suppress);
}
}
+ @RequiresApi(18)
+ @SuppressLint("NewApi") // Lint doesn't know about the hidden method.
+ private static void hiddenSuppressLayout(@NonNull ViewGroup group, boolean suppress) {
+ if (sTryHiddenSuppressLayout) {
+ // Since this was an @hide method made public, we can link directly against it with
+ // a try/catch for its absence instead of doing the same through reflection.
+ try {
+ group.suppressLayout(suppress);
+ } catch (NoSuchMethodError e) {
+ sTryHiddenSuppressLayout = false;
+ }
+ }
+ }
+
/**
* Returns the index of the child to draw for this iteration.
*/
+ @SuppressLint("NewApi") // TODO: Remove this suppression once Q SDK is released.
static int getChildDrawingOrder(@NonNull ViewGroup viewGroup, int i) {
- if (!sGetChildDrawingOrderMethodFetched) {
- try {
- sGetChildDrawingOrderMethod = ViewGroup.class.getDeclaredMethod(
- "getChildDrawingOrder", int.class, int.class);
- sGetChildDrawingOrderMethod.setAccessible(true);
- } catch (NoSuchMethodException ignore) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ return viewGroup.getChildDrawingOrder(i);
+ } else {
+ if (!sGetChildDrawingOrderMethodFetched) {
+ try {
+ sGetChildDrawingOrderMethod = ViewGroup.class.getDeclaredMethod(
+ "getChildDrawingOrder", int.class, int.class);
+ sGetChildDrawingOrderMethod.setAccessible(true);
+ } catch (NoSuchMethodException ignore) {
+ }
+ sGetChildDrawingOrderMethodFetched = true;
}
- sGetChildDrawingOrderMethodFetched = true;
- }
- if (sGetChildDrawingOrderMethod != null) {
- try {
- return (Integer) sGetChildDrawingOrderMethod.invoke(viewGroup,
- viewGroup.getChildCount(), i);
- } catch (IllegalAccessException ignore) {
- } catch (InvocationTargetException ignore) {
+ if (sGetChildDrawingOrderMethod != null) {
+ try {
+ return (Integer) sGetChildDrawingOrderMethod.invoke(viewGroup,
+ viewGroup.getChildCount(), i);
+ } catch (IllegalAccessException ignore) {
+ } catch (InvocationTargetException ignore) {
+ }
}
+ // fallback implementation
+ return i;
}
- // fallback implementation
- return i;
}
diff --git a/transition/src/main/java/androidx/transition/ViewGroupUtilsApi18.java b/transition/src/main/java/androidx/transition/ViewGroupUtilsApi18.java
deleted file mode 100644
index e4d4ffa..0000000
--- a/transition/src/main/java/androidx/transition/ViewGroupUtilsApi18.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.transition;
-
-import android.util.Log;
-import android.view.ViewGroup;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.RequiresApi;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-@RequiresApi(18)
-class ViewGroupUtilsApi18 {
-
- private static final String TAG = "ViewUtilsApi18";
-
- private static Method sSuppressLayoutMethod;
- private static boolean sSuppressLayoutMethodFetched;
-
- static void suppressLayout(@NonNull ViewGroup group, boolean suppress) {
- fetchSuppressLayoutMethod();
- if (sSuppressLayoutMethod != null) {
- try {
- sSuppressLayoutMethod.invoke(group, suppress);
- } catch (IllegalAccessException e) {
- Log.i(TAG, "Failed to invoke suppressLayout method", e);
- } catch (InvocationTargetException e) {
- Log.i(TAG, "Error invoking suppressLayout method", e);
- }
- }
- }
-
- private static void fetchSuppressLayoutMethod() {
- if (!sSuppressLayoutMethodFetched) {
- try {
- sSuppressLayoutMethod = ViewGroup.class.getDeclaredMethod("suppressLayout",
- boolean.class);
- sSuppressLayoutMethod.setAccessible(true);
- } catch (NoSuchMethodException e) {
- Log.i(TAG, "Failed to retrieve suppressLayout method", e);
- }
- sSuppressLayoutMethodFetched = true;
- }
- }
-
- private ViewGroupUtilsApi18() {
- }
-}
diff --git a/transition/src/main/java/androidx/transition/ViewUtils.java b/transition/src/main/java/androidx/transition/ViewUtils.java
index d770ab6..566db5e 100644
--- a/transition/src/main/java/androidx/transition/ViewUtils.java
+++ b/transition/src/main/java/androidx/transition/ViewUtils.java
@@ -16,10 +16,10 @@
package androidx.transition;
+import android.annotation.SuppressLint;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.os.Build;
-import android.util.Log;
import android.util.Property;
import android.view.View;
@@ -27,8 +27,6 @@
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
-import java.lang.reflect.Field;
-
/**
* Compatibility utilities for platform features of {@link View}.
*/
@@ -37,16 +35,18 @@
private static final ViewUtilsBase IMPL;
private static final String TAG = "ViewUtils";
- private static Field sViewFlagsField;
- private static boolean sViewFlagsFieldFetched;
- private static final int VISIBILITY_MASK = 0x0000000C;
-
static {
- if (Build.VERSION.SDK_INT >= 22) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ // TODO: replace with 'new ViewUtilsApi29()' when we can use an SDK_INT check as lint
+ // doesn't understand BuildCompat API checks
+ IMPL = createViewUtilsApi29();
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ IMPL = new ViewUtilsApi23();
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
IMPL = new ViewUtilsApi22();
- } else if (Build.VERSION.SDK_INT >= 21) {
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
IMPL = new ViewUtilsApi21();
- } else if (Build.VERSION.SDK_INT >= 19) {
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
IMPL = new ViewUtilsApi19();
} else {
IMPL = new ViewUtilsBase();
@@ -145,15 +145,7 @@
* {@link View#GONE}.
*/
static void setTransitionVisibility(@NonNull View view, int visibility) {
- fetchViewFlagsField();
- if (sViewFlagsField != null) {
- try {
- int viewFlags = sViewFlagsField.getInt(view);
- sViewFlagsField.setInt(view, (viewFlags & ~VISIBILITY_MASK) | visibility);
- } catch (IllegalAccessException e) {
- // Do nothing
- }
- }
+ IMPL.setTransitionVisibility(view, visibility);
}
/**
@@ -210,16 +202,10 @@
IMPL.setLeftTopRightBottom(v, left, top, right, bottom);
}
- private static void fetchViewFlagsField() {
- if (!sViewFlagsFieldFetched) {
- try {
- sViewFlagsField = View.class.getDeclaredField("mViewFlags");
- sViewFlagsField.setAccessible(true);
- } catch (NoSuchFieldException e) {
- Log.i(TAG, "fetchViewFlagsField: ");
- }
- sViewFlagsFieldFetched = true;
- }
+ // TODO: delete when we use an SDK_INT check as lint doesn't understand BuildCompat API checks
+ @SuppressLint("NewApi")
+ private static ViewUtilsApi29 createViewUtilsApi29() {
+ return new ViewUtilsApi29();
}
private ViewUtils() {
diff --git a/transition/src/main/java/androidx/transition/ViewUtilsApi19.java b/transition/src/main/java/androidx/transition/ViewUtilsApi19.java
index ff604319..b5a2547 100644
--- a/transition/src/main/java/androidx/transition/ViewUtilsApi19.java
+++ b/transition/src/main/java/androidx/transition/ViewUtilsApi19.java
@@ -16,54 +16,49 @@
package androidx.transition;
-import android.util.Log;
+import android.annotation.SuppressLint;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
@RequiresApi(19)
class ViewUtilsApi19 extends ViewUtilsBase {
- private static final String TAG = "ViewUtilsApi19";
-
- private static Method sSetTransitionAlphaMethod;
- private static boolean sSetTransitionAlphaMethodFetched;
- private static Method sGetTransitionAlphaMethod;
- private static boolean sGetTransitionAlphaMethodFetched;
+ /**
+ * False when linking of the hidden set[get]TransitionAlpha method has previously failed.
+ */
+ private static boolean sTryHiddenTransitionAlpha = true;
@Override
+ @SuppressLint("NewApi") // Lint doesn't know about the hidden method.
public void setTransitionAlpha(@NonNull View view, float alpha) {
- fetchSetTransitionAlphaMethod();
- if (sSetTransitionAlphaMethod != null) {
+ if (sTryHiddenTransitionAlpha) {
+ // Since this was an @hide method made public, we can link directly against it with
+ // a try/catch for its absence instead of doing the same through reflection.
try {
- sSetTransitionAlphaMethod.invoke(view, alpha);
- } catch (IllegalAccessException e) {
- // Do nothing
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e.getCause());
+ view.setTransitionAlpha(alpha);
+ return;
+ } catch (NoSuchMethodError e) {
+ sTryHiddenTransitionAlpha = false;
}
- } else {
- view.setAlpha(alpha);
}
+ view.setAlpha(alpha);
}
@Override
+ @SuppressLint("NewApi") // Lint doesn't know about the hidden method.
public float getTransitionAlpha(@NonNull View view) {
- fetchGetTransitionAlphaMethod();
- if (sGetTransitionAlphaMethod != null) {
+ if (sTryHiddenTransitionAlpha) {
+ // Since this was an @hide method made public, we can link directly against it with
+ // a try/catch for its absence instead of doing the same through reflection.
try {
- return (Float) sGetTransitionAlphaMethod.invoke(view);
- } catch (IllegalAccessException e) {
- // Do nothing
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e.getCause());
+ return view.getTransitionAlpha();
+ } catch (NoSuchMethodError e) {
+ sTryHiddenTransitionAlpha = false;
}
}
- return super.getTransitionAlpha(view);
+ return view.getAlpha();
}
@Override
@@ -76,29 +71,4 @@
// Do nothing
}
- private void fetchSetTransitionAlphaMethod() {
- if (!sSetTransitionAlphaMethodFetched) {
- try {
- sSetTransitionAlphaMethod = View.class.getDeclaredMethod("setTransitionAlpha",
- float.class);
- sSetTransitionAlphaMethod.setAccessible(true);
- } catch (NoSuchMethodException e) {
- Log.i(TAG, "Failed to retrieve setTransitionAlpha method", e);
- }
- sSetTransitionAlphaMethodFetched = true;
- }
- }
-
- private void fetchGetTransitionAlphaMethod() {
- if (!sGetTransitionAlphaMethodFetched) {
- try {
- sGetTransitionAlphaMethod = View.class.getDeclaredMethod("getTransitionAlpha");
- sGetTransitionAlphaMethod.setAccessible(true);
- } catch (NoSuchMethodException e) {
- Log.i(TAG, "Failed to retrieve getTransitionAlpha method", e);
- }
- sGetTransitionAlphaMethodFetched = true;
- }
- }
-
}
diff --git a/transition/src/main/java/androidx/transition/ViewUtilsApi21.java b/transition/src/main/java/androidx/transition/ViewUtilsApi21.java
index 14301d2..c5a8900 100644
--- a/transition/src/main/java/androidx/transition/ViewUtilsApi21.java
+++ b/transition/src/main/java/androidx/transition/ViewUtilsApi21.java
@@ -16,107 +16,70 @@
package androidx.transition;
+import android.annotation.SuppressLint;
import android.graphics.Matrix;
-import android.util.Log;
import android.view.View;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
@RequiresApi(21)
class ViewUtilsApi21 extends ViewUtilsApi19 {
- private static final String TAG = "ViewUtilsApi21";
-
- private static Method sTransformMatrixToGlobalMethod;
- private static boolean sTransformMatrixToGlobalMethodFetched;
- private static Method sTransformMatrixToLocalMethod;
- private static boolean sTransformMatrixToLocalMethodFetched;
- private static Method sSetAnimationMatrixMethod;
- private static boolean sSetAnimationMatrixMethodFetched;
+ /**
+ * False when linking of the hidden setAnimationMatrix method has previously failed.
+ */
+ private static boolean sTryHiddenSetAnimationMatrix = true;
+ /**
+ * False when linking of the hidden transformMatrixToGlobal method has previously failed.
+ */
+ private static boolean sTryHiddenTransformMatrixToGlobal = true;
+ /**
+ * False when linking of the hidden transformMatrixToLocal method has previously failed.
+ */
+ private static boolean sTryHiddenTransformMatrixToLocal = true;
@Override
+ @SuppressLint("NewApi") // Lint doesn't know about the hidden method.
public void transformMatrixToGlobal(@NonNull View view, @NonNull Matrix matrix) {
- fetchTransformMatrixToGlobalMethod();
- if (sTransformMatrixToGlobalMethod != null) {
+ if (sTryHiddenTransformMatrixToGlobal) {
+ // Since this was an @hide method made public, we can link directly against it with
+ // a try/catch for its absence instead of doing the same through reflection.
try {
- sTransformMatrixToGlobalMethod.invoke(view, matrix);
- } catch (IllegalAccessException e) {
- // Do nothing
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e.getCause());
+ view.transformMatrixToGlobal(matrix);
+ } catch (NoSuchMethodError e) {
+ sTryHiddenTransformMatrixToGlobal = false;
}
}
}
@Override
+ @SuppressLint("NewApi") // Lint doesn't know about the hidden method.
public void transformMatrixToLocal(@NonNull View view, @NonNull Matrix matrix) {
- fetchTransformMatrixToLocalMethod();
- if (sTransformMatrixToLocalMethod != null) {
+ if (sTryHiddenTransformMatrixToLocal) {
+ // Since this was an @hide method made public, we can link directly against it with
+ // a try/catch for its absence instead of doing the same through reflection.
try {
- sTransformMatrixToLocalMethod.invoke(view, matrix);
- } catch (IllegalAccessException e) {
- // Do nothing
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e.getCause());
+ view.transformMatrixToLocal(matrix);
+ } catch (NoSuchMethodError e) {
+ sTryHiddenTransformMatrixToLocal = false;
}
}
}
@Override
- public void setAnimationMatrix(@NonNull View view, Matrix matrix) {
- fetchSetAnimationMatrix();
- if (sSetAnimationMatrixMethod != null) {
+ @SuppressLint("NewApi") // Lint doesn't know about the hidden method.
+ public void setAnimationMatrix(@NonNull View view, @Nullable Matrix matrix) {
+ if (sTryHiddenSetAnimationMatrix) {
+ // Since this was an @hide method made public, we can link directly against it with
+ // a try/catch for its absence instead of doing the same through reflection.
try {
- sSetAnimationMatrixMethod.invoke(view, matrix);
- } catch (InvocationTargetException e) {
- // Do nothing
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e.getCause());
+ view.setAnimationMatrix(matrix);
+ } catch (NoSuchMethodError e) {
+ sTryHiddenSetAnimationMatrix = false;
}
}
}
- private void fetchTransformMatrixToGlobalMethod() {
- if (!sTransformMatrixToGlobalMethodFetched) {
- try {
- sTransformMatrixToGlobalMethod = View.class.getDeclaredMethod(
- "transformMatrixToGlobal", Matrix.class);
- sTransformMatrixToGlobalMethod.setAccessible(true);
- } catch (NoSuchMethodException e) {
- Log.i(TAG, "Failed to retrieve transformMatrixToGlobal method", e);
- }
- sTransformMatrixToGlobalMethodFetched = true;
- }
- }
-
- private void fetchTransformMatrixToLocalMethod() {
- if (!sTransformMatrixToLocalMethodFetched) {
- try {
- sTransformMatrixToLocalMethod = View.class.getDeclaredMethod(
- "transformMatrixToLocal", Matrix.class);
- sTransformMatrixToLocalMethod.setAccessible(true);
- } catch (NoSuchMethodException e) {
- Log.i(TAG, "Failed to retrieve transformMatrixToLocal method", e);
- }
- sTransformMatrixToLocalMethodFetched = true;
- }
- }
-
- private void fetchSetAnimationMatrix() {
- if (!sSetAnimationMatrixMethodFetched) {
- try {
- sSetAnimationMatrixMethod = View.class.getDeclaredMethod(
- "setAnimationMatrix", Matrix.class);
- sSetAnimationMatrixMethod.setAccessible(true);
- } catch (NoSuchMethodException e) {
- Log.i(TAG, "Failed to retrieve setAnimationMatrix method", e);
- }
- sSetAnimationMatrixMethodFetched = true;
- }
- }
-
}
diff --git a/transition/src/main/java/androidx/transition/ViewUtilsApi22.java b/transition/src/main/java/androidx/transition/ViewUtilsApi22.java
index f8dd2a0..a251bbe 100644
--- a/transition/src/main/java/androidx/transition/ViewUtilsApi22.java
+++ b/transition/src/main/java/androidx/transition/ViewUtilsApi22.java
@@ -17,49 +17,31 @@
package androidx.transition;
import android.annotation.SuppressLint;
-import android.util.Log;
import android.view.View;
+import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
@RequiresApi(22)
class ViewUtilsApi22 extends ViewUtilsApi21 {
- private static final String TAG = "ViewUtilsApi22";
-
- private static Method sSetLeftTopRightBottomMethod;
- private static boolean sSetLeftTopRightBottomMethodFetched;
+ /**
+ * False when linking of the hidden setLeftTopRightBottom method has previously failed.
+ */
+ private static boolean sTryHiddenSetLeftTopRightBottom = true;
@Override
- public void setLeftTopRightBottom(View v, int left, int top, int right, int bottom) {
- fetchSetLeftTopRightBottomMethod();
- if (sSetLeftTopRightBottomMethod != null) {
+ @SuppressLint("NewApi") // Lint doesn't know about the hidden method.
+ public void setLeftTopRightBottom(@NonNull View v, int left, int top, int right, int bottom) {
+ if (sTryHiddenSetLeftTopRightBottom) {
+ // Since this was an @hide method made public, we can link directly against it with
+ // a try/catch for its absence instead of doing the same through reflection.
try {
- sSetLeftTopRightBottomMethod.invoke(v, left, top, right, bottom);
- } catch (IllegalAccessException e) {
- // Do nothing
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e.getCause());
+ v.setLeftTopRightBottom(left, top, right, bottom);
+ } catch (NoSuchMethodError e) {
+ sTryHiddenSetLeftTopRightBottom = false;
}
}
}
-
- @SuppressLint("PrivateApi")
- private void fetchSetLeftTopRightBottomMethod() {
- if (!sSetLeftTopRightBottomMethodFetched) {
- try {
- sSetLeftTopRightBottomMethod = View.class.getDeclaredMethod("setLeftTopRightBottom",
- int.class, int.class, int.class, int.class);
- sSetLeftTopRightBottomMethod.setAccessible(true);
- } catch (NoSuchMethodException e) {
- Log.i(TAG, "Failed to retrieve setLeftTopRightBottom method", e);
- }
- sSetLeftTopRightBottomMethodFetched = true;
- }
- }
-
}
diff --git a/transition/src/main/java/androidx/transition/ViewUtilsApi23.java b/transition/src/main/java/androidx/transition/ViewUtilsApi23.java
new file mode 100644
index 0000000..a089f2f
--- /dev/null
+++ b/transition/src/main/java/androidx/transition/ViewUtilsApi23.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.transition;
+
+import android.annotation.SuppressLint;
+import android.os.Build;
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.RequiresApi;
+
+@RequiresApi(23)
+class ViewUtilsApi23 extends ViewUtilsApi22 {
+
+ /**
+ * False when linking of the hidden setLeftTopRightBottom method has previously failed.
+ */
+ private static boolean sTryHiddenSetTransitionVisibility = true;
+
+ @Override
+ @SuppressLint("NewApi") // Lint doesn't know about the hidden method.
+ public void setTransitionVisibility(@NonNull View view, int visibility) {
+ // on P this method is blacklisted, so we have to resort to reflecting on mViewFlags
+ if (Build.VERSION.SDK_INT == Build.VERSION_CODES.P) {
+ super.setTransitionVisibility(view, visibility);
+ } else {
+ if (sTryHiddenSetTransitionVisibility) {
+ // Since this was an @hide method made public, we can link directly against it with
+ // a try/catch for its absence instead of doing the same through reflection.
+ try {
+ view.setTransitionVisibility(visibility);
+ } catch (NoSuchMethodError e) {
+ sTryHiddenSetTransitionVisibility = false;
+ }
+ }
+ }
+ }
+}
+
diff --git a/transition/src/main/java/androidx/transition/ViewUtilsApi29.java b/transition/src/main/java/androidx/transition/ViewUtilsApi29.java
new file mode 100644
index 0000000..be835de5
--- /dev/null
+++ b/transition/src/main/java/androidx/transition/ViewUtilsApi29.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.transition;
+
+import android.graphics.Matrix;
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
+
+@RequiresApi(29)
+class ViewUtilsApi29 extends ViewUtilsApi23 {
+
+ @Override
+ public void setTransitionAlpha(@NonNull View view, float alpha) {
+ view.setTransitionAlpha(alpha);
+ }
+
+ @Override
+ public float getTransitionAlpha(@NonNull View view) {
+ return view.getTransitionAlpha();
+ }
+
+ @Override
+ public void setTransitionVisibility(@NonNull View view, int visibility) {
+ view.setTransitionVisibility(visibility);
+ }
+
+ @Override
+ public void setLeftTopRightBottom(@NonNull View v, int left, int top, int right, int bottom) {
+ v.setLeftTopRightBottom(left, top, right, bottom);
+ }
+
+ @Override
+ public void transformMatrixToGlobal(@NonNull View view, @NonNull Matrix matrix) {
+ view.transformMatrixToGlobal(matrix);
+ }
+
+ @Override
+ public void transformMatrixToLocal(@NonNull View view, @NonNull Matrix matrix) {
+ view.transformMatrixToLocal(matrix);
+ }
+
+ @Override
+ public void setAnimationMatrix(@NonNull View view, @Nullable Matrix matrix) {
+ view.setAnimationMatrix(matrix);
+ }
+}
+
diff --git a/transition/src/main/java/androidx/transition/ViewUtilsBase.java b/transition/src/main/java/androidx/transition/ViewUtilsBase.java
index 87917dd..3c43422 100644
--- a/transition/src/main/java/androidx/transition/ViewUtilsBase.java
+++ b/transition/src/main/java/androidx/transition/ViewUtilsBase.java
@@ -23,7 +23,9 @@
import android.view.ViewParent;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -34,6 +36,10 @@
private static Method sSetFrameMethod;
private static boolean sSetFrameFetched;
+ private static Field sViewFlagsField;
+ private static boolean sViewFlagsFieldFetched;
+ private static final int VISIBILITY_MASK = 0x0000000C;
+
private float[] mMatrixValues;
public void setTransitionAlpha(@NonNull View view, float alpha) {
@@ -99,7 +105,7 @@
}
}
- public void setAnimationMatrix(@NonNull View view, Matrix matrix) {
+ public void setAnimationMatrix(@NonNull View view, @Nullable Matrix matrix) {
if (matrix == null || matrix.isIdentity()) {
view.setPivotX(view.getWidth() / 2);
view.setPivotY(view.getHeight() / 2);
@@ -132,7 +138,7 @@
}
}
- public void setLeftTopRightBottom(View v, int left, int top, int right, int bottom) {
+ public void setLeftTopRightBottom(@NonNull View v, int left, int top, int right, int bottom) {
fetchSetFrame();
if (sSetFrameMethod != null) {
try {
@@ -145,6 +151,26 @@
}
}
+ public void setTransitionVisibility(@NonNull View view, int visibility) {
+ if (!sViewFlagsFieldFetched) {
+ try {
+ sViewFlagsField = View.class.getDeclaredField("mViewFlags");
+ sViewFlagsField.setAccessible(true);
+ } catch (NoSuchFieldException e) {
+ Log.i(TAG, "fetchViewFlagsField: ");
+ }
+ sViewFlagsFieldFetched = true;
+ }
+ if (sViewFlagsField != null) {
+ try {
+ int viewFlags = sViewFlagsField.getInt(view);
+ sViewFlagsField.setInt(view, (viewFlags & ~VISIBILITY_MASK) | visibility);
+ } catch (IllegalAccessException e) {
+ // Do nothing
+ }
+ }
+ }
+
@SuppressLint("PrivateApi")
private void fetchSetFrame() {
if (!sSetFrameFetched) {
diff --git a/ui/README.md b/ui/README.md
index 6db00fd..c811bd3 100644
--- a/ui/README.md
+++ b/ui/README.md
@@ -78,4 +78,4 @@
Text engine
## Feedback
-To provide feedback or report bugs, please refer to the main [AndroidX contribution guide](https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/README.md) and report your bugs [here](https://issuetracker.google.com/issues/new?component=612128)
+To provide feedback or report bugs, please refer to the main [AndroidX contribution guide](https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/README.md) and report your bugs [here](https://b.corp.google.com/issues/new?component=612128)
diff --git a/ui/android-view-non-ir/src/main/java/androidx/ui/androidview/adapters/CalendarViewInputController.kt b/ui/android-view-non-ir/src/main/java/androidx/ui/androidview/adapters/CalendarViewInputController.kt
index dddc847..ad60314 100644
--- a/ui/android-view-non-ir/src/main/java/androidx/ui/androidview/adapters/CalendarViewInputController.kt
+++ b/ui/android-view-non-ir/src/main/java/androidx/ui/androidview/adapters/CalendarViewInputController.kt
@@ -30,13 +30,13 @@
var onDateChange: Function1<Long, Unit>? = null
- override fun onSelectedDayChange(x: CalendarView?, year: Int, month: Int, dayOfMonth: Int) {
+ override fun onSelectedDayChange(x: CalendarView, year: Int, month: Int, dayOfMonth: Int) {
val cal = Calendar.getInstance()
cal.set(year, month, dayOfMonth)
val date = cal.timeInMillis
// view.getDate() returns incorrect date even if it shows in UI correctly, so update date here manually
// see bug : b/113224600
- x?.date = date
+ x.date = date
prepareForChange(date)
onDateChange?.invoke(date)
}
diff --git a/ui/framework/src/main/java/androidx/ui/core/vectorgraphics/Vector.kt b/ui/framework/src/main/java/androidx/ui/core/vectorgraphics/Vector.kt
index 7131973..6b0384b 100644
--- a/ui/framework/src/main/java/androidx/ui/core/vectorgraphics/Vector.kt
+++ b/ui/framework/src/main/java/androidx/ui/core/vectorgraphics/Vector.kt
@@ -595,8 +595,8 @@
override fun getIntrinsicHeight(): Int = Math.round(vector.defaultHeight)
- override fun draw(canvas: android.graphics.Canvas?) {
- vector.draw(androidx.ui.painting.Canvas(canvas!!))
+ override fun draw(canvas: android.graphics.Canvas) {
+ vector.draw(androidx.ui.painting.Canvas(canvas))
}
override fun setAlpha(alpha: Int) {
diff --git a/ui/settings.gradle b/ui/settings.gradle
index 18ea4cb..b65036f 100644
--- a/ui/settings.gradle
+++ b/ui/settings.gradle
@@ -63,3 +63,5 @@
// dumb test project that has a test for each size to ensure that at least one test is run
// for each size and test runner is happy when there is nothing to test.
includeProject(":dumb-tests", "../dumb-tests")
+
+includeProject(":fakeannotations", "../fakeannotations")
\ No newline at end of file
diff --git a/ui/text/src/main/java/androidx/ui/engine/text/platform/ParagraphAndroid.kt b/ui/text/src/main/java/androidx/ui/engine/text/platform/ParagraphAndroid.kt
index 13f39f1..1954072 100644
--- a/ui/text/src/main/java/androidx/ui/engine/text/platform/ParagraphAndroid.kt
+++ b/ui/text/src/main/java/androidx/ui/engine/text/platform/ParagraphAndroid.kt
@@ -469,7 +469,7 @@
style.locale?.let {
spannableString.setSpan(
// TODO(Migration/haoyuchang): support locale fallback in the framework
- LocaleSpan(Locale(it.languageCode, it.countryCode)),
+ LocaleSpan(Locale(it.languageCode, it.countryCode!!)),
start,
end,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
diff --git a/viewpager/src/main/java/androidx/viewpager/widget/PagerTitleStrip.java b/viewpager/src/main/java/androidx/viewpager/widget/PagerTitleStrip.java
index d94fc09..f5bfbea 100644
--- a/viewpager/src/main/java/androidx/viewpager/widget/PagerTitleStrip.java
+++ b/viewpager/src/main/java/androidx/viewpager/widget/PagerTitleStrip.java
@@ -20,6 +20,7 @@
import android.content.res.TypedArray;
import android.database.DataSetObserver;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.text.TextUtils.TruncateAt;
import android.text.method.SingleLineTransformationMethod;
import android.util.AttributeSet;
@@ -117,6 +118,9 @@
addView(mNextText = new TextView(context));
final TypedArray a = context.obtainStyledAttributes(attrs, ATTRS);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(context, ATTRS, attrs, a, 0, 0);
+ }
final int textAppearance = a.getResourceId(0, 0);
if (textAppearance != 0) {
TextViewCompat.setTextAppearance(mPrevText, textAppearance);
diff --git a/viewpager2/src/androidTest/java/androidx/viewpager2/widget/AccessibilityTest.kt b/viewpager2/src/androidTest/java/androidx/viewpager2/widget/AccessibilityTest.kt
new file mode 100644
index 0000000..02cd523
--- /dev/null
+++ b/viewpager2/src/androidTest/java/androidx/viewpager2/widget/AccessibilityTest.kt
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.viewpager2.widget
+
+import android.os.Build
+import android.view.accessibility.AccessibilityNodeInfo
+import androidx.core.view.ViewCompat
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_PAGE_DOWN
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_PAGE_LEFT
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_PAGE_RIGHT
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_PAGE_UP
+import androidx.test.filters.LargeTest
+import androidx.viewpager2.LocaleTestUtils
+import androidx.viewpager2.widget.ViewPager2.ORIENTATION_HORIZONTAL
+import androidx.viewpager2.widget.ViewPager2.ORIENTATION_VERTICAL
+import org.hamcrest.CoreMatchers.equalTo
+import org.junit.Assert.assertThat
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
+import java.util.concurrent.TimeUnit
+
+@RunWith(Parameterized::class)
+@LargeTest
+class AccessibilityTest(private val config: TestConfig) : BaseTest() {
+ data class TestConfig(
+ @ViewPager2.Orientation val orientation: Int,
+ val rtl: Boolean
+ )
+
+ companion object {
+ @JvmStatic
+ @Parameterized.Parameters(name = "{0}")
+ fun spec(): List<TestConfig> = createTestSet()
+ }
+
+ override fun setUp() {
+ super.setUp()
+ if (config.rtl) {
+ localeUtil.resetLocale()
+ localeUtil.setLocale(LocaleTestUtils.RTL_LANGUAGE)
+ }
+ }
+
+ @Test
+ fun test_onPerformPageAction() {
+ setUpTest(config.orientation).apply {
+ setAdapterSync(viewAdapterProvider(stringSequence(6)))
+
+ val initialPage = viewPager.currentItem
+ assertBasicState(initialPage)
+
+ listOf(1, 2, 3, 2, 3, 2, 3, 4, 5, 4, 5, 4, 3, 2, 1, 0, 1).forEach {
+ targetPage ->
+ val currentPage = viewPager.currentItem
+ val latch = viewPager.addWaitForScrolledLatch(targetPage)
+ if (targetPage - currentPage == 1) {
+ ViewCompat.performAccessibilityAction(viewPager,
+ getNextPageAction(config.orientation, isRtl), null)
+ } else {
+ ViewCompat.performAccessibilityAction(viewPager,
+ getPreviousPageAction(config.orientation, isRtl), null)
+ }
+ latch.await(1, TimeUnit.SECONDS)
+ assertBasicState(targetPage)
+ }
+ }
+ }
+
+ @Test
+ fun test_collectionInfo() {
+ setUpTest(config.orientation).apply {
+ setAdapterSync(viewAdapterProvider(stringSequence(6)))
+
+ val initialPage = viewPager.currentItem
+ assertBasicState(initialPage)
+
+ var node = AccessibilityNodeInfo.obtain()
+ activityTestRule.runOnUiThread { viewPager.onInitializeAccessibilityNodeInfo(node) }
+ var collectionInfo = node.collectionInfo
+
+ if (config.orientation == ORIENTATION_VERTICAL) {
+ assertThat(collectionInfo.rowCount, equalTo(6))
+ assertThat(collectionInfo.columnCount, equalTo(0))
+ } else {
+ assertThat(collectionInfo.columnCount, equalTo(6))
+ assertThat(collectionInfo.rowCount, equalTo(0))
+ }
+ assertThat(collectionInfo.isHierarchical, equalTo(false))
+ if (Build.VERSION.SDK_INT >= 21) {
+ assertThat(collectionInfo.selectionMode, equalTo(0))
+ }
+ }
+ }
+
+ @Test
+ fun test_onOrientationChange() {
+ setUpTest(config.orientation).apply {
+ setAdapterSync(viewAdapterProvider(stringSequence(2)))
+
+ val initialPage = viewPager.currentItem
+ assertBasicState(initialPage)
+
+ activityTestRule.runOnUiThread {
+ viewPager.setOrientation(getOppositeOrientation(config.orientation))
+ }
+ assertBasicState(initialPage)
+ }
+ }
+
+ private fun getNextPageAction(orientation: Int, isRtl: Boolean): Int {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ if (orientation == ViewPager2.ORIENTATION_HORIZONTAL) {
+ if (isRtl) {
+ return ACTION_PAGE_LEFT.id
+ } else {
+ return ACTION_PAGE_RIGHT.id
+ }
+ }
+ return ACTION_PAGE_DOWN.id
+ }
+ return AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD
+ }
+
+ private fun getPreviousPageAction(orientation: Int, isRtl: Boolean): Int {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ if (orientation == ViewPager2.ORIENTATION_HORIZONTAL) {
+ if (isRtl) {
+ return ACTION_PAGE_RIGHT.id
+ } else {
+ return ACTION_PAGE_LEFT.id
+ }
+ }
+ return ACTION_PAGE_UP.id
+ }
+ return AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD
+ }
+
+ private fun getOppositeOrientation(orientation: Int): Int {
+ if (orientation == ViewPager2.ORIENTATION_HORIZONTAL) {
+ return ViewPager2.ORIENTATION_VERTICAL
+ } else {
+ return ViewPager2.ORIENTATION_HORIZONTAL
+ }
+ }
+}
+
+// region Test Suite creation
+
+private fun createTestSet(): List<AccessibilityTest.TestConfig> {
+ return listOf(ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL).flatMap { orientation ->
+ listOf(true, false).map { rtl ->
+ AccessibilityTest.TestConfig(orientation, rtl)
+ }
+ }
+}
+
+// endregion
diff --git a/viewpager2/src/androidTest/java/androidx/viewpager2/widget/BaseTest.kt b/viewpager2/src/androidTest/java/androidx/viewpager2/widget/BaseTest.kt
index 0f2f78c..6953cbc 100644
--- a/viewpager2/src/androidTest/java/androidx/viewpager2/widget/BaseTest.kt
+++ b/viewpager2/src/androidTest/java/androidx/viewpager2/widget/BaseTest.kt
@@ -21,8 +21,15 @@
import android.util.Log
import android.view.View
import android.view.View.OVER_SCROLL_NEVER
-import androidx.core.os.BuildCompat.isAtLeastQ
+import android.view.accessibility.AccessibilityNodeInfo
import androidx.core.view.ViewCompat
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_PAGE_DOWN
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_PAGE_LEFT
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_PAGE_RIGHT
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_PAGE_UP
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.test.core.app.ApplicationProvider
@@ -120,7 +127,7 @@
* TODO(b/130160918): remove the workaround
*/
protected fun assumeApiBeforeQ() {
- assumeThat(isAtLeastQ(), equalTo(false))
+ assumeThat(Build.VERSION.SDK_INT >= 29, equalTo(false))
}
data class Context(val activityTestRule: ActivityTestRule<TestActivity>) {
@@ -242,6 +249,92 @@
)
)
}
+
+ fun assertPageActions() {
+ var customActions = getActionList(viewPager)
+ var currentPage = viewPager.currentItem
+ var numPages = viewPager.adapter!!.itemCount
+ var isUserInputEnabled = viewPager.isUserInputEnabled
+ var isHorizontalOrientation = viewPager.orientation == ViewPager2.ORIENTATION_HORIZONTAL
+ var isVerticalOrientation = viewPager.orientation == ViewPager2.ORIENTATION_VERTICAL
+
+ val expectPageLeftAction = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP &&
+ isUserInputEnabled && isHorizontalOrientation &&
+ (if (isRtl) currentPage < numPages - 1 else currentPage > 0)
+
+ val expectPageRightAction = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP &&
+ isUserInputEnabled && isHorizontalOrientation &&
+ (if (isRtl) currentPage > 0 else currentPage < numPages - 1)
+
+ val expectPageUpAction = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP &&
+ isUserInputEnabled && isVerticalOrientation &&
+ currentPage > 0
+
+ val expectPageDownAction = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP &&
+ isUserInputEnabled && isVerticalOrientation &&
+ currentPage < numPages - 1
+
+ val expectScrollBackwardAction = Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP &&
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN &&
+ isUserInputEnabled && currentPage > 0
+
+ val expectScrollForwardAction = Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP &&
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN &&
+ isUserInputEnabled && currentPage < numPages - 1
+
+ assertThat("Left action expected: $expectPageLeftAction",
+ hasPageAction(customActions, ACTION_PAGE_LEFT.id),
+ equalTo(expectPageLeftAction)
+ )
+
+ assertThat("Right action expected: $expectPageRightAction",
+ hasPageAction(customActions, ACTION_PAGE_RIGHT.id),
+ equalTo(expectPageRightAction)
+ )
+ assertThat("Up action expected: $expectPageUpAction",
+ hasPageAction(customActions, ACTION_PAGE_UP.id),
+ equalTo(expectPageUpAction)
+ )
+ assertThat("Down action expected: $expectPageDownAction",
+ hasPageAction(customActions, ACTION_PAGE_DOWN.id),
+ equalTo(expectPageDownAction)
+ )
+
+ var node = AccessibilityNodeInfo.obtain()
+ activityTestRule.runOnUiThread { viewPager.onInitializeAccessibilityNodeInfo(node) }
+ @Suppress("DEPRECATION") var standardActions = node.actions
+
+ assertThat("scroll backward action expected: $expectScrollBackwardAction",
+ hasScrollAction(standardActions, ACTION_SCROLL_BACKWARD),
+ equalTo(expectScrollBackwardAction)
+ )
+
+ assertThat("Scroll forward action expected: $expectScrollForwardAction",
+ hasScrollAction(standardActions, ACTION_SCROLL_FORWARD),
+ equalTo(expectScrollForwardAction)
+ )
+ }
+
+ private fun hasScrollAction(
+ actions: Int,
+ accessibilityActionId: Int
+ ): Boolean {
+ return actions and accessibilityActionId != 0
+ }
+
+ private fun hasPageAction(
+ actions: List<AccessibilityNodeInfoCompat.AccessibilityActionCompat>,
+ accessibilityActionId: Int
+ ): Boolean {
+ return actions.any { it.id == accessibilityActionId }
+ }
+
+ @Suppress("UNCHECKED_CAST")
+ private fun getActionList(view: View):
+ List<AccessibilityNodeInfoCompat.AccessibilityActionCompat> {
+ return view.getTag(R.id.tag_accessibility_actions) as?
+ ArrayList<AccessibilityNodeInfoCompat.AccessibilityActionCompat> ?: ArrayList()
+ }
}
/**
@@ -385,6 +478,7 @@
if (performSelfCheck && viewPager.adapter is SelfChecking) {
(viewPager.adapter as SelfChecking).selfCheck()
}
+ assertPageActions()
}
fun ViewPager2.setCurrentItemSync(
diff --git a/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/FragmentAdapter.kt b/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/FragmentAdapter.kt
index 8eedc0f..1f786f5 100644
--- a/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/FragmentAdapter.kt
+++ b/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/FragmentAdapter.kt
@@ -75,8 +75,8 @@
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
setValue(when {
- savedInstanceState != null -> savedInstanceState.getString(ARG_KEY)
- arguments != null -> arguments!!.getString(ARG_KEY)
+ savedInstanceState != null -> savedInstanceState.getString(ARG_KEY)!!
+ arguments != null -> arguments!!.getString(ARG_KEY)!!
else -> throw IllegalStateException()
})
}
diff --git a/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/TestActivity.kt b/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/TestActivity.kt
index 3b53100..e3b7926 100644
--- a/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/TestActivity.kt
+++ b/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/TestActivity.kt
@@ -25,7 +25,7 @@
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (intent?.hasExtra(EXTRA_LANGUAGE) == true) {
- LocaleTestUtils(this).setLocale(intent.getStringExtra(EXTRA_LANGUAGE))
+ LocaleTestUtils(this).setLocale(intent.getStringExtra(EXTRA_LANGUAGE)!!)
}
setContentView(R.layout.activity_test_layout)
diff --git a/viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java b/viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
index 021f7f2..8b91e85 100644
--- a/viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
+++ b/viewpager2/src/main/java/androidx/viewpager2/widget/ViewPager2.java
@@ -16,6 +16,10 @@
package androidx.viewpager2.widget;
+import static androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_PAGE_DOWN;
+import static androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_PAGE_LEFT;
+import static androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_PAGE_RIGHT;
+import static androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_PAGE_UP;
import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
import static java.lang.annotation.RetentionPolicy.SOURCE;
@@ -35,6 +39,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
import androidx.annotation.FloatRange;
import androidx.annotation.IntDef;
@@ -44,7 +49,7 @@
import androidx.annotation.RequiresApi;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
-import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat;
+import androidx.core.view.accessibility.AccessibilityViewCommand;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
@@ -101,6 +106,26 @@
*/
public static final int OFFSCREEN_PAGE_LIMIT_DEFAULT = 0;
+ private static final AccessibilityViewCommand ACTION_PAGE_FORWARD =
+ new AccessibilityViewCommand() {
+ @Override
+ public boolean perform(@NonNull View view, @Nullable CommandArguments arguments) {
+ ViewPager2 viewPager = (ViewPager2) view;
+ viewPager.setCurrentItem(viewPager.getCurrentItem() + 1, true);
+ return true;
+ }
+ };
+
+ private static final AccessibilityViewCommand ACTION_PAGE_BACKWARD =
+ new AccessibilityViewCommand() {
+ @Override
+ public boolean perform(@NonNull View view, @Nullable CommandArguments arguments) {
+ ViewPager2 viewPager = (ViewPager2) view;
+ viewPager.setCurrentItem(viewPager.getCurrentItem() - 1, true);
+ return true;
+ }
+ };
+
// reused in layout(...)
private final Rect mTmpContainerRect = new Rect();
private final Rect mTmpChildRect = new Rect();
@@ -119,6 +144,7 @@
private PageTransformerAdapter mPageTransformerAdapter;
private boolean mUserInputEnabled = true;
private int mOffscreenPageLimit = OFFSCREEN_PAGE_LIMIT_DEFAULT;
+ private RecyclerView.AdapterDataObserver mAdapterDataObserver;
public ViewPager2(@NonNull Context context) {
super(context);
@@ -145,6 +171,8 @@
private void initialize(Context context, AttributeSet attrs) {
mRecyclerView = new RecyclerViewImpl(context);
mRecyclerView.setId(ViewCompat.generateViewId());
+ ViewCompat.setImportantForAccessibility(mRecyclerView,
+ ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO);
mLayoutManager = new LinearLayoutManagerImpl(context);
mRecyclerView.setLayoutManager(mLayoutManager);
@@ -169,12 +197,23 @@
new CompositeOnPageChangeCallback(3);
mScrollEventAdapter.setOnPageChangeCallback(pageChangeEventDispatcher);
+ mAdapterDataObserver = new RecyclerView.AdapterDataObserver() {
+ @Override
+ public void onChanged() {
+ super.onChanged();
+ updatePageAccessibilityActions();
+ }
+ };
+
// Callback that updates mCurrentItem after swipes. Also triggered in other cases, but in
// all those cases mCurrentItem will only be overwritten with the same value.
final OnPageChangeCallback currentItemUpdater = new OnPageChangeCallback() {
@Override
public void onPageSelected(int position) {
- mCurrentItem = position;
+ if (mCurrentItem != position) {
+ mCurrentItem = position;
+ updatePageAccessibilityActions();
+ }
}
};
@@ -189,6 +228,12 @@
pageChangeEventDispatcher.addOnPageChangeCallback(mPageTransformerAdapter);
attachViewToParent(mRecyclerView, 0, mRecyclerView.getLayoutParams());
+
+ if (ViewCompat.getImportantForAccessibility(this)
+ == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
+ ViewCompat.setImportantForAccessibility(this,
+ ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
+ }
}
/**
@@ -216,8 +261,70 @@
};
}
+ @Override
+ public CharSequence getAccessibilityClassName() {
+ return "androidx.viewpager.widget.ViewPager";
+ }
+
+ /**
+ * Update the ViewPager2's available page accessibility actions. These are updated in response
+ * to page, adapter, and orientation changes. Compatible with API >= 21.
+ */
+ void updatePageAccessibilityActions() {
+ ViewCompat.removeAccessibilityAction(this, ACTION_PAGE_LEFT.getId());
+ ViewCompat.removeAccessibilityAction(this, ACTION_PAGE_RIGHT.getId());
+ ViewCompat.removeAccessibilityAction(this, ACTION_PAGE_UP.getId());
+ ViewCompat.removeAccessibilityAction(this, ACTION_PAGE_DOWN.getId());
+
+ if (getAdapter() == null) {
+ return;
+ }
+
+ int itemCount = getAdapter().getItemCount();
+ if (itemCount == 0) {
+ return;
+ }
+
+ if (!isUserInputEnabled()) {
+ return;
+ }
+
+ if (getOrientation() == ORIENTATION_HORIZONTAL) {
+ boolean isLayoutRtl = isLayoutRtl();
+ AccessibilityNodeInfoCompat.AccessibilityActionCompat actionPageForward =
+ isLayoutRtl ? ACTION_PAGE_LEFT : ACTION_PAGE_RIGHT;
+ AccessibilityNodeInfoCompat.AccessibilityActionCompat actionPageBackward =
+ isLayoutRtl ? ACTION_PAGE_RIGHT : ACTION_PAGE_LEFT;
+
+ if (mCurrentItem < itemCount - 1) {
+ ViewCompat.replaceAccessibilityAction(this, actionPageForward, null,
+ ACTION_PAGE_FORWARD);
+ }
+ if (mCurrentItem > 0) {
+ ViewCompat.replaceAccessibilityAction(this, actionPageBackward, null,
+ ACTION_PAGE_BACKWARD);
+ }
+ } else {
+ if (mCurrentItem < itemCount - 1) {
+ ViewCompat.replaceAccessibilityAction(this, ACTION_PAGE_DOWN, null,
+ ACTION_PAGE_FORWARD);
+ }
+ if (mCurrentItem > 0) {
+ ViewCompat.replaceAccessibilityAction(this, ACTION_PAGE_UP, null,
+ ACTION_PAGE_BACKWARD);
+ }
+ }
+ }
+
+ private boolean isLayoutRtl() {
+ return ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_RTL;
+ }
+
private void setOrientation(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ViewPager2);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(context, R.styleable.ViewPager2, attrs, a, 0, 0);
+ }
try {
setOrientation(
a.getInt(R.styleable.ViewPager2_android_orientation, ORIENTATION_HORIZONTAL));
@@ -279,6 +386,7 @@
mCurrentItem = Math.max(0, Math.min(mPendingCurrentItem, adapter.getItemCount() - 1));
mPendingCurrentItem = NO_POSITION;
mRecyclerView.scrollToPosition(mCurrentItem);
+ updatePageAccessibilityActions();
}
@Override
@@ -378,8 +486,15 @@
* @see RecyclerView#setAdapter(Adapter)
*/
public void setAdapter(@Nullable Adapter adapter) {
+ Adapter oldAdapter = mRecyclerView.getAdapter();
+ if (oldAdapter != null) {
+ oldAdapter.unregisterAdapterDataObserver(mAdapterDataObserver);
+ }
+
mRecyclerView.setAdapter(adapter);
restorePendingState();
+ updatePageAccessibilityActions();
+ adapter.registerAdapterDataObserver(mAdapterDataObserver);
}
public @Nullable Adapter getAdapter() {
@@ -445,6 +560,7 @@
*/
public void setOrientation(@Orientation int orientation) {
mLayoutManager.setOrientation(orientation);
+ updatePageAccessibilityActions();
}
public @Orientation int getOrientation() {
@@ -515,6 +631,7 @@
float previousItem = mCurrentItem;
mCurrentItem = item;
+ updatePageAccessibilityActions();
if (!mScrollEventAdapter.isIdle()) {
// Scroll in progress, overwrite previousItem with actual current position
@@ -664,6 +781,10 @@
*/
public void setUserInputEnabled(boolean enabled) {
mUserInputEnabled = enabled;
+ updatePageAccessibilityActions();
+ if (Build.VERSION.SDK_INT < 21) {
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
+ }
}
/**
@@ -779,6 +900,72 @@
mPageTransformerAdapter.onPageScrolled(position, positionOffset, positionOffsetPx);
}
+ @Override
+ @RequiresApi(17)
+ public void setLayoutDirection(int layoutDirection) {
+ super.setLayoutDirection(layoutDirection);
+ updatePageAccessibilityActions();
+ }
+
+ @Override
+ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
+ super.onInitializeAccessibilityNodeInfo(info);
+ addCollectionInfo(info);
+ addScrollActions(info);
+ }
+
+ private void addCollectionInfo(AccessibilityNodeInfo info) {
+ int rowCount = 0;
+ int colCount = 0;
+ if (getAdapter() != null) {
+ if (getOrientation() == ORIENTATION_VERTICAL) {
+ rowCount = getAdapter().getItemCount();
+ } else {
+ colCount = getAdapter().getItemCount();
+ }
+ }
+ AccessibilityNodeInfoCompat nodeInfoCompat = AccessibilityNodeInfoCompat.wrap(info);
+ AccessibilityNodeInfoCompat.CollectionInfoCompat collectionInfo =
+ AccessibilityNodeInfoCompat.CollectionInfoCompat.obtain(rowCount, colCount,
+ /* hierarchical= */false,
+ AccessibilityNodeInfoCompat.CollectionInfoCompat.SELECTION_MODE_NONE);
+ nodeInfoCompat.setCollectionInfo(collectionInfo);
+ }
+
+ private void addScrollActions(AccessibilityNodeInfo info) {
+ if (Build.VERSION.SDK_INT < 21) {
+ if (getAdapter() == null) {
+ return;
+ }
+ int itemCount = mRecyclerView.getAdapter().getItemCount();
+ if (itemCount == 0 || !mUserInputEnabled) {
+ return;
+ }
+ if (mCurrentItem > 0) {
+ info.addAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD);
+ }
+ if (mCurrentItem < itemCount - 1) {
+ info.addAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD);
+ }
+ info.setScrollable(true);
+ }
+ }
+
+ @Override
+ public boolean performAccessibilityAction(int action, Bundle arguments) {
+ switch (action) {
+ case AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD:
+ case AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD:
+ int nextItem = (action == AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD)
+ ? getCurrentItem() - 1
+ : getCurrentItem() + 1;
+
+ setCurrentItem(nextItem, true);
+ return true;
+ }
+ return super.performAccessibilityAction(action, arguments);
+ }
+
/**
* Slightly modified RecyclerView to get ViewPager behavior in accessibility and to
* enable/disable user scrolling.
@@ -789,15 +976,12 @@
}
@Override
- public CharSequence getAccessibilityClassName() {
- return "androidx.viewpager.widget.ViewPager";
- }
-
- @Override
public void onInitializeAccessibilityEvent(@NonNull AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
event.setFromIndex(mCurrentItem);
event.setToIndex(mCurrentItem);
+ event.setSource(ViewPager2.this);
+ event.setClassName(ViewPager2.this.getAccessibilityClassName());
}
@SuppressLint("ClickableViewAccessibility")
@@ -813,8 +997,7 @@
}
/**
- * Slightly modified LinearLayoutManager to adjust accessibility when user scrolling is
- * disabled.
+ * LinearLayoutManager that uses calculateExtraLayoutSpace to implement mOffscreenPageLimit
*/
private class LinearLayoutManagerImpl extends LinearLayoutManager {
LinearLayoutManagerImpl(Context context) {
@@ -822,31 +1005,6 @@
}
@Override
- public boolean performAccessibilityAction(@NonNull RecyclerView.Recycler recycler,
- @NonNull RecyclerView.State state, int action, @Nullable Bundle args) {
- switch (action) {
- case AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD:
- case AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD:
- if (!isUserInputEnabled()) {
- return false;
- }
- break;
- }
- return super.performAccessibilityAction(recycler, state, action, args);
- }
-
- @Override
- public void onInitializeAccessibilityNodeInfo(@NonNull RecyclerView.Recycler recycler,
- @NonNull RecyclerView.State state, @NonNull AccessibilityNodeInfoCompat info) {
- super.onInitializeAccessibilityNodeInfo(recycler, state, info);
- if (!isUserInputEnabled()) {
- info.removeAction(AccessibilityActionCompat.ACTION_SCROLL_BACKWARD);
- info.removeAction(AccessibilityActionCompat.ACTION_SCROLL_FORWARD);
- info.setScrollable(false);
- }
- }
-
- @Override
protected void calculateExtraLayoutSpace(@NonNull RecyclerView.State state,
@NonNull int[] extraLayoutSpace) {
int pageLimit = getOffscreenPageLimit();
diff --git a/wear/api/1.1.0-alpha01.txt b/wear/api/1.1.0-alpha01.txt
index 6609d67..325310e 100644
--- a/wear/api/1.1.0-alpha01.txt
+++ b/wear/api/1.1.0-alpha01.txt
@@ -19,6 +19,14 @@
@Deprecated public final class AmbientMode extends android.app.Fragment {
ctor @Deprecated public AmbientMode();
method @Deprecated public static <T extends android.app.Activity> androidx.wear.ambient.AmbientMode.AmbientController! attachAmbientSupport(T!);
+ method @Deprecated public void dump(String!, java.io.FileDescriptor!, java.io.PrintWriter!, String[]!);
+ method @Deprecated @CallSuper public void onAttach(android.content.Context!);
+ method @Deprecated @CallSuper public void onCreate(android.os.Bundle!);
+ method @Deprecated @CallSuper public void onDestroy();
+ method @Deprecated @CallSuper public void onDetach();
+ method @Deprecated @CallSuper public void onPause();
+ method @Deprecated @CallSuper public void onResume();
+ method @Deprecated @CallSuper public void onStop();
field @Deprecated public static final String EXTRA_BURN_IN_PROTECTION = "com.google.android.wearable.compat.extra.BURN_IN_PROTECTION";
field @Deprecated public static final String EXTRA_LOWBIT_AMBIENT = "com.google.android.wearable.compat.extra.LOWBIT_AMBIENT";
field @Deprecated public static final String FRAGMENT_TAG = "android.support.wearable.ambient.AmbientMode";
diff --git a/wear/api/current.txt b/wear/api/current.txt
index 6609d67..325310e 100644
--- a/wear/api/current.txt
+++ b/wear/api/current.txt
@@ -19,6 +19,14 @@
@Deprecated public final class AmbientMode extends android.app.Fragment {
ctor @Deprecated public AmbientMode();
method @Deprecated public static <T extends android.app.Activity> androidx.wear.ambient.AmbientMode.AmbientController! attachAmbientSupport(T!);
+ method @Deprecated public void dump(String!, java.io.FileDescriptor!, java.io.PrintWriter!, String[]!);
+ method @Deprecated @CallSuper public void onAttach(android.content.Context!);
+ method @Deprecated @CallSuper public void onCreate(android.os.Bundle!);
+ method @Deprecated @CallSuper public void onDestroy();
+ method @Deprecated @CallSuper public void onDetach();
+ method @Deprecated @CallSuper public void onPause();
+ method @Deprecated @CallSuper public void onResume();
+ method @Deprecated @CallSuper public void onStop();
field @Deprecated public static final String EXTRA_BURN_IN_PROTECTION = "com.google.android.wearable.compat.extra.BURN_IN_PROTECTION";
field @Deprecated public static final String EXTRA_LOWBIT_AMBIENT = "com.google.android.wearable.compat.extra.LOWBIT_AMBIENT";
field @Deprecated public static final String FRAGMENT_TAG = "android.support.wearable.ambient.AmbientMode";
diff --git a/wear/src/main/java/androidx/wear/widget/CircledImageView.java b/wear/src/main/java/androidx/wear/widget/CircledImageView.java
index 43ed817..8168e43 100644
--- a/wear/src/main/java/androidx/wear/widget/CircledImageView.java
+++ b/wear/src/main/java/androidx/wear/widget/CircledImageView.java
@@ -31,6 +31,7 @@
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
@@ -127,6 +128,9 @@
super(context, attrs, defStyle);
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.CircledImageView);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(context, R.styleable.CircledImageView, attrs, a, 0, 0);
+ }
mDrawable = a.getDrawable(R.styleable.CircledImageView_android_src);
if (mDrawable != null && mDrawable.getConstantState() != null) {
// The provided Drawable may be used elsewhere, so make a mutable clone before setTint()
diff --git a/wear/src/main/java/androidx/wear/widget/WearableRecyclerView.java b/wear/src/main/java/androidx/wear/widget/WearableRecyclerView.java
index a538479..34c8c9c 100644
--- a/wear/src/main/java/androidx/wear/widget/WearableRecyclerView.java
+++ b/wear/src/main/java/androidx/wear/widget/WearableRecyclerView.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Point;
+import android.os.Build;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@@ -84,6 +85,10 @@
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.WearableRecyclerView,
defStyle, defStyleRes);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.WearableRecyclerView, attrs, a, defStyle, defStyleRes);
+ }
setCircularScrollingGestureEnabled(
a.getBoolean(
diff --git a/wear/src/main/java/androidx/wear/widget/drawer/WearableActionDrawerView.java b/wear/src/main/java/androidx/wear/widget/drawer/WearableActionDrawerView.java
index 8674247..9739daf 100644
--- a/wear/src/main/java/androidx/wear/widget/drawer/WearableActionDrawerView.java
+++ b/wear/src/main/java/androidx/wear/widget/drawer/WearableActionDrawerView.java
@@ -20,6 +20,7 @@
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
@@ -119,6 +120,12 @@
TypedArray typedArray = context.obtainStyledAttributes(
attrs, R.styleable.WearableActionDrawerView, defStyleAttr, 0 /* defStyleRes */);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.WearableActionDrawerView, attrs, typedArray,
+ defStyleAttr, 0);
+ }
+
try {
mTitle = typedArray.getString(R.styleable.WearableActionDrawerView_drawerTitle);
showOverflowInPeek = typedArray.getBoolean(
diff --git a/wear/src/main/java/androidx/wear/widget/drawer/WearableDrawerView.java b/wear/src/main/java/androidx/wear/widget/drawer/WearableDrawerView.java
index 87b43b8..4314cd5 100644
--- a/wear/src/main/java/androidx/wear/widget/drawer/WearableDrawerView.java
+++ b/wear/src/main/java/androidx/wear/widget/drawer/WearableDrawerView.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -466,6 +467,11 @@
context.obtainStyledAttributes(
attrs, R.styleable.WearableDrawerView, defStyleAttr,
R.style.Widget_Wear_WearableDrawerView);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.WearableDrawerView, attrs, typedArray, defStyleAttr,
+ R.style.Widget_Wear_WearableDrawerView);
+ }
Drawable background =
getDrawable(context, typedArray, R.styleable.WearableDrawerView_android_background);
diff --git a/wear/src/main/java/androidx/wear/widget/drawer/WearableNavigationDrawerView.java b/wear/src/main/java/androidx/wear/widget/drawer/WearableNavigationDrawerView.java
index 667d177..0217bb1 100644
--- a/wear/src/main/java/androidx/wear/widget/drawer/WearableNavigationDrawerView.java
+++ b/wear/src/main/java/androidx/wear/widget/drawer/WearableNavigationDrawerView.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
@@ -143,6 +144,12 @@
defStyleAttr,
0 /* defStyleRes */);
+ if (Build.VERSION.SDK_INT >= 29) {
+ saveAttributeDataForStyleable(
+ context, R.styleable.WearableNavigationDrawerView, attrs, typedArray,
+ defStyleAttr, 0);
+ }
+
//noinspection WrongConstant
navStyle = typedArray.getInt(
R.styleable.WearableNavigationDrawerView_navigationStyle, DEFAULT_STYLE);