summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt119
-rw-r--r--api/system-current.txt4
-rw-r--r--api/test-current.txt1
-rw-r--r--core/java/android/app/role/RoleControllerManager.java5
-rw-r--r--core/java/android/os/LocaleList.java3
-rw-r--r--core/java/android/os/VibrationEffect.java1
-rw-r--r--core/java/android/view/IWindowSession.aidl4
-rw-r--r--core/java/android/view/MenuInflater.java2
-rw-r--r--core/java/android/view/MenuItem.java13
-rw-r--r--core/java/android/view/View.java42
-rw-r--r--core/java/android/widget/AbsSeekBar.java106
-rw-r--r--core/java/android/widget/CheckedTextView.java46
-rw-r--r--core/java/android/widget/CompoundButton.java53
-rw-r--r--core/java/android/widget/ImageView.java55
-rw-r--r--core/java/android/widget/ProgressBar.java167
-rw-r--r--core/java/android/widget/Switch.java91
-rw-r--r--core/java/android/widget/TextView.java51
-rw-r--r--core/java/com/android/internal/app/AbstractResolverComparator.java25
-rw-r--r--core/java/com/android/internal/app/AppPredictionServiceResolverComparator.java119
-rw-r--r--core/java/com/android/internal/app/ChooserActivity.java31
-rw-r--r--core/java/com/android/internal/app/ResolverListController.java16
-rw-r--r--core/java/com/android/internal/app/ResolverRankerServiceResolverComparator.java14
-rw-r--r--core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java14
-rw-r--r--core/java/com/android/internal/infra/AbstractRemoteService.java13
-rw-r--r--core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java9
-rwxr-xr-xcore/res/res/anim/lock_in.xml6
-rwxr-xr-xcore/res/res/anim/lock_lock.xml6
-rw-r--r--core/res/res/anim/lock_scanning.xml6
-rwxr-xr-xcore/res/res/anim/lock_to_error.xml6
-rwxr-xr-xcore/res/res/anim/lock_unlock.xml6
-rw-r--r--core/res/res/drawable/ic_lock.xml4
-rw-r--r--core/res/res/drawable/ic_lock_open.xml4
-rw-r--r--graphics/java/android/graphics/BaseCanvas.java4
-rw-r--r--graphics/java/android/graphics/BaseRecordingCanvas.java4
-rw-r--r--graphics/java/android/graphics/Canvas.java3
-rw-r--r--graphics/java/android/graphics/ComposeShader.java6
-rw-r--r--graphics/java/android/graphics/Paint.java7
-rw-r--r--graphics/java/android/graphics/PorterDuff.java3
-rw-r--r--graphics/java/android/graphics/PorterDuffColorFilter.java4
-rw-r--r--graphics/java/android/graphics/PorterDuffXfermode.java4
-rw-r--r--graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java4
-rw-r--r--graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java4
-rw-r--r--graphics/java/android/graphics/drawable/BitmapDrawable.java2
-rw-r--r--graphics/java/android/graphics/drawable/ColorDrawable.java2
-rw-r--r--graphics/java/android/graphics/drawable/ColorStateListDrawable.java6
-rw-r--r--graphics/java/android/graphics/drawable/Drawable.java21
-rw-r--r--graphics/java/android/graphics/drawable/DrawableContainer.java6
-rw-r--r--graphics/java/android/graphics/drawable/DrawableWrapper.java4
-rw-r--r--graphics/java/android/graphics/drawable/GradientDrawable.java2
-rw-r--r--graphics/java/android/graphics/drawable/Icon.java7
-rw-r--r--graphics/java/android/graphics/drawable/LayerDrawable.java4
-rw-r--r--graphics/java/android/graphics/drawable/NinePatchDrawable.java2
-rw-r--r--graphics/java/android/graphics/drawable/ShapeDrawable.java2
-rw-r--r--graphics/java/android/graphics/drawable/VectorDrawable.java2
-rw-r--r--media/apex/java/android/media/MediaController2.java2
-rw-r--r--media/apex/java/android/media/MediaSession2.java6
-rw-r--r--media/apex/java/android/media/MediaSession2Service.java10
-rw-r--r--packages/DynamicSystemInstallationService/res/values/strings.xml34
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtilsInternal.java39
-rw-r--r--packages/SystemUI/res-keyguard/drawable/bubble_hour_hand.xml13
-rw-r--r--packages/SystemUI/res-keyguard/drawable/bubble_minute_hand.xml13
-rw-r--r--packages/SystemUI/res-keyguard/layout/bubble_clock.xml8
-rw-r--r--packages/SystemUI/res-keyguard/layout/keyguard_message_area.xml40
-rw-r--r--packages/SystemUI/res-keyguard/layout/keyguard_message_area_large.xml31
-rw-r--r--packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml4
-rw-r--r--packages/SystemUI/res-keyguard/layout/keyguard_pattern_view.xml5
-rw-r--r--packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml4
-rw-r--r--packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml4
-rw-r--r--packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml4
-rw-r--r--packages/SystemUI/res-keyguard/values/strings.xml2
-rw-r--r--packages/SystemUI/res/layout/keyguard_bottom_area.xml15
-rw-r--r--packages/SystemUI/res/layout/super_status_bar.xml27
-rw-r--r--packages/SystemUI/res/values/dimens.xml4
-rw-r--r--packages/SystemUI/res/values/strings.xml4
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java7
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java61
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java4
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java4
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java20
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java10
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java10
-rw-r--r--packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java103
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java159
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java107
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java22
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java68
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java12
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardMessageAreaTest.java24
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt7
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java9
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt1
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java1
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java41
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java8
-rw-r--r--services/core/java/com/android/server/VibratorService.java4
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java37
-rw-r--r--services/core/java/com/android/server/am/LowMemDetector.java92
-rw-r--r--services/core/java/com/android/server/wm/DragDropController.java4
-rw-r--r--services/core/java/com/android/server/wm/DragState.java7
-rw-r--r--services/core/java/com/android/server/wm/Session.java4
-rw-r--r--services/core/java/com/android/server/wm/TaskPositioner.java21
-rw-r--r--services/core/jni/Android.bp2
-rw-r--r--services/core/jni/com_android_server_am_LowMemDetector.cpp156
-rw-r--r--services/core/jni/onload.cpp2
-rw-r--r--services/tests/mockingservicestests/Android.bp1
-rw-r--r--services/tests/servicestests/Android.bp1
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/DragDropControllerTests.java2
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/TaskPositionerTests.java15
-rwxr-xr-xtelephony/java/android/telephony/CarrierConfigManager.java16
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java46
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl4
121 files changed, 1750 insertions, 848 deletions
diff --git a/api/current.txt b/api/current.txt
index b434776a4403..ab698db7fc3a 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -13791,7 +13791,7 @@ package android.graphics {
method public void drawCircle(float, float, float, @NonNull android.graphics.Paint);
method public void drawColor(@ColorInt int);
method public void drawColor(@ColorLong long);
- method @Deprecated public void drawColor(@ColorInt int, @NonNull android.graphics.PorterDuff.Mode);
+ method public void drawColor(@ColorInt int, @NonNull android.graphics.PorterDuff.Mode);
method public void drawColor(@ColorInt int, @NonNull android.graphics.BlendMode);
method public void drawColor(@ColorLong long, @NonNull android.graphics.BlendMode);
method public void drawDoubleRoundRect(@NonNull android.graphics.RectF, float, float, @NonNull android.graphics.RectF, float, float, @NonNull android.graphics.Paint);
@@ -14108,7 +14108,7 @@ package android.graphics {
public class ComposeShader extends android.graphics.Shader {
ctor @Deprecated public ComposeShader(@NonNull android.graphics.Shader, @NonNull android.graphics.Shader, @NonNull android.graphics.Xfermode);
- ctor @Deprecated public ComposeShader(@NonNull android.graphics.Shader, @NonNull android.graphics.Shader, @NonNull android.graphics.PorterDuff.Mode);
+ ctor public ComposeShader(@NonNull android.graphics.Shader, @NonNull android.graphics.Shader, @NonNull android.graphics.PorterDuff.Mode);
ctor public ComposeShader(@NonNull android.graphics.Shader, @NonNull android.graphics.Shader, @NonNull android.graphics.BlendMode);
}
@@ -14497,7 +14497,7 @@ package android.graphics {
method @Px public float getUnderlinePosition();
method @Px public float getUnderlineThickness();
method @Px public float getWordSpacing();
- method @Deprecated public android.graphics.Xfermode getXfermode();
+ method public android.graphics.Xfermode getXfermode();
method public boolean hasGlyph(String);
method public final boolean isAntiAlias();
method public final boolean isDither();
@@ -14554,7 +14554,7 @@ package android.graphics {
method public android.graphics.Typeface setTypeface(android.graphics.Typeface);
method public void setUnderlineText(boolean);
method public void setWordSpacing(@Px float);
- method @Deprecated public android.graphics.Xfermode setXfermode(android.graphics.Xfermode);
+ method public android.graphics.Xfermode setXfermode(android.graphics.Xfermode);
field public static final int ANTI_ALIAS_FLAG = 1; // 0x1
field public static final int CURSOR_AFTER = 0; // 0x0
field public static final int CURSOR_AT = 4; // 0x4
@@ -14803,37 +14803,37 @@ package android.graphics {
field public float y;
}
- @Deprecated public class PorterDuff {
- ctor @Deprecated public PorterDuff();
+ public class PorterDuff {
+ ctor public PorterDuff();
}
- @Deprecated public enum PorterDuff.Mode {
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode ADD;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode CLEAR;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode DARKEN;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode DST;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode DST_ATOP;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode DST_IN;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode DST_OUT;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode DST_OVER;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode LIGHTEN;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode MULTIPLY;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode OVERLAY;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode SCREEN;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode SRC;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode SRC_ATOP;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode SRC_IN;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode SRC_OUT;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode SRC_OVER;
- enum_constant @Deprecated public static final android.graphics.PorterDuff.Mode XOR;
+ public enum PorterDuff.Mode {
+ enum_constant public static final android.graphics.PorterDuff.Mode ADD;
+ enum_constant public static final android.graphics.PorterDuff.Mode CLEAR;
+ enum_constant public static final android.graphics.PorterDuff.Mode DARKEN;
+ enum_constant public static final android.graphics.PorterDuff.Mode DST;
+ enum_constant public static final android.graphics.PorterDuff.Mode DST_ATOP;
+ enum_constant public static final android.graphics.PorterDuff.Mode DST_IN;
+ enum_constant public static final android.graphics.PorterDuff.Mode DST_OUT;
+ enum_constant public static final android.graphics.PorterDuff.Mode DST_OVER;
+ enum_constant public static final android.graphics.PorterDuff.Mode LIGHTEN;
+ enum_constant public static final android.graphics.PorterDuff.Mode MULTIPLY;
+ enum_constant public static final android.graphics.PorterDuff.Mode OVERLAY;
+ enum_constant public static final android.graphics.PorterDuff.Mode SCREEN;
+ enum_constant public static final android.graphics.PorterDuff.Mode SRC;
+ enum_constant public static final android.graphics.PorterDuff.Mode SRC_ATOP;
+ enum_constant public static final android.graphics.PorterDuff.Mode SRC_IN;
+ enum_constant public static final android.graphics.PorterDuff.Mode SRC_OUT;
+ enum_constant public static final android.graphics.PorterDuff.Mode SRC_OVER;
+ enum_constant public static final android.graphics.PorterDuff.Mode XOR;
}
- @Deprecated public class PorterDuffColorFilter extends android.graphics.ColorFilter {
- ctor @Deprecated public PorterDuffColorFilter(@ColorInt int, @NonNull android.graphics.PorterDuff.Mode);
+ public class PorterDuffColorFilter extends android.graphics.ColorFilter {
+ ctor public PorterDuffColorFilter(@ColorInt int, @NonNull android.graphics.PorterDuff.Mode);
}
- @Deprecated public class PorterDuffXfermode extends android.graphics.Xfermode {
- ctor @Deprecated public PorterDuffXfermode(android.graphics.PorterDuff.Mode);
+ public class PorterDuffXfermode extends android.graphics.Xfermode {
+ ctor public PorterDuffXfermode(android.graphics.PorterDuff.Mode);
}
public interface PostProcessor {
@@ -15394,9 +15394,9 @@ package android.graphics.drawable {
method public final boolean setLevel(@IntRange(from=0, to=10000) int);
method public boolean setState(@NonNull int[]);
method public void setTint(@ColorInt int);
+ method public void setTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setTintList(@Nullable android.content.res.ColorStateList);
- method @Deprecated public void setTintMode(@Nullable android.graphics.PorterDuff.Mode);
- method public void setTintMode(@Nullable android.graphics.BlendMode);
+ method public void setTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public boolean setVisible(boolean, boolean);
method public void unscheduleSelf(@NonNull Runnable);
}
@@ -15553,9 +15553,9 @@ package android.graphics.drawable {
method public void loadDrawableAsync(android.content.Context, android.os.Message);
method public void loadDrawableAsync(android.content.Context, android.graphics.drawable.Icon.OnDrawableLoadedListener, android.os.Handler);
method public android.graphics.drawable.Icon setTint(@ColorInt int);
+ method @NonNull public android.graphics.drawable.Icon setTintBlendMode(@NonNull android.graphics.BlendMode);
method public android.graphics.drawable.Icon setTintList(android.content.res.ColorStateList);
- method @Deprecated @NonNull public android.graphics.drawable.Icon setTintMode(@NonNull android.graphics.PorterDuff.Mode);
- method @NonNull public android.graphics.drawable.Icon setTintMode(@NonNull android.graphics.BlendMode);
+ method @NonNull public android.graphics.drawable.Icon setTintMode(@NonNull android.graphics.PorterDuff.Mode);
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.graphics.drawable.Icon> CREATOR;
field public static final int TYPE_ADAPTIVE_BITMAP = 5; // 0x5
@@ -24656,7 +24656,7 @@ package android.media {
public class MediaController2 implements java.lang.AutoCloseable {
method public void cancelSessionCommand(@NonNull Object);
method public void close();
- method @Nullable public android.media.Session2Token getConnectedSessionToken();
+ method @Nullable public android.media.Session2Token getConnectedToken();
method public boolean isPlaybackActive();
method @NonNull public Object sendSessionCommand(@NonNull android.media.Session2Command, @Nullable android.os.Bundle);
}
@@ -25821,8 +25821,8 @@ package android.media {
method public void cancelSessionCommand(@NonNull android.media.MediaSession2.ControllerInfo, @NonNull Object);
method public void close();
method @NonNull public java.util.List<android.media.MediaSession2.ControllerInfo> getConnectedControllers();
- method @NonNull public String getSessionId();
- method @NonNull public android.media.Session2Token getSessionToken();
+ method @NonNull public String getId();
+ method @NonNull public android.media.Session2Token getToken();
method public boolean isPlaybackActive();
method @NonNull public Object sendSessionCommand(@NonNull android.media.MediaSession2.ControllerInfo, @NonNull android.media.Session2Command, @Nullable android.os.Bundle);
method public void setPlaybackActive(boolean);
@@ -34595,6 +34595,7 @@ package android.os {
method @Nullable public java.util.Locale getFirstMatch(String[]);
method @IntRange(from=0xffffffff) public int indexOf(java.util.Locale);
method public boolean isEmpty();
+ method public static boolean isPseudoLocale(@Nullable android.icu.util.ULocale);
method public static void setDefault(@NonNull @Size(min=1) android.os.LocaleList);
method @IntRange(from=0) public int size();
method @NonNull public String toLanguageTags();
@@ -49453,7 +49454,7 @@ package android.view {
method public android.graphics.drawable.Drawable getIcon();
method @Nullable public default android.graphics.BlendMode getIconTintBlendMode();
method @Nullable public default android.content.res.ColorStateList getIconTintList();
- method @Deprecated @Nullable public default android.graphics.PorterDuff.Mode getIconTintMode();
+ method @Nullable public default android.graphics.PorterDuff.Mode getIconTintMode();
method public android.content.Intent getIntent();
method public int getItemId();
method public android.view.ContextMenu.ContextMenuInfo getMenuInfo();
@@ -49481,9 +49482,9 @@ package android.view {
method public android.view.MenuItem setEnabled(boolean);
method public android.view.MenuItem setIcon(android.graphics.drawable.Drawable);
method public android.view.MenuItem setIcon(@DrawableRes int);
+ method @NonNull public default android.view.MenuItem setIconTintBlendMode(@Nullable android.graphics.BlendMode);
method public default android.view.MenuItem setIconTintList(@Nullable android.content.res.ColorStateList);
- method @Deprecated @NonNull public default android.view.MenuItem setIconTintMode(@Nullable android.graphics.PorterDuff.Mode);
- method @NonNull public default android.view.MenuItem setIconTintMode(@Nullable android.graphics.BlendMode);
+ method @NonNull public default android.view.MenuItem setIconTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public android.view.MenuItem setIntent(android.content.Intent);
method public android.view.MenuItem setNumericShortcut(char);
method public default android.view.MenuItem setNumericShortcut(char, int);
@@ -50136,9 +50137,9 @@ package android.view {
method public int getAutofillType();
method @Nullable public android.view.autofill.AutofillValue getAutofillValue();
method public android.graphics.drawable.Drawable getBackground();
- method @Nullable public android.graphics.BlendMode getBackgroundBlendMode();
+ method @Nullable public android.graphics.BlendMode getBackgroundTintBlendMode();
method @Nullable public android.content.res.ColorStateList getBackgroundTintList();
- method @Deprecated @Nullable public android.graphics.PorterDuff.Mode getBackgroundTintMode();
+ method @Nullable public android.graphics.PorterDuff.Mode getBackgroundTintMode();
method @android.view.ViewDebug.ExportedProperty(category="layout") public int getBaseline();
method @android.view.ViewDebug.CapturedViewProperty public final int getBottom();
method protected float getBottomFadingEdgeStrength();
@@ -50169,10 +50170,10 @@ package android.view {
method public java.util.ArrayList<android.view.View> getFocusables(int);
method public void getFocusedRect(android.graphics.Rect);
method public android.graphics.drawable.Drawable getForeground();
- method @Nullable public android.graphics.BlendMode getForegroundBlendMode();
method public int getForegroundGravity();
+ method @Nullable public android.graphics.BlendMode getForegroundTintBlendMode();
method @Nullable public android.content.res.ColorStateList getForegroundTintList();
- method @Deprecated @Nullable public android.graphics.PorterDuff.Mode getForegroundTintMode();
+ method @Nullable public android.graphics.PorterDuff.Mode getForegroundTintMode();
method public boolean getGlobalVisibleRect(android.graphics.Rect, android.graphics.Point);
method public final boolean getGlobalVisibleRect(android.graphics.Rect);
method public android.os.Handler getHandler();
@@ -50484,9 +50485,9 @@ package android.view {
method public void setBackgroundColor(@ColorInt int);
method @Deprecated public void setBackgroundDrawable(android.graphics.drawable.Drawable);
method public void setBackgroundResource(@DrawableRes int);
+ method public void setBackgroundTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setBackgroundTintList(@Nullable android.content.res.ColorStateList);
- method @Deprecated public void setBackgroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
- method public void setBackgroundTintMode(@Nullable android.graphics.BlendMode);
+ method public void setBackgroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public final void setBottom(int);
method public void setCameraDistance(float);
method public void setClickable(boolean);
@@ -50512,9 +50513,9 @@ package android.view {
method public void setForceDarkAllowed(boolean);
method public void setForeground(android.graphics.drawable.Drawable);
method public void setForegroundGravity(int);
+ method public void setForegroundTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setForegroundTintList(@Nullable android.content.res.ColorStateList);
- method @Deprecated public void setForegroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
- method public void setForegroundTintMode(@Nullable android.graphics.BlendMode);
+ method public void setForegroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setHapticFeedbackEnabled(boolean);
method public void setHasTransientState(boolean);
method public void setHorizontalFadingEdgeEnabled(boolean);
@@ -54850,18 +54851,22 @@ package android.widget {
method public boolean getSplitTrack();
method public android.graphics.drawable.Drawable getThumb();
method public int getThumbOffset();
+ method @Nullable public android.graphics.BlendMode getThumbTintBlendMode();
method @Nullable public android.content.res.ColorStateList getThumbTintList();
method @Nullable public android.graphics.PorterDuff.Mode getThumbTintMode();
method public android.graphics.drawable.Drawable getTickMark();
+ method @Nullable public android.graphics.BlendMode getTickMarkTintBlendMode();
method @Nullable public android.content.res.ColorStateList getTickMarkTintList();
method @Nullable public android.graphics.PorterDuff.Mode getTickMarkTintMode();
method public void setKeyProgressIncrement(int);
method public void setSplitTrack(boolean);
method public void setThumb(android.graphics.drawable.Drawable);
method public void setThumbOffset(int);
+ method public void setThumbTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setThumbTintList(@Nullable android.content.res.ColorStateList);
method public void setThumbTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setTickMark(android.graphics.drawable.Drawable);
+ method public void setTickMarkTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setTickMarkTintList(@Nullable android.content.res.ColorStateList);
method public void setTickMarkTintMode(@Nullable android.graphics.PorterDuff.Mode);
}
@@ -55260,11 +55265,13 @@ package android.widget {
ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int);
ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int, int);
method public android.graphics.drawable.Drawable getCheckMarkDrawable();
+ method @Nullable public android.graphics.BlendMode getCheckMarkTintBlendMode();
method @Nullable public android.content.res.ColorStateList getCheckMarkTintList();
method @Nullable public android.graphics.PorterDuff.Mode getCheckMarkTintMode();
method @android.view.ViewDebug.ExportedProperty public boolean isChecked();
method public void setCheckMarkDrawable(@DrawableRes int);
method public void setCheckMarkDrawable(@Nullable android.graphics.drawable.Drawable);
+ method public void setCheckMarkTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setCheckMarkTintList(@Nullable android.content.res.ColorStateList);
method public void setCheckMarkTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setChecked(boolean);
@@ -55299,11 +55306,13 @@ package android.widget {
ctor public CompoundButton(android.content.Context, android.util.AttributeSet, int);
ctor public CompoundButton(android.content.Context, android.util.AttributeSet, int, int);
method @Nullable public android.graphics.drawable.Drawable getButtonDrawable();
+ method @Nullable public android.graphics.BlendMode getButtonTintBlendMode();
method @Nullable public android.content.res.ColorStateList getButtonTintList();
method @Nullable public android.graphics.PorterDuff.Mode getButtonTintMode();
method @android.view.ViewDebug.ExportedProperty public boolean isChecked();
method public void setButtonDrawable(@DrawableRes int);
method public void setButtonDrawable(@Nullable android.graphics.drawable.Drawable);
+ method public void setButtonTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setButtonTintList(@Nullable android.content.res.ColorStateList);
method public void setButtonTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setChecked(boolean);
@@ -55792,6 +55801,7 @@ package android.widget {
method public android.graphics.drawable.Drawable getDrawable();
method public int getImageAlpha();
method public android.graphics.Matrix getImageMatrix();
+ method @Nullable public android.graphics.BlendMode getImageTintBlendMode();
method @Nullable public android.content.res.ColorStateList getImageTintList();
method @Nullable public android.graphics.PorterDuff.Mode getImageTintMode();
method public int getMaxHeight();
@@ -55815,6 +55825,7 @@ package android.widget {
method public void setImageMatrix(android.graphics.Matrix);
method public void setImageResource(@DrawableRes int);
method public void setImageState(int[], boolean);
+ method public void setImageTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setImageTintList(@Nullable android.content.res.ColorStateList);
method public void setImageTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setImageURI(@Nullable android.net.Uri);
@@ -56268,6 +56279,7 @@ package android.widget {
ctor public ProgressBar(android.content.Context, android.util.AttributeSet, int, int);
method @Nullable public android.graphics.drawable.Drawable getCurrentDrawable();
method public android.graphics.drawable.Drawable getIndeterminateDrawable();
+ method @Nullable public android.graphics.BlendMode getIndeterminateTintBlendMode();
method @Nullable public android.content.res.ColorStateList getIndeterminateTintList();
method @Nullable public android.graphics.PorterDuff.Mode getIndeterminateTintMode();
method public android.view.animation.Interpolator getInterpolator();
@@ -56278,12 +56290,15 @@ package android.widget {
method @Px public int getMinHeight();
method @Px public int getMinWidth();
method @android.view.ViewDebug.ExportedProperty(category="progress") public int getProgress();
+ method @Nullable public android.graphics.BlendMode getProgressBackgroundTintBlendMode();
method @Nullable public android.content.res.ColorStateList getProgressBackgroundTintList();
method @Nullable public android.graphics.PorterDuff.Mode getProgressBackgroundTintMode();
method public android.graphics.drawable.Drawable getProgressDrawable();
+ method @Nullable public android.graphics.BlendMode getProgressTintBlendMode();
method @Nullable public android.content.res.ColorStateList getProgressTintList();
method @Nullable public android.graphics.PorterDuff.Mode getProgressTintMode();
method @android.view.ViewDebug.ExportedProperty(category="progress") public int getSecondaryProgress();
+ method @Nullable public android.graphics.BlendMode getSecondaryProgressTintBlendMode();
method @Nullable public android.content.res.ColorStateList getSecondaryProgressTintList();
method @Nullable public android.graphics.PorterDuff.Mode getSecondaryProgressTintMode();
method public final void incrementProgressBy(int);
@@ -56295,6 +56310,7 @@ package android.widget {
method public void setIndeterminate(boolean);
method public void setIndeterminateDrawable(android.graphics.drawable.Drawable);
method public void setIndeterminateDrawableTiled(android.graphics.drawable.Drawable);
+ method public void setIndeterminateTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setIndeterminateTintList(@Nullable android.content.res.ColorStateList);
method public void setIndeterminateTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setInterpolator(android.content.Context, @InterpolatorRes int);
@@ -56307,13 +56323,16 @@ package android.widget {
method public void setMinWidth(@Px int);
method public void setProgress(int);
method public void setProgress(int, boolean);
+ method public void setProgressBackgroundTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setProgressBackgroundTintList(@Nullable android.content.res.ColorStateList);
method public void setProgressBackgroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setProgressDrawable(android.graphics.drawable.Drawable);
method public void setProgressDrawableTiled(android.graphics.drawable.Drawable);
+ method public void setProgressTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setProgressTintList(@Nullable android.content.res.ColorStateList);
method public void setProgressTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setSecondaryProgress(int);
+ method public void setSecondaryProgressTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setSecondaryProgressTintList(@Nullable android.content.res.ColorStateList);
method public void setSecondaryProgressTintMode(@Nullable android.graphics.PorterDuff.Mode);
}
@@ -56862,9 +56881,11 @@ package android.widget {
method public CharSequence getTextOn();
method public android.graphics.drawable.Drawable getThumbDrawable();
method public int getThumbTextPadding();
+ method @Nullable public android.graphics.BlendMode getThumbTintBlendMode();
method @Nullable public android.content.res.ColorStateList getThumbTintList();
method @Nullable public android.graphics.PorterDuff.Mode getThumbTintMode();
method public android.graphics.drawable.Drawable getTrackDrawable();
+ method @Nullable public android.graphics.BlendMode getTrackTintBlendMode();
method @Nullable public android.content.res.ColorStateList getTrackTintList();
method @Nullable public android.graphics.PorterDuff.Mode getTrackTintMode();
method public void onMeasure(int, int);
@@ -56880,10 +56901,12 @@ package android.widget {
method public void setThumbDrawable(android.graphics.drawable.Drawable);
method public void setThumbResource(@DrawableRes int);
method public void setThumbTextPadding(int);
+ method public void setThumbTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setThumbTintList(@Nullable android.content.res.ColorStateList);
method public void setThumbTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setTrackDrawable(android.graphics.drawable.Drawable);
method public void setTrackResource(@DrawableRes int);
+ method public void setTrackTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setTrackTintList(@Nullable android.content.res.ColorStateList);
method public void setTrackTintMode(@Nullable android.graphics.PorterDuff.Mode);
}
@@ -57041,6 +57064,7 @@ package android.widget {
method public int getAutoSizeTextType();
method public int getBreakStrategy();
method public int getCompoundDrawablePadding();
+ method @Nullable public android.graphics.BlendMode getCompoundDrawableTintBlendMode();
method public android.content.res.ColorStateList getCompoundDrawableTintList();
method public android.graphics.PorterDuff.Mode getCompoundDrawableTintMode();
method @NonNull public android.graphics.drawable.Drawable[] getCompoundDrawables();
@@ -57166,6 +57190,7 @@ package android.widget {
method public void setAutoSizeTextTypeWithDefaults(int);
method public void setBreakStrategy(int);
method public void setCompoundDrawablePadding(int);
+ method public void setCompoundDrawableTintBlendMode(@Nullable android.graphics.BlendMode);
method public void setCompoundDrawableTintList(@Nullable android.content.res.ColorStateList);
method public void setCompoundDrawableTintMode(@Nullable android.graphics.PorterDuff.Mode);
method public void setCompoundDrawables(@Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable);
diff --git a/api/system-current.txt b/api/system-current.txt
index b60e850249ef..d08039d81dab 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5373,10 +5373,6 @@ package android.os {
field @NonNull public static final android.os.Parcelable.Creator<android.os.IncidentReportArgs> CREATOR;
}
- public final class LocaleList implements android.os.Parcelable {
- method public static boolean isPseudoLocale(@Nullable android.icu.util.ULocale);
- }
-
public final class NativeHandle implements java.io.Closeable {
ctor public NativeHandle();
ctor public NativeHandle(@NonNull java.io.FileDescriptor, boolean);
diff --git a/api/test-current.txt b/api/test-current.txt
index 49fa55809260..63c8df047f90 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -2010,6 +2010,7 @@ package android.os {
field public static final int EFFECT_STRENGTH_LIGHT = 0; // 0x0
field public static final int EFFECT_STRENGTH_MEDIUM = 1; // 0x1
field public static final int EFFECT_STRENGTH_STRONG = 2; // 0x2
+ field public static final int EFFECT_TEXTURE_TICK = 21; // 0x15
field public static final int EFFECT_THUD = 3; // 0x3
field public static final int[] RINGTONES;
}
diff --git a/core/java/android/app/role/RoleControllerManager.java b/core/java/android/app/role/RoleControllerManager.java
index 394a0d64b3e4..9186b3d5e15a 100644
--- a/core/java/android/app/role/RoleControllerManager.java
+++ b/core/java/android/app/role/RoleControllerManager.java
@@ -275,6 +275,11 @@ public class RoleControllerManager {
Log.e(LOG_TAG, "Error calling grantDefaultRoles()", e);
}
}
+
+ @Override
+ protected void onFailed() {
+ mRemoteCallback.sendResult(null);
+ }
}
/**
diff --git a/core/java/android/os/LocaleList.java b/core/java/android/os/LocaleList.java
index 351df1bf23e0..011810b6de48 100644
--- a/core/java/android/os/LocaleList.java
+++ b/core/java/android/os/LocaleList.java
@@ -20,7 +20,6 @@ import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Size;
-import android.annotation.SystemApi;
import android.annotation.UnsupportedAppUsage;
import android.content.LocaleProto;
import android.icu.util.ULocale;
@@ -328,9 +327,7 @@ public final class LocaleList implements Parcelable {
/**
* Returns true if locale is a pseudo-locale, false otherwise.
- * {@hide}
*/
- @SystemApi
public static boolean isPseudoLocale(@Nullable ULocale locale) {
return isPseudoLocale(locale != null ? locale.toLocale() : null);
}
diff --git a/core/java/android/os/VibrationEffect.java b/core/java/android/os/VibrationEffect.java
index 7958ddd29c70..035061b614f8 100644
--- a/core/java/android/os/VibrationEffect.java
+++ b/core/java/android/os/VibrationEffect.java
@@ -104,6 +104,7 @@ public abstract class VibrationEffect implements Parcelable {
* @see #get(int)
* @hide
*/
+ @TestApi
public static final int EFFECT_TEXTURE_TICK = Effect.TEXTURE_TICK;
/** {@hide} */
diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl
index d317df05cc6e..b52fdb8399d1 100644
--- a/core/java/android/view/IWindowSession.aidl
+++ b/core/java/android/view/IWindowSession.aidl
@@ -187,8 +187,10 @@ interface IWindowSession {
/**
* Cancel the current drag operation.
+ * skipAnimation is 'true' when it should skip the drag cancel animation which brings the drag
+ * shadow image back to the drag start position.
*/
- void cancelDragAndDrop(IBinder dragToken);
+ void cancelDragAndDrop(IBinder dragToken, boolean skipAnimation);
/**
* Tell the OS that we've just dragged into a View that is willing to accept the drop
diff --git a/core/java/android/view/MenuInflater.java b/core/java/android/view/MenuInflater.java
index 8b3b10f48a4a..b6b11ab9249b 100644
--- a/core/java/android/view/MenuInflater.java
+++ b/core/java/android/view/MenuInflater.java
@@ -488,7 +488,7 @@ public class MenuInflater {
}
if (mItemIconBlendMode != null) {
- item.setIconTintMode(mItemIconBlendMode);
+ item.setIconTintBlendMode(mItemIconBlendMode);
}
if (itemIconTintList != null) {
diff --git a/core/java/android/view/MenuItem.java b/core/java/android/view/MenuItem.java
index 37853103ce02..a2fb596f743e 100644
--- a/core/java/android/view/MenuItem.java
+++ b/core/java/android/view/MenuItem.java
@@ -270,11 +270,8 @@ public interface MenuItem {
* @attr ref android.R.styleable#MenuItem_iconTintMode
* @see #setIconTintList(ColorStateList)
* @see Drawable#setTintMode(PorterDuff.Mode)
- * @see Drawable#setTintMode(BlendMode)
- *
- * @deprecated use {@link #setIconTintMode(BlendMode)} instead
+ * @see Drawable#setTintBlendMode(BlendMode)
*/
- @Deprecated
default @NonNull MenuItem setIconTintMode(@Nullable PorterDuff.Mode tintMode) {
return this;
}
@@ -289,7 +286,7 @@ public interface MenuItem {
* @attr ref android.R.styleable#MenuItem_iconTintMode
* @see #setIconTintList(ColorStateList)
*/
- default @NonNull MenuItem setIconTintMode(@Nullable BlendMode blendMode) {
+ default @NonNull MenuItem setIconTintBlendMode(@Nullable BlendMode blendMode) {
PorterDuff.Mode mode = BlendMode.blendModeToPorterDuffMode(blendMode);
if (mode != null) {
return setIconTintMode(mode);
@@ -304,11 +301,9 @@ public interface MenuItem {
* @return the blending mode used to apply the tint to this item's icon
* @attr ref android.R.styleable#MenuItem_iconTintMode
* @see #setIconTintMode(PorterDuff.Mode)
- * @see #setIconTintMode(BlendMode)
+ * @see #setIconTintBlendMode(BlendMode)
*
- * @deprecated Use {@link #getIconTintBlendMode()} instead
*/
- @Deprecated
@Nullable
public default PorterDuff.Mode getIconTintMode() { return null; }
@@ -317,7 +312,7 @@ public interface MenuItem {
*
* @return the blending mode used to apply the tint to this item's icon
* @attr ref android.R.styleable#MenuItem_iconTintMode
- * @see #setIconTintMode(BlendMode)
+ * @see #setIconTintBlendMode(BlendMode)
*
*/
@Nullable
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 096c988c8cf1..5929c1b4d6e6 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -5608,7 +5608,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
break;
case R.styleable.View_foregroundTintMode:
if (targetSdkVersion >= Build.VERSION_CODES.M || this instanceof FrameLayout) {
- setForegroundTintMode(Drawable.parseBlendMode(a.getInt(attr, -1), null));
+ setForegroundTintBlendMode(
+ Drawable.parseBlendMode(a.getInt(attr, -1),
+ null));
}
break;
case R.styleable.View_foregroundTint:
@@ -22873,17 +22875,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @attr ref android.R.styleable#View_backgroundTintMode
* @see #getBackgroundTintMode()
* @see Drawable#setTintMode(PorterDuff.Mode)
- *
- * @deprecated use @setBackgroundTintMode(BlendMode) instead
*/
- @Deprecated
public void setBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
BlendMode mode = null;
if (tintMode != null) {
mode = BlendMode.fromValue(tintMode.nativeInt);
}
- setBackgroundTintMode(mode);
+ setBackgroundTintBlendMode(mode);
}
/**
@@ -22895,9 +22894,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* {@code null} to clear tint
* @attr ref android.R.styleable#View_backgroundTintMode
* @see #getBackgroundTintMode()
- * @see Drawable#setTintMode(BlendMode)
+ * @see Drawable#setTintBlendMode(BlendMode)
*/
- public void setBackgroundTintMode(@Nullable BlendMode blendMode) {
+ public void setBackgroundTintBlendMode(@Nullable BlendMode blendMode) {
if (mBackgroundTint == null) {
mBackgroundTint = new TintInfo();
}
@@ -22915,13 +22914,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @return the blending mode used to apply the tint to the background
* drawable
* @attr ref android.R.styleable#View_backgroundTintMode
- * @see #setBackgroundTintMode(BlendMode)
+ * @see #setBackgroundTintBlendMode(BlendMode)
*
- * @deprecated use #getBackgroundBlendMode() instead
*/
@Nullable
@InspectableProperty
- @Deprecated
public PorterDuff.Mode getBackgroundTintMode() {
PorterDuff.Mode porterDuffMode;
if (mBackgroundTint != null && mBackgroundTint.mBlendMode != null) {
@@ -22939,9 +22936,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @return the blending mode used to apply the tint to the background
* drawable, null if no blend has previously been configured
* @attr ref android.R.styleable#View_backgroundTintMode
- * @see #setBackgroundTintMode(BlendMode)
+ * @see #setBackgroundTintBlendMode(BlendMode)
*/
- public @Nullable BlendMode getBackgroundBlendMode() {
+ public @Nullable BlendMode getBackgroundTintBlendMode() {
return mBackgroundTint != null ? mBackgroundTint.mBlendMode : null;
}
@@ -22956,7 +22953,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
if (tintInfo.mHasTintMode) {
- mBackground.setTintMode(tintInfo.mBlendMode);
+ mBackground.setTintBlendMode(tintInfo.mBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -23141,15 +23138,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @see #getForegroundTintMode()
* @see Drawable#setTintMode(PorterDuff.Mode)
*
- * @deprecated use #setForegroundTintMode(BlendMode)
*/
- @Deprecated
public void setForegroundTintMode(@Nullable PorterDuff.Mode tintMode) {
BlendMode mode = null;
if (tintMode != null) {
mode = BlendMode.fromValue(tintMode.nativeInt);
}
- setForegroundTintMode(mode);
+ setForegroundTintBlendMode(mode);
}
/**
@@ -23161,9 +23156,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* {@code null} to clear tint
* @attr ref android.R.styleable#View_foregroundTintMode
* @see #getForegroundTintMode()
- * @see Drawable#setTintMode(BlendMode)
+ * @see Drawable#setTintBlendMode(BlendMode)
*/
- public void setForegroundTintMode(@Nullable BlendMode blendMode) {
+ public void setForegroundTintBlendMode(@Nullable BlendMode blendMode) {
if (mForegroundInfo == null) {
mForegroundInfo = new ForegroundInfo();
}
@@ -23184,12 +23179,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* drawable
* @attr ref android.R.styleable#View_foregroundTintMode
* @see #setForegroundTintMode(PorterDuff.Mode)
- *
- * @deprecated use #getForegroundBlendMode() instead
*/
@InspectableProperty
@Nullable
- @Deprecated
public PorterDuff.Mode getForegroundTintMode() {
BlendMode blendMode = mForegroundInfo != null && mForegroundInfo.mTintInfo != null
? mForegroundInfo.mTintInfo.mBlendMode : null;
@@ -23207,10 +23199,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @return the blending mode used to apply the tint to the foreground
* drawable
* @attr ref android.R.styleable#View_foregroundTintMode
- * @see #setForegroundTintMode(BlendMode)
+ * @see #setForegroundTintBlendMode(BlendMode)
*
*/
- public @Nullable BlendMode getForegroundBlendMode() {
+ public @Nullable BlendMode getForegroundTintBlendMode() {
return mForegroundInfo != null && mForegroundInfo.mTintInfo != null
? mForegroundInfo.mTintInfo.mBlendMode : null;
}
@@ -23227,7 +23219,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
if (tintInfo.mHasTintMode) {
- mForegroundInfo.mDrawable.setTintMode(tintInfo.mBlendMode);
+ mForegroundInfo.mDrawable.setTintBlendMode(tintInfo.mBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -25464,7 +25456,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
if (mAttachInfo.mDragToken != null) {
try {
- mAttachInfo.mSession.cancelDragAndDrop(mAttachInfo.mDragToken);
+ mAttachInfo.mSession.cancelDragAndDrop(mAttachInfo.mDragToken, false);
} catch (Exception e) {
Log.e(VIEW_LOG_TAG, "Unable to cancel drag", e);
}
diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java
index cd5f2e222b39..18c6abb3f5f1 100644
--- a/core/java/android/widget/AbsSeekBar.java
+++ b/core/java/android/widget/AbsSeekBar.java
@@ -22,6 +22,7 @@ import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.Insets;
import android.graphics.PorterDuff;
@@ -48,15 +49,15 @@ public abstract class AbsSeekBar extends ProgressBar {
@UnsupportedAppUsage
private Drawable mThumb;
private ColorStateList mThumbTintList = null;
- private PorterDuff.Mode mThumbTintMode = null;
+ private BlendMode mThumbBlendMode = null;
private boolean mHasThumbTint = false;
- private boolean mHasThumbTintMode = false;
+ private boolean mHasThumbBlendMode = false;
private Drawable mTickMark;
private ColorStateList mTickMarkTintList = null;
- private PorterDuff.Mode mTickMarkTintMode = null;
+ private BlendMode mTickMarkBlendMode = null;
private boolean mHasTickMarkTint = false;
- private boolean mHasTickMarkTintMode = false;
+ private boolean mHasTickMarkBlendMode = false;
private int mThumbOffset;
@UnsupportedAppUsage
@@ -114,9 +115,9 @@ public abstract class AbsSeekBar extends ProgressBar {
setThumb(thumb);
if (a.hasValue(R.styleable.SeekBar_thumbTintMode)) {
- mThumbTintMode = Drawable.parseTintMode(a.getInt(
- R.styleable.SeekBar_thumbTintMode, -1), mThumbTintMode);
- mHasThumbTintMode = true;
+ mThumbBlendMode = Drawable.parseBlendMode(a.getInt(
+ R.styleable.SeekBar_thumbTintMode, -1), mThumbBlendMode);
+ mHasThumbBlendMode = true;
}
if (a.hasValue(R.styleable.SeekBar_thumbTint)) {
@@ -128,9 +129,9 @@ public abstract class AbsSeekBar extends ProgressBar {
setTickMark(tickMark);
if (a.hasValue(R.styleable.SeekBar_tickMarkTintMode)) {
- mTickMarkTintMode = Drawable.parseTintMode(a.getInt(
- R.styleable.SeekBar_tickMarkTintMode, -1), mTickMarkTintMode);
- mHasTickMarkTintMode = true;
+ mTickMarkBlendMode = Drawable.parseBlendMode(a.getInt(
+ R.styleable.SeekBar_tickMarkTintMode, -1), mTickMarkBlendMode);
+ mHasTickMarkBlendMode = true;
}
if (a.hasValue(R.styleable.SeekBar_tickMarkTint)) {
@@ -274,9 +275,25 @@ public abstract class AbsSeekBar extends ProgressBar {
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setThumbTintMode(@Nullable PorterDuff.Mode tintMode) {
- mThumbTintMode = tintMode;
- mHasThumbTintMode = true;
+ setThumbTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) :
+ null);
+ }
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setThumbTintList(ColorStateList)}} to the thumb drawable. The
+ * default mode is {@link BlendMode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ *
+ * @attr ref android.R.styleable#SeekBar_thumbTintMode
+ * @see #getThumbTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setThumbTintBlendMode(@Nullable BlendMode blendMode) {
+ mThumbBlendMode = blendMode;
+ mHasThumbBlendMode = true;
applyThumbTint();
}
@@ -291,19 +308,33 @@ public abstract class AbsSeekBar extends ProgressBar {
@InspectableProperty
@Nullable
public PorterDuff.Mode getThumbTintMode() {
- return mThumbTintMode;
+ return mThumbBlendMode != null
+ ? BlendMode.blendModeToPorterDuffMode(mThumbBlendMode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the thumb drawable,
+ * if specified.
+ *
+ * @return the blending mode used to apply the tint to the thumb drawable
+ * @attr ref android.R.styleable#SeekBar_thumbTintMode
+ * @see #setThumbTintBlendMode(BlendMode)
+ */
+ @Nullable
+ public BlendMode getThumbTintBlendMode() {
+ return mThumbBlendMode;
}
private void applyThumbTint() {
- if (mThumb != null && (mHasThumbTint || mHasThumbTintMode)) {
+ if (mThumb != null && (mHasThumbTint || mHasThumbBlendMode)) {
mThumb = mThumb.mutate();
if (mHasThumbTint) {
mThumb.setTintList(mThumbTintList);
}
- if (mHasThumbTintMode) {
- mThumb.setTintMode(mThumbTintMode);
+ if (mHasThumbBlendMode) {
+ mThumb.setTintBlendMode(mThumbBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -430,8 +461,24 @@ public abstract class AbsSeekBar extends ProgressBar {
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setTickMarkTintMode(@Nullable PorterDuff.Mode tintMode) {
- mTickMarkTintMode = tintMode;
- mHasTickMarkTintMode = true;
+ setTickMarkTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setTickMarkTintList(ColorStateList)}} to the tick mark drawable. The
+ * default mode is {@link BlendMode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ *
+ * @attr ref android.R.styleable#SeekBar_tickMarkTintMode
+ * @see #getTickMarkTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setTickMarkTintBlendMode(@Nullable BlendMode blendMode) {
+ mTickMarkBlendMode = blendMode;
+ mHasTickMarkBlendMode = true;
applyTickMarkTint();
}
@@ -447,19 +494,34 @@ public abstract class AbsSeekBar extends ProgressBar {
@InspectableProperty
@Nullable
public PorterDuff.Mode getTickMarkTintMode() {
- return mTickMarkTintMode;
+ return mTickMarkBlendMode != null
+ ? BlendMode.blendModeToPorterDuffMode(mTickMarkBlendMode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the tick mark drawable,
+ * if specified.
+ *
+ * @return the blending mode used to apply the tint to the tick mark drawable
+ * @attr ref android.R.styleable#SeekBar_tickMarkTintMode
+ * @see #setTickMarkTintMode(PorterDuff.Mode)
+ */
+ @InspectableProperty(attributeId = android.R.styleable.SeekBar_tickMarkTintMode)
+ @Nullable
+ public BlendMode getTickMarkTintBlendMode() {
+ return mTickMarkBlendMode;
}
private void applyTickMarkTint() {
- if (mTickMark != null && (mHasTickMarkTint || mHasTickMarkTintMode)) {
+ if (mTickMark != null && (mHasTickMarkTint || mHasTickMarkBlendMode)) {
mTickMark = mTickMark.mutate();
if (mHasTickMarkTint) {
mTickMark.setTintList(mTickMarkTintList);
}
- if (mHasTickMarkTintMode) {
- mTickMark.setTintMode(mTickMarkTintMode);
+ if (mHasTickMarkBlendMode) {
+ mTickMark.setTintBlendMode(mTickMarkBlendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java
index a211b4686f4c..8b70f41f050c 100644
--- a/core/java/android/widget/CheckedTextView.java
+++ b/core/java/android/widget/CheckedTextView.java
@@ -23,6 +23,7 @@ import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
@@ -58,7 +59,7 @@ public class CheckedTextView extends TextView implements Checkable {
@UnsupportedAppUsage
private Drawable mCheckMarkDrawable;
private ColorStateList mCheckMarkTintList = null;
- private PorterDuff.Mode mCheckMarkTintMode = null;
+ private BlendMode mCheckMarkBlendMode = null;
private boolean mHasCheckMarkTint = false;
private boolean mHasCheckMarkTintMode = false;
@@ -99,8 +100,9 @@ public class CheckedTextView extends TextView implements Checkable {
}
if (a.hasValue(R.styleable.CheckedTextView_checkMarkTintMode)) {
- mCheckMarkTintMode = Drawable.parseTintMode(a.getInt(
- R.styleable.CheckedTextView_checkMarkTintMode, -1), mCheckMarkTintMode);
+ mCheckMarkBlendMode = Drawable.parseBlendMode(a.getInt(
+ R.styleable.CheckedTextView_checkMarkTintMode, -1),
+ mCheckMarkBlendMode);
mHasCheckMarkTintMode = true;
}
@@ -259,7 +261,23 @@ public class CheckedTextView extends TextView implements Checkable {
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setCheckMarkTintMode(@Nullable PorterDuff.Mode tintMode) {
- mCheckMarkTintMode = tintMode;
+ setCheckMarkTintBlendMode(tintMode != null
+ ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setCheckMarkTintList(ColorStateList)} to the check mark
+ * drawable. The default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param tintMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#CheckedTextView_checkMarkTintMode
+ * @see #setCheckMarkTintList(ColorStateList)
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setCheckMarkTintBlendMode(@Nullable BlendMode tintMode) {
+ mCheckMarkBlendMode = tintMode;
mHasCheckMarkTintMode = true;
applyCheckMarkTint();
@@ -277,7 +295,23 @@ public class CheckedTextView extends TextView implements Checkable {
@InspectableProperty
@Nullable
public PorterDuff.Mode getCheckMarkTintMode() {
- return mCheckMarkTintMode;
+ return mCheckMarkBlendMode != null
+ ? BlendMode.blendModeToPorterDuffMode(mCheckMarkBlendMode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the check mark
+ * drawable, if specified.
+ *
+ * @return the blending mode used to apply the tint to the check mark
+ * drawable
+ * @attr ref android.R.styleable#CheckedTextView_checkMarkTintMode
+ * @see #setCheckMarkTintMode(PorterDuff.Mode)
+ */
+ @InspectableProperty(attributeId = android.R.styleable.CheckedTextView_checkMarkTintMode)
+ @Nullable
+ public BlendMode getCheckMarkTintBlendMode() {
+ return mCheckMarkBlendMode;
}
private void applyCheckMarkTint() {
@@ -289,7 +323,7 @@ public class CheckedTextView extends TextView implements Checkable {
}
if (mHasCheckMarkTintMode) {
- mCheckMarkDrawable.setTintMode(mCheckMarkTintMode);
+ mCheckMarkDrawable.setTintBlendMode(mCheckMarkBlendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index 80ec1c65293b..2674ca4d159a 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -23,6 +23,7 @@ import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
@@ -67,9 +68,9 @@ public abstract class CompoundButton extends Button implements Checkable {
@UnsupportedAppUsage
private Drawable mButtonDrawable;
private ColorStateList mButtonTintList = null;
- private PorterDuff.Mode mButtonTintMode = null;
+ private BlendMode mButtonBlendMode = null;
private boolean mHasButtonTint = false;
- private boolean mHasButtonTintMode = false;
+ private boolean mHasButtonBlendMode = false;
@UnsupportedAppUsage
private OnCheckedChangeListener mOnCheckedChangeListener;
@@ -109,9 +110,9 @@ public abstract class CompoundButton extends Button implements Checkable {
}
if (a.hasValue(R.styleable.CompoundButton_buttonTintMode)) {
- mButtonTintMode = Drawable.parseTintMode(a.getInt(
- R.styleable.CompoundButton_buttonTintMode, -1), mButtonTintMode);
- mHasButtonTintMode = true;
+ mButtonBlendMode = Drawable.parseBlendMode(a.getInt(
+ R.styleable.CompoundButton_buttonTintMode, -1), mButtonBlendMode);
+ mHasButtonBlendMode = true;
}
if (a.hasValue(R.styleable.CompoundButton_buttonTint)) {
@@ -337,8 +338,23 @@ public abstract class CompoundButton extends Button implements Checkable {
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setButtonTintMode(@Nullable PorterDuff.Mode tintMode) {
- mButtonTintMode = tintMode;
- mHasButtonTintMode = true;
+ setButtonTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setButtonTintList(ColorStateList)}} to the button drawable. The
+ * default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param tintMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#CompoundButton_buttonTintMode
+ * @see #getButtonTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setButtonTintBlendMode(@Nullable BlendMode tintMode) {
+ mButtonBlendMode = tintMode;
+ mHasButtonBlendMode = true;
applyButtonTint();
}
@@ -348,22 +364,35 @@ public abstract class CompoundButton extends Button implements Checkable {
* @attr ref android.R.styleable#CompoundButton_buttonTintMode
* @see #setButtonTintMode(PorterDuff.Mode)
*/
- @InspectableProperty
+ @InspectableProperty(name = "buttonTintMode")
@Nullable
public PorterDuff.Mode getButtonTintMode() {
- return mButtonTintMode;
+ return mButtonBlendMode != null ? BlendMode.blendModeToPorterDuffMode(mButtonBlendMode) :
+ null;
+ }
+
+ /**
+ * @return the blending mode used to apply the tint to the button drawable
+ * @attr ref android.R.styleable#CompoundButton_buttonTintMode
+ * @see #setButtonTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(name = "buttonBlendMode",
+ attributeId = R.styleable.CompoundButton_buttonTintMode)
+ @Nullable
+ public BlendMode getButtonTintBlendMode() {
+ return mButtonBlendMode;
}
private void applyButtonTint() {
- if (mButtonDrawable != null && (mHasButtonTint || mHasButtonTintMode)) {
+ if (mButtonDrawable != null && (mHasButtonTint || mHasButtonBlendMode)) {
mButtonDrawable = mButtonDrawable.mutate();
if (mHasButtonTint) {
mButtonDrawable.setTintList(mButtonTintList);
}
- if (mHasButtonTintMode) {
- mButtonDrawable.setTintMode(mButtonTintMode);
+ if (mHasButtonBlendMode) {
+ mButtonDrawable.setTintBlendMode(mButtonBlendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java
index 9ae62ef8ab7a..be5d2211c670 100644
--- a/core/java/android/widget/ImageView.java
+++ b/core/java/android/widget/ImageView.java
@@ -27,6 +27,7 @@ import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.ImageDecoder;
@@ -127,9 +128,9 @@ public class ImageView extends View {
@UnsupportedAppUsage
private BitmapDrawable mRecycleableBitmapDrawable = null;
private ColorStateList mDrawableTintList = null;
- private PorterDuff.Mode mDrawableTintMode = null;
+ private BlendMode mDrawableBlendMode = null;
private boolean mHasDrawableTint = false;
- private boolean mHasDrawableTintMode = false;
+ private boolean mHasDrawableBlendMode = false;
private int[] mState = null;
private boolean mMergeState = false;
@@ -226,14 +227,14 @@ public class ImageView extends View {
// Prior to L, this attribute would always set a color filter with
// blending mode SRC_ATOP. Preserve that default behavior.
- mDrawableTintMode = PorterDuff.Mode.SRC_ATOP;
- mHasDrawableTintMode = true;
+ mDrawableBlendMode = BlendMode.SRC_ATOP;
+ mHasDrawableBlendMode = true;
}
if (a.hasValue(R.styleable.ImageView_tintMode)) {
- mDrawableTintMode = Drawable.parseTintMode(a.getInt(
- R.styleable.ImageView_tintMode, -1), mDrawableTintMode);
- mHasDrawableTintMode = true;
+ mDrawableBlendMode = Drawable.parseBlendMode(a.getInt(
+ R.styleable.ImageView_tintMode, -1), mDrawableBlendMode);
+ mHasDrawableBlendMode = true;
}
applyImageTint();
@@ -674,8 +675,23 @@ public class ImageView extends View {
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setImageTintMode(@Nullable PorterDuff.Mode tintMode) {
- mDrawableTintMode = tintMode;
- mHasDrawableTintMode = true;
+ setImageTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setImageTintList(ColorStateList)}} to the image drawable. The default
+ * mode is {@link BlendMode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#ImageView_tintMode
+ * @see #getImageTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setImageTintBlendMode(@Nullable BlendMode blendMode) {
+ mDrawableBlendMode = blendMode;
+ mHasDrawableBlendMode = true;
applyImageTint();
}
@@ -689,19 +705,32 @@ public class ImageView extends View {
@Nullable
@InspectableProperty(name = "tintMode")
public PorterDuff.Mode getImageTintMode() {
- return mDrawableTintMode;
+ return mDrawableBlendMode != null
+ ? BlendMode.blendModeToPorterDuffMode(mDrawableBlendMode) : null;
+ }
+
+ /**
+ * Gets the blending mode used to apply the tint to the image Drawable
+ * @return the blending mode used to apply the tint to the image Drawable
+ * @attr ref android.R.styleable#ImageView_tintMode
+ * @see #setImageTintBlendMode(BlendMode)
+ */
+ @Nullable
+ @InspectableProperty(name = "blendMode", attributeId = android.R.styleable.ImageView_tintMode)
+ public BlendMode getImageTintBlendMode() {
+ return mDrawableBlendMode;
}
private void applyImageTint() {
- if (mDrawable != null && (mHasDrawableTint || mHasDrawableTintMode)) {
+ if (mDrawable != null && (mHasDrawableTint || mHasDrawableBlendMode)) {
mDrawable = mDrawable.mutate();
if (mHasDrawableTint) {
mDrawable.setTintList(mDrawableTintList);
}
- if (mHasDrawableTintMode) {
- mDrawable.setTintMode(mDrawableTintMode);
+ if (mHasDrawableBlendMode) {
+ mDrawable.setTintBlendMode(mDrawableBlendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index 0b433b1f9dca..2e9574345692 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -25,6 +25,7 @@ import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.Rect;
@@ -334,7 +335,7 @@ public class ProgressBar extends View {
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mProgressTintMode = Drawable.parseTintMode(a.getInt(
+ mProgressTintInfo.mProgressBlendMode = Drawable.parseBlendMode(a.getInt(
R.styleable.ProgressBar_progressTintMode, -1), null);
mProgressTintInfo.mHasProgressTintMode = true;
}
@@ -352,7 +353,7 @@ public class ProgressBar extends View {
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mProgressBackgroundTintMode = Drawable.parseTintMode(a.getInt(
+ mProgressTintInfo.mProgressBackgroundBlendMode = Drawable.parseBlendMode(a.getInt(
R.styleable.ProgressBar_progressBackgroundTintMode, -1), null);
mProgressTintInfo.mHasProgressBackgroundTintMode = true;
}
@@ -370,7 +371,7 @@ public class ProgressBar extends View {
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mSecondaryProgressTintMode = Drawable.parseTintMode(
+ mProgressTintInfo.mSecondaryProgressBlendMode = Drawable.parseBlendMode(
a.getInt(R.styleable.ProgressBar_secondaryProgressTintMode, -1), null);
mProgressTintInfo.mHasSecondaryProgressTintMode = true;
}
@@ -388,7 +389,7 @@ public class ProgressBar extends View {
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mIndeterminateTintMode = Drawable.parseTintMode(a.getInt(
+ mProgressTintInfo.mIndeterminateBlendMode = Drawable.parseBlendMode(a.getInt(
R.styleable.ProgressBar_indeterminateTintMode, -1), null);
mProgressTintInfo.mHasIndeterminateTintMode = true;
}
@@ -796,12 +797,29 @@ public class ProgressBar extends View {
* @attr ref android.R.styleable#ProgressBar_indeterminateTintMode
* @see #setIndeterminateTintList(ColorStateList)
* @see Drawable#setTintMode(PorterDuff.Mode)
+ *
*/
public void setIndeterminateTintMode(@Nullable PorterDuff.Mode tintMode) {
+ setIndeterminateTintBlendMode(tintMode != null
+ ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setIndeterminateTintList(ColorStateList)} to the indeterminate
+ * drawable. The default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#ProgressBar_indeterminateTintMode
+ * @see #setIndeterminateTintList(ColorStateList)
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setIndeterminateTintBlendMode(@Nullable BlendMode blendMode) {
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mIndeterminateTintMode = tintMode;
+ mProgressTintInfo.mIndeterminateBlendMode = blendMode;
mProgressTintInfo.mHasIndeterminateTintMode = true;
applyIndeterminateTint();
@@ -819,7 +837,23 @@ public class ProgressBar extends View {
@InspectableProperty
@Nullable
public PorterDuff.Mode getIndeterminateTintMode() {
- return mProgressTintInfo != null ? mProgressTintInfo.mIndeterminateTintMode : null;
+ BlendMode mode = getIndeterminateTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the indeterminate
+ * drawable, if specified.
+ *
+ * @return the blending mode used to apply the tint to the indeterminate
+ * drawable
+ * @attr ref android.R.styleable#ProgressBar_indeterminateTintMode
+ * @see #setIndeterminateTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(attributeId = R.styleable.ProgressBar_indeterminateTintMode)
+ @Nullable
+ public BlendMode getIndeterminateTintBlendMode() {
+ return mProgressTintInfo != null ? mProgressTintInfo.mIndeterminateBlendMode : null;
}
private void applyIndeterminateTint() {
@@ -833,7 +867,7 @@ public class ProgressBar extends View {
}
if (tintInfo.mHasIndeterminateTintMode) {
- mIndeterminateDrawable.setTintMode(tintInfo.mIndeterminateTintMode);
+ mIndeterminateDrawable.setTintBlendMode(tintInfo.mIndeterminateBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -956,7 +990,7 @@ public class ProgressBar extends View {
target.setTintList(mProgressTintInfo.mProgressTintList);
}
if (mProgressTintInfo.mHasProgressTintMode) {
- target.setTintMode(mProgressTintInfo.mProgressTintMode);
+ target.setTintBlendMode(mProgressTintInfo.mProgressBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -981,7 +1015,7 @@ public class ProgressBar extends View {
target.setTintList(mProgressTintInfo.mProgressBackgroundTintList);
}
if (mProgressTintInfo.mHasProgressBackgroundTintMode) {
- target.setTintMode(mProgressTintInfo.mProgressBackgroundTintMode);
+ target.setTintBlendMode(mProgressTintInfo.mProgressBackgroundBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -1006,7 +1040,7 @@ public class ProgressBar extends View {
target.setTintList(mProgressTintInfo.mSecondaryProgressTintList);
}
if (mProgressTintInfo.mHasSecondaryProgressTintMode) {
- target.setTintMode(mProgressTintInfo.mSecondaryProgressTintMode);
+ target.setTintBlendMode(mProgressTintInfo.mSecondaryProgressBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -1076,10 +1110,25 @@ public class ProgressBar extends View {
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setProgressTintMode(@Nullable PorterDuff.Mode tintMode) {
+ setProgressTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setProgressTintList(ColorStateList)}} to the progress
+ * indicator. The default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#ProgressBar_progressTintMode
+ * @see #getProgressTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setProgressTintBlendMode(@Nullable BlendMode blendMode) {
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mProgressTintMode = tintMode;
+ mProgressTintInfo.mProgressBlendMode = blendMode;
mProgressTintInfo.mHasProgressTintMode = true;
if (mProgressDrawable != null) {
@@ -1099,7 +1148,23 @@ public class ProgressBar extends View {
@InspectableProperty
@Nullable
public PorterDuff.Mode getProgressTintMode() {
- return mProgressTintInfo != null ? mProgressTintInfo.mProgressTintMode : null;
+ BlendMode mode = getProgressTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the progress
+ * drawable, if specified.
+ *
+ * @return the blending mode used to apply the tint to the progress
+ * drawable
+ * @attr ref android.R.styleable#ProgressBar_progressTintMode
+ * @see #setProgressTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(attributeId = android.R.styleable.ProgressBar_progressTintMode)
+ @Nullable
+ public BlendMode getProgressTintBlendMode() {
+ return mProgressTintInfo != null ? mProgressTintInfo.mProgressBlendMode : null;
}
/**
@@ -1160,10 +1225,26 @@ public class ProgressBar extends View {
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setProgressBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
+ setProgressBackgroundTintBlendMode(tintMode != null
+ ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setProgressBackgroundTintList(ColorStateList)}} to the progress
+ * background. The default mode is {@link BlendMode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#ProgressBar_progressBackgroundTintMode
+ * @see #setProgressBackgroundTintList(ColorStateList)
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setProgressBackgroundTintBlendMode(@Nullable BlendMode blendMode) {
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mProgressBackgroundTintMode = tintMode;
+ mProgressTintInfo.mProgressBackgroundBlendMode = blendMode;
mProgressTintInfo.mHasProgressBackgroundTintMode = true;
if (mProgressDrawable != null) {
@@ -1180,7 +1261,20 @@ public class ProgressBar extends View {
@InspectableProperty
@Nullable
public PorterDuff.Mode getProgressBackgroundTintMode() {
- return mProgressTintInfo != null ? mProgressTintInfo.mProgressBackgroundTintMode : null;
+ BlendMode mode = getProgressBackgroundTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * @return the blending mode used to apply the tint to the progress
+ * background
+ * @attr ref android.R.styleable#ProgressBar_progressBackgroundTintMode
+ * @see #setProgressBackgroundTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(attributeId = R.styleable.ProgressBar_progressBackgroundTintMode)
+ @Nullable
+ public BlendMode getProgressBackgroundTintBlendMode() {
+ return mProgressTintInfo != null ? mProgressTintInfo.mProgressBackgroundBlendMode : null;
}
/**
@@ -1242,10 +1336,27 @@ public class ProgressBar extends View {
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setSecondaryProgressTintMode(@Nullable PorterDuff.Mode tintMode) {
+ setSecondaryProgressTintBlendMode(tintMode != null
+ ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setSecondaryProgressTintList(ColorStateList)}} to the secondary
+ * progress indicator. The default mode is
+ * {@link PorterDuff.Mode#SRC_ATOP}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#ProgressBar_secondaryProgressTintMode
+ * @see #setSecondaryProgressTintList(ColorStateList)
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setSecondaryProgressTintBlendMode(@Nullable BlendMode blendMode) {
if (mProgressTintInfo == null) {
mProgressTintInfo = new ProgressTintInfo();
}
- mProgressTintInfo.mSecondaryProgressTintMode = tintMode;
+ mProgressTintInfo.mSecondaryProgressBlendMode = blendMode;
mProgressTintInfo.mHasSecondaryProgressTintMode = true;
if (mProgressDrawable != null) {
@@ -1265,7 +1376,23 @@ public class ProgressBar extends View {
@InspectableProperty
@Nullable
public PorterDuff.Mode getSecondaryProgressTintMode() {
- return mProgressTintInfo != null ? mProgressTintInfo.mSecondaryProgressTintMode : null;
+ BlendMode mode = getSecondaryProgressTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the secondary
+ * progress drawable, if specified.
+ *
+ * @return the blending mode used to apply the tint to the secondary
+ * progress drawable
+ * @attr ref android.R.styleable#ProgressBar_secondaryProgressTintMode
+ * @see #setSecondaryProgressTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(attributeId = android.R.styleable.ProgressBar_secondaryProgressTintMode)
+ @Nullable
+ public BlendMode getSecondaryProgressTintBlendMode() {
+ return mProgressTintInfo != null ? mProgressTintInfo.mSecondaryProgressBlendMode : null;
}
/**
@@ -2208,22 +2335,22 @@ public class ProgressBar extends View {
private static class ProgressTintInfo {
ColorStateList mIndeterminateTintList;
- PorterDuff.Mode mIndeterminateTintMode;
+ BlendMode mIndeterminateBlendMode;
boolean mHasIndeterminateTint;
boolean mHasIndeterminateTintMode;
ColorStateList mProgressTintList;
- PorterDuff.Mode mProgressTintMode;
+ BlendMode mProgressBlendMode;
boolean mHasProgressTint;
boolean mHasProgressTintMode;
ColorStateList mProgressBackgroundTintList;
- PorterDuff.Mode mProgressBackgroundTintMode;
+ BlendMode mProgressBackgroundBlendMode;
boolean mHasProgressBackgroundTint;
boolean mHasProgressBackgroundTintMode;
ColorStateList mSecondaryProgressTintList;
- PorterDuff.Mode mSecondaryProgressTintMode;
+ BlendMode mSecondaryProgressBlendMode;
boolean mHasSecondaryProgressTint;
boolean mHasSecondaryProgressTintMode;
}
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index ea9cd421d438..d57b3bc7ad3b 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -26,6 +26,7 @@ import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.Insets;
import android.graphics.Paint;
@@ -98,14 +99,14 @@ public class Switch extends CompoundButton {
@UnsupportedAppUsage
private Drawable mThumbDrawable;
private ColorStateList mThumbTintList = null;
- private PorterDuff.Mode mThumbTintMode = null;
+ private BlendMode mThumbBlendMode = null;
private boolean mHasThumbTint = false;
private boolean mHasThumbTintMode = false;
@UnsupportedAppUsage
private Drawable mTrackDrawable;
private ColorStateList mTrackTintList = null;
- private PorterDuff.Mode mTrackTintMode = null;
+ private BlendMode mTrackBlendMode = null;
private boolean mHasTrackTint = false;
private boolean mHasTrackTintMode = false;
@@ -268,10 +269,11 @@ public class Switch extends CompoundButton {
mThumbTintList = thumbTintList;
mHasThumbTint = true;
}
- PorterDuff.Mode thumbTintMode = Drawable.parseTintMode(
- a.getInt(com.android.internal.R.styleable.Switch_thumbTintMode, -1), null);
- if (mThumbTintMode != thumbTintMode) {
- mThumbTintMode = thumbTintMode;
+ BlendMode thumbTintMode = Drawable.parseBlendMode(
+ a.getInt(com.android.internal.R.styleable.Switch_thumbTintMode, -1),
+ null);
+ if (mThumbBlendMode != thumbTintMode) {
+ mThumbBlendMode = thumbTintMode;
mHasThumbTintMode = true;
}
if (mHasThumbTint || mHasThumbTintMode) {
@@ -284,10 +286,11 @@ public class Switch extends CompoundButton {
mTrackTintList = trackTintList;
mHasTrackTint = true;
}
- PorterDuff.Mode trackTintMode = Drawable.parseTintMode(
- a.getInt(com.android.internal.R.styleable.Switch_trackTintMode, -1), null);
- if (mTrackTintMode != trackTintMode) {
- mTrackTintMode = trackTintMode;
+ BlendMode trackTintMode = Drawable.parseBlendMode(
+ a.getInt(com.android.internal.R.styleable.Switch_trackTintMode, -1),
+ null);
+ if (mTrackBlendMode != trackTintMode) {
+ mTrackBlendMode = trackTintMode;
mHasTrackTintMode = true;
}
if (mHasTrackTint || mHasTrackTintMode) {
@@ -587,7 +590,22 @@ public class Switch extends CompoundButton {
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setTrackTintMode(@Nullable PorterDuff.Mode tintMode) {
- mTrackTintMode = tintMode;
+ setTrackTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setTrackTintList(ColorStateList)}} to the track drawable.
+ * The default mode is {@link BlendMode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#Switch_trackTintMode
+ * @see #getTrackTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setTrackTintBlendMode(@Nullable BlendMode blendMode) {
+ mTrackBlendMode = blendMode;
mHasTrackTintMode = true;
applyTrackTint();
@@ -602,7 +620,20 @@ public class Switch extends CompoundButton {
@InspectableProperty
@Nullable
public PorterDuff.Mode getTrackTintMode() {
- return mTrackTintMode;
+ BlendMode mode = getTrackTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * @return the blending mode used to apply the tint to the track
+ * drawable
+ * @attr ref android.R.styleable#Switch_trackTintMode
+ * @see #setTrackTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(attributeId = com.android.internal.R.styleable.Switch_trackTintMode)
+ @Nullable
+ public BlendMode getTrackTintBlendMode() {
+ return mTrackBlendMode;
}
private void applyTrackTint() {
@@ -614,7 +645,7 @@ public class Switch extends CompoundButton {
}
if (mHasTrackTintMode) {
- mTrackDrawable.setTintMode(mTrackTintMode);
+ mTrackDrawable.setTintBlendMode(mTrackBlendMode);
}
// The drawable (or one of its children) may not have been
@@ -713,7 +744,22 @@ public class Switch extends CompoundButton {
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setThumbTintMode(@Nullable PorterDuff.Mode tintMode) {
- mThumbTintMode = tintMode;
+ setThumbTintBlendMode(tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setThumbTintList(ColorStateList)}} to the thumb drawable.
+ * The default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#Switch_thumbTintMode
+ * @see #getThumbTintMode()
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setThumbTintBlendMode(@Nullable BlendMode blendMode) {
+ mThumbBlendMode = blendMode;
mHasThumbTintMode = true;
applyThumbTint();
@@ -728,7 +774,20 @@ public class Switch extends CompoundButton {
@InspectableProperty
@Nullable
public PorterDuff.Mode getThumbTintMode() {
- return mThumbTintMode;
+ BlendMode mode = getThumbTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * @return the blending mode used to apply the tint to the thumb
+ * drawable
+ * @attr ref android.R.styleable#Switch_thumbTintMode
+ * @see #setThumbTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(attributeId = com.android.internal.R.styleable.Switch_thumbTintMode)
+ @Nullable
+ public BlendMode getThumbTintBlendMode() {
+ return mThumbBlendMode;
}
private void applyThumbTint() {
@@ -740,7 +799,7 @@ public class Switch extends CompoundButton {
}
if (mHasThumbTintMode) {
- mThumbDrawable.setTintMode(mThumbTintMode);
+ mThumbDrawable.setTintBlendMode(mThumbBlendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 618b05f8cb00..17c56c3f216a 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -55,6 +55,7 @@ import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.BaseCanvas;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.Insets;
import android.graphics.Paint;
@@ -489,7 +490,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
final Drawable[] mShowing = new Drawable[4];
ColorStateList mTintList;
- PorterDuff.Mode mTintMode;
+ BlendMode mBlendMode;
boolean mHasTint;
boolean mHasTintMode;
@@ -1036,7 +1037,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
Drawable drawableLeft = null, drawableTop = null, drawableRight = null,
drawableBottom = null, drawableStart = null, drawableEnd = null;
ColorStateList drawableTint = null;
- PorterDuff.Mode drawableTintMode = null;
+ BlendMode drawableTintMode = null;
int drawablePadding = 0;
int ellipsize = ELLIPSIZE_NOT_SET;
boolean singleLine = false;
@@ -1139,7 +1140,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
break;
case com.android.internal.R.styleable.TextView_drawableTintMode:
- drawableTintMode = Drawable.parseTintMode(a.getInt(attr, -1), drawableTintMode);
+ drawableTintMode = Drawable.parseBlendMode(a.getInt(attr, -1),
+ drawableTintMode);
break;
case com.android.internal.R.styleable.TextView_drawablePadding:
@@ -1543,7 +1545,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
mDrawables.mHasTint = true;
}
if (drawableTintMode != null) {
- mDrawables.mTintMode = drawableTintMode;
+ mDrawables.mBlendMode = drawableTintMode;
mDrawables.mHasTintMode = true;
}
}
@@ -3299,10 +3301,26 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setCompoundDrawableTintMode(@Nullable PorterDuff.Mode tintMode) {
+ setCompoundDrawableTintBlendMode(tintMode != null
+ ? BlendMode.fromValue(tintMode.nativeInt) : null);
+ }
+
+ /**
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setCompoundDrawableTintList(ColorStateList)} to the compound
+ * drawables. The default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param blendMode the blending mode used to apply the tint, may be
+ * {@code null} to clear tint
+ * @attr ref android.R.styleable#TextView_drawableTintMode
+ * @see #setCompoundDrawableTintList(ColorStateList)
+ * @see Drawable#setTintBlendMode(BlendMode)
+ */
+ public void setCompoundDrawableTintBlendMode(@Nullable BlendMode blendMode) {
if (mDrawables == null) {
mDrawables = new Drawables(getContext());
}
- mDrawables.mTintMode = tintMode;
+ mDrawables.mBlendMode = blendMode;
mDrawables.mHasTintMode = true;
applyCompoundDrawableTint();
@@ -3316,10 +3334,27 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* drawables
* @attr ref android.R.styleable#TextView_drawableTintMode
* @see #setCompoundDrawableTintMode(PorterDuff.Mode)
+ *
*/
@InspectableProperty(name = "drawableTintMode")
public PorterDuff.Mode getCompoundDrawableTintMode() {
- return mDrawables != null ? mDrawables.mTintMode : null;
+ BlendMode mode = getCompoundDrawableTintBlendMode();
+ return mode != null ? BlendMode.blendModeToPorterDuffMode(mode) : null;
+ }
+
+ /**
+ * Returns the blending mode used to apply the tint to the compound
+ * drawables, if specified.
+ *
+ * @return the blending mode used to apply the tint to the compound
+ * drawables
+ * @attr ref android.R.styleable#TextView_drawableTintMode
+ * @see #setCompoundDrawableTintBlendMode(BlendMode)
+ */
+ @InspectableProperty(name = "drawableBlendMode",
+ attributeId = com.android.internal.R.styleable.TextView_drawableTintMode)
+ public @Nullable BlendMode getCompoundDrawableTintBlendMode() {
+ return mDrawables != null ? mDrawables.mBlendMode : null;
}
private void applyCompoundDrawableTint() {
@@ -3329,7 +3364,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (mDrawables.mHasTint || mDrawables.mHasTintMode) {
final ColorStateList tintList = mDrawables.mTintList;
- final PorterDuff.Mode tintMode = mDrawables.mTintMode;
+ final BlendMode blendMode = mDrawables.mBlendMode;
final boolean hasTint = mDrawables.mHasTint;
final boolean hasTintMode = mDrawables.mHasTintMode;
final int[] state = getDrawableState();
@@ -3353,7 +3388,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
if (hasTintMode) {
- dr.setTintMode(tintMode);
+ dr.setTintBlendMode(blendMode);
}
// The drawable (or one of its children) may not have been
diff --git a/core/java/com/android/internal/app/AbstractResolverComparator.java b/core/java/com/android/internal/app/AbstractResolverComparator.java
index e091aac04c60..b7276a0450cc 100644
--- a/core/java/com/android/internal/app/AbstractResolverComparator.java
+++ b/core/java/com/android/internal/app/AbstractResolverComparator.java
@@ -1,3 +1,19 @@
+/*
+ * 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 com.android.internal.app;
import android.app.usage.UsageStatsManager;
@@ -20,7 +36,7 @@ abstract class AbstractResolverComparator implements Comparator<ResolvedComponen
private static final int NUM_OF_TOP_ANNOTATIONS_TO_USE = 3;
- protected AfterCompute mAfterCompute;
+ private AfterCompute mAfterCompute;
protected final PackageManager mPm;
protected final UsageStatsManager mUsm;
protected String[] mAnnotations;
@@ -72,6 +88,13 @@ abstract class AbstractResolverComparator implements Comparator<ResolvedComponen
mAfterCompute = afterCompute;
}
+ protected final void afterCompute() {
+ final AfterCompute afterCompute = mAfterCompute;
+ if (afterCompute != null) {
+ afterCompute.afterCompute();
+ }
+ }
+
@Override
public final int compare(ResolvedComponentInfo lhsp, ResolvedComponentInfo rhsp) {
final ResolveInfo lhs = lhsp.getResolveInfoAt(0);
diff --git a/core/java/com/android/internal/app/AppPredictionServiceResolverComparator.java b/core/java/com/android/internal/app/AppPredictionServiceResolverComparator.java
new file mode 100644
index 000000000000..cb44c67c8c9b
--- /dev/null
+++ b/core/java/com/android/internal/app/AppPredictionServiceResolverComparator.java
@@ -0,0 +1,119 @@
+/*
+ * 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 com.android.internal.app;
+
+import static android.app.prediction.AppTargetEvent.ACTION_LAUNCH;
+
+import android.app.prediction.AppPredictor;
+import android.app.prediction.AppTarget;
+import android.app.prediction.AppTargetEvent;
+import android.app.prediction.AppTargetId;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ResolveInfo;
+import android.os.UserHandle;
+import android.view.textclassifier.Log;
+
+import com.android.internal.app.ResolverActivity.ResolvedComponentInfo;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Uses an {@link AppPredictor} to sort Resolver targets.
+ */
+class AppPredictionServiceResolverComparator extends AbstractResolverComparator {
+
+ private static final String TAG = "APSResolverComparator";
+
+ private final AppPredictor mAppPredictor;
+ private final Context mContext;
+ private final Map<ComponentName, Integer> mTargetRanks = new HashMap<>();
+ private final UserHandle mUser;
+
+ AppPredictionServiceResolverComparator(
+ Context context, Intent intent, AppPredictor appPredictor, UserHandle user) {
+ super(context, intent);
+ mContext = context;
+ mAppPredictor = appPredictor;
+ mUser = user;
+ }
+
+ @Override
+ int compare(ResolveInfo lhs, ResolveInfo rhs) {
+ Integer lhsRank = mTargetRanks.get(new ComponentName(lhs.activityInfo.packageName,
+ lhs.activityInfo.name));
+ Integer rhsRank = mTargetRanks.get(new ComponentName(rhs.activityInfo.packageName,
+ rhs.activityInfo.name));
+ if (lhsRank == null && rhsRank == null) {
+ return 0;
+ } else if (lhsRank == null) {
+ return -1;
+ } else if (rhsRank == null) {
+ return 1;
+ }
+ return lhsRank - rhsRank;
+ }
+
+ @Override
+ void compute(List<ResolvedComponentInfo> targets) {
+ List<AppTarget> appTargets = new ArrayList<>();
+ for (ResolvedComponentInfo target : targets) {
+ appTargets.add(new AppTarget.Builder(new AppTargetId(target.name.flattenToString()))
+ .setTarget(target.name.getPackageName(), mUser)
+ .setClassName(target.name.getClassName()).build());
+ }
+ mAppPredictor.sortTargets(appTargets, mContext.getMainExecutor(),
+ sortedAppTargets -> {
+ for (int i = 0; i < sortedAppTargets.size(); i++) {
+ mTargetRanks.put(new ComponentName(sortedAppTargets.get(i).getPackageName(),
+ sortedAppTargets.get(i).getClassName()), i);
+ }
+ afterCompute();
+ });
+ }
+
+ @Override
+ float getScore(ComponentName name) {
+ Integer rank = mTargetRanks.get(name);
+ if (rank == null) {
+ Log.w(TAG, "Score requested for unknown component.");
+ return 0f;
+ }
+ int consecutiveSumOfRanks = (mTargetRanks.size() - 1) * (mTargetRanks.size()) / 2;
+ return 1.0f - (((float) rank) / consecutiveSumOfRanks);
+ }
+
+ @Override
+ void updateModel(ComponentName componentName) {
+ mAppPredictor.notifyAppTargetEvent(
+ new AppTargetEvent.Builder(
+ new AppTarget.Builder(
+ new AppTargetId(componentName.toString()),
+ componentName.getPackageName(), mUser)
+ .setClassName(componentName.getClassName()).build(),
+ ACTION_LAUNCH).build());
+ }
+
+ @Override
+ void destroy() {
+ // Do nothing. App Predictor destruction is handled by caller.
+ }
+}
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 54338bf6a176..59e867ff9dd6 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -150,6 +150,7 @@ public class ChooserActivity extends ResolverActivity {
*/
// TODO(b/123089490): Replace with system flag
private static final boolean USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS = false;
+ private static final boolean USE_PREDICTION_MANAGER_FOR_SHARE_ACTIVITIES = false;
// TODO(b/123088566) Share these in a better way.
private static final String APP_PREDICTION_SHARE_UI_SURFACE = "share";
public static final String LAUNCH_LOCATON_DIRECT_SHARE = "direct_share";
@@ -1387,6 +1388,15 @@ public class ChooserActivity extends ResolverActivity {
return USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS ? getAppPredictor() : null;
}
+ /**
+ * This will return an app predictor if it is enabled for share activity sorting
+ * and if one exists. Otherwise, it returns null.
+ */
+ @Nullable
+ private AppPredictor getAppPredictorForShareActivitesIfEnabled() {
+ return USE_PREDICTION_MANAGER_FOR_SHARE_ACTIVITIES ? getAppPredictor() : null;
+ }
+
void onRefinementResult(TargetInfo selectedTarget, Intent matchingIntent) {
if (mRefinementResultReceiver != null) {
mRefinementResultReceiver.destroy();
@@ -1491,8 +1501,10 @@ public class ChooserActivity extends ResolverActivity {
PackageManager pm,
Intent targetIntent,
String referrerPackageName,
- int launchedFromUid) {
- super(context, pm, targetIntent, referrerPackageName, launchedFromUid);
+ int launchedFromUid,
+ AbstractResolverComparator resolverComparator) {
+ super(context, pm, targetIntent, referrerPackageName, launchedFromUid,
+ resolverComparator);
}
@Override
@@ -1520,13 +1532,24 @@ public class ChooserActivity extends ResolverActivity {
@VisibleForTesting
protected ResolverListController createListController() {
+ AppPredictor appPredictor = getAppPredictorForShareActivitesIfEnabled();
+ AbstractResolverComparator resolverComparator;
+ if (appPredictor != null) {
+ resolverComparator = new AppPredictionServiceResolverComparator(this, getTargetIntent(),
+ appPredictor, getUser());
+ } else {
+ resolverComparator =
+ new ResolverRankerServiceResolverComparator(this, getTargetIntent(),
+ getReferrerPackageName(), null);
+ }
+
return new ChooserListController(
this,
mPm,
getTargetIntent(),
getReferrerPackageName(),
- mLaunchedFromUid
- );
+ mLaunchedFromUid,
+ resolverComparator);
}
@VisibleForTesting
diff --git a/core/java/com/android/internal/app/ResolverListController.java b/core/java/com/android/internal/app/ResolverListController.java
index a3cfa8786d59..5f92cddbaa38 100644
--- a/core/java/com/android/internal/app/ResolverListController.java
+++ b/core/java/com/android/internal/app/ResolverListController.java
@@ -63,14 +63,24 @@ public class ResolverListController {
Intent targetIntent,
String referrerPackage,
int launchedFromUid) {
+ this(context, pm, targetIntent, referrerPackage, launchedFromUid,
+ new ResolverRankerServiceResolverComparator(
+ context, targetIntent, referrerPackage, null));
+ }
+
+ public ResolverListController(
+ Context context,
+ PackageManager pm,
+ Intent targetIntent,
+ String referrerPackage,
+ int launchedFromUid,
+ AbstractResolverComparator resolverComparator) {
mContext = context;
mpm = pm;
mLaunchedFromUid = launchedFromUid;
mTargetIntent = targetIntent;
mReferrerPackage = referrerPackage;
- mResolverComparator =
- new ResolverRankerServiceResolverComparator(
- mContext, mTargetIntent, mReferrerPackage, null);
+ mResolverComparator = resolverComparator;
}
@VisibleForTesting
diff --git a/core/java/com/android/internal/app/ResolverRankerServiceResolverComparator.java b/core/java/com/android/internal/app/ResolverRankerServiceResolverComparator.java
index 9bf4f01bab06..726b186d8edb 100644
--- a/core/java/com/android/internal/app/ResolverRankerServiceResolverComparator.java
+++ b/core/java/com/android/internal/app/ResolverRankerServiceResolverComparator.java
@@ -126,7 +126,7 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator
Log.e(TAG, "Receiving null prediction results.");
}
mHandler.removeMessages(RESOLVER_RANKER_RESULT_TIMEOUT);
- mAfterCompute.afterCompute();
+ afterCompute();
}
break;
@@ -135,7 +135,7 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator
Log.d(TAG, "RESOLVER_RANKER_RESULT_TIMEOUT; unbinding services");
}
mHandler.removeMessages(RESOLVER_RANKER_SERVICE_RESULT);
- mAfterCompute.afterCompute();
+ afterCompute();
break;
default:
@@ -149,7 +149,6 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator
super(context, intent);
mCollator = Collator.getInstance(context.getResources().getConfiguration().locale);
mReferrerPackage = referrerPackage;
- mAfterCompute = afterCompute;
mContext = context;
mCurrentTime = System.currentTimeMillis();
@@ -157,6 +156,7 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator
mStats = mUsm.queryAndAggregateUsageStats(mSinceTime, mCurrentTime);
mAction = intent.getAction();
mRankerServiceName = new ComponentName(mContext, this.getClass());
+ setCallBack(afterCompute);
}
// compute features for each target according to usage stats of targets.
@@ -328,9 +328,7 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator
mContext.unbindService(mConnection);
mConnection.destroy();
}
- if (mAfterCompute != null) {
- mAfterCompute.afterCompute();
- }
+ afterCompute();
if (DEBUG) {
Log.d(TAG, "Unbinded Resolver Ranker.");
}
@@ -513,9 +511,7 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator
Log.e(TAG, "Error in Predict: " + e);
}
}
- if (mAfterCompute != null) {
- mAfterCompute.afterCompute();
- }
+ afterCompute();
}
// adds select prob as the default values, according to a pre-trained Logistic Regression model.
diff --git a/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java b/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java
index c3aa847acae1..f1398bf67283 100644
--- a/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java
+++ b/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java
@@ -75,6 +75,20 @@ public abstract class AbstractMultiplePendingRequestsRemoteService<S
}
@Override // from AbstractRemoteService
+ final void handleBindFailure() {
+ if (mPendingRequests != null) {
+ final int size = mPendingRequests.size();
+ if (mVerbose) Slog.v(mTag, "Sending failure to " + size + " pending requests");
+ for (int i = 0; i < size; i++) {
+ final BasePendingRequest<S, I> request = mPendingRequests.get(i);
+ request.onFailed();
+ request.finish();
+ }
+ mPendingRequests = null;
+ }
+ }
+
+ @Override // from AbstractRemoteService
public void dump(@NonNull String prefix, @NonNull PrintWriter pw) {
super.dump(prefix, pw);
diff --git a/core/java/com/android/internal/infra/AbstractRemoteService.java b/core/java/com/android/internal/infra/AbstractRemoteService.java
index 65a63a05f666..64f885770336 100644
--- a/core/java/com/android/internal/infra/AbstractRemoteService.java
+++ b/core/java/com/android/internal/infra/AbstractRemoteService.java
@@ -405,6 +405,11 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
abstract void handlePendingRequestWhileUnBound(
@NonNull BasePendingRequest<S, I> pendingRequest);
+ /**
+ * Called if {@link Context#bindServiceAsUser} returns {@code false}.
+ */
+ abstract void handleBindFailure();
+
private boolean handleIsBound() {
return mService != null;
}
@@ -426,6 +431,8 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
mBinding = false;
if (!mServiceDied) {
+ // TODO(b/126266412): merge these 2 calls?
+ handleBindFailure();
handleBinderDied();
}
}
@@ -562,6 +569,12 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
void onFinished() { }
/**
+ * Called when request fails due to reasons internal to {@link AbstractRemoteService},
+ * e.g. failure to bind to service.
+ */
+ protected void onFailed() { }
+
+ /**
* Checks whether this request was cancelled.
*/
@GuardedBy("mLock")
diff --git a/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java b/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java
index 66bee95b0302..2ebf2fd820d8 100644
--- a/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java
+++ b/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java
@@ -67,6 +67,15 @@ public abstract class AbstractSinglePendingRequestRemoteService<S
}
@Override // from AbstractRemoteService
+ void handleBindFailure() {
+ if (mPendingRequest != null) {
+ if (mVerbose) Slog.v(mTag, "Sending failure to " + mPendingRequest);
+ mPendingRequest.onFailed();
+ mPendingRequest = null;
+ }
+ }
+
+ @Override // from AbstractRemoteService
public void dump(@NonNull String prefix, @NonNull PrintWriter pw) {
super.dump(prefix, pw);
pw.append(prefix).append("hasPendingRequest=")
diff --git a/core/res/res/anim/lock_in.xml b/core/res/res/anim/lock_in.xml
index cd4effd63182..e687f9f2d87e 100755
--- a/core/res/res/anim/lock_in.xml
+++ b/core/res/res/anim/lock_in.xml
@@ -34,7 +34,7 @@
android:trimPathOffset="0"
android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "/>
<path android:name="_R_G_L_2_G_D_1_P_0"
- android:strokeColor="?attr/textColor" android:strokeLineCap="round"
+ android:strokeColor="#000" android:strokeLineCap="round"
android:strokeLineJoin="round" android:strokeWidth="16"
android:strokeAlpha="1" android:trimPathStart="0.14"
android:trimPathEnd="0.89" android:trimPathOffset="0"
@@ -48,7 +48,7 @@
<group android:name="_R_G_L_1_G" android:translateX="-8.25"
android:translateY="-4.25" android:pivotX="8.25" android:pivotY="7.25"
android:scaleX="0" android:scaleY="0">
- <path android:name="_R_G_L_1_G_D_0_P_0" android:fillColor="?attr/textColor"
+ <path android:name="_R_G_L_1_G_D_0_P_0" android:fillColor="#000"
android:fillAlpha="1" android:fillType="nonZero"
android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c "/>
</group>
@@ -58,7 +58,7 @@
<group android:name="_R_G_L_0_G" android:translateX="-2.25"
android:translateY="0.75" android:pivotX="2.25" android:pivotY="2.25"
android:scaleX="0" android:scaleY="0">
- <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="?attr/textColor"
+ <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="#000"
android:fillAlpha="1" android:fillType="nonZero"
android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "/>
</group>
diff --git a/core/res/res/anim/lock_lock.xml b/core/res/res/anim/lock_lock.xml
index ce9c8e88bf05..8fc4f05319d3 100755
--- a/core/res/res/anim/lock_lock.xml
+++ b/core/res/res/anim/lock_lock.xml
@@ -25,7 +25,7 @@
android:translateY="3">
<group android:name="_R_G_L_2_G" android:translateX="-8.25"
android:translateY="-7.25">
- <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="?attr/textColor"
+ <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="#000"
android:fillAlpha="1" android:fillType="nonZero"
android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c "/>
</group>
@@ -40,7 +40,7 @@
<group android:name="_R_G_L_1_G" android:translateX="6"
android:translateY="5" android:pivotX="2.25"
android:pivotY="2.25" android:scaleX="1" android:scaleY="1">
- <path android:name="_R_G_L_1_G_D_0_P_0" android:fillColor="?attr/textColor"
+ <path android:name="_R_G_L_1_G_D_0_P_0" android:fillColor="#000"
android:fillAlpha="1" android:fillType="nonZero"
android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "/>
</group>
@@ -61,7 +61,7 @@
android:fillAlpha="0" android:fillType="nonZero"
android:pathData=" M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 "/>
<path android:name="_R_G_L_0_G_D_1_P_0"
- android:strokeColor="?attr/textColor" android:strokeLineCap="round"
+ android:strokeColor="#000" android:strokeLineCap="round"
android:strokeLineJoin="round" android:strokeWidth="16"
android:strokeAlpha="1"
android:pathData=" M79.79 -48.55 C79.79,-48.55 79.75,-53.75 79.78,-55.48 C79.83,-57.62 79.08,-78.36 53.07,-78.83 C29.5,-79.25 25.2,-59.38 25.22,-58.27 C25.25,-56.25 24.97,-31.17 24.97,-31.17 "/>
diff --git a/core/res/res/anim/lock_scanning.xml b/core/res/res/anim/lock_scanning.xml
index 998c965f2199..8ced02b947c5 100644
--- a/core/res/res/anim/lock_scanning.xml
+++ b/core/res/res/anim/lock_scanning.xml
@@ -28,7 +28,7 @@
<group android:name="_R_G_L_2_G" android:translateX="6"
android:translateY="5" android:pivotX="2.25" android:pivotY="2.25"
android:scaleX="1" android:scaleY="1">
- <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="?attr/textColor"
+ <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="#000"
android:fillAlpha="1" android:fillType="nonZero"
android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "/>
</group>
@@ -45,7 +45,7 @@
android:scaleY="0.125">
<group android:name="_R_G_L_1_G" android:translateY="25.029">
<path android:name="_R_G_L_1_G_D_0_P_0"
- android:strokeColor="?attr/textColor" android:strokeLineCap="round"
+ android:strokeColor="#000" android:strokeLineCap="round"
android:strokeLineJoin="round" android:strokeWidth="16"
android:strokeAlpha="1"
android:pathData=" M-28.21 -25.03 C-28.21,-25.03 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.93,-26.15 27.93,-26.15 "/>
@@ -62,7 +62,7 @@
<group android:name="_R_G_L_0_G" android:translateY="0.04699999999999971"
android:pivotX="8.25" android:pivotY="7.25" android:scaleX="1.01562"
android:scaleY="1.01563">
- <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="?attr/textColor"
+ <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="#000"
android:fillAlpha="1" android:fillType="nonZero"
android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c "/>
</group>
diff --git a/core/res/res/anim/lock_to_error.xml b/core/res/res/anim/lock_to_error.xml
index ddef96bf7422..afe22909d19a 100755
--- a/core/res/res/anim/lock_to_error.xml
+++ b/core/res/res/anim/lock_to_error.xml
@@ -26,7 +26,7 @@
<group android:name="_R_G_L_2_G" android:translateX="6"
android:translateY="4.954" android:pivotX="2.25" android:pivotY="2.25"
android:scaleX="0.98462" android:scaleY="0.98462">
- <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="?attr/textColor"
+ <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="#000"
android:fillAlpha="1" android:fillType="nonZero"
android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "/>
</group>
@@ -38,7 +38,7 @@
<group android:name="_R_G_L_1_G" android:translateX="-16.273"
android:translateY="32.312" android:pivotX="27.965" android:pivotY="-32"
android:scaleX="0.12308" android:scaleY="0.12308">
- <path android:name="_R_G_L_1_G_D_0_P_0" android:strokeColor="?attr/textColor"
+ <path android:name="_R_G_L_1_G_D_0_P_0" android:strokeColor="#000"
android:strokeLineCap="round" android:strokeLineJoin="round"
android:strokeWidth="16" android:strokeAlpha="1"
android:pathData=" M-28.21 -25.03 C-28.21,-25.03 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.93,-26.15 27.93,-26.15 "/>
@@ -48,7 +48,7 @@
android:translateY="12.649999999999999" android:pivotX="8.25"
android:pivotY="7.25" android:rotation="0" android:scaleX="1.3"
android:scaleY="1.3">
- <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="?attr/textColor"
+ <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="#000"
android:fillAlpha="1" android:fillType="nonZero"
android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c "/>
</group>
diff --git a/core/res/res/anim/lock_unlock.xml b/core/res/res/anim/lock_unlock.xml
index 0e85c9d3f580..c8b260877c24 100755
--- a/core/res/res/anim/lock_unlock.xml
+++ b/core/res/res/anim/lock_unlock.xml
@@ -24,7 +24,7 @@
<group android:name="_R_G_L_2_G_T_1" android:translateY="3">
<group android:name="_R_G_L_2_G" android:translateX="-8.25"
android:translateY="-7.25">
- <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="?attr/textColor"
+ <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="#000"
android:fillAlpha="1" android:fillType="nonZero"
android:pathData=" M14.25 0.25 C14.25,0.25 12.75,0.25 12.75,0.25 C12.75,0.25 10.75,0.25 10.75,0.25 C10.75,0.25 5.75,0.25 5.75,0.25 C5.75,0.25 3.75,0.25 3.75,0.25 C3.75,0.25 2.25,0.25 2.25,0.25 C1.15,0.25 0.25,1.15 0.25,2.25 C0.25,2.25 0.25,12.25 0.25,12.25 C0.25,13.35 1.15,14.25 2.25,14.25 C2.25,14.25 14.25,14.25 14.25,14.25 C15.35,14.25 16.25,13.35 16.25,12.25 C16.25,12.25 16.25,2.25 16.25,2.25 C16.25,1.15 15.35,0.25 14.25,0.25c M14.25 12.25 C14.25,12.25 2.25,12.25 2.25,12.25 C2.25,12.25 2.25,2.25 2.25,2.25 C2.25,2.25 3.75,2.25 3.75,2.25 C3.75,2.25 12.75,2.25 12.75,2.25 C12.75,2.25 14.25,2.25 14.25,2.25 C14.25,2.25 14.25,12.25 14.25,12.25c "/>
</group>
@@ -38,7 +38,7 @@
<group android:name="_R_G_L_1_G" android:translateX="6"
android:translateY="5" android:pivotX="2.25"
android:pivotY="2.25" android:scaleX="1" android:scaleY="1">
- <path android:name="_R_G_L_1_G_D_0_P_0" android:fillColor="?attr/textColor"
+ <path android:name="_R_G_L_1_G_D_0_P_0" android:fillColor="#000"
android:fillAlpha="1" android:fillType="nonZero"
android:pathData=" M2.25 0.25 C3.35,0.25 4.25,1.15 4.25,2.25 C4.25,3.35 3.35,4.25 2.25,4.25 C1.15,4.25 0.25,3.35 0.25,2.25 C0.25,1.15 1.15,0.25 2.25,0.25c "/>
</group>
@@ -58,7 +58,7 @@
android:fillAlpha="0" android:fillType="nonZero"
android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "/>
<path android:name="_R_G_L_0_G_D_1_P_0"
- android:strokeColor="?attr/textColor" android:strokeLineCap="round"
+ android:strokeColor="#000" android:strokeLineCap="round"
android:strokeLineJoin="round" android:strokeWidth="16"
android:strokeAlpha="1"
android:pathData=" M-28.21 -31.92 C-28.21,-31.92 -27.85,-48.38 -27.97,-55.48 C-28,-57.63 -23.5,-79.87 -0.75,-79.82 C22.77,-79.76 27.75,-59.37 27.72,-58.27 C27.55,-52.88 27.97,-31.67 27.97,-31.67 "/>
diff --git a/core/res/res/drawable/ic_lock.xml b/core/res/res/drawable/ic_lock.xml
index 8d7143b7b49a..fed0e0d71287 100644
--- a/core/res/res/drawable/ic_lock.xml
+++ b/core/res/res/drawable/ic_lock.xml
@@ -19,9 +19,9 @@ Copyright (C) 2019 The Android Open Source Project
android:viewportWidth="32"
android:viewportHeight="32">
<path
- android:fillColor="?attr/textColor"
+ android:fillColor="#000"
android:pathData="M16,20m-2.7,0a2.7,2.7 0,1 1,5.4 0a2.7,2.7 0,1 1,-5.4 0"/>
<path
- android:fillColor="?attr/textColor"
+ android:fillColor="#000"
android:pathData="M24,10.7h-2V7.3c0,-3.3 -2.7,-6 -6,-6s-6,2.7 -6,6v3.3H8c-1.5,0 -2.7,1.2 -2.7,2.7v13.3c0,1.5 1.2,2.7 2.7,2.7h16c1.5,0 2.7,-1.2 2.7,-2.7V13.3C26.7,11.9 25.5,10.7 24,10.7zM12.7,7.3C12.7,5.5 14.2,4 16,4s3.3,1.5 3.3,3.3v3.3h-6.7V7.3zM24,26.7H8V13.3h2h12h2V26.7z"/>
</vector>
diff --git a/core/res/res/drawable/ic_lock_open.xml b/core/res/res/drawable/ic_lock_open.xml
index 3a6bf931f473..494fd6ae9a76 100644
--- a/core/res/res/drawable/ic_lock_open.xml
+++ b/core/res/res/drawable/ic_lock_open.xml
@@ -19,9 +19,9 @@ Copyright (C) 2019 The Android Open Source Project
android:viewportWidth="32"
android:viewportHeight="32">
<path
- android:fillColor="?attr/textColor"
+ android:fillColor="#000"
android:pathData="M16,20m-2.67,0a2.67,2.67 0,1 1,5.34 0a2.67,2.67 0,1 1,-5.34 0"/>
<path
- android:fillColor="?attr/textColor"
+ android:fillColor="#000"
android:pathData="M24.67,1.33a6,6 0,0 0,-6 6v3.34L8,10.67a2.67,2.67 0,0 0,-2.67 2.66L5.33,26.67A2.67,2.67 0,0 0,8 29.33L24,29.33a2.67,2.67 0,0 0,2.67 -2.66L26.67,13.33A2.67,2.67 0,0 0,24 10.67L21.33,10.67L21.33,7.33a3.34,3.34 0,0 1,6.67 0L28,8h2.67L30.67,7.33A6,6 0,0 0,24.67 1.33ZM24,13.33L24,26.67L8,26.67L8,13.33Z"/>
</vector> \ No newline at end of file
diff --git a/graphics/java/android/graphics/BaseCanvas.java b/graphics/java/android/graphics/BaseCanvas.java
index c9431e3178f0..6e7f286d19a7 100644
--- a/graphics/java/android/graphics/BaseCanvas.java
+++ b/graphics/java/android/graphics/BaseCanvas.java
@@ -243,10 +243,6 @@ public abstract class BaseCanvas {
nDrawColor(mNativeCanvasWrapper, color, BlendMode.SRC_OVER.getXfermode().porterDuffMode);
}
- /**
- * @deprecated use {@link Canvas#drawColor(int, BlendMode)}
- */
- @Deprecated
public void drawColor(@ColorInt int color, @NonNull PorterDuff.Mode mode) {
nDrawColor(mNativeCanvasWrapper, color, mode.nativeInt);
}
diff --git a/graphics/java/android/graphics/BaseRecordingCanvas.java b/graphics/java/android/graphics/BaseRecordingCanvas.java
index 028b784d24c2..2f5214cb1df5 100644
--- a/graphics/java/android/graphics/BaseRecordingCanvas.java
+++ b/graphics/java/android/graphics/BaseRecordingCanvas.java
@@ -203,10 +203,6 @@ public class BaseRecordingCanvas extends Canvas {
nDrawColor(mNativeCanvasWrapper, color, BlendMode.SRC_OVER.getXfermode().porterDuffMode);
}
- /**
- * @deprecated use {@link #drawColor(int, BlendMode)} instead
- */
- @Deprecated
@Override
public final void drawColor(@ColorInt int color, @NonNull PorterDuff.Mode mode) {
nDrawColor(mNativeCanvasWrapper, color, mode.nativeInt);
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 6f00fc907849..d4d5ae7bdddb 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -1700,10 +1700,7 @@ public class Canvas extends BaseCanvas {
*
* @param color the color to draw onto the canvas
* @param mode the porter-duff mode to apply to the color
- *
- * @deprecated use {@link #drawColor(int, BlendMode)} instead
*/
- @Deprecated
public void drawColor(@ColorInt int color, @NonNull PorterDuff.Mode mode) {
super.drawColor(color, mode);
}
diff --git a/graphics/java/android/graphics/ComposeShader.java b/graphics/java/android/graphics/ComposeShader.java
index 93ddb10d24bc..64ee6bf1f30c 100644
--- a/graphics/java/android/graphics/ComposeShader.java
+++ b/graphics/java/android/graphics/ComposeShader.java
@@ -39,9 +39,7 @@ public class ComposeShader extends Shader {
* @param shaderB The colors from this shader are seen as the "src" by the mode
* @param mode The mode that combines the colors from the two shaders. If mode
* is null, then SRC_OVER is assumed.
- *
- * @deprecated use {@link #ComposeShader(Shader, Shader, BlendMode)} instead
- */
+ */
@Deprecated
public ComposeShader(@NonNull Shader shaderA, @NonNull Shader shaderB, @NonNull Xfermode mode) {
this(shaderA, shaderB, mode.porterDuffMode);
@@ -56,9 +54,7 @@ public class ComposeShader extends Shader {
* @param shaderB The colors from this shader are seen as the "src" by the mode
* @param mode The PorterDuff mode that combines the colors from the two shaders.
*
- * @deprecated use {@link #ComposeShader(Shader, Shader, BlendMode)} instead
*/
- @Deprecated
public ComposeShader(@NonNull Shader shaderA, @NonNull Shader shaderB,
@NonNull PorterDuff.Mode mode) {
this(shaderA, shaderB, mode.nativeInt);
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index db5f06524c18..b7316ab03618 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -1274,10 +1274,7 @@ public class Paint {
* Get the paint's transfer mode object.
*
* @return the paint's transfer mode (or null)
- *
- * @deprecated use {@link #getBlendMode()} instead
*/
- @Deprecated
public Xfermode getXfermode() {
return mXfermode;
}
@@ -1308,11 +1305,7 @@ public class Paint {
*
* @param xfermode May be null. The xfermode to be installed in the paint
* @return xfermode
- *
- * @deprecated Use {@link #setBlendMode} to apply a Xfermode directly
- * through usage of {@link BlendMode}
*/
- @Deprecated
public Xfermode setXfermode(Xfermode xfermode) {
return installXfermode(xfermode);
}
diff --git a/graphics/java/android/graphics/PorterDuff.java b/graphics/java/android/graphics/PorterDuff.java
index 459291b7565e..bc1f66fdd5c0 100644
--- a/graphics/java/android/graphics/PorterDuff.java
+++ b/graphics/java/android/graphics/PorterDuff.java
@@ -24,9 +24,8 @@ import android.annotation.UnsupportedAppUsage;
* of {@link Paint}'s {@link Paint#setXfermode(Xfermode) transfer mode}.
* All the available modes can be found in the {@link Mode} enum.</p>
*
- * @deprecated Use {@link BlendMode} with {@link Paint#setBlendMode(BlendMode)} instead
+ * Consider using {@link BlendMode} instead as it provides a wider variety of tinting options
*/
-@Deprecated
public class PorterDuff {
/**
* {@usesMathJax}
diff --git a/graphics/java/android/graphics/PorterDuffColorFilter.java b/graphics/java/android/graphics/PorterDuffColorFilter.java
index c2a8eb7dbab1..cc2d3a8969fc 100644
--- a/graphics/java/android/graphics/PorterDuffColorFilter.java
+++ b/graphics/java/android/graphics/PorterDuffColorFilter.java
@@ -23,11 +23,7 @@ import android.annotation.UnsupportedAppUsage;
/**
* A color filter that can be used to tint the source pixels using a single
* color and a specific {@link PorterDuff Porter-Duff composite mode}.
- *
- * @deprecated Consider using {@link BlendModeColorFilter} instead as it supports a wider
- * set of blend modes than those defined in {@link PorterDuff.Mode}
*/
-@Deprecated
public class PorterDuffColorFilter extends ColorFilter {
@ColorInt
private int mColor;
diff --git a/graphics/java/android/graphics/PorterDuffXfermode.java b/graphics/java/android/graphics/PorterDuffXfermode.java
index 5b933c493162..ff9ff8b0069d 100644
--- a/graphics/java/android/graphics/PorterDuffXfermode.java
+++ b/graphics/java/android/graphics/PorterDuffXfermode.java
@@ -22,10 +22,6 @@ package android.graphics;
* documentation of the {@link PorterDuff.Mode} enum for more
* information on the available alpha compositing and blending modes.</p>
*
- * @deprecated Consider using {@link BlendMode} instead as it supports a wider
- * set of blend modes than those defined in {@link PorterDuff.Mode}
- *
- * @see Paint#setBlendMode(BlendMode)
*/
public class PorterDuffXfermode extends Xfermode {
/**
diff --git a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
index 7def322c1953..fab96a1e9fbd 100644
--- a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
+++ b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
@@ -701,13 +701,13 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
final ChildDrawable[] array = mLayerState.mChildren;
final int N = mLayerState.N_CHILDREN;
for (int i = 0; i < N; i++) {
final Drawable dr = array[i].mDrawable;
if (dr != null) {
- dr.setTintMode(blendMode);
+ dr.setTintBlendMode(blendMode);
}
}
}
diff --git a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
index f45bf9b783e8..66947da9166f 100644
--- a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
@@ -477,8 +477,8 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable2 {
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
- mAnimatedVectorState.mVectorDrawable.setTintMode(blendMode);
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
+ mAnimatedVectorState.mVectorDrawable.setTintBlendMode(blendMode);
}
@Override
diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java
index 6b30158a183a..e4aa774fd434 100644
--- a/graphics/java/android/graphics/drawable/BitmapDrawable.java
+++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java
@@ -685,7 +685,7 @@ public class BitmapDrawable extends Drawable {
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
final BitmapState state = mBitmapState;
if (state.mBlendMode != blendMode) {
state.mBlendMode = blendMode;
diff --git a/graphics/java/android/graphics/drawable/ColorDrawable.java b/graphics/java/android/graphics/drawable/ColorDrawable.java
index efa806afce70..f5fa8c546bed 100644
--- a/graphics/java/android/graphics/drawable/ColorDrawable.java
+++ b/graphics/java/android/graphics/drawable/ColorDrawable.java
@@ -215,7 +215,7 @@ public class ColorDrawable extends Drawable {
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
mColorState.mBlendMode = blendMode;
mBlendModeColorFilter = updateBlendModeFilter(mBlendModeColorFilter, mColorState.mTint,
blendMode);
diff --git a/graphics/java/android/graphics/drawable/ColorStateListDrawable.java b/graphics/java/android/graphics/drawable/ColorStateListDrawable.java
index b94b11468371..35021a66f572 100644
--- a/graphics/java/android/graphics/drawable/ColorStateListDrawable.java
+++ b/graphics/java/android/graphics/drawable/ColorStateListDrawable.java
@@ -114,9 +114,9 @@ public class ColorStateListDrawable extends Drawable implements Drawable.Callbac
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
mState.mBlendMode = blendMode;
- mColorDrawable.setTintMode(blendMode);
+ mColorDrawable.setTintBlendMode(blendMode);
onStateChange(getState());
}
@@ -293,7 +293,7 @@ public class ColorStateListDrawable extends Drawable implements Drawable.Callbac
}
if (mState.mBlendMode != DEFAULT_BLEND_MODE) {
- mColorDrawable.setTintMode(mState.mBlendMode);
+ mColorDrawable.setTintBlendMode(mState.mBlendMode);
}
}
}
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index adc04fb03e2a..08409869c626 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -213,17 +213,17 @@ public abstract class Drawable {
protected int mSrcDensityOverride = 0;
/**
- * Flag used to break the recursive loop between setTintMode(PorterDuff.Mode) and
- * setTintMode(BlendMode) as each default implementation invokes the other in order to
+ * Flag used to break the recursive loop between setTintBlendMode(PorterDuff.Mode) and
+ * setTintBlendMode(BlendMode) as each default implementation invokes the other in order to
* support new use cases that utilize the new blending modes as well as support the legacy
- * use cases. This flag tracks that {@link #setTintMode(BlendMode)} is only invoked once
+ * use cases. This flag tracks that {@link #setTintBlendMode(BlendMode)} is only invoked once
* per invocation.
*/
private boolean mSetBlendModeInvoked = false;
/**
- * Flag used to break the recursive loop between setTintMode(PorterDuff.Mode) and
- * setTintMode(BlendMode) as each default implementation invokes the other in order to
+ * Flag used to break the recursive loop between setTintBlendMode(PorterDuff.Mode) and
+ * setTintBlendMode(BlendMode) as each default implementation invokes the other in order to
* support new use cases that utilize the new blending modes as well as support the legacy
* use cases. This flag tracks that {@link #setTintMode(Mode)} is only invoked once
* per invocation;
@@ -651,7 +651,7 @@ public abstract class Drawable {
* @param tintColor Color to use for tinting this drawable
* @see #setTintList(ColorStateList)
* @see #setTintMode(PorterDuff.Mode)
- * @see #setTintMode(BlendMode)
+ * @see #setTintBlendMode(BlendMode)
*/
public void setTint(@ColorInt int tintColor) {
setTintList(ColorStateList.valueOf(tintColor));
@@ -673,7 +673,7 @@ public abstract class Drawable {
* {@code null} to clear the tint
* @see #setTint(int)
* @see #setTintMode(PorterDuff.Mode)
- * @see #setTintMode(BlendMode)
+ * @see #setTintBlendMode(BlendMode)
*/
public void setTintList(@Nullable ColorStateList tint) {}
@@ -693,15 +693,12 @@ public abstract class Drawable {
* of {@link PorterDuff.Mode#SRC_IN}
* @see #setTint(int)
* @see #setTintList(ColorStateList)
- *
- * @deprecated use {@link #setTintMode(BlendMode)} instead
*/
- @Deprecated
public void setTintMode(@Nullable PorterDuff.Mode tintMode) {
if (!mSetTintModeInvoked) {
mSetTintModeInvoked = true;
BlendMode mode = tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null;
- setTintMode(mode != null ? mode : Drawable.DEFAULT_BLEND_MODE);
+ setTintBlendMode(mode != null ? mode : Drawable.DEFAULT_BLEND_MODE);
mSetTintModeInvoked = false;
}
}
@@ -721,7 +718,7 @@ public abstract class Drawable {
* @see #setTint(int)
* @see #setTintList(ColorStateList)
*/
- public void setTintMode(@Nullable BlendMode blendMode) {
+ public void setTintBlendMode(@Nullable BlendMode blendMode) {
if (!mSetBlendModeInvoked) {
mSetBlendModeInvoked = true;
PorterDuff.Mode mode = BlendMode.blendModeToPorterDuffMode(blendMode);
diff --git a/graphics/java/android/graphics/drawable/DrawableContainer.java b/graphics/java/android/graphics/drawable/DrawableContainer.java
index 3e0881aef9ed..090d915a2f67 100644
--- a/graphics/java/android/graphics/drawable/DrawableContainer.java
+++ b/graphics/java/android/graphics/drawable/DrawableContainer.java
@@ -196,14 +196,14 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
mDrawableContainerState.mHasTintMode = true;
if (mDrawableContainerState.mBlendMode != blendMode) {
mDrawableContainerState.mBlendMode = blendMode;
if (mCurrDrawable != null) {
- mCurrDrawable.setTintMode(blendMode);
+ mCurrDrawable.setTintBlendMode(blendMode);
}
}
}
@@ -544,7 +544,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
d.setTintList(mDrawableContainerState.mTintList);
}
if (mDrawableContainerState.mHasTintMode) {
- d.setTintMode(mDrawableContainerState.mBlendMode);
+ d.setTintBlendMode(mDrawableContainerState.mBlendMode);
}
}
diff --git a/graphics/java/android/graphics/drawable/DrawableWrapper.java b/graphics/java/android/graphics/drawable/DrawableWrapper.java
index d81401d451ca..64fc7042dfc7 100644
--- a/graphics/java/android/graphics/drawable/DrawableWrapper.java
+++ b/graphics/java/android/graphics/drawable/DrawableWrapper.java
@@ -324,9 +324,9 @@ public abstract class DrawableWrapper extends Drawable implements Drawable.Callb
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
if (mDrawable != null) {
- mDrawable.setTintMode(blendMode);
+ mDrawable.setTintBlendMode(blendMode);
}
}
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index 6948bc4fd61b..816d1fda57d1 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -1211,7 +1211,7 @@ public class GradientDrawable extends Drawable {
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
mGradientState.mBlendMode = blendMode;
mBlendModeColorFilter = updateBlendModeFilter(mBlendModeColorFilter, mGradientState.mTint,
blendMode);
diff --git a/graphics/java/android/graphics/drawable/Icon.java b/graphics/java/android/graphics/drawable/Icon.java
index 5fd18a1431e0..3658f89abae1 100644
--- a/graphics/java/android/graphics/drawable/Icon.java
+++ b/graphics/java/android/graphics/drawable/Icon.java
@@ -324,7 +324,7 @@ public final class Icon implements Parcelable {
if (result != null && (mTintList != null || mBlendMode != DEFAULT_BLEND_MODE)) {
result.mutate();
result.setTintList(mTintList);
- result.setTintMode(mBlendMode);
+ result.setTintBlendMode(mBlendMode);
}
return result;
}
@@ -696,10 +696,7 @@ public final class Icon implements Parcelable {
*
* @param mode a blending mode, as in {@link Drawable#setTintMode(PorterDuff.Mode)}, may be null
* @return this same object, for use in chained construction
- *
- * @deprecated use {@link #setTintMode(BlendMode)} instead
*/
- @Deprecated
public @NonNull Icon setTintMode(@NonNull PorterDuff.Mode mode) {
mBlendMode = BlendMode.fromValue(mode.nativeInt);
return this;
@@ -711,7 +708,7 @@ public final class Icon implements Parcelable {
* @param mode a blending mode, as in {@link Drawable#setTintMode(PorterDuff.Mode)}, may be null
* @return this same object, for use in chained construction
*/
- public @NonNull Icon setTintMode(@NonNull BlendMode mode) {
+ public @NonNull Icon setTintBlendMode(@NonNull BlendMode mode) {
mBlendMode = mode;
return this;
}
diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java
index e2c84927b578..f3a1b0eb52d5 100644
--- a/graphics/java/android/graphics/drawable/LayerDrawable.java
+++ b/graphics/java/android/graphics/drawable/LayerDrawable.java
@@ -1397,13 +1397,13 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
final ChildDrawable[] array = mLayerState.mChildren;
final int N = mLayerState.mNumChildren;
for (int i = 0; i < N; i++) {
final Drawable dr = array[i].mDrawable;
if (dr != null) {
- dr.setTintMode(blendMode);
+ dr.setTintBlendMode(blendMode);
}
}
}
diff --git a/graphics/java/android/graphics/drawable/NinePatchDrawable.java b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
index 4972e6a82b7d..8561d95ddd88 100644
--- a/graphics/java/android/graphics/drawable/NinePatchDrawable.java
+++ b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
@@ -349,7 +349,7 @@ public class NinePatchDrawable extends Drawable {
}
@Override
- public void setTintMode(@Nullable BlendMode blendMode) {
+ public void setTintBlendMode(@Nullable BlendMode blendMode) {
mNinePatchState.mBlendMode = blendMode;
mBlendModeFilter = updateBlendModeFilter(mBlendModeFilter, mNinePatchState.mTint,
blendMode);
diff --git a/graphics/java/android/graphics/drawable/ShapeDrawable.java b/graphics/java/android/graphics/drawable/ShapeDrawable.java
index b5fe7f9e432d..9774b59f98a9 100644
--- a/graphics/java/android/graphics/drawable/ShapeDrawable.java
+++ b/graphics/java/android/graphics/drawable/ShapeDrawable.java
@@ -297,7 +297,7 @@ public class ShapeDrawable extends Drawable {
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
mShapeState.mBlendMode = blendMode;
mBlendModeColorFilter = updateBlendModeFilter(mBlendModeColorFilter, mShapeState.mTint,
blendMode);
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java
index 43772ec20cf3..aa19b2a0e94c 100644
--- a/graphics/java/android/graphics/drawable/VectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/VectorDrawable.java
@@ -487,7 +487,7 @@ public class VectorDrawable extends Drawable {
}
@Override
- public void setTintMode(@NonNull BlendMode blendMode) {
+ public void setTintBlendMode(@NonNull BlendMode blendMode) {
final VectorDrawableState state = mVectorState;
if (state.mBlendMode != blendMode) {
state.mBlendMode = blendMode;
diff --git a/media/apex/java/android/media/MediaController2.java b/media/apex/java/android/media/MediaController2.java
index fb4e6ac23937..9848f1a10a54 100644
--- a/media/apex/java/android/media/MediaController2.java
+++ b/media/apex/java/android/media/MediaController2.java
@@ -175,7 +175,7 @@ public class MediaController2 implements AutoCloseable {
* @return Session2Token of the connected session, or {@code null} if not connected
*/
@Nullable
- public Session2Token getConnectedSessionToken() {
+ public Session2Token getConnectedToken() {
synchronized (mLock) {
return mConnectedToken;
}
diff --git a/media/apex/java/android/media/MediaSession2.java b/media/apex/java/android/media/MediaSession2.java
index 6b56ae086a0d..0a1edb8d7712 100644
--- a/media/apex/java/android/media/MediaSession2.java
+++ b/media/apex/java/android/media/MediaSession2.java
@@ -153,7 +153,7 @@ public class MediaSession2 implements AutoCloseable {
* Returns the session ID
*/
@NonNull
- public String getSessionId() {
+ public String getId() {
return mSessionId;
}
@@ -161,7 +161,7 @@ public class MediaSession2 implements AutoCloseable {
* Returns the {@link Session2Token} for creating {@link MediaController2}.
*/
@NonNull
- public Session2Token getSessionToken() {
+ public Session2Token getToken() {
return mSessionToken;
}
@@ -553,7 +553,7 @@ public class MediaSession2 implements AutoCloseable {
try {
MediaSessionManager manager = (MediaSessionManager) mContext.getSystemService(
Context.MEDIA_SESSION_SERVICE);
- manager.notifySession2Created(session2.getSessionToken());
+ manager.notifySession2Created(session2.getToken());
} catch (Exception e) {
session2.close();
throw e;
diff --git a/media/apex/java/android/media/MediaSession2Service.java b/media/apex/java/android/media/MediaSession2Service.java
index 3f392d28fa1f..b8bf3842aae8 100644
--- a/media/apex/java/android/media/MediaSession2Service.java
+++ b/media/apex/java/android/media/MediaSession2Service.java
@@ -195,15 +195,15 @@ public abstract class MediaSession2Service extends Service {
throw new IllegalArgumentException("session is already closed");
}
synchronized (mLock) {
- MediaSession2 previousSession = mSessions.get(session.getSessionId());
+ MediaSession2 previousSession = mSessions.get(session.getId());
if (previousSession != null) {
if (previousSession != session) {
- Log.w(TAG, "Session ID should be unique, ID=" + session.getSessionId()
+ Log.w(TAG, "Session ID should be unique, ID=" + session.getId()
+ ", previous=" + previousSession + ", session=" + session);
}
return;
}
- mSessions.put(session.getSessionId(), session);
+ mSessions.put(session.getId(), session);
session.setForegroundServiceEventCallback(mForegroundServiceEventCallback);
}
}
@@ -220,11 +220,11 @@ public abstract class MediaSession2Service extends Service {
}
MediaNotification notification;
synchronized (mLock) {
- if (mSessions.get(session.getSessionId()) != session) {
+ if (mSessions.get(session.getId()) != session) {
// Session isn't added or removed already.
return;
}
- mSessions.remove(session.getSessionId());
+ mSessions.remove(session.getId());
notification = mNotifications.remove(session);
}
session.setForegroundServiceEventCallback(null);
diff --git a/packages/DynamicSystemInstallationService/res/values/strings.xml b/packages/DynamicSystemInstallationService/res/values/strings.xml
index 2a66db124d10..9bd5be7b0dd7 100644
--- a/packages/DynamicSystemInstallationService/res/values/strings.xml
+++ b/packages/DynamicSystemInstallationService/res/values/strings.xml
@@ -1,38 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- application name [CHAR LIMIT=32] -->
- <string name="app_name">AndroidOnTap Installer</string>
+ <string name="app_name">Dynamic System Updates</string>
<!-- notification channel name [CHAR LIMIT=32] -->
- <string name="notification_channel_name">AndroidOnTap Installer</string>
+ <string name="notification_channel_name">Dynamic System Updates</string>
<!-- password page title [CHAR LIMIT=32] -->
- <string name="keyguard_title">AndroidOnTap Installer</string>
+ <string name="keyguard_title">Dynamic System Updates</string>
<!-- password page description [CHAR LIMIT=128] -->
- <string name="keyguard_description">Please enter your password and continue to AndroidOnTap installation</string>
+ <string name="keyguard_description">Please enter your password and continue to Dynamic System Updates</string>
- <!-- Displayed on notification: AndroidOnTap installation is completed [CHAR LIMIT=128] -->
- <string name="notification_install_completed">System update is ready. To finish installing, restart your device.</string>
- <!-- Displayed on notification: AndroidOnTap installation is in progress [CHAR LIMIT=128] -->
+ <!-- Displayed on notification: Dynamic System is ready [CHAR LIMIT=128] -->
+ <string name="notification_install_completed">Dynamic system is ready. To start using it, restart your device.</string>
+ <!-- Displayed on notification: Dynamic System Updates is in progress [CHAR LIMIT=128] -->
<string name="notification_install_inprogress">Install in progress</string>
- <!-- Displayed on notification: AndroidOnTap installation is in progress [CHAR LIMIT=128] -->
- <string name="notification_install_failed">Install Failed</string>
- <!-- Displayed on notification: We are running in AndroidOnTap [CHAR LIMIT=128] -->
- <string name="notification_dynsystem_in_use">We are running in AndroidOnTap.</string>
+ <!-- Displayed on notification: Dynamic System installation failed [CHAR LIMIT=128] -->
+ <string name="notification_install_failed">Install failed</string>
+ <!-- Displayed on notification: We are running in Dynamic System [CHAR LIMIT=128] -->
+ <string name="notification_dynsystem_in_use">Currently running a dynamic system. Restart to use the original Android version.</string>
<!-- Action on notification: Cancel installation [CHAR LIMIT=16] -->
<string name="notification_action_cancel">Cancel</string>
<!-- Action on notification: Discard installation [CHAR LIMIT=16] -->
<string name="notification_action_discard">Discard</string>
- <!-- Action on notification: Uninstall AndroidOnTap [CHAR LIMIT=16] -->
+ <!-- Action on notification: Uninstall Dynamic System [CHAR LIMIT=16] -->
<string name="notification_action_uninstall">Uninstall</string>
- <!-- Action on notification: Restart to AndroidOnTap [CHAR LIMIT=16] -->
+ <!-- Action on notification: Restart to Dynamic System [CHAR LIMIT=16] -->
<string name="notification_action_reboot_to_dynsystem">Restart</string>
- <!-- Toast when installed AndroidOnTap is discarded [CHAR LIMIT=64] -->
- <string name="toast_dynsystem_discarded">Installed AndroidOnTap is discarded.</string>
- <!-- Toast when we fail to launch into AndroidOnTap [CHAR LIMIT=64] -->
- <string name="toast_failed_to_reboot_to_dynsystem">Failed to restart to AndroidOnTap.</string>
+ <!-- Toast when installed Dynamic System is discarded [CHAR LIMIT=64] -->
+ <string name="toast_dynsystem_discarded">Discarded dynamic system</string>
+ <!-- Toast when we fail to launch into Dynamic System [CHAR LIMIT=64] -->
+ <string name="toast_failed_to_reboot_to_dynsystem">Can\u2019t restart or load dynamic system</string>
</resources>
diff --git a/packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtilsInternal.java b/packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtilsInternal.java
index 93f6a94dcf49..9a41f1d6a2b1 100644
--- a/packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtilsInternal.java
+++ b/packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtilsInternal.java
@@ -38,7 +38,6 @@ import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.text.style.ImageSpan;
-import android.util.Log;
import android.view.MenuItem;
import android.widget.TextView;
@@ -47,7 +46,6 @@ import androidx.annotation.VisibleForTesting;
import com.android.internal.widget.LockPatternUtils;
import java.util.List;
-import java.util.Set;
/**
* Utility class to host methods usable in adding a restricted padlock icon and showing admin
@@ -310,43 +308,6 @@ public class RestrictedLockUtilsInternal extends RestrictedLockUtils {
return null;
}
- /**
- * @param userId user id of a managed profile.
- * @return profile owner admin if cross profile calendar is disallowed.
- */
- public static EnforcedAdmin getCrossProfileCalendarEnforcingAdmin(Context context, int userId) {
- final Context managedProfileContext = createPackageContextAsUser(
- context, userId);
- final DevicePolicyManager dpm = managedProfileContext.getSystemService(
- DevicePolicyManager.class);
- if (dpm == null) {
- return null;
- }
- final EnforcedAdmin admin = getProfileOwner(context, userId);
- if (admin == null) {
- return null;
- }
- final Set<String> packages = dpm.getCrossProfileCalendarPackages();
- if (packages != null && packages.isEmpty()) {
- return admin;
- }
- return null;
- }
-
- /**
- * @param userId user id of a managed profile.
- * @return a context created from the given context for the given user, or null if it fails.
- */
- private static Context createPackageContextAsUser(Context context, int userId) {
- try {
- return context.createPackageContextAsUser(
- context.getPackageName(), 0 /* flags */, UserHandle.of(userId));
- } catch (PackageManager.NameNotFoundException e) {
- Log.e(LOG_TAG, "Failed to create user context", e);
- }
- return null;
- }
-
public static EnforcedAdmin checkIfAccessibilityServiceDisallowed(Context context,
String packageName, int userId) {
DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(
diff --git a/packages/SystemUI/res-keyguard/drawable/bubble_hour_hand.xml b/packages/SystemUI/res-keyguard/drawable/bubble_hour_hand.xml
index a2404b0834e9..65f7a0e29843 100644
--- a/packages/SystemUI/res-keyguard/drawable/bubble_hour_hand.xml
+++ b/packages/SystemUI/res-keyguard/drawable/bubble_hour_hand.xml
@@ -1,9 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:height="350dp"
- android:width="350dp"
- android:viewportHeight="254.66145"
- android:viewportWidth="254.66145">
+ android:height="340dp"
+ android:width="340dp"
+ android:viewportHeight="340"
+ android:viewportWidth="340">
<path
- android:fillColor="#000000"
- android:pathData="M127.331,40.481m-10.914,0a10.914,10.914 0,1 1,21.828 0a10.914,10.914 0,1 1,-21.828 0"/>
+ android:pathData="M170,40m-39,0a39,39 0,1 1,78 0a39,39 0,1 1,-78 0"
+ android:strokeColor="#000000"
+ android:strokeWidth="2"/>
</vector>
diff --git a/packages/SystemUI/res-keyguard/drawable/bubble_minute_hand.xml b/packages/SystemUI/res-keyguard/drawable/bubble_minute_hand.xml
index be10b5d12af7..95b4b1ad0b9b 100644
--- a/packages/SystemUI/res-keyguard/drawable/bubble_minute_hand.xml
+++ b/packages/SystemUI/res-keyguard/drawable/bubble_minute_hand.xml
@@ -1,11 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:height="350dp"
- android:width="350dp"
- android:viewportHeight="254.66145"
- android:viewportWidth="254.66145" >
+ android:height="340dp"
+ android:width="340dp"
+ android:viewportHeight="340"
+ android:viewportWidth="340">
<path
+ android:pathData="M170,1L170,1A39,39 0,0 1,209 40L209,130A39,39 0,0 1,170 169L170,169A39,39 0,0 1,131 130L131,40A39,39 0,0 1,170 1z"
android:strokeColor="#000000"
- android:strokeWidth="5"
- android:pathData="M125.923,29.692L128.739,29.692A27.108,30.579 0,0 1,155.847 60.271L155.847,125.268A27.108,30.579 0,0 1,128.739 155.847L125.923,155.847A27.108,30.579 0,0 1,98.815 125.268L98.815,60.271A27.108,30.579 0,0 1,125.923 29.692z"/>
+ android:strokeWidth="2"/>
</vector>
-
diff --git a/packages/SystemUI/res-keyguard/layout/bubble_clock.xml b/packages/SystemUI/res-keyguard/layout/bubble_clock.xml
index b44faa98aa45..a6ad254d1c9d 100644
--- a/packages/SystemUI/res-keyguard/layout/bubble_clock.xml
+++ b/packages/SystemUI/res-keyguard/layout/bubble_clock.xml
@@ -26,15 +26,15 @@
>
<ImageView
android:id="@+id/minute_hand"
- android:layout_width="350dp"
- android:layout_height="350dp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:src="@drawable/bubble_minute_hand"
android:tint="@color/bubbleMinuteHandColor"
/>
<ImageView
android:id="@+id/hour_hand"
- android:layout_width="350dp"
- android:layout_height="350dp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:src="@drawable/bubble_hour_hand"
android:tint="@color/bubbleHourHandColor"
/>
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_message_area.xml b/packages/SystemUI/res-keyguard/layout/keyguard_message_area.xml
deleted file mode 100644
index 5da7611a4462..000000000000
--- a/packages/SystemUI/res-keyguard/layout/keyguard_message_area.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, 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.
-*/
--->
-
-<!-- This contains error message field and padlock shared by pin/pattern/password screens -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" >
- <FrameLayout
- android:id="@+id/lock_icon_container"
- android:layout_gravity="center"
- android:layout_marginBottom="@dimen/keyguard_lock_padding"
- android:layout_width="@dimen/keyguard_lock_width"
- android:layout_height="@dimen/keyguard_lock_height" />
- <com.android.keyguard.KeyguardMessageArea
- android:id="@+id/keyguard_message_area"
- style="@style/Keyguard.TextView"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:focusable="true" />
-</LinearLayout> \ No newline at end of file
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_message_area_large.xml b/packages/SystemUI/res-keyguard/layout/keyguard_message_area_large.xml
deleted file mode 100644
index ab6246d1f5df..000000000000
--- a/packages/SystemUI/res-keyguard/layout/keyguard_message_area_large.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2012, 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.
-*/
--->
-
-<!-- This contains emergency call button and carrier as shared by pin/pattern/password screens -->
-<com.android.keyguard.KeyguardMessageArea
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:id="@+id/keyguard_message_area"
- android:maxLines="4"
- android:textAppearance="?android:attr/textAppearance"
- android:textSize="@dimen/kg_status_line_font_size"
- android:textColor="?android:attr/textColorSecondary" />
-
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml
index 11bd98f549ca..b06d6a989cb8 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml
@@ -34,10 +34,6 @@
android:layout_weight="7"
/>
- <include layout="@layout/keyguard_message_area"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
<!-- Password entry field -->
<FrameLayout
android:layout_height="wrap_content"
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_pattern_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_pattern_view.xml
index ccb9af9ff731..dc2d11d601b4 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_pattern_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_pattern_view.xml
@@ -48,11 +48,6 @@
android:clipChildren="false"
android:clipToPadding="false">
- <include layout="@layout/keyguard_message_area"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- />
-
<com.android.internal.widget.LockPatternView
android:id="@+id/lockPatternView"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml
index 9c41fca7d224..a75b35d117b6 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml
@@ -27,10 +27,6 @@
androidprv:layout_maxHeight="@dimen/keyguard_security_max_height"
android:orientation="vertical"
>
- <include layout="@layout/keyguard_message_area"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- />
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
index bfb5bf9c0499..cd61a3775bf7 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
@@ -35,10 +35,6 @@
android:tint="@color/background_protected"
android:src="@drawable/ic_lockscreen_sim"/>
- <include layout="@layout/keyguard_message_area"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml
index 9f3ae3a8be45..bb757356f2b9 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml
@@ -36,10 +36,6 @@
android:tint="@color/background_protected"
android:src="@drawable/ic_lockscreen_sim"/>
- <include layout="@layout/keyguard_message_area"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
diff --git a/packages/SystemUI/res-keyguard/values/strings.xml b/packages/SystemUI/res-keyguard/values/strings.xml
index 1e98189fa238..09a5295b55ef 100644
--- a/packages/SystemUI/res-keyguard/values/strings.xml
+++ b/packages/SystemUI/res-keyguard/values/strings.xml
@@ -65,7 +65,7 @@
<string name="keyguard_charged">Fully charged</string>
<!-- When the lock screen is showing and the phone plugged in, and the battery is not fully charged, say that it's wirelessly charging. [CHAR LIMIT=50] -->
- <string name="keyguard_plugged_in_wireless"><xliff:g id="percentage" example="20%">%s</xliff:g> • Wirelessly Charging</string>
+ <string name="keyguard_plugged_in_wireless"><xliff:g id="percentage" example="20%">%s</xliff:g> • Charging wirelessly</string>
<!-- When the lock screen is showing and the phone plugged in, and the battery
is not fully charged, say that it's charging. -->
diff --git a/packages/SystemUI/res/layout/keyguard_bottom_area.xml b/packages/SystemUI/res/layout/keyguard_bottom_area.xml
index 636b929c6aa5..cdef09d73f77 100644
--- a/packages/SystemUI/res/layout/keyguard_bottom_area.xml
+++ b/packages/SystemUI/res/layout/keyguard_bottom_area.xml
@@ -78,21 +78,6 @@
android:tint="?attr/wallpaperTextColor" />
<FrameLayout
- android:id="@+id/lock_icon_container"
- android:layout_width="@dimen/keyguard_lock_width"
- android:layout_height="@dimen/keyguard_lock_height"
- android:layout_gravity="bottom|center_horizontal"
- android:layout_marginBottom="@dimen/keyguard_lock_padding">
- <com.android.systemui.statusbar.phone.LockIcon
- android:id="@+id/lock_icon"
- android:layout_width="@dimen/keyguard_lock_width"
- android:layout_height="@dimen/keyguard_lock_height"
- android:src="@*android:drawable/ic_lock"
- android:contentDescription="@string/accessibility_unlock_button"
- android:scaleType="center" />
- </FrameLayout>
-
- <FrameLayout
android:id="@+id/overlay_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
diff --git a/packages/SystemUI/res/layout/super_status_bar.xml b/packages/SystemUI/res/layout/super_status_bar.xml
index 34c208ab81aa..4cf5f850285e 100644
--- a/packages/SystemUI/res/layout/super_status_bar.xml
+++ b/packages/SystemUI/res/layout/super_status_bar.xml
@@ -71,4 +71,31 @@
sysui:ignoreRightInset="true"
/>
+ <LinearLayout
+ android:id="@+id/lock_icon_container"
+ android:orientation="vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/status_bar_height"
+ android:layout_gravity="top|center_horizontal">
+ <com.android.systemui.statusbar.phone.LockIcon
+ android:id="@+id/lock_icon"
+ android:layout_width="@dimen/keyguard_lock_width"
+ android:layout_height="@dimen/keyguard_lock_height"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="@dimen/keyguard_lock_padding"
+ android:contentDescription="@string/accessibility_unlock_button"
+ android:src="@*android:drawable/ic_lock"
+ android:scaleType="center" />
+ <com.android.keyguard.KeyguardMessageArea
+ android:id="@+id/keyguard_message_area"
+ style="@style/Keyguard.TextView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/keyguard_lock_padding"
+ android:gravity="center"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:focusable="true" />
+ </LinearLayout>
</com.android.systemui.statusbar.phone.StatusBarWindowView>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index bfdb21877277..5d8b9e662c51 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -717,9 +717,9 @@
<!-- The width/height of the unlock icon view on keyguard. -->
<dimen name="keyguard_lock_height">42dp</dimen>
<dimen name="keyguard_lock_width">42dp</dimen>
- <dimen name="keyguard_lock_padding">19dp</dimen>
+ <dimen name="keyguard_lock_padding">20dp</dimen>
- <dimen name="keyguard_indication_margin_bottom">65dp</dimen>
+ <dimen name="keyguard_indication_margin_bottom">44dp</dimen>
<!-- The text size for battery level -->
<dimen name="battery_level_text_size">12sp</dimen>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 256f72503c22..0b0822cd831e 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -277,8 +277,6 @@
<string name="accessibility_send_smart_reply">Send</string>
<!-- Content description of the manage notification button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_manage_notification">Manage notifications</string>
- <!-- Click action label for accessibility for the unlock button. [CHAR LIMIT=NONE] -->
- <string name="unlock_label">unlock</string>
<!-- Click action label for accessibility for the phone button. [CHAR LIMIT=NONE] -->
<string name="phone_label">open phone</string>
<!-- Click action label for accessibility for the voice assist button. This is not shown on-screen and is an accessibility label for the icon which launches the voice assist from the lock screen.[CHAR LIMIT=NONE] -->
@@ -974,7 +972,7 @@
<string name="interruption_level_alarms_twoline">Alarms\nonly</string>
<!-- Indication on the keyguard that is shown when the device is wirelessly charging. [CHAR LIMIT=80]-->
- <string name="keyguard_indication_charging_time_wireless"><xliff:g id="percentage" example="20%">%2$s</xliff:g> • Wirelessly Charging (<xliff:g id="charging_time_left" example="4 hours and 2 minutes">%1$s</xliff:g> until full)</string>
+ <string name="keyguard_indication_charging_time_wireless"><xliff:g id="percentage" example="20%">%2$s</xliff:g> • Charging wirelessly (<xliff:g id="charging_time_left" example="4 hours and 2 minutes">%1$s</xliff:g> until full)</string>
<!-- Indication on the keyguard that is shown when the device is charging. [CHAR LIMIT=50]-->
<string name="keyguard_indication_charging_time"><xliff:g id="percentage">%2$s</xliff:g> • Charging (<xliff:g id="charging_time_left" example="4 hours and 2 minutes">%1$s</xliff:g> until full)</string>
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
index 4cb8d90927fd..2ff7266baecf 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
@@ -100,7 +100,6 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
@Override
protected void onFinishInflate() {
mLockPatternUtils = new LockPatternUtils(mContext);
- mSecurityMessageDisplay = KeyguardMessageArea.findSecurityMessageDisplay(this);
mEcaView = findViewById(R.id.keyguard_selector_fade_container);
EmergencyButton button = findViewById(R.id.emergency_call_button);
@@ -110,6 +109,12 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
}
@Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mSecurityMessageDisplay = KeyguardMessageArea.findSecurityMessageDisplay(this);
+ }
+
+ @Override
public void onEmergencyButtonClickedWhenInCall() {
mCallback.reset();
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java b/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java
index 010ec7c44cf3..ace6f6fe904d 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java
@@ -16,8 +16,12 @@
package com.android.keyguard;
+import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
+
import android.content.Context;
import android.content.res.ColorStateList;
+import android.content.res.TypedArray;
+import android.graphics.Color;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
@@ -26,12 +30,18 @@ import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
+import com.android.systemui.statusbar.policy.ConfigurationController;
+
import java.lang.ref.WeakReference;
+import javax.inject.Inject;
+import javax.inject.Named;
+
/***
* Manages a number of views inside of the given layout. See below for a list of widgets.
*/
-class KeyguardMessageArea extends TextView implements SecurityMessageDisplay {
+public class KeyguardMessageArea extends TextView implements SecurityMessageDisplay,
+ ConfigurationController.ConfigurationListener {
/** Handler token posted with accessibility announcement runnables. */
private static final Object ANNOUNCE_TOKEN = new Object();
@@ -43,8 +53,9 @@ class KeyguardMessageArea extends TextView implements SecurityMessageDisplay {
private static final int DEFAULT_COLOR = -1;
private final Handler mHandler;
- private final ColorStateList mDefaultColorState;
+ private final ConfigurationController mConfigurationController;
+ private ColorStateList mDefaultColorState;
private CharSequence mMessage;
private ColorStateList mNextMessageColorState = ColorStateList.valueOf(DEFAULT_COLOR);
@@ -58,30 +69,58 @@ class KeyguardMessageArea extends TextView implements SecurityMessageDisplay {
};
public KeyguardMessageArea(Context context) {
- this(context, null);
+ super(context, null);
+ throw new IllegalStateException("This constructor should never be invoked");
}
- public KeyguardMessageArea(Context context, AttributeSet attrs) {
- this(context, attrs, KeyguardUpdateMonitor.getInstance(context));
+ @Inject
+ public KeyguardMessageArea(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
+ ConfigurationController configurationController) {
+ this(context, attrs, KeyguardUpdateMonitor.getInstance(context), configurationController);
}
- public KeyguardMessageArea(Context context, AttributeSet attrs, KeyguardUpdateMonitor monitor) {
+ public KeyguardMessageArea(Context context, AttributeSet attrs, KeyguardUpdateMonitor monitor,
+ ConfigurationController configurationController) {
super(context, attrs);
setLayerType(LAYER_TYPE_HARDWARE, null); // work around nested unclipped SaveLayer bug
monitor.registerCallback(mInfoCallback);
mHandler = new Handler(Looper.myLooper());
+ mConfigurationController = configurationController;
- mDefaultColorState = getTextColors();
+ onThemeChanged();
update();
}
@Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mConfigurationController.addCallback(this);
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mConfigurationController.removeCallback(this);
+ }
+
+ @Override
public void setNextMessageColor(ColorStateList colorState) {
mNextMessageColorState = colorState;
}
@Override
+ public void onThemeChanged() {
+ TypedArray array = mContext.obtainStyledAttributes(new int[] {
+ R.attr.wallpaperTextColor
+ });
+ ColorStateList newTextColors = ColorStateList.valueOf(array.getColor(0, Color.RED));
+ array.recycle();
+ setTextColor(newTextColors);
+ mDefaultColorState = newTextColors;
+ }
+
+ @Override
public void setMessage(CharSequence msg) {
if (!TextUtils.isEmpty(msg)) {
securityMessageChanged(msg);
@@ -108,9 +147,11 @@ class KeyguardMessageArea extends TextView implements SecurityMessageDisplay {
setMessage(message);
}
- public static SecurityMessageDisplay findSecurityMessageDisplay(View v) {
- KeyguardMessageArea messageArea = (KeyguardMessageArea) v.findViewById(
- R.id.keyguard_message_area);
+ public static KeyguardMessageArea findSecurityMessageDisplay(View v) {
+ KeyguardMessageArea messageArea = v.findViewById(R.id.keyguard_message_area);
+ if (messageArea == null) {
+ messageArea = v.getRootView().findViewById(R.id.keyguard_message_area);
+ }
if (messageArea == null) {
throw new RuntimeException("Can't find keyguard_message_area in " + v.getClass());
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java
index a543d1712299..6808c0f73998 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java
@@ -67,7 +67,9 @@ public class KeyguardPINView extends KeyguardPinBasedInputView {
@Override
protected void resetState() {
super.resetState();
- mSecurityMessageDisplay.setMessage("");
+ if (mSecurityMessageDisplay != null) {
+ mSecurityMessageDisplay.setMessage("");
+ }
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java
index 185edbfa9856..963921561f67 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java
@@ -81,7 +81,9 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
@Override
protected void resetState() {
mPasswordEntry.setTextOperationUser(UserHandle.of(KeyguardUpdateMonitor.getCurrentUser()));
- mSecurityMessageDisplay.setMessage("");
+ if (mSecurityMessageDisplay != null) {
+ mSecurityMessageDisplay.setMessage("");
+ }
final boolean wasDisabled = mPasswordEntry.isEnabled();
// Don't set enabled password entry & showSoftInput when PasswordEntry is invisible or in
// pausing stage.
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
index 112e06785bee..8899bd9ea9f2 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
@@ -34,6 +34,7 @@ import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.LinearLayout;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternChecker;
import com.android.internal.widget.LockPatternUtils;
@@ -92,7 +93,8 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
}
};
private Rect mTempRect = new Rect();
- private KeyguardMessageArea mSecurityMessageDisplay;
+ @VisibleForTesting
+ KeyguardMessageArea mSecurityMessageDisplay;
private View mEcaView;
private ViewGroup mContainer;
private int mDisappearYTranslation;
@@ -151,8 +153,6 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
// vibrate mode will be the same for the life of this screen
mLockPatternView.setTactileFeedbackEnabled(mLockPatternUtils.isTactileFeedbackEnabled());
- mSecurityMessageDisplay =
- (KeyguardMessageArea) KeyguardMessageArea.findSecurityMessageDisplay(this);
mEcaView = findViewById(R.id.keyguard_selector_fade_container);
mContainer = findViewById(R.id.container);
@@ -171,6 +171,12 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
}
@Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mSecurityMessageDisplay = KeyguardMessageArea.findSecurityMessageDisplay(this);
+ }
+
+ @Override
public void onEmergencyButtonClickedWhenInCall() {
mCallback.reset();
}
@@ -201,6 +207,10 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
mLockPatternView.setEnabled(true);
mLockPatternView.clearPattern();
+ if (mSecurityMessageDisplay == null) {
+ return;
+ }
+
// if the user is currently locked out, enforce it.
long deadline = mLockPatternUtils.getLockoutAttemptDeadline(
KeyguardUpdateMonitor.getCurrentUser());
@@ -212,7 +222,9 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
}
private void displayDefaultSecurityMessage() {
- mSecurityMessageDisplay.setMessage("");
+ if (mSecurityMessageDisplay != null) {
+ mSecurityMessageDisplay.setMessage("");
+ }
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
index fb4fe814601f..0d8a3db67a1c 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
@@ -24,6 +24,7 @@ import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -104,7 +105,9 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
int count = TelephonyManager.getDefault().getSimCount();
Resources rez = getResources();
String msg;
- int color = Color.WHITE;
+ TypedArray array = mContext.obtainStyledAttributes(new int[] { R.attr.wallpaperTextColor });
+ int color = array.getColor(0, Color.WHITE);
+ array.recycle();
if (count < 2) {
msg = rez.getString(R.string.kg_sim_pin_instructions);
} else {
@@ -120,7 +123,9 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
msg = rez.getString(R.string.kg_sim_lock_esim_instructions, msg);
}
- mSecurityMessageDisplay.setMessage(msg);
+ if (mSecurityMessageDisplay != null) {
+ mSecurityMessageDisplay.setMessage(msg);
+ }
mSimImageView.setImageTintList(ColorStateList.valueOf(color));
}
@@ -214,6 +219,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
protected void onAttachedToWindow() {
super.onAttachedToWindow();
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallback);
+ resetState();
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
index b17d117b68e3..27f71d1ae2be 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
@@ -23,6 +23,7 @@ import android.app.ProgressDialog;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
+import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -164,7 +165,9 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
int count = TelephonyManager.getDefault().getSimCount();
Resources rez = getResources();
String msg;
- int color = Color.WHITE;
+ TypedArray array = mContext.obtainStyledAttributes(new int[] { R.attr.wallpaperTextColor });
+ int color = array.getColor(0, Color.WHITE);
+ array.recycle();
if (count < 2) {
msg = rez.getString(R.string.kg_puk_enter_puk_hint);
} else {
@@ -179,7 +182,9 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
if (isEsimLocked) {
msg = rez.getString(R.string.kg_sim_lock_esim_instructions, msg);
}
- mSecurityMessageDisplay.setMessage(msg);
+ if (mSecurityMessageDisplay != null) {
+ mSecurityMessageDisplay.setMessage(msg);
+ }
mSimImageView.setImageTintList(ColorStateList.valueOf(color));
// Sending empty PUK here to query the number of remaining PIN attempts
@@ -267,6 +272,7 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
protected void onAttachedToWindow() {
super.onAttachedToWindow();
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallback);
+ resetState();
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
index cadfb79f24f7..fbbf64cf700b 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
@@ -167,9 +167,9 @@ public class BubbleClockController implements ClockPlugin {
return;
}
final int length = colorPalette.length;
- mLockClock.setTextColor(colorPalette[Math.max(0, length - 3)]);
- mAnalogClock.setClockColors(colorPalette[Math.max(0, length - 6)],
- colorPalette[Math.max(0, length - 3)]);
+ final int color = colorPalette[Math.max(0, length - 3)];
+ mLockClock.setTextColor(color);
+ mAnalogClock.setClockColors(color, color);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index b755f2886470..9d9c88f2c6ca 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -542,6 +542,9 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
* status bar, otherwise returns {@link Display#INVALID_DISPLAY}.
*/
public int getExpandedDisplayId(Context context) {
+ if (mStackView == null) {
+ return INVALID_DISPLAY;
+ }
boolean defaultDisplay = context.getDisplay() != null
&& context.getDisplay().getDisplayId() == DEFAULT_DISPLAY;
Bubble b = mStackView.getExpandedBubble();
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index d70d0d80c681..6af7ac4d17b8 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -2074,9 +2074,9 @@ public class KeyguardViewMediator extends SystemUI {
public StatusBarKeyguardViewManager registerStatusBar(StatusBar statusBar,
ViewGroup container, NotificationPanelView panelView,
- BiometricUnlockController biometricUnlockController) {
+ BiometricUnlockController biometricUnlockController, ViewGroup lockIconContainer) {
mStatusBarKeyguardViewManager.registerStatusBar(statusBar, container, panelView,
- biometricUnlockController, mDismissCallbackRegistry);
+ biometricUnlockController, mDismissCallbackRegistry, lockIconContainer);
return mStatusBarKeyguardViewManager;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 25436a9ad45b..7d4cf75059dd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -41,6 +41,8 @@ import android.view.ViewGroup;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IBatteryStats;
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.settingslib.Utils;
@@ -51,6 +53,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
import com.android.systemui.statusbar.phone.LockIcon;
+import com.android.systemui.statusbar.phone.LockscreenGestureLogger;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.policy.UserInfoController;
import com.android.systemui.util.wakelock.SettableWakeLock;
@@ -80,11 +83,13 @@ public class KeyguardIndicationController implements StateListener {
private final UserManager mUserManager;
private final IBatteryStats mBatteryInfo;
private final SettableWakeLock mWakeLock;
+ private final LockPatternUtils mLockPatternUtils;
private final int mSlowThreshold;
private final int mFastThreshold;
private final LockIcon mLockIcon;
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
+ private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private String mRestingIndication;
private CharSequence mTransientIndication;
@@ -104,14 +109,13 @@ public class KeyguardIndicationController implements StateListener {
private final DevicePolicyManager mDevicePolicyManager;
private boolean mDozing;
- private float mDarkAmount;
/**
* Creates a new KeyguardIndicationController and registers callbacks.
*/
public KeyguardIndicationController(Context context, ViewGroup indicationArea,
LockIcon lockIcon) {
- this(context, indicationArea, lockIcon,
+ this(context, indicationArea, lockIcon, new LockPatternUtils(context),
WakeLock.createPartial(context, "Doze:KeyguardIndication"));
registerCallbacks(KeyguardUpdateMonitor.getInstance(context));
@@ -122,7 +126,7 @@ public class KeyguardIndicationController implements StateListener {
*/
@VisibleForTesting
KeyguardIndicationController(Context context, ViewGroup indicationArea, LockIcon lockIcon,
- WakeLock wakeLock) {
+ LockPatternUtils lockPatternUtils, WakeLock wakeLock) {
mContext = context;
mIndicationArea = indicationArea;
mTextView = indicationArea.findViewById(R.id.keyguard_indication_text);
@@ -130,7 +134,9 @@ public class KeyguardIndicationController implements StateListener {
mTextView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
mDisclosure = indicationArea.findViewById(R.id.keyguard_indication_enterprise_disclosure);
mLockIcon = lockIcon;
+ mLockIcon.setOnLongClickListener(this::handleTrustCircleClick);
mWakeLock = new SettableWakeLock(wakeLock, TAG);
+ mLockPatternUtils = lockPatternUtils;
Resources res = context.getResources();
mSlowThreshold = res.getInteger(R.integer.config_chargingSlowlyThreshold);
@@ -164,6 +170,15 @@ public class KeyguardIndicationController implements StateListener {
Dependency.get(StatusBarStateController.class).removeCallback(this);
}
+ private boolean handleTrustCircleClick(View view) {
+ mLockscreenGestureLogger.write(MetricsProto.MetricsEvent.ACTION_LS_LOCK,
+ 0 /* lengthDp - N/A */, 0 /* velocityDp - N/A */);
+ showTransientIndication(R.string.keyguard_indication_trust_disabled);
+ mLockPatternUtils.requireCredentialEntry(KeyguardUpdateMonitor.getCurrentUser());
+
+ return true;
+ }
+
/**
* Gets the {@link KeyguardUpdateMonitorCallback} instance associated with this
* {@link KeyguardIndicationController}.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java
index 49d421be3fc4..cd0a43ed3bf6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java
@@ -56,7 +56,6 @@ public class KeyguardAffordanceHelper {
private int mMinFlingVelocity;
private int mHintGrowAmount;
private KeyguardAffordanceView mLeftIcon;
- private KeyguardAffordanceView mCenterIcon;
private KeyguardAffordanceView mRightIcon;
private Animator mSwipeAnimator;
private FalsingManager mFalsingManager;
@@ -85,7 +84,6 @@ public class KeyguardAffordanceHelper {
mCallback = callback;
initIcons();
updateIcon(mLeftIcon, 0.0f, mLeftIcon.getRestingAlpha(), false, false, true, false);
- updateIcon(mCenterIcon, 0.0f, mCenterIcon.getRestingAlpha(), false, false, true, false);
updateIcon(mRightIcon, 0.0f, mRightIcon.getRestingAlpha(), false, false, true, false);
initDimens();
}
@@ -108,7 +106,6 @@ public class KeyguardAffordanceHelper {
private void initIcons() {
mLeftIcon = mCallback.getLeftIcon();
- mCenterIcon = mCallback.getCenterIcon();
mRightIcon = mCallback.getRightIcon();
updatePreviews();
}
@@ -398,8 +395,6 @@ public class KeyguardAffordanceHelper {
}
updateIcon(otherView, 0.0f, fadeOutAlpha * otherView.getRestingAlpha(),
animateIcons, slowAnimation, isReset, forceNoCircleAnimation);
- updateIcon(mCenterIcon, 0.0f, fadeOutAlpha * mCenterIcon.getRestingAlpha(),
- animateIcons, slowAnimation, isReset, forceNoCircleAnimation);
mTranslation = translation;
}
@@ -417,7 +412,6 @@ public class KeyguardAffordanceHelper {
KeyguardAffordanceView otherView = targetView == mRightIcon ? mLeftIcon : mRightIcon;
updateIconAlpha(targetView, alpha + fadeOutAlpha * targetView.getRestingAlpha(), false);
updateIconAlpha(otherView, fadeOutAlpha * otherView.getRestingAlpha(), false);
- updateIconAlpha(mCenterIcon, fadeOutAlpha * mCenterIcon.getRestingAlpha(), false);
}
private float getTranslationFromRadius(float circleSize) {
@@ -538,12 +532,10 @@ public class KeyguardAffordanceHelper {
if (animate) {
fling(0, false, !left);
updateIcon(otherView, 0.0f, 0, true, false, true, false);
- updateIcon(mCenterIcon, 0.0f, 0, true, false, true, false);
} else {
mCallback.onAnimationToSideStarted(!left, mTranslation, 0);
mTranslation = left ? mCallback.getMaxTranslationDistance()
: mCallback.getMaxTranslationDistance();
- updateIcon(mCenterIcon, 0.0f, 0.0f, false, false, true, false);
updateIcon(otherView, 0.0f, 0.0f, false, false, true, false);
targetView.instantFinishAnimation();
mFlingEndListener.onAnimationEnd(null);
@@ -575,8 +567,6 @@ public class KeyguardAffordanceHelper {
KeyguardAffordanceView getLeftIcon();
- KeyguardAffordanceView getCenterIcon();
-
KeyguardAffordanceView getRightIcon();
View getLeftPreview();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index a924680b7043..cb64f10d9e8c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -40,7 +40,6 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
-import android.hardware.biometrics.BiometricSourceType;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.IBinder;
@@ -64,7 +63,6 @@ import android.widget.FrameLayout;
import android.widget.TextView;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
@@ -77,7 +75,6 @@ import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.IntentButtonProvider;
import com.android.systemui.plugins.IntentButtonProvider.IntentButton;
import com.android.systemui.plugins.IntentButtonProvider.IntentButton.IconState;
-import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.KeyguardIndicationController;
import com.android.systemui.statusbar.policy.AccessibilityController;
@@ -94,7 +91,7 @@ import com.android.systemui.tuner.TunerService;
*/
public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickListener,
UnlockMethodCache.OnUnlockMethodChangedListener,
- AccessibilityController.AccessibilityStateChangedCallback, View.OnLongClickListener {
+ AccessibilityController.AccessibilityStateChangedCallback {
final static String TAG = "StatusBar/KeyguardBottomAreaView";
@@ -122,8 +119,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
private KeyguardAffordanceView mRightAffordanceView;
private KeyguardAffordanceView mLeftAffordanceView;
- private LockIcon mLockIcon;
- private ViewGroup mLockIconContainer;
private ViewGroup mIndicationArea;
private TextView mEnterpriseDisclosure;
private TextView mIndicationText;
@@ -169,7 +164,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
private IntentButton mLeftButton = new DefaultLeftButton();
private Extension<IntentButton> mLeftExtension;
private String mLeftButtonStr;
- private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private boolean mDozing;
private int mIndicationBottomMargin;
private float mDarkAmount;
@@ -199,9 +193,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
String label = null;
- if (host == mLockIcon) {
- label = getResources().getString(R.string.unlock_label);
- } else if (host == mRightAffordanceView) {
+ if (host == mRightAffordanceView) {
label = getResources().getString(R.string.camera_label);
} else if (host == mLeftAffordanceView) {
if (mLeftIsVoiceAssist) {
@@ -216,11 +208,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
@Override
public boolean performAccessibilityAction(View host, int action, Bundle args) {
if (action == ACTION_CLICK) {
- if (host == mLockIcon) {
- mStatusBar.animateCollapsePanels(
- CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */);
- return true;
- } else if (host == mRightAffordanceView) {
+ if (host == mRightAffordanceView) {
launchCamera(CAMERA_LAUNCH_SOURCE_AFFORDANCE);
return true;
} else if (host == mLeftAffordanceView) {
@@ -247,8 +235,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
mOverlayContainer = findViewById(R.id.overlay_container);
mRightAffordanceView = findViewById(R.id.camera_button);
mLeftAffordanceView = findViewById(R.id.left_button);
- mLockIcon = findViewById(R.id.lock_icon);
- mLockIconContainer = findViewById(R.id.lock_icon_container);
mIndicationArea = findViewById(R.id.keyguard_indication_area);
mEnterpriseDisclosure = findViewById(
R.id.keyguard_indication_enterprise_disclosure);
@@ -260,14 +246,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
updateCameraVisibility();
mUnlockMethodCache = UnlockMethodCache.getInstance(getContext());
mUnlockMethodCache.addListener(this);
- KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
- mLockIcon.setScreenOn(updateMonitor.isScreenOn());
- mLockIcon.update();
setClipChildren(false);
setClipToPadding(false);
inflateCameraPreview();
- mLockIcon.setOnClickListener(this);
- mLockIcon.setOnLongClickListener(this);
mRightAffordanceView.setOnClickListener(this);
mLeftAffordanceView.setOnClickListener(this);
initAccessibility();
@@ -275,7 +256,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
mFlashlightController = Dependency.get(FlashlightController.class);
mAccessibilityController = Dependency.get(AccessibilityController.class);
mAssistManager = Dependency.get(AssistManager.class);
- mLockIcon.setAccessibilityController(mAccessibilityController);
mActivityIntentHelper = new ActivityIntentHelper(getContext());
updateLeftAffordance();
}
@@ -316,7 +296,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
}
private void initAccessibility() {
- mLockIcon.setAccessibilityDelegate(mAccessibilityDelegate);
mLeftAffordanceView.setAccessibilityDelegate(mAccessibilityDelegate);
mRightAffordanceView.setAccessibilityDelegate(mAccessibilityDelegate);
}
@@ -348,13 +327,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
mRightAffordanceView.setLayoutParams(lp);
updateRightAffordanceIcon();
- lp = mLockIcon.getLayoutParams();
- lp.width = getResources().getDimensionPixelSize(R.dimen.keyguard_lock_width);
- lp.height = getResources().getDimensionPixelSize(R.dimen.keyguard_lock_height);
- mLockIcon.setLayoutParams(lp);
- mLockIcon.setContentDescription(getContext().getText(R.string.accessibility_unlock_button));
- mLockIcon.update(true /* force */);
-
lp = mLeftAffordanceView.getLayoutParams();
lp.width = getResources().getDimensionPixelSize(R.dimen.keyguard_affordance_width);
lp.height = getResources().getDimensionPixelSize(R.dimen.keyguard_affordance_height);
@@ -437,7 +409,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
mLeftAffordanceView.setClickable(touchExplorationEnabled);
mRightAffordanceView.setFocusable(accessibilityEnabled);
mLeftAffordanceView.setFocusable(accessibilityEnabled);
- mLockIcon.update();
}
@Override
@@ -446,30 +417,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
launchCamera(CAMERA_LAUNCH_SOURCE_AFFORDANCE);
} else if (v == mLeftAffordanceView) {
launchLeftAffordance();
- } if (v == mLockIcon) {
- if (!mAccessibilityController.isAccessibilityEnabled()) {
- handleTrustCircleClick();
- } else {
- mStatusBar.animateCollapsePanels(
- CommandQueue.FLAG_EXCLUDE_NONE, true /* force */);
- }
}
}
- @Override
- public boolean onLongClick(View v) {
- handleTrustCircleClick();
- return true;
- }
-
- private void handleTrustCircleClick() {
- mLockscreenGestureLogger.write(MetricsEvent.ACTION_LS_LOCK, 0 /* lengthDp - N/A */,
- 0 /* velocityDp - N/A */);
- mIndicationController.showTransientIndication(
- R.string.keyguard_indication_trust_disabled);
- mLockPatternUtils.requireCredentialEntry(KeyguardUpdateMonitor.getCurrentUser());
- }
-
public void bindCameraPrewarmService() {
Intent intent = getCameraIntent();
ActivityInfo targetInfo = mActivityIntentHelper.getTargetActivityInfo(intent,
@@ -571,19 +521,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
return;
}
mDarkAmount = darkAmount;
- mLockIcon.setDarkAmount(darkAmount);
dozeTimeTick();
}
- /**
- * When keyguard is in pulsing (AOD2) state.
- * @param pulsing {@code true} when pulsing.
- * @param animated if transition should be animated.
- */
- public void setPulsing(boolean pulsing, boolean animated) {
- mLockIcon.setPulsing(pulsing, animated);
- }
-
private static boolean isSuccessfulLaunch(int result) {
return result == ActivityManager.START_SUCCESS
|| result == ActivityManager.START_DELIVERED_TO_TOP
@@ -641,7 +581,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
if (changedView == this && visibility == VISIBLE) {
- mLockIcon.update();
updateCameraVisibility();
}
}
@@ -662,14 +601,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
return mCameraPreview;
}
- public LockIcon getLockIcon() {
- return mLockIcon;
- }
-
- public ViewGroup getLockIconContainer() {
- return mLockIconContainer;
- }
-
public View getIndicationArea() {
return mIndicationArea;
}
@@ -681,7 +612,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
@Override
public void onUnlockMethodStateChanged() {
- mLockIcon.update();
updateCameraVisibility();
}
@@ -764,32 +694,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
}
@Override
- public void onScreenTurnedOn() {
- mLockIcon.setScreenOn(true);
- }
-
- @Override
- public void onScreenTurnedOff() {
- mLockIcon.setScreenOn(false);
- }
-
- @Override
- public void onKeyguardVisibilityChanged(boolean showing) {
- mLockIcon.update();
- }
-
- @Override
- public void onBiometricRunningStateChanged(boolean running,
- BiometricSourceType biometricSourceType) {
- mLockIcon.update();
- }
-
- @Override
- public void onStrongAuthStateChanged(int userId) {
- mLockIcon.update();
- }
-
- @Override
public void onUserUnlocked() {
inflateCameraPreview();
updateCameraVisibility();
@@ -836,7 +740,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
updateCameraVisibility();
updateLeftAffordanceIcon();
- mLockIcon.setDozing(dozing);
if (dozing) {
mOverlayContainer.setVisibility(INVISIBLE);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
index 1d2ca9f13c8e..b00d874b4493 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -167,6 +167,7 @@ public class KeyguardBouncer {
DejankUtils.postAfterTraversal(mShowRunnable);
mCallback.onBouncerVisiblityChanged(true /* shown */);
+ mExpansionCallback.onStartingToShow();
}
public boolean isScrimmed() {
@@ -429,8 +430,6 @@ public class KeyguardBouncer {
mStatusBarHeight = mRoot.getResources().getDimensionPixelOffset(
com.android.systemui.R.dimen.status_bar_height);
mRoot.setVisibility(View.INVISIBLE);
- mRoot.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight,
- oldBottom) -> mExpansionCallback.onLayout());
mRoot.setAccessibilityPaneTitle(mKeyguardView.getAccessibilityTitleForCurrentMode());
final WindowInsets rootInsets = mRoot.getRootWindowInsets();
@@ -510,7 +509,7 @@ public class KeyguardBouncer {
public interface BouncerExpansionCallback {
void onFullyShown();
void onStartingToHide();
+ void onStartingToShow();
void onFullyHidden();
- void onLayout();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
index d59f248fc530..0171d7f42aed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
@@ -99,11 +99,6 @@ public class KeyguardClockPositionAlgorithm {
*/
private float mDarkAmount;
- /**
- * If keyguard will require a password or just fade away.
- */
- private boolean mCurrentlySecure;
-
private float mEmptyDragAmount;
/**
@@ -122,7 +117,7 @@ public class KeyguardClockPositionAlgorithm {
public void setup(int minTopMargin, int maxShadeBottom, int notificationStackHeight,
float panelExpansion, int parentHeight, int keyguardStatusHeight, int clockPreferredY,
- float dark, boolean secure, float emptyDragAmount) {
+ float dark, float emptyDragAmount) {
mMinTopMargin = minTopMargin + mContainerTopPadding;
mMaxShadeBottom = maxShadeBottom;
mNotificationStackHeight = notificationStackHeight;
@@ -131,7 +126,6 @@ public class KeyguardClockPositionAlgorithm {
mKeyguardStatusHeight = keyguardStatusHeight;
mClockPreferredY = clockPreferredY;
mDarkAmount = dark;
- mCurrentlySecure = secure;
mEmptyDragAmount = emptyDragAmount;
}
@@ -204,13 +198,8 @@ public class KeyguardClockPositionAlgorithm {
* @return Alpha from 0 to 1.
*/
private float getClockAlpha(int y) {
- float alphaKeyguard;
- if (mCurrentlySecure) {
- alphaKeyguard = 1;
- } else {
- alphaKeyguard = Math.max(0, y / Math.max(1f, getExpandedClockPosition()));
- alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard);
- }
+ float alphaKeyguard = Math.max(0, y / Math.max(1f, getExpandedClockPosition()));
+ alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard);
return MathUtils.lerp(alphaKeyguard, 1f, mDarkAmount);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index 3cc4a7bfa1eb..971e5b3115d6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -16,29 +16,40 @@
package com.android.systemui.statusbar.phone;
+import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
+
import android.content.Context;
+import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Color;
-import android.graphics.PorterDuff;
import android.graphics.drawable.Animatable2;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
+import android.hardware.biometrics.BiometricSourceType;
import android.util.AttributeSet;
-import android.view.ContextThemeWrapper;
+import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import com.android.internal.graphics.ColorUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
+import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.R;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.policy.AccessibilityController;
+import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.UserInfoController.OnUserInfoChangedListener;
+import javax.inject.Inject;
+import javax.inject.Named;
+
/**
* Manages the different states and animations of the unlock icon.
*/
-public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChangedListener {
+public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChangedListener,
+ StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener,
+ UnlockMethodCache.OnUnlockMethodChangedListener {
private static final int FP_DRAW_OFF_TIMEOUT = 800;
@@ -46,13 +57,16 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
private static final int STATE_LOCK_OPEN = 1;
private static final int STATE_SCANNING_FACE = 2;
private static final int STATE_BIOMETRICS_ERROR = 3;
+ private final ConfigurationController mConfigurationController;
+ private final StatusBarStateController mStatusBarStateController;
+ private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
+ private final AccessibilityController mAccessibilityController;
private int mLastState = 0;
private boolean mTransientBiometricsError;
private boolean mScreenOn;
private boolean mLastScreenOn;
- private final UnlockMethodCache mUnlockMethodCache;
- private AccessibilityController mAccessibilityController;
private boolean mIsFaceUnlockState;
private int mDensity;
private boolean mPulsing;
@@ -61,18 +75,82 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
private boolean mLastDozing;
private boolean mLastPulsing;
private boolean mLastBouncerVisible;
+ private int mIconColor;
private final Runnable mDrawOffTimeout = () -> update(true /* forceUpdate */);
- private float mDarkAmount;
-
- public LockIcon(Context context, AttributeSet attrs) {
+ private float mDozeAmount;
+
+ private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
+ new KeyguardUpdateMonitorCallback() {
+ @Override
+ public void onScreenTurnedOn() {
+ mScreenOn = true;
+ update();
+ }
+
+ @Override
+ public void onScreenTurnedOff() {
+ mScreenOn = false;
+ update();
+ }
+
+ @Override
+ public void onKeyguardVisibilityChanged(boolean showing) {
+ update();
+ }
+
+ @Override
+ public void onBiometricRunningStateChanged(boolean running,
+ BiometricSourceType biometricSourceType) {
+ update();
+ }
+
+ @Override
+ public void onStrongAuthStateChanged(int userId) {
+ update();
+ }
+ };
+
+ @Inject
+ public LockIcon(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
+ StatusBarStateController statusBarStateController,
+ ConfigurationController configurationController,
+ AccessibilityController accessibilityController) {
super(context, attrs);
- TypedArray typedArray = context.getTheme().obtainStyledAttributes(
- attrs, new int[]{ R.attr.backgroundProtectedStyle }, 0, 0);
- mContext = new ContextThemeWrapper(context,
- typedArray.getResourceId(0, R.style.BackgroundProtectedStyle));
- typedArray.recycle();
+ mContext = context;
mUnlockMethodCache = UnlockMethodCache.getInstance(context);
+ mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
+ mAccessibilityController = accessibilityController;
+ mConfigurationController = configurationController;
+ mStatusBarStateController = statusBarStateController;
+ onThemeChanged();
+ }
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mStatusBarStateController.addCallback(this);
+ mConfigurationController.addCallback(this);
+ mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback);
+ mUnlockMethodCache.addListener(this);
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mStatusBarStateController.removeCallback(this);
+ mConfigurationController.removeCallback(this);
+ mKeyguardUpdateMonitor.removeCallback(mUpdateMonitorCallback);
+ mUnlockMethodCache.removeListener(this);
+ }
+
+ @Override
+ public void onThemeChanged() {
+ TypedArray typedArray = mContext.getTheme().obtainStyledAttributes(
+ null, new int[]{ R.attr.wallpaperTextColor }, 0, 0);
+ mIconColor = typedArray.getColor(0, Color.WHITE);
+ typedArray.recycle();
+ updateDarkTint();
}
@Override
@@ -88,11 +166,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
update();
}
- public void setScreenOn(boolean screenOn) {
- mScreenOn = screenOn;
- update();
- }
-
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
@@ -164,7 +237,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
mLastBouncerVisible = mBouncerVisible;
}
- setVisibility(mDozing && !mPulsing ? GONE : VISIBLE);
+ setVisibility(mDozing && !mPulsing ? INVISIBLE : VISIBLE);
updateClickability();
}
@@ -185,9 +258,8 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
- KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
- boolean fingerprintRunning = updateMonitor.isFingerprintDetectionRunning();
- boolean unlockingAllowed = updateMonitor.isUnlockingWithBiometricAllowed();
+ boolean fingerprintRunning = mKeyguardUpdateMonitor.isFingerprintDetectionRunning();
+ boolean unlockingAllowed = mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed();
if (fingerprintRunning && unlockingAllowed) {
AccessibilityNodeInfo.AccessibilityAction unlock
= new AccessibilityNodeInfo.AccessibilityAction(
@@ -204,10 +276,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
}
}
- public void setAccessibilityController(AccessibilityController accessibilityController) {
- mAccessibilityController = accessibilityController;
- }
-
private Drawable getIconForState(int state) {
int iconRes;
switch (state) {
@@ -273,17 +341,17 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
}
}
- public void setDarkAmount(float darkAmount) {
- mDarkAmount = darkAmount;
+ @Override
+ public void onDozeAmountChanged(float linear, float eased) {
+ mDozeAmount = eased;
updateDarkTint();
}
/**
* When keyguard is in pulsing (AOD2) state.
* @param pulsing {@code true} when pulsing.
- * @param animated if transition should be animated.
*/
- public void setPulsing(boolean pulsing, boolean animated) {
+ public void setPulsing(boolean pulsing) {
mPulsing = pulsing;
update();
}
@@ -291,15 +359,15 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
/**
* Sets the dozing state of the keyguard.
*/
- public void setDozing(boolean dozing) {
+ @Override
+ public void onDozingChanged(boolean dozing) {
mDozing = dozing;
update();
}
private void updateDarkTint() {
- Drawable drawable = getDrawable().mutate();
- int color = ColorUtils.blendARGB(Color.TRANSPARENT, Color.WHITE, mDarkAmount);
- drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
+ int color = ColorUtils.blendARGB(mIconColor, Color.WHITE, mDozeAmount);
+ setImageTintList(ColorStateList.valueOf(color));
}
/**
@@ -312,4 +380,27 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
mBouncerVisible = bouncerVisible;
update();
}
+
+ @Override
+ public void onDensityOrFontScaleChanged() {
+ ViewGroup.LayoutParams lp = getLayoutParams();
+ if (lp == null) {
+ return;
+ }
+ lp.width = getResources().getDimensionPixelSize(R.dimen.keyguard_lock_width);
+ lp.height = getResources().getDimensionPixelSize(R.dimen.keyguard_lock_height);
+ setLayoutParams(lp);
+ update(true /* force */);
+ }
+
+ @Override
+ public void onLocaleListChanged() {
+ setContentDescription(getContext().getText(R.string.accessibility_unlock_button));
+ update(true /* force */);
+ }
+
+ @Override
+ public void onUnlockMethodStateChanged() {
+ update();
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index ab13149f3151..57b2ee9d893c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -204,7 +204,6 @@ public class NotificationPanelView extends PanelView implements
private ValueAnimator mQsExpansionAnimator;
private FlingAnimationUtils mFlingAnimationUtils;
private int mStatusBarMinHeight;
- private boolean mUnlockIconActive;
private int mNotificationsHeaderCollideDistance;
private int mUnlockMoveDistance;
private float mEmptyDragAmount;
@@ -330,7 +329,6 @@ public class NotificationPanelView extends PanelView implements
private final ShadeController mShadeController =
Dependency.get(ShadeController.class);
private int mDisplayId;
- private KeyguardBouncer mBouncer;
/**
* Cache the resource id of the theme to avoid unnecessary work in onThemeChanged.
@@ -640,7 +638,6 @@ public class NotificationPanelView extends PanelView implements
mKeyguardStatusView.getHeight(),
clockPreferredY,
mInterpolatedDarkAmount,
- mStatusBar.isKeyguardCurrentlySecure(),
mEmptyDragAmount);
mClockPositionAlgorithm.run(mClockPositionResult);
PropertyAnimator.setProperty(mKeyguardStatusView, AnimatableProperty.X,
@@ -736,7 +733,6 @@ public class NotificationPanelView extends PanelView implements
public void resetViews(boolean animate) {
mIsLaunchTransitionFinished = false;
mBlockTouches = false;
- mUnlockIconActive = false;
if (!mLaunchingAffordance) {
mAffordanceHelper.reset(false);
mLastCameraLaunchSource = KeyguardBottomAreaView.CAMERA_LAUNCH_SOURCE_AFFORDANCE;
@@ -1518,6 +1514,10 @@ public class NotificationPanelView extends PanelView implements
mStatusBar.executeRunnableDismissingKeyguard(null, null /* cancelAction */,
false /* dismissShade */, true /* afterKeyguardGone */, false /* deferred */);
}
+ if (mExpansionListener != null) {
+ mExpansionListener.onQsExpansionChanged(mQsMaxExpansionHeight != 0
+ ? mQsExpansionHeight / mQsMaxExpansionHeight : 0);
+ }
if (DEBUG) {
invalidate();
}
@@ -1837,6 +1837,9 @@ public class NotificationPanelView extends PanelView implements
!mHeadsUpManager.hasPinnedHeadsUp()) {
alpha = getFadeoutAlpha();
}
+ if (mBarState == StatusBarState.KEYGUARD && !mHintAnimationRunning) {
+ alpha *= mClockPositionResult.clockAlpha;
+ }
mNotificationStackScroller.setAlpha(alpha);
}
@@ -2292,11 +2295,6 @@ public class NotificationPanelView extends PanelView implements
}
@Override
- public KeyguardAffordanceView getCenterIcon() {
- return mKeyguardBottomArea.getLockIcon();
- }
-
- @Override
public KeyguardAffordanceView getRightIcon() {
return getLayoutDirection() == LAYOUT_DIRECTION_RTL
? mKeyguardBottomArea.getLeftView()
@@ -2723,7 +2721,6 @@ public class NotificationPanelView extends PanelView implements
private void setLaunchingAffordance(boolean launchingAffordance) {
getLeftIcon().setLaunchingAffordance(launchingAffordance);
getRightIcon().setLaunchingAffordance(launchingAffordance);
- getCenterIcon().setLaunchingAffordance(launchingAffordance);
}
/**
@@ -2872,7 +2869,6 @@ public class NotificationPanelView extends PanelView implements
}
mNotificationStackScroller.setPulsing(pulsing, animatePulse);
mKeyguardStatusView.setPulsing(pulsing);
- mKeyguardBottomArea.setPulsing(pulsing, animatePulse);
}
public void setAmbientIndicationBottomPadding(int ambientIndicationBottomPadding) {
@@ -2910,10 +2906,6 @@ public class NotificationPanelView extends PanelView implements
mKeyguardBottomArea.setUserSetupComplete(userSetupComplete);
}
- public LockIcon getLockIcon() {
- return mKeyguardBottomArea.getLockIcon();
- }
-
public void applyExpandAnimationParams(ExpandAnimationParameters params) {
mExpandOffset = params != null ? params.getTopChange() : 0;
updateQsExpansion();
@@ -2957,7 +2949,6 @@ public class NotificationPanelView extends PanelView implements
public void onBouncerPreHideAnimation() {
setKeyguardStatusViewVisibility(mBarState, true /* keyguardFadingAway */,
false /* goingToFullShade */);
- updateLockIcon();
}
/**
@@ -3056,71 +3047,29 @@ public class NotificationPanelView extends PanelView implements
mKeyguardBottomArea.showTransientIndication(id);
}
- /**
- * Sets the reference to the {@link KeyguardBouncer}.
- */
- public void setBouncer(KeyguardBouncer bouncer) {
- mBouncer = bouncer;
- updateLockIcon();
- }
-
- public void updateLockIcon() {
- if (mBouncer == null) {
- return;
- }
-
- ViewGroup bouncerContainer = mBouncer.getLockIconContainer();
- ViewGroup bottomContainer = mKeyguardBottomArea.getLockIconContainer();
- LockIcon lockIcon = mKeyguardBottomArea.getLockIcon();
-
- if (mBouncer.isAnimatingAway()) {
- if (!lockIcon.isAnimatingAlpha() && lockIcon.getAlpha() != 0) {
- lockIcon.setImageAlpha(0, true /* animate */);
- }
- // Let's not re-apply the translation if the bouncer is animating, its
- // animation also includes translation and transition would be jarring.
- return;
- }
-
- // Lock icon needs to be re-parented in case of a scrimmed bouncer,
- // otherwise it would be under the scrim.
- if (mBouncer.isScrimmed() && bouncerContainer != null
- && lockIcon.getParent() != bouncerContainer) {
- ((ViewGroup) lockIcon.getParent()).removeView(lockIcon);
- bouncerContainer.addView(lockIcon);
- } else if (!mBouncer.isScrimmed() && bottomContainer != null
- && lockIcon.getParent() != bottomContainer) {
- ((ViewGroup) lockIcon.getParent()).removeView(lockIcon);
- bottomContainer.addView(lockIcon);
- }
-
- float translation = 0;
- if (bouncerContainer != null && bottomContainer != null && !mBouncer.isScrimmed()) {
- float bottomAreaContainerY = getCommonTop(bottomContainer);
- float bouncerLockY = getCommonTop(bouncerContainer);
- if (bouncerLockY < bottomAreaContainerY) {
- translation = bouncerLockY - bottomAreaContainerY;
- }
- }
- lockIcon.setTranslationY(translation);
-
- if (lockIcon.getAlpha() != 1) {
- lockIcon.setImageAlpha(1, false /* animate */);
- }
- }
-
- private static float getCommonTop(View view) {
- float y = view.getTop();
- ViewGroup parent = (ViewGroup) view.getParent();
- while (!(parent instanceof StatusBarWindowView) && parent != null) {
- y += parent.getY();
- parent = (ViewGroup) parent.getParent();
- }
- return y;
- }
-
@Override
public void onDynamicPrivacyChanged() {
mAnimateNextPositionUpdate = true;
}
+
+ /**
+ * Panel and QS expansion callbacks.
+ */
+ public interface PanelExpansionListener {
+ /**
+ * Invoked whenever the notification panel expansion changes, at every animation frame.
+ * This is the main expansion that happens when the user is swiping up to dismiss the
+ * lock screen.
+ *
+ * @param expansion 0 when collapsed, 1 when expanded.
+ * @param tracking {@code true} when the user is actively dragging the panel.
+ */
+ void onPanelExpansionChanged(float expansion, boolean tracking);
+
+ /**
+ * Invoked whenever the QS expansion changes, at every animation frame.
+ * @param expansion 0 when collapsed, 1 when expanded.
+ */
+ void onQsExpansionChanged(float expansion);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 99345d26abc9..24389f2fec8e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -49,11 +49,11 @@ import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.VibratorHelper;
+import com.android.systemui.statusbar.phone.NotificationPanelView.PanelExpansionListener;
import com.android.systemui.statusbar.policy.KeyguardMonitor;
import java.io.FileDescriptor;
import java.io.PrintWriter;
-import java.util.function.BiConsumer;
public abstract class PanelView extends FrameLayout {
public static final boolean DEBUG = PanelBar.DEBUG;
@@ -68,7 +68,7 @@ public abstract class PanelView extends FrameLayout {
private boolean mVibrateOnOpening;
protected boolean mLaunchingNotification;
private int mFixedDuration = NO_FIXED_DURATION;
- private BiConsumer<Float, Boolean> mExpansionListener;
+ protected PanelExpansionListener mExpansionListener;
private final void logf(String fmt, Object... args) {
Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args));
@@ -1115,7 +1115,6 @@ public abstract class PanelView extends FrameLayout {
View[] viewsToAnimate = {
mKeyguardBottomArea.getIndicationArea(),
- mKeyguardBottomArea.getLockIcon(),
mStatusBar.getAmbientIndicationContainer()};
for (View v : viewsToAnimate) {
if (v == null) {
@@ -1163,28 +1162,25 @@ public abstract class PanelView extends FrameLayout {
private ValueAnimator createHeightAnimator(float targetHeight) {
ValueAnimator animator = ValueAnimator.ofFloat(mExpandedHeight, targetHeight);
- animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- setExpandedHeightInternal((Float) animation.getAnimatedValue());
- }
- });
+ animator.addUpdateListener(
+ animation -> setExpandedHeightInternal((float) animation.getAnimatedValue()));
return animator;
}
protected void notifyBarPanelExpansionChanged() {
+ float fraction = mInstantExpanding ? 1 : mExpandedFraction;
if (mBar != null) {
- mBar.panelExpansionChanged(mExpandedFraction, mExpandedFraction > 0f
+ mBar.panelExpansionChanged(fraction, fraction > 0f
|| mPeekAnimator != null || mInstantExpanding
|| isPanelVisibleBecauseOfHeadsUp() || mTracking || mHeightAnimator != null);
}
if (mExpansionListener != null) {
- mExpansionListener.accept(mExpandedFraction, mTracking);
+ mExpansionListener.onPanelExpansionChanged(fraction, mTracking);
}
}
- public void setExpansionListener(BiConsumer<Float, Boolean> consumer) {
- mExpansionListener = consumer;
+ public void setExpansionListener(PanelExpansionListener panelExpansionListener) {
+ mExpansionListener = panelExpansionListener;
}
protected abstract boolean isPanelVisibleBecauseOfHeadsUp();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 251c0600b1f0..a381bbc47657 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -881,7 +881,7 @@ public class StatusBar extends SystemUI implements DemoMode,
mKeyguardIndicationController =
SystemUIFactory.getInstance().createKeyguardIndicationController(mContext,
mStatusBarWindow.findViewById(R.id.keyguard_indication_area),
- mNotificationPanel.getLockIcon());
+ mStatusBarWindow.findViewById(R.id.lock_icon));
mNotificationPanel.setKeyguardIndicationController(mKeyguardIndicationController);
mAmbientIndicationContainer = mStatusBarWindow.findViewById(
@@ -1173,7 +1173,7 @@ public class StatusBar extends SystemUI implements DemoMode,
mKeyguardIndicationController =
SystemUIFactory.getInstance().createKeyguardIndicationController(mContext,
mStatusBarWindow.findViewById(R.id.keyguard_indication_area),
- mNotificationPanel.getLockIcon());
+ mStatusBarWindow.findViewById(R.id.lock_icon));
mNotificationPanel.setKeyguardIndicationController(mKeyguardIndicationController);
mKeyguardIndicationController
.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
@@ -1224,7 +1224,8 @@ public class StatusBar extends SystemUI implements DemoMode,
mScrimController, this, UnlockMethodCache.getInstance(mContext),
new Handler(), mKeyguardUpdateMonitor, Dependency.get(TunerService.class));
mStatusBarKeyguardViewManager = keyguardViewMediator.registerStatusBar(this,
- getBouncerContainer(), mNotificationPanel, mBiometricUnlockController);
+ getBouncerContainer(), mNotificationPanel, mBiometricUnlockController,
+ mStatusBarWindow.findViewById(R.id.lock_icon_container));
mKeyguardIndicationController
.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
@@ -1233,7 +1234,6 @@ public class StatusBar extends SystemUI implements DemoMode,
mKeyguardViewMediatorCallback = keyguardViewMediator.getViewMediatorCallback();
mLightBarController.setBiometricUnlockController(mBiometricUnlockController);
mMediaManager.setBiometricUnlockController(mBiometricUnlockController);
- mNotificationPanel.setBouncer(mStatusBarKeyguardViewManager.getBouncer());
Dependency.get(KeyguardDismissUtil.class).setDismissHandler(this::executeWhenUnlocked);
Trace.endSection();
}
@@ -3953,6 +3953,7 @@ public class StatusBar extends SystemUI implements DemoMode,
mKeyguardViewMediator.setPulsing(pulsing);
mNotificationPanel.setPulsing(pulsing);
mVisualStabilityManager.setPulsing(pulsing);
+ mStatusBarWindow.setPulsing(pulsing);
mIgnoreTouchWhilePulsing = false;
if (mKeyguardUpdateMonitor != null && passiveAuthInterrupt) {
mKeyguardUpdateMonitor.onAuthInterruptDetected(pulsing /* active */);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index e3cc3d46aa11..09fa9ca6d0cf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -25,6 +25,8 @@ import android.content.Context;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.os.SystemClock;
+import android.transition.Fade;
+import android.transition.TransitionManager;
import android.util.StatsLog;
import android.view.KeyEvent;
import android.view.View;
@@ -32,14 +34,16 @@ import android.view.ViewGroup;
import android.view.ViewRootImpl;
import android.view.WindowManagerGlobal;
-import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.ViewMediatorCallback;
+import com.android.settingslib.animation.AppearAnimationUtils;
+import com.android.settingslib.animation.DisappearAnimationUtils;
import com.android.systemui.DejankUtils;
import com.android.systemui.Dependency;
+import com.android.systemui.Interpolators;
import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.dock.DockManager;
@@ -49,6 +53,7 @@ import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.RemoteInputController;
+import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.phone.KeyguardBouncer.BouncerExpansionCallback;
import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -65,7 +70,8 @@ import java.util.ArrayList;
* {@link com.android.keyguard.KeyguardViewBase}.
*/
public class StatusBarKeyguardViewManager implements RemoteInputController.Callback,
- StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener {
+ StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener,
+ NotificationPanelView.PanelExpansionListener {
// When hiding the Keyguard with timing supplied from WindowManager, better be early than late.
private static final long HIDE_TIMING_CORRECTION_MS = - 16 * 3;
@@ -90,7 +96,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public void onFullyShown() {
updateStates();
mStatusBar.wakeUpIfDozing(SystemClock.uptimeMillis(), mContainer, "BOUNCER_VISIBLE");
- mNotificationPanelView.updateLockIcon();
+ updateLockIcon();
}
@Override
@@ -99,14 +105,14 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
}
@Override
- public void onFullyHidden() {
- updateStates();
- mNotificationPanelView.updateLockIcon();
+ public void onStartingToShow() {
+ updateLockIcon();
}
@Override
- public void onLayout() {
- mNotificationPanelView.updateLockIcon();
+ public void onFullyHidden() {
+ updateStates();
+ updateLockIcon();
}
};
private final DockManager.DockEventListener mDockEventListener =
@@ -129,6 +135,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
private BiometricUnlockController mBiometricUnlockController;
private ViewGroup mContainer;
+ private ViewGroup mLockIconContainer;
protected KeyguardBouncer mBouncer;
protected boolean mShowing;
@@ -151,6 +158,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
private boolean mLastPulsing;
private int mLastBiometricMode;
private boolean mGoingToSleepVisibleNotOccluded;
+ private int mLastLockVisibility = -1;
private OnDismissAction mAfterKeyguardGoneAction;
private final ArrayList<Runnable> mAfterKeyguardGoneRunnables = new ArrayList<>();
@@ -161,6 +169,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
(KeyguardMonitorImpl) Dependency.get(KeyguardMonitor.class);
private final NotificationMediaManager mMediaManager =
Dependency.get(NotificationMediaManager.class);
+ private final StatusBarStateController mStatusBarStateController =
+ Dependency.get(StatusBarStateController.class);
private final DockManager mDockManager;
private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
@@ -184,7 +194,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mStatusBarWindowController = Dependency.get(StatusBarWindowController.class);
mGesturalNav = QuickStepContract.isGesturalMode(context);
KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateMonitorCallback);
- Dependency.get(StatusBarStateController.class).addCallback(this);
+ mStatusBarStateController.addCallback(this);
Dependency.get(ConfigurationController.class).addCallback(this);
mDockManager = SysUiServiceProvider.getComponent(context, DockManager.class);
if (mDockManager != null) {
@@ -197,19 +207,21 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
ViewGroup container,
NotificationPanelView notificationPanelView,
BiometricUnlockController biometricUnlockController,
- DismissCallbackRegistry dismissCallbackRegistry) {
+ DismissCallbackRegistry dismissCallbackRegistry,
+ ViewGroup lockIconContainer) {
mStatusBar = statusBar;
mContainer = container;
+ mLockIconContainer = lockIconContainer;
mBiometricUnlockController = biometricUnlockController;
mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext,
mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry,
mExpansionCallback);
mNotificationPanelView = notificationPanelView;
- notificationPanelView.setExpansionListener(this::onPanelExpansionChanged);
+ notificationPanelView.setExpansionListener(this);
}
- @VisibleForTesting
- void onPanelExpansionChanged(float expansion, boolean tracking) {
+ @Override
+ public void onPanelExpansionChanged(float expansion, boolean tracking) {
// We don't want to translate the bounce when:
// • Keyguard is occluded, because we're in a FLAG_SHOW_WHEN_LOCKED activity and need to
// conserve the original animation.
@@ -230,7 +242,32 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */);
}
}
- mNotificationPanelView.updateLockIcon();
+ }
+
+ @Override
+ public void onQsExpansionChanged(float expansion) {
+ updateLockIcon();
+ }
+
+ private void updateLockIcon() {
+ boolean keyguardWithoutQs = mStatusBarStateController.getState() == StatusBarState.KEYGUARD
+ && !mNotificationPanelView.isQsExpanded();
+ int lockVisibility = (mBouncer.isShowing() || keyguardWithoutQs)
+ && !mBouncer.isAnimatingAway() ? View.VISIBLE : View.INVISIBLE;
+
+ if (mLastLockVisibility != lockVisibility) {
+ mLastLockVisibility = lockVisibility;
+
+ Fade transition = new Fade();
+ boolean appearing = lockVisibility == View.VISIBLE;
+ transition.setDuration(appearing ? AppearAnimationUtils.DEFAULT_APPEAR_DURATION
+ : DisappearAnimationUtils.DEFAULT_APPEAR_DURATION / 2);
+ transition.setInterpolator(appearing ? Interpolators.ALPHA_IN
+ : Interpolators.ALPHA_OUT);
+ TransitionManager.beginDelayedTransition((ViewGroup) mLockIconContainer.getParent(),
+ transition);
+ mLockIconContainer.setVisibility(lockVisibility);
+ }
}
/**
@@ -463,6 +500,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
finishRunnable.run();
}
mNotificationPanelView.blockExpansionForCurrentTouch();
+ updateLockIcon();
}
/**
@@ -849,7 +887,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
@Override
public void onStateChanged(int newState) {
- // Nothing
+ updateLockIcon();
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index 96090571685e..28db28c7a845 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -87,6 +87,7 @@ public class StatusBarWindowView extends FrameLayout {
private NotificationStackScrollLayout mStackScrollLayout;
private NotificationPanelView mNotificationPanel;
private View mBrightnessMirror;
+ private LockIcon mLockIcon;
private PhoneStatusBarView mStatusBarView;
private int mRightInset = 0;
@@ -241,10 +242,10 @@ public class StatusBarWindowView extends FrameLayout {
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- mStackScrollLayout = (NotificationStackScrollLayout) findViewById(
- R.id.notification_stack_scroller);
- mNotificationPanel = (NotificationPanelView) findViewById(R.id.notification_panel);
+ mStackScrollLayout = findViewById(R.id.notification_stack_scroller);
+ mNotificationPanel = findViewById(R.id.notification_panel);
mBrightnessMirror = findViewById(R.id.brightness_mirror);
+ mLockIcon = findViewById(R.id.lock_icon);
}
@Override
@@ -255,6 +256,13 @@ public class StatusBarWindowView extends FrameLayout {
}
}
+ /**
+ * Propagate {@link StatusBar} pulsing state.
+ */
+ public void setPulsing(boolean pulsing) {
+ mLockIcon.setPulsing(pulsing);
+ }
+
public void setStatusBarView(PhoneStatusBarView statusBarView) {
mStatusBarView = statusBarView;
}
diff --git a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
index 376c328af72d..1e486c0949a4 100644
--- a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
+++ b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
@@ -24,12 +24,14 @@ import android.view.LayoutInflater;
import android.view.View;
import com.android.keyguard.KeyguardClockSwitch;
+import com.android.keyguard.KeyguardMessageArea;
import com.android.keyguard.KeyguardSliceView;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.qs.QSCarrierGroup;
import com.android.systemui.qs.QSFooterImpl;
import com.android.systemui.qs.QuickStatusBarHeader;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
+import com.android.systemui.statusbar.phone.LockIcon;
import com.android.systemui.statusbar.phone.NotificationPanelView;
import java.lang.reflect.InvocationTargetException;
@@ -142,6 +144,16 @@ public class InjectionInflationController {
* Creates the KeyguardSliceView.
*/
KeyguardSliceView createKeyguardSliceView();
+
+ /**
+ * Creates the KeyguardMessageArea.
+ */
+ KeyguardMessageArea createKeyguardMessageArea();
+
+ /**
+ * Creates the keyguard LockIcon.
+ */
+ LockIcon createLockIcon();
}
/**
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardMessageAreaTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardMessageAreaTest.java
index f8ca2621200c..fc7b9a4b47d1 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardMessageAreaTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardMessageAreaTest.java
@@ -18,32 +18,50 @@ package com.android.keyguard;
import static junit.framework.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper.RunWithLooper;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.statusbar.policy.ConfigurationController;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
@SmallTest
@RunWith(AndroidTestingRunner.class)
@RunWithLooper
public class KeyguardMessageAreaTest extends SysuiTestCase {
+ @Mock
+ private ConfigurationController mConfigurationController;
+ @Mock
+ private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private KeyguardMessageArea mMessageArea;
@Before
public void setUp() throws Exception {
- KeyguardUpdateMonitor monitor = mock(KeyguardUpdateMonitor.class);
- mMessageArea = new KeyguardMessageArea(mContext, null, monitor);
+ MockitoAnnotations.initMocks(this);
+ mMessageArea = new KeyguardMessageArea(mContext, null, mKeyguardUpdateMonitor,
+ mConfigurationController);
waitForIdleSync();
}
@Test
+ public void onAttachedToWindow_registersConfigurationCallback() {
+ mMessageArea.onAttachedToWindow();
+ verify(mConfigurationController).addCallback(eq(mMessageArea));
+
+ mMessageArea.onDetachedFromWindow();
+ verify(mConfigurationController).removeCallback(eq(mMessageArea));
+ }
+
+ @Test
public void clearFollowedByMessage_keepsMessage() {
mMessageArea.setMessage("");
mMessageArea.setMessage("test");
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt
index e7469c328fdf..5f03bdba40b4 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt
@@ -22,11 +22,13 @@ import android.testing.TestableLooper
import android.view.LayoutInflater
import com.android.systemui.SysuiTestCase
+import com.android.systemui.statusbar.policy.ConfigurationController
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
+import org.mockito.Mockito.mock
@SmallTest
@RunWith(AndroidTestingRunner::class)
@@ -41,8 +43,9 @@ class KeyguardPatternViewTest : SysuiTestCase() {
val inflater = LayoutInflater.from(context)
mKeyguardPatternView = inflater.inflate(R.layout.keyguard_pattern_view, null)
as KeyguardPatternView
- mSecurityMessage = KeyguardMessageArea.findSecurityMessageDisplay(mKeyguardPatternView)
- as KeyguardMessageArea
+ mSecurityMessage = KeyguardMessageArea(mContext, null,
+ mock(KeyguardUpdateMonitor::class.java), mock(ConfigurationController::class.java))
+ mKeyguardPatternView.mSecurityMessageDisplay = mSecurityMessage
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
index 18ffbb5062a7..80c51cfd1d34 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
@@ -40,10 +40,12 @@ import androidx.test.InstrumentationRegistry;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
+import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
+import com.android.systemui.statusbar.phone.LockIcon;
import com.android.systemui.util.wakelock.WakeLockFake;
import org.junit.Before;
@@ -66,6 +68,10 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
private ViewGroup mIndicationArea;
@Mock
private KeyguardIndicationTextView mDisclosure;
+ @Mock
+ private LockIcon mLockIcon;
+ @Mock
+ private LockPatternUtils mLockPatternUtils;
private KeyguardIndicationTextView mTextView;
private KeyguardIndicationController mController;
@@ -95,7 +101,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
if (Looper.myLooper() == null) {
Looper.prepare();
}
- mController = new KeyguardIndicationController(mContext, mIndicationArea, null, mWakeLock);
+ mController = new KeyguardIndicationController(mContext, mIndicationArea, mLockIcon,
+ mLockPatternUtils, mWakeLock);
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt
index 301099667eea..b95bb0a6002e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt
@@ -42,6 +42,5 @@ class KeyguardBottomAreaTest : SysuiTestCase() {
other.initFrom(mKeyguardBottomArea)
other.launchVoiceAssist()
- other.onLongClick(null)
}
} \ No newline at end of file
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
index c2e60d9e1230..575ff16b8ed3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
@@ -132,6 +132,7 @@ public class KeyguardBouncerTest extends SysuiTestCase {
public void testShow_notifiesVisibility() {
mBouncer.show(true);
verify(mViewMediatorCallback).onBouncerVisiblityChanged(eq(true));
+ verify(mExpansionCallback).onStartingToShow();
// Not called again when visible
reset(mViewMediatorCallback);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
index 3f4d96ca9bdb..93546488ad0a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
@@ -38,7 +38,6 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
private static final int PREFERRED_CLOCK_Y = SCREEN_HEIGHT / 2;
private static final int EMPTY_MARGIN = 0;
private static final int EMPTY_HEIGHT = 0;
- private static final boolean SECURE_LOCKED = false;
private static final float ZERO_DRAG = 0.f;
private static final float OPAQUE = 1.f;
private static final float TRANSPARENT = 0.f;
@@ -307,7 +306,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
private void positionClock() {
mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight,
mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight, PREFERRED_CLOCK_Y, mDark,
- SECURE_LOCKED, ZERO_DRAG);
+ ZERO_DRAG);
mClockPositionAlgorithm.run(mClockPosition);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
index 7d347d55e930..d09cea59b9c5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
@@ -27,6 +28,7 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
+import android.view.View;
import android.view.ViewGroup;
import androidx.test.filters.SmallTest;
@@ -36,6 +38,8 @@ import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.keyguard.DismissCallbackRegistry;
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.statusbar.StatusBarState;
import org.junit.Before;
import org.junit.Test;
@@ -64,16 +68,23 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
private BiometricUnlockController mBiometrucUnlockController;
@Mock
private DismissCallbackRegistry mDismissCallbackRegistry;
+ @Mock
+ private ViewGroup mLockIconContainer;
+ @Mock
+ private StatusBarStateController mStatusBarStateController;
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mDependency.injectMockDependency(StatusBarWindowController.class);
+ mDependency.injectTestDependency(StatusBarStateController.class, mStatusBarStateController);
+ when(mLockIconContainer.getParent()).thenReturn(mock(ViewGroup.class));
mStatusBarKeyguardViewManager = new TestableStatusBarKeyguardViewManager(getContext(),
mViewMediatorCallback, mLockPatternUtils);
mStatusBarKeyguardViewManager.registerStatusBar(mStatusBar, mContainer,
- mNotificationPanelView, mBiometrucUnlockController, mDismissCallbackRegistry);
+ mNotificationPanelView, mBiometrucUnlockController, mDismissCallbackRegistry,
+ mLockIconContainer);
mStatusBarKeyguardViewManager.show(null);
}
@@ -187,6 +198,29 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
verify(mBouncer, never()).setExpansion(anyFloat());
}
+ @Test
+ public void onQsExpansionChanged_lockVisibleOnlyWhenCollapsed() {
+ when(mStatusBarStateController.getState()).thenReturn(StatusBarState.KEYGUARD);
+ mStatusBarKeyguardViewManager.onQsExpansionChanged(0);
+ verify(mLockIconContainer).setVisibility(eq(View.VISIBLE));
+
+ reset(mNotificationPanelView);
+ when(mNotificationPanelView.isQsExpanded()).thenReturn(true);
+ mStatusBarKeyguardViewManager.onQsExpansionChanged(1f);
+ verify(mLockIconContainer).setVisibility(eq(View.INVISIBLE));
+ }
+
+ @Test
+ public void onQsExpansionChanged_lockInvisibleWhenAnimatingAway() {
+ when(mBouncer.isShowing()).thenReturn(true);
+ mStatusBarKeyguardViewManager.onQsExpansionChanged(0);
+ verify(mLockIconContainer).setVisibility(eq(View.VISIBLE));
+
+ when(mBouncer.isAnimatingAway()).thenReturn(true);
+ mStatusBarKeyguardViewManager.onQsExpansionChanged(0f);
+ verify(mLockIconContainer).setVisibility(eq(View.INVISIBLE));
+ }
+
private class TestableStatusBarKeyguardViewManager extends StatusBarKeyguardViewManager {
public TestableStatusBarKeyguardViewManager(Context context,
@@ -199,9 +233,10 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
public void registerStatusBar(StatusBar statusBar, ViewGroup container,
NotificationPanelView notificationPanelView,
BiometricUnlockController fingerprintUnlockController,
- DismissCallbackRegistry dismissCallbackRegistry) {
+ DismissCallbackRegistry dismissCallbackRegistry,
+ ViewGroup lockIconContainer) {
super.registerStatusBar(statusBar, container, notificationPanelView,
- fingerprintUnlockController, dismissCallbackRegistry);
+ fingerprintUnlockController, dismissCallbackRegistry, lockIconContainer);
mBouncer = StatusBarKeyguardViewManagerTest.this.mBouncer;
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
index 5f7f42285f30..43bc21b1943f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
@@ -170,6 +170,8 @@ public class StatusBarTest extends SysuiTestCase {
private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@Mock
private AmbientDisplayConfiguration mAmbientDisplayConfiguration;
+ @Mock
+ private StatusBarWindowView mStatusBarWindowView;
private TestableStatusBar mStatusBar;
private FakeMetricsLogger mMetricsLogger;
@@ -261,7 +263,7 @@ public class StatusBarTest extends SysuiTestCase {
mDozeScrimController, mock(NotificationShelf.class),
mLockscreenUserManager, mCommandQueue, mNotificationPresenter,
mock(BubbleController.class), mock(NavigationBarController.class),
- mock(AutoHideController.class), mKeyguardUpdateMonitor);
+ mock(AutoHideController.class), mKeyguardUpdateMonitor, mStatusBarWindowView);
mStatusBar.mContext = mContext;
mStatusBar.mComponents = mContext.getComponents();
SystemUIFactory.getInstance().getRootComponent()
@@ -767,7 +769,8 @@ public class StatusBarTest extends SysuiTestCase {
BubbleController bubbleController,
NavigationBarController navBarController,
AutoHideController autoHideController,
- KeyguardUpdateMonitor keyguardUpdateMonitor) {
+ KeyguardUpdateMonitor keyguardUpdateMonitor,
+ StatusBarWindowView statusBarWindow) {
mStatusBarKeyguardViewManager = man;
mUnlockMethodCache = unlock;
mKeyguardIndicationController = key;
@@ -801,6 +804,7 @@ public class StatusBarTest extends SysuiTestCase {
mNavigationBarController = navBarController;
mAutoHideController = autoHideController;
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
+ mStatusBarWindow = statusBarWindow;
}
private WakefulnessLifecycle createAwakeWakefulnessLifecycle() {
diff --git a/services/core/java/com/android/server/VibratorService.java b/services/core/java/com/android/server/VibratorService.java
index 5d0fa26f640e..ba562610c7b8 100644
--- a/services/core/java/com/android/server/VibratorService.java
+++ b/services/core/java/com/android/server/VibratorService.java
@@ -236,6 +236,7 @@ public class VibratorService extends IVibratorService.Stub
case VibrationEffect.EFFECT_CLICK:
case VibrationEffect.EFFECT_DOUBLE_CLICK:
case VibrationEffect.EFFECT_HEAVY_CLICK:
+ case VibrationEffect.EFFECT_TEXTURE_TICK:
case VibrationEffect.EFFECT_TICK:
case VibrationEffect.EFFECT_POP:
case VibrationEffect.EFFECT_THUD:
@@ -379,6 +380,9 @@ public class VibratorService extends IVibratorService.Stub
mFallbackEffects.put(VibrationEffect.EFFECT_TICK, tickEffect);
mFallbackEffects.put(VibrationEffect.EFFECT_HEAVY_CLICK, heavyClickEffect);
+ mFallbackEffects.put(VibrationEffect.EFFECT_TEXTURE_TICK,
+ VibrationEffect.get(VibrationEffect.EFFECT_TICK, false));
+
mScaleLevels = new SparseArray<>();
mScaleLevels.put(SCALE_VERY_LOW,
new ScaleLevel(SCALE_VERY_LOW_GAMMA, SCALE_VERY_LOW_MAX_AMPLITUDE));
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 881a4ae92bc4..0b602829d8d0 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -544,6 +544,7 @@ public class ActivityManagerService extends IActivityManager.Stub
private static final int NATIVE_DUMP_TIMEOUT_MS = 2000; // 2 seconds;
final OomAdjuster mOomAdjuster;
+ final LowMemDetector mLowMemDetector;
/** All system services */
SystemServiceManager mSystemServiceManager;
@@ -2294,6 +2295,7 @@ public class ActivityManagerService extends IActivityManager.Stub
? new ActivityManagerConstants(mContext, this, mHandler) : null;
final ActiveUids activeUids = new ActiveUids(this, false /* postChangesToAtm */);
mProcessList.init(this, activeUids);
+ mLowMemDetector = null;
mOomAdjuster = new OomAdjuster(this, mProcessList, activeUids);
mIntentFirewall = hasHandlerThread
@@ -2342,6 +2344,7 @@ public class ActivityManagerService extends IActivityManager.Stub
mConstants = new ActivityManagerConstants(mContext, this, mHandler);
final ActiveUids activeUids = new ActiveUids(this, true /* postChangesToAtm */);
mProcessList.init(this, activeUids);
+ mLowMemDetector = new LowMemDetector(this);
mOomAdjuster = new OomAdjuster(this, mProcessList, activeUids);
// Broadcast policy parameters
@@ -16524,25 +16527,29 @@ public class ActivityManagerService extends IActivityManager.Stub
final boolean updateLowMemStateLocked(int numCached, int numEmpty, int numTrimming) {
final int N = mProcessList.getLruSizeLocked();
final long now = SystemClock.uptimeMillis();
- // Now determine the memory trimming level of background processes.
- // Unfortunately we need to start at the back of the list to do this
- // properly. We only do this if the number of background apps we
- // are managing to keep around is less than half the maximum we desire;
- // if we are keeping a good number around, we'll let them use whatever
- // memory they want.
- final int numCachedAndEmpty = numCached + numEmpty;
int memFactor;
- if (numCached <= mConstants.CUR_TRIM_CACHED_PROCESSES
+ if (mLowMemDetector != null && mLowMemDetector.isAvailable()) {
+ memFactor = mLowMemDetector.getMemFactor();
+ } else {
+ // Now determine the memory trimming level of background processes.
+ // Unfortunately we need to start at the back of the list to do this
+ // properly. We only do this if the number of background apps we
+ // are managing to keep around is less than half the maximum we desire;
+ // if we are keeping a good number around, we'll let them use whatever
+ // memory they want.
+ if (numCached <= mConstants.CUR_TRIM_CACHED_PROCESSES
&& numEmpty <= mConstants.CUR_TRIM_EMPTY_PROCESSES) {
- if (numCachedAndEmpty <= ProcessList.TRIM_CRITICAL_THRESHOLD) {
- memFactor = ProcessStats.ADJ_MEM_FACTOR_CRITICAL;
- } else if (numCachedAndEmpty <= ProcessList.TRIM_LOW_THRESHOLD) {
- memFactor = ProcessStats.ADJ_MEM_FACTOR_LOW;
+ final int numCachedAndEmpty = numCached + numEmpty;
+ if (numCachedAndEmpty <= ProcessList.TRIM_CRITICAL_THRESHOLD) {
+ memFactor = ProcessStats.ADJ_MEM_FACTOR_CRITICAL;
+ } else if (numCachedAndEmpty <= ProcessList.TRIM_LOW_THRESHOLD) {
+ memFactor = ProcessStats.ADJ_MEM_FACTOR_LOW;
+ } else {
+ memFactor = ProcessStats.ADJ_MEM_FACTOR_MODERATE;
+ }
} else {
- memFactor = ProcessStats.ADJ_MEM_FACTOR_MODERATE;
+ memFactor = ProcessStats.ADJ_MEM_FACTOR_NORMAL;
}
- } else {
- memFactor = ProcessStats.ADJ_MEM_FACTOR_NORMAL;
}
// We always allow the memory level to go up (better). We only allow it to go
// down if we are in a state where that is allowed, *and* the total number of processes
diff --git a/services/core/java/com/android/server/am/LowMemDetector.java b/services/core/java/com/android/server/am/LowMemDetector.java
new file mode 100644
index 000000000000..e82a207cdd59
--- /dev/null
+++ b/services/core/java/com/android/server/am/LowMemDetector.java
@@ -0,0 +1,92 @@
+/*
+ * 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 com.android.server.am;
+
+import com.android.internal.annotations.GuardedBy;
+
+/**
+ * Detects low memory using PSI.
+ *
+ * If the kernel doesn't support PSI, then this class is not available.
+ */
+public final class LowMemDetector {
+ private static final String TAG = "LowMemDetector";
+ private final ActivityManagerService mAm;
+ private final LowMemThread mLowMemThread;
+ private boolean mAvailable;
+
+ private final Object mPressureStateLock = new Object();
+
+ @GuardedBy("mPressureStateLock")
+ private int mPressureState = MEM_PRESSURE_NONE;
+
+ /* getPressureState return values */
+ public static final int MEM_PRESSURE_NONE = 0;
+ public static final int MEM_PRESSURE_LOW = 1;
+ public static final int MEM_PRESSURE_MEDIUM = 2;
+ public static final int MEM_PRESSURE_HIGH = 3;
+
+ LowMemDetector(ActivityManagerService am) {
+ mAm = am;
+ mLowMemThread = new LowMemThread();
+ if (init() != 0) {
+ mAvailable = false;
+ } else {
+ mAvailable = true;
+ mLowMemThread.start();
+ }
+ }
+
+ public boolean isAvailable() {
+ return mAvailable;
+ }
+
+ /**
+ * Returns the current mem factor.
+ * Note that getMemFactor returns LowMemDetector.MEM_PRESSURE_XXX
+ * which match ProcessStats.ADJ_MEM_FACTOR_XXX values. If they deviate
+ * there should be conversion performed here to translate pressure state
+ * into memFactor.
+ */
+ public int getMemFactor() {
+ synchronized (mPressureStateLock) {
+ return mPressureState;
+ }
+ }
+
+ private native int init();
+ private native int waitForPressure();
+
+ private final class LowMemThread extends Thread {
+ public void run() {
+
+ while (true) {
+ // sleep waiting for a PSI event
+ int newPressureState = waitForPressure();
+ if (newPressureState == -1) {
+ // epoll broke, tear this down
+ mAvailable = false;
+ break;
+ }
+ // got a PSI event? let's update lowmem info
+ synchronized (mPressureStateLock) {
+ mPressureState = newPressureState;
+ }
+ }
+ }
+ }
+}
diff --git a/services/core/java/com/android/server/wm/DragDropController.java b/services/core/java/com/android/server/wm/DragDropController.java
index 716e4ef2ef82..f8f6334b04dc 100644
--- a/services/core/java/com/android/server/wm/DragDropController.java
+++ b/services/core/java/com/android/server/wm/DragDropController.java
@@ -236,7 +236,7 @@ class DragDropController {
}
}
- void cancelDragAndDrop(IBinder dragToken) {
+ void cancelDragAndDrop(IBinder dragToken, boolean skipAnimation) {
if (DEBUG_DRAG) {
Slog.d(TAG_WM, "cancelDragAndDrop");
}
@@ -257,7 +257,7 @@ class DragDropController {
}
mDragState.mDragResult = false;
- mDragState.cancelDragLocked();
+ mDragState.cancelDragLocked(skipAnimation);
}
} finally {
mCallback.get().postCancelDragAndDrop();
diff --git a/services/core/java/com/android/server/wm/DragState.java b/services/core/java/com/android/server/wm/DragState.java
index c4389667a57e..6127303141f4 100644
--- a/services/core/java/com/android/server/wm/DragState.java
+++ b/services/core/java/com/android/server/wm/DragState.java
@@ -475,15 +475,16 @@ class DragState {
closeLocked();
}
- void cancelDragLocked() {
+ void cancelDragLocked(boolean skipAnimation) {
if (mAnimator != null) {
return;
}
- if (!mDragInProgress) {
- // This can happen if an app invokes Session#cancelDragAndDrop before
+ if (!mDragInProgress || skipAnimation) {
+ // mDragInProgress is false if an app invokes Session#cancelDragAndDrop before
// Session#performDrag. Reset the drag state without playing the cancel animation
// because H.DRAG_START_TIMEOUT may be sent to WindowManagerService, which will cause
// DragState#reset() while playing the cancel animation.
+ // skipAnimation is true when a caller requests to skip the drag cancel animation.
closeLocked();
return;
}
diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java
index 22b030dd1620..b33f8c7ad658 100644
--- a/services/core/java/com/android/server/wm/Session.java
+++ b/services/core/java/com/android/server/wm/Session.java
@@ -283,10 +283,10 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
}
@Override
- public void cancelDragAndDrop(IBinder dragToken) {
+ public void cancelDragAndDrop(IBinder dragToken, boolean skipAnimation) {
final long ident = Binder.clearCallingIdentity();
try {
- mDragDropController.cancelDragAndDrop(dragToken);
+ mDragDropController.cancelDragAndDrop(dragToken, skipAnimation);
} finally {
Binder.restoreCallingIdentity(ident);
}
diff --git a/services/core/java/com/android/server/wm/TaskPositioner.java b/services/core/java/com/android/server/wm/TaskPositioner.java
index 7714458bb167..7f1b4c0d0dd3 100644
--- a/services/core/java/com/android/server/wm/TaskPositioner.java
+++ b/services/core/java/com/android/server/wm/TaskPositioner.java
@@ -34,6 +34,7 @@ import android.app.IActivityTaskManager;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Binder;
+import android.os.IBinder;
import android.os.Looper;
import android.os.Process;
import android.os.RemoteException;
@@ -56,7 +57,7 @@ import com.android.internal.annotations.VisibleForTesting;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-class TaskPositioner {
+class TaskPositioner implements IBinder.DeathRecipient {
private static final boolean DEBUG_ORIENTATION_VIOLATIONS = false;
private static final String TAG_LOCAL = "TaskPositioner";
private static final String TAG = TAG_WITH_CLASS_NAME ? TAG_LOCAL : TAG_WM;
@@ -116,7 +117,9 @@ class TaskPositioner {
private float mStartDragY;
@CtrlType
private int mCtrlType = CTRL_NONE;
- private boolean mDragEnded = false;
+ @VisibleForTesting
+ boolean mDragEnded;
+ private IBinder mClientCallback;
InputChannel mServerChannel;
InputChannel mClientChannel;
@@ -346,6 +349,7 @@ class TaskPositioner {
}
mDisplayContent.resumeRotationLocked();
mDisplayContent = null;
+ mClientCallback.unlinkToDeath(this, 0 /* flags */);
}
void startDrag(WindowState win, boolean resize, boolean preserveOrientation, float startX,
@@ -355,6 +359,14 @@ class TaskPositioner {
+ ", preserveOrientation=" + preserveOrientation + ", {" + startX + ", "
+ startY + "}");
}
+ try {
+ mClientCallback = win.mClient.asBinder();
+ mClientCallback.linkToDeath(this, 0 /* flags */);
+ } catch (RemoteException e) {
+ // The caller has died, so clean up TaskPositioningController.
+ mService.mTaskPositioningController.finishTaskPositioning();
+ return;
+ }
mTask = win.getTask();
// Use the bounds of the task which accounts for
// multiple app windows. Don't use any bounds from win itself as it
@@ -651,6 +663,11 @@ class TaskPositioner {
return sFactory.create(service);
}
+ @Override
+ public void binderDied() {
+ mService.mTaskPositioningController.finishTaskPositioning();
+ }
+
interface Factory {
default TaskPositioner create(WindowManagerService service) {
return new TaskPositioner(service);
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
index e1318af32301..621849869590 100644
--- a/services/core/jni/Android.bp
+++ b/services/core/jni/Android.bp
@@ -51,6 +51,7 @@ cc_library_static {
"com_android_server_PersistentDataBlockService.cpp",
"com_android_server_GraphicsStatsService.cpp",
"com_android_server_am_AppCompactor.cpp",
+ "com_android_server_am_LowMemDetector.cpp",
"onload.cpp",
":lib_networkStatsFactory_native",
],
@@ -104,6 +105,7 @@ cc_defaults {
"libbpf_android",
"libnetdbpf",
"libnetdutils",
+ "libpsi",
"android.hardware.audio.common@2.0",
"android.hardware.broadcastradio@1.0",
"android.hardware.broadcastradio@1.1",
diff --git a/services/core/jni/com_android_server_am_LowMemDetector.cpp b/services/core/jni/com_android_server_am_LowMemDetector.cpp
new file mode 100644
index 000000000000..e41de4d5d3c3
--- /dev/null
+++ b/services/core/jni/com_android_server_am_LowMemDetector.cpp
@@ -0,0 +1,156 @@
+/**
+** 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.
+*/
+
+#define LOG_TAG "LowMemDetector"
+
+#include <errno.h>
+#include <psi/psi.h>
+#include <string.h>
+#include <sys/epoll.h>
+
+#include <jni.h>
+#include <nativehelper/JNIHelp.h>
+#include <utils/Log.h>
+
+namespace android {
+
+enum pressure_levels {
+ PRESSURE_NONE,
+ PRESSURE_LOW,
+ PRESSURE_MEDIUM,
+ PRESSURE_HIGH,
+ PRESSURE_LEVEL_COUNT = PRESSURE_HIGH
+};
+
+// amount of stall in us for each level
+static constexpr int PSI_LOW_STALL_US = 15000;
+static constexpr int PSI_MEDIUM_STALL_US = 30000;
+static constexpr int PSI_HIGH_STALL_US = 50000;
+
+// stall tracking window size in us
+static constexpr int PSI_WINDOW_SIZE_US = 1000000;
+
+static int psi_epollfd = -1;
+
+static jint android_server_am_LowMemDetector_init(JNIEnv*, jobject) {
+ int epollfd;
+ int low_psi_fd;
+ int medium_psi_fd;
+ int high_psi_fd;
+
+ epollfd = epoll_create(PRESSURE_LEVEL_COUNT);
+ if (epollfd == -1) {
+ ALOGE("epoll_create failed: %s", strerror(errno));
+ return -1;
+ }
+
+ low_psi_fd = init_psi_monitor(PSI_SOME, PSI_LOW_STALL_US, PSI_WINDOW_SIZE_US);
+ if (low_psi_fd < 0 ||
+ register_psi_monitor(epollfd, low_psi_fd, (void*)PRESSURE_LOW) != 0) {
+ goto low_fail;
+ }
+
+ medium_psi_fd =
+ init_psi_monitor(PSI_FULL, PSI_MEDIUM_STALL_US, PSI_WINDOW_SIZE_US);
+ if (medium_psi_fd < 0 || register_psi_monitor(epollfd, medium_psi_fd,
+ (void*)PRESSURE_MEDIUM) != 0) {
+ goto medium_fail;
+ }
+
+ high_psi_fd =
+ init_psi_monitor(PSI_FULL, PSI_HIGH_STALL_US, PSI_WINDOW_SIZE_US);
+ if (high_psi_fd < 0 ||
+ register_psi_monitor(epollfd, high_psi_fd, (void*)PRESSURE_HIGH) != 0) {
+ goto high_fail;
+ }
+
+ psi_epollfd = epollfd;
+ return 0;
+
+high_fail:
+ unregister_psi_monitor(epollfd, medium_psi_fd);
+medium_fail:
+ unregister_psi_monitor(epollfd, low_psi_fd);
+low_fail:
+ ALOGE("Failed to register psi trigger");
+ close(epollfd);
+ return -1;
+}
+
+static jint android_server_am_LowMemDetector_waitForPressure(JNIEnv*, jobject) {
+ static uint32_t pressure_level = PRESSURE_NONE;
+ struct epoll_event events[PRESSURE_LEVEL_COUNT];
+ int nevents = 0;
+
+ if (psi_epollfd < 0) {
+ ALOGE("Memory pressure detector is not initialized");
+ return -1;
+ }
+
+ do {
+ if (pressure_level == PRESSURE_NONE) {
+ /* Wait for events with no timeout */
+ nevents = epoll_wait(psi_epollfd, events, PRESSURE_LEVEL_COUNT, -1);
+ } else {
+ // This is simpler than lmkd. Assume that the memory pressure
+ // state will stay high for at least 1s. Within that 1s window,
+ // the memory pressure state can go up due to a different FD
+ // becoming available or it can go down when that window expires.
+ // Accordingly, there's no polling: just epoll_wait with a 1s timeout.
+ nevents = epoll_wait(psi_epollfd, events, PRESSURE_LEVEL_COUNT, 1000);
+ if (nevents == 0) {
+ pressure_level = PRESSURE_NONE;
+ return pressure_level;
+ }
+ }
+ // keep waiting if interrupted
+ } while (nevents == -1 && errno == EINTR);
+
+ if (nevents == -1) {
+ ALOGE("epoll_wait failed while waiting for psi events: %s", strerror(errno));
+ return -1;
+ }
+
+ // reset pressure_level and raise it based on received events
+ pressure_level = PRESSURE_NONE;
+ for (int i = 0; i < nevents; i++) {
+ if (events[i].events & (EPOLLERR | EPOLLHUP)) {
+ // should never happen unless psi got disabled in kernel
+ ALOGE("Memory pressure events are not available anymore");
+ return -1;
+ }
+ // record the highest reported level
+ if (events[i].data.u32 > pressure_level) {
+ pressure_level = events[i].data.u32;
+ }
+ }
+
+ return pressure_level;
+}
+
+static const JNINativeMethod sMethods[] = {
+ /* name, signature, funcPtr */
+ {"init", "()I", (void*)android_server_am_LowMemDetector_init},
+ {"waitForPressure", "()I",
+ (void*)android_server_am_LowMemDetector_waitForPressure},
+};
+
+int register_android_server_am_LowMemDetector(JNIEnv* env) {
+ return jniRegisterNativeMethods(env, "com/android/server/am/LowMemDetector",
+ sMethods, NELEM(sMethods));
+}
+
+} // namespace android
diff --git a/services/core/jni/onload.cpp b/services/core/jni/onload.cpp
index cce96ff5f438..efffa6ca735b 100644
--- a/services/core/jni/onload.cpp
+++ b/services/core/jni/onload.cpp
@@ -56,6 +56,7 @@ int register_android_server_net_NetworkStatsFactory(JNIEnv* env);
int register_android_server_net_NetworkStatsService(JNIEnv* env);
int register_android_server_security_VerityUtils(JNIEnv* env);
int register_android_server_am_AppCompactor(JNIEnv* env);
+int register_android_server_am_LowMemDetector(JNIEnv* env);
};
using namespace android;
@@ -105,5 +106,6 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */)
register_android_server_net_NetworkStatsService(env);
register_android_server_security_VerityUtils(env);
register_android_server_am_AppCompactor(env);
+ register_android_server_am_LowMemDetector(env);
return JNI_VERSION_1_4;
}
diff --git a/services/tests/mockingservicestests/Android.bp b/services/tests/mockingservicestests/Android.bp
index 782196dc0048..2baa4d81515a 100644
--- a/services/tests/mockingservicestests/Android.bp
+++ b/services/tests/mockingservicestests/Android.bp
@@ -34,6 +34,7 @@ android_test {
jni_libs: [
"libdexmakerjvmtiagent",
+ "libpsi",
"libstaticjvmtiagent",
],
diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp
index 4ee9551542b5..1522a60850a1 100644
--- a/services/tests/servicestests/Android.bp
+++ b/services/tests/servicestests/Android.bp
@@ -69,6 +69,7 @@ android_test {
"liblog",
"liblzma",
"libnativehelper",
+ "libpsi",
"libui",
"libunwindstack",
"libutils",
diff --git a/services/tests/wmtests/src/com/android/server/wm/DragDropControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/DragDropControllerTests.java
index 68d8bc078d54..196cc211692c 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DragDropControllerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DragDropControllerTests.java
@@ -137,7 +137,7 @@ public class DragDropControllerTests extends WindowTestsBase {
return;
}
if (mToken != null) {
- mTarget.cancelDragAndDrop(mToken);
+ mTarget.cancelDragAndDrop(mToken, false);
}
latch = new CountDownLatch(1);
mTarget.setOnClosedCallbackLocked(latch::countDown);
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskPositionerTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskPositionerTests.java
index 9cdb465dc445..df55b39b0817 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskPositionerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskPositionerTests.java
@@ -20,6 +20,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.server.wm.TaskPositioner.MIN_ASPECT;
import static com.android.server.wm.WindowManagerService.dipToPixel;
import static com.android.server.wm.WindowState.MINIMUM_VISIBLE_HEIGHT_IN_DP;
@@ -29,6 +30,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
import android.app.IActivityTaskManager;
import android.graphics.Rect;
@@ -37,6 +40,7 @@ import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
+import androidx.test.filters.FlakyTest;
import androidx.test.filters.SmallTest;
import org.junit.After;
@@ -494,4 +498,15 @@ public class TaskPositionerTests extends WindowTestsBase {
assertEquals("top", expected.top, actual.top);
assertEquals("bottom", expected.bottom, actual.bottom);
}
+
+ @FlakyTest(bugId = 129492888)
+ @Test
+ public void testFinishingMovingWhenBinderDied() {
+ spyOn(mWm.mTaskPositioningController);
+
+ mPositioner.startDrag(mWindow, false, false, 0 /* startX */, 0 /* startY */);
+ verify(mWm.mTaskPositioningController, never()).finishTaskPositioning();
+ mPositioner.binderDied();
+ verify(mWm.mTaskPositioningController).finishTaskPositioning();
+ }
}
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index d2f88bbda654..33d5c04a8e5c 100755
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -3280,17 +3280,21 @@ public class CarrierConfigManager {
/**
* Overrides the carrier config of the provided subscription ID with the provided values.
*
- * Any further queries to carrier config from any process will return
- * the overriden values after this method returns. The overrides are effective for the lifetime
- * of the phone process.
+ * Any further queries to carrier config from any process will return the overridden values
+ * after this method returns. The overrides are effective for the lifetime of the phone process
+ * until the user passes in {@code null} for {@code overrideValues}. This removes all previous
+ * overrides and sets the carrier config back to production values.
*
* May throw an {@link IllegalArgumentException} if {@code overrideValues} contains invalid
* values for the specified config keys.
*
+ * NOTE: This API is meant for testing purposes only and may only be accessed from the shell UID
+ * during instrumentation testing.
+ *
* @param subscriptionId The subscription ID for which the override should be done.
- * @param overrideValues Key-value pairs of the values that are to be overriden. If null,
- * all previous overrides will be disabled and the config reset back to
- * its initial state.
+ * @param overrideValues Key-value pairs of the values that are to be overridden. If set to
+ * {@code null}, this will remove all previous overrides and set the
+ * carrier configuration back to production values.
* @hide
*/
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 18b9fbbf414e..0edf08ed73b2 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -64,6 +64,7 @@ import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.VisualVoicemailService.VisualVoicemailTask;
+import android.telephony.data.ApnSetting;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.emergency.EmergencyNumber.EmergencyServiceCategories;
import android.telephony.ims.aidl.IImsConfig;
@@ -10949,26 +10950,31 @@ public class TelephonyManager {
return new Pair<Integer, Integer>(-1, -1);
}
-
/**
- * Return whether MMS data is enabled. This will tell if framework will accept a MMS network
- * request on a subId.
+ * Return whether data is enabled for certain APN type. This will tell if framework will accept
+ * corresponding network requests on a subId.
+ *
+ * {@link #isDataEnabled()} is directly associated with users' Mobile data toggle on / off. If
+ * {@link #isDataEnabled()} returns false, it means in general all meter-ed data are disabled.
+ *
+ * This per APN type API gives a better idea whether data is allowed on a specific APN type.
+ * It will return true if:
*
- * Mms is enabled if:
- * 1) user data is turned on, or
- * 2) MMS is un-metered for this subscription, or
- * 3) alwaysAllowMms setting {@link SubscriptionManager#setAlwaysAllowMmsData} is turned on.
+ * 1) User data is turned on, or
+ * 2) APN is un-metered for this subscription, or
+ * 3) APN type is whitelisted. E.g. MMS is whitelisted if
+ * {@link SubscriptionManager#setAlwaysAllowMmsData} is turned on.
*
- * @return whether MMS data is allowed.
+ * @return whether data is enabled for a apn type.
*
* @hide
*/
- public boolean isMmsDataEnabled() {
+ public boolean isDataEnabledForApn(@ApnSetting.ApnType int apnType) {
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
try {
ITelephony service = getITelephony();
if (service != null) {
- return service.isMmsDataEnabled(getSubId(), pkgForDebug);
+ return service.isDataEnabledForApn(apnType, getSubId(), pkgForDebug);
}
} catch (RemoteException ex) {
if (!isSystemProcess()) {
@@ -10977,4 +10983,24 @@ public class TelephonyManager {
}
return false;
}
+
+ /**
+ * Whether an APN type is metered or not. It will be evaluated with the subId associated
+ * with the TelephonyManager instance.
+ *
+ * @hide
+ */
+ public boolean isApnMetered(@ApnSetting.ApnType int apnType) {
+ try {
+ ITelephony service = getITelephony();
+ if (service != null) {
+ return service.isApnMetered(apnType, getSubId());
+ }
+ } catch (RemoteException ex) {
+ if (!isSystemProcess()) {
+ ex.rethrowAsRuntimeException();
+ }
+ }
+ return true;
+ }
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 536c514356cb..0169c26d393c 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -1967,5 +1967,7 @@ interface ITelephony {
boolean isModemEnabledForSlot(int slotIndex, String callingPackage);
- boolean isMmsDataEnabled(int subId, String callingPackage);
+ boolean isDataEnabledForApn(int apnType, int subId, String callingPackage);
+
+ boolean isApnMetered(int apnType, int subId);
}