Disable factory reset for secondary users

Search in Settings makes it possible to find the factory reset screen.
Disable the search index in PrivacySettings so that backup and reset
keywords don't get indexed for secondary users.
Also add additional safeguards for other entry points such as public
intents, so that the backup/reset screen does not show any options.

Bug: 18076086
Change-Id: Ie5135fbf4084038c99947a1a107ab4758f0c15a9
This commit is contained in:
Amith Yamasani
2014-10-22 13:51:53 -07:00
parent 795c837807
commit 4339a470d3
3 changed files with 59 additions and 4 deletions

View File

@@ -28,6 +28,7 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Environment;
import android.os.Process;
import android.os.SystemProperties;
import android.os.UserManager;
import android.preference.Preference;
@@ -234,7 +235,8 @@ public class MasterClear extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (UserManager.get(getActivity()).hasUserRestriction(
if (!Process.myUserHandle().isOwner()
|| UserManager.get(getActivity()).hasUserRestriction(
UserManager.DISALLOW_FACTORY_RESET)) {
return inflater.inflate(R.layout.master_clear_disallowed_screen, null);
}