Part3 - Don't add padlock if the restriction is not set by admin.
Bug: 26687435 Change-Id: Ibfea6d7d5bd32e7a05dcc2cc32b121c9e50b6a34
This commit is contained in:
@@ -81,7 +81,9 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
|
||||
private UserManager mUm;
|
||||
|
||||
private EnforcedAdmin mFunDisallowedAdmin;
|
||||
private boolean mFunDisallowedBySystem;
|
||||
private EnforcedAdmin mDebuggingFeaturesDisallowedAdmin;
|
||||
private boolean mDebuggingFeaturesDisallowedBySystem;
|
||||
|
||||
@Override
|
||||
protected int getMetricsCategory() {
|
||||
@@ -192,8 +194,12 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
|
||||
mDevHitToast = null;
|
||||
mFunDisallowedAdmin = RestrictedLockUtils.checkIfRestrictionEnforced(
|
||||
getActivity(), UserManager.DISALLOW_FUN, UserHandle.myUserId());
|
||||
mFunDisallowedBySystem = RestrictedLockUtils.hasBaseUserRestriction(
|
||||
getActivity(), UserManager.DISALLOW_FUN, UserHandle.myUserId());
|
||||
mDebuggingFeaturesDisallowedAdmin = RestrictedLockUtils.checkIfRestrictionEnforced(
|
||||
getActivity(), UserManager.DISALLOW_DEBUGGING_FEATURES, UserHandle.myUserId());
|
||||
mDebuggingFeaturesDisallowedBySystem = RestrictedLockUtils.hasBaseUserRestriction(
|
||||
getActivity(), UserManager.DISALLOW_DEBUGGING_FEATURES, UserHandle.myUserId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -202,9 +208,11 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
|
||||
System.arraycopy(mHits, 1, mHits, 0, mHits.length-1);
|
||||
mHits[mHits.length-1] = SystemClock.uptimeMillis();
|
||||
if (mHits[0] >= (SystemClock.uptimeMillis()-500)) {
|
||||
if (mFunDisallowedAdmin != null) {
|
||||
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getActivity(),
|
||||
mFunDisallowedAdmin);
|
||||
if (mUm.hasUserRestriction(UserManager.DISALLOW_FUN)) {
|
||||
if (mFunDisallowedAdmin != null && !mFunDisallowedBySystem) {
|
||||
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getActivity(),
|
||||
mFunDisallowedAdmin);
|
||||
}
|
||||
Log.d(LOG_TAG, "Sorry, no fun for you!");
|
||||
return false;
|
||||
}
|
||||
@@ -228,9 +236,12 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mDebuggingFeaturesDisallowedAdmin != null) {
|
||||
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getActivity(),
|
||||
mDebuggingFeaturesDisallowedAdmin);
|
||||
if (mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) {
|
||||
if (mDebuggingFeaturesDisallowedAdmin != null &&
|
||||
!mDebuggingFeaturesDisallowedBySystem) {
|
||||
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getActivity(),
|
||||
mDebuggingFeaturesDisallowedAdmin);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user