1 /* 2 * Copyright (C) 2021 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 package com.android.launcher3.taskbar; 17 18 import static android.view.Display.DEFAULT_DISPLAY; 19 import static android.view.InsetsFrameProvider.SOURCE_DISPLAY; 20 import static android.view.WindowInsets.Type.mandatorySystemGestures; 21 import static android.view.WindowInsets.Type.navigationBars; 22 import static android.view.WindowInsets.Type.systemGestures; 23 import static android.view.WindowInsets.Type.tappableElement; 24 25 import static com.android.launcher3.taskbar.LauncherTaskbarUIController.DISPLAY_PROGRESS_COUNT; 26 27 import android.app.PendingIntent; 28 import android.os.Binder; 29 import android.os.IBinder; 30 import android.view.InsetsFrameProvider; 31 32 import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags; 33 import com.android.wm.shell.shared.bubbles.BubbleBarLocation; 34 import com.android.wm.shell.shared.bubbles.BubbleInfo; 35 36 import java.util.List; 37 38 /** 39 * State shared across different taskbar instance 40 */ 41 public class TaskbarSharedState { 42 43 private final IBinder mInsetsOwner = new Binder(); 44 private static int INDEX_LEFT = 0; 45 private static int INDEX_RIGHT = 1; 46 47 // TaskbarManager#onSystemUiFlagsChanged 48 @SystemUiStateFlags 49 public long sysuiStateFlags; 50 51 // TaskbarManager#disableNavBarElements() 52 public int disableNavBarDisplayId; 53 public int disableNavBarState1; 54 public int disableNavBarState2; 55 56 // TaskbarManager#onSystemBarAttributesChanged() 57 public int systemBarAttrsDisplayId; 58 public int systemBarAttrsBehavior; 59 60 // TaskbarManager#onNavButtonsDarkIntensityChanged() 61 public float navButtonsDarkIntensity; 62 63 // TaskbarManager#onTransitionModeUpdated() 64 public int barMode; 65 66 // TaskbarManager#onNavigationBarLumaSamplingEnabled() 67 public int mLumaSamplingDisplayId = DEFAULT_DISPLAY; 68 public boolean mIsLumaSamplingEnabled = true; 69 70 public boolean setupUIVisible = false; 71 72 public boolean wallpaperVisible = false; 73 74 public boolean allAppsVisible = false; 75 76 public BubbleBarLocation bubbleBarLocation; 77 78 public List<BubbleInfo> bubbleInfoItems; 79 80 public List<BubbleInfo> suppressedBubbleInfoItems; 81 82 /** Returns whether there are a saved bubbles. */ hasSavedBubbles()83 public boolean hasSavedBubbles() { 84 return bubbleInfoItems != null && !bubbleInfoItems.isEmpty(); 85 } 86 87 // LauncherTaskbarUIController#mTaskbarInAppDisplayProgressMultiProp 88 public float[] inAppDisplayProgressMultiPropValues = new float[DISPLAY_PROGRESS_COUNT]; 89 90 // Taskbar System Action 91 public PendingIntent taskbarSystemActionPendingIntent; 92 93 public final InsetsFrameProvider[] insetsFrameProviders = new InsetsFrameProvider[] { 94 new InsetsFrameProvider(mInsetsOwner, 0, navigationBars()), 95 new InsetsFrameProvider(mInsetsOwner, 0, tappableElement()), 96 new InsetsFrameProvider(mInsetsOwner, 0, mandatorySystemGestures()), 97 new InsetsFrameProvider(mInsetsOwner, INDEX_LEFT, systemGestures()) 98 .setSource(SOURCE_DISPLAY), 99 new InsetsFrameProvider(mInsetsOwner, INDEX_RIGHT, systemGestures()) 100 .setSource(SOURCE_DISPLAY) 101 }; 102 103 // Allows us to shift translation logic when doing taskbar pinning animation. 104 public boolean startTaskbarVariantIsTransient = true; 105 106 // To track if taskbar was pinned using taskbar pinning feature at the time of recreate, 107 // so we can unstash transient taskbar when we un-pinning taskbar. 108 private boolean mTaskbarWasPinned = false; 109 getTaskbarWasPinned()110 public boolean getTaskbarWasPinned() { 111 return mTaskbarWasPinned; 112 } 113 setTaskbarWasPinned(boolean taskbarWasPinned)114 public void setTaskbarWasPinned(boolean taskbarWasPinned) { 115 mTaskbarWasPinned = taskbarWasPinned; 116 } 117 118 // To track if taskbar was stashed / unstashed between configuration changes (which recreates 119 // the task bar). 120 public boolean taskbarWasStashedAuto = true; 121 122 // should show corner radius on persistent taskbar when in desktop mode. 123 public boolean showCornerRadiusInDesktopMode = false; 124 } 125