• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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.server.wm.flicker.monitor;
18 
19 import android.os.Environment;
20 
21 import java.nio.file.Path;
22 import java.nio.file.Paths;
23 
24 /** Collects test artifacts during a UI transition. */
25 public interface ITransitionMonitor {
26     Path OUTPUT_DIR = Paths.get(Environment.getExternalStorageDirectory().toString(), "flicker");
27 
28     /** Starts monitor. */
start()29     void start();
30 
31     /** Stops monitor. */
stop()32     void stop();
33 
34     /**
35      * Saves any monitor artifacts to file adding {@code testTag} and {@code iteration} to the file
36      * name.
37      *
38      * @param testTag suffix added to artifact name
39      * @param iteration suffix added to artifact name
40      * @return Path to saved artifact
41      */
save(String testTag, int iteration)42     default Path save(String testTag, int iteration) {
43         return save(testTag + "_" + iteration);
44     }
45 
46     /**
47      * Saves any monitor artifacts to file adding {@code testTag} to the file name.
48      *
49      * @param testTag suffix added to artifact name
50      * @return Path to saved artifact
51      */
save(String testTag)52     default Path save(String testTag) {
53         throw new UnsupportedOperationException("Save not implemented for this monitor");
54     }
55 }
56