Merge 47df70781d0c9fc781f31cefdc7411536ba0591e on remote branch

Change-Id: Ia25919b3a901f406cb33dd14fd833fb402dbf832
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index a7b17fd..34642dd 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -20,4 +20,8 @@
           package="com.android.systemui"
           android:sharedUserId="android.uid.systemui"
           coreApp="true">
+    <application
+        tools:replace="android:appComponentFactory"
+        android:appComponentFactory="com.android.systemui.go.SystemUIGoAppComponentFactory">
+    </application>
 </manifest>
diff --git a/proguard.flags b/proguard.flags
index 9b0d998..1f701aa 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -1,4 +1,4 @@
--keep class com.android.systemui.go.SystemUIGoFactory
+-keep class com.android.systemui.go.SystemUIGoInitializer
 -keep,allowoptimization,allowaccessmodification class com.android.systemui.go.DaggerSystemUIGoGlobalRootComponent$SystemUIGoComponentImpl { !synthetic *; }
 
 -include ../../../frameworks/base/packages/SystemUI/proguard.flags
\ No newline at end of file
diff --git a/res/values/config.xml b/res/values/config.xml
index a9d3ffe..4e5e4e2 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -26,8 +26,12 @@
     <!-- The minimum number of tiles to display in QuickSettings -->
     <integer name="quick_settings_min_num_tiles">3</integer>
 
-    <string name="config_systemUIFactoryComponent" translatable="false">
-        com.android.systemui.go.SystemUIGoFactory
-    </string>
+    <!-- Whether to enable dimming navigation buttons when wallpaper is not visible, should be
+         enabled for OLED devices to reduce/prevent burn in on the navigation bar (because of the
+         black background and static button placements) and disabled for all other devices to
+         prevent wasting cpu cycles on the dimming animation -->
+    <bool name="config_navigation_bar_enable_auto_dim_no_visible_wallpaper">false</bool>
 
+    <!-- Determines whether the shell features all run on another thread. -->
+    <bool name="config_enableShellMainThread">true</bool>
 </resources>
diff --git a/src/com/android/systemui/go/SystemUIGoAppComponentFactory.java b/src/com/android/systemui/go/SystemUIGoAppComponentFactory.java
new file mode 100644
index 0000000..3c9d674
--- /dev/null
+++ b/src/com/android/systemui/go/SystemUIGoAppComponentFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2022 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.go;
+
+import android.content.Context;
+
+import com.android.systemui.SystemUIAppComponentFactoryBase;
+import com.android.systemui.SystemUIInitializer;
+
+/**
+ * Starts up SystemUI using {@link SystemUIGoInitializer}.
+ *
+ * The {@link SystemUIAppComponentFactoryBase} is required for proper SystemUI functionality.
+ *
+ * @see SystemUIAppComponentFactoryBase
+ */
+public class SystemUIGoAppComponentFactory extends SystemUIAppComponentFactoryBase {
+    @Override
+    protected SystemUIInitializer createSystemUIInitializer(Context context) {
+        return new SystemUIGoInitializer(context);
+    }
+}
diff --git a/src/com/android/systemui/go/SystemUIGoFactory.java b/src/com/android/systemui/go/SystemUIGoInitializer.java
similarity index 66%
rename from src/com/android/systemui/go/SystemUIGoFactory.java
rename to src/com/android/systemui/go/SystemUIGoInitializer.java
index 30a5b89..60cda5b 100644
--- a/src/com/android/systemui/go/SystemUIGoFactory.java
+++ b/src/com/android/systemui/go/SystemUIGoInitializer.java
@@ -18,19 +18,21 @@
 
 import android.content.Context;
 
-import com.android.systemui.SystemUIFactory;
+import com.android.systemui.SystemUIInitializer;
 import com.android.systemui.dagger.GlobalRootComponent;
 import com.android.systemui.go.DaggerSystemUIGoGlobalRootComponent;
 
 /**
- * Go variant {@link SystemUIFactory}, that substitutes default {@link GlobalRootComponent} for
+ * Go variant {@link SystemUIInitializer}, that substitutes default {@link GlobalRootComponent} for
  * {@link SystemUIGoGlobalRootComponent}
  */
-final public class SystemUIGoFactory extends SystemUIFactory {
+final public class SystemUIGoInitializer extends SystemUIInitializer {
+    public SystemUIGoInitializer(Context context) {
+        super(context);
+    }
+
     @Override
-    protected GlobalRootComponent buildGlobalRootComponent(Context context) {
-        return DaggerSystemUIGoGlobalRootComponent.builder()
-                .context(context)
-                .build();
+    protected GlobalRootComponent.Builder getGlobalRootComponentBuilder() {
+        return DaggerSystemUIGoGlobalRootComponent.builder();
     }
 }
diff --git a/src/com/android/systemui/go/SystemUIGoModule.java b/src/com/android/systemui/go/SystemUIGoModule.java
index 389a3de..03d52ea 100644
--- a/src/com/android/systemui/go/SystemUIGoModule.java
+++ b/src/com/android/systemui/go/SystemUIGoModule.java
@@ -24,6 +24,7 @@
 import android.os.Handler;
 import android.os.PowerManager;
 
+import com.android.internal.logging.UiEventLogger;
 import com.android.keyguard.KeyguardViewController;
 import com.android.systemui.broadcast.BroadcastDispatcher;
 import com.android.systemui.dagger.GlobalRootComponent;
@@ -35,7 +36,9 @@
 import com.android.systemui.dock.DockManager;
 import com.android.systemui.dock.DockManagerImpl;
 import com.android.systemui.doze.DozeHost;
+import com.android.systemui.dump.DumpManager;
 import com.android.systemui.media.dagger.MediaModule;
+import com.android.systemui.navigationbar.gestural.GestureModule;
 import com.android.systemui.plugins.qs.QSFactory;
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
 import com.android.systemui.power.EnhancedEstimates;
@@ -44,22 +47,22 @@
 import com.android.systemui.qs.tileimpl.QSFactoryImpl;
 import com.android.systemui.recents.Recents;
 import com.android.systemui.recents.RecentsImplementation;
+import com.android.systemui.screenshot.ReferenceScreenshotModule;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.NotificationLockscreenUserManager;
 import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl;
 import com.android.systemui.statusbar.NotificationShadeWindowController;
 import com.android.systemui.statusbar.dagger.StartCentralSurfacesModule;
-import com.android.systemui.statusbar.notification.NotificationEntryManager;
 import com.android.systemui.statusbar.notification.collection.provider.VisualStabilityProvider;
 import com.android.systemui.statusbar.notification.collection.render.GroupMembershipManager;
 import com.android.systemui.statusbar.phone.DozeServiceHost;
 import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
 import com.android.systemui.statusbar.phone.KeyguardBypassController;
-import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl;
-import com.android.systemui.statusbar.phone.NotificationShadeWindowControllerImpl;
-import com.android.systemui.statusbar.phone.ShadeController;
-import com.android.systemui.statusbar.phone.ShadeControllerImpl;
+import com.android.systemui.shade.NotificationShadeWindowControllerImpl;
+import com.android.systemui.shade.ShadeController;
+import com.android.systemui.shade.ShadeControllerImpl;
 import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
+import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper;
 import com.android.systemui.statusbar.policy.BatteryController;
 import com.android.systemui.statusbar.policy.BatteryControllerImpl;
 import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -84,9 +87,11 @@
  * Android Go. This is forked from {@link ReferenceSystemUIModule}
  */
 @Module(includes = {
+        GestureModule.class,
         MediaModule.class,
         PowerModule.class,
         QSModule.class,
+        ReferenceScreenshotModule.class,
         StartCentralSurfacesModule.class,
         VolumeModule.class
 })
@@ -115,6 +120,7 @@
             PowerManager powerManager,
             BroadcastDispatcher broadcastDispatcher,
             DemoModeController demoModeController,
+            DumpManager dumpManager,
             @Main Handler mainHandler,
             @Background Handler bgHandler) {
         BatteryController bC = new BatteryControllerImpl(
@@ -123,6 +129,7 @@
                 powerManager,
                 broadcastDispatcher,
                 demoModeController,
+                dumpManager,
                 mainHandler,
                 bgHandler);
         bC.init();
@@ -156,10 +163,6 @@
     abstract DockManager bindDockManager(DockManagerImpl dockManager);
 
     @Binds
-    abstract NotificationEntryManager.KeyguardEnvironment bindKeyguardEnvironment(
-            KeyguardEnvironmentImpl keyguardEnvironment);
-
-    @Binds
     abstract ShadeController provideShadeController(ShadeControllerImpl shadeController);
 
     @SysUISingleton
@@ -178,7 +181,10 @@
             KeyguardBypassController bypassController,
             GroupMembershipManager groupManager,
             VisualStabilityProvider visualStabilityProvider,
-            ConfigurationController configurationController) {
+            ConfigurationController configurationController,
+            @Main Handler handler,
+            AccessibilityManagerWrapper accessibilityManagerWrapper,
+            UiEventLogger uiEventLogger) {
         return new HeadsUpManagerPhone(
                 context,
                 headsUpManagerLogger,
@@ -186,7 +192,10 @@
                 bypassController,
                 groupManager,
                 visualStabilityProvider,
-                configurationController
+                configurationController,
+                handler,
+                accessibilityManagerWrapper,
+                uiEventLogger
         );
     }