diff options
10 files changed, 29 insertions, 24 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt b/packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt index f12b91956c80..d89332d6d686 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt @@ -49,6 +49,7 @@ import com.android.systemui.mediaprojection.taskswitcher.MediaProjectionTaskSwit import com.android.systemui.power.PowerUI import com.android.systemui.reardisplay.RearDisplayDialogController import com.android.systemui.recents.Recents +import com.android.systemui.recents.ScreenPinningRequest import com.android.systemui.settings.dagger.MultiUserUtilsModule import com.android.systemui.shortcut.ShortcutKeyDispatcher import com.android.systemui.statusbar.ImmersiveModeConfirmation @@ -366,4 +367,9 @@ abstract class SystemUICoreStartableModule { @IntoMap @ClassKey(KeyguardDismissBinder::class) abstract fun bindKeyguardDismissBinder(impl: KeyguardDismissBinder): CoreStartable + + @Binds + @IntoMap + @ClassKey(ScreenPinningRequest::class) + abstract fun bindScreenPinningRequest(impl: ScreenPinningRequest): CoreStartable } diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index d23bedace06f..cef52e73d711 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -151,6 +151,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis private SysUiState mSysUiState; private final Handler mHandler; private final Lazy<NavigationBarController> mNavBarControllerLazy; + private final ScreenPinningRequest mScreenPinningRequest; private final NotificationShadeWindowController mStatusBarWinController; private final Provider<SceneInteractor> mSceneInteractor; @@ -185,9 +186,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis @Override public void startScreenPinning(int taskId) { verifyCallerAndClearCallingIdentityPostMain("startScreenPinning", () -> - mCentralSurfacesOptionalLazy.get().ifPresent( - statusBar -> statusBar.showScreenPinningRequest(taskId, - false /* allowCancel */))); + mScreenPinningRequest.showPrompt(taskId, false /* allowCancel */)); } @Override @@ -572,6 +571,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis Lazy<NavigationBarController> navBarControllerLazy, Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy, Lazy<ShadeViewController> shadeViewControllerLazy, + ScreenPinningRequest screenPinningRequest, NavigationModeController navModeController, NotificationShadeWindowController statusBarWinController, SysUiState sysUiState, @@ -601,6 +601,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis mShadeViewControllerLazy = shadeViewControllerLazy; mHandler = new Handler(); mNavBarControllerLazy = navBarControllerLazy; + mScreenPinningRequest = screenPinningRequest; mStatusBarWinController = statusBarWinController; mSceneInteractor = sceneInteractor; mUserTracker = userTracker; diff --git a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java index 346acf958e51..77fcd6813583 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java +++ b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java @@ -53,8 +53,10 @@ import android.widget.TextView; import androidx.annotation.NonNull; +import com.android.systemui.CoreStartable; import com.android.systemui.R; import com.android.systemui.broadcast.BroadcastDispatcher; +import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.navigationbar.NavigationBarView; import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.settings.UserTracker; @@ -69,8 +71,9 @@ import javax.inject.Inject; import dagger.Lazy; +@SysUISingleton public class ScreenPinningRequest implements View.OnClickListener, - NavigationModeController.ModeChangedListener { + NavigationModeController.ModeChangedListener, CoreStartable { private static final String TAG = "ScreenPinningRequest"; private final Context mContext; @@ -113,6 +116,9 @@ public class ScreenPinningRequest implements View.OnClickListener, mUserTracker = userTracker; } + @Override + public void start() {} + public void clearPrompt() { if (mRequestWindow != null) { mWindowManager.removeView(mRequestWindow); @@ -144,7 +150,8 @@ public class ScreenPinningRequest implements View.OnClickListener, mNavBarMode = mode; } - public void onConfigurationChanged() { + @Override + public void onConfigurationChanged(Configuration newConfig) { if (mRequestWindow != null) { mRequestWindow.onConfigurationChanged(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java index cfa481eaf7ef..7b7270b5ae40 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java @@ -269,8 +269,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner { boolean isScreenFullyOff(); - void showScreenPinningRequest(int taskId, boolean allowCancel); - @Nullable Intent getEmergencyActionIntent(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java index 28bb58108916..ebcfb8adb08d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java @@ -59,6 +59,7 @@ import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.qs.QSHost; import com.android.systemui.qs.QSPanelController; +import com.android.systemui.recents.ScreenPinningRequest; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.CameraLauncher; import com.android.systemui.shade.QuickSettingsController; @@ -84,6 +85,7 @@ import javax.inject.Inject; public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callbacks { private final CentralSurfaces mCentralSurfaces; private final Context mContext; + private final ScreenPinningRequest mScreenPinningRequest; private final com.android.systemui.shade.ShadeController mShadeController; private final CommandQueue mCommandQueue; private final ShadeViewController mShadeViewController; @@ -126,6 +128,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba QuickSettingsController quickSettingsController, Context context, @Main Resources resources, + ScreenPinningRequest screenPinningRequest, ShadeController shadeController, CommandQueue commandQueue, ShadeViewController shadeViewController, @@ -155,6 +158,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba mCentralSurfaces = centralSurfaces; mQsController = quickSettingsController; mContext = context; + mScreenPinningRequest = screenPinningRequest; mShadeController = shadeController; mCommandQueue = commandQueue; mShadeViewController = shadeViewController; @@ -516,7 +520,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba return; } // Show screen pinning request, since this comes from an app, show 'no thanks', button. - mCentralSurfaces.showScreenPinningRequest(taskId, true); + mScreenPinningRequest.showPrompt(taskId, true); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt index ff380db99c16..53e6bf164ca6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt @@ -71,7 +71,6 @@ abstract class CentralSurfacesEmptyImpl : CentralSurfaces { override fun isOverviewEnabled() = false override fun setBouncerShowing(bouncerShowing: Boolean) {} override fun isScreenFullyOff() = false - override fun showScreenPinningRequest(taskId: Int, allowCancel: Boolean) {} override fun getEmergencyActionIntent(): Intent? = null override fun isCameraAllowedByAdmin() = false override fun isGoingToSleep() = false diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 490c469261d9..5b11b410c126 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -168,7 +168,6 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.power.domain.interactor.PowerInteractor; import com.android.systemui.qs.QSFragment; import com.android.systemui.qs.QSPanelController; -import com.android.systemui.recents.ScreenPinningRequest; import com.android.systemui.scene.domain.interactor.WindowRootViewVisibilityInteractor; import com.android.systemui.scrim.ScrimView; import com.android.systemui.settings.UserTracker; @@ -507,8 +506,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { ? new GestureRecorder("/sdcard/statusbar_gestures.dat") : null; - private final ScreenPinningRequest mScreenPinningRequest; - private final MetricsLogger mMetricsLogger; // ensure quick settings is disabled until the current user makes it through the setup wizard @@ -692,7 +689,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { DozeServiceHost dozeServiceHost, BackActionInteractor backActionInteractor, PowerManager powerManager, - ScreenPinningRequest screenPinningRequest, DozeScrimController dozeScrimController, VolumeComponent volumeComponent, CommandQueue commandQueue, @@ -799,7 +795,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mDozeParameters = dozeParameters; mScrimController = scrimController; mLockscreenWallpaperLazy = lockscreenWallpaperLazy; - mScreenPinningRequest = screenPinningRequest; mDozeScrimController = dozeScrimController; mBiometricUnlockControllerLazy = biometricUnlockControllerLazy; mAuthRippleController = authRippleController; @@ -2815,11 +2810,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { return mScreenLifecycle.getScreenState() == ScreenLifecycle.SCREEN_OFF; } - @Override - public void showScreenPinningRequest(int taskId, boolean allowCancel) { - mScreenPinningRequest.showPrompt(taskId, allowCancel); - } - @Nullable @Override public Intent getEmergencyActionIntent() { @@ -3251,8 +3241,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { if (DEBUG) { Log.v(TAG, "configuration changed: " + mContext.getResources().getConfiguration()); } - - mScreenPinningRequest.onConfigurationChanged(); } @Override diff --git a/packages/SystemUI/tests/src/com/android/systemui/recents/OverviewProxyServiceTest.kt b/packages/SystemUI/tests/src/com/android/systemui/recents/OverviewProxyServiceTest.kt index e353a53af752..18fa0bec000c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/recents/OverviewProxyServiceTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/recents/OverviewProxyServiceTest.kt @@ -96,6 +96,7 @@ class OverviewProxyServiceTest : SysuiTestCase() { @Mock private lateinit var navBarController: NavigationBarController @Mock private lateinit var centralSurfaces: CentralSurfaces @Mock private lateinit var shadeViewController: ShadeViewController + @Mock private lateinit var screenPinningRequest: ScreenPinningRequest @Mock private lateinit var navModeController: NavigationModeController @Mock private lateinit var statusBarWinController: NotificationShadeWindowController @Mock private lateinit var userTracker: UserTracker @@ -136,6 +137,7 @@ class OverviewProxyServiceTest : SysuiTestCase() { { navBarController }, { Optional.of(centralSurfaces) }, { shadeViewController }, + screenPinningRequest, navModeController, statusBarWinController, sysUiState, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java index 3ad3c15f158a..c71c0c579e3a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java @@ -50,6 +50,7 @@ import com.android.systemui.flags.FakeFeatureFlags; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.qs.QSHost; +import com.android.systemui.recents.ScreenPinningRequest; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.CameraLauncher; import com.android.systemui.shade.QuickSettingsController; @@ -79,6 +80,7 @@ import java.util.Optional; public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase { @Mock private CentralSurfaces mCentralSurfaces; + @Mock private ScreenPinningRequest mScreenPinningRequest; @Mock private ShadeController mShadeController; @Mock private CommandQueue mCommandQueue; @Mock private QuickSettingsController mQuickSettingsController; @@ -116,6 +118,7 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase { mQuickSettingsController, mContext, mContext.getResources(), + mScreenPinningRequest, mShadeController, mCommandQueue, mShadeViewController, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java index bd3fb9f1cae3..6b944aed9368 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java @@ -116,7 +116,6 @@ import com.android.systemui.plugins.PluginDependencyProvider; import com.android.systemui.plugins.PluginManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.power.domain.interactor.PowerInteractor; -import com.android.systemui.recents.ScreenPinningRequest; import com.android.systemui.scene.domain.interactor.WindowRootViewVisibilityInteractor; import com.android.systemui.settings.UserTracker; import com.android.systemui.settings.brightness.BrightnessSliderController; @@ -285,7 +284,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase { @Mock private PluginManager mPluginManager; @Mock private ViewMediatorCallback mViewMediatorCallback; @Mock private StatusBarTouchableRegionManager mStatusBarTouchableRegionManager; - @Mock private ScreenPinningRequest mScreenPinningRequest; @Mock private PluginDependencyProvider mPluginDependencyProvider; @Mock private ExtensionController mExtensionController; @Mock private UserInfoControllerImpl mUserInfoControllerImpl; @@ -508,7 +506,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase { mDozeServiceHost, mBackActionInteractor, mPowerManager, - mScreenPinningRequest, mDozeScrimController, mVolumeComponent, mCommandQueue, |