summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk2
-rw-r--r--api/current.txt53
-rw-r--r--api/removed.txt25
-rw-r--r--api/system-current.txt103
-rw-r--r--api/system-removed.txt25
-rw-r--r--api/test-current.txt53
-rw-r--r--api/test-removed.txt25
-rw-r--r--core/java/android/app/Activity.java18
-rw-r--r--core/java/android/app/AlarmManager.java26
-rw-r--r--core/java/android/app/Fragment.java52
-rw-r--r--core/java/android/app/FragmentManager.java7
-rw-r--r--core/java/android/app/Notification.java31
-rw-r--r--core/java/android/content/Intent.java4
-rw-r--r--core/java/android/net/metrics/CaptivePortalCheckResultEvent.java64
-rw-r--r--core/java/android/net/metrics/CaptivePortalStateChangeEvent.java68
-rw-r--r--core/java/android/net/metrics/NetworkEvent.java86
-rw-r--r--core/java/android/net/metrics/ValidationProbeEvent.java (renamed from core/java/android/net/metrics/NetworkMonitorEvent.java)43
-rw-r--r--core/java/android/view/DragAndDropPermissions.java (renamed from core/java/android/view/DropPermissions.java)39
-rw-r--r--core/java/android/view/DragEvent.java30
-rw-r--r--core/java/android/view/Window.java7
-rw-r--r--core/java/android/view/WindowManager.java2
-rw-r--r--core/java/android/widget/DateTimeView.java165
-rw-r--r--core/java/android/widget/Editor.java12
-rw-r--r--core/java/android/widget/ProgressBar.java6
-rw-r--r--core/java/android/widget/RemoteViews.java4
-rw-r--r--core/java/android/widget/TextView.java1
-rw-r--r--core/java/com/android/internal/app/LocaleStore.java14
-rw-r--r--core/java/com/android/internal/app/SuggestedLocaleAdapter.java1
-rw-r--r--core/java/com/android/internal/view/IDragAndDropPermissions.aidl (renamed from core/java/com/android/internal/view/IDropPermissions.aidl)2
-rw-r--r--core/java/com/android/internal/view/menu/CascadingMenuPopup.java36
-rw-r--r--core/java/com/android/internal/view/menu/StandardMenuPopup.java12
-rw-r--r--core/res/AndroidManifest.xml4
-rw-r--r--core/res/res/layout/notification_template_header.xml10
-rw-r--r--core/res/res/layout/notification_template_part_time.xml25
-rw-r--r--core/res/res/values/attrs.xml4
-rw-r--r--core/res/res/values/strings.xml43
-rw-r--r--core/res/res/values/symbols.xml11
-rw-r--r--docs/html/training/tv/playback/browse.jd2
-rw-r--r--libs/androidfw/ResourceTypes.cpp2
-rw-r--r--media/java/android/mtp/MtpConstants.java36
-rw-r--r--media/java/android/mtp/MtpDevice.java22
-rw-r--r--media/java/android/mtp/MtpDeviceInfo.java73
-rw-r--r--media/java/android/mtp/MtpEvent.java104
-rw-r--r--media/jni/android_mtp_MtpDevice.cpp6
-rw-r--r--packages/SystemUI/res/values/strings.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java27
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/tv/animations/ViewFocusAnimator.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java38
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigPictureTemplateViewWrapper.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigTextTemplateViewWrapper.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java20
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java51
-rw-r--r--services/core/java/com/android/server/ConnectivityService.java3
-rw-r--r--services/core/java/com/android/server/LockSettingsService.java8
-rw-r--r--services/core/java/com/android/server/NativeDaemonConnector.java25
-rw-r--r--services/core/java/com/android/server/NetworkManagementService.java5
-rw-r--r--services/core/java/com/android/server/accounts/AccountManagerService.java18
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java15
-rw-r--r--services/core/java/com/android/server/am/ActivityStarter.java15
-rw-r--r--services/core/java/com/android/server/am/AppErrors.java14
-rw-r--r--services/core/java/com/android/server/am/BroadcastQueue.java23
-rw-r--r--services/core/java/com/android/server/am/ProcessRecord.java25
-rw-r--r--services/core/java/com/android/server/connectivity/NetworkMonitor.java22
-rw-r--r--services/core/java/com/android/server/connectivity/Tethering.java3
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java9
-rw-r--r--services/core/java/com/android/server/wm/AppTransition.java8
-rw-r--r--services/core/java/com/android/server/wm/AppWindowAnimator.java2
-rw-r--r--services/core/java/com/android/server/wm/AppWindowToken.java8
-rw-r--r--services/core/java/com/android/server/wm/DockedStackDividerController.java5
-rw-r--r--services/core/java/com/android/server/wm/DragAndDropPermissionsHandler.java (renamed from services/core/java/com/android/server/wm/DropPermissionsHandler.java)9
-rw-r--r--services/core/java/com/android/server/wm/DragState.java12
-rw-r--r--services/core/java/com/android/server/wm/Task.java2
-rw-r--r--services/core/java/com/android/server/wm/TaskStack.java13
-rw-r--r--services/core/java/com/android/server/wm/WallpaperController.java4
-rw-r--r--services/core/java/com/android/server/wm/WindowAnimator.java1
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java29
-rw-r--r--services/core/java/com/android/server/wm/WindowStateAnimator.java36
-rw-r--r--services/core/java/com/android/server/wm/WindowSurfacePlacer.java16
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java18
-rw-r--r--services/net/java/android/net/dhcp/DhcpClient.java4
-rw-r--r--services/net/java/android/net/ip/IpManager.java2
90 files changed, 1246 insertions, 698 deletions
diff --git a/Android.mk b/Android.mk
index f875be23a8a9..da53db7c362b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -331,7 +331,7 @@ LOCAL_SRC_FILES += \
core/java/com/android/internal/textservice/ISpellCheckerSessionListener.aidl \
core/java/com/android/internal/textservice/ITextServicesManager.aidl \
core/java/com/android/internal/textservice/ITextServicesSessionListener.aidl \
- core/java/com/android/internal/view/IDropPermissions.aidl \
+ core/java/com/android/internal/view/IDragAndDropPermissions.aidl \
core/java/com/android/internal/view/IInputContext.aidl \
core/java/com/android/internal/view/IInputContextCallback.aidl \
core/java/com/android/internal/view/IInputMethod.aidl \
diff --git a/api/current.txt b/api/current.txt
index 00a2b7a9a1d1..cc3b0852f260 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -3580,7 +3580,7 @@ package android.app {
method public boolean releaseInstance();
method public final deprecated void removeDialog(int);
method public void reportFullyDrawn();
- method public android.view.DropPermissions requestDropPermissions(android.view.DragEvent);
+ method public android.view.DragAndDropPermissions requestDragAndDropPermissions(android.view.DragEvent);
method public final void requestKeyboardShortcutsHelper();
method public final void requestPermissions(java.lang.String[], int);
method public boolean requestVisibleBehind(boolean);
@@ -23243,24 +23243,6 @@ package android.mtp {
ctor public MtpConstants();
method public static boolean isAbstractObject(int);
field public static final int ASSOCIATION_TYPE_GENERIC_FOLDER = 1; // 0x1
- field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
- field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
- field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
- field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
- field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
- field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
- field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
- field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
- field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
- field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
- field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
- field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
- field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
- field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
- field public static final int EVENT_STORE_FULL = 16394; // 0x400a
- field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
- field public static final int EVENT_UNDEFINED = 16384; // 0x4000
- field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
field public static final int FORMAT_3GP_CONTAINER = 47492; // 0xb984
field public static final int FORMAT_AAC = 47363; // 0xb903
field public static final int FORMAT_ABSTRACT_AUDIO_ALBUM = 47619; // 0xba03
@@ -23381,7 +23363,7 @@ package android.mtp {
method public boolean importFile(int, java.lang.String);
method public boolean importFile(int, android.os.ParcelFileDescriptor);
method public boolean open(android.hardware.usb.UsbDeviceConnection);
- method public android.mtp.MtpEvent readEvent(android.os.CancellationSignal);
+ method public android.mtp.MtpEvent readEvent(android.os.CancellationSignal) throws java.io.IOException;
method public boolean sendObject(int, long, android.os.ParcelFileDescriptor);
method public android.mtp.MtpObjectInfo sendObjectInfo(android.mtp.MtpObjectInfo);
}
@@ -23393,10 +23375,11 @@ package android.mtp {
method public final int[] getOperationsSupported();
method public final java.lang.String getSerialNumber();
method public final java.lang.String getVersion();
+ method public boolean isEventSupported(int);
+ method public boolean isOperationSupported(int);
}
public class MtpEvent {
- ctor public MtpEvent();
method public int getDevicePropCode();
method public int getEventCode();
method public int getObjectFormatCode();
@@ -23407,6 +23390,24 @@ package android.mtp {
method public int getParameter3();
method public int getStorageId();
method public int getTransactionId();
+ field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
+ field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
+ field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
+ field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
+ field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
+ field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
+ field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
+ field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
+ field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
+ field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
+ field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
+ field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
+ field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
+ field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
+ field public static final int EVENT_STORE_FULL = 16394; // 0x400a
+ field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
+ field public static final int EVENT_UNDEFINED = 16384; // 0x4000
+ field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
}
public final class MtpObjectInfo {
@@ -40973,6 +40974,10 @@ package android.view {
field public static final android.os.Parcelable.Creator<android.view.Display.Mode> CREATOR;
}
+ public final class DragAndDropPermissions {
+ method public void release();
+ }
+
public class DragEvent implements android.os.Parcelable {
method public int describeContents();
method public int getAction();
@@ -40992,10 +40997,6 @@ package android.view {
field public static final android.os.Parcelable.Creator<android.view.DragEvent> CREATOR;
}
- public final class DropPermissions {
- method public void release();
- }
-
public class FocusFinder {
method public android.view.View findNearestTouchable(android.view.ViewGroup, int, int, int, int[]);
method public final android.view.View findNextFocus(android.view.ViewGroup, android.view.View, int);
@@ -47463,7 +47464,7 @@ package android.widget {
method public void setChar(int, java.lang.String, char);
method public void setCharSequence(int, java.lang.String, java.lang.CharSequence);
method public void setChronometer(int, long, java.lang.String, boolean);
- method public void setChronometerCountsDown(int, boolean);
+ method public void setChronometerCountDown(int, boolean);
method public void setContentDescription(int, java.lang.CharSequence);
method public void setDisplayedChild(int, int);
method public void setDouble(int, java.lang.String, double);
diff --git a/api/removed.txt b/api/removed.txt
index 8c6abdcfb09e..de8a7244d388 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -165,6 +165,31 @@ package android.media.tv {
}
+package android.mtp {
+
+ public final class MtpConstants {
+ field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
+ field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
+ field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
+ field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
+ field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
+ field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
+ field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
+ field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
+ field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
+ field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
+ field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
+ field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
+ field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
+ field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
+ field public static final int EVENT_STORE_FULL = 16394; // 0x400a
+ field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
+ field public static final int EVENT_UNDEFINED = 16384; // 0x4000
+ field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
+ }
+
+}
+
package android.net {
public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
diff --git a/api/system-current.txt b/api/system-current.txt
index f017bb022879..7a7167295e63 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -3699,7 +3699,7 @@ package android.app {
method public boolean releaseInstance();
method public final deprecated void removeDialog(int);
method public void reportFullyDrawn();
- method public android.view.DropPermissions requestDropPermissions(android.view.DragEvent);
+ method public android.view.DragAndDropPermissions requestDragAndDropPermissions(android.view.DragEvent);
method public final void requestKeyboardShortcutsHelper();
method public final void requestPermissions(java.lang.String[], int);
method public boolean requestVisibleBehind(boolean);
@@ -24979,24 +24979,6 @@ package android.mtp {
ctor public MtpConstants();
method public static boolean isAbstractObject(int);
field public static final int ASSOCIATION_TYPE_GENERIC_FOLDER = 1; // 0x1
- field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
- field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
- field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
- field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
- field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
- field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
- field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
- field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
- field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
- field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
- field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
- field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
- field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
- field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
- field public static final int EVENT_STORE_FULL = 16394; // 0x400a
- field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
- field public static final int EVENT_UNDEFINED = 16384; // 0x4000
- field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
field public static final int FORMAT_3GP_CONTAINER = 47492; // 0xb984
field public static final int FORMAT_AAC = 47363; // 0xb903
field public static final int FORMAT_ABSTRACT_AUDIO_ALBUM = 47619; // 0xba03
@@ -25117,7 +25099,7 @@ package android.mtp {
method public boolean importFile(int, java.lang.String);
method public boolean importFile(int, android.os.ParcelFileDescriptor);
method public boolean open(android.hardware.usb.UsbDeviceConnection);
- method public android.mtp.MtpEvent readEvent(android.os.CancellationSignal);
+ method public android.mtp.MtpEvent readEvent(android.os.CancellationSignal) throws java.io.IOException;
method public boolean sendObject(int, long, android.os.ParcelFileDescriptor);
method public android.mtp.MtpObjectInfo sendObjectInfo(android.mtp.MtpObjectInfo);
}
@@ -25129,10 +25111,11 @@ package android.mtp {
method public final int[] getOperationsSupported();
method public final java.lang.String getSerialNumber();
method public final java.lang.String getVersion();
+ method public boolean isEventSupported(int);
+ method public boolean isOperationSupported(int);
}
public class MtpEvent {
- ctor public MtpEvent();
method public int getDevicePropCode();
method public int getEventCode();
method public int getObjectFormatCode();
@@ -25143,6 +25126,24 @@ package android.mtp {
method public int getParameter3();
method public int getStorageId();
method public int getTransactionId();
+ field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
+ field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
+ field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
+ field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
+ field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
+ field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
+ field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
+ field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
+ field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
+ field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
+ field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
+ field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
+ field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
+ field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
+ field public static final int EVENT_STORE_FULL = 16394; // 0x400a
+ field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
+ field public static final int EVENT_UNDEFINED = 16384; // 0x4000
+ field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
}
public final class MtpObjectInfo {
@@ -26011,29 +26012,6 @@ package android.net.http {
package android.net.metrics {
- public final class CaptivePortalCheckResultEvent extends android.net.metrics.IpConnectivityEvent implements android.os.Parcelable {
- method public int describeContents();
- method public static void logEvent(int, int);
- method public void writeToParcel(android.os.Parcel, int);
- field public static final android.os.Parcelable.Creator<android.net.metrics.CaptivePortalCheckResultEvent> CREATOR;
- field public final int netId;
- field public final int result;
- }
-
- public final class CaptivePortalStateChangeEvent extends android.net.metrics.IpConnectivityEvent implements android.os.Parcelable {
- ctor public CaptivePortalStateChangeEvent(int, int);
- ctor public CaptivePortalStateChangeEvent(android.os.Parcel);
- method public int describeContents();
- method public static void logEvent(int, int);
- method public void writeToParcel(android.os.Parcel, int);
- field public static final android.os.Parcelable.Creator<android.net.metrics.CaptivePortalStateChangeEvent> CREATOR;
- field public static final int NETWORK_MONITOR_CONNECTED = 0; // 0x0
- field public static final int NETWORK_MONITOR_DISCONNECTED = 1; // 0x1
- field public static final int NETWORK_MONITOR_VALIDATED = 2; // 0x2
- field public final int netId;
- field public final int state;
- }
-
public final class DefaultNetworkEvent extends android.net.metrics.IpConnectivityEvent implements android.os.Parcelable {
method public int describeContents();
method public static void logEvent(int, int[], int, boolean, boolean);
@@ -26147,16 +26125,35 @@ package android.net.metrics {
field public final java.lang.String ifName;
}
- public final class NetworkMonitorEvent extends android.net.metrics.IpConnectivityEvent implements android.os.Parcelable {
- ctor public NetworkMonitorEvent(android.os.Parcel);
+ public final class NetworkEvent extends android.net.metrics.IpConnectivityEvent implements android.os.Parcelable {
method public int describeContents();
method public static void logCaptivePortalFound(int, long);
- method public static void logPortalProbeEvent(int, long, int);
+ method public static void logEvent(int, int);
method public static void logValidated(int, long);
method public void writeToParcel(android.os.Parcel, int);
- field public static final android.os.Parcelable.Creator<android.net.metrics.NetworkMonitorEvent> CREATOR;
+ field public static final android.os.Parcelable.Creator<android.net.metrics.NetworkEvent> CREATOR;
+ field public static final int NETWORK_CAPTIVE_PORTAL_FOUND = 4; // 0x4
+ field public static final int NETWORK_CONNECTED = 1; // 0x1
+ field public static final int NETWORK_DISCONNECTED = 7; // 0x7
+ field public static final int NETWORK_LINGER = 5; // 0x5
+ field public static final int NETWORK_UNLINGER = 6; // 0x6
+ field public static final int NETWORK_VALIDATED = 2; // 0x2
+ field public static final int NETWORK_VALIDATION_FAILED = 3; // 0x3
field public final long durationMs;
+ field public final int eventType;
field public final int netId;
+ }
+
+ public final class ValidationProbeEvent extends android.net.metrics.IpConnectivityEvent implements android.os.Parcelable {
+ method public int describeContents();
+ method public static void logEvent(int, long, int, int);
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator<android.net.metrics.ValidationProbeEvent> CREATOR;
+ field public static final int PROBE_HTTP = 0; // 0x0
+ field public static final int PROBE_HTTPS = 1; // 0x1
+ field public final long durationMs;
+ field public final int netId;
+ field public final int probeType;
field public final int returnCode;
}
@@ -43924,6 +43921,10 @@ package android.view {
field public static final android.os.Parcelable.Creator<android.view.Display.Mode> CREATOR;
}
+ public final class DragAndDropPermissions {
+ method public void release();
+ }
+
public class DragEvent implements android.os.Parcelable {
method public int describeContents();
method public int getAction();
@@ -43943,10 +43944,6 @@ package android.view {
field public static final android.os.Parcelable.Creator<android.view.DragEvent> CREATOR;
}
- public final class DropPermissions {
- method public void release();
- }
-
public class FocusFinder {
method public android.view.View findNearestTouchable(android.view.ViewGroup, int, int, int, int[]);
method public final android.view.View findNextFocus(android.view.ViewGroup, android.view.View, int);
@@ -50772,7 +50769,7 @@ package android.widget {
method public void setChar(int, java.lang.String, char);
method public void setCharSequence(int, java.lang.String, java.lang.CharSequence);
method public void setChronometer(int, long, java.lang.String, boolean);
- method public void setChronometerCountsDown(int, boolean);
+ method public void setChronometerCountDown(int, boolean);
method public void setContentDescription(int, java.lang.CharSequence);
method public void setDisplayedChild(int, int);
method public void setDouble(int, java.lang.String, double);
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 95734c111afb..844604ce1510 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -163,6 +163,31 @@ package android.media.tv {
}
+package android.mtp {
+
+ public final class MtpConstants {
+ field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
+ field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
+ field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
+ field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
+ field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
+ field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
+ field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
+ field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
+ field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
+ field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
+ field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
+ field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
+ field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
+ field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
+ field public static final int EVENT_STORE_FULL = 16394; // 0x400a
+ field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
+ field public static final int EVENT_UNDEFINED = 16384; // 0x4000
+ field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
+ }
+
+}
+
package android.net {
public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
diff --git a/api/test-current.txt b/api/test-current.txt
index d5ecfd11fda2..39d69f3011f3 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -3580,7 +3580,7 @@ package android.app {
method public boolean releaseInstance();
method public final deprecated void removeDialog(int);
method public void reportFullyDrawn();
- method public android.view.DropPermissions requestDropPermissions(android.view.DragEvent);
+ method public android.view.DragAndDropPermissions requestDragAndDropPermissions(android.view.DragEvent);
method public final void requestKeyboardShortcutsHelper();
method public final void requestPermissions(java.lang.String[], int);
method public boolean requestVisibleBehind(boolean);
@@ -23311,24 +23311,6 @@ package android.mtp {
ctor public MtpConstants();
method public static boolean isAbstractObject(int);
field public static final int ASSOCIATION_TYPE_GENERIC_FOLDER = 1; // 0x1
- field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
- field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
- field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
- field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
- field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
- field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
- field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
- field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
- field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
- field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
- field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
- field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
- field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
- field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
- field public static final int EVENT_STORE_FULL = 16394; // 0x400a
- field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
- field public static final int EVENT_UNDEFINED = 16384; // 0x4000
- field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
field public static final int FORMAT_3GP_CONTAINER = 47492; // 0xb984
field public static final int FORMAT_AAC = 47363; // 0xb903
field public static final int FORMAT_ABSTRACT_AUDIO_ALBUM = 47619; // 0xba03
@@ -23449,7 +23431,7 @@ package android.mtp {
method public boolean importFile(int, java.lang.String);
method public boolean importFile(int, android.os.ParcelFileDescriptor);
method public boolean open(android.hardware.usb.UsbDeviceConnection);
- method public android.mtp.MtpEvent readEvent(android.os.CancellationSignal);
+ method public android.mtp.MtpEvent readEvent(android.os.CancellationSignal) throws java.io.IOException;
method public boolean sendObject(int, long, android.os.ParcelFileDescriptor);
method public android.mtp.MtpObjectInfo sendObjectInfo(android.mtp.MtpObjectInfo);
}
@@ -23461,10 +23443,11 @@ package android.mtp {
method public final int[] getOperationsSupported();
method public final java.lang.String getSerialNumber();
method public final java.lang.String getVersion();
+ method public boolean isEventSupported(int);
+ method public boolean isOperationSupported(int);
}
public class MtpEvent {
- ctor public MtpEvent();
method public int getDevicePropCode();
method public int getEventCode();
method public int getObjectFormatCode();
@@ -23475,6 +23458,24 @@ package android.mtp {
method public int getParameter3();
method public int getStorageId();
method public int getTransactionId();
+ field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
+ field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
+ field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
+ field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
+ field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
+ field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
+ field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
+ field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
+ field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
+ field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
+ field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
+ field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
+ field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
+ field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
+ field public static final int EVENT_STORE_FULL = 16394; // 0x400a
+ field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
+ field public static final int EVENT_UNDEFINED = 16384; // 0x4000
+ field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
}
public final class MtpObjectInfo {
@@ -41050,6 +41051,10 @@ package android.view {
field public static final android.os.Parcelable.Creator<android.view.Display.Mode> CREATOR;
}
+ public final class DragAndDropPermissions {
+ method public void release();
+ }
+
public class DragEvent implements android.os.Parcelable {
method public int describeContents();
method public int getAction();
@@ -41069,10 +41074,6 @@ package android.view {
field public static final android.os.Parcelable.Creator<android.view.DragEvent> CREATOR;
}
- public final class DropPermissions {
- method public void release();
- }
-
public class FocusFinder {
method public android.view.View findNearestTouchable(android.view.ViewGroup, int, int, int, int[]);
method public final android.view.View findNextFocus(android.view.ViewGroup, android.view.View, int);
@@ -47540,7 +47541,7 @@ package android.widget {
method public void setChar(int, java.lang.String, char);
method public void setCharSequence(int, java.lang.String, java.lang.CharSequence);
method public void setChronometer(int, long, java.lang.String, boolean);
- method public void setChronometerCountsDown(int, boolean);
+ method public void setChronometerCountDown(int, boolean);
method public void setContentDescription(int, java.lang.CharSequence);
method public void setDisplayedChild(int, int);
method public void setDouble(int, java.lang.String, double);
diff --git a/api/test-removed.txt b/api/test-removed.txt
index 8c6abdcfb09e..de8a7244d388 100644
--- a/api/test-removed.txt
+++ b/api/test-removed.txt
@@ -165,6 +165,31 @@ package android.media.tv {
}
+package android.mtp {
+
+ public final class MtpConstants {
+ field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
+ field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
+ field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
+ field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
+ field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
+ field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
+ field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
+ field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
+ field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
+ field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
+ field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
+ field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
+ field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
+ field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
+ field public static final int EVENT_STORE_FULL = 16394; // 0x400a
+ field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
+ field public static final int EVENT_UNDEFINED = 16384; // 0x4000
+ field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
+ }
+
+}
+
package android.net {
public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 9bd648fd2d21..5ea39030926f 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -85,8 +85,8 @@ import android.view.ActionMode;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextThemeWrapper;
+import android.view.DragAndDropPermissions;
import android.view.DragEvent;
-import android.view.DropPermissions;
import android.view.InputDevice;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
@@ -6505,16 +6505,16 @@ public class Activity extends ContextThemeWrapper
}
/**
- * Create {@link DropPermissions} object bound to this activity and controlling the access
- * permissions for content URIs associated with the {@link DragEvent}.
+ * Create {@link DragAndDropPermissions} object bound to this activity and controlling the
+ * access permissions for content URIs associated with the {@link DragEvent}.
* @param event Drag event
- * @return The DropPermissions object used to control access to the content URIs. Null if
- * no content URIs are associated with the event or if permissions could not be granted.
+ * @return The {@link DragAndDropPermissions} object used to control access to the content URIs.
+ * Null if no content URIs are associated with the event or if permissions could not be granted.
*/
- public DropPermissions requestDropPermissions(DragEvent event) {
- DropPermissions dropPermissions = DropPermissions.obtain(event);
- if (dropPermissions != null && dropPermissions.take(getActivityToken())) {
- return dropPermissions;
+ public DragAndDropPermissions requestDragAndDropPermissions(DragEvent event) {
+ DragAndDropPermissions dragAndDropPermissions = DragAndDropPermissions.obtain(event);
+ if (dragAndDropPermissions != null && dragAndDropPermissions.take(getActivityToken())) {
+ return dragAndDropPermissions;
}
return null;
}
diff --git a/core/java/android/app/AlarmManager.java b/core/java/android/app/AlarmManager.java
index e4fff9dc8a8c..02dcc5c7e3bd 100644
--- a/core/java/android/app/AlarmManager.java
+++ b/core/java/android/app/AlarmManager.java
@@ -33,7 +33,6 @@ import android.util.Log;
import libcore.util.ZoneInfoDB;
import java.io.IOException;
-import java.lang.ref.WeakReference;
import java.util.WeakHashMap;
/**
@@ -245,12 +244,7 @@ public class AlarmManager {
// Tracking of the OnAlarmListener -> wrapper mapping, for cancel() support.
// Access is synchronized on the AlarmManager class object.
- //
- // These are weak references so that we don't leak listener references if, for
- // example, the pending-alarm messages are posted to a HandlerThread that is
- // disposed of prior to alarm delivery. The underlying messages will be GC'd
- // but this static reference would still persist, orphaned, never deallocated.
- private static WeakHashMap<OnAlarmListener, WeakReference<ListenerWrapper>> sWrappers;
+ private static WeakHashMap<OnAlarmListener, ListenerWrapper> sWrappers;
/**
* package private on purpose
@@ -637,16 +631,14 @@ public class AlarmManager {
if (listener != null) {
synchronized (AlarmManager.class) {
if (sWrappers == null) {
- sWrappers = new WeakHashMap<OnAlarmListener, WeakReference<ListenerWrapper>>();
+ sWrappers = new WeakHashMap<OnAlarmListener, ListenerWrapper>();
}
- WeakReference<ListenerWrapper> wrapperRef = sWrappers.get(listener);
- // no existing wrapper *or* we've lost our weak ref to it => build a new one
- if (wrapperRef == null ||
- (recipientWrapper = wrapperRef.get()) == null) {
+ recipientWrapper = sWrappers.get(listener);
+ // no existing wrapper => build a new one
+ if (recipientWrapper == null) {
recipientWrapper = new ListenerWrapper(listener);
- wrapperRef = new WeakReference<ListenerWrapper>(recipientWrapper);
- sWrappers.put(listener, wrapperRef);
+ sWrappers.put(listener, recipientWrapper);
}
}
@@ -906,11 +898,7 @@ public class AlarmManager {
ListenerWrapper wrapper = null;
synchronized (AlarmManager.class) {
if (sWrappers != null) {
- final WeakReference<ListenerWrapper> wrapperRef;
- wrapperRef = sWrappers.get(listener);
- if (wrapperRef != null) {
- wrapper = wrapperRef.get();
- }
+ wrapper = sWrappers.get(listener);
}
}
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index a221c985428e..f4fe1eb1cc6e 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -17,6 +17,7 @@
package android.app;
import android.animation.Animator;
+import android.annotation.CallSuper;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.StringRes;
@@ -1335,6 +1336,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* @deprecated Use {@link #onInflate(Context, AttributeSet, Bundle)} instead.
*/
@Deprecated
+ @CallSuper
public void onInflate(AttributeSet attrs, Bundle savedInstanceState) {
mCalled = true;
}
@@ -1381,6 +1383,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* @param savedInstanceState If the fragment is being re-created from
* a previous saved state, this is the state.
*/
+ @CallSuper
public void onInflate(Context context, AttributeSet attrs, Bundle savedInstanceState) {
onInflate(attrs, savedInstanceState);
mCalled = true;
@@ -1421,6 +1424,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* @deprecated Use {@link #onInflate(Context, AttributeSet, Bundle)} instead.
*/
@Deprecated
+ @CallSuper
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
mCalled = true;
}
@@ -1429,6 +1433,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* Called when a fragment is first attached to its context.
* {@link #onCreate(Bundle)} will be called after this.
*/
+ @CallSuper
public void onAttach(Context context) {
mCalled = true;
final Activity hostActivity = mHost == null ? null : mHost.getActivity();
@@ -1442,6 +1447,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* @deprecated Use {@link #onAttach(Context)} instead.
*/
@Deprecated
+ @CallSuper
public void onAttach(Activity activity) {
mCalled = true;
}
@@ -1473,6 +1479,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* @param savedInstanceState If the fragment is being re-created from
* a previous saved state, this is the state.
*/
+ @CallSuper
public void onCreate(@Nullable Bundle savedInstanceState) {
mCalled = true;
final Context context = getContext();
@@ -1558,6 +1565,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* @param savedInstanceState If the fragment is being re-created from
* a previous saved state, this is the state.
*/
+ @CallSuper
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
mCalled = true;
}
@@ -1573,6 +1581,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* @param savedInstanceState If the fragment is being re-created from
* a previous saved state, this is the state.
*/
+ @CallSuper
public void onViewStateRestored(Bundle savedInstanceState) {
mCalled = true;
}
@@ -1582,6 +1591,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* tied to {@link Activity#onStart() Activity.onStart} of the containing
* Activity's lifecycle.
*/
+ @CallSuper
public void onStart() {
mCalled = true;
@@ -1603,6 +1613,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* tied to {@link Activity#onResume() Activity.onResume} of the containing
* Activity's lifecycle.
*/
+ @CallSuper
public void onResume() {
mCalled = true;
}
@@ -1648,6 +1659,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
}
+ @CallSuper
public void onConfigurationChanged(Configuration newConfig) {
mCalled = true;
}
@@ -1657,6 +1669,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* tied to {@link Activity#onPause() Activity.onPause} of the containing
* Activity's lifecycle.
*/
+ @CallSuper
public void onPause() {
mCalled = true;
}
@@ -1666,14 +1679,17 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* tied to {@link Activity#onStop() Activity.onStop} of the containing
* Activity's lifecycle.
*/
+ @CallSuper
public void onStop() {
mCalled = true;
}
+ @CallSuper
public void onLowMemory() {
mCalled = true;
}
+ @CallSuper
public void onTrimMemory(int level) {
mCalled = true;
}
@@ -1687,6 +1703,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* non-null view. Internally it is called after the view's state has
* been saved but before it has been removed from its parent.
*/
+ @CallSuper
public void onDestroyView() {
mCalled = true;
}
@@ -1695,6 +1712,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* Called when the fragment is no longer in use. This is called
* after {@link #onStop()} and before {@link #onDetach()}.
*/
+ @CallSuper
public void onDestroy() {
mCalled = true;
//Log.v("foo", "onDestroy: mCheckedForLoaderManager=" + mCheckedForLoaderManager
@@ -1743,20 +1761,9 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
* Activity re-creation (see {@link #setRetainInstance(boolean)}), in which case it is called
* after {@link #onStop()}.
*/
+ @CallSuper
public void onDetach() {
mCalled = true;
-
- // Destroy the child FragmentManager if we still have it here.
- // We won't unless we're retaining our instance and if we do,
- // our child FragmentManager instance state will have already been saved.
- if (mChildFragmentManager != null) {
- if (!mRetaining) {
- throw new IllegalStateException("Child FragmentManager of " + this + " was not "
- + " destroyed and this fragment is not retaining instance");
- }
- mChildFragmentManager.dispatchDestroy();
- mChildFragmentManager = null;
- }
}
/**
@@ -2568,6 +2575,27 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
mChildFragmentManager = null;
}
+ void performDetach() {
+ mCalled = false;
+ onDetach();
+ if (!mCalled) {
+ throw new SuperNotCalledException("Fragment " + this
+ + " did not call through to super.onDetach()");
+ }
+
+ // Destroy the child FragmentManager if we still have it here.
+ // We won't unless we're retaining our instance and if we do,
+ // our child FragmentManager instance state will have already been saved.
+ if (mChildFragmentManager != null) {
+ if (!mRetaining) {
+ throw new IllegalStateException("Child FragmentManager of " + this + " was not "
+ + " destroyed and this fragment is not retaining instance");
+ }
+ mChildFragmentManager.dispatchDestroy();
+ mChildFragmentManager = null;
+ }
+ }
+
private static Transition loadTransition(Context context, TypedArray typedArray,
Transition currentValue, Transition defaultValue, int id) {
if (currentValue != defaultValue) {
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index b1dda7f2a3fd..d79538558b9a 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -1117,12 +1117,7 @@ final class FragmentManagerImpl extends FragmentManager implements LayoutInflate
f.mState = Fragment.INITIALIZING;
}
- f.mCalled = false;
- f.onDetach();
- if (!f.mCalled) {
- throw new SuperNotCalledException("Fragment " + f
- + " did not call through to super.onDetach()");
- }
+ f.performDetach();
if (!keepActive) {
if (!f.mRetaining) {
makeInactive(f);
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 400a313979d8..39f8e190aeab 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -25,7 +25,6 @@ import android.annotation.SystemApi;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.ColorStateList;
@@ -186,6 +185,11 @@ public class Notification implements Parcelable
public long when;
/**
+ * The creation time of the notification
+ */
+ private long creationTime;
+
+ /**
* The resource id of a drawable to use as the icon in the status bar.
*
* @deprecated Use {@link Builder#setSmallIcon(Icon)} instead.
@@ -1480,6 +1484,7 @@ public class Notification implements Parcelable
public Notification()
{
this.when = System.currentTimeMillis();
+ this.creationTime = System.currentTimeMillis();
this.priority = PRIORITY_DEFAULT;
}
@@ -1517,6 +1522,7 @@ public class Notification implements Parcelable
this.icon = icon;
this.tickerText = tickerText;
this.when = when;
+ this.creationTime = System.currentTimeMillis();
}
/**
@@ -1527,6 +1533,7 @@ public class Notification implements Parcelable
int version = parcel.readInt();
when = parcel.readLong();
+ creationTime = parcel.readLong();
if (parcel.readInt() != 0) {
mSmallIcon = Icon.CREATOR.createFromParcel(parcel);
if (mSmallIcon.getType() == Icon.TYPE_RESOURCE) {
@@ -1615,6 +1622,7 @@ public class Notification implements Parcelable
*/
public void cloneInto(Notification that, boolean heavy) {
that.when = this.when;
+ that.creationTime = this.creationTime;
that.mSmallIcon = this.mSmallIcon;
that.number = this.number;
@@ -1795,6 +1803,7 @@ public class Notification implements Parcelable
parcel.writeInt(1);
parcel.writeLong(when);
+ parcel.writeLong(creationTime);
if (mSmallIcon == null && icon != 0) {
// you snuck an icon in here without using the builder; let's try to keep it
mSmallIcon = Icon.createWithResource("", icon);
@@ -3130,6 +3139,7 @@ public class Notification implements Parcelable
contentView.setViewVisibility(R.id.header_text, View.GONE);
contentView.setViewVisibility(R.id.header_text_divider, View.GONE);
contentView.setViewVisibility(R.id.time_divider, View.GONE);
+ contentView.setViewVisibility(R.id.time, View.GONE);
contentView.setImageViewIcon(R.id.profile_badge, null);
contentView.setViewVisibility(R.id.profile_badge, View.GONE);
}
@@ -3260,11 +3270,15 @@ public class Notification implements Parcelable
mN.when + (SystemClock.elapsedRealtime() - System.currentTimeMillis()));
contentView.setBoolean(R.id.chronometer, "setStarted", true);
boolean countsDown = mN.extras.getBoolean(EXTRA_CHRONOMETER_COUNTS_DOWN);
- contentView.setChronometerCountsDown(R.id.chronometer, countsDown);
+ contentView.setChronometerCountDown(R.id.chronometer, countsDown);
} else {
contentView.setViewVisibility(R.id.time, View.VISIBLE);
contentView.setLong(R.id.time, "setTime", mN.when);
}
+ } else {
+ // We still want a time to be set but gone, such that we can show and hide it
+ // on demand in case it's a child notification without anything in the header
+ contentView.setLong(R.id.time, "setTime", mN.when != 0 ? mN.when : mN.creationTime);
}
}
@@ -3332,7 +3346,7 @@ public class Notification implements Parcelable
* otherwise
*/
private boolean showsTimeOrChronometer() {
- return mN.when != 0 && mN.extras.getBoolean(EXTRA_SHOW_WHEN);
+ return mN.showsTimeOrChronometer();
}
private void resetStandardTemplateWithActions(RemoteViews big) {
@@ -3694,6 +3708,8 @@ public class Notification implements Parcelable
mN.extras = getAllExtras();
}
+ mN.creationTime = System.currentTimeMillis();
+
// lazy stuff from mContext; see comment in Builder(Context, Notification)
Notification.addFieldsFromContext(mContext, mN);
@@ -3827,6 +3843,15 @@ public class Notification implements Parcelable
}
/**
+ * @return true if the notification will show the time or the chronometer; false
+ * otherwise
+ * @hide
+ */
+ public boolean showsTimeOrChronometer() {
+ return when != 0 && extras.getBoolean(EXTRA_SHOW_WHEN);
+ }
+
+ /**
* An object that can apply a rich notification style to a {@link Notification.Builder}
* object.
*/
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 996ccba3c1b7..c8bf4d65418c 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -3078,10 +3078,6 @@ public class Intent implements Parcelable, Cloneable {
public static final String ACTION_MANAGED_PROFILE_UNLOCKED =
"android.intent.action.MANAGED_PROFILE_UNLOCKED";
- /** @hide */
- public static final String ACTION_MANAGED_PROFILE_AVAILABILITY_CHANGED =
- "android.intent.action.MANAGED_PROFILE_AVAILABILITY_CHANGED";
-
/**
* Broadcast sent to the primary user when an associated managed profile has become available.
* Currently this includes when the user disables quiet mode for the profile. Carries an extra
diff --git a/core/java/android/net/metrics/CaptivePortalCheckResultEvent.java b/core/java/android/net/metrics/CaptivePortalCheckResultEvent.java
deleted file mode 100644
index 02ab63e4959c..000000000000
--- a/core/java/android/net/metrics/CaptivePortalCheckResultEvent.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net.metrics;
-
-import android.annotation.SystemApi;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * {@hide}
- */
-@SystemApi
-public final class CaptivePortalCheckResultEvent extends IpConnectivityEvent implements Parcelable {
- public final int netId;
- public final int result;
-
- private CaptivePortalCheckResultEvent(int netId, int result) {
- this.netId = netId;
- this.result = result;
- }
-
- private CaptivePortalCheckResultEvent(Parcel in) {
- this.netId = in.readInt();
- this.result = in.readInt();
- }
-
- public void writeToParcel(Parcel out, int flags) {
- out.writeInt(netId);
- out.writeInt(result);
- }
-
- public int describeContents() {
- return 0;
- }
-
- public static final Parcelable.Creator<CaptivePortalCheckResultEvent> CREATOR
- = new Parcelable.Creator<CaptivePortalCheckResultEvent>() {
- public CaptivePortalCheckResultEvent createFromParcel(Parcel in) {
- return new CaptivePortalCheckResultEvent(in);
- }
-
- public CaptivePortalCheckResultEvent[] newArray(int size) {
- return new CaptivePortalCheckResultEvent[size];
- }
- };
-
- public static void logEvent(int netId, int result) {
- logEvent(IPCE_NETMON_CHECK_RESULT, new CaptivePortalCheckResultEvent(netId, result));
- }
-};
diff --git a/core/java/android/net/metrics/CaptivePortalStateChangeEvent.java b/core/java/android/net/metrics/CaptivePortalStateChangeEvent.java
deleted file mode 100644
index a67589af2563..000000000000
--- a/core/java/android/net/metrics/CaptivePortalStateChangeEvent.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net.metrics;
-
-import android.annotation.SystemApi;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * {@hide}
- */
-@SystemApi
-public final class CaptivePortalStateChangeEvent extends IpConnectivityEvent implements Parcelable {
- public static final int NETWORK_MONITOR_CONNECTED = 0;
- public static final int NETWORK_MONITOR_DISCONNECTED = 1;
- public static final int NETWORK_MONITOR_VALIDATED = 2;
-
- public final int netId;
- public final int state;
-
- public CaptivePortalStateChangeEvent(int netId, int state) {
- this.netId = netId;
- this.state = state;
- }
-
- public CaptivePortalStateChangeEvent(Parcel in) {
- netId = in.readInt();
- state = in.readInt();
- }
-
- public void writeToParcel(Parcel out, int flags) {
- out.writeInt(netId);
- out.writeInt(state);
- }
-
- public int describeContents() {
- return 0;
- }
-
- public static final Parcelable.Creator<CaptivePortalStateChangeEvent> CREATOR
- = new Parcelable.Creator<CaptivePortalStateChangeEvent>() {
- public CaptivePortalStateChangeEvent createFromParcel(Parcel in) {
- return new CaptivePortalStateChangeEvent(in);
- }
-
- public CaptivePortalStateChangeEvent[] newArray(int size) {
- return new CaptivePortalStateChangeEvent[size];
- }
- };
-
- public static void logEvent(int netId, int state) {
- logEvent(IPCE_NETMON_STATE_CHANGE, new CaptivePortalStateChangeEvent(netId, state));
- }
-};
diff --git a/core/java/android/net/metrics/NetworkEvent.java b/core/java/android/net/metrics/NetworkEvent.java
new file mode 100644
index 000000000000..b15dcee62a81
--- /dev/null
+++ b/core/java/android/net/metrics/NetworkEvent.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.metrics;
+
+import android.annotation.SystemApi;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * {@hide}
+ */
+@SystemApi
+public final class NetworkEvent extends IpConnectivityEvent implements Parcelable {
+
+ public static final int NETWORK_CONNECTED = 1;
+ public static final int NETWORK_VALIDATED = 2;
+ public static final int NETWORK_VALIDATION_FAILED = 3;
+ public static final int NETWORK_CAPTIVE_PORTAL_FOUND = 4;
+ public static final int NETWORK_LINGER = 5;
+ public static final int NETWORK_UNLINGER = 6;
+ public static final int NETWORK_DISCONNECTED = 7;
+
+ public final int netId;
+ public final int eventType;
+ public final long durationMs;
+
+ private NetworkEvent(int netId, int eventType, long durationMs) {
+ this.netId = netId;
+ this.eventType = eventType;
+ this.durationMs = durationMs;
+ }
+
+ private NetworkEvent(Parcel in) {
+ netId = in.readInt();
+ eventType = in.readInt();
+ durationMs = in.readLong();
+ }
+
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeInt(netId);
+ out.writeInt(eventType);
+ out.writeLong(durationMs);
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public static final Parcelable.Creator<NetworkEvent> CREATOR
+ = new Parcelable.Creator<NetworkEvent>() {
+ public NetworkEvent createFromParcel(Parcel in) {
+ return new NetworkEvent(in);
+ }
+
+ public NetworkEvent[] newArray(int size) {
+ return new NetworkEvent[size];
+ }
+ };
+
+ public static void logEvent(int netId, int eventType) {
+ logEvent(IPCE_NETMON_STATE_CHANGE, new NetworkEvent(netId, eventType, 0));
+ }
+
+ public static void logValidated(int netId, long durationMs) {
+ logEvent(IPCE_NETMON_VALIDATED, new NetworkEvent(netId, NETWORK_VALIDATED, durationMs));
+ }
+
+ public static void logCaptivePortalFound(int netId, long durationMs) {
+ final NetworkEvent ev = new NetworkEvent(netId, NETWORK_CAPTIVE_PORTAL_FOUND, durationMs);
+ logEvent(IPCE_NETMON_CAPPORT_FOUND, ev);
+ }
+};
diff --git a/core/java/android/net/metrics/NetworkMonitorEvent.java b/core/java/android/net/metrics/ValidationProbeEvent.java
index 23712661b9d5..0a524c69fb67 100644
--- a/core/java/android/net/metrics/NetworkMonitorEvent.java
+++ b/core/java/android/net/metrics/ValidationProbeEvent.java
@@ -24,26 +24,34 @@ import android.os.Parcelable;
* {@hide}
*/
@SystemApi
-public final class NetworkMonitorEvent extends IpConnectivityEvent implements Parcelable {
+public final class ValidationProbeEvent extends IpConnectivityEvent implements Parcelable {
+
+ public static final int PROBE_HTTP = 0;
+ public static final int PROBE_HTTPS = 1;
+
public final int netId;
public final long durationMs;
+ public final int probeType;
public final int returnCode;
- private NetworkMonitorEvent(int netId, long durationMs, int returnCode) {
+ private ValidationProbeEvent(int netId, long durationMs, int probeType, int returnCode) {
this.netId = netId;
this.durationMs = durationMs;
+ this.probeType = probeType;
this.returnCode = returnCode;
}
- public NetworkMonitorEvent(Parcel in) {
+ private ValidationProbeEvent(Parcel in) {
netId = in.readInt();
durationMs = in.readLong();
+ probeType = in.readInt();
returnCode = in.readInt();
}
public void writeToParcel(Parcel out, int flags) {
out.writeInt(netId);
out.writeLong(durationMs);
+ out.writeInt(probeType);
out.writeInt(returnCode);
}
@@ -51,30 +59,19 @@ public final class NetworkMonitorEvent extends IpConnectivityEvent implements Pa
return 0;
}
- public static final Parcelable.Creator<NetworkMonitorEvent> CREATOR
- = new Parcelable.Creator<NetworkMonitorEvent>() {
- public NetworkMonitorEvent createFromParcel(Parcel in) {
- return new NetworkMonitorEvent(in);
+ public static final Parcelable.Creator<ValidationProbeEvent> CREATOR
+ = new Parcelable.Creator<ValidationProbeEvent>() {
+ public ValidationProbeEvent createFromParcel(Parcel in) {
+ return new ValidationProbeEvent(in);
}
- public NetworkMonitorEvent[] newArray(int size) {
- return new NetworkMonitorEvent[size];
+ public ValidationProbeEvent[] newArray(int size) {
+ return new ValidationProbeEvent[size];
}
};
- private static void logEvent(int eventType, int netId, long durationMs, int returnCode) {
- logEvent(eventType, new NetworkMonitorEvent(netId, durationMs, returnCode));
- }
-
- public static void logValidated(int netId, long durationMs) {
- logEvent(IPCE_NETMON_VALIDATED, netId, durationMs, 0);
- }
-
- public static void logPortalProbeEvent(int netId, long durationMs, int returnCode) {
- logEvent(IPCE_NETMON_PORTAL_PROBE, netId, durationMs, returnCode);
- }
-
- public static void logCaptivePortalFound(int netId, long durationMs) {
- logEvent(IPCE_NETMON_CAPPORT_FOUND, netId, durationMs, 0);
+ public static void logEvent(int netId, long durationMs, int probeType, int returnCode) {
+ logEvent(IPCE_NETMON_PORTAL_PROBE,
+ new ValidationProbeEvent(netId, durationMs, probeType, returnCode));
}
};
diff --git a/core/java/android/view/DropPermissions.java b/core/java/android/view/DragAndDropPermissions.java
index 5411dad3284a..a3dbdb16197d 100644
--- a/core/java/android/view/DropPermissions.java
+++ b/core/java/android/view/DragAndDropPermissions.java
@@ -19,51 +19,52 @@ package android.view;
import android.app.ActivityManagerNative;
import android.os.IBinder;
import android.os.RemoteException;
-import com.android.internal.view.IDropPermissions;
+import com.android.internal.view.IDragAndDropPermissions;
import dalvik.system.CloseGuard;
/**
- * {@link DropPermissions} controls the access permissions for the content URIs associated with a
- * {@link DragEvent}.
+ * {@link DragAndDropPermissions} controls the access permissions for the content URIs associated
+ * with a {@link DragEvent}.
* <p>
* Permission are granted when this object is created by {@link
- * android.app.Activity#requestDropPermissions(DragEvent) Activity.requestDropPermissions}.
+ * android.app.Activity#requestDragAndDropPermissions(DragEvent)
+ * Activity.requestDragAndDropPermissions}.
* Which permissions are granted is defined by the set of flags passed to {@link
* View#startDragAndDrop(android.content.ClipData, View.DragShadowBuilder, Object, int)
* View.startDragAndDrop} by the app that started the drag operation.
* <p>
* The life cycle of the permissions is bound to the activity used to call {@link
- * android.app.Activity#requestDropPermissions(DragEvent) requestDropPermissions}. The
+ * android.app.Activity#requestDragAndDropPermissions(DragEvent) requestDragAndDropPermissions}. The
* permissions are revoked when this activity is destroyed, or when {@link #release()} is called,
* whichever occurs first.
*/
-public final class DropPermissions {
+public final class DragAndDropPermissions {
- private final IDropPermissions mDropPermissions;
+ private final IDragAndDropPermissions mDragAndDropPermissions;
private IBinder mPermissionOwnerToken;
private final CloseGuard mCloseGuard = CloseGuard.get();
/**
- * Create a new {@link DropPermissions} object to control the access permissions for content
- * URIs associated with {@link DragEvent}.
+ * Create a new {@link DragAndDropPermissions} object to control the access permissions for
+ * content URIs associated with {@link DragEvent}.
* @param dragEvent Drag event
- * @return {@link DropPermissions} object or null if there are no content URIs associated with
- * the {@link DragEvent}.
+ * @return {@link DragAndDropPermissions} object or null if there are no content URIs associated
+ * with the {@link DragEvent}.
* @hide
*/
- public static DropPermissions obtain(DragEvent dragEvent) {
- if (dragEvent.getDropPermissions() == null) {
+ public static DragAndDropPermissions obtain(DragEvent dragEvent) {
+ if (dragEvent.getDragAndDropPermissions() == null) {
return null;
}
- return new DropPermissions(dragEvent.getDropPermissions());
+ return new DragAndDropPermissions(dragEvent.getDragAndDropPermissions());
}
/** @hide */
- private DropPermissions(IDropPermissions dropPermissions) {
- mDropPermissions = dropPermissions;
+ private DragAndDropPermissions(IDragAndDropPermissions dragAndDropPermissions) {
+ mDragAndDropPermissions = dragAndDropPermissions;
}
/**
@@ -74,7 +75,7 @@ public final class DropPermissions {
*/
public boolean take(IBinder activityToken) {
try {
- mDropPermissions.take(activityToken);
+ mDragAndDropPermissions.take(activityToken);
} catch (RemoteException e) {
return false;
}
@@ -91,7 +92,7 @@ public final class DropPermissions {
try {
mPermissionOwnerToken = ActivityManagerNative.getDefault().
newUriPermissionOwner("drop");
- mDropPermissions.takeTransient(mPermissionOwnerToken);
+ mDragAndDropPermissions.takeTransient(mPermissionOwnerToken);
} catch (RemoteException e) {
return false;
}
@@ -104,7 +105,7 @@ public final class DropPermissions {
*/
public void release() {
try {
- mDropPermissions.release();
+ mDragAndDropPermissions.release();
mPermissionOwnerToken = null;
} catch (RemoteException e) {
}
diff --git a/core/java/android/view/DragEvent.java b/core/java/android/view/DragEvent.java
index 71db0b51b0bf..0dfbe7060039 100644
--- a/core/java/android/view/DragEvent.java
+++ b/core/java/android/view/DragEvent.java
@@ -21,7 +21,7 @@ import android.content.ClipDescription;
import android.os.Parcel;
import android.os.Parcelable;
-import com.android.internal.view.IDropPermissions;
+import com.android.internal.view.IDragAndDropPermissions;
//TODO: Improve Javadoc
/**
@@ -130,7 +130,7 @@ public class DragEvent implements Parcelable {
float mX, mY;
ClipDescription mClipDescription;
ClipData mClipData;
- IDropPermissions mDropPermissions;
+ IDragAndDropPermissions mDragAndDropPermissions;
Object mLocalState;
boolean mDragResult;
@@ -257,13 +257,13 @@ public class DragEvent implements Parcelable {
}
private void init(int action, float x, float y, ClipDescription description, ClipData data,
- IDropPermissions dropPermissions, Object localState, boolean result) {
+ IDragAndDropPermissions dragAndDropPermissions, Object localState, boolean result) {
mAction = action;
mX = x;
mY = y;
mClipDescription = description;
mClipData = data;
- mDropPermissions = dropPermissions;
+ this.mDragAndDropPermissions = dragAndDropPermissions;
mLocalState = localState;
mDragResult = result;
}
@@ -274,13 +274,14 @@ public class DragEvent implements Parcelable {
/** @hide */
public static DragEvent obtain(int action, float x, float y, Object localState,
- ClipDescription description, ClipData data, IDropPermissions dropPermissions,
- boolean result) {
+ ClipDescription description, ClipData data,
+ IDragAndDropPermissions dragAndDropPermissions, boolean result) {
final DragEvent ev;
synchronized (gRecyclerLock) {
if (gRecyclerTop == null) {
ev = new DragEvent();
- ev.init(action, x, y, description, data, dropPermissions, localState, result);
+ ev.init(action, x, y, description, data, dragAndDropPermissions, localState,
+ result);
return ev;
}
ev = gRecyclerTop;
@@ -291,7 +292,7 @@ public class DragEvent implements Parcelable {
ev.mRecycled = false;
ev.mNext = null;
- ev.init(action, x, y, description, data, dropPermissions, localState, result);
+ ev.init(action, x, y, description, data, dragAndDropPermissions, localState, result);
return ev;
}
@@ -299,7 +300,7 @@ public class DragEvent implements Parcelable {
/** @hide */
public static DragEvent obtain(DragEvent source) {
return obtain(source.mAction, source.mX, source.mY, source.mLocalState,
- source.mClipDescription, source.mClipData, source.mDropPermissions,
+ source.mClipDescription, source.mClipData, source.mDragAndDropPermissions,
source.mDragResult);
}
@@ -365,8 +366,8 @@ public class DragEvent implements Parcelable {
}
/** @hide */
- public IDropPermissions getDropPermissions() {
- return mDropPermissions;
+ public IDragAndDropPermissions getDragAndDropPermissions() {
+ return mDragAndDropPermissions;
}
/**
@@ -489,11 +490,11 @@ public class DragEvent implements Parcelable {
dest.writeInt(1);
mClipDescription.writeToParcel(dest, flags);
}
- if (mDropPermissions == null) {
+ if (mDragAndDropPermissions == null) {
dest.writeInt(0);
} else {
dest.writeInt(1);
- dest.writeStrongBinder(mDropPermissions.asBinder());
+ dest.writeStrongBinder(mDragAndDropPermissions.asBinder());
}
}
@@ -515,7 +516,8 @@ public class DragEvent implements Parcelable {
event.mClipDescription = ClipDescription.CREATOR.createFromParcel(in);
}
if (in.readInt() != 0) {
- event.mDropPermissions = IDropPermissions.Stub.asInterface(in.readStrongBinder());;
+ event.mDragAndDropPermissions =
+ IDragAndDropPermissions.Stub.asInterface(in.readStrongBinder());;
}
return event;
}
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index 51356578fd9b..72d63ea8c7cb 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -43,6 +43,8 @@ import android.transition.Transition;
import android.transition.TransitionManager;
import android.view.accessibility.AccessibilityEvent;
+import static android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
+
import java.util.List;
/**
@@ -792,8 +794,9 @@ public abstract class Window {
if (wp.packageName == null) {
wp.packageName = mContext.getPackageName();
}
- if (mHardwareAccelerated) {
- wp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
+ if (mHardwareAccelerated ||
+ (mWindowAttributes.flags & FLAG_HARDWARE_ACCELERATED) != 0) {
+ wp.flags |= FLAG_HARDWARE_ACCELERATED;
}
}
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 54e9942db4d0..9b74fc05809d 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -1251,7 +1251,7 @@ public interface WindowManager extends ViewManager {
* the device supports it.
* @hide
*/
- public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00020000;
+ public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000;
/**
* Control flags that are private to the platform.
diff --git a/core/java/android/widget/DateTimeView.java b/core/java/android/widget/DateTimeView.java
index d20b9244a4b2..d2ee86622e08 100644
--- a/core/java/android/widget/DateTimeView.java
+++ b/core/java/android/widget/DateTimeView.java
@@ -16,21 +16,32 @@
package android.widget;
+import static android.text.format.DateUtils.DAY_IN_MILLIS;
+import static android.text.format.DateUtils.HOUR_IN_MILLIS;
+import static android.text.format.DateUtils.MINUTE_IN_MILLIS;
+import static android.text.format.DateUtils.YEAR_IN_MILLIS;
+import static android.text.format.Time.getJulianDay;
+
import android.app.ActivityThread;
+import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.BroadcastReceiver;
+import android.content.res.Configuration;
+import android.content.res.TypedArray;
import android.database.ContentObserver;
+import android.icu.util.Calendar;
import android.os.Handler;
import android.text.format.Time;
import android.util.AttributeSet;
-import android.util.Log;
import android.widget.RemoteViews.RemoteView;
+import com.android.internal.R;
+
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
+import java.util.TimeZone;
//
// TODO
@@ -46,11 +57,6 @@ import java.util.Date;
*/
@RemoteView
public class DateTimeView extends TextView {
- private static final String TAG = "DateTimeView";
-
- private static final long TWELVE_HOURS_IN_MINUTES = 12 * 60;
- private static final long TWENTY_FOUR_HOURS_IN_MILLIS = 24 * 60 * 60 * 1000;
-
private static final int SHOW_TIME = 0;
private static final int SHOW_MONTH_DAY_YEAR = 1;
@@ -62,13 +68,30 @@ public class DateTimeView extends TextView {
private long mUpdateTimeMillis;
private static final ThreadLocal<ReceiverInfo> sReceiverInfo = new ThreadLocal<ReceiverInfo>();
+ private String mNowText;
+ private boolean mShowRelativeTime;
public DateTimeView(Context context) {
- super(context);
+ this(context, null);
}
public DateTimeView(Context context, AttributeSet attrs) {
super(context, attrs);
+ final TypedArray a = context.obtainStyledAttributes(attrs,
+ com.android.internal.R.styleable.DateTimeView, 0,
+ 0);
+
+ final int N = a.getIndexCount();
+ for (int i = 0; i < N; i++) {
+ int attr = a.getIndex(i);
+ switch (attr) {
+ case R.styleable.DateTimeView_showRelative:
+ boolean relative = a.getBoolean(i, false);
+ setShowRelativeTime(relative);
+ break;
+ }
+ }
+ a.recycle();
}
@Override
@@ -101,12 +124,31 @@ public class DateTimeView extends TextView {
update();
}
+ @android.view.RemotableViewMethod
+ public void setShowRelativeTime(boolean showRelativeTime) {
+ mShowRelativeTime = showRelativeTime;
+ updateNowText();
+ update();
+ }
+
+ @Override
+ @android.view.RemotableViewMethod
+ public void setVisibility(@Visibility int visibility) {
+ boolean gotVisible = visibility != GONE && getVisibility() == GONE;
+ super.setVisibility(visibility);
+ if (gotVisible) {
+ update();
+ }
+ }
+
void update() {
- if (mTime == null) {
+ if (mTime == null || getVisibility() == GONE) {
+ return;
+ }
+ if (mShowRelativeTime) {
+ updateRelativeTime();
return;
}
-
- long start = System.nanoTime();
int display;
Date time = mTime;
@@ -181,12 +223,105 @@ public class DateTimeView extends TextView {
? twelveHoursBefore : midnightBefore;
}
}
- if (false) {
- Log.d(TAG, "update needed for '" + time + "' at '" + new Date(mUpdateTimeMillis)
- + "' - text=" + text);
+ }
+
+ private void updateRelativeTime() {
+ long now = System.currentTimeMillis();
+ long duration = Math.abs(now - mTimeMillis);
+ int count;
+ long millisIncrease;
+ boolean past = (now >= mTimeMillis);
+ String result;
+ if (duration < MINUTE_IN_MILLIS) {
+ setText(mNowText);
+ mUpdateTimeMillis = mTimeMillis + MINUTE_IN_MILLIS + 1;
+ return;
+ } else if (duration < HOUR_IN_MILLIS) {
+ count = (int)(duration / MINUTE_IN_MILLIS);
+ result = String.format(getContext().getResources().getQuantityString(past
+ ? com.android.internal.R.plurals.duration_minutes_shortest
+ : com.android.internal.R.plurals.duration_minutes_shortest_future,
+ count),
+ count);
+ millisIncrease = MINUTE_IN_MILLIS;
+ } else if (duration < DAY_IN_MILLIS) {
+ count = (int)(duration / HOUR_IN_MILLIS);
+ result = String.format(getContext().getResources().getQuantityString(past
+ ? com.android.internal.R.plurals.duration_hours_shortest
+ : com.android.internal.R.plurals.duration_hours_shortest_future,
+ count),
+ count);
+ millisIncrease = HOUR_IN_MILLIS;
+ } else if (duration < YEAR_IN_MILLIS) {
+ // In weird cases it can become 0 because of daylight savings
+ TimeZone timeZone = TimeZone.getDefault();
+ count = Math.max(Math.abs(dayDistance(timeZone, mTimeMillis, now)), 1);
+ result = String.format(getContext().getResources().getQuantityString(past
+ ? com.android.internal.R.plurals.duration_days_shortest
+ : com.android.internal.R.plurals.duration_days_shortest_future,
+ count),
+ count);
+ if (past || count != 1) {
+ mUpdateTimeMillis = computeNextMidnight(timeZone);
+ millisIncrease = -1;
+ } else {
+ millisIncrease = DAY_IN_MILLIS;
+ }
+
+ } else {
+ count = (int)(duration / YEAR_IN_MILLIS);
+ result = String.format(getContext().getResources().getQuantityString(past
+ ? com.android.internal.R.plurals.duration_years_shortest
+ : com.android.internal.R.plurals.duration_years_shortest_future,
+ count),
+ count);
+ millisIncrease = YEAR_IN_MILLIS;
}
+ if (millisIncrease != -1) {
+ if (past) {
+ mUpdateTimeMillis = mTimeMillis + millisIncrease * (count + 1) + 1;
+ } else {
+ mUpdateTimeMillis = mTimeMillis - millisIncrease * count + 1;
+ }
+ }
+ setText(result);
+ }
+
+ /**
+ * @param timeZone the timezone we are in
+ * @return the timepoint in millis at UTC at midnight in the current timezone
+ */
+ private long computeNextMidnight(TimeZone timeZone) {
+ Calendar c = Calendar.getInstance();
+ c.setTimeZone(libcore.icu.DateUtilsBridge.icuTimeZone(timeZone));
+ c.add(Calendar.DAY_OF_MONTH, 1);
+ c.set(Calendar.HOUR_OF_DAY, 0);
+ c.set(Calendar.MINUTE, 0);
+ c.set(Calendar.SECOND, 0);
+ c.set(Calendar.MILLISECOND, 0);
+ return c.getTimeInMillis();
+ }
+
+ @Override
+ protected void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ updateNowText();
+ update();
+ }
+
+ private void updateNowText() {
+ if (!mShowRelativeTime) {
+ return;
+ }
+ mNowText = getContext().getResources().getString(
+ com.android.internal.R.string.now_string_shortest);
+ }
- long finish = System.nanoTime();
+ // Return the date difference for the two times in a given timezone.
+ private static int dayDistance(TimeZone timeZone, long startTime,
+ long endTime) {
+ return getJulianDay(endTime, timeZone.getOffset(endTime) / 1000)
+ - getJulianDay(startTime, timeZone.getOffset(startTime) / 1000);
}
private DateFormat getTimeFormat() {
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 440ef2162fc5..5d2683f98d00 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -77,8 +77,8 @@ import android.view.ActionMode;
import android.view.ActionMode.Callback;
import android.view.ContextMenu;
import android.view.DisplayListCanvas;
+import android.view.DragAndDropPermissions;
import android.view.DragEvent;
-import android.view.DropPermissions;
import android.view.Gravity;
import android.view.InputDevice;
import android.view.LayoutInflater;
@@ -2379,9 +2379,9 @@ public class Editor {
void onDrop(DragEvent event) {
StringBuilder content = new StringBuilder("");
- final DropPermissions dropPermissions = DropPermissions.obtain(event);
- if (dropPermissions != null) {
- dropPermissions.takeTransient();
+ final DragAndDropPermissions permissions = DragAndDropPermissions.obtain(event);
+ if (permissions != null) {
+ permissions.takeTransient();
}
try {
@@ -2393,8 +2393,8 @@ public class Editor {
}
}
finally {
- if (dropPermissions != null) {
- dropPermissions.release();
+ if (permissions != null) {
+ permissions.release();
}
}
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index 9c9784b4adf8..3c967acdfc55 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -1397,6 +1397,10 @@ public class ProgressBar extends View {
/**
* Sets the current progress to the specified value. Does not do anything
* if the progress bar is in indeterminate mode.
+ * <p>
+ * This method will immediately update the visual position of the progress
+ * indicator. To animate the visual position to the target value, use
+ * {@link #setProgress(int, boolean)}}.
*
* @param progress the new progress, between 0 and {@link #getMax()}
*
@@ -1412,7 +1416,7 @@ public class ProgressBar extends View {
/**
* Sets the current progress to the specified value, optionally animating
- * between the current and target values.
+ * the visual position between the current and target values.
* <p>
* Animation does not affect the result of {@link #getProgress()}, which
* will return the target value immediately after this method is called.
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index a9b7f4e97e7c..6dc5ff7c427a 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -2600,7 +2600,7 @@ public class RemoteViews implements Parcelable, Filter {
* simply display the timer value.
* @param started True if you want the clock to be started, false if not.
*
- * @see #setChronometerCountsDown(int, boolean)
+ * @see #setChronometerCountDown(int, boolean)
*/
public void setChronometer(int viewId, long base, String format, boolean started) {
setLong(viewId, "setBase", base);
@@ -2616,7 +2616,7 @@ public class RemoteViews implements Parcelable, Filter {
* @param isCountDown True if you want the chronometer to count down to base instead of
* counting up.
*/
- public void setChronometerCountsDown(int viewId, boolean isCountDown) {
+ public void setChronometerCountDown(int viewId, boolean isCountDown) {
setBoolean(viewId, "setCountDown", isCountDown);
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 8097d7a1ea85..3216fbabf76d 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -1591,6 +1591,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
}
+ @android.view.RemotableViewMethod
@Override
public void setEnabled(boolean enabled) {
if (enabled == isEnabled()) {
diff --git a/core/java/com/android/internal/app/LocaleStore.java b/core/java/com/android/internal/app/LocaleStore.java
index 7803e52c45e1..e3fce5197dca 100644
--- a/core/java/com/android/internal/app/LocaleStore.java
+++ b/core/java/com/android/internal/app/LocaleStore.java
@@ -126,12 +126,18 @@ public class LocaleStore {
return mFullCountryNameNative;
}
+ String getFullCountryNameInUiLanguage() {
+ // We don't cache the UI name because the default locale keeps changing
+ return LocaleHelper.getDisplayCountry(mLocale);
+ }
+
/** Returns the name of the locale in the language of the UI.
* It is used for search, but never shown.
* For instance German will show as "Deutsch" in the list, but we will also search for
* "allemand" if the system UI is in French.
*/
public String getFullNameInUiLanguage() {
+ // We don't cache the UI name because the default locale keeps changing
return LocaleHelper.getDisplayName(mLocale, true /* sentence case */);
}
@@ -154,6 +160,14 @@ public class LocaleStore {
}
}
+ String getContentDescription(boolean countryMode) {
+ if (countryMode) {
+ return getFullCountryNameInUiLanguage();
+ } else {
+ return getFullNameInUiLanguage();
+ }
+ }
+
public boolean getChecked() {
return mIsChecked;
}
diff --git a/core/java/com/android/internal/app/SuggestedLocaleAdapter.java b/core/java/com/android/internal/app/SuggestedLocaleAdapter.java
index e2d29e313be4..a4b5a8e6595c 100644
--- a/core/java/com/android/internal/app/SuggestedLocaleAdapter.java
+++ b/core/java/com/android/internal/app/SuggestedLocaleAdapter.java
@@ -159,6 +159,7 @@ public class SuggestedLocaleAdapter extends BaseAdapter implements Filterable {
LocaleStore.LocaleInfo item = (LocaleStore.LocaleInfo) getItem(position);
text.setText(item.getLabel(mCountryMode));
text.setTextLocale(item.getLocale());
+ text.setContentDescription(item.getContentDescription(mCountryMode));
if (mCountryMode) {
int layoutDir = TextUtils.getLayoutDirectionFromLocale(item.getParent());
//noinspection ResourceType
diff --git a/core/java/com/android/internal/view/IDropPermissions.aidl b/core/java/com/android/internal/view/IDragAndDropPermissions.aidl
index 74ff4b42d97f..64c2d0440983 100644
--- a/core/java/com/android/internal/view/IDropPermissions.aidl
+++ b/core/java/com/android/internal/view/IDragAndDropPermissions.aidl
@@ -22,7 +22,7 @@ import android.os.IBinder;
* Interface to allow a drop receiver to request permissions for URIs passed along with ClipData
* contained in DragEvent.
*/
-interface IDropPermissions {
+interface IDragAndDropPermissions {
void take(IBinder activityToken);
void takeTransient(IBinder permissionOwnerToken);
void release();
diff --git a/core/java/com/android/internal/view/menu/CascadingMenuPopup.java b/core/java/com/android/internal/view/menu/CascadingMenuPopup.java
index 5cb307fec697..72ed9d0cc60b 100644
--- a/core/java/com/android/internal/view/menu/CascadingMenuPopup.java
+++ b/core/java/com/android/internal/view/menu/CascadingMenuPopup.java
@@ -181,8 +181,10 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey
private View mAnchorView;
private View mShownAnchorView;
private int mLastPosition;
- private int mInitXOffset;
- private int mInitYOffset;
+ private boolean mHasXOffset;
+ private boolean mHasYOffset;
+ private int mXOffset;
+ private int mYOffset;
private boolean mForceShowIcon;
private boolean mShowTitle;
private Callback mPresenterCallback;
@@ -379,9 +381,6 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey
parentView = null;
}
- final int x;
- final int y;
- final Rect epicenterBounds;
if (parentView != null) {
// This menu is a cascading submenu anchored to a parent view.
popupWindow.setTouchModal(false);
@@ -401,6 +400,7 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey
// By now, mDropDownGravity is the resolved absolute gravity, so
// this should work in both LTR and RTL.
+ final int x;
if ((mDropDownGravity & Gravity.RIGHT) == Gravity.RIGHT) {
if (showOnRight) {
x = parentOffsetLeft + menuWidth;
@@ -415,17 +415,21 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey
}
}
- y = parentOffsetTop;
- epicenterBounds = null;
+ popupWindow.setHorizontalOffset(x);
+
+ final int y = parentOffsetTop;
+ popupWindow.setVerticalOffset(y);
} else {
- x = mInitXOffset;
- y = mInitYOffset;
- epicenterBounds = getEpicenterBounds();
+ if (mHasXOffset) {
+ popupWindow.setHorizontalOffset(mXOffset);
+ }
+ if (mHasYOffset) {
+ popupWindow.setVerticalOffset(mYOffset);
+ }
+ final Rect epicenterBounds = getEpicenterBounds();
+ popupWindow.setEpicenterBounds(epicenterBounds);
}
- popupWindow.setHorizontalOffset(x);
- popupWindow.setVerticalOffset(y);
- popupWindow.setEpicenterBounds(epicenterBounds);
final CascadingMenuInfo menuInfo = new CascadingMenuInfo(popupWindow, menu, mLastPosition);
mShowingMenus.add(menuInfo);
@@ -712,12 +716,14 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey
@Override
public void setHorizontalOffset(int x) {
- mInitXOffset = x;
+ mHasXOffset = true;
+ mXOffset = x;
}
@Override
public void setVerticalOffset(int y) {
- mInitYOffset = y;
+ mHasYOffset = true;
+ mYOffset = y;
}
@Override
diff --git a/core/java/com/android/internal/view/menu/StandardMenuPopup.java b/core/java/com/android/internal/view/menu/StandardMenuPopup.java
index 339c2bf79892..169caa585b0e 100644
--- a/core/java/com/android/internal/view/menu/StandardMenuPopup.java
+++ b/core/java/com/android/internal/view/menu/StandardMenuPopup.java
@@ -108,8 +108,6 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On
private int mDropDownGravity = Gravity.NO_GRAVITY;
- private int mXOffset;
- private int mYOffset;
private boolean mShowTitle;
public StandardMenuPopup(Context context, MenuBuilder menu, View anchorView, int popupStyleAttr,
@@ -177,8 +175,6 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On
mPopup.setContentWidth(mContentWidth);
mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
- mPopup.setHorizontalOffset(mXOffset);
- mPopup.setVerticalOffset(mYOffset);
mPopup.setEpicenterBounds(getEpicenterBounds());
mPopup.show();
@@ -276,7 +272,9 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On
mMenu.close(false /* closeAllMenus */);
// Show the new sub-menu popup at the same location as this popup.
- if (subPopup.tryShow(mXOffset, mYOffset)) {
+ final int horizontalOffset = mPopup.getHorizontalOffset();
+ final int verticalOffset = mPopup.getVerticalOffset();
+ if (subPopup.tryShow(horizontalOffset, verticalOffset)) {
if (mPresenterCallback != null) {
mPresenterCallback.onOpenSubMenu(subMenu);
}
@@ -338,12 +336,12 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On
@Override
public void setHorizontalOffset(int x) {
- mXOffset = x;
+ mPopup.setHorizontalOffset(x);
}
@Override
public void setVerticalOffset(int y) {
- mYOffset = y;
+ mPopup.setVerticalOffset(y);
}
@Override
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index a59809699be2..eb0c7424e3f5 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -347,10 +347,6 @@
<protected-broadcast android:name="android.app.action.SYSTEM_UPDATE_POLICY_CHANGED" />
<protected-broadcast android:name="android.app.action.DEVICE_OWNER_CHANGED" />
- <protected-broadcast android:name="android.intent.action.MANAGED_PROFILE_AVAILABILITY_CHANGED" />
- <protected-broadcast android:name="android.intent.action.MANAGED_PROFILE_AVAILABLE" />
- <protected-broadcast android:name="android.intent.action.MANAGED_PROFILE_UNAVAILABLE" />
-
<!-- Added in N -->
<protected-broadcast android:name="android.intent.action.ANR" />
<protected-broadcast android:name="android.intent.action.CALL" />
diff --git a/core/res/res/layout/notification_template_header.xml b/core/res/res/layout/notification_template_header.xml
index 992e88e22ad9..d16dcc6b906c 100644
--- a/core/res/res/layout/notification_template_header.xml
+++ b/core/res/res/layout/notification_template_header.xml
@@ -69,15 +69,17 @@
android:text="@string/notification_header_divider_symbol"
android:singleLine="true"
android:visibility="gone"/>
- <ViewStub
+ <DateTimeView
android:id="@+id/time"
+ android:textAppearance="@style/TextAppearance.Material.Notification.Time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_gravity="center"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
- android:layout="@layout/notification_template_part_time"
- android:visibility="gone"
- />
+ android:showRelative="true"
+ android:singleLine="true"
+ android:visibility="gone" />
<ViewStub
android:id="@+id/chronometer"
android:layout_width="wrap_content"
diff --git a/core/res/res/layout/notification_template_part_time.xml b/core/res/res/layout/notification_template_part_time.xml
deleted file mode 100644
index 442ff8cef443..000000000000
--- a/core/res/res/layout/notification_template_part_time.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<DateTimeView android:id="@+id/time" xmlns:android="http://schemas.android.com/apk/res/android"
- android:textAppearance="@style/TextAppearance.Material.Notification.Time"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:layout_marginEnd="4dp"
- android:layout_weight="0"
- android:singleLine="true"
- />
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 5bfa2d4ee5e3..b85ed9c83857 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -8134,6 +8134,10 @@ i
<attr name="spacing" />
</declare-styleable>
+ <declare-styleable name="DateTimeView">
+ <attr name="showRelative" format="boolean" />
+ </declare-styleable>
+
<declare-styleable name="ResolverDrawerLayout_LayoutParams">
<attr name="layout_alwaysShow" format="boolean" />
<attr name="layout_ignoreOffset" format="boolean" />
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 2040d7de5243..03c604871127 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2423,6 +2423,49 @@
<item quantity="other"><xliff:g id="count">%d</xliff:g> hours</item>
</plurals>
+ <!-- A string denoting the current point in time that should be as short as possible. Abbreviations are preferred to full strings as this might be shown repetitively. It is used in the header of notifications. [CHAR LIMIT=8]-->
+ <string name="now_string_shortest">now</string>
+
+ <!-- Phrase describing a time duration using minutes that is as short as possible, preferrably one character. If the language needs a space in between the integer and the unit, please also integrate it in the string, but preferably it should not have a space in between.[CHAR LIMIT=6] -->
+ <plurals name="duration_minutes_shortest">
+ <item quantity="other"><xliff:g example="2" id="count">%d</xliff:g>m</item>
+ </plurals>
+
+ <!-- Phrase describing a time duration using hours that is as short as possible, preferrably one character. If the language needs a space in between the integer and the unit, please also integrate it in the string, but preferably it should not have a space in between.[CHAR LIMIT=6] -->
+ <plurals name="duration_hours_shortest">
+ <item quantity="other"><xliff:g example="2" id="count">%d</xliff:g>h</item>
+ </plurals>
+
+ <!-- Phrase describing a time duration using days that is as short as possible, preferrably one character. If the language needs a space in between the integer and the unit, please also integrate it in the string, but preferably it should not have a space in between.[CHAR LIMIT=6] -->
+ <plurals name="duration_days_shortest">
+ <item quantity="other"><xliff:g example="2" id="count">%d</xliff:g>d</item>
+ </plurals>
+
+ <!-- Phrase describing a time duration using years that is as short as possible, preferrably one character. If the language needs a space in between the integer and the unit, please also integrate it in the string, but preferably it should not have a space in between.[CHAR LIMIT=6] -->
+ <plurals name="duration_years_shortest">
+ <item quantity="other"><xliff:g example="2" id="count">%d</xliff:g>y</item>
+ </plurals>
+
+ <!-- Phrase describing a time duration using minutes that is as short as possible, preferrably one character. This version should be a future point in time. If the language needs a space in between the integer and the unit, please also integrate it in the string, but preferably it should not have a space in between.[CHAR LIMIT=14] -->
+ <plurals name="duration_minutes_shortest_future">
+ <item quantity="other">in <xliff:g example="2" id="count">%d</xliff:g>m</item>
+ </plurals>
+
+ <!-- Phrase describing a time duration using hours that is as short as possible, preferrably one character. This version should be a future point in time. If the language needs a space in between the integer and the unit, please also integrate it in the string, but preferably it should not have a space in between.[CHAR LIMIT=14] -->
+ <plurals name="duration_hours_shortest_future">
+ <item quantity="other">in <xliff:g example="2" id="count">%d</xliff:g>h</item>
+ </plurals>
+
+ <!-- Phrase describing a time duration using days that is as short as possible, preferrably one character. This version should be a future point in time. If the language needs a space in between the integer and the unit, please also integrate it in the string, but preferably it should not have a space in between.[CHAR LIMIT=14] -->
+ <plurals name="duration_days_shortest_future">
+ <item quantity="other">in <xliff:g example="2" id="count">%d</xliff:g>d</item>
+ </plurals>
+
+ <!-- Phrase describing a time duration using years that is as short as possible, preferrably one character. This version should be a future point in time. If the language needs a space in between the integer and the unit, please also integrate it in the string, but preferably it should not have a space in between.[CHAR LIMIT=14] -->
+ <plurals name="duration_years_shortest_future">
+ <item quantity="other">in <xliff:g example="2" id="count">%d</xliff:g>y</item>
+ </plurals>
+
<!-- Title for error alert when a video cannot be played. it can be used by any app. -->
<string name="VideoView_error_title">Video problem</string>
<!-- Text for error alert when a video container is not valid for progressive download/playback. -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 60060a370205..adeaa63900b6 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2508,6 +2508,17 @@
<java-symbol type="id" name="notification_content_container" />
+ <java-symbol type="plurals" name="duration_minutes_shortest" />
+ <java-symbol type="plurals" name="duration_hours_shortest" />
+ <java-symbol type="plurals" name="duration_days_shortest" />
+ <java-symbol type="plurals" name="duration_years_shortest" />
+ <java-symbol type="plurals" name="duration_minutes_shortest_future" />
+ <java-symbol type="plurals" name="duration_hours_shortest_future" />
+ <java-symbol type="plurals" name="duration_days_shortest_future" />
+ <java-symbol type="plurals" name="duration_years_shortest_future" />
+
+ <java-symbol type="string" name="now_string_shortest" />
+
<!-- Encryption notification while accounts are locked by credential encryption -->
<java-symbol type="string" name="user_encrypted_title" />
<java-symbol type="string" name="user_encrypted_message" />
diff --git a/docs/html/training/tv/playback/browse.jd b/docs/html/training/tv/playback/browse.jd
index fee6a74787ad..46213897aacb 100644
--- a/docs/html/training/tv/playback/browse.jd
+++ b/docs/html/training/tv/playback/browse.jd
@@ -166,7 +166,7 @@ public class MainFragment extends BrowseFragment implements
shown in figures 1 and 2. This method replaces the title string with the
drawable resource, if {@code setTitle()} is also called. The drawable resource should be 52dps
tall.</li>
- <li>{@link android.support.v17.leanback.app.BrowseFragment#setTitle(java.lang.String) setTitle()}
+ <li>{@link android.support.v17.leanback.app.BrowseFragment#setTitle(java.lang.CharSequence) setTitle()}
sets the title string in the upper-right corner of the browse fragment, unless
{@code setBadgeDrawable()} is called.</li>
<li>{@link android.support.v17.leanback.app.BrowseFragment#setHeadersState(int) setHeadersState()}
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 15cb684ee08e..c3dfb89180de 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -562,7 +562,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData)
if ((mHeader->flags&ResStringPool_header::UTF8_FLAG &&
((uint8_t*)mStrings)[mStringPoolSize-1] != 0) ||
- (!mHeader->flags&ResStringPool_header::UTF8_FLAG &&
+ (!(mHeader->flags&ResStringPool_header::UTF8_FLAG) &&
((uint16_t*)mStrings)[mStringPoolSize-1] != 0)) {
ALOGW("Bad string block: last string is not 0-terminated\n");
return (mError=BAD_TYPE);
diff --git a/media/java/android/mtp/MtpConstants.java b/media/java/android/mtp/MtpConstants.java
index 0dcc7180b156..5bbf2ec4b379 100644
--- a/media/java/android/mtp/MtpConstants.java
+++ b/media/java/android/mtp/MtpConstants.java
@@ -583,41 +583,41 @@ public final class MtpConstants {
*/
public static final int ASSOCIATION_TYPE_GENERIC_FOLDER = 0x0001;
- /** Event code for UNDEFINED event */
+ /** @removed */
public static final int EVENT_UNDEFINED = 0x4000;
- /** Event code for CANCEL_TRANSACTION event */
+ /** @removed */
public static final int EVENT_CANCEL_TRANSACTION = 0x4001;
- /** Event code for OBJECT_ADDED event */
+ /** @removed */
public static final int EVENT_OBJECT_ADDED = 0x4002;
- /** Event code for OBJECT_REMOVED event */
+ /** @removed */
public static final int EVENT_OBJECT_REMOVED = 0x4003;
- /** Event code for STORE_ADDED event */
+ /** @removed */
public static final int EVENT_STORE_ADDED = 0x4004;
- /** Event code for STORE_REMOVED event */
+ /** @removed */
public static final int EVENT_STORE_REMOVED = 0x4005;
- /** Event code for DEVICE_PROP_CHANGED event */
+ /** @removed */
public static final int EVENT_DEVICE_PROP_CHANGED = 0x4006;
- /** Event code for OBJECT_INFO_CHANGED event */
+ /** @removed */
public static final int EVENT_OBJECT_INFO_CHANGED = 0x4007;
- /** Event code for DEVICE_INFO_CHANGED event */
+ /** @removed */
public static final int EVENT_DEVICE_INFO_CHANGED = 0x4008;
- /** Event code for REQUEST_OBJECT_TRANSFER event */
+ /** @removed */
public static final int EVENT_REQUEST_OBJECT_TRANSFER = 0x4009;
- /** Event code for STORE_FULL event */
+ /** @removed */
public static final int EVENT_STORE_FULL = 0x400A;
- /** Event code for DEVICE_RESET event */
+ /** @removed */
public static final int EVENT_DEVICE_RESET = 0x400B;
- /** Event code for STORAGE_INFO_CHANGED event */
+ /** @removed */
public static final int EVENT_STORAGE_INFO_CHANGED = 0x400C;
- /** Event code for CAPTURE_COMPLETE event */
+ /** @removed */
public static final int EVENT_CAPTURE_COMPLETE = 0x400D;
- /** Event code for UNREPORTED_STATUS event */
+ /** @removed */
public static final int EVENT_UNREPORTED_STATUS = 0x400E;
- /** Event code for OBJECT_PROP_CHANGED event */
+ /** @removed */
public static final int EVENT_OBJECT_PROP_CHANGED = 0xC801;
- /** Event code for OBJECT_PROP_DESC_CHANGED event */
+ /** @removed */
public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 0xC802;
- /** Event code for OBJECT_REFERENCES_CHANGED event */
+ /** @removed */
public static final int EVENT_OBJECT_REFERENCES_CHANGED = 0xC803;
/** Operation code for GetDeviceInfo */
diff --git a/media/java/android/mtp/MtpDevice.java b/media/java/android/mtp/MtpDevice.java
index d0ef37c77055..4082778986c6 100644
--- a/media/java/android/mtp/MtpDevice.java
+++ b/media/java/android/mtp/MtpDevice.java
@@ -16,6 +16,8 @@
package android.mtp;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.os.CancellationSignal;
@@ -169,8 +171,8 @@ public final class MtpDevice {
* @param objectHandle handle of the object to read
* @param offset Start index of reading range. It must be a non-negative value at most
* 0xffffffff.
- * @param size Size of reading range. It must be a non-negative value at most 0xffffffff. If
- * 0xffffffff is specified, the method obtains the full bytes of object.
+ * @param size Size of reading range. It must be a non-negative value at most Integer.MAX_VALUE
+ * or 0xffffffff. If 0xffffffff is specified, the method obtains the full bytes of object.
* @param buffer Array to write data.
* @return Size of bytes that are actually read.
*/
@@ -190,7 +192,7 @@ public final class MtpDevice {
*
* @param objectHandle handle of the object to read
* @param offset Start index of reading range. It must be a non-negative value.
- * @param size Size of reading range. It must be a non-negative value at most 0xffffffff.
+ * @param size Size of reading range. It must be a non-negative value at most Integer.MAX_VALUE.
* @param buffer Array to write data.
* @return Size of bytes that are actually read.
* @see MtpConstants#OPERATION_GET_PARTIAL_OBJECT_64
@@ -317,7 +319,7 @@ public final class MtpDevice {
* The returned {@link MtpObjectInfo} has the new object handle field filled in.
*
* @param info metadata of the entry
- * @return object info of the created entry
+ * @return object info of the created entry or null if the operation failed.
*/
public MtpObjectInfo sendObjectInfo(MtpObjectInfo info) {
return native_send_object_info(info);
@@ -329,13 +331,11 @@ public final class MtpDevice {
*
* @param signal signal for cancellation
* @return obtained event
+ * @throws IOException
*/
- public MtpEvent readEvent(CancellationSignal signal) {
+ public @NonNull MtpEvent readEvent(@Nullable CancellationSignal signal) throws IOException {
final int handle = native_submit_event_request();
-
- if (handle < 0) {
- throw new IllegalStateException("Other thread is reading an event.");
- }
+ Preconditions.checkState(handle >= 0, "Other thread is reading an event.");
if (signal != null) {
signal.setOnCancelListener(new CancellationSignal.OnCancelListener() {
@@ -391,8 +391,8 @@ public final class MtpDevice {
private native boolean native_import_file(int objectHandle, int fd);
private native boolean native_send_object(int objectHandle, long size, int fd);
private native MtpObjectInfo native_send_object_info(MtpObjectInfo info);
- private native int native_submit_event_request();
- private native MtpEvent native_reap_event_request(int handle);
+ private native int native_submit_event_request() throws IOException;
+ private native MtpEvent native_reap_event_request(int handle) throws IOException;
private native void native_discard_event_request(int handle);
private native long native_get_object_size_long(int handle, int format) throws IOException;
}
diff --git a/media/java/android/mtp/MtpDeviceInfo.java b/media/java/android/mtp/MtpDeviceInfo.java
index 2e4f4510b07b..86bd599e442c 100644
--- a/media/java/android/mtp/MtpDeviceInfo.java
+++ b/media/java/android/mtp/MtpDeviceInfo.java
@@ -16,8 +16,6 @@
package android.mtp;
-import android.annotation.Nullable;
-
/**
* This class encapsulates information about an MTP device.
* This corresponds to the DeviceInfo Dataset described in
@@ -112,7 +110,7 @@ public class MtpDeviceInfo {
* @see MtpConstants#OPERATION_SET_OBJECT_REFERENCES
* @see MtpConstants#OPERATION_SKIP
*/
- public final @Nullable int[] getOperationsSupported() {
+ public final int[] getOperationsSupported() {
return mOperationsSupported;
}
@@ -120,26 +118,57 @@ public class MtpDeviceInfo {
* Returns event code supported by the device.
*
* @return supported event code. Can be null if device does not provide the property.
- * @see MtpConstants#EVENT_UNDEFINED
- * @see MtpConstants#EVENT_CANCEL_TRANSACTION
- * @see MtpConstants#EVENT_OBJECT_ADDED
- * @see MtpConstants#EVENT_OBJECT_REMOVED
- * @see MtpConstants#EVENT_STORE_ADDED
- * @see MtpConstants#EVENT_STORE_REMOVED
- * @see MtpConstants#EVENT_DEVICE_PROP_CHANGED
- * @see MtpConstants#EVENT_OBJECT_INFO_CHANGED
- * @see MtpConstants#EVENT_DEVICE_INFO_CHANGED
- * @see MtpConstants#EVENT_REQUEST_OBJECT_TRANSFER
- * @see MtpConstants#EVENT_STORE_FULL
- * @see MtpConstants#EVENT_DEVICE_RESET
- * @see MtpConstants#EVENT_STORAGE_INFO_CHANGED
- * @see MtpConstants#EVENT_CAPTURE_COMPLETE
- * @see MtpConstants#EVENT_UNREPORTED_STATUS
- * @see MtpConstants#EVENT_OBJECT_PROP_CHANGED
- * @see MtpConstants#EVENT_OBJECT_PROP_DESC_CHANGED
- * @see MtpConstants#EVENT_OBJECT_REFERENCES_CHANGED
+ * @see MtpEvent#EVENT_UNDEFINED
+ * @see MtpEvent#EVENT_CANCEL_TRANSACTION
+ * @see MtpEvent#EVENT_OBJECT_ADDED
+ * @see MtpEvent#EVENT_OBJECT_REMOVED
+ * @see MtpEvent#EVENT_STORE_ADDED
+ * @see MtpEvent#EVENT_STORE_REMOVED
+ * @see MtpEvent#EVENT_DEVICE_PROP_CHANGED
+ * @see MtpEvent#EVENT_OBJECT_INFO_CHANGED
+ * @see MtpEvent#EVENT_DEVICE_INFO_CHANGED
+ * @see MtpEvent#EVENT_REQUEST_OBJECT_TRANSFER
+ * @see MtpEvent#EVENT_STORE_FULL
+ * @see MtpEvent#EVENT_DEVICE_RESET
+ * @see MtpEvent#EVENT_STORAGE_INFO_CHANGED
+ * @see MtpEvent#EVENT_CAPTURE_COMPLETE
+ * @see MtpEvent#EVENT_UNREPORTED_STATUS
+ * @see MtpEvent#EVENT_OBJECT_PROP_CHANGED
+ * @see MtpEvent#EVENT_OBJECT_PROP_DESC_CHANGED
+ * @see MtpEvent#EVENT_OBJECT_REFERENCES_CHANGED
*/
- public final @Nullable int[] getEventsSupported() {
+ public final int[] getEventsSupported() {
return mEventsSupported;
}
+
+ /**
+ * Returns if the given operation is supported by the device or not.
+ * @param code Operation code.
+ * @return If the given operation is supported by the device or not.
+ */
+ public boolean isOperationSupported(int code) {
+ return isSupported(mOperationsSupported, code);
+ }
+
+ /**
+ * Returns if the given event is supported by the device or not.
+ * @param code Event code.
+ * @return If the given event is supported by the device or not.
+ */
+ public boolean isEventSupported(int code) {
+ return isSupported(mEventsSupported, code);
+ }
+
+ /**
+ * Returns if the code set contains code.
+ * @hide
+ */
+ private static boolean isSupported(int[] set, int code) {
+ for (final int element : set) {
+ if (element == code) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/media/java/android/mtp/MtpEvent.java b/media/java/android/mtp/MtpEvent.java
index dc89a56cf0b3..9ca00e1956cb 100644
--- a/media/java/android/mtp/MtpEvent.java
+++ b/media/java/android/mtp/MtpEvent.java
@@ -21,7 +21,44 @@ package android.mtp;
* This corresponds to the events described in appendix G of the MTP specification.
*/
public class MtpEvent {
- private int mEventCode = MtpConstants.EVENT_UNDEFINED;
+ /** Event code for UNDEFINED event */
+ public static final int EVENT_UNDEFINED = 0x4000;
+ /** Event code for CANCEL_TRANSACTION event */
+ public static final int EVENT_CANCEL_TRANSACTION = 0x4001;
+ /** Event code for OBJECT_ADDED event */
+ public static final int EVENT_OBJECT_ADDED = 0x4002;
+ /** Event code for OBJECT_REMOVED event */
+ public static final int EVENT_OBJECT_REMOVED = 0x4003;
+ /** Event code for STORE_ADDED event */
+ public static final int EVENT_STORE_ADDED = 0x4004;
+ /** Event code for STORE_REMOVED event */
+ public static final int EVENT_STORE_REMOVED = 0x4005;
+ /** Event code for DEVICE_PROP_CHANGED event */
+ public static final int EVENT_DEVICE_PROP_CHANGED = 0x4006;
+ /** Event code for OBJECT_INFO_CHANGED event */
+ public static final int EVENT_OBJECT_INFO_CHANGED = 0x4007;
+ /** Event code for DEVICE_INFO_CHANGED event */
+ public static final int EVENT_DEVICE_INFO_CHANGED = 0x4008;
+ /** Event code for REQUEST_OBJECT_TRANSFER event */
+ public static final int EVENT_REQUEST_OBJECT_TRANSFER = 0x4009;
+ /** Event code for STORE_FULL event */
+ public static final int EVENT_STORE_FULL = 0x400A;
+ /** Event code for DEVICE_RESET event */
+ public static final int EVENT_DEVICE_RESET = 0x400B;
+ /** Event code for STORAGE_INFO_CHANGED event */
+ public static final int EVENT_STORAGE_INFO_CHANGED = 0x400C;
+ /** Event code for CAPTURE_COMPLETE event */
+ public static final int EVENT_CAPTURE_COMPLETE = 0x400D;
+ /** Event code for UNREPORTED_STATUS event */
+ public static final int EVENT_UNREPORTED_STATUS = 0x400E;
+ /** Event code for OBJECT_PROP_CHANGED event */
+ public static final int EVENT_OBJECT_PROP_CHANGED = 0xC801;
+ /** Event code for OBJECT_PROP_DESC_CHANGED event */
+ public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 0xC802;
+ /** Event code for OBJECT_REFERENCES_CHANGED event */
+ public static final int EVENT_OBJECT_REFERENCES_CHANGED = 0xC803;
+
+ private int mEventCode = EVENT_UNDEFINED;
// Parameters for event. The interpretation of event parameters depends upon mEventCode.
private int mParameter1;
@@ -29,6 +66,11 @@ public class MtpEvent {
private int mParameter3;
/**
+ * MtpEvent is instantiated by JNI.
+ */
+ private MtpEvent() {}
+
+ /**
* Returns event code of MTP event.
* See the USB-IF MTP specification for the details of event constants.
* @return event code
@@ -53,26 +95,26 @@ public class MtpEvent {
/**
* Obtains objectHandle event parameter.
*
- * @see MtpConstants#EVENT_OBJECT_ADDED
- * @see MtpConstants#EVENT_OBJECT_REMOVED
- * @see MtpConstants#EVENT_OBJECT_INFO_CHANGED
- * @see MtpConstants#EVENT_REQUEST_OBJECT_TRANSFER
- * @see MtpConstants#EVENT_OBJECT_PROP_CHANGED
- * @see MtpConstants#EVENT_OBJECT_REFERENCES_CHANGED
+ * @see #EVENT_OBJECT_ADDED
+ * @see #EVENT_OBJECT_REMOVED
+ * @see #EVENT_OBJECT_INFO_CHANGED
+ * @see #EVENT_REQUEST_OBJECT_TRANSFER
+ * @see #EVENT_OBJECT_PROP_CHANGED
+ * @see #EVENT_OBJECT_REFERENCES_CHANGED
*/
public int getObjectHandle() {
switch (mEventCode) {
- case MtpConstants.EVENT_OBJECT_ADDED:
+ case EVENT_OBJECT_ADDED:
return mParameter1;
- case MtpConstants.EVENT_OBJECT_REMOVED:
+ case EVENT_OBJECT_REMOVED:
return mParameter1;
- case MtpConstants.EVENT_OBJECT_INFO_CHANGED:
+ case EVENT_OBJECT_INFO_CHANGED:
return mParameter1;
- case MtpConstants.EVENT_REQUEST_OBJECT_TRANSFER:
+ case EVENT_REQUEST_OBJECT_TRANSFER:
return mParameter1;
- case MtpConstants.EVENT_OBJECT_PROP_CHANGED:
+ case EVENT_OBJECT_PROP_CHANGED:
return mParameter1;
- case MtpConstants.EVENT_OBJECT_REFERENCES_CHANGED:
+ case EVENT_OBJECT_REFERENCES_CHANGED:
return mParameter1;
default:
throw new IllegalParameterAccess("objectHandle", mEventCode);
@@ -82,20 +124,20 @@ public class MtpEvent {
/**
* Obtains storageID event parameter.
*
- * @see MtpConstants#EVENT_STORE_ADDED
- * @see MtpConstants#EVENT_STORE_REMOVED
- * @see MtpConstants#EVENT_STORE_FULL
- * @see MtpConstants#EVENT_STORAGE_INFO_CHANGED
+ * @see #EVENT_STORE_ADDED
+ * @see #EVENT_STORE_REMOVED
+ * @see #EVENT_STORE_FULL
+ * @see #EVENT_STORAGE_INFO_CHANGED
*/
public int getStorageId() {
switch (mEventCode) {
- case MtpConstants.EVENT_STORE_ADDED:
+ case EVENT_STORE_ADDED:
return mParameter1;
- case MtpConstants.EVENT_STORE_REMOVED:
+ case EVENT_STORE_REMOVED:
return mParameter1;
- case MtpConstants.EVENT_STORE_FULL:
+ case EVENT_STORE_FULL:
return mParameter1;
- case MtpConstants.EVENT_STORAGE_INFO_CHANGED:
+ case EVENT_STORAGE_INFO_CHANGED:
return mParameter1;
default:
throw new IllegalParameterAccess("storageID", mEventCode);
@@ -105,11 +147,11 @@ public class MtpEvent {
/**
* Obtains devicePropCode event parameter.
*
- * @see MtpConstants#EVENT_DEVICE_PROP_CHANGED
+ * @see #EVENT_DEVICE_PROP_CHANGED
*/
public int getDevicePropCode() {
switch (mEventCode) {
- case MtpConstants.EVENT_DEVICE_PROP_CHANGED:
+ case EVENT_DEVICE_PROP_CHANGED:
return mParameter1;
default:
throw new IllegalParameterAccess("devicePropCode", mEventCode);
@@ -119,11 +161,11 @@ public class MtpEvent {
/**
* Obtains transactionID event parameter.
*
- * @see MtpConstants#EVENT_CAPTURE_COMPLETE
+ * @see #EVENT_CAPTURE_COMPLETE
*/
public int getTransactionId() {
switch (mEventCode) {
- case MtpConstants.EVENT_CAPTURE_COMPLETE:
+ case EVENT_CAPTURE_COMPLETE:
return mParameter1;
default:
throw new IllegalParameterAccess("transactionID", mEventCode);
@@ -133,14 +175,14 @@ public class MtpEvent {
/**
* Obtains objectPropCode event parameter.
*
- * @see MtpConstants#EVENT_OBJECT_PROP_CHANGED
- * @see MtpConstants#EVENT_OBJECT_PROP_DESC_CHANGED
+ * @see #EVENT_OBJECT_PROP_CHANGED
+ * @see #EVENT_OBJECT_PROP_DESC_CHANGED
*/
public int getObjectPropCode() {
switch (mEventCode) {
- case MtpConstants.EVENT_OBJECT_PROP_CHANGED:
+ case EVENT_OBJECT_PROP_CHANGED:
return mParameter2;
- case MtpConstants.EVENT_OBJECT_PROP_DESC_CHANGED:
+ case EVENT_OBJECT_PROP_DESC_CHANGED:
return mParameter1;
default:
throw new IllegalParameterAccess("objectPropCode", mEventCode);
@@ -150,11 +192,11 @@ public class MtpEvent {
/**
* Obtains objectFormatCode event parameter.
*
- * @see MtpConstants#EVENT_OBJECT_PROP_DESC_CHANGED
+ * @see #EVENT_OBJECT_PROP_DESC_CHANGED
*/
public int getObjectFormatCode() {
switch (mEventCode) {
- case MtpConstants.EVENT_OBJECT_PROP_DESC_CHANGED:
+ case EVENT_OBJECT_PROP_DESC_CHANGED:
return mParameter2;
default:
throw new IllegalParameterAccess("objectFormatCode", mEventCode);
diff --git a/media/jni/android_mtp_MtpDevice.cpp b/media/jni/android_mtp_MtpDevice.cpp
index 6e434b2756a5..1faa0c472b2e 100644
--- a/media/jni/android_mtp_MtpDevice.cpp
+++ b/media/jni/android_mtp_MtpDevice.cpp
@@ -244,7 +244,8 @@ android_mtp_MtpDevice_get_device_info(JNIEnv *env, jobject thiz)
if (deviceInfo->mSerial)
env->SetObjectField(info, field_deviceInfo_serialNumber,
env->NewStringUTF(deviceInfo->mSerial));
- if (deviceInfo->mOperations) {
+ assert(deviceInfo->mOperations);
+ {
const size_t size = deviceInfo->mOperations->size();
ScopedLocalRef<jintArray> operations(env, static_cast<jintArray>(env->NewIntArray(size)));
{
@@ -259,7 +260,8 @@ android_mtp_MtpDevice_get_device_info(JNIEnv *env, jobject thiz)
env->SetObjectField(info, field_deviceInfo_operationsSupported, operations.get());
}
}
- if (deviceInfo->mEvents) {
+ assert(deviceInfo->mEvents);
+ {
const size_t size = deviceInfo->mEvents->size();
ScopedLocalRef<jintArray> events(env, static_cast<jintArray>(env->NewIntArray(size)));
{
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 981b2ddd7681..c78efe24fdfa 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1089,6 +1089,9 @@
<string name="volume_stream_content_description_vibrate">%1$s. Tap to set to vibrate. Accessibility services may be muted.</string>
<string name="volume_stream_content_description_mute">%1$s. Tap to mute. Accessibility services may be muted.</string>
+ <string name="volume_dialog_accessibility_shown_message">%s volume controls shown. Swipe up to dismiss.</string>
+ <string name="volume_dialog_accessibility_dismissed_message">Volume controls hidden</string>
+
<!-- Name of special SystemUI debug settings -->
<string name="system_ui_tuner">System UI Tuner</string>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java
index 9bc85c8a8395..fb76918c644d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java
@@ -54,7 +54,7 @@ public class TileQueryHelper {
// TODO: Live?
}
- private void addSystemTiles(QSTileHost host) {
+ private void addSystemTiles(final QSTileHost host) {
String possible = mContext.getString(R.string.quick_settings_tiles_default)
+ ",hotspot,inversion,saver,work,cast,night";
String[] possibleTiles = possible.split(",");
@@ -93,7 +93,7 @@ public class TileQueryHelper {
mainHandler.post(new Runnable() {
@Override
public void run() {
- new QueryTilesTask().execute();
+ new QueryTilesTask().execute(host.getTiles());
}
});
}
@@ -133,9 +133,10 @@ public class TileQueryHelper {
public boolean isSystem;
}
- private class QueryTilesTask extends AsyncTask<Void, Void, Collection<TileInfo>> {
+ private class QueryTilesTask extends
+ AsyncTask<Collection<QSTile<?>>, Void, Collection<TileInfo>> {
@Override
- protected Collection<TileInfo> doInBackground(Void... params) {
+ protected Collection<TileInfo> doInBackground(Collection<QSTile<?>>... params) {
List<TileInfo> tiles = new ArrayList<>();
PackageManager pm = mContext.getPackageManager();
List<ResolveInfo> services = pm.queryIntentServicesAsUser(
@@ -143,7 +144,13 @@ public class TileQueryHelper {
for (ResolveInfo info : services) {
String packageName = info.serviceInfo.packageName;
ComponentName componentName = new ComponentName(packageName, info.serviceInfo.name);
+ final CharSequence appLabel = info.serviceInfo.applicationInfo.loadLabel(pm);
String spec = CustomTile.toSpec(componentName);
+ State state = getState(params[0], spec);
+ if (state != null) {
+ addTile(spec, appLabel, state, false);
+ continue;
+ }
if (info.serviceInfo.icon == 0) {
continue;
}
@@ -157,12 +164,22 @@ public class TileQueryHelper {
icon.mutate();
icon.setTint(mContext.getColor(android.R.color.white));
CharSequence label = info.serviceInfo.loadLabel(pm);
- final CharSequence appLabel = info.serviceInfo.applicationInfo.loadLabel(pm);
addTile(spec, icon, label != null ? label.toString() : "null", appLabel, mContext);
}
return tiles;
}
+ private State getState(Collection<QSTile<?>> tiles, String spec) {
+ for (QSTile<?> tile : tiles) {
+ if (spec.equals(tile.getTileSpec())) {
+ final QSTile.State state = tile.newTileState();
+ tile.getState().copyTo(state);
+ return state;
+ }
+ }
+ return null;
+ }
+
@Override
protected void onPostExecute(Collection<TileInfo> result) {
mTiles.addAll(result);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/animations/ViewFocusAnimator.java b/packages/SystemUI/src/com/android/systemui/recents/tv/animations/ViewFocusAnimator.java
index be69552622ec..c3efe64207ea 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/animations/ViewFocusAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/animations/ViewFocusAnimator.java
@@ -36,6 +36,7 @@ public class ViewFocusAnimator implements View.OnFocusChangeListener {
private final float mSelectedZDelta;
private final float mUnselectedSpacing;
private final float mSelectedSpacingDelta;
+ private final float mDismissIconAlpha;
private final int mAnimDuration;
private final Interpolator mFocusInterpolator;
@@ -71,6 +72,8 @@ public class ViewFocusAnimator implements View.OnFocusChangeListener {
mFocusAnimation.setDuration(mAnimDuration);
mFocusAnimation.setInterpolator(mFocusInterpolator);
+ mDismissIconAlpha = res.getFloat(R.integer.dismiss_unselected_alpha);
+
setFocusProgress(0.0f);
mFocusAnimation.addListener(new AnimatorListenerAdapter() {
@@ -99,7 +102,7 @@ public class ViewFocusAnimator implements View.OnFocusChangeListener {
mTargetView.setPadding((int) spacing, mTargetView.getPaddingTop(),
(int) spacing, mTargetView.getPaddingBottom());
-
+ mTargetView.getDismissIconView().setAlpha(mDismissIconAlpha * level);
mTargetView.getThumbnailView().setZ(z);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java b/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java
index 235b782e4b1c..ef8a54b753ec 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java
@@ -47,6 +47,7 @@ public class TaskCardView extends LinearLayout {
private static final String TAG = "TaskCardView";
private View mThumbnailView;
+ private View mDismissIconView;
private TextView mTitleTextView;
private ImageView mBadgeView;
private Task mTask;
@@ -78,6 +79,7 @@ public class TaskCardView extends LinearLayout {
mThumbnailView = findViewById(R.id.card_view_thumbnail);
mTitleTextView = (TextView) findViewById(R.id.card_title_text);
mBadgeView = (ImageView) findViewById(R.id.card_extra_badge);
+ mDismissIconView = findViewById(R.id.dismiss_icon);
mDismissAnimationsHolder = new DismissAnimationsHolder(this);
View title = findViewById(R.id.card_info_field);
mCornerRadius = getResources().getDimensionPixelSize(
@@ -316,4 +318,8 @@ public class TaskCardView extends LinearLayout {
public View getThumbnailView() {
return mThumbnailView;
}
+
+ public View getDismissIconView() {
+ return mDismissIconView;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java
index 6115aa8272f1..2ec180d9b3b5 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java
@@ -202,8 +202,8 @@ public class RecentsViewTouchHandler {
* Handles dragging touch events
*/
private void handleTouchEvent(MotionEvent ev) {
- int action = ev.getAction();
- switch (action & MotionEvent.ACTION_MASK) {
+ int action = ev.getActionMasked();
+ switch (action) {
case MotionEvent.ACTION_DOWN:
mDownPos.set((int) ev.getX(), (int) ev.getY());
break;
@@ -258,7 +258,7 @@ public class RecentsViewTouchHandler {
case MotionEvent.ACTION_CANCEL: {
if (mDragRequested) {
EventBus.getDefault().send(new DragEndEvent(mDragTask, mTaskView,
- mLastDropTarget));
+ action == MotionEvent.ACTION_UP ? mLastDropTarget : null));
break;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index 6e9de231e48e..2806729b835a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -1346,7 +1346,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
expandButton.setVisibility(VISIBLE);
mNotificationHeader.setOnClickListener(mExpandClickListener);
mNotificationHeaderWrapper = NotificationViewWrapper.wrap(getContext(),
- mNotificationHeader);
+ mNotificationHeader, this);
addView(mNotificationHeader, indexOfChild(mChildrenContainer) + 1);
mTranslateableViews.add(mNotificationHeader);
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index 491ffde8071f..83f68e81bca7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -307,7 +307,8 @@ public class NotificationContentView extends FrameLayout {
addView(child);
mContractedChild = child;
mContractedChild.addOnLayoutChangeListener(mLayoutUpdater);
- mContractedWrapper = NotificationViewWrapper.wrap(getContext(), child);
+ mContractedWrapper = NotificationViewWrapper.wrap(getContext(), child,
+ mContainingNotification);
selectLayout(false /* animate */, true /* force */);
mContractedWrapper.setDark(mDark, false /* animate */, 0 /* delay */);
}
@@ -321,7 +322,8 @@ public class NotificationContentView extends FrameLayout {
addView(child);
mExpandedChild = child;
mExpandedChild.addOnLayoutChangeListener(mLayoutUpdater);
- mExpandedWrapper = NotificationViewWrapper.wrap(getContext(), child);
+ mExpandedWrapper = NotificationViewWrapper.wrap(getContext(), child,
+ mContainingNotification);
selectLayout(false /* animate */, true /* force */);
}
@@ -334,7 +336,8 @@ public class NotificationContentView extends FrameLayout {
addView(child);
mHeadsUpChild = child;
mHeadsUpChild.addOnLayoutChangeListener(mLayoutUpdater);
- mHeadsUpWrapper = NotificationViewWrapper.wrap(getContext(), child);
+ mHeadsUpWrapper = NotificationViewWrapper.wrap(getContext(), child,
+ mContainingNotification);
selectLayout(false /* animate */, true /* force */);
}
@@ -834,10 +837,14 @@ public class NotificationContentView extends FrameLayout {
public void updateExpandButtons(boolean expandable) {
mExpandable = expandable;
// if the expanded child has the same height as the collapsed one we hide it.
- if (mExpandedChild != null && mExpandedChild.getHeight() != 0 &&
- ((mIsHeadsUp && mExpandedChild.getHeight() == mHeadsUpChild.getHeight()) ||
- (!mIsHeadsUp && mExpandedChild.getHeight() == mContractedChild.getHeight()))) {
- expandable = false;
+ if (mExpandedChild != null && mExpandedChild.getHeight() != 0) {
+ if ((!mIsHeadsUp || mHeadsUpChild == null)) {
+ if (mExpandedChild.getHeight() == mContractedChild.getHeight()) {
+ expandable = false;
+ }
+ } else if (mExpandedChild.getHeight() == mHeadsUpChild.getHeight()) {
+ expandable = false;
+ }
}
if (mExpandedChild != null) {
mExpandedWrapper.updateExpandability(expandable, mExpandClickListener);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java
index 06d79a7f9124..3363993dd289 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java
@@ -65,12 +65,7 @@ public class NotificationHeaderUtil {
ImageView expand = (ImageView) view.findViewById(
com.android.internal.R.id.expand_button);
applyToChild(icon, apply, header.getOriginalIconColor());
- int color = header.getOriginalNotificationColor();
- if (color == Notification.COLOR_DEFAULT) {
- color = view.getContext().getColor(
- com.android.internal.R.color.notification_icon_default_color);
- }
- applyToChild(expand, apply, color);
+ applyToChild(expand, apply, header.getOriginalNotificationColor());
}
private void applyToChild(View view, boolean shouldApply, int originalColor) {
@@ -116,7 +111,7 @@ public class NotificationHeaderUtil {
@Override
public boolean compare(View parent, View child, Object parentData,
Object childData) {
- return parent.getVisibility() == View.VISIBLE;
+ return parent.getVisibility() != View.GONE;
}
@Override
@@ -161,11 +156,11 @@ public class NotificationHeaderUtil {
mComparators.get(compI).apply(row);
}
// We need to sanitize the dividers since they might be off-balance now
- sanitizeDividers(row);
+ sanitizeHeaderViews(row);
}
}
- private void sanitizeDividers(ExpandableNotificationRow row) {
+ private void sanitizeHeaderViews(ExpandableNotificationRow row) {
if (row.isSummaryWithChildren()) {
sanitizeHeader(row.getNotificationHeader());
return;
@@ -188,9 +183,26 @@ public class NotificationHeaderUtil {
if (rowHeader == null) {
return;
}
+ final int childCount = rowHeader.getChildCount();
+ View time = rowHeader.findViewById(com.android.internal.R.id.time);
+ boolean hasVisibleText = false;
+ for (int i = 1; i < childCount - 1 ; i++) {
+ View child = rowHeader.getChildAt(i);
+ if (child instanceof TextView
+ && child.getVisibility() != View.GONE
+ && !mDividers.contains(Integer.valueOf(child.getId()))
+ && child != time) {
+ hasVisibleText = true;
+ break;
+ }
+ }
+ // in case no view is visible we make sure the time is visible
+ int timeVisibility = !hasVisibleText
+ || mRow.getStatusBarNotification().getNotification().showsTimeOrChronometer()
+ ? View.VISIBLE : View.GONE;
+ time.setVisibility(timeVisibility);
View left = null;
View right;
- final int childCount = rowHeader.getChildCount();
for (int i = 1; i < childCount - 1 ; i++) {
View child = rowHeader.getChildAt(i);
if (mDividers.contains(Integer.valueOf(child.getId()))) {
@@ -202,14 +214,14 @@ public class NotificationHeaderUtil {
// A divider was found, this needs to be hidden
i--;
break;
- } else if (right.getVisibility() == View.VISIBLE) {
+ } else if (right.getVisibility() != View.GONE && right instanceof TextView) {
visible = left != null;
left = right;
break;
}
}
child.setVisibility(visible ? View.VISIBLE : View.GONE);
- } else if (child.getVisibility() == View.VISIBLE) {
+ } else if (child.getVisibility() != View.GONE && child instanceof TextView) {
left = child;
}
}
@@ -219,7 +231,7 @@ public class NotificationHeaderUtil {
for (int compI = 0; compI < mComparators.size(); compI++) {
mComparators.get(compI).apply(row, true /* reset */);
}
- sanitizeDividers(row);
+ sanitizeHeaderViews(row);
}
private static class HeaderProcessor {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
index 988d537f6c2c..2b59c68a44b8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
@@ -295,6 +295,14 @@ public class SignalClusterView
return;
}
// Clear out all old subIds.
+ for (PhoneState state : mPhoneStates) {
+ if (state.mMobile != null) {
+ state.maybeStopAnimatableDrawable(state.mMobile);
+ }
+ if (state.mMobileDark != null) {
+ state.maybeStopAnimatableDrawable(state.mMobileDark);
+ }
+ }
mPhoneStates.clear();
if (mMobileSignalGroup != null) {
mMobileSignalGroup.removeAllViews();
@@ -391,6 +399,11 @@ public class SignalClusterView
state.mMobile.setImageDrawable(null);
state.mLastMobileStrengthId = -1;
}
+ if (state.mMobileDark != null) {
+ state.maybeStopAnimatableDrawable(state.mMobileDark);
+ state.mMobileDark.setImageDrawable(null);
+ state.mLastMobileStrengthId = -1;
+ }
if (state.mMobileType != null) {
state.mMobileType.setImageDrawable(null);
state.mLastMobileTypeId = -1;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigPictureTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigPictureTemplateViewWrapper.java
index c5616010defb..6084770f5db5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigPictureTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigPictureTemplateViewWrapper.java
@@ -23,13 +23,16 @@ import android.os.Bundle;
import android.service.notification.StatusBarNotification;
import android.view.View;
+import com.android.systemui.statusbar.ExpandableNotificationRow;
+
/**
* Wraps a notification containing a big picture template
*/
public class NotificationBigPictureTemplateViewWrapper extends NotificationTemplateViewWrapper {
- protected NotificationBigPictureTemplateViewWrapper(Context ctx, View view) {
- super(ctx, view);
+ protected NotificationBigPictureTemplateViewWrapper(Context ctx, View view,
+ ExpandableNotificationRow row) {
+ super(ctx, view, row);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigTextTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigTextTemplateViewWrapper.java
index 487a7a03974e..3f4912550407 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigTextTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationBigTextTemplateViewWrapper.java
@@ -21,6 +21,7 @@ import android.service.notification.StatusBarNotification;
import android.view.View;
import com.android.internal.widget.ImageFloatingTextView;
+import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.TransformableView;
/**
@@ -30,8 +31,9 @@ public class NotificationBigTextTemplateViewWrapper extends NotificationTemplate
private ImageFloatingTextView mBigtext;
- protected NotificationBigTextTemplateViewWrapper(Context ctx, View view) {
- super(ctx, view);
+ protected NotificationBigTextTemplateViewWrapper(Context ctx, View view,
+ ExpandableNotificationRow row) {
+ super(ctx, view, row);
}
private void resolveViews(StatusBarNotification notification) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java
index 49e4ba8a83f5..61df44acbc50 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java
@@ -30,6 +30,7 @@ import android.view.View;
import com.android.systemui.R;
import com.android.systemui.ViewInvertHelper;
+import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.phone.NotificationPanelView;
/**
@@ -44,8 +45,8 @@ public class NotificationCustomViewWrapper extends NotificationViewWrapper {
private boolean mShouldInvertDark;
private boolean mShowingLegacyBackground;
- protected NotificationCustomViewWrapper(View view) {
- super(view);
+ protected NotificationCustomViewWrapper(View view, ExpandableNotificationRow row) {
+ super(view, row);
mInvertHelper = new ViewInvertHelper(view, NotificationPanelView.DOZE_ANIMATION_DURATION);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java
index b201d8fe68d9..1bfbaa228532 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java
@@ -36,6 +36,7 @@ import android.widget.ImageView;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.ViewInvertHelper;
+import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.TransformableView;
import com.android.systemui.statusbar.ViewTransformationHelper;
import com.android.systemui.statusbar.phone.NotificationPanelView;
@@ -61,8 +62,8 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
private ImageView mExpandButton;
private NotificationHeaderView mNotificationHeader;
- protected NotificationHeaderViewWrapper(Context ctx, View view) {
- super(view);
+ protected NotificationHeaderViewWrapper(Context ctx, View view, ExpandableNotificationRow row) {
+ super(view, row);
mIconDarkAlpha = ctx.getResources().getInteger(R.integer.doze_small_icon_alpha);
mInvertHelper = new ViewInvertHelper(ctx, NotificationPanelView.DOZE_ANIMATION_DURATION);
mTransformationHelper = new ViewTransformationHelper();
@@ -156,7 +157,9 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
} else {
mInvertHelper.update(dark);
}
- if (mIcon != null) {
+ if (mIcon != null && !mRow.isChildInGroup()) {
+ // We don't update the color for children views / their icon is invisible anyway.
+ // It also may lead to bugs where the icon isn't correctly greyed out.
boolean hadColorFilter = mNotificationHeader.getOriginalIconColor()
!= NotificationHeaderView.NO_COLOR;
if (fade) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java
index 30698e109178..3c95a786f8cd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java
@@ -20,6 +20,7 @@ import android.content.Context;
import android.service.notification.StatusBarNotification;
import android.view.View;
+import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.TransformableView;
/**
@@ -27,8 +28,9 @@ import com.android.systemui.statusbar.TransformableView;
*/
public class NotificationMediaTemplateViewWrapper extends NotificationTemplateViewWrapper {
- protected NotificationMediaTemplateViewWrapper(Context ctx, View view) {
- super(ctx, view);
+ protected NotificationMediaTemplateViewWrapper(Context ctx, View view,
+ ExpandableNotificationRow row) {
+ super(ctx, view, row);
}
View mActions;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
index 78e23fce1a3e..889bd5cac7a5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
@@ -25,11 +25,10 @@ import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
-import com.android.systemui.Interpolators;
import com.android.systemui.statusbar.CrossFadeHelper;
+import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.TransformableView;
import com.android.systemui.statusbar.ViewTransformationHelper;
-import com.android.systemui.statusbar.stack.StackStateAnimator;
/**
* Wraps a notification view inflated from a template.
@@ -43,8 +42,8 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
private TextView mTitle;
private TextView mText;
- protected NotificationTemplateViewWrapper(Context ctx, View view) {
- super(ctx, view);
+ protected NotificationTemplateViewWrapper(Context ctx, View view, ExpandableNotificationRow row) {
+ super(ctx, view, row);
mTransformationHelper.setCustomTransformation(
new ViewTransformationHelper.CustomTransformation() {
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java
index ebff69da46d1..7a0df1f54c64 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java
@@ -26,7 +26,7 @@ import android.view.View;
import com.android.systemui.Interpolators;
import com.android.systemui.statusbar.CrossFadeHelper;
-import com.android.systemui.statusbar.NotificationContentView;
+import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.TransformableView;
import com.android.systemui.statusbar.phone.NotificationPanelView;
@@ -38,28 +38,30 @@ public abstract class NotificationViewWrapper implements TransformableView {
protected final ColorMatrix mGrayscaleColorMatrix = new ColorMatrix();
protected final View mView;
+ protected final ExpandableNotificationRow mRow;
protected boolean mDark;
protected boolean mDarkInitialized = false;
- public static NotificationViewWrapper wrap(Context ctx, View v) {
+ public static NotificationViewWrapper wrap(Context ctx, View v, ExpandableNotificationRow row) {
if (v.getId() == com.android.internal.R.id.status_bar_latest_event_content) {
if ("bigPicture".equals(v.getTag())) {
- return new NotificationBigPictureTemplateViewWrapper(ctx, v);
+ return new NotificationBigPictureTemplateViewWrapper(ctx, v, row);
} else if ("bigText".equals(v.getTag())) {
- return new NotificationBigTextTemplateViewWrapper(ctx, v);
+ return new NotificationBigTextTemplateViewWrapper(ctx, v, row);
} else if ("media".equals(v.getTag()) || "bigMediaNarrow".equals(v.getTag())) {
- return new NotificationMediaTemplateViewWrapper(ctx, v);
+ return new NotificationMediaTemplateViewWrapper(ctx, v, row);
}
- return new NotificationTemplateViewWrapper(ctx, v);
+ return new NotificationTemplateViewWrapper(ctx, v, row);
} else if (v instanceof NotificationHeaderView) {
- return new NotificationHeaderViewWrapper(ctx, v);
+ return new NotificationHeaderViewWrapper(ctx, v, row);
} else {
- return new NotificationCustomViewWrapper(v);
+ return new NotificationCustomViewWrapper(v, row);
}
}
- protected NotificationViewWrapper(View view) {
+ protected NotificationViewWrapper(View view, ExpandableNotificationRow row) {
mView = view;
+ mRow = row;
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
index 0153a40c6922..65b93c743a94 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
@@ -20,6 +20,7 @@ import android.accessibilityservice.AccessibilityServiceInfo;
import android.animation.LayoutTransition;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
+import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.KeyguardManager;
@@ -109,6 +110,7 @@ public class VolumeDialog implements TunerService.Tunable {
private final SparseBooleanArray mDynamic = new SparseBooleanArray();
private final KeyguardManager mKeyguard;
private final AudioManager mAudioManager;
+ private final AccessibilityManager mAccessibilityMgr;
private int mExpandButtonAnimationDuration;
private ZenFooter mZenFooter;
private final LayoutTransition mLayoutTransition;
@@ -150,6 +152,7 @@ public class VolumeDialog implements TunerService.Tunable {
mSpTexts = new SpTexts(mContext);
mKeyguard = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+ mAccessibilityMgr = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
mActiveSliderTint = loadColorStateList(R.color.system_accent_color);
mInactiveSliderTint = loadColorStateList(R.color.volume_slider_inactive);
mLayoutTransition = new LayoutTransition();
@@ -507,6 +510,15 @@ public class VolumeDialog implements TunerService.Tunable {
setExpandedH(false);
}
});
+ if (mAccessibilityMgr.isEnabled()) {
+ AccessibilityEvent event =
+ AccessibilityEvent.obtain(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
+ event.setPackageName(mContext.getPackageName());
+ event.setClassName(CustomDialog.class.getSuperclass().getName());
+ event.getText().add(mContext.getString(
+ R.string.volume_dialog_accessibility_dismissed_message));
+ mAccessibilityMgr.sendAccessibilityEvent(event);
+ }
Events.writeEvent(mContext, Events.EVENT_DISMISS_DIALOG, reason);
mController.notifyVisible(false);
synchronized (mSafetyWarningLock) {
@@ -1082,6 +1094,27 @@ public class VolumeDialog implements TunerService.Tunable {
}
return false;
}
+
+ @Override
+ public boolean dispatchPopulateAccessibilityEvent(@NonNull AccessibilityEvent event) {
+ event.setClassName(getClass().getSuperclass().getName());
+ event.setPackageName(mContext.getPackageName());
+
+ ViewGroup.LayoutParams params = getWindow().getAttributes();
+ boolean isFullScreen = (params.width == ViewGroup.LayoutParams.MATCH_PARENT) &&
+ (params.height == ViewGroup.LayoutParams.MATCH_PARENT);
+ event.setFullScreen(isFullScreen);
+
+ if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
+ if (mShowing) {
+ event.getText().add(mContext.getString(
+ R.string.volume_dialog_accessibility_shown_message,
+ getActiveRow().ss.name));
+ return true;
+ }
+ }
+ return false;
+ }
}
private final class VolumeSeekBarChangeListener implements OnSeekBarChangeListener {
@@ -1138,16 +1171,13 @@ public class VolumeDialog implements TunerService.Tunable {
}
private final class Accessibility extends AccessibilityDelegate {
- private AccessibilityManager mMgr;
private boolean mFeedbackEnabled;
public void init() {
- mMgr = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
mDialogView.addOnAttachStateChangeListener(new OnAttachStateChangeListener() {
@Override
public void onViewDetachedFromWindow(View v) {
if (D.BUG) Log.d(TAG, "onViewDetachedFromWindow");
- // noop
}
@Override
@@ -1157,12 +1187,13 @@ public class VolumeDialog implements TunerService.Tunable {
}
});
mDialogView.setAccessibilityDelegate(this);
- mMgr.addAccessibilityStateChangeListener(new AccessibilityStateChangeListener() {
- @Override
- public void onAccessibilityStateChanged(boolean enabled) {
- updateFeedbackEnabled();
- }
- });
+ mAccessibilityMgr.addAccessibilityStateChangeListener(
+ new AccessibilityStateChangeListener() {
+ @Override
+ public void onAccessibilityStateChanged(boolean enabled) {
+ updateFeedbackEnabled();
+ }
+ });
updateFeedbackEnabled();
}
@@ -1180,7 +1211,7 @@ public class VolumeDialog implements TunerService.Tunable {
private boolean computeFeedbackEnabled() {
// are there any enabled non-generic a11y services?
final List<AccessibilityServiceInfo> services =
- mMgr.getEnabledAccessibilityServiceList(FEEDBACK_ALL_MASK);
+ mAccessibilityMgr.getEnabledAccessibilityServiceList(FEEDBACK_ALL_MASK);
for (AccessibilityServiceInfo asi : services) {
if (asi.feedbackType != 0 && asi.feedbackType != FEEDBACK_GENERIC) {
return true;
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index b965f64c5333..b06936129b75 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -72,6 +72,7 @@ import android.net.RouteInfo;
import android.net.UidRange;
import android.net.Uri;
import android.net.metrics.DefaultNetworkEvent;
+import android.net.metrics.NetworkEvent;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
@@ -2109,6 +2110,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
private void linger(NetworkAgentInfo nai) {
nai.lingering = true;
+ NetworkEvent.logEvent(nai.network.netId, NetworkEvent.NETWORK_LINGER);
nai.networkMonitor.sendMessage(NetworkMonitor.CMD_NETWORK_LINGER);
notifyNetworkCallbacks(nai, ConnectivityManager.CALLBACK_LOSING);
}
@@ -2122,6 +2124,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
nai.networkLingered.clear();
if (!nai.lingering) return;
nai.lingering = false;
+ NetworkEvent.logEvent(nai.network.netId, NetworkEvent.NETWORK_UNLINGER);
if (VDBG) log("Canceling linger of " + nai.name());
nai.networkMonitor.sendMessage(NetworkMonitor.CMD_NETWORK_CONNECTED);
}
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java
index 6c0517387176..bc9f69e8bede 100644
--- a/services/core/java/com/android/server/LockSettingsService.java
+++ b/services/core/java/com/android/server/LockSettingsService.java
@@ -1048,7 +1048,13 @@ public class LockSettingsService extends ILockSettings.Stub {
private void changeUserKey(int userId, byte[] token, byte[] secret)
throws RemoteException {
final UserInfo userInfo = UserManager.get(mContext).getUserInfo(userId);
- getMountService().changeUserKey(userId, userInfo.serialNumber, token, null, secret);
+ final IMountService mountService = getMountService();
+ final long callingId = Binder.clearCallingIdentity();
+ try {
+ mountService.changeUserKey(userId, userInfo.serialNumber, token, null, secret);
+ } finally {
+ Binder.restoreCallingIdentity(callingId);
+ }
}
@Override
diff --git a/services/core/java/com/android/server/NativeDaemonConnector.java b/services/core/java/com/android/server/NativeDaemonConnector.java
index 6009984842f4..f5f773214124 100644
--- a/services/core/java/com/android/server/NativeDaemonConnector.java
+++ b/services/core/java/com/android/server/NativeDaemonConnector.java
@@ -41,6 +41,7 @@ import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.LinkedList;
@@ -344,6 +345,30 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo
}
/**
+ * Method that waits until all asychronous notifications sent by the native daemon have
+ * been processed. This method must not be called on the notification thread or an
+ * exception will be thrown.
+ */
+ public void waitForCallbacks() {
+ if (Thread.currentThread() == mLooper.getThread()) {
+ throw new IllegalStateException("Must not call this method on callback thread");
+ }
+
+ final CountDownLatch latch = new CountDownLatch(1);
+ mCallbackHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ latch.countDown();
+ }
+ });
+ try {
+ latch.await();
+ } catch (InterruptedException e) {
+ Slog.wtf(TAG, "Interrupted while waiting for unsolicited response handling", e);
+ }
+ }
+
+ /**
* Issue the given command to the native daemon and return a single expected
* response.
*
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index fffd850ac1cb..745889847579 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -1507,6 +1507,11 @@ public class NetworkManagementService extends INetworkManagementService.Stub
} catch (NativeDaemonConnectorException e) {
throw e.rethrowAsParcelableException();
}
+
+ // Ensure that before we return from this command, any asynchronous
+ // notifications generated before the command completed have been
+ // processed by all NetworkManagementEventObservers.
+ mConnector.waitForCallbacks();
}
@Override
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 47918187e22a..87dedc91181f 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -4696,26 +4696,20 @@ public class AccountManagerService
ceHelper.getWritableDatabase();
ceHelper.close();
if (removeOldDb) {
- // TODO STOPSHIP - backup file during testing. Remove file before the release
- Log.i(TAG, "Migration complete - creating backup of old db " + preNDatabaseFile);
- renameToBakFile(preNDatabaseFile);
+ Slog.i(TAG, "Migration complete - removing pre-N db " + preNDatabaseFile);
+ if (!SQLiteDatabase.deleteDatabase(preNDatabaseFile)) {
+ Slog.e(TAG, "Cannot remove pre-N db " + preNDatabaseFile);
+ }
}
return ceHelper;
}
- private static void renameToBakFile(File file) {
- File bakFile = new File(file.getPath() + ".bak");
- if (!file.renameTo(bakFile)) {
- Log.e(TAG, "Cannot move file to " + bakFile);
- }
- }
-
private static boolean migratePreNDbToCe(File oldDbFile, File ceDbFile) {
- Log.i(TAG, "Moving pre-N DB " + oldDbFile + " to CE " + ceDbFile);
+ Slog.i(TAG, "Moving pre-N DB " + oldDbFile + " to CE " + ceDbFile);
try {
FileUtils.copyFileOrThrow(oldDbFile, ceDbFile);
} catch (IOException e) {
- Log.e(TAG, "Cannot copy file to " + ceDbFile + " from " + oldDbFile, e);
+ Slog.e(TAG, "Cannot copy file to " + ceDbFile + " from " + oldDbFile, e);
// Try to remove potentially damaged file if I/O error occurred
deleteDbFileWarnIfFailed(ceDbFile);
return false;
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index b043311b2d5e..06d6430041aa 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -116,6 +116,7 @@ import android.os.UserHandle;
import android.service.voice.IVoiceInteractionSession;
import android.util.ArraySet;
import android.util.EventLog;
+import android.util.Log;
import android.util.Slog;
import android.view.Display;
@@ -3431,8 +3432,10 @@ final class ActivityStack {
mWindowManager.prepareAppTransition(transit, false);
mWindowManager.setAppVisibility(r.appToken, false);
mWindowManager.executeAppTransition();
+ mStackSupervisor.mWaitingVisibleActivities.add(r);
}
- return finishCurrentActivityLocked(r, FINISH_AFTER_PAUSE, oomAdj) == null;
+ return finishCurrentActivityLocked(r,
+ r.visible ? FINISH_AFTER_VISIBLE : FINISH_AFTER_PAUSE, oomAdj) == null;
} else {
if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Finish waiting for pause of: " + r);
}
@@ -5023,10 +5026,20 @@ final class ActivityStack {
}
void positionTask(final TaskRecord task, int position) {
+ final ActivityRecord topRunningActivity = task.topRunningActivityLocked();
+ final boolean wasResumed = topRunningActivity == task.stack.mResumedActivity;
final ActivityStack prevStack = preAddTask(task, "positionTask");
task.stack = this;
insertTaskAtPosition(task, position);
postAddTask(task, prevStack);
+ if (wasResumed) {
+ if (mResumedActivity != null) {
+ Log.wtf(TAG, "mResumedActivity was already set when moving mResumedActivity from"
+ + " other stack to this stack mResumedActivity=" + mResumedActivity
+ + " other mResumedActivity=" + topRunningActivity);
+ }
+ mResumedActivity = topRunningActivity;
+ }
}
private ActivityStack preAddTask(TaskRecord task, String reason) {
diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java
index 4da69760a970..6622b34c1106 100644
--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -527,8 +527,13 @@ class ActivityStarter {
doPendingActivityLaunchesLocked(false);
- err = startActivityUnchecked(
- r, sourceRecord, voiceSession, voiceInteractor, startFlags, true, options, inTask);
+ try {
+ mService.mWindowManager.deferSurfaceLayout();
+ err = startActivityUnchecked(r, sourceRecord, voiceSession, voiceInteractor, startFlags,
+ true, options, inTask);
+ } finally {
+ mService.mWindowManager.continueSurfaceLayout();
+ }
postStartActivityUncheckedProcessing(r, err, stack.mStackId);
return err;
}
@@ -1853,6 +1858,12 @@ class ActivityStarter {
private ActivityStack getLaunchStack(ActivityRecord r, int launchFlags, TaskRecord task,
ActivityOptions aOptions) {
+
+ // We are reusing a task, keep the stack!
+ if (mReuseTask != null) {
+ return mReuseTask.stack;
+ }
+
final int launchStackId =
(aOptions != null) ? aOptions.getLaunchStackId() : INVALID_STACK_ID;
diff --git a/services/core/java/com/android/server/am/AppErrors.java b/services/core/java/com/android/server/am/AppErrors.java
index 68bd2fd3ce3e..e9ed34b18baa 100644
--- a/services/core/java/com/android/server/am/AppErrors.java
+++ b/services/core/java/com/android/server/am/AppErrors.java
@@ -293,19 +293,7 @@ class AppErrors {
return;
}
- if (proc.thread != null) {
- if (proc.pid == Process.myPid()) {
- Log.w(TAG, "crashApplication: trying to crash self!");
- return;
- }
- long ident = Binder.clearCallingIdentity();
- try {
- proc.thread.scheduleCrash(message);
- } catch (RemoteException e) {
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
+ proc.scheduleCrash(message);
}
/**
diff --git a/services/core/java/com/android/server/am/BroadcastQueue.java b/services/core/java/com/android/server/am/BroadcastQueue.java
index 37c7765f26e3..bbb8bdf8185e 100644
--- a/services/core/java/com/android/server/am/BroadcastQueue.java
+++ b/services/core/java/com/android/server/am/BroadcastQueue.java
@@ -38,6 +38,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Build;
import android.os.Bundle;
+import android.os.DeadObjectException;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
@@ -446,7 +447,7 @@ public final class BroadcastQueue {
}
}
- private static void performReceiveLocked(ProcessRecord app, IIntentReceiver receiver,
+ private void performReceiveLocked(ProcessRecord app, IIntentReceiver receiver,
Intent intent, int resultCode, String data, Bundle extras,
boolean ordered, boolean sticky, int sendingUser) throws RemoteException {
// Send the intent to the receiver asynchronously using one-way binder calls.
@@ -454,8 +455,23 @@ public final class BroadcastQueue {
if (app.thread != null) {
// If we have an app thread, do the call through that so it is
// correctly ordered with other one-way calls.
- app.thread.scheduleRegisteredReceiver(receiver, intent, resultCode,
- data, extras, ordered, sticky, sendingUser, app.repProcState);
+ try {
+ app.thread.scheduleRegisteredReceiver(receiver, intent, resultCode,
+ data, extras, ordered, sticky, sendingUser, app.repProcState);
+ // TODO: Uncomment this when (b/28322359) is fixed and we aren't getting
+ // DeadObjectException when the process isn't actually dead.
+ //} catch (DeadObjectException ex) {
+ // Failed to call into the process. It's dying so just let it die and move on.
+ // throw ex;
+ } catch (RemoteException ex) {
+ // Failed to call into the process. It's either dying or wedged. Kill it gently.
+ synchronized (mService) {
+ Slog.w(TAG, "Can't deliver broadcast to " + app.processName
+ + " (pid " + app.pid + "). Crashing it.");
+ app.scheduleCrash("can't deliver broadcast");
+ }
+ throw ex;
+ }
} else {
// Application has died. Receiver doesn't exist.
throw new RemoteException("app.thread must not be null");
@@ -853,6 +869,7 @@ public final class BroadcastQueue {
Slog.w(TAG, "Failure ["
+ mQueueName + "] sending broadcast result of "
+ r.intent, e);
+
}
}
diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java
index 93d40604dbda..059acbd4190f 100644
--- a/services/core/java/com/android/server/am/ProcessRecord.java
+++ b/services/core/java/com/android/server/am/ProcessRecord.java
@@ -37,9 +37,11 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.res.CompatibilityInfo;
+import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Process;
+import android.os.RemoteException;
import android.os.SystemClock;
import android.os.Trace;
import android.os.UserHandle;
@@ -552,6 +554,29 @@ final class ProcessRecord {
return adj;
}
+ void scheduleCrash(String message) {
+ // Checking killedbyAm should keep it from showing the crash dialog if the process
+ // was already dead for a good / normal reason.
+ if (!killedByAm) {
+ if (thread != null) {
+ if (pid == Process.myPid()) {
+ Slog.w(TAG, "scheduleCrash: trying to crash system process!");
+ return;
+ }
+ long ident = Binder.clearCallingIdentity();
+ try {
+ thread.scheduleCrash(message);
+ } catch (RemoteException e) {
+ // If it's already dead our work is done. If it's wedged just kill it.
+ // We won't get the crash dialog or the error reporting.
+ kill("scheduleCrash for '" + message + "' failed", true);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+ }
+ }
+
void kill(String reason, boolean noisy) {
if (!killedByAm) {
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "kill");
diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
index 381a110dd20b..f7784acc09c7 100644
--- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java
+++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
@@ -34,9 +34,8 @@ import android.net.NetworkRequest;
import android.net.ProxyInfo;
import android.net.TrafficStats;
import android.net.Uri;
-import android.net.metrics.CaptivePortalCheckResultEvent;
-import android.net.metrics.CaptivePortalStateChangeEvent;
-import android.net.metrics.NetworkMonitorEvent;
+import android.net.metrics.ValidationProbeEvent;
+import android.net.metrics.NetworkEvent;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.net.util.Stopwatch;
@@ -306,13 +305,11 @@ public class NetworkMonitor extends StateMachine {
transitionTo(mLingeringState);
return HANDLED;
case CMD_NETWORK_CONNECTED:
- CaptivePortalStateChangeEvent.logEvent(mNetId,
- CaptivePortalStateChangeEvent.NETWORK_MONITOR_CONNECTED);
+ NetworkEvent.logEvent(mNetId, NetworkEvent.NETWORK_CONNECTED);
transitionTo(mEvaluatingState);
return HANDLED;
case CMD_NETWORK_DISCONNECTED:
- CaptivePortalStateChangeEvent.logEvent(mNetId,
- CaptivePortalStateChangeEvent.NETWORK_MONITOR_DISCONNECTED);
+ NetworkEvent.logEvent(mNetId, NetworkEvent.NETWORK_DISCONNECTED);
if (mLaunchCaptivePortalAppBroadcastReceiver != null) {
mContext.unregisterReceiver(mLaunchCaptivePortalAppBroadcastReceiver);
mLaunchCaptivePortalAppBroadcastReceiver = null;
@@ -363,11 +360,9 @@ public class NetworkMonitor extends StateMachine {
@Override
public void enter() {
if (mEvaluationTimer.isRunning()) {
- NetworkMonitorEvent.logValidated(mNetId, mEvaluationTimer.stop());
+ NetworkEvent.logValidated(mNetId, mEvaluationTimer.stop());
mEvaluationTimer.reset();
}
- CaptivePortalStateChangeEvent.logEvent(mNetId,
- CaptivePortalStateChangeEvent.NETWORK_MONITOR_VALIDATED);
mConnectivityServiceHandler.sendMessage(obtainMessage(EVENT_NETWORK_TESTED,
NETWORK_TEST_RESULT_VALID, mNetworkAgentInfo.network.netId, null));
}
@@ -497,7 +492,6 @@ public class NetworkMonitor extends StateMachine {
// will be unresponsive. isCaptivePortal() could be executed on another Thread
// if this is found to cause problems.
CaptivePortalProbeResult probeResult = isCaptivePortal();
- CaptivePortalCheckResultEvent.logEvent(mNetId, probeResult.mHttpResponseCode);
if (probeResult.mHttpResponseCode == 204) {
transitionTo(mValidatedState);
} else if (probeResult.mHttpResponseCode >= 200 &&
@@ -508,6 +502,7 @@ public class NetworkMonitor extends StateMachine {
} else {
final Message msg = obtainMessage(CMD_REEVALUATE, ++mReevaluateToken, 0);
sendMessageDelayed(msg, mReevaluateDelayMs);
+ NetworkEvent.logEvent(mNetId, NetworkEvent.NETWORK_VALIDATION_FAILED);
mConnectivityServiceHandler.sendMessage(obtainMessage(
EVENT_NETWORK_TESTED, NETWORK_TEST_RESULT_INVALID, mNetId,
probeResult.mRedirectUrl));
@@ -568,7 +563,7 @@ public class NetworkMonitor extends StateMachine {
@Override
public void enter() {
if (mEvaluationTimer.isRunning()) {
- NetworkMonitorEvent.logCaptivePortalFound(mNetId, mEvaluationTimer.stop());
+ NetworkEvent.logCaptivePortalFound(mNetId, mEvaluationTimer.stop());
mEvaluationTimer.reset();
}
// Don't annoy user with sign-in notifications.
@@ -779,7 +774,8 @@ public class NetworkMonitor extends StateMachine {
urlConnection.disconnect();
}
}
- NetworkMonitorEvent.logPortalProbeEvent(mNetId, probeTimer.stop(), httpResponseCode);
+ final int probeType = ValidationProbeEvent.PROBE_HTTP;
+ ValidationProbeEvent.logEvent(mNetId, probeTimer.stop(), probeType, httpResponseCode);
return new CaptivePortalProbeResult(httpResponseCode, redirectUrl);
}
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java
index 79b5978998c4..c2022d5008d8 100644
--- a/services/core/java/com/android/server/connectivity/Tethering.java
+++ b/services/core/java/com/android/server/connectivity/Tethering.java
@@ -273,9 +273,6 @@ public class Tethering extends BaseNetworkObserver {
// ignore usb0 down after enabling RNDIS
// we will handle disconnect in interfaceRemoved instead
if (VDBG) Log.d(TAG, "ignore interface down for " + iface);
- } else if (isWifi(iface)) {
- // handle disconnect in interfaceRemoved
- if (VDBG) Log.d(TAG, "ignore interface down for " + iface);
} else if (sm != null) {
sm.sendMessage(TetherInterfaceSM.CMD_INTERFACE_DOWN);
mIfaces.remove(iface);
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 93e4d313cce2..7ea59190981a 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -632,15 +632,6 @@ public class UserManagerService extends IUserManager.Stub {
intent.putExtra(Intent.EXTRA_USER_HANDLE, profileHandle.getIdentifier());
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
mContext.sendBroadcastAsUser(intent, parentHandle);
-
- //TODO: remove once Launcher3 is updated.
- Intent oldIntent = new Intent(Intent.ACTION_MANAGED_PROFILE_AVAILABILITY_CHANGED);
- oldIntent.putExtra(Intent.EXTRA_QUIET_MODE, inQuietMode);
- oldIntent.putExtra(Intent.EXTRA_USER, profileHandle);
- oldIntent.putExtra(Intent.EXTRA_USER_HANDLE, profileHandle.getIdentifier());
- oldIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
- mContext.sendBroadcastAsUser(oldIntent, parentHandle);
-
}
@Override
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java
index 11b01ccb9c68..9199d10aa575 100644
--- a/services/core/java/com/android/server/wm/AppTransition.java
+++ b/services/core/java/com/android/server/wm/AppTransition.java
@@ -1914,6 +1914,14 @@ public class AppTransition implements Dump {
setAppTransition(transit);
}
}
+ if (transit != TRANSIT_DOCK_TASK_FROM_RECENTS
+ && mNextAppTransition == TRANSIT_DOCK_TASK_FROM_RECENTS) {
+
+ // Somebody is trying to start another transition while we are waiting for the docking
+ // window to be drawn. Because TRANSIT_DOCK_TASK_FROM_RECENTS starts prolonged
+ // animations, we need to override it or our prolonged animations will never be ended.
+ setAppTransition(transit);
+ }
boolean prepared = prepare();
if (isTransitionSet()) {
mService.mH.removeMessages(H.APP_TRANSITION_TIMEOUT);
diff --git a/services/core/java/com/android/server/wm/AppWindowAnimator.java b/services/core/java/com/android/server/wm/AppWindowAnimator.java
index aae52e847e79..abb1bb193f20 100644
--- a/services/core/java/com/android/server/wm/AppWindowAnimator.java
+++ b/services/core/java/com/android/server/wm/AppWindowAnimator.java
@@ -433,7 +433,7 @@ public class AppWindowAnimator {
WindowStateAnimator winAnimator = mAllAppWinAnimators.get(i);
if (DEBUG_VISIBILITY) Slog.v(TAG, "performing show on: " + winAnimator);
winAnimator.performShowLocked();
- isAnimating |= winAnimator.isAnimating();
+ isAnimating |= winAnimator.isAnimationSet();
}
return isAnimating;
}
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 545b9db75ecd..9f54b5373953 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -204,7 +204,7 @@ class AppWindowToken extends WindowToken {
if (DEBUG_VISIBILITY) {
Slog.v(TAG, "Win " + win + ": isDrawn="
+ win.isDrawnLw()
- + ", isAnimating=" + win.mWinAnimator.isAnimating());
+ + ", isAnimationSet=" + win.mWinAnimator.isAnimationSet());
if (!win.isDrawnLw()) {
Slog.v(TAG, "Not displayed: s=" +
win.mWinAnimator.mSurfaceController
@@ -220,11 +220,11 @@ class AppWindowToken extends WindowToken {
numInteresting++;
if (win.isDrawnLw()) {
numDrawn++;
- if (!win.mWinAnimator.isAnimating()) {
+ if (!win.mWinAnimator.isAnimationSet()) {
numVisible++;
}
nowGone = false;
- } else if (win.mWinAnimator.isAnimating()) {
+ } else if (win.mWinAnimator.isAnimationSet()) {
nowGone = false;
}
}
@@ -297,7 +297,7 @@ class AppWindowToken extends WindowToken {
// Return true so that the alpha doesn't get cleared.
if (!win.mAppFreezing
&& (win.mViewVisibility == View.VISIBLE || mAnimatingWithSavedSurface
- || (win.mWinAnimator.isAnimating()
+ || (win.mWinAnimator.isAnimationSet()
&& !service.mAppTransition.isTransitionSet()))
&& !win.mDestroying
&& win.isDrawnLw()) {
diff --git a/services/core/java/com/android/server/wm/DockedStackDividerController.java b/services/core/java/com/android/server/wm/DockedStackDividerController.java
index 8a003deb9db4..30ba28a21995 100644
--- a/services/core/java/com/android/server/wm/DockedStackDividerController.java
+++ b/services/core/java/com/android/server/wm/DockedStackDividerController.java
@@ -353,7 +353,7 @@ public class DockedStackDividerController implements DimLayerUser {
stack.getDimBounds(mTmpRect);
if (mTmpRect.height() > 0 && mTmpRect.width() > 0) {
mDimLayer.setBounds(mTmpRect);
- mDimLayer.show(mDisplayContent.mService.mLayersController.getResizeDimLayer(),
+ mDimLayer.show(mService.mLayersController.getResizeDimLayer(),
alpha, 0 /* duration */);
} else {
visibleAndValid = false;
@@ -543,6 +543,9 @@ public class DockedStackDividerController implements DimLayerUser {
} else if (mAnimatingForIme) {
return animateForIme(now);
} else {
+ if (mDimLayer != null) {
+ mDimLayer.setLayer(mService.mLayersController.getResizeDimLayer());
+ }
return false;
}
}
diff --git a/services/core/java/com/android/server/wm/DropPermissionsHandler.java b/services/core/java/com/android/server/wm/DragAndDropPermissionsHandler.java
index 5889fb8eb53e..1831ff963f74 100644
--- a/services/core/java/com/android/server/wm/DropPermissionsHandler.java
+++ b/services/core/java/com/android/server/wm/DragAndDropPermissionsHandler.java
@@ -23,11 +23,12 @@ import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
-import com.android.internal.view.IDropPermissions;
+import com.android.internal.view.IDragAndDropPermissions;
import java.util.ArrayList;
-class DropPermissionsHandler extends IDropPermissions.Stub implements IBinder.DeathRecipient {
+class DragAndDropPermissionsHandler extends IDragAndDropPermissions.Stub
+ implements IBinder.DeathRecipient {
private final int mSourceUid;
private final String mTargetPackage;
@@ -40,8 +41,8 @@ class DropPermissionsHandler extends IDropPermissions.Stub implements IBinder.De
private IBinder mActivityToken = null;
private IBinder mPermissionOwnerToken = null;
- DropPermissionsHandler(ClipData clipData, int sourceUid, String targetPackage, int mode,
- int sourceUserId, int targetUserId) {
+ DragAndDropPermissionsHandler(ClipData clipData, int sourceUid, String targetPackage, int mode,
+ int sourceUserId, int targetUserId) {
mSourceUid = sourceUid;
mTargetPackage = targetPackage;
mMode = mode;
diff --git a/services/core/java/com/android/server/wm/DragState.java b/services/core/java/com/android/server/wm/DragState.java
index ffe03361b37f..0539b05fa846 100644
--- a/services/core/java/com/android/server/wm/DragState.java
+++ b/services/core/java/com/android/server/wm/DragState.java
@@ -59,7 +59,7 @@ import com.android.server.input.InputWindowHandle;
import com.android.server.wm.WindowManagerService.DragInputEventReceiver;
import com.android.server.wm.WindowManagerService.H;
-import com.android.internal.view.IDropPermissions;
+import com.android.internal.view.IDragAndDropPermissions;
import java.util.ArrayList;
@@ -484,10 +484,10 @@ class DragState {
final int targetUserId = UserHandle.getUserId(touchedWin.getOwningUid());
- DropPermissionsHandler dropPermissions = null;
+ DragAndDropPermissionsHandler dragAndDropPermissions = null;
if ((mFlags & View.DRAG_FLAG_GLOBAL) != 0 &&
(mFlags & DRAG_FLAGS_URI_ACCESS) != 0) {
- dropPermissions = new DropPermissionsHandler(
+ dragAndDropPermissions = new DragAndDropPermissionsHandler(
mData,
mUid,
touchedWin.getOwningPackage(),
@@ -501,7 +501,7 @@ class DragState {
final int myPid = Process.myPid();
final IBinder token = touchedWin.mClient.asBinder();
DragEvent evt = obtainDragEvent(touchedWin, DragEvent.ACTION_DROP, x, y,
- null, null, mData, dropPermissions, false);
+ null, null, mData, dragAndDropPermissions, false);
try {
touchedWin.mClient.dispatchDragEvent(evt);
@@ -524,12 +524,12 @@ class DragState {
private static DragEvent obtainDragEvent(WindowState win, int action,
float x, float y, Object localState,
ClipDescription description, ClipData data,
- IDropPermissions dropPermissions,
+ IDragAndDropPermissions dragAndDropPermissions,
boolean result) {
final float winX = win.translateToWindowX(x);
final float winY = win.translateToWindowY(y);
return DragEvent.obtain(action, winX, winY, localState, description, data,
- dropPermissions, result);
+ dragAndDropPermissions, result);
}
boolean stepAnimationLocked(long currentTimeMs) {
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 4f49eed14090..6925fa597c4b 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -601,7 +601,7 @@ class Task implements DimLayer.DimLayerUser {
// Anyway we don't need to synchronize position and content updates for these
// windows since they aren't at the base layer and could be moved around anyway.
if (!win.computeDragResizing() && win.mAttrs.type == TYPE_BASE_APPLICATION &&
- !mStack.getBoundsAnimating()) {
+ !mStack.getBoundsAnimating() && !win.isGoneForLayoutLw()) {
win.mResizedWhileNotDragResizing = true;
}
}
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index a289855586c4..ad33b4c32d7a 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -41,7 +41,6 @@ import android.util.Slog;
import android.util.SparseArray;
import android.view.DisplayInfo;
import android.view.Surface;
-import android.view.animation.PathInterpolator;
import android.view.SurfaceControl;
import com.android.internal.policy.DividerSnapAlgorithm;
@@ -119,7 +118,6 @@ public class TaskStack implements DimLayer.DimLayerUser,
// Whether the stack and all its tasks is currently being drag-resized
private boolean mDragResizing;
- private final Rect mLastContentBounds = new Rect();
private final Rect mTmpAdjustedBounds = new Rect();
private boolean mAdjustedForIme;
private boolean mImeGoingAway;
@@ -503,7 +501,7 @@ public class TaskStack implements DimLayer.DimLayerUser,
final ArrayList<WindowState> windows = activities.get(activityNdx).allAppWindows;
for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) {
final WindowStateAnimator winAnimator = windows.get(winNdx).mWinAnimator;
- if (winAnimator.isAnimating() || winAnimator.mWin.mAnimatingExit) {
+ if (winAnimator.isAnimationSet() || winAnimator.mWin.mAnimatingExit) {
return true;
}
}
@@ -646,9 +644,12 @@ public class TaskStack implements DimLayer.DimLayerUser,
Rect bounds = null;
final TaskStack dockedStack = mService.mStackIdToStack.get(DOCKED_STACK_ID);
if (mStackId == DOCKED_STACK_ID
- || (dockedStack != null && StackId.isResizeableByDockedStack(mStackId))) {
+ || (dockedStack != null && StackId.isResizeableByDockedStack(mStackId)
+ && !dockedStack.isFullscreen())) {
// The existence of a docked stack affects the size of other static stack created since
- // the docked stack occupies a dedicated region on screen.
+ // the docked stack occupies a dedicated region on screen, but only if the dock stack is
+ // not fullscreen. If it's fullscreen, it means that we are in the transition of
+ // dismissing it, so we must not resize this stack.
bounds = new Rect();
displayContent.getLogicalDisplayRect(mTmpRect);
mTmpRect2.setEmpty();
@@ -975,7 +976,6 @@ public class TaskStack implements DimLayer.DimLayerUser,
contentBounds.bottom = imeTop;
}
- mLastContentBounds.set(contentBounds);
final int yOffset = displayContentRect.bottom - contentBounds.bottom;
final int dividerWidth =
@@ -1085,7 +1085,6 @@ public class TaskStack implements DimLayer.DimLayerUser,
}
if (!adjust) {
mTmpAdjustedBounds.setEmpty();
- mLastContentBounds.setEmpty();
}
setAdjustedBounds(mTmpAdjustedBounds);
diff --git a/services/core/java/com/android/server/wm/WallpaperController.java b/services/core/java/com/android/server/wm/WallpaperController.java
index e44b0f30d9b7..88028befdf1e 100644
--- a/services/core/java/com/android/server/wm/WallpaperController.java
+++ b/services/core/java/com/android/server/wm/WallpaperController.java
@@ -146,7 +146,7 @@ class WallpaperController {
}
boolean isWallpaperTargetAnimating() {
- return mWallpaperTarget != null && mWallpaperTarget.mWinAnimator.isAnimating()
+ return mWallpaperTarget != null && mWallpaperTarget.mWinAnimator.isAnimationSet()
&& !mWallpaperTarget.mWinAnimator.isDummyAnimation();
}
@@ -516,7 +516,7 @@ class WallpaperController {
if (hasWallpaper && w.isOnScreen() && (mWallpaperTarget == w || w.isDrawFinishedLw())) {
if (DEBUG_WALLPAPER) Slog.v(TAG, "Found wallpaper target: #" + i + "=" + w);
result.setWallpaperTarget(w, i);
- if (w == mWallpaperTarget && w.mWinAnimator.isAnimating()) {
+ if (w == mWallpaperTarget && w.mWinAnimator.isAnimationSet()) {
// The current wallpaper target is animating, so we'll look behind it for
// another possible target and figure out what is going on later.
if (DEBUG_WALLPAPER) Slog.v(TAG,
diff --git a/services/core/java/com/android/server/wm/WindowAnimator.java b/services/core/java/com/android/server/wm/WindowAnimator.java
index 6bc633f03aca..eae783881c9f 100644
--- a/services/core/java/com/android/server/wm/WindowAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowAnimator.java
@@ -670,6 +670,7 @@ public class WindowAnimator {
if (SHOW_TRANSACTIONS) Slog.i(
TAG, ">>> OPEN TRANSACTION animateLocked");
SurfaceControl.openTransaction();
+ SurfaceControl.setAnimationTransaction();
try {
final int numDisplays = mDisplayContentsAnimators.size();
for (int i = 0; i < numDisplays; i++) {
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index aee8fc90a8d2..ff6363285229 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -120,7 +120,6 @@ import android.view.WindowManagerPolicy;
import android.view.WindowManagerPolicy.PointerEventListener;
import android.view.animation.Animation;
import android.view.inputmethod.InputMethodManagerInternal;
-import android.widget.Toast;
import com.android.internal.R;
import com.android.internal.app.IAssistScreenshotReceiver;
@@ -174,6 +173,7 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.view.WindowManager.DOCKED_BOTTOM;
import static android.view.WindowManager.DOCKED_INVALID;
+import static android.view.WindowManager.DOCKED_TOP;
import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
@@ -1525,7 +1525,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (highestTarget != null) {
if (DEBUG_INPUT_METHOD) Slog.v(TAG_WM, mAppTransition + " " + highestTarget
- + " animating=" + highestTarget.mWinAnimator.isAnimating()
+ + " animating=" + highestTarget.mWinAnimator.isAnimationSet()
+ " layer=" + highestTarget.mWinAnimator.mAnimLayer
+ " new layer=" + w.mWinAnimator.mAnimLayer);
@@ -1535,7 +1535,7 @@ public class WindowManagerService extends IWindowManager.Stub
mInputMethodTargetWaitingAnim = true;
mInputMethodTarget = highestTarget;
return highestPos + 1;
- } else if (highestTarget.mWinAnimator.isAnimating() &&
+ } else if (highestTarget.mWinAnimator.isAnimationSet() &&
highestTarget.mWinAnimator.mAnimLayer > w.mWinAnimator.mAnimLayer) {
// If the window we are currently targeting is involved
// with an animation, and it is on top of the next target
@@ -2275,7 +2275,7 @@ public class WindowManagerService extends IWindowManager.Stub
+ " mRemoveOnExit=" + win.mRemoveOnExit
+ " mHasSurface=" + win.mHasSurface
+ " surfaceShowing=" + win.mWinAnimator.getShown()
- + " isAnimating=" + win.mWinAnimator.isAnimating()
+ + " isAnimationSet=" + win.mWinAnimator.isAnimationSet()
+ " app-animation="
+ (win.mAppToken != null ? win.mAppToken.mAppAnimator.animation : null)
+ " mWillReplaceWindow=" + win.mWillReplaceWindow
@@ -2339,7 +2339,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
final boolean isAnimating =
- winAnimator.isAnimating() && !winAnimator.isDummyAnimation();
+ winAnimator.isAnimationSet() && !winAnimator.isDummyAnimation();
final boolean lastWindowIsStartingWindow = startingWindow && appToken != null
&& appToken.allAppWindows.size() == 1;
// We delay the removal of a window if it has a showing surface that can be used to run
@@ -2924,7 +2924,7 @@ public class WindowManagerService extends IWindowManager.Stub
focusMayChange = isDefaultDisplay;
win.mAnimatingExit = true;
win.mWinAnimator.mAnimating = true;
- } else if (win.mWinAnimator.isAnimating()) {
+ } else if (win.mWinAnimator.isAnimationSet()) {
// Currently in a hide animation... turn this into
// an exit.
win.mAnimatingExit = true;
@@ -3281,7 +3281,7 @@ public class WindowManagerService extends IWindowManager.Stub
WindowState win = wtoken.windows.get(i);
displayContent = win.getDisplayContent();
- if (win.mWinAnimator.isAnimating()) {
+ if (win.mWinAnimator.isAnimationSet()) {
delayed = true;
}
@@ -4297,7 +4297,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
for (int i = wtoken.allAppWindows.size() - 1; i >= 0 && !delayed; i--) {
- if (wtoken.allAppWindows.get(i).mWinAnimator.isWindowAnimating()) {
+ if (wtoken.allAppWindows.get(i).mWinAnimator.isWindowAnimationSet()) {
delayed = true;
}
}
@@ -7467,6 +7467,10 @@ public class WindowManagerService extends IWindowManager.Stub
final boolean imeVisible = imeWin != null && imeWin.isVisibleLw() && imeWin.isDisplayedLw();
final boolean dockVisible = isStackVisibleLocked(DOCKED_STACK_ID);
final TaskStack imeTargetStack = getImeTargetStackLocked();
+ final int imeDockSide = (dockVisible && imeTargetStack != null) ?
+ imeTargetStack.getDockSide() : DOCKED_INVALID;
+ final boolean imeOnTop = (imeDockSide == DOCKED_TOP);
+ final boolean imeOnBottom = (imeDockSide == DOCKED_BOTTOM);
// The divider could be adjusted for IME position, or be thinner than usual,
// or both. There are three possible cases:
@@ -7474,20 +7478,19 @@ public class WindowManagerService extends IWindowManager.Stub
// - If IME is visible, and focus is on bottom, divider is moved for IME and thinner.
// - If IME is not visible, divider is not moved and is normal width.
- if (imeVisible && dockVisible && imeTargetStack != null) {
- final boolean isFocusOnBottom = imeTargetStack.getDockSide() == DOCKED_BOTTOM;
+ if (imeVisible && dockVisible && (imeOnTop || imeOnBottom)) {
final ArrayList<TaskStack> stacks = displayContent.getStacks();
for (int i = stacks.size() - 1; i >= 0; --i) {
final TaskStack stack = stacks.get(i);
final boolean isDockedOnBottom = stack.getDockSide() == DOCKED_BOTTOM;
- if (stack.isVisibleLocked() && (isFocusOnBottom || isDockedOnBottom)) {
+ if (stack.isVisibleLocked() && (imeOnBottom || isDockedOnBottom)) {
stack.setAdjustedForIme(imeWin);
} else {
stack.resetAdjustedForIme(false);
}
}
displayContent.mDividerControllerLocked.setAdjustedForIme(
- isFocusOnBottom /*ime*/, true /*divider*/, true /*animate*/, imeWin);
+ imeOnBottom /*ime*/, true /*divider*/, true /*animate*/, imeWin);
} else {
final ArrayList<TaskStack> stacks = displayContent.getStacks();
for (int i = stacks.size() - 1; i >= 0; --i) {
@@ -9101,7 +9104,7 @@ public class WindowManagerService extends IWindowManager.Stub
void updateResizingWindows(final WindowState w) {
final WindowStateAnimator winAnimator = w.mWinAnimator;
- if (w.mHasSurface && w.mLayoutSeq == mLayoutSeq) {
+ if (w.mHasSurface && w.mLayoutSeq == mLayoutSeq && !w.isGoneForLayoutLw()) {
w.setInsetsChanged();
boolean configChanged = w.isConfigChanged();
if (DEBUG_CONFIGURATION && configChanged) {
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 8c29c9b194ad..f60399598428 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -291,21 +291,33 @@ class WindowStateAnimator {
}
}
- /** Is the window or its container currently animating? */
- boolean isAnimating() {
+ /**
+ * Is the window or its container currently set to animate or currently animating?
+ */
+ boolean isAnimationSet() {
return mAnimation != null
|| (mAttachedWinAnimator != null && mAttachedWinAnimator.mAnimation != null)
|| (mAppAnimator != null && mAppAnimator.isAnimating());
}
+ /**
+ * @return whether an animation is about to start, i.e. the animation is set already but we
+ * haven't processed the first frame yet.
+ */
+ boolean isAnimationStarting() {
+ return isAnimationSet() && !mAnimating;
+ }
+
/** Is the window animating the DummyAnimation? */
boolean isDummyAnimation() {
return mAppAnimator != null
&& mAppAnimator.animation == sDummyAnimation;
}
- /** Is this window currently set to animate or currently animating? */
- boolean isWindowAnimating() {
+ /**
+ * Is this window currently set to animate or currently animating?
+ */
+ boolean isWindowAnimationSet() {
return mAnimation != null;
}
@@ -340,7 +352,7 @@ class WindowStateAnimator {
// there is more animation to run.
boolean stepAnimationLocked(long currentTime) {
// Save the animation state as it was before this step so WindowManagerService can tell if
- // we just started or just stopped animating by comparing mWasAnimating with isAnimating().
+ // we just started or just stopped animating by comparing mWasAnimating with isAnimationSet().
mWasAnimating = mAnimating;
final DisplayContent displayContent = mWin.getDisplayContent();
if (displayContent != null && mService.okToDisplay()) {
@@ -402,7 +414,7 @@ class WindowStateAnimator {
// Little trick to get through the path below to act like
// we have finished an animation.
mAnimating = true;
- } else if (isAnimating()) {
+ } else if (isAnimationSet()) {
mAnimating = true;
}
} else if (mAnimation != null) {
@@ -476,7 +488,7 @@ class WindowStateAnimator {
TAG, "finishExit in " + this
+ ": exiting=" + mWin.mAnimatingExit
+ " remove=" + mWin.mRemoveOnExit
- + " windowAnimating=" + isWindowAnimating());
+ + " windowAnimating=" + isWindowAnimationSet());
if (!mWin.mChildWindows.isEmpty()) {
// Copying to a different list as multiple children can be removed.
@@ -499,7 +511,7 @@ class WindowStateAnimator {
}
}
- if (!isWindowAnimating()) {
+ if (!isWindowAnimationSet()) {
//TODO (multidisplay): Accessibility is supported only for the default display.
if (mService.mAccessibilityController != null
&& mWin.getDisplayId() == DEFAULT_DISPLAY) {
@@ -511,7 +523,7 @@ class WindowStateAnimator {
return;
}
- if (isWindowAnimating()) {
+ if (isWindowAnimationSet()) {
return;
}
@@ -1310,7 +1322,7 @@ class WindowStateAnimator {
final int stackClip = resolveStackClip();
// It's animating and we don't want to clip it to stack bounds during animation - abort.
- if (isAnimating() && stackClip == STACK_CLIP_NONE) {
+ if (isAnimationSet() && stackClip == STACK_CLIP_NONE) {
return;
}
@@ -1332,7 +1344,7 @@ class WindowStateAnimator {
// If we are animating, we either apply the clip before applying all the animation
// transformation or after all the transformation.
- final boolean useFinalClipRect = isAnimating() && stackClip == STACK_CLIP_AFTER_ANIM;
+ final boolean useFinalClipRect = isAnimationSet() && stackClip == STACK_CLIP_AFTER_ANIM;
// We need to do some acrobatics with surface position, because their clip region is
// relative to the inside of the surface, but the stack bounds aren't.
@@ -1507,7 +1519,7 @@ class WindowStateAnimator {
w.mToken.hasVisible = true;
}
} else {
- if (DEBUG_ANIM && isAnimating()) {
+ if (DEBUG_ANIM && isAnimationSet()) {
Slog.v(TAG, "prepareSurface: No changes in animation for " + this);
}
displayed = true;
diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
index 928fcc03255a..8937f09d37ac 100644
--- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
+++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
@@ -10,7 +10,6 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
-import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static android.view.WindowManager.LayoutParams.TYPE_DREAM;
import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG;
@@ -762,13 +761,15 @@ class WindowSurfacePlacer {
}
}
}
- if (!winAnimator.isAnimating()) {
+ if (!winAnimator.isAnimationStarting()) {
// Updates the shown frame before we set up the surface. This is needed
// because the resizing could change the top-left position (in addition to
// size) of the window. setSurfaceBoundariesLocked uses mShownPosition to
- // position the surface. We only apply it to windows that aren't animating,
- // because we depend on the animation to calculate the correct shown frame
- // on the next animation step.
+ // position the surface.
+ //
+ // If an animation is being started, we can't call this method because the
+ // animation hasn't processed its initial transformation yet, but in general
+ // we do want to update the position if the window is animating.
winAnimator.computeShownFrameLocked();
}
winAnimator.setSurfaceBoundariesLocked(recoveringMemory);
@@ -792,7 +793,7 @@ class WindowSurfacePlacer {
if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) {
Slog.v(TAG, "Eval win " + w + ": isDrawn="
+ w.isDrawnLw()
- + ", isAnimating=" + winAnimator.isAnimating());
+ + ", isAnimationSet=" + winAnimator.isAnimationSet());
if (!w.isDrawnLw()) {
Slog.v(TAG, "Not displayed: s="
+ winAnimator.mSurfaceController
@@ -943,7 +944,8 @@ class WindowSurfacePlacer {
// windows, since that means "perform layout as normal,
// just don't display").
if (!gone || !win.mHaveFrame || win.mLayoutNeeded
- || ((win.isConfigChanged() || win.setInsetsChanged()) &&
+ || ((win.isConfigChanged() || win.setInsetsChanged())
+ && !win.isGoneForLayoutLw() &&
((win.mAttrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 ||
(win.mHasSurface && win.mAppToken != null &&
win.mAppToken.layoutConfigChanges)))) {
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 45a73118320c..56e2001872e1 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -4218,6 +4218,23 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
}
+ private void removeCaApprovalsIfNeeded(int userId) {
+ for (UserInfo userInfo : mUserManager.getProfiles(userId)) {
+ boolean isSecure = mLockPatternUtils.isSecure(userInfo.id);
+ if (userInfo.isManagedProfile()){
+ isSecure |= mLockPatternUtils.isSecure(getProfileParentId(userInfo.id));
+ }
+ if (!isSecure) {
+ synchronized (this) {
+ getUserData(userInfo.id).mAcceptedCaCertificates.clear();
+ saveSettingsLocked(userInfo.id);
+ }
+
+ new MonitoringCertNotificationTask().execute(userInfo.id);
+ }
+ }
+ }
+
@Override
public boolean installCaCert(ComponentName admin, byte[] certBuffer) throws RemoteException {
enforceCanManageCaCerts(admin);
@@ -4644,6 +4661,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
DeviceAdminReceiver.ACTION_PASSWORD_CHANGED,
DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD, userHandle);
}
+ removeCaApprovalsIfNeeded(userHandle);
} finally {
mInjector.binderRestoreCallingIdentity(ident);
}
diff --git a/services/net/java/android/net/dhcp/DhcpClient.java b/services/net/java/android/net/dhcp/DhcpClient.java
index 52701d532e1a..6d0808f781fe 100644
--- a/services/net/java/android/net/dhcp/DhcpClient.java
+++ b/services/net/java/android/net/dhcp/DhcpClient.java
@@ -264,8 +264,8 @@ public class DhcpClient extends StateMachine {
mInterfaceBroadcastAddr = new PacketSocketAddress(mIface.getIndex(),
DhcpPacket.ETHER_BROADCAST);
return true;
- } catch(SocketException e) {
- Log.wtf(TAG, "Can't determine ifindex or MAC address for " + mIfaceName);
+ } catch(SocketException | NullPointerException e) {
+ Log.e(TAG, "Can't determine ifindex or MAC address for " + mIfaceName, e);
return false;
}
}
diff --git a/services/net/java/android/net/ip/IpManager.java b/services/net/java/android/net/ip/IpManager.java
index 59ebf1bc79cc..5667e340122e 100644
--- a/services/net/java/android/net/ip/IpManager.java
+++ b/services/net/java/android/net/ip/IpManager.java
@@ -690,7 +690,7 @@ public class IpManager extends StateMachine {
final InterfaceConfiguration ifcg = new InterfaceConfiguration();
ifcg.setLinkAddress(new LinkAddress("0.0.0.0/0"));
mNwService.setInterfaceConfig(mInterfaceName, ifcg);
- } catch (RemoteException e) {
+ } catch (IllegalStateException | RemoteException e) {
Log.e(mTag, "ALERT: Failed to clear IPv4 address on interface " + mInterfaceName, e);
}
}