Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b0ff3dd authored by Lucas Silva's avatar Lucas Silva
Browse files

Cleanup dream preview complication.

Fixed: 229089441
Bug: 226986434
Test: locally on device
Change-Id: I5f42fff23826505ca18f7b365371b433e32d2d20
parent ff5064e7
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -2403,8 +2403,6 @@ package android.service.dreams {

  public abstract class DreamOverlayService extends android.app.Service {
    ctor public DreamOverlayService();
    method @Nullable public final CharSequence getDreamLabel();
    method public final boolean isPreviewMode();
    method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent);
    method public abstract void onStartDream(@NonNull android.view.WindowManager.LayoutParams);
    method public final void requestExit();
+0 −20
Original line number Diff line number Diff line
@@ -36,9 +36,6 @@ public abstract class DreamOverlayService extends Service {
    private static final String TAG = "DreamOverlayService";
    private static final boolean DEBUG = false;
    private boolean mShowComplications;
    private boolean mIsPreviewMode;
    @Nullable
    private CharSequence mDreamLabel;

    private IDreamOverlay mDreamOverlay = new IDreamOverlay.Stub() {
        @Override
@@ -59,8 +56,6 @@ public abstract class DreamOverlayService extends Service {
    public final IBinder onBind(@NonNull Intent intent) {
        mShowComplications = intent.getBooleanExtra(DreamService.EXTRA_SHOW_COMPLICATIONS,
                DreamService.DEFAULT_SHOW_COMPLICATIONS);
        mIsPreviewMode = intent.getBooleanExtra(DreamService.EXTRA_IS_PREVIEW, false);
        mDreamLabel = intent.getCharSequenceExtra(DreamService.EXTRA_DREAM_LABEL);
        return mDreamOverlay.asBinder();
    }

@@ -89,19 +84,4 @@ public abstract class DreamOverlayService extends Service {
    public final boolean shouldShowComplications() {
        return mShowComplications;
    }

    /**
     * Returns whether the dream is running in preview mode.
     */
    public final boolean isPreviewMode() {
        return mIsPreviewMode;
    }

    /**
     * Returns the user-facing label of the currently running dream.
     */
    @Nullable
    public final CharSequence getDreamLabel() {
        return mDreamLabel;
    }
}
+2 −17
Original line number Diff line number Diff line
@@ -215,18 +215,6 @@ public class DreamService extends Service implements Window.Callback {
    public static final String EXTRA_SHOW_COMPLICATIONS =
            "android.service.dreams.SHOW_COMPLICATIONS";

    /**
     * Extra containing a boolean for whether we are showing this dream in preview mode.
     * @hide
     */
    public static final String EXTRA_IS_PREVIEW = "android.service.dreams.IS_PREVIEW";

    /**
     * The user-facing label of the current dream service.
     * @hide
     */
    public static final String EXTRA_DREAM_LABEL = "android.service.dreams.DREAM_LABEL";

    /**
     * The default value for whether to show complications on the overlay.
     * @hide
@@ -270,7 +258,7 @@ public class DreamService extends Service implements Window.Callback {
        }

        public void bind(Context context, @Nullable ComponentName overlayService,
                ComponentName dreamService, boolean isPreviewMode) {
                ComponentName dreamService) {
            if (overlayService == null) {
                return;
            }
@@ -281,8 +269,6 @@ public class DreamService extends Service implements Window.Callback {
            overlayIntent.setComponent(overlayService);
            overlayIntent.putExtra(EXTRA_SHOW_COMPLICATIONS,
                    fetchShouldShowComplications(context, serviceInfo));
            overlayIntent.putExtra(EXTRA_DREAM_LABEL, fetchDreamLabel(context, serviceInfo));
            overlayIntent.putExtra(EXTRA_IS_PREVIEW, isPreviewMode);

            context.bindService(overlayIntent,
                    this, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE);
@@ -1007,8 +993,7 @@ public class DreamService extends Service implements Window.Callback {
            mOverlayConnection.bind(
                    /* context= */ this,
                    intent.getParcelableExtra(EXTRA_DREAM_OVERLAY_COMPONENT),
                    new ComponentName(this, getClass()),
                    intent.getBooleanExtra(EXTRA_IS_PREVIEW, /* defaultValue= */ false));
                    new ComponentName(this, getClass()));
        }

        return mDreamServiceWrapper;
+0 −28
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ 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.
  -->
<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/dream_preview_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="@dimen/dream_overlay_complication_preview_text_size"
    android:textColor="@android:color/white"
    android:shadowColor="@color/keyguard_shadow_color"
    android:shadowRadius="?attr/shadowRadius"
    android:gravity="center_vertical"
    android:drawableStart="@drawable/dream_preview_back_arrow"
    android:drawablePadding="@dimen/dream_overlay_complication_preview_icon_padding"/>
+0 −12
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dreams.complication.Complication;
import com.android.systemui.dreams.complication.DreamPreviewComplication;
import com.android.systemui.dreams.dagger.DreamOverlayComponent;
import com.android.systemui.dreams.touch.DreamOverlayTouchMonitor;

@@ -63,7 +62,6 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
    // content area).
    private final DreamOverlayContainerViewController mDreamOverlayContainerViewController;
    private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
    private final DreamPreviewComplication mPreviewComplication;
    private final UiEventLogger mUiEventLogger;

    // A reference to the {@link Window} used to hold the dream overlay.
@@ -127,14 +125,12 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
            DreamOverlayComponent.Factory dreamOverlayComponentFactory,
            DreamOverlayStateController stateController,
            KeyguardUpdateMonitor keyguardUpdateMonitor,
            DreamPreviewComplication previewComplication,
            UiEventLogger uiEventLogger) {
        mContext = context;
        mExecutor = executor;
        mKeyguardUpdateMonitor = keyguardUpdateMonitor;
        mKeyguardUpdateMonitor.registerCallback(mKeyguardCallback);
        mStateController = stateController;
        mPreviewComplication = previewComplication;
        mUiEventLogger = uiEventLogger;

        final DreamOverlayComponent component =
@@ -159,9 +155,6 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
            windowManager.removeView(mWindow.getDecorView());
        }
        mStateController.setOverlayActive(false);
        mPreviewComplication.setDreamLabel(null);
        mStateController.removeComplication(mPreviewComplication);
        mStateController.setPreviewMode(false);
        mDestroyed = true;
        super.onDestroy();
    }
@@ -177,11 +170,6 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
                return;
            }
            mStateController.setShouldShowComplications(shouldShowComplications());
            mStateController.setPreviewMode(isPreviewMode());
            if (isPreviewMode()) {
                mPreviewComplication.setDreamLabel(getDreamLabel());
                mStateController.addComplication(mPreviewComplication);
            }
            addOverlayWindowLocked(layoutParams);
            setCurrentState(Lifecycle.State.RESUMED);
            mStateController.setOverlayActive(true);
Loading