Merge "Pre-setup restrictions" into nyc-dev
This commit is contained in:
@@ -25,6 +25,7 @@ import android.content.pm.PackageInfo;
|
|||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.res.Resources.Theme;
|
import android.content.res.Resources.Theme;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.provider.Settings.Global;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
@@ -91,6 +92,9 @@ public class HelpUtils {
|
|||||||
*/
|
*/
|
||||||
public static boolean prepareHelpMenuItem(final Activity activity, MenuItem helpMenuItem,
|
public static boolean prepareHelpMenuItem(final Activity activity, MenuItem helpMenuItem,
|
||||||
String helpUriString, String backupContext) {
|
String helpUriString, String backupContext) {
|
||||||
|
if (Global.getInt(activity.getContentResolver(), Global.DEVICE_PROVISIONED, 0) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (TextUtils.isEmpty(helpUriString)) {
|
if (TextUtils.isEmpty(helpUriString)) {
|
||||||
// The help url string is empty or null, so set the help menu item to be invisible.
|
// The help url string is empty or null, so set the help menu item to be invisible.
|
||||||
helpMenuItem.setVisible(false);
|
helpMenuItem.setVisible(false);
|
||||||
@@ -128,6 +132,9 @@ public class HelpUtils {
|
|||||||
|
|
||||||
public static Intent getHelpIntent(Context context, String helpUriString,
|
public static Intent getHelpIntent(Context context, String helpUriString,
|
||||||
String backupContext) {
|
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 to handle as Intent Uri, otherwise just treat as Uri.
|
||||||
try {
|
try {
|
||||||
Intent intent = Intent.parseUri(helpUriString,
|
Intent intent = Intent.parseUri(helpUriString,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import android.graphics.drawable.Icon;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
import android.provider.Settings.Global;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
@@ -115,6 +116,8 @@ public class TileUtils {
|
|||||||
public static List<DashboardCategory> getCategories(Context context,
|
public static List<DashboardCategory> getCategories(Context context,
|
||||||
HashMap<Pair<String, String>, Tile> cache) {
|
HashMap<Pair<String, String>, Tile> cache) {
|
||||||
final long startTime = System.currentTimeMillis();
|
final long startTime = System.currentTimeMillis();
|
||||||
|
boolean setup = Global.getInt(context.getContentResolver(), Global.DEVICE_PROVISIONED, 0)
|
||||||
|
!= 0;
|
||||||
ArrayList<Tile> tiles = new ArrayList<>();
|
ArrayList<Tile> tiles = new ArrayList<>();
|
||||||
UserManager userManager = UserManager.get(context);
|
UserManager userManager = UserManager.get(context);
|
||||||
for (UserHandle user : userManager.getUserProfiles()) {
|
for (UserHandle user : userManager.getUserProfiles()) {
|
||||||
@@ -127,8 +130,10 @@ public class TileUtils {
|
|||||||
getTilesForAction(context, user, MANUFACTURER_SETTINGS, cache,
|
getTilesForAction(context, user, MANUFACTURER_SETTINGS, cache,
|
||||||
MANUFACTURER_DEFAULT_CATEGORY, tiles, false);
|
MANUFACTURER_DEFAULT_CATEGORY, tiles, false);
|
||||||
}
|
}
|
||||||
|
if (setup) {
|
||||||
getTilesForAction(context, user, EXTRA_SETTINGS_ACTION, cache, null, tiles, false);
|
getTilesForAction(context, user, EXTRA_SETTINGS_ACTION, cache, null, tiles, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
HashMap<String, DashboardCategory> categoryMap = new HashMap<>();
|
HashMap<String, DashboardCategory> categoryMap = new HashMap<>();
|
||||||
for (Tile tile : tiles) {
|
for (Tile tile : tiles) {
|
||||||
DashboardCategory category = categoryMap.get(tile.category);
|
DashboardCategory category = categoryMap.get(tile.category);
|
||||||
|
|||||||
Reference in New Issue
Block a user