Merge "A11y: Prefer EXTRA_TITLE to ticker for status bar icon content description" into oc-dev
diff --git a/api/current.txt b/api/current.txt
index 00202b6..344ad62 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -311,7 +311,7 @@
field public static final deprecated int autoText = 16843114; // 0x101016a
field public static final int autoUrlDetect = 16843404; // 0x101028c
field public static final int autoVerify = 16844014; // 0x10104ee
- field public static final int autofillHint = 16844121; // 0x1010559
+ field public static final int autofillHints = 16844121; // 0x1010559
field public static final int autofillMode = 16844116; // 0x1010554
field public static final int background = 16842964; // 0x10100d4
field public static final int backgroundDimAmount = 16842802; // 0x1010032
@@ -5299,7 +5299,6 @@
method public android.app.Notification.Builder addExtras(android.os.Bundle);
method public android.app.Notification.Builder addPerson(java.lang.String);
method public android.app.Notification build();
- method public android.app.Notification.Builder chooseBadgeIconType(int);
method public android.widget.RemoteViews createBigContentView();
method public android.widget.RemoteViews createContentView();
method public android.widget.RemoteViews createHeadsUpContentView();
@@ -5309,6 +5308,7 @@
method public static android.app.Notification.Builder recoverBuilder(android.content.Context, android.app.Notification);
method public android.app.Notification.Builder setActions(android.app.Notification.Action...);
method public android.app.Notification.Builder setAutoCancel(boolean);
+ method public android.app.Notification.Builder setBadgeIconType(int);
method public android.app.Notification.Builder setCategory(java.lang.String);
method public android.app.Notification.Builder setChannel(java.lang.String);
method public android.app.Notification.Builder setChronometerCountDown(boolean);
@@ -6582,7 +6582,7 @@
public static class AssistStructure.ViewNode {
method public float getAlpha();
- method public java.lang.String[] getAutoFillHint();
+ method public java.lang.String[] getAutoFillHints();
method public android.view.autofill.AutofillId getAutofillId();
method public java.lang.String[] getAutofillOptions();
method public int getAutofillType();
@@ -38853,6 +38853,7 @@
field public static final java.lang.String EVENT_CALL_MERGE_FAILED = "android.telecom.event.CALL_MERGE_FAILED";
field public static final java.lang.String EVENT_CALL_PULL_FAILED = "android.telecom.event.CALL_PULL_FAILED";
field public static final java.lang.String EXTRA_ANSWERING_DROPS_FG_CALL = "android.telecom.extra.ANSWERING_DROPS_FG_CALL";
+ field public static final java.lang.String EXTRA_ANSWERING_DROPS_FG_CALL_APP_NAME = "android.telecom.extra.ANSWERING_DROPS_FG_CALL_APP_NAME";
field public static final java.lang.String EXTRA_CALL_SUBJECT = "android.telecom.extra.CALL_SUBJECT";
field public static final java.lang.String EXTRA_CHILD_ADDRESS = "android.telecom.extra.CHILD_ADDRESS";
field public static final java.lang.String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER";
@@ -39262,6 +39263,7 @@
field public static final java.lang.String EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME = "android.telecom.extra.CHANGE_DEFAULT_DIALER_PACKAGE_NAME";
field public static final java.lang.String EXTRA_INCOMING_CALL_ADDRESS = "android.telecom.extra.INCOMING_CALL_ADDRESS";
field public static final java.lang.String EXTRA_INCOMING_CALL_EXTRAS = "android.telecom.extra.INCOMING_CALL_EXTRAS";
+ field public static final java.lang.String EXTRA_INCOMING_VIDEO_STATE = "android.telecom.extra.INCOMING_VIDEO_STATE";
field public static final java.lang.String EXTRA_NOTIFICATION_COUNT = "android.telecom.extra.NOTIFICATION_COUNT";
field public static final java.lang.String EXTRA_NOTIFICATION_PHONE_NUMBER = "android.telecom.extra.NOTIFICATION_PHONE_NUMBER";
field public static final java.lang.String EXTRA_OUTGOING_CALL_EXTRAS = "android.telecom.extra.OUTGOING_CALL_EXTRAS";
@@ -45256,7 +45258,7 @@
method public float getAlpha();
method public android.view.animation.Animation getAnimation();
method public android.os.IBinder getApplicationWindowToken();
- method public java.lang.String[] getAutofillHint();
+ method public java.lang.String[] getAutofillHints();
method public int getAutofillMode();
method public int getAutofillType();
method public android.view.autofill.AutofillValue getAutofillValue();
@@ -45577,7 +45579,7 @@
method public void setActivated(boolean);
method public void setAlpha(float);
method public void setAnimation(android.view.animation.Animation);
- method public void setAutofillHint(java.lang.String...);
+ method public void setAutofillHints(java.lang.String...);
method public void setAutofillMode(int);
method public void setBackground(android.graphics.drawable.Drawable);
method public void setBackgroundColor(int);
@@ -46001,6 +46003,7 @@
method public static deprecated int getEdgeSlop();
method public static deprecated int getFadingEdgeLength();
method public static deprecated long getGlobalActionKeyTimeout();
+ method public float getScaledHorizontalScrollFactor();
method public static int getJumpTapTimeout();
method public static int getKeyRepeatDelay();
method public static int getKeyRepeatTimeout();
@@ -46019,7 +46022,6 @@
method public int getScaledOverscrollDistance();
method public int getScaledPagingTouchSlop();
method public int getScaledScrollBarSize();
- method public int getScaledScrollFactor();
method public int getScaledTouchSlop();
method public int getScaledWindowTouchSlop();
method public static int getScrollBarFadeDuration();
@@ -46028,6 +46030,7 @@
method public static float getScrollFriction();
method public static int getTapTimeout();
method public static deprecated int getTouchSlop();
+ method public float getScaledVerticalScrollFactor();
method public static deprecated int getWindowTouchSlop();
method public static long getZoomControlsTimeout();
method public boolean hasPermanentMenuKey();
@@ -46392,7 +46395,7 @@
method public abstract void setAccessibilityFocused(boolean);
method public abstract void setActivated(boolean);
method public abstract void setAlpha(float);
- method public abstract void setAutofillHint(java.lang.String[]);
+ method public abstract void setAutofillHints(java.lang.String[]);
method public abstract void setAutofillId(android.view.ViewStructure, int);
method public abstract void setAutofillOptions(java.lang.String[]);
method public abstract void setAutofillType(int);
diff --git a/api/removed.txt b/api/removed.txt
index af429b8..fa62e05 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -374,16 +374,12 @@
method protected void initializeScrollbars(android.content.res.TypedArray);
}
- public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
- field public static final int TYPE_KEYGUARD = 2004; // 0x7d4
+ public class ViewConfiguration {
+ method public int getScaledScrollFactor();
}
-}
-
-package android.view.textclassifier {
-
- public final class TextClassificationManager {
- method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
+ public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
+ field public static final int TYPE_KEYGUARD = 2004; // 0x7d4
}
}
diff --git a/api/system-current.txt b/api/system-current.txt
index 7eca4ae..9a605b7 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -425,7 +425,7 @@
field public static final deprecated int autoText = 16843114; // 0x101016a
field public static final int autoUrlDetect = 16843404; // 0x101028c
field public static final int autoVerify = 16844014; // 0x10104ee
- field public static final int autofillHint = 16844121; // 0x1010559
+ field public static final int autofillHints = 16844121; // 0x1010559
field public static final int autofillMode = 16844116; // 0x1010554
field public static final int background = 16842964; // 0x10100d4
field public static final int backgroundDimAmount = 16842802; // 0x1010032
@@ -5474,7 +5474,6 @@
method public android.app.Notification.Builder addExtras(android.os.Bundle);
method public android.app.Notification.Builder addPerson(java.lang.String);
method public android.app.Notification build();
- method public android.app.Notification.Builder chooseBadgeIconType(int);
method public android.widget.RemoteViews createBigContentView();
method public android.widget.RemoteViews createContentView();
method public android.widget.RemoteViews createHeadsUpContentView();
@@ -5484,6 +5483,7 @@
method public static android.app.Notification.Builder recoverBuilder(android.content.Context, android.app.Notification);
method public android.app.Notification.Builder setActions(android.app.Notification.Action...);
method public android.app.Notification.Builder setAutoCancel(boolean);
+ method public android.app.Notification.Builder setBadgeIconType(int);
method public android.app.Notification.Builder setCategory(java.lang.String);
method public android.app.Notification.Builder setChannel(java.lang.String);
method public android.app.Notification.Builder setChronometerCountDown(boolean);
@@ -6819,7 +6819,7 @@
public static class AssistStructure.ViewNode {
method public float getAlpha();
- method public java.lang.String[] getAutoFillHint();
+ method public java.lang.String[] getAutoFillHints();
method public android.view.autofill.AutofillId getAutofillId();
method public java.lang.String[] getAutofillOptions();
method public int getAutofillType();
@@ -42020,6 +42020,7 @@
field public static final java.lang.String EVENT_CALL_MERGE_FAILED = "android.telecom.event.CALL_MERGE_FAILED";
field public static final java.lang.String EVENT_CALL_PULL_FAILED = "android.telecom.event.CALL_PULL_FAILED";
field public static final java.lang.String EXTRA_ANSWERING_DROPS_FG_CALL = "android.telecom.extra.ANSWERING_DROPS_FG_CALL";
+ field public static final java.lang.String EXTRA_ANSWERING_DROPS_FG_CALL_APP_NAME = "android.telecom.extra.ANSWERING_DROPS_FG_CALL_APP_NAME";
field public static final java.lang.String EXTRA_CALL_SUBJECT = "android.telecom.extra.CALL_SUBJECT";
field public static final java.lang.String EXTRA_CHILD_ADDRESS = "android.telecom.extra.CHILD_ADDRESS";
field public static final java.lang.String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER";
@@ -42615,6 +42616,7 @@
field public static final java.lang.String EXTRA_CONNECTION_SERVICE = "android.telecom.extra.CONNECTION_SERVICE";
field public static final java.lang.String EXTRA_INCOMING_CALL_ADDRESS = "android.telecom.extra.INCOMING_CALL_ADDRESS";
field public static final java.lang.String EXTRA_INCOMING_CALL_EXTRAS = "android.telecom.extra.INCOMING_CALL_EXTRAS";
+ field public static final java.lang.String EXTRA_INCOMING_VIDEO_STATE = "android.telecom.extra.INCOMING_VIDEO_STATE";
field public static final java.lang.String EXTRA_NOTIFICATION_COUNT = "android.telecom.extra.NOTIFICATION_COUNT";
field public static final java.lang.String EXTRA_NOTIFICATION_PHONE_NUMBER = "android.telecom.extra.NOTIFICATION_PHONE_NUMBER";
field public static final java.lang.String EXTRA_OUTGOING_CALL_EXTRAS = "android.telecom.extra.OUTGOING_CALL_EXTRAS";
@@ -48713,7 +48715,7 @@
method public float getAlpha();
method public android.view.animation.Animation getAnimation();
method public android.os.IBinder getApplicationWindowToken();
- method public java.lang.String[] getAutofillHint();
+ method public java.lang.String[] getAutofillHints();
method public int getAutofillMode();
method public int getAutofillType();
method public android.view.autofill.AutofillValue getAutofillValue();
@@ -49034,7 +49036,7 @@
method public void setActivated(boolean);
method public void setAlpha(float);
method public void setAnimation(android.view.animation.Animation);
- method public void setAutofillHint(java.lang.String...);
+ method public void setAutofillHints(java.lang.String...);
method public void setAutofillMode(int);
method public void setBackground(android.graphics.drawable.Drawable);
method public void setBackgroundColor(int);
@@ -49458,6 +49460,7 @@
method public static deprecated int getEdgeSlop();
method public static deprecated int getFadingEdgeLength();
method public static deprecated long getGlobalActionKeyTimeout();
+ method public float getScaledHorizontalScrollFactor();
method public static int getJumpTapTimeout();
method public static int getKeyRepeatDelay();
method public static int getKeyRepeatTimeout();
@@ -49476,7 +49479,6 @@
method public int getScaledOverscrollDistance();
method public int getScaledPagingTouchSlop();
method public int getScaledScrollBarSize();
- method public int getScaledScrollFactor();
method public int getScaledTouchSlop();
method public int getScaledWindowTouchSlop();
method public static int getScrollBarFadeDuration();
@@ -49485,6 +49487,7 @@
method public static float getScrollFriction();
method public static int getTapTimeout();
method public static deprecated int getTouchSlop();
+ method public float getScaledVerticalScrollFactor();
method public static deprecated int getWindowTouchSlop();
method public static long getZoomControlsTimeout();
method public boolean hasPermanentMenuKey();
@@ -49849,7 +49852,7 @@
method public abstract void setAccessibilityFocused(boolean);
method public abstract void setActivated(boolean);
method public abstract void setAlpha(float);
- method public abstract void setAutofillHint(java.lang.String[]);
+ method public abstract void setAutofillHints(java.lang.String[]);
method public abstract void setAutofillId(android.view.ViewStructure, int);
method public abstract void setAutofillOptions(java.lang.String[]);
method public abstract void setAutofillType(int);
@@ -52751,6 +52754,7 @@
}
public static abstract interface WebViewProvider.ViewDelegate {
+ method public default void autofill(android.util.SparseArray<android.view.autofill.AutofillValue>);
method public abstract boolean dispatchKeyEvent(android.view.KeyEvent);
method public abstract android.view.View findFocus(android.view.View);
method public abstract android.view.accessibility.AccessibilityNodeProvider getAccessibilityNodeProvider();
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 272ae77..1244103 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -368,16 +368,12 @@
method protected void initializeScrollbars(android.content.res.TypedArray);
}
- public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
- field public static final int TYPE_KEYGUARD = 2004; // 0x7d4
+ public class ViewConfiguration {
+ method public int getScaledScrollFactor();
}
-}
-
-package android.view.textclassifier {
-
- public final class TextClassificationManager {
- method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
+ public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
+ field public static final int TYPE_KEYGUARD = 2004; // 0x7d4
}
}
diff --git a/api/test-current.txt b/api/test-current.txt
index f800461..a5c9867 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -311,7 +311,7 @@
field public static final deprecated int autoText = 16843114; // 0x101016a
field public static final int autoUrlDetect = 16843404; // 0x101028c
field public static final int autoVerify = 16844014; // 0x10104ee
- field public static final int autofillHint = 16844121; // 0x1010559
+ field public static final int autofillHints = 16844121; // 0x1010559
field public static final int autofillMode = 16844116; // 0x1010554
field public static final int background = 16842964; // 0x10100d4
field public static final int backgroundDimAmount = 16842802; // 0x1010032
@@ -5311,7 +5311,6 @@
method public android.app.Notification.Builder addExtras(android.os.Bundle);
method public android.app.Notification.Builder addPerson(java.lang.String);
method public android.app.Notification build();
- method public android.app.Notification.Builder chooseBadgeIconType(int);
method public android.widget.RemoteViews createBigContentView();
method public android.widget.RemoteViews createContentView();
method public android.widget.RemoteViews createHeadsUpContentView();
@@ -5321,6 +5320,7 @@
method public static android.app.Notification.Builder recoverBuilder(android.content.Context, android.app.Notification);
method public android.app.Notification.Builder setActions(android.app.Notification.Action...);
method public android.app.Notification.Builder setAutoCancel(boolean);
+ method public android.app.Notification.Builder setBadgeIconType(int);
method public android.app.Notification.Builder setCategory(java.lang.String);
method public android.app.Notification.Builder setChannel(java.lang.String);
method public android.app.Notification.Builder setChronometerCountDown(boolean);
@@ -6611,7 +6611,7 @@
public static class AssistStructure.ViewNode {
method public float getAlpha();
- method public java.lang.String[] getAutoFillHint();
+ method public java.lang.String[] getAutoFillHints();
method public android.view.autofill.AutofillId getAutofillId();
method public java.lang.String[] getAutofillOptions();
method public int getAutofillType();
@@ -39056,6 +39056,7 @@
field public static final java.lang.String EVENT_CALL_MERGE_FAILED = "android.telecom.event.CALL_MERGE_FAILED";
field public static final java.lang.String EVENT_CALL_PULL_FAILED = "android.telecom.event.CALL_PULL_FAILED";
field public static final java.lang.String EXTRA_ANSWERING_DROPS_FG_CALL = "android.telecom.extra.ANSWERING_DROPS_FG_CALL";
+ field public static final java.lang.String EXTRA_ANSWERING_DROPS_FG_CALL_APP_NAME = "android.telecom.extra.ANSWERING_DROPS_FG_CALL_APP_NAME";
field public static final java.lang.String EXTRA_CALL_SUBJECT = "android.telecom.extra.CALL_SUBJECT";
field public static final java.lang.String EXTRA_CHILD_ADDRESS = "android.telecom.extra.CHILD_ADDRESS";
field public static final java.lang.String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER";
@@ -39465,6 +39466,7 @@
field public static final java.lang.String EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME = "android.telecom.extra.CHANGE_DEFAULT_DIALER_PACKAGE_NAME";
field public static final java.lang.String EXTRA_INCOMING_CALL_ADDRESS = "android.telecom.extra.INCOMING_CALL_ADDRESS";
field public static final java.lang.String EXTRA_INCOMING_CALL_EXTRAS = "android.telecom.extra.INCOMING_CALL_EXTRAS";
+ field public static final java.lang.String EXTRA_INCOMING_VIDEO_STATE = "android.telecom.extra.INCOMING_VIDEO_STATE";
field public static final java.lang.String EXTRA_NOTIFICATION_COUNT = "android.telecom.extra.NOTIFICATION_COUNT";
field public static final java.lang.String EXTRA_NOTIFICATION_PHONE_NUMBER = "android.telecom.extra.NOTIFICATION_PHONE_NUMBER";
field public static final java.lang.String EXTRA_OUTGOING_CALL_EXTRAS = "android.telecom.extra.OUTGOING_CALL_EXTRAS";
@@ -45630,7 +45632,7 @@
method public float getAlpha();
method public android.view.animation.Animation getAnimation();
method public android.os.IBinder getApplicationWindowToken();
- method public java.lang.String[] getAutofillHint();
+ method public java.lang.String[] getAutofillHints();
method public int getAutofillMode();
method public int getAutofillType();
method public android.view.autofill.AutofillValue getAutofillValue();
@@ -45954,7 +45956,7 @@
method public void setActivated(boolean);
method public void setAlpha(float);
method public void setAnimation(android.view.animation.Animation);
- method public void setAutofillHint(java.lang.String...);
+ method public void setAutofillHints(java.lang.String...);
method public void setAutofillMode(int);
method public void setBackground(android.graphics.drawable.Drawable);
method public void setBackgroundColor(int);
@@ -46378,6 +46380,7 @@
method public static deprecated int getEdgeSlop();
method public static deprecated int getFadingEdgeLength();
method public static deprecated long getGlobalActionKeyTimeout();
+ method public float getScaledHorizontalScrollFactor();
method public static int getHoverTooltipHideShortTimeout();
method public static int getHoverTooltipHideTimeout();
method public static int getHoverTooltipShowTimeout();
@@ -46400,7 +46403,6 @@
method public int getScaledOverscrollDistance();
method public int getScaledPagingTouchSlop();
method public int getScaledScrollBarSize();
- method public int getScaledScrollFactor();
method public int getScaledTouchSlop();
method public int getScaledWindowTouchSlop();
method public static int getScrollBarFadeDuration();
@@ -46409,6 +46411,7 @@
method public static float getScrollFriction();
method public static int getTapTimeout();
method public static deprecated int getTouchSlop();
+ method public float getScaledVerticalScrollFactor();
method public static deprecated int getWindowTouchSlop();
method public static long getZoomControlsTimeout();
method public boolean hasPermanentMenuKey();
@@ -46773,7 +46776,7 @@
method public abstract void setAccessibilityFocused(boolean);
method public abstract void setActivated(boolean);
method public abstract void setAlpha(float);
- method public abstract void setAutofillHint(java.lang.String[]);
+ method public abstract void setAutofillHints(java.lang.String[]);
method public abstract void setAutofillId(android.view.ViewStructure, int);
method public abstract void setAutofillOptions(java.lang.String[]);
method public abstract void setAutofillType(int);
diff --git a/api/test-removed.txt b/api/test-removed.txt
index af429b8..fa62e05 100644
--- a/api/test-removed.txt
+++ b/api/test-removed.txt
@@ -374,16 +374,12 @@
method protected void initializeScrollbars(android.content.res.TypedArray);
}
- public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
- field public static final int TYPE_KEYGUARD = 2004; // 0x7d4
+ public class ViewConfiguration {
+ method public int getScaledScrollFactor();
}
-}
-
-package android.view.textclassifier {
-
- public final class TextClassificationManager {
- method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
+ public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
+ field public static final int TYPE_KEYGUARD = 2004; // 0x7d4
}
}
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 4bbc003..3d66135 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -2715,7 +2715,7 @@
*
* Note: This value might be ignored, for launchers that don't support badge icons.
*/
- public Builder chooseBadgeIconType(int icon) {
+ public Builder setBadgeIconType(int icon) {
mN.mBadgeIcon = icon;
return this;
}
diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java
index a343524..124267b 100644
--- a/core/java/android/app/assist/AssistStructure.java
+++ b/core/java/android/app/assist/AssistStructure.java
@@ -593,7 +593,7 @@
// fields (viewId and childId) of the field.
AutofillId mAutofillId;
@View.AutofillType int mAutofillType;
- @Nullable String[] mAutofillHint;
+ @Nullable String[] mAutofillHints;
AutofillValue mAutofillValue;
String[] mAutofillOptions;
boolean mSanitized;
@@ -685,7 +685,7 @@
mSanitized = in.readInt() == 1;
mAutofillId = in.readParcelable(null);
mAutofillType = in.readInt();
- mAutofillHint = in.readStringArray();
+ mAutofillHints = in.readStringArray();
mAutofillValue = in.readParcelable(null);
mAutofillOptions = in.readStringArray();
}
@@ -830,7 +830,7 @@
out.writeInt(mSanitized ? 1 : 0);
out.writeParcelable(mAutofillId, 0);
out.writeInt(mAutofillType);
- out.writeStringArray(mAutofillHint);
+ out.writeStringArray(mAutofillHints);
final AutofillValue sanitizedValue = writeSensitive ? mAutofillValue : null;
out.writeParcelable(sanitizedValue, 0);
out.writeStringArray(mAutofillOptions);
@@ -973,10 +973,10 @@
* <p>It's only set when the {@link AssistStructure} is used for autofilling purposes, not
* for assist.</p>
*
- * @return The hint for this view
+ * @return The hints for this view
*/
- @Nullable public String[] getAutoFillHint() {
- return mAutofillHint;
+ @Nullable public String[] getAutoFillHints() {
+ return mAutofillHints;
}
/**
@@ -1678,8 +1678,8 @@
}
@Override
- public void setAutofillHint(@Nullable String[] hint) {
- mNode.mAutofillHint = hint;
+ public void setAutofillHints(@Nullable String[] hints) {
+ mNode.mAutofillHints = hints;
}
@Override
@@ -1836,7 +1836,7 @@
+ ", type=" + node.getAutofillType()
+ ", options=" + Arrays.toString(node.getAutofillOptions())
+ ", inputType=" + node.getInputType()
- + ", hint=" + Arrays.toString(node.getAutoFillHint())
+ + ", hints=" + Arrays.toString(node.getAutoFillHints())
+ ", value=" + node.getAutofillValue()
+ ", sanitized=" + node.isSanitized());
}
diff --git a/core/java/android/app/backup/RestoreSession.java b/core/java/android/app/backup/RestoreSession.java
index 94fac17..69d964d 100644
--- a/core/java/android/app/backup/RestoreSession.java
+++ b/core/java/android/app/backup/RestoreSession.java
@@ -54,7 +54,9 @@
public int getAvailableRestoreSets(RestoreObserver observer, BackupManagerMonitor monitor) {
int err = -1;
RestoreObserverWrapper obsWrapper = new RestoreObserverWrapper(mContext, observer);
- BackupManagerMonitorWrapper monitorWrapper = new BackupManagerMonitorWrapper(monitor);
+ BackupManagerMonitorWrapper monitorWrapper = monitor == null
+ ? null
+ : new BackupManagerMonitorWrapper(monitor);
try {
err = mBinder.getAvailableRestoreSets(obsWrapper, monitorWrapper);
} catch (RemoteException e) {
@@ -99,7 +101,9 @@
return -1;
}
mObserver = new RestoreObserverWrapper(mContext, observer);
- BackupManagerMonitorWrapper monitorWrapper = new BackupManagerMonitorWrapper(monitor);
+ BackupManagerMonitorWrapper monitorWrapper = monitor == null
+ ? null
+ : new BackupManagerMonitorWrapper(monitor);
try {
err = mBinder.restoreAll(token, mObserver, monitorWrapper);
} catch (RemoteException e) {
@@ -154,7 +158,9 @@
return -1;
}
mObserver = new RestoreObserverWrapper(mContext, observer);
- BackupManagerMonitorWrapper monitorWrapper = new BackupManagerMonitorWrapper(monitor);
+ BackupManagerMonitorWrapper monitorWrapper = monitor == null
+ ? null
+ : new BackupManagerMonitorWrapper(monitor);
try {
err = mBinder.restoreSome(token, mObserver, monitorWrapper, packages);
} catch (RemoteException e) {
@@ -212,8 +218,9 @@
return -1;
}
mObserver = new RestoreObserverWrapper(mContext, observer);
- BackupManagerMonitorWrapper monitorWrapper = new BackupManagerMonitorWrapper(monitor);
-
+ BackupManagerMonitorWrapper monitorWrapper = monitor == null
+ ? null
+ : new BackupManagerMonitorWrapper(monitor);
try {
err = mBinder.restorePackage(packageName, mObserver, monitorWrapper);
} catch (RemoteException e) {
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index e617816..8044d93 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2447,7 +2447,8 @@
*
* {@hide}
*/
- public static final String ACTION_REQUEST_SHUTDOWN = "android.intent.action.ACTION_REQUEST_SHUTDOWN";
+ public static final String ACTION_REQUEST_SHUTDOWN
+ = "com.android.internal.intent.action.REQUEST_SHUTDOWN";
/**
* Broadcast Action: A sticky broadcast that indicates low storage space
* condition on the device
diff --git a/core/java/android/inputmethodservice/CompactExtractEditLayout.java b/core/java/android/inputmethodservice/CompactExtractEditLayout.java
index 35c54b2..4925d25 100644
--- a/core/java/android/inputmethodservice/CompactExtractEditLayout.java
+++ b/core/java/android/inputmethodservice/CompactExtractEditLayout.java
@@ -17,6 +17,7 @@
package android.inputmethodservice;
import android.content.Context;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.annotation.FractionRes;
import android.util.AttributeSet;
@@ -24,6 +25,7 @@
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
+import android.view.WindowInsets;
import android.widget.LinearLayout;
/**
@@ -109,9 +111,25 @@
super.onAttachedToWindow();
if (mPerformLayoutChanges) {
Resources res = getResources();
+ Configuration cfg = res.getConfiguration();
DisplayMetrics dm = res.getDisplayMetrics();
- int heightPixels = dm.heightPixels;
int widthPixels = dm.widthPixels;
+ int heightPixels = dm.heightPixels;
+
+ // Percentages must be based on the pixel height of the full (apparent) display height
+ // which is sometimes different from display metrics.
+ //
+ // On a round device, a display height smaller than width indicates a chin (cropped
+ // edge of the display) for which there is no screen buffer allocated. This is
+ // typically 25-35px in height.
+ //
+ // getRootWindowInsets() does not function for InputMethod windows (always null).
+ // Instead just set height to match width if less. This is safe because round wear
+ // devices are by definition 1:1 aspect ratio.
+
+ if (cfg.isScreenRound() && heightPixels < widthPixels) {
+ heightPixels = widthPixels;
+ }
applyProportionalLayout(widthPixels, heightPixels);
}
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 23fcb55..884283d 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -982,7 +982,7 @@
/**
* This view contains an email address.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value #AUTOFILL_HINT_EMAIL_ADDRESS}"
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_EMAIL_ADDRESS}"
* to <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
*/
public static final String AUTOFILL_HINT_EMAIL_ADDRESS = "emailAddress";
@@ -990,7 +990,7 @@
/**
* The view contains a real name.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value #AUTOFILL_HINT_NAME}" to
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_NAME}" to
* <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
*/
public static final String AUTOFILL_HINT_NAME = "name";
@@ -998,7 +998,7 @@
/**
* The view contains a user name.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value #AUTOFILL_HINT_USERNAME}" to
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_USERNAME}" to
* <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
*/
public static final String AUTOFILL_HINT_USERNAME = "username";
@@ -1006,7 +1006,7 @@
/**
* The view contains a password.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value #AUTOFILL_HINT_PASSWORD}" to
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_PASSWORD}" to
* <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
*/
public static final String AUTOFILL_HINT_PASSWORD = "password";
@@ -1014,7 +1014,7 @@
/**
* The view contains a phone number.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value #AUTOFILL_HINT_PHONE}" to
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_PHONE}" to
* <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
*/
public static final String AUTOFILL_HINT_PHONE = "phone";
@@ -1022,7 +1022,7 @@
/**
* The view contains a postal address.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value #AUTOFILL_HINT_POSTAL_ADDRESS}"
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_POSTAL_ADDRESS}"
* to <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
*/
public static final String AUTOFILL_HINT_POSTAL_ADDRESS = "postalAddress";
@@ -1030,7 +1030,7 @@
/**
* The view contains a postal code.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value #AUTOFILL_HINT_POSTAL_CODE}" to
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_POSTAL_CODE}" to
* <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
*/
public static final String AUTOFILL_HINT_POSTAL_CODE = "postalCode";
@@ -1038,7 +1038,7 @@
/**
* The view contains a credit card number.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value
* #AUTOFILL_HINT_CREDIT_CARD_NUMBER}" to <a href="#attr_android:autofillHint"> {@code
* android:autofillHint}.
*/
@@ -1047,7 +1047,7 @@
/**
* The view contains a credit card security code.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value
* #AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE}" to <a href="#attr_android:autofillHint"> {@code
* android:autofillHint}.
*/
@@ -1056,7 +1056,7 @@
/**
* The view contains a credit card expiration date.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value
* #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE}" to <a href="#attr_android:autofillHint"> {@code
* android:autofillHint}.
*/
@@ -1066,7 +1066,7 @@
/**
* The view contains the month a credit card expires.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value
* #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH}" to <a href="#attr_android:autofillHint"> {@code
* android:autofillHint}.
*/
@@ -1076,7 +1076,7 @@
/**
* The view contains the year a credit card expires.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value
* #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR}" to <a href="#attr_android:autofillHint"> {@code
* android:autofillHint}.
*/
@@ -1086,7 +1086,7 @@
/**
* The view contains the day a credit card expires.
*
- * Use with {@link #setAutofillHint(String[])}, or set "{@value
+ * Use with {@link #setAutofillHints(String[])}, or set "{@value
* #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY}" to <a href="#attr_android:autofillHint"> {@code
* android:autofillHint}.
*/
@@ -1095,7 +1095,7 @@
/**
* Hintd for the autofill services that describes the content of the view.
*/
- private @Nullable String[] mAutofillHint;
+ private @Nullable String[] mAutofillHints;
/** @hide */
@IntDef({
@@ -5024,7 +5024,7 @@
setAutofillMode(a.getInt(attr, AUTOFILL_MODE_INHERIT));
}
break;
- case R.styleable.View_autofillHint:
+ case R.styleable.View_autofillHints:
if (a.peekValue(attr) != null) {
CharSequence[] rawHints = null;
String rawString = null;
@@ -5044,7 +5044,7 @@
if (rawHints == null) {
if (rawString == null) {
throw new IllegalArgumentException(
- "Could not resolve autofillHint");
+ "Could not resolve autofillHints");
} else {
rawHints = rawString.split(",");
}
@@ -5056,7 +5056,7 @@
for (int rawHintNum = 0; rawHintNum < numHints; rawHintNum++) {
hints[rawHintNum] = rawHints[rawHintNum].toString().trim();
}
- setAutofillHint(hints);
+ setAutofillHints(hints);
}
break;
case R.styleable.View_importantForAutofill:
@@ -7311,7 +7311,7 @@
// For example, only TextViews that are editable support autofill
if (autofillType != AUTOFILL_TYPE_NONE) {
structure.setAutofillType(autofillType);
- structure.setAutofillHint(getAutofillHint());
+ structure.setAutofillHints(getAutofillHints());
structure.setAutofillValue(getAutofillValue());
}
}
@@ -7476,13 +7476,13 @@
/**
* Describes the content of a view so that a autofill service can fill in the appropriate data.
*
- * @return The hint set via the attribute or {@code null} if no hint it set.
+ * @return The hints set via the attribute or {@code null} if no hint it set.
*
- * @attr ref android.R.styleable#View_autofillHint
+ * @attr ref android.R.styleable#View_autofillHints
*/
@ViewDebug.ExportedProperty()
- @Nullable public String[] getAutofillHint() {
- return mAutofillHint;
+ @Nullable public String[] getAutofillHints() {
+ return mAutofillHints;
}
/**
@@ -9111,17 +9111,17 @@
}
/**
- * Sets the a hint that helps the autofill service to select the appropriate data to fill the
+ * Sets the hints that helps the autofill service to select the appropriate data to fill the
* view.
*
- * @param autofillHint The autofill hint to set. If the array is emtpy, {@code null} is set.
- * @attr ref android.R.styleable#View_autofillHint
+ * @param autofillHints The autofill hints to set. If the array is emtpy, {@code null} is set.
+ * @attr ref android.R.styleable#View_autofillHints
*/
- public void setAutofillHint(@Nullable String... autofillHint) {
- if (autofillHint == null || autofillHint.length == 0) {
- mAutofillHint = null;
+ public void setAutofillHints(@Nullable String... autofillHints) {
+ if (autofillHints == null || autofillHints.length == 0) {
+ mAutofillHints = null;
} else {
- mAutofillHint = autofillHint;
+ mAutofillHints = autofillHints;
}
}
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index f16fcc9..574137b 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -232,10 +232,16 @@
private static final int OVERFLING_DISTANCE = 6;
/**
- * Amount to scroll in response to a {@link MotionEvent#ACTION_SCROLL} event, in dips per
- * axis value.
+ * Amount to scroll in response to a horizontal {@link MotionEvent#ACTION_SCROLL} event,
+ * in dips per axis value.
*/
- private static final int SCROLL_FACTOR = 64;
+ private static final float HORIZONTAL_SCROLL_FACTOR = 64;
+
+ /**
+ * Amount to scroll in response to a vertical {@link MotionEvent#ACTION_SCROLL} event,
+ * in dips per axis value.
+ */
+ private static final float VERTICAL_SCROLL_FACTOR = 64;
/**
* Default duration to hide an action mode for.
@@ -289,7 +295,8 @@
private final int mOverflingDistance;
private final boolean mFadingMarqueeEnabled;
private final long mGlobalActionsKeyTimeout;
- private final int mScrollFactor;
+ private final float mVerticalScrollFactor;
+ private final float mHorizontalScrollFactor;
private boolean sHasPermanentMenuKey;
private boolean sHasPermanentMenuKeySet;
@@ -319,7 +326,8 @@
mOverflingDistance = OVERFLING_DISTANCE;
mFadingMarqueeEnabled = true;
mGlobalActionsKeyTimeout = GLOBAL_ACTIONS_KEY_TIMEOUT;
- mScrollFactor = SCROLL_FACTOR;
+ mHorizontalScrollFactor = HORIZONTAL_SCROLL_FACTOR;
+ mVerticalScrollFactor = VERTICAL_SCROLL_FACTOR;
}
/**
@@ -406,8 +414,11 @@
com.android.internal.R.dimen.config_viewMaxFlingVelocity);
mGlobalActionsKeyTimeout = res.getInteger(
com.android.internal.R.integer.config_globalActionsKeyTimeout);
- mScrollFactor = res.getDimensionPixelSize(
- com.android.internal.R.dimen.config_scrollFactor);
+
+ mHorizontalScrollFactor = res.getDimensionPixelSize(
+ com.android.internal.R.dimen.config_horizontalScrollFactor);
+ mVerticalScrollFactor = res.getDimensionPixelSize(
+ com.android.internal.R.dimen.config_verticalScrollFactor);
}
/**
@@ -730,9 +741,27 @@
/**
* @return Amount to scroll in response to a {@link MotionEvent#ACTION_SCROLL} event. Multiply
* this by the event's axis value to obtain the number of pixels to be scrolled.
+ *
+ * @removed
*/
public int getScaledScrollFactor() {
- return mScrollFactor;
+ return (int) mVerticalScrollFactor;
+ }
+
+ /**
+ * @return Amount to scroll in response to a horizontal {@link MotionEvent#ACTION_SCROLL} event.
+ * Multiply this by the event's axis value to obtain the number of pixels to be scrolled.
+ */
+ public float getScaledHorizontalScrollFactor() {
+ return mHorizontalScrollFactor;
+ }
+
+ /**
+ * @return Amount to scroll in response to a vertical {@link MotionEvent#ACTION_SCROLL} event.
+ * Multiply this by the event's axis value to obtain the number of pixels to be scrolled.
+ */
+ public float getScaledVerticalScrollFactor() {
+ return mVerticalScrollFactor;
}
/**
diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java
index ad4b9d7..65f3c90 100644
--- a/core/java/android/view/ViewStructure.java
+++ b/core/java/android/view/ViewStructure.java
@@ -306,10 +306,10 @@
public abstract void setAutofillType(@View.AutofillType int type);
/**
- * Sets the a hint that helps the autofill service to select the appropriate data to fill the
+ * Sets the a hints that helps the autofill service to select the appropriate data to fill the
* view.
*/
- public abstract void setAutofillHint(@Nullable String[] hint);
+ public abstract void setAutofillHints(@Nullable String[] hint);
/**
* Sets the {@link AutofillValue} representing the current value of this node.
diff --git a/core/java/android/view/textclassifier/TextClassificationManager.java b/core/java/android/view/textclassifier/TextClassificationManager.java
index 0b6021a..dcdbe57 100644
--- a/core/java/android/view/textclassifier/TextClassificationManager.java
+++ b/core/java/android/view/textclassifier/TextClassificationManager.java
@@ -54,12 +54,6 @@
mContext = Preconditions.checkNotNull(context);
}
- // TODO: Remove.
- /** @removed */
- public TextClassifier getDefaultTextClassifier() {
- return getTextClassifier();
- }
-
/**
* Returns the text classifier.
*/
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index bc49123..9582b72 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -45,6 +45,7 @@
import android.text.InputType;
import android.util.AttributeSet;
import android.util.Log;
+import android.util.SparseArray;
import android.view.DragEvent;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -57,6 +58,7 @@
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeProvider;
+import android.view.autofill.AutofillValue;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.textclassifier.TextClassifier;
@@ -2646,7 +2648,7 @@
* <li>Otherwise, the class name should be {@code HTML.iframe}.
* </ol>
* <li>The W3C autofill field ({@code autocomplete} tag attribute) maps to
- * {@link ViewStructure#setAutofillHint(String[])}.
+ * {@link ViewStructure#setAutofillHints(String[])}.
* <li>The {@code type} attribute of {@code INPUT} tags maps to
* {@link ViewStructure#setInputType(int)}.
* <li>The {@code name} attribute maps to {@link ViewStructure#setIdEntry(String)}.
@@ -2706,6 +2708,11 @@
mProvider.getViewDelegate().onProvideAutofillVirtualStructure(structure, flags);
}
+ @Override
+ public void autofill(SparseArray<AutofillValue>values) {
+ mProvider.getViewDelegate().autofill(values);
+ }
+
/** @hide */
@Override
public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
diff --git a/core/java/android/webkit/WebViewProvider.java b/core/java/android/webkit/WebViewProvider.java
index aa1ffa2..f01b349 100644
--- a/core/java/android/webkit/WebViewProvider.java
+++ b/core/java/android/webkit/WebViewProvider.java
@@ -33,6 +33,7 @@
import android.os.Handler;
import android.os.Message;
import android.print.PrintDocumentAdapter;
+import android.util.SparseArray;
import android.view.DragEvent;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -41,6 +42,7 @@
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeProvider;
+import android.view.autofill.AutofillValue;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.textclassifier.TextClassifier;
@@ -331,6 +333,10 @@
int flags) {
}
+ @SuppressWarnings("unused")
+ public default void autofill(SparseArray<AutofillValue>values) {
+ }
+
public AccessibilityNodeProvider getAccessibilityNodeProvider();
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info);
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 99b91bd..1c87726 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -618,7 +618,7 @@
private int mTouchSlop;
private float mDensityScale;
- private float mScrollFactor;
+ private float mVerticalScrollFactor;
private InputConnection mDefInputConnection;
private InputConnectionWrapper mPublicInputConnection;
@@ -877,7 +877,7 @@
final ViewConfiguration configuration = ViewConfiguration.get(mContext);
mTouchSlop = configuration.getScaledTouchSlop();
- mScrollFactor = configuration.getScaledScrollFactor();
+ mVerticalScrollFactor = configuration.getScaledVerticalScrollFactor();
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mOverscrollDistance = configuration.getScaledOverscrollDistance();
@@ -4225,7 +4225,7 @@
axisValue = 0;
}
- final int delta = Math.round(axisValue * mScrollFactor);
+ final int delta = Math.round(axisValue * mVerticalScrollFactor);
if (delta != 0) {
if (!trackMotionScroll(delta, delta)) {
return true;
diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java
index 918b6c0..da00d9c 100644
--- a/core/java/android/widget/HorizontalScrollView.java
+++ b/core/java/android/widget/HorizontalScrollView.java
@@ -129,7 +129,7 @@
private int mOverscrollDistance;
private int mOverflingDistance;
- private float mScrollFactor;
+ private float mHorizontalScrollFactor;
/**
* ID of the active pointer. This is used to retain consistency during
@@ -224,7 +224,7 @@
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mOverscrollDistance = configuration.getScaledOverscrollDistance();
mOverflingDistance = configuration.getScaledOverflingDistance();
- mScrollFactor = configuration.getScaledScrollFactor();
+ mHorizontalScrollFactor = configuration.getScaledHorizontalScrollFactor();
}
@Override
@@ -743,7 +743,7 @@
axisValue = 0;
}
- final int delta = Math.round(axisValue * mScrollFactor);
+ final int delta = Math.round(axisValue * mHorizontalScrollFactor);
if (delta != 0) {
final int range = getScrollRange();
int oldScrollX = mScrollX;
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index d8f3379..0a9e361 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -135,7 +135,7 @@
private int mOverscrollDistance;
private int mOverflingDistance;
- private int mScrollFactor;
+ private float mVerticalScrollFactor;
/**
* ID of the active pointer. This is used to retain consistency during
@@ -250,7 +250,7 @@
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mOverscrollDistance = configuration.getScaledOverscrollDistance();
mOverflingDistance = configuration.getScaledOverflingDistance();
- mScrollFactor = configuration.getScaledScrollFactor();
+ mVerticalScrollFactor = configuration.getScaledVerticalScrollFactor();
}
@Override
@@ -796,7 +796,7 @@
axisValue = 0;
}
- final int delta = Math.round(axisValue * mScrollFactor);
+ final int delta = Math.round(axisValue * mVerticalScrollFactor);
if (delta != 0) {
final int range = getScrollRange();
int oldScrollY = mScrollY;
@@ -1875,7 +1875,7 @@
@Override
public String toString() {
- return "HorizontalScrollView.SavedState{"
+ return "ScrollView.SavedState{"
+ Integer.toHexString(System.identityHashCode(this))
+ " scrollPosition=" + scrollPosition + "}";
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 3d5e81b..6f8df36 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -367,14 +367,6 @@
private TextClassifier mTextClassifier;
- // A flag to prevent repeated movements from escaping the enclosing text view. The idea here is
- // that if a user is holding down a movement key to traverse text, we shouldn't also traverse
- // the view hierarchy. On the other hand, if the user is using the movement key to traverse
- // views (i.e. the first movement was to traverse out of this view, or this view was traversed
- // into by the user holding the movement key down) then we shouldn't prevent the focus from
- // changing.
- private boolean mPreventDefaultMovement;
-
private TextUtils.TruncateAt mEllipsize;
static class Drawables {
@@ -6982,20 +6974,22 @@
return true;
}
+ private boolean isDirectionalNavigationKey(int keyCode) {
+ switch(keyCode) {
+ case KeyEvent.KEYCODE_DPAD_UP:
+ case KeyEvent.KEYCODE_DPAD_DOWN:
+ case KeyEvent.KEYCODE_DPAD_LEFT:
+ case KeyEvent.KEYCODE_DPAD_RIGHT:
+ return true;
+ }
+ return false;
+ }
+
private int doKeyDown(int keyCode, KeyEvent event, KeyEvent otherEvent) {
if (!isEnabled()) {
return KEY_EVENT_NOT_HANDLED;
}
- // If this is the initial keydown, we don't want to prevent a movement away from this view.
- // While this shouldn't be necessary because any time we're preventing default movement we
- // should be restricting the focus to remain within this view, thus we'll also receive
- // the key up event, occasionally key up events will get dropped and we don't want to
- // prevent the user from traversing out of this on the next key down.
- if (event.getRepeatCount() == 0 && !KeyEvent.isModifierKey(keyCode)) {
- mPreventDefaultMovement = false;
- }
-
switch (keyCode) {
case KeyEvent.KEYCODE_ENTER:
if (event.hasNoModifiers()) {
@@ -7127,16 +7121,16 @@
}
if (doDown) {
if (mMovement.onKeyDown(this, (Spannable) mText, keyCode, event)) {
- if (event.getRepeatCount() == 0 && !KeyEvent.isModifierKey(keyCode)) {
- mPreventDefaultMovement = true;
- }
return KEY_DOWN_HANDLED_BY_MOVEMENT_METHOD;
}
}
+ // Consume arrows to prevent focus leaving the editor.
+ if (isDirectionalNavigationKey(keyCode)) {
+ return KEY_EVENT_HANDLED;
+ }
}
- return mPreventDefaultMovement && !KeyEvent.isModifierKey(keyCode)
- ? KEY_EVENT_HANDLED : KEY_EVENT_NOT_HANDLED;
+ return KEY_EVENT_NOT_HANDLED;
}
/**
@@ -7169,10 +7163,6 @@
return super.onKeyUp(keyCode, event);
}
- if (!KeyEvent.isModifierKey(keyCode)) {
- mPreventDefaultMovement = false;
- }
-
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:
if (event.hasNoModifiers()) {
diff --git a/core/jni/com_android_internal_os_FuseAppLoop.cpp b/core/jni/com_android_internal_os_FuseAppLoop.cpp
index e125150..2d5026f 100644
--- a/core/jni/com_android_internal_os_FuseAppLoop.cpp
+++ b/core/jni/com_android_internal_os_FuseAppLoop.cpp
@@ -53,13 +53,11 @@
mEnv(env), mSelf(self) {}
void OnLookup(uint64_t unique, uint64_t inode) override {
- mEnv->CallVoidMethod(mSelf, gOnCommandMethod, FUSE_LOOKUP, unique, inode, 0, 0, nullptr);
- CHECK(!mEnv->ExceptionCheck());
+ CallOnCommand(FUSE_LOOKUP, unique, inode, 0, 0, nullptr);
}
void OnGetAttr(uint64_t unique, uint64_t inode) override {
- mEnv->CallVoidMethod(mSelf, gOnCommandMethod, FUSE_GETATTR, unique, inode, 0, 0, nullptr);
- CHECK(!mEnv->ExceptionCheck());
+ CallOnCommand(FUSE_GETATTR, unique, inode, 0, 0, nullptr);
}
void OnOpen(uint64_t unique, uint64_t inode) override {
@@ -75,14 +73,12 @@
}
void OnFsync(uint64_t unique, uint64_t inode) override {
- mEnv->CallVoidMethod(mSelf, gOnCommandMethod, FUSE_FSYNC, unique, inode, 0, 0, nullptr);
- CHECK(!mEnv->ExceptionCheck());
+ CallOnCommand(FUSE_FSYNC, unique, inode, 0, 0, nullptr);
}
void OnRelease(uint64_t unique, uint64_t inode) override {
mBuffers.erase(inode);
- mEnv->CallVoidMethod(mSelf, gOnCommandMethod, FUSE_RELEASE, unique, inode, 0, 0, nullptr);
- CHECK(!mEnv->ExceptionCheck());
+ CallOnCommand(FUSE_RELEASE, unique, inode, 0, 0, nullptr);
}
void OnRead(uint64_t unique, uint64_t inode, uint64_t offset, uint32_t size) override {
@@ -91,10 +87,7 @@
auto it = mBuffers.find(inode);
CHECK(it != mBuffers.end());
- mEnv->CallVoidMethod(
- mSelf, gOnCommandMethod, FUSE_READ, unique, inode, offset, size,
- it->second->get());
- CHECK(!mEnv->ExceptionCheck());
+ CallOnCommand(FUSE_READ, unique, inode, offset, size, it->second->get());
}
void OnWrite(uint64_t unique, uint64_t inode, uint64_t offset, uint32_t size,
@@ -109,8 +102,14 @@
mEnv->SetByteArrayRegion(javaBuffer, 0, size, static_cast<const jbyte*>(buffer));
CHECK(!mEnv->ExceptionCheck());
- mEnv->CallVoidMethod(
- mSelf, gOnCommandMethod, FUSE_WRITE, unique, inode, offset, size, javaBuffer);
+ CallOnCommand(FUSE_WRITE, unique, inode, offset, size, javaBuffer);
+ }
+
+private:
+ // Helper function to make sure we invoke CallVoidMethod with correct size of integer arguments.
+ void CallOnCommand(jint command, jlong unique, jlong inode, jlong offset, jint size,
+ jobject bytes) {
+ mEnv->CallVoidMethod(mSelf, gOnCommandMethod, command, unique, inode, offset, size, bytes);
CHECK(!mEnv->ExceptionCheck());
}
};
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 536457b..362794e 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -3464,7 +3464,7 @@
android:theme="@style/Theme.NoDisplay"
android:excludeFromRecents="true">
<intent-filter>
- <action android:name="android.intent.action.ACTION_REQUEST_SHUTDOWN" />
+ <action android:name="com.android.internal.intent.action.REQUEST_SHUTDOWN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index a3b2705..554f50c 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2310,7 +2310,7 @@
<!-- Describes the content of a view so that a autofill service can fill in the appropriate
data. Multiple hints can be combined in a comma separated list or an array of strings
to mean e.g. emailAddress or postalAddress. -->
- <attr name="autofillHint" format="string|reference" />
+ <attr name="autofillHints" format="string|reference" />
<!-- Hints the Android System whether the view node associated with this View should be
included in a view structure used for autofill purposes. -->
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index cda2369..bcd8a8a 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1885,8 +1885,16 @@
Takes effect only if the scrollbar drawables have no intrinsic size. -->
<dimen name="config_scrollbarSize">4dp</dimen>
- <!-- Distance that should be scrolled in response to a {@link MotionEvent#ACTION_SCROLL event}
- with an axis value of 1. -->
+ <!-- Distance that should be scrolled, per axis value, in response to a horizontal
+ {@link MotionEvent#ACTION_SCROLL} event. -->
+ <dimen name="config_horizontalScrollFactor">64dp</dimen>
+
+ <!-- Distance that should be scrolled, per axis value, in response to a vertical
+ {@link MotionEvent#ACTION_SCROLL} event. -->
+ <dimen name="config_verticalScrollFactor">64dp</dimen>
+
+ <!-- Obsolete. Distance that should be scrolled, per axis value, in response to a
+ {@link MotionEvent#ACTION_SCROLL} event. -->
<dimen name="config_scrollFactor">64dp</dimen>
<!-- Maximum number of grid columns permitted in the ResolverActivity
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 6e20208..624eb59 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2802,7 +2802,7 @@
<public name="secondaryContentAlpha" />
<public name="requiredFeature" />
<public name="requiredNotFeature" />
- <public name="autofillHint" />
+ <public name="autofillHints" />
<public name="fontProviderPackage" />
<public name="importantForAutofill" />
<public name="recycleEnabled"/>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index db5fade..dfd18e7 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -434,6 +434,8 @@
<java-symbol type="dimen" name="config_viewMinFlingVelocity" />
<java-symbol type="dimen" name="config_viewMaxFlingVelocity" />
<java-symbol type="dimen" name="config_scrollbarSize" />
+ <java-symbol type="dimen" name="config_horizontalScrollFactor" />
+ <java-symbol type="dimen" name="config_verticalScrollFactor" />
<java-symbol type="dimen" name="config_scrollFactor" />
<java-symbol type="dimen" name="default_app_widget_padding_bottom" />
<java-symbol type="dimen" name="default_app_widget_padding_left" />
diff --git a/packages/SystemUI/res/drawable-hdpi/pip_dismiss_scrim.9.png b/packages/SystemUI/res/drawable-hdpi/pip_dismiss_scrim.9.png
new file mode 100644
index 0000000..6737c80
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/pip_dismiss_scrim.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/pip_dismiss_scrim.9.png b/packages/SystemUI/res/drawable-mdpi/pip_dismiss_scrim.9.png
new file mode 100644
index 0000000..d9e33eb
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/pip_dismiss_scrim.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/pip_dismiss_scrim.9.png b/packages/SystemUI/res/drawable-xhdpi/pip_dismiss_scrim.9.png
new file mode 100644
index 0000000..64daf20
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/pip_dismiss_scrim.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/pip_dismiss_scrim.9.png b/packages/SystemUI/res/drawable-xxhdpi/pip_dismiss_scrim.9.png
new file mode 100644
index 0000000..49e0499
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xxhdpi/pip_dismiss_scrim.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxxhdpi/pip_dismiss_scrim.9.png b/packages/SystemUI/res/drawable-xxxhdpi/pip_dismiss_scrim.9.png
new file mode 100644
index 0000000..0e6ca16
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xxxhdpi/pip_dismiss_scrim.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable/pip_dismiss_background.xml b/packages/SystemUI/res/drawable/pip_dismiss_background.xml
deleted file mode 100644
index 8f50231..0000000
--- a/packages/SystemUI/res/drawable/pip_dismiss_background.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright (C) 2017 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.
--->
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <gradient
- android:startColor="#B3000000"
- android:endColor="#00000000"
- android:angle="90"/>
-</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/pip_dismiss_view.xml b/packages/SystemUI/res/layout/pip_dismiss_view.xml
index f02a56c..34228d9 100644
--- a/packages/SystemUI/res/layout/pip_dismiss_view.xml
+++ b/packages/SystemUI/res/layout/pip_dismiss_view.xml
@@ -15,43 +15,18 @@
limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/pip_dismiss_view"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="@dimen/pip_dismiss_gradient_height"
+ android:background="@drawable/pip_dismiss_scrim"
android:alpha="0">
- <!-- The height of the below view needs to be animated from a window
- so it needs to be in a container to resize smoothly -->
- <View
- android:id="@+id/gradient_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="bottom"
- android:background="@drawable/pip_dismiss_background" />
-
- <LinearLayout
- android:id="@+id/pip_dismiss_container"
+ <TextView
+ android:id="@+id/pip_dismiss_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
- android:orientation="horizontal"
- android:paddingBottom="32dp" >
-
- <ImageView
- android:id="@+id/pip_dismiss_icon"
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:padding="2dp"
- android:src="@drawable/pip_dismiss"
- android:tint="#FFFFFFFF" />
-
- <TextView
- android:id="@+id/pip_dismiss_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/pip_phone_close"
- android:textColor="#FFFFFFFF"
- android:textSize="16sp" />
- </LinearLayout>
+ android:text="@string/pip_phone_dismiss_hint"
+ android:textColor="#FFFFFFFF"
+ android:textSize="14sp" />
</FrameLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 5ffc8f9..ac4bdfc 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -730,8 +730,11 @@
loading full resolution screenshots. -->
<dimen name="recents_fast_fling_velocity">600dp</dimen>
- <!-- The size of the PIP drag-to-dismiss target. -->
- <dimen name="pip_dismiss_target_size">48dp</dimen>
+ <!-- The height of the gradient indicating the dismiss edge when moving a PIP. -->
+ <dimen name="pip_dismiss_gradient_height">196dp</dimen>
+
+ <!-- The bottom margin of the PIP drag to dismiss info text shown when moving a PIP. -->
+ <dimen name="pip_dismiss_text_bottom_margin">36dp</dimen>
<!-- The shortest-edge size of the expanded PiP. -->
<dimen name="pip_expanded_shortest_edge_size">160dp</dimen>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index a2ec804..ad39f54 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1861,9 +1861,12 @@
<!-- Label for PIP action to Minimize the PIP [CHAR LIMIT=25] -->
<string name="pip_phone_minimize">Minimize</string>
- <!-- Label for PIP the drag to close zone [CHAR LIMIT=NONE]-->
+ <!-- Label for PIP close button [CHAR LIMIT=NONE]-->
<string name="pip_phone_close">Close</string>
+ <!-- Label for PIP the drag to dismiss hint [CHAR LIMIT=NONE]-->
+ <string name="pip_phone_dismiss_hint">Drag down to dismiss</string>
+
<!-- Title of menu shown over picture-in-picture. Used for accessibility. -->
<string name="pip_menu_title">Picture in picture menu</string>
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipDismissViewController.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipDismissViewController.java
index 0259e3e..86bb0de 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipDismissViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipDismissViewController.java
@@ -41,21 +41,9 @@
private static final int SHOW_TARGET_DELAY = 100;
private static final int SHOW_TARGET_DURATION = 200;
- private static final float DISMISS_TEXT_MAX_SCALE = 2f;
- private static final float DISMISS_GRADIENT_MIN_HEIGHT_PERCENT = 0.33f;
- private static final float DISMISS_GRADIENT_MAX_HEIGHT_PERCENT = 0.5f;
- private static final float DISMISS_THRESHOLD = 0.55f;
-
private Context mContext;
private WindowManager mWindowManager;
-
private View mDismissView;
- private Rect mDismissTargetScreenBounds = new Rect();
-
- private View mDismissContainer;
- private View mGradientView;
- private float mMinHeight;
- private float mMaxHeight;
public PipDismissViewController(Context context) {
mContext = context;
@@ -67,42 +55,29 @@
*/
public void createDismissTarget() {
if (mDismissView == null) {
- // Determine sizes for the gradient
+ // Determine sizes for the view
final Rect stableInsets = new Rect();
SystemServicesProxy.getInstance(mContext).getStableInsets(stableInsets);
final Point windowSize = new Point();
mWindowManager.getDefaultDisplay().getRealSize(windowSize);
- mMinHeight = windowSize.y * DISMISS_GRADIENT_MIN_HEIGHT_PERCENT;
- mMaxHeight = windowSize.y * DISMISS_GRADIENT_MAX_HEIGHT_PERCENT;
+ final int gradientHeight = mContext.getResources().getDimensionPixelSize(
+ R.dimen.pip_dismiss_gradient_height);
+ final int bottomMargin = mContext.getResources().getDimensionPixelSize(
+ R.dimen.pip_dismiss_text_bottom_margin);
// Create a new view for the dismiss target
LayoutInflater inflater = LayoutInflater.from(mContext);
mDismissView = inflater.inflate(R.layout.pip_dismiss_view, null);
- mGradientView = mDismissView.findViewById(R.id.gradient_view);
- FrameLayout.LayoutParams glp =
- (FrameLayout.LayoutParams) mGradientView.getLayoutParams();
- glp.height = (int) mMaxHeight;
- mGradientView.setLayoutParams(glp);
- mGradientView.setPivotY(windowSize.y);
- mGradientView.setScaleY(mMaxHeight / mMinHeight); // Set to min height via scaling
- mDismissContainer = mDismissView.findViewById(R.id.pip_dismiss_container);
- FrameLayout.LayoutParams clp =
- (FrameLayout.LayoutParams) mDismissContainer.getLayoutParams();
- clp.bottomMargin = stableInsets.bottom;
- mDismissContainer.addOnLayoutChangeListener(new OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom,
- int oldLeft, int oldTop, int oldRight, int oldBottom) {
- if (mDismissContainer != null) {
- mDismissContainer.getBoundsOnScreen(mDismissTargetScreenBounds);
- }
- }
- });
+
+ // Adjust bottom margins of the text
+ View text = mDismissView.findViewById(R.id.pip_dismiss_text);
+ FrameLayout.LayoutParams tlp = (FrameLayout.LayoutParams) text.getLayoutParams();
+ tlp.bottomMargin = stableInsets.bottom + bottomMargin;
// Add the target to the window
LayoutParams lp = new LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT, (int) mMaxHeight,
- 0, windowSize.y - (int) mMaxHeight,
+ ViewGroup.LayoutParams.MATCH_PARENT, gradientHeight,
+ 0, windowSize.y - gradientHeight,
LayoutParams.TYPE_SYSTEM_DIALOG,
LayoutParams.FLAG_LAYOUT_IN_SCREEN
| LayoutParams.FLAG_LAYOUT_NO_LIMITS
@@ -118,8 +93,7 @@
/**
* Shows the dismiss target.
*/
- public void showDismissTarget(Rect pinnedStack) {
- updateDismissTarget(pinnedStack);
+ public void showDismissTarget() {
mDismissView.animate()
.alpha(1f)
.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN)
@@ -148,48 +122,4 @@
.start();
}
}
-
- /**
- * Updates the appearance of the dismiss target based on how close the PIP is.
- */
- public void updateDismissTarget(Rect pinnedStack) {
- // As PIP moves over / away from delete target it grows / shrinks
- final float scalePercent = calculateDistancePercent(pinnedStack);
- final float newScale = 1 + (DISMISS_TEXT_MAX_SCALE - 1) * scalePercent;
- final float minGradientScale = mMinHeight / mMaxHeight;
- final float newHeight = Math.max(minGradientScale, scalePercent);
- mGradientView.setScaleY(newHeight);
- mDismissContainer.setScaleX(newScale);
- mDismissContainer.setScaleY(newScale);
- }
-
- /**
- * @return the percentage of distance the PIP is away from the dismiss target point.
- */
- private float calculateDistancePercent(Rect pinnedStack) {
- final int distance = mDismissTargetScreenBounds.height();
- final int textX = mDismissTargetScreenBounds.centerX();
- final int textY = mDismissTargetScreenBounds.bottom;
- final float pipCurrX = pinnedStack.centerX();
- final float pipCurrY = pinnedStack.bottom;
- final float currentDistance = PointF.length(pipCurrX - textX, pipCurrY - textY);
- if (currentDistance <= distance) {
- return 1 - (currentDistance / distance);
- }
- return 0;
- }
-
- /**
- * @return the dismiss target screen bounds.
- */
- public Rect getDismissBounds() {
- return mDismissTargetScreenBounds;
- }
-
- /**
- * @return whether the PIP is positioned on the dismiss target enough to be dismissed.
- */
- public boolean shouldDismiss(Rect pinnedStack) {
- return calculateDistancePercent(pinnedStack) >= DISMISS_THRESHOLD;
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
index 297fe67..17228b9 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
@@ -81,7 +81,7 @@
private static final long MENU_FADE_DURATION = 125;
private static final float MENU_BACKGROUND_ALPHA = 0.3f;
- private static final float DISMISS_BACKGROUND_ALPHA = 0.8f;
+ private static final float DISMISS_BACKGROUND_ALPHA = 0.6f;
private static final float DISABLED_ACTION_ALPHA = 0.54f;
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java
index c4cf28c..a14a712 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java
@@ -67,7 +67,7 @@
// The fraction of the stack width that the user has to drag offscreen to minimize the PiP
private static final float MINIMIZE_OFFSCREEN_FRACTION = 0.3f;
// The fraction of the stack height that the user has to drag offscreen to dismiss the PiP
- private static final float DISMISS_OFFSCREEN_FRACTION = 0.15f;
+ private static final float DISMISS_OFFSCREEN_FRACTION = 0.3f;
private Context mContext;
private IActivityManager mActivityManager;
@@ -201,7 +201,7 @@
*/
boolean shouldDismissPip() {
Point displaySize = new Point();
- mContext.getDisplay().getRealSize(displaySize);
+ mContext.getDisplay().getSize(displaySize);
if (mBounds.bottom > displaySize.y) {
float offscreenFraction = (float) (mBounds.bottom - displaySize.y) / mBounds.height();
return offscreenFraction >= DISMISS_OFFSCREEN_FRACTION;
@@ -327,12 +327,14 @@
/**
* Animates the dismissal of the PiP off the edge of the screen.
*/
- Rect animateDragToEdgeDismiss(Rect pipBounds, AnimatorUpdateListener listener) {
+ Rect animateDismiss(Rect pipBounds, float velocityX, float velocityY,
+ AnimatorUpdateListener listener) {
cancelAnimations();
- Point displaySize = new Point();
- mContext.getDisplay().getRealSize(displaySize);
+ final float velocity = PointF.length(velocityX, velocityY);
+ final boolean isFling = velocity > mFlingAnimationUtils.getMinVelocityPxPerSecond();
+ Point p = getDismissEndPoint(pipBounds, velocityX, velocityY, isFling);
Rect toBounds = new Rect(pipBounds);
- toBounds.offset(0, displaySize.y - pipBounds.top);
+ toBounds.offsetTo(p.x, p.y);
mBoundsAnimator = createAnimationToBounds(mBounds, toBounds, DRAG_TO_DISMISS_STACK_DURATION,
FAST_OUT_LINEAR_IN, mUpdateBoundsListener);
mBoundsAnimator.addListener(new AnimatorListenerAdapter() {
@@ -341,6 +343,10 @@
dismissPip();
}
});
+ if (isFling) {
+ mFlingAnimationUtils.apply(mBoundsAnimator, 0,
+ distanceBetweenRectOffsets(mBounds, toBounds), velocity);
+ }
if (listener != null) {
mBoundsAnimator.addUpdateListener(listener);
}
@@ -349,28 +355,6 @@
}
/**
- * Animates the dismissal of the PiP over the dismiss target bounds.
- */
- Rect animateDragToTargetDismiss(Rect dismissBounds) {
- cancelAnimations();
- Rect toBounds = new Rect(dismissBounds.centerX(),
- dismissBounds.centerY(),
- dismissBounds.centerX() + 1,
- dismissBounds.centerY() + 1);
- mBoundsAnimator = createAnimationToBounds(mBounds, toBounds,
- DRAG_TO_TARGET_DISMISS_STACK_DURATION,
- FAST_OUT_LINEAR_IN, mUpdateBoundsListener);
- mBoundsAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- dismissPip();
- }
- });
- mBoundsAnimator.start();
- return toBounds;
- }
-
- /**
* Cancels all existing animations.
*/
void cancelAnimations() {
@@ -439,6 +423,30 @@
}
/**
+ * @return the coordinates the PIP should animate to based on the direction of velocity when
+ * dismissing.
+ */
+ private Point getDismissEndPoint(Rect pipBounds, float velX, float velY, boolean isFling) {
+ Point displaySize = new Point();
+ mContext.getDisplay().getRealSize(displaySize);
+ final float bottomBound = displaySize.y + pipBounds.height() * .1f;
+ if (isFling && velX != 0 && velY != 0) {
+ // Line is defined by: y = mx + b, m = slope, b = y-intercept
+ // Find the slope
+ final float slope = velY / velX;
+ // Sub in slope and PiP position to solve for y-intercept: b = y - mx
+ final float yIntercept = pipBounds.top - slope * pipBounds.left;
+ // Now find the point on this line when y = bottom bound: x = (y - b) / m
+ final float x = (bottomBound - yIntercept) / slope;
+ return new Point((int) x, (int) bottomBound);
+ } else {
+ // If it wasn't a fling the velocity on 'up' is not reliable for direction of movement,
+ // just animate downwards.
+ return new Point(pipBounds.left, (int) bottomBound);
+ }
+ }
+
+ /**
* @return the distance between points {@param p1} and {@param p2}.
*/
private float distanceBetweenRectOffsets(Rect r1, Rect r2) {
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
index 0ce3210..6ade571 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
@@ -60,7 +60,6 @@
private static final int SHOW_DISMISS_AFFORDANCE_DELAY = 200;
// Allow dragging the PIP to a location to close it
- private static final boolean ENABLE_DISMISS_DRAG_TO_TARGET = false;
private static final boolean ENABLE_DISMISS_DRAG_TO_EDGE = true;
private final Context mContext;
@@ -88,8 +87,8 @@
private Runnable mShowDismissAffordance = new Runnable() {
@Override
public void run() {
- if (ENABLE_DISMISS_DRAG_TO_TARGET) {
- mDismissViewController.showDismissTarget(mMotionHelper.getBounds());
+ if (ENABLE_DISMISS_DRAG_TO_EDGE) {
+ mDismissViewController.showDismissTarget();
}
}
};
@@ -197,6 +196,7 @@
if (mIsMinimized) {
setMinimizedStateInternal(false);
}
+ mDismissViewController.destroyDismissTarget();
}
@Override
@@ -487,7 +487,7 @@
mMenuController.pokeMenu();
}
- if (ENABLE_DISMISS_DRAG_TO_TARGET) {
+ if (ENABLE_DISMISS_DRAG_TO_EDGE) {
mDismissViewController.createDismissTarget();
mHandler.postDelayed(mShowDismissAffordance, SHOW_DISMISS_AFFORDANCE_DELAY);
}
@@ -503,9 +503,9 @@
mSavedSnapFraction = -1f;
}
- if (touchState.startedDragging() && ENABLE_DISMISS_DRAG_TO_TARGET) {
+ if (touchState.startedDragging() && ENABLE_DISMISS_DRAG_TO_EDGE) {
mHandler.removeCallbacks(mShowDismissAffordance);
- mDismissViewController.showDismissTarget(mMotionHelper.getBounds());
+ mDismissViewController.showDismissTarget();
}
if (touchState.isDragging()) {
@@ -526,9 +526,6 @@
mTmpBounds.offsetTo((int) left, (int) top);
mMotionHelper.movePip(mTmpBounds);
- if (ENABLE_DISMISS_DRAG_TO_TARGET) {
- mDismissViewController.updateDismissTarget(mTmpBounds);
- }
if (ENABLE_DISMISS_DRAG_TO_EDGE) {
updateDismissFraction();
}
@@ -555,21 +552,22 @@
return false;
}
- if (ENABLE_DISMISS_DRAG_TO_TARGET) {
+ final PointF vel = touchState.getVelocity();
+ final boolean isHorizontal = Math.abs(vel.x) > Math.abs(vel.y);
+ final float velocity = PointF.length(vel.x, vel.y);
+ final boolean isFling = velocity > mFlingAnimationUtils.getMinVelocityPxPerSecond();
+ final boolean isFlingToBot = isFling
+ && !isHorizontal && mMovementWithinDismiss && vel.y > 0;
+ if (ENABLE_DISMISS_DRAG_TO_EDGE) {
try {
mHandler.removeCallbacks(mShowDismissAffordance);
- PointF vel = mTouchState.getVelocity();
- final float velocity = PointF.length(vel.x, vel.y);
- if (touchState.isDragging()
- && velocity < mFlingAnimationUtils.getMinVelocityPxPerSecond()) {
- if (mDismissViewController.shouldDismiss(mMotionHelper.getBounds())) {
- Rect dismissBounds = mDismissViewController.getDismissBounds();
- mMotionHelper.animateDragToTargetDismiss(dismissBounds);
- MetricsLogger.action(mContext,
- MetricsEvent.ACTION_PICTURE_IN_PICTURE_DISMISSED,
- METRIC_VALUE_DISMISSED_BY_DRAG);
- return true;
- }
+ if (mMotionHelper.shouldDismissPip() || isFlingToBot) {
+ mMotionHelper.animateDismiss(mMotionHelper.getBounds(), vel.x,
+ vel.y, mUpdateScrimListener);
+ MetricsLogger.action(mContext,
+ MetricsEvent.ACTION_PICTURE_IN_PICTURE_DISMISSED,
+ METRIC_VALUE_DISMISSED_BY_DRAG);
+ return true;
}
} finally {
mDismissViewController.destroyDismissTarget();
@@ -577,24 +575,9 @@
}
if (touchState.isDragging()) {
- final PointF vel = touchState.getVelocity();
- final float velocity = PointF.length(vel.x, vel.y);
- final boolean isFling = velocity > mFlingAnimationUtils.getMinVelocityPxPerSecond();
- final boolean isHorizontal = Math.abs(vel.x) > Math.abs(vel.y);
- final boolean isFlingToBot = isFling
- && !isHorizontal && mMovementWithinDismiss && vel.y > 0;
final boolean isFlingToEdge = isFling && isHorizontal && mMovementWithinMinimize
&& (mStartedOnLeft ? vel.x < 0 : vel.x > 0);
-
- if (ENABLE_DISMISS_DRAG_TO_EDGE
- && (mMotionHelper.shouldDismissPip() || isFlingToBot)) {
- mMotionHelper.animateDragToEdgeDismiss(mMotionHelper.getBounds(),
- mUpdateScrimListener);
- MetricsLogger.action(mContext,
- MetricsEvent.ACTION_PICTURE_IN_PICTURE_DISMISSED,
- METRIC_VALUE_DISMISSED_BY_DRAG);
- return true;
- } else if (mEnableMinimize &&
+ if (mEnableMinimize &&
!mIsMinimized && (mMotionHelper.shouldMinimizePip() || isFlingToEdge)) {
// Pip should be minimized
setMinimizedStateInternal(true);
@@ -664,7 +647,7 @@
pw.println(innerPrefix + "mIsImeShowing=" + mIsImeShowing);
pw.println(innerPrefix + "mImeHeight=" + mImeHeight);
pw.println(innerPrefix + "mSavedSnapFraction=" + mSavedSnapFraction);
- pw.println(innerPrefix + "mEnableDragToDismiss=" + ENABLE_DISMISS_DRAG_TO_TARGET);
+ pw.println(innerPrefix + "mEnableDragToEdgeDismiss=" + ENABLE_DISMISS_DRAG_TO_EDGE);
pw.println(innerPrefix + "mEnableMinimize=" + mEnableMinimize);
mSnapAlgorithm.dump(pw, innerPrefix);
mTouchState.dump(pw, innerPrefix);
diff --git a/proto/src/system_messages.proto b/proto/src/system_messages.proto
index 74f5cf5..97099df 100644
--- a/proto/src/system_messages.proto
+++ b/proto/src/system_messages.proto
@@ -24,6 +24,9 @@
// System message IDs
// These are non-consecutive in order to preserve some existing, ad hoc IDs.
+ // It is OK to use skipped IDs.
+ // Prefer to add new IDs consecutively from zero, search for ADD_NEW_IDS_ABOVE_THIS_LINE.
+ // Most of these IDs only became meaningful with the O release.
enum ID {
// Unknown
NOTE_UNKNOWN = 0;
@@ -56,6 +59,112 @@
// Package: com.android.systemui
NOTE_INSTANT_APPS = 7;
+ // Notify the user that they should select an input method
+ // Package: android
+ NOTE_SELECT_INPUT_METHOD = 8;
+
+ // Notify the user about limited functionality before decryption
+ // Package: android
+ NOTE_FBE_ENCRYPTED_NOTIFICATION = 9;
+
+ // Give the user a way out of car mode
+ // Package: android
+ NOTE_CAR_MODE_DISABLE = 10;
+
+ // Notification to tell the user that a heavy-weight application is running.
+ // Package: android
+ NOTE_HEAVY_WEIGHT_NOTIFICATION = 11;
+
+ // Notification to tell the user that a process has exceeded its memory limit.
+ // Package: android
+ NOTE_DUMP_HEAP_NOTIFICATION = 12;
+
+ // Notification that is shown when finishing a system upgrade
+ // Package: android
+ NOTE_SYSTEM_UPGRADING = 13;
+
+ // Notify the user that tethering is active.
+ // Package: android
+ NOTE_TETHER_GENERAL = 14;
+ NOTE_TETHER_USB = 15;
+ NOTE_TETHER_BLUETOOTH = 16;
+
+ // Notify the user that always-on VPN has disconnected.
+ // Package: android
+ NOTE_VPN_DISCONNECTED = 17;
+
+ // Notify the user about a sync error.
+ // Package: android
+ NOTE_SYNC_ERROR = 18;
+
+ // Ask the user to select a keyboard language and layout
+ // Package: android
+ NOTE_SELECT_KEYBOARD_LAYOUT = 19;
+
+ // Update the user about the status of the VPN
+ // Package: android
+ NOTE_VPN_STATUS = 20;
+
+ // Package manager either installed or deleted a package
+ // Package: android
+ NOTE_PACKAGE_STATE = 21;
+
+ // Tell the user that storage space is low
+ // Package: android
+ NOTE_LOW_STORAGE = 23;
+
+ // Confirm that the user wants to reset out of retail demo mode
+ // Package: android
+ NOTE_RETAIL_RESET = 24;
+
+ // Entice the use to tap to share files
+ // Package: android
+ NOTE_USB_MTP_TAP = 25;
+
+ // Display the Android Debug Protocol status
+ // Package: android
+ NOTE_ADB_ACTIVE = 26;
+
+ // Inform that USB is configured for Media Transfer Protocol
+ // Package: android
+ NOTE_USB_MTP = 27;
+
+ // Inform that USB is configured for Picture Transfer Protocol
+ // Package: android
+ NOTE_USB_PTP = 28;
+
+ // Inform that USB is configured as a Musical Instrument Digital Interface
+ // Package: android
+ NOTE_USB_MIDI = 29;
+
+ // Inform that USB is configured in host mode
+ // Package: android
+ NOTE_USB_ACCESSORY = 30;
+
+ // Inform the user that the device is supplying power to another device.
+ // Package: android
+ NOTE_USB_SUPPLYING = 31;
+
+ // Inform the user that the device is consuming power from another device.
+ // Package: android
+ NOTE_USB_CHARGING = 32;
+
+ // Inform the user that a certificate authority is managing SSL
+ // Package: android
+ NOTE_SSL_CERT_INFO = 33;
+
+ // ADD_NEW_IDS_ABOVE_THIS_LINE
+ // Legacy IDs with arbitrary values appear below
+ // Legacy IDs existed as stable non-conflicting constants prior to the O release
+
+ // Notify the user that their work profile has been deleted
+ // Package: android
+ NOTE_PROFILE_WIPED = 1001;
+
+ // Warn the user that their org can monitor the network
+ // Package: android
+ NOTE_NETWORK_LOGGING = 1002;
+
// Confirm that the user wants to remove the guest account.
// Package: com.android.systemui
NOTE_REMOVE_GUEST = 1010;
@@ -64,9 +173,13 @@
// Package: com.android.systemui
NOTE_LOGOUT_USER = 1011;
+ // Communicate to the user about remote bugreports.
+ // Package: android
+ NOTE_REMOTE_BUGREPORT = 678432343;
+
// Notify the user about public volume state changes..
// Package: com.android.systemui
- NOTE_STORAGE_PUBLIC = 0x53505542;
+ NOTE_STORAGE_PUBLIC = 0x53505542; // 1397773634
// Notify the user about private volume state changes.
// Package: com.android.systemui
@@ -79,5 +192,9 @@
// Notify the user that data or apps are being moved to external storage.
// Package: com.android.systemui
NOTE_STORAGE_MOVE = 0x534d4f56;
+
+ // Account Manager allocates IDs sequentially, starting here.
+ // Package: android
+ ACCOUNT_MANAGER_BASE = 0x70000000;
}
}
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index 9285027..3d35247 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -63,6 +63,7 @@
import com.android.server.autofill.ui.AutoFillUI;
import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.Map;
import java.util.Map.Entry;
@@ -101,23 +102,25 @@
@GuardedBy("mLock")
private final Map<AutofillId, ViewState> mViewStates = new ArrayMap<>();
+ /**
+ * Id of the View currently being displayed.
+ */
@GuardedBy("mLock")
- @Nullable
- private ViewState mCurrentViewState;
+ @Nullable private AutofillId mCurrentViewId;
private final IAutoFillManagerClient mClient;
@GuardedBy("mLock")
RemoteFillService mRemoteFillService;
- // TODO(b/33197203): Get a response per view instead of per activity.
+ // TODO(b/33197203 , b/35707731): Use List once it supports partitioning
@GuardedBy("mLock")
private FillResponse mCurrentResponse;
/**
* Used to remember which {@link Dataset} filled the session.
*/
- // TODO(b/33197203): might need more than one once we support partitions
+ // TODO(b/33197203 , b/35707731): might need more than one once it supports partitioning
@GuardedBy("mLock")
private Dataset mAutoFilledDataset;
@@ -189,7 +192,7 @@
processResponseLocked(response);
}
- LogMaker log = (new LogMaker(MetricsEvent.AUTOFILL_REQUEST))
+ final LogMaker log = (new LogMaker(MetricsEvent.AUTOFILL_REQUEST))
.setType(MetricsEvent.TYPE_SUCCESS)
.setPackageName(mPackageName)
.addTaggedData(MetricsEvent.FIELD_AUTOFILL_NUM_DATASETS,
@@ -292,8 +295,9 @@
public void requestShowFillUi(AutofillId id, int width, int height,
IAutofillWindowPresenter presenter) {
try {
+ final ViewState currentView = mViewStates.get(mCurrentViewId);
mClient.requestShowFillUi(mWindowToken, id, width, height,
- mCurrentViewState.mVirtualBounds, presenter);
+ currentView.getVirtualBounds(), presenter);
} catch (RemoteException e) {
Slog.e(TAG, "Error requesting to show fill UI", e);
}
@@ -376,13 +380,14 @@
return true;
}
+ // TODO(b/33197203 , b/35707731): refactor excessive calls to getCurrentValue()
boolean allRequiredAreNotEmpty = true;
boolean atLeastOneChanged = false;
for (int i = 0; i < requiredIds.length; i++) {
final AutofillId id = requiredIds[i];
final ViewState state = mViewStates.get(id);
- if (state == null || state.mAutofillValue == null
- || state.mAutofillValue.isEmpty()) {
+ if (state == null || state.getCurrentValue() == null
+ || state.getCurrentValue().isEmpty()) {
final ViewNode node = findViewNodeByIdLocked(id);
if (node == null) {
Slog.w(TAG, "Service passed invalid id on SavableInfo: " + id);
@@ -398,20 +403,20 @@
break;
}
}
- if (state.mValueUpdated) {
+ if (state.isChanged()) {
final AutofillValue filledValue = findValue(mAutoFilledDataset, id);
- if (!state.mAutofillValue.equals(filledValue)) {
+ if (!state.getCurrentValue().equals(filledValue)) {
if (DEBUG) {
Slog.d(TAG, "finishSessionLocked(): found a change on " + id + ": "
- + filledValue + " => " + state.mAutofillValue);
+ + filledValue + " => " + state.getCurrentValue());
}
atLeastOneChanged = true;
}
} else {
- if (state.mAutofillValue == null || state.mAutofillValue.isEmpty()) {
+ if (state.getCurrentValue() == null || state.getCurrentValue().isEmpty()) {
if (DEBUG) {
Slog.d(TAG, "finishSessionLocked(): empty value for " + id + ": "
- + state.mAutofillValue);
+ + state.getCurrentValue());
}
allRequiredAreNotEmpty = false;
break;
@@ -425,13 +430,13 @@
for (int i = 0; i < saveInfo.getOptionalIds().length; i++) {
final AutofillId id = saveInfo.getOptionalIds()[i];
final ViewState state = mViewStates.get(id);
- if (state != null && state.mAutofillValue != null && state.mValueUpdated) {
+ if (state != null && state.getCurrentValue() != null && state.isChanged()) {
final AutofillValue filledValue = findValue(mAutoFilledDataset, id);
- if (!state.mAutofillValue.equals(filledValue)) {
+ if (!state.getCurrentValue().equals(filledValue)) {
if (DEBUG) {
Slog.d(TAG, "finishSessionLocked(): found a change on optional "
+ id + ": " + filledValue + " => "
- + state.mAutofillValue);
+ + state.getCurrentValue());
}
atLeastOneChanged = true;
break;
@@ -464,7 +469,7 @@
final Bundle extras = this.mCurrentResponse.getExtras();
for (Entry<AutofillId, ViewState> entry : mViewStates.entrySet()) {
- final AutofillValue value = entry.getValue().mAutofillValue;
+ final AutofillValue value = entry.getValue().getCurrentValue();
if (value == null) {
if (VERBOSE) {
Slog.v(TAG, "callSaveLocked(): skipping " + entry.getKey());
@@ -498,39 +503,43 @@
void updateLocked(AutofillId id, Rect virtualBounds, AutofillValue value, int flags) {
if (mAutoFilledDataset != null && (flags & FLAG_VALUE_CHANGED) == 0) {
// TODO(b/33197203): ignoring because we don't support partitions yet
- Slog.d(TAG, "updateLocked(): ignoring " + flags + " after app was autofilled");
+ Slog.d(TAG, "updateLocked(): ignoring " + id + " after app was autofilled");
return;
}
ViewState viewState = mViewStates.get(id);
if (viewState == null) {
- viewState = new ViewState(this, id, this);
+ viewState = new ViewState(this, id, this, ViewState.STATE_INITIAL);
mViewStates.put(id, viewState);
}
if ((flags & FLAG_START_SESSION) != 0) {
// View is triggering autofill.
- mCurrentViewState = viewState;
+ mCurrentViewId = viewState.id;
viewState.update(value, virtualBounds);
+ viewState.setState(ViewState.STATE_STARTED_SESSION);
return;
}
if ((flags & FLAG_VALUE_CHANGED) != 0) {
- if (value != null && !value.equals(viewState.mAutofillValue)) {
- viewState.mValueUpdated = true;
+ if (value != null && !value.equals(viewState.getCurrentValue())) {
+
+ // TODO(b/33197203 , b/35707731): currently resets STATE_AUTOFILLED; should check
+ // first (doesn't make a difference now, but it will when it supports partitions)
+ viewState.setState(ViewState.STATE_CHANGED);
// Must check if this update was caused by autofilling the view, in which
// case we just update the value, but not the UI.
if (mAutoFilledDataset != null) {
final AutofillValue filledValue = findValue(mAutoFilledDataset, id);
if (value.equals(filledValue)) {
- viewState.mAutofillValue = value;
+ viewState.setCurrentValue(value);
return;
}
}
// Change value
- viewState.mAutofillValue = value;
+ viewState.setCurrentValue(value);
// Update the chooser UI
if (value.isText()) {
@@ -545,15 +554,14 @@
if ((flags & FLAG_VIEW_ENTERED) != 0) {
// Remove the UI if the ViewState has changed.
- if (mCurrentViewState != viewState) {
- mUi.hideFillUi(mCurrentViewState != null ? mCurrentViewState.mId : null);
- mCurrentViewState = viewState;
+ if (mCurrentViewId != viewState.id) {
+ mUi.hideFillUi(mCurrentViewId != null ? mCurrentViewId : null);
+ mCurrentViewId = viewState.id;
}
// If the ViewState is ready to be displayed, onReady() will be called.
viewState.update(value, virtualBounds);
- // TODO(b/33197203): Remove when there is a response per activity.
if (mCurrentResponse != null) {
viewState.setResponse(mCurrentResponse);
}
@@ -562,9 +570,9 @@
}
if ((flags & FLAG_VIEW_EXITED) != 0) {
- if (mCurrentViewState == viewState) {
- mUi.hideFillUi(viewState.mId);
- mCurrentViewState = null;
+ if (mCurrentViewId == viewState.id) {
+ mUi.hideFillUi(viewState.id);
+ mCurrentViewId = null;
}
return;
}
@@ -584,17 +592,17 @@
}
private void notifyUnavailableToClient() {
- if (mCurrentViewState == null) {
+ if (mCurrentViewId == null) {
// TODO(b/33197203): temporary sanity check; should never happen
- Slog.w(TAG, "notifyUnavailable(): mCurrentViewState is null");
+ Slog.w(TAG, "notifyUnavailable(): mCurrentViewId is null");
return;
}
if (!mHasCallback) return;
try {
- mClient.notifyNoFillUi(mWindowToken, mCurrentViewState.mId);
+ mClient.notifyNoFillUi(mWindowToken, mCurrentViewId);
} catch (RemoteException e) {
Slog.e(TAG, "Error notifying client no fill UI: windowToken=" + mWindowToken
- + " id=" + mCurrentViewState.mId, e);
+ + " id=" + mCurrentViewId, e);
}
}
@@ -604,21 +612,15 @@
+ "):" + response);
}
- if (mCurrentViewState == null) {
+ if (mCurrentViewId == null) {
// TODO(b/33197203): temporary sanity check; should never happen
- Slog.w(TAG, "processResponseLocked(): mCurrentViewState is null");
+ Slog.w(TAG, "processResponseLocked(): mCurrentViewId is null");
return;
}
mCurrentResponse = response;
- if (mCurrentResponse.getAuthentication() != null) {
- // Handle authentication.
- final Intent fillInIntent = createAuthFillInIntent(mStructure,
- mCurrentResponse.getExtras());
- mCurrentViewState.setResponse(mCurrentResponse, fillInIntent);
- return;
- }
+ setViewStatesLocked(response, ViewState.STATE_FILLABLE);
if ((mFlags & FLAG_MANUAL_REQUEST) != 0 && response.getDatasets() != null
&& response.getDatasets().size() == 1) {
@@ -627,7 +629,50 @@
return;
}
- mCurrentViewState.setResponse(mCurrentResponse);
+ // Updates the UI, if necessary.
+ final ViewState currentView = mViewStates.get(mCurrentViewId);
+ currentView.maybeCallOnFillReady();
+ }
+
+ /**
+ * Sets the state of all views in the given response.
+ */
+ private void setViewStatesLocked(FillResponse response, int state) {
+ final ArrayList<Dataset> datasets = response.getDatasets();
+ if (datasets != null) {
+ for (int i = 0; i < datasets.size(); i++) {
+ final Dataset dataset = datasets.get(i);
+ if (dataset == null) {
+ Slog.w(TAG, "Ignoring null dataset on " + datasets);
+ continue;
+ }
+ setViewStatesLocked(response, dataset, state);
+ }
+ }
+ }
+
+ /**
+ * Sets the state of all views in the given dataset and response.
+ */
+ private void setViewStatesLocked(@Nullable FillResponse response, @NonNull Dataset dataset,
+ int state) {
+ final ArrayList<AutofillId> ids = dataset.getFieldIds();
+ for (int j = 0; j < ids.size(); j++) {
+ final AutofillId id = ids.get(j);
+ ViewState viewState = mViewStates.get(id);
+ if (viewState != null) {
+ viewState.setState(state);
+ } else {
+ viewState = new ViewState(this, id, this, state);
+ if (DEBUG) { // TODO(b/33197203): change to VERBOSE once stable
+ Slog.d(TAG, "Adding autofillable view with id " + id + " and state " + state);
+ }
+ mViewStates.put(id, viewState);
+ }
+ if (response != null) {
+ viewState.setResponse(response);
+ }
+ }
}
void autoFill(Dataset dataset) {
@@ -650,6 +695,10 @@
return mService.getServiceName();
}
+ FillResponse getCurrentResponse() {
+ return mCurrentResponse;
+ }
+
private Intent createAuthFillInIntent(AssistStructure structure, Bundle extras) {
final Intent fillInIntent = new Intent();
fillInIntent.putExtra(AutofillManager.EXTRA_ASSIST_STRUCTURE, structure);
@@ -672,8 +721,8 @@
pw.print(prefix); pw.print("mFlags: "); pw.println(mFlags);
pw.print(prefix); pw.print("mCurrentResponse: "); pw.println(mCurrentResponse);
pw.print(prefix); pw.print("mAutoFilledDataset: "); pw.println(mAutoFilledDataset);
- pw.print(prefix); pw.print("mCurrentViewStates: "); pw.println(mCurrentViewState);
- pw.print(prefix); pw.print("mViewStates: "); pw.println(mViewStates.size());
+ pw.print(prefix); pw.print("mCurrentViewId: "); pw.println(mCurrentViewId);
+ pw.print(prefix); pw.print("mViewStates size: "); pw.println(mViewStates.size());
final String prefix2 = prefix + " ";
for (Map.Entry<AutofillId, ViewState> entry : mViewStates.entrySet()) {
pw.print(prefix); pw.print("State for id "); pw.println(entry.getKey());
@@ -700,6 +749,7 @@
Slog.d(TAG, "autoFillApp(): the buck is on the app: " + dataset);
}
mClient.autofill(mWindowToken, dataset.getFieldIds(), dataset.getFieldValues());
+ setViewStatesLocked(null, dataset, ViewState.STATE_AUTOFILLED);
} catch (RemoteException e) {
Slog.w(TAG, "Error autofilling activity: " + e);
}
diff --git a/services/autofill/java/com/android/server/autofill/ViewState.java b/services/autofill/java/com/android/server/autofill/ViewState.java
index d31dcfd..e3d9c1f 100644
--- a/services/autofill/java/com/android/server/autofill/ViewState.java
+++ b/services/autofill/java/com/android/server/autofill/ViewState.java
@@ -17,9 +17,9 @@
package com.android.server.autofill;
import android.annotation.Nullable;
-import android.content.Intent;
import android.graphics.Rect;
import android.service.autofill.FillResponse;
+import android.util.DebugUtils;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillValue;
@@ -40,55 +40,92 @@
@Nullable AutofillValue value);
}
- final AutofillId mId;
+ // NOTE: state constants must be public because of flagstoString().
+ public static final int STATE_UNKNOWN = 0x00;
+ /** Initial state. */
+ public static final int STATE_INITIAL = 0x01;
+ /** View id is present in a dataset returned by the service. */
+ public static final int STATE_FILLABLE = 0x02;
+ /** View was autofilled after user selected a dataset. */
+ public static final int STATE_AUTOFILLED = 0x04;
+ /** View value was changed, but not by the service. */
+ public static final int STATE_CHANGED = 0x08;
+ /** Set only in the View that started a session . */
+ public static final int STATE_STARTED_SESSION = 0x10;
+
+ public final AutofillId id;
private final Listener mListener;
- // TODO(b/33197203): would not need a reference to response and session if it was an inner
- // class of Session...
private final Session mSession;
private FillResponse mResponse;
- private Intent mAuthIntent;
- // TODO(b/33197203): encapsulate access so it's not called by UI
- AutofillValue mAutofillValue;
+ private AutofillValue mCurrentValue;
+ private Rect mVirtualBounds;
- // TODO(b/33197203): encapsulate access so it's not called by UI
- // Bounds if a virtual view, null otherwise
- Rect mVirtualBounds;
+ private int mState;
- boolean mValueUpdated;
-
- ViewState(Session session, AutofillId id, Listener listener) {
+ ViewState(Session session, AutofillId id, Listener listener, int state) {
mSession = session;
- mId = id;
+ this.id = id;
mListener = listener;
+ mState = state;
}
/**
- * Response should only be set once.
+ * Gets the boundaries of the virtual view, or {@code null} if the the view is not virtual.
*/
+ @Nullable
+ Rect getVirtualBounds() {
+ return mVirtualBounds;
+ }
+
+ /**
+ * Gets the current value of the view.
+ */
+ @Nullable
+ AutofillValue getCurrentValue() {
+ return mCurrentValue;
+ }
+
void setResponse(FillResponse response) {
mResponse = response;
- maybeCallOnFillReady();
}
- /**
- * Used when a {@link FillResponse} requires authentication to be unlocked.
- */
- void setResponse(FillResponse response, Intent authIntent) {
- mAuthIntent = authIntent;
- setResponse(response);
+ FillResponse getResponse() {
+ return mResponse;
}
CharSequence getServiceName() {
return mSession.getServiceName();
}
+ boolean isChanged() {
+ return (mState & STATE_CHANGED) != 0;
+ }
+
+ int getState() {
+ return mState;
+ }
+
+ String getStateAsString() {
+ return DebugUtils.flagsToString(ViewState.class, "STATE_", mState);
+ }
+
+ void setCurrentValue(AutofillValue value) {
+ mCurrentValue = value;
+ }
+
+ void setState(int state) {
+ // TODO(b/33197203 , b/35707731): currently it's always setting one state, but once it
+ // supports partitioning it will need to 'or' some of them..
+ mState = state;
+ }
+
// TODO(b/33197203): need to refactor / rename / document this method to make it clear that
// it can change the value and update the UI; similarly, should replace code that
// directly sets mAutoFilLValue to use encapsulation.
void update(@Nullable AutofillValue autofillValue, @Nullable Rect virtualBounds) {
if (autofillValue != null) {
- mAutofillValue = autofillValue;
+ mCurrentValue = autofillValue;
}
if (virtualBounds != null) {
mVirtualBounds = virtualBounds;
@@ -103,23 +140,31 @@
* fill UI is ready to be displayed (i.e. when response and bounds are set).
*/
void maybeCallOnFillReady() {
- if (mResponse != null && (mResponse.getAuthentication() != null
- || mResponse.getDatasets() != null)) {
- mListener.onFillReady(mResponse, mId, mAutofillValue);
+ // First try the current response associated with this View.
+ if (mResponse != null) {
+ if (mResponse.getDatasets() != null) {
+ mListener.onFillReady(mResponse, this.id, mCurrentValue);
+ }
+ return;
+ }
+ // Then checks if the session has a response waiting authentication; if so, uses it instead.
+ final FillResponse currentResponse = mSession.getCurrentResponse();
+ if (currentResponse.getAuthentication() != null) {
+ mListener.onFillReady(currentResponse, this.id, mCurrentValue);
}
}
@Override
public String toString() {
- return "ViewState: [id=" + mId + ", value=" + mAutofillValue + ", bounds=" + mVirtualBounds
- + ", updated = " + mValueUpdated + "]";
+ return "ViewState: [id=" + id + ", currentValue=" + mCurrentValue
+ + ", bounds=" + mVirtualBounds + ", state=" + getStateAsString() +"]";
}
void dump(String prefix, PrintWriter pw) {
- pw.print(prefix); pw.print("id:" ); pw.println(mId);
- pw.print(prefix); pw.print("value:" ); pw.println(mAutofillValue);
- pw.print(prefix); pw.print("updated:" ); pw.println(mValueUpdated);
+ pw.print(prefix); pw.print("id:" ); pw.println(this.id);
+ pw.print(prefix); pw.print("state:" ); pw.println(getStateAsString());
+ pw.print(prefix); pw.print("has response:" ); pw.println(mResponse != null);
+ pw.print(prefix); pw.print("currentValue:" ); pw.println(mCurrentValue);
pw.print(prefix); pw.print("virtualBounds:" ); pw.println(mVirtualBounds);
- pw.print(prefix); pw.print("authIntent:" ); pw.println(mAuthIntent);
}
}
\ No newline at end of file
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java
index 69e481f..c5f9599 100644
--- a/services/core/java/com/android/server/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/InputMethodManagerService.java
@@ -28,6 +28,7 @@
import com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.ImeSubtypeListItem;
import com.android.internal.inputmethod.InputMethodUtils;
import com.android.internal.inputmethod.InputMethodUtils.InputMethodSettings;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.os.HandlerCaller;
import com.android.internal.os.SomeArgs;
@@ -2192,7 +2193,7 @@
Slog.d(TAG, "--- show notification: label = " + summary);
}
mNotificationManager.notifyAsUser(null,
- com.android.internal.R.string.select_input_method,
+ SystemMessage.NOTE_SELECT_INPUT_METHOD,
mImeSwitcherNotification.build(), UserHandle.ALL);
mNotificationShown = true;
}
@@ -2204,7 +2205,7 @@
Slog.d(TAG, "--- hide notification");
}
mNotificationManager.cancelAsUser(null,
- com.android.internal.R.string.select_input_method, UserHandle.ALL);
+ SystemMessage.NOTE_SELECT_INPUT_METHOD, UserHandle.ALL);
mNotificationShown = false;
}
}
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java
index c0d1107..6f3ff10 100644
--- a/services/core/java/com/android/server/LockSettingsService.java
+++ b/services/core/java/com/android/server/LockSettingsService.java
@@ -76,6 +76,7 @@
import android.util.Slog;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.util.ArrayUtils;
import com.android.internal.widget.ICheckCredentialProgressCallback;
@@ -127,7 +128,6 @@
public class LockSettingsService extends ILockSettings.Stub {
private static final String TAG = "LockSettingsService";
private static final String PERMISSION = ACCESS_KEYGUARD_SECURE_STORAGE;
- private static final int FBE_ENCRYPTED_NOTIFICATION = 0;
private static final boolean DEBUG = false;
private static final int PROFILE_KEY_IV_SIZE = 12;
@@ -461,12 +461,14 @@
.setVisibility(Notification.VISIBILITY_PUBLIC)
.setContentIntent(intent)
.build();
- mNotificationManager.notifyAsUser(null, FBE_ENCRYPTED_NOTIFICATION, notification, user);
+ mNotificationManager.notifyAsUser(null, SystemMessage.NOTE_FBE_ENCRYPTED_NOTIFICATION,
+ notification, user);
}
private void hideEncryptionNotification(UserHandle userHandle) {
if (DEBUG) Slog.v(TAG, "hide encryption notification, user: " + userHandle.getIdentifier());
- mNotificationManager.cancelAsUser(null, FBE_ENCRYPTED_NOTIFICATION, userHandle);
+ mNotificationManager.cancelAsUser(null, SystemMessage.NOTE_FBE_ENCRYPTED_NOTIFICATION,
+ userHandle);
}
public void onCleanupUser(int userId) {
diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java
index e4f4687..227e2a2 100644
--- a/services/core/java/com/android/server/UiModeManagerService.java
+++ b/services/core/java/com/android/server/UiModeManagerService.java
@@ -58,6 +58,7 @@
import com.android.internal.R;
import com.android.internal.app.DisableCarModeActivity;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.server.power.ShutdownThread;
import com.android.server.twilight.TwilightListener;
@@ -710,10 +711,10 @@
PendingIntent.getActivityAsUser(context, 0, carModeOffIntent, 0,
null, UserHandle.CURRENT));
mNotificationManager.notifyAsUser(null,
- R.string.car_mode_disable_notification_title, n.build(), UserHandle.ALL);
+ SystemMessage.NOTE_CAR_MODE_DISABLE, n.build(), UserHandle.ALL);
} else {
mNotificationManager.cancelAsUser(null,
- R.string.car_mode_disable_notification_title, UserHandle.ALL);
+ SystemMessage.NOTE_CAR_MODE_DISABLE, UserHandle.ALL);
}
}
}
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 015603b..ad2ed93 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -89,6 +89,7 @@
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.content.PackageMonitor;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.IndentingPrintWriter;
@@ -189,7 +190,8 @@
}
private final LinkedHashMap<String, Session> mSessions = new LinkedHashMap<String, Session>();
- private final AtomicInteger mNotificationIds = new AtomicInteger(1);
+ private final AtomicInteger mNotificationIds =
+ new AtomicInteger(SystemMessage.ACCOUNT_MANAGER_BASE);
static class UserAccounts {
private final int userId;
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 487f383..653eed5 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -339,6 +339,7 @@
import com.android.internal.app.procstats.ProcessStats;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.os.BackgroundThread;
import com.android.internal.os.BatteryStatsImpl;
import com.android.internal.os.IResultReceiver;
@@ -2121,7 +2122,7 @@
try {
int[] outId = new int[1];
inm.enqueueNotificationWithTag("android", "android", null,
- R.string.heavy_weight_notification,
+ SystemMessage.NOTE_HEAVY_WEIGHT_NOTIFICATION,
notification, outId, root.userId);
} catch (RuntimeException e) {
Slog.w(ActivityManagerService.TAG,
@@ -2139,7 +2140,7 @@
}
try {
inm.cancelNotificationWithTag("android", null,
- R.string.heavy_weight_notification, msg.arg1);
+ SystemMessage.NOTE_HEAVY_WEIGHT_NOTIFICATION, msg.arg1);
} catch (RuntimeException e) {
Slog.w(ActivityManagerService.TAG,
"Error canceling notification for service", e);
@@ -2376,7 +2377,7 @@
try {
int[] outId = new int[1];
inm.enqueueNotificationWithTag("android", "android", null,
- R.string.dump_heap_notification,
+ SystemMessage.NOTE_DUMP_HEAP_NOTIFICATION,
notification, outId, userId);
} catch (RuntimeException e) {
Slog.w(ActivityManagerService.TAG,
diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java
index 9258539..e9b3e8d 100644
--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -966,7 +966,7 @@
mService.mWindowManager.continueSurfaceLayout();
}
- postStartActivityProcessing(r, result, mSupervisor.mFocusedStack.mStackId, mSourceRecord,
+ postStartActivityProcessing(r, result, mSupervisor.getLastStack().mStackId, mSourceRecord,
mTargetStack);
return result;
diff --git a/services/core/java/com/android/server/am/PreBootBroadcaster.java b/services/core/java/com/android/server/am/PreBootBroadcaster.java
index e0d3abd..3ea1147 100644
--- a/services/core/java/com/android/server/am/PreBootBroadcaster.java
+++ b/services/core/java/com/android/server/am/PreBootBroadcaster.java
@@ -35,6 +35,7 @@
import android.util.Slog;
import com.android.internal.R;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.util.ProgressReporter;
import com.android.server.UiThread;
@@ -159,11 +160,13 @@
.setVisibility(Notification.VISIBILITY_PUBLIC)
.setProgress(max, index, false)
.build();
- notifManager.notifyAsUser(TAG, 0, notif, UserHandle.of(mUserId));
+ notifManager.notifyAsUser(TAG, SystemMessage.NOTE_SYSTEM_UPGRADING, notif,
+ UserHandle.of(mUserId));
break;
case MSG_HIDE:
- notifManager.cancelAsUser(TAG, 0, UserHandle.of(mUserId));
+ notifManager.cancelAsUser(TAG, SystemMessage.NOTE_SYSTEM_UPGRADING,
+ UserHandle.of(mUserId));
break;
}
}
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java
index be770a3..07ab067 100644
--- a/services/core/java/com/android/server/connectivity/Tethering.java
+++ b/services/core/java/com/android/server/connectivity/Tethering.java
@@ -66,6 +66,7 @@
import android.util.SparseArray;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.TelephonyIntents;
@@ -618,30 +619,43 @@
if (usbTethered) {
if (wifiTethered || bluetoothTethered) {
- showTetheredNotification(com.android.internal.R.drawable.stat_sys_tether_general);
+ showTetheredNotification(SystemMessage.NOTE_TETHER_GENERAL);
} else {
- showTetheredNotification(com.android.internal.R.drawable.stat_sys_tether_usb);
+ showTetheredNotification(SystemMessage.NOTE_TETHER_USB);
}
} else if (wifiTethered) {
if (bluetoothTethered) {
- showTetheredNotification(com.android.internal.R.drawable.stat_sys_tether_general);
+ showTetheredNotification(SystemMessage.NOTE_TETHER_GENERAL);
} else {
/* We now have a status bar icon for WifiTethering, so drop the notification */
clearTetheredNotification();
}
} else if (bluetoothTethered) {
- showTetheredNotification(com.android.internal.R.drawable.stat_sys_tether_bluetooth);
+ showTetheredNotification(SystemMessage.NOTE_TETHER_BLUETOOTH);
} else {
clearTetheredNotification();
}
}
- private void showTetheredNotification(int icon) {
+ private void showTetheredNotification(int id) {
NotificationManager notificationManager =
(NotificationManager)mContext.getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager == null) {
return;
}
+ int icon = 0;
+ switch(id) {
+ case SystemMessage.NOTE_TETHER_USB:
+ icon = com.android.internal.R.drawable.stat_sys_tether_usb;
+ break;
+ case SystemMessage.NOTE_TETHER_BLUETOOTH:
+ icon = com.android.internal.R.drawable.stat_sys_tether_bluetooth;
+ break;
+ case SystemMessage.NOTE_TETHER_GENERAL:
+ default:
+ icon = com.android.internal.R.drawable.stat_sys_tether_general;
+ break;
+ }
if (mLastNotificationId != 0) {
if (mLastNotificationId == icon) {
@@ -678,7 +692,7 @@
.setContentTitle(title)
.setContentText(message)
.setContentIntent(pi);
- mLastNotificationId = icon;
+ mLastNotificationId = id;
notificationManager.notifyAsUser(null, mLastNotificationId,
mTetheredNotificationBuilder.build(), UserHandle.ALL);
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 9fc2fc7..2eb5557 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -81,6 +81,7 @@
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.net.LegacyVpnInfo;
import com.android.internal.net.VpnConfig;
import com.android.internal.net.VpnInfo;
@@ -1304,7 +1305,8 @@
.setVisibility(Notification.VISIBILITY_PUBLIC)
.setOngoing(true)
.setColor(mContext.getColor(R.color.system_notification_accent_color));
- notificationManager.notifyAsUser(TAG, 0, builder.build(), user);
+ notificationManager.notifyAsUser(TAG, SystemMessage.NOTE_VPN_DISCONNECTED,
+ builder.build(), user);
} finally {
Binder.restoreCallingIdentity(token);
}
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index 1a27a39..1504538 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -81,6 +81,7 @@
import android.util.Pair;
import android.util.Slog;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.util.ArrayUtils;
import com.android.server.LocalServices;
@@ -3169,8 +3170,9 @@
info.provider, syncResult.stats.numDeletes,
info.userId);
} else {
- mNotificationMgr.cancelAsUser(null,
- info.account.hashCode() ^ info.provider.hashCode(),
+ mNotificationMgr.cancelAsUser(
+ Integer.toString(info.account.hashCode() ^ info.provider.hashCode()),
+ SystemMessage.NOTE_SYNC_ERROR,
new UserHandle(info.userId));
}
if (syncResult != null && syncResult.fullSyncRequested) {
@@ -3270,7 +3272,9 @@
.setContentIntent(pendingIntent)
.build();
notification.flags |= Notification.FLAG_ONGOING_EVENT;
- mNotificationMgr.notifyAsUser(null, account.hashCode() ^ authority.hashCode(),
+ mNotificationMgr.notifyAsUser(
+ Integer.toString(account.hashCode() ^ authority.hashCode()),
+ SystemMessage.NOTE_SYNC_ERROR,
notification, user);
}
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index 297d5bd..65a4604 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -23,6 +23,7 @@
import android.util.Log;
import android.view.Display;
import com.android.internal.inputmethod.InputMethodSubtypeHandle;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.os.SomeArgs;
import com.android.internal.R;
@@ -986,7 +987,7 @@
com.android.internal.R.color.system_notification_accent_color))
.build();
mNotificationManager.notifyAsUser(null,
- R.string.select_keyboard_layout_notification_title,
+ SystemMessage.NOTE_SELECT_KEYBOARD_LAYOUT,
notification, UserHandle.ALL);
mKeyboardLayoutNotificationShown = true;
}
@@ -997,7 +998,7 @@
if (mKeyboardLayoutNotificationShown) {
mKeyboardLayoutNotificationShown = false;
mNotificationManager.cancelAsUser(null,
- R.string.select_keyboard_layout_notification_title,
+ SystemMessage.NOTE_SELECT_KEYBOARD_LAYOUT,
UserHandle.ALL);
}
}
diff --git a/services/core/java/com/android/server/net/LockdownVpnTracker.java b/services/core/java/com/android/server/net/LockdownVpnTracker.java
index a5e7d7c..5eb1277 100644
--- a/services/core/java/com/android/server/net/LockdownVpnTracker.java
+++ b/services/core/java/com/android/server/net/LockdownVpnTracker.java
@@ -45,6 +45,7 @@
import android.util.Slog;
import com.android.internal.R;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.net.VpnConfig;
import com.android.internal.net.VpnProfile;
import com.android.internal.notification.SystemNotificationChannels;
@@ -344,10 +345,11 @@
.setColor(mContext.getColor(
com.android.internal.R.color.system_notification_accent_color));
- NotificationManager.from(mContext).notify(TAG, 0, builder.build());
+ NotificationManager.from(mContext).notify(null, SystemMessage.NOTE_VPN_STATUS,
+ builder.build());
}
private void hideNotification() {
- NotificationManager.from(mContext).cancel(TAG, 0);
+ NotificationManager.from(mContext).cancel(null, SystemMessage.NOTE_VPN_STATUS);
}
}
diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java
index a317ca5..132ea2b 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerService.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerService.java
@@ -88,6 +88,7 @@
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.content.PackageHelper;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.util.FastXmlSerializer;
import com.android.internal.util.ImageUtils;
@@ -995,7 +996,9 @@
if (PackageManager.DELETE_SUCCEEDED == returnCode && mNotification != null) {
NotificationManager notificationManager = (NotificationManager)
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.notify(basePackageName, 0, mNotification);
+ notificationManager.notify(basePackageName,
+ SystemMessage.NOTE_PACKAGE_STATE,
+ mNotification);
}
final Intent fillIn = new Intent();
fillIn.putExtra(PackageInstaller.EXTRA_PACKAGE_NAME, mPackageName);
@@ -1054,7 +1057,9 @@
if (notification != null) {
NotificationManager notificationManager = (NotificationManager)
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.notify(basePackageName, 0, notification);
+ notificationManager.notify(basePackageName,
+ SystemMessage.NOTE_PACKAGE_STATE,
+ notification);
}
}
final Intent fillIn = new Intent();
diff --git a/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java b/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
index ba160ba..a847a3c 100644
--- a/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
+++ b/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
@@ -17,6 +17,8 @@
package com.android.server.storage;
import android.app.NotificationChannel;
+
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.server.EventLogTags;
import com.android.server.SystemService;
@@ -93,7 +95,6 @@
static final int DEVICE_MEMORY_WHAT = 1;
static final int FORCE_MEMORY_WHAT = 2;
private static final int MONITOR_INTERVAL = 1; //in minutes
- private static final int LOW_MEMORY_NOTIFICATION_ID = 1;
private static final int DEFAULT_FREE_STORAGE_LOG_INTERVAL_IN_MINUTES = 12*60; //in minutes
private static final long DEFAULT_DISK_FREE_CHANGE_REPORTING_THRESHOLD = 2 * 1024 * 1024; // 2MB
@@ -669,7 +670,7 @@
.setChannel(TV_NOTIFICATION_CHANNEL_ID))
.build();
notification.flags |= Notification.FLAG_NO_CLEAR;
- notificationMgr.notifyAsUser(null, LOW_MEMORY_NOTIFICATION_ID, notification,
+ notificationMgr.notifyAsUser(null, SystemMessage.NOTE_LOW_STORAGE, notification,
UserHandle.ALL);
Intent broadcast = new Intent(mStorageLowIntent);
if (seq != 0) {
@@ -688,7 +689,7 @@
(NotificationManager)context.getSystemService(
Context.NOTIFICATION_SERVICE);
//cancel notification since memory has been freed
- mNotificationMgr.cancelAsUser(null, LOW_MEMORY_NOTIFICATION_ID, UserHandle.ALL);
+ mNotificationMgr.cancelAsUser(null, SystemMessage.NOTE_LOW_STORAGE, UserHandle.ALL);
context.removeStickyBroadcastAsUser(mStorageLowIntent, UserHandle.ALL);
Intent broadcast = new Intent(mStorageOkIntent);
diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
index 78d8b53..86662b9 100644
--- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
@@ -1457,33 +1457,44 @@
/*
* TODO(b/33089503) : Create a jobject to represent GnssDebug.
*/
- if (gnssDebugIface != nullptr) {
+
+ std::stringstream internalState;
+
+ if (gnssDebugIface == nullptr) {
+ internalState << "Gnss Debug Interface not available" << std::endl;
+ } else {
IGnssDebug::DebugData data;
gnssDebugIface->getDebugData([&data](const IGnssDebug::DebugData& debugData) {
data = debugData;
});
- std::stringstream internalState;
- if (data.position.valid) {
- internalState << "Gnss Location Data:: LatitudeDegrees: " << data.position.latitudeDegrees
+ internalState << "Gnss Location Data:: ";
+ if (!data.position.valid) {
+ internalState << "not valid";
+ } else {
+ internalState << "LatitudeDegrees: " << data.position.latitudeDegrees
<< ", LongitudeDegrees: " << data.position.longitudeDegrees
<< ", altitudeMeters: " << data.position.altitudeMeters
<< ", speedMetersPerSecond: " << data.position.speedMetersPerSec
<< ", bearingDegrees: " << data.position.bearingDegrees
- << ", horizontalAccuracyMeters: " << data.position.horizontalAccuracyMeters
+ << ", horizontalAccuracyMeters: "
+ << data.position.horizontalAccuracyMeters
<< ", verticalAccuracyMeters: " << data.position.verticalAccuracyMeters
- << ", speedAccuracyMetersPerSecond: " << data.position.speedAccuracyMetersPerSecond
+ << ", speedAccuracyMetersPerSecond: "
+ << data.position.speedAccuracyMetersPerSecond
<< ", bearingAccuracyDegrees: " << data.position.bearingAccuracyDegrees
- << ", ageSeconds: " << data.position.ageSeconds << std::endl;
+ << ", ageSeconds: " << data.position.ageSeconds;
}
+ internalState << std::endl;
- if (data.time.valid) {
- internalState << "Gnss Time Data:: timeEstimate: " << data.time.timeEstimate
- << ", timeUncertaintyNs: " << data.time.timeUncertaintyNs << std::endl;
- }
+ internalState << "Gnss Time Data:: timeEstimate: " << data.time.timeEstimate
+ << ", timeUncertaintyNs: " << data.time.timeUncertaintyNs
+ << ", frequencyUncertaintyNsPerSec: "
+ << data.time.frequencyUncertaintyNsPerSec << std::endl;
if (data.satelliteDataArray.size() != 0) {
- internalState << "Satellite Data:: ";
+ internalState << "Satellite Data for " << data.satelliteDataArray.size()
+ << " satellites:: " << std::endl;
}
for (size_t i = 0; i < data.satelliteDataArray.size(); i++) {
@@ -1492,11 +1503,20 @@
<< static_cast<uint32_t>(data.satelliteDataArray[i].constellation)
<< ", ephemerisType: "
<< static_cast<uint32_t>(data.satelliteDataArray[i].ephemerisType)
+ << ", ephemerisSource: "
+ << static_cast<uint32_t>(data.satelliteDataArray[i].ephemerisSource)
+ << ", ephemerisHealth: "
+ << static_cast<uint32_t>(data.satelliteDataArray[i].ephemerisHealth)
+ << ", serverPredictionIsAvailable: "
+ << data.satelliteDataArray[i].serverPredictionIsAvailable
+ << ", serverPredictionAgeSeconds: "
+ << data.satelliteDataArray[i].serverPredictionAgeSeconds
<< ", ephemerisAgeSeconds: "
<< data.satelliteDataArray[i].ephemerisAgeSeconds << std::endl;
}
- result = env->NewStringUTF(internalState.str().c_str());
}
+
+ result = env->NewStringUTF(internalState.str().c_str());
return result;
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/CertificateMonitor.java b/services/devicepolicy/java/com/android/server/devicepolicy/CertificateMonitor.java
index a2bc195..4a456f7 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/CertificateMonitor.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/CertificateMonitor.java
@@ -39,6 +39,7 @@
import android.security.KeyChain.KeyChainConnection;
import android.util.Log;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.R;
@@ -52,7 +53,7 @@
public class CertificateMonitor {
protected static final String LOG_TAG = DevicePolicyManagerService.LOG_TAG;
- protected static final int MONITORING_CERT_NOTIFICATION_ID = R.plurals.ssl_ca_cert_warning;
+ protected static final int MONITORING_CERT_NOTIFICATION_ID = SystemMessage.NOTE_SSL_CERT_INFO;
private final DevicePolicyManagerService mService;
private final DevicePolicyManagerService.Injector mInjector;
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index ab86966..db7c99e 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -165,6 +165,7 @@
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.os.BackgroundThread;
import com.android.internal.statusbar.IStatusBarService;
@@ -261,9 +262,6 @@
private static final String ACTION_EXPIRED_PASSWORD_NOTIFICATION
= "com.android.server.ACTION_EXPIRED_PASSWORD_NOTIFICATION";
- private static final int PROFILE_WIPED_NOTIFICATION_ID = 1001;
- private static final int NETWORK_LOGGING_NOTIFICATION_ID = 1002;
-
private static final String ATTR_PERMISSION_PROVIDER = "permission-provider";
private static final String ATTR_SETUP_COMPLETE = "setup-complete";
private static final String ATTR_PROVISIONING_STATE = "provisioning-state";
@@ -5301,11 +5299,11 @@
.setColor(mContext.getColor(R.color.system_notification_accent_color))
.setStyle(new Notification.BigTextStyle().bigText(contentText))
.build();
- mInjector.getNotificationManager().notify(PROFILE_WIPED_NOTIFICATION_ID, notification);
+ mInjector.getNotificationManager().notify(SystemMessage.NOTE_PROFILE_WIPED, notification);
}
private void clearWipeProfileNotification() {
- mInjector.getNotificationManager().cancel(PROFILE_WIPED_NOTIFICATION_ID);
+ mInjector.getNotificationManager().cancel(SystemMessage.NOTE_PROFILE_WIPED);
}
@Override
@@ -10624,7 +10622,7 @@
+ " service not being available yet.");
}
mNetworkLogger = null;
- mInjector.getNotificationManager().cancel(NETWORK_LOGGING_NOTIFICATION_ID);
+ mInjector.getNotificationManager().cancel(SystemMessage.NOTE_NETWORK_LOGGING);
}
} finally {
mInjector.binderRestoreCallingIdentity(callingIdentity);
@@ -10751,7 +10749,7 @@
.setStyle(new Notification.BigTextStyle()
.bigText(mContext.getString(R.string.network_logging_notification_text)))
.build();
- mInjector.getNotificationManager().notify(NETWORK_LOGGING_NOTIFICATION_ID, notification);
+ mInjector.getNotificationManager().notify(SystemMessage.NOTE_NETWORK_LOGGING, notification);
saveSettingsLocked(mOwners.getDeviceOwnerUserId());
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/RemoteBugreportUtils.java b/services/devicepolicy/java/com/android/server/devicepolicy/RemoteBugreportUtils.java
index 969c89e..344077c 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/RemoteBugreportUtils.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/RemoteBugreportUtils.java
@@ -28,6 +28,7 @@
import android.text.format.DateUtils;
import com.android.internal.R;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import java.lang.annotation.Retention;
@@ -38,7 +39,7 @@
*/
class RemoteBugreportUtils {
- static final int NOTIFICATION_ID = 678432343;
+ static final int NOTIFICATION_ID = SystemMessage.NOTE_REMOTE_BUGREPORT;
@Retention(RetentionPolicy.SOURCE)
@IntDef({
diff --git a/services/retaildemo/java/com/android/server/retaildemo/RetailDemoModeService.java b/services/retaildemo/java/com/android/server/retaildemo/RetailDemoModeService.java
index 43c38a6..d9a937a 100644
--- a/services/retaildemo/java/com/android/server/retaildemo/RetailDemoModeService.java
+++ b/services/retaildemo/java/com/android/server/retaildemo/RetailDemoModeService.java
@@ -61,6 +61,8 @@
import android.text.TextUtils;
import android.util.KeyValueListParser;
import android.util.Slog;
+
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.os.BackgroundThread;
import com.android.internal.R;
@@ -621,8 +623,8 @@
if (!mIsCarrierDemoMode) {
// Show reset notification (except in carrier demo mode).
- mInjector.getNotificationManager().notifyAsUser(TAG,
- 1, mInjector.createResetNotification(), UserHandle.of(userId));
+ mInjector.getNotificationManager().notifyAsUser(TAG, SystemMessage.NOTE_RETAIL_RESET,
+ mInjector.createResetNotification(), UserHandle.of(userId));
synchronized (mActivityLock) {
mUserUntouched = true;
diff --git a/services/usb/java/com/android/server/usb/MtpNotificationManager.java b/services/usb/java/com/android/server/usb/MtpNotificationManager.java
index db7b385..462ee19 100644
--- a/services/usb/java/com/android/server/usb/MtpNotificationManager.java
+++ b/services/usb/java/com/android/server/usb/MtpNotificationManager.java
@@ -31,6 +31,7 @@
import android.hardware.usb.UsbManager;
import android.os.UserHandle;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
/**
@@ -101,11 +102,13 @@
notification.flags |= Notification.FLAG_LOCAL_ONLY;
mContext.getSystemService(NotificationManager.class).notify(
- TAG, device.getDeviceId(), notification);
+ Integer.toString(device.getDeviceId()), SystemMessage.NOTE_USB_MTP_TAP,
+ notification);
}
void hideNotification(int deviceId) {
- mContext.getSystemService(NotificationManager.class).cancel(TAG, deviceId);
+ mContext.getSystemService(NotificationManager.class).cancel(
+ Integer.toString(deviceId), SystemMessage.NOTE_USB_MTP_TAP);
}
private class Receiver extends BroadcastReceiver {
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index d69f933..3253056 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -51,6 +51,7 @@
import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.os.SomeArgs;
import com.android.internal.util.IndentingPrintWriter;
@@ -60,8 +61,6 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Scanner;
@@ -946,35 +945,46 @@
return;
}
int id = 0;
+ int titleRes = 0;
Resources r = mContext.getResources();
if (mConnected) {
if (!mUsbDataUnlocked) {
if (mSourcePower) {
- id = com.android.internal.R.string.usb_supplying_notification_title;
+ titleRes = com.android.internal.R.string.usb_supplying_notification_title;
+ id = SystemMessage.NOTE_USB_SUPPLYING;
} else {
- id = com.android.internal.R.string.usb_charging_notification_title;
+ titleRes = com.android.internal.R.string.usb_charging_notification_title;
+ id = SystemMessage.NOTE_USB_CHARGING;
}
} else if (UsbManager.containsFunction(mCurrentFunctions,
UsbManager.USB_FUNCTION_MTP)) {
- id = com.android.internal.R.string.usb_mtp_notification_title;
+ titleRes = com.android.internal.R.string.usb_mtp_notification_title;
+ id = SystemMessage.NOTE_USB_MTP;
} else if (UsbManager.containsFunction(mCurrentFunctions,
UsbManager.USB_FUNCTION_PTP)) {
- id = com.android.internal.R.string.usb_ptp_notification_title;
+ titleRes = com.android.internal.R.string.usb_ptp_notification_title;
+ id = SystemMessage.NOTE_USB_PTP;
} else if (UsbManager.containsFunction(mCurrentFunctions,
UsbManager.USB_FUNCTION_MIDI)) {
- id = com.android.internal.R.string.usb_midi_notification_title;
+ titleRes = com.android.internal.R.string.usb_midi_notification_title;
+ id = SystemMessage.NOTE_USB_MIDI;
} else if (UsbManager.containsFunction(mCurrentFunctions,
UsbManager.USB_FUNCTION_ACCESSORY)) {
- id = com.android.internal.R.string.usb_accessory_notification_title;
+ titleRes = com.android.internal.R.string.usb_accessory_notification_title;
+ id = SystemMessage.NOTE_USB_ACCESSORY;
} else if (mSourcePower) {
- id = com.android.internal.R.string.usb_supplying_notification_title;
+ titleRes = com.android.internal.R.string.usb_supplying_notification_title;
+ id = SystemMessage.NOTE_USB_SUPPLYING;
} else {
- id = com.android.internal.R.string.usb_charging_notification_title;
+ titleRes = com.android.internal.R.string.usb_charging_notification_title;
+ id = SystemMessage.NOTE_USB_CHARGING;
}
} else if (mSourcePower) {
- id = com.android.internal.R.string.usb_supplying_notification_title;
+ titleRes = com.android.internal.R.string.usb_supplying_notification_title;
+ id = SystemMessage.NOTE_USB_SUPPLYING;
} else if (mHostConnected && mSinkPower && mUsbCharging) {
- id = com.android.internal.R.string.usb_charging_notification_title;
+ titleRes = com.android.internal.R.string.usb_charging_notification_title;
+ id = SystemMessage.NOTE_USB_CHARGING;
}
if (id != mUsbNotificationId) {
// clear notification if title needs changing
@@ -986,7 +996,7 @@
if (id != 0) {
CharSequence message = r.getText(
com.android.internal.R.string.usb_notification_message);
- CharSequence title = r.getText(id);
+ CharSequence title = r.getText(titleRes);
Intent intent = Intent.makeRestartActivityTask(
new ComponentName("com.android.settings",
@@ -1018,7 +1028,7 @@
private void updateAdbNotification() {
if (mNotificationManager == null) return;
- final int id = com.android.internal.R.string.adb_active_notification_title;
+ final int id = SystemMessage.NOTE_ADB_ACTIVE;
if (mAdbEnabled && mConnected) {
if ("0".equals(SystemProperties.get("persist.adb.notify"))) return;
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 833affa..7998359 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -436,6 +436,18 @@
"android.telecom.extra.ANSWERING_DROPS_FG_CALL";
/**
+ * String connection extra key set on a {@link Connection} in {@link Connection#STATE_RINGING}
+ * state to indicate the name of the third-party app which is responsible for the current
+ * foreground call.
+ * <p>
+ * Used when {@link #EXTRA_ANSWERING_DROPS_FG_CALL} is true to ensure that the default Phone app
+ * is able to inform the user that answering the new incoming call will cause a call owned by
+ * another app to be dropped when the incoming call is answered.
+ */
+ public static final String EXTRA_ANSWERING_DROPS_FG_CALL_APP_NAME =
+ "android.telecom.extra.ANSWERING_DROPS_FG_CALL_APP_NAME";
+
+ /**
* Boolean connection extra key on a {@link Connection} which indicates that adding an
* additional call is disallowed.
* @hide
diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java
index 3926e20..c42a835 100644
--- a/telecomm/java/android/telecom/PhoneAccount.java
+++ b/telecomm/java/android/telecom/PhoneAccount.java
@@ -310,6 +310,18 @@
}
/**
+ * Sets the label. See {@link PhoneAccount#getLabel()}.
+ *
+ * @param label The label of the phone account.
+ * @return The builder.
+ * @hide
+ */
+ public Builder setLabel(CharSequence label) {
+ this.mLabel = label;
+ return this;
+ }
+
+ /**
* Sets the address. See {@link PhoneAccount#getAddress}.
*
* @param value The address of the phone account.
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 359dcb1..8bfe413 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -181,6 +181,18 @@
"android.telecom.extra.START_CALL_WITH_VIDEO_STATE";
/**
+ * Optional extra for {@link #addNewIncomingCall(PhoneAccountHandle, Bundle)} containing an
+ * integer that determines the requested video state for an incoming call.
+ * Valid options:
+ * {@link VideoProfile#STATE_AUDIO_ONLY},
+ * {@link VideoProfile#STATE_BIDIRECTIONAL},
+ * {@link VideoProfile#STATE_RX_ENABLED},
+ * {@link VideoProfile#STATE_TX_ENABLED}.
+ */
+ public static final String EXTRA_INCOMING_VIDEO_STATE =
+ "android.telecom.extra.INCOMING_VIDEO_STATE";
+
+ /**
* The extra used with an {@link android.content.Intent#ACTION_CALL} and
* {@link android.content.Intent#ACTION_DIAL} {@code Intent} to specify a
* {@link PhoneAccountHandle} to use when making the call.
@@ -383,7 +395,11 @@
* <p>
* An {@link InCallService} which receives self-managed calls is free to view and control the
* state of calls in the self-managed {@link ConnectionService}. An example use-case is
- * exposing these calls to a wearable or automotive device via its companion app.
+ * exposing these calls to an automotive device via its companion app.
+ * <p>
+ * This meta-data can only be set for an {@link InCallService} which also sets
+ * {@link #METADATA_IN_CALL_SERVICE_UI}. Only the default phone/dialer app, or a car-mode
+ * {@link InCallService} can see self-managed calls.
* <p>
* See also {@link Connection#PROPERTY_SELF_MANAGED}.
*/
@@ -1285,6 +1301,10 @@
* {@link #getPhoneAccount}. Self-managed {@link ConnectionService}s must have
* {@link android.Manifest.permission#MANAGE_OWN_CALLS} to add a new incoming call.
* <p>
+ * The incoming call you are adding is assumed to have a video state of
+ * {@link VideoProfile#STATE_AUDIO_ONLY}, unless the extra value
+ * {@link #EXTRA_INCOMING_VIDEO_STATE} is specified.
+ * <p>
* Once invoked, this method will cause the system to bind to the {@link ConnectionService}
* associated with the {@link PhoneAccountHandle} and request additional information about the
* call (See {@link ConnectionService#onCreateIncomingConnection}) before starting the incoming