Home | History | Annotate | Download | only in bstatstestapp
      1 /*
      2  * Copyright (C) 2017 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.coretests.apps.bstatstestapp;
     17 
     18 import android.app.Activity;
     19 import android.os.Bundle;
     20 import android.util.Log;
     21 
     22 public class TestActivity extends Activity {
     23     private static final String TAG = TestActivity.class.getSimpleName();
     24 
     25     @Override
     26     public void onCreate(Bundle icicle) {
     27         super.onCreate(icicle);
     28         Log.d(TAG, "onCreate called");
     29         notifyActivityLaunched();
     30     }
     31 
     32     private void notifyActivityLaunched() {
     33         Common.notifyLaunched(getIntent(), mReceiver.asBinder(), TAG);
     34     }
     35 
     36     @Override
     37     public void finish() {
     38         super.finish();
     39         Log.d(TAG, "finish called");
     40     }
     41 
     42     private BaseCmdReceiver mReceiver = new BaseCmdReceiver() {
     43         @Override
     44         public void doSomeWork(int durationMs) {
     45             Common.doSomeWork(durationMs);
     46         }
     47 
     48         @Override
     49         public void finishHost() {
     50             if (!isFinishing()) {
     51                 finish();
     52             }
     53         }
     54     };
     55 }
     56