- Prevent external tiles from system apps
- Don't let user settings run
- Disable help
Bug:
29194585
Change-Id: I74ab8aaab62d62cc4dbbdf3164429a503f3a572b
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources.Theme;
import android.net.Uri;
+import android.provider.Settings.Global;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;
*/
public static boolean prepareHelpMenuItem(final Activity activity, MenuItem helpMenuItem,
String helpUriString, String backupContext) {
+ if (Global.getInt(activity.getContentResolver(), Global.DEVICE_PROVISIONED, 0) == 0) {
+ return false;
+ }
if (TextUtils.isEmpty(helpUriString)) {
// The help url string is empty or null, so set the help menu item to be invisible.
helpMenuItem.setVisible(false);
public static Intent getHelpIntent(Context context, String helpUriString,
String backupContext) {
+ if (Global.getInt(context.getContentResolver(), Global.DEVICE_PROVISIONED, 0) == 0) {
+ return null;
+ }
// Try to handle as Intent Uri, otherwise just treat as Uri.
try {
Intent intent = Intent.parseUri(helpUriString,
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
+import android.provider.Settings.Global;
import android.text.TextUtils;
import android.transition.TransitionManager;
import android.util.ArrayMap;
}
private void addExternalTiles(List<DashboardCategory> target) {
+ if (Global.getInt(getContentResolver(), Global.DEVICE_PROVISIONED, 0) == 0) {
+ // Don't add external tiles until device is set up.
+ return;
+ }
Map<Pair<String, String>, DashboardTile> addedCache =
new ArrayMap<Pair<String, String>, DashboardTile>();
UserManager userManager = UserManager.get(this);
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.provider.Settings;
+import android.provider.Settings.Global;
import android.provider.Settings.Secure;
import android.util.Log;
import android.util.SparseArray;
filter.addAction(Intent.ACTION_USER_INFO_CHANGED);
context.registerReceiverAsUser(mUserChangeReceiver, UserHandle.ALL, filter, null,
mHandler);
+
+ if (Global.getInt(getContext().getContentResolver(), Global.DEVICE_PROVISIONED, 0) == 0) {
+ getActivity().finish();
+ return;
+ }
}
@Override