summaryrefslogtreecommitdiff
path: root/core/java/android/app/AppOpsManager.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2017-01-20 16:14:51 -0800
committerWinson Chung <winsonc@google.com>2017-01-24 09:15:01 -0800
commit59fda9e2175742d86fa982600dd1cf09d8151180 (patch)
treee1394f6c17f269b6f0f9616c6c173c88fab5b1f9 /core/java/android/app/AppOpsManager.java
parentf779f91cd2c944a2c7c6ecbae124847fc3d7a034 (diff)
Adding AppOps setting for entering PiP when hidden.
- In O, apps can request to enter picture-in-picture when the user effectively leaves their activity for another task by default. To prevent this from being abused, we need to add a setting for the user to disable this behavior per-package in the system level. When disabled, any activity from that package will only be able to enter picture-in-picture when it is visible and resumed. Bug: 34520451 Test: android.server.cts.ActivityManagerPinnedStackTests Test: #testAppOpsDenyPipOnPause Change-Id: Ib3a993e99ffb071706c6b7d3fb1c882b74acc5d7 Signed-off-by: Winson Chung <winsonc@google.com>
Diffstat (limited to 'core/java/android/app/AppOpsManager.java')
-rw-r--r--core/java/android/app/AppOpsManager.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index 9cc13abcbabc..603126b3badd 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -245,8 +245,10 @@ public class AppOpsManager {
public static final int OP_READ_PHONE_NUMBER = 65;
/** @hide Request package installs through package installer */
public static final int OP_REQUEST_INSTALL_PACKAGES = 66;
+ /** @hide Enter picture-in-picture when hidden. */
+ public static final int OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE = 67;
/** @hide */
- public static final int _NUM_OP = 67;
+ public static final int _NUM_OP = 68;
/** Access to coarse location information. */
public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -464,6 +466,7 @@ public class AppOpsManager {
OP_AUDIO_ACCESSIBILITY_VOLUME,
OP_READ_PHONE_NUMBER,
OP_REQUEST_INSTALL_PACKAGES,
+ OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE,
};
/**
@@ -538,6 +541,7 @@ public class AppOpsManager {
null, // OP_AUDIO_ACCESSIBILITY_VOLUME
OPSTR_READ_PHONE_NUMBER,
null, // OP_REQUEST_INSTALL_PACKAGES
+ null,
};
/**
@@ -612,6 +616,7 @@ public class AppOpsManager {
"AUDIO_ACCESSIBILITY_VOLUME",
"READ_PHONE_NUMBER",
"REQUEST_INSTALL_PACKAGES",
+ "OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE",
};
/**
@@ -686,6 +691,7 @@ public class AppOpsManager {
null, // no permission for changing accessibility volume
Manifest.permission.READ_PHONE_NUMBER,
Manifest.permission.REQUEST_INSTALL_PACKAGES,
+ null, // no permission for entering picture-in-picture on hide
};
/**
@@ -761,6 +767,7 @@ public class AppOpsManager {
UserManager.DISALLOW_ADJUST_VOLUME, //AUDIO_ACCESSIBILITY_VOLUME
null, // READ_PHONE_NUMBER
null, // REQUEST_INSTALL_PACKAGES
+ null, // ENTER_PICTURE_IN_PICTURE_ON_HIDE
};
/**
@@ -835,6 +842,7 @@ public class AppOpsManager {
false, // AUDIO_ACCESSIBILITY_VOLUME
false, // READ_PHONE_NUMBER
false, // REQUEST_INSTALL_PACKAGES
+ false, // ENTER_PICTURE_IN_PICTURE_ON_HIDE
};
/**
@@ -908,6 +916,7 @@ public class AppOpsManager {
AppOpsManager.MODE_ALLOWED, // OP_AUDIO_ACCESSIBILITY_VOLUME
AppOpsManager.MODE_ALLOWED,
AppOpsManager.MODE_DEFAULT, // OP_REQUEST_INSTALL_PACKAGES
+ AppOpsManager.MODE_ALLOWED, // OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE
};
/**
@@ -985,6 +994,7 @@ public class AppOpsManager {
false, // OP_AUDIO_ACCESSIBILITY_VOLUME
false,
false, // OP_REQUEST_INSTALL_PACKAGES
+ false, // OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE
};
/**