Skip to content

Commit

Permalink
OboeTester: Add sustained perf to Dynamic CPU Load test (#2156)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertwu1 authored Feb 20, 2025
1 parent 350fedb commit 11afdfc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@

package com.mobileer.oboetester;

import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
Expand Down Expand Up @@ -73,6 +77,7 @@ public class DynamicWorkloadActivity extends TestOutputActivityBase {
private CheckBox mWorkloadReportBox;
private boolean mDrawChartAlways = true;
private CheckBox mDrawAlwaysBox;
private CheckBox mSustainedPerformanceModeBox;
private int mCpuCount;
private boolean mShouldUseADPF;
private boolean mShouldUseWorkloadReporting;
Expand Down Expand Up @@ -329,6 +334,19 @@ public void onClick(View view) {
mDrawChartAlways = checkBox.isChecked();
});

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
PowerManager powerManager = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);
mSustainedPerformanceModeBox = (CheckBox) findViewById(R.id.sustained_perf_mode);
if (powerManager.isSustainedPerformanceModeSupported()) {
mSustainedPerformanceModeBox.setOnClickListener(buttonView -> {
CheckBox checkBox = (CheckBox) buttonView;
getWindow().setSustainedPerformanceMode(checkBox.isChecked());
});
} else {
mSustainedPerformanceModeBox.setEnabled(false);
}
}

if (mDynamicWorkloadView != null) {
mDynamicWorkloadView.setWorkloadReceiver((w) -> {
setWorkloadHigh(w);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@
android:layout_height="wrap_content"
android:layout_marginRight="8sp"
android:text="Alt ADPF" />
</LinearLayout>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="@dimen/small_horizontal_margin"
android:paddingTop="@dimen/small_vertical_margin"
android:paddingRight="@dimen/small_horizontal_margin"
android:paddingBottom="@dimen/small_vertical_margin"
tools:context="com.mobileer.oboetester.DynamicWorkloadActivity">

<CheckBox
android:id="@+id/hear_workload"
Expand All @@ -68,6 +81,13 @@
android:layout_marginRight="8sp"
android:checked="true"
android:text="Scroll" />

<CheckBox
android:id="@+id/sustained_perf_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8sp"
android:text="Sustain" />
</LinearLayout>

<HorizontalScrollView
Expand Down

0 comments on commit 11afdfc

Please sign in to comment.