Skip to content

Commit cb1610c

Browse files
Ed HeylAndroid Git Automerger
authored andcommitted
Merge branch 'master' of ssh://android-git:29418/platform/frameworks/base
2 parents 68901a3 + 1451f18 commit cb1610c

File tree

23 files changed

+328
-162
lines changed

23 files changed

+328
-162
lines changed

core/java/android/content/pm/VerifierDeviceIdentity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,15 @@ private static final long decodeBase32(byte[] input) throws IllegalArgumentExcep
153153
value = group - ('2' - 26);
154154
} else if (group == SEPARATOR) {
155155
continue;
156+
} else if ('a' <= group && group <= 'z') {
157+
/* Lowercase letters should be the same as uppercase for Base32 */
158+
value = group - 'a';
159+
} else if (group == '0') {
160+
/* Be nice to users that mistake O (letter) for 0 (zero) */
161+
value = 'O' - 'A';
162+
} else if (group == '1') {
163+
/* Be nice to users that mistake I (letter) for 1 (one) */
164+
value = 'I' - 'A';
156165
} else {
157166
throw new IllegalArgumentException("base base-32 character: " + group);
158167
}

core/java/android/widget/AutoCompleteTextView.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package android.widget;
1818

19-
import com.android.internal.R;
20-
2119
import android.content.Context;
2220
import android.content.res.TypedArray;
2321
import android.database.DataSetObserver;
@@ -38,6 +36,8 @@
3836
import android.view.inputmethod.EditorInfo;
3937
import android.view.inputmethod.InputMethodManager;
4038

39+
import com.android.internal.R;
40+
4141

4242
/**
4343
* <p>An editable text view that shows completion suggestions automatically
@@ -744,7 +744,6 @@ void doAfterTextChanged() {
744744
if (mFilter != null) {
745745
mPopupCanBeUpdated = true;
746746
performFiltering(getText(), mLastKeyCode);
747-
buildImeCompletions();
748747
}
749748
} else {
750749
// drop down is automatically dismissed when enough characters
@@ -837,10 +836,6 @@ public void performCompletion() {
837836
@Override
838837
public void onCommitCompletion(CompletionInfo completion) {
839838
if (isPopupShowing()) {
840-
mBlockCompletion = true;
841-
replaceText(completion.getText());
842-
mBlockCompletion = false;
843-
844839
mPopup.performItemClick(completion.getPosition());
845840
}
846841
}
@@ -938,7 +933,8 @@ private void updateDropDownForFilter(int count) {
938933
*/
939934

940935
final boolean dropDownAlwaysVisible = mPopup.isDropDownAlwaysVisible();
941-
if ((count > 0 || dropDownAlwaysVisible) && enoughToFilter()) {
936+
final boolean enoughToFilter = enoughToFilter();
937+
if ((count > 0 || dropDownAlwaysVisible) && enoughToFilter) {
942938
if (hasFocus() && hasWindowFocus() && mPopupCanBeUpdated) {
943939
showDropDown();
944940
}
@@ -1049,6 +1045,8 @@ public boolean isInputMethodNotNeeded() {
10491045
* <p>Displays the drop down on screen.</p>
10501046
*/
10511047
public void showDropDown() {
1048+
buildImeCompletions();
1049+
10521050
if (mPopup.getAnchorView() == null) {
10531051
if (mDropDownAnchorId != View.NO_ID) {
10541052
mPopup.setAnchorView(getRootView().findViewById(mDropDownAnchorId));
@@ -1064,7 +1062,7 @@ public void showDropDown() {
10641062
mPopup.show();
10651063
mPopup.getListView().setOverScrollMode(View.OVER_SCROLL_ALWAYS);
10661064
}
1067-
1065+
10681066
/**
10691067
* Forces outside touches to be ignored. Normally if {@link #isDropDownAlwaysVisible()} is
10701068
* false, we allow outside touch to dismiss the dropdown. If this is set to true, then we
@@ -1075,7 +1073,7 @@ public void showDropDown() {
10751073
public void setForceIgnoreOutsideTouch(boolean forceIgnoreOutsideTouch) {
10761074
mPopup.setForceIgnoreOutsideTouch(forceIgnoreOutsideTouch);
10771075
}
1078-
1076+
10791077
private void buildImeCompletions() {
10801078
final ListAdapter adapter = mAdapter;
10811079
if (adapter != null) {
@@ -1090,8 +1088,7 @@ private void buildImeCompletions() {
10901088
realCount++;
10911089
Object item = adapter.getItem(i);
10921090
long id = adapter.getItemId(i);
1093-
completions[i] = new CompletionInfo(id, i,
1094-
convertSelectionToString(item));
1091+
completions[i] = new CompletionInfo(id, i, convertSelectionToString(item));
10951092
}
10961093
}
10971094

core/java/android/widget/CalendarView.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,8 @@ public CalendarView(Context context, AttributeSet attrs, int defStyle) {
339339
// initialization based on locale
340340
setCurrentLocale(Locale.getDefault());
341341

342-
TypedValue calendarViewStyle = new TypedValue();
343-
context.getTheme().resolveAttribute(R.attr.calendarViewStyle, calendarViewStyle, true);
344-
TypedArray attributesArray = context.obtainStyledAttributes(calendarViewStyle.resourceId,
345-
R.styleable.CalendarView);
342+
TypedArray attributesArray = context.obtainStyledAttributes(attrs, R.styleable.CalendarView,
343+
R.attr.calendarViewStyle, 0);
346344
mShowWeekNumber = attributesArray.getBoolean(R.styleable.CalendarView_showWeekNumber,
347345
DEFAULT_SHOW_WEEK_NUMBER);
348346
mFirstDayOfWeek = attributesArray.getInt(R.styleable.CalendarView_firstDayOfWeek,
@@ -355,6 +353,9 @@ public CalendarView(Context context, AttributeSet attrs, int defStyle) {
355353
if (TextUtils.isEmpty(maxDate) || !parseDate(maxDate, mMaxDate)) {
356354
parseDate(DEFAULT_MAX_DATE, mMaxDate);
357355
}
356+
if (mMaxDate.before(mMinDate)) {
357+
throw new IllegalArgumentException("Max date cannot be before min date.");
358+
}
358359
mShownWeekCount = attributesArray.getInt(R.styleable.CalendarView_shownWeekCount,
359360
DEFAULT_SHOWN_WEEK_COUNT);
360361
mSelectedWeekBackgroundColor = attributesArray.getColor(
@@ -407,9 +408,16 @@ public CalendarView(Context context, AttributeSet attrs, int defStyle) {
407408
setUpListView();
408409
setUpAdapter();
409410

410-
// go to today now
411+
// go to today or whichever is close to today min or max date
411412
mTempDate.setTimeInMillis(System.currentTimeMillis());
412-
goTo(mTempDate, false, true, true);
413+
if (mTempDate.before(mMinDate)) {
414+
goTo(mMinDate, false, true, true);
415+
} else if (mMaxDate.before(mTempDate)) {
416+
goTo(mMaxDate, false, true, true);
417+
} else {
418+
goTo(mTempDate, false, true, true);
419+
}
420+
413421
invalidate();
414422
}
415423

core/java/android/widget/RelativeLayout.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ public void setIgnoreGravity(int viewId) {
212212
* Describes how the child views are positioned. Defaults to
213213
* <code>Gravity.LEFT | Gravity.TOP</code>.
214214
*
215+
* <p>Note that since RelativeLayout considers the positioning of each child
216+
* relative to one another to be significant, setting gravity will affect
217+
* the positioning of all children as a single unit within the parent.
218+
* This happens after children have been relatively positioned.</p>
219+
*
215220
* @param gravity See {@link android.view.Gravity}
216221
*
217222
* @see #setHorizontalGravity(int)

core/java/android/widget/TextView.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8939,14 +8939,8 @@ public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
89398939

89408940
final boolean isPassword = hasPasswordTransformationMethod();
89418941
if (!isPassword) {
8942-
CharSequence text = getText();
8942+
CharSequence text = getTextForAccessibility();
89438943
if (TextUtils.isEmpty(text)) {
8944-
text = getHint();
8945-
}
8946-
if (TextUtils.isEmpty(text)) {
8947-
text = getContentDescription();
8948-
}
8949-
if (!TextUtils.isEmpty(text)) {
89508944
event.getText().add(text);
89518945
}
89528946
}
@@ -8972,7 +8966,7 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
89728966

89738967
final boolean isPassword = hasPasswordTransformationMethod();
89748968
if (!isPassword) {
8975-
info.setText(getText());
8969+
info.setText(getTextForAccessibility());
89768970
}
89778971
info.setPassword(isPassword);
89788972
}
@@ -8988,6 +8982,20 @@ public void sendAccessibilityEvent(int eventType) {
89888982
super.sendAccessibilityEvent(eventType);
89898983
}
89908984

8985+
/**
8986+
* Gets the text reported for accessibility purposes. It is the
8987+
* text if not empty or the hint.
8988+
*
8989+
* @return The accessibility text.
8990+
*/
8991+
private CharSequence getTextForAccessibility() {
8992+
CharSequence text = getText();
8993+
if (TextUtils.isEmpty(text)) {
8994+
text = getHint();
8995+
}
8996+
return text;
8997+
}
8998+
89918999
void sendAccessibilityEventTypeViewTextChanged(CharSequence beforeText,
89929000
int fromIndex, int removedCount, int addedCount) {
89939001
AccessibilityEvent event =

core/java/com/android/internal/widget/LockPatternUtils.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -756,24 +756,36 @@ private static String toHex(byte[] ary) {
756756
}
757757

758758
/**
759-
* @return Whether the lock password is enabled.
759+
* @return Whether the lock password is enabled, or if it is set as a backup for biometric weak
760760
*/
761761
public boolean isLockPasswordEnabled() {
762762
long mode = getLong(PASSWORD_TYPE_KEY, 0);
763-
return savedPasswordExists() &&
764-
(mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC
765-
|| mode == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC
766-
|| mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
767-
|| mode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX);
763+
long backupMode = getLong(PASSWORD_TYPE_ALTERNATE_KEY, 0);
764+
final boolean passwordEnabled = mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC
765+
|| mode == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC
766+
|| mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
767+
|| mode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
768+
final boolean backupEnabled = backupMode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC
769+
|| backupMode == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC
770+
|| backupMode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
771+
|| backupMode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
772+
773+
return savedPasswordExists() && (passwordEnabled ||
774+
(isBiometricEnabled() && backupEnabled));
768775
}
769776

770777
/**
771-
* @return Whether the lock pattern is enabled.
778+
* @return Whether the lock pattern is enabled, or if it is set as a backup for biometric weak
772779
*/
773780
public boolean isLockPatternEnabled() {
781+
final boolean backupEnabled =
782+
getLong(PASSWORD_TYPE_ALTERNATE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
783+
== DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
784+
774785
return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED)
775-
&& getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
776-
== DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
786+
&& (getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
787+
== DevicePolicyManager.PASSWORD_QUALITY_SOMETHING ||
788+
(isBiometricEnabled() && backupEnabled));
777789
}
778790

779791
/**
@@ -923,8 +935,7 @@ public boolean isSecure() {
923935
|| mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
924936
|| mode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
925937
final boolean secure = isPattern && isLockPatternEnabled() && savedPatternExists()
926-
|| isPassword && savedPasswordExists()
927-
|| usingBiometricWeak() && isBiometricEnabled();
938+
|| isPassword && savedPasswordExists();
928939
return secure;
929940
}
930941

0 commit comments

Comments
 (0)