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

Commit 833c60d1 authored by Lyn's avatar Lyn Committed by Lyn Han
Browse files

Remove app attribution UI for FSI

Bug: 243421660
Fixes: 257506350
Test: compiles
Change-Id: Icb1aa3a417c93d196a5fd401919191cefbb76fa4
parent ae168942
Loading
Loading
Loading
Loading
+0 −49
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.notification.fsi.FsiChromeView android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="50dp"
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:id="@+id/fsi_chrome"
        android:layout_height="50dp"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/fsi_app_icon"
            android:layout_width="50dp"
            android:layout_height="match_parent"
            android:contentDescription="@null" />

        <TextView
            android:id="@+id/fsi_app_name"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:padding="10dp"
            android:textSize="22dp"
            android:gravity="center"
            android:textColor="#FFFFFF"
            android:text="AppName" />

        <Space
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="1" />

        <Button
            android:id="@+id/fsi_fullscreen_button"
            android:layout_width="100dp"
            android:layout_height="match_parent"
            android:text="fullscreen" />

        <Button
            android:id="@+id/fsi_dismiss_button"
            android:layout_width="100dp"
            android:layout_height="match_parent"
            android:text="dismiss" />

    </LinearLayout>

</com.android.systemui.statusbar.notification.fsi.FsiChromeView>
 No newline at end of file
+0 −3
Original line number Diff line number Diff line
@@ -257,9 +257,6 @@
    <!-- Radius for notifications corners with adjacent notifications -->
    <dimen name="notification_corner_radius_small">4dp</dimen>

    <!-- Vertical padding of the FSI container -->
    <dimen name="fsi_chrome_vertical_padding">80dp</dimen>

    <!-- the padding of the shelf icon container -->
    <dimen name="shelf_icon_container_padding">13dp</dimen>

+0 −21
Original line number Diff line number Diff line
@@ -47,10 +47,7 @@ import com.android.systemui.reardisplay.RearDisplayDialogController
import com.android.systemui.recents.Recents
import com.android.systemui.settings.dagger.MultiUserUtilsModule
import com.android.systemui.shortcut.ShortcutKeyDispatcher
import com.android.systemui.statusbar.notification.fsi.FsiChromeRepo
import com.android.systemui.statusbar.notification.InstantAppNotifier
import com.android.systemui.statusbar.notification.fsi.FsiChromeViewModelFactory
import com.android.systemui.statusbar.notification.fsi.FsiChromeViewBinder
import com.android.systemui.statusbar.phone.KeyguardLiftController
import com.android.systemui.stylus.StylusUsiPowerStartable
import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator
@@ -91,24 +88,6 @@ abstract class SystemUICoreStartableModule {
    @ClassKey(ClipboardListener::class)
    abstract fun bindClipboardListener(sysui: ClipboardListener): CoreStartable

    /** Inject into FsiChromeRepo.  */
    @Binds
    @IntoMap
    @ClassKey(FsiChromeRepo::class)
    abstract fun bindFSIChromeRepo(sysui: FsiChromeRepo): CoreStartable

    /** Inject into FsiChromeWindowViewModel.  */
    @Binds
    @IntoMap
    @ClassKey(FsiChromeViewModelFactory::class)
    abstract fun bindFSIChromeWindowViewModel(sysui: FsiChromeViewModelFactory): CoreStartable

    /** Inject into FsiChromeWindowBinder.  */
    @Binds
    @IntoMap
    @ClassKey(FsiChromeViewBinder::class)
    abstract fun bindFsiChromeWindowBinder(sysui: FsiChromeViewBinder): CoreStartable

    /** Inject into GlobalActionsComponent.  */
    @Binds
    @IntoMap
+0 −3
Original line number Diff line number Diff line
@@ -87,9 +87,6 @@ object Flags {
    val NOTIFICATION_GROUP_DISMISSAL_ANIMATION =
        releasedFlag(259217907, "notification_group_dismissal_animation")

    // TODO(b/257506350): Tracking Bug
    @JvmField val FSI_CHROME = unreleasedFlag(117, "fsi_chrome")

    @JvmField
    val SIMPLIFIED_APPEAR_FRACTION =
        unreleasedFlag(259395680, "simplified_appear_fraction", teamfood = true)
+0 −102
Original line number Diff line number Diff line
package com.android.systemui.statusbar.notification.fsi

import android.app.PendingIntent
import android.content.Context
import android.content.pm.PackageManager
import android.graphics.drawable.Drawable
import android.os.RemoteException
import android.service.dreams.IDreamManager
import com.android.systemui.CoreStartable
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.keyguard.data.repository.KeyguardRepository
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.collection.provider.LaunchFullScreenIntentProvider
import com.android.systemui.statusbar.notification.fsi.FsiDebug.Companion.log
import com.android.systemui.statusbar.phone.CentralSurfaces
import java.util.concurrent.Executor
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

/**
 * Class that bridges the gap between clean app architecture and existing code. Provides new
 * implementation of StatusBarNotificationActivityStarter launchFullscreenIntent that pipes
 * one-directional data => FsiChromeViewModel => FsiChromeView.
 */
@SysUISingleton
class FsiChromeRepo
@Inject
constructor(
    private val context: Context,
    private val pm: PackageManager,
    private val keyguardRepo: KeyguardRepository,
    private val launchFullScreenIntentProvider: LaunchFullScreenIntentProvider,
    private val featureFlags: FeatureFlags,
    private val uiBgExecutor: Executor,
    private val dreamManager: IDreamManager,
    private val centralSurfaces: CentralSurfaces
) : CoreStartable {

    companion object {
        private const val classTag = "FsiChromeRepo"
    }

    data class FSIInfo(
        val appName: String,
        val appIcon: Drawable,
        val fullscreenIntent: PendingIntent
    )

    private val _infoFlow = MutableStateFlow<FSIInfo?>(null)
    val infoFlow: StateFlow<FSIInfo?> = _infoFlow

    override fun start() {
        log("$classTag start listening for FSI notifications")

        // Listen for FSI launch events for the lifetime of SystemUI.
        launchFullScreenIntentProvider.registerListener { entry -> launchFullscreenIntent(entry) }
    }

    fun dismiss() {
        _infoFlow.value = null
    }

    fun onFullscreen() {
        // TODO(b/243421660) implement transition from container to fullscreen
    }

    fun stopScreenSaver() {
        uiBgExecutor.execute {
            try {
                dreamManager.awaken()
            } catch (e: RemoteException) {
                e.printStackTrace()
            }
        }
    }

    fun launchFullscreenIntent(entry: NotificationEntry) {
        if (!featureFlags.isEnabled(Flags.FSI_CHROME)) {
            return
        }
        if (!keyguardRepo.isKeyguardShowing()) {
            return
        }
        stopScreenSaver()

        var appName = pm.getApplicationLabel(context.applicationInfo) as String
        val appIcon = pm.getApplicationIcon(context.packageName)
        val fullscreenIntent = entry.sbn.notification.fullScreenIntent

        log("FsiChromeRepo launchFullscreenIntent appName=$appName appIcon $appIcon")
        _infoFlow.value = FSIInfo(appName, appIcon, fullscreenIntent)

        // If screen is off or we're showing AOD, show lockscreen.
        centralSurfaces.wakeUpForFullScreenIntent()

        // Don't show HUN since we're already showing FSI.
        entry.notifyFullScreenIntentLaunched()
    }
}
Loading