Merge "Safecty checker improvements on DevicePolicyManagerService." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3888076437
@@ -1139,6 +1139,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSafeOperation(@OperationSafetyReason int reason) {
|
public boolean isSafeOperation(@OperationSafetyReason int reason) {
|
||||||
|
if (VERBOSE_LOG) {
|
||||||
|
Slog.v(LOG_TAG, "checking isSafeOperation("
|
||||||
|
+ DevicePolicyManager.operationSafetyReasonToString(reason)
|
||||||
|
+ ") using mSafetyChecker " + mSafetyChecker);
|
||||||
|
}
|
||||||
return mSafetyChecker == null ? true : mSafetyChecker.isSafeOperation(reason);
|
return mSafetyChecker == null ? true : mSafetyChecker.isSafeOperation(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9175,8 +9180,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
|||||||
pw.printf("mIsWatch=%b\n", mIsWatch);
|
pw.printf("mIsWatch=%b\n", mIsWatch);
|
||||||
pw.printf("mIsAutomotive=%b\n", mIsAutomotive);
|
pw.printf("mIsAutomotive=%b\n", mIsAutomotive);
|
||||||
pw.printf("mHasTelephonyFeature=%b\n", mHasTelephonyFeature);
|
pw.printf("mHasTelephonyFeature=%b\n", mHasTelephonyFeature);
|
||||||
String safetyChecker = mSafetyChecker == null ? "N/A" : mSafetyChecker.getClass().getName();
|
pw.printf("mSafetyChecker=%s\n", mSafetyChecker);
|
||||||
pw.printf("mSafetyChecker=%b\n", safetyChecker);
|
|
||||||
pw.decreaseIndent();
|
pw.decreaseIndent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ final class OneTimeSafetyChecker implements DevicePolicySafetyChecker {
|
|||||||
Slog.i(TAG, "notifying " + reasonName + " is inactive");
|
Slog.i(TAG, "notifying " + reasonName + " is inactive");
|
||||||
dpmi.notifyUnsafeOperationStateChanged(this, reason, false);
|
dpmi.notifyUnsafeOperationStateChanged(this, reason, false);
|
||||||
|
|
||||||
Slog.i(TAG, "returning " + reasonName
|
Slog.i(TAG, "returning " + reasonName);
|
||||||
+ " and restoring DevicePolicySafetyChecker to " + mRealSafetyChecker);
|
|
||||||
mService.setDevicePolicySafetyCheckerUnchecked(mRealSafetyChecker);
|
disableSelf();
|
||||||
return reason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,6 +89,7 @@ final class OneTimeSafetyChecker implements DevicePolicySafetyChecker {
|
|||||||
boolean safe = mReason != reason;
|
boolean safe = mReason != reason;
|
||||||
Slog.i(TAG, "isSafeOperation(" + operationSafetyReasonToString(reason) + "): " + safe);
|
Slog.i(TAG, "isSafeOperation(" + operationSafetyReasonToString(reason) + "): " + safe);
|
||||||
|
|
||||||
|
disableSelf();
|
||||||
return safe;
|
return safe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,4 +97,16 @@ final class OneTimeSafetyChecker implements DevicePolicySafetyChecker {
|
|||||||
public void onFactoryReset(IResultReceiver callback) {
|
public void onFactoryReset(IResultReceiver callback) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void disableSelf() {
|
||||||
|
Slog.i(TAG, "restoring DevicePolicySafetyChecker to " + mRealSafetyChecker);
|
||||||
|
mService.setDevicePolicySafetyCheckerUnchecked(mRealSafetyChecker);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "OneTimeSafetyChecker[id=" + System.identityHashCode(this)
|
||||||
|
+ ", reason=" + operationSafetyReasonToString(mReason)
|
||||||
|
+ ", operation=" + operationToString(mOperation) + ']';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user