From 94d2cf9725ba21a60e28fc9dadb3b65bac873e12 Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Wed, 18 Jun 2014 09:53:34 -0400 Subject: [PATCH] Change clearDeviceOwnerApp to take a package If the caller is sharing uid, then the package from getPackage() may not be the desired one. This also matches better with the other device owner calls. Change-Id: I14f2ec4bff0717273f626072dabad0d2c76068a5 --- api/current.txt | 2 +- core/java/android/app/admin/DevicePolicyManager.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/current.txt b/api/current.txt index a09a853a4419f..a6ca30f9db512 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5197,7 +5197,7 @@ package android.app.admin { method public void addPersistentPreferredActivity(android.content.ComponentName, android.content.IntentFilter, android.content.ComponentName); method public void addUserRestriction(android.content.ComponentName, java.lang.String); method public void clearCrossProfileIntentFilters(android.content.ComponentName); - method public void clearDeviceOwnerApp(); + method public void clearDeviceOwnerApp(java.lang.String); method public void clearPackagePersistentPreferredActivities(android.content.ComponentName, java.lang.String); method public void clearUserRestriction(android.content.ComponentName, java.lang.String); method public android.os.UserHandle createAndInitializeUser(android.content.ComponentName, java.lang.String, java.lang.String, android.content.ComponentName, android.os.Bundle); diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index e80c7616204fb..f630977abd4bc 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -1839,11 +1839,13 @@ public class DevicePolicyManager { * This function should be used cautiously as once it is called it cannot * be undone. The device owner can only be set as a part of device setup * before setup completes. + * + * @param packageName The package name of the device owner. */ - public void clearDeviceOwnerApp() { + public void clearDeviceOwnerApp(String packageName) { if (mService != null) { try { - mService.clearDeviceOwner(mContext.getPackageName()); + mService.clearDeviceOwner(packageName); } catch (RemoteException re) { Log.w(TAG, "Failed to clear device owner"); }