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 package com.android.tv.perf; 17 18 import android.app.Activity; 19 import android.app.Application; 20 21 /** 22 * Measures App startup. This interface is lightweight to help measure both cold and warm startup 23 * latency. Implementations must not throw any Exception. 24 */ 25 public interface StartupMeasure { 26 27 /** To be be placed as the first static block in the app's Application class. */ onAppClassLoaded()28 void onAppClassLoaded(); 29 30 /** 31 * To be placed in your {@link Application#onCreate} to let Performance Monitoring know when 32 * this happen. 33 */ onAppCreate(Application application)34 void onAppCreate(Application application); 35 36 /** 37 * To be placed in an initialization block of your {@link Activity} to let Performance 38 * Monitoring know when this activity is instantiated. Please note that this initialization 39 * block should be before other initialization blocks (if any) in your activity class. 40 */ onActivityInit()41 void onActivityInit(); 42 } 43