summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--startop/apps/test/AndroidManifest.xml2
-rw-r--r--startop/apps/test/src/SystemServerBenchmarks.java12
2 files changed, 12 insertions, 2 deletions
diff --git a/startop/apps/test/AndroidManifest.xml b/startop/apps/test/AndroidManifest.xml
index ba1be715700d..a5ac348f42d1 100644
--- a/startop/apps/test/AndroidManifest.xml
+++ b/startop/apps/test/AndroidManifest.xml
@@ -91,4 +91,6 @@
</application>
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+
</manifest>
diff --git a/startop/apps/test/src/SystemServerBenchmarks.java b/startop/apps/test/src/SystemServerBenchmarks.java
index 2464fbf7691c..126c2c8f2db7 100644
--- a/startop/apps/test/src/SystemServerBenchmarks.java
+++ b/startop/apps/test/src/SystemServerBenchmarks.java
@@ -26,6 +26,7 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.AsyncTask;
+import android.os.PowerManager;
/**
* An interface for running benchmarks and collecting results. Used so we can have both an
@@ -161,12 +162,19 @@ class SystemServerBenchmarks {
});
// We use PendingIntent.getCreatorPackage, since
- // getPackageIntentForSender is not public to us, but getCreatorPackage
- // is just a thin wrapper around it.
+ // getPackageIntentForSender is not public to us, but getCreatorPackage
+ // is just a thin wrapper around it.
PendingIntent pi = PendingIntent.getActivity(parent, 0, new Intent(), 0);
benchmarks.addBenchmark("getPackageIntentForSender", () -> {
pi.getCreatorPackage();
});
+
+ PowerManager pwr = (PowerManager) parent.getSystemService(Context.POWER_SERVICE);
+ PowerManager.WakeLock wl = pwr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "benchmark tag");
+ benchmarks.addBenchmark("WakeLock Acquire/Release", () -> {
+ wl.acquire();
+ wl.release();
+ });
}
/**