Merge "Fix bad xml generation due to mismatched start/end tags" into klp-modular-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
aab514738e
@@ -117,7 +117,7 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||||
|
|
||||||
private static final String TAG = "DevicePolicyManagerService";
|
private static final String LOG_TAG = "DevicePolicyManagerService";
|
||||||
|
|
||||||
private static final String DEVICE_POLICIES_XML = "device_policies.xml";
|
private static final String DEVICE_POLICIES_XML = "device_policies.xml";
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
getSendingUserId());
|
getSendingUserId());
|
||||||
if (Intent.ACTION_BOOT_COMPLETED.equals(action)
|
if (Intent.ACTION_BOOT_COMPLETED.equals(action)
|
||||||
|| ACTION_EXPIRED_PASSWORD_NOTIFICATION.equals(action)) {
|
|| ACTION_EXPIRED_PASSWORD_NOTIFICATION.equals(action)) {
|
||||||
if (DBG) Slog.v(TAG, "Sending password expiration notifications for action "
|
if (DBG) Slog.v(LOG_TAG, "Sending password expiration notifications for action "
|
||||||
+ action + " for user " + userHandle);
|
+ action + " for user " + userHandle);
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -218,6 +218,28 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static class ActiveAdmin {
|
static class ActiveAdmin {
|
||||||
|
private static final String TAG_DISABLE_KEYGUARD_FEATURES = "disable-keyguard-features";
|
||||||
|
private static final String TAG_DISABLE_CAMERA = "disable-camera";
|
||||||
|
private static final String TAG_ENCRYPTION_REQUESTED = "encryption-requested";
|
||||||
|
private static final String TAG_PASSWORD_EXPIRATION_DATE = "password-expiration-date";
|
||||||
|
private static final String TAG_PASSWORD_EXPIRATION_TIMEOUT = "password-expiration-timeout";
|
||||||
|
private static final String TAG_GLOBAL_PROXY_EXCLUSION_LIST = "global-proxy-exclusion-list";
|
||||||
|
private static final String TAG_GLOBAL_PROXY_SPEC = "global-proxy-spec";
|
||||||
|
private static final String TAG_SPECIFIES_GLOBAL_PROXY = "specifies-global-proxy";
|
||||||
|
private static final String TAG_MAX_FAILED_PASSWORD_WIPE = "max-failed-password-wipe";
|
||||||
|
private static final String TAG_MAX_TIME_TO_UNLOCK = "max-time-to-unlock";
|
||||||
|
private static final String TAG_MIN_PASSWORD_NONLETTER = "min-password-nonletter";
|
||||||
|
private static final String TAG_MIN_PASSWORD_SYMBOLS = "min-password-symbols";
|
||||||
|
private static final String TAG_MIN_PASSWORD_NUMERIC = "min-password-numeric";
|
||||||
|
private static final String TAG_MIN_PASSWORD_LETTERS = "min-password-letters";
|
||||||
|
private static final String TAG_MIN_PASSWORD_LOWERCASE = "min-password-lowercase";
|
||||||
|
private static final String TAG_MIN_PASSWORD_UPPERCASE = "min-password-uppercase";
|
||||||
|
private static final String TAG_PASSWORD_HISTORY_LENGTH = "password-history-length";
|
||||||
|
private static final String TAG_MIN_PASSWORD_LENGTH = "min-password-length";
|
||||||
|
private static final String ATTR_VALUE = "value";
|
||||||
|
private static final String TAG_PASSWORD_QUALITY = "password-quality";
|
||||||
|
private static final String TAG_POLICIES = "policies";
|
||||||
|
|
||||||
final DeviceAdminInfo info;
|
final DeviceAdminInfo info;
|
||||||
|
|
||||||
int passwordQuality = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
int passwordQuality = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
||||||
@@ -281,103 +303,103 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
|
|
||||||
void writeToXml(XmlSerializer out)
|
void writeToXml(XmlSerializer out)
|
||||||
throws IllegalArgumentException, IllegalStateException, IOException {
|
throws IllegalArgumentException, IllegalStateException, IOException {
|
||||||
out.startTag(null, "policies");
|
out.startTag(null, TAG_POLICIES);
|
||||||
info.writePoliciesToXml(out);
|
info.writePoliciesToXml(out);
|
||||||
out.endTag(null, "policies");
|
out.endTag(null, TAG_POLICIES);
|
||||||
if (passwordQuality != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
if (passwordQuality != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
||||||
out.startTag(null, "password-quality");
|
out.startTag(null, TAG_PASSWORD_QUALITY);
|
||||||
out.attribute(null, "value", Integer.toString(passwordQuality));
|
out.attribute(null, ATTR_VALUE, Integer.toString(passwordQuality));
|
||||||
out.endTag(null, "password-quality");
|
out.endTag(null, TAG_PASSWORD_QUALITY);
|
||||||
if (minimumPasswordLength != DEF_MINIMUM_PASSWORD_LENGTH) {
|
if (minimumPasswordLength != DEF_MINIMUM_PASSWORD_LENGTH) {
|
||||||
out.startTag(null, "min-password-length");
|
out.startTag(null, TAG_MIN_PASSWORD_LENGTH);
|
||||||
out.attribute(null, "value", Integer.toString(minimumPasswordLength));
|
out.attribute(null, ATTR_VALUE, Integer.toString(minimumPasswordLength));
|
||||||
out.endTag(null, "min-password-length");
|
out.endTag(null, TAG_MIN_PASSWORD_LENGTH);
|
||||||
}
|
}
|
||||||
if(passwordHistoryLength != DEF_PASSWORD_HISTORY_LENGTH) {
|
if(passwordHistoryLength != DEF_PASSWORD_HISTORY_LENGTH) {
|
||||||
out.startTag(null, "password-history-length");
|
out.startTag(null, TAG_PASSWORD_HISTORY_LENGTH);
|
||||||
out.attribute(null, "value", Integer.toString(passwordHistoryLength));
|
out.attribute(null, ATTR_VALUE, Integer.toString(passwordHistoryLength));
|
||||||
out.endTag(null, "password-history-length");
|
out.endTag(null, TAG_PASSWORD_HISTORY_LENGTH);
|
||||||
}
|
}
|
||||||
if (minimumPasswordUpperCase != DEF_MINIMUM_PASSWORD_UPPER_CASE) {
|
if (minimumPasswordUpperCase != DEF_MINIMUM_PASSWORD_UPPER_CASE) {
|
||||||
out.startTag(null, "min-password-uppercase");
|
out.startTag(null, TAG_MIN_PASSWORD_UPPERCASE);
|
||||||
out.attribute(null, "value", Integer.toString(minimumPasswordUpperCase));
|
out.attribute(null, ATTR_VALUE, Integer.toString(minimumPasswordUpperCase));
|
||||||
out.endTag(null, "min-password-uppercase");
|
out.endTag(null, TAG_MIN_PASSWORD_UPPERCASE);
|
||||||
}
|
}
|
||||||
if (minimumPasswordLowerCase != DEF_MINIMUM_PASSWORD_LOWER_CASE) {
|
if (minimumPasswordLowerCase != DEF_MINIMUM_PASSWORD_LOWER_CASE) {
|
||||||
out.startTag(null, "min-password-lowercase");
|
out.startTag(null, TAG_MIN_PASSWORD_LOWERCASE);
|
||||||
out.attribute(null, "value", Integer.toString(minimumPasswordLowerCase));
|
out.attribute(null, ATTR_VALUE, Integer.toString(minimumPasswordLowerCase));
|
||||||
out.endTag(null, "min-password-lowercase");
|
out.endTag(null, TAG_MIN_PASSWORD_LOWERCASE);
|
||||||
}
|
}
|
||||||
if (minimumPasswordLetters != DEF_MINIMUM_PASSWORD_LETTERS) {
|
if (minimumPasswordLetters != DEF_MINIMUM_PASSWORD_LETTERS) {
|
||||||
out.startTag(null, "min-password-letters");
|
out.startTag(null, TAG_MIN_PASSWORD_LETTERS);
|
||||||
out.attribute(null, "value", Integer.toString(minimumPasswordLetters));
|
out.attribute(null, ATTR_VALUE, Integer.toString(minimumPasswordLetters));
|
||||||
out.endTag(null, "min-password-letters");
|
out.endTag(null, TAG_MIN_PASSWORD_LETTERS);
|
||||||
}
|
}
|
||||||
if (minimumPasswordNumeric != DEF_MINIMUM_PASSWORD_NUMERIC) {
|
if (minimumPasswordNumeric != DEF_MINIMUM_PASSWORD_NUMERIC) {
|
||||||
out.startTag(null, "min-password-numeric");
|
out.startTag(null, TAG_MIN_PASSWORD_NUMERIC);
|
||||||
out.attribute(null, "value", Integer.toString(minimumPasswordNumeric));
|
out.attribute(null, ATTR_VALUE, Integer.toString(minimumPasswordNumeric));
|
||||||
out.endTag(null, "min-password-numeric");
|
out.endTag(null, TAG_MIN_PASSWORD_NUMERIC);
|
||||||
}
|
}
|
||||||
if (minimumPasswordSymbols != DEF_MINIMUM_PASSWORD_SYMBOLS) {
|
if (minimumPasswordSymbols != DEF_MINIMUM_PASSWORD_SYMBOLS) {
|
||||||
out.startTag(null, "min-password-symbols");
|
out.startTag(null, TAG_MIN_PASSWORD_SYMBOLS);
|
||||||
out.attribute(null, "value", Integer.toString(minimumPasswordSymbols));
|
out.attribute(null, ATTR_VALUE, Integer.toString(minimumPasswordSymbols));
|
||||||
out.endTag(null, "min-password-symbols");
|
out.endTag(null, TAG_MIN_PASSWORD_SYMBOLS);
|
||||||
}
|
}
|
||||||
if (minimumPasswordNonLetter > DEF_MINIMUM_PASSWORD_NON_LETTER) {
|
if (minimumPasswordNonLetter > DEF_MINIMUM_PASSWORD_NON_LETTER) {
|
||||||
out.startTag(null, "min-password-nonletter");
|
out.startTag(null, TAG_MIN_PASSWORD_NONLETTER);
|
||||||
out.attribute(null, "value", Integer.toString(minimumPasswordNonLetter));
|
out.attribute(null, ATTR_VALUE, Integer.toString(minimumPasswordNonLetter));
|
||||||
out.endTag(null, "min-password-nonletter");
|
out.endTag(null, TAG_MIN_PASSWORD_NONLETTER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maximumTimeToUnlock != DEF_MAXIMUM_TIME_TO_UNLOCK) {
|
if (maximumTimeToUnlock != DEF_MAXIMUM_TIME_TO_UNLOCK) {
|
||||||
out.startTag(null, "max-time-to-unlock");
|
out.startTag(null, TAG_MAX_TIME_TO_UNLOCK);
|
||||||
out.attribute(null, "value", Long.toString(maximumTimeToUnlock));
|
out.attribute(null, ATTR_VALUE, Long.toString(maximumTimeToUnlock));
|
||||||
out.endTag(null, "max-time-to-unlock");
|
out.endTag(null, TAG_MAX_TIME_TO_UNLOCK);
|
||||||
}
|
}
|
||||||
if (maximumFailedPasswordsForWipe != DEF_MAXIMUM_FAILED_PASSWORDS_FOR_WIPE) {
|
if (maximumFailedPasswordsForWipe != DEF_MAXIMUM_FAILED_PASSWORDS_FOR_WIPE) {
|
||||||
out.startTag(null, "max-failed-password-wipe");
|
out.startTag(null, TAG_MAX_FAILED_PASSWORD_WIPE);
|
||||||
out.attribute(null, "value", Integer.toString(maximumFailedPasswordsForWipe));
|
out.attribute(null, ATTR_VALUE, Integer.toString(maximumFailedPasswordsForWipe));
|
||||||
out.endTag(null, "max-failed-password-wipe");
|
out.endTag(null, TAG_MAX_FAILED_PASSWORD_WIPE);
|
||||||
}
|
}
|
||||||
if (specifiesGlobalProxy) {
|
if (specifiesGlobalProxy) {
|
||||||
out.startTag(null, "specifies-global-proxy");
|
out.startTag(null, TAG_SPECIFIES_GLOBAL_PROXY);
|
||||||
out.attribute(null, "value", Boolean.toString(specifiesGlobalProxy));
|
out.attribute(null, ATTR_VALUE, Boolean.toString(specifiesGlobalProxy));
|
||||||
out.endTag(null, "specifies_global_proxy");
|
out.endTag(null, TAG_SPECIFIES_GLOBAL_PROXY);
|
||||||
if (globalProxySpec != null) {
|
if (globalProxySpec != null) {
|
||||||
out.startTag(null, "global-proxy-spec");
|
out.startTag(null, TAG_GLOBAL_PROXY_SPEC);
|
||||||
out.attribute(null, "value", globalProxySpec);
|
out.attribute(null, ATTR_VALUE, globalProxySpec);
|
||||||
out.endTag(null, "global-proxy-spec");
|
out.endTag(null, TAG_GLOBAL_PROXY_SPEC);
|
||||||
}
|
}
|
||||||
if (globalProxyExclusionList != null) {
|
if (globalProxyExclusionList != null) {
|
||||||
out.startTag(null, "global-proxy-exclusion-list");
|
out.startTag(null, TAG_GLOBAL_PROXY_EXCLUSION_LIST);
|
||||||
out.attribute(null, "value", globalProxyExclusionList);
|
out.attribute(null, ATTR_VALUE, globalProxyExclusionList);
|
||||||
out.endTag(null, "global-proxy-exclusion-list");
|
out.endTag(null, TAG_GLOBAL_PROXY_EXCLUSION_LIST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (passwordExpirationTimeout != DEF_PASSWORD_EXPIRATION_TIMEOUT) {
|
if (passwordExpirationTimeout != DEF_PASSWORD_EXPIRATION_TIMEOUT) {
|
||||||
out.startTag(null, "password-expiration-timeout");
|
out.startTag(null, TAG_PASSWORD_EXPIRATION_TIMEOUT);
|
||||||
out.attribute(null, "value", Long.toString(passwordExpirationTimeout));
|
out.attribute(null, ATTR_VALUE, Long.toString(passwordExpirationTimeout));
|
||||||
out.endTag(null, "password-expiration-timeout");
|
out.endTag(null, TAG_PASSWORD_EXPIRATION_TIMEOUT);
|
||||||
}
|
}
|
||||||
if (passwordExpirationDate != DEF_PASSWORD_EXPIRATION_DATE) {
|
if (passwordExpirationDate != DEF_PASSWORD_EXPIRATION_DATE) {
|
||||||
out.startTag(null, "password-expiration-date");
|
out.startTag(null, TAG_PASSWORD_EXPIRATION_DATE);
|
||||||
out.attribute(null, "value", Long.toString(passwordExpirationDate));
|
out.attribute(null, ATTR_VALUE, Long.toString(passwordExpirationDate));
|
||||||
out.endTag(null, "password-expiration-date");
|
out.endTag(null, TAG_PASSWORD_EXPIRATION_DATE);
|
||||||
}
|
}
|
||||||
if (encryptionRequested) {
|
if (encryptionRequested) {
|
||||||
out.startTag(null, "encryption-requested");
|
out.startTag(null, TAG_ENCRYPTION_REQUESTED);
|
||||||
out.attribute(null, "value", Boolean.toString(encryptionRequested));
|
out.attribute(null, ATTR_VALUE, Boolean.toString(encryptionRequested));
|
||||||
out.endTag(null, "encryption-requested");
|
out.endTag(null, TAG_ENCRYPTION_REQUESTED);
|
||||||
}
|
}
|
||||||
if (disableCamera) {
|
if (disableCamera) {
|
||||||
out.startTag(null, "disable-camera");
|
out.startTag(null, TAG_DISABLE_CAMERA);
|
||||||
out.attribute(null, "value", Boolean.toString(disableCamera));
|
out.attribute(null, ATTR_VALUE, Boolean.toString(disableCamera));
|
||||||
out.endTag(null, "disable-camera");
|
out.endTag(null, TAG_DISABLE_CAMERA);
|
||||||
}
|
}
|
||||||
if (disabledKeyguardFeatures != DEF_KEYGUARD_FEATURES_DISABLED) {
|
if (disabledKeyguardFeatures != DEF_KEYGUARD_FEATURES_DISABLED) {
|
||||||
out.startTag(null, "disable-keyguard-features");
|
out.startTag(null, TAG_DISABLE_KEYGUARD_FEATURES);
|
||||||
out.attribute(null, "value", Integer.toString(disabledKeyguardFeatures));
|
out.attribute(null, ATTR_VALUE, Integer.toString(disabledKeyguardFeatures));
|
||||||
out.endTag(null, "disable-keyguard-features");
|
out.endTag(null, TAG_DISABLE_KEYGUARD_FEATURES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,67 +413,67 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String tag = parser.getName();
|
String tag = parser.getName();
|
||||||
if ("policies".equals(tag)) {
|
if (TAG_POLICIES.equals(tag)) {
|
||||||
info.readPoliciesFromXml(parser);
|
info.readPoliciesFromXml(parser);
|
||||||
} else if ("password-quality".equals(tag)) {
|
} else if (TAG_PASSWORD_QUALITY.equals(tag)) {
|
||||||
passwordQuality = Integer.parseInt(
|
passwordQuality = Integer.parseInt(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("min-password-length".equals(tag)) {
|
} else if (TAG_MIN_PASSWORD_LENGTH.equals(tag)) {
|
||||||
minimumPasswordLength = Integer.parseInt(
|
minimumPasswordLength = Integer.parseInt(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("password-history-length".equals(tag)) {
|
} else if (TAG_PASSWORD_HISTORY_LENGTH.equals(tag)) {
|
||||||
passwordHistoryLength = Integer.parseInt(
|
passwordHistoryLength = Integer.parseInt(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("min-password-uppercase".equals(tag)) {
|
} else if (TAG_MIN_PASSWORD_UPPERCASE.equals(tag)) {
|
||||||
minimumPasswordUpperCase = Integer.parseInt(
|
minimumPasswordUpperCase = Integer.parseInt(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("min-password-lowercase".equals(tag)) {
|
} else if (TAG_MIN_PASSWORD_LOWERCASE.equals(tag)) {
|
||||||
minimumPasswordLowerCase = Integer.parseInt(
|
minimumPasswordLowerCase = Integer.parseInt(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("min-password-letters".equals(tag)) {
|
} else if (TAG_MIN_PASSWORD_LETTERS.equals(tag)) {
|
||||||
minimumPasswordLetters = Integer.parseInt(
|
minimumPasswordLetters = Integer.parseInt(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("min-password-numeric".equals(tag)) {
|
} else if (TAG_MIN_PASSWORD_NUMERIC.equals(tag)) {
|
||||||
minimumPasswordNumeric = Integer.parseInt(
|
minimumPasswordNumeric = Integer.parseInt(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("min-password-symbols".equals(tag)) {
|
} else if (TAG_MIN_PASSWORD_SYMBOLS.equals(tag)) {
|
||||||
minimumPasswordSymbols = Integer.parseInt(
|
minimumPasswordSymbols = Integer.parseInt(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("min-password-nonletter".equals(tag)) {
|
} else if (TAG_MIN_PASSWORD_NONLETTER.equals(tag)) {
|
||||||
minimumPasswordNonLetter = Integer.parseInt(
|
minimumPasswordNonLetter = Integer.parseInt(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("max-time-to-unlock".equals(tag)) {
|
} else if (TAG_MAX_TIME_TO_UNLOCK.equals(tag)) {
|
||||||
maximumTimeToUnlock = Long.parseLong(
|
maximumTimeToUnlock = Long.parseLong(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("max-failed-password-wipe".equals(tag)) {
|
} else if (TAG_MAX_FAILED_PASSWORD_WIPE.equals(tag)) {
|
||||||
maximumFailedPasswordsForWipe = Integer.parseInt(
|
maximumFailedPasswordsForWipe = Integer.parseInt(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("specifies-global-proxy".equals(tag)) {
|
} else if (TAG_SPECIFIES_GLOBAL_PROXY.equals(tag)) {
|
||||||
specifiesGlobalProxy = Boolean.parseBoolean(
|
specifiesGlobalProxy = Boolean.parseBoolean(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("global-proxy-spec".equals(tag)) {
|
} else if (TAG_GLOBAL_PROXY_SPEC.equals(tag)) {
|
||||||
globalProxySpec =
|
globalProxySpec =
|
||||||
parser.getAttributeValue(null, "value");
|
parser.getAttributeValue(null, ATTR_VALUE);
|
||||||
} else if ("global-proxy-exclusion-list".equals(tag)) {
|
} else if (TAG_GLOBAL_PROXY_EXCLUSION_LIST.equals(tag)) {
|
||||||
globalProxyExclusionList =
|
globalProxyExclusionList =
|
||||||
parser.getAttributeValue(null, "value");
|
parser.getAttributeValue(null, ATTR_VALUE);
|
||||||
} else if ("password-expiration-timeout".equals(tag)) {
|
} else if (TAG_PASSWORD_EXPIRATION_TIMEOUT.equals(tag)) {
|
||||||
passwordExpirationTimeout = Long.parseLong(
|
passwordExpirationTimeout = Long.parseLong(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("password-expiration-date".equals(tag)) {
|
} else if (TAG_PASSWORD_EXPIRATION_DATE.equals(tag)) {
|
||||||
passwordExpirationDate = Long.parseLong(
|
passwordExpirationDate = Long.parseLong(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("encryption-requested".equals(tag)) {
|
} else if (TAG_ENCRYPTION_REQUESTED.equals(tag)) {
|
||||||
encryptionRequested = Boolean.parseBoolean(
|
encryptionRequested = Boolean.parseBoolean(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("disable-camera".equals(tag)) {
|
} else if (TAG_DISABLE_CAMERA.equals(tag)) {
|
||||||
disableCamera = Boolean.parseBoolean(
|
disableCamera = Boolean.parseBoolean(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else if ("disable-keyguard-features".equals(tag)) {
|
} else if (TAG_DISABLE_KEYGUARD_FEATURES.equals(tag)) {
|
||||||
disabledKeyguardFeatures = Integer.parseInt(
|
disabledKeyguardFeatures = Integer.parseInt(
|
||||||
parser.getAttributeValue(null, "value"));
|
parser.getAttributeValue(null, ATTR_VALUE));
|
||||||
} else {
|
} else {
|
||||||
Slog.w(TAG, "Unknown admin tag: " + tag);
|
Slog.w(LOG_TAG, "Unknown admin tag: " + tag);
|
||||||
}
|
}
|
||||||
XmlUtils.skipCurrentTag(parser);
|
XmlUtils.skipCurrentTag(parser);
|
||||||
}
|
}
|
||||||
@@ -513,7 +535,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
|
|
||||||
private void handlePackagesChanged(int userHandle) {
|
private void handlePackagesChanged(int userHandle) {
|
||||||
boolean removed = false;
|
boolean removed = false;
|
||||||
if (DBG) Slog.d(TAG, "Handling package changes for user " + userHandle);
|
if (DBG) Slog.d(LOG_TAG, "Handling package changes for user " + userHandle);
|
||||||
DevicePolicyData policy = getUserData(userHandle);
|
DevicePolicyData policy = getUserData(userHandle);
|
||||||
IPackageManager pm = AppGlobals.getPackageManager();
|
IPackageManager pm = AppGlobals.getPackageManager();
|
||||||
for (int i = policy.mAdminList.size() - 1; i >= 0; i--) {
|
for (int i = policy.mAdminList.size() - 1; i >= 0; i--) {
|
||||||
@@ -585,7 +607,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
void removeUserData(int userHandle) {
|
void removeUserData(int userHandle) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (userHandle == UserHandle.USER_OWNER) {
|
if (userHandle == UserHandle.USER_OWNER) {
|
||||||
Slog.w(TAG, "Tried to remove device policy file for user 0! Ignoring.");
|
Slog.w(LOG_TAG, "Tried to remove device policy file for user 0! Ignoring.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DevicePolicyData policy = mUserData.get(userHandle);
|
DevicePolicyData policy = mUserData.get(userHandle);
|
||||||
@@ -595,7 +617,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
File policyFile = new File(Environment.getUserSystemDirectory(userHandle),
|
File policyFile = new File(Environment.getUserSystemDirectory(userHandle),
|
||||||
DEVICE_POLICIES_XML);
|
DEVICE_POLICIES_XML);
|
||||||
policyFile.delete();
|
policyFile.delete();
|
||||||
Slog.i(TAG, "Removed device policy file " + policyFile.getAbsolutePath());
|
Slog.i(LOG_TAG, "Removed device policy file " + policyFile.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -792,10 +814,12 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
try {
|
try {
|
||||||
return new DeviceAdminInfo(mContext, infos.get(0));
|
return new DeviceAdminInfo(mContext, infos.get(0));
|
||||||
} catch (XmlPullParserException e) {
|
} catch (XmlPullParserException e) {
|
||||||
Slog.w(TAG, "Bad device admin requested for user=" + userHandle + ": " + adminName, e);
|
Slog.w(LOG_TAG, "Bad device admin requested for user=" + userHandle + ": " + adminName,
|
||||||
|
e);
|
||||||
return null;
|
return null;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Slog.w(TAG, "Bad device admin requested for user=" + userHandle + ": " + adminName, e);
|
Slog.w(LOG_TAG, "Bad device admin requested for user=" + userHandle + ": " + adminName,
|
||||||
|
e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -922,7 +946,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
ComponentName.unflattenFromString(name), userHandle);
|
ComponentName.unflattenFromString(name), userHandle);
|
||||||
if (DBG && (UserHandle.getUserId(dai.getActivityInfo().applicationInfo.uid)
|
if (DBG && (UserHandle.getUserId(dai.getActivityInfo().applicationInfo.uid)
|
||||||
!= userHandle)) {
|
!= userHandle)) {
|
||||||
Slog.w(TAG, "findAdmin returned an incorrect uid "
|
Slog.w(LOG_TAG, "findAdmin returned an incorrect uid "
|
||||||
+ dai.getActivityInfo().applicationInfo.uid + " for user "
|
+ dai.getActivityInfo().applicationInfo.uid + " for user "
|
||||||
+ userHandle);
|
+ userHandle);
|
||||||
}
|
}
|
||||||
@@ -933,7 +957,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
policy.mAdminList.add(ap);
|
policy.mAdminList.add(ap);
|
||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Slog.w(TAG, "Failed loading admin " + name, e);
|
Slog.w(LOG_TAG, "Failed loading admin " + name, e);
|
||||||
}
|
}
|
||||||
} else if ("failed-password-attempts".equals(tag)) {
|
} else if ("failed-password-attempts".equals(tag)) {
|
||||||
policy.mFailedPasswordAttempts = Integer.parseInt(
|
policy.mFailedPasswordAttempts = Integer.parseInt(
|
||||||
@@ -962,22 +986,22 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
parser.getAttributeValue(null, "nonletter"));
|
parser.getAttributeValue(null, "nonletter"));
|
||||||
XmlUtils.skipCurrentTag(parser);
|
XmlUtils.skipCurrentTag(parser);
|
||||||
} else {
|
} else {
|
||||||
Slog.w(TAG, "Unknown tag: " + tag);
|
Slog.w(LOG_TAG, "Unknown tag: " + tag);
|
||||||
XmlUtils.skipCurrentTag(parser);
|
XmlUtils.skipCurrentTag(parser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
Slog.w(TAG, "failed parsing " + file + " " + e);
|
Slog.w(LOG_TAG, "failed parsing " + file + " " + e);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Slog.w(TAG, "failed parsing " + file + " " + e);
|
Slog.w(LOG_TAG, "failed parsing " + file + " " + e);
|
||||||
} catch (XmlPullParserException e) {
|
} catch (XmlPullParserException e) {
|
||||||
Slog.w(TAG, "failed parsing " + file + " " + e);
|
Slog.w(LOG_TAG, "failed parsing " + file + " " + e);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
// Don't be noisy, this is normal if we haven't defined any policies.
|
// Don't be noisy, this is normal if we haven't defined any policies.
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Slog.w(TAG, "failed parsing " + file + " " + e);
|
Slog.w(LOG_TAG, "failed parsing " + file + " " + e);
|
||||||
} catch (IndexOutOfBoundsException e) {
|
} catch (IndexOutOfBoundsException e) {
|
||||||
Slog.w(TAG, "failed parsing " + file + " " + e);
|
Slog.w(LOG_TAG, "failed parsing " + file + " " + e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
@@ -993,7 +1017,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
// never normally happen.
|
// never normally happen.
|
||||||
LockPatternUtils utils = new LockPatternUtils(mContext);
|
LockPatternUtils utils = new LockPatternUtils(mContext);
|
||||||
if (utils.getActivePasswordQuality() < policy.mActivePasswordQuality) {
|
if (utils.getActivePasswordQuality() < policy.mActivePasswordQuality) {
|
||||||
Slog.w(TAG, "Active password quality 0x"
|
Slog.w(LOG_TAG, "Active password quality 0x"
|
||||||
+ Integer.toHexString(policy.mActivePasswordQuality)
|
+ Integer.toHexString(policy.mActivePasswordQuality)
|
||||||
+ " does not match actual quality 0x"
|
+ " does not match actual quality 0x"
|
||||||
+ Integer.toHexString(utils.getActivePasswordQuality()));
|
+ Integer.toHexString(utils.getActivePasswordQuality()));
|
||||||
@@ -1037,7 +1061,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!haveOwner) {
|
if (!haveOwner) {
|
||||||
Slog.w(TAG, "Previous password owner " + policy.mPasswordOwner
|
Slog.w(LOG_TAG, "Previous password owner " + policy.mPasswordOwner
|
||||||
+ " no longer active; disabling");
|
+ " no longer active; disabling");
|
||||||
policy.mPasswordOwner = -1;
|
policy.mPasswordOwner = -1;
|
||||||
}
|
}
|
||||||
@@ -1057,7 +1081,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
long token = Binder.clearCallingIdentity();
|
long token = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
String value = cameraDisabled ? "1" : "0";
|
String value = cameraDisabled ? "1" : "0";
|
||||||
if (DBG) Slog.v(TAG, "Change in camera state ["
|
if (DBG) Slog.v(LOG_TAG, "Change in camera state ["
|
||||||
+ SYSTEM_PROP_DISABLE_CAMERA + "] = " + value);
|
+ SYSTEM_PROP_DISABLE_CAMERA + "] = " + value);
|
||||||
SystemProperties.set(SYSTEM_PROP_DISABLE_CAMERA, value);
|
SystemProperties.set(SYSTEM_PROP_DISABLE_CAMERA, value);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -1173,7 +1197,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
long ident = Binder.clearCallingIdentity();
|
long ident = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
if (!refreshing && getActiveAdminUncheckedLocked(adminReceiver, userHandle) != null) {
|
if (!refreshing
|
||||||
|
&& getActiveAdminUncheckedLocked(adminReceiver, userHandle) != null) {
|
||||||
throw new IllegalArgumentException("Admin is already added");
|
throw new IllegalArgumentException("Admin is already added");
|
||||||
}
|
}
|
||||||
ActiveAdmin newAdmin = new ActiveAdmin(info);
|
ActiveAdmin newAdmin = new ActiveAdmin(info);
|
||||||
@@ -1443,7 +1468,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
ap.passwordExpirationDate = expiration;
|
ap.passwordExpirationDate = expiration;
|
||||||
ap.passwordExpirationTimeout = timeout;
|
ap.passwordExpirationTimeout = timeout;
|
||||||
if (timeout > 0L) {
|
if (timeout > 0L) {
|
||||||
Slog.w(TAG, "setPasswordExpiration(): password will expire on "
|
Slog.w(LOG_TAG, "setPasswordExpiration(): password will expire on "
|
||||||
+ DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT)
|
+ DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT)
|
||||||
.format(new Date(expiration)));
|
.format(new Date(expiration)));
|
||||||
}
|
}
|
||||||
@@ -1789,11 +1814,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return policy.mActivePasswordUpperCase >= getPasswordMinimumUpperCase(null, userHandle)
|
return policy.mActivePasswordUpperCase >= getPasswordMinimumUpperCase(null, userHandle)
|
||||||
&& policy.mActivePasswordLowerCase >= getPasswordMinimumLowerCase(null, userHandle)
|
&& policy.mActivePasswordLowerCase >= getPasswordMinimumLowerCase(null, userHandle)
|
||||||
&& policy.mActivePasswordLetters >= getPasswordMinimumLetters(null, userHandle)
|
&& policy.mActivePasswordLetters >= getPasswordMinimumLetters(null, userHandle)
|
||||||
&& policy.mActivePasswordNumeric >= getPasswordMinimumNumeric(null, userHandle)
|
&& policy.mActivePasswordNumeric >= getPasswordMinimumNumeric(null, userHandle)
|
||||||
&& policy.mActivePasswordSymbols >= getPasswordMinimumSymbols(null, userHandle)
|
&& policy.mActivePasswordSymbols >= getPasswordMinimumSymbols(null, userHandle)
|
||||||
&& policy.mActivePasswordNonLetter >= getPasswordMinimumNonLetter(null, userHandle);
|
&& policy.mActivePasswordNonLetter >= getPasswordMinimumNonLetter(null, userHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1871,7 +1896,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
int realQuality = LockPatternUtils.computePasswordQuality(password);
|
int realQuality = LockPatternUtils.computePasswordQuality(password);
|
||||||
if (realQuality < quality
|
if (realQuality < quality
|
||||||
&& quality != DevicePolicyManager.PASSWORD_QUALITY_COMPLEX) {
|
&& quality != DevicePolicyManager.PASSWORD_QUALITY_COMPLEX) {
|
||||||
Slog.w(TAG, "resetPassword: password quality 0x"
|
Slog.w(LOG_TAG, "resetPassword: password quality 0x"
|
||||||
+ Integer.toHexString(realQuality)
|
+ Integer.toHexString(realQuality)
|
||||||
+ " does not meet required quality 0x"
|
+ " does not meet required quality 0x"
|
||||||
+ Integer.toHexString(quality));
|
+ Integer.toHexString(quality));
|
||||||
@@ -1881,7 +1906,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
}
|
}
|
||||||
int length = getPasswordMinimumLength(null, userHandle);
|
int length = getPasswordMinimumLength(null, userHandle);
|
||||||
if (password.length() < length) {
|
if (password.length() < length) {
|
||||||
Slog.w(TAG, "resetPassword: password length " + password.length()
|
Slog.w(LOG_TAG, "resetPassword: password length " + password.length()
|
||||||
+ " does not meet required length " + length);
|
+ " does not meet required length " + length);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1910,40 +1935,40 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
}
|
}
|
||||||
int neededLetters = getPasswordMinimumLetters(null, userHandle);
|
int neededLetters = getPasswordMinimumLetters(null, userHandle);
|
||||||
if(letters < neededLetters) {
|
if(letters < neededLetters) {
|
||||||
Slog.w(TAG, "resetPassword: number of letters " + letters
|
Slog.w(LOG_TAG, "resetPassword: number of letters " + letters
|
||||||
+ " does not meet required number of letters " + neededLetters);
|
+ " does not meet required number of letters " + neededLetters);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int neededNumbers = getPasswordMinimumNumeric(null, userHandle);
|
int neededNumbers = getPasswordMinimumNumeric(null, userHandle);
|
||||||
if (numbers < neededNumbers) {
|
if (numbers < neededNumbers) {
|
||||||
Slog.w(TAG, "resetPassword: number of numerical digits " + numbers
|
Slog.w(LOG_TAG, "resetPassword: number of numerical digits " + numbers
|
||||||
+ " does not meet required number of numerical digits "
|
+ " does not meet required number of numerical digits "
|
||||||
+ neededNumbers);
|
+ neededNumbers);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int neededLowerCase = getPasswordMinimumLowerCase(null, userHandle);
|
int neededLowerCase = getPasswordMinimumLowerCase(null, userHandle);
|
||||||
if (lowercase < neededLowerCase) {
|
if (lowercase < neededLowerCase) {
|
||||||
Slog.w(TAG, "resetPassword: number of lowercase letters " + lowercase
|
Slog.w(LOG_TAG, "resetPassword: number of lowercase letters " + lowercase
|
||||||
+ " does not meet required number of lowercase letters "
|
+ " does not meet required number of lowercase letters "
|
||||||
+ neededLowerCase);
|
+ neededLowerCase);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int neededUpperCase = getPasswordMinimumUpperCase(null, userHandle);
|
int neededUpperCase = getPasswordMinimumUpperCase(null, userHandle);
|
||||||
if (uppercase < neededUpperCase) {
|
if (uppercase < neededUpperCase) {
|
||||||
Slog.w(TAG, "resetPassword: number of uppercase letters " + uppercase
|
Slog.w(LOG_TAG, "resetPassword: number of uppercase letters " + uppercase
|
||||||
+ " does not meet required number of uppercase letters "
|
+ " does not meet required number of uppercase letters "
|
||||||
+ neededUpperCase);
|
+ neededUpperCase);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int neededSymbols = getPasswordMinimumSymbols(null, userHandle);
|
int neededSymbols = getPasswordMinimumSymbols(null, userHandle);
|
||||||
if (symbols < neededSymbols) {
|
if (symbols < neededSymbols) {
|
||||||
Slog.w(TAG, "resetPassword: number of special symbols " + symbols
|
Slog.w(LOG_TAG, "resetPassword: number of special symbols " + symbols
|
||||||
+ " does not meet required number of special symbols " + neededSymbols);
|
+ " does not meet required number of special symbols " + neededSymbols);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int neededNonLetter = getPasswordMinimumNonLetter(null, userHandle);
|
int neededNonLetter = getPasswordMinimumNonLetter(null, userHandle);
|
||||||
if (nonletter < neededNonLetter) {
|
if (nonletter < neededNonLetter) {
|
||||||
Slog.w(TAG, "resetPassword: number of non-letter characters " + nonletter
|
Slog.w(LOG_TAG, "resetPassword: number of non-letter characters " + nonletter
|
||||||
+ " does not meet required number of non-letter characters "
|
+ " does not meet required number of non-letter characters "
|
||||||
+ neededNonLetter);
|
+ neededNonLetter);
|
||||||
return false;
|
return false;
|
||||||
@@ -1954,7 +1979,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
int callingUid = Binder.getCallingUid();
|
int callingUid = Binder.getCallingUid();
|
||||||
DevicePolicyData policy = getUserData(userHandle);
|
DevicePolicyData policy = getUserData(userHandle);
|
||||||
if (policy.mPasswordOwner >= 0 && policy.mPasswordOwner != callingUid) {
|
if (policy.mPasswordOwner >= 0 && policy.mPasswordOwner != callingUid) {
|
||||||
Slog.w(TAG, "resetPassword: already set by another uid and not entered by user");
|
Slog.w(LOG_TAG, "resetPassword: already set by another uid and not entered by user");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2020,7 +2045,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
try {
|
try {
|
||||||
getIPowerManager().setMaximumScreenOffTimeoutFromDeviceAdmin((int)timeMs);
|
getIPowerManager().setMaximumScreenOffTimeoutFromDeviceAdmin((int)timeMs);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.w(TAG, "Failure talking with power manager", e);
|
Slog.w(LOG_TAG, "Failure talking with power manager", e);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(ident);
|
Binder.restoreCallingIdentity(ident);
|
||||||
@@ -2095,10 +2120,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
X509Certificate cert = parseCert(certBuffer);
|
X509Certificate cert = parseCert(certBuffer);
|
||||||
pemCert = Credentials.convertToPem(cert);
|
pemCert = Credentials.convertToPem(cert);
|
||||||
} catch (CertificateException ce) {
|
} catch (CertificateException ce) {
|
||||||
Log.e(TAG, "Problem converting cert", ce);
|
Log.e(LOG_TAG, "Problem converting cert", ce);
|
||||||
return false;
|
return false;
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.e(TAG, "Problem reading cert", ioe);
|
Log.e(LOG_TAG, "Problem reading cert", ioe);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -2113,7 +2138,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e1) {
|
} catch (InterruptedException e1) {
|
||||||
Log.w(TAG, "installCaCertsToKeyChain(): ", e1);
|
Log.w(LOG_TAG, "installCaCertsToKeyChain(): ", e1);
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -2134,10 +2159,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
X509Certificate cert = parseCert(certBuffer);
|
X509Certificate cert = parseCert(certBuffer);
|
||||||
alias = certStore.getCertificateAlias(cert);
|
alias = certStore.getCertificateAlias(cert);
|
||||||
} catch (CertificateException ce) {
|
} catch (CertificateException ce) {
|
||||||
Log.e(TAG, "Problem creating X509Certificate", ce);
|
Log.e(LOG_TAG, "Problem creating X509Certificate", ce);
|
||||||
return;
|
return;
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.e(TAG, "Problem reading certificate", ioe);
|
Log.e(LOG_TAG, "Problem reading certificate", ioe);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -2146,13 +2171,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
try {
|
try {
|
||||||
service.deleteCaCertificate(alias);
|
service.deleteCaCertificate(alias);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "from CaCertUninstaller: ", e);
|
Log.e(LOG_TAG, "from CaCertUninstaller: ", e);
|
||||||
} finally {
|
} finally {
|
||||||
keyChainConnection.close();
|
keyChainConnection.close();
|
||||||
keyChainConnection = null;
|
keyChainConnection = null;
|
||||||
}
|
}
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
Log.w(TAG, "CaCertUninstaller: ", ie);
|
Log.w(LOG_TAG, "CaCertUninstaller: ", ie);
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2173,7 +2198,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
try {
|
try {
|
||||||
RecoverySystem.rebootWipeUserData(mContext);
|
RecoverySystem.rebootWipeUserData(mContext);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Slog.w(TAG, "Failed requesting data wipe", e);
|
Slog.w(LOG_TAG, "Failed requesting data wipe", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2264,8 +2289,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
if (p.mActivePasswordQuality != quality || p.mActivePasswordLength != length
|
if (p.mActivePasswordQuality != quality || p.mActivePasswordLength != length
|
||||||
|| p.mFailedPasswordAttempts != 0 || p.mActivePasswordLetters != letters
|
|| p.mFailedPasswordAttempts != 0 || p.mActivePasswordLetters != letters
|
||||||
|| p.mActivePasswordUpperCase != uppercase
|
|| p.mActivePasswordUpperCase != uppercase
|
||||||
|| p.mActivePasswordLowerCase != lowercase || p.mActivePasswordNumeric != numbers
|
|| p.mActivePasswordLowerCase != lowercase
|
||||||
|| p.mActivePasswordSymbols != symbols || p.mActivePasswordNonLetter != nonletter) {
|
|| p.mActivePasswordNumeric != numbers
|
||||||
|
|| p.mActivePasswordSymbols != symbols
|
||||||
|
|| p.mActivePasswordNonLetter != nonletter) {
|
||||||
long ident = Binder.clearCallingIdentity();
|
long ident = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
p.mActivePasswordQuality = quality;
|
p.mActivePasswordQuality = quality;
|
||||||
@@ -2387,7 +2414,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
|
|
||||||
// If the user is not the owner, don't set the global proxy. Fail silently.
|
// If the user is not the owner, don't set the global proxy. Fail silently.
|
||||||
if (UserHandle.getCallingUserId() != UserHandle.USER_OWNER) {
|
if (UserHandle.getCallingUserId() != UserHandle.USER_OWNER) {
|
||||||
Slog.w(TAG, "Only the owner is allowed to set the global proxy. User "
|
Slog.w(LOG_TAG, "Only the owner is allowed to set the global proxy. User "
|
||||||
+ userHandle + " is not permitted.");
|
+ userHandle + " is not permitted.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -2468,7 +2495,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
|
|
||||||
ProxyProperties proxyProperties = new ProxyProperties(data[0], proxyPort, exclusionList);
|
ProxyProperties proxyProperties = new ProxyProperties(data[0], proxyPort, exclusionList);
|
||||||
if (!proxyProperties.isValid()) {
|
if (!proxyProperties.isValid()) {
|
||||||
Slog.e(TAG, "Invalid proxy properties, ignoring: " + proxyProperties.toString());
|
Slog.e(LOG_TAG, "Invalid proxy properties, ignoring: " + proxyProperties.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST, data[0]);
|
Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST, data[0]);
|
||||||
@@ -2494,7 +2521,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
// Only owner can set storage encryption
|
// Only owner can set storage encryption
|
||||||
if (userHandle != UserHandle.USER_OWNER
|
if (userHandle != UserHandle.USER_OWNER
|
||||||
|| UserHandle.getCallingUserId() != UserHandle.USER_OWNER) {
|
|| UserHandle.getCallingUserId() != UserHandle.USER_OWNER) {
|
||||||
Slog.w(TAG, "Only owner is allowed to set storage encryption. User "
|
Slog.w(LOG_TAG, "Only owner is allowed to set storage encryption. User "
|
||||||
+ UserHandle.getCallingUserId() + " is not permitted.");
|
+ UserHandle.getCallingUserId() + " is not permitted.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2880,7 +2907,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NameNotFoundException nnfe) {
|
} catch (NameNotFoundException nnfe) {
|
||||||
Slog.w(TAG, "Device Owner package " + packageName + " not installed.");
|
Slog.w(LOG_TAG, "Device Owner package " + packageName + " not installed.");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2905,9 +2932,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
mOwnerName = parser.getAttributeValue(null, ATTR_NAME);
|
mOwnerName = parser.getAttributeValue(null, ATTR_NAME);
|
||||||
input.close();
|
input.close();
|
||||||
} catch (XmlPullParserException xppe) {
|
} catch (XmlPullParserException xppe) {
|
||||||
Slog.e(TAG, "Error parsing device-owner file\n" + xppe);
|
Slog.e(LOG_TAG, "Error parsing device-owner file\n" + xppe);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Slog.e(TAG, "IO Exception when reading device-owner file\n" + ioe);
|
Slog.e(LOG_TAG, "IO Exception when reading device-owner file\n" + ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2935,7 +2962,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
out.flush();
|
out.flush();
|
||||||
file.finishWrite(output);
|
file.finishWrite(output);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Slog.e(TAG, "IO Exception when writing device-owner file\n" + ioe);
|
Slog.e(LOG_TAG, "IO Exception when writing device-owner file\n" + ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user