import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
import android.annotation.UserIdInt;
+import android.annotation.WorkerThread;
import android.app.Activity;
import android.app.admin.SecurityLog.SecurityEvent;
import android.content.ComponentName;
* owner, and the application restrictions managing package via
* {@link #getApplicationRestrictions}.
*
+ * <p>NOTE: The method performs disk I/O and shouldn't be called on the main thread
+ *
* @param admin Which {@link DeviceAdminReceiver} this request is associated with, or
* {@code null} if called by the application restrictions managing package.
* @param packageName The name of the package to update restricted settings for.
* @see #setApplicationRestrictionsManagingPackage
* @see UserManager#KEY_RESTRICTIONS_PENDING
*/
+ @WorkerThread
public void setApplicationRestrictions(@Nullable ComponentName admin, String packageName,
Bundle settings) {
throwIfParentInstance("setApplicationRestrictions");
* application restrictions via {@link #setApplicationRestrictionsManagingPackage}; otherwise a
* security exception will be thrown.
*
+ * <p>NOTE: The method performs disk I/O and shouldn't be called on the main thread
+ *
* @param admin Which {@link DeviceAdminReceiver} this request is associated with, or
* {@code null} if called by the application restrictions managing package.
* @param packageName The name of the package to fetch restricted settings of.
* @throws SecurityException if {@code admin} is not a device or profile owner.
* @see {@link #setApplicationRestrictionsManagingPackage}
*/
+ @WorkerThread
public Bundle getApplicationRestrictions(@Nullable ComponentName admin, String packageName) {
throwIfParentInstance("getApplicationRestrictions");
if (mService != null) {
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.UserIdInt;
+import android.annotation.WorkerThread;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManagerNative;
* <li>From {@link android.os.Build.VERSION_CODES#M}, {@code Bundle} or {@code Bundle[]}
* </ul>
*
+ * <p>NOTE: The method performs disk I/O and shouldn't be called on the main thread
+ *
* @param packageName the package name of the calling application
* @return a {@link Bundle} with the restrictions for that package, or an empty {@link Bundle}
* if there are no saved restrictions.
*
* @see #KEY_RESTRICTIONS_PENDING
*/
+ @WorkerThread
public Bundle getApplicationRestrictions(String packageName) {
try {
return mService.getApplicationRestrictions(packageName);
/**
* @hide
*/
+ @WorkerThread
public Bundle getApplicationRestrictions(String packageName, UserHandle user) {
try {
return mService.getApplicationRestrictionsForUser(packageName, user.getIdentifier());
/**
* @hide
*/
+ @WorkerThread
public void setApplicationRestrictions(String packageName, Bundle restrictions,
UserHandle user) {
try {