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

Commit 7db46f58 authored by Bharat Singh's avatar Bharat Singh
Browse files

[SysUI][Floaty] Add basic composable to draw squeeze effect later

* Adds a basic composable to draw squeeze effect in later CLs
* Adds logic for attaching this composable to a new root window

Bug: 399263897
Flag: com.android.systemui.shared.enable_lpp_squeeze_effect
Change-Id: I6d3c953d6493b64f247eb5b6e6a754d0a472baf9
parent 46655948
Loading
Loading
Loading
Loading
+37 −2
Original line number Diff line number Diff line
@@ -16,13 +16,48 @@

package com.android.systemui.effects;

import android.content.Context
import android.graphics.PixelFormat
import android.view.Gravity
import android.view.WindowInsets
import android.view.WindowManager
import com.android.systemui.CoreStartable
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import javax.inject.Inject

@SysUISingleton
class TopLevelWindowEffects @Inject constructor() : CoreStartable {
class TopLevelWindowEffects @Inject constructor(
    @Application private val context: Context
) : CoreStartable {
    override fun start() {

    }

    private fun getWindowManagerLayoutParams(): WindowManager.LayoutParams {
        val lp = WindowManager.LayoutParams(
            WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY,
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                    or WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                    or WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
                    or WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
            PixelFormat.TRANSPARENT
        )

        lp.privateFlags = lp.privateFlags or
                (WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS
                        or WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION
                        or WindowManager.LayoutParams.PRIVATE_FLAG_EDGE_TO_EDGE_ENFORCED
                        or WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED
                        or WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY)

        lp.layoutInDisplayCutoutMode =
            WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS

        lp.title = "TopLevelWindowEffects"
        lp.fitInsetsTypes = WindowInsets.Type.systemOverlays()
        lp.gravity = Gravity.TOP

        return lp
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -45,6 +45,6 @@ class EffectsWindowRoot : AbstractComposeView {

    @Composable
    override fun Content() {

        SqueezeEffect()
    }
}
 No newline at end of file
+24 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.effects.ui.compose

import androidx.compose.runtime.Composable

@Composable
fun SqueezeEffect() {
    // TODO: add squeeze effect
}
 No newline at end of file