mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-18 10:18:20 +00:00
This CL adds a Soong build flag in Android.bp files to enable Compose code when building Launcher. The flag is disabled by default, and it will be enabled once agreed with the System Health team. More details in go/launcher-enabling-compose-next-steps. To turn this flag on, one simply has to `build-flag set RELEASE_ENABLE_COMPOSE_IN_LAUNCHER true` before compiling. - When the flag is enabled, Launcher3 will use a ComposeFacade object that provides features implemented using Compose. This Facade also provides a function to check whether Compose is enabled or not. - When the flag is disabled, Launcher3 will implement a ComposeFacade object that throws an exception if a feature using Compose is requested. Thus, it is important to always check isComposableAvailable function before requesting a Compose feature. Bug: 346288480 Test: Builds Flag: EXEMPT Build flag: RELEASE_ENABLE_COMPOSE_IN_LAUNCHER Change-Id: I5f2703f74960aeb104d0386ed3ef49784ed85234
29 lines
1011 B
Kotlin
29 lines
1011 B
Kotlin
/*
|
|
* Copyright (C) 2024 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.launcher3.compose
|
|
|
|
import android.content.Context
|
|
import android.view.View
|
|
import androidx.compose.ui.platform.ComposeView
|
|
import com.android.launcher3.compose.core.BaseComposeFacade
|
|
|
|
object ComposeFacade : BaseComposeFacade {
|
|
override fun isComposeAvailable(): Boolean = true
|
|
|
|
override fun initComposeView(appContext: Context): View = ComposeView(appContext)
|
|
}
|