diff options
129 files changed, 1857 insertions, 1028 deletions
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index 3d060feff70e..f08be4922495 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -5301,7 +5301,7 @@ message NetworkDnsEventReported { // Only valid for event_type = EVENT_RESNSEND. optional int32 res_nsend_flags = 5; - optional android.stats.dnsresolver.Transport network_type = 6; + optional android.stats.dnsresolver.NetworkType network_type = 6; // The DNS over TLS mode on a specific netId. optional android.stats.dnsresolver.PrivateDnsModes private_dns_modes = 7; @@ -5309,6 +5309,9 @@ message NetworkDnsEventReported { // Additional pass-through fields opaque to statsd. // The DNS resolver Mainline module can add new fields here without requiring an OS update. optional android.stats.dnsresolver.DnsQueryEvents dns_query_events = 8 [(log_mode) = MODE_BYTES]; + + // The sample rate of DNS stats (to statsd) is 1/sampling_rate_denom. + optional int32 sampling_rate_denom = 9; } /** diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index cebe6e1211e0..90b80e73c323 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -309,7 +309,7 @@ public abstract class AccessibilityService extends Service { * Name under which an AccessibilityService component publishes information * about itself. This meta-data must reference an XML resource containing an * <code><{@link android.R.styleable#AccessibilityService accessibility-service}></code> - * tag. This is a a sample XML file configuring an accessibility service: + * tag. This is a sample XML file configuring an accessibility service: * <pre> <accessibility-service * android:accessibilityEventTypes="typeViewClicked|typeViewFocused" * android:packageNames="foo.bar, foo.baz" diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index f66448f518c8..ceadd8510e44 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -5437,10 +5437,11 @@ public class Notification implements Parcelable /** * Construct a RemoteViews for the display in public contexts like on the lockscreen. * + * @param isLowPriority is this notification low priority * @hide */ @UnsupportedAppUsage - public RemoteViews makePublicContentView() { + public RemoteViews makePublicContentView(boolean isLowPriority) { if (mN.publicVersion != null) { final Builder builder = recoverBuilder(mContext, mN.publicVersion); return builder.createContentView(); @@ -5467,7 +5468,11 @@ public class Notification implements Parcelable } mN.extras = publicExtras; RemoteViews view; - view = makeNotificationHeader(); + StandardTemplateParams params = mParams.reset().fillTextsFrom(this); + if (isLowPriority) { + params.forceDefaultColor(); + } + view = makeNotificationHeader(params); view.setBoolean(R.id.notification_header, "setExpandOnlyOnButton", true); mN.extras = savedBundle; mN.mLargeIcon = largeIcon; diff --git a/core/java/android/hardware/biometrics/BiometricManager.java b/core/java/android/hardware/biometrics/BiometricManager.java index af66dc161343..d8110f33d723 100644 --- a/core/java/android/hardware/biometrics/BiometricManager.java +++ b/core/java/android/hardware/biometrics/BiometricManager.java @@ -129,6 +129,25 @@ public class BiometricManager { } /** + * @hide + * @param userId + * @return + */ + @RequiresPermission(USE_BIOMETRIC_INTERNAL) + public boolean hasEnrolledBiometrics(int userId) { + if (mService != null) { + try { + return mService.hasEnrolledBiometrics(userId); + } catch (RemoteException e) { + Slog.w(TAG, "Remote exception in hasEnrolledBiometrics(): " + e); + return false; + } + } else { + return false; + } + } + + /** * Listens for changes to biometric eligibility on keyguard from user settings. * @param callback * @hide diff --git a/core/java/android/hardware/biometrics/IBiometricService.aidl b/core/java/android/hardware/biometrics/IBiometricService.aidl index 18c14cb835a8..f0a0b2f0235f 100644 --- a/core/java/android/hardware/biometrics/IBiometricService.aidl +++ b/core/java/android/hardware/biometrics/IBiometricService.aidl @@ -42,6 +42,9 @@ interface IBiometricService { // Checks if biometrics can be used. int canAuthenticate(String opPackageName, int userId); + // Checks if any biometrics are enrolled. + boolean hasEnrolledBiometrics(int userId); + // Register callback for when keyguard biometric eligibility changes. void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback); diff --git a/core/java/android/view/IRecentsAnimationController.aidl b/core/java/android/view/IRecentsAnimationController.aidl index 956161acd762..955be8d40c47 100644 --- a/core/java/android/view/IRecentsAnimationController.aidl +++ b/core/java/android/view/IRecentsAnimationController.aidl @@ -77,6 +77,21 @@ interface IRecentsAnimationController { void hideCurrentInputMethod(); /** + * This call is deprecated, use #setDeferCancelUntilNextTransition() instead + * TODO(138144750): Remove this method once there are no callers + * @deprecated + */ + void setCancelWithDeferredScreenshot(boolean screenshot); + + /** + * Clean up the screenshot of previous task which was created during recents animation that + * was cancelled by a stack order change. + * + * @see {@link IRecentsAnimationRunner#onAnimationCanceled} + */ + void cleanupScreenshot(); + + /** * Set a state for controller whether would like to cancel recents animations with deferred * task screenshot presentation. * @@ -86,22 +101,23 @@ interface IRecentsAnimationController { * screenshot, so that Launcher can still control the leash lifecycle & make the next app * transition animate smoothly without flickering. * - * @param screenshot When set {@code true}, means recents animation will be canceled when the - * next app launch. System will take previous task's screenshot when the next - * app transition starting, and skip previous task's animation. - * Set {@code false} means will not take screenshot & skip animation - * for previous task. + * @param defer When set {@code true}, means that the recents animation will defer canceling the + * animation when a stack order change is triggered until the subsequent app + * transition start and skip previous task's animation. + * When set to {@code false}, means that the recents animation will be canceled + * immediately when the stack order changes. + * @param screenshot When set {@code true}, means that the system will take previous task's + * screenshot and replace the contents of the leash with it when the next app + * transition starting. The runner must call #cleanupScreenshot() to end the + * recents animation. + * When set to {@code false}, means that the system will simply wait for the + * next app transition start to immediately cancel the recents animation. This + * can be useful when you want an immediate transition into a state where the + * task is shown in the home/recents activity (without waiting for a + * screenshot). * * @see #cleanupScreenshot() * @see IRecentsAnimationRunner#onCancelled */ - void setCancelWithDeferredScreenshot(boolean screenshot); - - /** - * Clean up the screenshot of previous task which was created during recents animation that - * was cancelled by a stack order change. - * - * @see {@link IRecentsAnimationRunner#onAnimationCanceled} - */ - void cleanupScreenshot(); + void setDeferCancelUntilNextTransition(boolean defer, boolean screenshot); } diff --git a/core/java/android/view/IRecentsAnimationRunner.aidl b/core/java/android/view/IRecentsAnimationRunner.aidl index 9c652a8d990b..6cda60c80b7d 100644 --- a/core/java/android/view/IRecentsAnimationRunner.aidl +++ b/core/java/android/view/IRecentsAnimationRunner.aidl @@ -36,7 +36,7 @@ oneway interface IRecentsAnimationRunner { * @param deferredWithScreenshot If set to {@code true}, the contents of the task will be * replaced with a screenshot, such that the runner's leash is * still active. As soon as the runner doesn't need the leash - * anymore, it can call + * anymore, it must call * {@link IRecentsAnimationController#cleanupScreenshot). * * @see {@link RecentsAnimationController#cleanupScreenshot} diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index fd4dafc81f36..b2449d5b5340 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -967,6 +967,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ static boolean sBrokenInsetsDispatch; + /** + * Prior to Q, calling + * {@link com.android.internal.policy.DecorView#setBackgroundDrawable(Drawable)} + * did not call update the window format so the opacity of the background was not correctly + * applied to the window. Some applications rely on this misbehavior to work properly. + * <p> + * From Q, {@link com.android.internal.policy.DecorView#setBackgroundDrawable(Drawable)} is + * the same as {@link com.android.internal.policy.DecorView#setWindowBackground(Drawable)} + * which updates the window format. + * @hide + */ + protected static boolean sBrokenWindowBackground; + /** @hide */ @IntDef({NOT_FOCUSABLE, FOCUSABLE, FOCUSABLE_AUTO}) @Retention(RetentionPolicy.SOURCE) @@ -5223,6 +5236,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, sBrokenInsetsDispatch = ViewRootImpl.sNewInsetsMode != NEW_INSETS_MODE_FULL || targetSdkVersion < Build.VERSION_CODES.Q; + sBrokenWindowBackground = targetSdkVersion < Build.VERSION_CODES.Q; + sCompatibilityDone = true; } } diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index d985528c38fb..6b324a541c42 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -1202,13 +1202,13 @@ public class RelativeLayout extends ViewGroup { * determine where to position the view on the screen. If the view is not contained * within a relative layout, these attributes are ignored. * - * See the <a href="/guide/topics/ui/layout/relative.html"> - * Relative Layout</a> guide for example code demonstrating how to use relative layout’s + * See the <a href="{@docRoot}guide/topics/ui/layout/relative.html">Relative + * Layout</a> guide for example code demonstrating how to use relative layout's * layout parameters in a layout XML. * * To learn more about layout parameters and how they differ from typical view attributes, - * see the <a href="/guide/topics/ui/declaring-layout.html#attributes"> - * Layouts guide</a>. + * see the <a href="{@docRoot}guide/topics/ui/declaring-layout.html#attributes">Layouts + * guide</a>. * * * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignWithParentIfMissing diff --git a/core/java/android/widget/TabWidget.java b/core/java/android/widget/TabWidget.java index 49a0f39b3bad..4c67b080252a 100644 --- a/core/java/android/widget/TabWidget.java +++ b/core/java/android/widget/TabWidget.java @@ -433,7 +433,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { * to the next tabbed view, in this example). * <p> * To move both the focus AND the selected tab at once, please use - * {@link #setCurrentTab}. Normally, the view logic takes care of + * {@link #focusCurrentTab}. Normally, the view logic takes care of * adjusting the focus, so unless you're circumventing the UI, * you'll probably just focus your interest here. * diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index fe66cf9aab7d..7c52a40d4494 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -983,13 +983,14 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind @Override public void setBackgroundDrawable(Drawable background) { - // TODO: This should route through setWindowBackground, but late in the release to make this // change. if (mOriginalBackgroundDrawable != background) { mOriginalBackgroundDrawable = background; updateBackgroundDrawable(); - drawableChanged(); + if (!View.sBrokenWindowBackground) { + drawableChanged(); + } } } diff --git a/core/proto/android/stats/dnsresolver/dns_resolver.proto b/core/proto/android/stats/dnsresolver/dns_resolver.proto index af6fea017bef..9eaabfbca463 100644 --- a/core/proto/android/stats/dnsresolver/dns_resolver.proto +++ b/core/proto/android/stats/dnsresolver/dns_resolver.proto @@ -1,214 +1,217 @@ -/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-syntax = "proto2";
-package android.stats.dnsresolver;
-
-enum EventType {
- EVENT_UNKNOWN = 0;
- EVENT_GETADDRINFO = 1;
- EVENT_GETHOSTBYNAME = 2;
- EVENT_GETHOSTBYADDR = 3;
- EVENT_RES_NSEND = 4;
-}
-
-// The return value of the DNS resolver for each DNS lookups.
-// bionic/libc/include/netdb.h
-// system/netd/resolv/include/netd_resolv/resolv.h
-enum ReturnCode {
- RC_EAI_NO_ERROR = 0;
- RC_EAI_ADDRFAMILY = 1;
- RC_EAI_AGAIN = 2;
- RC_EAI_BADFLAGS = 3;
- RC_EAI_FAIL = 4;
- RC_EAI_FAMILY = 5;
- RC_EAI_MEMORY = 6;
- RC_EAI_NODATA = 7;
- RC_EAI_NONAME = 8;
- RC_EAI_SERVICE = 9;
- RC_EAI_SOCKTYPE = 10;
- RC_EAI_SYSTEM = 11;
- RC_EAI_BADHINTS = 12;
- RC_EAI_PROTOCOL = 13;
- RC_EAI_OVERFLOW = 14;
- RC_RESOLV_TIMEOUT = 255;
- RC_EAI_MAX = 256;
-}
-
-enum NsRcode {
- NS_R_NO_ERROR = 0; // No error occurred.
- NS_R_FORMERR = 1; // Format error.
- NS_R_SERVFAIL = 2; // Server failure.
- NS_R_NXDOMAIN = 3; // Name error.
- NS_R_NOTIMPL = 4; // Unimplemented.
- NS_R_REFUSED = 5; // Operation refused.
- // these are for BIND_UPDATE
- NS_R_YXDOMAIN = 6; // Name exists
- NS_R_YXRRSET = 7; // RRset exists
- NS_R_NXRRSET = 8; // RRset does not exist
- NS_R_NOTAUTH = 9; // Not authoritative for zone
- NS_R_NOTZONE = 10; // Zone of record different from zone section
- NS_R_MAX = 11;
- // The following are EDNS extended rcodes
- NS_R_BADVERS = 16;
- // The following are TSIG errors
- // NS_R_BADSIG = 16,
- NS_R_BADKEY = 17;
- NS_R_BADTIME = 18;
-}
-
-// Currently defined type values for resources and queries.
-enum NsType {
- NS_T_INVALID = 0; // Cookie.
- NS_T_A = 1; // Host address.
- NS_T_NS = 2; // Authoritative server.
- NS_T_MD = 3; // Mail destination.
- NS_T_MF = 4; // Mail forwarder.
- NS_T_CNAME = 5; // Canonical name.
- NS_T_SOA = 6; // Start of authority zone.
- NS_T_MB = 7; // Mailbox domain name.
- NS_T_MG = 8; // Mail group member.
- NS_T_MR = 9; // Mail rename name.
- NS_T_NULL = 10; // Null resource record.
- NS_T_WKS = 11; // Well known service.
- NS_T_PTR = 12; // Domain name pointer.
- NS_T_HINFO = 13; // Host information.
- NS_T_MINFO = 14; // Mailbox information.
- NS_T_MX = 15; // Mail routing information.
- NS_T_TXT = 16; // Text strings.
- NS_T_RP = 17; // Responsible person.
- NS_T_AFSDB = 18; // AFS cell database.
- NS_T_X25 = 19; // X_25 calling address.
- NS_T_ISDN = 20; // ISDN calling address.
- NS_T_RT = 21; // Router.
- NS_T_NSAP = 22; // NSAP address.
- NS_T_NSAP_PTR = 23; // Reverse NSAP lookup (deprecated).
- NS_T_SIG = 24; // Security signature.
- NS_T_KEY = 25; // Security key.
- NS_T_PX = 26; // X.400 mail mapping.
- NS_T_GPOS = 27; // Geographical position (withdrawn).
- NS_T_AAAA = 28; // IPv6 Address.
- NS_T_LOC = 29; // Location Information.
- NS_T_NXT = 30; // Next domain (security).
- NS_T_EID = 31; // Endpoint identifier.
- NS_T_NIMLOC = 32; // Nimrod Locator.
- NS_T_SRV = 33; // Server Selection.
- NS_T_ATMA = 34; // ATM Address
- NS_T_NAPTR = 35; // Naming Authority PoinTeR
- NS_T_KX = 36; // Key Exchange
- NS_T_CERT = 37; // Certification record
- NS_T_A6 = 38; // IPv6 address (experimental)
- NS_T_DNAME = 39; // Non-terminal DNAME
- NS_T_SINK = 40; // Kitchen sink (experimentatl)
- NS_T_OPT = 41; // EDNS0 option (meta-RR)
- NS_T_APL = 42; // Address prefix list (RFC 3123)
- NS_T_DS = 43; // Delegation Signer
- NS_T_SSHFP = 44; // SSH Fingerprint
- NS_T_IPSECKEY = 45; // IPSEC Key
- NS_T_RRSIG = 46; // RRset Signature
- NS_T_NSEC = 47; // Negative security
- NS_T_DNSKEY = 48; // DNS Key
- NS_T_DHCID = 49; // Dynamic host configuratin identifier
- NS_T_NSEC3 = 50; // Negative security type 3
- NS_T_NSEC3PARAM = 51; // Negative security type 3 parameters
- NS_T_HIP = 55; // Host Identity Protocol
- NS_T_SPF = 99; // Sender Policy Framework
- NS_T_TKEY = 249; // Transaction key
- NS_T_TSIG = 250; // Transaction signature.
- NS_T_IXFR = 251; // Incremental zone transfer.
- NS_T_AXFR = 252; // Transfer zone of authority.
- NS_T_MAILB = 253; // Transfer mailbox records.
- NS_T_MAILA = 254; // Transfer mail agent records.
- NS_T_ANY = 255; // Wildcard match.
- NS_T_ZXFR = 256; // BIND-specific, nonstandard.
- NS_T_DLV = 32769; // DNSSEC look-aside validatation.
- NS_T_MAX = 65536;
-}
-
-enum IpVersion {
- IV_UNKNOWN = 0;
- IV_IPV4 = 1;
- IV_IPV6 = 2;
-}
-
-enum TransportType {
- TT_UNKNOWN = 0;
- TT_UDP = 1;
- TT_TCP = 2;
- TT_DOT = 3;
-}
-
-enum PrivateDnsModes {
- PDM_UNKNOWN = 0;
- PDM_OFF = 1;
- PDM_OPPORTUNISTIC = 2;
- PDM_STRICT = 3;
-}
-
-enum Transport {
- // Indicates this network uses a Cellular transport.
- TRANSPORT_DEFAULT = 0; // TRANSPORT_CELLULAR
- // Indicates this network uses a Wi-Fi transport.
- TRANSPORT_WIFI = 1;
- // Indicates this network uses a Bluetooth transport.
- TRANSPORT_BLUETOOTH = 2;
- // Indicates this network uses an Ethernet transport.
- TRANSPORT_ETHERNET = 3;
- // Indicates this network uses a VPN transport.
- TRANSPORT_VPN = 4;
- // Indicates this network uses a Wi-Fi Aware transport.
- TRANSPORT_WIFI_AWARE = 5;
- // Indicates this network uses a LoWPAN transport.
- TRANSPORT_LOWPAN = 6;
-}
-
-enum CacheStatus{
- // the cache can't handle that kind of queries.
- // or the answer buffer is too small.
- CS_UNSUPPORTED = 0;
- // the cache doesn't know about this query.
- CS_NOTFOUND = 1;
- // the cache found the answer.
- CS_FOUND = 2;
- // Don't do anything on cache.
- CS_SKIP = 3;
-}
-
-message DnsQueryEvent {
- optional android.stats.dnsresolver.NsRcode rcode = 1;
-
- optional android.stats.dnsresolver.NsType type = 2;
-
- optional android.stats.dnsresolver.CacheStatus cache_hit = 3;
-
- optional android.stats.dnsresolver.IpVersion ip_version = 4;
-
- optional android.stats.dnsresolver.TransportType transport = 5;
-
- // Number of DNS query retry times
- optional int32 retry_times = 6;
-
- // Ordinal number of name server.
- optional int32 dns_server_count = 7;
-
- // Used only by TCP and DOT. True for new connections.
- optional bool connected = 8;
-
- optional int32 latency_micros = 9;
-}
-
-message DnsQueryEvents {
- repeated DnsQueryEvent dns_query_event = 1;
-}
+/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +syntax = "proto2"; +package android.stats.dnsresolver; + +enum EventType { + EVENT_UNKNOWN = 0; + EVENT_GETADDRINFO = 1; + EVENT_GETHOSTBYNAME = 2; + EVENT_GETHOSTBYADDR = 3; + EVENT_RES_NSEND = 4; +} + +// The return value of the DNS resolver for each DNS lookups. +// bionic/libc/include/netdb.h +// system/netd/resolv/include/netd_resolv/resolv.h +enum ReturnCode { + RC_EAI_NO_ERROR = 0; + RC_EAI_ADDRFAMILY = 1; + RC_EAI_AGAIN = 2; + RC_EAI_BADFLAGS = 3; + RC_EAI_FAIL = 4; + RC_EAI_FAMILY = 5; + RC_EAI_MEMORY = 6; + RC_EAI_NODATA = 7; + RC_EAI_NONAME = 8; + RC_EAI_SERVICE = 9; + RC_EAI_SOCKTYPE = 10; + RC_EAI_SYSTEM = 11; + RC_EAI_BADHINTS = 12; + RC_EAI_PROTOCOL = 13; + RC_EAI_OVERFLOW = 14; + RC_RESOLV_TIMEOUT = 255; + RC_EAI_MAX = 256; +} + +enum NsRcode { + NS_R_NO_ERROR = 0; // No error occurred. + NS_R_FORMERR = 1; // Format error. + NS_R_SERVFAIL = 2; // Server failure. + NS_R_NXDOMAIN = 3; // Name error. + NS_R_NOTIMPL = 4; // Unimplemented. + NS_R_REFUSED = 5; // Operation refused. + // these are for BIND_UPDATE + NS_R_YXDOMAIN = 6; // Name exists + NS_R_YXRRSET = 7; // RRset exists + NS_R_NXRRSET = 8; // RRset does not exist + NS_R_NOTAUTH = 9; // Not authoritative for zone + NS_R_NOTZONE = 10; // Zone of record different from zone section + NS_R_MAX = 11; + // The following are EDNS extended rcodes + NS_R_BADVERS = 16; + // The following are TSIG errors + // NS_R_BADSIG = 16, + NS_R_BADKEY = 17; + NS_R_BADTIME = 18; + NS_R_INTERNAL_ERROR = 254; + NS_R_TIMEOUT = 255; +} + +// Currently defined type values for resources and queries. +enum NsType { + NS_T_INVALID = 0; // Cookie. + NS_T_A = 1; // Host address. + NS_T_NS = 2; // Authoritative server. + NS_T_MD = 3; // Mail destination. + NS_T_MF = 4; // Mail forwarder. + NS_T_CNAME = 5; // Canonical name. + NS_T_SOA = 6; // Start of authority zone. + NS_T_MB = 7; // Mailbox domain name. + NS_T_MG = 8; // Mail group member. + NS_T_MR = 9; // Mail rename name. + NS_T_NULL = 10; // Null resource record. + NS_T_WKS = 11; // Well known service. + NS_T_PTR = 12; // Domain name pointer. + NS_T_HINFO = 13; // Host information. + NS_T_MINFO = 14; // Mailbox information. + NS_T_MX = 15; // Mail routing information. + NS_T_TXT = 16; // Text strings. + NS_T_RP = 17; // Responsible person. + NS_T_AFSDB = 18; // AFS cell database. + NS_T_X25 = 19; // X_25 calling address. + NS_T_ISDN = 20; // ISDN calling address. + NS_T_RT = 21; // Router. + NS_T_NSAP = 22; // NSAP address. + NS_T_NSAP_PTR = 23; // Reverse NSAP lookup (deprecated). + NS_T_SIG = 24; // Security signature. + NS_T_KEY = 25; // Security key. + NS_T_PX = 26; // X.400 mail mapping. + NS_T_GPOS = 27; // Geographical position (withdrawn). + NS_T_AAAA = 28; // IPv6 Address. + NS_T_LOC = 29; // Location Information. + NS_T_NXT = 30; // Next domain (security). + NS_T_EID = 31; // Endpoint identifier. + NS_T_NIMLOC = 32; // Nimrod Locator. + NS_T_SRV = 33; // Server Selection. + NS_T_ATMA = 34; // ATM Address + NS_T_NAPTR = 35; // Naming Authority PoinTeR + NS_T_KX = 36; // Key Exchange + NS_T_CERT = 37; // Certification record + NS_T_A6 = 38; // IPv6 address (experimental) + NS_T_DNAME = 39; // Non-terminal DNAME + NS_T_SINK = 40; // Kitchen sink (experimentatl) + NS_T_OPT = 41; // EDNS0 option (meta-RR) + NS_T_APL = 42; // Address prefix list (RFC 3123) + NS_T_DS = 43; // Delegation Signer + NS_T_SSHFP = 44; // SSH Fingerprint + NS_T_IPSECKEY = 45; // IPSEC Key + NS_T_RRSIG = 46; // RRset Signature + NS_T_NSEC = 47; // Negative security + NS_T_DNSKEY = 48; // DNS Key + NS_T_DHCID = 49; // Dynamic host configuratin identifier + NS_T_NSEC3 = 50; // Negative security type 3 + NS_T_NSEC3PARAM = 51; // Negative security type 3 parameters + NS_T_HIP = 55; // Host Identity Protocol + NS_T_SPF = 99; // Sender Policy Framework + NS_T_TKEY = 249; // Transaction key + NS_T_TSIG = 250; // Transaction signature. + NS_T_IXFR = 251; // Incremental zone transfer. + NS_T_AXFR = 252; // Transfer zone of authority. + NS_T_MAILB = 253; // Transfer mailbox records. + NS_T_MAILA = 254; // Transfer mail agent records. + NS_T_ANY = 255; // Wildcard match. + NS_T_ZXFR = 256; // BIND-specific, nonstandard. + NS_T_DLV = 32769; // DNSSEC look-aside validatation. + NS_T_MAX = 65536; +} + +enum IpVersion { + IV_UNKNOWN = 0; + IV_IPV4 = 1; + IV_IPV6 = 2; +} + +enum Protocol { + PROTO_UNKNOWN = 0; + PROTO_UDP = 1; + PROTO_TCP = 2; + PROTO_DOT = 3; +} + +enum PrivateDnsModes { + PDM_UNKNOWN = 0; + PDM_OFF = 1; + PDM_OPPORTUNISTIC = 2; + PDM_STRICT = 3; +} + +enum NetworkType { + NT_UNKNOWN = 0; + // Indicates this network uses a Cellular transport. + NT_CELLULAR = 1; + // Indicates this network uses a Wi-Fi transport. + NT_WIFI = 2; + // Indicates this network uses a Bluetooth transport. + NT_BLUETOOTH = 3; + // Indicates this network uses an Ethernet transport. + NT_ETHERNET = 4; + // Indicates this network uses a VPN transport. + NT_VPN = 5; + // Indicates this network uses a Wi-Fi Aware transport. + NT_WIFI_AWARE = 6; + // Indicates this network uses a LoWPAN transport. + NT_LOWPAN = 7; +} + +enum CacheStatus{ + // the cache can't handle that kind of queries. + // or the answer buffer is too small. + CS_UNSUPPORTED = 0; + // the cache doesn't know about this query. + CS_NOTFOUND = 1; + // the cache found the answer. + CS_FOUND = 2; + // Don't do anything on cache. + CS_SKIP = 3; +} + +message DnsQueryEvent { + optional android.stats.dnsresolver.NsRcode rcode = 1; + + optional android.stats.dnsresolver.NsType type = 2; + + optional android.stats.dnsresolver.CacheStatus cache_hit = 3; + + optional android.stats.dnsresolver.IpVersion ip_version = 4; + + optional android.stats.dnsresolver.Protocol protocol = 5; + + // Number of DNS query retry times + optional int32 retry_times = 6; + + // Ordinal number of name server. + optional int32 dns_server_index = 7; + + // Used only by TCP and DOT. True for new connections. + optional bool connected = 8; + + optional int32 latency_micros = 9; +} + +message DnsQueryEvents { + repeated DnsQueryEvent dns_query_event = 1; +} diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index a3fccd96f224..e7e20fc41eee 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -726,7 +726,7 @@ <p>Protection level: dangerous <p> This is a hard restricted permission which cannot be held by an app until - the installer on record did not whitelist the permission. For more details see + the installer on record whitelists the permission. For more details see {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.SEND_SMS" @@ -740,7 +740,7 @@ <p>Protection level: dangerous <p> This is a hard restricted permission which cannot be held by an app until - the installer on record did not whitelist the permission. For more details see + the installer on record whitelists the permission. For more details see {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.RECEIVE_SMS" @@ -754,7 +754,7 @@ <p>Protection level: dangerous <p> This is a hard restricted permission which cannot be held by an app until - the installer on record did not whitelist the permission. For more details see + the installer on record whitelists the permission. For more details see {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.READ_SMS" @@ -768,7 +768,7 @@ <p>Protection level: dangerous <p> This is a hard restricted permission which cannot be held by an app until - the installer on record did not whitelist the permission. For more details see + the installer on record whitelists the permission. For more details see {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.RECEIVE_WAP_PUSH" @@ -782,7 +782,7 @@ <p>Protection level: dangerous <p> This is a hard restricted permission which cannot be held by an app until - the installer on record did not whitelist the permission. For more details see + the installer on record whitelists the permission. For more details see {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.RECEIVE_MMS" @@ -805,7 +805,7 @@ <p>Protection level: dangerous <p> This is a hard restricted permission which cannot be held by an app until - the installer on record did not whitelist the permission. For more details see + the installer on record whitelists the permission. For more details see {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. @hide Pending API council approval --> @@ -851,7 +851,7 @@ targetSdkVersion}</a> is 4 or higher. <p> This is a soft restricted permission which cannot be held by an app it its - full form until the installer on record did not whitelist the permission. + full form until the installer on record whitelists the permission. Specifically, if the permission is whitelisted the holder app can access external storage and the visual and aural media collections while if the permission is not whitelisted the holder app can only access to the visual @@ -859,7 +859,7 @@ meaning that the whitelist state can be specified only at install time and cannot change until the app is installed. For more details see {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. - --> + <p>Protection level: dangerous --> <permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_sdcardRead" @@ -880,8 +880,9 @@ read/write files in your application-specific directories returned by {@link android.content.Context#getExternalFilesDir} and {@link android.content.Context#getExternalCacheDir}. - <p>Is this permission is not whitelisted for an app that targets an API level before + <p>If this permission is not whitelisted for an app that targets an API level before {@link android.os.Build.VERSION_CODES#Q} this permission cannot be granted to apps.</p> + <p>Protection level: dangerous</p> --> <permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:permissionGroup="android.permission-group.UNDEFINED" @@ -891,7 +892,8 @@ android:protectionLevel="dangerous" /> <!-- Allows an application to access any geographic locations persisted in the - user's shared collection. --> + user's shared collection. + <p>Protection level: dangerous --> <permission android:name="android.permission.ACCESS_MEDIA_LOCATION" android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_mediaLocation" @@ -948,7 +950,7 @@ <p>Protection level: dangerous <p> This is a hard restricted permission which cannot be held by an app until - the installer on record did not whitelist the permission. For more details see + the installer on record whitelists the permission. For more details see {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" @@ -994,7 +996,7 @@ <p>Protection level: dangerous <p> This is a hard restricted permission which cannot be held by an app until - the installer on record did not whitelist the permission. For more details see + the installer on record whitelists the permission. For more details see {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.READ_CALL_LOG" @@ -1018,7 +1020,7 @@ <p>Protection level: dangerous <p> This is a hard restricted permission which cannot be held by an app until - the installer on record did not whitelist the permission. For more details see + the installer on record whitelists the permission. For more details see {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.WRITE_CALL_LOG" @@ -1034,7 +1036,7 @@ <p>Protection level: dangerous <p> This is a hard restricted permission which cannot be held by an app until - the installer on record did not whitelist the permission. For more details see + the installer on record whitelists the permission. For more details see {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. @deprecated Applications should use {@link android.telecom.CallRedirectionService} instead @@ -1711,7 +1713,7 @@ <!-- Allows applications to pair bluetooth devices without user interaction, and to allow or disallow phonebook access or message access. - This is not available to third party applications. --> + <p>Not for use by third-party applications. --> <permission android:name="android.permission.BLUETOOTH_PRIVILEGED" android:protectionLevel="signature|privileged" /> @@ -2561,7 +2563,8 @@ android:protectionLevel="signature" /> <!-- Allows an application to modify the current configuration, such - as locale. --> + as locale. + <p>Protection level: signature|privileged|development --> <permission android:name="android.permission.CHANGE_CONFIGURATION" android:protectionLevel="signature|privileged|development" /> @@ -2860,7 +2863,8 @@ <!-- ==================================== --> <eat-comment /> - <!-- Allows access to the list of accounts in the Accounts Service. --> + <!-- Allows access to the list of accounts in the Accounts Service. + <p>Protection level: signature|privileged --> <permission android:name="android.permission.GET_ACCOUNTS_PRIVILEGED" android:protectionLevel="signature|privileged" /> @@ -3439,7 +3443,8 @@ android:protectionLevel="signature" /> <!-- Old permission for deleting an app's cache files, no longer used, - but signals for us to quietly ignore calls instead of throwing an exception. --> + but signals for us to quietly ignore calls instead of throwing an exception. + <p>Protection level: signature|privileged --> <permission android:name="android.permission.DELETE_CACHE_FILES" android:protectionLevel="signature|privileged" /> @@ -3797,7 +3802,8 @@ <!-- Allows an application to collect component usage statistics <p>Declaring the permission implies intention to use the API and the user of the - device can grant permission through the Settings application. --> + device can grant permission through the Settings application. + <p>Protection level: signature|privileged|development|appop --> <permission android:name="android.permission.PACKAGE_USAGE_STATS" android:protectionLevel="signature|privileged|development|appop" /> <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /> @@ -3820,14 +3826,14 @@ <!-- Permission an application must hold in order to use {@link android.provider.Settings#ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS}. - This is a normal permission: an app requesting it will always be granted the - permission, without the user needing to approve or see it. --> + <p>Protection level: normal --> <permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" android:label="@string/permlab_requestIgnoreBatteryOptimizations" android:description="@string/permdesc_requestIgnoreBatteryOptimizations" android:protectionLevel="normal" /> - <!-- Allows an application to collect battery statistics --> + <!-- Allows an application to collect battery statistics + <p>Protection level: signature|privileged|development --> <permission android:name="android.permission.BATTERY_STATS" android:protectionLevel="signature|privileged|development" /> @@ -3857,7 +3863,8 @@ android:protectionLevel="signature" /> <!-- Must be required by a {@link android.widget.RemoteViewsService}, - to ensure that only the system can bind to it. --> + to ensure that only the system can bind to it. + <p>Protection level: signature|privileged --> <permission android:name="android.permission.BIND_REMOTEVIEWS" android:protectionLevel="signature|privileged" /> @@ -3899,7 +3906,8 @@ to the path in the provider where global search queries are performed. This permission can not be held by regular applications; it is used by applications to protect themselves from everyone else - besides global search. --> + besides global search. + <p>Protection level: signature|privileged --> <permission android:name="android.permission.GLOBAL_SEARCH" android:protectionLevel="signature|privileged" /> @@ -4438,7 +4446,8 @@ <permission android:name="android.permission.MODIFY_THEME_OVERLAY" android:protectionLevel="signature" /> - <!-- Allows an instant app to create foreground services. --> + <!-- Allows an instant app to create foreground services. + <p>Protection level: signature|development|instant|appop --> <permission android:name="android.permission.INSTANT_APP_FOREGROUND_SERVICE" android:protectionLevel="signature|development|instant|appop" /> @@ -4508,7 +4517,8 @@ <permission android:name="android.permission.MONITOR_DEFAULT_SMS_PACKAGE" android:protectionLevel="signature|privileged" /> - <!-- A subclass of {@link android.service.carrier.CarrierMessagingClientService} must be protected with this permission. --> + <!-- A subclass of {@link android.service.carrier.CarrierMessagingClientService} must be protected with this permission. + <p>Protection level: signature --> <permission android:name="android.permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE" android:protectionLevel="signature" /> @@ -4540,13 +4550,15 @@ <permission android:name="android.permission.GRANT_PROFILE_OWNER_DEVICE_IDS_ACCESS" android:protectionLevel="signature" /> - <!-- Allows financial apps to read filtered sms messages. --> + <!-- Allows financial apps to read filtered sms messages. + Protection level: signature|appop --> <permission android:name="android.permission.SMS_FINANCIAL_TRANSACTIONS" android:protectionLevel="signature|appop" /> <!-- Required for apps targeting {@link android.os.Build.VERSION_CODES#Q} that want to use {@link android.app.Notification.Builder#setFullScreenIntent notification full screen - intents}. --> + intents}. + <p>Protection level: normal --> <permission android:name="android.permission.USE_FULL_SCREEN_INTENT" android:protectionLevel="normal" /> diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml index 7dc0b92437e2..5169c1de0ea4 100644 --- a/core/res/res/values-hi/strings.xml +++ b/core/res/res/values-hi/strings.xml @@ -339,21 +339,21 @@ <string name="permlab_answerPhoneCalls" msgid="4077162841226223337">"फ़ोन कॉल का जवाब दें"</string> <string name="permdesc_answerPhoneCalls" msgid="2901889867993572266">"ऐप्लिकेशन को किसी इनकमिंग फ़ोन कॉल का जवाब देने देती है."</string> <string name="permlab_receiveSms" msgid="8673471768947895082">"मैसेज (एसएमएस) पाएं"</string> - <string name="permdesc_receiveSms" msgid="6424387754228766939">"ऐप को मैसेज (एसएमएस) को प्राप्त और संसाधित करने देता है. इसका अर्थ है कि ऐप आपके डिवाइस पर भेजे गए संदेशों की निगरानी आपको दिखाए बिना कर सकता है और उन्हें हटा सकता है."</string> + <string name="permdesc_receiveSms" msgid="6424387754228766939">"एप्लिकेशन को मैसेज (एसएमएस) पाने और प्रोसेस करने देता है. इसका मतलब है कि एप्लिकेशन आपके डिवाइस पर भेजे गए मैसेज की निगरानी आपको दिखाए बिना कर सकता है और उन्हें हटा सकता है."</string> <string name="permlab_receiveMms" msgid="1821317344668257098">"मैसेज (एमएमएस) पाएं"</string> <string name="permdesc_receiveMms" msgid="533019437263212260">"ऐप को मल्टीमीडिया मैसेज (एमएमएस) को पाने और उन पर कार्रवाई करने देता है. इसका मतलब है कि ऐप आपके डिवाइस पर भेजे गए मैसेज की निगरानी आपको दिखाए बिना कर सकता है और उन्हें हटा सकता है."</string> <string name="permlab_readCellBroadcasts" msgid="1598328843619646166">"सेल ब्रॉडकास्ट (CBC) मैसेज पढ़ें"</string> <string name="permdesc_readCellBroadcasts" msgid="6361972776080458979">"ऐप को, वो सेल ब्रॉडकास्ट (CBC) मैसेज पढ़ने देता है जो आपके डिवाइस को मिले हैं. सेल ब्रॉडकास्ट (CBC) अलर्ट कुछ स्थानों (लोकेशन) पर आपको आपातकालीन स्थितियों की चेतावनी देने के लिए दिए जाते हैं. आपातकालीन सेल ब्रॉडकास्ट (CBC) मिलने पर, धोखा देने वाले ऐप आपके डिवाइस के परफ़ॉर्मेंस या कार्यवाही में दखल दे सकते हैं."</string> - <string name="permlab_subscribedFeedsRead" msgid="4756609637053353318">"सदस्यता-प्राप्त फ़ीड पढ़ें"</string> - <string name="permdesc_subscribedFeedsRead" msgid="5557058907906144505">"ऐप्स को वर्तमान में समन्वयित फ़ीड के बारे में विवरण प्राप्त करने देता है."</string> + <string name="permlab_subscribedFeedsRead" msgid="4756609637053353318">"सदस्यता वाली फ़ीड पढ़ें"</string> + <string name="permdesc_subscribedFeedsRead" msgid="5557058907906144505">"एप्लिकेशन को मौजूदा समय में सिंक फ़ीड के बारे में जानकारी देता है."</string> <string name="permlab_sendSms" msgid="7544599214260982981">"मैसेज (एमएमएस) भेजें और देखें"</string> <string name="permdesc_sendSms" msgid="7094729298204937667">"ऐप को मैसेज (एसएमएस) भेजने देता है. इसकी वजह से उम्मीद से ज़्यादा शुल्क लग सकते हैं. धोखा देने वाले ऐप आपकी पुष्टि के बिना मैसेज भेजकर आपका पैसा खर्च करवा सकते हैं."</string> <string name="permlab_readSms" msgid="8745086572213270480">"अपने मैसेज (एसएमएस या एमएमएस) पढ़ें"</string> <string name="permdesc_readSms" product="tablet" msgid="4741697454888074891">"यह ऐप आपके टैबलेट पर सहेजे गए सभी मैसेज (एसएमएस) पढ़ सकता है."</string> <string name="permdesc_readSms" product="tv" msgid="5796670395641116592">"यह ऐप आपके टीवी पर सहेजे गए सभी मैसेज (एसएमएस) पढ़ सकता है."</string> <string name="permdesc_readSms" product="default" msgid="6826832415656437652">"यह ऐप आपके फ़ोन पर सहेजे गए सभी मैसेज (एसएमएस) पढ़ सकता है."</string> - <string name="permlab_receiveWapPush" msgid="5991398711936590410">"लेख संदेश (WAP) प्राप्त करें"</string> - <string name="permdesc_receiveWapPush" msgid="748232190220583385">"ऐप्स को WAP संदेशों को प्राप्त और संसाधित करने देता है. इस अनुमति में आपको भेजे गए संदेशों की निगरानी आपको दिखाए बिना करने और हटाने की क्षमता शामिल है."</string> + <string name="permlab_receiveWapPush" msgid="5991398711936590410">"टेक्सट मैसेज (WAP) पाएं"</string> + <string name="permdesc_receiveWapPush" msgid="748232190220583385">"एप्लिकेशन को WAP मैसेज पाने और प्रोसेस करने देता है. इस अनुमति में आपको भेजे गए मैसेज की निगरानी आपको दिए एप्लिकेशन को दिखाए बिना करने और हटाने की क्षमता शामिल है."</string> <string name="permlab_getTasks" msgid="6466095396623933906">"चल रहे ऐप्स पुनर्प्राप्त करें"</string> <string name="permdesc_getTasks" msgid="7454215995847658102">"ऐप को माजूदा समय में और हाल ही में चल रही कार्रवाइयों के बारे में जानकारी निकालने देता है. इससे ऐप डिवाइस पर इस्तेमाल किए गए ऐप के बारे में जानकारी खोज सकता है."</string> <string name="permlab_manageProfileAndDeviceOwners" msgid="7918181259098220004">"प्रोफ़ाइल और डिवाइस स्वामियों को प्रबंधित करें"</string> @@ -467,9 +467,9 @@ <string name="permdesc_setTimeZone" product="tv" msgid="888864653946175955">"ऐप को टीवी का समय क्षेत्र बदलने देती है."</string> <string name="permdesc_setTimeZone" product="default" msgid="4499943488436633398">"ऐप्स को टैबलेट का समय क्षेत्र बदलने देता है."</string> <string name="permlab_getAccounts" msgid="1086795467760122114">"डिवाइस पर खाते ढूंढें"</string> - <string name="permdesc_getAccounts" product="tablet" msgid="2741496534769660027">"ऐप्स को टैबलेट द्वारा ज्ञात खातों की सूची प्राप्त करने देता है. इसमें वे खाते शामिल हो सकते हैं जिन्हें इंस्टॉल किए गए ऐप्स ने बनाया है."</string> - <string name="permdesc_getAccounts" product="tv" msgid="4190633395633907543">"ऐप को टीवी द्वारा ज्ञात खातों की सूची प्राप्त करने देती है. इसमें इंस्टॉल किए गए ऐप्लिकेशन के द्वारा बनाए गए खाते शामिल हो सकते हैं."</string> - <string name="permdesc_getAccounts" product="default" msgid="3448316822451807382">"ऐप्स को फ़ोन द्वारा ज्ञात खातों की सूची प्राप्त करने देता है. इसमें वे खाते शामिल हो सकते हैं जिन्हें इंस्टॉल किए गए ऐप्स ने बनाया है."</string> + <string name="permdesc_getAccounts" product="tablet" msgid="2741496534769660027">"एप्लिकेशन को टैबलेट से ज्ञात खातों की सूची पाने देता है. इसमें वे खाते शामिल हो सकते हैं जिन्हें इंस्टॉल किए गए एप्लिकेशन ने बनाया है."</string> + <string name="permdesc_getAccounts" product="tv" msgid="4190633395633907543">"ऐप्लिकेशन को टीवी से ज्ञात खातों की सूची पाने देती है. इसमें इंस्टॉल किए गए ऐप्लिकेशन से बनाए गए खाते शामिल हो सकते हैं."</string> + <string name="permdesc_getAccounts" product="default" msgid="3448316822451807382">"एप्लिकेशन को फ़ोन से ज्ञात खातों की सूची पाने देता है. इसमें वे खाते शामिल हो सकते हैं जिन्हें इंस्टॉल किए गए एप्लिकेशन ने बनाया है."</string> <string name="permlab_accessNetworkState" msgid="4951027964348974773">"नेटवर्क कनेक्शन देखें"</string> <string name="permdesc_accessNetworkState" msgid="8318964424675960975">"ऐप को नेटवर्क कनेक्शन के बारे में जानकारी देखने देता है, जैसे कौन से नेटवर्क मौजूद हैं और कनेक्ट हैं."</string> <string name="permlab_createNetworkSockets" msgid="7934516631384168107">"नेटवर्क को पूरी तरह इस्तेमाल करें"</string> @@ -483,9 +483,9 @@ <string name="permlab_changeWifiState" msgid="6550641188749128035">"वाई-फ़ाई से कनेक्ट और डिस्कनेक्ट करें"</string> <string name="permdesc_changeWifiState" msgid="7137950297386127533">"ऐप्स को वाई-फ़ाई पहुंच बिंदुओं से कनेक्ट और डिसकनेक्ट करने और वाई-फ़ाई नेटवर्क के लिए डिवाइस कॉन्फ़िगरेशन में परिवर्तन करने देता है."</string> <string name="permlab_changeWifiMulticastState" msgid="1368253871483254784">"वाई-फ़ाई मल्टीकास्ट पाने को अनुमति दें"</string> - <string name="permdesc_changeWifiMulticastState" product="tablet" msgid="7969774021256336548">"ऐप्स को वाई-फ़ाई नेटवर्क पर मल्टीकास्ट पते के उपयोग से केवल आपके टैबलेट पर ही नहीं, बल्कि सभी डिवाइस पर भेजे गए पैकेट प्राप्त करने देता है. यह गैर-मल्टीकास्ट मोड से ज़्यादा पावर का उपयोग करता है."</string> - <string name="permdesc_changeWifiMulticastState" product="tv" msgid="9031975661145014160">"ऐप को मल्टीकास्ट पतों का उपयोग करके ना केवल आपके टीवी को, बल्कि वाई-फ़ाई पर मौजूद सभी डिवाइसों को पैकेट भेजने और प्राप्त करने देती है. इसमें गैर-मल्टीकास्ट मोड की अपेक्षा ज़्यादा पावर का उपयोग होता है."</string> - <string name="permdesc_changeWifiMulticastState" product="default" msgid="6851949706025349926">"ऐप्स को वाई-फ़ाई नेटवर्क पर मल्टीकास्ट पते के उपयोग से केवल आपके फ़ोन पर ही नहीं, बल्कि सभी डिवाइस पर भेजे गए पैकेट प्राप्त करने देता है. यह गैर-मल्टीकास्ट मोड से ज़्यादा पावर का उपयोग करता है."</string> + <string name="permdesc_changeWifiMulticastState" product="tablet" msgid="7969774021256336548">"एप्लिकेशन को वाई-फ़ाई नेटवर्क पर मल्टीकास्ट पते के इस्तेमाल से सिर्फ़ आपके टैबलेट पर ही नहीं, बल्कि सभी डिवाइस पर भेजे गए पैकेट पाने देता है. यह गैर-मल्टीकास्ट मोड से ज़्यादा पावर का इस्तेमाल करता है."</string> + <string name="permdesc_changeWifiMulticastState" product="tv" msgid="9031975661145014160">"ऐप्लिकेशन को मल्टीकास्ट पतों का उपयोग करके न सिर्फ़ आपके टीवी को, बल्कि वाई-फ़ाई पर मौजूद सभी डिवाइसों को पैकेट भेजने और पाने देती है. इसमें गैर-मल्टीकास्ट मोड की अपेक्षा ज़्यादा पावर का उपयोग होता है."</string> + <string name="permdesc_changeWifiMulticastState" product="default" msgid="6851949706025349926">"एप्लिकेशन को वाई-फ़ाई नेटवर्क पर मल्टीकास्ट पते के इस्तेमाल से सिर्फ़ आपके फ़ोन पर ही नहीं, बल्कि सभी डिवाइस पर भेजे गए पैकेट पाने देता है. यह गैर-मल्टीकास्ट मोड से ज़्यादा पावर का इस्तेमाल करता है."</string> <string name="permlab_bluetoothAdmin" msgid="6006967373935926659">"ब्लूटूथ सेटिंग पर पहुंचें"</string> <string name="permdesc_bluetoothAdmin" product="tablet" msgid="6921177471748882137">"किसी ऐप्स को स्थानीय ब्लूटूथ टैबलेट कॉन्फ़िगर करने की और रिमोट डिवाइस के साथ खोजने और युग्मित करने देता है."</string> <string name="permdesc_bluetoothAdmin" product="tv" msgid="3373125682645601429">"ऐप को स्थानीय ब्लूटूथ टीवी कॉन्फ़िगर करने देती है और दूरस्थ डिवाइसों को खोजने और उनसे युग्मित करने देती है."</string> @@ -503,7 +503,7 @@ <string name="permlab_nfc" msgid="4423351274757876953">"नियर फ़ील्ड कम्यूनिकेशन नियंत्रित करें"</string> <string name="permdesc_nfc" msgid="7120611819401789907">"ऐप्स को नियर फ़ील्ड कम्यूनिकेशन (NFC) टैग, कार्ड, और रीडर के साथ संचार करने देता है."</string> <string name="permlab_disableKeyguard" msgid="3598496301486439258">"अपना स्क्रीन लॉक अक्षम करें"</string> - <string name="permdesc_disableKeyguard" msgid="6034203065077122992">"ऐप्स को कीलॉक और कोई भी संबद्ध पासवर्ड सुरक्षा अक्षम करने देता है. उदाहरण के लिए, इनकमिंग फ़ोन कॉल प्राप्त करते समय फ़ोन, कीलॉक को अक्षम कर देता है, फिर कॉल खत्म होने पर कीलॉक को फिर से सक्षम कर देता है."</string> + <string name="permdesc_disableKeyguard" msgid="6034203065077122992">"ऐप्स को कीलॉक और कोई भी संबद्ध पासवर्ड सुरक्षा बंद करने देता है. उदाहरण के लिए, इनकमिंग फ़ोन कॉल पाते समय फ़ोन, कीलॉक को बंद कर देता है, फिर कॉल खत्म होने पर कीलॉक को फिर से चालू कर देता है."</string> <string name="permlab_requestPasswordComplexity" msgid="202650535669249674">"जानें कि स्क्रीन लॉक कितना मुश्किल बनाया गया है"</string> <string name="permdesc_requestPasswordComplexity" msgid="4730994229754212347">"यह मंज़ूरी मिलने के बाद ऐप्लिकेशन जान पाता है कि स्क्रीन लॉक कितना मुश्किल (बहुत ज़्यादा, मध्यम, कम या बिल्कुल नहीं) है. इस स्तर से यह पता चलता है कि स्क्रीन लॉक कितना लंबा या किस तरह का है. ऐप्लिकेशन उपयोगकर्ताओं को यह सुझाव भी दे सकता है कि वे स्क्रीन लॉक को एक तय लेवल तक अपडेट करें. लेकिन उपयोगकर्ता इसे बेझिझक अनदेखा करके छोड़ सकते हैं. ध्यान दें कि स्क्रीन लॉक को सादे टेक्स्ट में सेव नहीं किया जाता है इसलिए ऐप्लिकेशन को सटीक पासवर्ड पता नहीं होता है."</string> <string name="permlab_useBiometric" msgid="8837753668509919318">"बायोमीट्रिक हार्डवेयर इस्तेमाल करने दें"</string> @@ -603,8 +603,8 @@ <string name="permdesc_sdcardRead" msgid="1804941689051236391">"ऐप्लिकेशन को आपकी शेयर की गई मेमोरी की सामग्री पढ़ने देती है."</string> <string name="permlab_sdcardWrite" msgid="9220937740184960897">"आपकी शेयर की गई मेमोरी की सामग्री में बदलाव करना या उसे मिटाना"</string> <string name="permdesc_sdcardWrite" msgid="2834431057338203959">"ऐप्लिकेशन को आपकी शेयर की गई मेमोरी की सामग्री लिखने देती है."</string> - <string name="permlab_use_sip" msgid="2052499390128979920">"SIP कॉल करें/प्राप्त करें"</string> - <string name="permdesc_use_sip" msgid="2297804849860225257">"ऐप्स को SIP कॉल करने और प्राप्त करने देती है."</string> + <string name="permlab_use_sip" msgid="2052499390128979920">"SIP कॉल करें/पाएं"</string> + <string name="permdesc_use_sip" msgid="2297804849860225257">"ऐप्लिकेशन को SIP कॉल करने और पाने देता है."</string> <string name="permlab_register_sim_subscription" msgid="3166535485877549177">"नए टेलिकॉम सिम कनेक्शन रजिस्टर करें"</string> <string name="permdesc_register_sim_subscription" msgid="2138909035926222911">"ऐप को नए टेलिकॉम सिम कनेक्शन पंजीकृत करने देती है."</string> <string name="permlab_register_call_provider" msgid="108102120289029841">"नए टेलिकॉम कनेक्शन रजिस्टर करें"</string> @@ -614,7 +614,7 @@ <string name="permlab_bind_incall_service" msgid="6773648341975287125">"इन-कॉल स्क्रीन से सहभागिता करें"</string> <string name="permdesc_bind_incall_service" msgid="8343471381323215005">"ऐप को यह नियंत्रित करने देती है कि उपयोगकर्ता को इन-कॉल स्क्रीन कब और कैसी दिखाई देती है."</string> <string name="permlab_bind_connection_service" msgid="3557341439297014940">"टेलीफ़ोनी सेवाओं के साथ सहभागिता करें"</string> - <string name="permdesc_bind_connection_service" msgid="4008754499822478114">"कॉल करने/प्राप्त करने के लिए ऐप्स को टेलीफ़ोनी सेवा के साथ सहभागिता करने दें."</string> + <string name="permdesc_bind_connection_service" msgid="4008754499822478114">"कॉल करने/पाने के लिए ऐप्स को टेलीफ़ोनी सेवा के साथ सहभागिता करने दें."</string> <string name="permlab_control_incall_experience" msgid="9061024437607777619">"इन कॉल उपयोगकर्ता अनुभव लें"</string> <string name="permdesc_control_incall_experience" msgid="915159066039828124">"ऐप को इन कॉल उपयोगकर्ता अनुभव लेने देती है."</string> <string name="permlab_readNetworkUsageHistory" msgid="7862593283611493232">"ऐतिहासिक नेटवर्क उपयोग पढें"</string> diff --git a/core/res/res/values-or/strings.xml b/core/res/res/values-or/strings.xml index 176d01c0273a..053b1cd8577d 100644 --- a/core/res/res/values-or/strings.xml +++ b/core/res/res/values-or/strings.xml @@ -1658,7 +1658,7 @@ <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"ଆପଣଙ୍କ ଅନଲକ୍ ପାଟର୍ନକୁ ଆପଣ <xliff:g id="NUMBER_0">%1$d</xliff:g> ଥର ଭୁଲ ଭାବେ ଅଙ୍କନ କରିଛନ୍ତି। ଆଉ <xliff:g id="NUMBER_1">%2$d</xliff:g>ଟି ଭୁଲ ପ୍ରୟାସ ପରେ ଏକ ଇମେଲ୍ ଆକାଉଣ୍ଟ ବ୍ୟବହାର କରି ନିଜ ଫୋନ୍କୁ ଅନଲକ୍ କରିବା ପାଇଁ କୁହାଯିବ।\n\n<xliff:g id="NUMBER_2">%3$d</xliff:g> ସେକେଣ୍ଡ ପରେ ପୁଣି ଚେଷ୍ଟା କରନ୍ତୁ।"</string> <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string> <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"ବାହାର କରନ୍ତୁ"</string> - <string name="safe_media_volume_warning" product="default" msgid="2276318909314492312">"ମାତ୍ରା ବଢ଼ାଇ ସୁପାରିସ ସ୍ତର ବଢ଼ାଉଛନ୍ତି? \n\n ଲମ୍ବା ସମୟ ପର୍ଯ୍ୟନ୍ତ ଉଚ୍ଚ ଶବ୍ଦରେ ଶୁଣିଲେ ଆପଣଙ୍କ ଶ୍ରବଣ ଶକ୍ତି ଖରାପ ହୋଇପାରେ।"</string> + <string name="safe_media_volume_warning" product="default" msgid="2276318909314492312">"ମାତ୍ରା ବଢ଼ାଇ ସୁପାରିଶ ସ୍ତର ବଢ଼ାଉଛନ୍ତି? \n\n ଲମ୍ବା ସମୟ ପର୍ଯ୍ୟନ୍ତ ଉଚ୍ଚ ଶବ୍ଦରେ ଶୁଣିଲେ ଆପଣଙ୍କ ଶ୍ରବଣ ଶକ୍ତି ଖରାପ ହୋଇପାରେ।"</string> <string name="accessibility_shortcut_warning_dialog_title" msgid="8404780875025725199">"ଆକ୍ସେସବିଲିଟି ଶର୍ଟକଟ୍ ବ୍ୟବହାର କରିବେ?"</string> <string name="accessibility_shortcut_toogle_warning" msgid="7256507885737444807">"ସର୍ଟକଟ୍ ଅନ୍ ଥିବା ବେଳେ, ଉଭୟ ଭଲ୍ୟୁମ୍ ବଟନ୍ 3 ସେକେଣ୍ଡ ପାଇଁ ଦବାଇବା ଦ୍ୱାରା ଆକ୍ସେସବିଲିଟି ବୈଶିଷ୍ଟ ଆରମ୍ଭ ହେବ।\n\n ସମ୍ପ୍ରତି ଆକ୍ସେସବିଲିଟି ବୈଶିଷ୍ଟ୍ୟ:\n <xliff:g id="SERVICE_NAME">%1$s</xliff:g>\n\n ସେଟିଙ୍ଗ ଓ ଆକ୍ସେସବିଲିଟିରେ ଆପଣ ବୈଶିଷ୍ଟ୍ୟ ବଦଳାଇ ପାରିବେ।"</string> <string name="disable_accessibility_shortcut" msgid="627625354248453445">"ଶର୍ଟକଟ୍ ବନ୍ଦ କରନ୍ତୁ"</string> diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml index 85d5cf9c7f95..ef50a39771ed 100644 --- a/core/res/res/values-zh-rCN/strings.xml +++ b/core/res/res/values-zh-rCN/strings.xml @@ -297,7 +297,7 @@ <string name="permgrouplab_microphone" msgid="171539900250043464">"麦克风"</string> <string name="permgroupdesc_microphone" msgid="4988812113943554584">"录制音频"</string> <string name="permgrouprequest_microphone" msgid="9167492350681916038">"允许<b><xliff:g id="APP_NAME">%1$s</xliff:g></b>录音吗?"</string> - <string name="permgrouplab_activityRecognition" msgid="1565108047054378642">"健身运动"</string> + <string name="permgrouplab_activityRecognition" msgid="1565108047054378642">"身体活动"</string> <string name="permgroupdesc_activityRecognition" msgid="6949472038320473478">"访问您的健身运动"</string> <string name="permgrouprequest_activityRecognition" msgid="7626438016904799383">"允许<b><xliff:g id="APP_NAME">%1$s</xliff:g></b>访问您的健身运动吗?"</string> <string name="permgrouplab_camera" msgid="4820372495894586615">"相机"</string> diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index f326ce8d23e9..9898a1c30856 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -148,7 +148,8 @@ void CanvasContext::setSurface(sp<Surface>&& surface) { if (surface) { mNativeSurface = new ReliableSurface{std::move(surface)}; - mNativeSurface->setDequeueTimeout(500_ms); + // TODO: Fix error handling & re-shorten timeout + mNativeSurface->setDequeueTimeout(4000_ms); } else { mNativeSurface = nullptr; } diff --git a/packages/PrintSpooler/res/values-or/strings.xml b/packages/PrintSpooler/res/values-or/strings.xml index 7eeac8771032..f385391c8d78 100644 --- a/packages/PrintSpooler/res/values-or/strings.xml +++ b/packages/PrintSpooler/res/values-or/strings.xml @@ -72,7 +72,7 @@ <string name="select_to_add_printers" msgid="3800709038689830974">"ପ୍ରିଣ୍ଟର ଯୋଡ଼ିବାକୁ ଚୟନ କରନ୍ତୁ"</string> <string name="enable_print_service" msgid="3482815747043533842">"ସକ୍ଷମ କରିବା ପାଇଁ ଚୟନ କରନ୍ତୁ"</string> <string name="enabled_services_title" msgid="7036986099096582296">"ସକ୍ଷମ କରାଯାଇଥିବା ସର୍ଭିସ୍"</string> - <string name="recommended_services_title" msgid="3799434882937956924">"ସୁପାରିସ କରାଯାଇଥିବା ସର୍ଭିସ୍"</string> + <string name="recommended_services_title" msgid="3799434882937956924">"ସୁପାରିଶ କରାଯାଇଥିବା ସର୍ଭିସ୍"</string> <string name="disabled_services_title" msgid="7313253167968363211">"ଅକ୍ଷମ କରାଯାଇଥିବା ସର୍ଭିସ୍"</string> <string name="all_services_title" msgid="5578662754874906455">"ସମସ୍ତ ସର୍ଭିସ୍"</string> <plurals name="print_services_recommendation_subtitle" formatted="false" msgid="5678487708807185138"> diff --git a/packages/SettingsLib/res/values-hi/strings.xml b/packages/SettingsLib/res/values-hi/strings.xml index 238eba58e0a5..3a20d04d7ab2 100644 --- a/packages/SettingsLib/res/values-hi/strings.xml +++ b/packages/SettingsLib/res/values-hi/strings.xml @@ -46,7 +46,7 @@ <string name="wifi_limited_connection" msgid="7717855024753201527">"सीमित कनेक्शन"</string> <string name="wifi_status_no_internet" msgid="5784710974669608361">"इंटरनेट कनेक्शन नहीं है"</string> <string name="wifi_status_sign_in_required" msgid="123517180404752756">"साइन इन करना ज़रूरी है"</string> - <string name="wifi_ap_unable_to_handle_new_sta" msgid="5348824313514404541">"एक्सेस पॉइंट फ़िलहाल भरा हुआ है"</string> + <string name="wifi_ap_unable_to_handle_new_sta" msgid="5348824313514404541">"ऐक्सेस पॉइंट फ़िलहाल भरा हुआ है"</string> <string name="connected_via_carrier" msgid="7583780074526041912">"%1$s के ज़रिए कनेक्ट"</string> <string name="available_via_carrier" msgid="1469036129740799053">"%1$s के ज़रिए उपलब्ध"</string> <string name="osu_opening_provider" msgid="5488997661548640424">"<xliff:g id="PASSPOINTPROVIDER">%1$s</xliff:g> खोला जा रहा है"</string> @@ -68,7 +68,7 @@ <string name="bluetooth_pairing" msgid="1426882272690346242">"युग्मित कर रहा है…"</string> <string name="bluetooth_connected_no_headset" msgid="616068069034994802">"जुड़ गया (फ़ोन के ऑडियो को छोड़कर)<xliff:g id="ACTIVE_DEVICE">%1$s</xliff:g>"</string> <string name="bluetooth_connected_no_a2dp" msgid="3736431800395923868">"जुड़ गया (मीडिया ऑडियो को छोड़कर)<xliff:g id="ACTIVE_DEVICE">%1$s</xliff:g>"</string> - <string name="bluetooth_connected_no_map" msgid="3200033913678466453">"जुड़ गया (मैसेज का एक्सेस नहीं)<xliff:g id="ACTIVE_DEVICE">%1$s</xliff:g>"</string> + <string name="bluetooth_connected_no_map" msgid="3200033913678466453">"जुड़ गया (मैसेज का ऐक्सेस नहीं)<xliff:g id="ACTIVE_DEVICE">%1$s</xliff:g>"</string> <string name="bluetooth_connected_no_headset_no_a2dp" msgid="2047403011284187056">"जुड़ गया (फ़ोन या मीडिया ऑडियो को छोड़कर)<xliff:g id="ACTIVE_DEVICE">%1$s</xliff:g>"</string> <string name="bluetooth_connected_battery_level" msgid="5162924691231307748">"जुड़ गया, बैटरी का लेवल <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE">%1$s</xliff:g><xliff:g id="ACTIVE_DEVICE">%2$s</xliff:g>"</string> <string name="bluetooth_connected_no_headset_battery_level" msgid="1610296229139400266">"जुड़ गया (फ़ोन के ऑडियो को छोड़कर), बैटरी का लेवल <xliff:g id="BATTERY_LEVEL_AS_PERCENTAGE">%1$s</xliff:g><xliff:g id="ACTIVE_DEVICE">%2$s</xliff:g>"</string> @@ -88,7 +88,7 @@ <string name="bluetooth_profile_pbap_summary" msgid="6605229608108852198">"संपर्क साझाकरण के लिए उपयोग करें"</string> <string name="bluetooth_profile_pan_nap" msgid="8429049285027482959">"इंटरनेट कनेक्शन साझाकरण"</string> <string name="bluetooth_profile_map" msgid="1019763341565580450">"लेख संदेश"</string> - <string name="bluetooth_profile_sap" msgid="5764222021851283125">"सिम एक्सेस"</string> + <string name="bluetooth_profile_sap" msgid="5764222021851283125">"सिम ऐक्सेस"</string> <string name="bluetooth_profile_a2dp_high_quality" msgid="5444517801472820055">"HD ऑडियो: <xliff:g id="CODEC_NAME">%1$s</xliff:g>"</string> <string name="bluetooth_profile_a2dp_high_quality_unknown_codec" msgid="8510588052415438887">"HD ऑडियो"</string> <string name="bluetooth_profile_hearing_aid" msgid="6680721080542444257">"सुनने में मदद करने वाले डिवाइस"</string> @@ -200,7 +200,7 @@ <string name="development_settings_not_available" msgid="4308569041701535607">"यह उपयोगकर्ता, डेवलपर के लिए सेटिंग और टूल का इस्तेमाल नहीं कर सकता"</string> <string name="vpn_settings_not_available" msgid="956841430176985598">"VPN सेटिंग इस उपयोगकर्ता के लिए उपलब्ध नहीं हैं"</string> <string name="tethering_settings_not_available" msgid="6765770438438291012">"टेदरिंग सेटिंग इस उपयोगकर्ता के लिए उपलब्ध नहीं हैं"</string> - <string name="apn_settings_not_available" msgid="7873729032165324000">"एक्सेस पॉइंट के नाम की सेटिंग इस उपयोगकर्ता के लिए मौजूद नहीं हैं"</string> + <string name="apn_settings_not_available" msgid="7873729032165324000">"ऐक्सेस पॉइंट के नाम की सेटिंग इस उपयोगकर्ता के लिए मौजूद नहीं हैं"</string> <string name="enable_adb" msgid="7982306934419797485">"USB डीबग करना"</string> <string name="enable_adb_summary" msgid="4881186971746056635">"डीबग मोड जब USB कनेक्ट किया गया हो"</string> <string name="clear_adb_keys" msgid="4038889221503122743">"USB डीबग करने की मंज़ूरी रद्द करें"</string> @@ -414,7 +414,7 @@ <string name="disabled" msgid="9206776641295849915">"बंद किया गया"</string> <string name="external_source_trusted" msgid="2707996266575928037">"अनुमति है"</string> <string name="external_source_untrusted" msgid="2677442511837596726">"अनुमति नहीं है"</string> - <string name="install_other_apps" msgid="6986686991775883017">"अनजान ऐप्लिकेशन इंस्टॉल करने का एक्सेस"</string> + <string name="install_other_apps" msgid="6986686991775883017">"अनजान ऐप्लिकेशन इंस्टॉल करने का ऐक्सेस"</string> <string name="home" msgid="3256884684164448244">"सेटिंग का होम पेज"</string> <string-array name="battery_labels"> <item msgid="8494684293649631252">"0%"</item> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java index 9d398b5b69a1..d884fab518ce 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java @@ -56,6 +56,7 @@ import java.time.DateTimeException; import java.util.Arrays; import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.zip.CRC32; /** @@ -241,6 +242,8 @@ public class SettingsBackupAgent extends BackupAgentHelper { HashSet<String> movedToGlobal = new HashSet<String>(); Settings.System.getMovedToGlobalSettings(movedToGlobal); Settings.Secure.getMovedToGlobalSettings(movedToGlobal); + Set<String> movedToSecure = getMovedToSecureSettings(); + byte[] restoredWifiSupplicantData = null; byte[] restoredWifiIpConfigData = null; @@ -259,16 +262,17 @@ public class SettingsBackupAgent extends BackupAgentHelper { switch (key) { case KEY_SYSTEM : - restoreSettings(data, Settings.System.CONTENT_URI, movedToGlobal); + restoreSettings(data, Settings.System.CONTENT_URI, movedToGlobal, + movedToSecure); mSettingsHelper.applyAudioSettings(); break; case KEY_SECURE : - restoreSettings(data, Settings.Secure.CONTENT_URI, movedToGlobal); + restoreSettings(data, Settings.Secure.CONTENT_URI, movedToGlobal, null); break; case KEY_GLOBAL : - restoreSettings(data, Settings.Global.CONTENT_URI, null); + restoreSettings(data, Settings.Global.CONTENT_URI, null, movedToSecure); break; case KEY_WIFI_SUPPLICANT : @@ -347,20 +351,22 @@ public class SettingsBackupAgent extends BackupAgentHelper { HashSet<String> movedToGlobal = new HashSet<String>(); Settings.System.getMovedToGlobalSettings(movedToGlobal); Settings.Secure.getMovedToGlobalSettings(movedToGlobal); + Set<String> movedToSecure = getMovedToSecureSettings(); // system settings data first int nBytes = in.readInt(); if (DEBUG_BACKUP) Log.d(TAG, nBytes + " bytes of settings data"); byte[] buffer = new byte[nBytes]; in.readFully(buffer, 0, nBytes); - restoreSettings(buffer, nBytes, Settings.System.CONTENT_URI, movedToGlobal); + restoreSettings(buffer, nBytes, Settings.System.CONTENT_URI, movedToGlobal, + movedToSecure); // secure settings nBytes = in.readInt(); if (DEBUG_BACKUP) Log.d(TAG, nBytes + " bytes of secure settings data"); if (nBytes > buffer.length) buffer = new byte[nBytes]; in.readFully(buffer, 0, nBytes); - restoreSettings(buffer, nBytes, Settings.Secure.CONTENT_URI, movedToGlobal); + restoreSettings(buffer, nBytes, Settings.Secure.CONTENT_URI, movedToGlobal, null); // Global only if sufficiently new if (version >= FULL_BACKUP_ADDED_GLOBAL) { @@ -369,7 +375,8 @@ public class SettingsBackupAgent extends BackupAgentHelper { if (nBytes > buffer.length) buffer = new byte[nBytes]; in.readFully(buffer, 0, nBytes); movedToGlobal.clear(); // no redirection; this *is* the global namespace - restoreSettings(buffer, nBytes, Settings.Global.CONTENT_URI, movedToGlobal); + restoreSettings(buffer, nBytes, Settings.Global.CONTENT_URI, movedToGlobal, + movedToSecure); } // locale @@ -440,6 +447,13 @@ public class SettingsBackupAgent extends BackupAgentHelper { } } + private Set<String> getMovedToSecureSettings() { + Set<String> movedToSecureSettings = new HashSet<>(); + Settings.Global.getMovedToSecureSettings(movedToSecureSettings); + Settings.System.getMovedToSecureSettings(movedToSecureSettings); + return movedToSecureSettings; + } + private long[] readOldChecksums(ParcelFileDescriptor oldState) throws IOException { long[] stateChecksums = new long[STATE_SIZE]; @@ -564,7 +578,7 @@ public class SettingsBackupAgent extends BackupAgentHelper { } private void restoreSettings(BackupDataInput data, Uri contentUri, - HashSet<String> movedToGlobal) { + HashSet<String> movedToGlobal, Set<String> movedToSecure) { byte[] settings = new byte[data.getDataSize()]; try { data.readEntityData(settings, 0, settings.length); @@ -572,11 +586,11 @@ public class SettingsBackupAgent extends BackupAgentHelper { Log.e(TAG, "Couldn't read entity data"); return; } - restoreSettings(settings, settings.length, contentUri, movedToGlobal); + restoreSettings(settings, settings.length, contentUri, movedToGlobal, movedToSecure); } private void restoreSettings(byte[] settings, int bytes, Uri contentUri, - HashSet<String> movedToGlobal) { + HashSet<String> movedToGlobal, Set<String> movedToSecure) { if (DEBUG) { Log.i(TAG, "restoreSettings: " + contentUri); } @@ -651,9 +665,14 @@ public class SettingsBackupAgent extends BackupAgentHelper { continue; } - final Uri destination = (movedToGlobal != null && movedToGlobal.contains(key)) - ? Settings.Global.CONTENT_URI - : contentUri; + final Uri destination; + if (movedToGlobal != null && movedToGlobal.contains(key)) { + destination = Settings.Global.CONTENT_URI; + } else if (movedToSecure != null && movedToSecure.contains(key)) { + destination = Settings.Secure.CONTENT_URI; + } else { + destination = contentUri; + } settingsHelper.restoreValue(this, cr, contentValues, destination, key, value, mRestoredFromSdkInt); diff --git a/packages/SystemUI/res/values-da/strings.xml b/packages/SystemUI/res/values-da/strings.xml index 08fb0b38c770..90ead3514b1d 100644 --- a/packages/SystemUI/res/values-da/strings.xml +++ b/packages/SystemUI/res/values-da/strings.xml @@ -255,8 +255,8 @@ <string name="accessibility_quick_settings_flashlight_on" msgid="2003479320007841077">"Lommelygten er tændt."</string> <string name="accessibility_quick_settings_flashlight_changed_off" msgid="3303701786768224304">"Lommelygten er slukket."</string> <string name="accessibility_quick_settings_flashlight_changed_on" msgid="6531793301533894686">"Lommelygten er tændt."</string> - <string name="accessibility_quick_settings_color_inversion_changed_off" msgid="4406577213290173911">"Invertering af farver er slået fra."</string> - <string name="accessibility_quick_settings_color_inversion_changed_on" msgid="6897462320184911126">"Invertering af farver er slået til."</string> + <string name="accessibility_quick_settings_color_inversion_changed_off" msgid="4406577213290173911">"Ombytning af farver er slået fra."</string> + <string name="accessibility_quick_settings_color_inversion_changed_on" msgid="6897462320184911126">"Ombytning af farver er slået til."</string> <string name="accessibility_quick_settings_hotspot_changed_off" msgid="5004708003447561394">"Mobilhotspot er slået fra."</string> <string name="accessibility_quick_settings_hotspot_changed_on" msgid="2890951609226476206">"Mobilhotspot er slået til."</string> <string name="accessibility_casting_turned_off" msgid="1430668982271976172">"Casting af din skærm er stoppet."</string> diff --git a/packages/SystemUI/res/values-fr-rCA/strings.xml b/packages/SystemUI/res/values-fr-rCA/strings.xml index a3069a1e174f..552d12ee6390 100644 --- a/packages/SystemUI/res/values-fr-rCA/strings.xml +++ b/packages/SystemUI/res/values-fr-rCA/strings.xml @@ -886,7 +886,7 @@ <string name="qs_dnd_prompt_app" msgid="7978037419334156034">"Le mode Ne pas déranger a été activé par une application (<xliff:g id="ID_1">%s</xliff:g>)."</string> <string name="qs_dnd_prompt_auto_rule_app" msgid="2599343675391111951">"Le mode Ne pas déranger a été activé par une règle automatique ou une application."</string> <string name="qs_dnd_until" msgid="3469471136280079874">"Jusqu\'à <xliff:g id="ID_1">%s</xliff:g>"</string> - <string name="qs_dnd_keep" msgid="1825009164681928736">"Garder"</string> + <string name="qs_dnd_keep" msgid="1825009164681928736">"Conserver"</string> <string name="qs_dnd_replace" msgid="8019520786644276623">"Remplacer"</string> <string name="running_foreground_services_title" msgid="381024150898615683">"Applications qui fonctionnent en arrière-plan"</string> <string name="running_foreground_services_msg" msgid="6326247670075574355">"Touchez pour afficher des détails sur l\'utilisation de la pile et des données"</string> diff --git a/packages/SystemUI/res/values-hi/strings.xml b/packages/SystemUI/res/values-hi/strings.xml index 263fe8a31a9a..3fa2a48188c9 100644 --- a/packages/SystemUI/res/values-hi/strings.xml +++ b/packages/SystemUI/res/values-hi/strings.xml @@ -46,8 +46,8 @@ <string name="bluetooth_tethered" msgid="7094101612161133267">"ब्लूटूथ टीदर किया गया"</string> <string name="status_bar_input_method_settings_configure_input_methods" msgid="3504292471512317827">"इनपुट का तरीका सेट करें"</string> <string name="status_bar_use_physical_keyboard" msgid="7551903084416057810">"सामान्य कीबोर्ड"</string> - <string name="usb_device_permission_prompt" msgid="1825685909587559679">"<xliff:g id="APPLICATION">%1$s</xliff:g> को <xliff:g id="USB_DEVICE">%2$s</xliff:g> के एक्सेस की अनुमति दें?"</string> - <string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"<xliff:g id="APPLICATION">%1$s</xliff:g> को <xliff:g id="USB_ACCESSORY">%2$s</xliff:g> के एक्सेस की अनुमति दें?"</string> + <string name="usb_device_permission_prompt" msgid="1825685909587559679">"<xliff:g id="APPLICATION">%1$s</xliff:g> को <xliff:g id="USB_DEVICE">%2$s</xliff:g> के ऐक्सेस की अनुमति दें?"</string> + <string name="usb_accessory_permission_prompt" msgid="2465531696941369047">"<xliff:g id="APPLICATION">%1$s</xliff:g> को <xliff:g id="USB_ACCESSORY">%2$s</xliff:g> के ऐक्सेस की अनुमति दें?"</string> <string name="usb_device_confirm_prompt" msgid="7440562274256843905">"<xliff:g id="USB_DEVICE">%2$s</xliff:g> के लिए <xliff:g id="APPLICATION">%1$s</xliff:g> खोलें?"</string> <string name="usb_accessory_confirm_prompt" msgid="4333670517539993561">"<xliff:g id="USB_ACCESSORY">%2$s</xliff:g> के लिए <xliff:g id="APPLICATION">%1$s</xliff:g> खोलें?"</string> <string name="usb_accessory_uri_prompt" msgid="513450621413733343">"इस USB सहायक डिवाइस के साथ कोई भी इंस्टॉल ऐप्स काम नहीं करता. इस सहायक डिवाइस के बारे में यहां ज़्यादा जानें: <xliff:g id="URL">%1$s</xliff:g>"</string> @@ -205,7 +205,7 @@ <string name="accessibility_overflow_action" msgid="5681882033274783311">"पूरी सूचनाएं देखें"</string> <string name="accessibility_remove_notification" msgid="3603099514902182350">"सूचना साफ़ करें"</string> <string name="accessibility_gps_enabled" msgid="3511469499240123019">"GPS सक्षम."</string> - <string name="accessibility_gps_acquiring" msgid="8959333351058967158">"GPS प्राप्त करना."</string> + <string name="accessibility_gps_acquiring" msgid="8959333351058967158">"GPS पाना."</string> <string name="accessibility_tty_enabled" msgid="4613200365379426561">"टेलीटाइपराइटर सक्षम."</string> <string name="accessibility_ringer_vibrate" msgid="666585363364155055">"रिंगर कंपन (वाइब्रेशन)."</string> <string name="accessibility_ringer_silent" msgid="9061243307939135383">"रिंगर मौन."</string> @@ -452,8 +452,8 @@ <string name="battery_saver_notification_title" msgid="8614079794522291840">"बैटरी सेवर चालू है"</string> <string name="battery_saver_notification_text" msgid="820318788126672692">"निष्पादन और पृष्ठभूमि डेटा को कम करता है"</string> <string name="battery_saver_notification_action_text" msgid="132118784269455533">"बैटरी सेवर बंद करें"</string> - <string name="media_projection_dialog_text" msgid="8585357687598538511">"रिकॉर्ड या कास्ट करते समय, <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> आपकी स्क्रीन पर दिखाई जा रही या आपके डिवाइस पर चलाई जा रही संवेदनशील जानकारी एक्सेस कर सकता है. इस जानकारी में ऑडियो, पासवर्ड, भुगतान की जानकारी, फ़ोटो और मैसेज शामिल हैं."</string> - <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"रिकॉर्ड या कास्ट करते समय, यह सेवा देने वाला ऐप्लिकेशन आपकी स्क्रीन पर दिखाई जा रही या आपके डिवाइस पर चलाई जा रही संवेदनशील जानकारी एक्सेस कर सकता है. इस जानकारी में ऑडियो, पासवर्ड, भुगतान की जानकारी, फ़ोटो और मैसेज शामिल हैं."</string> + <string name="media_projection_dialog_text" msgid="8585357687598538511">"रिकॉर्ड या कास्ट करते समय, <xliff:g id="APP_SEEKING_PERMISSION">%s</xliff:g> आपकी स्क्रीन पर दिखाई जा रही या आपके डिवाइस पर चलाई जा रही संवेदनशील जानकारी ऐक्सेस कर सकता है. इस जानकारी में ऑडियो, पासवर्ड, भुगतान की जानकारी, फ़ोटो और मैसेज शामिल हैं."</string> + <string name="media_projection_dialog_service_text" msgid="3075544489835858258">"रिकॉर्ड या कास्ट करते समय, यह सेवा देने वाला ऐप्लिकेशन आपकी स्क्रीन पर दिखाई जा रही या आपके डिवाइस पर चलाई जा रही संवेदनशील जानकारी ऐक्सेस कर सकता है. इस जानकारी में ऑडियो, पासवर्ड, भुगतान की जानकारी, फ़ोटो और मैसेज शामिल हैं."</string> <string name="media_projection_dialog_title" msgid="8124184308671641248">"कास्ट करने/रिकॉर्ड करने के दौरान संवेदनशील जानकारी का सबके सामने आ जाना"</string> <string name="media_projection_remember_text" msgid="3103510882172746752">"फिर से न दिखाएं"</string> <string name="clear_all_notifications_text" msgid="814192889771462828">"सभी को हटाएं"</string> diff --git a/packages/SystemUI/res/values-mr/strings.xml b/packages/SystemUI/res/values-mr/strings.xml index 20f638d04077..676208bb02f7 100644 --- a/packages/SystemUI/res/values-mr/strings.xml +++ b/packages/SystemUI/res/values-mr/strings.xml @@ -747,7 +747,7 @@ <string name="data_saver" msgid="5037565123367048522">"डेटा सेव्हर"</string> <string name="accessibility_data_saver_on" msgid="8454111686783887148">"डेटा सेव्हर चालू आहे"</string> <string name="accessibility_data_saver_off" msgid="8841582529453005337">"डेटा सेव्हर बंद आहे"</string> - <string name="switch_bar_on" msgid="1142437840752794229">"चालू"</string> + <string name="switch_bar_on" msgid="1142437840752794229">"सुरू"</string> <string name="switch_bar_off" msgid="8803270596930432874">"बंद"</string> <string name="nav_bar" msgid="1993221402773877607">"नॅव्हिगेशन बार"</string> <string name="nav_bar_layout" msgid="3664072994198772020">"लेआउट"</string> diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml index f124d89070bf..6becd21984b9 100644 --- a/packages/SystemUI/res/values/attrs.xml +++ b/packages/SystemUI/res/values/attrs.xml @@ -75,14 +75,15 @@ <attr name="horizontalSpacing" format="dimension" /> </declare-styleable> - <!-- Theme for icons in the status bar (light/dark). background/fillColor is used for dual tone - icons like wifi and signal, and singleToneColor is used for icons with only one tone. + <!-- Theme for icons in the status/nav bar (light/dark). background/fillColor is used for dual + tone icons like wifi and signal, and singleToneColor is used for icons with only one tone. Contract: Pixel with fillColor blended over backgroundColor blended over translucent should equal to singleToneColor blended over translucent. --> <declare-styleable name="TonedIcon"> <attr name="backgroundColor" format="integer" /> <attr name="fillColor" format="integer" /> <attr name="singleToneColor" format="integer" /> + <attr name="homeHandleColor" format="integer" /> </declare-styleable> <declare-styleable name="StatusBarWindowView_Layout"> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index e7a1a660abc2..61816f60d0ba 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -116,6 +116,9 @@ <!-- The color of the navigation bar icons. Need to be in sync with ic_sysbar_* --> <color name="navigation_bar_icon_color">#E5FFFFFF</color> + <color name="navigation_bar_home_handle_light_color">#EBffffff</color> + <color name="navigation_bar_home_handle_dark_color">#99000000</color> + <!-- The shadow color for light navigation bar icons. --> <color name="nav_key_button_shadow_color">#30000000</color> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 2f1770a39f02..6374191c4d7b 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -366,11 +366,13 @@ <item name="backgroundColor">@color/light_mode_icon_color_dual_tone_background</item> <item name="fillColor">@color/light_mode_icon_color_dual_tone_fill</item> <item name="singleToneColor">@color/light_mode_icon_color_single_tone</item> + <item name="homeHandleColor">@color/navigation_bar_home_handle_light_color</item> </style> <style name="DualToneDarkTheme"> <item name="backgroundColor">@color/dark_mode_icon_color_dual_tone_background</item> <item name="fillColor">@color/dark_mode_icon_color_dual_tone_fill</item> <item name="singleToneColor">@color/dark_mode_icon_color_single_tone</item> + <item name="homeHandleColor">@color/navigation_bar_home_handle_dark_color</item> </style> <style name="QSHeaderDarkTheme"> <item name="backgroundColor">@color/dark_mode_qs_icon_color_dual_tone_background</item> diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/TaskKeyLruCache.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/TaskKeyLruCache.java index b2c79a4c0a32..e106c657109d 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/TaskKeyLruCache.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/TaskKeyLruCache.java @@ -52,7 +52,11 @@ public class TaskKeyLruCache<V> extends TaskKeyCache<V> { if (mEvictionCallback != null) { mEvictionCallback.onEntryEvicted(mKeys.get(taskId)); } - mKeys.remove(taskId); + + // Only remove from mKeys on cache remove, not a cache update. + if (newV == null) { + mKeys.remove(taskId); + } } }; } diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java index cc7863c0113b..c732584eddfc 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java @@ -80,18 +80,25 @@ public class QuickStepContract { public static final int SYSUI_STATE_HOME_DISABLED = 1 << 8; // The keyguard is showing, but occluded public static final int SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED = 1 << 9; + // The search feature is disabled (either by SUW/SysUI/device policy) + public static final int SYSUI_STATE_SEARCH_DISABLED = 1 << 10; + // The notification panel is expanded and interactive (either locked or unlocked), and the + // quick settings is not expanded + public static final int SYSUI_STATE_QUICK_SETTINGS_EXPANDED = 1 << 11; @Retention(RetentionPolicy.SOURCE) @IntDef({SYSUI_STATE_SCREEN_PINNING, SYSUI_STATE_NAV_BAR_HIDDEN, SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED, + SYSUI_STATE_QUICK_SETTINGS_EXPANDED, SYSUI_STATE_BOUNCER_SHOWING, SYSUI_STATE_A11Y_BUTTON_CLICKABLE, SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE, SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING, SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED, SYSUI_STATE_OVERVIEW_DISABLED, - SYSUI_STATE_HOME_DISABLED + SYSUI_STATE_HOME_DISABLED, + SYSUI_STATE_SEARCH_DISABLED }) public @interface SystemUiStateFlags {} @@ -100,8 +107,10 @@ public class QuickStepContract { str.add((flags & SYSUI_STATE_SCREEN_PINNING) != 0 ? "screen_pinned" : ""); str.add((flags & SYSUI_STATE_OVERVIEW_DISABLED) != 0 ? "overview_disabled" : ""); str.add((flags & SYSUI_STATE_HOME_DISABLED) != 0 ? "home_disabled" : ""); + str.add((flags & SYSUI_STATE_SEARCH_DISABLED) != 0 ? "search_disabled" : ""); str.add((flags & SYSUI_STATE_NAV_BAR_HIDDEN) != 0 ? "navbar_hidden" : ""); str.add((flags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) != 0 ? "notif_visible" : ""); + str.add((flags & SYSUI_STATE_QUICK_SETTINGS_EXPANDED) != 0 ? "qs_visible" : ""); str.add((flags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING) != 0 ? "keygrd_visible" : ""); str.add((flags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0 ? "keygrd_occluded" : ""); @@ -150,10 +159,13 @@ public class QuickStepContract { * disabled. */ public static boolean isAssistantGestureDisabled(int sysuiStateFlags) { - // Disable when in screen pinning, immersive, the bouncer is showing + // Disable when in quick settings, screen pinning, immersive, the bouncer is showing, + // or search is disabled int disableFlags = SYSUI_STATE_SCREEN_PINNING | SYSUI_STATE_NAV_BAR_HIDDEN - | SYSUI_STATE_BOUNCER_SHOWING; + | SYSUI_STATE_BOUNCER_SHOWING + | SYSUI_STATE_SEARCH_DISABLED + | SYSUI_STATE_QUICK_SETTINGS_EXPANDED; if ((sysuiStateFlags & disableFlags) != 0) { return true; } diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java index d2fe5cd9ef64..2ef042210e67 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java @@ -91,6 +91,7 @@ public class RecentsAnimationControllerCompat { } } + @Deprecated public void setCancelWithDeferredScreenshot(boolean screenshot) { try { mAnimationController.setCancelWithDeferredScreenshot(screenshot); @@ -99,6 +100,14 @@ public class RecentsAnimationControllerCompat { } } + public void setDeferCancelUntilNextTransition(boolean defer, boolean screenshot) { + try { + mAnimationController.setDeferCancelUntilNextTransition(defer, screenshot); + } catch (RemoteException e) { + Log.e(TAG, "Failed to set deferred cancel with screenshot", e); + } + } + public void cleanupScreenshot() { try { mAnimationController.cleanupScreenshot(); diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentTaskInfoCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskInfoCompat.java index a5299038d3a9..326c2aa37175 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentTaskInfoCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskInfoCompat.java @@ -17,29 +17,32 @@ package com.android.systemui.shared.system; import android.app.ActivityManager; +import android.app.TaskInfo; import android.content.ComponentName; -public class RecentTaskInfoCompat { +public class TaskInfoCompat { - private ActivityManager.RecentTaskInfo mInfo; + public static int getUserId(TaskInfo info) { + return info.userId; + } - public RecentTaskInfoCompat(ActivityManager.RecentTaskInfo info) { - mInfo = info; + public static int getActivityType(TaskInfo info) { + return info.configuration.windowConfiguration.getActivityType(); } - public int getUserId() { - return mInfo.userId; + public static int getWindowingMode(TaskInfo info) { + return info.configuration.windowConfiguration.getWindowingMode(); } - public boolean supportsSplitScreenMultiWindow() { - return mInfo.supportsSplitScreenMultiWindow; + public static boolean supportsSplitScreenMultiWindow(TaskInfo info) { + return info.supportsSplitScreenMultiWindow; } - public ComponentName getTopActivity() { - return mInfo.topActivity; + public static ComponentName getTopActivity(TaskInfo info) { + return info.topActivity; } - public ActivityManager.TaskDescription getTaskDescription() { - return mInfo.taskDescription; + public static ActivityManager.TaskDescription getTaskDescription(TaskInfo info) { + return info.taskDescription; } } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java index 2483192eb04e..5097216a7405 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java @@ -584,6 +584,9 @@ public class KeyguardClockSwitch extends RelativeLayout { @Override public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) { + if (!sceneRoot.isShown()) { + return null; + } final float cutoff = mCutoff; final int startVisibility = View.INVISIBLE; final int endVisibility = (int) endValues.values.get(PROPNAME_VISIBILITY); @@ -596,6 +599,9 @@ public class KeyguardClockSwitch extends RelativeLayout { @Override public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) { + if (!sceneRoot.isShown()) { + return null; + } final float cutoff = 1f - mCutoff; final int startVisibility = View.VISIBLE; final int endVisibility = (int) endValues.values.get(PROPNAME_VISIBILITY); diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index 4ad262fee520..8059dcf33df7 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -269,7 +269,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe */ private void updateBiometricRetry() { SecurityMode securityMode = getSecurityMode(); - mSwipeUpToRetry = mUnlockMethodCache.isUnlockingWithFacePossible() + mSwipeUpToRetry = mUnlockMethodCache.isFaceAuthEnabled() && securityMode != SecurityMode.SimPin && securityMode != SecurityMode.SimPuk && securityMode != SecurityMode.None; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java index e219e24a8944..af4e61b3f6bc 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java @@ -89,6 +89,7 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe private final HashMap<View, PendingIntent> mClickActions; private final ActivityStarter mActivityStarter; private final ConfigurationController mConfigurationController; + private final LayoutTransition mLayoutTransition; private Uri mKeyguardSliceUri; @VisibleForTesting TextView mTitle; @@ -126,16 +127,16 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe mActivityStarter = activityStarter; mConfigurationController = configurationController; - LayoutTransition transition = new LayoutTransition(); - transition.setStagger(LayoutTransition.CHANGE_APPEARING, DEFAULT_ANIM_DURATION / 2); - transition.setDuration(LayoutTransition.APPEARING, DEFAULT_ANIM_DURATION); - transition.setDuration(LayoutTransition.DISAPPEARING, DEFAULT_ANIM_DURATION / 2); - transition.disableTransitionType(LayoutTransition.CHANGE_APPEARING); - transition.disableTransitionType(LayoutTransition.CHANGE_DISAPPEARING); - transition.setInterpolator(LayoutTransition.APPEARING, Interpolators.FAST_OUT_SLOW_IN); - transition.setInterpolator(LayoutTransition.DISAPPEARING, Interpolators.ALPHA_OUT); - transition.setAnimateParentHierarchy(false); - setLayoutTransition(transition); + mLayoutTransition = new LayoutTransition(); + mLayoutTransition.setStagger(LayoutTransition.CHANGE_APPEARING, DEFAULT_ANIM_DURATION / 2); + mLayoutTransition.setDuration(LayoutTransition.APPEARING, DEFAULT_ANIM_DURATION); + mLayoutTransition.setDuration(LayoutTransition.DISAPPEARING, DEFAULT_ANIM_DURATION / 2); + mLayoutTransition.disableTransitionType(LayoutTransition.CHANGE_APPEARING); + mLayoutTransition.disableTransitionType(LayoutTransition.CHANGE_DISAPPEARING); + mLayoutTransition.setInterpolator(LayoutTransition.APPEARING, + Interpolators.FAST_OUT_SLOW_IN); + mLayoutTransition.setInterpolator(LayoutTransition.DISAPPEARING, Interpolators.ALPHA_OUT); + mLayoutTransition.setAnimateParentHierarchy(false); } @Override @@ -174,6 +175,12 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe mConfigurationController.removeCallback(this); } + @Override + public void onVisibilityAggregated(boolean isVisible) { + super.onVisibilityAggregated(isVisible); + setLayoutTransition(isVisible ? mLayoutTransition : null); + } + /** * Returns whether the current visible slice has a title/header. */ @@ -419,6 +426,7 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe * their desired positions. */ private final Animation.AnimationListener mKeepAwakeListener; + private LayoutTransition mLayoutTransition; private float mDarkAmount; public Row(Context context) { @@ -440,33 +448,41 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe @Override protected void onFinishInflate() { - LayoutTransition transition = new LayoutTransition(); - transition.setDuration(DEFAULT_ANIM_DURATION); + mLayoutTransition = new LayoutTransition(); + mLayoutTransition.setDuration(DEFAULT_ANIM_DURATION); PropertyValuesHolder left = PropertyValuesHolder.ofInt("left", 0, 1); PropertyValuesHolder right = PropertyValuesHolder.ofInt("right", 0, 1); ObjectAnimator changeAnimator = ObjectAnimator.ofPropertyValuesHolder((Object) null, left, right); - transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changeAnimator); - transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING, changeAnimator); - transition.setInterpolator(LayoutTransition.CHANGE_APPEARING, + mLayoutTransition.setAnimator(LayoutTransition.CHANGE_APPEARING, changeAnimator); + mLayoutTransition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING, changeAnimator); + mLayoutTransition.setInterpolator(LayoutTransition.CHANGE_APPEARING, Interpolators.ACCELERATE_DECELERATE); - transition.setInterpolator(LayoutTransition.CHANGE_DISAPPEARING, + mLayoutTransition.setInterpolator(LayoutTransition.CHANGE_DISAPPEARING, Interpolators.ACCELERATE_DECELERATE); - transition.setStartDelay(LayoutTransition.CHANGE_APPEARING, DEFAULT_ANIM_DURATION); - transition.setStartDelay(LayoutTransition.CHANGE_DISAPPEARING, DEFAULT_ANIM_DURATION); + mLayoutTransition.setStartDelay(LayoutTransition.CHANGE_APPEARING, + DEFAULT_ANIM_DURATION); + mLayoutTransition.setStartDelay(LayoutTransition.CHANGE_DISAPPEARING, + DEFAULT_ANIM_DURATION); ObjectAnimator appearAnimator = ObjectAnimator.ofFloat(null, "alpha", 0f, 1f); - transition.setAnimator(LayoutTransition.APPEARING, appearAnimator); - transition.setInterpolator(LayoutTransition.APPEARING, Interpolators.ALPHA_IN); + mLayoutTransition.setAnimator(LayoutTransition.APPEARING, appearAnimator); + mLayoutTransition.setInterpolator(LayoutTransition.APPEARING, Interpolators.ALPHA_IN); ObjectAnimator disappearAnimator = ObjectAnimator.ofFloat(null, "alpha", 1f, 0f); - transition.setInterpolator(LayoutTransition.DISAPPEARING, Interpolators.ALPHA_OUT); - transition.setDuration(LayoutTransition.DISAPPEARING, DEFAULT_ANIM_DURATION / 4); - transition.setAnimator(LayoutTransition.DISAPPEARING, disappearAnimator); + mLayoutTransition.setInterpolator(LayoutTransition.DISAPPEARING, + Interpolators.ALPHA_OUT); + mLayoutTransition.setDuration(LayoutTransition.DISAPPEARING, DEFAULT_ANIM_DURATION / 4); + mLayoutTransition.setAnimator(LayoutTransition.DISAPPEARING, disappearAnimator); - transition.setAnimateParentHierarchy(false); - setLayoutTransition(transition); + mLayoutTransition.setAnimateParentHierarchy(false); + } + + @Override + public void onVisibilityAggregated(boolean isVisible) { + super.onVisibilityAggregated(isVisible); + setLayoutTransition(isVisible ? mLayoutTransition : null); } @Override diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index fd618b05f348..4e7b15715243 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -1783,13 +1783,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { && mFpm.getEnrolledFingerprints(userId).size() > 0; } + private boolean isUnlockWithFacePossible(int userId) { + return isFaceAuthEnabledForUser(userId) && !isFaceDisabled(userId); + } + /** * If face hardware is available, user has enrolled and enabled auth via setting. - * Not considering encryption or lock down state. */ - public boolean isUnlockWithFacePossible(int userId) { + public boolean isFaceAuthEnabledForUser(int userId) { return mFaceManager != null && mFaceManager.isHardwareDetected() - && !isFaceDisabled(userId) && mFaceManager.hasEnrolledTemplates(userId) && mFaceSettingEnabledForUser.get(userId); } diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java index c9d4957494e4..bd91333100bd 100644 --- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java @@ -47,7 +47,7 @@ public class ImageWallpaper extends WallpaperService { // This is to avoid destroying then recreating render context in a very short time. private static final int DELAY_FINISH_RENDERING = 1000; private static final int INTERVAL_WAIT_FOR_RENDERING = 100; - private static final int PATIENCE_WAIT_FOR_RENDERING = 5; + private static final int PATIENCE_WAIT_FOR_RENDERING = 10; private HandlerThread mWorker; @Override @@ -124,10 +124,10 @@ public class ImageWallpaper extends WallpaperService { @Override public void onAmbientModeChanged(boolean inAmbientMode, long animationDuration) { - long duration = mNeedTransition || animationDuration != 0 ? animationDuration : 0; + if (!mNeedTransition) return; mWorker.getThreadHandler().post( - () -> mRenderer.updateAmbientMode(inAmbientMode, duration)); - if (inAmbientMode && duration == 0) { + () -> mRenderer.updateAmbientMode(inAmbientMode, animationDuration)); + if (inAmbientMode && animationDuration == 0) { // This means that we are transiting from home to aod, to avoid // race condition between window visibility and transition, // we don't return until the transition is finished. See b/136643341. diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogView.java b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogView.java index a5857df8ba5a..ce67577ea483 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogView.java @@ -111,6 +111,9 @@ public abstract class BiometricDialogView extends LinearLayout { protected boolean mRequireConfirmation; private int mUserId; // used to determine if we should show work background + private boolean mCompletedAnimatingIn; + private boolean mPendingDismissDialog; + protected abstract int getHintStringResourceId(); protected abstract int getAuthenticatedAccessibilityResourceId(); protected abstract int getIconDescriptionResourceId(); @@ -332,6 +335,7 @@ public abstract class BiometricDialogView extends LinearLayout { mDialog.setAlpha(1.0f); mDialog.setTranslationY(0); mLayout.setAlpha(1.0f); + mCompletedAnimatingIn = true; } else { // Dim the background and slide the dialog up mDialog.setTranslationY(mAnimationTranslationOffset); @@ -352,6 +356,12 @@ public abstract class BiometricDialogView extends LinearLayout { } public void startDismiss() { + if (!mCompletedAnimatingIn) { + Log.w(TAG, "startDismiss(): waiting for onDialogAnimatedIn"); + mPendingDismissDialog = true; + return; + } + mAnimatingAway = true; // This is where final cleanup should occur. @@ -499,6 +509,13 @@ public abstract class BiometricDialogView extends LinearLayout { } public void onDialogAnimatedIn() { + mCompletedAnimatingIn = true; + + if (mPendingDismissDialog) { + Log.d(TAG, "onDialogAnimatedIn(): mPendingDismissDialog=true, dismissing now"); + startDismiss(); + mPendingDismissDialog = false; + } } public void restoreState(Bundle bundle) { diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/FaceDialogView.java b/packages/SystemUI/src/com/android/systemui/biometrics/FaceDialogView.java index 729242e3144f..ae6cb5ce23d3 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/FaceDialogView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/FaceDialogView.java @@ -460,6 +460,7 @@ public class FaceDialogView extends BiometricDialogView { @Override public void onDialogAnimatedIn() { + super.onDialogAnimatedIn(); mDialogAnimatedIn = true; mIconController.startPulsing(); } diff --git a/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java b/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java index cee01a4d3048..ce82bbfb1512 100644 --- a/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java +++ b/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java @@ -50,6 +50,8 @@ public class BrightLineFalsingManager implements FalsingManager { private boolean mSessionStarted; private MetricsLogger mMetricsLogger; private int mIsFalseTouchCalls; + private boolean mShowingAod; + private boolean mScreenOn; private final ExecutorService mBackgroundExecutor = Executors.newSingleThreadExecutor(); @@ -105,10 +107,12 @@ public class BrightLineFalsingManager implements FalsingManager { } private void sessionStart() { - logDebug("Starting Session"); - mSessionStarted = true; - registerSensors(); - mClassifiers.forEach(FalsingClassifier::onSessionStarted); + if (!mSessionStarted && !mShowingAod && mScreenOn) { + logDebug("Starting Session"); + mSessionStarted = true; + registerSensors(); + mClassifiers.forEach(FalsingClassifier::onSessionStarted); + } } private void sessionEnd() { @@ -172,6 +176,7 @@ public class BrightLineFalsingManager implements FalsingManager { mMetricsLogger.histogram(FALSING_SUCCESS, mIsFalseTouchCalls); mIsFalseTouchCalls = 0; } + sessionEnd(); } @Override @@ -180,6 +185,7 @@ public class BrightLineFalsingManager implements FalsingManager { @Override public void setShowingAod(boolean showingAod) { + mShowingAod = showingAod; if (showingAod) { sessionEnd(); } else { @@ -264,7 +270,7 @@ public class BrightLineFalsingManager implements FalsingManager { @Override public void onScreenOnFromTouch() { - sessionStart(); + onScreenTurningOn(); } @Override @@ -286,11 +292,13 @@ public class BrightLineFalsingManager implements FalsingManager { @Override public void onScreenTurningOn() { + mScreenOn = true; sessionStart(); } @Override public void onScreenOff() { + mScreenOn = false; sessionEnd(); } diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java b/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java index ae6dac59b2f5..07dd2cd77043 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java @@ -77,8 +77,10 @@ public interface DozeHost { interface Callback { /** * Called when a high priority notification is added. + * @param onPulseSuppressedListener A listener that is invoked if the pulse is being + * supressed. */ - default void onNotificationAlerted() {} + default void onNotificationAlerted(Runnable onPulseSuppressedListener) {} /** * Called when battery state or power save mode changes. diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java index 8ef01e8d608e..2ca85c074a89 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java @@ -106,22 +106,31 @@ public class DozeTriggers implements DozeMachine.Part { mDockManager = dockManager; } - private void onNotification() { + private void onNotification(Runnable onPulseSuppressedListener) { if (DozeMachine.DEBUG) { Log.d(TAG, "requestNotificationPulse"); } if (!sWakeDisplaySensorState) { Log.d(TAG, "Wake display false. Pulse denied."); + runIfNotNull(onPulseSuppressedListener); return; } mNotificationPulseTime = SystemClock.elapsedRealtime(); if (!mConfig.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) { + runIfNotNull(onPulseSuppressedListener); return; } - requestPulse(DozeLog.PULSE_REASON_NOTIFICATION, false /* performedProxCheck */); + requestPulse(DozeLog.PULSE_REASON_NOTIFICATION, false /* performedProxCheck */, + onPulseSuppressedListener); DozeLog.traceNotificationPulse(mContext); } + private static void runIfNotNull(Runnable runnable) { + if (runnable != null) { + runnable.run(); + } + } + private void proximityCheckThenCall(IntConsumer callback, boolean alreadyPerformedProxCheck, int reason) { @@ -158,10 +167,11 @@ public class DozeTriggers implements DozeMachine.Part { if (isWakeDisplay) { onWakeScreen(wakeEvent, mMachine.isExecutingTransition() ? null : mMachine.getState()); } else if (isLongPress) { - requestPulse(pulseReason, sensorPerformedProxCheck); + requestPulse(pulseReason, sensorPerformedProxCheck, null /* onPulseSupressedListener */); } else if (isWakeLockScreen) { if (wakeEvent) { - requestPulse(pulseReason, sensorPerformedProxCheck); + requestPulse(pulseReason, sensorPerformedProxCheck, + null /* onPulseSupressedListener */); } } else { proximityCheckThenCall((result) -> { @@ -340,7 +350,8 @@ public class DozeTriggers implements DozeMachine.Part { } } - private void requestPulse(final int reason, boolean performedProxCheck) { + private void requestPulse(final int reason, boolean performedProxCheck, + Runnable onPulseSuppressedListener) { Assert.isMainThread(); mDozeHost.extendPulse(reason); @@ -357,6 +368,7 @@ public class DozeTriggers implements DozeMachine.Part { DozeLog.tracePulseDropped(mContext, mPulsePending, mMachine.getState(), mDozeHost.isPulsingBlocked()); } + runIfNotNull(onPulseSuppressedListener); return; } @@ -365,6 +377,7 @@ public class DozeTriggers implements DozeMachine.Part { if (result == ProximityCheck.RESULT_NEAR) { // in pocket, abort pulse mPulsePending = false; + runIfNotNull(onPulseSuppressedListener); } else { // not in pocket, continue pulsing continuePulseRequest(reason); @@ -482,7 +495,8 @@ public class DozeTriggers implements DozeMachine.Part { public void onReceive(Context context, Intent intent) { if (PULSE_ACTION.equals(intent.getAction())) { if (DozeMachine.DEBUG) Log.d(TAG, "Received pulse intent"); - requestPulse(DozeLog.PULSE_REASON_INTENT, false /* performedProxCheck */); + requestPulse(DozeLog.PULSE_REASON_INTENT, false, /* performedProxCheck */ + null /* onPulseSupressedListener */); } if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(intent.getAction())) { mMachine.requestState(DozeMachine.State.FINISH); @@ -532,8 +546,8 @@ public class DozeTriggers implements DozeMachine.Part { private DozeHost.Callback mHostCallback = new DozeHost.Callback() { @Override - public void onNotificationAlerted() { - onNotification(); + public void onNotificationAlerted(Runnable onPulseSuppressedListener) { + onNotification(onPulseSuppressedListener); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageRevealHelper.java b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageRevealHelper.java index 45e97b38d87e..b154e66a846e 100644 --- a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageRevealHelper.java +++ b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageRevealHelper.java @@ -65,7 +65,7 @@ class ImageRevealHelper { @Override public void onAnimationStart(Animator animation) { if (mRevealListener != null) { - mRevealListener.onRevealStart(); + mRevealListener.onRevealStart(true /* animate */); } } }); @@ -73,7 +73,7 @@ class ImageRevealHelper { private void animate() { mAnimator.cancel(); - mAnimator.setFloatValues(mReveal, !mAwake ? MIN_REVEAL : MAX_REVEAL); + mAnimator.setFloatValues(mReveal, mAwake ? MAX_REVEAL : MIN_REVEAL); mAnimator.start(); } @@ -84,12 +84,11 @@ class ImageRevealHelper { void updateAwake(boolean awake, long duration) { mAwake = awake; mAnimator.setDuration(duration); - if (!mAwake && duration == 0) { - // We are transiting from home to aod, - // since main thread is waiting for rendering finished, we only need draw - // the last state directly, which is a black screen. - mReveal = MIN_REVEAL; - mRevealListener.onRevealStart(); + if (duration == 0) { + // We are transiting from home to aod or aod to home directly, + // we don't need to do transition in these cases. + mReveal = mAwake ? MAX_REVEAL : MIN_REVEAL; + mRevealListener.onRevealStart(false /* animate */); mRevealListener.onRevealStateChanged(); mRevealListener.onRevealEnd(); } else { @@ -110,7 +109,7 @@ class ImageRevealHelper { /** * Called back while reveal starts. */ - void onRevealStart(); + void onRevealStart(boolean animate); /** * Called back while reveal ends. diff --git a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java index 93d8dd6146a6..7b22a49fc88a 100644 --- a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java +++ b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageWallpaperRenderer.java @@ -24,6 +24,7 @@ import static android.opengl.GLES20.glViewport; import android.app.WallpaperManager; import android.content.Context; +import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Rect; import android.util.Log; @@ -70,7 +71,14 @@ public class ImageWallpaperRenderer implements GLWallpaperRenderer, DisplayInfo displayInfo = new DisplayInfo(); WindowManager wm = context.getSystemService(WindowManager.class); wm.getDefaultDisplay().getDisplayInfo(displayInfo); - mScissor = new Rect(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight); + + // We only do transition in portrait currently, b/137962047. + int orientation = context.getResources().getConfiguration().orientation; + if (orientation == Configuration.ORIENTATION_PORTRAIT) { + mScissor = new Rect(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight); + } else { + mScissor = new Rect(0, 0, displayInfo.logicalHeight, displayInfo.logicalWidth); + } mProxy = proxy; mProgram = new ImageGLProgram(context); @@ -179,20 +187,24 @@ public class ImageWallpaperRenderer implements GLWallpaperRenderer, } @Override - public void onRevealStart() { - mScissorMode = true; - // Use current display area of texture. - mWallpaper.adjustTextureCoordinates(mSurfaceSize, mScissor, mXOffset, mYOffset); + public void onRevealStart(boolean animate) { + if (animate) { + mScissorMode = true; + // Use current display area of texture. + mWallpaper.adjustTextureCoordinates(mSurfaceSize, mScissor, mXOffset, mYOffset); + } mProxy.preRender(); } @Override public void onRevealEnd() { - mScissorMode = false; - // reset texture coordinates to use full texture. - mWallpaper.adjustTextureCoordinates(null, null, 0, 0); - // We need draw full texture back before finishing render. - mProxy.requestRender(); + if (mScissorMode) { + mScissorMode = false; + // reset texture coordinates to use full texture. + mWallpaper.adjustTextureCoordinates(null, null, 0, 0); + // We need draw full texture back before finishing render. + mProxy.requestRender(); + } mProxy.postRender(); } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java index 5136682bb292..48f32cf04fb2 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java @@ -52,6 +52,7 @@ import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.R; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationMediaManager; +import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.policy.NextAlarmController; @@ -62,7 +63,6 @@ import com.android.systemui.util.wakelock.SettableWakeLock; import com.android.systemui.util.wakelock.WakeLock; import java.util.Date; -import java.util.HashSet; import java.util.Locale; import java.util.TimeZone; import java.util.concurrent.TimeUnit; @@ -128,6 +128,7 @@ public class KeyguardSliceProvider extends SliceProvider implements private CharSequence mMediaTitle; private CharSequence mMediaArtist; protected boolean mDozing; + private int mStatusBarState; private boolean mMediaIsVisible; /** @@ -231,7 +232,11 @@ public class KeyguardSliceProvider extends SliceProvider implements protected boolean needsMediaLocked() { boolean keepWhenAwake = mKeyguardBypassController != null && mKeyguardBypassController.getBypassEnabled() && mDozeParameters.getAlwaysOn(); - return !TextUtils.isEmpty(mMediaTitle) && mMediaIsVisible && (mDozing || keepWhenAwake); + // Show header if music is playing and the status bar is in the shade state. This way, an + // animation isn't necessary when pressing power and transitioning to AOD. + boolean keepWhenShade = mStatusBarState == StatusBarState.SHADE && mMediaIsVisible; + return !TextUtils.isEmpty(mMediaTitle) && mMediaIsVisible && (mDozing || keepWhenAwake + || keepWhenShade); } protected void addMediaLocked(ListBuilder listBuilder) { @@ -458,7 +463,7 @@ public class KeyguardSliceProvider extends SliceProvider implements synchronized (this) { boolean nextVisible = NotificationMediaManager.isPlayingState(state); mHandler.removeCallbacksAndMessages(mMediaToken); - if (mMediaIsVisible && !nextVisible) { + if (mMediaIsVisible && !nextVisible && mStatusBarState != StatusBarState.SHADE) { // We need to delay this event for a few millis when stopping to avoid jank in the // animation. The media app might not send its update when buffering, and the slice // would end up without a header for 0.5 second. @@ -515,5 +520,14 @@ public class KeyguardSliceProvider extends SliceProvider implements @Override public void onStateChanged(int newState) { + final boolean notify; + synchronized (this) { + boolean needsMedia = needsMediaLocked(); + mStatusBarState = newState; + notify = needsMedia != needsMediaLocked(); + } + if (notify) { + notifyChange(); + } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java index 0fe5f8a6af5a..4cc5b2144adc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java @@ -15,7 +15,6 @@ package com.android.systemui.statusbar; import android.content.pm.UserInfo; -import android.service.notification.StatusBarNotification; import android.util.SparseArray; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -58,7 +57,7 @@ public interface NotificationLockscreenUserManager { boolean shouldHideNotifications(int userId); boolean shouldHideNotifications(String key); - boolean shouldShowOnKeyguard(StatusBarNotification sbn); + boolean shouldShowOnKeyguard(NotificationEntry entry); boolean isAnyProfilePublicMode(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java index 4ea1ed5b9451..e08a5ae07bd8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java @@ -33,7 +33,6 @@ import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; -import android.service.notification.StatusBarNotification; import android.util.Log; import android.util.SparseArray; import android.util.SparseBooleanArray; @@ -302,7 +301,7 @@ public class NotificationLockscreenUserManagerImpl implements Notification.VISIBILITY_SECRET; } - public boolean shouldShowOnKeyguard(StatusBarNotification sbn) { + public boolean shouldShowOnKeyguard(NotificationEntry entry) { if (getEntryManager() == null) { Log.wtf(TAG, "mEntryManager was null!", new Throwable()); return false; @@ -310,10 +309,10 @@ public class NotificationLockscreenUserManagerImpl implements boolean exceedsPriorityThreshold; if (NotificationUtils.useNewInterruptionModel(mContext) && hideSilentNotificationsOnLockscreen()) { - exceedsPriorityThreshold = getEntryManager().getNotificationData().isHighPriority(sbn); + exceedsPriorityThreshold = entry.isTopBucket(); } else { exceedsPriorityThreshold = - !getEntryManager().getNotificationData().isAmbient(sbn.getKey()); + !getEntryManager().getNotificationData().isAmbient(entry.key); } return mShowLockscreenNotifications && exceedsPriorityThreshold; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java index f001561754aa..00a12a9e4409 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java @@ -17,6 +17,10 @@ package com.android.systemui.statusbar; import static com.android.systemui.Dependency.MAIN_HANDLER; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; +import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_UNLOCK_FADING; +import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK; +import static com.android.systemui.statusbar.phone.BiometricUnlockController + .MODE_WAKE_AND_UNLOCK_PULSING; import static com.android.systemui.statusbar.phone.StatusBar.DEBUG_MEDIA_FAKE_ARTWORK; import static com.android.systemui.statusbar.phone.StatusBar.ENABLE_LOCKSCREEN_WALLPAPER; import static com.android.systemui.statusbar.phone.StatusBar.SHOW_LOCKSCREEN_MEDIA_ARTWORK; @@ -595,9 +599,11 @@ public class NotificationMediaManager implements Dumpable { boolean cannotAnimateDoze = shadeController != null && shadeController.isDozing() && !ScrimState.AOD.getAnimateChange(); - if (mBiometricUnlockController != null && mBiometricUnlockController.getMode() + boolean needsBypassFading = mKeyguardMonitor.isBypassFadingAnimation(); + if (((mBiometricUnlockController != null && mBiometricUnlockController.getMode() == BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING - || hideBecauseOccluded || cannotAnimateDoze) { + || cannotAnimateDoze) && !needsBypassFading) + || hideBecauseOccluded) { // We are unlocking directly - no animation! mBackdrop.setVisibility(View.GONE); @@ -622,9 +628,7 @@ public class NotificationMediaManager implements Dumpable { }); if (mKeyguardMonitor.isKeyguardFadingAway()) { mBackdrop.animate() - // Make it disappear faster, as the focus should be on the activity - // behind. - .setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2) + .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration()) .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay()) .setInterpolator(Interpolators.LINEAR) .start(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java index 22c91647d7f7..6e75c0375afc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java @@ -397,15 +397,13 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle int userId = entry.notification.getUserId(); boolean suppressedSummary = mGroupManager.isSummaryOfSuppressedGroup( entry.notification) && !entry.isRowRemoved(); - boolean showOnKeyguard = mLockscreenUserManager.shouldShowOnKeyguard(entry - .notification); + boolean showOnKeyguard = mLockscreenUserManager.shouldShowOnKeyguard(entry); if (!showOnKeyguard) { // min priority notifications should show if their summary is showing if (mGroupManager.isChildInGroupWithSummary(entry.notification)) { NotificationEntry summary = mGroupManager.getLogicalGroupSummary( entry.notification); - if (summary != null && mLockscreenUserManager.shouldShowOnKeyguard( - summary.notification)) { + if (summary != null && mLockscreenUserManager.shouldShowOnKeyguard(summary)) { showOnKeyguard = true; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/BypassHeadsUpNotifier.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/BypassHeadsUpNotifier.kt index ea474ced7632..314dc04e574f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/BypassHeadsUpNotifier.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/BypassHeadsUpNotifier.kt @@ -21,6 +21,7 @@ import android.media.MediaMetadata import android.provider.Settings import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.plugins.statusbar.StatusBarStateController +import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.NotificationMediaManager import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.notification.collection.NotificationEntry @@ -40,6 +41,7 @@ class BypassHeadsUpNotifier @Inject constructor( private val bypassController: KeyguardBypassController, private val statusBarStateController: StatusBarStateController, private val headsUpManager: HeadsUpManagerPhone, + private val notificationLockscreenUserManager: NotificationLockscreenUserManager, private val mediaManager: NotificationMediaManager, tunerService: TunerService) : StatusBarStateController.StateListener, NotificationMediaManager.MediaListener { @@ -63,7 +65,7 @@ class BypassHeadsUpNotifier @Inject constructor( enabled = Settings.Secure.getIntForUser( context.contentResolver, Settings.Secure.SHOW_MEDIA_WHEN_BYPASSING, - 1 /* default */, + 0 /* default */, KeyguardUpdateMonitor.getCurrentUser()) != 0 }, Settings.Secure.SHOW_MEDIA_WHEN_BYPASSING) } @@ -79,9 +81,6 @@ class BypassHeadsUpNotifier @Inject constructor( if (!NotificationMediaManager.isPlayingState(state)) { newEntry = null } - if (newEntry?.isSensitive == true) { - newEntry = null - } currentMediaEntry = newEntry updateAutoHeadsUp(previous) updateAutoHeadsUp(currentMediaEntry) @@ -89,7 +88,7 @@ class BypassHeadsUpNotifier @Inject constructor( private fun updateAutoHeadsUp(entry: NotificationEntry?) { entry?.let { - val autoHeadsUp = it == currentMediaEntry && canAutoHeadsUp() + val autoHeadsUp = it == currentMediaEntry && canAutoHeadsUp(it) it.isAutoHeadsUp = autoHeadsUp if (autoHeadsUp) { headsUpManager.showNotification(it) @@ -97,11 +96,36 @@ class BypassHeadsUpNotifier @Inject constructor( } } + /** + * @return {@code true} if this entry be autoHeadsUpped right now. + */ + private fun canAutoHeadsUp(entry: NotificationEntry): Boolean { + if (!isAutoHeadsUpAllowed()) { + return false; + } + if (entry.isSensitive) { + // filter sensitive notifications + return false + } + if (!notificationLockscreenUserManager.shouldShowOnKeyguard(entry)) { + // filter notifications invisible on Keyguard + return false + } + if (!entryManager.notificationData.activeNotifications.contains(entry)) { + // filter notifications not the active list currently + return false + } + return true + } + override fun onStatePostChange() { updateAutoHeadsUp(currentMediaEntry) } - private fun canAutoHeadsUp() : Boolean { + /** + * @return {@code true} if autoHeadsUp is possible right now. + */ + private fun isAutoHeadsUpAllowed() : Boolean { if (!enabled) { return false } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt index 6a3816c50330..6af1f5bca07f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt @@ -29,6 +29,7 @@ import com.android.systemui.statusbar.phone.DozeParameters import com.android.systemui.statusbar.phone.HeadsUpManagerPhone import com.android.systemui.statusbar.phone.KeyguardBypassController import com.android.systemui.statusbar.phone.NotificationIconAreaController +import com.android.systemui.statusbar.phone.PanelExpansionListener import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener import javax.inject.Inject @@ -40,7 +41,8 @@ class NotificationWakeUpCoordinator @Inject constructor( private val mHeadsUpManagerPhone: HeadsUpManagerPhone, private val statusBarStateController: StatusBarStateController, private val bypassController: KeyguardBypassController) - : OnHeadsUpChangedListener, StatusBarStateController.StateListener { + : OnHeadsUpChangedListener, StatusBarStateController.StateListener, + PanelExpansionListener { private val mNotificationVisibility = object : FloatProperty<NotificationWakeUpCoordinator>("notificationVisibility") { @@ -64,7 +66,6 @@ class NotificationWakeUpCoordinator @Inject constructor( private var mVisibilityAnimator: ObjectAnimator? = null private var mVisibilityAmount = 0.0f private var mLinearVisibilityAmount = 0.0f - private var mWakingUp = false private val mEntrySetToClearWhenFinished = mutableSetOf<NotificationEntry>() private val mDozeParameters: DozeParameters private var pulseExpanding: Boolean = false @@ -73,6 +74,25 @@ class NotificationWakeUpCoordinator @Inject constructor( var fullyAwake: Boolean = false + var wakingUp = false + set(value) { + field = value + willWakeUp = false + if (value) { + if (mNotificationsVisible && !mNotificationsVisibleForExpansion + && !bypassController.bypassEnabled) { + // We're waking up while pulsing, let's make sure the animation looks nice + mStackScroller.wakeUpFromPulse(); + } + if (bypassController.bypassEnabled && !mNotificationsVisible) { + // Let's make sure our huns become visible once we are waking up in case + // they were blocked by the proximity sensor + updateNotificationVisibility(animate = shouldAnimateVisibility(), + increaseSpeed = false) + } + } + } + var willWakeUp = false set(value) { if (!value || mDozeAmount != 0.0f) { @@ -80,7 +100,9 @@ class NotificationWakeUpCoordinator @Inject constructor( } } + private var collapsedEnoughToHide: Boolean = false lateinit var iconAreaController : NotificationIconAreaController + var pulsing: Boolean = false set(value) { field = value @@ -102,7 +124,6 @@ class NotificationWakeUpCoordinator @Inject constructor( } } } - /** * True if we can show pulsing heads up notifications */ @@ -112,8 +133,12 @@ class NotificationWakeUpCoordinator @Inject constructor( var canShow = pulsing if (bypassController.bypassEnabled) { // We also allow pulsing on the lock screen! - canShow = canShow || (mWakingUp || willWakeUp || fullyAwake) + canShow = canShow || (wakingUp || willWakeUp || fullyAwake) && statusBarStateController.state == StatusBarState.KEYGUARD + // We want to hide the notifications when collapsed too much + if (collapsedEnoughToHide) { + canShow = false + } } return canShow } @@ -160,7 +185,7 @@ class NotificationWakeUpCoordinator @Inject constructor( wakeUpListeners.add(listener); } - fun removeFullyHiddenChangedListener(listener: WakeUpListener) { + fun removeListener(listener: WakeUpListener) { wakeUpListeners.remove(listener); } @@ -169,7 +194,7 @@ class NotificationWakeUpCoordinator @Inject constructor( var visible = mNotificationsVisibleForExpansion || mHeadsUpManagerPhone.hasNotifications() visible = visible && canShowPulsingHuns - if (!visible && mNotificationsVisible && (mWakingUp || willWakeUp) && mDozeAmount != 0.0f) { + if (!visible && mNotificationsVisible && (wakingUp || willWakeUp) && mDozeAmount != 0.0f) { // let's not make notifications invisible while waking up, otherwise the animation // is strange return; @@ -229,6 +254,18 @@ class NotificationWakeUpCoordinator @Inject constructor( this.state = newState } + override fun onPanelExpansionChanged(expansion: Float, tracking: Boolean) { + val collapsedEnough = expansion <= 0.9f + if (collapsedEnough != this.collapsedEnoughToHide) { + val couldShowPulsingHuns = canShowPulsingHuns; + this.collapsedEnoughToHide = collapsedEnough + if (couldShowPulsingHuns && !canShowPulsingHuns) { + updateNotificationVisibility(animate = true, increaseSpeed = true) + mHeadsUpManagerPhone.releaseAllImmediately() + } + } + } + private fun updateDozeAmountIfBypass(): Boolean { if (bypassController.bypassEnabled) { var amount = 1.0f; @@ -307,16 +344,6 @@ class NotificationWakeUpCoordinator @Inject constructor( return if (bypassController.bypassEnabled) 0.0f else overflow } - fun setWakingUp(wakingUp: Boolean) { - willWakeUp = false - mWakingUp = wakingUp - if (wakingUp && mNotificationsVisible && !mNotificationsVisibleForExpansion - && !bypassController.bypassEnabled) { - // We're waking up while pulsing, let's make sure the animation looks nice - mStackScroller.wakeUpFromPulse(); - } - } - override fun onHeadsUpStateChanged(entry: NotificationEntry, isHeadsUp: Boolean) { var animate = shouldAnimateVisibility() if (!isHeadsUp) { @@ -325,7 +352,7 @@ class NotificationWakeUpCoordinator @Inject constructor( // if we animate, we see the shelf briefly visible. Instead we fully animate // the notification and its background out animate = false - } else if (!mWakingUp && !willWakeUp){ + } else if (!wakingUp && !willWakeUp){ // TODO: look that this is done properly and not by anyone else entry.setHeadsUpAnimatingAway(true) mEntrySetToClearWhenFinished.add(entry) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java index fca520fe0521..1ce493444e25 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java @@ -25,7 +25,6 @@ import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.SnoozeCriterion; import android.service.notification.StatusBarNotification; import android.util.ArrayMap; -import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.Dependency; @@ -108,10 +107,19 @@ public class NotificationData { boolean bSystemMax = bImportance >= NotificationManager.IMPORTANCE_HIGH && isSystemNotification(nb); - boolean isHeadsUp = a.getRow().isHeadsUp(); - if (isHeadsUp != b.getRow().isHeadsUp()) { - return isHeadsUp ? -1 : 1; - } else if (isHeadsUp) { + + boolean aHeadsUp = a.getRow().isHeadsUp(); + boolean bHeadsUp = b.getRow().isHeadsUp(); + + // HACK: This should really go elsewhere, but it's currently not straightforward to + // extract the comparison code and we're guaranteed to touch every element, so this is + // the best place to set the buckets for the moment. + a.setIsTopBucket(aHeadsUp || aMedia || aSystemMax || a.isHighPriority()); + b.setIsTopBucket(bHeadsUp || bMedia || bSystemMax || b.isHighPriority()); + + if (aHeadsUp != bHeadsUp) { + return aHeadsUp ? -1 : 1; + } else if (aHeadsUp) { // Provide consistent ranking with headsUpManager return mHeadsUpManager.compare(a, b); } else if (aMedia != bMedia) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java index b19d2ca29c96..fe8854168288 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java @@ -173,9 +173,13 @@ public final class NotificationEntry { * the lock screen/status bar and in the top section in the shade. */ private boolean mHighPriority; + + private boolean mIsTopBucket; + private boolean mSensitive = true; private Runnable mOnSensitiveChangedListener; private boolean mAutoHeadsUp; + private boolean mPulseSupressed; public NotificationEntry(StatusBarNotification n) { this(n, null); @@ -224,6 +228,18 @@ public final class NotificationEntry { this.mHighPriority = highPriority; } + /** + * @return True if the notif should appear in the "top" or "important" section of notifications + * (as opposed to the "bottom" or "silent" section). This is usually the same as + * {@link #isHighPriority()}, but there are certain exceptions, such as media notifs. + */ + public boolean isTopBucket() { + return mIsTopBucket; + } + public void setIsTopBucket(boolean isTopBucket) { + mIsTopBucket = isTopBucket; + } + public boolean isBubble() { return (notification.getNotification().flags & FLAG_BUBBLE) != 0; } @@ -900,6 +916,14 @@ public final class NotificationEntry { mOnSensitiveChangedListener = listener; } + public boolean isPulseSuppressed() { + return mPulseSupressed; + } + + public void setPulseSuppressed(boolean suppressed) { + mPulseSupressed = suppressed; + } + /** Information about a suggestion that is being edited. */ public static class EditedSuggestionInfo { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java index d057a1d2f20b..48a82957bf1e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java @@ -349,7 +349,7 @@ public class NotificationContentInflater { } if ((reInflateFlags & FLAG_CONTENT_VIEW_PUBLIC) != 0) { - result.newPublicView = builder.makePublicContentView(); + result.newPublicView = builder.makePublicContentView(isLowPriority); } result.packageContext = packageContext; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationListContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationListContainer.java index 212808dae8e3..15cc72c2d7a1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationListContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationListContainer.java @@ -184,4 +184,6 @@ public interface NotificationListContainer extends ExpandableView.OnHeightChange default boolean containsView(View v) { return true; } + + default void setWillExpand(boolean willExpand) {}; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java index 170a4d570688..d119fb79e4c6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java @@ -133,7 +133,7 @@ class NotificationSectionsManager implements StackScrollAlgorithm.SectionProvide if (child instanceof ExpandableNotificationRow && child.getVisibility() != View.GONE) { ExpandableNotificationRow row = (ExpandableNotificationRow) child; - if (!row.getEntry().isHighPriority()) { + if (!row.getEntry().isTopBucket()) { firstGentleNotifIndex = i; mFirstGentleNotif = row; break; @@ -248,7 +248,7 @@ class NotificationSectionsManager implements StackScrollAlgorithm.SectionProvide View child = mParent.getChildAt(i); if (child.getVisibility() != View.GONE && child instanceof ExpandableNotificationRow) { ExpandableNotificationRow row = (ExpandableNotificationRow) child; - if (!row.getEntry().isHighPriority()) { + if (!row.getEntry().isTopBucket()) { break; } else { lastChildBeforeGap = row; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 9e3d74b138fa..3e4fe20a8cab 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -500,6 +500,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private boolean mAnimateBottomOnLayout; private float mLastSentAppear; private float mLastSentExpandedHeight; + private boolean mWillExpand; @Inject public NotificationStackScrollLayout( @@ -2549,13 +2550,21 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } return; } - int minTopPosition = 0; + int minTopPosition; NotificationSection lastSection = getLastVisibleSection(); boolean onKeyguard = mStatusBarState == StatusBarState.KEYGUARD; if (!onKeyguard) { minTopPosition = (int) (mTopPadding + mStackTranslation); } else if (lastSection == null) { minTopPosition = mTopPadding; + } else { + // The first sections could be empty while there could still be elements in later + // sections. The position of these first few sections is determined by the position of + // the first visible section. + NotificationSection firstVisibleSection = getFirstVisibleSection(); + firstVisibleSection.updateBounds(0 /* minTopPosition*/, 0 /* minBottomPosition */, + false /* shiftPulsingWithFirst */); + minTopPosition = firstVisibleSection.getBounds().top; } boolean shiftPulsingWithFirst = mHeadsUpManager.getAllEntries().count() <= 1 && (mAmbientState.isDozing() @@ -4398,6 +4407,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mStateAnimator.setShadeExpanded(isExpanded); mSwipeHelper.setIsExpanded(isExpanded); if (changed) { + mWillExpand = false; if (!mIsExpanded) { mGroupManager.collapseAllGroups(); mExpandHelper.cancelImmediately(); @@ -5047,7 +5057,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd if (mAnimationsEnabled && (isHeadsUp || mHeadsUpGoingAwayAnimationsAllowed)) { mHeadsUpChangeAnimations.add(new Pair<>(row, isHeadsUp)); mNeedsAnimation = true; - if (!mIsExpanded && !isHeadsUp) { + if (!mIsExpanded && !mWillExpand && !isHeadsUp) { row.setHeadsUpAnimatingAway(true); } requestChildrenUpdate(); @@ -5068,6 +5078,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd requestChildrenUpdate(); } + @Override + public void setWillExpand(boolean willExpand) { + mWillExpand = willExpand; + } + @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void setTrackingHeadsUp(ExpandableNotificationRow row) { mTrackingHeadsUp = row != null; @@ -5668,6 +5683,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd // The bottom might change because we're using the final actual height of the view mAnimateBottomOnLayout = true; } + // Let's update the footer once the notifications have been updated (in the next frame) + post(this::updateFooter); } public void setOnPulseHeightChangedListener(Runnable listener) { @@ -5738,7 +5755,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd currentIndex++; boolean beforeSpeedBump; if (mHighPriorityBeforeSpeedBump) { - beforeSpeedBump = row.getEntry().isHighPriority(); + beforeSpeedBump = row.getEntry().isTopBucket(); } else { beforeSpeedBump = !row.getEntry().ambient; } @@ -5796,9 +5813,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd case ROWS_ALL: return true; case ROWS_HIGH_PRIORITY: - return row.getEntry().isHighPriority(); + return row.getEntry().isTopBucket(); case ROWS_GENTLE: - return !row.getEntry().isHighPriority(); + return !row.getEntry().isTopBucket(); default: throw new IllegalArgumentException("Unknown selection: " + selection); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java index 94cd2cdaa9d3..41c6a7ba7848 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java @@ -445,14 +445,13 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { if (!mUpdateMonitor.isDeviceInteractive()) { if (!mStatusBarKeyguardViewManager.isShowing()) { return bypass ? MODE_WAKE_AND_UNLOCK : MODE_ONLY_WAKE; - } else if (mDozeScrimController.isPulsing() && unlockingAllowed) { + } else if (!unlockingAllowed) { + return bypass ? MODE_SHOW_BOUNCER : MODE_NONE; + } else if (mDozeScrimController.isPulsing()) { // Let's not wake-up to lock screen when not bypassing, otherwise the notification // would move as the user tried to tap it. return bypass ? MODE_WAKE_AND_UNLOCK_PULSING : MODE_NONE; } else { - if (!(mDozeScrimController.isPulsing() && !unlockingAllowed)) { - Log.wtf(TAG, "Face somehow arrived when the device was not interactive"); - } if (bypass) { // Wake-up fading out nicely return MODE_WAKE_AND_UNLOCK_PULSING; @@ -530,7 +529,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { mStatusBar.notifyBiometricAuthModeChanged(); } - private final WakefulnessLifecycle.Observer mWakefulnessObserver = + @VisibleForTesting + final WakefulnessLifecycle.Observer mWakefulnessObserver = new WakefulnessLifecycle.Observer() { @Override public void onFinishedWakingUp() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java index 46dd5e62ddda..f53c4e8c818e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java @@ -35,6 +35,7 @@ import com.android.systemui.statusbar.CrossFadeHelper; import com.android.systemui.statusbar.HeadsUpStatusBarView; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.SysuiStatusBarStateController; +import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; @@ -48,7 +49,7 @@ import java.util.function.Consumer; * Controls the appearance of heads up notifications in the icon area and the header itself. */ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, - DarkIconDispatcher.DarkReceiver { + DarkIconDispatcher.DarkReceiver, NotificationWakeUpCoordinator.WakeUpListener { public static final int CONTENT_FADE_DURATION = 110; public static final int CONTENT_FADE_DELAY = 100; private final NotificationIconAreaController mNotificationIconAreaController; @@ -67,6 +68,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, private final KeyguardBypassController mBypassController; private final StatusBarStateController mStatusBarStateController; private final CommandQueue mCommandQueue; + private final NotificationWakeUpCoordinator mWakeUpCoordinator; @VisibleForTesting float mExpandedHeight; @VisibleForTesting @@ -95,9 +97,10 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, HeadsUpManagerPhone headsUpManager, View statusbarView, SysuiStatusBarStateController statusBarStateController, - KeyguardBypassController keyguardBypassController) { + KeyguardBypassController keyguardBypassController, + NotificationWakeUpCoordinator wakeUpCoordinator) { this(notificationIconAreaController, headsUpManager, statusBarStateController, - keyguardBypassController, + keyguardBypassController, wakeUpCoordinator, statusbarView.findViewById(R.id.heads_up_status_bar_view), statusbarView.findViewById(R.id.notification_stack_scroller), statusbarView.findViewById(R.id.notification_panel), @@ -112,6 +115,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, HeadsUpManagerPhone headsUpManager, StatusBarStateController stateController, KeyguardBypassController bypassController, + NotificationWakeUpCoordinator wakeUpCoordinator, HeadsUpStatusBarView headsUpStatusBarView, NotificationStackScrollLayout stackScroller, NotificationPanelView panelView, @@ -153,6 +157,8 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, }); mBypassController = bypassController; mStatusBarStateController = stateController; + mWakeUpCoordinator = wakeUpCoordinator; + wakeUpCoordinator.addListener(this); mCommandQueue = getComponent(headsUpStatusBarView.getContext(), CommandQueue.class); mKeyguardMonitor = Dependency.get(KeyguardMonitor.class); } @@ -161,6 +167,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, public void destroy() { mHeadsUpManager.removeListener(this); mHeadsUpStatusBarView.setOnDrawingRectChangedListener(null); + mWakeUpCoordinator.removeListener(this); mPanelView.removeTrackingHeadsUpListener(mSetTrackingHeadsUp); mPanelView.removeVerticalTranslationListener(mUpdatePanelTranslation); mPanelView.setHeadsUpAppearanceController(null); @@ -289,6 +296,11 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, updateParentClipping(true /* shouldClip */); }); } + // Show the status bar icons when the view gets shown / hidden + if (mStatusBarStateController.getState() != StatusBarState.SHADE) { + mCommandQueue.recomputeDisableFlags( + mHeadsUpStatusBarView.getContext().getDisplayId(), false); + } } } @@ -362,10 +374,12 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, * @return if the heads up status bar view should be shown */ public boolean shouldBeVisible() { - boolean canShow = !mIsExpanded; + boolean notificationsShown = !mWakeUpCoordinator.getNotificationsFullyHidden(); + boolean canShow = !mIsExpanded && notificationsShown; if (mBypassController.getBypassEnabled() && (mStatusBarStateController.getState() == StatusBarState.KEYGUARD - || mKeyguardMonitor.isKeyguardGoingAway())) { + || mKeyguardMonitor.isKeyguardGoingAway()) + && notificationsShown) { canShow = true; } return canShow && mHeadsUpManager.hasPinnedHeadsUp(); @@ -377,15 +391,6 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, updateHeader(entry); } - @Override - public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) { - if (mStatusBarStateController.getState() != StatusBarState.SHADE) { - // Show the status bar icons when the pinned mode changes - mCommandQueue.recomputeDisableFlags( - mHeadsUpStatusBarView.getContext().getDisplayId(), false); - } - } - public void setAppearFraction(float expandedHeight, float appearFraction) { boolean changed = expandedHeight != mExpandedHeight; mExpandedHeight = expandedHeight; @@ -451,4 +456,9 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, mAppearFraction = oldController.mAppearFraction; } } + + @Override + public void onFullyHiddenChanged(boolean isFullyHidden) { + updateTopEntry(); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index d6f8a606af55..c4d346ccaefb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -170,7 +170,7 @@ public class KeyguardBouncer { // Split up the work over multiple frames. DejankUtils.removeCallbacks(mResetRunnable); - if (mUnlockMethodCache.isUnlockingWithFacePossible() && !needsFullscreenBouncer() + if (mUnlockMethodCache.isFaceAuthEnabled() && !needsFullscreenBouncer() && !mKeyguardUpdateMonitor.userNeedsStrongAuth()) { mHandler.postDelayed(mShowRunnable, BOUNCER_FACE_DELAY); } else { @@ -207,14 +207,12 @@ public class KeyguardBouncer { * @see #onFullyShown() */ private void onFullyHidden() { - if (!mShowingSoon) { - cancelShowRunnable(); - if (mRoot != null) { - mRoot.setVisibility(View.INVISIBLE); - } - mFalsingManager.onBouncerHidden(); - DejankUtils.postAfterTraversal(mResetRunnable); + cancelShowRunnable(); + if (mRoot != null) { + mRoot.setVisibility(View.INVISIBLE); } + mFalsingManager.onBouncerHidden(); + DejankUtils.postAfterTraversal(mResetRunnable); } private final Runnable mShowRunnable = new Runnable() { @@ -349,7 +347,7 @@ public class KeyguardBouncer { * {@link #show(boolean)} was called but we're not showing yet, or being dragged. */ public boolean inTransit() { - return mShowingSoon || mExpansion != EXPANSION_HIDDEN; + return mShowingSoon || mExpansion != EXPANSION_HIDDEN && mExpansion != EXPANSION_VISIBLE; } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt index 0aec2b12fa92..70d3bff9b822 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt @@ -47,7 +47,7 @@ class KeyguardBypassController { * If face unlock dismisses the lock screen or keeps user on keyguard for the current user. */ var bypassEnabled: Boolean = false - get() = field && unlockMethodCache.isUnlockingWithFacePossible + get() = field && unlockMethodCache.isFaceAuthEnabled private set var bouncerShowing: Boolean = false diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java index 1360a084207b..c9c80d464b46 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java @@ -217,7 +217,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange mConfigurationController.removeCallback(this); mKeyguardUpdateMonitor.removeCallback(mUpdateMonitorCallback); mKeyguardMonitor.removeCallback(mKeyguardMonitorCallback); - mWakeUpCoordinator.removeFullyHiddenChangedListener(this); + mWakeUpCoordinator.removeListener(this); mUnlockMethodCache.removeListener(this); if (mDockManager != null) { mDockManager.removeListener(mDockEventListener); @@ -323,14 +323,24 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange } updateDarkTint(); + updateIconVisibility(); + updateClickability(); + + return true; + } + + /** + * Update the icon visibility + * @return true if the visibility changed + */ + private boolean updateIconVisibility() { boolean onAodNotPulsingOrDocked = mDozing && (!mPulsing || mDocked); boolean invisible = onAodNotPulsingOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance; if (mBypassController.getBypassEnabled() && !mBouncerShowingScrimmed) { - if (mHeadsUpManager.isHeadsUpGoingAway() - || mHeadsUpManager.hasPinnedHeadsUp() - || (mStatusBarStateController.getState() == StatusBarState.KEYGUARD - && !mWakeUpCoordinator.getNotificationsFullyHidden())) { + if ((mHeadsUpManager.isHeadsUpGoingAway() || mHeadsUpManager.hasPinnedHeadsUp()) + && mStatusBarStateController.getState() == StatusBarState.KEYGUARD + && !mWakeUpCoordinator.getNotificationsFullyHidden()) { invisible = true; } } @@ -349,10 +359,9 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange .setDuration(233) .start(); } + return true; } - updateClickability(); - - return true; + return false; } private boolean canBlockUpdates() { @@ -440,7 +449,10 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange @Override public void onFullyHiddenChanged(boolean isFullyHidden) { if (mBypassController.getBypassEnabled()) { - update(); + boolean changed = updateIconVisibility(); + if (changed) { + update(); + } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 22e3edb2bbd8..081e29381a65 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -21,7 +21,9 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SEARCH_DISABLED; import static com.android.systemui.shared.system.QuickStepContract.isGesturalMode; import static com.android.systemui.statusbar.phone.BarTransitions.MODE_OPAQUE; @@ -706,7 +708,7 @@ public class NavigationBarView extends FrameLayout implements } } - public void onPanelExpandedChange() { + public void onStatusBarPanelStateChanged() { updateSlippery(); updateSystemUiStateFlags(); } @@ -719,9 +721,13 @@ public class NavigationBarView extends FrameLayout implements (mDisabledFlags & View.STATUS_BAR_DISABLE_RECENT) != 0, displayId); mOverviewProxyService.setSystemUiStateFlag(SYSUI_STATE_HOME_DISABLED, (mDisabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0, displayId); + mOverviewProxyService.setSystemUiStateFlag(SYSUI_STATE_SEARCH_DISABLED, + (mDisabledFlags & View.STATUS_BAR_DISABLE_SEARCH) != 0, displayId); if (mPanelView != null) { mOverviewProxyService.setSystemUiStateFlag(SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED, mPanelView.isFullyExpanded() && !mPanelView.isInSettings(), displayId); + mOverviewProxyService.setSystemUiStateFlag(SYSUI_STATE_QUICK_SETTINGS_EXPANDED, + mPanelView.isInSettings(), displayId); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationHandle.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationHandle.java index 0fe12943614c..4f7af58094ec 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationHandle.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationHandle.java @@ -53,8 +53,8 @@ public class NavigationHandle extends View implements ButtonInterface { final int dualToneLightTheme = Utils.getThemeAttr(context, R.attr.lightIconTheme); Context lightContext = new ContextThemeWrapper(context, dualToneLightTheme); Context darkContext = new ContextThemeWrapper(context, dualToneDarkTheme); - mLightColor = Utils.getColorAttrDefaultColor(lightContext, R.attr.singleToneColor); - mDarkColor = Utils.getColorAttrDefaultColor(darkContext, R.attr.singleToneColor); + mLightColor = Utils.getColorAttrDefaultColor(lightContext, R.attr.homeHandleColor); + mDarkColor = Utils.getColorAttrDefaultColor(darkContext, R.attr.homeHandleColor); mPaint.setAntiAlias(true); setFocusable(false); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java index 64fef55a21d3..1df9411019d2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java @@ -32,8 +32,6 @@ import static com.android.systemui.shared.system.QuickStepContract.ACTION_ENABLE import static com.android.systemui.shared.system.QuickStepContract.ACTION_ENABLE_GESTURE_NAV_RESULT; import static com.android.systemui.shared.system.QuickStepContract.EXTRA_RESULT_INTENT; -import android.app.Notification; -import android.app.NotificationManager; import android.app.PendingIntent; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; @@ -42,7 +40,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.om.IOverlayManager; -import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.ApkAssets; import android.os.PatternMatcher; @@ -52,16 +49,13 @@ import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.provider.Settings.Secure; -import android.text.TextUtils; import android.util.Log; import android.util.SparseBooleanArray; import com.android.systemui.Dumpable; -import com.android.systemui.R; import com.android.systemui.UiOffloadThread; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.statusbar.policy.DeviceProvisionedController; -import com.android.systemui.util.NotificationChannels; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -80,11 +74,6 @@ public class NavigationModeController implements Dumpable { private static final String TAG = NavigationModeController.class.getSimpleName(); private static final boolean DEBUG = false; - private static final int SYSTEM_APP_MASK = - ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP; - static final String SHARED_PREFERENCES_NAME = "navigation_mode_controller_preferences"; - static final String PREFS_SWITCHED_FROM_GESTURE_NAV_KEY = "switched_from_gesture_nav"; - public interface ModeChangedListener { void onNavigationModeChanged(int mode); } @@ -100,8 +89,6 @@ public class NavigationModeController implements Dumpable { private int mMode = NAV_BAR_MODE_3BUTTON; private ArrayList<ModeChangedListener> mListeners = new ArrayList<>(); - private String mLastDefaultLauncher; - private BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -112,18 +99,6 @@ public class NavigationModeController implements Dumpable { } updateCurrentInteractionMode(true /* notify */); break; - case ACTION_PREFERRED_ACTIVITY_CHANGED: - if (DEBUG) { - Log.d(TAG, "ACTION_PREFERRED_ACTIVITY_CHANGED"); - } - final String launcher = getDefaultLauncherPackageName(mCurrentUserContext); - // Check if it is a default launcher change - if (!TextUtils.equals(mLastDefaultLauncher, launcher)) { - switchFromGestureNavModeIfNotSupportedByDefaultLauncher(); - showNotificationIfDefaultLauncherSupportsGestureNav(); - mLastDefaultLauncher = launcher; - } - break; } } }; @@ -159,7 +134,6 @@ public class NavigationModeController implements Dumpable { // Update the nav mode for the current user updateCurrentInteractionMode(true /* notify */); - switchFromGestureNavModeIfNotSupportedByDefaultLauncher(); // When switching users, defer enabling the gestural nav overlay until the user // is all set up @@ -190,11 +164,7 @@ public class NavigationModeController implements Dumpable { mContext.registerReceiverAsUser(mReceiver, UserHandle.ALL, preferredActivityFilter, null, null); - // We are only interested in launcher changes, so keeping track of the current default. - mLastDefaultLauncher = getDefaultLauncherPackageName(mContext); - updateCurrentInteractionMode(false /* notify */); - switchFromGestureNavModeIfNotSupportedByDefaultLauncher(); // Check if we need to defer enabling gestural nav deferGesturalNavOverlayIfNecessary(); @@ -216,21 +186,13 @@ public class NavigationModeController implements Dumpable { // Already in gesture mode return true; } - final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext); - if (supported == null || supported) { - Log.d(TAG, "Switching system navigation to full-gesture mode:" - + " defaultLauncher=" - + getDefaultLauncherPackageName(mCurrentUserContext) - + " contextUser=" - + mCurrentUserContext.getUserId()); - - setModeOverlay(NAV_BAR_MODE_GESTURAL_OVERLAY, USER_CURRENT); - return true; - } else { - Log.e(TAG, "Gesture nav is not supported for defaultLauncher=" - + getDefaultLauncherPackageName(mCurrentUserContext)); - return false; - } + + Log.d(TAG, "Switching system navigation to full-gesture mode:" + + " contextUser=" + + mCurrentUserContext.getUserId()); + + setModeOverlay(NAV_BAR_MODE_GESTURAL_OVERLAY, USER_CURRENT); + return true; } private boolean enableGestureNav(Intent intent) { @@ -430,100 +392,6 @@ public class NavigationModeController implements Dumpable { }); } - private void switchFromGestureNavModeIfNotSupportedByDefaultLauncher() { - if (getCurrentInteractionMode(mCurrentUserContext) != NAV_BAR_MODE_GESTURAL) { - return; - } - final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext); - if (supported == null || supported) { - return; - } - - Log.d(TAG, "Switching system navigation to 3-button mode:" - + " defaultLauncher=" + getDefaultLauncherPackageName(mCurrentUserContext) - + " contextUser=" + mCurrentUserContext.getUserId()); - - setModeOverlay(NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT); - showNotification(mCurrentUserContext, R.string.notification_content_system_nav_changed); - mCurrentUserContext.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) - .edit().putBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, true).apply(); - } - - private void showNotificationIfDefaultLauncherSupportsGestureNav() { - boolean previouslySwitchedFromGestureNav = mCurrentUserContext - .getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) - .getBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false); - if (!previouslySwitchedFromGestureNav) { - return; - } - if (getCurrentInteractionMode(mCurrentUserContext) == NAV_BAR_MODE_GESTURAL) { - return; - } - final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext); - if (supported == null || !supported) { - return; - } - - showNotification(mCurrentUserContext, R.string.notification_content_gesture_nav_available); - mCurrentUserContext.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) - .edit().putBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false).apply(); - } - - /** - * Returns null if there is no default launcher set for the current user. Returns true if the - * current default launcher supports Gesture Navigation. Returns false otherwise. - */ - private Boolean isGestureNavSupportedByDefaultLauncher(Context context) { - final String defaultLauncherPackageName = getDefaultLauncherPackageName(context); - if (DEBUG) { - Log.d(TAG, "isGestureNavSupportedByDefaultLauncher:" - + " defaultLauncher=" + defaultLauncherPackageName - + " contextUser=" + context.getUserId()); - } - if (defaultLauncherPackageName == null) { - return null; - } - if (isSystemApp(context, defaultLauncherPackageName)) { - return true; - } - return false; - } - - private String getDefaultLauncherPackageName(Context context) { - final ComponentName cn = context.getPackageManager().getHomeActivities(new ArrayList<>()); - if (cn == null) { - return null; - } - return cn.getPackageName(); - } - - /** Returns true if the app for the given package name is a system app for this device */ - private boolean isSystemApp(Context context, String packageName) { - try { - ApplicationInfo ai = context.getPackageManager().getApplicationInfo(packageName, - PackageManager.GET_META_DATA); - return ai != null && ((ai.flags & SYSTEM_APP_MASK) != 0); - } catch (PackageManager.NameNotFoundException e) { - return false; - } - } - - private void showNotification(Context context, int resId) { - final CharSequence message = context.getResources().getString(resId); - if (DEBUG) { - Log.d(TAG, "showNotification: message=" + message); - } - - final Notification.Builder builder = - new Notification.Builder(mContext, NotificationChannels.ALERTS) - .setContentText(message) - .setStyle(new Notification.BigTextStyle()) - .setSmallIcon(R.drawable.ic_info) - .setAutoCancel(true) - .setContentIntent(PendingIntent.getActivity(context, 0, new Intent(), 0)); - context.getSystemService(NotificationManager.class).notify(TAG, 0, builder.build()); - } - @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("NavigationModeController:"); @@ -536,12 +404,6 @@ public class NavigationModeController implements Dumpable { } pw.println(" defaultOverlays=" + defaultOverlays); dumpAssetPaths(mCurrentUserContext); - - pw.println(" defaultLauncher=" + mLastDefaultLauncher); - boolean previouslySwitchedFromGestureNav = mCurrentUserContext - .getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) - .getBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false); - pw.println(" previouslySwitchedFromGestureNav=" + previouslySwitchedFromGestureNav); } private void dumpAssetPaths(Context context) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java index d2159ca15b24..ba3406999388 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java @@ -4,7 +4,6 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Color; import android.graphics.Rect; -import android.provider.Settings; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -32,7 +31,6 @@ import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; -import com.android.systemui.tuner.TunerService; import java.util.ArrayList; import java.util.Objects; @@ -58,7 +56,6 @@ public class NotificationIconAreaController implements DarkReceiver, private final KeyguardBypassController mBypassController; private final DozeParameters mDozeParameters; - private boolean mShowSilentOnLockscreen = true; private int mIconSize; private int mIconHPadding; private int mIconTint = Color.WHITE; @@ -81,6 +78,7 @@ public class NotificationIconAreaController implements DarkReceiver, private int mAodIconTint; private boolean mFullyHidden; private boolean mAodIconsVisible; + private boolean mIsPulsing; public NotificationIconAreaController(Context context, StatusBar statusBar, StatusBarStateController statusBarStateController, @@ -101,11 +99,6 @@ public class NotificationIconAreaController implements DarkReceiver, initializeNotificationAreaViews(context); reloadAodColor(); - - TunerService tunerService = Dependency.get(TunerService.class); - tunerService.addTunable((key, newValue) -> { - mShowSilentOnLockscreen = "1".equals(newValue); - }, Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS); } protected View inflateIconArea(LayoutInflater inflater) { @@ -238,7 +231,7 @@ public class NotificationIconAreaController implements DarkReceiver, } protected boolean shouldShowNotificationIcon(NotificationEntry entry, - boolean showAmbient, boolean showLowPriority, boolean hideDismissed, + boolean showAmbient, boolean hideDismissed, boolean hideRepliedMessages, boolean hideCurrentMedia, boolean hideCenteredIcon, boolean hidePulsing, boolean onlyShowCenteredIcon) { @@ -257,9 +250,6 @@ public class NotificationIconAreaController implements DarkReceiver, if (hideCurrentMedia && entry.key.equals(mMediaManager.getMediaNotificationKey())) { return false; } - if (!showLowPriority && !entry.isHighPriority()) { - return false; - } if (!entry.isTopLevelChild()) { return false; } @@ -276,7 +266,9 @@ public class NotificationIconAreaController implements DarkReceiver, if (!showAmbient && entry.shouldSuppressStatusBar()) { return false; } - if (hidePulsing && entry.showingPulsing()) { + if (hidePulsing && entry.showingPulsing() + && (!mWakeUpCoordinator.getNotificationsFullyHidden() + || !entry.isPulseSuppressed())) { return false; } return true; @@ -297,7 +289,6 @@ public class NotificationIconAreaController implements DarkReceiver, private void updateShelfIcons() { updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons, true /* showAmbient */, - true /* showLowPriority */, false /* hideDismissed */, false /* hideRepliedMessages */, false /* hideCurrentMedia */, @@ -309,7 +300,6 @@ public class NotificationIconAreaController implements DarkReceiver, public void updateStatusBarIcons() { updateIconsForLayout(entry -> entry.icon, mNotificationIcons, false /* showAmbient */, - true /* showLowPriority */, true /* hideDismissed */, true /* hideRepliedMessages */, false /* hideCurrentMedia */, @@ -321,7 +311,6 @@ public class NotificationIconAreaController implements DarkReceiver, private void updateCenterIcon() { updateIconsForLayout(entry -> entry.centeredIcon, mCenteredIcon, false /* showAmbient */, - true /* showLowPriority */, false /* hideDismissed */, false /* hideRepliedMessages */, false /* hideCurrentMedia */, @@ -333,7 +322,6 @@ public class NotificationIconAreaController implements DarkReceiver, public void updateAodNotificationIcons() { updateIconsForLayout(entry -> entry.aodIcon, mAodIcons, false /* showAmbient */, - mShowSilentOnLockscreen /* showLowPriority */, true /* hideDismissed */, true /* hideRepliedMessages */, true /* hideCurrentMedia */, @@ -353,7 +341,7 @@ public class NotificationIconAreaController implements DarkReceiver, * @param hidePulsing should pulsing notifications be hidden */ private void updateIconsForLayout(Function<NotificationEntry, StatusBarIconView> function, - NotificationIconContainer hostLayout, boolean showAmbient, boolean showLowPriority, + NotificationIconContainer hostLayout, boolean showAmbient, boolean hideDismissed, boolean hideRepliedMessages, boolean hideCurrentMedia, boolean hideCenteredIcon, boolean hidePulsing, boolean onlyShowCenteredIcon) { ArrayList<StatusBarIconView> toShow = new ArrayList<>( @@ -364,7 +352,7 @@ public class NotificationIconAreaController implements DarkReceiver, View view = mNotificationScrollLayout.getChildAt(i); if (view instanceof ExpandableNotificationRow) { NotificationEntry ent = ((ExpandableNotificationRow) view).getEntry(); - if (shouldShowNotificationIcon(ent, showAmbient, showLowPriority, hideDismissed, + if (shouldShowNotificationIcon(ent, showAmbient, hideDismissed, hideRepliedMessages, hideCurrentMedia, hideCenteredIcon, hidePulsing, onlyShowCenteredIcon)) { StatusBarIconView iconView = function.apply(ent); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 37855ae592a5..5b3322b486a1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -454,6 +454,11 @@ public class NotificationPanelView extends PanelView implements mPulseExpansionHandler.setUp(mNotificationStackScroller, this, mShadeController); mWakeUpCoordinator.addListener(new NotificationWakeUpCoordinator.WakeUpListener() { @Override + public void onFullyHiddenChanged(boolean isFullyHidden) { + updateKeyguardStatusBarForHeadsUp(); + } + + @Override public void onPulseExpansionChanged(boolean expandingChanged) { if (mKeyguardBypassController.getBypassEnabled()) { // Position the notifications while dragging down while pulsing @@ -803,8 +808,7 @@ public class NotificationPanelView extends PanelView implements if (suppressedSummary) { continue; } - if (!mLockscreenUserManager.shouldShowOnKeyguard( - row.getStatusBarNotification())) { + if (!mLockscreenUserManager.shouldShowOnKeyguard(row.getEntry())) { continue; } if (row.isRemoved()) { @@ -1278,6 +1282,7 @@ public class NotificationPanelView extends PanelView implements } mExpectingSynthesizedDown = true; onTrackingStarted(); + updatePanelExpanded(); } /** @@ -1560,9 +1565,15 @@ public class NotificationPanelView extends PanelView implements anim.setStartDelay(mKeyguardMonitor.isKeyguardFadingAway() ? mKeyguardMonitor.getKeyguardFadingAwayDelay() : 0); - anim.setDuration(mKeyguardMonitor.isKeyguardFadingAway() - ? mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2 - : StackStateAnimator.ANIMATION_DURATION_STANDARD); + + long duration; + if (mKeyguardMonitor.isKeyguardFadingAway()) { + duration = mKeyguardMonitor.getShortenedFadingAwayDuration(); + } else { + duration = StackStateAnimator.ANIMATION_DURATION_STANDARD; + } + anim.setDuration(duration); + anim.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN); anim.addListener(new AnimatorListenerAdapter() { @Override @@ -1605,7 +1616,7 @@ public class NotificationPanelView extends PanelView implements mKeyguardBottomArea.animate() .alpha(0f) .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay()) - .setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2) + .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration()) .setInterpolator(Interpolators.ALPHA_OUT) .withEndAction(mAnimateKeyguardBottomAreaInvisibleEndRunnable) .start(); @@ -1634,7 +1645,7 @@ public class NotificationPanelView extends PanelView implements if (keyguardFadingAway) { mKeyguardStatusView.animate() .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay()) - .setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2) + .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration()) .start(); } } else if (mBarState == StatusBarState.SHADE_LOCKED @@ -1717,8 +1728,8 @@ public class NotificationPanelView extends PanelView implements mStatusBar.executeRunnableDismissingKeyguard(null, null /* cancelAction */, false /* dismissShade */, true /* afterKeyguardGone */, false /* deferred */); } - if (mExpansionListener != null) { - mExpansionListener.onQsExpansionChanged(mQsMaxExpansionHeight != 0 + for (int i = 0; i < mExpansionListeners.size(); i++) { + mExpansionListeners.get(i).onQsExpansionChanged(mQsMaxExpansionHeight != 0 ? mQsExpansionHeight / mQsMaxExpansionHeight : 0); } if (DEBUG) { @@ -2029,7 +2040,7 @@ public class NotificationPanelView extends PanelView implements } private void updatePanelExpanded() { - boolean isExpanded = !isFullyCollapsed(); + boolean isExpanded = !isFullyCollapsed() || mExpectingSynthesizedDown; if (mPanelExpanded != isExpanded) { mHeadsUpManager.setIsPanelExpanded(isExpanded); mStatusBar.setPanelExpanded(isExpanded); @@ -3374,24 +3385,4 @@ public class NotificationPanelView extends PanelView implements mOnReinflationListener = onReinflationListener; } - /** - * Panel and QS expansion callbacks. - */ - public interface PanelExpansionListener { - /** - * Invoked whenever the notification panel expansion changes, at every animation frame. - * This is the main expansion that happens when the user is swiping up to dismiss the - * lock screen. - * - * @param expansion 0 when collapsed, 1 when expanded. - * @param tracking {@code true} when the user is actively dragging the panel. - */ - void onPanelExpansionChanged(float expansion, boolean tracking); - - /** - * Invoked whenever the QS expansion changes, at every animation frame. - * @param expansion 0 when collapsed, 1 when expanded. - */ - void onQsExpansionChanged(float expansion); - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelExpansionListener.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelExpansionListener.java new file mode 100644 index 000000000000..655a25d22337 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelExpansionListener.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.systemui.statusbar.phone; + +/** + * Panel and QS expansion callbacks. + */ +public interface PanelExpansionListener { + /** + * Invoked whenever the notification panel expansion changes, at every animation frame. + * This is the main expansion that happens when the user is swiping up to dismiss the + * lock screen. + * + * @param expansion 0 when collapsed, 1 when expanded. + * @param tracking {@code true} when the user is actively dragging the panel. + */ + void onPanelExpansionChanged(float expansion, boolean tracking); + + /** + * Invoked whenever the QS expansion changes, at every animation frame. + * @param expansion 0 when collapsed, 1 when expanded. + */ + default void onQsExpansionChanged(float expansion) {}; +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index a5b221bbad8c..98526b9207b2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -50,11 +50,11 @@ import com.android.systemui.statusbar.FlingAnimationUtils; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.VibratorHelper; -import com.android.systemui.statusbar.phone.NotificationPanelView.PanelExpansionListener; import com.android.systemui.statusbar.policy.KeyguardMonitor; import java.io.FileDescriptor; import java.io.PrintWriter; +import java.util.ArrayList; public abstract class PanelView extends FrameLayout { public static final boolean DEBUG = PanelBar.DEBUG; @@ -69,7 +69,7 @@ public abstract class PanelView extends FrameLayout { private boolean mVibrateOnOpening; protected boolean mLaunchingNotification; private int mFixedDuration = NO_FIXED_DURATION; - protected PanelExpansionListener mExpansionListener; + protected ArrayList<PanelExpansionListener> mExpansionListeners = new ArrayList<>(); private final void logf(String fmt, Object... args) { Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args)); @@ -1174,13 +1174,13 @@ public abstract class PanelView extends FrameLayout { || mPeekAnimator != null || mInstantExpanding || isPanelVisibleBecauseOfHeadsUp() || mTracking || mHeightAnimator != null); } - if (mExpansionListener != null) { - mExpansionListener.onPanelExpansionChanged(mExpandedFraction, mTracking); + for (int i = 0; i < mExpansionListeners.size(); i++) { + mExpansionListeners.get(i).onPanelExpansionChanged(mExpandedFraction, mTracking); } } - public void setExpansionListener(PanelExpansionListener panelExpansionListener) { - mExpansionListener = panelExpansionListener; + public void addExpansionListener(PanelExpansionListener panelExpansionListener) { + mExpansionListeners.add(panelExpansionListener); } protected abstract boolean isPanelVisibleBecauseOfHeadsUp(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java index 660810fe7eb9..8efd952e67c5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java @@ -46,7 +46,6 @@ import com.android.systemui.R; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; import com.android.systemui.statusbar.CommandQueue; -import com.android.systemui.statusbar.policy.HeadsUpManager; import java.util.Objects; @@ -279,7 +278,7 @@ public class PhoneStatusBarView extends PanelBar { super.panelExpansionChanged(frac, expanded); updateScrimFraction(); if ((frac == 0 || frac == 1) && mBar.getNavigationBarView() != null) { - mBar.getNavigationBarView().onPanelExpandedChange(); + mBar.getNavigationBarView().onStatusBarPanelStateChanged(); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index 1aec5e4d0b1d..b12bf5c39970 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -491,8 +491,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo * away once the display turns on. */ public void prepareForGentleWakeUp() { - if (mState == ScrimState.AOD && mDozeParameters.getAlwaysOn()) { + if (mState == ScrimState.AOD) { mCurrentInFrontAlpha = 1f; + mCurrentInFrontTint = Color.BLACK; + mCurrentBehindTint = Color.BLACK; mAnimateChange = false; updateScrims(); mAnimateChange = true; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java index 763e0d70469b..c706062d3bb3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java @@ -129,7 +129,10 @@ public enum ScrimState { public void prepare(ScrimState previousState) { mCurrentInFrontAlpha = 0f; mCurrentBehindTint = Color.BLACK; + mCurrentInFrontTint = Color.BLACK; mBlankScreen = mDisplayRequiresBlanking; + mAnimationDuration = mWakeLockScreenSensorActive + ? ScrimController.ANIMATION_DURATION_LONG : ScrimController.ANIMATION_DURATION; } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index d93dc950a077..5521f1d592d5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -490,9 +490,12 @@ public class StatusBar extends SystemUI implements DemoMode, WallpaperInfo info = wallpaperManager.getWallpaperInfo(UserHandle.USER_CURRENT); final boolean deviceSupportsAodWallpaper = mContext.getResources().getBoolean( com.android.internal.R.bool.config_dozeSupportsAodWallpaper); + final boolean imageWallpaperInAmbient = + !DozeParameters.getInstance(mContext).getDisplayNeedsBlanking(); // If WallpaperInfo is null, it must be ImageWallpaper. final boolean supportsAmbientMode = deviceSupportsAodWallpaper - && (info == null || info.supportsAmbientMode()); + && ((info == null && imageWallpaperInAmbient) + || (info != null && info.supportsAmbientMode())); mStatusBarWindowController.setWallpaperSupportsAmbientMode(supportsAmbientMode); mScrimController.setWallpaperSupportsAmbientMode(supportsAmbientMode); @@ -814,6 +817,7 @@ public class StatusBar extends SystemUI implements DemoMode, inflateShelf(); mNotificationIconAreaController.setupShelf(mNotificationShelf); mNotificationPanel.setOnReinflationListener(mNotificationIconAreaController::initAodIcons); + mNotificationPanel.addExpansionListener(mWakeUpCoordinator); Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mNotificationIconAreaController); // Allow plugins to reference DarkIconDispatcher and StatusBarStateController @@ -856,7 +860,8 @@ public class StatusBar extends SystemUI implements DemoMode, } mHeadsUpAppearanceController = new HeadsUpAppearanceController( mNotificationIconAreaController, mHeadsUpManager, mStatusBarWindow, - mStatusBarStateController, mKeyguardBypassController); + mStatusBarStateController, mKeyguardBypassController, + mWakeUpCoordinator); mHeadsUpAppearanceController.readFrom(oldController); mStatusBarWindow.setStatusBarView(mStatusBarView); updateAreThereNotifications(); @@ -1508,6 +1513,9 @@ public class StatusBar extends SystemUI implements DemoMode, mNotificationPanel.setStatusAccessibilityImportance(expanded ? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS : View.IMPORTANT_FOR_ACCESSIBILITY_AUTO); + if (getNavigationBarView() != null) { + getNavigationBarView().onStatusBarPanelStateChanged(); + } } public boolean isWakeUpComingFromTouch() { @@ -1578,7 +1586,8 @@ public class StatusBar extends SystemUI implements DemoMode, public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) { mEntryManager.updateNotifications(); if (isDozing() && isHeadsUp) { - mDozeServiceHost.fireNotificationPulse(); + entry.setPulseSuppressed(false); + mDozeServiceHost.fireNotificationPulse(entry); if (mPulsing) { mDozeScrimController.cancelPendingPulseTimeout(); } @@ -1802,6 +1811,8 @@ public class StatusBar extends SystemUI implements DemoMode, mVibratorHelper.vibrate(VibrationEffect.EFFECT_TICK); } mNotificationPanel.expand(true /* animate */); + ((NotificationListContainer) mStackScroller).setWillExpand(true); + mHeadsUpManager.unpinAll(true /* userUnpinned */); mMetricsLogger.count(NotificationPanelView.COUNTER_PANEL_OPEN, 1); } else if (!mNotificationPanel.isInSettings() && !mNotificationPanel.isExpanding()){ mNotificationPanel.flingSettings(0 /* velocity */, @@ -1939,7 +1950,6 @@ public class StatusBar extends SystemUI implements DemoMode, if (start) { mNotificationPanel.startWaitingForOpenPanelGesture(); - setPanelExpanded(true); } else { mNotificationPanel.stopWaitingForOpenPanelGesture(velocity); } @@ -2388,6 +2398,10 @@ public class StatusBar extends SystemUI implements DemoMode, mLightBarController.dump(fd, pw, args); } + if (mUnlockMethodCache != null) { + mUnlockMethodCache.dump(pw); + } + if (mKeyguardBypassController != null) { mKeyguardBypassController.dump(pw); } @@ -3200,12 +3214,13 @@ public class StatusBar extends SystemUI implements DemoMode, /** * Notifies the status bar the Keyguard is fading away with the specified timings. - * - * @param startTime the start time of the animations in uptime millis + * @param startTime the start time of the animations in uptime millis * @param delay the precalculated animation delay in milliseconds * @param fadeoutDuration the duration of the exit animation, in milliseconds + * @param isBypassFading is this a fading away animation while bypassing */ - public void setKeyguardFadingAway(long startTime, long delay, long fadeoutDuration) { + public void setKeyguardFadingAway(long startTime, long delay, long fadeoutDuration, + boolean isBypassFading) { mCommandQueue.appTransitionStarting(mDisplayId, startTime + fadeoutDuration - LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, true); @@ -3213,7 +3228,7 @@ public class StatusBar extends SystemUI implements DemoMode, mCommandQueue.appTransitionStarting(mDisplayId, startTime - LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, true); - mKeyguardMonitor.notifyKeyguardFadingAway(delay, fadeoutDuration); + mKeyguardMonitor.notifyKeyguardFadingAway(delay, fadeoutDuration, isBypassFading); } /** @@ -3563,6 +3578,9 @@ public class StatusBar extends SystemUI implements DemoMode, userAllowsPrivateNotificationsInPublic(mLockscreenUserManager.getCurrentUserId()) || !mLockscreenUserManager.shouldShowLockscreenNotifications() || mFalsingManager.shouldEnforceBouncer(); + if (mKeyguardBypassController.getBypassEnabled()) { + fullShadeNeedsBouncer = false; + } if (mLockscreenUserManager.isLockscreenPublicMode(userId) && fullShadeNeedsBouncer) { mStatusBarStateController.setLeaveOpenOnKeyguardHide(true); showBouncerIfKeyguard(); @@ -3920,9 +3938,13 @@ public class StatusBar extends SystemUI implements DemoMode, } } - public void fireNotificationPulse() { + public void fireNotificationPulse(NotificationEntry entry) { + Runnable pulseSupressedListener = () -> { + entry.setPulseSuppressed(true); + mNotificationIconAreaController.updateAodNotificationIcons(); + }; for (Callback callback : mCallbacks) { - callback.onNotificationAlerted(); + callback.onNotificationAlerted(pulseSupressedListener); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 1321784c978a..4d85a422d9b9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -69,7 +69,7 @@ import java.util.ArrayList; */ public class StatusBarKeyguardViewManager implements RemoteInputController.Callback, StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener, - NotificationPanelView.PanelExpansionListener, NavigationModeController.ModeChangedListener { + PanelExpansionListener, NavigationModeController.ModeChangedListener { // When hiding the Keyguard with timing supplied from WindowManager, better be early than late. private static final long HIDE_TIMING_CORRECTION_MS = - 16 * 3; @@ -222,7 +222,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry, mExpansionCallback); mNotificationPanelView = notificationPanelView; - notificationPanelView.setExpansionListener(this); + notificationPanelView.addExpansionListener(this); mBypassController = bypassController; mNotificationContainer = notificationContainer; } @@ -560,18 +560,22 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb executeAfterKeyguardGoneAction(); boolean wakeUnlockPulsing = mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING; - if (wakeUnlockPulsing) { + boolean needsFading = needsBypassFading(); + if (needsFading) { + delay = 0; + fadeoutDuration = KeyguardBypassController.BYPASS_PANEL_FADE_DURATION; + } else if (wakeUnlockPulsing) { delay = 0; fadeoutDuration = 240; } - mStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration); + mStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration, needsFading); mBiometricUnlockController.startKeyguardFadingAway(); hideBouncer(true /* destroyView */); if (wakeUnlockPulsing) { - if (needsBypassFading()) { + if (needsFading) { ViewGroupFadeHelper.fadeOutAllChildrenExcept(mNotificationPanelView, mNotificationContainer, - KeyguardBypassController.BYPASS_PANEL_FADE_DURATION, + fadeoutDuration, () -> { mStatusBar.hideKeyguard(); onKeyguardFadedAway(); @@ -584,10 +588,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide(); if (!staying) { mStatusBarWindowController.setKeyguardFadingAway(true); - if (needsBypassFading()) { + if (needsFading) { ViewGroupFadeHelper.fadeOutAllChildrenExcept(mNotificationPanelView, mNotificationContainer, - KeyguardBypassController.BYPASS_PANEL_FADE_DURATION, + fadeoutDuration, () -> { mStatusBar.hideKeyguard(); }); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java index 4ddd0e9962ad..d9a9f7cbc2a8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java @@ -51,12 +51,13 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.google.android.collect.Lists; + import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.ref.WeakReference; import java.lang.reflect.Field; - import java.util.ArrayList; + import javax.inject.Inject; import javax.inject.Singleton; @@ -352,7 +353,7 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat } private void applyForceStatusBarVisibleFlag(State state) { - if (state.forceStatusBarVisible) { + if (state.forceStatusBarVisible || state.forcePluginOpen) { mLpChanged.privateFlags |= WindowManager .LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT; } else { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java index 94054188d769..d98ac240d62f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -419,7 +419,7 @@ public class StatusBarWindowView extends FrameLayout { if (mNotificationPanel.isFullyExpanded() && mStatusBarStateController.getState() == StatusBarState.KEYGUARD && !mService.isBouncerShowing() - && !mBypassController.getBypassEnabled() + && (!mBypassController.getBypassEnabled() || mNotificationPanel.isQsExpanded()) && !mService.isDozing()) { intercept = mDragDownHelper.onInterceptTouchEvent(ev); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java index a71fcdbd9914..b1d6ca6e5580 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java @@ -28,6 +28,7 @@ import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; +import java.io.PrintWriter; import java.util.ArrayList; /** @@ -51,7 +52,7 @@ public class UnlockMethodCache { private boolean mTrustManaged; private boolean mTrusted; private boolean mDebugUnlocked = false; - private boolean mIsUnlockingWithFacePossible; + private boolean mFaceAuthEnabled; private UnlockMethodCache(Context ctx) { mLockPatternUtils = new LockPatternUtils(ctx); @@ -110,8 +111,8 @@ public class UnlockMethodCache { /** * If there are faces enrolled and user enabled face auth on keyguard. */ - public boolean isUnlockingWithFacePossible() { - return mIsUnlockingWithFacePossible; + public boolean isFaceAuthEnabled() { + return mFaceAuthEnabled; } private void update(boolean updateAlways) { @@ -122,16 +123,16 @@ public class UnlockMethodCache { || (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB && mDebugUnlocked); boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user); boolean trusted = mKeyguardUpdateMonitor.getUserHasTrust(user); - boolean isUnlockingWithFacePossible = mKeyguardUpdateMonitor.isUnlockWithFacePossible(user); + boolean faceAuthEnabled = mKeyguardUpdateMonitor.isFaceAuthEnabledForUser(user); boolean changed = secure != mSecure || canSkipBouncer != mCanSkipBouncer || trustManaged != mTrustManaged - || mIsUnlockingWithFacePossible != isUnlockingWithFacePossible; + || mFaceAuthEnabled != faceAuthEnabled; if (changed || updateAlways) { mSecure = secure; mCanSkipBouncer = canSkipBouncer; mTrusted = trusted; mTrustManaged = trustManaged; - mIsUnlockingWithFacePossible = isUnlockingWithFacePossible; + mFaceAuthEnabled = faceAuthEnabled; notifyListeners(); } Trace.endSection(); @@ -143,6 +144,16 @@ public class UnlockMethodCache { } } + public void dump(PrintWriter pw) { + pw.println("UnlockMethodCache"); + pw.println(" mSecure: " + mSecure); + pw.println(" mCanSkipBouncer: " + mCanSkipBouncer); + pw.println(" mTrustManaged: " + mTrustManaged); + pw.println(" mTrusted: " + mTrusted); + pw.println(" mDebugUnlocked: " + mDebugUnlocked); + pw.println(" mFaceAuthEnabled: " + mFaceAuthEnabled); + } + private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { @Override public void onUserSwitchComplete(int userId) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java index f61b556e22ab..070136ec94c1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java @@ -29,6 +29,19 @@ public interface KeyguardMonitor extends CallbackController<Callback> { long getKeyguardFadingAwayDelay(); long calculateGoingToFullShadeDelay(); + /** + * @return a shortened fading away duration similar to + * {{@link #getKeyguardFadingAwayDuration()}} which may only span half of the duration, unless + * we're bypassing + */ + default long getShortenedFadingAwayDuration() { + if (isBypassFadingAnimation()) { + return getKeyguardFadingAwayDuration(); + } else { + return getKeyguardFadingAwayDuration() / 2; + } + } + default boolean isDeviceInteractive() { return false; } @@ -39,7 +52,21 @@ public interface KeyguardMonitor extends CallbackController<Callback> { default void notifyKeyguardGoingAway(boolean b) { } - default void notifyKeyguardFadingAway(long delay, long fadeoutDuration) { + /** + * @return {@code true} if the current fading away animation is the fast bypass fading. + */ + default boolean isBypassFadingAnimation() { + return false; + } + + /** + * Notifies that the Keyguard is fading away with the specified timings. + * @param delay the precalculated animation delay in milliseconds + * @param fadeoutDuration the duration of the exit animation, in milliseconds + * @param isBypassFading is this a fading away animation while bypassing + */ + default void notifyKeyguardFadingAway(long delay, long fadeoutDuration, + boolean isBypassFading) { } default void notifyKeyguardDoneFading() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java index 68d00708b0d3..8829be4ee0f8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java @@ -54,6 +54,7 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback private long mKeyguardFadingAwayDuration; private boolean mKeyguardGoingAway; private boolean mLaunchTransitionFadingAway; + private boolean mBypassFadingAnimation; /** */ @@ -140,10 +141,11 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback new ArrayList<>(mCallbacks).forEach(Callback::onKeyguardShowingChanged); } - public void notifyKeyguardFadingAway(long delay, long fadeoutDuration) { + public void notifyKeyguardFadingAway(long delay, long fadeoutDuration, boolean isBypassFading) { setKeyguardFadingAway(true); mKeyguardFadingAwayDelay = delay; mKeyguardFadingAwayDuration = fadeoutDuration; + mBypassFadingAnimation = isBypassFading; } private void setKeyguardFadingAway(boolean keyguardFadingAway) { @@ -172,6 +174,11 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback } @Override + public boolean isBypassFadingAnimation() { + return mBypassFadingAnimation; + } + + @Override public long getKeyguardFadingAwayDelay() { return mKeyguardFadingAwayDelay; } diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java index 69d2e31135e8..d3862b6eed81 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java @@ -43,6 +43,7 @@ import android.os.Looper; import android.os.Message; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.UserHandle; import android.os.VibrationEffect; import android.os.Vibrator; import android.provider.Settings; @@ -272,14 +273,14 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa } public boolean areCaptionsEnabled() { - int currentValue = Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.ODI_CAPTIONS_ENABLED, 0); + int currentValue = Settings.Secure.getIntForUser(mContext.getContentResolver(), + Settings.Secure.ODI_CAPTIONS_ENABLED, 0, UserHandle.USER_CURRENT); return currentValue == 1; } public void setCaptionsEnabled(boolean isEnabled) { - Settings.Secure.putInt(mContext.getContentResolver(), - Settings.Secure.ODI_CAPTIONS_ENABLED, isEnabled ? 1 : 0); + Settings.Secure.putIntForUser(mContext.getContentResolver(), + Settings.Secure.ODI_CAPTIONS_ENABLED, isEnabled ? 1 : 0, UserHandle.USER_CURRENT); } @Override diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java index eb8ef09d0635..d4642238d8fd 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java @@ -95,13 +95,13 @@ public class DozeTriggersTest extends SysuiTestCase { mTriggers.transitionTo(DozeMachine.State.INITIALIZED, DozeMachine.State.DOZE); clearInvocations(mMachine); - mHost.callback.onNotificationAlerted(); + mHost.callback.onNotificationAlerted(null /* pulseSuppressedListener */); mSensors.getMockProximitySensor().sendProximityResult(false); /* Near */ verify(mMachine, never()).requestState(any()); verify(mMachine, never()).requestPulse(anyInt()); - mHost.callback.onNotificationAlerted(); + mHost.callback.onNotificationAlerted(null /* pulseSuppressedListener */); mSensors.getMockProximitySensor().sendProximityResult(true); /* Far */ verify(mMachine).requestPulse(anyInt()); diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardSliceProviderTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardSliceProviderTest.java index 893f3d184acb..9576cb2eec45 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardSliceProviderTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardSliceProviderTest.java @@ -48,6 +48,7 @@ import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationMediaManager; +import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.policy.ZenModeController; @@ -197,6 +198,7 @@ public class KeyguardSliceProviderTest extends SysuiTestCase { @Test public void onMetadataChanged_updatesSlice() { + mProvider.onStateChanged(StatusBarState.KEYGUARD); mProvider.onDozingChanged(true); reset(mContentResolver); mProvider.onMetadataOrStateChanged(mock(MediaMetadata.class), PlaybackState.STATE_PLAYING); @@ -210,6 +212,7 @@ public class KeyguardSliceProviderTest extends SysuiTestCase { @Test public void onDozingChanged_updatesSliceIfMedia() { + mProvider.onStateChanged(StatusBarState.KEYGUARD); mProvider.onMetadataOrStateChanged(mock(MediaMetadata.class), PlaybackState.STATE_PLAYING); reset(mContentResolver); // Show media when dozing diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/recents/model/TaskKeyLruCacheTest.java b/packages/SystemUI/tests/src/com/android/systemui/shared/recents/model/TaskKeyLruCacheTest.java new file mode 100644 index 000000000000..eb71dd6ee677 --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/shared/recents/model/TaskKeyLruCacheTest.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.shared.recents.model; + + +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertNull; + +import android.test.suitebuilder.annotation.SmallTest; + +import com.android.systemui.SysuiTestCase; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@SmallTest +@RunWith(JUnit4.class) +public class TaskKeyLruCacheTest extends SysuiTestCase { + private static int sCacheSize = 3; + private static int sIdTask1 = 1; + private static int sIdTask2 = 2; + private static int sIdTask3 = 3; + private static int sIdUser1 = 1; + + TaskKeyCache<Integer> mCache = new TaskKeyLruCache<>(sCacheSize, null); + Task.TaskKey mKey1; + Task.TaskKey mKey2; + Task.TaskKey mKey3; + + @Before + public void setup() { + mKey1 = new Task.TaskKey(sIdTask1, 0, null, null, sIdUser1, System.currentTimeMillis()); + mKey2 = new Task.TaskKey(sIdTask2, 0, null, null, sIdUser1, System.currentTimeMillis()); + mKey3 = new Task.TaskKey(sIdTask3, 0, null, null, sIdUser1, System.currentTimeMillis()); + } + + @Test + public void addSingleItem_get_success() { + mCache.put(mKey1, 1); + + assertEquals(1, (int) mCache.get(mKey1)); + } + + @Test + public void addSingleItem_getUninsertedItem_returnsNull() { + mCache.put(mKey1, 1); + + assertNull(mCache.get(mKey2)); + } + + @Test + public void emptyCache_get_returnsNull() { + assertNull(mCache.get(mKey1)); + } + + @Test + public void updateItem_get_returnsSecond() { + mCache.put(mKey1, 1); + mCache.put(mKey1, 2); + + assertEquals(2, (int) mCache.get(mKey1)); + assertEquals(1, mCache.mKeys.size()); + } + + @Test + public void fillCache_put_evictsOldest() { + mCache.put(mKey1, 1); + mCache.put(mKey2, 2); + mCache.put(mKey3, 3); + Task.TaskKey key4 = new Task.TaskKey(sIdTask3 + 1, 0, + null, null, sIdUser1, System.currentTimeMillis()); + mCache.put(key4, 4); + + assertNull(mCache.get(mKey1)); + assertEquals(3, mCache.mKeys.size()); + assertEquals(mKey2, mCache.mKeys.valueAt(0)); + } + + @Test + public void fillCache_remove_success() { + mCache.put(mKey1, 1); + mCache.put(mKey2, 2); + mCache.put(mKey3, 3); + + mCache.remove(mKey2); + + assertNull(mCache.get(mKey2)); + assertEquals(2, mCache.mKeys.size()); + } +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java index 49a263a8d781..57dd8c94c790 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java @@ -38,7 +38,6 @@ import android.os.Handler; import android.os.Looper; import android.os.UserManager; import android.provider.Settings; -import android.service.notification.StatusBarNotification; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; @@ -48,6 +47,7 @@ import com.android.systemui.Dependency; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotificationData; +import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.policy.DeviceProvisionedController; @@ -166,7 +166,7 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 1); when(mNotificationData.isHighPriority(any())).thenReturn(false); - assertTrue(mLockscreenUserManager.shouldShowOnKeyguard(mock(StatusBarNotification.class))); + assertTrue(mLockscreenUserManager.shouldShowOnKeyguard(mock(NotificationEntry.class))); } @Test @@ -179,7 +179,7 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 0); when(mNotificationData.isHighPriority(any())).thenReturn(false); - assertFalse(mLockscreenUserManager.shouldShowOnKeyguard(mock(StatusBarNotification.class))); + assertFalse(mLockscreenUserManager.shouldShowOnKeyguard(mock(NotificationEntry.class))); } private class TestNotificationLockscreenUserManager diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManagerTest.java index 73abda9a5da7..59d0f912d38e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManagerTest.java @@ -263,6 +263,8 @@ public class NotificationSectionsManagerTest extends SysuiTestCase { when(notifRow.getVisibility()).thenReturn(View.VISIBLE); when(notifRow.getEntry().isHighPriority()) .thenReturn(children[i] == ChildType.HIPRI); + when(notifRow.getEntry().isTopBucket()) + .thenReturn(children[i] == ChildType.HIPRI); when(notifRow.getParent()).thenReturn(mNssl); child = notifRow; break; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java index 7d9920db36a4..fd676111b1da 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java @@ -82,7 +82,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { MockitoAnnotations.initMocks(this); when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true); - when(mUnlockMethodCache.isUnlockingWithFacePossible()).thenReturn(true); + when(mUnlockMethodCache.isFaceAuthEnabled()).thenReturn(true); when(mKeyguardBypassController.onBiometricAuthenticated(any())).thenReturn(true); when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true); mContext.addMockSystemService(PowerManager.class, mPowerManager); @@ -161,6 +161,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { @Test public void onBiometricAuthenticated_whenFace_andBypass_encrypted_showBouncer() { + reset(mUpdateMonitor); when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true); mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); @@ -168,11 +169,18 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, BiometricSourceType.FACE); + // Wake up before showing the bouncer + verify(mStatusBarKeyguardViewManager, never()).showBouncer(eq(false)); + mBiometricUnlockController.mWakefulnessObserver.onFinishedWakingUp(); + verify(mStatusBarKeyguardViewManager).showBouncer(eq(false)); + assertThat(mBiometricUnlockController.getMode()) + .isEqualTo(BiometricUnlockController.MODE_SHOW_BOUNCER); } @Test public void onBiometricAuthenticated_whenFace_noBypass_encrypted_doNothing() { + reset(mUpdateMonitor); mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); when(mUpdateMonitor.isUnlockingWithBiometricAllowed()).thenReturn(false); @@ -181,6 +189,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean()); verify(mStatusBarKeyguardViewManager, never()).animateCollapsePanels(anyFloat()); + assertThat(mBiometricUnlockController.getMode()) + .isEqualTo(BiometricUnlockController.MODE_NONE); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java index b45707ef6c10..a38094da3e1c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java @@ -35,6 +35,7 @@ import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.HeadsUpStatusBarView; import com.android.systemui.statusbar.NotificationTestHelper; +import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; @@ -59,6 +60,7 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase { private View mOperatorNameView; private StatusBarStateController mStatusbarStateController; private KeyguardBypassController mBypassController; + private NotificationWakeUpCoordinator mWakeUpCoordinator; @Before public void setUp() throws Exception { @@ -72,11 +74,13 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase { mOperatorNameView = new View(mContext); mStatusbarStateController = mock(StatusBarStateController.class); mBypassController = mock(KeyguardBypassController.class); + mWakeUpCoordinator = mock(NotificationWakeUpCoordinator.class); mHeadsUpAppearanceController = new HeadsUpAppearanceController( mock(NotificationIconAreaController.class), mHeadsUpManager, mStatusbarStateController, mBypassController, + mWakeUpCoordinator, mHeadsUpStatusBarView, mStackScroller, mPanelView, @@ -153,6 +157,7 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase { mHeadsUpManager, mStatusbarStateController, mBypassController, + mWakeUpCoordinator, mHeadsUpStatusBarView, mStackScroller, mPanelView, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java index 4e0ef56ad830..907e695f2513 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java @@ -379,7 +379,7 @@ public class KeyguardBouncerTest extends SysuiTestCase { @Test public void testShow_delaysIfFaceAuthIsRunning() { - when(mUnlockMethodCache.isUnlockingWithFacePossible()).thenReturn(true); + when(mUnlockMethodCache.isFaceAuthEnabled()).thenReturn(true); mBouncer.show(true /* reset */); ArgumentCaptor<Runnable> showRunnable = ArgumentCaptor.forClass(Runnable.class); @@ -394,4 +394,15 @@ public class KeyguardBouncerTest extends SysuiTestCase { public void testRegisterUpdateMonitorCallback() { verify(mKeyguardUpdateMonitor).registerCallback(any()); } + + @Test + public void testInTransit_whenTranslation() { + mBouncer.show(true); + mBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); + assertThat(mBouncer.inTransit()).isFalse(); + mBouncer.setExpansion(0.5f); + assertThat(mBouncer.inTransit()).isTrue(); + mBouncer.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); + assertThat(mBouncer.inTransit()).isFalse(); + } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java index d8e90a584058..0dbf30881ffe 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java @@ -225,11 +225,12 @@ public class ScrimControllerTest extends SysuiTestCase { mScrimController.transitionTo(ScrimState.PULSING); mScrimController.finishAnimationsImmediately(); - // Front scrim should be transparent + // Front scrim should be transparent, but tinted // Back scrim should be semi-transparent so the user can see the wallpaper // Pulse callback should have been invoked assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE); assertScrimTint(mScrimBehind, true /* tinted */); + assertScrimTint(mScrimInFront, true /* tinted */); mScrimController.setWakeLockScreenSensorActive(true); mScrimController.finishAnimationsImmediately(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java index 1b33aefd1634..da2e8dc90854 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -31,6 +32,7 @@ import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.view.View; import android.view.ViewGroup; +import android.view.ViewPropertyAnimator; import androidx.test.filters.SmallTest; @@ -85,6 +87,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mDependency.injectMockDependency(StatusBarWindowController.class); mDependency.injectTestDependency(StatusBarStateController.class, mStatusBarStateController); when(mLockIconContainer.getParent()).thenReturn(mock(ViewGroup.class)); + when(mLockIconContainer.animate()).thenReturn(mock(ViewPropertyAnimator.class, + RETURNS_DEEP_STUBS)); mStatusBarKeyguardViewManager = new TestableStatusBarKeyguardViewManager(getContext(), mViewMediatorCallback, mLockPatternUtils); mStatusBarKeyguardViewManager.registerStatusBar(mStatusBar, mContainer, diff --git a/packages/VpnDialogs/res/values-hi/strings.xml b/packages/VpnDialogs/res/values-hi/strings.xml index 34b79cb4100a..eed0858787d9 100644 --- a/packages/VpnDialogs/res/values-hi/strings.xml +++ b/packages/VpnDialogs/res/values-hi/strings.xml @@ -22,7 +22,7 @@ <string name="session" msgid="6470628549473641030">"सत्र:"</string> <string name="duration" msgid="3584782459928719435">"अवधि:"</string> <string name="data_transmitted" msgid="7988167672982199061">"भेजे गए:"</string> - <string name="data_received" msgid="4062776929376067820">"प्राप्त:"</string> + <string name="data_received" msgid="4062776929376067820">"पाया:"</string> <string name="data_value_format" msgid="2192466557826897580">"<xliff:g id="NUMBER_0">%1$s</xliff:g> बाइट / <xliff:g id="NUMBER_1">%2$s</xliff:g> पैकेट"</string> <string name="always_on_disconnected_title" msgid="1906740176262776166">"हमेशा चालू रहने वाले VPN से नहीं जुड़ पा रहा है"</string> <string name="always_on_disconnected_message" msgid="555634519845992917">"<xliff:g id="VPN_APP_0">%1$s</xliff:g> को हर समय जुड़े रहने के लिए सेट अप किया गया है, लेकिन वह इस समय नहीं जुड़ पा रहा है. जब तक आपका फ़ोन <xliff:g id="VPN_APP_1">%1$s</xliff:g> से नहीं जुड़ जाता, तब तक वह सार्वजनिक नेटवर्क का इस्तेमाल करेगा."</string> diff --git a/proto/src/wifi.proto b/proto/src/wifi.proto index f9a2ca269335..8ad24894a1b9 100644 --- a/proto/src/wifi.proto +++ b/proto/src/wifi.proto @@ -551,6 +551,30 @@ message WifiLog { // Histogram of the EAP method type of all installed Passpoint profiles for R2 repeated PasspointProfileTypeCount installed_passpoint_profile_type_for_r2 = 148; + + // Histogram of Tx link speed at 2G + repeated Int32Count tx_link_speed_count_2g = 149; + + // Histogram of Tx link speed at 5G low band + repeated Int32Count tx_link_speed_count_5g_low = 150; + + // Histogram of Tx link speed at 5G middle band + repeated Int32Count tx_link_speed_count_5g_mid = 151; + + // Histogram of Tx link speed at 5G high band + repeated Int32Count tx_link_speed_count_5g_high = 152; + + // Histogram of Rx link speed at 2G + repeated Int32Count rx_link_speed_count_2g = 153; + + // Histogram of Rx link speed at 5G low band + repeated Int32Count rx_link_speed_count_5g_low = 154; + + // Histogram of Rx link speed at 5G middle band + repeated Int32Count rx_link_speed_count_5g_mid = 155; + + // Histogram of Rx link speed at 5G high band + repeated Int32Count rx_link_speed_count_5g_high = 156; } // Information that gets logged for every WiFi connection. @@ -827,6 +851,7 @@ message LinkSpeedCount { optional int64 rssi_sum_of_squares_dbm_sq = 4; } + // Number of occurrences of Soft AP session durations message SoftApDurationBucket { // Bucket covers duration : [duration_sec, duration_sec + bucket_size_sec) diff --git a/services/backup/java/com/android/server/backup/UserBackupManagerService.java b/services/backup/java/com/android/server/backup/UserBackupManagerService.java index c0af99c30542..2554433fb659 100644 --- a/services/backup/java/com/android/server/backup/UserBackupManagerService.java +++ b/services/backup/java/com/android/server/backup/UserBackupManagerService.java @@ -166,6 +166,52 @@ import java.util.concurrent.atomic.AtomicInteger; /** System service that performs backup/restore operations. */ public class UserBackupManagerService { + /** Wrapper over {@link PowerManager.WakeLock} to prevent double-free exceptions on release() + * after quit(). + * */ + public static class BackupWakeLock { + private final PowerManager.WakeLock mPowerManagerWakeLock; + private boolean mHasQuit = false; + + public BackupWakeLock(PowerManager.WakeLock powerManagerWakeLock) { + mPowerManagerWakeLock = powerManagerWakeLock; + } + + /** Acquires the {@link PowerManager.WakeLock} if hasn't been quit. */ + public synchronized void acquire() { + if (mHasQuit) { + Slog.v(TAG, "Ignore wakelock acquire after quit:" + mPowerManagerWakeLock.getTag()); + return; + } + mPowerManagerWakeLock.acquire(); + } + + /** Releases the {@link PowerManager.WakeLock} if hasn't been quit. */ + public synchronized void release() { + if (mHasQuit) { + Slog.v(TAG, "Ignore wakelock release after quit:" + mPowerManagerWakeLock.getTag()); + return; + } + mPowerManagerWakeLock.release(); + } + + /** + * Returns true if the {@link PowerManager.WakeLock} has been acquired but not yet released. + */ + public synchronized boolean isHeld() { + return mPowerManagerWakeLock.isHeld(); + } + + /** Release the {@link PowerManager.WakeLock} till it isn't held. */ + public synchronized void quit() { + while (mPowerManagerWakeLock.isHeld()) { + Slog.v(TAG, "Releasing wakelock:" + mPowerManagerWakeLock.getTag()); + mPowerManagerWakeLock.release(); + } + mHasQuit = true; + } + } + // Persistently track the need to do a full init. private static final String INIT_SENTINEL_FILE_NAME = "_need_init_"; @@ -252,7 +298,6 @@ public class UserBackupManagerService { private final @UserIdInt int mUserId; private final BackupAgentTimeoutParameters mAgentTimeoutParameters; private final TransportManager mTransportManager; - private final HandlerThread mUserBackupThread; private final Context mContext; private final PackageManager mPackageManager; @@ -263,7 +308,7 @@ public class UserBackupManagerService { private final AlarmManager mAlarmManager; private final IStorageManager mStorageManager; private final BackupManagerConstants mConstants; - private final PowerManager.WakeLock mWakelock; + private final BackupWakeLock mWakelock; private final BackupHandler mBackupHandler; private final IBackupManager mBackupManagerBinder; @@ -367,6 +412,9 @@ public class UserBackupManagerService { private long mCurrentToken = 0; @Nullable private File mAncestralSerialNumberFile; + private final ContentObserver mSetupObserver; + private final BroadcastReceiver mRunBackupReceiver; + private final BroadcastReceiver mRunInitReceiver; /** * Creates an instance of {@link UserBackupManagerService} and initializes state for it. This @@ -484,8 +532,7 @@ public class UserBackupManagerService { mAgentTimeoutParameters.start(); checkNotNull(userBackupThread, "userBackupThread cannot be null"); - mUserBackupThread = userBackupThread; - mBackupHandler = new BackupHandler(this, userBackupThread.getLooper()); + mBackupHandler = new BackupHandler(this, userBackupThread); // Set up our bookkeeping final ContentResolver resolver = context.getContentResolver(); @@ -493,11 +540,11 @@ public class UserBackupManagerService { mAutoRestore = Settings.Secure.getIntForUser(resolver, Settings.Secure.BACKUP_AUTO_RESTORE, 1, userId) != 0; - ContentObserver setupObserver = new SetupObserver(this, mBackupHandler); + mSetupObserver = new SetupObserver(this, mBackupHandler); resolver.registerContentObserver( Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), /* notifyForDescendents */ false, - setupObserver, + mSetupObserver, mUserId); mBaseStateDir = checkNotNull(baseStateDir, "baseStateDir cannot be null"); @@ -516,21 +563,21 @@ public class UserBackupManagerService { mBackupPasswordManager = new BackupPasswordManager(mContext, mBaseStateDir, mRng); // Receivers for scheduled backups and transport initialization operations. - BroadcastReceiver runBackupReceiver = new RunBackupReceiver(this); + mRunBackupReceiver = new RunBackupReceiver(this); IntentFilter filter = new IntentFilter(); filter.addAction(RUN_BACKUP_ACTION); context.registerReceiverAsUser( - runBackupReceiver, + mRunBackupReceiver, UserHandle.of(userId), filter, android.Manifest.permission.BACKUP, /* scheduler */ null); - BroadcastReceiver runInitReceiver = new RunInitializeReceiver(this); + mRunInitReceiver = new RunInitializeReceiver(this); filter = new IntentFilter(); filter.addAction(RUN_INITIALIZE_ACTION); context.registerReceiverAsUser( - runInitReceiver, + mRunInitReceiver, UserHandle.of(userId), filter, android.Manifest.permission.BACKUP, @@ -585,7 +632,10 @@ public class UserBackupManagerService { mBackupHandler.postDelayed(this::parseLeftoverJournals, INITIALIZATION_DELAY_MILLIS); // Power management - mWakelock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "*backup*-" + userId); + mWakelock = new BackupWakeLock( + mPowerManager.newWakeLock( + PowerManager.PARTIAL_WAKE_LOCK, + "*backup*-" + userId + "-" + userBackupThread.getThreadId())); // Set up the various sorts of package tracking we do mFullBackupScheduleFile = new File(mBaseStateDir, "fb-schedule"); @@ -599,7 +649,13 @@ public class UserBackupManagerService { /** Cleans up state when the user of this service is stopped. */ void tearDownService() { - mUserBackupThread.quit(); + mAgentTimeoutParameters.stop(); + mConstants.stop(); + mContext.getContentResolver().unregisterContentObserver(mSetupObserver); + mContext.unregisterReceiver(mRunBackupReceiver); + mContext.unregisterReceiver(mRunInitReceiver); + mContext.unregisterReceiver(mPackageTrackingReceiver); + mBackupHandler.stop(); } public @UserIdInt int getUserId() { @@ -659,7 +715,7 @@ public class UserBackupManagerService { mSetupComplete = setupComplete; } - public PowerManager.WakeLock getWakelock() { + public BackupWakeLock getWakelock() { return mWakelock; } @@ -670,7 +726,7 @@ public class UserBackupManagerService { @VisibleForTesting public void setWorkSource(@Nullable WorkSource workSource) { // TODO: This is for testing, unfortunately WakeLock is final and WorkSource is not exposed - mWakelock.setWorkSource(workSource); + mWakelock.mPowerManagerWakeLock.setWorkSource(workSource); } public Handler getBackupHandler() { @@ -747,7 +803,7 @@ public class UserBackupManagerService { @VisibleForTesting BroadcastReceiver getPackageTrackingReceiver() { - return mBroadcastReceiver; + return mPackageTrackingReceiver; } @Nullable @@ -874,7 +930,7 @@ public class UserBackupManagerService { filter.addAction(Intent.ACTION_PACKAGE_CHANGED); filter.addDataScheme("package"); mContext.registerReceiverAsUser( - mBroadcastReceiver, + mPackageTrackingReceiver, UserHandle.of(mUserId), filter, /* broadcastPermission */ null, @@ -885,7 +941,7 @@ public class UserBackupManagerService { sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE); sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE); mContext.registerReceiverAsUser( - mBroadcastReceiver, + mPackageTrackingReceiver, UserHandle.of(mUserId), sdFilter, /* broadcastPermission */ null, @@ -1158,7 +1214,7 @@ public class UserBackupManagerService { * A {@link BroadcastReceiver} tracking changes to packages and sd cards in order to update our * internal bookkeeping. */ - private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { + private BroadcastReceiver mPackageTrackingReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { if (MORE_DEBUG) { Slog.d(TAG, "Received broadcast " + intent); diff --git a/services/backup/java/com/android/server/backup/internal/BackupHandler.java b/services/backup/java/com/android/server/backup/internal/BackupHandler.java index ba153bf90ebe..059b1b9379af 100644 --- a/services/backup/java/com/android/server/backup/internal/BackupHandler.java +++ b/services/backup/java/com/android/server/backup/internal/BackupHandler.java @@ -23,7 +23,7 @@ import static com.android.server.backup.BackupManagerService.TAG; import android.app.backup.RestoreSet; import android.content.Intent; import android.os.Handler; -import android.os.Looper; +import android.os.HandlerThread; import android.os.Message; import android.os.RemoteException; import android.os.UserHandle; @@ -83,19 +83,47 @@ public class BackupHandler extends Handler { // backup task state machine tick public static final int MSG_BACKUP_RESTORE_STEP = 20; public static final int MSG_OP_COMPLETE = 21; + // Release the wakelock. This is used to ensure we don't hold it after + // a user is removed. This will also terminate the looper thread. + public static final int MSG_STOP = 22; private final UserBackupManagerService backupManagerService; private final BackupAgentTimeoutParameters mAgentTimeoutParameters; - public BackupHandler(UserBackupManagerService backupManagerService, Looper looper) { - super(looper); + private final HandlerThread mBackupThread; + private volatile boolean mIsStopping = false; + + public BackupHandler( + UserBackupManagerService backupManagerService, HandlerThread backupThread) { + super(backupThread.getLooper()); + mBackupThread = backupThread; this.backupManagerService = backupManagerService; mAgentTimeoutParameters = Preconditions.checkNotNull( backupManagerService.getAgentTimeoutParameters(), "Timeout parameters cannot be null"); } + /** + * Put the BackupHandler into a stopping state where the remaining messages on the queue will be + * silently dropped and the {@link WakeLock} held by the {@link UserBackupManagerService} will + * then be released. + */ + public void stop() { + mIsStopping = true; + sendMessage(obtainMessage(BackupHandler.MSG_STOP)); + } + public void handleMessage(Message msg) { + if (msg.what == MSG_STOP) { + Slog.v(TAG, "Stopping backup handler"); + backupManagerService.getWakelock().quit(); + mBackupThread.quitSafely(); + } + + if (mIsStopping) { + // If we're finishing all other types of messages should be ignored + return; + } TransportManager transportManager = backupManagerService.getTransportManager(); switch (msg.what) { diff --git a/services/backup/java/com/android/server/backup/internal/RunInitializeReceiver.java b/services/backup/java/com/android/server/backup/internal/RunInitializeReceiver.java index 97711e3c27ed..96d61e5755c8 100644 --- a/services/backup/java/com/android/server/backup/internal/RunInitializeReceiver.java +++ b/services/backup/java/com/android/server/backup/internal/RunInitializeReceiver.java @@ -23,7 +23,6 @@ import static com.android.server.backup.UserBackupManagerService.RUN_INITIALIZE_ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import android.os.PowerManager; import android.util.Slog; import com.android.server.backup.UserBackupManagerService; @@ -57,7 +56,8 @@ public class RunInitializeReceiver extends BroadcastReceiver { mUserBackupManagerService.clearPendingInits(); - PowerManager.WakeLock wakelock = mUserBackupManagerService.getWakelock(); + UserBackupManagerService.BackupWakeLock wakelock = + mUserBackupManagerService.getWakelock(); wakelock.acquire(); OnTaskFinishedListener listener = caller -> wakelock.release(); diff --git a/services/backup/java/com/android/server/backup/restore/ActiveRestoreSession.java b/services/backup/java/com/android/server/backup/restore/ActiveRestoreSession.java index 10304c39f021..5a57cdc39402 100644 --- a/services/backup/java/com/android/server/backup/restore/ActiveRestoreSession.java +++ b/services/backup/java/com/android/server/backup/restore/ActiveRestoreSession.java @@ -34,7 +34,6 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.os.Binder; import android.os.Handler; import android.os.Message; -import android.os.PowerManager; import android.util.Slog; import com.android.server.backup.TransportManager; @@ -110,7 +109,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub { // comes in. mBackupManagerService.getBackupHandler().removeMessages(MSG_RESTORE_SESSION_TIMEOUT); - PowerManager.WakeLock wakelock = mBackupManagerService.getWakelock(); + UserBackupManagerService.BackupWakeLock wakelock = mBackupManagerService.getWakelock(); wakelock.acquire(); // Prevent lambda from leaking 'this' @@ -392,7 +391,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub { Handler backupHandler = mBackupManagerService.getBackupHandler(); backupHandler.removeMessages(MSG_RESTORE_SESSION_TIMEOUT); - PowerManager.WakeLock wakelock = mBackupManagerService.getWakelock(); + UserBackupManagerService.BackupWakeLock wakelock = mBackupManagerService.getWakelock(); wakelock.acquire(); if (MORE_DEBUG) { Slog.d(TAG, callerLogString); diff --git a/services/core/java/com/android/server/am/OomAdjuster.java b/services/core/java/com/android/server/am/OomAdjuster.java index bcfe71b82a6a..dbf8acf74dbd 100644 --- a/services/core/java/com/android/server/am/OomAdjuster.java +++ b/services/core/java/com/android/server/am/OomAdjuster.java @@ -34,6 +34,7 @@ import static android.os.Process.THREAD_GROUP_BG_NONINTERACTIVE; import static android.os.Process.THREAD_GROUP_DEFAULT; import static android.os.Process.THREAD_GROUP_RESTRICTED; import static android.os.Process.THREAD_GROUP_TOP_APP; +import static android.os.Process.THREAD_PRIORITY_DISPLAY; import static android.os.Process.setProcessGroup; import static android.os.Process.setThreadPriority; import static android.os.Process.setThreadScheduler; @@ -1803,7 +1804,6 @@ public final class OomAdjuster { if (app.renderThreadTid != 0) { setThreadScheduler(app.renderThreadTid, SCHED_OTHER, 0); - setThreadPriority(app.renderThreadTid, -4); } } catch (IllegalArgumentException e) { Slog.w(TAG, @@ -1815,9 +1815,10 @@ public final class OomAdjuster { } else { // Reset priority for top app UI and render threads setThreadPriority(app.pid, 0); - if (app.renderThreadTid != 0) { - setThreadPriority(app.renderThreadTid, 0); - } + } + + if (app.renderThreadTid != 0) { + setThreadPriority(app.renderThreadTid, THREAD_PRIORITY_DISPLAY); } } } catch (Exception e) { diff --git a/services/core/java/com/android/server/biometrics/BiometricService.java b/services/core/java/com/android/server/biometrics/BiometricService.java index bd3cd5439b32..af2f24f959b4 100644 --- a/services/core/java/com/android/server/biometrics/BiometricService.java +++ b/services/core/java/com/android/server/biometrics/BiometricService.java @@ -789,6 +789,23 @@ public class BiometricService extends SystemService { return error; } + @Override + public boolean hasEnrolledBiometrics(int userId) { + checkInternalPermission(); + + final long ident = Binder.clearCallingIdentity(); + try { + for (int i = 0; i < mAuthenticators.size(); i++) { + if (mAuthenticators.get(i).mAuthenticator.hasEnrolledTemplates(userId)) { + return true; + } + } + } finally { + Binder.restoreCallingIdentity(ident); + } + return false; + } + @Override // Binder call public void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback) throws RemoteException { diff --git a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java index 20eb6180832c..f3f9754bd32b 100644 --- a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java +++ b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java @@ -282,10 +282,10 @@ public abstract class BiometricServiceBase extends SystemService public EnrollClientImpl(Context context, DaemonWrapper daemon, long halDeviceId, IBinder token, ServiceListener listener, int userId, int groupId, byte[] cryptoToken, boolean restricted, String owner, - final int[] disabledFeatures) { + final int[] disabledFeatures, int timeoutSec) { super(context, getConstants(), daemon, halDeviceId, token, listener, userId, groupId, cryptoToken, restricted, owner, getBiometricUtils(), - disabledFeatures); + disabledFeatures, timeoutSec); } @Override @@ -912,8 +912,12 @@ public abstract class BiometricServiceBase extends SystemService } protected void setActiveUserInternal(int userId) { - // Do not put on handler, since it should finish before returning to caller. - updateActiveGroup(userId, null /* clientPackage */); + mHandler.post(() -> { + if (DEBUG) { + Slog.d(getTag(), "setActiveUser(" + userId + ")"); + } + updateActiveGroup(userId, null /* clientPackage */); + }); } protected void removeInternal(RemovalClient client) { diff --git a/services/core/java/com/android/server/biometrics/EnrollClient.java b/services/core/java/com/android/server/biometrics/EnrollClient.java index 854528f0654d..7ebb7c059b4c 100644 --- a/services/core/java/com/android/server/biometrics/EnrollClient.java +++ b/services/core/java/com/android/server/biometrics/EnrollClient.java @@ -31,11 +31,11 @@ import java.util.Arrays; * A class to keep track of the enrollment state for a given client. */ public abstract class EnrollClient extends ClientMonitor { - private static final long MS_PER_SEC = 1000; - private static final int ENROLLMENT_TIMEOUT_MS = 60 * 1000; // 1 minute private final byte[] mCryptoToken; private final BiometricUtils mBiometricUtils; private final int[] mDisabledFeatures; + private final int mTimeoutSec; + private long mEnrollmentStartTimeMs; public abstract boolean shouldVibrate(); @@ -44,12 +44,13 @@ public abstract class EnrollClient extends ClientMonitor { BiometricServiceBase.DaemonWrapper daemon, long halDeviceId, IBinder token, BiometricServiceBase.ServiceListener listener, int userId, int groupId, byte[] cryptoToken, boolean restricted, String owner, BiometricUtils utils, - final int[] disabledFeatures) { + final int[] disabledFeatures, int timeoutSec) { super(context, constants, daemon, halDeviceId, token, listener, userId, groupId, restricted, owner, 0 /* cookie */); mBiometricUtils = utils; mCryptoToken = Arrays.copyOf(cryptoToken, cryptoToken.length); mDisabledFeatures = Arrays.copyOf(disabledFeatures, disabledFeatures.length); + mTimeoutSec = timeoutSec; } @Override @@ -94,14 +95,13 @@ public abstract class EnrollClient extends ClientMonitor { @Override public int start() { mEnrollmentStartTimeMs = System.currentTimeMillis(); - final int timeout = (int) (ENROLLMENT_TIMEOUT_MS / MS_PER_SEC); try { final ArrayList<Integer> disabledFeatures = new ArrayList<>(); for (int i = 0; i < mDisabledFeatures.length; i++) { disabledFeatures.add(mDisabledFeatures[i]); } - final int result = getDaemonWrapper().enroll(mCryptoToken, getGroupId(), timeout, + final int result = getDaemonWrapper().enroll(mCryptoToken, getGroupId(), mTimeoutSec, disabledFeatures); if (result != 0) { Slog.w(getLogTag(), "startEnroll failed, result=" + result); diff --git a/services/core/java/com/android/server/biometrics/LoggableMonitor.java b/services/core/java/com/android/server/biometrics/LoggableMonitor.java index 6c7cbc166241..ecf3864e3362 100644 --- a/services/core/java/com/android/server/biometrics/LoggableMonitor.java +++ b/services/core/java/com/android/server/biometrics/LoggableMonitor.java @@ -93,7 +93,7 @@ public abstract class LoggableMonitor { statsAction(), statsClient(), acquiredInfo, - 0 /* vendorCode */, // Don't log vendorCode for now + vendorCode, Utils.isDebugEnabled(context, targetUserId)); } diff --git a/services/core/java/com/android/server/biometrics/face/FaceService.java b/services/core/java/com/android/server/biometrics/face/FaceService.java index a38abdc1bed0..a7065216f6a3 100644 --- a/services/core/java/com/android/server/biometrics/face/FaceService.java +++ b/services/core/java/com/android/server/biometrics/face/FaceService.java @@ -329,6 +329,7 @@ public class FaceService extends BiometricServiceBase { * Receives the incoming binder calls from FaceManager. */ private final class FaceServiceWrapper extends IFaceService.Stub { + private static final int ENROLL_TIMEOUT_SEC = 75; /** * The following methods contain common code which is shared in biometrics/common. @@ -343,16 +344,19 @@ public class FaceService extends BiometricServiceBase { @Override // Binder call public int revokeChallenge(IBinder token) { checkPermission(MANAGE_BIOMETRIC); - // TODO(b/137106905): Schedule binder calls in FaceService to avoid deadlocks. - if (getCurrentClient() == null) { - // if we aren't handling any other HIDL calls (mCurrentClient == null), revoke the - // challenge right away. - return startRevokeChallenge(token); - } else { - // postpone revoking the challenge until we finish processing the current HIDL call. - mRevokeChallengePending = true; - return Status.OK; - } + mHandler.post(() -> { + // TODO(b/137106905): Schedule binder calls in FaceService to avoid deadlocks. + if (getCurrentClient() == null) { + // if we aren't handling any other HIDL calls (mCurrentClient == null), revoke + // the challenge right away. + startRevokeChallenge(token); + } else { + // postpone revoking the challenge until we finish processing the current HIDL + // call. + mRevokeChallengePending = true; + } + }); + return Status.OK; } @Override // Binder call @@ -368,7 +372,8 @@ public class FaceService extends BiometricServiceBase { final boolean restricted = isRestricted(); final EnrollClientImpl client = new EnrollClientImpl(getContext(), mDaemonWrapper, mHalDeviceId, token, new ServiceListenerImpl(receiver), mCurrentUserId, - 0 /* groupId */, cryptoToken, restricted, opPackageName, disabledFeatures) { + 0 /* groupId */, cryptoToken, restricted, opPackageName, disabledFeatures, + ENROLL_TIMEOUT_SEC) { @Override public int[] getAcquireIgnorelist() { @@ -609,27 +614,32 @@ public class FaceService extends BiometricServiceBase { public void resetLockout(byte[] token) { checkPermission(MANAGE_BIOMETRIC); - if (!FaceService.this.hasEnrolledBiometrics(mCurrentUserId)) { - Slog.w(TAG, "Ignoring lockout reset, no templates enrolled"); - return; - } + mHandler.post(() -> { + if (!FaceService.this.hasEnrolledBiometrics(mCurrentUserId)) { + Slog.w(TAG, "Ignoring lockout reset, no templates enrolled"); + return; + } - Slog.d(TAG, "Resetting lockout for user: " + mCurrentUserId); + Slog.d(TAG, "Resetting lockout for user: " + mCurrentUserId); - try { - mDaemonWrapper.resetLockout(token); - } catch (RemoteException e) { - Slog.e(getTag(), "Unable to reset lockout", e); - } + try { + mDaemonWrapper.resetLockout(token); + } catch (RemoteException e) { + Slog.e(getTag(), "Unable to reset lockout", e); + } + }); } @Override public void setFeature(int userId, int feature, boolean enabled, final byte[] token, IFaceServiceReceiver receiver, final String opPackageName) { checkPermission(MANAGE_BIOMETRIC); - updateActiveGroup(userId, opPackageName); mHandler.post(() -> { + if (DEBUG) { + Slog.d(TAG, "setFeature for user(" + userId + ")"); + } + updateActiveGroup(userId, opPackageName); if (!FaceService.this.hasEnrolledBiometrics(mCurrentUserId)) { Slog.e(TAG, "No enrolled biometrics while setting feature: " + feature); return; @@ -660,9 +670,12 @@ public class FaceService extends BiometricServiceBase { public void getFeature(int userId, int feature, IFaceServiceReceiver receiver, final String opPackageName) { checkPermission(MANAGE_BIOMETRIC); - updateActiveGroup(userId, opPackageName); mHandler.post(() -> { + if (DEBUG) { + Slog.d(TAG, "getFeature for user(" + userId + ")"); + } + updateActiveGroup(userId, opPackageName); // This should ideally return tri-state, but the user isn't shown settings unless // they are enrolled so it's fine for now. if (!FaceService.this.hasEnrolledBiometrics(mCurrentUserId)) { diff --git a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java index 28336f459863..320e1022873c 100644 --- a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java @@ -176,6 +176,7 @@ public class FingerprintService extends BiometricServiceBase { * Receives the incoming binder calls from FingerprintManager. */ private final class FingerprintServiceWrapper extends IFingerprintService.Stub { + private static final int ENROLL_TIMEOUT_SEC = 60; /** * The following methods contain common code which is shared in biometrics/common. @@ -203,7 +204,8 @@ public class FingerprintService extends BiometricServiceBase { final int groupId = userId; // default group for fingerprint enrollment final EnrollClientImpl client = new EnrollClientImpl(getContext(), mDaemonWrapper, mHalDeviceId, token, new ServiceListenerImpl(receiver), mCurrentUserId, groupId, - cryptoToken, restricted, opPackageName, new int[0] /* disabledFeatures */) { + cryptoToken, restricted, opPackageName, new int[0] /* disabledFeatures */, + ENROLL_TIMEOUT_SEC) { @Override public boolean shouldVibrate() { return true; diff --git a/services/core/java/com/android/server/display/ColorFade.java b/services/core/java/com/android/server/display/ColorFade.java index 36d9c0e4478e..f61306405daa 100644 --- a/services/core/java/com/android/server/display/ColorFade.java +++ b/services/core/java/com/android/server/display/ColorFade.java @@ -29,6 +29,7 @@ import android.opengl.GLES11Ext; import android.opengl.GLES20; import android.os.IBinder; import android.util.Slog; +import android.view.Display; import android.view.DisplayInfo; import android.view.Surface; import android.view.Surface.OutOfResourcesException; @@ -72,6 +73,9 @@ final class ColorFade { // See code for details. private static final int DEJANK_FRAMES = 3; + private static final int EGL_GL_COLORSPACE_KHR = 0x309D; + private static final int EGL_GL_COLORSPACE_DISPLAY_P3_PASSTHROUGH_EXT = 0x3490; + private final int mDisplayId; // Set to true when the animation context has been fully prepared. @@ -93,6 +97,7 @@ final class ColorFade { private EGLSurface mEglSurface; private boolean mSurfaceVisible; private float mSurfaceAlpha; + private boolean mIsWideColor; // Texture names. We only use one texture, which contains the screenshot. private final int[] mTexNames = new int[1]; @@ -482,6 +487,8 @@ final class ColorFade { return false; } + mIsWideColor = SurfaceControl.getActiveColorMode(token) + == Display.COLOR_MODE_DISPLAY_P3; SurfaceControl.screenshot(token, s); st.updateTexImage(); st.getTransformMatrix(mTexMatrix); @@ -608,8 +615,16 @@ final class ColorFade { private boolean createEglSurface() { if (mEglSurface == null) { int[] eglSurfaceAttribList = new int[] { + EGL14.EGL_NONE, + EGL14.EGL_NONE, EGL14.EGL_NONE }; + + // If the current display is in wide color, then so is the screenshot. + if (mIsWideColor) { + eglSurfaceAttribList[0] = EGL_GL_COLORSPACE_KHR; + eglSurfaceAttribList[1] = EGL_GL_COLORSPACE_DISPLAY_P3_PASSTHROUGH_EXT; + } // turn our SurfaceControl into a Surface mEglSurface = EGL14.eglCreateWindowSurface(mEglDisplay, mEglConfig, mSurface, eglSurfaceAttribList, 0); diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java index 433ce811c8d7..9510db09aa25 100644 --- a/services/core/java/com/android/server/locksettings/LockSettingsService.java +++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java @@ -446,7 +446,7 @@ public class LockSettingsService extends ILockSettings.Stub { public boolean hasEnrolledBiometrics(int userId) { BiometricManager bm = mContext.getSystemService(BiometricManager.class); - return bm.canAuthenticate(userId) == BiometricManager.BIOMETRIC_SUCCESS; + return bm.hasEnrolledBiometrics(userId); } public int binderGetCallingUid() { diff --git a/services/core/java/com/android/server/locksettings/LockSettingsStorage.java b/services/core/java/com/android/server/locksettings/LockSettingsStorage.java index f0e431ee0354..84ae7c790a74 100644 --- a/services/core/java/com/android/server/locksettings/LockSettingsStorage.java +++ b/services/core/java/com/android/server/locksettings/LockSettingsStorage.java @@ -48,6 +48,8 @@ import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; +import java.nio.channels.FileChannel; +import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -390,6 +392,17 @@ class LockSettingsStorage { return stored; } + private void fsyncDirectory(File directory) { + try { + try (FileChannel file = FileChannel.open(directory.toPath(), + StandardOpenOption.READ)) { + file.force(true); + } + } catch (IOException e) { + Slog.e(TAG, "Error syncing directory: " + directory, e); + } + } + private void writeFile(String name, byte[] hash) { synchronized (mFileWriteLock) { RandomAccessFile raf = null; @@ -406,6 +419,7 @@ class LockSettingsStorage { raf.write(hash, 0, hash.length); } raf.close(); + fsyncDirectory((new File(name)).getAbsoluteFile().getParentFile()); } catch (IOException e) { Slog.e(TAG, "Error writing to file " + e); } finally { diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/PlatformKeyManager.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/PlatformKeyManager.java index c54bfc01e031..0ad6c2a69556 100644 --- a/services/core/java/com/android/server/locksettings/recoverablekeystore/PlatformKeyManager.java +++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/PlatformKeyManager.java @@ -19,6 +19,7 @@ package com.android.server.locksettings.recoverablekeystore; import android.app.KeyguardManager; import android.content.Context; import android.os.RemoteException; +import android.os.UserHandle; import android.security.GateKeeper; import android.security.keystore.AndroidKeyStoreSecretKey; import android.security.keystore.KeyPermanentlyInvalidatedException; @@ -437,25 +438,31 @@ public class PlatformKeyManager { // so it may live in memory for some time. SecretKey secretKey = generateAesKey(); - long secureUserId = getGateKeeperService().getSecureUserId(userId); - // TODO(b/124095438): Propagate this failure instead of silently failing. - if (secureUserId == GateKeeper.INVALID_SECURE_USER_ID) { - Log.e(TAG, "No SID available for user " + userId); - return; - } - - // Store decryption key first since it is more likely to fail. - mKeyStore.setEntry( - decryptAlias, - new KeyStore.SecretKeyEntry(secretKey), + KeyProtection.Builder decryptionKeyProtection = new KeyProtection.Builder(KeyProperties.PURPOSE_DECRYPT) .setUserAuthenticationRequired(true) .setUserAuthenticationValidityDurationSeconds( USER_AUTHENTICATION_VALIDITY_DURATION_SECONDS) .setBlockModes(KeyProperties.BLOCK_MODE_GCM) - .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE) + .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE); + if (userId != UserHandle.USER_SYSTEM) { + // Bind decryption key to secondary profile lock screen secret. + long secureUserId = getGateKeeperService().getSecureUserId(userId); + // TODO(b/124095438): Propagate this failure instead of silently failing. + if (secureUserId == GateKeeper.INVALID_SECURE_USER_ID) { + Log.e(TAG, "No SID available for user " + userId); + return; + } + decryptionKeyProtection .setBoundToSpecificSecureUserId(secureUserId) - .build()); + // Ignore caller uid which always belongs to the primary profile. + .setCriticalToDeviceEncryption(true); + } + // Store decryption key first since it is more likely to fail. + mKeyStore.setEntry( + decryptAlias, + new KeyStore.SecretKeyEntry(secretKey), + decryptionKeyProtection.build()); mKeyStore.setEntry( encryptAlias, new KeyStore.SecretKeyEntry(secretKey), diff --git a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java index 6f28675d051b..934511bf88d1 100644 --- a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java +++ b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java @@ -296,22 +296,12 @@ final class OverlayManagerServiceImpl { */ private void updateAndRefreshOverlaysForTarget(@NonNull final String targetPackageName, final int userId, final int flags) { - final List<OverlayInfo> ois = new ArrayList<>(); - - // Framework overlays added first because order matters when resolving a resource - if (!"android".equals(targetPackageName)) { - ois.addAll(mSettings.getOverlaysForTarget("android", userId)); - } - - // Then add the targeted, non-framework overlays which have higher priority - ois.addAll(mSettings.getOverlaysForTarget(targetPackageName, userId)); - - final List<String> enabledBaseCodePaths = new ArrayList<>(ois.size()); + final List<OverlayInfo> targetOverlays = mSettings.getOverlaysForTarget(targetPackageName, + userId); + // Update the state for any overlay that targets this package. boolean modified = false; - final int n = ois.size(); - for (int i = 0; i < n; i++) { - final OverlayInfo oi = ois.get(i); + for (final OverlayInfo oi : targetOverlays) { final PackageInfo overlayPackage = mPackageManager.getPackageInfo(oi.packageName, userId); if (overlayPackage == null) { @@ -324,25 +314,39 @@ final class OverlayManagerServiceImpl { Slog.e(TAG, "failed to update settings", e); modified |= mSettings.remove(oi.packageName, userId); } - - if (oi.isEnabled() && overlayPackage.applicationInfo != null) { - enabledBaseCodePaths.add(overlayPackage.applicationInfo.getBaseCodePath()); - } } } if (!modified) { + // Update the overlay paths of the target within package manager if necessary. + final List<String> enabledOverlayPaths = new ArrayList<>(targetOverlays.size()); + + // Framework overlays are first in the overlay paths of a package within PackageManager. + for (final OverlayInfo oi : mSettings.getOverlaysForTarget("android", userId)) { + if (oi.isEnabled()) { + enabledOverlayPaths.add(oi.baseCodePath); + } + } + + for (final OverlayInfo oi : targetOverlays) { + if (oi.isEnabled()) { + enabledOverlayPaths.add(oi.baseCodePath); + } + } + + // TODO(): Use getEnabledOverlayPaths(userId, targetPackageName) instead of + // resourceDirs if in the future resourceDirs contains APKs other than overlays PackageInfo packageInfo = mPackageManager.getPackageInfo(targetPackageName, userId); ApplicationInfo appInfo = packageInfo == null ? null : packageInfo.applicationInfo; String[] resourceDirs = appInfo == null ? null : appInfo.resourceDirs; // If the lists aren't the same length, the enabled overlays have changed - if (ArrayUtils.size(resourceDirs) != enabledBaseCodePaths.size()) { + if (ArrayUtils.size(resourceDirs) != enabledOverlayPaths.size()) { modified = true; } else if (resourceDirs != null) { // If any element isn't equal, an overlay or the order of overlays has changed for (int index = 0; index < resourceDirs.length; index++) { - if (!resourceDirs[index].equals(enabledBaseCodePaths.get(index))) { + if (!resourceDirs[index].equals(enabledOverlayPaths.get(index))) { modified = true; break; } diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 7fce4453b768..7cbf919b3d00 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -319,6 +319,8 @@ import com.android.server.pm.permission.PermissionManagerService; import com.android.server.pm.permission.PermissionManagerServiceInternal; import com.android.server.pm.permission.PermissionManagerServiceInternal.PermissionCallback; import com.android.server.pm.permission.PermissionsState; +import com.android.server.policy.PermissionPolicyInternal; +import com.android.server.policy.PermissionPolicyInternal.OnInitializedCallback; import com.android.server.security.VerityUtils; import com.android.server.storage.DeviceStorageMonitorInternal; import com.android.server.wm.ActivityTaskManagerInternal; @@ -17035,11 +17037,6 @@ public class PackageManagerService extends IPackageManager.Stub commitPackagesLocked(commitRequest); success = true; } finally { - for (PrepareResult result : prepareResults.values()) { - if (result.freezer != null) { - result.freezer.close(); - } - } Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } } @@ -19865,6 +19862,9 @@ public class PackageManagerService extends IPackageManager.Stub } }; + final AppOpsManager appOpsManager = mContext.getSystemService(AppOpsManager.class); + final int uid = UserHandle.getUid(userId, ps.pkg.applicationInfo.uid); + final int permissionCount = ps.pkg.requestedPermissions.size(); for (int i = 0; i < permissionCount; i++) { final String permName = ps.pkg.requestedPermissions.get(i); @@ -19924,6 +19924,14 @@ public class PackageManagerService extends IPackageManager.Stub if ((oldFlags & FLAG_PERMISSION_GRANTED_BY_DEFAULT) != 0) { mPermissionManager.grantRuntimePermission(permName, packageName, false, Process.SYSTEM_UID, userId, delayingPermCallback); + // Allow app op later as we are holding mPackages + // PermissionPolicyService will handle the app op for foreground/background + // permissions. + String appOp = AppOpsManager.permissionToOp(permName); + if (appOp != null) { + mHandler.post(() -> appOpsManager.setUidMode(appOp, uid, + AppOpsManager.MODE_ALLOWED)); + } // If permission review is enabled the permissions for a legacy apps // are represented as constantly granted runtime ones, so don't revoke. } else if ((flags & FLAG_PERMISSION_REVIEW_REQUIRED) == 0) { @@ -21633,6 +21641,17 @@ public class PackageManagerService extends IPackageManager.Stub mPermissionManager.updateAllPermissions( StorageManager.UUID_PRIVATE_INTERNAL, false, mPackages.values(), mPermissionCallback); + + final PermissionPolicyInternal permissionPolicyInternal = + LocalServices.getService(PermissionPolicyInternal.class); + permissionPolicyInternal.setOnInitializedCallback(userId -> { + // The SDK updated case is already handled when we run during the ctor. + synchronized (mPackages) { + mPermissionManager.updateAllPermissions( + StorageManager.UUID_PRIVATE_INTERNAL, false /*sdkUpdated*/, + mPackages.values(), mPermissionCallback); + } + }); } // Watch for external volumes that come and go over time diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java index f8c4f6b2cdba..4550446f88c5 100644 --- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java +++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java @@ -1170,6 +1170,11 @@ public final class DefaultPermissionGrantPolicy { final int flags = mContext.getPackageManager().getPermissionFlags( permission, pkg.packageName, user); + // If we are trying to grant as system fixed and already system fixed + // then the system can change the system fixed grant state. + final boolean changingGrantForSystemFixed = systemFixed + && (flags & PackageManager.FLAG_PERMISSION_SYSTEM_FIXED) != 0; + // Certain flags imply that the permission's current state by the system or // device/profile owner or the user. In these cases we do not want to clobber the // current state. @@ -1177,7 +1182,8 @@ public final class DefaultPermissionGrantPolicy { // Unless the caller wants to override user choices. The override is // to make sure we can grant the needed permission to the default // sms and phone apps after the user chooses this in the UI. - if (!isFixedOrUserSet(flags) || ignoreSystemPackage) { + if (!isFixedOrUserSet(flags) || ignoreSystemPackage + || changingGrantForSystemFixed) { // Never clobber policy fixed permissions. // We must allow the grant of a system-fixed permission because // system-fixed is sticky, but the permission itself may be revoked. @@ -1196,6 +1202,14 @@ public final class DefaultPermissionGrantPolicy { PackageManager.FLAG_PERMISSION_RESTRICTION_SYSTEM_EXEMPT, user); } + // If the system tries to change a system fixed permission from one fixed + // state to another we need to drop the fixed flag to allow the grant. + if (changingGrantForSystemFixed) { + mContext.getPackageManager().updatePermissionFlags(permission, + pkg.packageName, flags, + flags & ~PackageManager.FLAG_PERMISSION_SYSTEM_FIXED, user); + } + if (pm.checkPermission(permission, pkg.packageName) != PackageManager.PERMISSION_GRANTED) { mContext.getPackageManager() diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java index d3e5df5d62d1..8884821c770e 100644 --- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java +++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java @@ -97,6 +97,7 @@ import com.android.server.pm.SharedUserSetting; import com.android.server.pm.UserManagerService; import com.android.server.pm.permission.PermissionManagerServiceInternal.PermissionCallback; import com.android.server.pm.permission.PermissionsState.PermissionState; +import com.android.server.policy.PermissionPolicyInternal; import com.android.server.policy.SoftRestrictedPermissionPolicy; import libcore.util.EmptyArray; @@ -197,6 +198,9 @@ public class PermissionManagerService { @GuardedBy("mLock") private boolean mSystemReady; + @GuardedBy("mLock") + private PermissionPolicyInternal mPermissionPolicyInternal; + /** * For each foreground/background permission the mapping: * Background permission -> foreground permissions @@ -1080,6 +1084,13 @@ public class PermissionManagerService { boolean softRestricted = bp.isSoftRestricted(); for (int userId : currentUserIds) { + // If permission policy is not ready we don't deal with restricted + // permissions as the policy may whitelist some permissions. Once + // the policy is initialized we would re-evaluate permissions. + final boolean permissionPolicyInitialized = + mPermissionPolicyInternal != null + && mPermissionPolicyInternal.isInitialized(userId); + PermissionState permState = origPermissions .getRuntimePermissionState(perm, userId); int flags = permState != null ? permState.getFlags() : 0; @@ -1094,7 +1105,7 @@ public class PermissionManagerService { if (appSupportsRuntimePermissions) { // If hard restricted we don't allow holding it - if (hardRestricted) { + if (permissionPolicyInitialized && hardRestricted) { if (!restrictionExempt) { if (permState != null && permState.isGranted() && permissionsState.revokeRuntimePermission( @@ -1107,7 +1118,7 @@ public class PermissionManagerService { } } // If soft restricted we allow holding in a restricted form - } else if (softRestricted) { + } else if (permissionPolicyInitialized && softRestricted) { // Regardless if granted set the restriction flag as it // may affect app treatment based on this permission. if (!restrictionExempt && !restrictionApplied) { @@ -1126,7 +1137,8 @@ public class PermissionManagerService { flags &= ~FLAG_PERMISSION_REVOKE_ON_UPGRADE; wasChanged = true; // Hard restricted permissions cannot be held. - } else if (!hardRestricted || restrictionExempt) { + } else if (!permissionPolicyInitialized + || (!hardRestricted || restrictionExempt)) { if (permState != null && permState.isGranted()) { if (permissionsState.grantRuntimePermission(bp, userId) == PERMISSION_OPERATION_FAILURE) { @@ -1155,33 +1167,28 @@ public class PermissionManagerService { // If legacy app always grant the permission but if restricted // and not exempt take a note a restriction should be applied. - if ((hardRestricted || softRestricted) - && !restrictionExempt && !restrictionApplied) { + if (permissionPolicyInitialized + && (hardRestricted || softRestricted) + && !restrictionExempt && !restrictionApplied) { flags |= FLAG_PERMISSION_APPLY_RESTRICTION; wasChanged = true; } } // If unrestricted or restriction exempt, don't apply restriction. - if (!(hardRestricted || softRestricted) || restrictionExempt) { - if (restrictionApplied) { - flags &= ~FLAG_PERMISSION_APPLY_RESTRICTION; - // Dropping restriction on a legacy app requires a review. - if (!appSupportsRuntimePermissions) { - flags |= FLAG_PERMISSION_REVIEW_REQUIRED; + if (permissionPolicyInitialized) { + if (!(hardRestricted || softRestricted) || restrictionExempt) { + if (restrictionApplied) { + flags &= ~FLAG_PERMISSION_APPLY_RESTRICTION; + // Dropping restriction on a legacy app implies a review + if (!appSupportsRuntimePermissions) { + flags |= FLAG_PERMISSION_REVIEW_REQUIRED; + } + wasChanged = true; } - wasChanged = true; } } - if (hardRestricted && !restrictionExempt - && (flags & FLAG_PERMISSION_SYSTEM_FIXED) != 0) { - // Applying a hard restriction implies revoking it. This might - // lead to a system-fixed, revoked permission. - flags &= ~FLAG_PERMISSION_SYSTEM_FIXED; - wasChanged = true; - } - if (wasChanged) { updatedUserIds = ArrayUtils.appendInt(updatedUserIds, userId); } @@ -1216,6 +1223,13 @@ public class PermissionManagerService { boolean softRestricted = bp.isSoftRestricted(); for (int userId : currentUserIds) { + // If permission policy is not ready we don't deal with restricted + // permissions as the policy may whitelist some permissions. Once + // the policy is initialized we would re-evaluate permissions. + final boolean permissionPolicyInitialized = + mPermissionPolicyInternal != null + && mPermissionPolicyInternal.isInitialized(userId); + boolean wasChanged = false; boolean restrictionExempt = @@ -1226,7 +1240,7 @@ public class PermissionManagerService { if (appSupportsRuntimePermissions) { // If hard restricted we don't allow holding it - if (hardRestricted) { + if (permissionPolicyInitialized && hardRestricted) { if (!restrictionExempt) { if (permState != null && permState.isGranted() && permissionsState.revokeRuntimePermission( @@ -1239,7 +1253,7 @@ public class PermissionManagerService { } } // If soft restricted we allow holding in a restricted form - } else if (softRestricted) { + } else if (permissionPolicyInitialized && softRestricted) { // Regardless if granted set the restriction flag as it // may affect app treatment based on this permission. if (!restrictionExempt && !restrictionApplied) { @@ -1258,7 +1272,8 @@ public class PermissionManagerService { flags &= ~FLAG_PERMISSION_REVOKE_ON_UPGRADE; wasChanged = true; // Hard restricted permissions cannot be held. - } else if (!hardRestricted || restrictionExempt) { + } else if (!permissionPolicyInitialized || + (!hardRestricted || restrictionExempt)) { if (permissionsState.grantRuntimePermission(bp, userId) != PERMISSION_OPERATION_FAILURE) { wasChanged = true; @@ -1274,22 +1289,25 @@ public class PermissionManagerService { // If legacy app always grant the permission but if restricted // and not exempt take a note a restriction should be applied. - if ((hardRestricted || softRestricted) - && !restrictionExempt && !restrictionApplied) { + if (permissionPolicyInitialized + && (hardRestricted || softRestricted) + && !restrictionExempt && !restrictionApplied) { flags |= FLAG_PERMISSION_APPLY_RESTRICTION; wasChanged = true; } } // If unrestricted or restriction exempt, don't apply restriction. - if (!(hardRestricted || softRestricted) || restrictionExempt) { - if (restrictionApplied) { - flags &= ~FLAG_PERMISSION_APPLY_RESTRICTION; - // Dropping restriction on a legacy app requires a review. - if (!appSupportsRuntimePermissions) { - flags |= FLAG_PERMISSION_REVIEW_REQUIRED; + if (permissionPolicyInitialized) { + if (!(hardRestricted || softRestricted) || restrictionExempt) { + if (restrictionApplied) { + flags &= ~FLAG_PERMISSION_APPLY_RESTRICTION; + // Dropping restriction on a legacy app implies a review + if (!appSupportsRuntimePermissions) { + flags |= FLAG_PERMISSION_REVIEW_REQUIRED; + } + wasChanged = true; } - wasChanged = true; } } @@ -2900,6 +2918,7 @@ public class PermissionManagerService { } mPermissionControllerManager = mContext.getSystemService(PermissionControllerManager.class); + mPermissionPolicyInternal = LocalServices.getService(PermissionPolicyInternal.class); } private static String getVolumeUuidForPackage(PackageParser.Package pkg) { diff --git a/services/core/java/com/android/server/policy/PermissionPolicyInternal.java b/services/core/java/com/android/server/policy/PermissionPolicyInternal.java index 7760c1edd9e6..6084c6718577 100644 --- a/services/core/java/com/android/server/policy/PermissionPolicyInternal.java +++ b/services/core/java/com/android/server/policy/PermissionPolicyInternal.java @@ -18,6 +18,7 @@ package com.android.server.policy; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.UserIdInt; import android.content.Intent; /** @@ -26,6 +27,19 @@ import android.content.Intent; public abstract class PermissionPolicyInternal { /** + * Callback for initializing the permission policy service. + */ + public interface OnInitializedCallback { + + /** + * Called when initialized for the given user. + * + * @param userId The initialized user. + */ + void onInitialized(@UserIdInt int userId); + } + + /** * Check whether an activity should be started. * * @param intent the {@link Intent} for the activity start @@ -36,4 +50,17 @@ public abstract class PermissionPolicyInternal { */ public abstract boolean checkStartActivity(@NonNull Intent intent, int callingUid, @Nullable String callingPackage); + + /** + * @return Whether the policy is initialized for a user. + */ + public abstract boolean isInitialized(@UserIdInt int userId); + + /** + * Set a callback for users being initialized. If the user is already + * initialized the callback will not be invoked. + * + * @param callback The callback to register. + */ + public abstract void setOnInitializedCallback(@NonNull OnInitializedCallback callback); } diff --git a/services/core/java/com/android/server/policy/PermissionPolicyService.java b/services/core/java/com/android/server/policy/PermissionPolicyService.java index a569bffef141..3d543c96aacc 100644 --- a/services/core/java/com/android/server/policy/PermissionPolicyService.java +++ b/services/core/java/com/android/server/policy/PermissionPolicyService.java @@ -66,6 +66,7 @@ import com.android.server.LocalServices; import com.android.server.SystemService; import com.android.server.pm.permission.PermissionManagerServiceInternal; +import com.android.server.policy.PermissionPolicyInternal.OnInitializedCallback; import java.util.ArrayList; import java.util.concurrent.CountDownLatch; @@ -86,6 +87,10 @@ public final class PermissionPolicyService extends SystemService { @GuardedBy("mLock") private final SparseBooleanArray mIsStarted = new SparseBooleanArray(); + /** Callbacks for when a user is initialized */ + @GuardedBy("mLock") + private OnInitializedCallback mOnInitializedCallback; + /** * Whether an async {@link #synchronizePackagePermissionsAndAppOpsForUser} is currently * scheduled for a package/user. @@ -240,12 +245,20 @@ public final class PermissionPolicyService extends SystemService { grantOrUpgradeDefaultRuntimePermissionsIfNeeded(userId); + final OnInitializedCallback callback; + synchronized (mLock) { mIsStarted.put(userId, true); + callback = mOnInitializedCallback; } // Force synchronization as permissions might have changed synchronizePermissionsAndAppOpsForUser(userId); + + // Tell observers we are initialized for this user. + if (callback != null) { + callback.onInitialized(userId); + } } @Override @@ -807,6 +820,18 @@ public final class PermissionPolicyService extends SystemService { return true; } + @Override + public boolean isInitialized(int userId) { + return isStarted(userId); + } + + @Override + public void setOnInitializedCallback(@NonNull OnInitializedCallback callback) { + synchronized (mLock) { + mOnInitializedCallback = callback; + } + } + /** * Check if the intent action is removed for the calling package (often based on target SDK * version). If the action is removed, we'll silently cancel the activity launch. diff --git a/services/core/java/com/android/server/slice/PinnedSliceState.java b/services/core/java/com/android/server/slice/PinnedSliceState.java index e139ab86775d..4970862070bb 100644 --- a/services/core/java/com/android/server/slice/PinnedSliceState.java +++ b/services/core/java/com/android/server/slice/PinnedSliceState.java @@ -188,7 +188,7 @@ public class PinnedSliceState { b.putParcelable(SliceProvider.EXTRA_BIND_URI, mUri); try { client.call(SliceProvider.METHOD_PIN, null, b); - } catch (RemoteException e) { + } catch (Exception e) { Log.w(TAG, "Unable to contact " + mUri, e); } } @@ -201,7 +201,7 @@ public class PinnedSliceState { b.putParcelable(SliceProvider.EXTRA_BIND_URI, mUri); try { client.call(SliceProvider.METHOD_UNPIN, null, b); - } catch (RemoteException e) { + } catch (Exception e) { Log.w(TAG, "Unable to contact " + mUri, e); } } diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java index 4f91081e8acd..3550ebf9a03f 100644 --- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java @@ -1202,8 +1202,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { final PackageInfo packageInfo; try { packageInfo = mService.mContext.getPackageManager() - .getPackageInfoAsUser(callingPackage, PackageManager.GET_PERMISSIONS, - UserHandle.getUserId(callingUid)); + .getPackageInfo(callingPackage, PackageManager.GET_PERMISSIONS); } catch (PackageManager.NameNotFoundException e) { Slog.i(TAG, "Cannot find package info for " + callingPackage); return ACTIVITY_RESTRICTION_NONE; diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index 7186ed169f5d..8a9dfc7569dc 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -1015,7 +1015,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { public final int startActivities(IApplicationThread caller, String callingPackage, Intent[] intents, String[] resolvedTypes, IBinder resultTo, Bundle bOptions, int userId) { - assertPackageMatchesCallingUid(callingPackage); final String reason = "startActivities"; enforceNotIsolatedCaller(reason); userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId, reason); @@ -1035,11 +1034,10 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { true /*validateIncomingUser*/); } - private int startActivityAsUser(IApplicationThread caller, String callingPackage, + int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle bOptions, int userId, boolean validateIncomingUser) { - assertPackageMatchesCallingUid(callingPackage); enforceNotIsolatedCaller("startActivityAsUser"); userId = getActivityStartController().checkTargetUser(userId, validateIncomingUser, @@ -1212,7 +1210,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { public final WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle bOptions, int userId) { - assertPackageMatchesCallingUid(callingPackage); final WaitResult res = new WaitResult(); synchronized (mGlobalLock) { enforceNotIsolatedCaller("startActivityAndWait"); @@ -1240,7 +1237,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { public final int startActivityWithConfig(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, Configuration config, Bundle bOptions, int userId) { - assertPackageMatchesCallingUid(callingPackage); synchronized (mGlobalLock) { enforceNotIsolatedCaller("startActivityWithConfig"); userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId, @@ -1290,7 +1286,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle bOptions, IBinder permissionToken, boolean ignoreTargetSecurity, int userId) { - assertPackageMatchesCallingUid(callingPackage); // This is very dangerous -- it allows you to perform a start activity (including // permission grants) as any app that may launch one of your own activities. So we only // allow this in two cases: @@ -1420,7 +1415,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { Intent intent, String resolvedType, IVoiceInteractionSession session, IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo, Bundle bOptions, int userId) { - assertPackageMatchesCallingUid(callingPackage); mAmInternal.enforceCallingPermission(BIND_VOICE_INTERACTION, "startVoiceActivity()"); if (session == null || interactor == null) { throw new NullPointerException("null session or interactor"); @@ -1444,7 +1438,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public int startAssistantActivity(String callingPackage, int callingPid, int callingUid, Intent intent, String resolvedType, Bundle bOptions, int userId) { - assertPackageMatchesCallingUid(callingPackage); mAmInternal.enforceCallingPermission(BIND_VOICE_INTERACTION, "startAssistantActivity()"); userId = handleIncomingUser(callingPid, callingUid, userId, "startAssistantActivity"); @@ -2370,9 +2363,15 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { void moveTaskToFrontLocked(@Nullable IApplicationThread appThread, @Nullable String callingPackage, int taskId, int flags, SafeActivityOptions options, boolean fromRecents) { + final int callingPid = Binder.getCallingPid(); final int callingUid = Binder.getCallingUid(); - assertPackageMatchesCallingUid(callingPackage); + if (!isSameApp(callingUid, callingPackage)) { + String msg = "Permission Denial: moveTaskToFrontLocked() from pid=" + + Binder.getCallingPid() + " as package " + callingPackage; + Slog.w(TAG, msg); + throw new SecurityException(msg); + } if (!checkAppSwitchAllowedLocked(callingPid, callingUid, -1, -1, "Task to front")) { SafeActivityOptions.abort(options); return; @@ -2424,7 +2423,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { /** * Return true if callingUid is system, or packageName belongs to that callingUid. */ - private boolean isSameApp(int callingUid, @Nullable String packageName) { + boolean isSameApp(int callingUid, @Nullable String packageName) { try { if (callingUid != 0 && callingUid != SYSTEM_UID) { if (packageName == null) { @@ -2441,21 +2440,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { return true; } - /** - * Checks that the provided package name matches the current calling UID, throws a security - * exception if it doesn't. - */ - void assertPackageMatchesCallingUid(@Nullable String packageName) { - final int callingUid = Binder.getCallingUid(); - if (isSameApp(callingUid, packageName)) { - return; - } - final String msg = "Permission Denial: package=" + packageName - + " does not belong to uid=" + callingUid; - Slog.w(TAG, msg); - throw new SecurityException(msg); - } - boolean checkAppSwitchAllowedLocked(int sourcePid, int sourceUid, int callingPid, int callingUid, String name) { if (mAppSwitchesAllowedTime < SystemClock.uptimeMillis()) { @@ -2989,7 +2973,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public List<IBinder> getAppTasks(String callingPackage) { int callingUid = Binder.getCallingUid(); - assertPackageMatchesCallingUid(callingPackage); long ident = Binder.clearCallingIdentity(); try { synchronized (mGlobalLock) { @@ -6210,7 +6193,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { SafeActivityOptions options, int userId, boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) { - assertPackageMatchesCallingUid(callingPackage); synchronized (mGlobalLock) { return getActivityStartController().startActivitiesInPackage(uid, realCallingPid, realCallingUid, callingPackage, intents, resolvedTypes, resultTo, options, @@ -6226,7 +6208,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { int userId, TaskRecord inTask, String reason, boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) { - assertPackageMatchesCallingUid(callingPackage); synchronized (mGlobalLock) { return getActivityStartController().startActivityInPackage(uid, realCallingPid, realCallingUid, callingPackage, intent, resolvedType, resultTo, resultWho, diff --git a/services/core/java/com/android/server/wm/AppTaskImpl.java b/services/core/java/com/android/server/wm/AppTaskImpl.java index a8f7768efc87..1eb7455135c7 100644 --- a/services/core/java/com/android/server/wm/AppTaskImpl.java +++ b/services/core/java/com/android/server/wm/AppTaskImpl.java @@ -27,6 +27,7 @@ import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.os.UserHandle; +import android.util.Slog; /** * An implementation of IAppTask, that allows an app to manage its own tasks via @@ -96,7 +97,12 @@ class AppTaskImpl extends IAppTask.Stub { // Will bring task to front if it already has a root activity. final int callingPid = Binder.getCallingPid(); final int callingUid = Binder.getCallingUid(); - mService.assertPackageMatchesCallingUid(callingPackage); + if (!mService.isSameApp(callingUid, callingPackage)) { + String msg = "Permission Denial: moveToFront() from pid=" + + Binder.getCallingPid() + " as package " + callingPackage; + Slog.w(TAG, msg); + throw new SecurityException(msg); + } final long origId = Binder.clearCallingIdentity(); try { synchronized (mService.mGlobalLock) { @@ -128,7 +134,6 @@ class AppTaskImpl extends IAppTask.Stub { public int startActivity(IBinder whoThread, String callingPackage, Intent intent, String resolvedType, Bundle bOptions) { checkCaller(); - mService.assertPackageMatchesCallingUid(callingPackage); int callingUser = UserHandle.getCallingUserId(); TaskRecord tr; diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index eab5e0dd270e..6c577e150e54 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -2477,7 +2477,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree // transformed the task. final RecentsAnimationController controller = mWmService.getRecentsAnimationController(); if (controller != null && controller.isAnimatingTask(getTask()) - && controller.shouldCancelWithDeferredScreenshot()) { + && controller.shouldDeferCancelUntilNextTransition()) { return false; } diff --git a/services/core/java/com/android/server/wm/RecentsAnimation.java b/services/core/java/com/android/server/wm/RecentsAnimation.java index bf627ec5680c..0a3e7a4860d5 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimation.java +++ b/services/core/java/com/android/server/wm/RecentsAnimation.java @@ -355,7 +355,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks, // launch-behind state is restored. That also prevents the next transition // type being disturbed if the visibility is updated after setting the next // transition (the target activity will be one of closing apps). - if (!controller.shouldCancelWithDeferredScreenshot() + if (!controller.shouldDeferCancelWithScreenshot() && !targetStack.isFocusedStackOnDisplay()) { targetStack.ensureActivitiesVisibleLocked(null /* starting */, 0 /* starting */, false /* preserveWindows */); @@ -415,16 +415,18 @@ class RecentsAnimation implements RecentsAnimationCallbacks, final DisplayContent dc = mService.mRootActivityContainer.getDefaultDisplay().mDisplayContent; dc.mBoundsAnimationController.setAnimationType( - controller.shouldCancelWithDeferredScreenshot() ? FADE_IN : BOUNDS); + controller.shouldDeferCancelUntilNextTransition() ? FADE_IN : BOUNDS); - // Cancel running recents animation and screenshot previous task when the next - // transition starts in below cases: - // 1) The next launching task is not in recents animation task. + // We defer canceling the recents animation until the next app transition in the following + // cases: + // 1) The next launching task is not being animated by the recents animation // 2) The next task is home activity. (i.e. pressing home key to back home in recents). if ((!controller.isAnimatingTask(stack.getTaskStack().getTopChild()) || controller.isTargetApp(stack.getTopActivity().mAppWindowToken)) - && controller.shouldCancelWithDeferredScreenshot()) { - controller.cancelOnNextTransitionStart(); + && controller.shouldDeferCancelUntilNextTransition()) { + // Always prepare an app transition since we rely on the transition callbacks to cleanup + mWindowManager.prepareAppTransition(TRANSIT_NONE, false); + controller.setCancelOnNextTransitionStart(); } else { // Just cancel directly to unleash from launcher when the next launching task is the // current top task. diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java index c03dabe660ad..a8b00838577f 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -96,10 +96,9 @@ public class RecentsAnimationController implements DeathRecipient { private final Runnable mFailsafeRunnable = () -> cancelAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION, "failSafeRunnable"); - final Object mLock = new Object(); - // The recents component app token that is shown behind the visibile tasks private AppWindowToken mTargetAppToken; + private DisplayContent mDisplayContent; private int mTargetActivityType; private Rect mMinimizedHomeBounds = new Rect(); @@ -123,25 +122,47 @@ public class RecentsAnimationController implements DeathRecipient { private boolean mLinkedToDeathOfRunner; - private boolean mCancelWithDeferredScreenshot; - + // Whether to try to defer canceling from a stack order change until the next transition + private boolean mRequestDeferCancelUntilNextTransition; + // Whether to actually defer canceling until the next transition private boolean mCancelOnNextTransitionStart; + // Whether to take a screenshot when handling a deferred cancel + private boolean mCancelDeferredWithScreenshot; /** * Animates the screenshot of task that used to be controlled by RecentsAnimation. - * @see {@link #cancelOnNextTransitionStart} + * @see {@link #setCancelOnNextTransitionStart} */ SurfaceAnimator mRecentScreenshotAnimator; + /** + * An app transition listener to cancel the recents animation only after the app transition + * starts or is canceled. + */ final AppTransitionListener mAppTransitionListener = new AppTransitionListener() { @Override public int onAppTransitionStartingLocked(int transit, long duration, long statusBarAnimationStartTime, long statusBarAnimationDuration) { - onTransitionStart(); - mService.mRoot.getDisplayContent(mDisplayId).mAppTransition - .unregisterListener(this); + continueDeferredCancel(); return 0; } + + @Override + public void onAppTransitionCancelledLocked(int transit) { + continueDeferredCancel(); + } + + private void continueDeferredCancel() { + mDisplayContent.mAppTransition.unregisterListener(this); + if (mCanceled) { + return; + } + + if (mCancelOnNextTransitionStart) { + mCancelOnNextTransitionStart = false; + cancelAnimationWithScreenshot(mCancelDeferredWithScreenshot); + } + } }; public interface RecentsAnimationCallbacks { @@ -201,8 +222,7 @@ public class RecentsAnimationController implements DeathRecipient { ? REORDER_MOVE_TO_TOP : REORDER_MOVE_TO_ORIGINAL_POSITION, true /* runSynchronously */, sendUserLeaveHint); - final DisplayContent dc = mService.mRoot.getDisplayContent(mDisplayId); - dc.mBoundsAnimationController.setAnimationType(FADE_IN); + mDisplayContent.mBoundsAnimationController.setAnimationType(FADE_IN); } finally { Binder.restoreCallingIdentity(token); } @@ -239,8 +259,7 @@ public class RecentsAnimationController implements DeathRecipient { } mInputConsumerEnabled = enabled; - final InputMonitor inputMonitor = - mService.mRoot.getDisplayContent(mDisplayId).getInputMonitor(); + final InputMonitor inputMonitor = mDisplayContent.getInputMonitor(); inputMonitor.updateInputWindowsLw(true /*force*/); mService.scheduleAnimationLocked(); } @@ -281,15 +300,23 @@ public class RecentsAnimationController implements DeathRecipient { } @Override + @Deprecated public void setCancelWithDeferredScreenshot(boolean screenshot) { - synchronized (mLock) { - setCancelWithDeferredScreenshotLocked(screenshot); + synchronized (mService.mGlobalLock) { + setDeferredCancel(true /* deferred */, screenshot); + } + } + + @Override + public void setDeferCancelUntilNextTransition(boolean defer, boolean screenshot) { + synchronized (mService.mGlobalLock) { + setDeferredCancel(defer, screenshot); } } @Override public void cleanupScreenshot() { - synchronized (mLock) { + synchronized (mService.mGlobalLock) { if (mRecentScreenshotAnimator != null) { mRecentScreenshotAnimator.cancelAnimation(); mRecentScreenshotAnimator = null; @@ -311,10 +338,7 @@ public class RecentsAnimationController implements DeathRecipient { mCallbacks = callbacks; mDisplayId = displayId; mStatusBar = LocalServices.getService(StatusBarManagerInternal.class); - } - - public void initialize(int targetActivityType, SparseBooleanArray recentTaskIds) { - initialize(mService.mRoot.getDisplayContent(mDisplayId), targetActivityType, recentTaskIds); + mDisplayContent = service.mRoot.getDisplayContent(displayId); } /** @@ -322,15 +346,15 @@ public class RecentsAnimationController implements DeathRecipient { * because it may call cancelAnimation() which needs to properly clean up the controller * in the window manager. */ - @VisibleForTesting - void initialize(DisplayContent dc, int targetActivityType, SparseBooleanArray recentTaskIds) { + public void initialize(int targetActivityType, SparseBooleanArray recentTaskIds) { mTargetActivityType = targetActivityType; - dc.mAppTransition.registerListenerLocked(mAppTransitionListener); + mDisplayContent.mAppTransition.registerListenerLocked(mAppTransitionListener); // Make leashes for each of the visible/target tasks and add it to the recents animation to // be started - final ArrayList<Task> visibleTasks = dc.getVisibleTasks(); - final TaskStack targetStack = dc.getStack(WINDOWING_MODE_UNDEFINED, targetActivityType); + final ArrayList<Task> visibleTasks = mDisplayContent.getVisibleTasks(); + final TaskStack targetStack = mDisplayContent.getStack(WINDOWING_MODE_UNDEFINED, + targetActivityType); if (targetStack != null) { for (int i = targetStack.getChildCount() - 1; i >= 0; i--) { final Task t = targetStack.getChildAt(i); @@ -364,29 +388,31 @@ public class RecentsAnimationController implements DeathRecipient { } // Adjust the wallpaper visibility for the showing target activity - final AppWindowToken recentsComponentAppToken = dc.getStack(WINDOWING_MODE_UNDEFINED, - targetActivityType).getTopChild().getTopFullscreenAppToken(); + final AppWindowToken recentsComponentAppToken = + targetStack.getTopChild().getTopFullscreenAppToken(); if (recentsComponentAppToken != null) { if (DEBUG_RECENTS_ANIMATIONS) Slog.d(TAG, "setHomeApp(" + recentsComponentAppToken.getName() + ")"); mTargetAppToken = recentsComponentAppToken; if (recentsComponentAppToken.windowsCanBeWallpaperTarget()) { - dc.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER; - dc.setLayoutNeeded(); + mDisplayContent.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER; + mDisplayContent.setLayoutNeeded(); } } // Save the minimized home height - final TaskStack dockedStack = dc.getSplitScreenPrimaryStackIgnoringVisibility(); - dc.getDockedDividerController().getHomeStackBoundsInDockedMode( - dc.getConfiguration(), + final TaskStack dockedStack = mDisplayContent.getSplitScreenPrimaryStackIgnoringVisibility(); + mDisplayContent.getDockedDividerController().getHomeStackBoundsInDockedMode( + mDisplayContent.getConfiguration(), dockedStack == null ? DOCKED_INVALID : dockedStack.getDockSide(), mMinimizedHomeBounds); mService.mWindowPlacerLocked.performSurfacePlacement(); // Notify that the animation has started - mStatusBar.onRecentsAnimationStateChanged(true /* running */); + if (mStatusBar != null) { + mStatusBar.onRecentsAnimationStateChanged(true /* running */); + } } @VisibleForTesting @@ -440,8 +466,7 @@ public class RecentsAnimationController implements DeathRecipient { // Perform layout if it was scheduled before to make sure that we get correct content // insets for the target app window after a rotation - final DisplayContent displayContent = mService.mRoot.getDisplayContent(mDisplayId); - displayContent.performLayout(false /* initial */, false /* updateInputWindows */); + mDisplayContent.performLayout(false /* initial */, false /* updateInputWindows */); final Rect minimizedHomeBounds = mTargetAppToken != null && mTargetAppToken.inSplitScreenSecondaryWindowingMode() @@ -479,9 +504,8 @@ public class RecentsAnimationController implements DeathRecipient { cancelAnimation(reorderMode, true /* runSynchronously */, false /* screenshot */, reason); } - void cancelAnimationWithScreenShot() { - cancelAnimation(REORDER_KEEP_IN_PLACE, true /* sync */, true /* screenshot */, - "stackOrderChanged"); + void cancelAnimationWithScreenshot(boolean screenshot) { + cancelAnimation(REORDER_KEEP_IN_PLACE, true /* sync */, screenshot, "stackOrderChanged"); } private void cancelAnimation(@ReorderMode int reorderMode, boolean runSynchronously, @@ -495,21 +519,29 @@ public class RecentsAnimationController implements DeathRecipient { } mService.mH.removeCallbacks(mFailsafeRunnable); mCanceled = true; - try { - if (screenshot) { - // Screen shot previous task when next task starts transition. - final Task task = mPendingAnimations.get(0).mTask; - screenshotRecentTask(task, reorderMode, runSynchronously); + + if (screenshot) { + // Screen shot previous task when next task starts transition and notify the runner. + // We will actually finish the animation once the runner calls cleanUpScreenshot(). + final Task task = mPendingAnimations.get(0).mTask; + screenshotRecentTask(task, reorderMode, runSynchronously); + try { mRunner.onAnimationCanceled(true /* deferredWithScreenshot */); - return; + } catch (RemoteException e) { + Slog.e(TAG, "Failed to cancel recents animation", e); + } + } else { + // Otherwise, notify the runner and clean up the animation immediately + // Note: In the fallback case, this can trigger multiple onAnimationCancel() calls + // to the runner if we this actually triggers cancel twice on the caller + try { + mRunner.onAnimationCanceled(false /* deferredWithScreenshot */); + } catch (RemoteException e) { + Slog.e(TAG, "Failed to cancel recents animation", e); } - mRunner.onAnimationCanceled(false /* deferredWithScreenshot */); - } catch (RemoteException e) { - Slog.e(TAG, "Failed to cancel recents animation", e); + mCallbacks.onAnimationFinished(reorderMode, runSynchronously, + false /* sendUserLeaveHint */); } - // Clean up and return to the previous app - mCallbacks.onAnimationFinished(reorderMode, runSynchronously, - false /* sendUserLeaveHint */); } } @@ -522,27 +554,36 @@ public class RecentsAnimationController implements DeathRecipient { * screenshot, so that Launcher can still control the leash lifecycle & make the next app * transition animate smoothly without flickering. */ - void cancelOnNextTransitionStart() { + void setCancelOnNextTransitionStart() { mCancelOnNextTransitionStart = true; } - void setCancelWithDeferredScreenshotLocked(boolean screenshot) { - mCancelWithDeferredScreenshot = screenshot; + /** + * Requests that we attempt to defer the cancel until the next app transition if we are + * canceling from a stack order change. If {@param screenshot} is specified, then the system + * will replace the contents of the leash with a screenshot, which must be cleaned up when the + * runner calls cleanUpScreenshot(). + */ + void setDeferredCancel(boolean defer, boolean screenshot) { + mRequestDeferCancelUntilNextTransition = defer; + mCancelDeferredWithScreenshot = screenshot; } - boolean shouldCancelWithDeferredScreenshot() { - return mCancelWithDeferredScreenshot; + /** + * @return Whether we should defer the cancel from a stack order change until the next app + * transition. + */ + boolean shouldDeferCancelUntilNextTransition() { + return mRequestDeferCancelUntilNextTransition; } - void onTransitionStart() { - if (mCanceled) { - return; - } - - if (mCancelOnNextTransitionStart) { - mCancelOnNextTransitionStart = false; - cancelAnimationWithScreenShot(); - } + /** + * @return Whether we should both defer the cancel from a stack order change until the next + * app transition, and also that the deferred cancel should replace the contents of the leash + * with a screenshot. + */ + boolean shouldDeferCancelWithScreenshot() { + return mRequestDeferCancelUntilNextTransition && mCancelDeferredWithScreenshot; } void screenshotRecentTask(Task task, @ReorderMode int reorderMode, boolean runSynchronously) { @@ -575,6 +616,7 @@ public class RecentsAnimationController implements DeathRecipient { // Clear any pending failsafe runnables mService.mH.removeCallbacks(mFailsafeRunnable); + mDisplayContent.mAppTransition.unregisterListener(mAppTransitionListener); // Clear references to the runner unlinkToDeathOfRunner(); @@ -588,21 +630,22 @@ public class RecentsAnimationController implements DeathRecipient { } // Update the input windows after the animation is complete - final InputMonitor inputMonitor = - mService.mRoot.getDisplayContent(mDisplayId).getInputMonitor(); + final InputMonitor inputMonitor = mDisplayContent.getInputMonitor(); inputMonitor.updateInputWindowsLw(true /*force*/); // We have deferred all notifications to the target app as a part of the recents animation, // so if we are actually transitioning there, notify again here if (mTargetAppToken != null) { if (reorderMode == REORDER_MOVE_TO_TOP || reorderMode == REORDER_KEEP_IN_PLACE) { - mService.mRoot.getDisplayContent(mDisplayId) - .mAppTransition.notifyAppTransitionFinishedLocked(mTargetAppToken.token); + mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked( + mTargetAppToken.token); } } // Notify that the animation has ended - mStatusBar.onRecentsAnimationStateChanged(false /* running */); + if (mStatusBar != null) { + mStatusBar.onRecentsAnimationStateChanged(false /* running */); + } } void scheduleFailsafe() { @@ -629,8 +672,7 @@ public class RecentsAnimationController implements DeathRecipient { synchronized (mService.getWindowManagerLock()) { // Clear associated input consumers on runner death - final InputMonitor inputMonitor = - mService.mRoot.getDisplayContent(mDisplayId).getInputMonitor(); + final InputMonitor inputMonitor = mDisplayContent.getInputMonitor(); inputMonitor.destroyInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION); } } @@ -826,5 +868,11 @@ public class RecentsAnimationController implements DeathRecipient { pw.print(innerPrefix); pw.println("mSplitScreenMinimized=" + mSplitScreenMinimized); pw.print(innerPrefix); pw.println("mTargetAppToken=" + mTargetAppToken); pw.print(innerPrefix); pw.println("isTargetOverWallpaper=" + isTargetOverWallpaper()); + pw.print(innerPrefix); pw.println("mRequestDeferCancelUntilNextTransition=" + + mRequestDeferCancelUntilNextTransition); + pw.print(innerPrefix); pw.println("mCancelOnNextTransitionStart=" + + mCancelOnNextTransitionStart); + pw.print(innerPrefix); pw.println("mCancelDeferredWithScreenshot=" + + mCancelDeferredWithScreenshot); } } diff --git a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java index 6fd802d10e98..0be9736e9d76 100644 --- a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java +++ b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java @@ -937,6 +937,7 @@ class ScreenRotationAnimation { } } + t.setEarlyWakeup(); setSnapshotTransform(t, mSnapshotFinalMatrix, mExitTransformation.getAlpha()); } diff --git a/services/core/java/com/android/server/wm/TaskScreenshotAnimatable.java b/services/core/java/com/android/server/wm/TaskScreenshotAnimatable.java index bb1570e1ecb1..c0877a0a6752 100644 --- a/services/core/java/com/android/server/wm/TaskScreenshotAnimatable.java +++ b/services/core/java/com/android/server/wm/TaskScreenshotAnimatable.java @@ -28,7 +28,7 @@ import android.view.SurfaceSession; * Class used by {@link RecentsAnimationController} to create a surface control with taking * screenshot of task when canceling recents animation. * - * @see {@link RecentsAnimationController#cancelOnNextTransitionStart} + * @see {@link RecentsAnimationController#setCancelOnNextTransitionStart} */ class TaskScreenshotAnimatable implements SurfaceAnimator.Animatable { private static final String TAG = "TaskScreenshotAnim"; diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 3a7cbf8cc06a..133b82f72746 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -1973,6 +1973,11 @@ public final class SystemServer { } traceEnd(); + // Permission policy service + traceBeginAndSlog("StartPermissionPolicyService"); + mSystemServiceManager.startService(PermissionPolicyService.class); + traceEnd(); + traceBeginAndSlog("MakePackageManagerServiceReady"); mPackageManagerService.systemReady(); traceEnd(); @@ -2007,11 +2012,6 @@ public final class SystemServer { mSystemServiceManager.startBootPhase(SystemService.PHASE_DEVICE_SPECIFIC_SERVICES_READY); traceEnd(); - // Permission policy service - traceBeginAndSlog("StartPermissionPolicyService"); - mSystemServiceManager.startService(PermissionPolicyService.class); - traceEnd(); - // These are needed to propagate to the runnable below. final NetworkManagementService networkManagementF = networkManagement; final NetworkStatsService networkStatsF = networkStats; diff --git a/services/robotests/backup/src/com/android/server/backup/keyvalue/KeyValueBackupTaskTest.java b/services/robotests/backup/src/com/android/server/backup/keyvalue/KeyValueBackupTaskTest.java index cc64323e51c7..1d082c735d09 100644 --- a/services/robotests/backup/src/com/android/server/backup/keyvalue/KeyValueBackupTaskTest.java +++ b/services/robotests/backup/src/com/android/server/backup/keyvalue/KeyValueBackupTaskTest.java @@ -94,7 +94,6 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.ParcelFileDescriptor; -import android.os.PowerManager; import android.os.RemoteException; import android.platform.test.annotations.Presubmit; import android.util.Pair; @@ -184,7 +183,7 @@ public class KeyValueBackupTaskTest { private TransportData mTransport; private ShadowLooper mShadowBackupLooper; private Handler mBackupHandler; - private PowerManager.WakeLock mWakeLock; + private UserBackupManagerService.BackupWakeLock mWakeLock; private KeyValueBackupReporter mReporter; private PackageManager mPackageManager; private ShadowPackageManager mShadowPackageManager; diff --git a/services/robotests/backup/src/com/android/server/backup/restore/ActiveRestoreSessionTest.java b/services/robotests/backup/src/com/android/server/backup/restore/ActiveRestoreSessionTest.java index f4cea7ae86a6..3fc421dfb6e9 100644 --- a/services/robotests/backup/src/com/android/server/backup/restore/ActiveRestoreSessionTest.java +++ b/services/robotests/backup/src/com/android/server/backup/restore/ActiveRestoreSessionTest.java @@ -18,7 +18,7 @@ package com.android.server.backup.restore; import static com.android.server.backup.testing.BackupManagerServiceTestUtils.createBackupWakeLock; import static com.android.server.backup.testing.BackupManagerServiceTestUtils.setUpBackupManagerServiceBasics; -import static com.android.server.backup.testing.BackupManagerServiceTestUtils.startBackupThreadAndGetLooper; +import static com.android.server.backup.testing.BackupManagerServiceTestUtils.startBackupThread; import static com.android.server.backup.testing.TestUtils.assertEventLogged; import static com.android.server.backup.testing.TestUtils.assertEventNotLogged; import static com.android.server.backup.testing.TransportData.backupTransport; @@ -44,8 +44,8 @@ import android.app.backup.RestoreSet; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.os.Handler; +import android.os.HandlerThread; import android.os.Looper; -import android.os.PowerManager; import android.os.RemoteException; import android.platform.test.annotations.Presubmit; @@ -98,7 +98,7 @@ public class ActiveRestoreSessionTest { @Mock private IBackupManagerMonitor mMonitor; private ShadowLooper mShadowBackupLooper; private ShadowApplication mShadowApplication; - private PowerManager.WakeLock mWakeLock; + private UserBackupManagerService.BackupWakeLock mWakeLock; private TransportData mTransport; private RestoreSet mRestoreSet1; private RestoreSet mRestoreSet2; @@ -118,7 +118,8 @@ public class ActiveRestoreSessionTest { mShadowPackageManager = shadowOf(application.getPackageManager()); - Looper backupLooper = startBackupThreadAndGetLooper(); + HandlerThread handlerThread = startBackupThread(null); + Looper backupLooper = handlerThread.getLooper(); mShadowBackupLooper = shadowOf(backupLooper); Handler mainHandler = new Handler(Looper.getMainLooper()); @@ -129,7 +130,7 @@ public class ActiveRestoreSessionTest { // We need to mock BMS timeout parameters before initializing the BackupHandler since // the constructor of BackupHandler relies on it. when(mBackupManagerService.getAgentTimeoutParameters()).thenReturn(agentTimeoutParameters); - BackupHandler backupHandler = new BackupHandler(mBackupManagerService, backupLooper); + BackupHandler backupHandler = new BackupHandler(mBackupManagerService, handlerThread); mWakeLock = createBackupWakeLock(application); diff --git a/services/robotests/backup/src/com/android/server/backup/testing/BackupManagerServiceTestUtils.java b/services/robotests/backup/src/com/android/server/backup/testing/BackupManagerServiceTestUtils.java index 47abcc5a2dd1..392d182328a5 100644 --- a/services/robotests/backup/src/com/android/server/backup/testing/BackupManagerServiceTestUtils.java +++ b/services/robotests/backup/src/com/android/server/backup/testing/BackupManagerServiceTestUtils.java @@ -113,7 +113,7 @@ public class BackupManagerServiceTestUtils { TransportManager transportManager, PackageManager packageManager, Handler backupHandler, - PowerManager.WakeLock wakeLock, + UserBackupManagerService.BackupWakeLock wakeLock, BackupAgentTimeoutParameters agentTimeoutParameters) { when(backupManagerService.getContext()).thenReturn(application); @@ -161,10 +161,12 @@ public class BackupManagerServiceTestUtils { }); } - public static PowerManager.WakeLock createBackupWakeLock(Application application) { + public static UserBackupManagerService.BackupWakeLock createBackupWakeLock( + Application application) { PowerManager powerManager = (PowerManager) application.getSystemService(Context.POWER_SERVICE); - return powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "*backup*"); + return new UserBackupManagerService.BackupWakeLock( + powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "*backup*")); } /** diff --git a/services/tests/uiservicestests/src/com/android/server/slice/PinnedSliceStateTest.java b/services/tests/uiservicestests/src/com/android/server/slice/PinnedSliceStateTest.java index f5002ace6690..3b336eb7aec9 100644 --- a/services/tests/uiservicestests/src/com/android/server/slice/PinnedSliceStateTest.java +++ b/services/tests/uiservicestests/src/com/android/server/slice/PinnedSliceStateTest.java @@ -7,10 +7,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -159,4 +161,25 @@ public class PinnedSliceStateTest extends UiServiceTestCase { verify(mSliceService).removePinnedSlice(eq(TEST_URI)); assertFalse(mPinnedSliceManager.hasPinOrListener()); } + + @Test + public void testPinFailed() throws Exception { + // Throw exception when trying to pin + doAnswer(invocation -> { + throw new Exception("Pin failed"); + }).when(mIContentProvider).call( + anyString(), anyString(), anyString(), eq(null), any()); + + TestableLooper.get(this).processAllMessages(); + + // When pinned for the first time, a pinned message should be sent. + mPinnedSliceManager.pin("pkg", FIRST_SPECS, mToken); + TestableLooper.get(this).processAllMessages(); + + verify(mIContentProvider).call(anyString(), anyString(), eq(SliceProvider.METHOD_PIN), + eq(null), argThat(b -> { + assertEquals(TEST_URI, b.getParcelable(SliceProvider.EXTRA_BIND_URI)); + return true; + })); + } } diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java index 26cd63c62cc1..cd292b2494ff 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java @@ -25,6 +25,7 @@ import static android.view.WindowManager.TRANSIT_ACTIVITY_CLOSE; import static com.android.dx.mockito.inline.extended.ExtendedMockito.atLeast; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verifyNoMoreInteractions; @@ -35,10 +36,12 @@ import static com.android.server.wm.RecentsAnimationController.REORDER_MOVE_TO_O import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; import android.os.Binder; @@ -79,6 +82,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { // Hold the lock to protect the stubbing from being accessed by other threads. spyOn(mWm.mRoot); doNothing().when(mWm.mRoot).performSurfacePlacement(anyBoolean()); + doReturn(mDisplayContent).when(mWm.mRoot).getDisplayContent(anyInt()); } when(mMockRunner.asBinder()).thenReturn(new Binder()); mController = new RecentsAnimationController(mWm, mMockRunner, mAnimationCallbacks, @@ -135,7 +139,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { hiddenAppWindow.setHidden(true); mDisplayContent.getConfiguration().windowConfiguration.setRotation( mDisplayContent.getRotation()); - mController.initialize(mDisplayContent, ACTIVITY_TYPE_HOME, new SparseBooleanArray()); + mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray()); // Ensure that we are animating the target activity as well assertTrue(mController.isAnimatingTask(homeAppWindow.getTask())); @@ -144,7 +148,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { } @Test - public void testCancelAnimationWithScreenShot() throws Exception { + public void testDeferCancelAnimation() throws Exception { mWm.setRecentsAnimationController(mController); final AppWindowToken appWindow = createAppWindowToken(mDisplayContent, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD); @@ -156,8 +160,31 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { mController.addAnimation(appWindow.getTask(), false /* isRecentTaskInvisible */); assertTrue(mController.isAnimatingTask(appWindow.getTask())); - mController.setCancelWithDeferredScreenshotLocked(true); - mController.cancelAnimationWithScreenShot(); + mController.setDeferredCancel(true /* deferred */, false /* screenshot */); + mController.cancelAnimationWithScreenshot(false /* screenshot */); + verify(mMockRunner).onAnimationCanceled(false /* deferredWithScreenshot */); + assertNull(mController.mRecentScreenshotAnimator); + + // Simulate the app transition finishing + mController.mAppTransitionListener.onAppTransitionStartingLocked(0, 0, 0, 0); + verify(mAnimationCallbacks).onAnimationFinished(REORDER_KEEP_IN_PLACE, true, false); + } + + @Test + public void testDeferCancelAnimationWithScreenShot() throws Exception { + mWm.setRecentsAnimationController(mController); + final AppWindowToken appWindow = createAppWindowToken(mDisplayContent, + WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD); + final WindowState win1 = createWindow(null, TYPE_BASE_APPLICATION, appWindow, "win1"); + appWindow.addWindow(win1); + assertEquals(appWindow.getTask().getTopVisibleAppToken(), appWindow); + assertEquals(appWindow.findMainWindow(), win1); + + mController.addAnimation(appWindow.getTask(), false /* isRecentTaskInvisible */); + assertTrue(mController.isAnimatingTask(appWindow.getTask())); + + mController.setDeferredCancel(true /* deferred */, true /* screenshot */); + mController.cancelAnimationWithScreenshot(true /* screenshot */); verify(mMockRunner).onAnimationCanceled(true /* deferredWithScreenshot */); assertNotNull(mController.mRecentScreenshotAnimator); assertTrue(mController.mRecentScreenshotAnimator.isAnimating()); @@ -185,7 +212,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { // Assume appWindow transition should animate when no // IRecentsAnimationController#setCancelWithDeferredScreenshot called. - assertFalse(mController.shouldCancelWithDeferredScreenshot()); + assertFalse(mController.shouldDeferCancelWithScreenshot()); assertTrue(appWindow.shouldAnimate(TRANSIT_ACTIVITY_CLOSE)); } diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java index 9630b7d46e3c..0e119e3cc375 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java @@ -274,12 +274,13 @@ public class RecentsAnimationTest extends ActivityTestsBase { // Assume recents animation already started, set a state that cancel recents animation // with screenshot. - doReturn(true).when(mRecentsAnimationController).shouldCancelWithDeferredScreenshot(); + doReturn(true).when(mRecentsAnimationController).shouldDeferCancelUntilNextTransition(); + doReturn(true).when(mRecentsAnimationController).shouldDeferCancelWithScreenshot(); // Start another fullscreen activity. fullscreenStack2.moveToFront("Activity start"); - // Ensure that the recents animation was canceled by cancelOnNextTransitionStart(). - verify(mRecentsAnimationController, times(1)).cancelOnNextTransitionStart(); + // Ensure that the recents animation was canceled by setCancelOnNextTransitionStart(). + verify(mRecentsAnimationController, times(1)).setCancelOnNextTransitionStart(); } @Test @@ -315,7 +316,7 @@ public class RecentsAnimationTest extends ActivityTestsBase { // Ensure that the recents animation was NOT canceled verify(mService.mWindowManager, times(0)).cancelRecentsAnimationSynchronously( eq(REORDER_KEEP_IN_PLACE), any()); - verify(mRecentsAnimationController, times(0)).cancelOnNextTransitionStart(); + verify(mRecentsAnimationController, times(0)).setCancelOnNextTransitionStart(); } @Test diff --git a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java index 94352b21db87..99337565e128 100644 --- a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java +++ b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java @@ -104,8 +104,8 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener { // This is an indirect indication of the microphone being open in some other application. private boolean mServiceDisabled = false; - // Whether we have ANY recognition (keyphrase or generic) running. - private boolean mRecognitionRunning = false; + // Whether ANY recognition (keyphrase or generic) has been requested. + private boolean mRecognitionRequested = false; private PowerSaveModeListener mPowerSaveModeListener; @@ -252,11 +252,6 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener { } } - // Initialize power save, call active state monitoring logic. - if (!mRecognitionRunning) { - initializeTelephonyAndPowerStateListeners(); - } - // If the existing SoundModel is different (for the same UUID for Generic and same // keyphrase ID for voice), ensure that it is unloaded and stopped before proceeding. // This works for both keyphrase and generic models. This logic also ensures that a @@ -326,8 +321,16 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener { modelData.setRecognitionConfig(recognitionConfig); modelData.setSoundModel(soundModel); - return startRecognitionLocked(modelData, + int status = startRecognitionLocked(modelData, false /* Don't notify for synchronous calls */); + + // Initialize power save, call active state monitoring logic. + if (status == STATUS_OK && !mRecognitionRequested) { + initializeTelephonyAndPowerStateListeners(); + mRecognitionRequested = true; + } + + return status; } } @@ -450,7 +453,7 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener { modelData.clearCallback(); modelData.setRecognitionConfig(null); - if (!computeRecognitionRunningLocked()) { + if (!computeRecognitionRequestedLocked()) { internalClearGlobalStateLocked(); } @@ -1196,20 +1199,20 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener { } // Computes whether we have any recognition running at all (voice or generic). Sets - // the mRecognitionRunning variable with the result. - private boolean computeRecognitionRunningLocked() { + // the mRecognitionRequested variable with the result. + private boolean computeRecognitionRequestedLocked() { if (mModuleProperties == null || mModule == null) { - mRecognitionRunning = false; - return mRecognitionRunning; + mRecognitionRequested = false; + return mRecognitionRequested; } for (ModelData modelData : mModelDataMap.values()) { - if (modelData.isModelStarted()) { - mRecognitionRunning = true; - return mRecognitionRunning; + if (modelData.isRequested()) { + mRecognitionRequested = true; + return mRecognitionRequested; } } - mRecognitionRunning = false; - return mRecognitionRunning; + mRecognitionRequested = false; + return mRecognitionRequested; } // This class encapsulates the callbacks, state, handles and any other information that |