summaryrefslogtreecommitdiff
path: root/com/android/systemui/recents/RecentsDebugFlags.java
blob: 0262a098b8d29de3e9eaa9973420aadd93d1c343 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.recents;

import android.content.Context;

import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.DebugFlagsChangedEvent;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.tuner.TunerService;

/**
 * Tunable debug flags
 */
public class RecentsDebugFlags implements TunerService.Tunable {

    public static class Static {
        // Enables debug drawing for the transition thumbnail
        public static final boolean EnableTransitionThumbnailDebugMode = false;
        // This disables the bitmap and icon caches
        public static final boolean DisableBackgroundCache = false;
        // Enables the task affiliations
        public static final boolean EnableAffiliatedTaskGroups = false;
        // Enables the button above the stack
        public static final boolean EnableStackActionButton = true;
        // Overrides the Tuner flags and enables the timeout
        private static final boolean EnableFastToggleTimeout = false;
        // Overrides the Tuner flags and enables the paging via the Recents button
        private static final boolean EnablePaging = false;
        // Disables enter and exit transitions for other tasks for low ram devices
        public static final boolean DisableRecentsLowRamEnterExitAnimation = false;

        // Enables us to create mock recents tasks
        public static final boolean EnableMockTasks = false;
        // Defines the number of mock recents packages to create
        public static final int MockTasksPackageCount = 3;
        // Defines the number of mock recents tasks to create
        public static final int MockTaskCount = 100;
        // Enables the simulated task affiliations
        public static final boolean EnableMockTaskGroups = false;
        // Defines the number of mock task affiliations per group
        public static final int MockTaskGroupsTaskCount = 12;
    }

    /**
     * We read the prefs once when we start the activity, then update them as the tuner changes
     * the flags.
     */
    public RecentsDebugFlags(Context context) {
        // Register all our flags, this will also call onTuningChanged() for each key, which will
        // initialize the current state of each flag
    }

    /**
     * @return whether we are enabling fast toggling.
     */
    public boolean isFastToggleRecentsEnabled() {
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (ssp.hasFreeformWorkspaceSupport() || ssp.isTouchExplorationEnabled()) {
            return false;
        }
        return Static.EnableFastToggleTimeout;
    }

    /**
     * @return whether we are enabling paging.
     */
    public boolean isPagingEnabled() {
        return Static.EnablePaging;
    }

    @Override
    public void onTuningChanged(String key, String newValue) {
        EventBus.getDefault().send(new DebugFlagsChangedEvent());
    }
}