1 /* 2 * Copyright (C) 2025 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.documentsui.util 18 19 import com.android.documentsui.flags.Flags 20 21 /** 22 * Wraps the static flags classes to enable a single place to refactor flag usage 23 * (or combine usage when required). 24 */ 25 class FlagUtils { 26 companion object { 27 @JvmStatic isUseMaterial3FlagEnablednull28 fun isUseMaterial3FlagEnabled(): Boolean { 29 return Flags.useMaterial3() 30 } 31 32 @JvmStatic isZipNgFlagEnablednull33 fun isZipNgFlagEnabled(): Boolean { 34 return Flags.zipNgRo() && Flags.useMaterial3() 35 } 36 37 @JvmStatic isUseSearchV2FlagEnablednull38 fun isUseSearchV2FlagEnabled(): Boolean { 39 return Flags.useSearchV2ReadOnly() 40 } 41 42 @JvmStatic isDesktopFileHandlingFlagEnablednull43 fun isDesktopFileHandlingFlagEnabled(): Boolean { 44 return Flags.desktopFileHandlingRo() 45 } 46 47 @JvmStatic isVisualSignalsFlagEnablednull48 fun isVisualSignalsFlagEnabled(): Boolean { 49 return Flags.visualSignalsRo() && isUseMaterial3FlagEnabled() 50 } 51 52 @JvmStatic isHideRootsOnDesktopFlagEnablednull53 fun isHideRootsOnDesktopFlagEnabled(): Boolean { 54 return Flags.hideRootsOnDesktopRo() 55 } 56 57 @JvmStatic isUsePeekPreviewFlagEnablednull58 fun isUsePeekPreviewFlagEnabled(): Boolean { 59 return Flags.usePeekPreviewRo() && isUseMaterial3FlagEnabled() 60 } 61 } 62 } 63