Merge "PMS caches DPM" into sc-dev
This commit is contained in:
@@ -1495,6 +1495,9 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
// List of packages names to keep cached, even if they are uninstalled for all users
|
||||
private List<String> mKeepUninstalledPackages;
|
||||
|
||||
// Cached reference to IDevicePolicyManager.
|
||||
private IDevicePolicyManager mDevicePolicyManager = null;
|
||||
|
||||
private File mCacheDir;
|
||||
|
||||
private Future<?> mPrepareAppDataFuture;
|
||||
@@ -20807,8 +20810,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
|
||||
private boolean isPackageDeviceAdmin(String packageName, int userId) {
|
||||
IDevicePolicyManager dpm = IDevicePolicyManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.DEVICE_POLICY_SERVICE));
|
||||
final IDevicePolicyManager dpm = getDevicePolicyManager();
|
||||
try {
|
||||
if (dpm != null) {
|
||||
final ComponentName deviceOwnerComponentName = dpm.getDeviceOwnerComponent(
|
||||
@@ -20840,6 +20842,16 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Returns the device policy manager interface. */
|
||||
private IDevicePolicyManager getDevicePolicyManager() {
|
||||
if (mDevicePolicyManager == null) {
|
||||
// No need to synchronize; worst-case scenario it will be fetched twice.
|
||||
mDevicePolicyManager = IDevicePolicyManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.DEVICE_POLICY_SERVICE));
|
||||
}
|
||||
return mDevicePolicyManager;
|
||||
}
|
||||
|
||||
private boolean shouldKeepUninstalledPackageLPr(String packageName) {
|
||||
return mKeepUninstalledPackages != null && mKeepUninstalledPackages.contains(packageName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user