summaryrefslogtreecommitdiffstats
path: root/quickstep/src/com/android/quickstep/util/SysuiEventLogger.java
blob: d474ded905ae5a2ee2a252f486259ac34d9d3728 (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
/*
 * Copyright (C) 2018 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.quickstep.util;

import android.metrics.LogMaker;
import android.util.EventLog;

/**
 * Utility class for writing logs on behalf of systemUI
 */
public class SysuiEventLogger {

    /** 524292 sysui_multi_action (content|4) */
    public static final int SYSUI_MULTI_ACTION = 524292;

    private static void write(LogMaker content) {
        if (content.getType() == 0/*MetricsEvent.TYPE_UNKNOWN*/) {
            content.setType(4/*MetricsEvent.TYPE_ACTION*/);
        }
        EventLog.writeEvent(SYSUI_MULTI_ACTION, content.serialize());
    }

    public static void writeDummyRecentsTransition(long transitionDelay) {
        // Mimic ActivityMetricsLogger.logAppTransitionMultiEvents() logging for
        // "Recents" activity for app transition tests for the app-to-recents case.
        final LogMaker builder = new LogMaker(761/*APP_TRANSITION*/);
        builder.setPackageName("com.android.systemui");
        builder.addTaggedData(871/*FIELD_CLASS_NAME*/,
                "com.android.systemui.recents.RecentsActivity");
        builder.addTaggedData(319/*APP_TRANSITION_DELAY_MS*/,
                transitionDelay);
        write(builder);
    }
}