1 /* 2 * Copyright (C) 2019 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.systemui.statusbar; 18 19 import android.content.Context; 20 import android.util.FeatureFlagUtils; 21 22 import com.android.systemui.R; 23 import com.android.systemui.dagger.SysUISingleton; 24 import com.android.systemui.flags.FeatureFlagReader; 25 26 import javax.inject.Inject; 27 28 /** 29 * Class to manage simple DeviceConfig-based feature flags. 30 * 31 * See {@link FeatureFlagReader} for instructions on defining and flipping flags. 32 */ 33 @SysUISingleton 34 public class FeatureFlags { 35 private final FeatureFlagReader mFlagReader; 36 private final Context mContext; 37 38 @Inject FeatureFlags(FeatureFlagReader flagReader, Context context)39 public FeatureFlags(FeatureFlagReader flagReader, Context context) { 40 mFlagReader = flagReader; 41 mContext = context; 42 } 43 isNewNotifPipelineEnabled()44 public boolean isNewNotifPipelineEnabled() { 45 return mFlagReader.isEnabled(R.bool.flag_notification_pipeline2); 46 } 47 isNewNotifPipelineRenderingEnabled()48 public boolean isNewNotifPipelineRenderingEnabled() { 49 return mFlagReader.isEnabled(R.bool.flag_notification_pipeline2_rendering); 50 } 51 52 /** b/171917882 */ isTwoColumnNotificationShadeEnabled()53 public boolean isTwoColumnNotificationShadeEnabled() { 54 return mFlagReader.isEnabled(R.bool.flag_notification_twocolumn); 55 } 56 isKeyguardLayoutEnabled()57 public boolean isKeyguardLayoutEnabled() { 58 return mFlagReader.isEnabled(R.bool.flag_keyguard_layout); 59 } 60 useNewLockscreenAnimations()61 public boolean useNewLockscreenAnimations() { 62 return mFlagReader.isEnabled(R.bool.flag_lockscreen_animations); 63 } 64 isPeopleTileEnabled()65 public boolean isPeopleTileEnabled() { 66 return mFlagReader.isEnabled(R.bool.flag_conversations); 67 } 68 isMonetEnabled()69 public boolean isMonetEnabled() { 70 return mFlagReader.isEnabled(R.bool.flag_monet); 71 } 72 isPMLiteEnabled()73 public boolean isPMLiteEnabled() { 74 return mFlagReader.isEnabled(R.bool.flag_pm_lite); 75 } 76 isChargingRippleEnabled()77 public boolean isChargingRippleEnabled() { 78 return mFlagReader.isEnabled(R.bool.flag_charging_ripple); 79 } 80 isOngoingCallStatusBarChipEnabled()81 public boolean isOngoingCallStatusBarChipEnabled() { 82 return mFlagReader.isEnabled(R.bool.flag_ongoing_call_status_bar_chip); 83 } 84 isSmartspaceEnabled()85 public boolean isSmartspaceEnabled() { 86 return mFlagReader.isEnabled(R.bool.flag_smartspace); 87 } 88 isSmartspaceDedupingEnabled()89 public boolean isSmartspaceDedupingEnabled() { 90 return isSmartspaceEnabled() && mFlagReader.isEnabled(R.bool.flag_smartspace_deduping); 91 } 92 isNewKeyguardSwipeAnimationEnabled()93 public boolean isNewKeyguardSwipeAnimationEnabled() { 94 return mFlagReader.isEnabled(R.bool.flag_new_unlock_swipe_animation); 95 } 96 isSmartSpaceSharedElementTransitionEnabled()97 public boolean isSmartSpaceSharedElementTransitionEnabled() { 98 return mFlagReader.isEnabled(R.bool.flag_smartspace_shared_element_transition); 99 } 100 101 /** Whether or not to use the provider model behavior for the status bar icons */ isCombinedStatusBarSignalIconsEnabled()102 public boolean isCombinedStatusBarSignalIconsEnabled() { 103 return mFlagReader.isEnabled(R.bool.flag_combined_status_bar_signal_icons); 104 } 105 106 /** System setting for provider model behavior */ isProviderModelSettingEnabled()107 public boolean isProviderModelSettingEnabled() { 108 return FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL); 109 } 110 111 /** static method for the system setting */ isProviderModelSettingEnabled(Context context)112 public static boolean isProviderModelSettingEnabled(Context context) { 113 return FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL); 114 } 115 } 116