Merge "Set dream overlay window title to System UI." into tm-qpr-dev

This commit is contained in:
Bryce Lee
2023-02-27 19:03:04 +00:00
committed by Android (Google) Code Review
3 changed files with 20 additions and 3 deletions

View File

@@ -16,6 +16,8 @@
package com.android.systemui.dreams;
import static com.android.systemui.dreams.dagger.DreamModule.DREAM_OVERLAY_WINDOW_TITLE;
import android.content.ComponentName;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
@@ -70,6 +72,7 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
private final ComponentName mLowLightDreamComponent;
private final UiEventLogger mUiEventLogger;
private final WindowManager mWindowManager;
private final String mWindowTitle;
// A reference to the {@link Window} used to hold the dream overlay.
private Window mWindow;
@@ -134,7 +137,8 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
UiEventLogger uiEventLogger,
@Nullable @Named(LowLightDreamModule.LOW_LIGHT_DREAM_COMPONENT)
ComponentName lowLightDreamComponent,
DreamOverlayCallbackController dreamOverlayCallbackController) {
DreamOverlayCallbackController dreamOverlayCallbackController,
@Named(DREAM_OVERLAY_WINDOW_TITLE) String windowTitle) {
mContext = context;
mExecutor = executor;
mWindowManager = windowManager;
@@ -144,6 +148,7 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
mStateController = stateController;
mUiEventLogger = uiEventLogger;
mDreamOverlayCallbackController = dreamOverlayCallbackController;
mWindowTitle = windowTitle;
final ViewModelStore viewModelStore = new ViewModelStore();
final Complication.Host host =
@@ -251,7 +256,7 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
private boolean addOverlayWindowLocked(WindowManager.LayoutParams layoutParams) {
mWindow = new PhoneWindow(mContext);
// Default to SystemUI name for TalkBack.
mWindow.setTitle("");
mWindow.setTitle(mWindowTitle);
mWindow.setAttributes(layoutParams);
mWindow.setWindowManager(null, layoutParams.token, "DreamOverlay", true);

View File

@@ -23,6 +23,7 @@ import android.content.res.Resources;
import com.android.dream.lowlight.dagger.LowLightDreamModule;
import com.android.settingslib.dream.DreamBackend;
import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dreams.DreamOverlayNotificationCountProvider;
@@ -63,6 +64,8 @@ public interface DreamModule {
String DREAM_SUPPORTED = "dream_supported";
String DREAM_PRETEXT_CONDITIONS = "dream_pretext_conditions";
String DREAM_PRETEXT_MONITOR = "dream_prtext_monitor";
String DREAM_OVERLAY_WINDOW_TITLE = "dream_overlay_window_title";
/**
* Provides the dream component
@@ -136,4 +139,11 @@ public interface DreamModule {
@Named(DREAM_PRETEXT_CONDITIONS) Set<Condition> pretextConditions) {
return new Monitor(executor, pretextConditions);
}
/** */
@Provides
@Named(DREAM_OVERLAY_WINDOW_TITLE)
static String providesDreamOverlayWindowTitle(@Main Resources resources) {
return resources.getString(R.string.app_label);
}
}

View File

@@ -70,6 +70,7 @@ public class DreamOverlayServiceTest extends SysuiTestCase {
private static final ComponentName LOW_LIGHT_COMPONENT = new ComponentName("package",
"lowlight");
private static final String DREAM_COMPONENT = "package/dream";
private static final String WINDOW_NAME = "test";
private final FakeSystemClock mFakeSystemClock = new FakeSystemClock();
private final FakeExecutor mMainExecutor = new FakeExecutor(mFakeSystemClock);
@@ -149,7 +150,8 @@ public class DreamOverlayServiceTest extends SysuiTestCase {
mKeyguardUpdateMonitor,
mUiEventLogger,
LOW_LIGHT_COMPONENT,
mDreamOverlayCallbackController);
mDreamOverlayCallbackController,
WINDOW_NAME);
}
public IDreamOverlayClient getClient() throws RemoteException {