Home | History | Annotate | Download | only in recents
      1 /*
      2  * Copyright (C) 2014 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.recents;
     18 
     19 import android.content.Context;
     20 
     21 import com.android.systemui.recents.events.EventBus;
     22 import com.android.systemui.recents.events.activity.DebugFlagsChangedEvent;
     23 import com.android.systemui.recents.misc.SystemServicesProxy;
     24 import com.android.systemui.tuner.TunerService;
     25 
     26 /**
     27  * Tunable debug flags
     28  */
     29 public class RecentsDebugFlags implements TunerService.Tunable {
     30 
     31     public static class Static {
     32         // Enables debug drawing for the transition thumbnail
     33         public static final boolean EnableTransitionThumbnailDebugMode = false;
     34         // This disables the bitmap and icon caches
     35         public static final boolean DisableBackgroundCache = false;
     36         // Enables the task affiliations
     37         public static final boolean EnableAffiliatedTaskGroups = false;
     38         // Enables the button above the stack
     39         public static final boolean EnableStackActionButton = true;
     40         // Overrides the Tuner flags and enables the timeout
     41         private static final boolean EnableFastToggleTimeout = false;
     42         // Overrides the Tuner flags and enables the paging via the Recents button
     43         private static final boolean EnablePaging = false;
     44         // Disables enter and exit transitions for other tasks for low ram devices
     45         public static final boolean DisableRecentsLowRamEnterExitAnimation = false;
     46 
     47         // Enables us to create mock recents tasks
     48         public static final boolean EnableMockTasks = false;
     49         // Defines the number of mock recents packages to create
     50         public static final int MockTasksPackageCount = 3;
     51         // Defines the number of mock recents tasks to create
     52         public static final int MockTaskCount = 100;
     53         // Enables the simulated task affiliations
     54         public static final boolean EnableMockTaskGroups = false;
     55         // Defines the number of mock task affiliations per group
     56         public static final int MockTaskGroupsTaskCount = 12;
     57     }
     58 
     59     /**
     60      * We read the prefs once when we start the activity, then update them as the tuner changes
     61      * the flags.
     62      */
     63     public RecentsDebugFlags(Context context) {
     64         // Register all our flags, this will also call onTuningChanged() for each key, which will
     65         // initialize the current state of each flag
     66     }
     67 
     68     /**
     69      * @return whether we are enabling fast toggling.
     70      */
     71     public boolean isFastToggleRecentsEnabled() {
     72         SystemServicesProxy ssp = Recents.getSystemServices();
     73         if (ssp.hasFreeformWorkspaceSupport() || ssp.isTouchExplorationEnabled()) {
     74             return false;
     75         }
     76         return Static.EnableFastToggleTimeout;
     77     }
     78 
     79     /**
     80      * @return whether we are enabling paging.
     81      */
     82     public boolean isPagingEnabled() {
     83         return Static.EnablePaging;
     84     }
     85 
     86     @Override
     87     public void onTuningChanged(String key, String newValue) {
     88         EventBus.getDefault().send(new DebugFlagsChangedEvent());
     89     }
     90 }
     91