summaryrefslogtreecommitdiffstats
path: root/tests/ActivityTests
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-08-11 00:28:20 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-11 00:28:20 +0000
commit09e77852d8c25854894358789807a73c3e79ddf0 (patch)
tree5106dec8198311fc865e151a6599310013a239bb /tests/ActivityTests
parent83682890190c9a5b73e1742a58c1e017ac418ee2 (diff)
parent5cf89a011932f1af9361e7b713e33ff5c5af3e61 (diff)
downloadframeworks_base-09e77852d8c25854894358789807a73c3e79ddf0.zip
frameworks_base-09e77852d8c25854894358789807a73c3e79ddf0.tar.gz
frameworks_base-09e77852d8c25854894358789807a73c3e79ddf0.tar.bz2
am 5cf89a01: am b2b02092: Merge "Fix issue #23037899: Support for Battery Optimization permission + Dialog" into mnc-dev
* commit '5cf89a011932f1af9361e7b713e33ff5c5af3e61': Fix issue #23037899: Support for Battery Optimization permission + Dialog
Diffstat (limited to 'tests/ActivityTests')
-rw-r--r--tests/ActivityTests/AndroidManifest.xml1
-rw-r--r--tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java5
2 files changed, 5 insertions, 1 deletions
diff --git a/tests/ActivityTests/AndroidManifest.xml b/tests/ActivityTests/AndroidManifest.xml
index 73cb432..7b9c9f1 100644
--- a/tests/ActivityTests/AndroidManifest.xml
+++ b/tests/ActivityTests/AndroidManifest.xml
@@ -24,6 +24,7 @@
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
<uses-permission android:name="android.permission.MANAGE_USERS" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+ <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-sdk android:targetSdkVersion="22" />
<application android:label="ActivityTest">
<activity android:name="ActivityTestMain">
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
index 2f0bf39..5fbfe8a 100644
--- a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
+++ b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
@@ -465,9 +465,12 @@ public class ActivityTestMain extends Activity {
menu.add("Ignore battery optimizations").setOnMenuItemClickListener(
new MenuItem.OnMenuItemClickListener() {
@Override public boolean onMenuItemClick(MenuItem item) {
- Intent intent = new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);
+ Intent intent;
if (!mPower.isIgnoringBatteryOptimizations(getPackageName())) {
+ intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
intent.setData(Uri.fromParts("package", getPackageName(), null));
+ } else {
+ intent = new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);
}
startActivity(intent);
return true;