Merge "Guard double-showing of user credentials dialog" into nyc-dev
diff --git a/res/layout/delete_managed_profile_dialog.xml b/res/layout/delete_managed_profile_dialog.xml
index da763c9..0458f1d 100644
--- a/res/layout/delete_managed_profile_dialog.xml
+++ b/res/layout/delete_managed_profile_dialog.xml
@@ -41,15 +41,15 @@
android:layout_height="@dimen/mdm_app_info_height"
android:layout_alignParentLeft="true"
android:layout_centerInParent="true"
- android:layout_gravity="center_vertical"
+ android:layout_gravity="center_vertical|start"
android:orientation="horizontal"
android:paddingBottom="@dimen/mdm_app_info_padding_top_bottom"
android:paddingTop="@dimen/mdm_app_info_padding_top_bottom" >
<ImageView
android:id="@+id/delete_managed_profile_mdm_icon_view"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="@dimen/mdm_app_icon_width_height"
+ android:layout_height="@dimen/mdm_app_icon_width_height"
android:scaleType="centerInside"
android:gravity="center_vertical" />
@@ -58,7 +58,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
- android:paddingLeft="@dimen/mdm_app_name_padding_left"
+ android:paddingStart="@dimen/mdm_app_name_padding_left"
style="@style/TextAppearance.RemoveDialogContent" />
</LinearLayout>
diff --git a/res/layout/single_button_panel.xml b/res/layout/single_button_panel.xml
index 1ff5470..6673b0d 100755
--- a/res/layout/single_button_panel.xml
+++ b/res/layout/single_button_panel.xml
@@ -33,8 +33,7 @@
android:layout_width="120dip"
android:layout_weight="0.4"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- style="@android:style/Widget.Material.Button.Colored" />
+ android:layout_gravity="center_vertical" />
<Space
android:layout_width="0dip"
android:layout_height="wrap_content"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index a4e3401..9d739c0 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -247,6 +247,7 @@
<dimen name="mdm_app_info_height">72dp</dimen>
<dimen name="mdm_app_info_padding_top_bottom">8dp</dimen>
<dimen name="mdm_app_name_padding_left">16dp</dimen>
+ <dimen name="mdm_app_icon_width_height">56dp</dimen>
<dimen name="shortcut_size">40dp</dimen>
<dimen name="badge_size">10dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c726d0e..8c532f5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1005,7 +1005,7 @@
<string name="setup_lock_settings_picker_title">Protect your phone</string>
<!-- Title for screen in setup wizard, prompting user to choose the their backup screen lock method [CHAR LIMIT=NONE] -->
- <string name="setup_lock_settings_picker_fingerprint_message">Fingerprint may be less secure than a strong pattern, PIN or password. Set up a backup lock screen to be secure.</string>
+ <string name="setup_lock_settings_picker_fingerprint_message">Your fingerprint may be less secure than a strong pattern, PIN, or password. For added security, set up a backup screen lock.</string>
<!-- Description text for screen in setup wizard asking user to set up screen lock, explaining to the user how setting up a screen lock protect them from losing data. (tablet) [CHAR LIMIT=NONE] -->
<string name="setup_lock_settings_picker_message" product="tablet">Prevent others from using this tablet without your permission by activating device protection features. Choose the screen lock you want to use.</string>
diff --git a/src/com/android/settings/ChooseLockSettingsHelper.java b/src/com/android/settings/ChooseLockSettingsHelper.java
index 21d26eb..d3bf747 100644
--- a/src/com/android/settings/ChooseLockSettingsHelper.java
+++ b/src/com/android/settings/ChooseLockSettingsHelper.java
@@ -88,8 +88,8 @@
* @return true if one exists and we launched an activity to confirm it
* @see Activity#onActivityResult(int, int, android.content.Intent)
*/
- boolean launchConfirmationActivity(int request, CharSequence title, boolean returnCredentials,
- int userId) {
+ public boolean launchConfirmationActivity(int request, CharSequence title,
+ boolean returnCredentials, int userId) {
return launchConfirmationActivity(request, title, null, null,
returnCredentials, false, false, 0, Utils.enforceSameOwner(mActivity, userId));
}
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 75ad35d..c007891 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -1007,7 +1007,7 @@
flashLockState = mOemUnlockManager.getFlashLockState();
}
- return flashLockState == PersistentDataBlockManager.FLASH_LOCK_LOCKED;
+ return flashLockState != PersistentDataBlockManager.FLASH_LOCK_UNLOCKED;
}
private void updateOemUnlockOptions() {
diff --git a/src/com/android/settings/PreviewPagerAdapter.java b/src/com/android/settings/PreviewPagerAdapter.java
index a2e7b0e..485ac8f 100644
--- a/src/com/android/settings/PreviewPagerAdapter.java
+++ b/src/com/android/settings/PreviewPagerAdapter.java
@@ -49,10 +49,6 @@
Configuration[] configurations) {
mPreviewFrames = new FrameLayout[previewSampleResIds.length];
- // We need to get the copy of the original configuration before we call
- // createConfigurationContext() as that call changes the current configuration for the App.
- final Configuration origConfig = context.getResources().getConfiguration();
-
for (int i = 0; i < previewSampleResIds.length; ++i) {
mPreviewFrames[i] = new FrameLayout(context);
mPreviewFrames[i].setLayoutParams(new LinearLayout.LayoutParams(
@@ -76,10 +72,6 @@
mPreviewFrames[i].addView(sampleView);
}
}
-
- // Create a context with the original App configuration since the last configuration passed
- // to createConfigurationContext() becomes the configuration for any new views inflated.
- context.createConfigurationContext(origConfig);
}
@Override
diff --git a/src/com/android/settings/accounts/AddAccountSettings.java b/src/com/android/settings/accounts/AddAccountSettings.java
index 3f691e3..1cec53b 100644
--- a/src/com/android/settings/accounts/AddAccountSettings.java
+++ b/src/com/android/settings/accounts/AddAccountSettings.java
@@ -32,6 +32,7 @@
import android.util.Log;
import android.widget.Toast;
+import com.android.settings.ChooseLockSettingsHelper;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settingslib.RestrictedLockUtils;
@@ -83,6 +84,7 @@
private static final int CHOOSE_ACCOUNT_REQUEST = 1;
private static final int ADD_ACCOUNT_REQUEST = 2;
+ private static final int UNLOCK_WORK_PROFILE_REQUEST = 3;
private PendingIntent mPendingIntent;
@@ -154,24 +156,27 @@
finish();
return;
}
- final String[] authorities =
- getIntent().getStringArrayExtra(AccountPreferenceBase.AUTHORITIES_FILTER_KEY);
- final String[] accountTypes =
- getIntent().getStringArrayExtra(AccountPreferenceBase.ACCOUNT_TYPES_FILTER_KEY);
- final Intent intent = new Intent(this, ChooseAccountActivity.class);
- if (authorities != null) {
- intent.putExtra(AccountPreferenceBase.AUTHORITIES_FILTER_KEY, authorities);
+
+ // If the profile is locked, we must ask the user to unlock it first.
+ ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
+ if (!helper.launchConfirmationActivity(UNLOCK_WORK_PROFILE_REQUEST,
+ getString(R.string.unlock_set_unlock_launch_picker_title),
+ false,
+ mUserHandle.getIdentifier())) {
+ requestChooseAccount();
}
- if (accountTypes != null) {
- intent.putExtra(AccountPreferenceBase.ACCOUNT_TYPES_FILTER_KEY, accountTypes);
- }
- intent.putExtra(EXTRA_USER, mUserHandle);
- startActivityForResult(intent, CHOOSE_ACCOUNT_REQUEST);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
+ case UNLOCK_WORK_PROFILE_REQUEST:
+ if (resultCode == Activity.RESULT_OK) {
+ requestChooseAccount();
+ } else {
+ finish();
+ }
+ break;
case CHOOSE_ACCOUNT_REQUEST:
if (resultCode == RESULT_CANCELED) {
if (data != null) {
@@ -202,6 +207,22 @@
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "saved");
}
+ private void requestChooseAccount() {
+ final String[] authorities =
+ getIntent().getStringArrayExtra(AccountPreferenceBase.AUTHORITIES_FILTER_KEY);
+ final String[] accountTypes =
+ getIntent().getStringArrayExtra(AccountPreferenceBase.ACCOUNT_TYPES_FILTER_KEY);
+ final Intent intent = new Intent(this, ChooseAccountActivity.class);
+ if (authorities != null) {
+ intent.putExtra(AccountPreferenceBase.AUTHORITIES_FILTER_KEY, authorities);
+ }
+ if (accountTypes != null) {
+ intent.putExtra(AccountPreferenceBase.ACCOUNT_TYPES_FILTER_KEY, accountTypes);
+ }
+ intent.putExtra(EXTRA_USER, mUserHandle);
+ startActivityForResult(intent, CHOOSE_ACCOUNT_REQUEST);
+ }
+
private void addAccount(String accountType) {
Bundle addAccountOptions = new Bundle();
/*
diff --git a/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java b/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java
index a87b0d0..a5d0701 100644
--- a/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java
+++ b/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java
@@ -106,7 +106,7 @@
private static void animateChange(final View view, final View content,
final View detailGroup, final boolean visible) {
- final int beforeBottom = view.getBottom();
+ final int beforeBottom = content.getBottom();
setHeight(detailGroup, visible ? LayoutParams.WRAP_CONTENT : 0);
detailGroup.setVisibility(View.VISIBLE);
view.addOnLayoutChangeListener(new OnLayoutChangeListener() {
@@ -115,7 +115,7 @@
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
- final int afterBottom = v.getBottom();
+ final int afterBottom = content.getBottom();
v.removeOnLayoutChangeListener(this);
final ObjectAnimator animator = ObjectAnimator.ofInt(content, "bottom",
beforeBottom, afterBottom);
diff --git a/src/com/android/settings/users/EditUserPhotoController.java b/src/com/android/settings/users/EditUserPhotoController.java
index 01b553c..97a9937 100644
--- a/src/com/android/settings/users/EditUserPhotoController.java
+++ b/src/com/android/settings/users/EditUserPhotoController.java
@@ -37,6 +37,7 @@
import android.provider.MediaStore;
import android.support.v4.content.FileProvider;
import android.util.Log;
+import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
@@ -169,6 +170,7 @@
final int width = Math.max(mImageView.getWidth(), context.getResources()
.getDimensionPixelSize(R.dimen.update_user_photo_popup_min_width));
listPopupWindow.setWidth(width);
+ listPopupWindow.setDropDownGravity(Gravity.START);
listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override