Merge "Rename ACTION_BROWSE_DOCUMENT_ROOT -> ACTION_BROWSE"
diff --git a/res/layout-land/dashboard_tile.xml b/res/layout-land/dashboard_tile.xml
deleted file mode 100644
index a817799..0000000
--- a/res/layout-land/dashboard_tile.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="@dimen/dashboard_tile_minimum_height">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:orientation="horizontal"
- android:gravity="center_vertical"
- android:layout_weight="1">
-
- <ImageView
- android:id="@+id/icon"
- android:layout_width="@dimen/dashboard_tile_image_size"
- android:layout_height="@dimen/dashboard_tile_image_size"
- android:scaleType="centerInside"
- android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
- android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end" />
-
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
-
- <TextView android:id="@+id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:textAppearance="@style/TextAppearance.TileTitle"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal" />
-
- <TextView android:id="@+id/status"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/title"
- android:layout_alignStart="@android:id/title"
- android:textAppearance="@style/TextAppearance.Small"
- android:textColor="?android:attr/textColorSecondary" />
-
- </RelativeLayout>
-
- </LinearLayout>
-
- <View android:id="@+id/tile_divider"
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:background="?android:attr/dividerVertical" />
-
- </LinearLayout>
-
-</LinearLayout>
\ No newline at end of file
diff --git a/res/layout-sw600dp/dashboard_tile.xml b/res/layout-sw600dp/dashboard_tile.xml
deleted file mode 100644
index a817799..0000000
--- a/res/layout-sw600dp/dashboard_tile.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="@dimen/dashboard_tile_minimum_height">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:orientation="horizontal"
- android:gravity="center_vertical"
- android:layout_weight="1">
-
- <ImageView
- android:id="@+id/icon"
- android:layout_width="@dimen/dashboard_tile_image_size"
- android:layout_height="@dimen/dashboard_tile_image_size"
- android:scaleType="centerInside"
- android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
- android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end" />
-
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
-
- <TextView android:id="@+id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:textAppearance="@style/TextAppearance.TileTitle"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal" />
-
- <TextView android:id="@+id/status"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/title"
- android:layout_alignStart="@android:id/title"
- android:textAppearance="@style/TextAppearance.Small"
- android:textColor="?android:attr/textColorSecondary" />
-
- </RelativeLayout>
-
- </LinearLayout>
-
- <View android:id="@+id/tile_divider"
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:background="?android:attr/dividerVertical" />
-
- </LinearLayout>
-
-</LinearLayout>
\ No newline at end of file
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 3dbfef9..af34647 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -297,7 +297,11 @@
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (!mUm.isAdminUser()
- || mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) {
+ || mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)
+ || Settings.Global.getInt(getActivity().getContentResolver(),
+ Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
+ // Block access to developer options if the user is not the owner, if user policy
+ // restricts it, or if the device has not been provisioned
mUnavailable = true;
setPreferenceScreen(new PreferenceScreen(getPrefContext(), null));
return;
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index d3c77f3..40be2e7 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -208,6 +208,12 @@
// Don't enable developer options for secondary users.
if (!mUm.isAdminUser()) return true;
+ // Don't enable developer options until device has been provisioned
+ if (Settings.Global.getInt(getActivity().getContentResolver(),
+ Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
+ return true;
+ }
+
if (mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) return true;
if (mDevHitCountdown > 0) {
diff --git a/src/com/android/settings/dashboard/DashboardContainerView.java b/src/com/android/settings/dashboard/DashboardContainerView.java
deleted file mode 100644
index af7e787..0000000
--- a/src/com/android/settings/dashboard/DashboardContainerView.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2014 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.dashboard;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.util.AttributeSet;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.android.settings.R;
-
-public class DashboardContainerView extends ViewGroup {
-
- private float mCellGapX;
- private float mCellGapY;
-
- private int mNumRows;
- private int mNumColumns;
-
- public DashboardContainerView(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- final Resources res = context.getResources();
- mCellGapX = res.getDimension(R.dimen.dashboard_cell_gap_x);
- mCellGapY = res.getDimension(R.dimen.dashboard_cell_gap_y);
- mNumColumns = res.getInteger(R.integer.dashboard_num_columns);
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- final int width = MeasureSpec.getSize(widthMeasureSpec);
- final int availableWidth = (int) (width - getPaddingLeft() - getPaddingRight() -
- (mNumColumns - 1) * mCellGapX);
- float cellWidth = (float) Math.ceil(((float) availableWidth) / mNumColumns);
- final int N = getChildCount();
-
- int cellHeight = 0;
- int cursor = 0;
-
- for (int i = 0; i < N; ++i) {
- DashboardTileView v = (DashboardTileView) getChildAt(i);
- if (v.getVisibility() == View.GONE) {
- continue;
- }
-
- ViewGroup.LayoutParams lp = v.getLayoutParams();
- int colSpan = v.getColumnSpan();
- lp.width = (int) ((colSpan * cellWidth) + (colSpan - 1) * mCellGapX);
-
- // Measure the child
- int newWidthSpec = getChildMeasureSpec(widthMeasureSpec, 0, lp.width);
- int newHeightSpec = getChildMeasureSpec(heightMeasureSpec, 0, lp.height);
- v.measure(newWidthSpec, newHeightSpec);
-
- // Save the cell height
- if (cellHeight <= 0) {
- cellHeight = v.getMeasuredHeight();
- }
-
- lp.height = cellHeight;
-
- cursor += colSpan;
- }
-
- mNumRows = (int) Math.ceil((float) cursor / mNumColumns);
- final int newHeight = (int) ((mNumRows * cellHeight) + ((mNumRows - 1) * mCellGapY)) +
- getPaddingTop() + getPaddingBottom();
-
- setMeasuredDimension(width, newHeight);
- }
-
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- final int N = getChildCount();
- final boolean isLayoutRtl = isLayoutRtl();
- final int width = getWidth();
-
- int x = getPaddingStart();
- int y = getPaddingTop();
- int cursor = 0;
-
- for (int i = 0; i < N; ++i) {
- final DashboardTileView child = (DashboardTileView) getChildAt(i);
- final ViewGroup.LayoutParams lp = child.getLayoutParams();
- if (child.getVisibility() == GONE) {
- continue;
- }
-
- final int col = cursor % mNumColumns;
- final int colSpan = child.getColumnSpan();
-
- final int childWidth = lp.width;
- final int childHeight = lp.height;
-
- int row = cursor / mNumColumns;
-
- if (row == mNumRows - 1) {
- child.setDividerVisibility(false);
- }
-
- // Push the item to the next row if it can't fit on this one
- if ((col + colSpan) > mNumColumns) {
- x = getPaddingStart();
- y += childHeight + mCellGapY;
- row++;
- }
-
- final int childLeft = (isLayoutRtl) ? width - x - childWidth : x;
- final int childRight = childLeft + childWidth;
-
- final int childTop = y;
- final int childBottom = childTop + childHeight;
-
- // Layout the container
- child.layout(childLeft, childTop, childRight, childBottom);
-
- // Offset the position by the cell gap or reset the position and cursor when we
- // reach the end of the row
- cursor += child.getColumnSpan();
- if (cursor < (((row + 1) * mNumColumns))) {
- x += childWidth + mCellGapX;
- } else {
- x = getPaddingStart();
- y += childHeight + mCellGapY;
- }
- }
- }
-}
diff --git a/src/com/android/settings/dashboard/DashboardTileView.java b/src/com/android/settings/dashboard/DashboardTileView.java
deleted file mode 100644
index 5239c06..0000000
--- a/src/com/android/settings/dashboard/DashboardTileView.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2014 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.dashboard;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.TextView;
-import com.android.settings.R;
-import com.android.settings.SettingsActivity;
-import com.android.settingslib.drawer.DashboardTile;
-
-public class DashboardTileView extends FrameLayout implements View.OnClickListener {
-
- private static final int DEFAULT_COL_SPAN = 1;
-
- private ImageView mImageView;
- private TextView mTitleTextView;
- private TextView mStatusTextView;
- private View mDivider;
-
- private int mColSpan = DEFAULT_COL_SPAN;
-
- private DashboardTile mTile;
-
- public DashboardTileView(Context context) {
- this(context, null);
- }
-
- public DashboardTileView(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- final View view = LayoutInflater.from(context).inflate(R.layout.dashboard_tile, this);
-
- mImageView = (ImageView) view.findViewById(R.id.icon);
- mTitleTextView = (TextView) view.findViewById(R.id.title);
- mStatusTextView = (TextView) view.findViewById(R.id.status);
- mDivider = view.findViewById(R.id.tile_divider);
-
- setOnClickListener(this);
- setBackgroundResource(R.drawable.dashboard_tile_background);
- setFocusable(true);
- }
-
- public TextView getTitleTextView() {
- return mTitleTextView;
- }
-
- public TextView getStatusTextView() {
- return mStatusTextView;
- }
-
- public ImageView getImageView() {
- return mImageView;
- }
-
- public void setTile(DashboardTile tile) {
- mTile = tile;
- }
-
- public void setDividerVisibility(boolean visible) {
- mDivider.setVisibility(visible ? View.VISIBLE : View.GONE);
- }
-
- void setColumnSpan(int span) {
- mColSpan = span;
- }
-
- int getColumnSpan() {
- return mColSpan;
- }
-
- @Override
- public void onClick(View v) {
- ((SettingsActivity) getContext()).openTile(mTile);
- }
-}