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 */ 16package com.android.car.test.stressfs; 17 18import android.app.Activity; 19import android.content.ComponentName; 20import android.content.Context; 21import android.content.Intent; 22import android.content.ServiceConnection; 23import android.os.Bundle; 24import android.os.IBinder; 25 26/** 27 * Used to instantiate the WritingService service at a high priority. 28 */ 29public class WritingActivity extends Activity { 30 31 private static final String TAG = "StressFS"; 32 33 /** 34 * Activity-wide connection to keep the service going. 35 * Not used for any specific interaction. 36 */ 37 private ServiceConnection mConnection = new ServiceConnection() { 38 /** No-op */ 39 public void onServiceConnected(ComponentName className, IBinder service) { 40 // Nothing to do. 41 } 42 43 /** No-op */ 44 public void onServiceDisconnected(ComponentName className) { 45 // Nothing to do. 46 } 47 }; 48 49 @Override 50 public void onCreate(Bundle savedInstanceState) { 51 super.onCreate(savedInstanceState); 52 bindService( 53 new Intent( 54 getIntent().getAction(), 55 getIntent().getData(), 56 this, 57 WritingService.class), 58 mConnection, 59 Context.BIND_AUTO_CREATE); 60 } 61} 62