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 17 package org.chromium.latency.walt; 18 19 20 import android.os.Build; 21 import android.os.Bundle; 22 import android.support.v4.app.Fragment; 23 import android.view.LayoutInflater; 24 import android.view.View; 25 import android.view.ViewGroup; 26 import android.widget.TextView; 27 28 29 /** 30 * A screen that shows information about WALT. 31 */ 32 public class AboutFragment extends Fragment { 33 AboutFragment()34 public AboutFragment() { 35 // Required empty public constructor 36 } 37 38 @Override onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)39 public View onCreateView(LayoutInflater inflater, ViewGroup container, 40 Bundle savedInstanceState) { 41 // Inflate the layout for this fragment 42 return inflater.inflate(R.layout.fragment_about, container, false); 43 } 44 45 @Override onResume()46 public void onResume() { 47 super.onResume(); 48 TextView textView = (TextView) getActivity().findViewById(R.id.txt_build_info); 49 String text = String.format("WALT v%s (versionCode=%d)\n", 50 BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE); 51 text += "WALT protocol version: " + WaltDevice.PROTOCOL_VERSION + "\n"; 52 text += "Android Build ID: " + Build.DISPLAY + "\n"; 53 text += "Android API Level: " + Build.VERSION.SDK_INT + "\n"; 54 text += "Android OS Version: " + System.getProperty("os.version"); 55 textView.setText(text); 56 } 57 } 58