diff options
| author | 2019-08-21 21:19:19 +0000 | |
|---|---|---|
| committer | 2019-08-21 21:19:19 +0000 | |
| commit | 05b2c6883ebd448dd5ed9cf4db68fa49044f414c (patch) | |
| tree | 6665721dc9dbd467f5527e127e596fe397285756 | |
| parent | 323b7e6f9c2790c75a56e099134df5292043a8cd (diff) | |
| parent | 1081450d094d5be3a74666d1b176ad6a1bebc605 (diff) | |
Merge "[DO NOT MERGE] qt-qpr1-sysui-dev @ build 5814791" into qt-qpr1-dev
82 files changed, 434 insertions, 244 deletions
diff --git a/core/res/res/values-en-rCA/strings.xml b/core/res/res/values-en-rCA/strings.xml index 47318862c76f..6cf284320cdb 100644 --- a/core/res/res/values-en-rCA/strings.xml +++ b/core/res/res/values-en-rCA/strings.xml @@ -95,7 +95,6 @@ <string name="notification_channel_voice_mail" msgid="3954099424160511919">"Voicemail messages"</string> <string name="notification_channel_wfc" msgid="2130802501654254801">"Wi-Fi Calling"</string> <string name="notification_channel_sim" msgid="4052095493875188564">"SIM status"</string> - <string name="notification_channel_sim_high_prio" msgid="1787666807724243207">"High priority SIM status"</string> <string name="peerTtyModeFull" msgid="6165351790010341421">"Peer requested TTY Mode FULL"</string> <string name="peerTtyModeHco" msgid="5728602160669216784">"Peer requested TTY Mode HCO"</string> <string name="peerTtyModeVco" msgid="1742404978686538049">"Peer requested TTY Mode VCO"</string> diff --git a/core/res/res/values-en-rXC/strings.xml b/core/res/res/values-en-rXC/strings.xml index 95ebcdc8c603..f62b3857b930 100644 --- a/core/res/res/values-en-rXC/strings.xml +++ b/core/res/res/values-en-rXC/strings.xml @@ -95,7 +95,6 @@ <string name="notification_channel_voice_mail" msgid="3954099424160511919">"Voicemail messages"</string> <string name="notification_channel_wfc" msgid="2130802501654254801">"Wi-Fi calling"</string> <string name="notification_channel_sim" msgid="4052095493875188564">"SIM status"</string> - <string name="notification_channel_sim_high_prio" msgid="1787666807724243207">"High priority SIM status"</string> <string name="peerTtyModeFull" msgid="6165351790010341421">"Peer requested TTY Mode FULL"</string> <string name="peerTtyModeHco" msgid="5728602160669216784">"Peer requested TTY Mode HCO"</string> <string name="peerTtyModeVco" msgid="1742404978686538049">"Peer requested TTY Mode VCO"</string> diff --git a/packages/SettingsLib/HelpUtils/AndroidManifest.xml b/packages/SettingsLib/HelpUtils/AndroidManifest.xml index 5240ce44c9d9..ccad6e49ff8c 100644 --- a/packages/SettingsLib/HelpUtils/AndroidManifest.xml +++ b/packages/SettingsLib/HelpUtils/AndroidManifest.xml @@ -16,6 +16,6 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.settingslib.helputils"> + package="com.android.settingslib.widget"> </manifest> diff --git a/packages/SettingsLib/HelpUtils/src/com/android/settingslib/HelpUtils.java b/packages/SettingsLib/HelpUtils/src/com/android/settingslib/HelpUtils.java index e407d7239546..2d13b73d3d1f 100644 --- a/packages/SettingsLib/HelpUtils/src/com/android/settingslib/HelpUtils.java +++ b/packages/SettingsLib/HelpUtils/src/com/android/settingslib/HelpUtils.java @@ -33,11 +33,11 @@ import android.view.Menu; import android.view.MenuItem; import android.view.MenuItem.OnMenuItemClickListener; +import com.android.settingslib.widget.R; + import java.net.URISyntaxException; import java.util.Locale; -import com.android.settingslib.helputils.R; - /** * Functions to easily prepare contextual help menu option items with an intent that opens up the * browser to a particular URL, while taking into account the preferred language and app version. diff --git a/packages/SettingsLib/RestrictedLockUtils/AndroidManifest.xml b/packages/SettingsLib/RestrictedLockUtils/AndroidManifest.xml index d19a02238628..09756400b736 100644 --- a/packages/SettingsLib/RestrictedLockUtils/AndroidManifest.xml +++ b/packages/SettingsLib/RestrictedLockUtils/AndroidManifest.xml @@ -16,6 +16,6 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.settingslib.restrictedlockutils"> + package="com.android.settingslib.widget"> </manifest>
\ No newline at end of file diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp index 4c52b1324781..636b90af80a2 100644 --- a/packages/SystemUI/Android.bp +++ b/packages/SystemUI/Android.bp @@ -71,10 +71,6 @@ android_library { "telephony-common", ], - aaptflags: [ - "--extra-packages", - "com.android.keyguard", - ], kotlincflags: ["-Xjvm-default=enable"], plugins: ["dagger2-compiler-2.19"], @@ -132,7 +128,7 @@ android_library { kotlincflags: ["-Xjvm-default=enable"], aaptflags: [ "--extra-packages", - "com.android.keyguard:com.android.systemui", + "com.android.systemui", ], plugins: ["dagger2-compiler-2.19"], } @@ -160,10 +156,6 @@ android_app { kotlincflags: ["-Xjvm-default=enable"], dxflags: ["--multi-dex"], - aaptflags: [ - "--extra-packages", - "com.android.keyguard", - ], required: ["privapp_whitelist_com.android.systemui"], } @@ -180,10 +172,6 @@ android_app { privileged: true, dxflags: ["--multi-dex"], - aaptflags: [ - "--extra-packages", - "com.android.keyguard", - ], optimize: { proguard_flags_files: ["proguard.flags", "legacy/recents/proguard.flags"], }, diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 6e8e8236a99a..78318cb7e858 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -273,7 +273,6 @@ <!-- SystemUI Services: The classes of the stuff to start. --> <string-array name="config_systemUIServiceComponents" translatable="false"> - <item>com.android.systemui.Dependency$DependencyCreator</item> <item>com.android.systemui.util.NotificationChannels</item> <item>com.android.systemui.statusbar.CommandQueue$CommandQueueStart</item> <item>com.android.systemui.keyguard.KeyguardViewMediator</item> @@ -304,7 +303,6 @@ <!-- SystemUI Services (per user): The classes of the stuff to start for each user. This is a subset of the config_systemUIServiceComponents --> <string-array name="config_systemUIServiceComponentsPerUser" translatable="false"> - <item>com.android.systemui.Dependency$DependencyCreator</item> <item>com.android.systemui.util.NotificationChannels</item> </string-array> diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierText.java b/packages/SystemUI/src/com/android/keyguard/CarrierText.java index adcb7a125e80..b70d8341799a 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierText.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierText.java @@ -24,6 +24,8 @@ import android.util.AttributeSet; import android.view.View; import android.widget.TextView; +import com.android.systemui.R; + import java.util.Locale; public class CarrierText extends TextView { diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java index 10d132ad2763..2b8e3ee0dfc0 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java @@ -44,6 +44,7 @@ import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.TelephonyProperties; import com.android.settingslib.WirelessUtils; import com.android.systemui.Dependency; +import com.android.systemui.R; import com.android.systemui.keyguard.WakefulnessLifecycle; import java.util.ArrayList; diff --git a/packages/SystemUI/src/com/android/keyguard/EmergencyCarrierArea.java b/packages/SystemUI/src/com/android/keyguard/EmergencyCarrierArea.java index e98ef0607951..225bebe57128 100644 --- a/packages/SystemUI/src/com/android/keyguard/EmergencyCarrierArea.java +++ b/packages/SystemUI/src/com/android/keyguard/EmergencyCarrierArea.java @@ -21,6 +21,8 @@ import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; +import com.android.systemui.R; + public class EmergencyCarrierArea extends AlphaOptimizedLinearLayout { private CarrierText mCarrierText; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java index 517abac671b5..d45603fd23ff 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java @@ -33,6 +33,7 @@ import android.widget.LinearLayout; import com.android.internal.util.LatencyTracker; import com.android.internal.widget.LockPatternChecker; import com.android.internal.widget.LockPatternUtils; +import com.android.systemui.R; import java.util.Arrays; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockAccessibilityDelegate.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockAccessibilityDelegate.java index 6a83c719b38f..a78c293a65ac 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockAccessibilityDelegate.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockAccessibilityDelegate.java @@ -23,6 +23,8 @@ import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.TextView; +import com.android.systemui.R; + /** * Replaces fancy colons with regular colons. Only works on TextViews. */ diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java index 5097216a7405..df0dc467f87e 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java @@ -30,6 +30,7 @@ import com.android.internal.colorextraction.ColorExtractor; import com.android.internal.colorextraction.ColorExtractor.OnColorsChangedListener; import com.android.keyguard.clock.ClockManager; import com.android.systemui.Interpolators; +import com.android.systemui.R; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.plugins.ClockPlugin; import com.android.systemui.plugins.statusbar.StatusBarStateController; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java index 0ec60e5dff7d..9380eb4b03f0 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java @@ -35,6 +35,7 @@ import android.view.WindowManager; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.Dependency; +import com.android.systemui.R; import com.android.systemui.statusbar.NavigationBarController; import com.android.systemui.statusbar.phone.NavigationBarView; import com.android.systemui.util.InjectionInflationController; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardEsimArea.java b/packages/SystemUI/src/com/android/keyguard/KeyguardEsimArea.java index c2bbfbf73bb6..fe641427cb31 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardEsimArea.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardEsimArea.java @@ -32,6 +32,8 @@ import android.view.View; import android.view.WindowManager; import android.widget.Button; +import com.android.systemui.R; + /*** * This button is used by the device with embedded SIM card to disable current carrier to unlock * the device with no cellular service. diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java index 14ead0427478..8e1f6d384d1d 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java @@ -35,6 +35,7 @@ import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardSecurityContainer.SecurityCallback; import com.android.keyguard.KeyguardSecurityModel.SecurityMode; import com.android.settingslib.Utils; +import com.android.systemui.R; import com.android.systemui.plugins.ActivityStarter.OnDismissAction; import java.io.File; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java b/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java index 037a8d3146d2..1ff98ddf2267 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java @@ -31,6 +31,7 @@ import android.util.TypedValue; import android.view.View; import android.widget.TextView; +import com.android.systemui.R; import com.android.systemui.statusbar.policy.ConfigurationController; import java.lang.ref.WeakReference; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java index 6808c0f73998..15d2ea7c3280 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java @@ -24,6 +24,7 @@ import android.view.animation.AnimationUtils; import com.android.settingslib.animation.AppearAnimationUtils; import com.android.settingslib.animation.DisappearAnimationUtils; +import com.android.systemui.R; /** * Displays a PIN pad for unlocking. diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java index 963921561f67..eaaa3ed78654 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java @@ -37,6 +37,7 @@ import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; import com.android.internal.widget.TextViewInputDisabler; +import com.android.systemui.R; import java.util.List; /** diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java index 56b38f7382fa..34c15e64ff54 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java @@ -42,6 +42,7 @@ import com.android.internal.widget.LockPatternView; import com.android.settingslib.animation.AppearAnimationCreator; import com.android.settingslib.animation.AppearAnimationUtils; import com.android.settingslib.animation.DisappearAnimationUtils; +import com.android.systemui.R; import java.util.List; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java index ecafc3408224..274f739d8c29 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java @@ -23,6 +23,8 @@ import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; +import com.android.systemui.R; + /** * A Pin based Keyguard input view */ diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index 169c97b1ce22..ca7cd0d666ad 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -45,6 +45,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardSecurityModel.SecurityMode; import com.android.systemui.Dependency; +import com.android.systemui.R; import com.android.systemui.SystemUIFactory; import com.android.systemui.statusbar.phone.UnlockMethodCache; import com.android.systemui.util.InjectionInflationController; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java index e6a02506b4a3..24da3ad46f23 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java @@ -32,6 +32,7 @@ import android.widget.FrameLayout; import android.widget.ViewFlipper; import com.android.internal.widget.LockPatternUtils; +import com.android.systemui.R; /** * Subclass of the current view flipper that allows us to overload dispatchTouchEvent() so diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java index 69da990a0a73..367a7bd4aed7 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java @@ -41,6 +41,7 @@ import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.IccCardConstants.State; import com.android.internal.telephony.PhoneConstants; +import com.android.systemui.R; /** * Displays a PIN pad for unlocking. diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java index 27f71d1ae2be..81f8c67605fe 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java @@ -40,6 +40,7 @@ import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.IccCardConstants.State; import com.android.internal.telephony.PhoneConstants; +import com.android.systemui.R; /** diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java index 37e89c095575..1dfc5f25955b 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java @@ -40,6 +40,7 @@ import androidx.core.graphics.ColorUtils; import com.android.internal.widget.LockPatternUtils; import com.android.systemui.Dependency; +import com.android.systemui.R; import com.android.systemui.statusbar.policy.ConfigurationController; import java.io.FileDescriptor; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index c5847a8a7e31..0d456ff29914 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -94,6 +94,7 @@ import com.android.internal.telephony.TelephonyIntents; import com.android.internal.util.Preconditions; import com.android.internal.widget.LockPatternUtils; import com.android.settingslib.WirelessUtils; +import com.android.systemui.R; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.statusbar.phone.KeyguardBypassController; diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java index 08691ec10d6a..ebdd8c653dce 100644 --- a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java +++ b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java @@ -29,6 +29,7 @@ import android.view.ViewGroup; import android.widget.TextView; import com.android.internal.widget.LockPatternUtils; +import com.android.systemui.R; public class NumPadKey extends ViewGroup { // list of "ABC", etc per digit, starting with '0' diff --git a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java index b21bcc98ae68..409ae3f3c7d6 100644 --- a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java +++ b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java @@ -42,6 +42,8 @@ import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import android.widget.EditText; +import com.android.systemui.R; + import java.util.ArrayList; import java.util.Stack; diff --git a/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java index 9c5242ce1a3e..eba24004e387 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java @@ -26,7 +26,7 @@ import android.view.View; import android.widget.TextClock; import com.android.internal.colorextraction.ColorExtractor; -import com.android.keyguard.R; +import com.android.systemui.R; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.plugins.ClockPlugin; diff --git a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java index 8e81327a9325..3a2fbe5a9653 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java @@ -26,7 +26,7 @@ import android.view.View; import android.widget.TextClock; import com.android.internal.colorextraction.ColorExtractor; -import com.android.keyguard.R; +import com.android.systemui.R; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.plugins.ClockPlugin; diff --git a/packages/SystemUI/src/com/android/keyguard/clock/ClockLayout.java b/packages/SystemUI/src/com/android/keyguard/clock/ClockLayout.java index 7485d336174c..d44d89e63e8f 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/ClockLayout.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/ClockLayout.java @@ -24,7 +24,7 @@ import android.util.MathUtils; import android.view.View; import android.widget.FrameLayout; -import com.android.keyguard.R; +import com.android.systemui.R; /** * Positions clock faces (analog, digital, typographic) and handles pixel shifting diff --git a/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java index 98679ade1022..c81935a15a15 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java @@ -26,7 +26,7 @@ import android.view.View; import android.widget.TextView; import com.android.internal.colorextraction.ColorExtractor; -import com.android.keyguard.R; +import com.android.systemui.R; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.plugins.ClockPlugin; diff --git a/packages/SystemUI/src/com/android/keyguard/clock/ImageClock.java b/packages/SystemUI/src/com/android/keyguard/clock/ImageClock.java index 95f100433137..34c041bbb2dc 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/ImageClock.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/ImageClock.java @@ -21,7 +21,7 @@ import android.util.AttributeSet; import android.widget.FrameLayout; import android.widget.ImageView; -import com.android.keyguard.R; +import com.android.systemui.R; import java.text.SimpleDateFormat; import java.util.Calendar; diff --git a/packages/SystemUI/src/com/android/keyguard/clock/SmallClockPosition.java b/packages/SystemUI/src/com/android/keyguard/clock/SmallClockPosition.java index 60ca945278f6..b3040744ce7a 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/SmallClockPosition.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/SmallClockPosition.java @@ -20,6 +20,7 @@ import android.content.res.Resources; import android.util.MathUtils; import com.android.internal.annotations.VisibleForTesting; +import com.android.systemui.R; /** * Computes preferred position of clock by considering height of status bar and lock icon. @@ -40,10 +41,10 @@ class SmallClockPosition { private float mDarkAmount; SmallClockPosition(Resources res) { - this(res.getDimensionPixelSize(com.android.keyguard.R.dimen.status_bar_height), - res.getDimensionPixelSize(com.android.keyguard.R.dimen.keyguard_lock_padding), - res.getDimensionPixelSize(com.android.keyguard.R.dimen.keyguard_lock_height), - res.getDimensionPixelSize(com.android.keyguard.R.dimen.burn_in_prevention_offset_y) + this(res.getDimensionPixelSize(R.dimen.status_bar_height), + res.getDimensionPixelSize(R.dimen.keyguard_lock_padding), + res.getDimensionPixelSize(R.dimen.keyguard_lock_height), + res.getDimensionPixelSize(R.dimen.burn_in_prevention_offset_y) ); } diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java index 6c36bc98996b..15bea2484d7f 100644 --- a/packages/SystemUI/src/com/android/systemui/Dependency.java +++ b/packages/SystemUI/src/com/android/systemui/Dependency.java @@ -16,7 +16,6 @@ package com.android.systemui; import android.annotation.Nullable; import android.app.INotificationManager; -import android.content.Context; import android.content.res.Configuration; import android.hardware.SensorPrivacyManager; import android.hardware.display.NightDisplayListener; @@ -114,7 +113,6 @@ import com.android.systemui.util.leak.LeakReporter; import java.io.FileDescriptor; import java.io.PrintWriter; -import java.util.HashMap; import java.util.function.Consumer; import javax.inject.Inject; @@ -138,9 +136,7 @@ import dagger.Subcomponent; * they have no clients they should not have any registered resources like bound * services, registered receivers, etc. */ -public class Dependency extends SystemUI { - private static final String TAG = "Dependency"; - +public class Dependency { /** * Key for getting a background Looper for background work. */ @@ -305,8 +301,20 @@ public class Dependency extends SystemUI { public Dependency() { } - @Override - public void start() { + + /** + * Initialize Depenency. + */ + public static void initDependencies(SystemUIRootComponent rootComponent) { + if (sDependency != null) { + return; + } + sDependency = new Dependency(); + rootComponent.createDependency().createSystemUI(sDependency); + sDependency.start(); + } + + protected void start() { // TODO: Think about ways to push these creation rules out of Dependency to cut down // on imports. mProviders.put(TIME_TICK_HANDLER, mTimeTickHandler::get); @@ -486,10 +494,14 @@ public class Dependency extends SystemUI { sDependency = this; } - @Override - public synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) { - super.dump(fd, pw, args); + static void staticDump(FileDescriptor fd, PrintWriter pw, String[] args) { + sDependency.dump(fd, pw, args); + } + /** + * {@see SystemUI.dump} + */ + public synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) { // Make sure that the DumpController gets added to mDependencies, as they are only added // with Dependency#get. getDependency(DumpController.class); @@ -509,9 +521,11 @@ public class Dependency extends SystemUI { .forEach(o -> ((Dumpable) o).dump(fd, pw, args)); } - @Override + protected static void staticOnConfigurationChanged(Configuration newConfig) { + sDependency.onConfigurationChanged(newConfig); + } + protected synchronized void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); mDependencies.values().stream().filter(obj -> obj instanceof ConfigurationChangedReceiver) .forEach(o -> ((ConfigurationChangedReceiver) o).onConfigurationChanged(newConfig)); } @@ -565,20 +579,6 @@ public class Dependency extends SystemUI { } /** - * Used in separate processes (like tuner settings) to init the dependencies. - */ - public static void initDependencies(Context context) { - if (sDependency != null) return; - Dependency d = new Dependency(); - SystemUIFactory.getInstance().getRootComponent() - .createDependency() - .createSystemUI(d); - d.mContext = context; - d.mComponents = new HashMap<>(); - d.start(); - } - - /** * Used in separate process teardown to ensure the context isn't leaked. * * TODO: Remove once PreferenceFragment doesn't reference getActivity() @@ -629,15 +629,4 @@ public class Dependency extends SystemUI { public interface DependencyInjector { void createSystemUI(Dependency dependency); } - - public static class DependencyCreator implements Injector { - @Override - public SystemUI apply(Context context) { - Dependency dependency = new Dependency(); - SystemUIFactory.getInstance().getRootComponent() - .createDependency() - .createSystemUI(dependency); - return dependency; - } - } } diff --git a/packages/SystemUI/src/com/android/systemui/ForegroundServicesDialog.java b/packages/SystemUI/src/com/android/systemui/ForegroundServicesDialog.java index cb9523fcaed1..6fec92c84fec 100644 --- a/packages/SystemUI/src/com/android/systemui/ForegroundServicesDialog.java +++ b/packages/SystemUI/src/com/android/systemui/ForegroundServicesDialog.java @@ -75,7 +75,7 @@ public final class ForegroundServicesDialog extends AlertActivity implements @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Dependency.initDependencies(getApplicationContext()); + Dependency.initDependencies(SystemUIFactory.getInstance().getRootComponent()); mMetricsLogger = Dependency.get(MetricsLogger.class); diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java index f8449add6dce..48127a75b86e 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java @@ -62,19 +62,28 @@ public class SystemUIApplication extends Application implements SysUiServiceProv private final Map<Class<?>, Object> mComponents = new HashMap<>(); private ContextAvailableCallback mContextAvailableCallback; + public SystemUIApplication() { + super(); + Log.v(TAG, "SystemUIApplication constructed."); + } + @Override public void onCreate() { super.onCreate(); + Log.v(TAG, "SystemUIApplication created."); // This line is used to setup Dagger's dependency injection and should be kept at the // top of this method. + TimingsTraceLog log = new TimingsTraceLog("SystemUIBootTiming", + Trace.TRACE_TAG_APP); + log.traceBegin("DependencyInjection"); mContextAvailableCallback.onContextAvailable(this); + log.traceEnd(); // Set the application theme that is inherited by all services. Note that setting the // application theme in the manifest does only work for activities. Keep this in sync with // the theme set there. setTheme(R.style.Theme_SystemUI); - if (Process.myUserHandle().equals(UserHandle.SYSTEM)) { IntentFilter bootCompletedFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED); bootCompletedFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); @@ -138,7 +147,7 @@ public class SystemUIApplication extends Application implements SysUiServiceProv /** * Ensures that all the Secondary user SystemUI services are running. If they are already - * running, this is a no-op. This is needed to conditinally start all the services, as we only + * running, this is a no-op. This is needed to conditionally start all the services, as we only * need to have it in the main process. * <p>This method must only be called from the main thread.</p> */ @@ -159,7 +168,9 @@ public class SystemUIApplication extends Application implements SysUiServiceProv // see ActivityManagerService.finishBooting() if ("1".equals(SystemProperties.get("sys.boot_completed"))) { mBootCompleted = true; - if (DEBUG) Log.v(TAG, "BOOT_COMPLETED was already sent"); + if (DEBUG) { + Log.v(TAG, "BOOT_COMPLETED was already sent"); + } } } @@ -273,6 +284,7 @@ public class SystemUIApplication extends Application implements SysUiServiceProv @Override public void onConfigurationChanged(Configuration newConfig) { if (mServicesStarted) { + Dependency.staticOnConfigurationChanged(newConfig); int len = mServices.length; for (int i = 0; i < len; i++) { if (mServices[i] != null) { diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIDefaultModule.java b/packages/SystemUI/src/com/android/systemui/SystemUIDefaultModule.java new file mode 100644 index 000000000000..7f3159131f96 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/SystemUIDefaultModule.java @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui; + +import static com.android.systemui.Dependency.LEAK_REPORT_EMAIL_NAME; + +import android.content.Context; + +import androidx.annotation.Nullable; + +import com.android.systemui.dock.DockManager; +import com.android.systemui.dock.DockManagerImpl; +import com.android.systemui.power.EnhancedEstimates; +import com.android.systemui.power.EnhancedEstimatesImpl; +import com.android.systemui.statusbar.NotificationLockscreenUserManager; +import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl; +import com.android.systemui.statusbar.notification.collection.NotificationData; +import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl; +import com.android.systemui.statusbar.phone.ShadeController; +import com.android.systemui.statusbar.phone.StatusBar; + +import javax.inject.Named; +import javax.inject.Singleton; + +import dagger.Binds; +import dagger.Module; +import dagger.Provides; + +/** + * A dagger module for injecting default implementations of components of System UI that may be + * overridden by the System UI implementation. + */ +@Module +abstract class SystemUIDefaultModule { + + @Singleton + @Provides + @Named(LEAK_REPORT_EMAIL_NAME) + @Nullable + static String provideLeakReportEmail() { + return null; + } + + @Binds + abstract EnhancedEstimates bindEnhancedEstimates(EnhancedEstimatesImpl enhancedEstimates); + + @Binds + abstract NotificationLockscreenUserManager bindNotificationLockscreenUserManager( + NotificationLockscreenUserManagerImpl notificationLockscreenUserManager); + + @Binds + abstract DockManager bindDockManager(DockManagerImpl dockManager); + + @Binds + abstract NotificationData.KeyguardEnvironment bindKeyguardEnvironment( + KeyguardEnvironmentImpl keyguardEnvironment); + + @Singleton + @Provides + static ShadeController provideShadeController(Context context) { + return SysUiServiceProvider.getComponent(context, StatusBar.class); + } +} diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java index 5d8ecc5bfabf..0899d955a1ac 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java @@ -16,13 +16,8 @@ package com.android.systemui; -import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME; -import static com.android.systemui.Dependency.LEAK_REPORT_EMAIL_NAME; - -import android.annotation.Nullable; import android.app.AlarmManager; import android.content.Context; -import android.content.pm.PackageManager; import android.os.Handler; import android.os.Looper; import android.util.Log; @@ -33,59 +28,40 @@ import com.android.internal.util.function.TriConsumer; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.ViewMediatorCallback; -import com.android.systemui.assist.AssistManager; -import com.android.systemui.dock.DockManager; import com.android.systemui.keyguard.DismissCallbackRegistry; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; -import com.android.systemui.power.EnhancedEstimates; -import com.android.systemui.power.EnhancedEstimatesImpl; import com.android.systemui.statusbar.KeyguardIndicationController; -import com.android.systemui.statusbar.NotificationListener; -import com.android.systemui.statusbar.NotificationLockscreenUserManager; -import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.ScrimView; -import com.android.systemui.statusbar.notification.NotificationEntryManager; -import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; -import com.android.systemui.statusbar.notification.collection.NotificationData; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.KeyguardBouncer; import com.android.systemui.statusbar.phone.KeyguardBypassController; -import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl; -import com.android.systemui.statusbar.phone.KeyguardLiftController; import com.android.systemui.statusbar.phone.LockIcon; import com.android.systemui.statusbar.phone.LockscreenWallpaper; import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.ScrimState; -import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.phone.UnlockMethodCache; -import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.KeyguardMonitor; -import com.android.systemui.util.AsyncSensorManager; import com.android.systemui.volume.VolumeDialogComponent; import java.util.function.Consumer; -import javax.inject.Named; -import javax.inject.Singleton; - import dagger.Module; import dagger.Provides; /** * Class factory to provide customizable SystemUI components. */ -@Module public class SystemUIFactory { private static final String TAG = "SystemUIFactory"; static SystemUIFactory mFactory; - private SystemUIRootComponent mRootComponent; + protected SystemUIRootComponent mRootComponent; public static <T extends SystemUIFactory> T getInstance() { return (T) mFactory; @@ -110,9 +86,16 @@ public class SystemUIFactory { public SystemUIFactory() {} - protected void init(Context context) { - mRootComponent = DaggerSystemUIRootComponent.builder() - .systemUIFactory(this) + private void init(Context context) { + mRootComponent = buildSystemUIRootComponent(context); + + // Every other part of our codebase currently relies on Dependency, so we + // really need to ensure the Dependency gets initialized early on. + Dependency.initDependencies(mRootComponent); + } + + protected SystemUIRootComponent buildSystemUIRootComponent(Context context) { + return DaggerSystemUIRootComponent.builder() .dependencyProvider(new com.android.systemui.DependencyProvider()) .contextHolder(new ContextHolder(context)) .build(); @@ -128,14 +111,15 @@ public class SystemUIFactory { } public KeyguardBouncer createKeyguardBouncer(Context context, ViewMediatorCallback callback, - LockPatternUtils lockPatternUtils, ViewGroup container, + LockPatternUtils lockPatternUtils, ViewGroup container, DismissCallbackRegistry dismissCallbackRegistry, KeyguardBouncer.BouncerExpansionCallback expansionCallback, - FalsingManager falsingManager) { + FalsingManager falsingManager, KeyguardBypassController bypassController) { return new KeyguardBouncer(context, callback, lockPatternUtils, container, dismissCallbackRegistry, falsingManager, expansionCallback, UnlockMethodCache.getInstance(context), - KeyguardUpdateMonitor.getInstance(context), new Handler(Looper.getMainLooper())); + KeyguardUpdateMonitor.getInstance(context), bypassController, + new Handler(Looper.getMainLooper())); } public ScrimController createScrimController(ScrimView scrimBehind, ScrimView scrimInFront, @@ -166,93 +150,8 @@ public class SystemUIFactory { return new VolumeDialogComponent(systemUi, context); } - @Singleton - @Provides - public NotificationData.KeyguardEnvironment provideKeyguardEnvironment(Context context) { - return new KeyguardEnvironmentImpl(); - } - - @Singleton - @Provides - public NotificationLockscreenUserManager provideNotificationLockscreenUserManager( - Context context) { - return new NotificationLockscreenUserManagerImpl(context); - } - - @Singleton - @Provides - public AssistManager provideAssistManager(DeviceProvisionedController controller, - Context context) { - return new AssistManager(controller, context); - } - - @Singleton - @Provides - @Nullable - public DockManager provideDockManager(Context context) { - return null; - } - - @Singleton - @Provides - public NotificationEntryManager provideNotificationEntryManager(Context context) { - return new NotificationEntryManager(context); - } - - @Singleton - @Provides - public EnhancedEstimates provideEnhancedEstimates(Context context) { - return new EnhancedEstimatesImpl(); - } - - @Singleton - @Provides - @Named(LEAK_REPORT_EMAIL_NAME) - @Nullable - public String provideLeakReportEmail() { - return null; - } - - @Singleton - @Provides - @Nullable - public KeyguardLiftController provideKeyguardLiftController(Context context, - StatusBarStateController statusBarStateController, - AsyncSensorManager asyncSensorManager) { - if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) { - return null; - } - return new KeyguardLiftController(context, statusBarStateController, asyncSensorManager); - } - - @Singleton - @Provides - public NotificationListener provideNotificationListener(Context context) { - return new NotificationListener(context); - } - - @Singleton - @Provides - public NotificationInterruptionStateProvider provideNotificationInterruptionStateProvider( - Context context) { - return new NotificationInterruptionStateProvider(context); - } - - @Singleton - @Provides - @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) - public boolean provideAllowNotificationLongPress() { - return true; - } - - @Singleton - @Provides - public ShadeController provideShadeController(Context context) { - return SysUiServiceProvider.getComponent(context, StatusBar.class); - } - @Module - protected static class ContextHolder { + public static class ContextHolder { private Context mContext; public ContextHolder(Context context) { diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/SystemUIModule.java new file mode 100644 index 000000000000..e1baf9fcf9bc --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/SystemUIModule.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui; + +import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME; + +import android.annotation.Nullable; +import android.content.Context; +import android.content.pm.PackageManager; + +import com.android.systemui.plugins.statusbar.StatusBarStateController; +import com.android.systemui.statusbar.phone.KeyguardLiftController; +import com.android.systemui.util.AsyncSensorManager; + +import javax.inject.Named; +import javax.inject.Singleton; + +import dagger.Module; +import dagger.Provides; + +/** + * A dagger module for injecting components of System UI that are not overridden by the System UI + * implementation. + */ +@Module +public abstract class SystemUIModule { + + @Singleton + @Provides + @Nullable + static KeyguardLiftController provideKeyguardLiftController(Context context, + StatusBarStateController statusBarStateController, + AsyncSensorManager asyncSensorManager) { + if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) { + return null; + } + return new KeyguardLiftController(context, statusBarStateController, asyncSensorManager); + } + + @Singleton + @Provides + @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) + static boolean provideAllowNotificationLongPress() { + return true; + } +} diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java b/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java index c732df3fdb9f..f18c8b2c3da6 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java @@ -16,11 +16,14 @@ package com.android.systemui; +import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME; + import com.android.systemui.fragments.FragmentService; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.util.InjectionInflationController; import com.android.systemui.util.leak.GarbageMonitor; +import javax.inject.Named; import javax.inject.Singleton; import dagger.Component; @@ -29,8 +32,13 @@ import dagger.Component; * Root component for Dagger injection. */ @Singleton -@Component(modules = {SystemUIFactory.class, DependencyProvider.class, DependencyBinder.class, - ServiceBinder.class, SystemUIFactory.ContextHolder.class}) +@Component(modules = { + DependencyProvider.class, + DependencyBinder.class, + ServiceBinder.class, + SystemUIFactory.ContextHolder.class, + SystemUIModule.class, + SystemUIDefaultModule.class}) public interface SystemUIRootComponent { /** * Main dependency providing module. @@ -62,6 +70,12 @@ public interface SystemUIRootComponent { GarbageMonitor createGarbageMonitor(); /** + * Whether notification long press is allowed. + */ + @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) + boolean allowNotificationLongPressName(); + + /** * Injects into the supplied argument. */ void inject(SystemUIAppComponentFactory factory); diff --git a/packages/SystemUI/src/com/android/systemui/SystemUISecondaryUserService.java b/packages/SystemUI/src/com/android/systemui/SystemUISecondaryUserService.java index c8a2e1758ad1..2d2d91db4fe1 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUISecondaryUserService.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUISecondaryUserService.java @@ -38,25 +38,8 @@ public class SystemUISecondaryUserService extends Service { @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { - SystemUI[] services = ((SystemUIApplication) getApplication()).getServices(); - if (args == null || args.length == 0) { - for (SystemUI ui: services) { - if (ui != null) { - pw.println("dumping service: " + ui.getClass().getName()); - ui.dump(fd, pw, args); - } - } - } else { - String svc = args[0]; - for (SystemUI ui: services) { - if (ui != null) { - String name = ui.getClass().getName(); - if (name.endsWith(svc)) { - ui.dump(fd, pw, args); - } - } - } - } + SystemUIService.dumpServices( + ((SystemUIApplication) getApplication()).getServices(), fd, pw, args); } } diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIService.java b/packages/SystemUI/src/com/android/systemui/SystemUIService.java index dc1218d33498..1c5e80005d84 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIService.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIService.java @@ -66,8 +66,14 @@ public class SystemUIService extends Service { @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { - SystemUI[] services = ((SystemUIApplication) getApplication()).getServices(); + dumpServices(((SystemUIApplication) getApplication()).getServices(), fd, pw, args); + } + + static void dumpServices( + SystemUI[] services, FileDescriptor fd, PrintWriter pw, String[] args) { if (args == null || args.length == 0) { + pw.println("dumping service: " + Dependency.class.getName()); + Dependency.staticDump(fd, pw, args); for (SystemUI ui: services) { pw.println("dumping service: " + ui.getClass().getName()); ui.dump(fd, pw, args); @@ -78,6 +84,9 @@ public class SystemUIService extends Service { } } else { String svc = args[0].toLowerCase(); + if (Dependency.class.getName().endsWith(svc)) { + Dependency.staticDump(fd, pw, args); + } for (SystemUI ui: services) { String name = ui.getClass().getName().toLowerCase(); if (name.endsWith(svc)) { diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java index 6da3818c5d05..25d16455a164 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java @@ -177,6 +177,12 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac mBehaviorMap.get(mCurrentBehavior).onAssistantGesturePerformed(); } + void onAssistHandlesRequested() { + if (mInGesturalMode) { + mBehaviorMap.get(mCurrentBehavior).onAssistHandlesRequested(); + } + } + void setBehavior(AssistHandleBehavior behavior) { if (mCurrentBehavior == behavior) { return; @@ -316,6 +322,7 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac void onModeActivated(Context context, AssistHandleCallbacks callbacks); default void onModeDeactivated() {} default void onAssistantGesturePerformed() {} + default void onAssistHandlesRequested() {} default void dump(PrintWriter pw, String prefix) {} } } diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java index f9ddeaef3e86..c5064b7e0422 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java @@ -211,6 +211,13 @@ final class AssistHandleReminderExpBehavior implements BehaviorController { mContext.getContentResolver(), LEARNING_EVENT_COUNT_KEY, ++mLearningCount); } + @Override + public void onAssistHandlesRequested() { + if (mAssistHandleCallbacks != null && !mIsDozing && !mIsNavBarHidden && !mOnLockscreen) { + mAssistHandleCallbacks.showAndGo(); + } + } + private static boolean isNavBarHidden(int sysuiStateFlags) { return (sysuiStateFlags & QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN) != 0; } diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index 4a4feada3c65..aafffe2fe9d3 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -48,9 +48,13 @@ import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.policy.DeviceProvisionedController; +import javax.inject.Inject; +import javax.inject.Singleton; + /** * Class to manage everything related to assist in SystemUI. */ +@Singleton public class AssistManager implements ConfigurationChangedReceiver { /** @@ -97,6 +101,8 @@ public class AssistManager implements ConfigurationChangedReceiver { private static final String INVOCATION_TIME_MS_KEY = "invocation_time_ms"; private static final String INVOCATION_PHONE_STATE_KEY = "invocation_phone_state"; public static final String INVOCATION_TYPE_KEY = "invocation_type"; + protected static final String ACTION_KEY = "action"; + protected static final String SHOW_ASSIST_HANDLES_ACTION = "show_assist_handles"; public static final int INVOCATION_TYPE_GESTURE = 1; public static final int INVOCATION_TYPE_ACTIVE_EDGE = 2; @@ -147,6 +153,7 @@ public class AssistManager implements ConfigurationChangedReceiver { } }; + @Inject public AssistManager(DeviceProvisionedController controller, Context context) { mContext = context; mDeviceProvisionedController = controller; @@ -204,6 +211,9 @@ public class AssistManager implements ConfigurationChangedReceiver { if (VERBOSE) { Log.v(TAG, "UI hints received"); } + if (SHOW_ASSIST_HANDLES_ACTION.equals(hints.getString(ACTION_KEY))) { + requestAssistHandles(); + } } }); } @@ -277,6 +287,10 @@ public class AssistManager implements ConfigurationChangedReceiver { mUiController.onGestureCompletion(velocity); } + protected void requestAssistHandles() { + mHandleController.onAssistHandlesRequested(); + } + public void hideAssist() { mAssistUtils.hideCurrentSession(); } diff --git a/packages/SystemUI/src/com/android/systemui/dock/DockManagerImpl.java b/packages/SystemUI/src/com/android/systemui/dock/DockManagerImpl.java new file mode 100644 index 000000000000..fa7f5032ca16 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/dock/DockManagerImpl.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.dock; + +import javax.inject.Inject; +import javax.inject.Singleton; + +@Singleton +public class DockManagerImpl implements DockManager { + + @Inject + public DockManagerImpl() { + } + + @Override + public void addListener(DockEventListener callback) { + } + + @Override + public void removeListener(DockEventListener callback) { + } + + @Override + public boolean isDocked() { + return false; + } +} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 36c3cc68be85..f424a8e5d71f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -81,6 +81,7 @@ import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.Dependency; +import com.android.systemui.R; import com.android.systemui.SystemUI; import com.android.systemui.SystemUIFactory; import com.android.systemui.UiOffloadThread; @@ -713,8 +714,7 @@ public class KeyguardViewMediator extends SystemUI { // Assume keyguard is showing (unless it's disabled) until we know for sure, unless Keyguard // is disabled. - if (mContext.getResources().getBoolean( - com.android.keyguard.R.bool.config_enableKeyguardService)) { + if (mContext.getResources().getBoolean(R.bool.config_enableKeyguardService)) { setShowingLocked(!shouldWaitForProvisioning() && !mLockPatternUtils.isLockScreenDisabled( KeyguardUpdateMonitor.getCurrentUser()), true /* forceCallbacks */); diff --git a/packages/SystemUI/src/com/android/systemui/power/EnhancedEstimatesImpl.java b/packages/SystemUI/src/com/android/systemui/power/EnhancedEstimatesImpl.java index 9b1f23aa0d0c..78f53501d100 100644 --- a/packages/SystemUI/src/com/android/systemui/power/EnhancedEstimatesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/power/EnhancedEstimatesImpl.java @@ -2,8 +2,16 @@ package com.android.systemui.power; import com.android.settingslib.fuelgauge.Estimate; +import javax.inject.Inject; +import javax.inject.Singleton; + +@Singleton public class EnhancedEstimatesImpl implements EnhancedEstimates { + @Inject + public EnhancedEstimatesImpl() { + } + @Override public boolean isHybridNotificationEnabled() { return false; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java index c375574f023d..14009214bdc5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java @@ -37,11 +37,15 @@ import com.android.systemui.statusbar.phone.NotificationListenerWithPlugins; import java.util.ArrayList; +import javax.inject.Inject; +import javax.inject.Singleton; + /** * This class handles listening to notification updates and passing them along to * NotificationPresenter to be displayed to the user. */ @SuppressLint("OverrideAbstract") +@Singleton public class NotificationListener extends NotificationListenerWithPlugins { private static final String TAG = "NotificationListener"; @@ -56,6 +60,7 @@ public class NotificationListener extends NotificationListenerWithPlugins { private final ArrayList<NotificationSettingsListener> mSettingsListeners = new ArrayList<>(); private final Context mContext; + @Inject public NotificationListener(Context context) { mContext = context; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java index e08a5ae07bd8..802a7d29a7a5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java @@ -58,10 +58,14 @@ import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; +import javax.inject.Singleton; + /** * Handles keeping track of the current user, profiles, and various things related to hiding * contents, redacting notifications, and the lockscreen. */ +@Singleton public class NotificationLockscreenUserManagerImpl implements Dumpable, NotificationLockscreenUserManager, StateListener { private static final String TAG = "LockscreenUserManager"; @@ -171,6 +175,7 @@ public class NotificationLockscreenUserManagerImpl implements return mEntryManager; } + @Inject public NotificationLockscreenUserManagerImpl(Context context) { mContext = context; mDevicePolicyManager = (DevicePolicyManager) mContext.getSystemService( diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java index 879a8dfa2875..f8fef7d4778c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java @@ -54,11 +54,15 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.inject.Inject; +import javax.inject.Singleton; + /** * NotificationEntryManager is responsible for the adding, removing, and updating of notifications. * It also handles tasks such as their inflation and their interaction with other * Notification.*Manager objects. */ +@Singleton public class NotificationEntryManager implements Dumpable, NotificationContentInflater.InflationCallback, @@ -118,6 +122,7 @@ public class NotificationEntryManager implements } } + @Inject public NotificationEntryManager(Context context) { mNotificationData = new NotificationData(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java index 4fc646119261..68d95463bd3a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInterruptionStateProvider.java @@ -42,9 +42,13 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.policy.HeadsUpManager; +import javax.inject.Inject; +import javax.inject.Singleton; + /** * Provides heads-up and pulsing state for notification entries. */ +@Singleton public class NotificationInterruptionStateProvider { private static final String TAG = "InterruptionStateProvider"; @@ -72,6 +76,7 @@ public class NotificationInterruptionStateProvider { protected boolean mUseHeadsUp = false; private boolean mDisableNotificationAlerts; + @Inject public NotificationInterruptionStateProvider(Context context) { this(context, (PowerManager) context.getSystemService(Context.POWER_SERVICE), 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 c4d346ccaefb..0854e84a6888 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -40,9 +40,9 @@ import com.android.keyguard.KeyguardHostView; import com.android.keyguard.KeyguardSecurityView; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; -import com.android.keyguard.R; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.DejankUtils; +import com.android.systemui.R; import com.android.systemui.keyguard.DismissCallbackRegistry; import com.android.systemui.plugins.FalsingManager; @@ -77,6 +77,7 @@ public class KeyguardBouncer { } }; private final Runnable mRemoveViewRunnable = this::removeView; + private final KeyguardBypassController mKeyguardBypassController; protected KeyguardHostView mKeyguardView; private final Runnable mResetRunnable = ()-> { if (mKeyguardView != null) { @@ -97,7 +98,8 @@ public class KeyguardBouncer { LockPatternUtils lockPatternUtils, ViewGroup container, DismissCallbackRegistry dismissCallbackRegistry, FalsingManager falsingManager, BouncerExpansionCallback expansionCallback, UnlockMethodCache unlockMethodCache, - KeyguardUpdateMonitor keyguardUpdateMonitor, Handler handler) { + KeyguardUpdateMonitor keyguardUpdateMonitor, + KeyguardBypassController keyguardBypassController, Handler handler) { mContext = context; mCallback = callback; mLockPatternUtils = lockPatternUtils; @@ -109,6 +111,7 @@ public class KeyguardBouncer { mHandler = handler; mUnlockMethodCache = unlockMethodCache; mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback); + mKeyguardBypassController = keyguardBypassController; } public void show(boolean resetSecuritySelection) { @@ -171,7 +174,8 @@ public class KeyguardBouncer { // Split up the work over multiple frames. DejankUtils.removeCallbacks(mResetRunnable); if (mUnlockMethodCache.isFaceAuthEnabled() && !needsFullscreenBouncer() - && !mKeyguardUpdateMonitor.userNeedsStrongAuth()) { + && !mKeyguardUpdateMonitor.userNeedsStrongAuth() + && !mKeyguardBypassController.getBypassEnabled()) { mHandler.postDelayed(mShowRunnable, BOUNCER_FACE_DELAY); } else { DejankUtils.postAfterTraversal(mShowRunnable); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardEnvironmentImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardEnvironmentImpl.java index 925a19d6f5eb..2c931ae1c8ef 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardEnvironmentImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardEnvironmentImpl.java @@ -25,6 +25,10 @@ import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.notification.collection.NotificationData.KeyguardEnvironment; import com.android.systemui.statusbar.policy.DeviceProvisionedController; +import javax.inject.Inject; +import javax.inject.Singleton; + +@Singleton public class KeyguardEnvironmentImpl implements KeyguardEnvironment { private static final String TAG = "KeyguardEnvironmentImpl"; @@ -34,6 +38,7 @@ public class KeyguardEnvironmentImpl implements KeyguardEnvironment { private final DeviceProvisionedController mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class); + @Inject public KeyguardEnvironmentImpl() { } 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 97f069274f78..5d5cbe984859 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -25,6 +25,7 @@ import static android.app.StatusBarManager.WindowVisibleState; import static android.app.StatusBarManager.windowStateToString; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY; +import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME; import static com.android.systemui.Dependency.BG_HANDLER; import static com.android.systemui.Dependency.MAIN_HANDLER; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_ASLEEP; @@ -238,6 +239,7 @@ import java.util.ArrayList; import java.util.Map; import javax.inject.Inject; +import javax.inject.Named; import dagger.Subcomponent; @@ -382,6 +384,9 @@ public class StatusBar extends SystemUI implements DemoMode, @Nullable @Inject protected KeyguardLiftController mKeyguardLiftController; + @Inject + @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) + boolean mAllowNotificationLongPress; // expanded notifications protected NotificationPanelView mNotificationPanel; // the sliding/resizing panel within the notification window @@ -1064,7 +1069,7 @@ public class StatusBar extends SystemUI implements DemoMode, final NotificationRowBinderImpl rowBinder = new NotificationRowBinderImpl( mContext, - SystemUIFactory.getInstance().provideAllowNotificationLongPress(), + mAllowNotificationLongPress, mKeyguardBypassController, mStatusBarStateController); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index d47adbe180c8..0c47d1468a7f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -221,7 +221,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mBiometricUnlockController = biometricUnlockController; mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext, mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry, - mExpansionCallback, falsingManager); + mExpansionCallback, falsingManager, bypassController); mNotificationPanelView = notificationPanelView; notificationPanelView.addExpansionListener(this); mBypassController = bypassController; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java index 0ef981bdb3de..946fe0b3a2f8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java @@ -39,9 +39,9 @@ import android.view.WindowManager; import android.view.WindowManager.LayoutParams; import com.android.internal.annotations.VisibleForTesting; -import com.android.keyguard.R; import com.android.systemui.Dependency; import com.android.systemui.Dumpable; +import com.android.systemui.R; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.plugins.statusbar.StatusBarStateController; diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java index 1d4f9b33b0bc..97507900e269 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java @@ -31,6 +31,7 @@ import androidx.preference.PreferenceScreen; import com.android.systemui.Dependency; import com.android.systemui.R; +import com.android.systemui.SystemUIFactory; import com.android.systemui.fragments.FragmentService; public class TunerActivity extends Activity implements @@ -50,7 +51,7 @@ public class TunerActivity extends Activity implements setActionBar(toolbar); } - Dependency.initDependencies(this); + Dependency.initDependencies(SystemUIFactory.getInstance().getRootComponent()); if (getFragmentManager().findFragmentByTag(TAG_TUNER) == null) { final String action = getIntent().getAction(); diff --git a/packages/SystemUI/tests/Android.mk b/packages/SystemUI/tests/Android.mk index 5412cde0df55..81e2c22d5c4f 100644 --- a/packages/SystemUI/tests/Android.mk +++ b/packages/SystemUI/tests/Android.mk @@ -39,7 +39,7 @@ LOCAL_JAVA_LIBRARIES := \ telephony-common \ android.test.base \ -LOCAL_AAPT_FLAGS := --extra-packages com.android.systemui:com.android.keyguard +LOCAL_AAPT_FLAGS := --extra-packages com.android.systemui # sign this with platform cert, so this test is allowed to inject key events into # UI it doesn't own. This is necessary to allow screenshots to be taken diff --git a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java index 0044ca7c0409..1421b06be621 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java @@ -46,6 +46,7 @@ import android.testing.TestableLooper; import com.android.internal.telephony.IccCardConstants; import com.android.systemui.Dependency; +import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.keyguard.WakefulnessLifecycle; diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockAccessibilityDelegateTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockAccessibilityDelegateTest.java index dcafa7203ce9..00f88bfa2abb 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockAccessibilityDelegateTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockAccessibilityDelegateTest.java @@ -27,6 +27,7 @@ import android.widget.TextView; import androidx.test.filters.SmallTest; +import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import org.junit.Before; diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java index f01c0b421ef7..de7664c769e6 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java @@ -39,6 +39,7 @@ import android.widget.FrameLayout; import android.widget.TextClock; import com.android.keyguard.clock.ClockManager; +import com.android.systemui.R; import com.android.systemui.SystemUIFactory; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.ClockPlugin; diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt index 5f03bdba40b4..42a89509975d 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewTest.kt @@ -21,6 +21,7 @@ import android.testing.AndroidTestingRunner import android.testing.TestableLooper import android.view.LayoutInflater +import com.android.systemui.R import com.android.systemui.SysuiTestCase import com.android.systemui.statusbar.policy.ConfigurationController import com.google.common.truth.Truth.assertThat diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinBasedInputViewTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinBasedInputViewTest.java index eadb1b63df90..202fbd71a0c4 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinBasedInputViewTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinBasedInputViewTest.java @@ -28,6 +28,7 @@ import android.view.LayoutInflater; import androidx.test.filters.SmallTest; +import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import org.junit.Before; diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerTest.java index 8db195a23a15..d47fceea9724 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerTest.java @@ -23,6 +23,7 @@ import android.view.LayoutInflater; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; +import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import org.junit.Test; diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSliceViewTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSliceViewTest.java index b3accbc3b4bb..116f8fc7d3eb 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSliceViewTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSliceViewTest.java @@ -27,6 +27,7 @@ import androidx.slice.SliceProvider; import androidx.slice.SliceSpecs; import androidx.slice.builders.ListBuilder; +import com.android.systemui.R; import com.android.systemui.SystemUIFactory; import com.android.systemui.SysuiTestCase; import com.android.systemui.keyguard.KeyguardSliceProvider; diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.java index 31ea39cedf3b..87f2ef5a9636 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.java @@ -24,6 +24,7 @@ import android.testing.TestableLooper; import android.testing.TestableLooper.RunWithLooper; import android.view.LayoutInflater; +import com.android.systemui.R; import com.android.systemui.SystemUIFactory; import com.android.systemui.SysuiTestCase; import com.android.systemui.util.Assert; diff --git a/packages/SystemUI/tests/src/com/android/systemui/DependencyTest.java b/packages/SystemUI/tests/src/com/android/systemui/DependencyTest.java index b1ca169eac0c..b9d09ce91c1a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/DependencyTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/DependencyTest.java @@ -74,6 +74,6 @@ public class DependencyTest extends SysuiTestCase { @Test public void testInitDependency() { Dependency.clearDependencies(); - Dependency.initDependencies(mContext); + Dependency.initDependencies(SystemUIFactory.getInstance().getRootComponent()); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/IconPackOverlayTest.java b/packages/SystemUI/tests/src/com/android/systemui/IconPackOverlayTest.java index ccc9afcd4296..0fa7443da394 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/IconPackOverlayTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/IconPackOverlayTest.java @@ -32,6 +32,7 @@ import androidx.test.filters.MediumTest; import androidx.test.runner.AndroidJUnit4; import com.android.internal.util.XmlUtils; +import com.android.systemui.tests.R; import org.junit.After; import org.junit.Before; diff --git a/packages/SystemUI/tests/src/com/android/systemui/TestableDependency.java b/packages/SystemUI/tests/src/com/android/systemui/TestableDependency.java index 18bf75e3cfb1..0c53b03de4d2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/TestableDependency.java +++ b/packages/SystemUI/tests/src/com/android/systemui/TestableDependency.java @@ -25,10 +25,6 @@ public class TestableDependency extends Dependency { private final ArraySet<Object> mInstantiatedObjects = new ArraySet<>(); public TestableDependency(Context context) { - if (context instanceof SysuiTestableContext) { - mComponents = ((SysuiTestableContext) context).getComponents(); - } - mContext = context; SystemUIFactory.createFromConfig(context); SystemUIFactory.getInstance().getRootComponent() .createDependency() diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubblesTestActivity.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubblesTestActivity.java index 43d2ad1dfe0a..8bc2e2bc77b6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubblesTestActivity.java +++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubblesTestActivity.java @@ -20,7 +20,7 @@ import android.app.Activity; import android.content.Intent; import android.os.Bundle; -import com.android.systemui.R; +import com.android.systemui.tests.R; /** * Referenced by NotificationTestHelper#makeBubbleMetadata diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotStubActivity.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotStubActivity.java index 784d0352c679..0b871e433f5b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotStubActivity.java +++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotStubActivity.java @@ -15,11 +15,11 @@ */ package com.android.systemui.screenshot; -import com.android.systemui.R; - import android.app.Activity; import android.os.Bundle; +import com.android.systemui.tests.R; + /** * A stub activity used in {@link ScreenshotTest}. */ diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java index 7063ddf3e653..ab207f83a709 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java @@ -40,7 +40,6 @@ import android.widget.RemoteViews; import androidx.test.InstrumentationRegistry; -import com.android.systemui.R; import com.android.systemui.bubbles.BubblesTestActivity; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -50,7 +49,7 @@ import com.android.systemui.statusbar.notification.row.NotificationContentInflat import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.NotificationGroupManager; -import com.android.systemui.statusbar.policy.HeadsUpManager; +import com.android.systemui.tests.R; /** * A helper class to create {@link ExpandableNotificationRow} (for both individual and group diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/MediaNotificationProcessorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/MediaNotificationProcessorTest.java index 7eeae67c9fdf..e6287e7063d3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/MediaNotificationProcessorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/MediaNotificationProcessorTest.java @@ -38,8 +38,8 @@ import android.widget.RemoteViews; import androidx.palette.graphics.Palette; import androidx.test.runner.AndroidJUnit4; -import com.android.systemui.R; import com.android.systemui.SysuiTestCase; +import com.android.systemui.tests.R; import org.junit.After; import org.junit.Before; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java index 2ec125e8a43b..ccadcc35f37a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java @@ -23,7 +23,6 @@ import static com.android.systemui.statusbar.notification.row.NotificationConten import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; @@ -44,12 +43,12 @@ import android.widget.RemoteViews; import androidx.test.filters.SmallTest; -import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.InflationTask; import com.android.systemui.statusbar.NotificationTestHelper; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationCallback; +import com.android.systemui.tests.R; import org.junit.Assert; import org.junit.Before; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapperTest.java index 63e18ce722c3..49a64101eb84 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapperTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapperTest.java @@ -24,10 +24,10 @@ import android.widget.RemoteViews; import androidx.test.filters.SmallTest; -import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.NotificationTestHelper; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; +import com.android.systemui.tests.R; import org.junit.Assert; import org.junit.Before; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java index 907e695f2513..cd60e47eef50 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java @@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.never; @@ -84,6 +85,8 @@ public class KeyguardBouncerTest extends SysuiTestCase { @Mock private UnlockMethodCache mUnlockMethodCache; @Mock + private KeyguardBypassController mKeyguardBypassController; + @Mock private Handler mHandler; private KeyguardBouncer mBouncer; @@ -98,7 +101,8 @@ public class KeyguardBouncerTest extends SysuiTestCase { when(mKeyguardHostView.getHeight()).thenReturn(500); mBouncer = new KeyguardBouncer(getContext(), mViewMediatorCallback, mLockPatternUtils, container, mDismissCallbackRegistry, mFalsingManager, - mExpansionCallback, mUnlockMethodCache, mKeyguardUpdateMonitor, mHandler) { + mExpansionCallback, mUnlockMethodCache, mKeyguardUpdateMonitor, + mKeyguardBypassController, mHandler) { @Override protected void inflateView() { super.inflateView(); @@ -391,6 +395,15 @@ public class KeyguardBouncerTest extends SysuiTestCase { } @Test + public void testShow_delaysIfFaceAuthIsRunning_unlessBypass() { + when(mUnlockMethodCache.isFaceAuthEnabled()).thenReturn(true); + when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true); + mBouncer.show(true /* reset */); + + verify(mHandler, never()).postDelayed(any(), anyLong()); + } + + @Test public void testRegisterUpdateMonitorCallback() { verify(mKeyguardUpdateMonitor).registerCallback(any()); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java index a97832f94924..4b6ca56fc8e3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java @@ -68,7 +68,7 @@ public class StatusBarRemoteInputCallbackTest extends SysuiTestCase { mDependency.injectTestDependency(ShadeController.class, mShadeController); mDependency.injectTestDependency(NotificationLockscreenUserManager.class, mNotificationLockscreenUserManager); - mDependency.putComponent(CommandQueue.class, mock(CommandQueue.class)); + mContext.putComponent(CommandQueue.class, mock(CommandQueue.class)); mRemoteInputCallback = spy(new StatusBarRemoteInputCallback(mContext, mock(NotificationGroupManager.class))); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java index 6e3d9067f63c..34511831247e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java @@ -1,5 +1,12 @@ package com.android.systemui.statusbar.policy; +import static junit.framework.Assert.assertEquals; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import android.content.Intent; import android.net.NetworkCapabilities; import android.net.NetworkInfo; @@ -16,13 +23,6 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; -import static junit.framework.Assert.assertEquals; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @SmallTest @RunWith(AndroidTestingRunner.class) @RunWithLooper diff --git a/tests/testables/src/android/testing/DexmakerShareClassLoaderRule.java b/tests/testables/src/android/testing/DexmakerShareClassLoaderRule.java index 1b8e58c3050d..7057a90c7672 100644 --- a/tests/testables/src/android/testing/DexmakerShareClassLoaderRule.java +++ b/tests/testables/src/android/testing/DexmakerShareClassLoaderRule.java @@ -20,6 +20,8 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; +import libcore.util.SneakyThrow; + import org.junit.rules.TestRule; import org.junit.runner.Description; import org.junit.runners.model.Statement; @@ -55,7 +57,11 @@ public class DexmakerShareClassLoaderRule implements TestRule { * WARNING: This is absolutely incompatible with running tests in parallel! */ public static void runWithDexmakerShareClassLoader(Runnable r) { - apply(r::run).run(); + try { + apply(r::run).run(); + } catch (Throwable t) { + SneakyThrow.sneakyThrow(t); + } } /** |