Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
akatyphon committed Mar 27, 2024
2 parents 97143ca + ee1bdd9 commit f30855a
Show file tree
Hide file tree
Showing 23 changed files with 381 additions and 768 deletions.
5 changes: 5 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ android {
)
}
}

buildFeatures {
viewBinding = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down
19 changes: 13 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
Expand All @@ -17,7 +21,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AndroidDeviceTester"
tools:targetApi="31">
tools:targetApi="31" >
<activity
android:name=".sensors.SensorDetails"
android:exported="false" />
Expand All @@ -40,14 +44,17 @@
android:name=".SystemActivity"
android:exported="false" />
<activity
android:name=".sensors.ignore.SensorDetails"
android:name=".apps.AppActivity"
android:exported="false" />
<activity
android:name=".apps.AppDetails"
android:exported="false" />
<activity
android:name=".sensors.ignore.SensorActivity"
android:name=".apps.PackageDetails"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="true">
android:name=".HomeActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,43 @@

import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.provider.Settings;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.madinaappstudio.deviceanalyzer.databinding.ActivityDeviceBinding;

public class DeviceActivity extends AppCompatActivity {

TextView devFtName, devName, devManufacturer, devModel, devBrand, devProduct, devBoard, devHardware, devRadio, devIncremental;
ImageView devFtIc;
ActivityDeviceBinding binding;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_device);
binding = ActivityDeviceBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);

CrashReporter.startCrashThread(this);

devFtIc = findViewById(R.id.devFtIc);
devFtName = findViewById(R.id.devFtName);
devName = findViewById(R.id.devName);
devManufacturer = findViewById(R.id.devManufacturer);
devModel = findViewById(R.id.devModel);
devBrand = findViewById(R.id.devBrand);
devProduct = findViewById(R.id.devProduct);
devBoard = findViewById(R.id.devBoard);
devHardware = findViewById(R.id.devHardware);
devRadio = findViewById(R.id.devRadio);
devIncremental = findViewById(R.id.devIncremental);

//Device
String deviceName = Settings.Global.getString(getContentResolver(), Settings.Global.DEVICE_NAME);
devName.setText(deviceName);
binding.devName.setText(deviceName);
SetHeadDetails setHeadDetails = new SetHeadDetails();
String manufacturer = Build.MANUFACTURER.toLowerCase();
setHeadDetails.ofDev(manufacturer, deviceName, devFtIc, devFtName);
devManufacturer.setText(manufacturer);
devModel.setText(String.valueOf(Build.MODEL));
devBrand.setText(String.valueOf(Build.BRAND));
devProduct.setText(String.valueOf(Build.PRODUCT));
devBoard.setText(String.valueOf(Build.BOARD));
devHardware.setText(String.valueOf(Build.HARDWARE));
devRadio.setText(String.valueOf(Build.getRadioVersion()));
devIncremental.setText(String.valueOf(Build.VERSION.INCREMENTAL));
setHeadDetails.ofDev(manufacturer, deviceName, binding.devFtIc, binding.devFtName);
binding.devManufacturer.setText(manufacturer);
binding.devModel.setText(String.valueOf(Build.MODEL));
binding.devBrand.setText(String.valueOf(Build.BRAND));
binding.devProduct.setText(String.valueOf(Build.PRODUCT));
binding.devBoard.setText(String.valueOf(Build.BOARD));
binding.devHardware.setText(String.valueOf(Build.HARDWARE));
binding.devRadio.setText(String.valueOf(Build.getRadioVersion()));
binding.devIncremental.setText(String.valueOf(Build.VERSION.INCREMENTAL));


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import com.madinaappstudio.deviceanalyzer.databinding.ActivityHardwareBinding;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
Expand All @@ -37,83 +39,48 @@
import javax.microedition.khronos.opengles.GL10;

public class HardwareActivity extends AppCompatActivity implements GLSurfaceView.Renderer{

TextView hardSocFtName, hardSocManufacturer, hardSocModel, hardSocArchitecture, hardSocClockSpeed, hardSocCpuCores, hardSocGpuVendor,
hardSocGpuRenderer, hardSocGpuVersion, hardSocGpuExtension, hardSocBtnMore, hardDisFtName,hardDisScreenSize, hardDisResolution,
hardDisDensityDpi, hardDisRefreshRate, hardDisHdrSupport, hardDisWideColorGamut, hardDisLuminance, hardDisPixelPerInch,
hardMemFtName, hardRamSize, hardRamOccupied, hardRamAvailable, hardStoSize, hardStoOccupied, hardStoAvailable;

private int numCores;
TextView[] coreName;
LinearLayout hardSocCoreLiveFreq;
StringBuilder sbGpuExt = new StringBuilder();
ImageView hardSocFtIc, hardDisFtIc, hardMemFtIc;
ActivityHardwareBinding binding;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hardware);
binding = ActivityHardwareBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);

CrashReporter.startCrashThread(this);

numCores = Runtime.getRuntime().availableProcessors();
int textViewHeight = getResources().getDimensionPixelSize(R.dimen.textview_height);
int textViewWidth = getResources().getDimensionPixelSize(R.dimen.textview_width);

hardSocFtName = findViewById(R.id.hardSocFtName);
hardSocFtIc = findViewById(R.id.hardSocFtIc);
hardSocManufacturer = findViewById(R.id.hardSocManufacturer);
hardSocModel = findViewById(R.id.hardSocModel);
hardSocArchitecture = findViewById(R.id.hardSocArchitecture);
hardSocClockSpeed = findViewById(R.id.hardSocClockSpeed);
hardSocCpuCores = findViewById(R.id.hardSocCpuCores);
hardSocGpuVendor = findViewById(R.id.hardSocGpuVendor);
hardSocGpuRenderer = findViewById(R.id.hardSocGpuRenderer);
hardSocGpuVersion = findViewById(R.id.hardSocGpuVersion);
hardSocGpuExtension = findViewById(R.id.hardSocGpuExtension);
hardSocBtnMore = findViewById(R.id.hardSocBtnMore);
hardDisFtName = findViewById(R.id.hardDisFtName);
hardDisFtIc = findViewById(R.id.hardDisFtIc);
hardDisScreenSize = findViewById(R.id.hardDisScreenSize);
hardDisResolution = findViewById(R.id.hardDisResolution);
hardDisDensityDpi = findViewById(R.id.hardDisDensityDpi);
hardDisRefreshRate = findViewById(R.id.hardDisRefreshRate);
hardDisHdrSupport = findViewById(R.id.hardDisHdrSupport);
hardDisWideColorGamut = findViewById(R.id.hardDisWideColorGamut);
hardDisLuminance = findViewById(R.id.hardDisLuminance);
hardDisPixelPerInch = findViewById(R.id.hardDisPixelPerInch);
hardMemFtIc = findViewById(R.id.hardMemFtIc);
hardMemFtName = findViewById(R.id.hardMemFtName);
hardRamSize = findViewById(R.id.hardRamSize);
hardRamOccupied = findViewById(R.id.hardRamOccupied);
hardRamAvailable = findViewById(R.id.hardRamAvailable);
hardStoSize = findViewById(R.id.hardStoSize);
hardStoOccupied = findViewById(R.id.hardStoOccupied);
hardStoAvailable = findViewById(R.id.hardStoAvailable);
hardSocCoreLiveFreq = findViewById(R.id.hardSocCoreLiveFreq);

SetHeadDetails setHeadDetails = new SetHeadDetails();
setHeadDetails.ofHardSoc(hardSocFtName, hardSocFtIc);
setHeadDetails.ofHardSoc(binding.hardSocFtName, binding.hardSocFtIc);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
hardSocManufacturer.setText(Build.SOC_MANUFACTURER);
hardSocModel.setText(Build.SOC_MODEL);
binding.hardSocManufacturer.setText(Build.SOC_MANUFACTURER);
binding.hardSocModel.setText(Build.SOC_MODEL);
}
String[] arch = Build.SUPPORTED_ABIS;
if (arch.length == 1){
hardSocArchitecture.setText(String.valueOf(arch[0]));
binding.hardSocArchitecture.setText(String.valueOf(arch[0]));
} else if (arch.length == 2) {
hardSocArchitecture.setText(String.valueOf(arch[0] +", "+ arch[1]));
binding.hardSocArchitecture.setText(String.valueOf(arch[0] +", "+ arch[1]));
} else if (arch.length == 3) {
hardSocArchitecture.setText(String.valueOf(arch[0] +", "+ arch[1] +", "+ arch[2]));
binding.hardSocArchitecture.setText(String.valueOf(arch[0] +", "+ arch[1] +", "+ arch[2]));
}
hardSocClockSpeed.setText(String.format(Locale.US, "%.1f", getClockSpeed()) + "Ghz");
hardSocCpuCores.setText(String.valueOf(numCores));
hardSocGpuExtension.setOnClickListener(new View.OnClickListener() {
binding.hardSocClockSpeed.setText(String.format(Locale.US, "%.1f", getClockSpeed()) + "Ghz");
binding.hardSocCpuCores.setText(String.valueOf(numCores));
binding.hardSocGpuExtension.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
displayGPUExtensions();
}
});
hardSocBtnMore.setOnClickListener(new View.OnClickListener() {
binding.hardSocBtnMore.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
displayCPUInfo();
Expand All @@ -136,7 +103,7 @@ public void onClick(View v) {
if (i + 1 < numCores) {
coreName[i + 1] = createTextView(params, rowLayout);
}
hardSocCoreLiveFreq.addView(rowLayout);
binding.hardSocCoreLiveFreq.addView(rowLayout);
}

Timer timer = new Timer();
Expand Down Expand Up @@ -180,28 +147,28 @@ public void run() {
float heightInches = displayMetrics.heightPixels / displayMetrics.ydpi;
double sizeInch = Math.sqrt(Math.pow(widthInches, 2) + Math.pow(heightInches, 2));

setHeadDetails.ofHardDis(hardDisFtIc, hardDisFtName, displayName);
setHeadDetails.ofHardDis(binding.hardDisFtIc, binding.hardDisFtName, displayName);

hardDisScreenSize.setText(String.format(Locale.US,"%.1f", sizeInch) + " In");
hardDisResolution.setText(String.valueOf(width +" x "+ height));
hardDisDensityDpi.setText(String.valueOf(displayMetrics.densityDpi));
hardDisRefreshRate.setText(String.valueOf((int) display.getRefreshRate() + "Hz"));
binding.hardDisScreenSize.setText(String.format(Locale.US,"%.1f", sizeInch) + " In");
binding.hardDisResolution.setText(String.valueOf(width +" x "+ height));
binding.hardDisDensityDpi.setText(String.valueOf(displayMetrics.densityDpi));
binding.hardDisRefreshRate.setText(String.valueOf((int) display.getRefreshRate() + "Hz"));
if (display.isHdr()){
hardDisHdrSupport.setText(R.string.supported);
binding.hardDisHdrSupport.setText(R.string.supported);
} else {
hardDisHdrSupport.setText(R.string.not_supported);
binding.hardDisHdrSupport.setText(R.string.not_supported);
}
if (display.isWideColorGamut()){
hardDisWideColorGamut.setText(R.string.supported);
binding.hardDisWideColorGamut.setText(R.string.supported);
} else {
hardDisWideColorGamut.setText(R.string.not_supported);
binding.hardDisWideColorGamut.setText(R.string.not_supported);
}
int minLum = (int) display.getHdrCapabilities().getDesiredMinLuminance();
int maxLum = (int) display.getHdrCapabilities().getDesiredMaxLuminance();
hardDisLuminance.setText(String.valueOf("Min: "+ minLum +" Max: "+ maxLum));
binding.hardDisLuminance.setText(String.valueOf("Min: "+ minLum +" Max: "+ maxLum));
int pixX = (int) displayMetrics.xdpi;
int pixY = (int) displayMetrics.ydpi;
hardDisPixelPerInch.setText(String.valueOf("X: "+ pixX +" Y: "+ pixY));
binding.hardDisPixelPerInch.setText(String.valueOf("X: "+ pixX +" Y: "+ pixY));

// Memory
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
Expand All @@ -220,14 +187,14 @@ public void run() {
long uSto = tSto - aSto;
float aStoInPer = ((float) aSto / tSto) * 100;

setHeadDetails.ofHardMem(hardMemFtIc, hardMemFtName);
setHeadDetails.ofHardMem(binding.hardMemFtIc, binding.hardMemFtName);

hardRamSize.setText(formatSize(tRam));
hardRamOccupied.setText(formatSize(uRam));
hardRamAvailable.setText(formatSize(aRam) + " - " + String.format(Locale.US, "%.2f", aRamInPer) + "%");
hardStoSize.setText(formatSize(tSto));
hardStoOccupied.setText(formatSize(uSto));
hardStoAvailable.setText(formatSize(aSto) + " - " + String.format(Locale.US, "%.2f", aStoInPer) + "%");
binding.hardRamSize.setText(formatSize(tRam));
binding.hardRamOccupied.setText(formatSize(uRam));
binding.hardRamAvailable.setText(formatSize(aRam) + " - " + String.format(Locale.US, "%.2f", aRamInPer) + "%");
binding.hardStoSize.setText(formatSize(tSto));
binding.hardStoOccupied.setText(formatSize(uSto));
binding.hardStoAvailable.setText(formatSize(aSto) + " - " + String.format(Locale.US, "%.2f", aStoInPer) + "%");

}

Expand Down Expand Up @@ -329,9 +296,9 @@ public static String formatSize(long bytes) {

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
hardSocGpuVendor.setText(gl.glGetString(GL10.GL_VENDOR));
hardSocGpuRenderer.setText(gl.glGetString(GL10.GL_RENDERER));
hardSocGpuVersion.setText(gl.glGetString(GL10.GL_VERSION));
binding.hardSocGpuVendor.setText(gl.glGetString(GL10.GL_VENDOR));
binding.hardSocGpuRenderer.setText(gl.glGetString(GL10.GL_RENDERER));
binding.hardSocGpuVersion.setText(gl.glGetString(GL10.GL_VERSION));
String ext = gl.glGetString(GL10.GL_EXTENSIONS);
if (ext != null) {
String[] stringsArr = ext.split(" ");
Expand Down
Loading

0 comments on commit f30855a

Please sign in to comment.