• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.photopicker.core.features
18 
19 import androidx.compose.runtime.staticCompositionLocalOf
20 
21 /**
22  * Provider for fetching [FeatureManager] inside of composables. [staticCompositionLocalOf] is used
23  * here because the FeatureManager is unlikely to change or be reassigned, and there are performance
24  * benefits for not having to keep track of consumers to apply recompositions. The drawback is that
25  * the content this CompositionLocal wraps will be recalculated if the value is changed. Since it's
26  * not expected for the FeatureManager reference to be updated (this is being provided by the
27  * Activity at the top of the UI tree), and is injected via Hilt, this value should be very stable.
28  */
29 val LocalFeatureManager =
<lambda>null30     staticCompositionLocalOf<FeatureManager> { error("No FeatureManager provided") }
31