diff --git a/res/values/strings.xml b/res/values/strings.xml
index 237d05c7cb2..6acd1276bb0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -8780,7 +8780,8 @@
Connect to the Internet or contact your carrier
Unavailable on carrier-locked devices
-
+
+ Please restart the device to enable device protection feature.
%1$s total made available\n\nLast ran on %2$s
diff --git a/src/com/android/settings/development/OemLockInfoDialog.java b/src/com/android/settings/development/OemLockInfoDialog.java
new file mode 100644
index 00000000000..6d7581272dc
--- /dev/null
+++ b/src/com/android/settings/development/OemLockInfoDialog.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.os.Bundle;
+
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
+import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+
+public class OemLockInfoDialog extends InstrumentedDialogFragment {
+
+ private static final String TAG = "OemLockInfoDialog";
+
+ public static void show(Fragment host) {
+ final FragmentManager manager = host.getChildFragmentManager();
+ if (manager.findFragmentByTag(TAG) == null) {
+ final OemLockInfoDialog dialog = new OemLockInfoDialog();
+ dialog.show(manager, TAG);
+ }
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ return MetricsProto.MetricsEvent.DIALOG_OEM_LOCK_INFO;
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
+ .setMessage(R.string.oem_lock_info_message);
+
+ return builder.create();
+ }
+}
diff --git a/src/com/android/settings/development/OemUnlockPreferenceController.java b/src/com/android/settings/development/OemUnlockPreferenceController.java
index 91994c2d644..f486b3d3d29 100644
--- a/src/com/android/settings/development/OemUnlockPreferenceController.java
+++ b/src/com/android/settings/development/OemUnlockPreferenceController.java
@@ -90,6 +90,7 @@ public class OemUnlockPreferenceController extends DeveloperOptionsPreferenceCon
}
} else {
mOemLockManager.setOemUnlockAllowedByUser(false);
+ OemLockInfoDialog.show(mFragment);
}
return true;
}
diff --git a/tests/robotests/src/com/android/settings/development/OemUnlockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/OemUnlockPreferenceControllerTest.java
index 13678703bd8..f59c29fc6bd 100644
--- a/tests/robotests/src/com/android/settings/development/OemUnlockPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/OemUnlockPreferenceControllerTest.java
@@ -18,18 +18,17 @@ package com.android.settings.development;
import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes
.REQUEST_CODE_ENABLE_OEM_UNLOCK;
-
import static com.google.common.truth.Truth.assertThat;
-
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.app.Activity;
+import android.app.FragmentManager;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.res.Resources;
import android.os.UserManager;
import android.service.oemlock.OemLockManager;
@@ -43,6 +42,7 @@ import com.android.settingslib.RestrictedSwitchPreference;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
@@ -81,6 +81,8 @@ public class OemUnlockPreferenceControllerTest {
mController = new OemUnlockPreferenceController(mContext, mActivity, mFragment);
when(mPreferenceScreen.findPreference(mController.getPreferenceKey())).thenReturn(
mPreference);
+ when(mFragment.getChildFragmentManager()).thenReturn(
+ mock(FragmentManager.class, Answers.RETURNS_DEEP_STUBS));
mController.displayPreference(mPreferenceScreen);
}
@@ -114,8 +116,8 @@ public class OemUnlockPreferenceControllerTest {
@Test
public void onPreferenceChanged_turnOffUnlock() {
mController.onPreferenceChange(null, false);
-
verify(mOemLockManager).setOemUnlockAllowedByUser(false);
+ verify(mFragment).getChildFragmentManager();
}
@Test