From 1e3b5a559faab780cb4b47ae07b5492f7e8f6996 Mon Sep 17 00:00:00 2001 From: James O'Leary Date: Mon, 20 May 2019 23:21:54 -0400 Subject: [PATCH 01/34] Fix NPE with live wallpaper Test: Verify WAI Fixes: 133130262, 133194773, 133168135, 133160573 Change-Id: Ib38947326839a5c4806b909ead2484efd5a535a1 (cherry picked from commit 35cb43b811206def4929128911d658ed415673b3) --- .../src/com/android/systemui/assist/PhoneStateMonitor.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java b/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java index 8c070835f69ed..ea08c335b31d4 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java +++ b/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java @@ -136,7 +136,11 @@ final class PhoneStateMonitor { } private boolean isLauncherShowing(ActivityManager.RunningTaskInfo runningTaskInfo) { - return runningTaskInfo.topActivity.equals(mDefaultHome); + if (runningTaskInfo == null) { + return false; + } else { + return runningTaskInfo.topActivity.equals(mDefaultHome); + } } private boolean isAppImmersive() { From 7e378bc588f913ca53f1e9f2d433b3cc72a67fda Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Wed, 22 May 2019 13:04:12 -0700 Subject: [PATCH 02/34] Temporarily disable retry on bouncer when pattern Bug: 132687980 Test: manual Change-Id: I40c1e6201a6ce2b7bc644a2977f7afe383dd2e35 (cherry picked from commit d5c4ca2e914c0243f517af6114adb1d97055534c) --- .../src/com/android/keyguard/KeyguardSecurityContainer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index 906ace78148e5..eef61dbb0949c 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -269,7 +269,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe mSwipeUpToRetry = mUpdateMonitor.isUnlockWithFacePossible(userId) && securityMode != SecurityMode.SimPin && securityMode != SecurityMode.SimPuk - && securityMode != SecurityMode.None; + && securityMode != SecurityMode.None + && securityMode != SecurityMode.Pattern; } public CharSequence getTitle() { From 260416cfd456cabb26cef8877ea5efe1cf6a04da Mon Sep 17 00:00:00 2001 From: chen xu Date: Tue, 28 May 2019 15:28:37 -0700 Subject: [PATCH 03/34] skip permission check for TelephonyManager API getMmsUserAgent Bug: 133637995 Test: Manual test Change-Id: Ib9f211120c34e9b48c02f990088c32fb307a64f2 (cherry picked from commit 48781653654ff06b5db51ab312fd1f01111d65de) --- .../android/telephony/TelephonyManager.java | 24 ++++++++++++++----- .../internal/telephony/ITelephony.aidl | 10 ++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index d63c37accb37b..2ba34c6c3453a 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -5356,18 +5356,30 @@ public class TelephonyManager { * Returns the MMS user agent. */ public String getMmsUserAgent() { - if (mContext == null) return null; - return SubscriptionManager.getResourcesForSubId(mContext, getSubId()).getString( - com.android.internal.R.string.config_mms_user_agent); + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.getMmsUserAgent(getSubId()); + } + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return null; } /** * Returns the MMS user agent profile URL. */ public String getMmsUAProfUrl() { - if (mContext == null) return null; - return SubscriptionManager.getResourcesForSubId(mContext, getSubId()).getString( - com.android.internal.R.string.config_mms_user_agent_profile_url); + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.getMmsUAProfUrl(getSubId()); + } + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return null; } /** diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 63aded1c4b206..cf1323a328fe4 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -1986,4 +1986,14 @@ interface ITelephony { * outgoing SmsManager operation. */ oneway void enqueueSmsPickResult(String callingPackage, IIntegerConsumer subIdResult); + + /** + * Returns the MMS user agent. + */ + String getMmsUserAgent(int subId); + + /** + * Returns the MMS user agent profile URL. + */ + String getMmsUAProfUrl(int subId); } From 851bfd1c5a1e6a33eec58a17345e126dd6f21a80 Mon Sep 17 00:00:00 2001 From: chen xu Date: Tue, 28 May 2019 15:28:37 -0700 Subject: [PATCH 04/34] skip permission check for TelephonyManager API getMmsUserAgent Bug: 133637995 Test: Manual test Change-Id: Ib9f211120c34e9b48c02f990088c32fb307a64f2 (cherry picked from commit 48781653654ff06b5db51ab312fd1f01111d65de) --- .../android/telephony/TelephonyManager.java | 24 ++++++++++++++----- .../internal/telephony/ITelephony.aidl | 10 ++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index d63c37accb37b..2ba34c6c3453a 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -5356,18 +5356,30 @@ public class TelephonyManager { * Returns the MMS user agent. */ public String getMmsUserAgent() { - if (mContext == null) return null; - return SubscriptionManager.getResourcesForSubId(mContext, getSubId()).getString( - com.android.internal.R.string.config_mms_user_agent); + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.getMmsUserAgent(getSubId()); + } + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return null; } /** * Returns the MMS user agent profile URL. */ public String getMmsUAProfUrl() { - if (mContext == null) return null; - return SubscriptionManager.getResourcesForSubId(mContext, getSubId()).getString( - com.android.internal.R.string.config_mms_user_agent_profile_url); + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.getMmsUAProfUrl(getSubId()); + } + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return null; } /** diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 63aded1c4b206..cf1323a328fe4 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -1986,4 +1986,14 @@ interface ITelephony { * outgoing SmsManager operation. */ oneway void enqueueSmsPickResult(String callingPackage, IIntegerConsumer subIdResult); + + /** + * Returns the MMS user agent. + */ + String getMmsUserAgent(int subId); + + /** + * Returns the MMS user agent profile URL. + */ + String getMmsUAProfUrl(int subId); } From 7d3114012b58a630fda04ba9f22367d974a2426d Mon Sep 17 00:00:00 2001 From: Daniel Chapin Date: Thu, 30 May 2019 19:40:47 +0000 Subject: [PATCH 05/34] Revert "Fix AppFuseMountScope.close()" This reverts commit be9c9900198891e97c228d244c3df064560c4756. Reason for revert: b/134032662 Change-Id: I7132ba078d44ba424bc8a9bf6874f8077738b22d (cherry picked from commit e890b9793b4f0d7d139a5e78a5c46735b2cf04c2) --- .../com/android/server/StorageManagerService.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index d2b992bad4623..2f2b40a7b20f7 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -2842,9 +2842,8 @@ class StorageManagerService extends IStorageManager.Stub } } - /** Not thread safe */ class AppFuseMountScope extends AppFuseBridge.MountScope { - private boolean mMounted = false; + boolean opened = false; public AppFuseMountScope(int uid, int mountId) { super(uid, mountId); @@ -2853,9 +2852,8 @@ class StorageManagerService extends IStorageManager.Stub @Override public ParcelFileDescriptor open() throws NativeDaemonConnectorException { try { - final FileDescriptor fd = mVold.mountAppFuse(uid, mountId); - mMounted = true; - return new ParcelFileDescriptor(fd); + return new ParcelFileDescriptor( + mVold.mountAppFuse(uid, mountId)); } catch (Exception e) { throw new NativeDaemonConnectorException("Failed to mount", e); } @@ -2874,9 +2872,9 @@ class StorageManagerService extends IStorageManager.Stub @Override public void close() throws Exception { - if (mMounted) { + if (opened) { mVold.unmountAppFuse(uid, mountId); - mMounted = false; + opened = false; } } } From dfd70076fb796d14380f2705d6b9336710645595 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Tue, 28 May 2019 17:43:59 -0700 Subject: [PATCH 06/34] Move bypass default value to framework It also needs to be read from Settings Bug: 130327302 Test: make Test: toggle setting on Settings app Change-Id: I46b7e61764e4bc9a07110e4b0b25deb7bc0b88f1 (cherry picked from commit 1b883b4858adc0414f48a89b278b986469cc029e) --- core/res/res/values/config.xml | 3 +++ core/res/res/values/symbols.xml | 1 + packages/SystemUI/res/values/config.xml | 3 --- .../statusbar/phone/KeyguardBypassController.kt | 11 ++++++++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index fb585693c8a5f..483ec376df06c 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -4117,6 +4117,9 @@ + + true + diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index d910be976b988..7563a454b1da7 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2581,6 +2581,7 @@ + diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 19e7b734912af..6039568cab3ac 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -40,9 +40,6 @@ false - - false - 0 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 5b5eb767e184e..5abf39e781f34 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt @@ -17,10 +17,10 @@ package com.android.systemui.statusbar.phone import android.content.Context +import android.hardware.face.FaceManager import android.provider.Settings import com.android.internal.annotations.VisibleForTesting import com.android.keyguard.KeyguardUpdateMonitor -import com.android.systemui.R import com.android.systemui.tuner.TunerService import javax.inject.Inject @@ -32,8 +32,13 @@ class KeyguardBypassController { @Inject constructor(context: Context, tunerService: TunerService) { - val dismissByDefault = if (context.getResources().getBoolean( - R.bool.config_faceAuthDismissesKeyguard)) 1 else 0 + val faceManager = context.getSystemService(FaceManager::class.java) + if (faceManager?.isHardwareDetected != true) { + return + } + + val dismissByDefault = if (context.resources.getBoolean( + com.android.internal.R.bool.config_faceAuthDismissesKeyguard)) 1 else 0 tunerService.addTunable( object : TunerService.Tunable { override fun onTuningChanged(key: String?, newValue: String?) { From 594daca6abf5cee87c9ccb4c79eaadc3f10cb7ad Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Wed, 29 May 2019 17:27:21 -0700 Subject: [PATCH 07/34] Fixed that we could be stuck with notifications pulse expanding We weren't properly reseting the pulse expanding state in the bypass flow Fixes: 133868650 Change-Id: Ibddac4a374f6eec990b11e80a824a02cfdd06f99 (cherry picked from commit 9a7520a393ba1595507863b9750aef7aad643df9) --- .../NotificationWakeUpCoordinator.kt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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 61fc1a3cb38b7..3613f9f3ea5f9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt @@ -147,11 +147,16 @@ class NotificationWakeUpCoordinator @Inject constructor( // Let's notify the scroller that an animation started notifyAnimationStart(mLinearDozeAmount == 1.0f) } + setDozeAmount(linear, eased) + } + + fun setDozeAmount(linear: Float, eased: Float) { + val changed = linear != mLinearDozeAmount mLinearDozeAmount = linear mDozeAmount = eased mStackScroller.setDozeAmount(mDozeAmount) updateDarkAmount() - if (linear == 0.0f) { + if (changed && linear == 0.0f) { setNotificationsVisible(visible = false, animate = false, increaseSpeed = false); setNotificationsVisibleForExpansion(visible = false, animate = false, increaseSpeed = false) @@ -164,16 +169,12 @@ class NotificationWakeUpCoordinator @Inject constructor( private fun updateDozeAmountIfBypass(): Boolean { if (mBypassController.bypassEnabled) { + var amount = 1.0f; if (mStatusBarStateController.state == StatusBarState.SHADE || mStatusBarStateController.state == StatusBarState.SHADE_LOCKED) { - mDozeAmount = 0.0f - mLinearDozeAmount = 0.0f - } else { - mDozeAmount = 1.0f - mLinearDozeAmount = 1.0f + amount = 0.0f; } - updateDarkAmount() - mStackScroller.setDozeAmount(mDozeAmount) + setDozeAmount(amount, amount) return true } return false From 29f0fa5883c4f70a12eac5d9d1710f14816146a6 Mon Sep 17 00:00:00 2001 From: "Philip P. Moltmann" Date: Thu, 30 May 2019 16:21:57 -0700 Subject: [PATCH 08/34] Don't create system fixed, revoked permissions .. when restricting a previously unrestricted permission. Fixes: 134069814 Test: Upgraded from Q (before loc bg was restricted) to Q (after log bg was restricted) and saw previously system-fixed loc bg perm to be re-granted via the DefaultPermissionGrantPolicy. Change-Id: I641a95a0e481ca057c4fb7e05b29b18b7a8c10b6 (cherry picked from commit 6a59bbe2be05c374df96765600f616df8b4c564c) --- .../server/pm/permission/PermissionManagerService.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 267fbf030619f..beb72686d6cee 100644 --- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java +++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java @@ -1173,6 +1173,14 @@ public class PermissionManagerService { } } + 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); } From 9c1e45245c583cbbe02eada97a3447ccfa7e6a75 Mon Sep 17 00:00:00 2001 From: "Philip P. Moltmann" Date: Fri, 31 May 2019 08:48:14 -0700 Subject: [PATCH 09/34] Reset SYSTEM_FIXED flags for hard restricted perms So that incorrectly SYSTEM_FIXED / denied permissions will be able to get regrated via the default permission grant policy This can be removed after all devices have been fixed Test: Got system into the state with SYSTEM_FIXED / denied permission and then silulated an OTA with this change Bug: 134069814 Change-Id: I7bc986f0d3e69dd60a017f16867182163fd6eecb (cherry picked from commit 0891123822d6173686e9772c3265b72c27b2b901) --- .../android/server/pm/permission/PermissionManagerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 beb72686d6cee..81dd868ca8e9b 100644 --- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java +++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java @@ -1173,7 +1173,7 @@ public class PermissionManagerService { } } - if (hardRestricted && !restrictionExempt + if (hardRestricted && (flags & FLAG_PERMISSION_SYSTEM_FIXED) != 0) { // Applying a hard restriction implies revoking it. This might // lead to a system-fixed, revoked permission. From cd564d488230f2f2f6b9671d6515e1a76941d2c0 Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Tue, 4 Jun 2019 03:18:12 +0000 Subject: [PATCH 10/34] Revert "[DO NOT MERGE] Handle config override via settings correctly" This reverts commit aa5ba4f75ff8391ce14f8b357450ca4be98c589c. Reason for revert: Breaks presubmits. Bootloops blueline on qt-dev. Bug: 134445287 Change-Id: I6ad17fa66a1ddc681339966acd007ebd43d7ba3b (cherry picked from commit 69a015931e1d4ccaf4510d9c3f8a82d6c7d20c76) --- .../server/appop/HistoricalRegistry.java | 147 ++++-------------- 1 file changed, 30 insertions(+), 117 deletions(-) diff --git a/services/core/java/com/android/server/appop/HistoricalRegistry.java b/services/core/java/com/android/server/appop/HistoricalRegistry.java index 805cac755fd54..69a1c9f584cb4 100644 --- a/services/core/java/com/android/server/appop/HistoricalRegistry.java +++ b/services/core/java/com/android/server/appop/HistoricalRegistry.java @@ -108,12 +108,6 @@ import java.util.concurrent.TimeUnit; * must be called with the mInMemoryLock, xxxDMLocked suffix means the method * must be called with the mOnDiskLock and mInMemoryLock locks acquired in that * exact order. - *

- * INITIALIZATION: We can initialize persistence only after the system is ready - * as we need to check the optional configuration override from the settings - * database which is not initialized at the time the app ops service is created. - * This means that all entry points that touch persistence should be short - * circuited via isPersistenceInitialized() check. */ // TODO (bug:122218838): Make sure we handle start of epoch time // TODO (bug:122218838): Validate changed time is handled correctly @@ -183,33 +177,14 @@ final class HistoricalRegistry { // Object managing persistence (read/write) @GuardedBy("mOnDiskLock") - private Persistence mPersistence; + private Persistence mPersistence = new Persistence(mBaseSnapshotInterval, + mIntervalCompressionMultiplier); HistoricalRegistry(@NonNull Object lock) { mInMemoryLock = lock; - } - - void systemReady(@NonNull ContentResolver resolver) { - final Uri uri = Settings.Global.getUriFor(Settings.Global.APPOP_HISTORY_PARAMETERS); - resolver.registerContentObserver(uri, false, new ContentObserver( - FgThread.getHandler()) { - @Override - public void onChange(boolean selfChange) { - updateParametersFromSetting(resolver); - } - }); - - updateParametersFromSetting(resolver); - - synchronized (mOnDiskLock) { - synchronized (mInMemoryLock) { - if (mMode != AppOpsManager.HISTORICAL_MODE_DISABLED) { - // Can be uninitialized if there is no config in the settings table. - if (!isPersistenceInitializedMLocked()) { - mPersistence = new Persistence(mBaseSnapshotInterval, - mIntervalCompressionMultiplier); - } - + if (mMode != AppOpsManager.HISTORICAL_MODE_DISABLED) { + synchronized (mOnDiskLock) { + synchronized (mInMemoryLock) { // When starting always adjust history to now. final long lastPersistTimeMills = mPersistence.getLastPersistTimeMillisDLocked(); @@ -222,8 +197,16 @@ final class HistoricalRegistry { } } - private boolean isPersistenceInitializedMLocked() { - return mPersistence != null; + void systemReady(@NonNull ContentResolver resolver) { + updateParametersFromSetting(resolver); + final Uri uri = Settings.Global.getUriFor(Settings.Global.APPOP_HISTORY_PARAMETERS); + resolver.registerContentObserver(uri, false, new ContentObserver( + FgThread.getHandler()) { + @Override + public void onChange(boolean selfChange) { + updateParametersFromSetting(resolver); + } + }); } private void updateParametersFromSetting(@NonNull ContentResolver resolver) { @@ -291,11 +274,6 @@ final class HistoricalRegistry { makeRelativeToEpochStart(currentOps, nowMillis); currentOps.accept(visitor); - if(isPersistenceInitializedMLocked()) { - Slog.e(LOG_TAG, "Interaction before persistence initialized"); - return; - } - final List ops = mPersistence.readHistoryDLocked(); if (ops != null) { // TODO (bug:122218838): Make sure this is properly dumped @@ -324,21 +302,12 @@ final class HistoricalRegistry { void getHistoricalOpsFromDiskRaw(int uid, @NonNull String packageName, @Nullable String[] opNames, long beginTimeMillis, long endTimeMillis, @OpFlags int flags, @NonNull RemoteCallback callback) { - synchronized (mOnDiskLock) { - synchronized (mInMemoryLock) { - if (!isPersistenceInitializedMLocked()) { - Slog.e(LOG_TAG, "Interaction before persistence initialized"); - callback.sendResult(new Bundle()); - return; - } - final HistoricalOps result = new HistoricalOps(beginTimeMillis, endTimeMillis); - mPersistence.collectHistoricalOpsDLocked(result, uid, packageName, opNames, - beginTimeMillis, endTimeMillis, flags); - final Bundle payload = new Bundle(); - payload.putParcelable(AppOpsManager.KEY_HISTORICAL_OPS, result); - callback.sendResult(payload); - } - } + final HistoricalOps result = new HistoricalOps(beginTimeMillis, endTimeMillis); + mPersistence.collectHistoricalOpsDLocked(result, uid, packageName, opNames, + beginTimeMillis, endTimeMillis, flags); + final Bundle payload = new Bundle(); + payload.putParcelable(AppOpsManager.KEY_HISTORICAL_OPS, result); + callback.sendResult(payload); } void getHistoricalOps(int uid, @NonNull String packageName, @@ -362,12 +331,6 @@ final class HistoricalRegistry { boolean collectOpsFromDisk; synchronized (mInMemoryLock) { - if (!isPersistenceInitializedMLocked()) { - Slog.e(LOG_TAG, "Interaction before persistence initialized"); - callback.sendResult(new Bundle()); - return; - } - currentOps = getUpdatedPendingHistoricalOpsMLocked(currentTimeMillis); if (!(inMemoryAdjBeginTimeMillis >= currentOps.getEndTimeMillis() || inMemoryAdjEndTimeMillis <= currentOps.getBeginTimeMillis())) { @@ -411,10 +374,6 @@ final class HistoricalRegistry { @UidState int uidState, @OpFlags int flags) { synchronized (mInMemoryLock) { if (mMode == AppOpsManager.HISTORICAL_MODE_ENABLED_ACTIVE) { - if (!isPersistenceInitializedMLocked()) { - Slog.e(LOG_TAG, "Interaction before persistence initialized"); - return; - } getUpdatedPendingHistoricalOpsMLocked(System.currentTimeMillis()) .increaseAccessCount(op, uid, packageName, uidState, flags, 1); } @@ -425,10 +384,6 @@ final class HistoricalRegistry { @UidState int uidState, @OpFlags int flags) { synchronized (mInMemoryLock) { if (mMode == AppOpsManager.HISTORICAL_MODE_ENABLED_ACTIVE) { - if (!isPersistenceInitializedMLocked()) { - Slog.e(LOG_TAG, "Interaction before persistence initialized"); - return; - } getUpdatedPendingHistoricalOpsMLocked(System.currentTimeMillis()) .increaseRejectCount(op, uid, packageName, uidState, flags, 1); } @@ -439,10 +394,6 @@ final class HistoricalRegistry { @UidState int uidState, @OpFlags int flags, long increment) { synchronized (mInMemoryLock) { if (mMode == AppOpsManager.HISTORICAL_MODE_ENABLED_ACTIVE) { - if (!isPersistenceInitializedMLocked()) { - Slog.e(LOG_TAG, "Interaction before persistence initialized"); - return; - } getUpdatedPendingHistoricalOpsMLocked(System.currentTimeMillis()) .increaseAccessDuration(op, uid, packageName, uidState, flags, increment); } @@ -453,8 +404,6 @@ final class HistoricalRegistry { long baseSnapshotInterval, long intervalCompressionMultiplier) { synchronized (mOnDiskLock) { synchronized (mInMemoryLock) { - // NOTE: We allow this call if persistence is not initialized as - // it is a part of the persistence initialization process. boolean resampleHistory = false; Slog.i(LOG_TAG, "New history parameters: mode:" + AppOpsManager.historicalModeToString(mMode) + " baseSnapshotInterval:" @@ -463,7 +412,7 @@ final class HistoricalRegistry { if (mMode != mode) { mMode = mode; if (mMode == AppOpsManager.HISTORICAL_MODE_DISABLED) { - clearHistoryOnDiskDLocked(); + clearHistoryOnDiskLocked(); } } if (mBaseSnapshotInterval != baseSnapshotInterval) { @@ -484,10 +433,6 @@ final class HistoricalRegistry { void offsetHistory(long offsetMillis) { synchronized (mOnDiskLock) { synchronized (mInMemoryLock) { - if (!isPersistenceInitializedMLocked()) { - Slog.e(LOG_TAG, "Interaction before persistence initialized"); - return; - } final List history = mPersistence.readHistoryDLocked(); clearHistory(); if (history != null) { @@ -508,10 +453,6 @@ final class HistoricalRegistry { void addHistoricalOps(HistoricalOps ops) { final List pendingWrites; synchronized (mInMemoryLock) { - if (!isPersistenceInitializedMLocked()) { - Slog.e(LOG_TAG, "Interaction before persistence initialized"); - return; - } // The history files start from mBaseSnapshotInterval - take this into account. ops.offsetBeginAndEndTime(mBaseSnapshotInterval); mPendingWrites.offerFirst(ops); @@ -527,10 +468,6 @@ final class HistoricalRegistry { } void resetHistoryParameters() { - if (!isPersistenceInitializedMLocked()) { - Slog.e(LOG_TAG, "Interaction before persistence initialized"); - return; - } setHistoryParameters(DEFAULT_MODE, DEFAULT_SNAPSHOT_INTERVAL_MILLIS, DEFAULT_COMPRESSION_STEP); } @@ -538,10 +475,6 @@ final class HistoricalRegistry { void clearHistory(int uid, String packageName) { synchronized (mOnDiskLock) { synchronized (mInMemoryLock) { - if (!isPersistenceInitializedMLocked()) { - Slog.e(LOG_TAG, "Interaction before persistence initialized"); - return; - } if (mMode != AppOpsManager.HISTORICAL_MODE_ENABLED_ACTIVE) { return; } @@ -560,17 +493,11 @@ final class HistoricalRegistry { void clearHistory() { synchronized (mOnDiskLock) { - synchronized (mInMemoryLock) { - if (!isPersistenceInitializedMLocked()) { - Slog.e(LOG_TAG, "Interaction before persistence initialized"); - return; - } - clearHistoryOnDiskDLocked(); - } + clearHistoryOnDiskLocked(); } } - private void clearHistoryOnDiskDLocked() { + private void clearHistoryOnDiskLocked() { BackgroundThread.getHandler().removeMessages(MSG_WRITE_PENDING_HISTORY); synchronized (mInMemoryLock) { mCurrentHistoricalOps = null; @@ -791,27 +718,13 @@ final class HistoricalRegistry { baseDir = mHistoricalAppOpsDir.startRead(); final File[] files = baseDir.listFiles(); if (files != null && files.length > 0) { - File shortestFile = null; - for (File candidate : files) { - final String candidateName = candidate.getName(); - if (!candidateName.endsWith(HISTORY_FILE_SUFFIX)) { - continue; + final Set historyFiles = new ArraySet<>(); + Collections.addAll(historyFiles, files); + for (int i = 0;; i++) { + final File file = generateFile(baseDir, i); + if (historyFiles.contains(file)) { + return file.lastModified(); } - if (shortestFile == null) { - shortestFile = candidate; - } else if (candidateName.length() < shortestFile.getName().length()) { - shortestFile = candidate; - } - } - if (shortestFile == null) { - return 0; - } - final String shortestNameNoExtension = shortestFile.getName() - .replace(HISTORY_FILE_SUFFIX, ""); - try { - return Long.parseLong(shortestNameNoExtension); - } catch (NumberFormatException e) { - return 0; } } mHistoricalAppOpsDir.finishRead(); From 95cbc93ab951477d241c00ba1e90066d01891b22 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Tue, 4 Jun 2019 13:44:14 +0000 Subject: [PATCH 11/34] Revert "Collect NeededUriGrants without holding locks." This reverts commit 344ce7ce703f806f50ea253047d6dbbb10eaa424. Bug: 115619667 Bug: 134494852 Reason for revert: Causes "Permission Denial: opening provider" error Change-Id: I9986618b6e338fef9843b2103da6a728a36c6ea6 (cherry picked from commit 586a8ee7864d0530a3a0b6eb6079f8ab1e72128d) --- .../server/uri/UriGrantsManagerInternal.java | 4 +- .../server/uri/UriGrantsManagerService.java | 19 ++- .../com/android/server/wm/ActivityRecord.java | 8 +- .../com/android/server/wm/ActivityStack.java | 96 ++++++++------- .../server/wm/ActivityStackSupervisor.java | 24 ++-- .../server/wm/ActivityStartController.java | 2 +- .../android/server/wm/ActivityStarter.java | 110 ++++-------------- .../server/wm/ActivityTaskManagerService.java | 53 +++------ .../com/android/server/wm/TaskRecord.java | 10 +- .../server/wm/WindowProcessController.java | 2 +- .../android/server/wm/ActivityStackTests.java | 3 +- .../wm/ActivityStartControllerTests.java | 4 +- 12 files changed, 114 insertions(+), 221 deletions(-) diff --git a/services/core/java/com/android/server/uri/UriGrantsManagerInternal.java b/services/core/java/com/android/server/uri/UriGrantsManagerInternal.java index 94a1baa49deb1..2f50fcb08c02c 100644 --- a/services/core/java/com/android/server/uri/UriGrantsManagerInternal.java +++ b/services/core/java/com/android/server/uri/UriGrantsManagerInternal.java @@ -43,14 +43,14 @@ public interface UriGrantsManagerInternal { int callingUid, String targetPkg, Uri uri, int modeFlags, int userId); NeededUriGrants checkGrantUriPermissionFromIntent(int callingUid, String targetPkg, Intent intent, int mode, NeededUriGrants needed, int targetUserId); - NeededUriGrants checkGrantUriPermissionFromIntent(int callingUid, - Intent intent, String targetPkg, int targetUserId); /** * Grant Uri permissions from one app to another. This method only extends * permission grants if {@code callingUid} has permission to them. */ void grantUriPermissionFromIntent(int callingUid, String targetPkg, Intent intent, int targetUserId); + void grantUriPermissionFromIntent(int callingUid, + String targetPkg, Intent intent, UriPermissionOwner owner, int targetUserId); void grantUriPermissionUncheckedFromIntent( NeededUriGrants needed, UriPermissionOwner owner); IBinder newUriPermissionOwner(String name); diff --git a/services/core/java/com/android/server/uri/UriGrantsManagerService.java b/services/core/java/com/android/server/uri/UriGrantsManagerService.java index 04f7c7ee8574e..8b332d271a3a0 100644 --- a/services/core/java/com/android/server/uri/UriGrantsManagerService.java +++ b/services/core/java/com/android/server/uri/UriGrantsManagerService.java @@ -1361,16 +1361,6 @@ public class UriGrantsManagerService extends IUriGrantsManager.Stub { } } - @Override - public NeededUriGrants checkGrantUriPermissionFromIntent(int callingUid, Intent intent, - String targetPkg, int targetUserId) { - synchronized (mLock) { - final int mode = (intent != null) ? intent.getFlags() : 0; - return UriGrantsManagerService.this.checkGrantUriPermissionFromIntent( - callingUid, targetPkg, intent, mode, null, targetUserId); - } - } - @Override public void grantUriPermissionFromIntent(int callingUid, String targetPkg, Intent intent, int targetUserId) { @@ -1380,6 +1370,15 @@ public class UriGrantsManagerService extends IUriGrantsManager.Stub { } } + @Override + public void grantUriPermissionFromIntent(int callingUid, String targetPkg, Intent intent, + UriPermissionOwner owner, int targetUserId) { + synchronized (mLock) { + UriGrantsManagerService.this.grantUriPermissionFromIntent( + callingUid, targetPkg, intent, owner, targetUserId); + } + } + @Override public void grantUriPermissionUncheckedFromIntent(NeededUriGrants needed, UriPermissionOwner owner) { diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 7c4b5711cbe6b..1344727ab36da 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -215,7 +215,6 @@ import com.android.server.AttributeCache; import com.android.server.AttributeCache.Entry; import com.android.server.am.AppTimeTracker; import com.android.server.am.PendingIntentRecord; -import com.android.server.uri.NeededUriGrants; import com.android.server.uri.UriPermissionOwner; import com.android.server.wm.ActivityMetricsLogger.WindowingModeTransitionInfoSnapshot; import com.android.server.wm.ActivityStack.ActivityState; @@ -1600,11 +1599,10 @@ final class ActivityRecord extends ConfigurationContainer { * Deliver a new Intent to an existing activity, so that its onNewIntent() * method will be called at the proper time. */ - final void deliverNewIntentLocked(int callingUid, Intent intent, NeededUriGrants intentGrants, - String referrer) { + final void deliverNewIntentLocked(int callingUid, Intent intent, String referrer) { // The activity now gets access to the data associated with this Intent. - mAtmService.mUgmInternal.grantUriPermissionUncheckedFromIntent(intentGrants, - getUriPermissionsLocked()); + mAtmService.mUgmInternal.grantUriPermissionFromIntent(callingUid, packageName, + intent, getUriPermissionsLocked(), mUserId); final ReferrerIntent rintent = new ReferrerIntent(intent, referrer); boolean unsent = true; final boolean isTopActivityWhileSleeping = isTopRunningActivity() && isSleeping(); diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index 94c4a61e4159b..b3b6efed1a375 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -163,7 +163,6 @@ import com.android.server.am.ActivityManagerService.ItemMatcher; import com.android.server.am.AppTimeTracker; import com.android.server.am.EventLogTags; import com.android.server.am.PendingIntentRecord; -import com.android.server.uri.NeededUriGrants; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -2782,7 +2781,7 @@ class ActivityStack extends ConfigurationContainer { if (DEBUG_STATES) Slog.d(TAG_STATES, "no-history finish of " + mLastNoHistoryActivity + " on new resume"); requestFinishActivityLocked(mLastNoHistoryActivity.appToken, Activity.RESULT_CANCELED, - null, null, "resume-no-history", false); + null, "resume-no-history", false); mLastNoHistoryActivity = null; } @@ -3016,7 +3015,7 @@ class ActivityStack extends ConfigurationContainer { // If any exception gets thrown, toss away this // activity and try the next one. Slog.w(TAG, "Exception thrown during resume of " + next, e); - requestFinishActivityLocked(next.appToken, Activity.RESULT_CANCELED, null, null, + requestFinishActivityLocked(next.appToken, Activity.RESULT_CANCELED, null, "resume-exception", true); return true; } @@ -3426,7 +3425,7 @@ class ActivityStack extends ConfigurationContainer { if (DEBUG_TASKS) Slog.w(TAG_TASKS, "resetTaskIntendedTask: calling finishActivity on " + p); if (finishActivityLocked( - p, Activity.RESULT_CANCELED, null, null, "reset-task", false)) { + p, Activity.RESULT_CANCELED, null, "reset-task", false)) { end--; srcPos--; } @@ -3505,7 +3504,7 @@ class ActivityStack extends ConfigurationContainer { continue; } finishActivityLocked( - p, Activity.RESULT_CANCELED, null, null, "move-affinity", false); + p, Activity.RESULT_CANCELED, null, "move-affinity", false); } } else { if (taskInsertionPoint < 0) { @@ -3539,8 +3538,8 @@ class ActivityStack extends ConfigurationContainer { if (targetNdx > 0) { ActivityRecord p = taskActivities.get(targetNdx - 1); if (p.intent.getComponent().equals(target.intent.getComponent())) { - finishActivityLocked(p, Activity.RESULT_CANCELED, null, null, - "replace", false); + finishActivityLocked(p, Activity.RESULT_CANCELED, null, "replace", + false); } } } @@ -3600,21 +3599,22 @@ class ActivityStack extends ConfigurationContainer { return taskTop; } - void sendActivityResultLocked(int callingUid, ActivityRecord r, String resultWho, - int requestCode, int resultCode, Intent resultData, NeededUriGrants resultGrants) { + void sendActivityResultLocked(int callingUid, ActivityRecord r, + String resultWho, int requestCode, int resultCode, Intent data) { + if (callingUid > 0) { - mService.mUgmInternal.grantUriPermissionUncheckedFromIntent(resultGrants, - r.getUriPermissionsLocked()); + mService.mUgmInternal.grantUriPermissionFromIntent(callingUid, r.packageName, + data, r.getUriPermissionsLocked(), r.mUserId); } if (DEBUG_RESULTS) Slog.v(TAG, "Send activity result to " + r + " : who=" + resultWho + " req=" + requestCode - + " res=" + resultCode + " data=" + resultData); + + " res=" + resultCode + " data=" + data); if (mResumedActivity == r && r.attachedToProcess()) { try { ArrayList list = new ArrayList(); list.add(new ResultInfo(resultWho, requestCode, - resultCode, resultData)); + resultCode, data)); mService.getLifecycleManager().scheduleTransaction(r.app.getThread(), r.appToken, ActivityResultItem.obtain(list)); return; @@ -3623,7 +3623,7 @@ class ActivityStack extends ConfigurationContainer { } } - r.addResultLocked(null, resultWho, requestCode, resultCode, resultData); + r.addResultLocked(null, resultWho, requestCode, resultCode, data); } /** Returns true if the task is one of the task finishing on-top of the top running task. */ @@ -3730,8 +3730,8 @@ class ActivityStack extends ConfigurationContainer { if (!r.finishing) { if (!shouldSleepActivities()) { if (DEBUG_STATES) Slog.d(TAG_STATES, "no-history finish of " + r); - if (requestFinishActivityLocked(r.appToken, Activity.RESULT_CANCELED, - null, null, "stop-no-history", false)) { + if (requestFinishActivityLocked(r.appToken, Activity.RESULT_CANCELED, null, + "stop-no-history", false)) { // If {@link requestFinishActivityLocked} returns {@code true}, // {@link adjustFocusedActivityStack} would have been already called. r.resumeKeyDispatchingLocked(); @@ -3787,7 +3787,7 @@ class ActivityStack extends ConfigurationContainer { * some reason it is being left as-is. */ final boolean requestFinishActivityLocked(IBinder token, int resultCode, - Intent resultData, NeededUriGrants resultGrants, String reason, boolean oomAdj) { + Intent resultData, String reason, boolean oomAdj) { ActivityRecord r = isInStackLocked(token); if (DEBUG_RESULTS || DEBUG_STATES) Slog.v(TAG_STATES, "Finishing activity token=" + token + " r=" @@ -3797,7 +3797,7 @@ class ActivityStack extends ConfigurationContainer { return false; } - finishActivityLocked(r, resultCode, resultData, resultGrants, reason, oomAdj); + finishActivityLocked(r, resultCode, resultData, reason, oomAdj); return true; } @@ -3809,8 +3809,8 @@ class ActivityStack extends ConfigurationContainer { if (r.resultTo == self && r.requestCode == requestCode) { if ((r.resultWho == null && resultWho == null) || (r.resultWho != null && r.resultWho.equals(resultWho))) { - finishActivityLocked(r, Activity.RESULT_CANCELED, null, null, - "request-sub", false); + finishActivityLocked(r, Activity.RESULT_CANCELED, null, "request-sub", + false); } } } @@ -3840,7 +3840,7 @@ class ActivityStack extends ConfigurationContainer { int activityNdx = task.mActivities.indexOf(r); getDisplay().mDisplayContent.prepareAppTransition( TRANSIT_CRASHING_ACTIVITY_CLOSE, false /* alwaysKeepCurrent */); - finishActivityLocked(r, Activity.RESULT_CANCELED, null, null, reason, false); + finishActivityLocked(r, Activity.RESULT_CANCELED, null, reason, false); finishedTask = task; // Also terminate any activities below it that aren't yet // stopped, to avoid a situation where one will get @@ -3861,7 +3861,7 @@ class ActivityStack extends ConfigurationContainer { if (!r.isActivityTypeHome() || mService.mHomeProcess != r.app) { Slog.w(TAG, " Force finishing activity " + r.intent.getComponent().flattenToShortString()); - finishActivityLocked(r, Activity.RESULT_CANCELED, null, null, reason, false); + finishActivityLocked(r, Activity.RESULT_CANCELED, null, reason, false); } } } @@ -3877,8 +3877,8 @@ class ActivityStack extends ConfigurationContainer { for (int activityNdx = tr.mActivities.size() - 1; activityNdx >= 0; --activityNdx) { ActivityRecord r = tr.mActivities.get(activityNdx); if (!r.finishing) { - finishActivityLocked(r, Activity.RESULT_CANCELED, null, null, - "finish-voice", false); + finishActivityLocked(r, Activity.RESULT_CANCELED, null, "finish-voice", + false); didOne = true; } } @@ -3914,14 +3914,12 @@ class ActivityStack extends ConfigurationContainer { if (!Objects.equals(cur.taskAffinity, r.taskAffinity)) { break; } - finishActivityLocked(cur, Activity.RESULT_CANCELED, null, null, - "request-affinity", true); + finishActivityLocked(cur, Activity.RESULT_CANCELED, null, "request-affinity", true); } return true; } - private void finishActivityResultsLocked(ActivityRecord r, int resultCode, Intent resultData, - NeededUriGrants resultGrants) { + private void finishActivityResultsLocked(ActivityRecord r, int resultCode, Intent resultData) { // send the result ActivityRecord resultTo = r.resultTo; if (resultTo != null) { @@ -3934,8 +3932,9 @@ class ActivityStack extends ConfigurationContainer { } } if (r.info.applicationInfo.uid > 0) { - mService.mUgmInternal.grantUriPermissionUncheckedFromIntent(resultGrants, - resultTo.getUriPermissionsLocked()); + mService.mUgmInternal.grantUriPermissionFromIntent(r.info.applicationInfo.uid, + resultTo.packageName, resultData, + resultTo.getUriPermissionsLocked(), resultTo.mUserId); } resultTo.addResultLocked(r, r.resultWho, r.requestCode, resultCode, resultData); r.resultTo = null; @@ -3951,10 +3950,12 @@ class ActivityStack extends ConfigurationContainer { r.icicle = null; } + /** + * See {@link #finishActivityLocked(ActivityRecord, int, Intent, String, boolean, boolean)} + */ final boolean finishActivityLocked(ActivityRecord r, int resultCode, Intent resultData, - NeededUriGrants resultGrants, String reason, boolean oomAdj) { - return finishActivityLocked(r, resultCode, resultData, resultGrants, reason, oomAdj, - !PAUSE_IMMEDIATELY); + String reason, boolean oomAdj) { + return finishActivityLocked(r, resultCode, resultData, reason, oomAdj, !PAUSE_IMMEDIATELY); } /** @@ -3962,7 +3963,7 @@ class ActivityStack extends ConfigurationContainer { * list, or false if it is still in the list and will be removed later. */ final boolean finishActivityLocked(ActivityRecord r, int resultCode, Intent resultData, - NeededUriGrants resultGrants, String reason, boolean oomAdj, boolean pauseImmediately) { + String reason, boolean oomAdj, boolean pauseImmediately) { if (r.finishing) { Slog.w(TAG, "Duplicate finish request for " + r); return false; @@ -3992,7 +3993,7 @@ class ActivityStack extends ConfigurationContainer { adjustFocusedActivityStack(r, "finishActivity"); - finishActivityResultsLocked(r, resultCode, resultData, resultGrants); + finishActivityResultsLocked(r, resultCode, resultData); final boolean endTask = index <= 0 && !task.isClearingToReuseTask(); final int transit = endTask ? TRANSIT_TASK_CLOSE : TRANSIT_ACTIVITY_CLOSE; @@ -4225,9 +4226,8 @@ class ActivityStack extends ConfigurationContainer { return false; } - final boolean navigateUpToLocked(ActivityRecord srec, Intent destIntent, - NeededUriGrants destGrants, int resultCode, Intent resultData, - NeededUriGrants resultGrants) { + final boolean navigateUpToLocked(ActivityRecord srec, Intent destIntent, int resultCode, + Intent resultData) { final TaskRecord task = srec.getTaskRecord(); final ArrayList activities = task.mActivities; final int start = activities.indexOf(srec); @@ -4274,8 +4274,7 @@ class ActivityStack extends ConfigurationContainer { final long origId = Binder.clearCallingIdentity(); for (int i = start; i > finishTo; i--) { ActivityRecord r = activities.get(i); - requestFinishActivityLocked(r.appToken, resultCode, resultData, resultGrants, - "navigate-up", true); + requestFinishActivityLocked(r.appToken, resultCode, resultData, "navigate-up", true); // Only return the supplied result for the first activity finished resultCode = Activity.RESULT_CANCELED; resultData = null; @@ -4289,7 +4288,7 @@ class ActivityStack extends ConfigurationContainer { parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TOP || (destIntentFlags & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) { parent.deliverNewIntentLocked(srec.info.applicationInfo.uid, destIntent, - destGrants, srec.packageName); + srec.packageName); } else { try { ActivityInfo aInfo = AppGlobals.getPackageManager().getActivityInfo( @@ -4313,7 +4312,7 @@ class ActivityStack extends ConfigurationContainer { foundParentInTask = false; } requestFinishActivityLocked(parent.appToken, resultCode, - resultData, resultGrants, "navigate-top", true); + resultData, "navigate-top", true); } } Binder.restoreCallingIdentity(origId); @@ -4398,7 +4397,7 @@ class ActivityStack extends ConfigurationContainer { } private void removeActivityFromHistoryLocked(ActivityRecord r, String reason) { - finishActivityResultsLocked(r, Activity.RESULT_CANCELED, null, null); + finishActivityResultsLocked(r, Activity.RESULT_CANCELED, null); r.makeFinishingLocked(); if (DEBUG_ADD_REMOVE) Slog.i(TAG_ADD_REMOVE, "Removing activity " + r + " from stack callers=" + Debug.getCallers(5)); @@ -5130,8 +5129,7 @@ class ActivityStack extends ConfigurationContainer { for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) { final ActivityRecord r = activities.get(activityNdx); if ((r.info.flags&ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS) != 0) { - finishActivityLocked(r, Activity.RESULT_CANCELED, null, null, - "close-sys", true); + finishActivityLocked(r, Activity.RESULT_CANCELED, null, "close-sys", true); } } } @@ -5175,8 +5173,8 @@ class ActivityStack extends ConfigurationContainer { didSomething = true; Slog.i(TAG, " Force finishing activity " + r); lastTask = r.getTaskRecord(); - finishActivityLocked(r, Activity.RESULT_CANCELED, null, null, - "force-stop", true); + finishActivityLocked(r, Activity.RESULT_CANCELED, null, "force-stop", + true); } } } @@ -5230,8 +5228,8 @@ class ActivityStack extends ConfigurationContainer { final ArrayList activities = mTaskHistory.get(top).mActivities; int activityTop = activities.size() - 1; if (activityTop >= 0) { - finishActivityLocked(activities.get(activityTop), Activity.RESULT_CANCELED, - null, null, "unhandled-back", true); + finishActivityLocked(activities.get(activityTop), Activity.RESULT_CANCELED, null, + "unhandled-back", true); } } } diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java index 8d2a92acc91fd..c992a69c2ecb5 100644 --- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java @@ -140,7 +140,6 @@ import com.android.internal.util.function.pooled.PooledLambda; import com.android.server.am.ActivityManagerService; import com.android.server.am.EventLogTags; import com.android.server.am.UserState; -import com.android.server.uri.NeededUriGrants; import java.io.FileDescriptor; import java.io.IOException; @@ -404,17 +403,14 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { final int startFlags; final ActivityStack stack; final WindowProcessController callerApp; - final NeededUriGrants neededGrants; - PendingActivityLaunch(ActivityRecord r, ActivityRecord sourceRecord, - int startFlags, ActivityStack stack, WindowProcessController callerApp, - NeededUriGrants neededGrants) { - this.r = r; - this.sourceRecord = sourceRecord; - this.startFlags = startFlags; - this.stack = stack; - this.callerApp = callerApp; - this.neededGrants = neededGrants; + PendingActivityLaunch(ActivityRecord _r, ActivityRecord _sourceRecord, + int _startFlags, ActivityStack _stack, WindowProcessController app) { + r = _r; + sourceRecord = _sourceRecord; + startFlags = _startFlags; + stack = _stack; + callerApp = app; } void sendErrorResult(String message) { @@ -878,8 +874,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { Slog.e(TAG, "Second failure launching " + r.intent.getComponent().flattenToShortString() + ", giving up", e); proc.appDied(); - stack.requestFinishActivityLocked(r.appToken, Activity.RESULT_CANCELED, - null, null, "2nd-crash", false); + stack.requestFinishActivityLocked(r.appToken, Activity.RESULT_CANCELED, null, + "2nd-crash", false); return false; } @@ -1024,7 +1020,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks { if (resultRecord != null) { resultStack.sendActivityResultLocked(-1, resultRecord, resultWho, requestCode, - Activity.RESULT_CANCELED, null, null); + Activity.RESULT_CANCELED, null); } final String msg; if (actionRestriction == ACTIVITY_RESTRICTION_PERMISSION) { diff --git a/services/core/java/com/android/server/wm/ActivityStartController.java b/services/core/java/com/android/server/wm/ActivityStartController.java index 738d143280d99..919141c136226 100644 --- a/services/core/java/com/android/server/wm/ActivityStartController.java +++ b/services/core/java/com/android/server/wm/ActivityStartController.java @@ -462,7 +462,7 @@ public class ActivityStartController { "pendingActivityLaunch"); try { starter.startResolvedActivity(pal.r, pal.sourceRecord, null, null, pal.startFlags, - resume, pal.r.pendingOptions, null, pal.neededGrants); + resume, pal.r.pendingOptions, null); } catch (Exception e) { Slog.e(TAG, "Exception during pending activity launch pal=" + pal, e); pal.sendErrorResult(e.getMessage()); diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index fb18569ba637b..1718ac634b101 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -127,7 +127,6 @@ import com.android.internal.app.IVoiceInteractor; import com.android.server.am.EventLogTags; import com.android.server.am.PendingIntentRecord; import com.android.server.pm.InstantAppResolver; -import com.android.server.uri.NeededUriGrants; import com.android.server.wm.ActivityStackSupervisor.PendingActivityLaunch; import com.android.server.wm.LaunchParamsController.LaunchParams; @@ -550,8 +549,7 @@ class ActivityStarter { */ int startResolvedActivity(final ActivityRecord r, ActivityRecord sourceRecord, IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor, - int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask, - NeededUriGrants neededGrants) { + int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask) { try { mSupervisor.getActivityMetricsLogger().notifyActivityLaunching(r.intent); mLastStartReason = "startResolvedActivity"; @@ -559,7 +557,7 @@ class ActivityStarter { mLastStartActivityRecord[0] = r; mLastStartActivityResult = startActivity(r, sourceRecord, voiceSession, voiceInteractor, startFlags, doResume, options, inTask, mLastStartActivityRecord, - false /* restrictedBgActivity */, neededGrants); + false /* restrictedBgActivity */); mSupervisor.getActivityMetricsLogger().notifyActivityLaunched(mLastStartActivityResult, mLastStartActivityRecord[0]); return mLastStartActivityResult; @@ -578,33 +576,6 @@ class ActivityStarter { boolean allowPendingRemoteAnimationRegistryLookup, PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) { - // Carefully collect grants without holding lock - NeededUriGrants neededGrants = null; - if (aInfo != null) { - neededGrants = mService.mUgmInternal.checkGrantUriPermissionFromIntent( - resolveCallingUid(mRequest.caller), intent, aInfo.applicationInfo.packageName, - UserHandle.getUserId(aInfo.applicationInfo.uid)); - } - - return startActivity(caller, intent, ephemeralIntent, resolvedType, aInfo, rInfo, - voiceSession, voiceInteractor, resultTo, resultWho, requestCode, callingPid, - callingUid, callingPackage, realCallingPid, realCallingUid, startFlags, options, - ignoreTargetSecurity, componentSpecified, outActivity, inTask, reason, - allowPendingRemoteAnimationRegistryLookup, originatingPendingIntent, - allowBackgroundActivityStart, neededGrants); - } - - private int startActivity(IApplicationThread caller, Intent intent, Intent ephemeralIntent, - String resolvedType, ActivityInfo aInfo, ResolveInfo rInfo, - IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor, - IBinder resultTo, String resultWho, int requestCode, int callingPid, int callingUid, - String callingPackage, int realCallingPid, int realCallingUid, int startFlags, - SafeActivityOptions options, boolean ignoreTargetSecurity, boolean componentSpecified, - ActivityRecord[] outActivity, TaskRecord inTask, String reason, - boolean allowPendingRemoteAnimationRegistryLookup, - PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart, - NeededUriGrants neededGrants) { - if (TextUtils.isEmpty(reason)) { throw new IllegalArgumentException("Need to specify a reason."); } @@ -617,7 +588,7 @@ class ActivityStarter { callingPid, callingUid, callingPackage, realCallingPid, realCallingUid, startFlags, options, ignoreTargetSecurity, componentSpecified, mLastStartActivityRecord, inTask, allowPendingRemoteAnimationRegistryLookup, originatingPendingIntent, - allowBackgroundActivityStart, neededGrants); + allowBackgroundActivityStart); if (outActivity != null) { // mLastStartActivityRecord[0] is set in the call to startActivity above. @@ -648,8 +619,7 @@ class ActivityStarter { SafeActivityOptions options, boolean ignoreTargetSecurity, boolean componentSpecified, ActivityRecord[] outActivity, TaskRecord inTask, boolean allowPendingRemoteAnimationRegistryLookup, - PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart, - NeededUriGrants neededGrants) { + PendingIntentRecord originatingPendingIntent, boolean allowBackgroundActivityStart) { mSupervisor.getActivityMetricsLogger().notifyActivityLaunching(intent); int err = ActivityManager.START_SUCCESS; // Pull the optional Ephemeral Installer-only bundle out of the options early. @@ -784,7 +754,7 @@ class ActivityStarter { if (err != START_SUCCESS) { if (resultRecord != null) { resultStack.sendActivityResultLocked( - -1, resultRecord, resultWho, requestCode, RESULT_CANCELED, null, null); + -1, resultRecord, resultWho, requestCode, RESULT_CANCELED, null); } SafeActivityOptions.abort(options); return err; @@ -844,16 +814,12 @@ class ActivityStarter { callingPid = mInterceptor.mCallingPid; callingUid = mInterceptor.mCallingUid; checkedOptions = mInterceptor.mActivityOptions; - - // The interception target shouldn't get any permission grants - // intended for the original destination - neededGrants = null; } if (abort) { if (resultRecord != null) { resultStack.sendActivityResultLocked(-1, resultRecord, resultWho, requestCode, - RESULT_CANCELED, null, null); + RESULT_CANCELED, null); } // We pretend to the caller that it was really started, but // they will just get a cancel result. @@ -909,10 +875,6 @@ class ActivityStarter { aInfo = mSupervisor.resolveActivity(intent, rInfo, startFlags, null /*profilerInfo*/); - // The permissions review target shouldn't get any permission - // grants intended for the original destination - neededGrants = null; - if (DEBUG_PERMISSIONS_REVIEW) { final ActivityStack focusedStack = mRootActivityContainer.getTopDisplayFocusedStack(); @@ -935,10 +897,6 @@ class ActivityStarter { callingPid = realCallingPid; aInfo = mSupervisor.resolveActivity(intent, rInfo, startFlags, null /*profilerInfo*/); - - // The ephemeral installer shouldn't get any permission grants - // intended for the original destination - neededGrants = null; } ActivityRecord r = new ActivityRecord(mService, callerApp, callingPid, callingUid, @@ -965,7 +923,7 @@ class ActivityStarter { realCallingPid, realCallingUid, "Activity start")) { if (!(restrictedBgActivity && handleBackgroundActivityAbort(r))) { mController.addPendingActivityLaunch(new PendingActivityLaunch(r, - sourceRecord, startFlags, stack, callerApp, neededGrants)); + sourceRecord, startFlags, stack, callerApp)); } ActivityOptions.abort(checkedOptions); return ActivityManager.START_SWITCHES_CANCELED; @@ -976,8 +934,7 @@ class ActivityStarter { mController.doPendingActivityLaunches(false); final int res = startActivity(r, sourceRecord, voiceSession, voiceInteractor, startFlags, - true /* doResume */, checkedOptions, inTask, outActivity, restrictedBgActivity, - neededGrants); + true /* doResume */, checkedOptions, inTask, outActivity, restrictedBgActivity); mSupervisor.getActivityMetricsLogger().notifyActivityLaunched(res, outActivity[0]); return res; } @@ -1275,15 +1232,9 @@ class ActivityStarter { } } } - // Collect information about the target of the Intent. ActivityInfo aInfo = mSupervisor.resolveActivity(intent, rInfo, startFlags, profilerInfo); - // Carefully collect grants without holding lock - NeededUriGrants neededGrants = mService.mUgmInternal.checkGrantUriPermissionFromIntent( - resolveCallingUid(mRequest.caller), intent, aInfo.applicationInfo.packageName, - UserHandle.getUserId(aInfo.applicationInfo.uid)); - synchronized (mService.mGlobalLock) { final ActivityStack stack = mRootActivityContainer.getTopDisplayFocusedStack(); stack.mConfigWillChange = globalConfig != null @@ -1360,7 +1311,7 @@ class ActivityStarter { callingUid, callingPackage, realCallingPid, realCallingUid, startFlags, options, ignoreTargetSecurity, componentSpecified, outRecord, inTask, reason, allowPendingRemoteAnimationRegistryLookup, originatingPendingIntent, - allowBackgroundActivityStart, neededGrants); + allowBackgroundActivityStart); Binder.restoreCallingIdentity(origId); @@ -1455,16 +1406,14 @@ class ActivityStarter { private int startActivity(final ActivityRecord r, ActivityRecord sourceRecord, IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor, - int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask, - ActivityRecord[] outActivity, boolean restrictedBgActivity, - NeededUriGrants neededGrants) { + int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask, + ActivityRecord[] outActivity, boolean restrictedBgActivity) { int result = START_CANCELED; final ActivityStack startedActivityStack; try { mService.mWindowManager.deferSurfaceLayout(); result = startActivityUnchecked(r, sourceRecord, voiceSession, voiceInteractor, - startFlags, doResume, options, inTask, outActivity, restrictedBgActivity, - neededGrants); + startFlags, doResume, options, inTask, outActivity, restrictedBgActivity); } finally { final ActivityStack currentStack = r.getActivityStack(); startedActivityStack = currentStack != null ? currentStack : mTargetStack; @@ -1489,8 +1438,7 @@ class ActivityStarter { final ActivityStack stack = mStartActivity.getActivityStack(); if (stack != null) { stack.finishActivityLocked(mStartActivity, RESULT_CANCELED, - null /* resultData */, null /* resultGrants */, - "startActivity", true /* oomAdj */); + null /* intentResultData */, "startActivity", true /* oomAdj */); } } mService.mWindowManager.continueSurfaceLayout(); @@ -1519,7 +1467,7 @@ class ActivityStarter { if (resultRecord != null) { ActivityStack resultStack = resultRecord.getActivityStack(); resultStack.sendActivityResultLocked(-1, resultRecord, resultWho, requestCode, - RESULT_CANCELED, null, null); + RESULT_CANCELED, null); } // We pretend to the caller that it was really started to make it backward compatible, but // they will just get a cancel result. @@ -1531,8 +1479,7 @@ class ActivityStarter { private int startActivityUnchecked(final ActivityRecord r, ActivityRecord sourceRecord, IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor, int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask, - ActivityRecord[] outActivity, boolean restrictedBgActivity, - NeededUriGrants neededGrants) { + ActivityRecord[] outActivity, boolean restrictedBgActivity) { setInitialState(r, options, inTask, doResume, startFlags, sourceRecord, voiceSession, voiceInteractor, restrictedBgActivity); @@ -1682,7 +1629,7 @@ class ActivityStarter { if (sourceStack != null) { sourceStack.sendActivityResultLocked(-1 /* callingUid */, mStartActivity.resultTo, mStartActivity.resultWho, mStartActivity.requestCode, RESULT_CANCELED, - null /* resultData */, null /* resultGrants */); + null /* data */); } ActivityOptions.abort(mOptions); return START_CLASS_NOT_FOUND; @@ -1749,8 +1696,8 @@ class ActivityStarter { return result; } - mService.mUgmInternal.grantUriPermissionUncheckedFromIntent(neededGrants, - mStartActivity.getUriPermissionsLocked()); + mService.mUgmInternal.grantUriPermissionFromIntent(mCallingUid, mStartActivity.packageName, + mIntent, mStartActivity.getUriPermissionsLocked(), mStartActivity.mUserId); mService.getPackageManagerInternalLocked().grantEphemeralAccess( mStartActivity.mUserId, mIntent, UserHandle.getAppId(mStartActivity.appInfo.uid), UserHandle.getAppId(mCallingUid)); @@ -1986,7 +1933,7 @@ class ActivityStarter { Slog.w(TAG, "Activity is launching as a new task, so cancelling activity result."); sourceStack.sendActivityResultLocked(-1 /* callingUid */, mStartActivity.resultTo, mStartActivity.resultWho, mStartActivity.requestCode, RESULT_CANCELED, - null /* resultData */, null /* resultGrants */); + null /* data */); mStartActivity.resultTo = null; } } @@ -2415,13 +2362,8 @@ class ActivityStarter { } ActivityStack.logStartActivity(AM_NEW_INTENT, activity, activity.getTaskRecord()); - - Intent intent = mStartActivity.intent; - NeededUriGrants intentGrants = mService.mUgmInternal.checkGrantUriPermissionFromIntent( - mCallingUid, intent, activity.packageName, activity.mUserId); - activity.deliverNewIntentLocked(mCallingUid, intent, intentGrants, + activity.deliverNewIntentLocked(mCallingUid, mStartActivity.intent, mStartActivity.launchedFromPackage); - mIntentDelivered = true; } @@ -2800,18 +2742,6 @@ class ActivityStarter { } } - private int resolveCallingUid(IApplicationThread caller) { - if (caller != null) { - synchronized (mService.mGlobalLock) { - final WindowProcessController callerApp = mService.getProcessController(caller); - if (callerApp != null) { - return callerApp.mInfo.uid; - } - } - } - return -1; - } - private boolean isLaunchModeOneOf(int mode1, int mode2) { return mode1 == mLaunchMode || mode2 == mLaunchMode; } diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index b123aa5d20c74..444e2190aba4e 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -265,7 +265,6 @@ import com.android.server.appop.AppOpsService; import com.android.server.firewall.IntentFirewall; import com.android.server.pm.UserManagerService; import com.android.server.policy.PermissionPolicyInternal; -import com.android.server.uri.NeededUriGrants; import com.android.server.uri.UriGrantsManagerInternal; import com.android.server.vr.VrManagerInternal; @@ -1541,19 +1540,11 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { throw new IllegalArgumentException("File descriptors passed in Intent"); } - final ActivityRecord r; synchronized (mGlobalLock) { - r = ActivityRecord.isInStackLocked(token); + ActivityRecord r = ActivityRecord.isInStackLocked(token); if (r == null) { return true; } - } - - // Carefully collect grants without holding lock - final NeededUriGrants resultGrants = mUgmInternal.checkGrantUriPermissionFromIntent( - Binder.getCallingUid(), resultData, r.packageName, r.mUserId); - - synchronized (mGlobalLock) { // Keep track of the root activity of the task before we finish it final TaskRecord tr = r.getTaskRecord(); ActivityRecord rootR = tr.getRootActivity(); @@ -1615,7 +1606,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { r.mRelaunchReason = RELAUNCH_REASON_NONE; } else { res = tr.getStack().requestFinishActivityLocked(token, resultCode, - resultData, resultGrants, "app-request", true); + resultData, "app-request", true); if (!res) { Slog.i(TAG, "Failed to finish by app-request"); } @@ -2141,23 +2132,14 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public boolean navigateUpTo(IBinder token, Intent destIntent, int resultCode, Intent resultData) { - final ActivityRecord r; + synchronized (mGlobalLock) { - r = ActivityRecord.isInStackLocked(token); - if (r == null) { - return false; + final ActivityRecord r = ActivityRecord.forTokenLocked(token); + if (r != null) { + return r.getActivityStack().navigateUpToLocked( + r, destIntent, resultCode, resultData); } - } - - // Carefully collect grants without holding lock - final NeededUriGrants destGrants = mUgmInternal.checkGrantUriPermissionFromIntent( - Binder.getCallingUid(), destIntent, r.packageName, r.mUserId); - final NeededUriGrants resultGrants = mUgmInternal.checkGrantUriPermissionFromIntent( - Binder.getCallingUid(), resultData, r.packageName, r.mUserId); - - synchronized (mGlobalLock) { - return r.getActivityStack().navigateUpToLocked( - r, destIntent, destGrants, resultCode, resultData, resultGrants); + return false; } } @@ -6615,23 +6597,14 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public void sendActivityResult(int callingUid, IBinder activityToken, String resultWho, - int requestCode, int resultCode, Intent resultData) { - final ActivityRecord r; + int requestCode, int resultCode, Intent data) { synchronized (mGlobalLock) { - r = ActivityRecord.isInStackLocked(activityToken); - if (r == null || r.getActivityStack() == null) { - return; + final ActivityRecord r = ActivityRecord.isInStackLocked(activityToken); + if (r != null && r.getActivityStack() != null) { + r.getActivityStack().sendActivityResultLocked(callingUid, r, resultWho, + requestCode, resultCode, data); } } - - // Carefully collect grants without holding lock - final NeededUriGrants resultGrants = mUgmInternal.checkGrantUriPermissionFromIntent( - Binder.getCallingUid(), resultData, r.packageName, r.mUserId); - - synchronized (mGlobalLock) { - r.getActivityStack().sendActivityResultLocked(callingUid, r, resultWho, - requestCode, resultCode, resultData, resultGrants); - } } @Override diff --git a/services/core/java/com/android/server/wm/TaskRecord.java b/services/core/java/com/android/server/wm/TaskRecord.java index 4a0bf02ab517a..298b302a17fbf 100644 --- a/services/core/java/com/android/server/wm/TaskRecord.java +++ b/services/core/java/com/android/server/wm/TaskRecord.java @@ -1442,7 +1442,7 @@ class TaskRecord extends ConfigurationContainer { mActivities.remove(activityNdx); --activityNdx; --numActivities; - } else if (mStack.finishActivityLocked(r, Activity.RESULT_CANCELED, null, null, + } else if (mStack.finishActivityLocked(r, Activity.RESULT_CANCELED, null, reason, false, pauseImmediately)) { --activityNdx; --numActivities; @@ -1497,8 +1497,8 @@ class TaskRecord extends ConfigurationContainer { if (opts != null) { ret.updateOptionsLocked(opts); } - if (mStack != null && mStack.finishActivityLocked(r, Activity.RESULT_CANCELED, - null, null, "clear-task-stack", false)) { + if (mStack != null && mStack.finishActivityLocked( + r, Activity.RESULT_CANCELED, null, "clear-task-stack", false)) { --activityNdx; --numActivities; } @@ -1512,8 +1512,8 @@ class TaskRecord extends ConfigurationContainer { && !ActivityStarter.isDocumentLaunchesIntoExisting(launchFlags)) { if (!ret.finishing) { if (mStack != null) { - mStack.finishActivityLocked(ret, Activity.RESULT_CANCELED, - null, null, "clear-task-top", false); + mStack.finishActivityLocked( + ret, Activity.RESULT_CANCELED, null, "clear-task-top", false); } return null; } diff --git a/services/core/java/com/android/server/wm/WindowProcessController.java b/services/core/java/com/android/server/wm/WindowProcessController.java index fbd4ec7ff5360..2ad25cf123e20 100644 --- a/services/core/java/com/android/server/wm/WindowProcessController.java +++ b/services/core/java/com/android/server/wm/WindowProcessController.java @@ -623,7 +623,7 @@ public class WindowProcessController extends ConfigurationContainer Date: Tue, 4 Jun 2019 16:37:40 -0700 Subject: [PATCH 12/34] Avoid unwanted wakeAndUnLock mode for face Test: press power repeatedly on lock screen Bug: 132846921 Fixes: 130766403 Bug: 130327302 Change-Id: Ic11914ad220a0c8f81f0d28d5f999fcf970ccdeb (cherry picked from commit 9bae9c2dc6d2e507594a0195d1c74a7ed57cb8e8) --- .../keyguard/KeyguardUpdateMonitor.java | 4 ++++ .../phone/BiometricUnlockController.java | 15 ++++++++++--- .../phone/KeyguardBypassController.kt | 7 ------ .../phone/BiometricsUnlockControllerTest.java | 22 ++++++------------- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 9feca3d2865af..3c119a622b664 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -748,6 +748,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private void handleFaceAuthenticated(int authUserId) { Trace.beginSection("KeyGuardUpdateMonitor#handlerFaceAuthenticated"); try { + if (mGoingToSleep) { + Log.d(TAG, "Aborted successful auth because device is going to sleep."); + return; + } final int userId; try { userId = ActivityManager.getService().getCurrentUser().id; 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 d67795210f0c2..aa78a5d63f7e1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java @@ -365,16 +365,23 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { private int calculateMode(BiometricSourceType biometricSourceType) { boolean unlockingAllowed = mUpdateMonitor.isUnlockingWithBiometricAllowed(); boolean deviceDreaming = mUpdateMonitor.isDreaming(); - boolean faceStayingOnKeyguard = biometricSourceType == BiometricSourceType.FACE - && !mKeyguardBypassController.getBypassEnabled(); + boolean face = biometricSourceType == BiometricSourceType.FACE; + boolean faceStayingOnKeyguard = face && !mKeyguardBypassController.getBypassEnabled(); if (!mUpdateMonitor.isDeviceInteractive()) { if (!mStatusBarKeyguardViewManager.isShowing()) { return MODE_ONLY_WAKE; } else if (mDozeScrimController.isPulsing() && unlockingAllowed) { return faceStayingOnKeyguard ? MODE_NONE : MODE_WAKE_AND_UNLOCK_PULSING; - } else if (unlockingAllowed || !mUnlockMethodCache.isMethodSecure()) { + } else if (!face && (unlockingAllowed || !mUnlockMethodCache.isMethodSecure())) { return MODE_WAKE_AND_UNLOCK; + } else if (face) { + if (!(mDozeScrimController.isPulsing() && !unlockingAllowed)) { + Log.wtf(TAG, "Face somehow arrived when the device was not interactive"); + } + // We could theoretically return MODE_NONE, but this means that the device + // would be not interactive, unlocked, and the user would not see the device state. + return MODE_ONLY_WAKE; } else { return MODE_SHOW_BOUNCER; } @@ -389,6 +396,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { return MODE_DISMISS_BOUNCER; } else if (unlockingAllowed) { return faceStayingOnKeyguard ? MODE_ONLY_WAKE : MODE_UNLOCK; + } else if (face) { + return MODE_NONE; } else if (!mStatusBarKeyguardViewManager.isBouncerShowing()) { return MODE_SHOW_BOUNCER; } 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 c9dd4613b9462..124206a5a369d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.phone import android.content.Context import android.hardware.face.FaceManager import android.provider.Settings -import com.android.internal.annotations.VisibleForTesting import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.tuner.TunerService @@ -59,10 +58,4 @@ class KeyguardBypassController { } }, Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD) } - - @VisibleForTesting - constructor(bypassEnabled: Boolean, unlockMethodCache: UnlockMethodCache) { - this.bypassEnabled = bypassEnabled - this.unlockMethodCache = unlockMethodCache - } } 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 9b8d09e7aee85..eb3f56a19c9e8 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 @@ -71,6 +71,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { private UnlockMethodCache mUnlockMethodCache; @Mock private Handler mHandler; + @Mock + private KeyguardBypassController mKeyguardBypassController; private BiometricUnlockController mBiometricUnlockController; @Before @@ -83,8 +85,9 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager); mDependency.injectTestDependency(StatusBarWindowController.class, mStatusBarWindowController); - mBiometricUnlockController = new TestableBiometricUnlockController( - false /* faceDismissesKeyguard */); + mBiometricUnlockController = new BiometricUnlockController(mContext, mDozeScrimController, + mKeyguardViewMediator, mScrimController, mStatusBar, mUnlockMethodCache, + mHandler, mUpdateMonitor, 0 /* wakeUpDelay */, mKeyguardBypassController); mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); } @@ -139,9 +142,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { } @Test - public void onBiometricAuthenticated_whenFace_dismissingKeyguard() { - mBiometricUnlockController = new TestableBiometricUnlockController( - true /* faceDismissesKeyguard */); + public void onBiometricAuthenticated_whenFace_andBypass_dismissKeyguard() { + when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true); mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); when(mUpdateMonitor.isUnlockingWithBiometricAllowed()).thenReturn(true); @@ -184,14 +186,4 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mBiometricUnlockController.onFinishedGoingToSleep(-1); verify(mHandler).post(any()); } - - private class TestableBiometricUnlockController extends BiometricUnlockController { - - TestableBiometricUnlockController(boolean faceDismissesKeyguard) { - super(mContext, mDozeScrimController, - mKeyguardViewMediator, mScrimController, mStatusBar, mUnlockMethodCache, - mHandler, mUpdateMonitor, 0 /* wakeUpDelay */, - new KeyguardBypassController(faceDismissesKeyguard, mUnlockMethodCache)); - } - } } From 31292aad8afce9f01eb7c8900aaccde29df90e88 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Thu, 30 May 2019 19:35:05 -0700 Subject: [PATCH 13/34] Not rendering the dark icons with the shelf anymore Instead it is rendered by a dedicated container. This will help with a lot of the transitions that are necessary for the bypass and also fixes the coloring of the notification icons on the lockscreen. Fixes: 133869048 Bug: 130327302 Bug: 133182504 Test: atest SystemUITests Change-Id: I422b3da488fdac6577173d41b26c67f81c7826c5 (cherry picked from commit 195dfc5db60fc913d060a692dc4ee7b0b02ece68) --- .../layout/keyguard_status_view.xml | 9 +- packages/SystemUI/res/values/dimens.xml | 4 +- .../systemui/bubbles/BubbleExpandedView.java | 2 +- .../systemui/statusbar/NotificationShelf.java | 57 +----- .../systemui/statusbar/StatusBarIconView.java | 45 ++--- .../notification/NotificationDozeHelper.java | 7 +- .../NotificationWakeUpCoordinator.kt | 28 +-- .../collection/NotificationEntry.java | 17 +- .../row/ActivatableNotificationView.java | 18 +- .../row/ExpandableNotificationRow.java | 12 +- .../notification/row/ExpandableView.java | 14 +- .../row/NotificationContentView.java | 10 +- .../row/NotificationGutsManager.java | 2 +- .../notification/row/NotificationMenuRow.java | 2 +- .../notification/stack/AmbientState.java | 33 ++-- .../notification/stack/AnimationFilter.java | 10 +- .../stack/ExpandableViewState.java | 12 +- .../stack/NotificationChildrenContainer.java | 2 +- .../stack/NotificationStackScrollLayout.java | 175 ++++++------------ .../stack/StackScrollAlgorithm.java | 4 +- .../stack/StackStateAnimator.java | 2 +- .../phone/NotificationIconAreaController.java | 150 ++++++++++++--- .../phone/NotificationIconContainer.java | 27 +-- .../phone/NotificationPanelView.java | 20 +- .../NotificationsQuickSettingsContainer.java | 69 ++++--- .../systemui/statusbar/phone/StatusBar.java | 8 +- .../statusbar/phone/StatusBarWindowView.java | 1 - .../row/ExpandableNotificationRowTest.java | 6 +- .../row/NotificationContentViewTest.java | 4 +- .../NotificationStackScrollLayoutTest.java | 7 +- .../NotificationIconAreaControllerTest.java | 11 +- 31 files changed, 420 insertions(+), 348 deletions(-) diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml index 04d6afc1935f7..a983b05620b44 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml @@ -25,14 +25,11 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" - androidprv:layout_maxWidth="@dimen/keyguard_security_width" - androidprv:layout_maxHeight="@dimen/keyguard_security_height" android:gravity="center_horizontal|top"> + diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index c5e4662f6d45d..afe6d9c2552b5 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -258,8 +258,8 @@ @*android:dimen/notification_header_icon_size_ambient - - 16dp + + 16dp 90% diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java index 09d4b05855419..7b58c5de48134 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java @@ -515,7 +515,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList viewState.gone = false; viewState.hidden = false; viewState.dimmed = false; - viewState.dark = false; + viewState.dozing = false; viewState.alpha = 1f; viewState.notGoneIndex = -1; viewState.xTranslation = 0; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index 1779b325359e9..9ffb78c109390 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -63,15 +63,12 @@ public class NotificationShelf extends ActivatableNotificationView implements = SystemProperties.getBoolean("debug.icon_scroll_animations", true); private static final int TAG_CONTINUOUS_CLIPPING = R.id.continuous_clipping_tag; private static final String TAG = "NotificationShelf"; - private static final long SHELF_IN_TRANSLATION_DURATION = 200; private NotificationIconContainer mShelfIcons; private int[] mTmp = new int[2]; private boolean mHideBackground; private int mIconAppearTopPadding; - private int mShelfAppearTranslation; - private float mDarkShelfPadding; - private float mDarkShelfIconSize; + private float mHiddenShelfIconSize; private int mStatusBarHeight; private int mStatusBarPaddingStart; private AmbientState mAmbientState; @@ -140,8 +137,6 @@ public class NotificationShelf extends ActivatableNotificationView implements mStatusBarHeight = res.getDimensionPixelOffset(R.dimen.status_bar_height); mStatusBarPaddingStart = res.getDimensionPixelOffset(R.dimen.status_bar_padding_start); mPaddingBetweenElements = res.getDimensionPixelSize(R.dimen.notification_divider_height); - mShelfAppearTranslation = res.getDimensionPixelSize(R.dimen.shelf_appear_translation); - mDarkShelfPadding = res.getDimensionPixelSize(R.dimen.widget_bottom_separator_padding); ViewGroup.LayoutParams layoutParams = getLayoutParams(); layoutParams.height = res.getDimensionPixelOffset(R.dimen.notification_shelf_height); @@ -152,7 +147,7 @@ public class NotificationShelf extends ActivatableNotificationView implements mScrollFastThreshold = res.getDimensionPixelOffset(R.dimen.scroll_fast_threshold); mShowNotificationShelf = res.getBoolean(R.bool.config_showNotificationShelf); mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size); - mDarkShelfIconSize = res.getDimensionPixelOffset(R.dimen.dark_shelf_icon_size); + mHiddenShelfIconSize = res.getDimensionPixelOffset(R.dimen.hidden_shelf_icon_size); mGapHeight = res.getDimensionPixelSize(R.dimen.qs_notification_padding); if (!mShowNotificationShelf) { @@ -166,33 +161,6 @@ public class NotificationShelf extends ActivatableNotificationView implements initDimens(); } - @Override - public void setDark(boolean dark, boolean fade, long delay) { - if (mDark == dark) return; - super.setDark(dark, fade, delay); - mShelfIcons.setDark(dark, fade, delay); - updateInteractiveness(); - updateOutline(); - } - - /** - * Alpha animation with translation played when this view is visible on AOD. - */ - public void fadeInTranslating() { - mShelfIcons.setTranslationY(-mShelfAppearTranslation); - mShelfIcons.setAlpha(0); - mShelfIcons.animate() - .setInterpolator(Interpolators.DECELERATE_QUINT) - .translationY(0) - .setDuration(SHELF_IN_TRANSLATION_DURATION) - .start(); - mShelfIcons.animate() - .alpha(1) - .setInterpolator(Interpolators.LINEAR) - .setDuration(SHELF_IN_TRANSLATION_DURATION) - .start(); - } - @Override protected View getContentView() { return mShelfIcons; @@ -219,11 +187,8 @@ public class NotificationShelf extends ActivatableNotificationView implements viewState.copyFrom(lastViewState); viewState.height = getIntrinsicHeight(); - float awakenTranslation = Math.max(Math.min(viewEnd, maxShelfEnd) - viewState.height, + viewState.yTranslation = Math.max(Math.min(viewEnd, maxShelfEnd) - viewState.height, getFullyClosedTranslation()); - float yRatio = mAmbientState.hasPulsingNotifications() ? - 0 : mAmbientState.getDarkAmount(); - viewState.yTranslation = awakenTranslation + mDarkShelfPadding * yRatio; viewState.zTranslation = ambientState.getBaseZHeight(); // For the small display size, it's not enough to make the icon not covered by // the top cutout so the denominator add the height of cutout. @@ -452,7 +417,7 @@ public class NotificationShelf extends ActivatableNotificationView implements } StatusBarIconView icon = row.getEntry().expandedIcon; float shelfIconPosition = getTranslationY() + icon.getTop() + icon.getTranslationY(); - if (shelfIconPosition < maxTop && !mAmbientState.isFullyDark()) { + if (shelfIconPosition < maxTop && !mAmbientState.isFullyHidden()) { int top = (int) (maxTop - shelfIconPosition); Rect clipRect = new Rect(0, top, icon.getWidth(), Math.max(top, icon.getHeight())); icon.setClipBounds(clipRect); @@ -666,8 +631,8 @@ public class NotificationShelf extends ActivatableNotificationView implements iconState.translateContent = false; } float transitionAmount; - if (mAmbientState.isDarkAtAll() && !row.isInShelf()) { - transitionAmount = mAmbientState.isFullyDark() ? 1 : 0; + if (mAmbientState.isHiddenAtAll() && !row.isInShelf()) { + transitionAmount = mAmbientState.isFullyHidden() ? 1 : 0; } else if (isLastChild || !USE_ANIMATIONS_WHEN_OPENING || iconState.useFullTransitionAmount || iconState.useLinearTransitionAmount) { transitionAmount = iconTransitionAmount; @@ -717,7 +682,7 @@ public class NotificationShelf extends ActivatableNotificationView implements } notificationIconPosition += iconTopPadding; float shelfIconPosition = getTranslationY() + icon.getTop(); - float iconSize = mDark ? mDarkShelfIconSize : mIconSize; + float iconSize = mDozing ? mHiddenShelfIconSize : mIconSize; shelfIconPosition += (icon.getHeight() - icon.getIconScale() * iconSize) / 2.0f; float iconYTranslation = NotificationUtils.interpolate( notificationIconPosition - shelfIconPosition, @@ -794,12 +759,12 @@ public class NotificationShelf extends ActivatableNotificationView implements @Override protected boolean needsOutline() { - return !mHideBackground && !mDark && super.needsOutline(); + return !mHideBackground && super.needsOutline(); } @Override protected boolean shouldHideBackground() { - return super.shouldHideBackground() || mHideBackground || mDark; + return super.shouldHideBackground() || mHideBackground; } @Override @@ -910,8 +875,7 @@ public class NotificationShelf extends ActivatableNotificationView implements } private void updateInteractiveness() { - mInteractive = mStatusBarState == StatusBarState.KEYGUARD && mHasItemsInStableShelf - && !mDark; + mInteractive = mStatusBarState == StatusBarState.KEYGUARD && mHasItemsInStableShelf; setClickable(mInteractive); setFocusable(mInteractive); setImportantForAccessibility(mInteractive ? View.IMPORTANT_FOR_ACCESSIBILITY_YES @@ -929,7 +893,6 @@ public class NotificationShelf extends ActivatableNotificationView implements public void setAnimationsEnabled(boolean enabled) { mAnimationsEnabled = enabled; - mCollapsedIcons.setAnimationsEnabled(enabled); if (!enabled) { // we need to wait with enabling the animations until the first frame has passed mShelfIcons.setAnimationsEnabled(false); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java index 6552fe671794f..f4af9ae21b754 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java @@ -112,7 +112,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi }; private boolean mAlwaysScaleIcon; - private int mStatusBarIconDrawingSizeDark = 1; + private int mStatusBarIconDrawingSizeIncreased = 1; private int mStatusBarIconDrawingSize = 1; private int mStatusBarIconSize = 1; private StatusBarIcon mIcon; @@ -139,7 +139,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi private int mDrawableColor; private int mIconColor; private int mDecorColor; - private float mDarkAmount; + private float mDozeAmount; private ValueAnimator mColorAnimator; private int mCurrentSetColor = NO_COLOR; private int mAnimationStartColor = NO_COLOR; @@ -158,6 +158,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi private Runnable mLayoutRunnable; private boolean mDismissed; private Runnable mOnDismissListener; + private boolean mIncreasedSize; public StatusBarIconView(Context context, String slot, StatusBarNotification sbn) { this(context, slot, sbn, false); @@ -196,12 +197,10 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi } private void updateIconScaleForNotifications() { - final float imageBounds = NotificationUtils.interpolate( - mStatusBarIconDrawingSize, - mStatusBarIconDrawingSizeDark, - mDarkAmount); + final float imageBounds = mIncreasedSize ? + mStatusBarIconDrawingSizeIncreased : mStatusBarIconDrawingSize; final int outerBounds = mStatusBarIconSize; - mIconScale = (float)imageBounds / (float)outerBounds; + mIconScale = imageBounds / (float)outerBounds; updatePivot(); } @@ -225,8 +224,8 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi } } - public float getIconScaleFullyDark() { - return (float) mStatusBarIconDrawingSizeDark / mStatusBarIconDrawingSize; + public float getIconScaleIncreased() { + return (float) mStatusBarIconDrawingSizeIncreased / mStatusBarIconDrawingSize; } public float getIconScale() { @@ -256,7 +255,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi Resources res = getResources(); mStaticDotRadius = res.getDimensionPixelSize(R.dimen.overflow_dot_radius); mStatusBarIconSize = res.getDimensionPixelSize(R.dimen.status_bar_icon_size); - mStatusBarIconDrawingSizeDark = + mStatusBarIconDrawingSizeIncreased = res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size_dark); mStatusBarIconDrawingSize = res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size); @@ -584,7 +583,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi } private void updateDecorColor() { - int color = NotificationUtils.interpolateColors(mDecorColor, Color.WHITE, mDarkAmount); + int color = NotificationUtils.interpolateColors(mDecorColor, Color.WHITE, mDozeAmount); if (mDotPaint.getColor() != color) { mDotPaint.setColor(color); @@ -618,13 +617,13 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi mMatrixColorFilter = new ColorMatrixColorFilter(mMatrix); } int color = NotificationUtils.interpolateColors( - mCurrentSetColor, Color.WHITE, mDarkAmount); - updateTintMatrix(mMatrix, color, DARK_ALPHA_BOOST * mDarkAmount); + mCurrentSetColor, Color.WHITE, mDozeAmount); + updateTintMatrix(mMatrix, color, DARK_ALPHA_BOOST * mDozeAmount); mMatrixColorFilter.setColorMatrixArray(mMatrix); setColorFilter(null); // setColorFilter only invalidates if the instance changed. setColorFilter(mMatrixColorFilter); } else { - mDozer.updateGrayscale(this, mDarkAmount); + mDozer.updateGrayscale(this, mDozeAmount); } } @@ -855,19 +854,18 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi mOnVisibilityChangedListener = listener; } - public void setDark(boolean dark, boolean fade, long delay) { - mDozer.setIntensityDark(f -> { - mDarkAmount = f; - maybeUpdateIconScaleDimens(); + public void setDozing(boolean dozing, boolean fade, long delay) { + mDozer.setDozing(f -> { + mDozeAmount = f; updateDecorColor(); updateIconColor(); updateAllowAnimation(); - }, dark, fade, delay, this); + }, dozing, fade, delay, this); } private void updateAllowAnimation() { - if (mDarkAmount == 0 || mDarkAmount == 1) { - setAllowAnimation(mDarkAmount == 0); + if (mDozeAmount == 0 || mDozeAmount == 1) { + setAllowAnimation(mDozeAmount == 0); } } @@ -949,6 +947,11 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi return mBlocked; } + public void setIncreasedSize(boolean increasedSize) { + mIncreasedSize = increasedSize; + maybeUpdateIconScaleDimens(); + } + public interface OnVisibilityChangedListener { void onVisibilityChanged(int newVisibility); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationDozeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationDozeHelper.java index ef042bab76258..63bb73ab7f131 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationDozeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationDozeHelper.java @@ -79,10 +79,11 @@ public class NotificationDozeHelper { animator.start(); } - public void setIntensityDark(Consumer listener, boolean dark, + public void setDozing(Consumer listener, boolean dozing, boolean animate, long delay, View view) { if (animate) { - startIntensityAnimation(a -> listener.accept((Float) a.getAnimatedValue()), dark, delay, + startIntensityAnimation(a -> listener.accept((Float) a.getAnimatedValue()), dozing, + delay, new AnimatorListenerAdapter() { @Override @@ -100,7 +101,7 @@ public class NotificationDozeHelper { if (animator != null) { animator.cancel(); } - listener.accept(dark ? 1f : 0f); + listener.accept(dozing ? 1f : 0f); } } 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 3613f9f3ea5f9..0fa6842ca9b1f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt @@ -28,6 +28,7 @@ import com.android.systemui.statusbar.notification.stack.NotificationStackScroll import com.android.systemui.statusbar.notification.stack.StackStateAnimator import com.android.systemui.statusbar.phone.DozeParameters import com.android.systemui.statusbar.phone.KeyguardBypassController +import com.android.systemui.statusbar.phone.NotificationIconAreaController import javax.inject.Inject import javax.inject.Singleton @@ -59,7 +60,7 @@ class NotificationWakeUpCoordinator @Inject constructor( private var mNotificationVisibleAmount = 0.0f private var mNotificationsVisible = false private var mNotificationsVisibleForExpansion = false - private var mDarkAnimator: ObjectAnimator? = null + private var mVisibilityAnimator: ObjectAnimator? = null private var mVisibilityAmount = 0.0f private var mLinearVisibilityAmount = 0.0f private var mWakingUp = false @@ -72,6 +73,8 @@ class NotificationWakeUpCoordinator @Inject constructor( } } + lateinit var iconAreaController : NotificationIconAreaController + var pulsing: Boolean = false set(value) { field = value @@ -129,7 +132,7 @@ class NotificationWakeUpCoordinator @Inject constructor( return } mNotificationsVisible = visible - mDarkAnimator?.cancel(); + mVisibilityAnimator?.cancel(); if (animate) { notifyAnimationStart(visible) startVisibilityAnimation(increaseSpeed) @@ -155,7 +158,7 @@ class NotificationWakeUpCoordinator @Inject constructor( mLinearDozeAmount = linear mDozeAmount = eased mStackScroller.setDozeAmount(mDozeAmount) - updateDarkAmount() + updateHideAmount() if (changed && linear == 0.0f) { setNotificationsVisible(visible = false, animate = false, increaseSpeed = false); setNotificationsVisibleForExpansion(visible = false, animate = false, @@ -188,15 +191,15 @@ class NotificationWakeUpCoordinator @Inject constructor( Interpolators.FAST_OUT_SLOW_IN_REVERSE } val target = if (mNotificationsVisible) 1.0f else 0.0f - val darkAnimator = ObjectAnimator.ofFloat(this, mNotificationVisibility, target) - darkAnimator.setInterpolator(Interpolators.LINEAR) + val visibilityAnimator = ObjectAnimator.ofFloat(this, mNotificationVisibility, target) + visibilityAnimator.setInterpolator(Interpolators.LINEAR) var duration = StackStateAnimator.ANIMATION_DURATION_WAKEUP.toLong() if (increaseSpeed) { duration = (duration.toFloat() / 1.5F).toLong(); } - darkAnimator.setDuration(duration) - darkAnimator.start() - mDarkAnimator = darkAnimator + visibilityAnimator.setDuration(duration) + visibilityAnimator.start() + mVisibilityAnimator = visibilityAnimator } private fun setVisibilityAmount(visibilityAmount: Float) { @@ -204,7 +207,7 @@ class NotificationWakeUpCoordinator @Inject constructor( mVisibilityAmount = mVisibilityInterpolator.getInterpolation( visibilityAmount) handleAnimationFinished(); - updateDarkAmount() + updateHideAmount() } private fun handleAnimationFinished() { @@ -218,14 +221,15 @@ class NotificationWakeUpCoordinator @Inject constructor( return mStackScroller.pulseHeight } - private fun updateDarkAmount() { + private fun updateHideAmount() { val linearAmount = Math.min(1.0f - mLinearVisibilityAmount, mLinearDozeAmount) val amount = Math.min(1.0f - mVisibilityAmount, mDozeAmount) - mStackScroller.setDarkAmount(linearAmount, amount) + mStackScroller.setHideAmount(linearAmount, amount) + iconAreaController.setFullyHidden(linearAmount == 1.0f); } private fun notifyAnimationStart(awake: Boolean) { - mStackScroller.notifyDarkAnimationStart(!awake) + mStackScroller.notifyHideAnimationStart(!awake) } override fun onDozingChanged(isDozing: Boolean) { 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 92c261c4cad7c..5371bd9e0d3a8 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 @@ -96,6 +96,7 @@ public final class NotificationEntry { public StatusBarIconView icon; public StatusBarIconView expandedIcon; public StatusBarIconView centeredIcon; + public StatusBarIconView aodIcon; private boolean interruption; public boolean autoRedacted; // whether the redacted notification was generated by us public int targetSdk; @@ -336,6 +337,12 @@ public final class NotificationEntry { sbn.getPackageName() + "/0x" + Integer.toHexString(sbn.getId()), sbn); expandedIcon.setScaleType(ImageView.ScaleType.CENTER_INSIDE); + // Construct the expanded icon. + aodIcon = new StatusBarIconView(context, + sbn.getPackageName() + "/0x" + Integer.toHexString(sbn.getId()), sbn); + aodIcon.setScaleType(ImageView.ScaleType.CENTER_INSIDE); + aodIcon.setIncreasedSize(true); + final StatusBarIcon ic = new StatusBarIcon( sbn.getUser(), sbn.getPackageName(), @@ -344,10 +351,11 @@ public final class NotificationEntry { n.number, StatusBarIconView.contentDescForNotification(context, n)); - if (!icon.set(ic) || !expandedIcon.set(ic)) { + if (!icon.set(ic) || !expandedIcon.set(ic) || !aodIcon.set(ic)) { icon = null; expandedIcon = null; centeredIcon = null; + aodIcon = null; throw new InflationException("Couldn't create icon: " + ic); } expandedIcon.setVisibility(View.INVISIBLE); @@ -380,6 +388,10 @@ public final class NotificationEntry { if (centeredIcon != null) { centeredIcon.setTag(key, tag); } + + if (aodIcon != null) { + aodIcon.setTag(key, tag); + } } /** @@ -403,7 +415,8 @@ public final class NotificationEntry { StatusBarIconView.contentDescForNotification(context, n)); icon.setNotification(sbn); expandedIcon.setNotification(sbn); - if (!icon.set(ic) || !expandedIcon.set(ic)) { + aodIcon.setNotification(sbn); + if (!icon.set(ic) || !expandedIcon.set(ic) || !aodIcon.set(ic)) { throw new InflationException("Couldn't update icon: " + ic); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java index 94face2581b35..11321cffd25b5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java @@ -52,7 +52,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView private static final int BACKGROUND_ANIMATION_LENGTH_MS = 220; private static final int ACTIVATE_ANIMATION_LENGTH = 220; - private static final long DARK_ANIMATION_LENGTH = StackStateAnimator.ANIMATION_DURATION_WAKEUP; /** * The amount of width, which is kept in the end when performing a disappear animation (also @@ -84,11 +83,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView */ private static final float VERTICAL_ANIMATION_START = 1.0f; - /** - * Scale for the background to animate from when exiting dark mode. - */ - private static final float DARK_EXIT_SCALE_START = 0.93f; - /** * A sentinel value when no color should be used. Can be used with {@link #setTintColor(int)} * or {@link #setOverrideTintColor(int, float)}. @@ -105,7 +99,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView private final DoubleTapHelper mDoubleTapHelper; private boolean mDimmed; - protected boolean mDark; + protected boolean mDozing; protected int mBgTint = NO_COLOR; private float mBgAlpha = 1f; @@ -440,12 +434,12 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView return true; } - public void setDark(boolean dark, boolean fade, long delay) { - super.setDark(dark, fade, delay); - if (mDark == dark) { + public void setDozing(boolean dozing, boolean fade, long delay) { + super.setDozing(dozing, fade, delay); + if (mDozing == dozing) { return; } - mDark = dark; + mDozing = dozing; updateBackground(); updateBackgroundTint(false); } @@ -542,7 +536,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView * used and the background color not at all. */ public void setOverrideTintColor(int color, float overrideAmount) { - if (mDark) { + if (mDozing) { color = NO_COLOR; overrideAmount = 0; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index d625b318487d7..a27c15b80276c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -2051,18 +2051,18 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } @Override - public void setDark(boolean dark, boolean fade, long delay) { - if (mDark == dark) { + public void setDozing(boolean dozing, boolean fade, long delay) { + if (mDozing == dozing) { return; } - super.setDark(dark, fade, delay); + super.setDozing(dozing, fade, delay); if (!mIsAmbientPulsing) { // Only fade the showing view of the pulsing notification. fade = false; } final NotificationContentView showing = getShowingLayout(); if (showing != null) { - showing.setDark(dark, fade, delay); + showing.setDozing(dozing, fade, delay); } updateShelfIconColor(); } @@ -2180,7 +2180,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView */ @Override public boolean isSoundEffectsEnabled() { - final boolean mute = mDark && mSecureStateProvider != null && + final boolean mute = mDozing && mSecureStateProvider != null && !mSecureStateProvider.getAsBoolean(); return !mute && super.isSoundEffectsEnabled(); } @@ -2563,7 +2563,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView showingLayout.updateBackgroundColor(animated); mPrivateLayout.updateExpandButtons(isExpandable()); updateShelfIconColor(); - showingLayout.setDark(isDark(), false /* animate */, 0 /* delay */); + showingLayout.setDozing(isDozing(), false /* animate */, 0 /* delay */); mShowingPublicInitialized = true; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java index cac41da521205..30b53383bb746 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java @@ -49,7 +49,7 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable { protected int mClipBottomAmount; protected int mMinimumHeightForClipping = 0; protected float mExtraWidthForClipping = 0; - private boolean mDark; + private boolean mDozing; private ArrayList mMatchParentViews = new ArrayList(); private static Rect mClipRect = new Rect(); private boolean mWillBeGone; @@ -213,18 +213,18 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable { } /** - * Sets the notification as dark. The default implementation does nothing. + * Sets the notification as dozing. The default implementation does nothing. * - * @param dark Whether the notification should be dark. + * @param dozing Whether the notification should be dozing. * @param fade Whether an animation should be played to change the state. * @param delay If fading, the delay of the animation. */ - public void setDark(boolean dark, boolean fade, long delay) { - mDark = dark; + public void setDozing(boolean dozing, boolean fade, long delay) { + mDozing = dozing; } - public boolean isDark() { - return mDark; + public boolean isDozing() { + return mDozing; } public boolean isRemoved() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java index 354ed2d00d32e..ef11c7aacc3a7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java @@ -103,7 +103,7 @@ public class NotificationContentView extends FrameLayout { private int mClipTopAmount; private int mContentHeight; private int mVisibleType = VISIBLE_TYPE_CONTRACTED; - private boolean mDark; + private boolean mDozing; private boolean mAnimate; private boolean mIsHeadsUp; private boolean mLegacy; @@ -1130,12 +1130,12 @@ public class NotificationContentView extends FrameLayout { return mIsContentExpandable; } - public void setDark(boolean dark, boolean fade, long delay) { + public void setDozing(boolean dozing, boolean fade, long delay) { if (mContractedChild == null) { return; } - mDark = dark; - selectLayout(!dark && fade /* animate */, false /* force */); + mDozing = dozing; + selectLayout(!dozing && fade /* animate */, false /* force */); } public void setHeadsUp(boolean headsUp) { @@ -1208,7 +1208,7 @@ public class NotificationContentView extends FrameLayout { applyMediaTransfer(entry); updateLegacy(); mForceSelectNextLayout = true; - setDark(mDark, false /* animate */, 0 /* delay */); + setDozing(mDozing, false /* animate */, 0 /* delay */); mPreviousExpandedRemoteInputIntent = null; mPreviousHeadsUpRemoteInputIntent = null; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java index fe890fb3b471d..caad0f5be7a33 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java @@ -386,7 +386,7 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx } final ExpandableNotificationRow row = (ExpandableNotificationRow) view; - if (row.isDark()) { + if (row.isDozing()) { return false; } view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java index d911e1a050293..7bde92f1427f4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java @@ -346,7 +346,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl if (mShouldShowMenu && !NotificationStackScrollLayout.isPinnedHeadsUp(getParent()) && !mParent.areGutsExposed() - && !mParent.isDark() + && !mParent.isDozing() && !mParent.showingAmbientPulsing() && (mCheckForDrag == null || !mHandler.hasCallbacks(mCheckForDrag))) { // Only show the menu if we're not a heads up view and guts aren't exposed. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java index d9162c0d60714..d8bda6cbbf835 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java @@ -79,7 +79,7 @@ public class AmbientState { private int mIntrinsicPadding; private int mExpandAnimationTopChange; private ExpandableNotificationRow mExpandingNotification; - private float mDarkAmount; + private float mHideAmount; private boolean mAppearing; private float mPulseHeight = MAX_PULSE_HEIGHT; private float mDozeAmount = 0.0f; @@ -180,23 +180,23 @@ public class AmbientState { mDimmed = dimmed; } - /** In dark mode, we draw as little as possible, assuming a black background */ + /** While dozing, we draw as little as possible, assuming a black background */ public void setDozing(boolean dozing) { mDozing = dozing; } - /** Dark ratio of the status bar **/ - public void setDarkAmount(float darkAmount) { - if (darkAmount == 1.0f && mDarkAmount != darkAmount) { - // Whenever we are fully dark, let's reset the pulseHeight again + /** Hide ratio of the status bar **/ + public void setHideAmount(float hidemount) { + if (hidemount == 1.0f && mHideAmount != hidemount) { + // Whenever we are fully hidden, let's reset the pulseHeight again mPulseHeight = MAX_PULSE_HEIGHT; } - mDarkAmount = darkAmount; + mHideAmount = hidemount; } - /** Returns the dark ratio of the status bar */ - public float getDarkAmount() { - return mDarkAmount; + /** Returns the hide ratio of the status bar */ + public float getHideAmount() { + return mHideAmount; } public void setHideSensitive(boolean hideSensitive) { @@ -295,7 +295,7 @@ public class AmbientState { } public boolean isPulseExpanding() { - return mPulseHeight != MAX_PULSE_HEIGHT && mDozeAmount != 0.0f && mDarkAmount != 1.0f; + return mPulseHeight != MAX_PULSE_HEIGHT && mDozeAmount != 0.0f && mHideAmount != 1.0f; } public boolean isShadeExpanded() { @@ -481,14 +481,15 @@ public class AmbientState { } /** - * @return {@code true } when shade is completely dark: in AOD or ambient display. + * @return {@code true } when shade is completely hidden: in AOD, ambient display or when + * bypassing. */ - public boolean isFullyDark() { - return mDarkAmount == 1; + public boolean isFullyHidden() { + return mHideAmount == 1; } - public boolean isDarkAtAll() { - return mDarkAmount != 0; + public boolean isHiddenAtAll() { + return mHideAmount != 0; } public void setAppearing(boolean appearing) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java index a471d8784c540..bc9e71a72b72f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java @@ -36,7 +36,7 @@ public class AnimationFilter { boolean animateHeight; boolean animateTopInset; boolean animateDimmed; - boolean animateDark; + boolean animateDozing; boolean animateHideSensitive; boolean hasDelays; boolean hasGoToFullShadeEvent; @@ -89,8 +89,8 @@ public class AnimationFilter { return this; } - public AnimationFilter animateDark() { - animateDark = true; + public AnimationFilter animateDozing() { + animateDozing = true; return this; } @@ -145,7 +145,7 @@ public class AnimationFilter { animateHeight |= filter.animateHeight; animateTopInset |= filter.animateTopInset; animateDimmed |= filter.animateDimmed; - animateDark |= filter.animateDark; + animateDozing |= filter.animateDozing; animateHideSensitive |= filter.animateHideSensitive; hasDelays |= filter.hasDelays; mAnimatedProperties.addAll(filter.mAnimatedProperties); @@ -160,7 +160,7 @@ public class AnimationFilter { animateHeight = false; animateTopInset = false; animateDimmed = false; - animateDark = false; + animateDozing = false; animateHideSensitive = false; hasDelays = false; hasGoToFullShadeEvent = false; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ExpandableViewState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ExpandableViewState.java index f28e556229ce2..af26c7c232223 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ExpandableViewState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ExpandableViewState.java @@ -85,7 +85,7 @@ public class ExpandableViewState extends ViewState { public int height; public boolean dimmed; - public boolean dark; + public boolean dozing; public boolean hideSensitive; public boolean belowSpeedBump; public boolean inShelf; @@ -121,7 +121,7 @@ public class ExpandableViewState extends ViewState { ExpandableViewState svs = (ExpandableViewState) viewState; height = svs.height; dimmed = svs.dimmed; - dark = svs.dark; + dozing = svs.dozing; hideSensitive = svs.hideSensitive; belowSpeedBump = svs.belowSpeedBump; clipTopAmount = svs.clipTopAmount; @@ -158,8 +158,8 @@ public class ExpandableViewState extends ViewState { // apply below shelf speed bump expandableView.setBelowSpeedBump(this.belowSpeedBump); - // apply dark - expandableView.setDark(this.dark, false /* animate */, 0 /* delay */); + // apply dozing + expandableView.setDozing(this.dozing, false /* animate */, 0 /* delay */); // apply clipping float oldClipTopAmount = expandableView.getClipTopAmount(); @@ -209,8 +209,8 @@ public class ExpandableViewState extends ViewState { expandableView.setHideSensitive(this.hideSensitive, animationFilter.animateHideSensitive, properties.delay, properties.duration); - // start dark animation - expandableView.setDark(this.dark, animationFilter.animateDark, properties.delay); + // start dozing animation + expandableView.setDozing(this.dozing, animationFilter.animateDozing, properties.delay); if (properties.wasAdded(child) && !hidden) { expandableView.performAddAnimation(properties.delay, properties.duration, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java index 6632ae63d9442..5425c8e613a29 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java @@ -567,7 +567,7 @@ public class NotificationChildrenContainer extends ViewGroup { ? parentState.zTranslation : 0; childState.dimmed = parentState.dimmed; - childState.dark = parentState.dark; + childState.dozing = parentState.dozing; childState.hideSensitive = parentState.hideSensitive; childState.belowSpeedBump = parentState.belowSpeedBump; childState.clipTopAmount = 0; 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 aae4cafe1f5b9..1f0e545ecb0f5 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 @@ -126,7 +126,6 @@ import com.android.systemui.statusbar.notification.row.NotificationGuts; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.row.NotificationSnooze; import com.android.systemui.statusbar.notification.row.StackScrollerDecorView; -import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.HeadsUpAppearanceController; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.HeadsUpTouchHelper; @@ -267,8 +266,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private boolean mTopPaddingNeedsAnimation; private boolean mDimmedNeedsAnimation; private boolean mHideSensitiveNeedsAnimation; - private boolean mDarkNeedsAnimation; - private int mDarkAnimationOriginIndex; + private boolean mDozingNeedsAnimation; private boolean mActivateNeedsAnimation; private boolean mGoToFullShadeNeedsAnimation; private boolean mIsExpanded = true; @@ -409,9 +407,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private final ViewOutlineProvider mOutlineProvider = new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { - if (mAmbientState.isDarkAtAll()) { - float xProgress = mDarkXInterpolator.getInterpolation( - (1 - mLinearDarkAmount) * mBackgroundXFactor); + if (mAmbientState.isHiddenAtAll()) { + float xProgress = mHideXInterpolator.getInterpolation( + (1 - mLinearHideAmount) * mBackgroundXFactor); outline.setRoundRect(mBackgroundAnimationRect, MathUtils.lerp(mCornerRadius / 2.0f, mCornerRadius, xProgress)); @@ -427,14 +425,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private View mForcedScroll; /** - * @see #setDarkAmount(float, float) + * @see #setHideAmount(float, float) */ - private float mInterpolatedDarkAmount = 0f; + private float mInterpolatedHideAmount = 0f; /** - * @see #setDarkAmount(float, float) + * @see #setHideAmount(float, float) */ - private float mLinearDarkAmount = 0f; + private float mLinearHideAmount = 0f; /** * How fast the background scales in the X direction as a factor of the Y expansion. @@ -495,16 +493,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd Dependency.get(VisualStabilityManager.class); protected boolean mClearAllEnabled; - private Interpolator mDarkXInterpolator = Interpolators.FAST_OUT_SLOW_IN; + private Interpolator mHideXInterpolator = Interpolators.FAST_OUT_SLOW_IN; private NotificationPanelView mNotificationPanel; private final ShadeController mShadeController = Dependency.get(ShadeController.class); private final NotificationGutsManager mNotificationGutsManager = Dependency.get(NotificationGutsManager.class); private final NotificationSectionsManager mSectionsManager; - /** - * If the {@link NotificationShelf} should be visible when dark. - */ private boolean mAnimateBottomOnLayout; @Inject @@ -571,7 +566,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd blockingHelperManager.setNotificationShadeExpanded(height); }); - updateWillNotDraw(); + boolean willDraw = mShouldDrawNotificationBackground || DEBUG; + setWillNotDraw(!willDraw); mBackgroundPaint.setAntiAlias(true); if (DEBUG) { mDebugPaint = new Paint(); @@ -814,17 +810,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd int lockScreenRight = getWidth() - mSidePaddings; int lockScreenTop = mSections[0].getCurrentBounds().top; int lockScreenBottom = mSections[NUM_SECTIONS - 1].getCurrentBounds().bottom; - int darkLeft = getWidth() / 2; - int darkTop = mTopPadding; + int hiddenLeft = getWidth() / 2; + int hiddenTop = mTopPadding; - float yProgress = 1 - mInterpolatedDarkAmount; - float xProgress = mDarkXInterpolator.getInterpolation( - (1 - mLinearDarkAmount) * mBackgroundXFactor); + float yProgress = 1 - mInterpolatedHideAmount; + float xProgress = mHideXInterpolator.getInterpolation( + (1 - mLinearHideAmount) * mBackgroundXFactor); - int left = (int) MathUtils.lerp(darkLeft, lockScreenLeft, xProgress); - int right = (int) MathUtils.lerp(darkLeft, lockScreenRight, xProgress); - int top = (int) MathUtils.lerp(darkTop, lockScreenTop, yProgress); - int bottom = (int) MathUtils.lerp(darkTop, lockScreenBottom, yProgress); + int left = (int) MathUtils.lerp(hiddenLeft, lockScreenLeft, xProgress); + int right = (int) MathUtils.lerp(hiddenLeft, lockScreenRight, xProgress); + int top = (int) MathUtils.lerp(hiddenTop, lockScreenTop, yProgress); + int bottom = (int) MathUtils.lerp(hiddenTop, lockScreenBottom, yProgress); mBackgroundAnimationRect.set( left, top, @@ -940,7 +936,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd // Interpolate between semi-transparent notification panel background color // and white AOD separator. float colorInterpolation = MathUtils.smoothStep(0.4f /* start */, 1f /* end */, - mLinearDarkAmount); + mLinearHideAmount); int color = ColorUtils.blendARGB(mBgColor, Color.WHITE, colorInterpolation); if (mCachedBackgroundColor != color) { @@ -1361,11 +1357,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mIsClipped = clipped; } - if (!mAmbientPulseManager.hasNotifications() && mAmbientState.isFullyDark()) { - setClipBounds(null); - } else if (mAmbientState.isDarkAtAll()) { + if (mAmbientState.isHiddenAtAll()) { clipToOutline = true; invalidateOutline(); + if (isFullyHidden()) { + setClipBounds(null); + } } else if (clipped) { setClipBounds(mRequestedClipBounds); } else { @@ -2434,7 +2431,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) private void updateBackground() { // No need to update the background color if it's not being drawn. - if (!mShouldDrawNotificationBackground || mAmbientState.isFullyDark()) { + if (!mShouldDrawNotificationBackground) { return; } @@ -3356,7 +3353,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd generateActivateEvent(); generateDimmedEvent(); generateHideSensitiveEvent(); - generateDarkEvent(); + generateDozingEvent(); generateGoToFullShadeEvent(); generateViewResizeEvent(); generateGroupExpansionEvent(); @@ -3571,17 +3568,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER) - private void generateDarkEvent() { - if (mDarkNeedsAnimation) { + private void generateDozingEvent() { + if (mDozingNeedsAnimation) { AnimationEvent ev = new AnimationEvent(null, - AnimationEvent.ANIMATION_TYPE_DARK, + AnimationEvent.ANIMATION_TYPE_DOZING, new AnimationFilter() - .animateDark() + .animateDozing() .animateY(mShelf)); - ev.darkAnimationOriginIndex = mDarkAnimationOriginIndex; mAnimationEvents.add(ev); } - mDarkNeedsAnimation = false; + mDozingNeedsAnimation = false; } @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER) @@ -4711,18 +4707,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } mAmbientState.setDozing(dozing); if (animate && mAnimationsEnabled) { - mDarkNeedsAnimation = true; - mDarkAnimationOriginIndex = findDarkAnimationOriginIndex(touchWakeUpScreenLocation); + mDozingNeedsAnimation = true; mNeedsAnimation = true; } requestChildrenUpdate(); - updateWillNotDraw(); notifyHeightChangeListener(mShelf); } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) private void updatePanelTranslation() { - setTranslationX(mHorizontalPanelTranslation + mAntiBurnInOffsetX * mInterpolatedDarkAmount); + setTranslationX(mHorizontalPanelTranslation + mAntiBurnInOffsetX * mInterpolatedHideAmount); } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) @@ -4732,49 +4726,30 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } /** - * Updates whether or not this Layout will perform its own custom drawing (i.e. whether or - * not {@link #onDraw(Canvas)} is called). This method should be called whenever the - * {@link #mAmbientState}'s dark mode is toggled. - */ - @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) - private void updateWillNotDraw() { - boolean willDraw = mShouldDrawNotificationBackground || DEBUG; - setWillNotDraw(!willDraw); - } - - @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) - private void setDarkAmount(float darkAmount) { - setDarkAmount(darkAmount, darkAmount); - } - - /** - * Sets the current dark amount. + * Sets the current hide amount. * - * @param linearDarkAmount The dark amount that follows linear interpoloation in the + * @param linearHideAmount The hide amount that follows linear interpoloation in the * animation, * i.e. animates from 0 to 1 or vice-versa in a linear manner. - * @param interpolatedDarkAmount The dark amount that follows the actual interpolation of the + * @param interpolatedHideAmount The hide amount that follows the actual interpolation of the * animation curve. */ @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) - public void setDarkAmount(float linearDarkAmount, float interpolatedDarkAmount) { - mLinearDarkAmount = linearDarkAmount; - mInterpolatedDarkAmount = interpolatedDarkAmount; - boolean wasFullyDark = mAmbientState.isFullyDark(); - boolean wasDarkAtAll = mAmbientState.isDarkAtAll(); - mAmbientState.setDarkAmount(interpolatedDarkAmount); - boolean nowFullyDark = mAmbientState.isFullyDark(); - boolean nowDarkAtAll = mAmbientState.isDarkAtAll(); - if (nowFullyDark != wasFullyDark) { - updateContentHeight(); - if (nowFullyDark) { - updateDarkShelfVisibility(); - } + public void setHideAmount(float linearHideAmount, float interpolatedHideAmount) { + mLinearHideAmount = linearHideAmount; + mInterpolatedHideAmount = interpolatedHideAmount; + boolean wasFullyHidden = mAmbientState.isFullyHidden(); + boolean wasHiddenAtAll = mAmbientState.isHiddenAtAll(); + mAmbientState.setHideAmount(interpolatedHideAmount); + boolean nowFullyHidden = mAmbientState.isFullyHidden(); + boolean nowHiddenAtAll = mAmbientState.isHiddenAtAll(); + if (nowFullyHidden != wasFullyHidden) { + setVisibility(mAmbientState.isFullyHidden() ? View.INVISIBLE : View.VISIBLE); } - if (!wasDarkAtAll && nowDarkAtAll) { + if (!wasHiddenAtAll && nowHiddenAtAll) { resetExposedMenuView(true /* animate */, true /* animate */); } - if (nowFullyDark != wasFullyDark || wasDarkAtAll != nowDarkAtAll) { + if (nowFullyHidden != wasFullyHidden || wasHiddenAtAll != nowHiddenAtAll) { invalidateOutline(); } updateAlgorithmHeightAndPadding(); @@ -4783,42 +4758,18 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd requestChildrenUpdate(); } - private void updateDarkShelfVisibility() { - DozeParameters dozeParameters = DozeParameters.getInstance(mContext); - if (dozeParameters.shouldControlScreenOff()) { - mShelf.fadeInTranslating(); - } - updateClipping(); - } - @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER) - public void notifyDarkAnimationStart(boolean dark) { - // We only swap the scaling factor if we're fully dark or fully awake to avoid + public void notifyHideAnimationStart(boolean hide) { + // We only swap the scaling factor if we're fully hidden or fully awake to avoid // interpolation issues when playing with the power button. - if (mInterpolatedDarkAmount == 0 || mInterpolatedDarkAmount == 1) { - mBackgroundXFactor = dark ? 1.8f : 1.5f; - mDarkXInterpolator = dark + if (mInterpolatedHideAmount == 0 || mInterpolatedHideAmount == 1) { + mBackgroundXFactor = hide ? 1.8f : 1.5f; + mHideXInterpolator = hide ? Interpolators.FAST_OUT_SLOW_IN_REVERSE : Interpolators.FAST_OUT_SLOW_IN; } } - @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER) - private int findDarkAnimationOriginIndex(@Nullable PointF screenLocation) { - if (screenLocation == null || screenLocation.y < mTopPadding) { - return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE; - } - if (screenLocation.y > getBottomMostNotificationBottom()) { - return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_BELOW; - } - View child = getClosestChildAtRawPosition(screenLocation.x, screenLocation.y); - if (child != null) { - return getNotGoneIndex(child); - } else { - return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE; - } - } - @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) private int getNotGoneIndex(View child) { int count = getChildCount(); @@ -5416,8 +5367,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) - public boolean isFullyDark() { - return mAmbientState.isFullyDark(); + public boolean isFullyHidden() { + return mAmbientState.isFullyHidden(); } /** @@ -5661,7 +5612,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } /** - * Set the amount how much we're dozing. This is different from how dark the shade is, when + * Set the amount how much we're dozing. This is different from how hidden the shade is, when * the notification is pulsing. */ public void setDozeAmount(float dozeAmount) { @@ -5880,7 +5831,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd .animateY() .animateZ(), - // ANIMATION_TYPE_DARK + // ANIMATION_TYPE_DOZING null, // Unused // ANIMATION_TYPE_GO_TO_FULL_SHADE @@ -5944,7 +5895,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd // ANIMATION_TYPE_EVERYTHING new AnimationFilter() .animateAlpha() - .animateDark() + .animateDozing() .animateDimmed() .animateHideSensitive() .animateHeight() @@ -5976,7 +5927,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd // ANIMATION_TYPE_CHANGE_POSITION StackStateAnimator.ANIMATION_DURATION_STANDARD, - // ANIMATION_TYPE_DARK + // ANIMATION_TYPE_DOZING StackStateAnimator.ANIMATION_DURATION_WAKEUP, // ANIMATION_TYPE_GO_TO_FULL_SHADE @@ -6014,7 +5965,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd static final int ANIMATION_TYPE_ACTIVATED_CHILD = 4; static final int ANIMATION_TYPE_DIMMED = 5; static final int ANIMATION_TYPE_CHANGE_POSITION = 6; - static final int ANIMATION_TYPE_DARK = 7; + static final int ANIMATION_TYPE_DOZING = 7; static final int ANIMATION_TYPE_GO_TO_FULL_SHADE = 8; static final int ANIMATION_TYPE_HIDE_SENSITIVE = 9; static final int ANIMATION_TYPE_VIEW_RESIZE = 10; @@ -6025,16 +5976,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd static final int ANIMATION_TYPE_HEADS_UP_OTHER = 15; static final int ANIMATION_TYPE_EVERYTHING = 16; - static final int DARK_ANIMATION_ORIGIN_INDEX_ABOVE = -1; - static final int DARK_ANIMATION_ORIGIN_INDEX_BELOW = -2; - final long eventStartTime; final ExpandableView mChangingView; final int animationType; final AnimationFilter filter; final long length; View viewAfterChangingView; - int darkAnimationOriginIndex; boolean headsUpFromBottom; AnimationEvent(ExpandableView view, int type) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java index 2980ee4ac45e8..ccee2a1d9b9f5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java @@ -213,7 +213,7 @@ public class StackScrollAlgorithm { private void updateDimmedActivatedHideSensitive(AmbientState ambientState, StackScrollAlgorithmState algorithmState) { boolean dimmed = ambientState.isDimmed(); - boolean dark = ambientState.isFullyDark(); + boolean hidden = ambientState.isFullyHidden(); boolean hideSensitive = ambientState.isHideSensitive(); View activatedChild = ambientState.getActivatedChild(); int childCount = algorithmState.visibleChildren.size(); @@ -221,7 +221,7 @@ public class StackScrollAlgorithm { ExpandableView child = algorithmState.visibleChildren.get(i); ExpandableViewState childViewState = child.getViewState(); childViewState.dimmed = dimmed; - childViewState.dark = dark; + childViewState.dozing = hidden; childViewState.hideSensitive = hideSensitive; boolean isActivatedChild = activatedChild == child; if (dimmed && isActivatedChild) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java index 7332b034b9bf0..ea1ceec4e3b3d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java @@ -172,7 +172,7 @@ public class StackStateAnimator { || viewState.alpha != child.getAlpha() || viewState.height != child.getActualHeight() || viewState.clipTopAmount != child.getClipTopAmount() - || viewState.dark != child.isDark())) { + || viewState.dozing != child.isDozing())) { mAnimationProperties.delay = mCurrentAdditionalDelay + calculateChildAnimationDelay(viewState); } 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 e8ca3eef24de5..177b72a01f851 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java @@ -15,7 +15,9 @@ import androidx.collection.ArrayMap; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.util.ContrastColorUtil; +import com.android.settingslib.Utils; import com.android.systemui.Dependency; +import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; @@ -24,6 +26,7 @@ import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.StatusBarIconView; +import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -41,12 +44,14 @@ public class NotificationIconAreaController implements DarkReceiver, StatusBarStateController.StateListener { public static final String LOW_PRIORITY = "low_priority"; + private static final long AOD_ICONS_APPEAR_DURATION = 200; private final ContrastColorUtil mContrastColorUtil; private final NotificationEntryManager mEntryManager; private final Runnable mUpdateStatusBarIcons = this::updateStatusBarIcons; private final StatusBarStateController mStatusBarStateController; private final NotificationMediaManager mMediaManager; + private final DozeParameters mDozeParameters; @VisibleForTesting final NotificationListener.NotificationSettingsListener mSettingsListener = new NotificationListener.NotificationSettingsListener() { @@ -72,17 +77,17 @@ public class NotificationIconAreaController implements DarkReceiver, private NotificationIconContainer mShelfIcons; protected View mCenteredIconArea; private NotificationIconContainer mCenteredIcon; + private NotificationIconContainer mAodIcons; private StatusBarIconView mCenteredIconView; private final Rect mTintArea = new Rect(); private ViewGroup mNotificationScrollLayout; private Context mContext; - private boolean mFullyDark; private boolean mShowLowPriority = true; + private int mAodIconAppearTranslation; - /** - * Ratio representing being awake or in ambient mode, where 1 is dark and 0 awake. - */ - private float mDarkAmount; + private boolean mAnimationsEnabled; + private int mAodIconTint; + private boolean mFullyHidden; public NotificationIconAreaController(Context context, StatusBar statusBar, StatusBarStateController statusBarStateController, @@ -96,8 +101,10 @@ public class NotificationIconAreaController implements DarkReceiver, mStatusBarStateController.addCallback(this); mMediaManager = notificationMediaManager; notificationListener.addNotificationSettingsListener(mSettingsListener); + mDozeParameters = DozeParameters.getInstance(mContext); initializeNotificationAreaViews(context); + reloadAodColor(); } protected View inflateIconArea(LayoutInflater inflater) { @@ -118,6 +125,24 @@ public class NotificationIconAreaController implements DarkReceiver, mCenteredIconArea = layoutInflater.inflate(R.layout.center_icon_area, null); mCenteredIcon = mCenteredIconArea.findViewById(R.id.centeredIcon); + + initAodIcons(); + } + + public void initAodIcons() { + boolean changed = mAodIcons != null; + if (changed) { + mAodIcons.setAnimationsEnabled(false); + mAodIcons.removeAllViews(); + } + mAodIcons = mStatusBar.getStatusBarWindow().findViewById( + R.id.clock_notification_icon_container); + mAodIcons.setOnLockScreen(true); + updateAodIconsVisibility(); + updateAnimations(); + if (changed) { + updateAodIcons(); + } } public void setupShelf(NotificationShelf shelf) { @@ -140,6 +165,10 @@ public class NotificationIconAreaController implements DarkReceiver, View child = mCenteredIcon.getChildAt(i); child.setLayoutParams(params); } + for (int i = 0; i < mAodIcons.getChildCount(); i++) { + View child = mAodIcons.getChildAt(i); + child.setLayoutParams(params); + } } @NonNull @@ -152,6 +181,8 @@ public class NotificationIconAreaController implements DarkReceiver, Resources res = context.getResources(); mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size); mIconHPadding = res.getDimensionPixelSize(R.dimen.status_bar_icon_padding); + mAodIconAppearTranslation = res.getDimensionPixelSize( + R.dimen.shelf_appear_translation); } /** @@ -236,7 +267,7 @@ public class NotificationIconAreaController implements DarkReceiver, return false; } // showAmbient == show in shade but not shelf - if ((!showAmbient || mFullyDark) && entry.shouldSuppressStatusBar()) { + if (!showAmbient && entry.shouldSuppressStatusBar()) { return false; } return true; @@ -249,6 +280,7 @@ public class NotificationIconAreaController implements DarkReceiver, updateStatusBarIcons(); updateShelfIcons(); updateCenterIcon(); + updateAodIcons(); applyNotificationIconsTint(); } @@ -256,10 +288,10 @@ public class NotificationIconAreaController implements DarkReceiver, private void updateShelfIcons() { updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons, true /* showAmbient */, - !mFullyDark /* showLowPriority */, + true /* showLowPriority */, false /* hideDismissed */, - mFullyDark /* hideRepliedMessages */, - mFullyDark /* hideCurrentMedia */, + false /* hideRepliedMessages */, + false /* hideCurrentMedia */, true /* hide centered icon */); } @@ -276,13 +308,23 @@ public class NotificationIconAreaController implements DarkReceiver, private void updateCenterIcon() { updateIconsForLayout(entry -> entry.centeredIcon, mCenteredIcon, false /* showAmbient */, - !mFullyDark /* showLowPriority */, + true /* showLowPriority */, false /* hideDismissed */, false /* hideRepliedMessages */, - mFullyDark /* hideCurrentMedia */, + false /* hideCurrentMedia */, false /* hide centered icon */); } + public void updateAodIcons() { + updateIconsForLayout(entry -> entry.aodIcon, mAodIcons, + false /* showAmbient */, + mShowLowPriority /* showLowPriority */, + true /* hideDismissed */, + true /* hideRepliedMessages */, + true /* hideCurrentMedia */, + true /* hide centered icon */); + } + @VisibleForTesting boolean shouldShouldLowPriorityIcons() { return mShowLowPriority; @@ -424,6 +466,8 @@ public class NotificationIconAreaController implements DarkReceiver, iv.executeOnLayout(() -> updateTintForIcon(iv, mCenteredIconTint)); } } + + updateAodIconColors(); } private void updateTintForIcon(StatusBarIconView v, int tint) { @@ -437,12 +481,6 @@ public class NotificationIconAreaController implements DarkReceiver, v.setDecorColor(tint); } - public void setDark(boolean dark) { - mNotificationIcons.setDark(dark, false, 0); - mShelfIcons.setDark(dark, false, 0); - mCenteredIcon.setDark(dark, false, 0); - } - /** * Shows the icon view given in the center. */ @@ -463,12 +501,78 @@ public class NotificationIconAreaController implements DarkReceiver, } @Override - public void onDozeAmountChanged(float linear, float eased) { - mDarkAmount = linear; - boolean fullyDark = mDarkAmount == 1f; - if (mFullyDark != fullyDark) { - mFullyDark = fullyDark; - updateShelfIcons(); + public void onDozingChanged(boolean isDozing) { + boolean animate = mDozeParameters.getAlwaysOn() + && !mDozeParameters.getDisplayNeedsBlanking(); + mAodIcons.setDozing(isDozing, animate, 0); + } + + public void setAnimationsEnabled(boolean enabled) { + mAnimationsEnabled = enabled; + updateAnimations(); + } + + @Override + public void onStateChanged(int newState) { + updateAnimations(); + } + + private void updateAnimations() { + boolean inShade = mStatusBarStateController.getState() == StatusBarState.SHADE; + mAodIcons.setAnimationsEnabled(mAnimationsEnabled && !inShade); + mCenteredIcon.setAnimationsEnabled(mAnimationsEnabled && inShade); + mNotificationIcons.setAnimationsEnabled(mAnimationsEnabled && inShade); + } + + public void onThemeChanged() { + reloadAodColor(); + updateAodIconColors(); + } + + public void appearAodIcons() { + DozeParameters dozeParameters = DozeParameters.getInstance(mContext); + if (dozeParameters.shouldControlScreenOff()) { + mAodIcons.setTranslationY(-mAodIconAppearTranslation); + mAodIcons.setAlpha(0); + mAodIcons.animate() + .setInterpolator(Interpolators.DECELERATE_QUINT) + .translationY(0) + .setDuration(AOD_ICONS_APPEAR_DURATION) + .start(); + mAodIcons.animate() + .alpha(1) + .setInterpolator(Interpolators.LINEAR) + .setDuration(AOD_ICONS_APPEAR_DURATION) + .start(); } } + + private void reloadAodColor() { + mAodIconTint = Utils.getColorAttrDefaultColor(mContext, + R.attr.wallpaperTextColor); + } + private void updateAodIconColors() { + for (int i = 0; i < mAodIcons.getChildCount(); i++) { + final StatusBarIconView iv = (StatusBarIconView) mAodIcons.getChildAt(i); + if (iv.getWidth() != 0) { + updateTintForIcon(iv, mAodIconTint); + } else { + iv.executeOnLayout(() -> updateTintForIcon(iv, mAodIconTint)); + } + } + } + + public void setFullyHidden(boolean fullyHidden) { + if (mFullyHidden != fullyHidden) { + mFullyHidden = fullyHidden; + if (fullyHidden) { + appearAodIcons(); + } + updateAodIconsVisibility(); + } + } + + private void updateAodIconsVisibility() { + mAodIcons.setVisibility(mFullyHidden ? View.VISIBLE : View.INVISIBLE); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java index 009afca5b0345..e51baf306328c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java @@ -128,7 +128,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { } }.setDuration(CONTENT_FADE_DURATION); - private static final int MAX_VISIBLE_ICONS_WHEN_DARK = 5; + private static final int MAX_VISIBLE_ICONS_ON_LOCK = 5; public static final int MAX_STATIC_ICONS = 4; private static final int MAX_DOTS = 1; @@ -141,7 +141,8 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { private int mActualLayoutWidth = NO_VALUE; private float mActualPaddingEnd = NO_VALUE; private float mActualPaddingStart = NO_VALUE; - private boolean mDark; + private boolean mDozing; + private boolean mOnLockScreen; private boolean mChangingViewPositions; private int mAddAnimationStartIndex = -1; private int mCannedAnimationStartIndex = -1; @@ -288,7 +289,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { } } if (child instanceof StatusBarIconView) { - ((StatusBarIconView) child).setDark(mDark, false, 0); + ((StatusBarIconView) child).setDozing(mDozing, false, 0); } } @@ -315,7 +316,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { @Override public void onViewRemoved(View child) { super.onViewRemoved(child); - if (child instanceof StatusBarIconView) { + if (mAnimationsEnabled && child instanceof StatusBarIconView) { boolean isReplacingIcon = isReplacingIcon(child); final StatusBarIconView icon = (StatusBarIconView) child; if (icon.getVisibleState() != StatusBarIconView.STATE_HIDDEN @@ -372,7 +373,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { float translationX = getActualPaddingStart(); int firstOverflowIndex = -1; int childCount = getChildCount(); - int maxVisibleIcons = mDark ? MAX_VISIBLE_ICONS_WHEN_DARK : + int maxVisibleIcons = mOnLockScreen ? MAX_VISIBLE_ICONS_ON_LOCK : mIsStaticLayout ? MAX_STATIC_ICONS : childCount; float layoutEnd = getLayoutEnd(); float overflowStart = getMaxOverflowStart(); @@ -389,8 +390,8 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { boolean forceOverflow = mSpeedBumpIndex != -1 && i >= mSpeedBumpIndex && iconState.iconAppearAmount > 0.0f || i >= maxVisibleIcons; boolean noOverflowAfter = i == childCount - 1; - float drawingScale = mDark && view instanceof StatusBarIconView - ? ((StatusBarIconView) view).getIconScaleFullyDark() + float drawingScale = mOnLockScreen && view instanceof StatusBarIconView + ? ((StatusBarIconView) view).getIconScaleIncreased() : 1f; if (mOpenedAmount != 0.0f) { noOverflowAfter = noOverflowAfter && !hasAmbient && !forceOverflow; @@ -437,7 +438,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { mFirstVisibleIconState = mIconStates.get(getChildAt(0)); } - boolean center = mDark; + boolean center = mOnLockScreen; if (center && translationX < getLayoutEnd()) { float initialTranslation = mFirstVisibleIconState == null ? 0 : mFirstVisibleIconState.xTranslation; @@ -557,13 +558,13 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { mChangingViewPositions = changingViewPositions; } - public void setDark(boolean dark, boolean fade, long delay) { - mDark = dark; + public void setDozing(boolean dozing, boolean fade, long delay) { + mDozing = dozing; mDisallowNextAnimation |= !fade; for (int i = 0; i < getChildCount(); i++) { View view = getChildAt(i); if (view instanceof StatusBarIconView) { - ((StatusBarIconView) view).setDark(dark, fade, delay); + ((StatusBarIconView) view).setDozing(dozing, fade, delay); } } } @@ -667,6 +668,10 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { } } + public void setOnLockScreen(boolean onLockScreen) { + mOnLockScreen = onLockScreen; + } + public class IconState extends ViewState { public static final int NO_VALUE = NotificationIconContainer.NO_VALUE; public float iconAppearAmount = 1.0f; 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 1d1ae3746b382..1ee1c42c81d02 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -345,6 +345,9 @@ public class NotificationPanelView extends PanelView implements private int mThemeResId; private KeyguardIndicationController mKeyguardIndicationController; private Consumer mAffordanceLaunchListener; + private int mShelfHeight; + private Runnable mOnReinflationListener; + private int mDarkIconSize; @Inject public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs, @@ -452,6 +455,9 @@ public class NotificationPanelView extends PanelView implements R.dimen.keyguard_indication_bottom_padding); mQsNotificationTopPadding = getResources().getDimensionPixelSize( R.dimen.qs_notification_padding); + mShelfHeight = getResources().getDimensionPixelSize(R.dimen.notification_shelf_height); + mDarkIconSize = getResources().getDimensionPixelSize( + R.dimen.status_bar_icon_drawing_size_dark); } /** @@ -544,6 +550,9 @@ public class NotificationPanelView extends PanelView implements setKeyguardStatusViewVisibility(mBarState, false, false); setKeyguardBottomAreaVisibility(mBarState, false); + if (mOnReinflationListener != null) { + mOnReinflationListener.run(); + } } private void initBottomArea() { @@ -674,7 +683,8 @@ public class NotificationPanelView extends PanelView implements mNotificationStackScroller.getIntrinsicContentHeight(), getExpandedFraction(), totalHeight, - mKeyguardStatusView.getHeight(), + (int) (mKeyguardStatusView.getHeight() + - mShelfHeight / 2.0f - mDarkIconSize / 2.0f), clockPreferredY, hasCustomClock(), mNotificationStackScroller.getVisibleNotificationCount() != 0, @@ -3063,10 +3073,6 @@ public class NotificationPanelView extends PanelView implements return mNotificationStackScroller.hasPulsingNotifications(); } - public boolean isFullyDark() { - return mNotificationStackScroller.isFullyDark(); - } - public ActivatableNotificationView getActivatedChild() { return mNotificationStackScroller.getActivatedChild(); } @@ -3114,6 +3120,10 @@ public class NotificationPanelView extends PanelView implements mAnimateNextPositionUpdate = true; } + public void setOnReinflationListener(Runnable onReinflationListener) { + mOnReinflationListener = onReinflationListener; + } + /** * Panel and QS expansion callbacks. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java index ca762cdf07f30..27c94d277cc43 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java @@ -36,6 +36,9 @@ import com.android.systemui.plugins.qs.QS; import com.android.systemui.statusbar.notification.AboveShelfObserver; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; +import java.util.ArrayList; +import java.util.Comparator; + /** * The container with notification stack scroller and quick settings inside. */ @@ -54,6 +57,9 @@ public class NotificationsQuickSettingsContainer extends FrameLayout private int mBottomPadding; private int mStackScrollerMargin; private boolean mHasViewsAboveShelf; + private ArrayList mDrawingOrderedChildren = new ArrayList<>(); + private ArrayList mLayoutDrawingOrder = new ArrayList<>(); + private final Comparator mIndexComparator = Comparator.comparingInt(this::indexOfChild); public NotificationsQuickSettingsContainer(Context context, AttributeSet attrs) { super(context, attrs); @@ -107,35 +113,44 @@ public class NotificationsQuickSettingsContainer extends FrameLayout } @Override - protected boolean drawChild(Canvas canvas, View child, long drawingTime) { - boolean userSwitcherVisible = mInflated && mUserSwitcher.getVisibility() == View.VISIBLE; - boolean statusBarVisible = mKeyguardStatusBar.getVisibility() == View.VISIBLE; - - final boolean qsBottom = mHasViewsAboveShelf; - View stackQsTop = qsBottom ? mStackScroller : mQsFrame; - View stackQsBottom = !qsBottom ? mStackScroller : mQsFrame; + protected void dispatchDraw(Canvas canvas) { // Invert the order of the scroll view and user switcher such that the notifications receive // touches first but the panel gets drawn above. - if (child == mQsFrame) { - return super.drawChild(canvas, userSwitcherVisible && statusBarVisible ? mUserSwitcher - : statusBarVisible ? mKeyguardStatusBar - : userSwitcherVisible ? mUserSwitcher - : stackQsBottom, drawingTime); - } else if (child == mStackScroller) { - return super.drawChild(canvas, - userSwitcherVisible && statusBarVisible ? mKeyguardStatusBar - : statusBarVisible || userSwitcherVisible ? stackQsBottom - : stackQsTop, - drawingTime); - } else if (child == mUserSwitcher) { - return super.drawChild(canvas, - userSwitcherVisible && statusBarVisible ? stackQsBottom - : stackQsTop, - drawingTime); - } else if (child == mKeyguardStatusBar) { - return super.drawChild(canvas, - stackQsTop, - drawingTime); + mDrawingOrderedChildren.clear(); + mLayoutDrawingOrder.clear(); + if (mInflated && mUserSwitcher.getVisibility() == View.VISIBLE) { + mDrawingOrderedChildren.add(mUserSwitcher); + mLayoutDrawingOrder.add(mUserSwitcher); + } + if (mKeyguardStatusBar.getVisibility() == View.VISIBLE) { + mDrawingOrderedChildren.add(mKeyguardStatusBar); + mLayoutDrawingOrder.add(mKeyguardStatusBar); + } + if (mStackScroller.getVisibility() == View.VISIBLE) { + mDrawingOrderedChildren.add(mStackScroller); + mLayoutDrawingOrder.add(mStackScroller); + } + if (mQsFrame.getVisibility() == View.VISIBLE) { + mDrawingOrderedChildren.add(mQsFrame); + mLayoutDrawingOrder.add(mQsFrame); + } + + if (mHasViewsAboveShelf) { + // StackScroller needs to be on top + mDrawingOrderedChildren.remove(mStackScroller); + mDrawingOrderedChildren.add(mStackScroller); + } + + // Let's now find the order that the view has when drawing regulary by sorting + mLayoutDrawingOrder.sort(mIndexComparator); + super.dispatchDraw(canvas); + } + + @Override + protected boolean drawChild(Canvas canvas, View child, long drawingTime) { + int layoutIndex = mLayoutDrawingOrder.indexOf(child); + if (layoutIndex >= 0) { + return super.drawChild(canvas, mDrawingOrderedChildren.get(layoutIndex), drawingTime); } else { return super.drawChild(canvas, child, drawingTime); } 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 8ad25bfc1f4d6..3cde49300d935 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -811,8 +811,10 @@ public class StatusBar extends SystemUI implements DemoMode, mNotificationIconAreaController = SystemUIFactory.getInstance() .createNotificationIconAreaController(context, this, mStatusBarStateController, mNotificationListener); + mWakeUpCoordinator.setIconAreaController(mNotificationIconAreaController); inflateShelf(); mNotificationIconAreaController.setupShelf(mNotificationShelf); + mNotificationPanel.setOnReinflationListener(mNotificationIconAreaController::initAodIcons); Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mNotificationIconAreaController); // Allow plugins to reference DarkIconDispatcher and StatusBarStateController @@ -1189,6 +1191,7 @@ public class StatusBar extends SystemUI implements DemoMode, if (mAmbientIndicationContainer instanceof AutoReinflateContainer) { ((AutoReinflateContainer) mAmbientIndicationContainer).inflateLayout(); } + mNotificationIconAreaController.onThemeChanged(); } @Override @@ -3666,8 +3669,9 @@ public class StatusBar extends SystemUI implements DemoMode, private void updateNotificationPanelTouchState() { boolean goingToSleepWithoutAnimation = isGoingToSleep() && !DozeParameters.getInstance(mContext).shouldControlScreenOff(); - mNotificationPanel.setTouchAndAnimationDisabled((!mDeviceInteractive && !mPulsing) - || goingToSleepWithoutAnimation); + boolean disabled = (!mDeviceInteractive && !mPulsing) || goingToSleepWithoutAnimation; + mNotificationPanel.setTouchAndAnimationDisabled(disabled); + mNotificationIconAreaController.setAnimationsEnabled(!disabled); } final ScreenLifecycle.Observer mScreenObserver = new ScreenLifecycle.Observer() { 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 7d5f23bc1e582..de266592533d4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -415,7 +415,6 @@ public class StatusBarWindowView extends FrameLayout { } boolean intercept = false; if (mNotificationPanel.isFullyExpanded() - && stackScrollLayout.getVisibility() == View.VISIBLE && mStatusBarStateController.getState() == StatusBarState.KEYGUARD && !mService.isBouncerShowing() && !mService.isDozing()) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java index 8077e3fbaa0a9..8d3c549880016 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java @@ -37,9 +37,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.app.AppOpsManager; -import android.app.Notification; import android.app.NotificationChannel; -import android.os.UserHandle; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.testing.TestableLooper.RunWithLooper; @@ -140,7 +138,7 @@ public class ExpandableNotificationRowTest extends SysuiTestCase { @Test public void testIconColorShouldBeUpdatedWhenSettingDark() throws Exception { ExpandableNotificationRow row = spy(mNotificationTestHelper.createRow()); - row.setDark(true, false, 0); + row.setDozing(true, false, 0); verify(row).updateShelfIconColor(); } @@ -212,7 +210,7 @@ public class ExpandableNotificationRowTest extends SysuiTestCase { @Test public void testClickSound() throws Exception { assertTrue("Should play sounds by default.", mGroupRow.isSoundEffectsEnabled()); - mGroupRow.setDark(true /* dark */, false /* fade */, 0 /* delay */); + mGroupRow.setDozing(true /* dark */, false /* fade */, 0 /* delay */); mGroupRow.setSecureStateProvider(()-> false); assertFalse("Shouldn't play sounds when dark and trusted.", mGroupRow.isSoundEffectsEnabled()); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java index 5cd0ca7efa9ef..377aa0bacd36e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java @@ -83,8 +83,8 @@ public class NotificationContentViewTest extends SysuiTestCase { @UiThreadTest public void animationStartType_getsClearedAfterUpdatingVisibilitiesWithoutAnimation() { mView.setHeadsUp(true); - mView.setDark(true, false, 0); - mView.setDark(false, true, 0); + mView.setDozing(true, false, 0); + mView.setDozing(false, true, 0); mView.setHeadsUpAnimatingAway(true); assertFalse(mView.isAnimatingVisibleType()); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java index 662edd2d58cd6..c1780467daf92 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java @@ -173,7 +173,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { doNothing().when(mGroupManager).collapseAllGroups(); doNothing().when(mExpandHelper).cancelImmediately(); doNothing().when(notificationShelf).setAnimationsEnabled(anyBoolean()); - doNothing().when(notificationShelf).fadeInTranslating(); } @After @@ -194,9 +193,9 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { public void testAntiBurnInOffset() { final int burnInOffset = 30; mStackScroller.setAntiBurnInOffsetX(burnInOffset); - mStackScroller.setDarkAmount(0.0f, 0.0f); + mStackScroller.setHideAmount(0.0f, 0.0f); Assert.assertEquals(0 /* expected */, mStackScroller.getTranslationX(), 0.01 /* delta */); - mStackScroller.setDarkAmount(1.0f, 1.0f); + mStackScroller.setHideAmount(1.0f, 1.0f); Assert.assertEquals(burnInOffset /* expected */, mStackScroller.getTranslationX(), 0.01 /* delta */); } @@ -386,7 +385,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { NotificationSwipeHelper swipeActionHelper = (NotificationSwipeHelper) mStackScroller.getSwipeActionHelper(); swipeActionHelper.setExposedMenuView(new View(mContext)); - mStackScroller.setDarkAmount(0.1f, 0.1f); + mStackScroller.setHideAmount(0.1f, 0.1f); assertNull(swipeActionHelper.getExposedMenuView()); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java index 7f7a3e7e7cd6f..61b753079f0b7 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java @@ -20,6 +20,7 @@ import static android.provider.Settings.Secure.NOTIFICATION_NEW_INTERRUPTION_MOD import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; import android.provider.Settings; import android.testing.AndroidTestingRunner; @@ -27,6 +28,7 @@ import android.testing.TestableLooper; import androidx.test.filters.SmallTest; +import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationListener; @@ -36,6 +38,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.MockitoAnnotations; @SmallTest @@ -48,6 +51,10 @@ public class NotificationIconAreaControllerTest extends SysuiTestCase { @Mock StatusBar mStatusBar; @Mock + StatusBarWindowView mStatusBarWindowView; + @Mock + NotificationIconContainer mIconContainer; + @Mock StatusBarStateController mStatusBarStateController; @Mock private NotificationMediaManager mMediaManager; @@ -56,7 +63,9 @@ public class NotificationIconAreaControllerTest extends SysuiTestCase { @Before public void setup() { MockitoAnnotations.initMocks(this); - + when(mStatusBar.getStatusBarWindow()).thenReturn(mStatusBarWindowView); + when(mStatusBarWindowView.findViewById(R.id.clock_notification_icon_container)).thenReturn( + mIconContainer); mController = new NotificationIconAreaController(mContext, mStatusBar, mStatusBarStateController, mListener, mMediaManager); } From bc083fdf5f4ede6b1bb6aa3af9f59e0ead3092fa Mon Sep 17 00:00:00 2001 From: Elisa Pascual Trevino Date: Wed, 12 Jun 2019 22:10:23 +0000 Subject: [PATCH 14/34] Revert "Prevent dismissing starting window when reopening app" This reverts commit 7c88cf83035e331bb4c4ccb519c8200f2e9d083f. Original bug: b/134561008 Reason for revert: b/135084202 Change-Id: Ib4c17f98d66c9efb10d800d9ba585d14be4ac878 (cherry picked from commit 6e814f9f3356cd56623c47ec50e2a84ec6bc10be) --- .../core/java/com/android/server/wm/AppWindowToken.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index 60cfe14f40803..4a9a3f71f90e5 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -540,14 +540,6 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree // If the app was already visible, don't reset the waitingToShow state. if (isHidden()) { waitingToShow = true; - - // Let's reset the draw state in order to prevent the starting window to be - // immediately dismissed when the app still has the surface. - forAllWindows(w -> { - if (w.mAttrs.type != TYPE_APPLICATION_STARTING) { - w.mWinAnimator.resetDrawState(); - } - }, true /* traverseTopToBottom */); } } From 1cff983426fde3c289f26d8e3c5d9d28f2511dcf Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Thu, 13 Jun 2019 10:08:19 -0700 Subject: [PATCH 15/34] Do not execute face auth when notification There's a big power cost and very high likelihood of failing Test: manual Test: atest StatusBarTest Fixes: 134551789 Change-Id: I6593797316e6e24180ad79a37aed2de8aa12fd96 (cherry picked from commit a422c09e020082710fbaddcef58cb3bc84a51d7e) --- .../src/com/android/systemui/statusbar/phone/StatusBar.java | 5 ++--- .../com/android/systemui/statusbar/phone/StatusBarTest.java | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) 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 a572e8fc37925..1351b018b5f9f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3947,9 +3947,8 @@ public class StatusBar extends SystemUI implements DemoMode, mStatusBarWindow.suppressWakeUpGesture(true); } - boolean passiveAuthInterrupt = reason == DozeLog.PULSE_REASON_NOTIFICATION || ( - reason == DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN - && mWakeLockScreenPerformsAuth); + boolean passiveAuthInterrupt = reason == DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN + && mWakeLockScreenPerformsAuth; // Set the state to pulsing, so ScrimController will know what to do once we ask it to // execute the transition. The pulse callback will then be invoked when the scrims // are black, indicating that StatusBar is ready to present the rest of the UI. diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java index 5e381ffd2b269..cffd57b35f04f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java @@ -639,10 +639,10 @@ public class StatusBarTest extends SysuiTestCase { @Test public void testPulseWhileDozing_notifyAuthInterrupt() { HashSet reasonsWantingAuth = new HashSet<>( - Collections.singletonList(DozeLog.PULSE_REASON_NOTIFICATION)); + Collections.singletonList(DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN)); HashSet reasonsSkippingAuth = new HashSet<>( Arrays.asList(DozeLog.PULSE_REASON_INTENT, - DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN, + DozeLog.PULSE_REASON_NOTIFICATION, DozeLog.PULSE_REASON_SENSOR_SIGMOTION, DozeLog.REASON_SENSOR_PICKUP, DozeLog.REASON_SENSOR_DOUBLE_TAP, @@ -661,6 +661,7 @@ public class StatusBarTest extends SysuiTestCase { return null; }).when(mDozeScrimController).pulse(any(), anyInt()); + mStatusBar.mDozeServiceHost.mWakeLockScreenPerformsAuth = true; for (int i = 0; i < DozeLog.REASONS; i++) { reset(mKeyguardUpdateMonitor); mStatusBar.mDozeServiceHost.pulseWhileDozing(mock(DozeHost.PulseCallback.class), i); From 8bbe52597394307d5981ee380f13ad3d6b34d955 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Wed, 19 Jun 2019 15:36:44 -0700 Subject: [PATCH 16/34] Animating the notifications now when they disappear Previously they were just disappearing immediately, looking fairly ugly. Bug: 130327302 Test: drag down on lockscreen with and without bypass Change-Id: I450569043f5b6fc715dcf817072ccdbb5841807f (cherry picked from commit 999230c38bfc613a50fbb428d5bc222ee6d524c2) --- .../systemui/statusbar/CrossFadeHelper.java | 4 ++ .../phone/NotificationIconAreaController.java | 52 ++++++++++++++----- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CrossFadeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/CrossFadeHelper.java index 04534ba06d7e7..164215befe796 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CrossFadeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CrossFadeHelper.java @@ -28,6 +28,10 @@ import com.android.systemui.statusbar.notification.stack.StackStateAnimator; public class CrossFadeHelper { public static final long ANIMATION_DURATION_LENGTH = 210; + public static void fadeOut(final View view) { + fadeOut(view, null); + } + public static void fadeOut(final View view, final Runnable endRunnable) { fadeOut(view, ANIMATION_DURATION_LENGTH, 0, endRunnable); } 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 5310a5449cd7c..3b4168946ddbe 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java @@ -22,6 +22,7 @@ import com.android.systemui.R; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; import com.android.systemui.plugins.statusbar.StatusBarStateController; +import com.android.systemui.statusbar.CrossFadeHelper; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.NotificationShelf; @@ -92,6 +93,7 @@ public class NotificationIconAreaController implements DarkReceiver, private boolean mAnimationsEnabled; private int mAodIconTint; private boolean mFullyHidden; + private boolean mAodIconsVisible; public NotificationIconAreaController(Context context, StatusBar statusBar, StatusBarStateController statusBarStateController, @@ -147,10 +149,10 @@ public class NotificationIconAreaController implements DarkReceiver, mAodIcons = mStatusBar.getStatusBarWindow().findViewById( R.id.clock_notification_icon_container); mAodIcons.setOnLockScreen(true); - updateAodIconsVisibility(); + updateAodIconsVisibility(false /* animate */); updateAnimations(); if (changed) { - updateAodIcons(); + updateAodNotificationIcons(); } } @@ -293,7 +295,7 @@ public class NotificationIconAreaController implements DarkReceiver, updateStatusBarIcons(); updateShelfIcons(); updateCenterIcon(); - updateAodIcons(); + updateAodNotificationIcons(); applyNotificationIconsTint(); } @@ -331,7 +333,7 @@ public class NotificationIconAreaController implements DarkReceiver, false /* hidePulsing */); } - public void updateAodIcons() { + public void updateAodNotificationIcons() { updateIconsForLayout(entry -> entry.aodIcon, mAodIcons, false /* showAmbient */, mShowLowPriority /* showLowPriority */, @@ -532,7 +534,7 @@ public class NotificationIconAreaController implements DarkReceiver, @Override public void onStateChanged(int newState) { - updateAodIconsVisibility(); + updateAodIconsVisibility(false /* animate */); updateAnimations(); } @@ -583,21 +585,25 @@ public class NotificationIconAreaController implements DarkReceiver, @Override public void onFullyHiddenChanged(boolean fullyHidden) { - if (fullyHidden && !mBypassController.getBypassEnabled()) { - appearAodIcons(); + boolean animate = true; + if (!mBypassController.getBypassEnabled()) { + animate = mDozeParameters.getAlwaysOn() && !mDozeParameters.getDisplayNeedsBlanking(); + // We only want the appear animations to happen when the notifications get fully hidden, + // since otherwise the unhide animation overlaps + animate &= fullyHidden; } - updateAodIconsVisibility(); - updateAodIcons(); + updateAodIconsVisibility(animate); + updateAodNotificationIcons(); } @Override public void onPulseExpansionChanged(boolean expandingChanged) { if (expandingChanged) { - updateAodIconsVisibility(); + updateAodIconsVisibility(true /* animate */); } } - private void updateAodIconsVisibility() { + private void updateAodIconsVisibility(boolean animate) { boolean visible = mBypassController.getBypassEnabled() || mWakeUpCoordinator.getNotificationsFullyHidden(); if (mStatusBarStateController.getState() != StatusBarState.KEYGUARD) { @@ -606,6 +612,28 @@ public class NotificationIconAreaController implements DarkReceiver, if (visible && mWakeUpCoordinator.isPulseExpanding()) { visible = false; } - mAodIcons.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); + if (mAodIconsVisible != visible) { + mAodIconsVisible = visible; + mAodIcons.animate().cancel(); + if (animate) { + boolean wasFullyInvisible = mAodIcons.getVisibility() != View.VISIBLE; + if (mAodIconsVisible) { + if (wasFullyInvisible) { + // No fading here, let's just appear the icons instead! + mAodIcons.setVisibility(View.VISIBLE); + mAodIcons.setAlpha(1.0f); + appearAodIcons(); + } else { + // We were fading out, let's fade in instead + CrossFadeHelper.fadeIn(mAodIcons); + } + } else { + CrossFadeHelper.fadeOut(mAodIcons); + } + } else { + mAodIcons.setAlpha(1.0f); + mAodIcons.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); + } + } } } From bfa00499c4d9027cf4187d414b1a74f53ea73e3e Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Wed, 19 Jun 2019 18:04:05 -0700 Subject: [PATCH 17/34] Not bypassing when the user is expanding quick settings Previously we would also bypass when the user would look at QS. Fixes: 134094877 Test: pull down QS, wait on bypass, nothing happens! Change-Id: I0b2ec98f3c361307845c16cc27866c6f3b3d4136 (cherry picked from commit ae2702d1d6b7f7f0fb05aac68964bc6fb5927df7) --- .../statusbar/phone/KeyguardBypassController.kt | 10 +++++++++- .../statusbar/phone/NotificationPanelView.java | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) 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 4be4d908979f2..fbd6adc9b7aa9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt @@ -49,6 +49,14 @@ class KeyguardBypassController { private set var bouncerShowing: Boolean = false + var qSExpanded = false + set(value) { + val changed = field != value + field = value + if (changed && !value) { + maybePerformPendingUnlock() + } + } @Inject constructor(context: Context, tunerService: TunerService, @@ -98,7 +106,7 @@ class KeyguardBypassController { // to unlock return false } - if (isPulseExpanding) { + if (isPulseExpanding || qSExpanded) { pendingUnlockType = biometricSourceType return false } 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 e805575e38846..bbbb9b11cab72 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -1384,6 +1384,7 @@ public class NotificationPanelView extends PanelView implements mStatusBar.setQsExpanded(expanded); mNotificationContainerParent.setQsExpanded(expanded); mPulseExpansionHandler.setQsExpanded(expanded); + mKeyguardBypassController.setQSExpanded(expanded); } } From 616c25b73b10833f21ef270ac12c9001ffd7e8d9 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Wed, 12 Jun 2019 15:23:17 -0700 Subject: [PATCH 18/34] Allow wake_lock_screen when AOD is off Also decoupling the settings, so they can be configured separately. Fixes: 135023656 Test: manual Test: adb shell settings put secure doze_wake_lock_screen_gesture 0 Test: adb shell settings put secure doze_wake_lock_screen_gesture 1 Change-Id: I2138d5d06919b9c23428663e49381fc1b694e301 (cherry picked from commit 7c7b8c28ca7c886ca112bd5a00e5fb8479fa2d36) --- .../display/AmbientDisplayConfiguration.java | 13 +++++++--- core/java/android/provider/Settings.java | 24 ++++++++++++++----- .../android/systemui/doze/DozeSensors.java | 6 ++--- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/core/java/android/hardware/display/AmbientDisplayConfiguration.java b/core/java/android/hardware/display/AmbientDisplayConfiguration.java index c45b8ed521879..3e995b6241123 100644 --- a/core/java/android/hardware/display/AmbientDisplayConfiguration.java +++ b/core/java/android/hardware/display/AmbientDisplayConfiguration.java @@ -48,7 +48,8 @@ public class AmbientDisplayConfiguration { return pulseOnNotificationEnabled(user) || pulseOnLongPressEnabled(user) || alwaysOnEnabled(user) - || wakeScreenGestureEnabled(user) + || wakeLockScreenGestureEnabled(user) + || wakeDisplayGestureEnabled(user) || pickupGestureEnabled(user) || tapGestureEnabled(user) || doubleTapGestureEnabled(user); @@ -105,8 +106,14 @@ public class AmbientDisplayConfiguration { } /** {@hide} */ - public boolean wakeScreenGestureEnabled(int user) { - return boolSettingDefaultOn(Settings.Secure.DOZE_WAKE_SCREEN_GESTURE, user) + public boolean wakeLockScreenGestureEnabled(int user) { + return boolSettingDefaultOn(Settings.Secure.DOZE_WAKE_LOCK_SCREEN_GESTURE, user) + && wakeScreenGestureAvailable(); + } + + /** {@hide} */ + public boolean wakeDisplayGestureEnabled(int user) { + return boolSettingDefaultOn(Settings.Secure.DOZE_WAKE_DISPLAY_GESTURE, user) && wakeScreenGestureAvailable(); } diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 83e636ba20757..e95e6e0812768 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -88,6 +88,7 @@ import android.util.ArrayMap; import android.util.ArraySet; import android.util.Log; import android.util.MemoryIntArray; +import android.view.Display; import android.view.inputmethod.InputMethodSystemProperty; import com.android.internal.annotations.GuardedBy; @@ -4073,7 +4074,7 @@ public final class Settings { * preference, this rotation value will be used. Must be one of the * {@link android.view.Surface#ROTATION_0 Surface rotation constants}. * - * @see android.view.Display#getRotation + * @see Display#getRotation */ public static final String USER_ROTATION = "user_rotation"; @@ -7733,12 +7734,21 @@ public final class Settings { private static final Validator DOZE_TAP_SCREEN_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR; /** - * Gesture that wakes up the display, showing the ambient version of the status bar. + * Gesture that wakes up the display, showing some version of the lock screen. * @hide */ - public static final String DOZE_WAKE_SCREEN_GESTURE = "doze_wake_screen_gesture"; + public static final String DOZE_WAKE_LOCK_SCREEN_GESTURE = "doze_wake_screen_gesture"; - private static final Validator DOZE_WAKE_SCREEN_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR; + private static final Validator DOZE_WAKE_LOCK_SCREEN_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * Gesture that wakes up the display, toggling between {@link Display.STATE_OFF} and + * {@link Display.STATE_DOZE}. + * @hide + */ + public static final String DOZE_WAKE_DISPLAY_GESTURE = "doze_wake_display_gesture"; + + private static final Validator DOZE_WAKE_DISPLAY_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR; /** * Gesture that skips media. @@ -8964,7 +8974,8 @@ public final class Settings { DOZE_PICK_UP_GESTURE, DOZE_DOUBLE_TAP_GESTURE, DOZE_TAP_SCREEN_GESTURE, - DOZE_WAKE_SCREEN_GESTURE, + DOZE_WAKE_LOCK_SCREEN_GESTURE, + DOZE_WAKE_DISPLAY_GESTURE, NFC_PAYMENT_DEFAULT_COMPONENT, AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN, FACE_UNLOCK_KEYGUARD_ENABLED, @@ -9136,7 +9147,8 @@ public final class Settings { VALIDATORS.put(DOZE_PICK_UP_GESTURE, DOZE_PICK_UP_GESTURE_VALIDATOR); VALIDATORS.put(DOZE_DOUBLE_TAP_GESTURE, DOZE_DOUBLE_TAP_GESTURE_VALIDATOR); VALIDATORS.put(DOZE_TAP_SCREEN_GESTURE, DOZE_TAP_SCREEN_GESTURE_VALIDATOR); - VALIDATORS.put(DOZE_WAKE_SCREEN_GESTURE, DOZE_WAKE_SCREEN_GESTURE_VALIDATOR); + VALIDATORS.put(DOZE_WAKE_LOCK_SCREEN_GESTURE, DOZE_WAKE_LOCK_SCREEN_GESTURE_VALIDATOR); + VALIDATORS.put(DOZE_WAKE_DISPLAY_GESTURE, DOZE_WAKE_DISPLAY_GESTURE_VALIDATOR); VALIDATORS.put(NFC_PAYMENT_DEFAULT_COMPONENT, NFC_PAYMENT_DEFAULT_COMPONENT_VALIDATOR); VALIDATORS.put(AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN, AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_VALIDATOR); diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java index cdcf66040f2f6..66b4ef47d1f86 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java @@ -127,15 +127,15 @@ public class DozeSensors { true /* touchscreen */), new PluginSensor( new SensorManagerPlugin.Sensor(TYPE_WAKE_DISPLAY), - Settings.Secure.DOZE_WAKE_SCREEN_GESTURE, + Settings.Secure.DOZE_WAKE_DISPLAY_GESTURE, mConfig.wakeScreenGestureAvailable() && alwaysOn, DozeLog.REASON_SENSOR_WAKE_UP, false /* reports touch coordinates */, false /* touchscreen */), new PluginSensor( new SensorManagerPlugin.Sensor(TYPE_WAKE_LOCK_SCREEN), - Settings.Secure.DOZE_WAKE_SCREEN_GESTURE, - mConfig.wakeScreenGestureAvailable() && alwaysOn, + Settings.Secure.DOZE_WAKE_LOCK_SCREEN_GESTURE, + mConfig.wakeScreenGestureAvailable(), DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN, false /* reports touch coordinates */, false /* touchscreen */, mConfig.getWakeLockScreenDebounce()), From d5d97d76ba1a612e6bd4d36f53c05266f9036093 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Tue, 23 Jul 2019 16:51:02 -0700 Subject: [PATCH 19/34] Log acquired vendorCode Bug: 137688980 Test: adb shell cmd stats print-logs adb logcat | grep -i statsd Change-Id: Icdbc4a4ba004b5f4b7407de6e8ee256bee8ef97a (cherry picked from commit f24ae8da0e45ef77e2405adced21978a98f8ed87) --- .../java/com/android/server/biometrics/LoggableMonitor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/biometrics/LoggableMonitor.java b/services/core/java/com/android/server/biometrics/LoggableMonitor.java index 6c7cbc166241f..ecf3864e3362c 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)); } From d935197888d183eabd928d4f67027356b04d89b6 Mon Sep 17 00:00:00 2001 From: joshmccloskey Date: Wed, 24 Jul 2019 17:13:16 -0700 Subject: [PATCH 20/34] Fixed race condition with different profiles Test: Verified that setting/getting features in one profile does not change the other. Fixes: 138127704 Change-Id: Id8627fc84f0d2f4ec642cfb3e9a4d9884209a91f (cherry picked from commit a4772064dfb6c463eebb831563a7dd8182010cc2) --- .../biometrics/BiometricServiceBase.java | 8 +++-- .../server/biometrics/face/FaceService.java | 32 ++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java index 91a32f48ec9ac..f3f9754bd32b5 100644 --- a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java +++ b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java @@ -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/face/FaceService.java b/services/core/java/com/android/server/biometrics/face/FaceService.java index c26e53ff8583f..9d51abeed1144 100644 --- a/services/core/java/com/android/server/biometrics/face/FaceService.java +++ b/services/core/java/com/android/server/biometrics/face/FaceService.java @@ -611,27 +611,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; @@ -662,9 +667,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)) { From 6a7029b74529471b87ab55bdcf5b02d1c19d0716 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Wed, 24 Jul 2019 18:45:42 -0700 Subject: [PATCH 21/34] Ensure BiometricDialogView dismiss animation is run postOnAnimation requests the animation be started on the next frame. The behavior is undefined if an animation is already running. Currently if this happens, the second animation is never initiated. Fixes: 138199986 Test: Modify BiometricPromptDemo to cancel authentication immediately after requesting authentication. BiometricDialogView isn't stuck anymore Change-Id: Ia62dccc2d484d1eaca5587bffa4d3def89730533 (cherry picked from commit 906bde542322caf70785191af5a9880c476c6859) --- .../biometrics/BiometricDialogView.java | 17 +++++++++++++++++ .../systemui/biometrics/FaceDialogView.java | 1 + 2 files changed, 18 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogView.java b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogView.java index a5857df8ba5a9..ce67577ea4837 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 729242e3144f2..ae6cb5ce23d39 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(); } From 5630166e4ce8c0213d57726eb7c69474ba3fa1cb Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Wed, 24 Jul 2019 16:36:14 -0700 Subject: [PATCH 22/34] Cancel show runnable when bouncer is hidden Otherwise the bouncer might report "showing soon" and future show() calls will be aborted. Test: swipe up and down, wait for face, swipe up Test: tap on notification on bouncer Test: swipe up, unlock from bouncer Test: unlock on lock screen, swipe up to dismiss bouncer Fixes: 132846921 Change-Id: I22a1af2ef903b266ae8d8fcb9eb55f6cc11aeae2 (cherry picked from commit 9b8e5e3875f1cb1081814f2ac94ac4ce0c02b24d) --- .../systemui/statusbar/phone/KeyguardBouncer.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) 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 40085a48a58c9..c4d346ccaefb6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -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() { From 1364df709e5a2179f76787813ca2c78ae9687b40 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Thu, 25 Jul 2019 20:28:28 -0700 Subject: [PATCH 23/34] Show bouncer when unlocking and not interactive We cannot dismiss the bouncer when the device cannot be unlocked, otherwise we'll be stuck looking since gatekeeper is not unlocked. Test: face auth from AOD2 encrypted Test: face auth from lock screen encrypted Test: face auth from AOD2 Test: atest BiometricsUnlockControllerTest Fixes: 138093575 Change-Id: I5c5b89ee9fa1a10cedceaf1ab227e26910beed2a (cherry picked from commit 81cdfa4a82f5fc9450d20d3bfa91bcadf01ac371) --- .../statusbar/phone/BiometricUnlockController.java | 10 +++++----- .../phone/BiometricsUnlockControllerTest.java | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) 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 94cd2cdaa9d36..41c6a7ba7848c 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/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java index 4a41349ca195b..fd676111b1dab 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 @@ -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 From 39781a6664b4a1abbaed0113beb9d268b405da36 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Sat, 27 Jul 2019 17:50:33 -0700 Subject: [PATCH 24/34] ResetLockout should be scheduled on FaceService's handler Fixes: 138501368 Test: Reject 5 times and get locked out Enter password Go back to lockscreen, no longer locked out Change-Id: I23e3022bcca533f3cacb03aa79bf0a68a9e01de2 (cherry picked from commit 7a207e47163fd57d0b59d165f741f77560ae1303) --- .../server/biometrics/face/FaceService.java | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) 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 9d51abeed1144..a7065216f6a37 100644 --- a/services/core/java/com/android/server/biometrics/face/FaceService.java +++ b/services/core/java/com/android/server/biometrics/face/FaceService.java @@ -344,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 From 9b49d1de6875c35e8b23540ccb1487de800c2791 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Wed, 10 Jul 2019 12:41:55 -0400 Subject: [PATCH 25/34] Remove icon name from NR dump While occasionally useful, the call to create the Resources object can take long enough that threads waiting on the notificationlist lock (that we hold while dump()-ing) will ANR and crash system_process. Test: none Fixes: 134505821 Change-Id: I8c6246cb1debc2c3d548c300e76d9279e29e2d4f (cherry picked from commit c4ced6544d6e0160507e9477140a5903c72c2bf7) (cherry picked from commit e9ebf622d7d7d5b5439c65226e887f44d70b3113) --- .../notification/NotificationRecord.java | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java index c2e559a8a96bf..3c2169a446a1e 100644 --- a/services/core/java/com/android/server/notification/NotificationRecord.java +++ b/services/core/java/com/android/server/notification/NotificationRecord.java @@ -34,11 +34,8 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManagerInternal; -import android.content.res.Resources; import android.graphics.Bitmap; -import android.graphics.drawable.Icon; import android.media.AudioAttributes; import android.media.AudioSystem; import android.metrics.LogMaker; @@ -453,16 +450,11 @@ public final class NotificationRecord { void dump(PrintWriter pw, String prefix, Context baseContext, boolean redact) { final Notification notification = sbn.getNotification(); - final Icon icon = notification.getSmallIcon(); - String iconStr = String.valueOf(icon); - if (icon != null && icon.getType() == Icon.TYPE_RESOURCE) { - iconStr += " / " + idDebugString(baseContext, icon.getResPackage(), icon.getResId()); - } pw.println(prefix + this); prefix = prefix + " "; pw.println(prefix + "uid=" + sbn.getUid() + " userId=" + sbn.getUserId()); pw.println(prefix + "opPkg=" + sbn.getOpPkg()); - pw.println(prefix + "icon=" + iconStr); + pw.println(prefix + "icon=" + notification.getSmallIcon()); pw.println(prefix + "flags=0x" + Integer.toHexString(notification.flags)); pw.println(prefix + "pri=" + notification.priority); pw.println(prefix + "key=" + sbn.getKey()); @@ -592,28 +584,6 @@ public final class NotificationRecord { pw.println(prefix + "mAdjustments=" + mAdjustments); } - - static String idDebugString(Context baseContext, String packageName, int id) { - Context c; - - if (packageName != null) { - try { - c = baseContext.createPackageContext(packageName, 0); - } catch (NameNotFoundException e) { - c = baseContext; - } - } else { - c = baseContext; - } - - Resources r = c.getResources(); - try { - return r.getResourceName(id); - } catch (Resources.NotFoundException e) { - return ""; - } - } - @Override public final String toString() { return String.format( From afabc598c421c8a6df6a8a42e349fb858260c6a3 Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Wed, 7 Aug 2019 15:29:34 -0700 Subject: [PATCH 26/34] Make the back longpress timeout a system property issue 138944380 Test: manual Change-Id: I9cebea1f7f44298a8723d04df17349cc3cb03067 (cherry picked from commit a699c284a3a81f94f4446457697c5cb1930de0a0) --- .../systemui/statusbar/phone/EdgeBackGestureHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java index e0c6c55c2e592..6a7477945cdd8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java @@ -31,6 +31,7 @@ import android.hardware.input.InputManager; import android.os.Looper; import android.os.RemoteException; import android.os.SystemClock; +import android.os.SystemProperties; import android.util.Log; import android.util.MathUtils; import android.view.Gravity; @@ -66,7 +67,8 @@ import java.util.concurrent.Executor; public class EdgeBackGestureHandler implements DisplayListener { private static final String TAG = "EdgeBackGestureHandler"; - private static final int MAX_LONG_PRESS_TIMEOUT = 250; + private static final int MAX_LONG_PRESS_TIMEOUT = SystemProperties.getInt( + "gestures.back_timeout", 250); private final IPinnedStackListener.Stub mImeChangedListener = new IPinnedStackListener.Stub() { @Override From ef008de643ec87cc5b3c2c424c4b5f2275b0a3e2 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Thu, 8 Aug 2019 21:48:16 -0700 Subject: [PATCH 27/34] Import translations. DO NOT MERGE Auto-generated-cl: translation import Bug: 64712476 Change-Id: I68fcda4e1f4d0abaebf711f96f3770411b85fb5d (cherry picked from commit a5576ff9aa7760060e44c2bdc8b3949e7183111c) --- packages/SystemUI/res-keyguard/values-de/strings.xml | 2 +- packages/SystemUI/res/values-de/strings.xml | 2 +- packages/SystemUI/res/values-es-rUS/strings.xml | 4 ++-- packages/SystemUI/res/values-sq/strings.xml | 2 +- packages/SystemUI/res/values-sw/strings.xml | 2 +- packages/SystemUI/res/values-ta/strings.xml | 2 +- packages/SystemUI/res/values-vi/strings.xml | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/SystemUI/res-keyguard/values-de/strings.xml b/packages/SystemUI/res-keyguard/values-de/strings.xml index 7f39a194202a2..d44bfbc670a19 100644 --- a/packages/SystemUI/res-keyguard/values-de/strings.xml +++ b/packages/SystemUI/res-keyguard/values-de/strings.xml @@ -152,6 +152,6 @@ Die SIM-Karte ist jetzt deaktiviert. Gib den PUK-Code ein, um fortzufahren. Du hast noch %d Versuch, bevor die SIM-Karte endgültig gesperrt wird. Weitere Informationen erhältst du von deinem Mobilfunkanbieter. "Standard" - "Blase" + "Bubble" "Analog" diff --git a/packages/SystemUI/res/values-de/strings.xml b/packages/SystemUI/res/values-de/strings.xml index 408254f7c9e6e..9b3974b423ba5 100644 --- a/packages/SystemUI/res/values-de/strings.xml +++ b/packages/SystemUI/res/values-de/strings.xml @@ -656,7 +656,7 @@ "Lautlos" "Benachrichtigen" "Benachrichtigungen werden ohne Ton oder Vibration angekündigt, um deine Konzentration nicht zu stören." - "Benachrichtigungen werden mit einem Ton oder einer Vibration angekündigt, um dich auf sie aufmerksam zu machen." + "Benachrichtigungen werden mit einem Ton oder einer Vibration angekündigt." "Diese Benachrichtigungen können nicht geändert werden." "Die Benachrichtigungsgruppe kann hier nicht konfiguriert werden" "Weitergeleitete Benachrichtigung" diff --git a/packages/SystemUI/res/values-es-rUS/strings.xml b/packages/SystemUI/res/values-es-rUS/strings.xml index 37aae55d2b8ba..d6c8d090b97bb 100644 --- a/packages/SystemUI/res/values-es-rUS/strings.xml +++ b/packages/SystemUI/res/values-es-rUS/strings.xml @@ -553,7 +553,7 @@ "Ocultar" "Llamada" "Sistema" - "Hacer sonar" + "Timbre" "Multimedia" "Alarma" "Notificación" @@ -561,7 +561,7 @@ "Multifrecuencia de tono doble" "Accesibilidad" "Llamadas" - "Hacer sonar" + "Timbre" "Vibrar" "Silenciar" "Teléfono en vibración" diff --git a/packages/SystemUI/res/values-sq/strings.xml b/packages/SystemUI/res/values-sq/strings.xml index 83a7aaa684c3b..1f75490ebe5dc 100644 --- a/packages/SystemUI/res/values-sq/strings.xml +++ b/packages/SystemUI/res/values-sq/strings.xml @@ -544,7 +544,7 @@ "Kjo e ruan në pamje deri sa ta heqësh nga gozhdimi. Prek dhe mbaj të shtypur \"Kreu\" për ta hequr nga gozhdimi." "Për të hequr gozhdimin e këtij ekrani, prek dhe mbaj butonat \"Prapa\" dhe \"Përmbledhja\"." "Për të hequr gozhdimin e këtij ekrani, prek dhe mbaj butonat \"Prapa\" dhe \"Kreu\"." - "E kuptova!" + "E kuptova" "Jo, faleminderit!" "Ekrani u gozhdua" "Ekrani u hoq nga gozhdimi" diff --git a/packages/SystemUI/res/values-sw/strings.xml b/packages/SystemUI/res/values-sw/strings.xml index 182caa4c09deb..640bbda0d2a3a 100644 --- a/packages/SystemUI/res/values-sw/strings.xml +++ b/packages/SystemUI/res/values-sw/strings.xml @@ -416,7 +416,7 @@ "%2$s • Inachaji bila kutumia waya (imebakisha %1$s ili ijae)" "%2$s • Inachaji (Imebakisha %1$s ili ijae)" "%2$s • Inachaji kwa kasi (Imebakisha %1$s ili ijae)" - "%2$s • Inachaji pole pole (Imebakisha %1$s ili ijae)" + "%2$s • Inachaji pole pole (Imebakisha %1$s ijae)" "Badili mtumiaji" "Badili mtumiaji, mtumiaji wa sasa %s" "Mtumiaji wa sasa %s" diff --git a/packages/SystemUI/res/values-ta/strings.xml b/packages/SystemUI/res/values-ta/strings.xml index 9f8f45e44ebf3..6e8b0974087a2 100644 --- a/packages/SystemUI/res/values-ta/strings.xml +++ b/packages/SystemUI/res/values-ta/strings.xml @@ -761,7 +761,7 @@ "ஏதுமில்லை" - "இயல்பானது" + "சராசரி" "சுருக்கமானது" "இடப்புறம் சாய்ந்தது" "வலப்புறம் சாய்ந்தது" diff --git a/packages/SystemUI/res/values-vi/strings.xml b/packages/SystemUI/res/values-vi/strings.xml index affca3d05f05b..025efacee5821 100644 --- a/packages/SystemUI/res/values-vi/strings.xml +++ b/packages/SystemUI/res/values-vi/strings.xml @@ -741,7 +741,7 @@ "Pin" "Đồng hồ" "Tai nghe" - "Mở cài đặt" + "Mở phần cài đặt" "Đã kết nối tai nghe" "Đã kết nối tai nghe" "Trình tiết kiệm dữ liệu" @@ -817,7 +817,7 @@ "Ứng dụng không hỗ trợ chia đôi màn hình." "Ứng dụng có thể không hoạt động trên màn hình phụ." "Ứng dụng không hỗ trợ khởi chạy trên màn hình phụ." - "Mở cài đặt." + "Mở phần cài đặt." "Mở cài đặt nhanh." "Đóng cài đặt nhanh." "Đã đặt báo thức." From 0962bde228a3785724743f5d7e17f3998d885e3f Mon Sep 17 00:00:00 2001 From: Ned Burns Date: Thu, 8 Aug 2019 13:43:57 -0400 Subject: [PATCH 28/34] Ensure isTopBucket() gets set when there is just one notification My descendants will vilify this CL for generations to come. We'll clean it up for R, but this is our last, best hope for fixing things in Q. Bug: 138775282 Test: manual Change-Id: I615b2f7fddca30dae67dbaab0e5d54a824a4c441 (cherry picked from commit 2d35980e7201e042e253fadd0eb55e1866fc28d9) --- .../collection/NotificationData.java | 9 ++- .../collection/NotificationDataTest.java | 66 ++++++++++++++++++- 2 files changed, 72 insertions(+), 3 deletions(-) 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 1ce493444e25b..00092929fd49c 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 @@ -420,7 +420,14 @@ public class NotificationData { } } - Collections.sort(mSortedAndFiltered, mRankingComparator); + if (mSortedAndFiltered.size() == 1) { + // HACK: We need the comparator to run on all children in order to set the + // isHighPriority field. If there is only one child, then the comparison won't be run, + // so we have to trigger it manually. Get rid of this code as soon as possible. + mRankingComparator.compare(mSortedAndFiltered.get(0), mSortedAndFiltered.get(0)); + } else { + Collections.sort(mSortedAndFiltered, mRankingComparator); + } } public void dump(PrintWriter pw, String indent) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java index 260555f712560..e2d8e5698daf3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java @@ -23,6 +23,7 @@ import static android.app.Notification.CATEGORY_CALL; import static android.app.Notification.CATEGORY_EVENT; import static android.app.Notification.CATEGORY_MESSAGE; import static android.app.Notification.CATEGORY_REMINDER; +import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_MIN; @@ -62,6 +63,8 @@ import android.testing.TestableLooper; import android.testing.TestableLooper.RunWithLooper; import android.util.ArraySet; +import androidx.test.filters.SmallTest; + import com.android.systemui.Dependency; import com.android.systemui.ForegroundServiceController; import com.android.systemui.InitController; @@ -85,8 +88,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import androidx.test.filters.SmallTest; - @SmallTest @RunWith(AndroidTestingRunner.class) @RunWithLooper @@ -114,6 +115,7 @@ public class NotificationDataTest extends SysuiTestCase { MockitoAnnotations.initMocks(this); when(mMockStatusBarNotification.getUid()).thenReturn(UID_NORMAL); when(mMockStatusBarNotification.cloneLight()).thenReturn(mMockStatusBarNotification); + when(mMockStatusBarNotification.getKey()).thenReturn("mock_key"); when(mMockPackageManager.checkUidPermission( eq(Manifest.permission.NOTIFICATION_DURING_SETUP), @@ -232,6 +234,7 @@ public class NotificationDataTest extends SysuiTestCase { Notification n = mMockStatusBarNotification.getNotification(); n.flags = Notification.FLAG_FOREGROUND_SERVICE; NotificationEntry entry = new NotificationEntry(mMockStatusBarNotification); + entry.setRow(mRow); mNotificationData.add(entry); Bundle override = new Bundle(); override.putInt(OVERRIDE_VIS_EFFECTS, 255); @@ -250,6 +253,7 @@ public class NotificationDataTest extends SysuiTestCase { n = nb.build(); when(mMockStatusBarNotification.getNotification()).thenReturn(n); NotificationEntry entry = new NotificationEntry(mMockStatusBarNotification); + entry.setRow(mRow); mNotificationData.add(entry); Bundle override = new Bundle(); override.putInt(OVERRIDE_VIS_EFFECTS, 255); @@ -263,6 +267,7 @@ public class NotificationDataTest extends SysuiTestCase { public void testIsExemptFromDndVisualSuppression_system() { initStatusBarNotification(false); NotificationEntry entry = new NotificationEntry(mMockStatusBarNotification); + entry.setRow(mRow); entry.mIsSystemNotification = true; mNotificationData.add(entry); Bundle override = new Bundle(); @@ -277,6 +282,7 @@ public class NotificationDataTest extends SysuiTestCase { public void testIsNotExemptFromDndVisualSuppression_hiddenCategories() { initStatusBarNotification(false); NotificationEntry entry = new NotificationEntry(mMockStatusBarNotification); + entry.setRow(mRow); entry.mIsSystemNotification = true; Bundle override = new Bundle(); override.putInt(OVERRIDE_VIS_EFFECTS, NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT); @@ -529,6 +535,62 @@ public class NotificationDataTest extends SysuiTestCase { assertEquals(-1, mNotificationData.mRankingComparator.compare(a, b)); } + @Test + public void testSort_properlySetsIsTopBucket() { + + Notification notification = new Notification.Builder(mContext, "test") + .build(); + StatusBarNotification sbn = new StatusBarNotification( + "pkg", + "pkg", + 0, + "tag", + 0, + 0, + notification, + mContext.getUser(), + "", + 0); + + Bundle override = new Bundle(); + override.putInt(OVERRIDE_IMPORTANCE, IMPORTANCE_DEFAULT); + mNotificationData.rankingOverrides.put(sbn.getKey(), override); + + NotificationEntry entry = new NotificationEntry(sbn); + entry.setRow(mRow); + mNotificationData.add(entry); + + assertTrue(entry.isTopBucket()); + } + + @Test + public void testSort_properlySetsIsNotTopBucket() { + Notification notification = new Notification.Builder(mContext, "test") + .build(); + StatusBarNotification sbn = new StatusBarNotification( + "pkg", + "pkg", + 0, + "tag", + 0, + 0, + notification, + mContext.getUser(), + "", + 0); + + Bundle override = new Bundle(); + override.putInt(OVERRIDE_IMPORTANCE, IMPORTANCE_LOW); + mNotificationData.rankingOverrides.put(sbn.getKey(), override); + + NotificationEntry entry = new NotificationEntry(sbn); + entry.setRow(mRow); + + mNotificationData.add(entry); + + assertFalse(entry.isTopBucket()); + } + private void initStatusBarNotification(boolean allowDuringSetup) { Bundle bundle = new Bundle(); bundle.putBoolean(Notification.EXTRA_ALLOW_DURING_SETUP, allowDuringSetup); From ea62a122edb7501287e05d822f5d1195032a3711 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Thu, 8 Aug 2019 16:58:50 -0700 Subject: [PATCH 29/34] Fade from black when reach Previously, we were fading from the previous state, which could be transparent. The screen would seem to flash if the wallpaper were light. Test: manual Fixes: 138097741 Change-Id: Ic86024b8970e01ed405e90bf12ef2dc27acf1c29 (cherry picked from commit fea9b86e9c419999f6e5f7b24712b145bbc9c1c8) --- .../com/android/systemui/statusbar/phone/ScrimState.java | 6 ++++++ 1 file changed, 6 insertions(+) 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 c706062d3bb34..b45914b2e83d4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java @@ -133,6 +133,12 @@ public enum ScrimState { mBlankScreen = mDisplayRequiresBlanking; mAnimationDuration = mWakeLockScreenSensorActive ? ScrimController.ANIMATION_DURATION_LONG : ScrimController.ANIMATION_DURATION; + + // Wake sensor will show the wallpaper, let's fade from black. Otherwise it will + // feel like the screen is flashing if the wallpaper is light. + if (mWakeLockScreenSensorActive && previousState == AOD) { + updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK); + } } @Override From ec30fd51ed2d00088410d425fcff34aec2eecbcf Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 8 Aug 2019 16:36:14 -0700 Subject: [PATCH 30/34] Hide the home handle in lock task home when home and overview are disabled Bug: 137626984 Test: Verified the home handle is hidden with CtsVerifier app Change-Id: I0c21ae5b6f0d094e84b2ba4200a93fd9c4295a55 (cherry picked from commit be4e054cd35adefd99830a828f3b67e8fe8606ed) --- .../android/systemui/statusbar/phone/NavigationBarView.java | 5 +++++ 1 file changed, 5 insertions(+) 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 6bfa048eb63d8..f689a3eadf588 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -619,6 +619,10 @@ public class NavigationBarView extends FrameLayout implements // Always disable recents when alternate car mode UI is active and for secondary displays. boolean disableRecent = isRecentsButtonDisabled(); + // Disable the home handle if both hone and recents are disabled + boolean disableHomeHandle = disableRecent + && ((mDisabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0); + boolean disableBack = !useAltBack && (isGesturalMode(mNavBarMode) || ((mDisabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0)); @@ -649,6 +653,7 @@ public class NavigationBarView extends FrameLayout implements getBackButton().setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE); getHomeButton().setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE); getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE); + getHomeHandle().setVisibility(disableHomeHandle ? View.INVISIBLE : View.VISIBLE); } @VisibleForTesting From fd5f57e14f8cc3f282f98364506372817f35f80f Mon Sep 17 00:00:00 2001 From: Mihir Patel Date: Fri, 9 Aug 2019 14:00:42 -0700 Subject: [PATCH 31/34] Fixing a bug where content capture sessions with child sessions could get stuck in a state where no event flushing other than forced flushes would occur Fixes: 139202268 Test: atest CtsContentCaptureServiceTestCases Change-Id: I21e9d4db2402fe5210b7d938dac2f12e7557c146 (cherry picked from commit 52ed9ee0387fa4faa91deff970dde779e2ff2f9f) --- .../view/contentcapture/MainContentCaptureSession.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/java/android/view/contentcapture/MainContentCaptureSession.java b/core/java/android/view/contentcapture/MainContentCaptureSession.java index cee79439d1b3d..1e7440bd5a43e 100644 --- a/core/java/android/view/contentcapture/MainContentCaptureSession.java +++ b/core/java/android/view/contentcapture/MainContentCaptureSession.java @@ -480,6 +480,8 @@ public final class MainContentCaptureSession extends ContentCaptureSession { return; } + mNextFlushForTextChanged = false; + final int numberEvents = mEvents.size(); final String reasonString = getFlushReasonAsString(reason); if (sDebug) { @@ -495,10 +497,6 @@ public final class MainContentCaptureSession extends ContentCaptureSession { try { mHandler.removeMessages(MSG_FLUSH); - if (reason == FLUSH_REASON_TEXT_CHANGE_TIMEOUT) { - mNextFlushForTextChanged = false; - } - final ParceledListSlice events = clearEvents(); mDirectServiceInterface.sendEvents(events, reason, mManager.mOptions); } catch (RemoteException e) { From 24e9ba5476ad700724937cd8629ec5dfe399a66f Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Fri, 16 Aug 2019 16:51:47 -0700 Subject: [PATCH 32/34] Remove unused setting Bug: 139554930 Test: manual Change-Id: I5c4af200b0c61efb9a0f76d00c2f047d4880d77b Merged-In: I5c4af200b0c61efb9a0f76d00c2f047d4880d77b (cherry picked from commit d806bc4c11dea44e28d8752cb849532735e79123) --- core/java/android/provider/Settings.java | 12 ------------ .../src/android/provider/SettingsBackupTest.java | 3 +-- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index bf8b0066cb648..f92be195229ed 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -8341,16 +8341,6 @@ public final class Settings { private static final Validator FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR = BOOLEAN_VALIDATOR; - /** - * Whether or not the face unlock education screen has been shown to the user. - * @hide - */ - public static final String FACE_UNLOCK_EDUCATION_INFO_DISPLAYED = - "face_unlock_education_info_displayed"; - - private static final Validator FACE_UNLOCK_EDUCATION_INFO_DISPLAYED_VALIDATOR = - BOOLEAN_VALIDATOR; - /** * Whether or not debugging is enabled. * @hide @@ -9190,8 +9180,6 @@ public final class Settings { VALIDATORS.put(FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_APP_ENABLED_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR); - VALIDATORS.put(FACE_UNLOCK_EDUCATION_INFO_DISPLAYED, - FACE_UNLOCK_EDUCATION_INFO_DISPLAYED_VALIDATOR); VALIDATORS.put(ASSIST_GESTURE_ENABLED, ASSIST_GESTURE_ENABLED_VALIDATOR); VALIDATORS.put(ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, ASSIST_GESTURE_SILENCE_ALERTS_ENABLED_VALIDATOR); diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java index 88bda9d640848..aee178a9a01e4 100644 --- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java +++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java @@ -720,8 +720,7 @@ public class SettingsBackupTest { Settings.Secure.LOCATION_ACCESS_CHECK_DELAY_MILLIS, Settings.Secure.BIOMETRIC_DEBUG_ENABLED, Settings.Secure.FACE_UNLOCK_ATTENTION_REQUIRED, - Settings.Secure.FACE_UNLOCK_DIVERSITY_REQUIRED, - Settings.Secure.FACE_UNLOCK_EDUCATION_INFO_DISPLAYED); + Settings.Secure.FACE_UNLOCK_DIVERSITY_REQUIRED); @Test public void systemSettingsBackedUpOrBlacklisted() { From 1fb00f5480d6a0fe3741fd323a751062f183c7f4 Mon Sep 17 00:00:00 2001 From: Adrian Salido Date: Thu, 22 Aug 2019 20:41:15 +0000 Subject: [PATCH 33/34] Revert "Hold Display suspend blocker until doze starts" This reverts commit 93e164726f2d243eb75351b4e52d683573f9f802. Reason for revert: This is causing wake lock to remain held while screen is off Bug: 139875245 Change-Id: I0ff714a0cf2496d141d355de68761ab720a09539 (cherry picked from commit 36966ca4ab1966fd33053ff451af52b8ffbca02e) --- .../com/android/server/power/PowerManagerService.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index dc56b03bb100e..aa49ba62f48b1 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -2735,17 +2735,6 @@ public final class PowerManagerService extends SystemService if (mScreenBrightnessBoostInProgress) { return true; } - - // Because summoning the sandman is asyncronous, there is a time-gap where - // we release the display suspend blocker before the dream service acquires - // their own wakelock. Within this gap, we can end up suspending before - // dream service has a chance to start. To avoid this, we check if we want - // to doze and the sandman is scheduled and if so, keep the display on until - // that has passed. - if (mWakefulness == WAKEFULNESS_DOZING && mSandmanScheduled) { - return true; - } - // Let the system suspend if the screen is off or dozing. return false; } From 1a1e8ca581119a1adf19fc9f7c08361f9a8ee868 Mon Sep 17 00:00:00 2001 From: vagdevi Date: Thu, 22 Aug 2019 12:02:47 -0700 Subject: [PATCH 34/34] 5GE Icon: Show 5G subscript E (italics) URL: https://screenshot.googleplex.com/SpTnerVCnQZ.png Bug: 139776677 Test: manual using PARIS Override for show_carrier_data_icon_pattern_string Change-Id: I69e32c89558fba884bb12d29cb8ff81470591bb0 (cherry picked from commit 47af50d8c8a03e0aec66151f4574e9ece02e8d02) --- .../SystemUI/res/drawable/ic_5g_e_mobiledata.xml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/SystemUI/res/drawable/ic_5g_e_mobiledata.xml b/packages/SystemUI/res/drawable/ic_5g_e_mobiledata.xml index fe1bb265880c9..7c7c8c1e47290 100644 --- a/packages/SystemUI/res/drawable/ic_5g_e_mobiledata.xml +++ b/packages/SystemUI/res/drawable/ic_5g_e_mobiledata.xml @@ -16,16 +16,10 @@ + android:width="19.41dp" + android:height="15dp"> - - - + android:pathData="M 6.72 3.52 L 6.54 4.69 L 3.34 4.69 L 2.63 7.41 C 3.011 7.143 3.465 7 3.93 7 C 4.5 6.986 5.041 7.251 5.38 7.71 C 5.756 8.249 5.952 8.893 5.94 9.55 C 5.98 10.276 5.864 11.002 5.6 11.68 C 5.385 12.267 5.007 12.78 4.51 13.16 C 4.043 13.499 3.476 13.671 2.9 13.65 C 2.271 13.653 1.675 13.369 1.28 12.88 C 0.854 12.302 0.636 11.597 0.66 10.88 L 1.76 10.88 C 1.81 12 2.21 12.57 3 12.58 C 3.592 12.589 4.132 12.243 4.37 11.7 C 4.708 11.044 4.85 10.305 4.78 9.57 C 4.767 9.209 4.645 8.86 4.43 8.57 C 4.239 8.309 3.934 8.156 3.61 8.16 C 3.404 8.138 3.196 8.162 3 8.23 C 2.748 8.358 2.518 8.527 2.32 8.73 L 1.31 8.46 L 2.51 3.52 L 6.72 3.52 Z M 11.7 3.39 C 12.459 3.353 13.195 3.662 13.7 4.23 C 14.185 4.864 14.42 5.654 14.36 6.45 L 13.1 6.45 C 13.131 5.938 12.998 5.43 12.72 5 C 12.455 4.679 12.056 4.498 11.64 4.51 C 11.025 4.456 10.42 4.688 10 5.14 C 9.491 5.811 9.179 6.611 9.1 7.45 L 8.75 9.54 L 8.75 10.57 C 8.82 11.86 9.36 12.52 10.36 12.57 C 10.701 12.593 11.043 12.538 11.36 12.41 C 11.661 12.281 11.943 12.113 12.2 11.91 L 12.62 9.62 L 10.77 9.62 L 11 8.52 L 14 8.52 L 13.36 12.23 C 13.176 12.483 12.953 12.706 12.7 12.89 C 11.995 13.398 11.138 13.652 10.27 13.61 C 9.507 13.634 8.773 13.315 8.27 12.74 C 7.748 12.085 7.475 11.267 7.5 10.43 C 7.47 10.097 7.47 9.763 7.5 9.43 L 7.8 7.43 C 7.927 6.332 8.36 5.293 9.05 4.43 C 9.725 3.692 10.703 3.308 11.7 3.39 Z M 20.81 7.21 L 20.62 8.29 L 18.32 8.29 L 18.06 9.8 L 20.06 9.8 L 19.83 10.84 L 17.88 10.84 L 17.59 12.54 L 19.9 12.54 L 19.71 13.61 L 16.14 13.61 L 17.25 7.21 L 20.81 7.21 Z" /> +