Merge "Work around buggy DMAgent." into nyc-dev
This commit is contained in:
@@ -4868,10 +4868,24 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
// we start using it for different purposes.
|
// we start using it for different purposes.
|
||||||
ensureCallerPackage(callerPackage);
|
ensureCallerPackage(callerPackage);
|
||||||
|
|
||||||
|
final ApplicationInfo ai;
|
||||||
|
try {
|
||||||
|
ai = mContext.getPackageManager().getApplicationInfo(callerPackage, 0);
|
||||||
|
} catch (NameNotFoundException e) {
|
||||||
|
throw new SecurityException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean legacyApp = false;
|
||||||
|
if (ai.targetSdkVersion <= Build.VERSION_CODES.M) {
|
||||||
|
legacyApp = true;
|
||||||
|
} else if ("com.google.android.apps.enterprise.dmagent".equals(ai.packageName)
|
||||||
|
&& ai.versionCode == 697) {
|
||||||
|
// TODO: remove this once a new prebuilt is dropped
|
||||||
|
legacyApp = true;
|
||||||
|
}
|
||||||
|
|
||||||
final int rawStatus = getEncryptionStatus();
|
final int rawStatus = getEncryptionStatus();
|
||||||
if ((rawStatus == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_PER_USER)
|
if ((rawStatus == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_PER_USER) && legacyApp) {
|
||||||
&& (callerPackage != null)
|
|
||||||
&& (getTargetSdk(callerPackage, userHandle) <= VERSION_CODES.M)) {
|
|
||||||
return DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE;
|
return DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE;
|
||||||
}
|
}
|
||||||
return rawStatus;
|
return rawStatus;
|
||||||
|
|||||||
Reference in New Issue
Block a user