import android.os.Bundle;
import android.os.Process;
import android.os.UserHandle;
+import android.os.UserManager;
import android.security.KeyStore;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
// what makes sense with disabled == true
private void maybeEnableEncryption(int quality, boolean disabled) {
DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(DEVICE_POLICY_SERVICE);
- if (Process.myUserHandle().isOwner() && LockPatternUtils.isDeviceEncryptionEnabled()
+ if (UserManager.get(getActivity()).isAdminUser()
+ && LockPatternUtils.isDeviceEncryptionEnabled()
&& !dpm.getDoNotAskCredentialsOnBoot()) {
mEncryptionRequestQuality = quality;
mEncryptionRequestDisabled = disabled;
import android.os.RemoteCallback;
import android.os.RemoteException;
import android.os.UserHandle;
+import android.os.UserManager;
import android.text.TextUtils.TruncateAt;
import android.util.EventLog;
import android.util.Log;
private void addDeviceAdminPolicies(boolean showDescription) {
if (!mAdminPoliciesInitialized) {
- boolean isOwner = Binder.getCallingUserHandle().isOwner();
+ boolean isAdminUser = UserManager.get(this).isAdminUser();
for (DeviceAdminInfo.PolicyInfo pi : mDeviceAdmin.getUsedPolicies()) {
- int descriptionId = isOwner ? pi.description : pi.descriptionForSecondaryUsers;
- int labelId = isOwner ? pi.label : pi.labelForSecondaryUsers;
+ int descriptionId = isAdminUser ? pi.description : pi.descriptionForSecondaryUsers;
+ int labelId = isAdminUser ? pi.label : pi.labelForSecondaryUsers;
View view = AppSecurityPermissions.getPermissionItemView(this, getText(labelId),
showDescription ? getText(descriptionId) : "", true);
mAdminPolicies.addView(view);