Home | History | Annotate | Download | only in execserver
      1 /*-------------------------------------------------------------------------
      2  * drawElements Quality Program Tester Core
      3  * ----------------------------------------
      4  *
      5  * Copyright 2014 The Android Open Source Project
      6  *
      7  * Licensed under the Apache License, Version 2.0 (the "License");
      8  * you may not use this file except in compliance with the License.
      9  * You may obtain a copy of the License at
     10  *
     11  *      http://www.apache.org/licenses/LICENSE-2.0
     12  *
     13  * Unless required by applicable law or agreed to in writing, software
     14  * distributed under the License is distributed on an "AS IS" BASIS,
     15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16  * See the License for the specific language governing permissions and
     17  * limitations under the License.
     18  *
     19  *//*!
     20  * \file
     21  * \brief ExecServer Activity
     22  *
     23  * Actual execserver is run in service, but this activity serves
     24  * as starter for the service.
     25  *//*--------------------------------------------------------------------*/
     26 
     27 package com.drawelements.deqp.execserver;
     28 
     29 import android.app.Activity;
     30 import android.content.Context;
     31 import android.content.Intent;
     32 import android.content.pm.ActivityInfo;
     33 import android.widget.TextView;
     34 import android.os.Bundle;
     35 
     36 import com.drawelements.deqp.testercore.Log;
     37 import com.drawelements.deqp.execserver.ExecService;
     38 import com.drawelements.deqp.R;
     39 
     40 public class ExecServerActivity extends Activity {
     41 
     42 	private static final String		LOG_TAG			= "dEQP/ExecServer";
     43 	private static final int		PORT			= 50016;
     44 
     45 	private TextView				m_statusText;
     46 
     47 	@Override
     48 	protected void onCreate (Bundle savedInstance) {
     49 		super.onCreate(savedInstance);
     50 		setContentView(R.layout.exec_server);
     51 
     52 		m_statusText = (TextView)findViewById(R.id.status_text);
     53 	}
     54 
     55 	@Override
     56 	protected void onStart () {
     57 		super.onStart();
     58 
     59 		try {
     60 			Intent svc = new Intent(this, com.drawelements.deqp.execserver.ExecService.class);
     61 			startService(svc);
     62 		}
     63 		catch (Exception e) {
     64 			Log.e(LOG_TAG, "Service starter starting problem", e);
     65 			m_statusText.setText("Failed to start ExecServer!");
     66 		}
     67 
     68 		// \todo [2013-05-07 pyry] Show IP address
     69 		m_statusText.setText(String.format("Listening on port %d", PORT));
     70 	}
     71 
     72 	@Override
     73 	protected void onStop () {
     74 		super.onStop();
     75 	}
     76 
     77 	@Override
     78 	protected void onPause () {
     79 		super.onPause();
     80 	}
     81 
     82 	@Override
     83 	protected void onResume () {
     84 		super.onResume();
     85 	}
     86 
     87 	@Override
     88 	protected void onDestroy() {
     89 		super.onDestroy();
     90 	}
     91 }
     92