diff options
author | Hyunyoung Song <hyunyoungs@google.com> | 2019-08-30 14:47:43 -0700 |
---|---|---|
committer | Hyunyoung Song <hyunyoungs@google.com> | 2019-09-01 00:31:47 -0700 |
commit | 8f9d34cb5f38889b233191495434d4c3bd4f7cfc (patch) | |
tree | d383f4fefaa3db9c334931df3226b854d2cb0974 | |
parent | 09809a3d7b00de3fa063653a62d73b6246e00353 (diff) |
[DO NOT MERGE] qt-qpr1-sysui-dev @ build 5814791
Test: presubmit setup on source branch
Bug: 130289146 Create a Gradle build for SystemUI
Bug: 136279712 Daggerize FalsingManager
Bug: 137324767 "Unable to instantiate service com.android.systemui.doze.DozeService" exception breaks launcher tests
Bug: 137563419 Remove Bouncer reveal delay from bypass flow
Bug: 138787339 Allow Services and Activities to be injected into directly.
Bug: 139128921 [AS 3.5 RC2, SDK API 29 rev 2] Overload resolution ambiguity: while removing element from HashMap
Bug: 64712476 Import translations for dev branches
Change-Id: Ib7fd4706c070907fd556c3532957f3b1b046de6d
70 files changed, 172 insertions, 124 deletions
diff --git a/core/res/res/values-en-rCA/strings.xml b/core/res/res/values-en-rCA/strings.xml index 839aaac16c7a..b2f9183e4457 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 7961a865cd53..a6aa60430425 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 3e5d72077f8b..d674be4c8fc0 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"], @@ -133,7 +129,7 @@ android_library { kotlincflags: ["-Xjvm-default=enable"], aaptflags: [ "--extra-packages", - "com.android.keyguard:com.android.systemui", + "com.android.systemui", ], plugins: ["dagger2-compiler-2.19"], } @@ -161,10 +157,6 @@ android_app { kotlincflags: ["-Xjvm-default=enable"], dxflags: ["--multi-dex"], - aaptflags: [ - "--extra-packages", - "com.android.keyguard", - ], required: ["privapp_whitelist_com.android.systemui"], } @@ -181,10 +173,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 7592a8d86eed..f6b03c1fa013 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierText.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierText.java @@ -25,6 +25,7 @@ import android.view.View; import android.widget.TextView; import com.android.systemui.Dependency; +import com.android.systemui.R; import java.util.Locale; diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java index cdabbd7f59a8..3b03d67b4f83 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java @@ -41,6 +41,7 @@ import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.TelephonyIntents; import com.android.settingslib.WirelessUtils; import com.android.systemui.Dependency; +import com.android.systemui.R; import com.android.systemui.keyguard.WakefulnessLifecycle; import java.util.List; 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 97e435dcb382..2c8f23889a17 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java @@ -36,6 +36,7 @@ import com.android.keyguard.KeyguardSecurityContainer.SecurityCallback; import com.android.keyguard.KeyguardSecurityModel.SecurityMode; import com.android.settingslib.Utils; import com.android.systemui.Dependency; +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 811b458f2ff3..a8b1451d92c7 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java @@ -32,6 +32,7 @@ import android.view.View; import android.widget.TextView; import com.android.systemui.Dependency; +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 299e72b72f48..12ea1d586e10 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java @@ -25,6 +25,7 @@ import android.view.animation.AnimationUtils; import com.android.settingslib.animation.AppearAnimationUtils; import com.android.settingslib.animation.DisappearAnimationUtils; import com.android.systemui.Dependency; +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 11a70b6a64d3..297052f842f3 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java @@ -43,6 +43,7 @@ import com.android.settingslib.animation.AppearAnimationCreator; import com.android.settingslib.animation.AppearAnimationUtils; import com.android.settingslib.animation.DisappearAnimationUtils; import com.android.systemui.Dependency; +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 878c9c4c3277..35eb272bdaef 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -47,6 +47,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 b93e28be545b..9c0a71c1f81d 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java @@ -42,6 +42,7 @@ import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.IccCardConstants.State; import com.android.internal.telephony.PhoneConstants; import com.android.systemui.Dependency; +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 44cd2ef9b7a6..fc888e11d3f5 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java @@ -41,6 +41,7 @@ import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.IccCardConstants.State; import com.android.internal.telephony.PhoneConstants; import com.android.systemui.Dependency; +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 0cbe43b613b7..63da5339efe7 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 81a6576c646c..e4a8aab9045d 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -98,6 +98,7 @@ import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.TelephonyIntents; 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; @@ -1388,6 +1389,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { Trace.endSection(); } + + /** Provides access to the static instance. */ + public static KeyguardUpdateMonitor getInstance(Context context) { + if (sInstance == null) { + sInstance = new KeyguardUpdateMonitor(context, Looper.getMainLooper()); + } + return sInstance; + } + protected void handleStartedGoingToSleep(int arg1) { checkIsHandlerThread(); mLockIconPressed = false; diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java index 1edb57eaaaa0..b0457fce6a1a 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 d8f039c6d1ce..bd5b9c724eb3 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; @@ -118,7 +117,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; @@ -142,9 +140,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 the main looper. */ @@ -323,8 +319,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); @@ -510,10 +518,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); @@ -534,9 +546,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)); } @@ -590,20 +604,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() @@ -654,15 +654,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 351ca42172db..1c210b177ae7 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java @@ -63,12 +63,22 @@ public class SystemUIApplication extends Application implements SysUiServiceProv private final Map<Class<?>, Object> mComponents = new HashMap<>(); private SystemUIAppComponentFactory.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 @@ -138,7 +148,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 +169,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 +285,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/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java index 0e5bdaf7cbcc..cd16d85685de 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java @@ -98,10 +98,11 @@ public class SystemUIFactory { public SystemUIFactory() {} private void init(Context context) { - initWithRootComponent(buildSystemUIRootComponent(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(context); + Dependency.initDependencies(mRootComponent); } protected void initWithRootComponent(@NonNull SystemUIRootComponent rootComponent) { @@ -129,7 +130,7 @@ 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, KeyguardBypassController bypassController) { diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java b/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java index ad04f18c6ec2..b77667e339af 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java @@ -16,10 +16,10 @@ package com.android.systemui; -import android.content.ContentProvider; - import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME; +import android.content.ContentProvider; + import com.android.systemui.fragments.FragmentService; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.util.InjectionInflationController; 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 0cee030015a2..38ca70865a58 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 7a9feb7b26a6..9cf738541276 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java @@ -216,6 +216,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 c4feac1d1a26..e42eb0a19f74 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -103,6 +103,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; @@ -211,6 +213,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(); + } } }); } @@ -284,6 +289,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/keyguard/KeyguardSliceProvider.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java index abfcbc19886e..1d2de6027d76 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java @@ -317,7 +317,6 @@ public class KeyguardSliceProvider extends SliceProvider implements public boolean onCreateSliceProvider() { if (mContextAvailableCallback != null) { mContextAvailableCallback.onContextAvailable(getContext()); - Dependency.initDependencies(getContext()); } synchronized (KeyguardSliceProvider.sInstanceLock) { KeyguardSliceProvider oldInstance = KeyguardSliceProvider.sInstance; diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index dc026e78207f..e69688079e57 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -82,6 +82,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; @@ -717,8 +718,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/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 2e7ba045c272..5001006d1aa6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -41,9 +41,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; 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 58519b8e8a58..724b46297e75 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java @@ -40,9 +40,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 21f6b6753a7f..6d433d2c0770 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 22e10206a7d4..b4363cf215f1 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 b2a42819456e..6666a926c68b 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 8da530696b3a..e4b83ccc5125 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/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 99428ec50181..264a5400f1a5 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,6 +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.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/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); + } } /** |