1 /* 2 * Copyright (C) 2015 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.compatibility.common.deviceinfo; 17 18 import android.app.Activity; 19 import android.app.Instrumentation; 20 import android.content.Context; 21 import android.content.Intent; 22 import android.content.pm.FeatureInfo; 23 import android.content.pm.PackageManager; 24 import android.content.res.Configuration; 25 import android.os.Build; 26 import android.os.Bundle; 27 import android.os.Environment; 28 import android.os.UserManager; 29 import android.telephony.TelephonyManager; 30 import android.text.TextUtils; 31 import android.util.DisplayMetrics; 32 import android.util.Log; 33 import android.view.Display; 34 import android.view.WindowManager; 35 36 import java.io.IOException; 37 import java.lang.reflect.Field; 38 import java.lang.reflect.InvocationTargetException; 39 import java.lang.reflect.Method; 40 import java.util.ArrayList; 41 import java.util.Arrays; 42 import java.util.HashSet; 43 import java.util.List; 44 import java.util.Scanner; 45 import java.util.Set; 46 47 import com.android.compatibility.common.deviceinfo.DeviceInfoActivity; 48 49 /** 50 * Generic device info collector. 51 */ 52 public class GenericDeviceInfo extends DeviceInfoActivity { 53 54 public static final String BUILD_ID = "build_id"; 55 public static final String BUILD_PRODUCT = "build_product"; 56 public static final String BUILD_DEVICE = "build_device"; 57 public static final String BUILD_BOARD = "build_board"; 58 public static final String BUILD_MANUFACTURER = "build_manufacturer"; 59 public static final String BUILD_BRAND = "build_brand"; 60 public static final String BUILD_MODEL = "build_model"; 61 public static final String BUILD_TYPE = "build_type"; 62 public static final String BUILD_FINGERPRINT = "build_fingerprint"; 63 public static final String BUILD_ABI = "build_abi"; 64 public static final String BUILD_ABI2 = "build_abi2"; 65 public static final String BUILD_ABIS = "build_abis"; 66 public static final String BUILD_ABIS_32 = "build_abis_32"; 67 public static final String BUILD_ABIS_64 = "build_abis_64"; 68 public static final String BUILD_SERIAL = "build_serial"; 69 public static final String BUILD_VERSION_RELEASE = "build_version_release"; 70 public static final String BUILD_VERSION_SDK = "build_version_sdk"; 71 72 @Override onCreate(Bundle savedInstanceState)73 public void onCreate(Bundle savedInstanceState) { 74 super.onCreate(savedInstanceState); 75 } 76 77 @Override collectDeviceInfo()78 protected void collectDeviceInfo() { 79 addResult(BUILD_ID, Build.ID); 80 addResult(BUILD_PRODUCT, Build.PRODUCT); 81 addResult(BUILD_DEVICE, Build.DEVICE); 82 addResult(BUILD_BOARD, Build.BOARD); 83 addResult(BUILD_MANUFACTURER, Build.MANUFACTURER); 84 addResult(BUILD_BRAND, Build.BRAND); 85 addResult(BUILD_MODEL, Build.MODEL); 86 addResult(BUILD_TYPE, Build.TYPE); 87 addResult(BUILD_FINGERPRINT, Build.FINGERPRINT); 88 addResult(BUILD_ABI, Build.CPU_ABI); 89 addResult(BUILD_ABI2, Build.CPU_ABI2); 90 addResult(BUILD_ABIS, TextUtils.join(",", Build.SUPPORTED_ABIS)); 91 addResult(BUILD_ABIS_32, TextUtils.join(",", Build.SUPPORTED_32_BIT_ABIS)); 92 addResult(BUILD_ABIS_64, TextUtils.join(",", Build.SUPPORTED_64_BIT_ABIS)); 93 addResult(BUILD_SERIAL, Build.SERIAL); 94 addResult(BUILD_VERSION_RELEASE, Build.VERSION.RELEASE); 95 addResult(BUILD_VERSION_SDK, Build.VERSION.SDK); 96 } 97 }